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 .
22 #include "rtattributes.hxx"
23 #include <rtl/ref.hxx>
24 #include <svl/languageoptions.hxx>
25 #include <editeng/svxenum.hxx>
26 #include <editeng/frmdir.hxx>
27 #include <salhelper/simplereferenceobject.hxx>
36 class AttributeHandler
: public salhelper::SimpleReferenceObject
39 AttributeId m_nAttribute
;
43 AttributeId
getAttribute() const { return m_nAttribute
; }
44 WhichId
getWhich() const { return m_nWhich
; }
47 AttributeHandler( AttributeId _nAttributeId
, WhichId _nWhichId
);
49 AttributeId
getAttributeId( ) const;
50 virtual AttributeState
getState( const SfxItemSet
& _rAttribs
) const;
51 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const = 0;
54 /// helper method calling implGetCheckState
55 AttributeCheckState
getCheckState( const SfxItemSet
& _rAttribs
) const;
57 /// helper method putting an item into a set, respecting a script type
58 void putItemForScript( SfxItemSet
& _rAttribs
, const SfxPoolItem
& _rItem
, SvtScriptType _nForScriptType
) const;
61 virtual AttributeCheckState
implGetCheckState( const SfxPoolItem
& _rItem
) const;
64 virtual ~AttributeHandler() override
;
67 namespace AttributeHandlerFactory
69 ::rtl::Reference
< AttributeHandler
> getHandlerFor( AttributeId _nAttributeId
, const SfxItemPool
& _rEditEnginePool
);
72 class ParaAlignmentHandler
: public AttributeHandler
78 explicit ParaAlignmentHandler( AttributeId _nAttributeId
);
81 virtual AttributeCheckState
implGetCheckState( const SfxPoolItem
& _rItem
) const override
;
82 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const override
;
85 class LineSpacingHandler
: public AttributeHandler
88 sal_uInt16 m_nLineSpace
;
91 explicit LineSpacingHandler( AttributeId _nAttributeId
);
94 virtual AttributeCheckState
implGetCheckState( const SfxPoolItem
& _rItem
) const override
;
95 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const override
;
98 class EscapementHandler
: public AttributeHandler
101 SvxEscapement m_eEscapement
;
104 explicit EscapementHandler( AttributeId _nAttributeId
);
107 virtual AttributeCheckState
implGetCheckState( const SfxPoolItem
& _rItem
) const override
;
108 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const override
;
111 class SlotHandler
: public AttributeHandler
114 bool m_bScriptDependent
;
117 SlotHandler( AttributeId _nAttributeId
, WhichId _nWhichId
);
120 virtual AttributeState
getState( const SfxItemSet
& _rAttribs
) const override
;
121 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const override
;
124 class BooleanHandler
: public AttributeHandler
127 BooleanHandler( AttributeId _nAttributeId
, WhichId _nWhichId
);
130 virtual AttributeCheckState
implGetCheckState( const SfxPoolItem
& _rItem
) const override
;
131 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const override
;
134 class FontSizeHandler
: public AttributeHandler
137 FontSizeHandler( AttributeId _nAttributeId
, WhichId _nWhichId
);
140 virtual AttributeState
getState( const SfxItemSet
& _rAttribs
) const override
;
141 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const override
;
144 class ParagraphDirectionHandler
: public AttributeHandler
147 SvxFrameDirection m_eParagraphDirection
;
148 SvxAdjust m_eDefaultAdjustment
;
149 SvxAdjust m_eOppositeDefaultAdjustment
;
152 explicit ParagraphDirectionHandler( AttributeId _nAttributeId
);
155 virtual AttributeCheckState
implGetCheckState( const SfxPoolItem
& _rItem
) const override
;
156 virtual void executeAttribute( const SfxItemSet
& _rCurrentAttribs
, SfxItemSet
& _rNewAttribs
, const SfxPoolItem
* _pAdditionalArg
, SvtScriptType _nForScriptType
) const override
;
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */