xref: /trunk/main/sw/inc/fmtornt.hxx (revision cea84f56765a2ac06f0f5a2718f45f6430edc781)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _FMTORNT_HXX
24 #define _FMTORNT_HXX
25 
26 #include <com/sun/star/text/HoriOrientation.hpp>
27 #include <com/sun/star/text/VertOrientation.hpp>
28 #include <com/sun/star/text/RelOrientation.hpp>
29 #include "swdllapi.h"
30 #include <hintids.hxx>
31 #include <swtypes.hxx>
32 #include <format.hxx>
33 #include <svl/poolitem.hxx>
34 
35 
36 class IntlWrapper;
37 
38 #define IVER_VERTORIENT_REL ((sal_uInt16)0x0001)
39 
40 class SW_DLLPUBLIC SwFmtVertOrient: public SfxPoolItem
41 {
42     SwTwips         nYPos;  //Enthaelt _immer_ die aktuelle RelPos.
43     sal_Int16       eOrient;
44     sal_Int16       eRelation;
45 public:
46     TYPEINFO();
47     SwFmtVertOrient( SwTwips nY = 0, sal_Int16 eVert = com::sun::star::text::VertOrientation::NONE,
48                      sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA );
49     inline SwFmtVertOrient &operator=( const SwFmtVertOrient &rCpy );
50     SwFmtVertOrient(const SwFmtVertOrient&) = default;
51 
52     // "pure virtual Methoden" vom SfxPoolItem
53     virtual int             operator==( const SfxPoolItem& ) const;
54     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
55     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
56                                     SfxMapUnit eCoreMetric,
57                                     SfxMapUnit ePresMetric,
58                                     String &rText,
59                                     const IntlWrapper*    pIntl = 0 ) const;
60     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
61     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
62 
GetVertOrient() const63     sal_Int16 GetVertOrient() const { return eOrient; }
GetRelationOrient() const64     sal_Int16 GetRelationOrient() const { return eRelation; }
SetVertOrient(sal_Int16 eNew)65     void   SetVertOrient( sal_Int16 eNew ) { eOrient = eNew; }
SetRelationOrient(sal_Int16 eNew)66     void   SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
67 
GetPos() const68     SwTwips GetPos() const { return nYPos; }
SetPos(SwTwips nNew)69     void    SetPos( SwTwips nNew ) { nYPos = nNew; }
70 };
71 
72 //SwFmtHoriOrient, wie und woran orientiert --
73 //  sich der FlyFrm in der Hoizontalen ----------
74 
75 #define IVER_HORIORIENT_TOGGLE ((sal_uInt16)0x0001)
76 #define IVER_HORIORIENT_REL ((sal_uInt16)0x0002)
77 
78 class SW_DLLPUBLIC SwFmtHoriOrient: public SfxPoolItem
79 {
80     SwTwips         nXPos;  //Enthaelt _immer_ die aktuelle RelPos.
81     sal_Int16       eOrient;
82     sal_Int16       eRelation;
83     sal_Bool            bPosToggle : 1; // auf geraden Seiten Position spiegeln
84 public:
85     TYPEINFO();
86     SwFmtHoriOrient( SwTwips nX = 0, sal_Int16 eHori = com::sun::star::text::HoriOrientation::NONE,
87         sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA, sal_Bool bPos = sal_False );
88     inline SwFmtHoriOrient &operator=( const SwFmtHoriOrient &rCpy );
89     SwFmtHoriOrient(const SwFmtHoriOrient&) = default;
90 
91     // "pure virtual Methoden" vom SfxPoolItem
92     virtual int             operator==( const SfxPoolItem& ) const;
93     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
94     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
95                                     SfxMapUnit eCoreMetric,
96                                     SfxMapUnit ePresMetric,
97                                     String &rText,
98                                     const IntlWrapper*    pIntl = 0 ) const;
99     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
100     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
101 
GetHoriOrient() const102     sal_Int16 GetHoriOrient() const { return eOrient; }
GetRelationOrient() const103     sal_Int16 GetRelationOrient() const { return eRelation; }
SetHoriOrient(sal_Int16 eNew)104     void SetHoriOrient( sal_Int16 eNew ) { eOrient = eNew; }
SetRelationOrient(sal_Int16 eNew)105     void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
106 
GetPos() const107     SwTwips GetPos() const { return nXPos; }
SetPos(SwTwips nNew)108     void    SetPos( SwTwips nNew ) { nXPos = nNew; }
109 
IsPosToggle() const110     sal_Bool IsPosToggle() const { return bPosToggle; }
SetPosToggle(sal_Bool bNew)111     void SetPosToggle( sal_Bool bNew ) { bPosToggle = bNew; }
112 };
113 
operator =(const SwFmtVertOrient & rCpy)114 inline SwFmtVertOrient &SwFmtVertOrient::operator=( const SwFmtVertOrient &rCpy )
115 {
116     nYPos = rCpy.GetPos();
117     eOrient = rCpy.GetVertOrient();
118     eRelation = rCpy.GetRelationOrient();
119     return *this;
120 }
operator =(const SwFmtHoriOrient & rCpy)121 inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy )
122 {
123     nXPos = rCpy.GetPos();
124     eOrient = rCpy.GetHoriOrient();
125     eRelation = rCpy.GetRelationOrient();
126     bPosToggle = rCpy.IsPosToggle();
127     return *this;
128 }
129 
GetVertOrient(sal_Bool bInP) const130 inline const SwFmtVertOrient &SwAttrSet::GetVertOrient(sal_Bool bInP) const
131     { return (const SwFmtVertOrient&)Get( RES_VERT_ORIENT,bInP); }
GetHoriOrient(sal_Bool bInP) const132 inline const SwFmtHoriOrient &SwAttrSet::GetHoriOrient(sal_Bool bInP) const
133     { return (const SwFmtHoriOrient&)Get( RES_HORI_ORIENT,bInP); }
134 
GetVertOrient(sal_Bool bInP) const135 inline const SwFmtVertOrient &SwFmt::GetVertOrient(sal_Bool bInP) const
136     { return aSet.GetVertOrient(bInP); }
GetHoriOrient(sal_Bool bInP) const137 inline const SwFmtHoriOrient &SwFmt::GetHoriOrient(sal_Bool bInP) const
138     { return aSet.GetHoriOrient(bInP); }
139 
140 #endif
141