LibreOffice Module editeng (master) 1
lrspitem.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_EDITENG_LRSPITEM_HXX
20#define INCLUDED_EDITENG_LRSPITEM_HXX
21
22#include <svl/poolitem.hxx>
24
25
26// class SvxLRSpaceItem --------------------------------------------------
27
28/* [Description]
29
30 Left/Right margin and first line indent
31
32 SvxLRSpaceItem offers two interfaces to get the left margin and first line
33 indent.
34 - The Get* methods return the member in the way the layout used to expect:
35 with a negative first line indent, the left margin shifts to the left.
36 - The SetText*,GetText* methods assume that the left margin represents
37 the 0 coordinate for the first line indent:
38
39 UI UI LAYOUT UI/TEXT UI/TEXT (Where?)
40SetTextLeft SetTextFirst GetLeft GetTextLeft GetTextFirst (What?)
41 500 -500 0 500 -500 (How much?)
42 500 0 500 500 0
43 500 +500 500 500 +500
44 700 -500 200 700 -500
45*/
46
48
51{
52private:
54 tools::Long m_nLeftMargin = 0;
55 sal_uInt16 m_nPropLeftMargin = 100;
56
57public:
58 // The "layout interface":
59 void SetLeft(const tools::Long nL, const sal_uInt16 nProp = 100);
60
61 // Query/direct setting of the absolute values
62 tools::Long GetLeft() const { return m_nLeftMargin; }
63
64 sal_uInt16 GetPropLeft() const { return m_nPropLeftMargin; }
65
66 explicit SvxLeftMarginItem(const sal_uInt16 nId);
67 SvxLeftMarginItem(const tools::Long nLeft, const sal_uInt16 nId);
68 SvxLeftMarginItem(SvxLeftMarginItem const &) = default; // SfxPoolItem copy function dichotomy
69
70 // "pure virtual Methods" from SfxPoolItem
71 virtual bool operator==(const SfxPoolItem&) const override;
72
73 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
74 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
75
76 virtual bool GetPresentation(SfxItemPresentation ePres,
77 MapUnit eCoreMetric,
78 MapUnit ePresMetric,
79 OUString &rText, const IntlWrapper&) const override;
80
81 virtual SvxLeftMarginItem* Clone(SfxItemPool *pPool = nullptr) const override;
82 virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override;
83 virtual bool HasMetrics() const override;
84
85 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
86 virtual boost::property_tree::ptree dumpAsJSON() const override;
87};
88
91{
92private:
95 tools::Long m_nTextLeftMargin = 0;
96 sal_uInt16 m_nPropLeftMargin = 100;
97
98public:
99 //TODO: need this?
100 //void SetLeft(SvxFirstLineIndentItem const& rFirstLine, const tools::Long nL, const sal_uInt16 nProp = 100);
102 tools::Long GetLeft(SvxFirstLineIndentItem const& rFirstLine) const;
103 sal_uInt16 GetPropLeft() const { return m_nPropLeftMargin; }
104
105 void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp = 100);
106 tools::Long GetTextLeft() const;
107
108 explicit SvxTextLeftMarginItem(const sal_uInt16 nId);
109 SvxTextLeftMarginItem(const tools::Long nLeft, const sal_uInt16 nId);
110 SvxTextLeftMarginItem(SvxTextLeftMarginItem const &) = default; // SfxPoolItem copy function dichotomy
111
112 // "pure virtual Methods" from SfxPoolItem
113 virtual bool operator==(const SfxPoolItem&) const override;
114
115 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
116 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
117
118 virtual bool GetPresentation(SfxItemPresentation ePres,
119 MapUnit eCoreMetric,
120 MapUnit ePresMetric,
121 OUString &rText, const IntlWrapper&) const override;
122
123 virtual SvxTextLeftMarginItem* Clone(SfxItemPool *pPool = nullptr) const override;
124 virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override;
125 virtual bool HasMetrics() const override;
126
127 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
128 virtual boost::property_tree::ptree dumpAsJSON() const override;
129};
130
133{
134private:
136 short m_nFirstLineOffset = 0;
137 sal_uInt16 m_nPropFirstLineOffset = 100;
139 bool m_bAutoFirst = false;
140
141public:
142 bool IsAutoFirst() const { return m_bAutoFirst; }
143 void SetAutoFirst(const bool bNew) { m_bAutoFirst = bNew; }
144
145 void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp = 100);
146 short GetTextFirstLineOffset() const { return m_nFirstLineOffset; }
147 void SetPropTextFirstLineOffset(const sal_uInt16 nProp)
148 { m_nPropFirstLineOffset = nProp; }
149 sal_uInt16 GetPropTextFirstLineOffset() const
150 { return m_nPropFirstLineOffset; }
151 void SetTextFirstLineOffsetValue(const short nValue)
152 { m_nFirstLineOffset = nValue; }
153
154 explicit SvxFirstLineIndentItem(const sal_uInt16 nId);
155 SvxFirstLineIndentItem(const short nOffset, const sal_uInt16 nId);
156 SvxFirstLineIndentItem(SvxFirstLineIndentItem const &) = default; // SfxPoolItem copy function dichotomy
157
158 // "pure virtual Methods" from SfxPoolItem
159 virtual bool operator==(const SfxPoolItem&) const override;
160
161 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
162 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
163
164 virtual bool GetPresentation(SfxItemPresentation ePres,
165 MapUnit eCoreMetric,
166 MapUnit ePresMetric,
167 OUString &rText, const IntlWrapper&) const override;
168
169 virtual SvxFirstLineIndentItem* Clone(SfxItemPool *pPool = nullptr) const override;
170 virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override;
171 virtual bool HasMetrics() const override;
172
173 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
174 virtual boost::property_tree::ptree dumpAsJSON() const override;
175};
176
178{
179private:
181 tools::Long m_nRightMargin = 0;
182 sal_uInt16 m_nPropRightMargin = 100;
183
184public:
185 // The "layout interface":
186 void SetRight(const tools::Long nR, const sal_uInt16 nProp = 100);
187
188 // Query/direct setting of the absolute values
189 tools::Long GetRight() const { return m_nRightMargin;}
190
191 sal_uInt16 GetPropRight() const { return m_nPropRightMargin; }
192
193 explicit SvxRightMarginItem(const sal_uInt16 nId);
194 SvxRightMarginItem(const tools::Long nRight, const sal_uInt16 nId);
195 SvxRightMarginItem(SvxRightMarginItem const &) = default; // SfxPoolItem copy function dichotomy
196
197 // "pure virtual Methods" from SfxPoolItem
198 virtual bool operator==(const SfxPoolItem&) const override;
199
200 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
201 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
202
203 virtual bool GetPresentation(SfxItemPresentation ePres,
204 MapUnit eCoreMetric,
205 MapUnit ePresMetric,
206 OUString &rText, const IntlWrapper&) const override;
207
208 virtual SvxRightMarginItem* Clone(SfxItemPool *pPool = nullptr) const override;
209 virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override;
210 virtual bool HasMetrics() const override;
211
212 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
213 virtual boost::property_tree::ptree dumpAsJSON() const override;
214};
215
218{
219private:
221 tools::Long m_nGutterMargin = 0;
222
223public:
224 void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; }
225 tools::Long GetGutterMargin() const { return m_nGutterMargin; }
226
227 explicit SvxGutterLeftMarginItem(const sal_uInt16 nId);
228 SvxGutterLeftMarginItem(SvxGutterLeftMarginItem const &) = default; // SfxPoolItem copy function dichotomy
229
230 // "pure virtual Methods" from SfxPoolItem
231 virtual bool operator==(const SfxPoolItem&) const override;
232
233 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
234 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
235
236 virtual bool GetPresentation(SfxItemPresentation ePres,
237 MapUnit eCoreMetric,
238 MapUnit ePresMetric,
239 OUString &rText, const IntlWrapper&) const override;
240
241 virtual SvxGutterLeftMarginItem* Clone(SfxItemPool *pPool = nullptr) const override;
242 virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override;
243 virtual bool HasMetrics() const override;
244
245 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
246 virtual boost::property_tree::ptree dumpAsJSON() const override;
247};
248
251{
252private:
254 tools::Long m_nRightGutterMargin = 0;
255
256public:
257 tools::Long GetRightGutterMargin() const { return m_nRightGutterMargin; }
258
259 explicit SvxGutterRightMarginItem(const sal_uInt16 nId);
260 SvxGutterRightMarginItem(SvxGutterRightMarginItem const &) = default; // SfxPoolItem copy function dichotomy
261
262 // "pure virtual Methods" from SfxPoolItem
263 virtual bool operator==(const SfxPoolItem&) const override;
264
265 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
266 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
267
268 virtual bool GetPresentation(SfxItemPresentation ePres,
269 MapUnit eCoreMetric,
270 MapUnit ePresMetric,
271 OUString &rText, const IntlWrapper&) const override;
272
273 virtual SvxGutterRightMarginItem* Clone(SfxItemPool *pPool = nullptr) const override;
274 virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override;
275 virtual bool HasMetrics() const override;
276
277 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
278 virtual boost::property_tree::ptree dumpAsJSON() const override;
279};
280
282{
285 tools::Long nLeftMargin; // nLeft or the negative first-line indent
286 tools::Long nRightMargin; // The unproblematic right edge
291
292 sal_uInt16 nPropFirstLineOffset, nPropLeftMargin, nPropRightMargin;
293 bool bAutoFirst; // Automatic calculation of the first line indent
296
297public:
298
299 static SfxPoolItem* CreateDefault();
300
301 explicit SvxLRSpaceItem( const sal_uInt16 nId );
302 SvxLRSpaceItem( const tools::Long nLeft, const tools::Long nRight,
303 const short nOfset /*= 0*/,
304 const sal_uInt16 nId );
305 SvxLRSpaceItem(SvxLRSpaceItem const &) = default; // SfxPoolItem copy function dichotomy
306
307 // "pure virtual Methods" from SfxPoolItem
308 virtual bool operator==( const SfxPoolItem& ) const override;
309
310 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
311 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
312
313 virtual bool GetPresentation( SfxItemPresentation ePres,
314 MapUnit eCoreMetric,
315 MapUnit ePresMetric,
316 OUString &rText, const IntlWrapper& ) const override;
317
318 virtual SvxLRSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
319 virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
320 virtual bool HasMetrics() const override;
321
322 // The "layout interface":
323 void SetLeft (const tools::Long nL, const sal_uInt16 nProp = 100);
324 void SetRight(const tools::Long nR, const sal_uInt16 nProp = 100);
325
326 // Query/direct setting of the absolute values
327 tools::Long GetLeft() const { return nLeftMargin; }
329 void SetLeftValue( const tools::Long nL ) { assert(nFirstLineOffset == 0); nLeftMargin = nL; }
330 void SetRightValue( const tools::Long nR ) { nRightMargin = nR; }
331 bool IsAutoFirst() const { return bAutoFirst; }
332 void SetAutoFirst( const bool bNew ) { bAutoFirst = bNew; }
333
334 bool IsExplicitZeroMarginValRight() const { return bExplicitZeroMarginValRight; }
335 bool IsExplicitZeroMarginValLeft() const { return bExplicitZeroMarginValLeft; }
336 void SetExplicitZeroMarginValRight( const bool eR ) { bExplicitZeroMarginValRight = eR; }
337 void SetExplicitZeroMarginValLeft( const bool eL ) { bExplicitZeroMarginValLeft = eL; }
338 sal_uInt16 GetPropLeft() const { return nPropLeftMargin; }
339 sal_uInt16 GetPropRight() const { return nPropRightMargin;}
340
341 // The UI/text interface:
342 void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp = 100);
343 tools::Long GetTextLeft() const;
344
345 void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp = 100);
346 short GetTextFirstLineOffset() const { return nFirstLineOffset; }
347 void SetPropTextFirstLineOffset( const sal_uInt16 nProp )
348 { nPropFirstLineOffset = nProp; }
349 sal_uInt16 GetPropTextFirstLineOffset() const
350 { return nPropFirstLineOffset; }
351 void SetTextFirstLineOffsetValue( const short nValue )
353 void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; }
354 tools::Long GetGutterMargin() const { return m_nGutterMargin; }
355 void SetRightGutterMargin(const tools::Long nRightGutterMargin) { m_nRightGutterMargin = nRightGutterMargin; }
356 tools::Long GetRightGutterMargin() const { return m_nRightGutterMargin; }
357
358 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
359 virtual boost::property_tree::ptree dumpAsJSON() const override;
360};
361
362#endif
363
364/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ScaleMetrics(tools::Long lMult, tools::Long lDiv)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual bool operator==(const SfxPoolItem &) const=0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
virtual boost::property_tree::ptree dumpAsJSON() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual bool HasMetrics() const
first line indent that may be applied to paragraphs
Definition: lrspitem.hxx:133
SvxFirstLineIndentItem(SvxFirstLineIndentItem const &)=default
void SetPropTextFirstLineOffset(const sal_uInt16 nProp)
Definition: lrspitem.hxx:147
void SetTextFirstLineOffsetValue(const short nValue)
Definition: lrspitem.hxx:151
bool IsAutoFirst() const
Definition: lrspitem.hxx:142
sal_uInt16 GetPropTextFirstLineOffset() const
Definition: lrspitem.hxx:149
void SetAutoFirst(const bool bNew)
Definition: lrspitem.hxx:143
short GetTextFirstLineOffset() const
Definition: lrspitem.hxx:146
gutter margin - for page styles
Definition: lrspitem.hxx:218
void SetGutterMargin(const tools::Long nGutterMargin)
Definition: lrspitem.hxx:224
tools::Long GetGutterMargin() const
Definition: lrspitem.hxx:225
SvxGutterLeftMarginItem(SvxGutterLeftMarginItem const &)=default
gutter margin - for page styles
Definition: lrspitem.hxx:251
SvxGutterRightMarginItem(SvxGutterRightMarginItem const &)=default
tools::Long GetRightGutterMargin() const
Definition: lrspitem.hxx:257
void SetGutterMargin(const tools::Long nGutterMargin)
Definition: lrspitem.hxx:353
void SetLeftValue(const tools::Long nL)
Definition: lrspitem.hxx:329
void SetPropTextFirstLineOffset(const sal_uInt16 nProp)
Definition: lrspitem.hxx:347
tools::Long GetRightGutterMargin() const
Definition: lrspitem.hxx:356
bool bExplicitZeroMarginValLeft
Definition: lrspitem.hxx:295
short nFirstLineOffset
First-line indent always relative to GetTextLeft()
Definition: lrspitem.hxx:284
void SetExplicitZeroMarginValRight(const bool eR)
Definition: lrspitem.hxx:336
bool IsAutoFirst() const
Definition: lrspitem.hxx:331
sal_uInt16 GetPropLeft() const
Definition: lrspitem.hxx:338
sal_uInt16 GetPropRight() const
Definition: lrspitem.hxx:339
bool IsExplicitZeroMarginValRight() const
Definition: lrspitem.hxx:334
void SetTextFirstLineOffsetValue(const short nValue)
Definition: lrspitem.hxx:351
bool IsExplicitZeroMarginValLeft() const
Definition: lrspitem.hxx:335
sal_uInt16 nPropFirstLineOffset
Definition: lrspitem.hxx:292
short GetTextFirstLineOffset() const
Definition: lrspitem.hxx:346
tools::Long nLeftMargin
Definition: lrspitem.hxx:285
tools::Long GetRight() const
Definition: lrspitem.hxx:328
void SetRightGutterMargin(const tools::Long nRightGutterMargin)
Definition: lrspitem.hxx:355
tools::Long nRightMargin
Definition: lrspitem.hxx:286
void SetExplicitZeroMarginValLeft(const bool eL)
Definition: lrspitem.hxx:337
tools::Long GetGutterMargin() const
Definition: lrspitem.hxx:354
tools::Long GetLeft() const
Definition: lrspitem.hxx:327
void SetRightValue(const tools::Long nR)
Definition: lrspitem.hxx:330
tools::Long m_nGutterMargin
The amount of extra space added to the left margin.
Definition: lrspitem.hxx:288
bool bExplicitZeroMarginValRight
Definition: lrspitem.hxx:294
SvxLRSpaceItem(SvxLRSpaceItem const &)=default
void SetAutoFirst(const bool bNew)
Definition: lrspitem.hxx:332
sal_uInt16 GetPropTextFirstLineOffset() const
Definition: lrspitem.hxx:349
tools::Long m_nRightGutterMargin
The amount of extra space added to the right margin, on mirrored pages.
Definition: lrspitem.hxx:290
GetLeft() - for everything that's not applied to a paragraph.
Definition: lrspitem.hxx:51
sal_uInt16 GetPropLeft() const
Definition: lrspitem.hxx:64
tools::Long GetLeft() const
Definition: lrspitem.hxx:62
SvxLeftMarginItem(SvxLeftMarginItem const &)=default
tools::Long GetRight() const
Definition: lrspitem.hxx:189
SvxRightMarginItem(SvxRightMarginItem const &)=default
sal_uInt16 GetPropRight() const
Definition: lrspitem.hxx:191
GetTextLeft() - for everything that's applied to a paragraph.
Definition: lrspitem.hxx:91
SvxTextLeftMarginItem(SvxTextLeftMarginItem const &)=default
sal_uInt16 GetPropLeft() const
Definition: lrspitem.hxx:103
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
struct _xmlTextWriter * xmlTextWriterPtr
sal_Int16 nValue
sal_Int32 nFirstLineOffset
MapUnit
tools::Long const nRightMargin
tools::Long const nLeftMargin
long Long
SfxItemPresentation
unsigned char sal_uInt8