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