Bump version to 21.06.18.1
[LibreOffice.git] / sw / inc / paratr.hxx
blob1c6bcf4de0fc365ab1449952b4606b0ca250c300
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 .
19 #ifndef INCLUDED_SW_INC_PARATR_HXX
20 #define INCLUDED_SW_INC_PARATR_HXX
21 #include <svl/eitem.hxx>
22 #include <svl/stritem.hxx>
23 #include "swdllapi.h"
24 #include "hintids.hxx"
25 #include "calbck.hxx"
26 #include "swatrset.hxx"
27 #include "format.hxx"
28 #include "charfmt.hxx"
29 #include <editeng/adjustitem.hxx>
30 #include <editeng/lspcitem.hxx>
31 #include <editeng/spltitem.hxx>
32 #include <editeng/widwitem.hxx>
33 #include <editeng/orphitem.hxx>
34 #include <editeng/tstpitem.hxx>
35 #include <editeng/hyphenzoneitem.hxx>
36 #include <editeng/scriptspaceitem.hxx>
37 #include <editeng/hngpnctitem.hxx>
38 #include <editeng/forbiddenruleitem.hxx>
39 #include <editeng/paravertalignitem.hxx>
40 #include <editeng/pgrditem.hxx>
42 class IntlWrapper;
44 #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
46 /** If SwFormatDrop is a Client, it is the CharFormat that describes the font for the
47 DropCaps. If it is not a Client, formatting uses the CharFormat of the paragraph.
48 If the CharFormat is modified, this change is propagated to the paragraphs
49 via the Modify of SwFormatDrop. */
50 class SW_DLLPUBLIC SwFormatDrop: public SfxPoolItem, public SwClient
52 sw::BroadcastingModify* m_pDefinedIn; /**< Modify-Object, that contains DropCaps.
53 Can only be TextFormatCollection/TextNode. */
54 sal_uInt16 m_nDistance; ///< Distance to beginning of text.
55 sal_uInt8 m_nLines; ///< Line count.
56 sal_uInt8 m_nChars; ///< Character count.
57 bool m_bWholeWord; ///< First word with initials.
58 public:
59 static SfxPoolItem* CreateDefault();
61 SwFormatDrop();
62 virtual ~SwFormatDrop() override;
64 // @@@ public copy ctor, but no copy assignment?
65 SwFormatDrop( const SwFormatDrop & );
66 private:
67 // @@@ public copy ctor, but no copy assignment?
68 SwFormatDrop & operator= (const SwFormatDrop &) = delete;
70 protected:
71 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
73 public:
75 /// "pure virtual methods" of SfxPoolItem
76 virtual bool operator==( const SfxPoolItem& ) const override;
77 virtual SwFormatDrop* Clone( SfxItemPool* pPool = nullptr ) const override;
78 virtual bool GetPresentation( SfxItemPresentation ePres,
79 MapUnit eCoreMetric,
80 MapUnit ePresMetric,
81 OUString &rText,
82 const IntlWrapper& rIntl ) const override;
83 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
84 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
86 sal_uInt8 GetLines() const { return m_nLines; }
87 sal_uInt8 &GetLines() { return m_nLines; }
89 sal_uInt8 GetChars() const { return m_nChars; }
90 sal_uInt8 &GetChars() { return m_nChars; }
92 bool GetWholeWord() const { return m_bWholeWord; }
93 bool &GetWholeWord() { return m_bWholeWord; }
95 sal_uInt16 GetDistance() const { return m_nDistance; }
96 sal_uInt16 &GetDistance() { return m_nDistance; }
98 const SwCharFormat *GetCharFormat() const { return static_cast<const SwCharFormat*>(GetRegisteredIn()); }
99 SwCharFormat *GetCharFormat() { return static_cast<SwCharFormat*>(GetRegisteredIn()); }
100 void SetCharFormat( SwCharFormat *pNew );
101 /// Get information from Client.
102 virtual bool GetInfo( SfxPoolItem& ) const override;
104 /// Get and set Modify pointer.
105 const sw::BroadcastingModify* GetDefinedIn() const { return m_pDefinedIn; }
106 void ChgDefinedIn( const sw::BroadcastingModify* pNew )
107 { m_pDefinedIn = const_cast<sw::BroadcastingModify*>(pNew); }
110 class SwRegisterItem : public SfxBoolItem
112 public:
113 static SfxPoolItem* CreateDefault();
115 inline SwRegisterItem( const bool bRegister = false );
117 /// "pure virtual methods" of SfxPoolItem
118 virtual SwRegisterItem* Clone( SfxItemPool *pPool = nullptr ) const override;
119 virtual bool GetPresentation( SfxItemPresentation ePres,
120 MapUnit eCoreMetric,
121 MapUnit ePresMetric,
122 OUString &rText,
123 const IntlWrapper& rIntl ) const override;
126 inline SwRegisterItem::SwRegisterItem( const bool bRegister ) :
127 SfxBoolItem( RES_PARATR_REGISTER, bRegister )
130 class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem
132 public:
133 static SfxPoolItem* CreateDefault();
135 SwNumRuleItem()
136 : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {}
138 SwNumRuleItem( const OUString& rRuleName )
139 : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
141 SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy
143 /// "pure virtual methods" of SfxPoolItem
144 virtual bool operator==( const SfxPoolItem& ) const override;
145 virtual SwNumRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override;
146 virtual bool GetPresentation( SfxItemPresentation ePres,
147 MapUnit eCoreMetric,
148 MapUnit ePresMetric,
149 OUString &rText,
150 const IntlWrapper& rIntl ) const override;
152 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
153 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
155 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
158 class SwParaConnectBorderItem : public SfxBoolItem
160 public:
162 inline SwParaConnectBorderItem( const bool bConnect = true );
164 /// "pure virtual methods" of SfxPoolItem
165 virtual SwParaConnectBorderItem* Clone( SfxItemPool *pPool = nullptr ) const override;
166 virtual bool GetPresentation( SfxItemPresentation ePres,
167 MapUnit eCoreMetric,
168 MapUnit ePresMetric,
169 OUString &rText,
170 const IntlWrapper& rIntl ) const override;
173 inline SwParaConnectBorderItem::SwParaConnectBorderItem( const bool bConnect ) :
174 SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect )
177 // Implementation of paragraph-attributes methods of SwAttrSet
178 inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const
179 { return Get( RES_PARATR_LINESPACING,bInP); }
180 inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const
181 { return Get( RES_PARATR_ADJUST,bInP); }
182 inline const SvxFormatSplitItem &SwAttrSet::GetSplit(bool bInP) const
183 { return Get( RES_PARATR_SPLIT,bInP); }
184 inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const
185 { return Get( RES_PARATR_REGISTER,bInP); }
186 inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const
187 { return Get( RES_PARATR_WIDOWS,bInP); }
188 inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const
189 { return Get( RES_PARATR_ORPHANS,bInP); }
190 inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const
191 { return Get( RES_PARATR_TABSTOP,bInP); }
192 inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const
193 { return Get(RES_PARATR_HYPHENZONE,bInP); }
194 inline const SwFormatDrop &SwAttrSet::GetDrop(bool bInP) const
195 { return Get(RES_PARATR_DROP,bInP); }
196 inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const
197 { return Get(RES_PARATR_NUMRULE,bInP); }
198 inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const
199 { return Get(RES_PARATR_SCRIPTSPACE,bInP); }
200 inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(bool bInP) const
201 { return Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
202 inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const
203 { return Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
204 inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const
205 { return Get( RES_PARATR_VERTALIGN, bInP ); }
206 inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const
207 { return Get( RES_PARATR_SNAPTOGRID, bInP ); }
208 inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(bool bInP) const
209 { return Get( RES_PARATR_CONNECT_BORDER, bInP ); }
211 // Implementation of paragraph-attributes methods of SwFormat
212 inline const SvxLineSpacingItem &SwFormat::GetLineSpacing(bool bInP) const
213 { return m_aSet.GetLineSpacing(bInP); }
214 inline const SvxTabStopItem &SwFormat::GetTabStops(bool bInP) const
215 { return m_aSet.GetTabStops(bInP); }
216 inline const SwFormatDrop &SwFormat::GetDrop(bool bInP) const
217 { return m_aSet.GetDrop(bInP); }
218 inline const SwNumRuleItem &SwFormat::GetNumRule(bool bInP) const
219 { return m_aSet.GetNumRule(bInP); }
221 #endif
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */