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 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>
37 class AttributeHandler
: public salhelper::SimpleReferenceObject
40 AttributeId m_nAttribute
;
44 AttributeId
getAttribute() const { return m_nAttribute
; }
45 WhichId
getWhich() const { return m_nWhich
; }
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;
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;
62 virtual AttributeCheckState
implGetCheckState( const SfxPoolItem
& _rItem
) const;
65 virtual ~AttributeHandler();
68 namespace AttributeHandlerFactory
70 ::rtl::Reference
< AttributeHandler
> getHandlerFor( AttributeId _nAttributeId
, const SfxItemPool
& _rEditEnginePool
);
73 class ParaAlignmentHandler
: public AttributeHandler
79 explicit ParaAlignmentHandler( AttributeId _nAttributeId
);
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
89 sal_uInt16 m_nLineSpace
;
92 explicit LineSpacingHandler( AttributeId _nAttributeId
);
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
102 SvxEscapement m_eEscapement
;
105 explicit EscapementHandler( AttributeId _nAttributeId
);
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
115 bool m_bScriptDependent
;
118 SlotHandler( AttributeId _nAttributeId
, WhichId _nWhichId
);
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
128 BooleanHandler( AttributeId _nAttributeId
, WhichId _nWhichId
);
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
138 FontSizeHandler( AttributeId _nAttributeId
, WhichId _nWhichId
);
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
148 SvxFrameDirection m_eParagraphDirection
;
149 SvxAdjust m_eDefaultAdjustment
;
150 SvxAdjust m_eOppositeDefaultAdjustment
;
153 explicit ParagraphDirectionHandler( AttributeId _nAttributeId
);
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
;
164 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTEHANDLER_HXX
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */