Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / forms / source / richtext / rtattributehandler.hxx
blob70118a8bbca444f52d146426c68de2a8f79ed1c1
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_RTATTRIBUTEHANDLER_HXX
21 #define INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTEHANDLER_HXX
23 #include "rtattributes.hxx"
24 #include <rtl/ref.hxx>
25 #include <svl/languageoptions.hxx>
26 #include <editeng/svxenum.hxx>
27 #include <editeng/frmdir.hxx>
28 #include <salhelper/simplereferenceobject.hxx>
30 class SfxItemSet;
31 class SfxPoolItem;
32 class SfxItemPool;
34 namespace frm
37 class AttributeHandler : public salhelper::SimpleReferenceObject
39 private:
40 AttributeId m_nAttribute;
41 WhichId m_nWhich;
43 protected:
44 AttributeId getAttribute() const { return m_nAttribute; }
45 WhichId getWhich() const { return m_nWhich; }
47 public:
48 AttributeHandler( AttributeId _nAttributeId, WhichId _nWhichId );
50 AttributeId getAttributeId( ) const;
51 virtual AttributeState getState( const SfxItemSet& _rAttribs ) const;
52 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const = 0;
54 protected:
55 /// helper method calling implGetCheckState
56 AttributeCheckState getCheckState( const SfxItemSet& _rAttribs ) const;
58 /// helper method putting an item into a set, respecting a script type
59 void putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, SvtScriptType _nForScriptType ) const;
61 // pseudo-abstract
62 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
64 protected:
65 virtual ~AttributeHandler();
68 namespace AttributeHandlerFactory
70 ::rtl::Reference< AttributeHandler > getHandlerFor( AttributeId _nAttributeId, const SfxItemPool& _rEditEnginePool );
73 class ParaAlignmentHandler : public AttributeHandler
75 private:
76 SvxAdjust m_eAdjust;
78 public:
79 explicit ParaAlignmentHandler( AttributeId _nAttributeId );
81 public:
82 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
83 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
86 class LineSpacingHandler : public AttributeHandler
88 private:
89 sal_uInt16 m_nLineSpace;
91 public:
92 explicit LineSpacingHandler( AttributeId _nAttributeId );
94 public:
95 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
96 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
99 class EscapementHandler : public AttributeHandler
101 private:
102 SvxEscapement m_eEscapement;
104 public:
105 explicit EscapementHandler( AttributeId _nAttributeId );
107 public:
108 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
109 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
112 class SlotHandler : public AttributeHandler
114 private:
115 bool m_bScriptDependent;
117 public:
118 SlotHandler( AttributeId _nAttributeId, WhichId _nWhichId );
120 public:
121 virtual AttributeState getState( const SfxItemSet& _rAttribs ) const override;
122 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
125 class BooleanHandler : public AttributeHandler
127 public:
128 BooleanHandler( AttributeId _nAttributeId, WhichId _nWhichId );
130 public:
131 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
132 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
135 class FontSizeHandler : public AttributeHandler
137 public:
138 FontSizeHandler( AttributeId _nAttributeId, WhichId _nWhichId );
140 public:
141 virtual AttributeState getState( const SfxItemSet& _rAttribs ) const override;
142 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
145 class ParagraphDirectionHandler : public AttributeHandler
147 private:
148 SvxFrameDirection m_eParagraphDirection;
149 SvxAdjust m_eDefaultAdjustment;
150 SvxAdjust m_eOppositeDefaultAdjustment;
152 public:
153 explicit ParagraphDirectionHandler( AttributeId _nAttributeId );
155 public:
156 virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const override;
157 virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const override;
161 } // namespace frm
164 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTEHANDLER_HXX
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */