nss: upgrade to release 3.73
[LibreOffice.git] / forms / source / richtext / rtattributes.hxx
blobfc514580a64a7c949e85dff32145e0482fee218b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
21 #define INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
23 #include <sal/types.h>
24 #include <svl/poolitem.hxx>
26 namespace frm
29 /// the id of an attribute
30 typedef sal_Int32 AttributeId;
31 /// the "which id" of an item in an SfxItemSet
32 typedef sal_uInt16 WhichId;
33 /// a SFX slot id
34 typedef sal_uInt16 SfxSlotId;
36 enum AttributeCheckState
38 eChecked,
39 eUnchecked,
40 eIndetermined
43 struct AttributeState
45 private:
46 std::unique_ptr<SfxPoolItem> pItemHandleItem;
48 public:
49 AttributeCheckState eSimpleState;
51 inline AttributeState( );
52 inline explicit AttributeState( AttributeCheckState _eCheckState );
53 inline AttributeState( const AttributeState& _rSource );
55 inline AttributeState& operator=( const AttributeState& _rSource );
57 inline bool operator==( const AttributeState& _rRHS );
59 inline const SfxPoolItem* getItem() const;
60 inline void setItem( const SfxPoolItem* _pItem );
63 inline AttributeState::AttributeState( )
64 :eSimpleState( eIndetermined )
68 inline AttributeState::AttributeState( AttributeCheckState _eCheckState )
69 :eSimpleState( _eCheckState )
73 inline AttributeState::AttributeState( const AttributeState& _rSource )
74 :eSimpleState( eIndetermined )
76 operator=( _rSource );
79 inline AttributeState& AttributeState::operator=( const AttributeState& _rSource )
81 if ( &_rSource == this )
82 return *this;
84 eSimpleState = _rSource.eSimpleState;
85 setItem( _rSource.getItem() );
86 return *this;
89 inline const SfxPoolItem* AttributeState::getItem() const
91 return pItemHandleItem.get();
94 inline void AttributeState::setItem( const SfxPoolItem* _pItem )
96 if ( _pItem )
97 pItemHandleItem.reset(_pItem->Clone());
98 else
99 pItemHandleItem.reset();
102 inline bool AttributeState::operator==( const AttributeState& _rRHS )
104 if ( eSimpleState != _rRHS.eSimpleState )
105 return false;
107 if ( pItemHandleItem && !_rRHS.pItemHandleItem )
108 return false;
110 if ( !pItemHandleItem && _rRHS.pItemHandleItem )
111 return false;
113 if ( pItemHandleItem == _rRHS.pItemHandleItem )
114 return true;
116 return *pItemHandleItem == *_rRHS.pItemHandleItem;
119 class IMultiAttributeDispatcher
121 public:
122 virtual AttributeState getState( AttributeId _nAttributeId ) const = 0;
123 virtual void executeAttribute( AttributeId _nAttributeId, const SfxPoolItem* _pArgument ) = 0;
125 protected:
126 ~IMultiAttributeDispatcher() {}
129 } // namespace frm
131 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */