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_FWDTITEM_HXX
29 : : #define _SVX_FWDTITEM_HXX
30 : :
31 : : #include <svl/poolitem.hxx>
32 : :
33 : :
34 : : // class SvxFontWidthItem -----------------------------------------------
35 : :
36 : :
37 : : /* [Description]
38 : :
39 : : This item describes the font width.
40 : : */
41 : :
42 [ # # ]: 0 : class SvxFontWidthItem : public SfxPoolItem
43 : : {
44 : : sal_uInt16 nWidth; // 0 = default
45 : : sal_uInt16 nProp; // default 100%
46 : : public:
47 : : TYPEINFO();
48 : :
49 : : SvxFontWidthItem( const sal_uInt16 nSz /*= 0*/,
50 : : const sal_uInt16 nPropWidth /*= 100*/,
51 : : const sal_uInt16 nId );
52 : :
53 : : // "pure virtual Methods" from SfxPoolItem
54 : : virtual int operator==( const SfxPoolItem& ) const;
55 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
56 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
57 : :
58 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
59 : : SfxMapUnit eCoreMetric,
60 : : SfxMapUnit ePresMetric,
61 : : String &rText, const IntlWrapper * = 0 ) const;
62 : :
63 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
64 : : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
65 : : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
66 : : virtual bool ScaleMetrics( long nMult, long nDiv );
67 : : virtual bool HasMetrics() const;
68 : :
69 : : inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem )
70 : : {
71 : : SetWidthValue( rItem.GetWidth() );
72 : : SetProp( rItem.GetProp() );
73 : : return *this;
74 : : }
75 : :
76 : : void SetWidth( sal_uInt16 nNewWidth, const sal_uInt16 nNewProp = 100 )
77 : : {
78 : : DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
79 : : nWidth = sal_uInt16(( (sal_uInt32)nNewWidth * nNewProp ) / 100 );
80 : : nProp = nNewProp;
81 : : }
82 : :
83 : 0 : sal_uInt16 GetWidth() const { return nWidth; }
84 : :
85 : 0 : void SetWidthValue( sal_uInt16 nNewWidth )
86 : : {
87 : : DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
88 : 0 : nWidth = nNewWidth;
89 : 0 : }
90 : :
91 : : void SetProp( const sal_uInt16 nNewProp )
92 : : {
93 : : DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
94 : : nProp = nNewProp;
95 : : }
96 : :
97 : 0 : sal_uInt16 GetProp() const { return nProp; }
98 : : };
99 : :
100 : :
101 : :
102 : :
103 : :
104 : : #endif
105 : :
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|