xref: /aoo41x/main/sw/source/core/inc/flyfrms.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 _FLYFRMS_HXX
24cdf0e10cSrcweir #define _FLYFRMS_HXX
25cdf0e10cSrcweir #include "flyfrm.hxx"
26cdf0e10cSrcweir // --> OD 2004-06-23 #i28701#
27cdf0e10cSrcweir class SwFlyAtCntFrm;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir //Basisklasse fuer diejenigen Flys, die sich relativ frei Bewegen koennen -
30cdf0e10cSrcweir //also die nicht _im_ Inhalt gebundenen Flys.
31cdf0e10cSrcweir class SwFlyFreeFrm : public SwFlyFrm
32cdf0e10cSrcweir {
33cdf0e10cSrcweir     SwPageFrm *pPage;   //Bei dieser Seite ist der Fly angemeldet.
34cdf0e10cSrcweir 
35cdf0e10cSrcweir     // --> OD 2004-11-15 #i34753# - flag for at-page anchored Writer fly frames
36cdf0e10cSrcweir     // to prevent a positioning - call of method <MakeObjPos()> -, if Writer
37cdf0e10cSrcweir     // fly frame is already clipped during its format by the object formatter.
38cdf0e10cSrcweir     bool mbNoMakePos;
39cdf0e10cSrcweir     // <--
40cdf0e10cSrcweir     // --> OD 2004-11-12 #i37068# - flag to prevent move in method
41cdf0e10cSrcweir     // <CheckClip(..)>
42cdf0e10cSrcweir     bool mbNoMoveOnCheckClip;
43cdf0e10cSrcweir     // <--
44cdf0e10cSrcweir     void CheckClip( const SwFmtFrmSize &rSz );  //'Emergency' Clipping.
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     /** determines, if direct environment of fly frame has 'auto' size
47cdf0e10cSrcweir 
48cdf0e10cSrcweir         OD 07.08.2003 #i17297#, #111066#, #111070#
49cdf0e10cSrcweir         start with anchor frame and search for a header, footer, row or fly frame
50cdf0e10cSrcweir         stopping at page frame.
51cdf0e10cSrcweir         return <true>, if such a frame is found and it has 'auto' size.
52cdf0e10cSrcweir         otherwise <false> is returned.
53cdf0e10cSrcweir 
54cdf0e10cSrcweir         @author OD
55cdf0e10cSrcweir 
56cdf0e10cSrcweir         @return boolean indicating, that direct environment has 'auto' size
57cdf0e10cSrcweir     */
58cdf0e10cSrcweir     bool HasEnvironmentAutoSize() const;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir protected:
61cdf0e10cSrcweir     // OD 2004-05-12 #i28701# - new friend class <SwFlyNotify> for access to
62cdf0e10cSrcweir     // method <NotifyBackground>
63cdf0e10cSrcweir     friend class SwFlyNotify;
64cdf0e10cSrcweir 	virtual void NotifyBackground( SwPageFrm *pPage,
65cdf0e10cSrcweir 								   const SwRect& rRect, PrepareHint eHint);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	SwFlyFreeFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir     // --> OD 2004-06-29 #i28701#
71cdf0e10cSrcweir     TYPEINFO();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	virtual ~SwFlyFreeFrm();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	virtual void MakeAll();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     // --> OD 2004-11-12 #i37068# - accessors for member <mbNoMoveOnCheckClip>
SetNoMoveOnCheckClip(const bool _bNewNoMoveOnCheckClip)78cdf0e10cSrcweir     inline void SetNoMoveOnCheckClip( const bool _bNewNoMoveOnCheckClip )
79cdf0e10cSrcweir     {
80cdf0e10cSrcweir         mbNoMoveOnCheckClip = _bNewNoMoveOnCheckClip;
81cdf0e10cSrcweir     }
IsNoMoveOnCheckClip() const82cdf0e10cSrcweir     inline bool IsNoMoveOnCheckClip() const
83cdf0e10cSrcweir     {
84cdf0e10cSrcweir         return mbNoMoveOnCheckClip;
85cdf0e10cSrcweir     }
86cdf0e10cSrcweir     // <--
87cdf0e10cSrcweir     // --> OD 2004-11-15 #i34753# - accessors for member <mbNoMakePos>
SetNoMakePos(const bool _bNoMakePos)88cdf0e10cSrcweir     inline void SetNoMakePos( const bool _bNoMakePos )
89cdf0e10cSrcweir     {
90cdf0e10cSrcweir         if ( IsFlyLayFrm() )
91cdf0e10cSrcweir         {
92cdf0e10cSrcweir             mbNoMakePos = _bNoMakePos;
93cdf0e10cSrcweir         }
94cdf0e10cSrcweir     }
IsNoMakePos() const95cdf0e10cSrcweir     inline bool IsNoMakePos() const
96cdf0e10cSrcweir     {
97cdf0e10cSrcweir         if ( IsFlyLayFrm() )
98cdf0e10cSrcweir         {
99cdf0e10cSrcweir             return mbNoMakePos;
100cdf0e10cSrcweir         }
101cdf0e10cSrcweir         else
102cdf0e10cSrcweir         {
103cdf0e10cSrcweir             return false;
104cdf0e10cSrcweir         }
105cdf0e10cSrcweir     }
106cdf0e10cSrcweir     // <--
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     /** method to determine, if a format on the Writer fly frame is possible
109cdf0e10cSrcweir 
110cdf0e10cSrcweir         OD 2004-05-11 #i28701#
111cdf0e10cSrcweir         refine 'IsFormatPossible'-conditions of method
112cdf0e10cSrcweir         <SwFlyFrm::IsFormatPossible()> by:
113cdf0e10cSrcweir         format isn't possible, if Writer fly frame isn't registered at a page frame
114cdf0e10cSrcweir         and its anchor frame isn't inside another Writer fly frame.
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         @author OD
117cdf0e10cSrcweir     */
118cdf0e10cSrcweir     virtual bool IsFormatPossible() const;
119cdf0e10cSrcweir };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir //Die Fly's, die an einem Layoutfrm haengen und nicht inhaltsgebunden sind
123cdf0e10cSrcweir class SwFlyLayFrm : public SwFlyFreeFrm
124cdf0e10cSrcweir {
125cdf0e10cSrcweir public:
126cdf0e10cSrcweir     // --> OD 2004-06-29 #i28701#
127cdf0e10cSrcweir     TYPEINFO();
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     SwFlyLayFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
130cdf0e10cSrcweir 	SwFlyLayFrm( SwFlyLayFrm& );
131cdf0e10cSrcweir protected:
132cdf0e10cSrcweir 	virtual	void Modify( const SfxPoolItem*, const SfxPoolItem* );
133cdf0e10cSrcweir };
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //Die Flys, die an einem Cntnt haengen nicht aber im Inhalt
136cdf0e10cSrcweir class SwFlyAtCntFrm : public SwFlyFreeFrm
137cdf0e10cSrcweir {
138cdf0e10cSrcweir protected:
139cdf0e10cSrcweir     virtual void MakeAll();
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     // OD 2004-05-12 #i28701#
142cdf0e10cSrcweir     virtual bool _InvalidationAllowed( const InvalidationType _nInvalid ) const;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     /** method to assure that anchored object is registered at the correct
145cdf0e10cSrcweir         page frame
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         OD 2004-07-02 #i28701#
148cdf0e10cSrcweir 
149cdf0e10cSrcweir         @author OD
150cdf0e10cSrcweir     */
151cdf0e10cSrcweir     virtual void RegisterAtCorrectPage();
152cdf0e10cSrcweir 	virtual	void Modify( const SfxPoolItem*, const SfxPoolItem* );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir public:
155cdf0e10cSrcweir     // --> OD 2004-06-29 #i28701#
156cdf0e10cSrcweir     TYPEINFO();
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     SwFlyAtCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 	void SetAbsPos( const Point &rNew );
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     // OD 2004-03-23 #i26791#
163cdf0e10cSrcweir     virtual void MakeObjPos();
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     /** method to determine, if a format on the Writer fly frame is possible
166cdf0e10cSrcweir 
167cdf0e10cSrcweir         OD 2004-05-11 #i28701#
168cdf0e10cSrcweir         refine 'IsFormatPossible'-conditions of method
169cdf0e10cSrcweir         <SwFlyFreeFrm::IsFormatPossible()> by:
170cdf0e10cSrcweir         format isn't possible, if method <MakeAll()> is already in progress.
171cdf0e10cSrcweir 
172cdf0e10cSrcweir         @author OD
173cdf0e10cSrcweir     */
174cdf0e10cSrcweir     virtual bool IsFormatPossible() const;
175cdf0e10cSrcweir };
176cdf0e10cSrcweir 
177cdf0e10cSrcweir //Die Flys, die an einem Zeichen in einem Cntnt haengen.
178cdf0e10cSrcweir class SwFlyInCntFrm : public SwFlyFrm
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     Point aRef;  //Relativ zu diesem Point wird die AbsPos berechnet.
181cdf0e10cSrcweir 	long  nLine; //Zeilenhoehe, Ref.Y() - nLine == Zeilenanfang.
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	sal_Bool bInvalidLayout :1;
184cdf0e10cSrcweir 	sal_Bool bInvalidCntnt	:1;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir protected:
187cdf0e10cSrcweir     virtual void NotifyBackground( SwPageFrm *pPage,
188cdf0e10cSrcweir 								   const SwRect& rRect, PrepareHint eHint);
189cdf0e10cSrcweir 	virtual void MakeAll();
190cdf0e10cSrcweir 	virtual	void  Modify( const SfxPoolItem*, const SfxPoolItem* );
191cdf0e10cSrcweir 
192cdf0e10cSrcweir public:
193cdf0e10cSrcweir     // --> OD 2004-06-29 #i28701#
194cdf0e10cSrcweir     TYPEINFO();
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 	SwFlyInCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 	virtual ~SwFlyInCntFrm();
199cdf0e10cSrcweir 	virtual void  Format(  const SwBorderAttrs *pAttrs = 0 );
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 	void SetRefPoint( const Point& rPoint, const Point &rRelAttr,
202cdf0e10cSrcweir 		const Point &rRelPos );
GetRefPoint() const203cdf0e10cSrcweir 	const Point &GetRefPoint() const { return aRef; }
204cdf0e10cSrcweir     const Point GetRelPos() const;
GetLineHeight() const205cdf0e10cSrcweir 		  long   GetLineHeight() const { return nLine; }
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	inline void InvalidateLayout() const;
208cdf0e10cSrcweir 	inline void InvalidateCntnt() const;
209cdf0e10cSrcweir 	inline void ValidateLayout() const;
210cdf0e10cSrcweir 	inline void ValidateCntnt() const;
IsInvalid() const211cdf0e10cSrcweir 	sal_Bool IsInvalid() const { return (bInvalidLayout || bInvalidCntnt); }
IsInvalidLayout() const212cdf0e10cSrcweir 	sal_Bool IsInvalidLayout() const { return bInvalidLayout; }
IsInvalidCntnt() const213cdf0e10cSrcweir 	sal_Bool IsInvalidCntnt() const { return bInvalidCntnt; }
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 	//BP 26.11.93: vgl. tabfrm.hxx, gilt bestimmt aber fuer andere auch...
217cdf0e10cSrcweir 	//Zum Anmelden der Flys nachdem ein FlyCnt erzeugt _und_ eingefuegt wurde.
218cdf0e10cSrcweir 	//Muss vom Erzeuger gerufen werden, denn erst nach dem Konstruieren wird
219cdf0e10cSrcweir 	//Das Teil gepastet; mithin ist auch erst dann die Seite zum Anmelden der
220cdf0e10cSrcweir 	//Flys erreichbar.
221cdf0e10cSrcweir 	void RegistFlys();
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	//siehe layact.cxx
AddRefOfst(long nOfst)224cdf0e10cSrcweir 	void AddRefOfst( long nOfst ) { aRef.Y() += nOfst; }
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     // OD 2004-03-23 #i26791#
227cdf0e10cSrcweir     virtual void MakeObjPos();
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     // --> OD 2004-12-02 #115759# - invalidate anchor frame on invalidation
230cdf0e10cSrcweir     // of the position, because the position is calculated during the
231cdf0e10cSrcweir     // format of the anchor frame
232cdf0e10cSrcweir     virtual void _ActionOnInvalidation( const InvalidationType _nInvalid );
233cdf0e10cSrcweir     // <--
234cdf0e10cSrcweir };
235cdf0e10cSrcweir 
InvalidateLayout() const236cdf0e10cSrcweir inline void SwFlyInCntFrm::InvalidateLayout() const
237cdf0e10cSrcweir {
238cdf0e10cSrcweir 	((SwFlyInCntFrm*)this)->bInvalidLayout = sal_True;
239cdf0e10cSrcweir }
InvalidateCntnt() const240cdf0e10cSrcweir inline void SwFlyInCntFrm::InvalidateCntnt() const
241cdf0e10cSrcweir {
242cdf0e10cSrcweir 	((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_True;
243cdf0e10cSrcweir }
ValidateLayout() const244cdf0e10cSrcweir inline void SwFlyInCntFrm::ValidateLayout() const
245cdf0e10cSrcweir {
246cdf0e10cSrcweir 	((SwFlyInCntFrm*)this)->bInvalidLayout = sal_False;
247cdf0e10cSrcweir }
ValidateCntnt() const248cdf0e10cSrcweir inline void SwFlyInCntFrm::ValidateCntnt() const
249cdf0e10cSrcweir {
250cdf0e10cSrcweir 	((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_False;
251cdf0e10cSrcweir }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir #endif
254