1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_EDITENG_ADJUSTITEM_HXX
20 #define INCLUDED_EDITENG_ADJUSTITEM_HXX
22 #include <svl/cenumitm.hxx>
23 #include <svl/poolitem.hxx>
24 #include <editeng/svxenum.hxx>
25 #include <editeng/editengdllapi.h>
27 // class SvxAdjustItem ---------------------------------------------------
31 This item describes the row orientation.
33 constexpr sal_uInt16 ADJUST_LASTBLOCK_VERSION
= 0x0001;
35 class EDITENG_DLLPUBLIC SvxAdjustItem final
: public SfxEnumItemInterface
42 // only active when bBlock
48 static SfxPoolItem
* CreateDefault();
50 SvxAdjustItem( const SvxAdjust eAdjst
/*= SvxAdjust::Left*/,
51 const sal_uInt16 nId
);
53 // "pure virtual Methods" from SfxPoolItem
54 virtual bool operator==( const SfxPoolItem
& ) const override
;
56 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
57 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
59 virtual bool GetPresentation( SfxItemPresentation ePres
,
62 OUString
&rText
, const IntlWrapper
& ) const override
;
63 virtual sal_uInt16
GetValueCount() const override
;
64 static OUString
GetValueTextByPos( sal_uInt16 nPos
);
65 virtual sal_uInt16
GetEnumValue() const override
;
66 virtual void SetEnumValue( sal_uInt16 nNewVal
) override
;
67 virtual SvxAdjustItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
69 void SetOneWord( const SvxAdjust eType
)
71 bOneBlock
= eType
== SvxAdjust::Block
;
74 void SetLastBlock( const SvxAdjust eType
)
76 bLastBlock
= eType
== SvxAdjust::Block
;
77 bLastCenter
= eType
== SvxAdjust::Center
;
80 void SetAdjust( const SvxAdjust eType
)
82 bLeft
= eType
== SvxAdjust::Left
;
83 bRight
= eType
== SvxAdjust::Right
;
84 bCenter
= eType
== SvxAdjust::Center
;
85 bBlock
= eType
== SvxAdjust::Block
;
88 SvxAdjust
GetLastBlock() const
90 SvxAdjust eRet
= SvxAdjust::Left
;
93 eRet
= SvxAdjust::Block
;
94 else if( bLastCenter
)
95 eRet
= SvxAdjust::Center
;
99 SvxAdjust
GetOneWord() const
101 SvxAdjust eRet
= SvxAdjust::Left
;
103 if ( bBlock
&& bOneBlock
)
104 eRet
= SvxAdjust::Block
;
108 SvxAdjust
GetAdjust() const
110 SvxAdjust eRet
= SvxAdjust::Left
;
113 eRet
= SvxAdjust::Right
;
115 eRet
= SvxAdjust::Center
;
117 eRet
= SvxAdjust::Block
;
121 sal_Int8
GetAsFlags() const
133 void SetAsFlags(sal_Int8 nFlags
)
135 bOneBlock
= 0 != (nFlags
& 0x0001);
136 bLastCenter
= 0 != (nFlags
& 0x0002);
137 bLastBlock
= 0 != (nFlags
& 0x0004);
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */