1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: flyfrms.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 // --> OD 2004-06-23 #i28701#
36 //Basisklasse fuer diejenigen Flys, die sich relativ frei Bewegen koennen -
37 //also die nicht _im_ Inhalt gebundenen Flys.
38 class SwFlyFreeFrm
: public SwFlyFrm
40 SwPageFrm
*pPage
; //Bei dieser Seite ist der Fly angemeldet.
42 // --> OD 2004-11-15 #i34753# - flag for at-page anchored Writer fly frames
43 // to prevent a positioning - call of method <MakeObjPos()> -, if Writer
44 // fly frame is already clipped during its format by the object formatter.
47 // --> OD 2004-11-12 #i37068# - flag to prevent move in method
49 bool mbNoMoveOnCheckClip
;
51 void CheckClip( const SwFmtFrmSize
&rSz
); //'Emergency' Clipping.
53 /** determines, if direct environment of fly frame has 'auto' size
55 OD 07.08.2003 #i17297#, #111066#, #111070#
56 start with anchor frame and search for a header, footer, row or fly frame
57 stopping at page frame.
58 return <true>, if such a frame is found and it has 'auto' size.
59 otherwise <false> is returned.
63 @return boolean indicating, that direct environment has 'auto' size
65 bool HasEnvironmentAutoSize() const;
68 // OD 2004-05-12 #i28701# - new friend class <SwFlyNotify> for access to
69 // method <NotifyBackground>
70 friend class SwFlyNotify
;
71 virtual void NotifyBackground( SwPageFrm
*pPage
,
72 const SwRect
& rRect
, PrepareHint eHint
);
74 SwFlyFreeFrm( SwFlyFrmFmt
*, SwFrm
*pAnchor
);
77 // --> OD 2004-06-29 #i28701#
80 virtual ~SwFlyFreeFrm();
82 virtual void MakeAll();
84 // --> OD 2004-11-12 #i37068# - accessors for member <mbNoMoveOnCheckClip>
85 inline void SetNoMoveOnCheckClip( const bool _bNewNoMoveOnCheckClip
)
87 mbNoMoveOnCheckClip
= _bNewNoMoveOnCheckClip
;
89 inline bool IsNoMoveOnCheckClip() const
91 return mbNoMoveOnCheckClip
;
94 // --> OD 2004-11-15 #i34753# - accessors for member <mbNoMakePos>
95 inline void SetNoMakePos( const bool _bNoMakePos
)
99 mbNoMakePos
= _bNoMakePos
;
102 inline bool IsNoMakePos() const
115 /** method to determine, if a format on the Writer fly frame is possible
117 OD 2004-05-11 #i28701#
118 refine 'IsFormatPossible'-conditions of method
119 <SwFlyFrm::IsFormatPossible()> by:
120 format isn't possible, if Writer fly frame isn't registered at a page frame
121 and its anchor frame isn't inside another Writer fly frame.
125 virtual bool IsFormatPossible() const;
129 //Die Fly's, die an einem Layoutfrm haengen und nicht inhaltsgebunden sind
130 class SwFlyLayFrm
: public SwFlyFreeFrm
133 // --> OD 2004-06-29 #i28701#
136 SwFlyLayFrm( SwFlyFrmFmt
*, SwFrm
*pAnchor
);
137 SwFlyLayFrm( SwFlyLayFrm
& );
139 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
143 //Die Flys, die an einem Cntnt haengen nicht aber im Inhalt
144 class SwFlyAtCntFrm
: public SwFlyFreeFrm
147 virtual void MakeAll();
149 // OD 2004-05-12 #i28701#
150 virtual bool _InvalidationAllowed( const InvalidationType _nInvalid
) const;
152 /** method to assure that anchored object is registered at the correct
155 OD 2004-07-02 #i28701#
159 virtual void RegisterAtCorrectPage();
162 // --> OD 2004-06-29 #i28701#
165 SwFlyAtCntFrm( SwFlyFrmFmt
*, SwFrm
*pAnchor
);
167 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
169 void SetAbsPos( const Point
&rNew
);
171 // OD 2004-03-23 #i26791#
172 virtual void MakeObjPos();
174 /** method to determine, if a format on the Writer fly frame is possible
176 OD 2004-05-11 #i28701#
177 refine 'IsFormatPossible'-conditions of method
178 <SwFlyFreeFrm::IsFormatPossible()> by:
179 format isn't possible, if method <MakeAll()> is already in progress.
183 virtual bool IsFormatPossible() const;
186 //Die Flys, die an einem Zeichen in einem Cntnt haengen.
187 class SwFlyInCntFrm
: public SwFlyFrm
189 Point aRef
; //Relativ zu diesem Point wird die AbsPos berechnet.
190 long nLine
; //Zeilenhoehe, Ref.Y() - nLine == Zeilenanfang.
192 BOOL bInvalidLayout
:1;
193 BOOL bInvalidCntnt
:1;
196 virtual void NotifyBackground( SwPageFrm
*pPage
,
197 const SwRect
& rRect
, PrepareHint eHint
);
198 virtual void MakeAll();
201 // --> OD 2004-06-29 #i28701#
204 SwFlyInCntFrm( SwFlyFrmFmt
*, SwFrm
*pAnchor
);
206 virtual ~SwFlyInCntFrm();
207 virtual void Format( const SwBorderAttrs
*pAttrs
= 0 );
208 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
210 void SetRefPoint( const Point
& rPoint
, const Point
&rRelAttr
,
211 const Point
&rRelPos
);
212 const Point
&GetRefPoint() const { return aRef
; }
213 const Point
GetRelPos() const;
214 long GetLineHeight() const { return nLine
; }
216 inline void InvalidateLayout() const;
217 inline void InvalidateCntnt() const;
218 inline void ValidateLayout() const;
219 inline void ValidateCntnt() const;
220 BOOL
IsInvalid() const { return (bInvalidLayout
|| bInvalidCntnt
); }
221 BOOL
IsInvalidLayout() const { return bInvalidLayout
; }
222 BOOL
IsInvalidCntnt() const { return bInvalidCntnt
; }
225 //BP 26.11.93: vgl. tabfrm.hxx, gilt bestimmt aber fuer andere auch...
226 //Zum Anmelden der Flys nachdem ein FlyCnt erzeugt _und_ eingefuegt wurde.
227 //Muss vom Erzeuger gerufen werden, denn erst nach dem Konstruieren wird
228 //Das Teil gepastet; mithin ist auch erst dann die Seite zum Anmelden der
233 void AddRefOfst( long nOfst
) { aRef
.Y() += nOfst
; }
235 // OD 2004-03-23 #i26791#
236 virtual void MakeObjPos();
238 // --> OD 2004-12-02 #115759# - invalidate anchor frame on invalidation
239 // of the position, because the position is calculated during the
240 // format of the anchor frame
241 virtual void _ActionOnInvalidation( const InvalidationType _nInvalid
);
245 inline void SwFlyInCntFrm::InvalidateLayout() const
247 ((SwFlyInCntFrm
*)this)->bInvalidLayout
= TRUE
;
249 inline void SwFlyInCntFrm::InvalidateCntnt() const
251 ((SwFlyInCntFrm
*)this)->bInvalidCntnt
= TRUE
;
253 inline void SwFlyInCntFrm::ValidateLayout() const
255 ((SwFlyInCntFrm
*)this)->bInvalidLayout
= FALSE
;
257 inline void SwFlyInCntFrm::ValidateCntnt() const
259 ((SwFlyInCntFrm
*)this)->bInvalidCntnt
= FALSE
;