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 13612460 : class SW_DLLPUBLIC SwFormatVertOrient: 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 : SwFormatVertOrient( 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 SwFormatVertOrient &operator=( const SwFormatVertOrient &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 63724 : sal_Int16 GetVertOrient() const { return m_eOrient; }
59 16866 : sal_Int16 GetRelationOrient() const { return m_eRelation; }
60 6677459 : void SetVertOrient( sal_Int16 eNew ) { m_eOrient = eNew; }
61 6 : void SetRelationOrient( sal_Int16 eNew ) { m_eRelation = eNew; }
62 :
63 25422 : SwTwips GetPos() const { return m_nYPos; }
64 6216 : void SetPos( SwTwips nNew ) { m_nYPos = nNew; }
65 :
66 : void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
67 : };
68 :
69 48860 : class SW_DLLPUBLIC SwFormatHoriOrient: public SfxPoolItem
70 : {
71 : SwTwips m_nXPos; ///< Contains *always* the current RelPos.
72 : sal_Int16 m_eOrient;
73 : sal_Int16 m_eRelation;
74 : bool m_bPosToggle : 1; ///< Flip position on even pages.
75 : public:
76 : TYPEINFO_OVERRIDE();
77 : SwFormatHoriOrient( SwTwips nX = 0, sal_Int16 eHori = com::sun::star::text::HoriOrientation::NONE,
78 : sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA, bool bPos = false );
79 : inline SwFormatHoriOrient &operator=( const SwFormatHoriOrient &rCpy );
80 :
81 : /// "Pure virtual methods" of SfxPoolItem.
82 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
83 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
84 : virtual bool GetPresentation( SfxItemPresentation ePres,
85 : SfxMapUnit eCoreMetric,
86 : SfxMapUnit ePresMetric,
87 : OUString &rText,
88 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
89 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
90 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
91 :
92 32664 : sal_Int16 GetHoriOrient() const { return m_eOrient; }
93 7527 : sal_Int16 GetRelationOrient() const { return m_eRelation; }
94 189 : void SetHoriOrient( sal_Int16 eNew ) { m_eOrient = eNew; }
95 0 : void SetRelationOrient( sal_Int16 eNew ) { m_eRelation = eNew; }
96 :
97 17790 : SwTwips GetPos() const { return m_nXPos; }
98 5440 : void SetPos( SwTwips nNew ) { m_nXPos = nNew; }
99 :
100 8881 : bool IsPosToggle() const { return m_bPosToggle; }
101 1454 : void SetPosToggle( bool bNew ) { m_bPosToggle = bNew; }
102 :
103 : void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
104 : };
105 :
106 0 : inline SwFormatVertOrient &SwFormatVertOrient::operator=( const SwFormatVertOrient &rCpy )
107 : {
108 0 : m_nYPos = rCpy.GetPos();
109 0 : m_eOrient = rCpy.GetVertOrient();
110 0 : m_eRelation = rCpy.GetRelationOrient();
111 0 : return *this;
112 : }
113 0 : inline SwFormatHoriOrient &SwFormatHoriOrient::operator=( const SwFormatHoriOrient &rCpy )
114 : {
115 0 : m_nXPos = rCpy.GetPos();
116 0 : m_eOrient = rCpy.GetHoriOrient();
117 0 : m_eRelation = rCpy.GetRelationOrient();
118 0 : m_bPosToggle = rCpy.IsPosToggle();
119 0 : return *this;
120 : }
121 :
122 62941 : inline const SwFormatVertOrient &SwAttrSet::GetVertOrient(bool bInP) const
123 62941 : { return static_cast<const SwFormatVertOrient&>(Get( RES_VERT_ORIENT,bInP)); }
124 23779 : inline const SwFormatHoriOrient &SwAttrSet::GetHoriOrient(bool bInP) const
125 23779 : { return static_cast<const SwFormatHoriOrient&>(Get( RES_HORI_ORIENT,bInP)); }
126 :
127 41259 : inline const SwFormatVertOrient &SwFormat::GetVertOrient(bool bInP) const
128 41259 : { return m_aSet.GetVertOrient(bInP); }
129 23779 : inline const SwFormatHoriOrient &SwFormat::GetHoriOrient(bool bInP) const
130 23779 : { return m_aSet.GetHoriOrient(bInP); }
131 :
132 : #endif
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|