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 _SVX_ESCPITEM_HXX
20 : #define _SVX_ESCPITEM_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 4962 : class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface
42 : {
43 : short nEsc;
44 : sal_uInt8 nProp;
45 : public:
46 : TYPEINFO();
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 int operator==( const SfxPoolItem& ) const;
56 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
57 : SfxMapUnit eCoreMetric,
58 : SfxMapUnit ePresMetric,
59 : OUString &rText, const IntlWrapper * = 0 ) const;
60 :
61 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
62 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
63 :
64 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
65 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
66 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
67 :
68 141 : inline void SetEscapement( const SvxEscapement eNew )
69 : {
70 141 : if( SVX_ESCAPEMENT_OFF == eNew )
71 141 : 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 141 : }
78 0 : inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
79 :
80 9036 : inline short &GetEsc() { return nEsc; }
81 842267 : inline short GetEsc() const { return nEsc; }
82 :
83 1759 : inline sal_uInt8 &GetProp() { return nProp; }
84 836366 : 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;
94 : virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
95 : virtual sal_uInt16 GetEnumValue() const;
96 : virtual void SetEnumValue( sal_uInt16 nNewVal );
97 : };
98 :
99 : #endif
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|