Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef FORMS_SOURCE_COMPONENT_RTATTRIBUTEHANDLER_HXX
30 : : #define FORMS_SOURCE_COMPONENT_RTATTRIBUTEHANDLER_HXX
31 : :
32 : : #include "rtattributes.hxx"
33 : : #include <rtl/ref.hxx>
34 : : #include <editeng/svxenum.hxx>
35 : : #include <editeng/frmdir.hxx>
36 : :
37 : : class SfxItemSet;
38 : : class SfxPoolItem;
39 : : class SfxItemPool;
40 : : //........................................................................
41 : : namespace frm
42 : : {
43 : : //........................................................................
44 : :
45 : : //====================================================================
46 : : //= ReferenceBase
47 : : //====================================================================
48 : 0 : class ReferenceBase : public ::rtl::IReference
49 : : {
50 : : protected:
51 : : oslInterlockedCount m_refCount;
52 : :
53 : : public:
54 : : // IReference
55 : : virtual oslInterlockedCount SAL_CALL acquire();
56 : : virtual oslInterlockedCount SAL_CALL release();
57 : :
58 : : protected:
59 : : virtual ~ReferenceBase();
60 : : };
61 : :
62 : : //====================================================================
63 : : //= IAttributeHandler
64 : : //====================================================================
65 : 0 : class IAttributeHandler : public ::rtl::IReference
66 : : {
67 : : public:
68 : : virtual AttributeId getAttributeId( ) const = 0;
69 : : virtual AttributeState getState( const SfxItemSet& _rAttribs ) const = 0;
70 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0;
71 : :
72 : : protected:
73 : 0 : ~IAttributeHandler() {}
74 : : };
75 : :
76 : : //====================================================================
77 : : //= AttributeHandler
78 : : //====================================================================
79 : : class AttributeHandler :public ReferenceBase
80 : : ,public IAttributeHandler
81 : : {
82 : : private:
83 : : AttributeId m_nAttribute;
84 : : WhichId m_nWhich;
85 : :
86 : : protected:
87 : 0 : AttributeId getAttribute() const { return m_nAttribute; }
88 : 0 : WhichId getWhich() const { return m_nWhich; }
89 : :
90 : : public:
91 : : AttributeHandler( AttributeId _nAttributeId, WhichId _nWhichId );
92 : :
93 : : // IAttributeHandler
94 : : virtual AttributeId getAttributeId( ) const;
95 : : virtual AttributeState getState( const SfxItemSet& _rAttribs ) const;
96 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0;
97 : :
98 : : protected:
99 : : /// helper method calling implGetCheckState
100 : : AttributeCheckState getCheckState( const SfxItemSet& _rAttribs ) const;
101 : :
102 : : /// helper method putting an item into a set, respecting a script type
103 : : void putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, ScriptType _nForScriptType ) const;
104 : :
105 : : // pseudo-abstract
106 : : virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
107 : :
108 : : // disambiguate IReference
109 : : virtual oslInterlockedCount SAL_CALL acquire();
110 : : virtual oslInterlockedCount SAL_CALL release();
111 : :
112 : : protected:
113 : : virtual ~AttributeHandler();
114 : : };
115 : :
116 : : //====================================================================
117 : : //= AttributeHandlerFactory
118 : : //====================================================================
119 : : class AttributeHandlerFactory
120 : : {
121 : : public:
122 : : static ::rtl::Reference< IAttributeHandler > getHandlerFor( AttributeId _nAttributeId, const SfxItemPool& _rEditEnginePool );
123 : :
124 : : private:
125 : : AttributeHandlerFactory(); // never implemented
126 : : AttributeHandlerFactory( const AttributeHandlerFactory& ); // never implemented
127 : : AttributeHandlerFactory& operator=( const AttributeHandlerFactory& ); // never implemented
128 : : ~AttributeHandlerFactory(); // never implemented
129 : : };
130 : :
131 : : //====================================================================
132 : : //= ParaAlignmentHandler
133 : : //====================================================================
134 [ # # ]: 0 : class ParaAlignmentHandler : public AttributeHandler
135 : : {
136 : : private:
137 : : SvxAdjust m_eAdjust;
138 : :
139 : : public:
140 : : ParaAlignmentHandler( AttributeId _nAttributeId );
141 : :
142 : : public:
143 : : virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
144 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const;
145 : : };
146 : :
147 : : //====================================================================
148 : : //= LineSpacingHandler
149 : : //====================================================================
150 [ # # ]: 0 : class LineSpacingHandler : public AttributeHandler
151 : : {
152 : : private:
153 : : sal_uInt16 m_nLineSpace;
154 : :
155 : : public:
156 : : LineSpacingHandler( AttributeId _nAttributeId );
157 : :
158 : : public:
159 : : virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
160 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const;
161 : : };
162 : :
163 : : //====================================================================
164 : : //= EscapementHandler
165 : : //====================================================================
166 [ # # ]: 0 : class EscapementHandler : public AttributeHandler
167 : : {
168 : : private:
169 : : SvxEscapement m_eEscapement;
170 : :
171 : : public:
172 : : EscapementHandler( AttributeId _nAttributeId );
173 : :
174 : : public:
175 : : virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
176 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const;
177 : : };
178 : :
179 : : //====================================================================
180 : : //= SlotHandler
181 : : //====================================================================
182 [ # # ]: 0 : class SlotHandler : public AttributeHandler
183 : : {
184 : : private:
185 : : bool m_bScriptDependent;
186 : :
187 : : public:
188 : : SlotHandler( AttributeId _nAttributeId, WhichId _nWhichId );
189 : :
190 : : public:
191 : : virtual AttributeState getState( const SfxItemSet& _rAttribs ) const;
192 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const;
193 : : };
194 : :
195 : : //====================================================================
196 : : //= BooleanHandler
197 : : //====================================================================
198 [ # # ]: 0 : class BooleanHandler : public AttributeHandler
199 : : {
200 : : public:
201 : : BooleanHandler( AttributeId _nAttributeId, WhichId _nWhichId );
202 : :
203 : : public:
204 : : virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
205 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const;
206 : : };
207 : :
208 : : //====================================================================
209 : : //= FontSizeHandler
210 : : //====================================================================
211 [ # # ]: 0 : class FontSizeHandler : public AttributeHandler
212 : : {
213 : : public:
214 : : FontSizeHandler( AttributeId _nAttributeId, WhichId _nWhichId );
215 : :
216 : : public:
217 : : virtual AttributeState getState( const SfxItemSet& _rAttribs ) const;
218 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const;
219 : : };
220 : :
221 : : //====================================================================
222 : : //= ParagraphDirectionHandler
223 : : //====================================================================
224 [ # # ]: 0 : class ParagraphDirectionHandler : public AttributeHandler
225 : : {
226 : : private:
227 : : SvxFrameDirection m_eParagraphDirection;
228 : : SvxAdjust m_eDefaultAdjustment;
229 : : SvxAdjust m_eOppositeDefaultAdjustment;
230 : :
231 : : public:
232 : : ParagraphDirectionHandler( AttributeId _nAttributeId );
233 : :
234 : : public:
235 : : virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
236 : : virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const;
237 : : };
238 : :
239 : : //........................................................................
240 : : } // namespace frm
241 : : //........................................................................
242 : :
243 : : #endif // FORMS_SOURCE_COMPONENT_RTATTRIBUTEHANDLER_HXX
244 : :
245 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|