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_FWDTITEM_HXX
20 #define INCLUDED_EDITENG_FWDTITEM_HXX
22 #include <svl/poolitem.hxx>
25 // class SvxFontWidthItem -----------------------------------------------
30 This item describes the font width.
33 class SvxFontWidthItem
: public SfxPoolItem
35 sal_uInt16 nWidth
; // 0 = default
36 sal_uInt16 nProp
; // default 100%
40 SvxFontWidthItem( const sal_uInt16 nSz
/*= 0*/,
41 const sal_uInt16 nPropWidth
/*= 100*/,
42 const sal_uInt16 nId
);
44 // "pure virtual Methods" from SfxPoolItem
45 virtual bool operator==( const SfxPoolItem
& ) const SAL_OVERRIDE
;
46 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const SAL_OVERRIDE
;
47 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) SAL_OVERRIDE
;
49 virtual bool GetPresentation( SfxItemPresentation ePres
,
50 SfxMapUnit eCoreMetric
,
51 SfxMapUnit ePresMetric
,
52 OUString
&rText
, const IntlWrapper
* = 0 ) const SAL_OVERRIDE
;
54 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const SAL_OVERRIDE
;
55 virtual SfxPoolItem
* Create(SvStream
&, sal_uInt16
) const SAL_OVERRIDE
;
56 virtual SvStream
& Store(SvStream
&, sal_uInt16 nItemVersion
) const SAL_OVERRIDE
;
57 virtual bool ScaleMetrics( long nMult
, long nDiv
) SAL_OVERRIDE
;
58 virtual bool HasMetrics() const SAL_OVERRIDE
;
60 inline SvxFontWidthItem
& operator=(const SvxFontWidthItem
& rItem
)
62 SetWidthValue( rItem
.GetWidth() );
63 SetProp( rItem
.GetProp() );
67 void SetWidth( sal_uInt16 nNewWidth
, const sal_uInt16 nNewProp
= 100 )
69 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
70 nWidth
= sal_uInt16(( (sal_uInt32
)nNewWidth
* nNewProp
) / 100 );
74 sal_uInt16
GetWidth() const { return nWidth
; }
76 void SetWidthValue( sal_uInt16 nNewWidth
)
78 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
82 void SetProp( const sal_uInt16 nNewProp
)
84 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
88 sal_uInt16
GetProp() const { return nProp
; }
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */