LibreOffice Module editeng (master) 1
ulspitem.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_ULSPITEM_HXX
20#define INCLUDED_EDITENG_ULSPITEM_HXX
21
22#include <svl/poolitem.hxx>
24
25
26// class SvxULSpaceItem --------------------------------------------------
27
28/* [Description]
29
30 This item describes the Upper- and Lower space of a page or paragraph.
31*/
32
33#define ULSPACE_16_VERSION (sal_uInt16(0x0001))
34
36{
37 sal_uInt16 nUpper; // Upper space
38 sal_uInt16 nLower; // Lower space
39 bool bContext; // Contextual spacing?
40 sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%)
41public:
42 static SfxPoolItem* CreateDefault();
43
44 explicit SvxULSpaceItem( const sal_uInt16 nId );
45 SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
46 const sal_uInt16 nId );
47
48 // "pure virtual Methods" from SfxPoolItem
49 virtual bool operator==( const SfxPoolItem& ) const override;
50
51 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
52 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
53
54 virtual bool GetPresentation( SfxItemPresentation ePres,
55 MapUnit eCoreMetric,
56 MapUnit ePresMetric,
57 OUString &rText, const IntlWrapper& ) const override;
58
59 virtual SvxULSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
60 virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
61 virtual bool HasMetrics() const override;
62
63 inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
64 inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
65
66 void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
67 void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
68 void SetContextValue( const bool bC ) { bContext = bC; }
69 void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
70 void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
71
72 sal_uInt16 GetUpper() const { return nUpper; }
73 sal_uInt16 GetLower() const { return nLower; }
74 bool GetContext() const { return bContext; }
75 sal_uInt16 GetPropUpper() const { return nPropUpper; }
76 sal_uInt16 GetPropLower() const { return nPropLower; }
77
78 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
79 virtual boost::property_tree::ptree dumpAsJSON() const override;
80};
81
82inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
83{
84 nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
85}
86inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
87{
88 nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
89}
90
91#endif
92
93/* 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
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
Definition: ulspitem.hxx:86
sal_uInt16 nLower
Definition: ulspitem.hxx:38
sal_uInt16 nPropUpper
Definition: ulspitem.hxx:40
sal_uInt16 nPropLower
Definition: ulspitem.hxx:40
void SetPropUpper(const sal_uInt16 nU)
Definition: ulspitem.hxx:69
sal_uInt16 GetPropLower() const
Definition: ulspitem.hxx:76
sal_uInt16 nUpper
Definition: ulspitem.hxx:37
sal_uInt16 GetUpper() const
Definition: ulspitem.hxx:72
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
Definition: ulspitem.hxx:82
void SetPropLower(const sal_uInt16 nL)
Definition: ulspitem.hxx:70
sal_uInt16 GetLower() const
Definition: ulspitem.hxx:73
bool GetContext() const
Definition: ulspitem.hxx:74
void SetUpperValue(const sal_uInt16 nU)
Definition: ulspitem.hxx:66
sal_uInt16 GetPropUpper() const
Definition: ulspitem.hxx:75
void SetLowerValue(const sal_uInt16 nL)
Definition: ulspitem.hxx:67
void SetContextValue(const bool bC)
Definition: ulspitem.hxx:68
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
struct _xmlTextWriter * xmlTextWriterPtr
MapUnit
long Long
SfxItemPresentation
unsigned char sal_uInt8