1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_EDITENG_FHGTITEM_HXX
20 #define INCLUDED_EDITENG_FHGTITEM_HXX
22 #include <svl/poolitem.hxx>
23 #include <editeng/editengdllapi.h>
25 class SvXMLUnitConverter
;
27 // class SvxFontHeightItem -----------------------------------------------
29 // Warning: twips values
33 This item describes the font height
36 #define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001)
37 #define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002)
39 class EDITENG_DLLPUBLIC SvxFontHeightItem
: public SfxPoolItem
42 sal_uInt16 nProp
; // default 100%
43 MapUnit ePropUnit
; // Percent, Twip, ...
45 static SfxPoolItem
* CreateDefault();
47 SvxFontHeightItem( const sal_uLong nSz
/*= 240*/, const sal_uInt16 nPropHeight
/*= 100*/,
48 const sal_uInt16 nId
);
50 // "pure virtual Methods" from SfxPoolItem
51 virtual bool operator==( const SfxPoolItem
& ) const override
;
52 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
53 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
55 virtual bool GetPresentation( SfxItemPresentation ePres
,
58 OUString
&rText
, const IntlWrapper
* = nullptr ) const override
;
60 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
61 virtual SfxPoolItem
* Create(SvStream
&, sal_uInt16
) const override
;
62 virtual SvStream
& Store(SvStream
&, sal_uInt16 nItemVersion
) const override
;
63 virtual sal_uInt16
GetVersion( sal_uInt16 nItemVersion
) const override
;
64 virtual void ScaleMetrics( long nMult
, long nDiv
) override
;
65 virtual bool HasMetrics() const override
;
67 SvxFontHeightItem
& operator=(const SvxFontHeightItem
& rSize
)
69 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
70 nHeight
= rSize
.nHeight
;
72 ePropUnit
= rSize
.ePropUnit
;
76 void SetHeight( sal_uInt32 nNewHeight
, const sal_uInt16 nNewProp
= 100,
77 MapUnit eUnit
= MapUnit::MapRelative
);
79 void SetHeight( sal_uInt32 nNewHeight
, sal_uInt16 nNewProp
,
80 MapUnit eUnit
, MapUnit eCoreUnit
);
82 sal_uInt32
GetHeight() const { return nHeight
; }
84 void SetProp( sal_uInt16 nNewProp
, MapUnit eUnit
)
86 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
91 sal_uInt16
GetProp() const { return nProp
; }
93 MapUnit
GetPropUnit() const { return ePropUnit
; } // Percent, Twip, ...
95 void dumpAsXml(struct _xmlTextWriter
* pWriter
) const override
;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */