xref: /aoo41x/main/sw/source/ui/inc/frmmgr.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _FRMMGR_HXX
24cdf0e10cSrcweir #define _FRMMGR_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "swtypes.hxx"
27cdf0e10cSrcweir #include "frmatr.hxx"
28cdf0e10cSrcweir #include <editeng/svxenum.hxx>
29cdf0e10cSrcweir #include <tools/gen.hxx>
30cdf0e10cSrcweir #include <fmtfsize.hxx>
31cdf0e10cSrcweir #include <fmtsrnd.hxx>
32cdf0e10cSrcweir #include <fmtornt.hxx>
33cdf0e10cSrcweir #include <fmtanchr.hxx>
34cdf0e10cSrcweir #include "swdllapi.h"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class	SwWrtShell;
37cdf0e10cSrcweir struct  SvxSwFrameValidation;
38cdf0e10cSrcweir struct  SwPosition;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class	SwFmt;
41cdf0e10cSrcweir class	SwFmtCol;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir const SwTwips	DFLT_WIDTH		= MM50 * 4;
44cdf0e10cSrcweir const SwTwips	DFLT_HEIGHT 	= MM50;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #define FULL_ATTRSET	0xffff
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #define FRMMGR_TYPE_NONE	0x00
49cdf0e10cSrcweir #define FRMMGR_TYPE_TEXT 	0x01
50cdf0e10cSrcweir #define FRMMGR_TYPE_GRF  	0x02
51cdf0e10cSrcweir #define FRMMGR_TYPE_OLE  	0x04
52cdf0e10cSrcweir #define FRMMGR_TYPE_LABEL   0x08
53cdf0e10cSrcweir #define FRMMGR_TYPE_ENVELP	0x10
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class SW_DLLPUBLIC SwFlyFrmAttrMgr
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	SfxItemSet	aSet;
58cdf0e10cSrcweir 	Point		aAbsPos;
59cdf0e10cSrcweir 	SwWrtShell	*pOwnSh;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	sal_Bool		bAbsPos,
62cdf0e10cSrcweir 				bNewFrm;
63cdf0e10cSrcweir     sal_Bool        bIsInVertical;
64cdf0e10cSrcweir     // --> OD 2009-09-01 #mongolianlayout#
65cdf0e10cSrcweir     sal_Bool        bIsInVerticalL2R;
66cdf0e10cSrcweir     // <--
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	// interne Verrechnung fuer Umrandung
69cdf0e10cSrcweir 	SW_DLLPRIVATE SwTwips 			CalcTopSpace();
70cdf0e10cSrcweir 	SW_DLLPRIVATE SwTwips 			CalcBottomSpace();
71cdf0e10cSrcweir 	SW_DLLPRIVATE SwTwips 			CalcLeftSpace();
72cdf0e10cSrcweir 	SW_DLLPRIVATE SwTwips 			CalcRightSpace();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	SW_DLLPRIVATE void _UpdateFlyFrm();	//Nacharbeit nach Einfuegen oder Update
75cdf0e10cSrcweir 
76cdf0e10cSrcweir public:
77cdf0e10cSrcweir 	SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, sal_uInt8 nType );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	//CopyCtor fuer die Dialoge, zum Pruefen der Metrics
80cdf0e10cSrcweir 	SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell *pSh, const SfxItemSet &rSet );
81cdf0e10cSrcweir 
GetShell()82cdf0e10cSrcweir 	inline SwWrtShell*	GetShell() { return pOwnSh; }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	void				SetAnchor(RndStdIds eId);
85cdf0e10cSrcweir 	inline RndStdIds	GetAnchor()  const;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     void                SetHorzOrientation(sal_Int16 eOrient);
88cdf0e10cSrcweir     void                SetVertOrientation(sal_Int16 eOrient);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	// Absolute Position
91cdf0e10cSrcweir 	void				SetAbsPos(const Point& rLPoint);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	// Relative Position vom Anker
94cdf0e10cSrcweir 	void				SetPos(const Point& rLPoint);
95cdf0e10cSrcweir 	inline Point		GetPos() const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	// Groesse
98cdf0e10cSrcweir 	void				SetSize(const Size& rLSize);
99cdf0e10cSrcweir 	inline const Size&	GetSize() const;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	inline sal_uInt16		GetHeightPercent() const;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     void                SetHeightSizeType(SwFrmSize eType);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	// Abstand zum Inhalt
106cdf0e10cSrcweir 	void				SetLRSpace( long nLeft	= LONG_MAX,
107cdf0e10cSrcweir 									long nRight = LONG_MAX );
108cdf0e10cSrcweir 	void				SetULSpace( long nTop	= LONG_MAX,
109cdf0e10cSrcweir 									long nBottom= LONG_MAX );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	void				SetCol( const SwFmtCol &rCol);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	// Attribute aendern und erfragen
114cdf0e10cSrcweir 	void				UpdateAttrMgr();
115cdf0e10cSrcweir 	void				UpdateFlyFrm();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// neuen Rahmen erzeugen
118cdf0e10cSrcweir 	sal_Bool				InsertFlyFrm();
119cdf0e10cSrcweir 	void				InsertFlyFrm(RndStdIds		eAnchorType,
120cdf0e10cSrcweir 								   const Point	  &rPos,
121cdf0e10cSrcweir 								   const Size	  &rSize,
122cdf0e10cSrcweir 								   sal_Bool 		  bAbsPos = sal_False);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	// Metriken pruefen und  aendern
125cdf0e10cSrcweir     void                ValidateMetrics(SvxSwFrameValidation& rVal,
126cdf0e10cSrcweir                             const SwPosition* pToCharCntntPos,
127cdf0e10cSrcweir                             sal_Bool bOnlyPercentRefValue = sal_False);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	void				DelAttr(sal_uInt16 nId);
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	// Set rausreichen
GetAttrSet() const132cdf0e10cSrcweir 	inline const SfxItemSet &GetAttrSet() const { return aSet; }
GetAttrSet()133cdf0e10cSrcweir 	inline 		 SfxItemSet &GetAttrSet() 		{ return aSet; }
134cdf0e10cSrcweir 	void					 SetAttrSet(const SfxItemSet& rSet);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	inline const SwFmtVertOrient &GetVertOrient() const;
137cdf0e10cSrcweir 	inline const SwFmtHoriOrient &GetHoriOrient() const;
138cdf0e10cSrcweir 	inline const SvxShadowItem   &GetShadow() const;
139cdf0e10cSrcweir 	inline const SvxBoxItem		 &GetBox() const;
140cdf0e10cSrcweir 	inline const SwFmtSurround	 &GetSurround() const;
141cdf0e10cSrcweir 	inline const SwFmtFrmSize    &GetFrmSize() const;
142cdf0e10cSrcweir 
CalcWidthBorder()143cdf0e10cSrcweir 	long CalcWidthBorder()  { return CalcLeftSpace()+CalcRightSpace(); }
CalcHeightBorder()144cdf0e10cSrcweir 	long CalcHeightBorder() { return CalcTopSpace()+CalcBottomSpace(); }
145cdf0e10cSrcweir };
146cdf0e10cSrcweir 
GetSize() const147cdf0e10cSrcweir inline const Size& SwFlyFrmAttrMgr::GetSize() const
148cdf0e10cSrcweir {
149cdf0e10cSrcweir 	return ((SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE)).GetSize();
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
GetVertOrient() const152cdf0e10cSrcweir inline const SwFmtVertOrient &SwFlyFrmAttrMgr::GetVertOrient() const
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 	return ((SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT));
155cdf0e10cSrcweir }
GetHoriOrient() const156cdf0e10cSrcweir inline const SwFmtHoriOrient &SwFlyFrmAttrMgr::GetHoriOrient() const
157cdf0e10cSrcweir {
158cdf0e10cSrcweir 	return ((SwFmtHoriOrient &)aSet.Get(RES_HORI_ORIENT));
159cdf0e10cSrcweir }
GetFrmSize() const160cdf0e10cSrcweir inline const SwFmtFrmSize& SwFlyFrmAttrMgr::GetFrmSize() const
161cdf0e10cSrcweir {
162cdf0e10cSrcweir 	return ((SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE));
163cdf0e10cSrcweir }
GetShadow() const164cdf0e10cSrcweir inline const SvxShadowItem &SwFlyFrmAttrMgr::GetShadow() const
165cdf0e10cSrcweir {
166cdf0e10cSrcweir 	return ((SvxShadowItem&)aSet.Get(RES_SHADOW));
167cdf0e10cSrcweir }
GetBox() const168cdf0e10cSrcweir inline const SvxBoxItem	&SwFlyFrmAttrMgr::GetBox() const
169cdf0e10cSrcweir {
170cdf0e10cSrcweir 	return ((SvxBoxItem&)aSet.Get(RES_BOX));
171cdf0e10cSrcweir }
GetSurround() const172cdf0e10cSrcweir inline const SwFmtSurround &SwFlyFrmAttrMgr::GetSurround() const
173cdf0e10cSrcweir {
174cdf0e10cSrcweir 	return ((SwFmtSurround&)aSet.Get(RES_SURROUND));
175cdf0e10cSrcweir }
176cdf0e10cSrcweir 
GetPos() const177cdf0e10cSrcweir inline Point SwFlyFrmAttrMgr::GetPos() const
178cdf0e10cSrcweir {
179cdf0e10cSrcweir 	return Point( GetHoriOrient().GetPos(), GetVertOrient().GetPos() );
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
GetAnchor() const182cdf0e10cSrcweir inline RndStdIds SwFlyFrmAttrMgr::GetAnchor()  const
183cdf0e10cSrcweir {
184cdf0e10cSrcweir 	return ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
185cdf0e10cSrcweir }
186cdf0e10cSrcweir 
GetHeightPercent() const187cdf0e10cSrcweir inline sal_uInt16 SwFlyFrmAttrMgr::GetHeightPercent() const
188cdf0e10cSrcweir {
189cdf0e10cSrcweir 	return GetFrmSize().GetHeightPercent();
190cdf0e10cSrcweir }
191cdf0e10cSrcweir 
192cdf0e10cSrcweir #endif
193