LibreOffice Module editeng (master) 1
fhgtitem.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_FHGTITEM_HXX
20#define INCLUDED_EDITENG_FHGTITEM_HXX
21
22#include <svl/poolitem.hxx>
23#include <tools/debug.hxx>
25
26// class SvxFontHeightItem -----------------------------------------------
27
28// Warning: twips values
29
30/* [Description]
31
32 This item describes the font height
33*/
34
35constexpr sal_uInt16 FONTHEIGHT_16_VERSION = 0x0001;
36constexpr sal_uInt16 FONTHEIGHT_UNIT_VERSION = 0x0002;
37
39{
40 sal_uInt32 nHeight;
41 sal_uInt16 nProp; // default 100%
42 MapUnit ePropUnit; // Percent, Twip, ...
43
44private:
45 friend void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP);
46 void legacy_direct_set(sal_uInt32 nH, sal_uInt16 nP, MapUnit eP) { nHeight = nH; nProp = nP; ePropUnit = eP; }
47
48public:
49 static SfxPoolItem* CreateDefault();
50
51 SvxFontHeightItem( const sal_uInt32 nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
52 const sal_uInt16 nId );
53
54 // "pure virtual Methods" from SfxPoolItem
55 virtual bool operator==( const SfxPoolItem& ) const override;
56 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
57 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
58
59 virtual bool GetPresentation( SfxItemPresentation ePres,
60 MapUnit eCoreMetric,
61 MapUnit ePresMetric,
62 OUString &rText, const IntlWrapper& ) const override;
63
64 virtual SvxFontHeightItem* Clone( SfxItemPool *pPool = nullptr ) const override;
65 virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
66 virtual bool HasMetrics() const override;
67
68 void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
69 MapUnit eUnit = MapUnit::MapRelative );
70
71 void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
72 MapUnit eUnit, MapUnit eCoreUnit );
73
74 sal_uInt32 GetHeight() const { return nHeight; }
75
76 void SetProp( sal_uInt16 nNewProp, MapUnit eUnit )
77 {
78 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
79 nProp = nNewProp;
80 ePropUnit = eUnit;
81 }
82
83 sal_uInt16 GetProp() const { return nProp; }
84
85 MapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
86
87 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
88};
89
90#endif
91
92/* 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
sal_uInt32 GetRefCount() 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 SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual bool HasMetrics() const
sal_uInt32 GetHeight() const
Definition: fhgtitem.hxx:74
MapUnit GetPropUnit() const
Definition: fhgtitem.hxx:85
sal_uInt32 nHeight
Definition: fhgtitem.hxx:40
void legacy_direct_set(sal_uInt32 nH, sal_uInt16 nP, MapUnit eP)
Definition: fhgtitem.hxx:46
sal_uInt16 GetProp() const
Definition: fhgtitem.hxx:83
void SetProp(sal_uInt16 nNewProp, MapUnit eUnit)
Definition: fhgtitem.hxx:76
sal_uInt16 nProp
Definition: fhgtitem.hxx:41
MapUnit ePropUnit
Definition: fhgtitem.hxx:42
#define DBG_ASSERT(sCon, aError)
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
constexpr sal_uInt16 FONTHEIGHT_16_VERSION
Definition: fhgtitem.hxx:35
constexpr sal_uInt16 FONTHEIGHT_UNIT_VERSION
Definition: fhgtitem.hxx:36
struct _xmlTextWriter * xmlTextWriterPtr
void Create_legacy_direct_set(SvxFontHeightItem &rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP)
Definition: legacyitem.cxx:51
MapUnit
long Long
SfxItemPresentation
unsigned char sal_uInt8