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 INCLUDED_EDITENG_ESCAPEMENTITEM_HXX
20 : #define INCLUDED_EDITENG_ESCAPEMENTITEM_HXX
21 :
22 : #include <svl/eitem.hxx>
23 : #include <editeng/svxenum.hxx>
24 : #include <editeng/editengdllapi.h>
25 :
26 : class SvXMLUnitConverter;
27 :
28 : // class SvxEscapementItem -----------------------------------------------
29 :
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
35 :
36 : /* [Description]
37 :
38 : This item describes the writing position.
39 : */
40 :
41 37262 : class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface
42 : {
43 : short nEsc;
44 : sal_uInt8 nProp;
45 : public:
46 : TYPEINFO_OVERRIDE();
47 :
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 );
53 :
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;
60 :
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;
63 :
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;
67 :
68 196 : inline void SetEscapement( const SvxEscapement eNew )
69 : {
70 196 : if( SVX_ESCAPEMENT_OFF == eNew )
71 196 : nEsc = 0, nProp = 100;
72 : else
73 0 : if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew )
74 0 : nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP;
75 : else
76 0 : nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP;
77 196 : }
78 482 : inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
79 :
80 0 : inline short &GetEsc() { return nEsc; }
81 976364 : inline short GetEsc() const { return nEsc; }
82 :
83 0 : inline sal_uInt8 &GetProp() { return nProp; }
84 909913 : inline sal_uInt8 GetProp() const { return nProp; }
85 :
86 : inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc)
87 : {
88 : nEsc = rEsc.GetEsc();
89 : nProp = rEsc.GetProp();
90 : return *this;
91 : }
92 :
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;
97 : };
98 :
99 : #endif
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|