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