Line data Source code
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 _SVX_FHGTITEM_HXX
20 : #define _SVX_FHGTITEM_HXX
21 :
22 : #include <svl/poolitem.hxx>
23 : #include <editeng/editengdllapi.h>
24 :
25 : class SvXMLUnitConverter;
26 : namespace rtl
27 : {
28 : class OUString;
29 : }
30 :
31 : // class SvxFontHeightItem -----------------------------------------------
32 :
33 : // Warning: twips values
34 :
35 : /* [Description]
36 :
37 : This item describes the font height
38 : */
39 :
40 : #define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001)
41 : #define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002)
42 :
43 88137 : class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem
44 : {
45 : sal_uInt32 nHeight;
46 : sal_uInt16 nProp; // default 100%
47 : SfxMapUnit ePropUnit; // Percent, Twip, ...
48 : public:
49 : TYPEINFO();
50 :
51 : SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
52 : const sal_uInt16 nId );
53 :
54 : // "pure virtual Methods" from SfxPoolItem
55 : virtual int operator==( const SfxPoolItem& ) const;
56 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
57 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
58 :
59 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
60 : SfxMapUnit eCoreMetric,
61 : SfxMapUnit ePresMetric,
62 : String &rText, const IntlWrapper * = 0 ) const;
63 :
64 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
65 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
66 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
67 : virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const;
68 : virtual bool ScaleMetrics( long nMult, long nDiv );
69 : virtual bool HasMetrics() const;
70 :
71 0 : inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
72 : {
73 0 : SetHeightValue( rSize.GetHeight() );
74 0 : SetProp( rSize.GetProp(), ePropUnit );
75 0 : return *this;
76 : }
77 :
78 : void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
79 : SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE );
80 :
81 : void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
82 : SfxMapUnit eUnit, SfxMapUnit eCoreUnit );
83 :
84 558042 : sal_uInt32 GetHeight() const { return nHeight; }
85 :
86 0 : void SetHeightValue( sal_uInt32 nNewHeight )
87 : {
88 : DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
89 0 : nHeight = nNewHeight;
90 0 : }
91 :
92 0 : void SetProp( const sal_uInt16 nNewProp,
93 : SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
94 : {
95 : DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
96 0 : nProp = nNewProp;
97 0 : ePropUnit = eUnit;
98 0 : }
99 :
100 81530 : sal_uInt16 GetProp() const { return nProp; }
101 :
102 81530 : SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
103 : };
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|