Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_ADJITEM_HXX
29 : : #define _SVX_ADJITEM_HXX
30 : :
31 : : #include <svl/eitem.hxx>
32 : : #include <editeng/svxenum.hxx>
33 : : #include <editeng/eeitem.hxx>
34 : : #include <editeng/editengdllapi.h>
35 : :
36 : : class SvXMLUnitConverter;
37 : : namespace rtl
38 : : {
39 : : class OUString;
40 : : }
41 : :
42 : : // class SvxAdjustItem ---------------------------------------------------
43 : :
44 : : /*
45 : : [Description]
46 : : This item describes the row orientation.
47 : : */
48 : : #define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001)
49 : :
50 [ - + ]: 59662 : class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface
51 : : {
52 : : sal_Bool bLeft : 1;
53 : : sal_Bool bRight : 1;
54 : : sal_Bool bCenter : 1;
55 : : sal_Bool bBlock : 1;
56 : :
57 : : // only activ when bBlock
58 : : sal_Bool bOneBlock : 1;
59 : : sal_Bool bLastCenter : 1;
60 : : sal_Bool bLastBlock : 1;
61 : :
62 : : friend SvStream& operator<<( SvStream&, SvxAdjustItem& ); //$ ostream
63 : : public:
64 : : TYPEINFO();
65 : :
66 : : SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/,
67 : : const sal_uInt16 nId );
68 : :
69 : : // "pure virtual Methods" from SfxPoolItem
70 : : virtual int operator==( const SfxPoolItem& ) const;
71 : :
72 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
73 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
74 : :
75 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
76 : : SfxMapUnit eCoreMetric,
77 : : SfxMapUnit ePresMetric,
78 : : String &rText, const IntlWrapper * = 0 ) const;
79 : : virtual sal_uInt16 GetValueCount() const;
80 : : virtual rtl::OUString GetValueTextByPos( sal_uInt16 nPos ) const;
81 : : virtual sal_uInt16 GetEnumValue() const;
82 : : virtual void SetEnumValue( sal_uInt16 nNewVal );
83 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
84 : : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
85 : : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
86 : : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
87 : :
88 : 256 : inline void SetOneWord( const SvxAdjust eType )
89 : : {
90 : 256 : bOneBlock = eType == SVX_ADJUST_BLOCK;
91 : 256 : }
92 : :
93 : 559 : inline void SetLastBlock( const SvxAdjust eType )
94 : : {
95 : 559 : bLastBlock = eType == SVX_ADJUST_BLOCK;
96 : 559 : bLastCenter = eType == SVX_ADJUST_CENTER;
97 : 559 : }
98 : :
99 : 39464 : inline void SetAdjust( const SvxAdjust eType )
100 : : {
101 : 39464 : bLeft = eType == SVX_ADJUST_LEFT;
102 : 39464 : bRight = eType == SVX_ADJUST_RIGHT;
103 : 39464 : bCenter = eType == SVX_ADJUST_CENTER;
104 : 39464 : bBlock = eType == SVX_ADJUST_BLOCK;
105 : 39464 : }
106 : :
107 : 189209 : inline SvxAdjust GetLastBlock() const
108 : : {
109 : 189209 : SvxAdjust eRet = SVX_ADJUST_LEFT;
110 : :
111 [ - + ]: 189209 : if ( bLastBlock )
112 : 0 : eRet = SVX_ADJUST_BLOCK;
113 [ - + ]: 189209 : else if( bLastCenter )
114 : 0 : eRet = SVX_ADJUST_CENTER;
115 : 189209 : return eRet;
116 : : }
117 : :
118 : 94571 : inline SvxAdjust GetOneWord() const
119 : : {
120 : 94571 : SvxAdjust eRet = SVX_ADJUST_LEFT;
121 : :
122 [ + + ][ - + ]: 94571 : if ( bBlock && bOneBlock )
123 : 0 : eRet = SVX_ADJUST_BLOCK;
124 : 94571 : return eRet;
125 : : }
126 : :
127 : 709336 : inline SvxAdjust GetAdjust() const
128 : : {
129 : 709336 : SvxAdjust eRet = SVX_ADJUST_LEFT;
130 : :
131 [ + + ]: 709336 : if ( bRight )
132 : 7123 : eRet = SVX_ADJUST_RIGHT;
133 [ + + ]: 702213 : else if ( bCenter )
134 : 105972 : eRet = SVX_ADJUST_CENTER;
135 [ + + ]: 596241 : else if ( bBlock )
136 : 6279 : eRet = SVX_ADJUST_BLOCK;
137 : 709336 : return eRet;
138 : : }
139 : : };
140 : :
141 : : #endif
142 : :
143 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|