1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
21 #define FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
23 #include <tools/solar.h>
24 #include <sal/types.h>
25 #include <svl/poolitem.hxx>
30 //====================================================================
32 //====================================================================
33 /// the id of an attribute
34 typedef sal_Int32 AttributeId
;
35 /// the "which id" of an item in an SfxItemSet
36 typedef sal_uInt16 WhichId
;
38 typedef sal_uInt16 SfxSlotId
;
40 typedef sal_uInt16 ScriptType
;
42 //====================================================================
43 //= AttributeCheckState
44 //====================================================================
45 enum AttributeCheckState
52 //====================================================================
54 //====================================================================
58 SfxItemHandle
* pItemHandle
;
61 AttributeCheckState eSimpleState
;
63 inline AttributeState( );
64 inline explicit AttributeState( AttributeCheckState _eCheckState
);
65 inline AttributeState( const AttributeState
& _rSource
);
66 inline ~AttributeState( );
68 inline AttributeState
& operator=( const AttributeState
& _rSource
);
70 inline bool operator==( const AttributeState
& _rRHS
);
72 inline const SfxPoolItem
* getItem() const;
73 inline void setItem( const SfxPoolItem
* _pItem
);
76 //====================================================================
77 //= AttributeState (inline implementation)
78 //====================================================================
79 inline AttributeState::AttributeState( )
81 ,eSimpleState( eIndetermined
)
85 inline AttributeState::AttributeState( AttributeCheckState _eCheckState
)
87 ,eSimpleState( _eCheckState
)
91 inline AttributeState::AttributeState( const AttributeState
& _rSource
)
93 ,eSimpleState( eIndetermined
)
95 operator=( _rSource
);
98 inline AttributeState::~AttributeState( )
103 inline AttributeState
& AttributeState::operator=( const AttributeState
& _rSource
)
105 if ( &_rSource
== this )
108 eSimpleState
= _rSource
.eSimpleState
;
109 setItem( _rSource
.getItem() );
113 inline const SfxPoolItem
* AttributeState::getItem() const
115 return pItemHandle
? &pItemHandle
->GetItem() : NULL
;
118 inline void AttributeState::setItem( const SfxPoolItem
* _pItem
)
123 pItemHandle
= new SfxItemHandle( *const_cast< SfxPoolItem
* >( _pItem
) );
128 inline bool AttributeState::operator==( const AttributeState
& _rRHS
)
130 if ( eSimpleState
!= _rRHS
.eSimpleState
)
133 if ( pItemHandle
&& !_rRHS
.pItemHandle
)
136 if ( !pItemHandle
&& _rRHS
.pItemHandle
)
139 if ( !pItemHandle
&& !_rRHS
.pItemHandle
)
142 return ( pItemHandle
->GetItem() == _rRHS
.pItemHandle
->GetItem() );
145 //====================================================================
146 //= IMultiAttributeDispatcher
147 //====================================================================
148 class IMultiAttributeDispatcher
151 virtual AttributeState
getState( AttributeId _nAttributeId
) const = 0;
152 virtual void executeAttribute( AttributeId _nAttributeId
, const SfxPoolItem
* _pArgument
) = 0;
155 ~IMultiAttributeDispatcher() {}
160 #endif // FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */