Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_FHGTITEM_HXX
29 : : #define _SVX_FHGTITEM_HXX
30 : :
31 : : #include <svl/poolitem.hxx>
32 : : #include <editeng/editengdllapi.h>
33 : :
34 : : class SvXMLUnitConverter;
35 : : namespace rtl
36 : : {
37 : : class OUString;
38 : : }
39 : :
40 : : // class SvxFontHeightItem -----------------------------------------------
41 : :
42 : : // Warning: twips values
43 : :
44 : : /* [Description]
45 : :
46 : : This item describes the font height
47 : : */
48 : :
49 : : #define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001)
50 : : #define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002)
51 : :
52 [ - + ]: 599026 : class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem
53 : : {
54 : : sal_uInt32 nHeight;
55 : : sal_uInt16 nProp; // default 100%
56 : : SfxMapUnit ePropUnit; // Percent, Twip, ...
57 : : public:
58 : : TYPEINFO();
59 : :
60 : : SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
61 : : const sal_uInt16 nId );
62 : :
63 : : // "pure virtual Methods" from SfxPoolItem
64 : : virtual int operator==( const SfxPoolItem& ) const;
65 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
66 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
67 : :
68 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
69 : : SfxMapUnit eCoreMetric,
70 : : SfxMapUnit ePresMetric,
71 : : String &rText, const IntlWrapper * = 0 ) const;
72 : :
73 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
74 : : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
75 : : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
76 : : virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const;
77 : : virtual bool ScaleMetrics( long nMult, long nDiv );
78 : : virtual bool HasMetrics() const;
79 : :
80 : 822 : inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
81 : : {
82 : 822 : SetHeightValue( rSize.GetHeight() );
83 : 822 : SetProp( rSize.GetProp(), ePropUnit );
84 : 822 : return *this;
85 : : }
86 : :
87 : : void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
88 : : SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE );
89 : :
90 : : void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
91 : : SfxMapUnit eUnit, SfxMapUnit eCoreUnit );
92 : :
93 : 3808633 : sal_uInt32 GetHeight() const { return nHeight; }
94 : :
95 : 822 : void SetHeightValue( sal_uInt32 nNewHeight )
96 : : {
97 : : DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
98 : 822 : nHeight = nNewHeight;
99 : 822 : }
100 : :
101 : 1590 : void SetProp( const sal_uInt16 nNewProp,
102 : : SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
103 : : {
104 : : DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
105 : 1590 : nProp = nNewProp;
106 : 1590 : ePropUnit = eUnit;
107 : 1590 : }
108 : :
109 : 481952 : sal_uInt16 GetProp() const { return nProp; }
110 : :
111 : 481124 : SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
112 : : };
113 : :
114 : : #endif
115 : :
116 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|