xref: /aoo42x/main/sw/inc/anchoredobject.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 _ANCHOREDOBJECT_HXX
24cdf0e10cSrcweir #define _ANCHOREDOBJECT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <tools/rtti.hxx>
27cdf0e10cSrcweir #include <swtypes.hxx>
28cdf0e10cSrcweir #include <swrect.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class SdrObject;
31cdf0e10cSrcweir class SwFrm;
32cdf0e10cSrcweir class SwLayoutFrm;
33cdf0e10cSrcweir // --> OD 2004-07-14 #117380#
34cdf0e10cSrcweir class SwTxtFrm;
35cdf0e10cSrcweir // <--
36cdf0e10cSrcweir // --> OD 2004-06-30 #i28701#
37cdf0e10cSrcweir class SwPageFrm;
38cdf0e10cSrcweir class SwObjPositioningInProgress;
39cdf0e10cSrcweir // <--
40cdf0e10cSrcweir class SwFrmFmt;
41cdf0e10cSrcweir class SwFmtAnchor;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir /** wrapper class for the positioning of Writer fly frames and drawing objects
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     OD 2004-03-22 #i26791#
46cdf0e10cSrcweir     Purpose of this class is to provide a unified interface for the positioning
47cdf0e10cSrcweir     of Writer fly frames (derived classes of <SwFlyFrm>) and of drawing objects
48cdf0e10cSrcweir     (derived classes of <SwDrawFrm>).
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     @author OD
51cdf0e10cSrcweir */
52cdf0e10cSrcweir class SW_DLLPUBLIC SwAnchoredObject
53cdf0e10cSrcweir {
54cdf0e10cSrcweir     private:
55cdf0e10cSrcweir         // drawing object representing the anchored object in the drawing layer
56cdf0e10cSrcweir         SdrObject* mpDrawObj;
57cdf0e10cSrcweir         // frame the object is anchored at
58cdf0e10cSrcweir         SwFrm* mpAnchorFrm;
59cdf0e10cSrcweir         // --> OD 2004-06-30 #i28701# - page frame the object is registered at
60cdf0e10cSrcweir         // note: no page frame for as-character anchored objects
61cdf0e10cSrcweir         SwPageFrm* mpPageFrm;
62cdf0e10cSrcweir         // <--
63cdf0e10cSrcweir         // current relative position (relative to anchor position of anchor frame)
64cdf0e10cSrcweir         Point maRelPos;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir         // for to-character anchored objects:
67cdf0e10cSrcweir         // Last known anchor character retangle.
68cdf0e10cSrcweir         // Used to decide, if invalidation has to been performed, if anchor position
69cdf0e10cSrcweir         // has changed, and used to position object.
70cdf0e10cSrcweir         SwRect maLastCharRect;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir         // for to-character anchored objects:
73cdf0e10cSrcweir         // Last known top of line, in which the anchor character is in.
74cdf0e10cSrcweir         // Used to decide, if invalidation has to been performed, if anchor position
75cdf0e10cSrcweir         // has changed, and used to position object.
76cdf0e10cSrcweir         SwTwips mnLastTopOfLine;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         // for to-paragraph and to-character anchored objects:
79cdf0e10cSrcweir         // Layout frame vertical position is orient at - typically its the upper
80cdf0e10cSrcweir         // of the anchor frame, but it could also by the upper of a follow or
81cdf0e10cSrcweir         // a following layout frame in the text flow.
82cdf0e10cSrcweir         const SwLayoutFrm* mpVertPosOrientFrm;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir         // --> OD 2004-06-30 #i28701# - boolean, indicating that the object
85cdf0e10cSrcweir         // positioning algorithm is in progress.
86cdf0e10cSrcweir         bool mbPositioningInProgress;
87cdf0e10cSrcweir         // <--
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         // --> OD 2004-06-29 #i28701# - Booleans needed for the layout process.
90cdf0e10cSrcweir         // Values only of relevance for to-paragraph and to-character anchored
91cdf0e10cSrcweir         // floating screen object, for whose the 'straight-forward positioning
92cdf0e10cSrcweir         // process are applied
93cdf0e10cSrcweir         // Otherwise value of <mbConsiderForTextWrap> is treated as <true>,
94cdf0e10cSrcweir         // value of <mbPositionLocked> is treated as <false> and
95cdf0e10cSrcweir         // value of <mbRestartLayoutProcess> is treated as <false>.
96cdf0e10cSrcweir         // --> OD 2004-10-22 #i35911# - add boolean <mbClearEnvironment>
97cdf0e10cSrcweir         // Indicates that due to its position and wrapping style its layout
98cdf0e10cSrcweir         // environment is cleared - all content is moved forward.
99cdf0e10cSrcweir         // Treated as <false>, if not the 'straight-forward positioning process"
100cdf0e10cSrcweir         // is applied.
101cdf0e10cSrcweir         bool mbConsiderForTextWrap;
102cdf0e10cSrcweir         bool mbPositionLocked;
103cdf0e10cSrcweir         // --> OD 2005-01-10 #i40147# - boolean needed to keep position of
104cdf0e10cSrcweir         // anchored object locked due to special object positioning for sections.
105cdf0e10cSrcweir         bool mbKeepPositionLockedForSection;
106cdf0e10cSrcweir         // <--
107cdf0e10cSrcweir         bool mbRestartLayoutProcess;
108cdf0e10cSrcweir         bool mbClearedEnvironment;
109cdf0e10cSrcweir         // <--
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         // --> OD 2004-08-25 #i3317# - boolean, indicating that temporarly
112cdf0e10cSrcweir         // the wrapping style influence of the anchored object has to be
113cdf0e10cSrcweir         // considered during its positioning.
114cdf0e10cSrcweir         // This boolean is used, if compatibility option 'Consider wrapping style
115cdf0e10cSrcweir         // influence on object positioning' is OFF and a positioning loop is
116cdf0e10cSrcweir         // detected in method <SwFlyAtCntFrm::MakeAll()> or method
117cdf0e10cSrcweir         // <SwAnchoredDrawObject::_MakeObjPosAnchoredAtPara()>.
118cdf0e10cSrcweir         // The boolean is reset to <false>, when the layout process for a
119cdf0e10cSrcweir         // page frame starts - see class <NotifyLayoutOfPageInProgress>.
120cdf0e10cSrcweir         bool mbTmpConsiderWrapInfluence;
121cdf0e10cSrcweir         // <--
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         // --> OD 2006-06-21 #i68520#
124cdf0e10cSrcweir         mutable SwRect maObjRectWithSpaces;
125cdf0e10cSrcweir         mutable bool mbObjRectWithSpacesValid;
126cdf0e10cSrcweir         mutable SwRect maLastObjRect;
127cdf0e10cSrcweir         // <--
128cdf0e10cSrcweir 
129cdf0e10cSrcweir         /** method to indicate, that positioning of anchored object is in progress
130cdf0e10cSrcweir 
131cdf0e10cSrcweir             note: method is implemented empty
132cdf0e10cSrcweir 
133cdf0e10cSrcweir             @author OD
134cdf0e10cSrcweir         */
135cdf0e10cSrcweir         friend class SwObjPositioningInProgress;
SetPositioningInProgress(const bool _bPosInProgress)136cdf0e10cSrcweir         inline void SetPositioningInProgress( const bool _bPosInProgress )
137cdf0e10cSrcweir         {
138cdf0e10cSrcweir             mbPositioningInProgress = _bPosInProgress;
139cdf0e10cSrcweir         }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 
142cdf0e10cSrcweir         /** check anchor character rectangle
143cdf0e10cSrcweir 
144cdf0e10cSrcweir             OD 2004-03-25 #i26791#
145cdf0e10cSrcweir             helper method for method <CheckCharRectAndTopOfLine()>
146cdf0e10cSrcweir             For to-character anchored Writer fly frames the member <maLastCharRect>
147cdf0e10cSrcweir             is updated. This is checked for change and depending on the applied
148cdf0e10cSrcweir             positioning, it's decided, if the Writer fly frame has to be invalidated.
149cdf0e10cSrcweir             OD 2004-07-14 #117380#
150cdf0e10cSrcweir             improvement - add second parameter <_rAnchorCharFrm>
151cdf0e10cSrcweir 
152cdf0e10cSrcweir             @author OD
153cdf0e10cSrcweir 
154cdf0e10cSrcweir             @param _rAnch
155cdf0e10cSrcweir             input parameter - reference to anchor position
156cdf0e10cSrcweir 
157cdf0e10cSrcweir             @param _rAnchorCharFrm
158cdf0e10cSrcweir             input parameter - reference to the text frame containing the anchor
159cdf0e10cSrcweir             character.
160cdf0e10cSrcweir         */
161cdf0e10cSrcweir         void _CheckCharRect( const SwFmtAnchor& _rAnch,
162cdf0e10cSrcweir                              const SwTxtFrm& _rAnchorCharFrm );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir         /** check top of line
165cdf0e10cSrcweir 
166cdf0e10cSrcweir             OD 2004-03-25 #i26791#
167cdf0e10cSrcweir             helper method for method <CheckCharRectAndTopOfLine()>
168cdf0e10cSrcweir             For to-character anchored Writer fly frames the member <mnLastTopOfLine>
169cdf0e10cSrcweir             is updated. This is checked for change and depending on the applied
170cdf0e10cSrcweir             positioning, it's decided, if the Writer fly frame has to be invalidated.
171cdf0e10cSrcweir             OD 2004-07-14 #117380#
172cdf0e10cSrcweir             improvement - add second parameter <_rAnchorCharFrm>
173cdf0e10cSrcweir 
174cdf0e10cSrcweir             @author OD
175cdf0e10cSrcweir 
176cdf0e10cSrcweir             @param _rAnch
177cdf0e10cSrcweir             input parameter - reference to anchor position
178cdf0e10cSrcweir 
179cdf0e10cSrcweir             @param _rAnchorCharFrm
180cdf0e10cSrcweir             input parameter - reference to the text frame containing the anchor
181cdf0e10cSrcweir             character.
182cdf0e10cSrcweir         */
183cdf0e10cSrcweir         void _CheckTopOfLine( const SwFmtAnchor& _rAnch,
184cdf0e10cSrcweir                               const SwTxtFrm& _rAnchorCharFrm );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir         // --> OD 2005-03-30 #120729# - needed for the hotfix
187cdf0e10cSrcweir         // method <lcl_HideObj(..)> sets needed data structure values for the
188cdf0e10cSrcweir         // object positioning
189cdf0e10cSrcweir         friend bool lcl_HideObj( const SwTxtFrm& _rFrm,
190cdf0e10cSrcweir                                  const RndStdIds _eAnchorType,
191cdf0e10cSrcweir                                  const xub_StrLen _nObjAnchorPos,
192cdf0e10cSrcweir                                  SwAnchoredObject* _pAnchoredObj );
193cdf0e10cSrcweir         // <--
194cdf0e10cSrcweir     protected:
195cdf0e10cSrcweir         SwAnchoredObject();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir         void SetVertPosOrientFrm( const SwLayoutFrm& _rVertPosOrientFrm );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir         /** method to assure that anchored object is registered at the correct
200cdf0e10cSrcweir             page frame
201cdf0e10cSrcweir 
202cdf0e10cSrcweir             OD 2004-07-02 #i28701#
203cdf0e10cSrcweir 
204cdf0e10cSrcweir             @author OD
205cdf0e10cSrcweir         */
206cdf0e10cSrcweir         virtual void RegisterAtCorrectPage() = 0;
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         /** method to indicate, that anchored object is attached to a anchor frame
209cdf0e10cSrcweir 
210cdf0e10cSrcweir             @author OD
211cdf0e10cSrcweir         */
212cdf0e10cSrcweir         virtual void ObjectAttachedToAnchorFrame();
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         /** method to determine, if other anchored objects, also attached at
215cdf0e10cSrcweir             to the anchor frame, have to consider its wrap influence.
216cdf0e10cSrcweir 
217cdf0e10cSrcweir             // --> OD 2005-02-22 #i43255#
218cdf0e10cSrcweir 
219cdf0e10cSrcweir             @author OD
220cdf0e10cSrcweir         */
221cdf0e10cSrcweir         bool ConsiderObjWrapInfluenceOfOtherObjs() const;
222cdf0e10cSrcweir 
223cdf0e10cSrcweir         /** method to apply temporary consideration of wrapping style influence
224cdf0e10cSrcweir             to the anchored objects, which are anchored at the same anchor frame
225cdf0e10cSrcweir 
226cdf0e10cSrcweir             OD 2006-07-24 #b6449874#
227cdf0e10cSrcweir 
228cdf0e10cSrcweir             @author OD
229cdf0e10cSrcweir         */
230cdf0e10cSrcweir         void SetTmpConsiderWrapInfluenceOfOtherObjs( const bool bTmpConsiderWrapInfluence );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir         // --> OD 2006-08-10 #i68520#
233cdf0e10cSrcweir         virtual bool _SetObjTop( const SwTwips _nTop) = 0;
234cdf0e10cSrcweir         virtual bool _SetObjLeft( const SwTwips _nLeft) = 0;
235cdf0e10cSrcweir         // <--
236cdf0e10cSrcweir 
237cdf0e10cSrcweir         // --> OD 2006-10-05 #i70122#
238cdf0e10cSrcweir         virtual const SwRect GetObjBoundRect() const = 0;
239cdf0e10cSrcweir         // <--
240cdf0e10cSrcweir     public:
241cdf0e10cSrcweir         TYPEINFO();
242cdf0e10cSrcweir 
243cdf0e10cSrcweir         virtual ~SwAnchoredObject();
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         // accessors to member <mpDrawObj>
246cdf0e10cSrcweir         void SetDrawObj( SdrObject& _rDrawObj );
247cdf0e10cSrcweir         const SdrObject* GetDrawObj() const;
248cdf0e10cSrcweir         SdrObject* DrawObj();
249cdf0e10cSrcweir 
250cdf0e10cSrcweir         // accessors to member <mpAnchorFrm>
251cdf0e10cSrcweir         const SwFrm* GetAnchorFrm() const;
252cdf0e10cSrcweir         SwFrm* AnchorFrm();
253cdf0e10cSrcweir         void ChgAnchorFrm( SwFrm* _pNewAnchorFrm );
254cdf0e10cSrcweir         /** determine anchor frame containing the anchor position
255cdf0e10cSrcweir 
256cdf0e10cSrcweir             OD 2004-10-08 #i26945#
257cdf0e10cSrcweir             the anchor frame, which is determined, is <mpAnchorFrm>
258cdf0e10cSrcweir             for an at-page, at-frame or at-paragraph anchored object
259cdf0e10cSrcweir             and the anchor character frame for an at-character and as-character
260cdf0e10cSrcweir             anchored object.
261cdf0e10cSrcweir 
262cdf0e10cSrcweir             @author OD
263cdf0e10cSrcweir         */
264cdf0e10cSrcweir         SwFrm* GetAnchorFrmContainingAnchPos();
265cdf0e10cSrcweir 
266cdf0e10cSrcweir         // --> OD 2004-06-30 #i28701# - accessors to member <mpPageFrm>
267cdf0e10cSrcweir         SwPageFrm* GetPageFrm();
268cdf0e10cSrcweir         const SwPageFrm* GetPageFrm() const;
269cdf0e10cSrcweir         void SetPageFrm( SwPageFrm* _pNewPageFrm );
270cdf0e10cSrcweir         // <--
271cdf0e10cSrcweir 
272cdf0e10cSrcweir         /** method to determine the page frame, on which the 'anchor' of
273cdf0e10cSrcweir             the given anchored object is.
274cdf0e10cSrcweir 
275cdf0e10cSrcweir             OD 2004-07-02 #i28701#
276cdf0e10cSrcweir             OD 2004-09-23 #i33751#, #i34060#
277cdf0e10cSrcweir             Adjust meaning of method and thus its name: If the anchored object
278cdf0e10cSrcweir             or its anchor isn't correctly inserted in the layout, no page frame
279cdf0e10cSrcweir             can be found. Thus, the return type changed to be a pointer and can
280cdf0e10cSrcweir             be NULL.
281cdf0e10cSrcweir 
282cdf0e10cSrcweir             @author OD
283cdf0e10cSrcweir 
284cdf0e10cSrcweir             @param _rAnchoredObj
285cdf0e10cSrcweir             input parameter - anchored object, for which the page frame of its
286cdf0e10cSrcweir             'anchor' has to be determined.
287cdf0e10cSrcweir 
288cdf0e10cSrcweir             @return SwPageFrm&
289cdf0e10cSrcweir             page frame, the 'anchor' of the given anchored object is on
290cdf0e10cSrcweir         */
291cdf0e10cSrcweir         SwPageFrm* FindPageFrmOfAnchor();
292cdf0e10cSrcweir 
293cdf0e10cSrcweir         /** get frame, which contains the anchor character, if the object
294cdf0e10cSrcweir             is anchored at-character or as-character.
295cdf0e10cSrcweir 
296cdf0e10cSrcweir             OD 2004-10-04 #i26945#
297cdf0e10cSrcweir 
298cdf0e10cSrcweir             @author OD
299cdf0e10cSrcweir 
300cdf0e10cSrcweir             @return SwTxtFrm*
301cdf0e10cSrcweir             text frame containing the anchor character. It's NULL, if the object
302cdf0e10cSrcweir             isn't anchored at-character resp. as-character.
303cdf0e10cSrcweir         */
304cdf0e10cSrcweir         SwTxtFrm* FindAnchorCharFrm();
305cdf0e10cSrcweir 
306cdf0e10cSrcweir         // accessors to data of position calculation:
307cdf0e10cSrcweir         // frame vertical position is orient at
GetVertPosOrientFrm() const308cdf0e10cSrcweir         inline const SwLayoutFrm* GetVertPosOrientFrm() const
309cdf0e10cSrcweir         {
310cdf0e10cSrcweir             return mpVertPosOrientFrm;
311cdf0e10cSrcweir         }
312cdf0e10cSrcweir         // --> OD 2004-11-29 #115759# - method to clear member <mpVertPosOrientFrm>
ClearVertPosOrientFrm()313cdf0e10cSrcweir         inline void ClearVertPosOrientFrm()
314cdf0e10cSrcweir         {
315cdf0e10cSrcweir             mpVertPosOrientFrm = 0L;
316cdf0e10cSrcweir         }
317cdf0e10cSrcweir         // <--
318cdf0e10cSrcweir 
319cdf0e10cSrcweir         /** check anchor character rectangle and top of line
320cdf0e10cSrcweir 
321cdf0e10cSrcweir             OD 2004-03-25 #i26791#
322cdf0e10cSrcweir             For to-character anchored Writer fly frames the members <maLastCharRect>
323cdf0e10cSrcweir             and <maLastTopOfLine> are updated. These are checked for change and
324cdf0e10cSrcweir             depending on the applied positioning, it's decided, if the Writer fly
325cdf0e10cSrcweir             frame has to be invalidated.
326cdf0e10cSrcweir             OD 2004-07-15 #117380#
327cdf0e10cSrcweir             add parameter <_bCheckForParaPorInf>, default value <true>
328cdf0e10cSrcweir 
329cdf0e10cSrcweir             @author OD
330cdf0e10cSrcweir 
331cdf0e10cSrcweir             @param _bCheckForParaPorInf
332cdf0e10cSrcweir             input parameter - boolean indicating, if check on paragraph portion
333cdf0e10cSrcweir             information has to be done.
334cdf0e10cSrcweir         */
335cdf0e10cSrcweir         void CheckCharRectAndTopOfLine( const bool _bCheckForParaPorInf = true );
336cdf0e10cSrcweir 
337cdf0e10cSrcweir         // accessors to member <maLastCharRect>
338cdf0e10cSrcweir         const SwRect& GetLastCharRect() const;
339cdf0e10cSrcweir         SwTwips GetRelCharX( const SwFrm* pFrm ) const;
340cdf0e10cSrcweir         SwTwips GetRelCharY( const SwFrm* pFrm ) const;
341cdf0e10cSrcweir         void AddLastCharY( long nDiff );
342cdf0e10cSrcweir         void ResetLastCharRectHeight();
343cdf0e10cSrcweir 
344cdf0e10cSrcweir         // accessor to member <nmLastTopOfLine>
345cdf0e10cSrcweir         SwTwips GetLastTopOfLine() const;
346cdf0e10cSrcweir         // OD 2004-05-18 #i28701# - follow-up of #i22341#
347cdf0e10cSrcweir         void AddLastTopOfLineY( SwTwips _nDiff );
348cdf0e10cSrcweir 
349cdf0e10cSrcweir         /** reset members <maLastCharRect> and <mnLastTopOfLine>
350cdf0e10cSrcweir 
351cdf0e10cSrcweir             OD 2004-06-29 #i27801#
352cdf0e10cSrcweir 
353cdf0e10cSrcweir             @author OD
354cdf0e10cSrcweir         */
355cdf0e10cSrcweir         void ClearCharRectAndTopOfLine();
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         /** method to determine position for the object and set the position
358cdf0e10cSrcweir             at the object
359cdf0e10cSrcweir 
360cdf0e10cSrcweir             @author OD
361cdf0e10cSrcweir         */
362cdf0e10cSrcweir         virtual void MakeObjPos() = 0;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir         /** is positioning of anchored object in progress
365cdf0e10cSrcweir 
366cdf0e10cSrcweir             @author OD
367cdf0e10cSrcweir         */
IsPositioningInProgress() const368cdf0e10cSrcweir         inline bool IsPositioningInProgress() const
369cdf0e10cSrcweir         {
370cdf0e10cSrcweir             return mbPositioningInProgress;
371cdf0e10cSrcweir         }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir         /** method to determine, if invalidation of position is allowed
374cdf0e10cSrcweir 
375cdf0e10cSrcweir             OD 2004-07-01 #i28701#
376cdf0e10cSrcweir 
377cdf0e10cSrcweir             @author OD
378cdf0e10cSrcweir         */
379cdf0e10cSrcweir         bool InvalidationOfPosAllowed() const;
380cdf0e10cSrcweir 
381cdf0e10cSrcweir         /** method to invalidate position of the anchored object
382cdf0e10cSrcweir 
383cdf0e10cSrcweir             @author OD
384cdf0e10cSrcweir         */
385cdf0e10cSrcweir         virtual void InvalidateObjPos() = 0;
386cdf0e10cSrcweir 
387cdf0e10cSrcweir         /** method to perform necessary invalidations for the positioning of
388cdf0e10cSrcweir             objects, for whose the wrapping style influence has to be considered
389cdf0e10cSrcweir             on the object positioning.
390cdf0e10cSrcweir 
391cdf0e10cSrcweir             OD 2004-06-30 #i28701#
392cdf0e10cSrcweir 
393cdf0e10cSrcweir             @author OD
394cdf0e10cSrcweir         */
395cdf0e10cSrcweir         void InvalidateObjPosForConsiderWrapInfluence( const bool _bNotifyBackgrd );
396cdf0e10cSrcweir 
397cdf0e10cSrcweir         /** method to trigger notification of 'background'
398cdf0e10cSrcweir 
399cdf0e10cSrcweir             OD 2004-07-01 #i28701#
400cdf0e10cSrcweir 
401cdf0e10cSrcweir             @author OD
402cdf0e10cSrcweir         */
403cdf0e10cSrcweir         virtual void NotifyBackground( SwPageFrm* _pPageFrm,
404cdf0e10cSrcweir                                        const SwRect& _rRect,
405cdf0e10cSrcweir                                        PrepareHint _eHint ) = 0;
406cdf0e10cSrcweir 
407cdf0e10cSrcweir         // accessors to the current relative position (relative to anchor
408cdf0e10cSrcweir         // position of anchor frame)
409cdf0e10cSrcweir         const Point GetCurrRelPos() const;
410cdf0e10cSrcweir         void SetCurrRelPos( Point _aRelPos );
411cdf0e10cSrcweir 
412cdf0e10cSrcweir         // accessors to the format
413cdf0e10cSrcweir         virtual SwFrmFmt& GetFrmFmt() = 0;
414cdf0e10cSrcweir         virtual const SwFrmFmt& GetFrmFmt() const = 0;
415cdf0e10cSrcweir 
416cdf0e10cSrcweir         // accessors to the object area and its position
417cdf0e10cSrcweir         virtual const SwRect GetObjRect() const = 0;
418cdf0e10cSrcweir         // --> OD 2006-08-10 #i68520#
419cdf0e10cSrcweir         void SetObjTop( const SwTwips _nTop);
420cdf0e10cSrcweir         void SetObjLeft( const SwTwips _nLeft);
421cdf0e10cSrcweir         // <--
422cdf0e10cSrcweir 
423cdf0e10cSrcweir         /** method update layout direction the layout direction, the anchored
424cdf0e10cSrcweir             object is assigned to
425cdf0e10cSrcweir 
426cdf0e10cSrcweir             OD 2004-07-27 #i31698#
427cdf0e10cSrcweir             method has typically to be called, if the anchored object gets its
428cdf0e10cSrcweir             anchor frame assigned and if the anchor frame changes its layout direction
429cdf0e10cSrcweir             OD 2006-03-17 #i62875#
430cdf0e10cSrcweir             made virtual, because it's needed to be overloaded by <SwAnchoredDrawObject>
431cdf0e10cSrcweir 
432cdf0e10cSrcweir             @author OD
433cdf0e10cSrcweir         */
434cdf0e10cSrcweir         virtual void UpdateLayoutDir();
435cdf0e10cSrcweir 
436cdf0e10cSrcweir         /** method to determine object area inclusive its spacing
437cdf0e10cSrcweir 
438cdf0e10cSrcweir             OD 2004-06-30 #i28701#
439cdf0e10cSrcweir             OD 2006-08-10 #i68520# - return constant reference
440cdf0e10cSrcweir 
441cdf0e10cSrcweir             @author OD
442cdf0e10cSrcweir         */
443cdf0e10cSrcweir         const SwRect& GetObjRectWithSpaces() const;
444cdf0e10cSrcweir 
445cdf0e10cSrcweir         // --> OD 2006-08-10 #i68520#
InvalidateObjRectWithSpaces() const446cdf0e10cSrcweir         inline void InvalidateObjRectWithSpaces() const
447cdf0e10cSrcweir         {
448cdf0e10cSrcweir             mbObjRectWithSpacesValid = false;
449cdf0e10cSrcweir         }
450cdf0e10cSrcweir         // <--
451cdf0e10cSrcweir 
452cdf0e10cSrcweir         /** method to determine, if wrapping style influence of the anchored
453cdf0e10cSrcweir             object has to be considered on the object positioning
454cdf0e10cSrcweir 
455cdf0e10cSrcweir             OD 2004-06-30 #i28701#
456cdf0e10cSrcweir             Note: result of this method also decides, if the boolean for the
457cdf0e10cSrcweir             layout process are of relevance.
458cdf0e10cSrcweir 
459cdf0e10cSrcweir             @author OD
460cdf0e10cSrcweir         */
461cdf0e10cSrcweir         bool ConsiderObjWrapInfluenceOnObjPos() const;
462cdf0e10cSrcweir 
463cdf0e10cSrcweir         // --> OD 2004-06-29 #i28701# - accessors to booleans for layout process
464cdf0e10cSrcweir         bool ConsiderForTextWrap() const;
465cdf0e10cSrcweir         void SetConsiderForTextWrap( const bool _bConsiderForTextWrap );
466cdf0e10cSrcweir         bool PositionLocked() const;
LockPosition()467cdf0e10cSrcweir         inline void LockPosition()
468cdf0e10cSrcweir         {
469cdf0e10cSrcweir             mbPositionLocked = true;
470cdf0e10cSrcweir         }
UnlockPosition()471cdf0e10cSrcweir         inline void UnlockPosition()
472cdf0e10cSrcweir         {
473cdf0e10cSrcweir             if ( !mbKeepPositionLockedForSection )
474cdf0e10cSrcweir             {
475cdf0e10cSrcweir                 mbPositionLocked = false;
476cdf0e10cSrcweir             }
477cdf0e10cSrcweir         }
478cdf0e10cSrcweir         // --> OD 2005-01-10 #i40147#
SetKeepPosLocked(const bool _bKeepPosLocked)479cdf0e10cSrcweir         inline void SetKeepPosLocked( const bool _bKeepPosLocked )
480cdf0e10cSrcweir         {
481cdf0e10cSrcweir             mbKeepPositionLockedForSection = _bKeepPosLocked;
482cdf0e10cSrcweir         }
483cdf0e10cSrcweir         // <--
484cdf0e10cSrcweir         bool RestartLayoutProcess() const;
485cdf0e10cSrcweir         void SetRestartLayoutProcess( const bool _bRestartLayoutProcess );
486cdf0e10cSrcweir         // --> OD 2004-10-22 #i35911# - accessors for <mbClearedEnvironment>
487cdf0e10cSrcweir         bool ClearedEnvironment() const;
488cdf0e10cSrcweir         void SetClearedEnvironment( const bool _bClearedEnvironment );
489cdf0e10cSrcweir         // <--
490cdf0e10cSrcweir         // --> OD 2005-03-03 #i43913# - reset booleans for layout process
ResetLayoutProcessBools()491cdf0e10cSrcweir         inline void ResetLayoutProcessBools()
492cdf0e10cSrcweir         {
493cdf0e10cSrcweir             mbPositioningInProgress = false;
494cdf0e10cSrcweir             mbConsiderForTextWrap = false;
495cdf0e10cSrcweir             mbPositionLocked = false;
496cdf0e10cSrcweir             mbKeepPositionLockedForSection = false;
497cdf0e10cSrcweir             mbRestartLayoutProcess = false;
498cdf0e10cSrcweir             mbClearedEnvironment = false;
499cdf0e10cSrcweir             mbTmpConsiderWrapInfluence = false;
500cdf0e10cSrcweir         }
501cdf0e10cSrcweir         // <--
502cdf0e10cSrcweir 
503cdf0e10cSrcweir         /** method to determine, if due to anchored object size and wrapping
504cdf0e10cSrcweir             style, its layout environment is cleared.
505cdf0e10cSrcweir 
506cdf0e10cSrcweir             OD 2004-10-22 #i35911#
507cdf0e10cSrcweir 
508cdf0e10cSrcweir             @author OD
509cdf0e10cSrcweir         */
510cdf0e10cSrcweir         bool HasClearedEnvironment() const;
511cdf0e10cSrcweir 
512cdf0e10cSrcweir         /** method to update anchored object in the <SwSortedObjs> lists
513cdf0e10cSrcweir 
514cdf0e10cSrcweir             OD 2004-07-01 #i28701#
515cdf0e10cSrcweir             Method is not proposed to be called during a layout process is
516cdf0e10cSrcweir             running. It has been used on the change of the anchored object
517cdf0e10cSrcweir             attributes, which belongs the sort criteria of <SwSortedObjs>.
518cdf0e10cSrcweir             If document compatibility option 'Consider wrapping style influence
519cdf0e10cSrcweir             on object positioning' is ON, additionally all anchored objects
520cdf0e10cSrcweir             at the anchor frame and all following anchored objects on the page
521cdf0e10cSrcweir             frame are invalidated.
522cdf0e10cSrcweir 
523cdf0e10cSrcweir             @author OD
524cdf0e10cSrcweir         */
525cdf0e10cSrcweir         void UpdateObjInSortedList();
526cdf0e10cSrcweir 
527cdf0e10cSrcweir         /** method to determine, if a format on the anchored object is possible
528cdf0e10cSrcweir 
529cdf0e10cSrcweir             OD 2004-07-23 #i28701#
530cdf0e10cSrcweir             A format isn't possible, if anchored object is in an invisible layer.
531cdf0e10cSrcweir             Note: method is virtual to refine the conditions for the sub-classes.
532cdf0e10cSrcweir 
533cdf0e10cSrcweir             @author OD
534cdf0e10cSrcweir         */
535cdf0e10cSrcweir         virtual bool IsFormatPossible() const;
536cdf0e10cSrcweir 
537cdf0e10cSrcweir         // --> OD 2004-08-25 #i3317# - accessors to member <mbTmpConsiderWrapInfluence>
538cdf0e10cSrcweir         void SetTmpConsiderWrapInfluence( const bool _bTmpConsiderWrapInfluence );
539cdf0e10cSrcweir         bool IsTmpConsiderWrapInfluence() const;
540cdf0e10cSrcweir         // <--
541cdf0e10cSrcweir 
542cdf0e10cSrcweir         /** method to determine, if the anchored object is overlapping with a
543cdf0e10cSrcweir             previous column
544cdf0e10cSrcweir 
545cdf0e10cSrcweir             OD 2004-08-25 #i3317#
546cdf0e10cSrcweir             overlapping with a previous column means, that the object overlaps
547cdf0e10cSrcweir             with a column, which is a previous one of the column its anchor
548cdf0e10cSrcweir             frame is in.
549cdf0e10cSrcweir             Only applied for at-paragraph and at-character anchored objects.
550cdf0e10cSrcweir 
551cdf0e10cSrcweir             @author OD
552cdf0e10cSrcweir         */
553cdf0e10cSrcweir         bool OverlapsPrevColumn() const;
554cdf0e10cSrcweir 
555cdf0e10cSrcweir         /** method to determine position of anchored object relative to
556cdf0e10cSrcweir             anchor frame
557cdf0e10cSrcweir 
558cdf0e10cSrcweir             OD 2005-01-06 #i30669#
559cdf0e10cSrcweir             Usage: Needed layout information for WW8 export
560cdf0e10cSrcweir 
561cdf0e10cSrcweir             @author OD
562cdf0e10cSrcweir 
563cdf0e10cSrcweir             @return Point - determined relative position
564cdf0e10cSrcweir         */
565cdf0e10cSrcweir         Point GetRelPosToAnchorFrm() const;
566cdf0e10cSrcweir 
567cdf0e10cSrcweir         /** method to determine position of anchored object relative to
568cdf0e10cSrcweir             page frame
569cdf0e10cSrcweir 
570cdf0e10cSrcweir             OD 2005-01-06 #i30669#
571cdf0e10cSrcweir             Usage: Needed layout information for WW8 export
572cdf0e10cSrcweir             OD 2005-01-27 #i33818# - add parameters <_bFollowTextFlow> and
573cdf0e10cSrcweir             <_obRelToTableCell>
574cdf0e10cSrcweir             If <_bFollowTextFlow> is set and object is anchored inside table,
575cdf0e10cSrcweir             the position relative to the table cell is determined. Output
576cdf0e10cSrcweir             parameter <_obRelToTableCell> reflects this situation
577cdf0e10cSrcweir 
578cdf0e10cSrcweir             @author OD
579cdf0e10cSrcweir 
580cdf0e10cSrcweir             @param _bFollowTextFlow
581cdf0e10cSrcweir             input parameter - boolean indicating, if the anchored object has to
582cdf0e10cSrcweir             follow the text flow.
583cdf0e10cSrcweir 
584cdf0e10cSrcweir             @param _obRelToTableCell
585cdf0e10cSrcweir             output parameter - boolean indicating, the determine position is
586cdf0e10cSrcweir             relative to the table cell
587cdf0e10cSrcweir 
588cdf0e10cSrcweir             @return Point - determined relative position
589cdf0e10cSrcweir         */
590cdf0e10cSrcweir         Point GetRelPosToPageFrm( const bool _bFollowTextFlow,
591cdf0e10cSrcweir                                   bool& _obRelToTableCell ) const;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir         /** method to determine position of anchored object relative to
594cdf0e10cSrcweir             anchor character
595cdf0e10cSrcweir 
596cdf0e10cSrcweir             OD 2005-01-06 #i30669#
597cdf0e10cSrcweir             Usage: Needed layout information for WW8 export
598cdf0e10cSrcweir 
599cdf0e10cSrcweir             @author OD
600cdf0e10cSrcweir 
601cdf0e10cSrcweir             @return Point - determined relative position
602cdf0e10cSrcweir         */
603cdf0e10cSrcweir         Point GetRelPosToChar() const;
604cdf0e10cSrcweir 
605cdf0e10cSrcweir         /** method to determine position of anchored object relative to
606cdf0e10cSrcweir             top of line
607cdf0e10cSrcweir 
608cdf0e10cSrcweir             OD 2005-01-06 #i30669#
609cdf0e10cSrcweir             Usage: Needed layout information for WW8 export
610cdf0e10cSrcweir 
611cdf0e10cSrcweir             @author OD
612cdf0e10cSrcweir 
613cdf0e10cSrcweir             @return Point - determined relative position
614cdf0e10cSrcweir         */
615cdf0e10cSrcweir         Point GetRelPosToLine() const;
616cdf0e10cSrcweir };
617cdf0e10cSrcweir 
618cdf0e10cSrcweir // ============================================================================
619cdf0e10cSrcweir // OD 2004-04-13 #i26791#, #i28701#
620cdf0e10cSrcweir // helper class for notify that positioning of an anchored object is in progress
621cdf0e10cSrcweir // ============================================================================
622cdf0e10cSrcweir class SwObjPositioningInProgress
623cdf0e10cSrcweir {
624cdf0e10cSrcweir     private:
625cdf0e10cSrcweir         SwAnchoredObject* mpAnchoredObj;
626cdf0e10cSrcweir         // --> OD 2005-08-09 #i52904# - introduce boolean indicating old state
627cdf0e10cSrcweir         // of anchored object regarding positioning in progress in order to
628cdf0e10cSrcweir         // consider nested usage of class <SwObjPositioningInProgress>
629cdf0e10cSrcweir         bool mbOldObjPositioningInProgress;
630cdf0e10cSrcweir         // <--
631cdf0e10cSrcweir 
632cdf0e10cSrcweir     public:
633cdf0e10cSrcweir         SwObjPositioningInProgress( SdrObject& _rSdrObj );
634cdf0e10cSrcweir         SwObjPositioningInProgress( SwAnchoredObject& _rAnchoredObj );
635cdf0e10cSrcweir         ~SwObjPositioningInProgress();
636cdf0e10cSrcweir };
637cdf0e10cSrcweir 
638cdf0e10cSrcweir #endif
639