xref: /aoo41x/main/sw/inc/fmtornt.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _FMTORNT_HXX
28 #define _FMTORNT_HXX
29 
30 #include <com/sun/star/text/HoriOrientation.hpp>
31 #include <com/sun/star/text/VertOrientation.hpp>
32 #include <com/sun/star/text/RelOrientation.hpp>
33 #include "swdllapi.h"
34 #include <hintids.hxx>
35 #include <swtypes.hxx>
36 #include <format.hxx>
37 #include <svl/poolitem.hxx>
38 
39 
40 class IntlWrapper;
41 
42 #define IVER_VERTORIENT_REL ((sal_uInt16)0x0001)
43 
44 class SW_DLLPUBLIC SwFmtVertOrient: public SfxPoolItem
45 {
46     SwTwips         nYPos;  //Enthaelt _immer_ die aktuelle RelPos.
47     sal_Int16       eOrient;
48     sal_Int16       eRelation;
49 public:
50 	TYPEINFO();
51     SwFmtVertOrient( SwTwips nY = 0, sal_Int16 eVert = com::sun::star::text::VertOrientation::NONE,
52                      sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA );
53 	inline SwFmtVertOrient &operator=( const SwFmtVertOrient &rCpy );
54 
55 	// "pure virtual Methoden" vom SfxPoolItem
56 	virtual int             operator==( const SfxPoolItem& ) const;
57 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
58 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
59 									SfxMapUnit eCoreMetric,
60 									SfxMapUnit ePresMetric,
61 									String &rText,
62                                     const IntlWrapper*    pIntl = 0 ) const;
63 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
64 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
65 
66     sal_Int16 GetVertOrient() const { return eOrient; }
67     sal_Int16 GetRelationOrient() const { return eRelation; }
68     void   SetVertOrient( sal_Int16 eNew ) { eOrient = eNew; }
69     void   SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
70 
71 	SwTwips GetPos() const { return nYPos; }
72 	void    SetPos( SwTwips nNew ) { nYPos = nNew; }
73 };
74 
75 //SwFmtHoriOrient, wie und woran orientiert --
76 //	sich der FlyFrm in der Hoizontalen ----------
77 
78 #define IVER_HORIORIENT_TOGGLE ((sal_uInt16)0x0001)
79 #define IVER_HORIORIENT_REL ((sal_uInt16)0x0002)
80 
81 class SW_DLLPUBLIC SwFmtHoriOrient: public SfxPoolItem
82 {
83     SwTwips         nXPos;  //Enthaelt _immer_ die aktuelle RelPos.
84     sal_Int16       eOrient;
85     sal_Int16       eRelation;
86     sal_Bool            bPosToggle : 1; // auf geraden Seiten Position spiegeln
87 public:
88 	TYPEINFO();
89     SwFmtHoriOrient( SwTwips nX = 0, sal_Int16 eHori = com::sun::star::text::HoriOrientation::NONE,
90         sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA, sal_Bool bPos = sal_False );
91 	inline SwFmtHoriOrient &operator=( const SwFmtHoriOrient &rCpy );
92 
93 	// "pure virtual Methoden" vom SfxPoolItem
94 	virtual int             operator==( const SfxPoolItem& ) const;
95 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
96 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
97 									SfxMapUnit eCoreMetric,
98 									SfxMapUnit ePresMetric,
99 									String &rText,
100                                     const IntlWrapper*    pIntl = 0 ) const;
101 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
102 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
103 
104     sal_Int16 GetHoriOrient() const { return eOrient; }
105     sal_Int16 GetRelationOrient() const { return eRelation; }
106     void SetHoriOrient( sal_Int16 eNew ) { eOrient = eNew; }
107     void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
108 
109 	SwTwips GetPos() const { return nXPos; }
110 	void    SetPos( SwTwips nNew ) { nXPos = nNew; }
111 
112 	sal_Bool IsPosToggle() const { return bPosToggle; }
113 	void SetPosToggle( sal_Bool bNew ) { bPosToggle = bNew; }
114 };
115 
116 inline SwFmtVertOrient &SwFmtVertOrient::operator=( const SwFmtVertOrient &rCpy )
117 {
118 	nYPos = rCpy.GetPos();
119 	eOrient = rCpy.GetVertOrient();
120 	eRelation = rCpy.GetRelationOrient();
121 	return *this;
122 }
123 inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy )
124 {
125 	nXPos = rCpy.GetPos();
126 	eOrient = rCpy.GetHoriOrient();
127 	eRelation = rCpy.GetRelationOrient();
128 	bPosToggle = rCpy.IsPosToggle();
129 	return *this;
130 }
131 
132 inline const SwFmtVertOrient &SwAttrSet::GetVertOrient(sal_Bool bInP) const
133 	{ return (const SwFmtVertOrient&)Get( RES_VERT_ORIENT,bInP); }
134 inline const SwFmtHoriOrient &SwAttrSet::GetHoriOrient(sal_Bool bInP) const
135 	{ return (const SwFmtHoriOrient&)Get( RES_HORI_ORIENT,bInP); }
136 
137 inline const SwFmtVertOrient &SwFmt::GetVertOrient(sal_Bool bInP) const
138 	{ return aSet.GetVertOrient(bInP); }
139 inline const SwFmtHoriOrient &SwFmt::GetHoriOrient(sal_Bool bInP) const
140 	{ return aSet.GetHoriOrient(bInP); }
141 
142 #endif
143 
144