LibreOffice Module sw (master)  1
paratr.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
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>
37 #include <editeng/hngpnctitem.hxx>
40 #include <editeng/pgrditem.hxx>
41 
42 class IntlWrapper;
43 
44 #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
45 
51 {
54  sal_uInt16 m_nDistance;
57  bool m_bWholeWord;
58 public:
59  static SfxPoolItem* CreateDefault();
60 
61  SwFormatDrop();
62  virtual ~SwFormatDrop() override;
63 
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;
69 
70 protected:
71  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
72 
73 public:
74 
76  virtual bool operator==( const SfxPoolItem& ) const override;
77  virtual SfxPoolItem* 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;
85 
86  sal_uInt8 GetLines() const { return m_nLines; }
87  sal_uInt8 &GetLines() { return m_nLines; }
88 
89  sal_uInt8 GetChars() const { return m_nChars; }
90  sal_uInt8 &GetChars() { return m_nChars; }
91 
92  bool GetWholeWord() const { return m_bWholeWord; }
93  bool &GetWholeWord() { return m_bWholeWord; }
94 
95  sal_uInt16 GetDistance() const { return m_nDistance; }
96  sal_uInt16 &GetDistance() { return m_nDistance; }
97 
98  const SwCharFormat *GetCharFormat() const { return static_cast<const SwCharFormat*>(GetRegisteredIn()); }
99  SwCharFormat *GetCharFormat() { return static_cast<SwCharFormat*>(GetRegisteredIn()); }
100  void SetCharFormat( SwCharFormat *pNew );
102  virtual bool GetInfo( SfxPoolItem& ) const override;
103 
105  const SwModify* GetDefinedIn() const { return m_pDefinedIn; }
106  void ChgDefinedIn( const SwModify* pNew )
107  { m_pDefinedIn = const_cast<SwModify*>(pNew); }
108 };
109 
111 {
112 public:
113  static SfxPoolItem* CreateDefault();
114 
115  inline SwRegisterItem( const bool bRegister = false );
116 
118  virtual SfxPoolItem* 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;
124 };
125 
126 inline SwRegisterItem::SwRegisterItem( const bool bRegister ) :
127  SfxBoolItem( RES_PARATR_REGISTER, bRegister )
128 {}
129 
131 {
132 public:
133  static SfxPoolItem* CreateDefault();
134 
136  : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {}
137 
138  SwNumRuleItem( const OUString& rRuleName )
139  : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
140 
141  SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy
142 
144  virtual bool operator==( const SfxPoolItem& ) const override;
145  virtual SfxPoolItem* 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;
151 
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;
154 
155  void dumpAsXml(xmlTextWriterPtr pWriter) const override;
156 };
157 
159 {
160 public:
161 
162  inline SwParaConnectBorderItem( const bool bConnect = true );
163 
165  virtual SfxPoolItem* 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;
171 };
172 
175 {}
176 
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); }
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 ); }
209  { return Get( RES_PARATR_CONNECT_BORDER, bInP ); }
210 
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); }
220 
221 #endif
222 
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:196
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
"pure virtual methods" of SfxPoolItem
Definition: paratr.cxx:194
const SvxHyphenZoneItem & GetHyphenZone(bool=true) const
Definition: paratr.hxx:192
const SvxTabStopItem & GetTabStops(bool=true) const
Definition: paratr.hxx:214
const SwFormatDrop & GetDrop(bool=true) const
Definition: paratr.hxx:194
bool GetWholeWord() const
Definition: paratr.hxx:92
const SvxForbiddenRuleItem & GetForbiddenRule(bool=true) const
Definition: paratr.hxx:202
sal_uInt16 m_nDistance
Distance to beginning of text.
Definition: paratr.hxx:54
SwParaConnectBorderItem(const bool bConnect=true)
Definition: paratr.hxx:173
virtual bool operator==(const SfxPoolItem &) const =0
const SvxTabStopItem & GetTabStops(bool=true) const
Definition: paratr.hxx:190
SwRegisterItem(const bool bRegister=false)
Definition: paratr.hxx:126
bool & GetWholeWord()
Definition: paratr.hxx:93
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
sal_uInt8 m_nChars
Character count.
Definition: paratr.hxx:56
sal_uInt16 & GetDistance()
Definition: paratr.hxx:96
sal_uInt8 GetLines() const
Definition: paratr.hxx:86
#define RES_PARATR_VERTALIGN
Definition: hintids.hxx:175
#define RES_PARATR_FORBIDDEN_RULES
Definition: hintids.hxx:174
const SwParaConnectBorderItem & GetParaConnectBorder(bool=true) const
Definition: paratr.hxx:208
const SvxOrphansItem & GetOrphans(bool=true) const
Definition: paratr.hxx:188
SwCharFormat * GetCharFormat()
Definition: paratr.hxx:99
SfxPoolItem & operator=(const SfxPoolItem &)=delete
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:172
#define RES_PARATR_REGISTER
Definition: hintids.hxx:170
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Paragraph-attributes - implemented in paratr.hxx.
Definition: paratr.hxx:212
virtual bool operator==(const SfxPoolItem &rItem) const override
SwAttrSet m_aSet
Definition: format.hxx:48
#define RES_PARATR_SPLIT
Definition: hintids.hxx:164
void dumpAsXml(xmlTextWriterPtr pWriter) const override
void ChgDefinedIn(const SwModify *pNew)
Definition: paratr.hxx:106
sal_uInt8 & GetLines()
Definition: paratr.hxx:87
#define RES_PARATR_HANGINGPUNCTUATION
Definition: hintids.hxx:173
#define RES_PARATR_CONNECT_BORDER
Definition: hintids.hxx:177
const SwRegisterItem & GetRegister(bool=true) const
Definition: paratr.hxx:184
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
#define RES_PARATR_TABSTOP
Definition: hintids.hxx:167
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
"pure virtual methods" of SfxPoolItem
Definition: paratr.cxx:233
const SvxFormatSplitItem & GetSplit(bool=true) const
Definition: paratr.hxx:182
static SfxPoolItem * CreateDefault()
sal_uInt16 GetDistance() const
Definition: paratr.hxx:95
#define RES_PARATR_NUMRULE
Definition: hintids.hxx:171
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
#define RES_PARATR_SNAPTOGRID
Definition: hintids.hxx:176
const SvxHangingPunctuationItem & GetHangingPunctuation(bool=true) const
Definition: paratr.hxx:200
struct _xmlTextWriter * xmlTextWriterPtr
SfxItemPresentation
const SwFormatDrop & GetDrop(bool=true) const
Definition: paratr.hxx:216
const SvxParaVertAlignItem & GetParaVertAlign(bool=true) const
Definition: paratr.hxx:204
sal_uInt8 m_nLines
Line count.
Definition: paratr.hxx:55
#define RES_PARATR_HYPHENZONE
Definition: hintids.hxx:168
#define RES_PARATR_ORPHANS
Definition: hintids.hxx:165
#define RES_PARATR_SCRIPTSPACE
Definition: hintids.hxx:172
const SvxAdjustItem & GetAdjust(bool=true) const
Definition: paratr.hxx:180
const SvxWidowsItem & GetWidows(bool=true) const
Definition: paratr.hxx:186
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:178
sal_uInt8 & GetChars()
Definition: paratr.hxx:90
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
sal_uInt8 GetChars() const
Definition: paratr.hxx:89
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
SwNumRuleItem(const OUString &rRuleName)
Definition: paratr.hxx:138
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:218
const SwModify * GetDefinedIn() const
Get and set Modify pointer.
Definition: paratr.hxx:105
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:203
unsigned char sal_uInt8
const SvxParaGridItem & GetParaGrid(bool=true) const
Definition: paratr.hxx:206
const SvxScriptSpaceItem & GetScriptSpace(bool=true) const
Definition: paratr.hxx:198
static SfxPoolItem * CreateDefault()
Definition: paratr.cxx:37
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
#define RES_PARATR_ADJUST
Definition: hintids.hxx:163
virtual SfxPoolItem * Clone(SfxItemPool *=nullptr) const override
SwModify * m_pDefinedIn
Modify-Object, that contains DropCaps.
Definition: paratr.hxx:52
virtual bool GetInfo(SfxPoolItem &) const
Definition: calbck.hxx:164
#define RES_PARATR_WIDOWS
Definition: hintids.hxx:166
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
MapUnit
const SwCharFormat * GetCharFormat() const
Definition: paratr.hxx:98
#define RES_PARATR_DROP
Definition: hintids.hxx:169
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps...
Definition: paratr.hxx:50
bool m_bWholeWord
First word with initials.
Definition: paratr.hxx:57
virtual void Modify(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.cxx:130
#define RES_PARATR_LINESPACING
Definition: hintids.hxx:162