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_SW_INC_FMTORNT_HXX
20 : #define INCLUDED_SW_INC_FMTORNT_HXX
21 :
22 : #include <com/sun/star/text/HoriOrientation.hpp>
23 : #include <com/sun/star/text/VertOrientation.hpp>
24 : #include <com/sun/star/text/RelOrientation.hpp>
25 : #include "swdllapi.h"
26 : #include <hintids.hxx>
27 : #include <swtypes.hxx>
28 : #include <format.hxx>
29 : #include <svl/poolitem.hxx>
30 :
31 : class IntlWrapper;
32 :
33 26166544 : class SW_DLLPUBLIC SwFmtVertOrient: public SfxPoolItem
34 : {
35 : SwTwips m_nYPos; ///< Contains *always* the current RelPos.
36 : sal_Int16 m_eOrient;
37 : sal_Int16 m_eRelation;
38 : public:
39 : TYPEINFO_OVERRIDE();
40 : SwFmtVertOrient( SwTwips nY = 0, sal_Int16 eVert = com::sun::star::text::VertOrientation::NONE,
41 : sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA );
42 : inline SwFmtVertOrient &operator=( const SwFmtVertOrient &rCpy );
43 :
44 : /// "Pure virtual methods" of SfxPoolItem.
45 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
46 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
47 : virtual bool GetPresentation( SfxItemPresentation ePres,
48 : SfxMapUnit eCoreMetric,
49 : SfxMapUnit ePresMetric,
50 : OUString &rText,
51 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
52 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
53 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
54 :
55 : SvStream& Store(SvStream &rStream, sal_uInt16 itemVersion) const SAL_OVERRIDE;
56 : SfxPoolItem* Create(SvStream &rStream, sal_uInt16 itemVersion) const SAL_OVERRIDE;
57 :
58 125117 : sal_Int16 GetVertOrient() const { return m_eOrient; }
59 30633 : sal_Int16 GetRelationOrient() const { return m_eRelation; }
60 12848922 : void SetVertOrient( sal_Int16 eNew ) { m_eOrient = eNew; }
61 0 : void SetRelationOrient( sal_Int16 eNew ) { m_eRelation = eNew; }
62 :
63 47041 : SwTwips GetPos() const { return m_nYPos; }
64 11022 : void SetPos( SwTwips nNew ) { m_nYPos = nNew; }
65 : };
66 :
67 86704 : class SW_DLLPUBLIC SwFmtHoriOrient: public SfxPoolItem
68 : {
69 : SwTwips nXPos; ///< Contains *always* the current RelPos.
70 : sal_Int16 eOrient;
71 : sal_Int16 eRelation;
72 : bool bPosToggle : 1; ///< Flip position on even pages.
73 : public:
74 : TYPEINFO_OVERRIDE();
75 : SwFmtHoriOrient( SwTwips nX = 0, sal_Int16 eHori = com::sun::star::text::HoriOrientation::NONE,
76 : sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA, bool bPos = false );
77 : inline SwFmtHoriOrient &operator=( const SwFmtHoriOrient &rCpy );
78 :
79 : /// "Pure virtual methods" of SfxPoolItem.
80 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
81 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
82 : virtual bool GetPresentation( SfxItemPresentation ePres,
83 : SfxMapUnit eCoreMetric,
84 : SfxMapUnit ePresMetric,
85 : OUString &rText,
86 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
87 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
88 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
89 :
90 54020 : sal_Int16 GetHoriOrient() const { return eOrient; }
91 13918 : sal_Int16 GetRelationOrient() const { return eRelation; }
92 180 : void SetHoriOrient( sal_Int16 eNew ) { eOrient = eNew; }
93 0 : void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
94 :
95 31904 : SwTwips GetPos() const { return nXPos; }
96 9724 : void SetPos( SwTwips nNew ) { nXPos = nNew; }
97 :
98 15904 : bool IsPosToggle() const { return bPosToggle; }
99 2268 : void SetPosToggle( bool bNew ) { bPosToggle = bNew; }
100 : };
101 :
102 0 : inline SwFmtVertOrient &SwFmtVertOrient::operator=( const SwFmtVertOrient &rCpy )
103 : {
104 0 : m_nYPos = rCpy.GetPos();
105 0 : m_eOrient = rCpy.GetVertOrient();
106 0 : m_eRelation = rCpy.GetRelationOrient();
107 0 : return *this;
108 : }
109 0 : inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy )
110 : {
111 0 : nXPos = rCpy.GetPos();
112 0 : eOrient = rCpy.GetHoriOrient();
113 0 : eRelation = rCpy.GetRelationOrient();
114 0 : bPosToggle = rCpy.IsPosToggle();
115 0 : return *this;
116 : }
117 :
118 123675 : inline const SwFmtVertOrient &SwAttrSet::GetVertOrient(bool bInP) const
119 123675 : { return (const SwFmtVertOrient&)Get( RES_VERT_ORIENT,bInP); }
120 38018 : inline const SwFmtHoriOrient &SwAttrSet::GetHoriOrient(bool bInP) const
121 38018 : { return (const SwFmtHoriOrient&)Get( RES_HORI_ORIENT,bInP); }
122 :
123 83051 : inline const SwFmtVertOrient &SwFmt::GetVertOrient(bool bInP) const
124 83051 : { return aSet.GetVertOrient(bInP); }
125 38018 : inline const SwFmtHoriOrient &SwFmt::GetHoriOrient(bool bInP) const
126 38018 : { return aSet.GetHoriOrient(bInP); }
127 :
128 : #endif
129 :
130 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|