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_ESCAPEMENTITEM_HXX
20 #define INCLUDED_EDITENG_ESCAPEMENTITEM_HXX
22 #include <svl/eitem.hxx>
23 #include <editeng/svxenum.hxx>
24 #include <editeng/editengdllapi.h>
26 class SvXMLUnitConverter
;
28 // class SvxEscapementItem -----------------------------------------------
30 #define DFLT_ESC_SUPER 33 // 1/3
31 #define DFLT_ESC_SUB -33 // also 1/3 previously 8/100
32 #define DFLT_ESC_PROP 58
33 #define DFLT_ESC_AUTO_SUPER 101
34 #define DFLT_ESC_AUTO_SUB -101
38 This item describes the writing position.
41 class EDITENG_DLLPUBLIC SvxEscapementItem
: public SfxEnumItemInterface
48 explicit SvxEscapementItem( const sal_uInt16 nId
);
49 SvxEscapementItem( const SvxEscapement eEscape
,
50 const sal_uInt16 nId
);
51 SvxEscapementItem( const short nEsc
, const sal_uInt8 nProp
,
52 const sal_uInt16 nId
);
54 // "pure virtual Methods" from SfxPoolItem
55 virtual bool operator==( const SfxPoolItem
& ) const SAL_OVERRIDE
;
56 virtual bool GetPresentation( SfxItemPresentation ePres
,
57 SfxMapUnit eCoreMetric
,
58 SfxMapUnit ePresMetric
,
59 OUString
&rText
, const IntlWrapper
* = 0 ) const SAL_OVERRIDE
;
61 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const SAL_OVERRIDE
;
62 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) SAL_OVERRIDE
;
64 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const SAL_OVERRIDE
;
65 virtual SfxPoolItem
* Create(SvStream
&, sal_uInt16
) const SAL_OVERRIDE
;
66 virtual SvStream
& Store(SvStream
&, sal_uInt16 nItemVersion
) const SAL_OVERRIDE
;
68 inline void SetEscapement( const SvxEscapement eNew
)
70 if( SVX_ESCAPEMENT_OFF
== eNew
)
71 nEsc
= 0, nProp
= 100;
73 if( SVX_ESCAPEMENT_SUPERSCRIPT
== eNew
)
74 nEsc
= DFLT_ESC_SUPER
, nProp
= DFLT_ESC_PROP
;
76 nEsc
= DFLT_ESC_SUB
, nProp
= DFLT_ESC_PROP
;
78 inline SvxEscapement
GetEscapement() const { return static_cast< SvxEscapement
>( GetEnumValue() ); }
80 inline short &GetEsc() { return nEsc
; }
81 inline short GetEsc() const { return nEsc
; }
83 inline sal_uInt8
&GetProp() { return nProp
; }
84 inline sal_uInt8
GetProp() const { return nProp
; }
86 inline SvxEscapementItem
& operator=(const SvxEscapementItem
& rEsc
)
89 nProp
= rEsc
.GetProp();
93 virtual sal_uInt16
GetValueCount() const SAL_OVERRIDE
;
94 virtual OUString
GetValueTextByPos( sal_uInt16 nPos
) const SAL_OVERRIDE
;
95 virtual sal_uInt16
GetEnumValue() const SAL_OVERRIDE
;
96 virtual void SetEnumValue( sal_uInt16 nNewVal
) SAL_OVERRIDE
;
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */