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_SW_INC_FMTORNT_HXX
20 #define INCLUDED_SW_INC_FMTORNT_HXX
22 #include <com/sun/star/text/HoriOrientation.hpp>
23 #include <com/sun/star/text/VertOrientation.hpp>
24 #include <com/sun/star/text/RelOrientation.hpp>
26 #include <hintids.hxx>
27 #include <swtypes.hxx>
29 #include <svl/poolitem.hxx>
33 class SW_DLLPUBLIC SwFormatVertOrient
: public SfxPoolItem
35 SwTwips m_nYPos
; ///< Contains *always* the current RelPos.
37 sal_Int16 m_eRelation
;
39 SwFormatVertOrient( SwTwips nY
= 0, sal_Int16 eVert
= css::text::VertOrientation::NONE
,
40 sal_Int16 eRel
= css::text::RelOrientation::PRINT_AREA
);
41 inline SwFormatVertOrient
&operator=( const SwFormatVertOrient
&rCpy
);
43 /// "Pure virtual methods" of SfxPoolItem.
44 virtual bool operator==( const SfxPoolItem
& ) const override
;
45 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
46 virtual bool GetPresentation( SfxItemPresentation ePres
,
50 const IntlWrapper
* pIntl
= nullptr ) const override
;
51 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
52 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
54 SvStream
& Store(SvStream
&rStream
, sal_uInt16 itemVersion
) const override
;
55 SfxPoolItem
* Create(SvStream
&rStream
, sal_uInt16 itemVersion
) const override
;
57 sal_Int16
GetVertOrient() const { return m_eOrient
; }
58 sal_Int16
GetRelationOrient() const { return m_eRelation
; }
59 void SetVertOrient( sal_Int16 eNew
) { m_eOrient
= eNew
; }
60 void SetRelationOrient( sal_Int16 eNew
) { m_eRelation
= eNew
; }
62 SwTwips
GetPos() const { return m_nYPos
; }
63 void SetPos( SwTwips nNew
) { m_nYPos
= nNew
; }
65 void dumpAsXml(struct _xmlTextWriter
* pWriter
) const override
;
68 class SW_DLLPUBLIC SwFormatHoriOrient
: public SfxPoolItem
70 SwTwips m_nXPos
; ///< Contains *always* the current RelPos.
72 sal_Int16 m_eRelation
;
73 bool m_bPosToggle
: 1; ///< Flip position on even pages.
75 SwFormatHoriOrient( SwTwips nX
= 0, sal_Int16 eHori
= css::text::HoriOrientation::NONE
,
76 sal_Int16 eRel
= css::text::RelOrientation::PRINT_AREA
, bool bPos
= false );
77 inline SwFormatHoriOrient
&operator=( const SwFormatHoriOrient
&rCpy
);
79 /// "Pure virtual methods" of SfxPoolItem.
80 virtual bool operator==( const SfxPoolItem
& ) const override
;
81 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
82 virtual bool GetPresentation( SfxItemPresentation ePres
,
86 const IntlWrapper
* pIntl
= nullptr ) const override
;
87 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
88 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
90 sal_Int16
GetHoriOrient() const { return m_eOrient
; }
91 sal_Int16
GetRelationOrient() const { return m_eRelation
; }
92 void SetHoriOrient( sal_Int16 eNew
) { m_eOrient
= eNew
; }
93 void SetRelationOrient( sal_Int16 eNew
) { m_eRelation
= eNew
; }
95 SwTwips
GetPos() const { return m_nXPos
; }
96 void SetPos( SwTwips nNew
) { m_nXPos
= nNew
; }
98 bool IsPosToggle() const { return m_bPosToggle
; }
99 void SetPosToggle( bool bNew
) { m_bPosToggle
= bNew
; }
101 void dumpAsXml(struct _xmlTextWriter
* pWriter
) const override
;
104 inline SwFormatVertOrient
&SwFormatVertOrient::operator=( const SwFormatVertOrient
&rCpy
)
106 m_nYPos
= rCpy
.GetPos();
107 m_eOrient
= rCpy
.GetVertOrient();
108 m_eRelation
= rCpy
.GetRelationOrient();
111 inline SwFormatHoriOrient
&SwFormatHoriOrient::operator=( const SwFormatHoriOrient
&rCpy
)
113 m_nXPos
= rCpy
.GetPos();
114 m_eOrient
= rCpy
.GetHoriOrient();
115 m_eRelation
= rCpy
.GetRelationOrient();
116 m_bPosToggle
= rCpy
.IsPosToggle();
120 inline const SwFormatVertOrient
&SwAttrSet::GetVertOrient(bool bInP
) const
121 { return static_cast<const SwFormatVertOrient
&>(Get( RES_VERT_ORIENT
,bInP
)); }
122 inline const SwFormatHoriOrient
&SwAttrSet::GetHoriOrient(bool bInP
) const
123 { return static_cast<const SwFormatHoriOrient
&>(Get( RES_HORI_ORIENT
,bInP
)); }
125 inline const SwFormatVertOrient
&SwFormat::GetVertOrient(bool bInP
) const
126 { return m_aSet
.GetVertOrient(bInP
); }
127 inline const SwFormatHoriOrient
&SwFormat::GetHoriOrient(bool bInP
) const
128 { return m_aSet
.GetHoriOrient(bInP
); }
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */