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