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