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 : namespace rtl
28 : {
29 : class OUString;
30 : }
31 :
32 : // class SvxEscapementItem -----------------------------------------------
33 :
34 : #define DFLT_ESC_SUPER 33 // 1/3
35 : #define DFLT_ESC_SUB -33 // also 1/3 previously 8/100
36 : #define DFLT_ESC_PROP 58
37 : #define DFLT_ESC_AUTO_SUPER 101
38 : #define DFLT_ESC_AUTO_SUB -101
39 :
40 : /* [Description]
41 :
42 : This item describes the writing position.
43 : */
44 :
45 1704 : class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface
46 : {
47 : short nEsc;
48 : sal_uInt8 nProp;
49 : public:
50 : TYPEINFO();
51 :
52 : explicit SvxEscapementItem( const sal_uInt16 nId );
53 : SvxEscapementItem( const SvxEscapement eEscape,
54 : const sal_uInt16 nId );
55 : SvxEscapementItem( const short nEsc, const sal_uInt8 nProp,
56 : const sal_uInt16 nId );
57 :
58 : // "pure virtual Methods" from SfxPoolItem
59 : virtual int operator==( const SfxPoolItem& ) const;
60 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
61 : SfxMapUnit eCoreMetric,
62 : SfxMapUnit ePresMetric,
63 : String &rText, const IntlWrapper * = 0 ) const;
64 :
65 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
66 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
67 :
68 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
69 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
70 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
71 :
72 284 : inline void SetEscapement( const SvxEscapement eNew )
73 : {
74 284 : if( SVX_ESCAPEMENT_OFF == eNew )
75 284 : nEsc = 0, nProp = 100;
76 : else
77 0 : if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew )
78 0 : nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP;
79 : else
80 0 : nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP;
81 284 : }
82 0 : inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
83 :
84 27 : inline short &GetEsc() { return nEsc; }
85 64074 : inline short GetEsc() const { return nEsc; }
86 :
87 27 : inline sal_uInt8 &GetProp() { return nProp; }
88 63192 : inline sal_uInt8 GetProp() const { return nProp; }
89 :
90 : inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc)
91 : {
92 : nEsc = rEsc.GetEsc();
93 : nProp = rEsc.GetProp();
94 : return *this;
95 : }
96 :
97 : virtual sal_uInt16 GetValueCount() const;
98 : virtual rtl::OUString GetValueTextByPos( sal_uInt16 nPos ) const;
99 : virtual sal_uInt16 GetEnumValue() const;
100 : virtual void SetEnumValue( sal_uInt16 nNewVal );
101 : };
102 :
103 : #endif
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|