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_ADJUSTITEM_HXX
20 : #define INCLUDED_EDITENG_ADJUSTITEM_HXX
21 :
22 : #include <svl/eitem.hxx>
23 : #include <editeng/svxenum.hxx>
24 : #include <editeng/eeitem.hxx>
25 : #include <editeng/editengdllapi.h>
26 :
27 : class SvXMLUnitConverter;
28 :
29 : // class SvxAdjustItem ---------------------------------------------------
30 :
31 : /*
32 : [Description]
33 : This item describes the row orientation.
34 : */
35 : #define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001)
36 :
37 0 : class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface
38 : {
39 : bool bLeft : 1;
40 : bool bRight : 1;
41 : bool bCenter : 1;
42 : bool bBlock : 1;
43 :
44 : // only activ when bBlock
45 : bool bOneBlock : 1;
46 : bool bLastCenter : 1;
47 : bool bLastBlock : 1;
48 :
49 : friend SvStream& WriteSvxAdjustItem( SvStream&, SvxAdjustItem& ); //$ ostream
50 : public:
51 : TYPEINFO_OVERRIDE();
52 :
53 : SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/,
54 : const sal_uInt16 nId );
55 :
56 : // "pure virtual Methods" from SfxPoolItem
57 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
58 :
59 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
60 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
61 :
62 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
63 : SfxMapUnit eCoreMetric,
64 : SfxMapUnit ePresMetric,
65 : OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
66 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
67 : virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const SAL_OVERRIDE;
68 : virtual sal_uInt16 GetEnumValue() const SAL_OVERRIDE;
69 : virtual void SetEnumValue( sal_uInt16 nNewVal ) SAL_OVERRIDE;
70 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
71 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
72 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
73 : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const SAL_OVERRIDE;
74 :
75 0 : inline void SetOneWord( const SvxAdjust eType )
76 : {
77 0 : bOneBlock = eType == SVX_ADJUST_BLOCK;
78 0 : }
79 :
80 0 : inline void SetLastBlock( const SvxAdjust eType )
81 : {
82 0 : bLastBlock = eType == SVX_ADJUST_BLOCK;
83 0 : bLastCenter = eType == SVX_ADJUST_CENTER;
84 0 : }
85 :
86 0 : inline void SetAdjust( const SvxAdjust eType )
87 : {
88 0 : bLeft = eType == SVX_ADJUST_LEFT;
89 0 : bRight = eType == SVX_ADJUST_RIGHT;
90 0 : bCenter = eType == SVX_ADJUST_CENTER;
91 0 : bBlock = eType == SVX_ADJUST_BLOCK;
92 0 : }
93 :
94 0 : inline SvxAdjust GetLastBlock() const
95 : {
96 0 : SvxAdjust eRet = SVX_ADJUST_LEFT;
97 :
98 0 : if ( bLastBlock )
99 0 : eRet = SVX_ADJUST_BLOCK;
100 0 : else if( bLastCenter )
101 0 : eRet = SVX_ADJUST_CENTER;
102 0 : return eRet;
103 : }
104 :
105 0 : inline SvxAdjust GetOneWord() const
106 : {
107 0 : SvxAdjust eRet = SVX_ADJUST_LEFT;
108 :
109 0 : if ( bBlock && bOneBlock )
110 0 : eRet = SVX_ADJUST_BLOCK;
111 0 : return eRet;
112 : }
113 :
114 0 : inline SvxAdjust GetAdjust() const
115 : {
116 0 : SvxAdjust eRet = SVX_ADJUST_LEFT;
117 :
118 0 : if ( bRight )
119 0 : eRet = SVX_ADJUST_RIGHT;
120 0 : else if ( bCenter )
121 0 : eRet = SVX_ADJUST_CENTER;
122 0 : else if ( bBlock )
123 0 : eRet = SVX_ADJUST_BLOCK;
124 0 : return eRet;
125 : }
126 : };
127 :
128 : #endif
129 :
130 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|