1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: objectformattertxtfrm.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _OBJECTFORMATTERTXTFRM_HXX
31 #define _OBJECTFORMATTERTXTFRM_HXX
33 #include <objectformatter.hxx>
34 #include <sal/types.h>
38 // -----------------------------------------------------------------------------
39 // OD 2004-07-01 #i28701#
40 // Format floating screen objects, which are anchored at a given anchor text frame
41 // and registered at the given page frame.
42 // -----------------------------------------------------------------------------
43 class SwObjectFormatterTxtFrm
: public SwObjectFormatter
47 SwTxtFrm
& mrAnchorTxtFrm
;
49 // 'master' anchor text frame
50 SwTxtFrm
* mpMasterAnchorTxtFrm
;
52 SwObjectFormatterTxtFrm( SwTxtFrm
& _rAnchorTxtFrm
,
53 const SwPageFrm
& _rPageFrm
,
54 SwTxtFrm
* _pMasterAnchorTxtFrm
,
55 SwLayAction
* _pLayAction
);
57 /* method to invalidate objects, anchored previous to given object at
61 reference to anchored object - objects, anchored previous to
62 this one will be invalidated.
66 void _InvalidatePrevObjs( SwAnchoredObject
& _rAnchoredObj
);
68 /* method to invalidate objects, anchored after the given object at
72 reference to anchored object - objects, anchored after this one will
76 boolean indicates, if given anchored object <_rAnchoredObj> also have
81 void _InvalidateFollowObjs( SwAnchoredObject
& _rAnchoredObj
,
82 const bool _bInclObj
);
84 /** method to determine first anchored object, whose 'anchor is moved
87 'anchor (of an object) is moved forward', if the anchor frame
88 respectively the anchor character of the object isn't on the
89 proposed page frame. Instead its on a following page
90 OD 2004-10-04 #i26945# - For at-character anchored objects,
91 it has also to be checked, if the anchor character is in a follow
92 text frame, which would move to the next page.
93 OD 2005-03-30 #i43913# - add output parameter <_boInFollow>
97 @param _nWrapInfluenceOnPosition
98 input parameter - only object with this given wrapping style
99 influence are investigated.
102 input parameter - number of page frame, the 'anchor' should be
105 output parameter - number of page frame, the 'anchor' of the returned
109 output parameter - boolean, indicating that anchor text frame is
110 currently on the same page, but it's a follow of in a follow row,
111 which will move forward. value only relevant, if method returns
114 @return SwAnchoredObject*
115 anchored object with a 'moved forward anchor'. If NULL, no such
116 anchored object is found.
118 SwAnchoredObject
* _GetFirstObjWithMovedFwdAnchor(
119 const sal_Int16 _nWrapInfluenceOnPosition
,
120 sal_uInt32
& _noToPageNum
,
123 /** method to format the anchor frame for checking of the move forward condition
125 OD 2005-01-11 #i40141#
129 void _FormatAnchorFrmForCheckMoveFwd();
131 /** method to determine if at least one anchored object has state
132 <temporarly consider wrapping style influence> set.
134 OD 2006-07-24 #b6449874#
138 bool _AtLeastOneObjIsTmpConsiderWrapInfluence();
142 virtual SwFrm
& GetAnchorFrm();
145 virtual ~SwObjectFormatterTxtFrm();
147 // --> OD 2005-01-10 #i40147# - add parameter <_bCheckForMovedFwd>.
148 virtual bool DoFormatObj( SwAnchoredObject
& _rAnchoredObj
,
149 const bool _bCheckForMovedFwd
= false );
151 virtual bool DoFormatObjs();
153 /** method to create an instance of <SwObjectFormatterTxtFrm> is
158 static SwObjectFormatterTxtFrm
* CreateObjFormatter(
159 SwTxtFrm
& _rAnchorTxtFrm
,
160 const SwPageFrm
& _rPageFrm
,
161 SwLayAction
* _pLayAction
);
163 /** method to format given anchor text frame and its previous frames
165 OD 2005-11-17 #i56300#
166 Usage: Needed to check, if the anchor text frame is moved forward
167 due to the positioning and wrapping of its anchored objects, and
168 to format the frames, which have become invalid due to the anchored
169 object formatting in the iterative object positioning algorithm
173 @param _rAnchorTxtFrm
174 input parameter - reference to anchor text frame, which has to be
175 formatted including its previous frames of the page.
177 static void FormatAnchorFrmAndItsPrevs( SwTxtFrm
& _rAnchorTxtFrm
);
179 /** method to check the conditions, if 'anchor is moved forward'
181 OD 2004-10-11 #i26945#
182 OD 2005-03-30 #i43913# - add output parameter <_boInFollow>
183 OD 2006-01-27 #i58182# - replace method by a corresponding static
184 method, because it's needed for the iterative positioning algorithm.
189 input parameter - anchored object, for which the condition has to checked.
192 input parameter - number of the page, on which the check is performed
194 @param _bAnchoredAtMasterBeforeFormatAnchor
195 input parameter - boolean indicating, that the given anchored object
196 was anchored at the master frame before the anchor frame has been
200 output parameter - number of page frame, the 'anchor' of the returned
204 output parameter - boolean, indicating that anchor text frame is
205 currently on the same page, but it's a follow of in a follow row,
206 which will move forward. value only relevant, if method return <true>.
209 indicating, if 'anchor is moved forward'
211 static bool CheckMovedFwdCondition( SwAnchoredObject
& _rAnchoredObj
,
212 const sal_uInt32 _nFromPageNum
,
213 const bool _bAnchoredAtMasterBeforeFormatAnchor
,
214 sal_uInt32
& _noToPageNum
,