tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / include / editeng / fhgtitem.hxx
blobc8643a8095d7d328c796ba7cc5359e08ae33f69f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <tools/debug.hxx>
24 #include <editeng/editengdllapi.h>
26 // class SvxFontHeightItem -----------------------------------------------
28 // Warning: twips values
30 /* [Description]
32 This item describes the font height
35 constexpr sal_uInt16 FONTHEIGHT_16_VERSION = 0x0001;
36 constexpr sal_uInt16 FONTHEIGHT_UNIT_VERSION = 0x0002;
38 class EDITENG_DLLPUBLIC SvxFontHeightItem final : public SfxPoolItem
40 sal_uInt32 nHeight;
41 sal_uInt16 nProp; // default 100%
42 MapUnit ePropUnit; // Percent, Twip, ...
44 friend void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP);
45 void legacy_direct_set(sal_uInt32 nH, sal_uInt16 nP, MapUnit eP) { nHeight = nH; nProp = nP; ePropUnit = eP; }
47 protected:
48 virtual ItemInstanceManager* getItemInstanceManager() const override;
50 public:
51 static SfxPoolItem* CreateDefault();
53 SvxFontHeightItem( const sal_uInt32 nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
54 const sal_uInt16 nId );
56 // "pure virtual Methods" from SfxPoolItem
57 virtual bool operator==( const SfxPoolItem& ) const override;
58 virtual size_t hashCode() const override;
59 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
60 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
62 virtual bool GetPresentation( SfxItemPresentation ePres,
63 MapUnit eCoreMetric,
64 MapUnit ePresMetric,
65 OUString &rText, const IntlWrapper& ) const override;
67 virtual SvxFontHeightItem* Clone( SfxItemPool *pPool = nullptr ) const override;
68 virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override;
69 virtual bool HasMetrics() const override;
71 void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
72 MapUnit eUnit = MapUnit::MapRelative );
74 void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
75 MapUnit eUnit, MapUnit eCoreUnit );
77 sal_uInt32 GetHeight() const { return nHeight; }
79 void SetProp( sal_uInt16 nNewProp, MapUnit eUnit )
81 ASSERT_CHANGE_REFCOUNTED_ITEM;
82 nProp = nNewProp;
83 ePropUnit = eUnit;
86 sal_uInt16 GetProp() const { return nProp; }
88 MapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
90 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
93 #endif
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */