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 SwTextNode;
43 class IntlWrapper;
44 
45 #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
46 
47 class SwFormatDrop;
48 
49 namespace sw {
51  protected:
52  virtual ~FormatDropDefiner() {};
53  public:
54  virtual void FormatDropNotify(const SwFormatDrop&) =0;
55  };
56 }
57 
63 {
65  sal_uInt16 m_nDistance;
68  bool m_bWholeWord;
69 public:
70  static SfxPoolItem* CreateDefault();
71 
72  SwFormatDrop();
73  virtual ~SwFormatDrop() override;
74 
75  // @@@ public copy ctor, but no copy assignment?
76  SwFormatDrop( const SwFormatDrop & );
77 private:
78  // @@@ public copy ctor, but no copy assignment?
79  SwFormatDrop & operator= (const SwFormatDrop &) = delete;
80 
81 protected:
82  virtual void SwClientNotify(const SwModify&, const SfxHint&) override
83  {
84  if (!m_pDefinedIn)
85  return;
86  m_pDefinedIn->FormatDropNotify(*this);
87  }
88 
89 public:
90 
92  virtual bool operator==( const SfxPoolItem& ) const override;
93  virtual SwFormatDrop* Clone( SfxItemPool* pPool = nullptr ) const override;
94  virtual bool GetPresentation( SfxItemPresentation ePres,
95  MapUnit eCoreMetric,
96  MapUnit ePresMetric,
97  OUString &rText,
98  const IntlWrapper& rIntl ) const override;
99  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
100  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
101 
102  sal_uInt8 GetLines() const { return m_nLines; }
103  sal_uInt8 &GetLines() { return m_nLines; }
104 
105  sal_uInt8 GetChars() const { return m_nChars; }
106  sal_uInt8 &GetChars() { return m_nChars; }
107 
108  bool GetWholeWord() const { return m_bWholeWord; }
109  bool &GetWholeWord() { return m_bWholeWord; }
110 
111  sal_uInt16 GetDistance() const { return m_nDistance; }
112  sal_uInt16 &GetDistance() { return m_nDistance; }
113 
114  const SwCharFormat *GetCharFormat() const { return static_cast<const SwCharFormat*>(GetRegisteredIn()); }
115  SwCharFormat *GetCharFormat() { return static_cast<SwCharFormat*>(GetRegisteredIn()); }
116  void SetCharFormat( SwCharFormat *pNew );
118  virtual bool GetInfo( SfxPoolItem& ) const override;
119 
122  { return m_pDefinedIn; };
123  void ChgDefinedIn( const sw::FormatDropDefiner* pDefiner )
124  { m_pDefinedIn = const_cast<sw::FormatDropDefiner*>(pDefiner); };
125 };
126 
128 {
129 public:
130  static SfxPoolItem* CreateDefault();
131 
132  inline SwRegisterItem( const bool bRegister = false );
133 
135  virtual SwRegisterItem* Clone( SfxItemPool *pPool = nullptr ) const override;
136  virtual bool GetPresentation( SfxItemPresentation ePres,
137  MapUnit eCoreMetric,
138  MapUnit ePresMetric,
139  OUString &rText,
140  const IntlWrapper& rIntl ) const override;
141 };
142 
143 inline SwRegisterItem::SwRegisterItem( const bool bRegister ) :
144  SfxBoolItem( RES_PARATR_REGISTER, bRegister )
145 {}
146 
148 {
149 public:
150  static SfxPoolItem* CreateDefault();
151 
153  : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {}
154 
155  SwNumRuleItem( const OUString& rRuleName )
156  : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
157 
158  SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy
159 
161  virtual bool operator==( const SfxPoolItem& ) const override;
162  virtual SwNumRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override;
163  virtual bool GetPresentation( SfxItemPresentation ePres,
164  MapUnit eCoreMetric,
165  MapUnit ePresMetric,
166  OUString &rText,
167  const IntlWrapper& rIntl ) const override;
168 
169  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
170  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
171 
172  void dumpAsXml(xmlTextWriterPtr pWriter) const override;
173 };
174 
176 {
177 public:
178 
179  inline SwParaConnectBorderItem( const bool bConnect = true );
180 
182  virtual SwParaConnectBorderItem* Clone( SfxItemPool *pPool = nullptr ) const override;
183  virtual bool GetPresentation( SfxItemPresentation ePres,
184  MapUnit eCoreMetric,
185  MapUnit ePresMetric,
186  OUString &rText,
187  const IntlWrapper& rIntl ) const override;
188 };
189 
192 {}
193 
194 // Implementation of paragraph-attributes methods of SwAttrSet
195 inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const
196  { return Get( RES_PARATR_LINESPACING,bInP); }
197 inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const
198  { return Get( RES_PARATR_ADJUST,bInP); }
199 inline const SvxFormatSplitItem &SwAttrSet::GetSplit(bool bInP) const
200  { return Get( RES_PARATR_SPLIT,bInP); }
201 inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const
202  { return Get( RES_PARATR_REGISTER,bInP); }
203 inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const
204  { return Get( RES_PARATR_WIDOWS,bInP); }
205 inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const
206  { return Get( RES_PARATR_ORPHANS,bInP); }
207 inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const
208  { return Get( RES_PARATR_TABSTOP,bInP); }
209 inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const
210  { return Get(RES_PARATR_HYPHENZONE,bInP); }
211 inline const SwFormatDrop &SwAttrSet::GetDrop(bool bInP) const
212  { return Get(RES_PARATR_DROP,bInP); }
213 inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const
214  { return Get(RES_PARATR_NUMRULE,bInP); }
215 inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const
216  { return Get(RES_PARATR_SCRIPTSPACE,bInP); }
218  { return Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
219 inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const
220  { return Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
221 inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const
222  { return Get( RES_PARATR_VERTALIGN, bInP ); }
223 inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const
224  { return Get( RES_PARATR_SNAPTOGRID, bInP ); }
226  { return Get( RES_PARATR_CONNECT_BORDER, bInP ); }
227 
228 // Implementation of paragraph-attributes methods of SwFormat
229 inline const SvxLineSpacingItem &SwFormat::GetLineSpacing(bool bInP) const
230  { return m_aSet.GetLineSpacing(bInP); }
231 inline const SvxTabStopItem &SwFormat::GetTabStops(bool bInP) const
232  { return m_aSet.GetTabStops(bInP); }
233 inline const SwFormatDrop &SwFormat::GetDrop(bool bInP) const
234  { return m_aSet.GetDrop(bInP); }
235 inline const SwNumRuleItem &SwFormat::GetNumRule(bool bInP) const
236  { return m_aSet.GetNumRule(bInP); }
237 
238 #endif
239 
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:213
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
const SvxHyphenZoneItem & GetHyphenZone(bool=true) const
Definition: paratr.hxx:209
const SvxTabStopItem & GetTabStops(bool=true) const
Definition: paratr.hxx:231
const SwFormatDrop & GetDrop(bool=true) const
Definition: paratr.hxx:211
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
bool GetWholeWord() const
Definition: paratr.hxx:108
const SvxForbiddenRuleItem & GetForbiddenRule(bool=true) const
Definition: paratr.hxx:219
constexpr TypedWhichId< SvxParaGridItem > RES_PARATR_SNAPTOGRID(77)
sal_uInt16 m_nDistance
Distance to beginning of text.
Definition: paratr.hxx:65
SwParaConnectBorderItem(const bool bConnect=true)
Definition: paratr.hxx:190
virtual bool operator==(const SfxPoolItem &) const =0
const SvxTabStopItem & GetTabStops(bool=true) const
Definition: paratr.hxx:207
SwRegisterItem(const bool bRegister=false)
Definition: paratr.hxx:143
bool & GetWholeWord()
Definition: paratr.hxx:109
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
sal_uInt8 m_nChars
Character count.
Definition: paratr.hxx:67
sal_uInt16 & GetDistance()
Definition: paratr.hxx:112
sal_uInt8 GetLines() const
Definition: paratr.hxx:102
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
const SwParaConnectBorderItem & GetParaConnectBorder(bool=true) const
Definition: paratr.hxx:225
constexpr TypedWhichId< SwRegisterItem > RES_PARATR_REGISTER(71)
const SvxOrphansItem & GetOrphans(bool=true) const
Definition: paratr.hxx:205
SwCharFormat * GetCharFormat()
Definition: paratr.hxx:115
SfxPoolItem & operator=(const SfxPoolItem &)=delete
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrdesc.cxx:170
constexpr TypedWhichId< SvxHangingPunctuationItem > RES_PARATR_HANGINGPUNCTUATION(74)
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Paragraph-attributes - implemented in paratr.hxx.
Definition: paratr.hxx:229
virtual bool operator==(const SfxPoolItem &rItem) const override
Dialog to specify the properties of date form field.
virtual SwParaConnectBorderItem * Clone(SfxItemPool *pPool=nullptr) const override
"pure virtual methods" of SfxPoolItem
Definition: paratr.cxx:216
SwAttrSet m_aSet
Definition: format.hxx:48
void dumpAsXml(xmlTextWriterPtr pWriter) const override
sal_uInt8 & GetLines()
Definition: paratr.hxx:103
const SwRegisterItem & GetRegister(bool=true) const
Definition: paratr.hxx:201
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
const sw::FormatDropDefiner * GetDefinedIn() const
Get and set Modify pointer.
Definition: paratr.hxx:121
constexpr TypedWhichId< SwFormatDrop > RES_PARATR_DROP(70)
const SvxFormatSplitItem & GetSplit(bool=true) const
Definition: paratr.hxx:199
static SfxPoolItem * CreateDefault()
virtual SfxStringItem * Clone(SfxItemPool *=nullptr) const override
sal_uInt16 GetDistance() const
Definition: paratr.hxx:111
virtual void FormatDropNotify(const SwFormatDrop &)=0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
const SvxHangingPunctuationItem & GetHangingPunctuation(bool=true) const
Definition: paratr.hxx:217
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
constexpr TypedWhichId< SvxParaVertAlignItem > RES_PARATR_VERTALIGN(76)
struct _xmlTextWriter * xmlTextWriterPtr
SfxItemPresentation
const SwFormatDrop & GetDrop(bool=true) const
Definition: paratr.hxx:233
const SvxParaVertAlignItem & GetParaVertAlign(bool=true) const
Definition: paratr.hxx:221
sal_uInt8 m_nLines
Line count.
Definition: paratr.hxx:66
const SvxAdjustItem & GetAdjust(bool=true) const
Definition: paratr.hxx:197
virtual ~FormatDropDefiner()
Definition: paratr.hxx:52
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
const SvxWidowsItem & GetWidows(bool=true) const
Definition: paratr.hxx:203
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:195
sal_uInt8 & GetChars()
Definition: paratr.hxx:106
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
sal_uInt8 GetChars() const
Definition: paratr.hxx:105
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
SwNumRuleItem(const OUString &rRuleName)
Definition: paratr.hxx:155
sw::FormatDropDefiner * m_pDefinedIn
TextNode or FormatColl that contains the CapDrops.
Definition: paratr.hxx:64
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:235
constexpr TypedWhichId< SvxScriptSpaceItem > RES_PARATR_SCRIPTSPACE(73)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
constexpr TypedWhichId< SvxOrphansItem > RES_PARATR_ORPHANS(66)
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:201
constexpr TypedWhichId< SvxFormatSplitItem > RES_PARATR_SPLIT(65)
unsigned char sal_uInt8
constexpr TypedWhichId< SvxForbiddenRuleItem > RES_PARATR_FORBIDDEN_RULES(75)
const SvxParaGridItem & GetParaGrid(bool=true) const
Definition: paratr.hxx:223
const SvxScriptSpaceItem & GetScriptSpace(bool=true) const
Definition: paratr.hxx:215
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: paratr.hxx:82
void ChgDefinedIn(const sw::FormatDropDefiner *pDefiner)
Definition: paratr.hxx:123
static SfxPoolItem * CreateDefault()
Definition: paratr.cxx:35
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:163
virtual SwRegisterItem * Clone(SfxItemPool *pPool=nullptr) const override
"pure virtual methods" of SfxPoolItem
Definition: paratr.cxx:176
virtual bool GetInfo(SfxPoolItem &) const
Definition: calbck.hxx:170
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
MapUnit
const SwCharFormat * GetCharFormat() const
Definition: paratr.hxx:114
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps...
Definition: paratr.hxx:62
constexpr TypedWhichId< SwParaConnectBorderItem > RES_PARATR_CONNECT_BORDER(78)
bool m_bWholeWord
First word with initials.
Definition: paratr.hxx:68
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxWidowsItem > RES_PARATR_WIDOWS(67)