xref: /AOO41X/main/sw/inc/fmtornt.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
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 
51     // "pure virtual Methoden" vom SfxPoolItem
52     virtual int             operator==( const SfxPoolItem& ) const;
53     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
54     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
55                                     SfxMapUnit eCoreMetric,
56                                     SfxMapUnit ePresMetric,
57                                     String &rText,
58                                     const IntlWrapper*    pIntl = 0 ) const;
59     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
60     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
61 
GetVertOrient() const62     sal_Int16 GetVertOrient() const { return eOrient; }
GetRelationOrient() const63     sal_Int16 GetRelationOrient() const { return eRelation; }
SetVertOrient(sal_Int16 eNew)64     void   SetVertOrient( sal_Int16 eNew ) { eOrient = eNew; }
SetRelationOrient(sal_Int16 eNew)65     void   SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
66 
GetPos() const67     SwTwips GetPos() const { return nYPos; }
SetPos(SwTwips nNew)68     void    SetPos( SwTwips nNew ) { nYPos = nNew; }
69 };
70 
71 //SwFmtHoriOrient, wie und woran orientiert --
72 //  sich der FlyFrm in der Hoizontalen ----------
73 
74 #define IVER_HORIORIENT_TOGGLE ((sal_uInt16)0x0001)
75 #define IVER_HORIORIENT_REL ((sal_uInt16)0x0002)
76 
77 class SW_DLLPUBLIC SwFmtHoriOrient: public SfxPoolItem
78 {
79     SwTwips         nXPos;  //Enthaelt _immer_ die aktuelle RelPos.
80     sal_Int16       eOrient;
81     sal_Int16       eRelation;
82     sal_Bool            bPosToggle : 1; // auf geraden Seiten Position spiegeln
83 public:
84     TYPEINFO();
85     SwFmtHoriOrient( SwTwips nX = 0, sal_Int16 eHori = com::sun::star::text::HoriOrientation::NONE,
86         sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA, sal_Bool bPos = sal_False );
87     inline SwFmtHoriOrient &operator=( const SwFmtHoriOrient &rCpy );
88 
89     // "pure virtual Methoden" vom SfxPoolItem
90     virtual int             operator==( const SfxPoolItem& ) const;
91     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
92     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
93                                     SfxMapUnit eCoreMetric,
94                                     SfxMapUnit ePresMetric,
95                                     String &rText,
96                                     const IntlWrapper*    pIntl = 0 ) const;
97     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
98     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
99 
GetHoriOrient() const100     sal_Int16 GetHoriOrient() const { return eOrient; }
GetRelationOrient() const101     sal_Int16 GetRelationOrient() const { return eRelation; }
SetHoriOrient(sal_Int16 eNew)102     void SetHoriOrient( sal_Int16 eNew ) { eOrient = eNew; }
SetRelationOrient(sal_Int16 eNew)103     void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
104 
GetPos() const105     SwTwips GetPos() const { return nXPos; }
SetPos(SwTwips nNew)106     void    SetPos( SwTwips nNew ) { nXPos = nNew; }
107 
IsPosToggle() const108     sal_Bool IsPosToggle() const { return bPosToggle; }
SetPosToggle(sal_Bool bNew)109     void SetPosToggle( sal_Bool bNew ) { bPosToggle = bNew; }
110 };
111 
operator =(const SwFmtVertOrient & rCpy)112 inline SwFmtVertOrient &SwFmtVertOrient::operator=( const SwFmtVertOrient &rCpy )
113 {
114     nYPos = rCpy.GetPos();
115     eOrient = rCpy.GetVertOrient();
116     eRelation = rCpy.GetRelationOrient();
117     return *this;
118 }
operator =(const SwFmtHoriOrient & rCpy)119 inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy )
120 {
121     nXPos = rCpy.GetPos();
122     eOrient = rCpy.GetHoriOrient();
123     eRelation = rCpy.GetRelationOrient();
124     bPosToggle = rCpy.IsPosToggle();
125     return *this;
126 }
127 
GetVertOrient(sal_Bool bInP) const128 inline const SwFmtVertOrient &SwAttrSet::GetVertOrient(sal_Bool bInP) const
129     { return (const SwFmtVertOrient&)Get( RES_VERT_ORIENT,bInP); }
GetHoriOrient(sal_Bool bInP) const130 inline const SwFmtHoriOrient &SwAttrSet::GetHoriOrient(sal_Bool bInP) const
131     { return (const SwFmtHoriOrient&)Get( RES_HORI_ORIENT,bInP); }
132 
GetVertOrient(sal_Bool bInP) const133 inline const SwFmtVertOrient &SwFmt::GetVertOrient(sal_Bool bInP) const
134     { return aSet.GetVertOrient(bInP); }
GetHoriOrient(sal_Bool bInP) const135 inline const SwFmtHoriOrient &SwFmt::GetHoriOrient(sal_Bool bInP) const
136     { return aSet.GetHoriOrient(bInP); }
137 
138 #endif
139 
140