1*2d785d7eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d785d7eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d785d7eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d785d7eSAndrew Rist * distributed with this work for additional information 6*2d785d7eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d785d7eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d785d7eSAndrew Rist * "License"); you may not use this file except in compliance 9*2d785d7eSAndrew Rist * with the License. You may obtain a copy of the License at 10*2d785d7eSAndrew Rist * 11*2d785d7eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2d785d7eSAndrew Rist * 13*2d785d7eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d785d7eSAndrew Rist * software distributed under the License is distributed on an 15*2d785d7eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d785d7eSAndrew Rist * KIND, either express or implied. See the License for the 17*2d785d7eSAndrew Rist * specific language governing permissions and limitations 18*2d785d7eSAndrew Rist * under the License. 19*2d785d7eSAndrew Rist * 20*2d785d7eSAndrew Rist *************************************************************/ 21*2d785d7eSAndrew Rist 22*2d785d7eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef FORMS_SOURCE_COMPONENT_RTATTRIBUTEHANDLER_HXX 25cdf0e10cSrcweir #define FORMS_SOURCE_COMPONENT_RTATTRIBUTEHANDLER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "rtattributes.hxx" 28cdf0e10cSrcweir #include <rtl/ref.hxx> 29cdf0e10cSrcweir #include <editeng/svxenum.hxx> 30cdf0e10cSrcweir #include <editeng/frmdir.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir class SfxItemSet; 33cdf0e10cSrcweir class SfxPoolItem; 34cdf0e10cSrcweir class SfxItemPool; 35cdf0e10cSrcweir //........................................................................ 36cdf0e10cSrcweir namespace frm 37cdf0e10cSrcweir { 38cdf0e10cSrcweir //........................................................................ 39cdf0e10cSrcweir 40cdf0e10cSrcweir //==================================================================== 41cdf0e10cSrcweir //= ReferenceBase 42cdf0e10cSrcweir //==================================================================== 43cdf0e10cSrcweir class ReferenceBase : public ::rtl::IReference 44cdf0e10cSrcweir { 45cdf0e10cSrcweir protected: 46cdf0e10cSrcweir oslInterlockedCount m_refCount; 47cdf0e10cSrcweir 48cdf0e10cSrcweir public: 49cdf0e10cSrcweir // IReference 50cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire(); 51cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release(); 52cdf0e10cSrcweir 53cdf0e10cSrcweir protected: 54cdf0e10cSrcweir virtual ~ReferenceBase(); 55cdf0e10cSrcweir }; 56cdf0e10cSrcweir 57cdf0e10cSrcweir //==================================================================== 58cdf0e10cSrcweir //= IAttributeHandler 59cdf0e10cSrcweir //==================================================================== 60cdf0e10cSrcweir class IAttributeHandler : public ::rtl::IReference 61cdf0e10cSrcweir { 62cdf0e10cSrcweir public: 63cdf0e10cSrcweir virtual AttributeId getAttributeId( ) const = 0; 64cdf0e10cSrcweir virtual AttributeState getState( const SfxItemSet& _rAttribs ) const = 0; 65cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0; 66cdf0e10cSrcweir }; 67cdf0e10cSrcweir 68cdf0e10cSrcweir //==================================================================== 69cdf0e10cSrcweir //= AttributeHandler 70cdf0e10cSrcweir //==================================================================== 71cdf0e10cSrcweir class AttributeHandler :public ReferenceBase 72cdf0e10cSrcweir ,public IAttributeHandler 73cdf0e10cSrcweir { 74cdf0e10cSrcweir private: 75cdf0e10cSrcweir AttributeId m_nAttribute; 76cdf0e10cSrcweir WhichId m_nWhich; 77cdf0e10cSrcweir 78cdf0e10cSrcweir protected: getAttribute() const79cdf0e10cSrcweir AttributeId getAttribute() const { return m_nAttribute; } getWhich() const80cdf0e10cSrcweir WhichId getWhich() const { return m_nWhich; } 81cdf0e10cSrcweir 82cdf0e10cSrcweir public: 83cdf0e10cSrcweir AttributeHandler( AttributeId _nAttributeId, WhichId _nWhichId ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir // IAttributeHandler 86cdf0e10cSrcweir virtual AttributeId getAttributeId( ) const; 87cdf0e10cSrcweir virtual AttributeState getState( const SfxItemSet& _rAttribs ) const; 88cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0; 89cdf0e10cSrcweir 90cdf0e10cSrcweir protected: 91cdf0e10cSrcweir /// helper method calling implGetCheckState 92cdf0e10cSrcweir AttributeCheckState getCheckState( const SfxItemSet& _rAttribs ) const; 93cdf0e10cSrcweir 94cdf0e10cSrcweir /// helper method putting an item into a set, respecting a script type 95cdf0e10cSrcweir void putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, ScriptType _nForScriptType ) const; 96cdf0e10cSrcweir 97cdf0e10cSrcweir // pseudo-abstract 98cdf0e10cSrcweir virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; 99cdf0e10cSrcweir 100cdf0e10cSrcweir // disambiguate IReference 101cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire(); 102cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release(); 103cdf0e10cSrcweir 104cdf0e10cSrcweir protected: 105cdf0e10cSrcweir virtual ~AttributeHandler(); 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir //==================================================================== 109cdf0e10cSrcweir //= AttributeHandlerFactory 110cdf0e10cSrcweir //==================================================================== 111cdf0e10cSrcweir class AttributeHandlerFactory 112cdf0e10cSrcweir { 113cdf0e10cSrcweir public: 114cdf0e10cSrcweir static ::rtl::Reference< IAttributeHandler > getHandlerFor( AttributeId _nAttributeId, const SfxItemPool& _rEditEnginePool ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir private: 117cdf0e10cSrcweir AttributeHandlerFactory(); // never implemented 118cdf0e10cSrcweir AttributeHandlerFactory( const AttributeHandlerFactory& ); // never implemented 119cdf0e10cSrcweir AttributeHandlerFactory& operator=( const AttributeHandlerFactory& ); // never implemented 120cdf0e10cSrcweir ~AttributeHandlerFactory(); // never implemented 121cdf0e10cSrcweir }; 122cdf0e10cSrcweir 123cdf0e10cSrcweir //==================================================================== 124cdf0e10cSrcweir //= ParaAlignmentHandler 125cdf0e10cSrcweir //==================================================================== 126cdf0e10cSrcweir class ParaAlignmentHandler : public AttributeHandler 127cdf0e10cSrcweir { 128cdf0e10cSrcweir private: 129cdf0e10cSrcweir SvxAdjust m_eAdjust; 130cdf0e10cSrcweir 131cdf0e10cSrcweir public: 132cdf0e10cSrcweir ParaAlignmentHandler( AttributeId _nAttributeId ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir public: 135cdf0e10cSrcweir virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; 136cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const; 137cdf0e10cSrcweir }; 138cdf0e10cSrcweir 139cdf0e10cSrcweir //==================================================================== 140cdf0e10cSrcweir //= LineSpacingHandler 141cdf0e10cSrcweir //==================================================================== 142cdf0e10cSrcweir class LineSpacingHandler : public AttributeHandler 143cdf0e10cSrcweir { 144cdf0e10cSrcweir private: 145cdf0e10cSrcweir sal_uInt16 m_nLineSpace; 146cdf0e10cSrcweir 147cdf0e10cSrcweir public: 148cdf0e10cSrcweir LineSpacingHandler( AttributeId _nAttributeId ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir public: 151cdf0e10cSrcweir virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; 152cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const; 153cdf0e10cSrcweir }; 154cdf0e10cSrcweir 155cdf0e10cSrcweir //==================================================================== 156cdf0e10cSrcweir //= EscapementHandler 157cdf0e10cSrcweir //==================================================================== 158cdf0e10cSrcweir class EscapementHandler : public AttributeHandler 159cdf0e10cSrcweir { 160cdf0e10cSrcweir private: 161cdf0e10cSrcweir SvxEscapement m_eEscapement; 162cdf0e10cSrcweir 163cdf0e10cSrcweir public: 164cdf0e10cSrcweir EscapementHandler( AttributeId _nAttributeId ); 165cdf0e10cSrcweir 166cdf0e10cSrcweir public: 167cdf0e10cSrcweir virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; 168cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const; 169cdf0e10cSrcweir }; 170cdf0e10cSrcweir 171cdf0e10cSrcweir //==================================================================== 172cdf0e10cSrcweir //= SlotHandler 173cdf0e10cSrcweir //==================================================================== 174cdf0e10cSrcweir class SlotHandler : public AttributeHandler 175cdf0e10cSrcweir { 176cdf0e10cSrcweir private: 177cdf0e10cSrcweir bool m_bScriptDependent; 178cdf0e10cSrcweir 179cdf0e10cSrcweir public: 180cdf0e10cSrcweir SlotHandler( AttributeId _nAttributeId, WhichId _nWhichId ); 181cdf0e10cSrcweir 182cdf0e10cSrcweir public: 183cdf0e10cSrcweir virtual AttributeState getState( const SfxItemSet& _rAttribs ) const; 184cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const; 185cdf0e10cSrcweir }; 186cdf0e10cSrcweir 187cdf0e10cSrcweir //==================================================================== 188cdf0e10cSrcweir //= BooleanHandler 189cdf0e10cSrcweir //==================================================================== 190cdf0e10cSrcweir class BooleanHandler : public AttributeHandler 191cdf0e10cSrcweir { 192cdf0e10cSrcweir public: 193cdf0e10cSrcweir BooleanHandler( AttributeId _nAttributeId, WhichId _nWhichId ); 194cdf0e10cSrcweir 195cdf0e10cSrcweir public: 196cdf0e10cSrcweir virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; 197cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const; 198cdf0e10cSrcweir }; 199cdf0e10cSrcweir 200cdf0e10cSrcweir //==================================================================== 201cdf0e10cSrcweir //= FontSizeHandler 202cdf0e10cSrcweir //==================================================================== 203cdf0e10cSrcweir class FontSizeHandler : public AttributeHandler 204cdf0e10cSrcweir { 205cdf0e10cSrcweir public: 206cdf0e10cSrcweir FontSizeHandler( AttributeId _nAttributeId, WhichId _nWhichId ); 207cdf0e10cSrcweir 208cdf0e10cSrcweir public: 209cdf0e10cSrcweir virtual AttributeState getState( const SfxItemSet& _rAttribs ) const; 210cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const; 211cdf0e10cSrcweir }; 212cdf0e10cSrcweir 213cdf0e10cSrcweir //==================================================================== 214cdf0e10cSrcweir //= ParagraphDirectionHandler 215cdf0e10cSrcweir //==================================================================== 216cdf0e10cSrcweir class ParagraphDirectionHandler : public AttributeHandler 217cdf0e10cSrcweir { 218cdf0e10cSrcweir private: 219cdf0e10cSrcweir SvxFrameDirection m_eParagraphDirection; 220cdf0e10cSrcweir SvxAdjust m_eDefaultAdjustment; 221cdf0e10cSrcweir SvxAdjust m_eOppositeDefaultAdjustment; 222cdf0e10cSrcweir 223cdf0e10cSrcweir public: 224cdf0e10cSrcweir ParagraphDirectionHandler( AttributeId _nAttributeId ); 225cdf0e10cSrcweir 226cdf0e10cSrcweir public: 227cdf0e10cSrcweir virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const; 228cdf0e10cSrcweir virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const; 229cdf0e10cSrcweir }; 230cdf0e10cSrcweir 231cdf0e10cSrcweir //........................................................................ 232cdf0e10cSrcweir } // namespace frm 233cdf0e10cSrcweir //........................................................................ 234cdf0e10cSrcweir 235cdf0e10cSrcweir #endif // FORMS_SOURCE_COMPONENT_RTATTRIBUTEHANDLER_HXX 236cdf0e10cSrcweir 237