1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_SOURCE_CORE_LAYOUT_OBJECTFORMATTERTXTFRM_HXX
20 #define INCLUDED_SW_SOURCE_CORE_LAYOUT_OBJECTFORMATTERTXTFRM_HXX
22 #include <objectformatter.hxx>
23 #include <sal/types.h>
28 // Format floating screen objects, which are anchored at a given anchor text frame
29 // and registered at the given page frame.
30 class SwObjectFormatterTextFrame
: public SwObjectFormatter
34 SwTextFrame
& mrAnchorTextFrame
;
36 // 'master' anchor text frame
37 SwTextFrame
* mpMasterAnchorTextFrame
;
39 SwObjectFormatterTextFrame( SwTextFrame
& _rAnchorTextFrame
,
40 const SwPageFrame
& _rPageFrame
,
41 SwTextFrame
* _pMasterAnchorTextFrame
,
42 SwLayAction
* _pLayAction
);
44 /** method to invalidate objects, anchored previous to given object at
48 reference to anchored object - objects, anchored previous to
49 this one will be invalidated.
51 void InvalidatePrevObjs( SwAnchoredObject
& _rAnchoredObj
);
53 /** method to invalidate objects, anchored after the given object at
57 reference to anchored object - objects, anchored after this one will
60 void InvalidateFollowObjs( SwAnchoredObject
& _rAnchoredObj
);
62 /** method to determine first anchored object, whose 'anchor is moved
65 'anchor (of an object) is moved forward', if the anchor frame
66 respectively the anchor character of the object isn't on the
67 proposed page frame. Instead its on a following page
69 #i26945# - For at-character anchored objects,
70 it has also to be checked, if the anchor character is in a follow
71 text frame, which would move to the next page.
73 #i43913# - add output parameter <_boInFollow>
75 @param _nWrapInfluenceOnPosition
76 input parameter - only object with this given wrapping style
77 influence are investigated.
80 input parameter - number of page frame, the 'anchor' should be
83 output parameter - number of page frame, the 'anchor' of the returned
87 output parameter - boolean, indicating that anchor text frame is
88 currently on the same page, but it's a follow of in a follow row,
89 which will move forward. value only relevant, if method returns
92 @return SwAnchoredObject*
93 anchored object with a 'moved forward anchor'. If NULL, no such
94 anchored object is found.
96 SwAnchoredObject
* GetFirstObjWithMovedFwdAnchor(
97 const sal_Int16 _nWrapInfluenceOnPosition
,
98 sal_uInt32
& _noToPageNum
,
101 /** method to format the anchor frame for checking of the move forward condition
105 void FormatAnchorFrameForCheckMoveFwd();
107 /** method to determine if at least one anchored object has state
108 <temporarily consider wrapping style influence> set.
110 bool AtLeastOneObjIsTmpConsiderWrapInfluence();
114 virtual SwFrame
& GetAnchorFrame() override
;
117 virtual ~SwObjectFormatterTextFrame() override
;
119 // #i40147# - add parameter <_bCheckForMovedFwd>.
120 virtual bool DoFormatObj( SwAnchoredObject
& _rAnchoredObj
,
121 const bool _bCheckForMovedFwd
= false ) override
;
122 virtual bool DoFormatObjs() override
;
124 /** method to create an instance of <SwObjectFormatterTextFrame> is
127 static SwObjectFormatterTextFrame
* CreateObjFormatter(
128 SwTextFrame
& _rAnchorTextFrame
,
129 const SwPageFrame
& _rPageFrame
,
130 SwLayAction
* _pLayAction
);
132 /** method to format given anchor text frame and its previous frames
135 Usage: Needed to check, if the anchor text frame is moved forward
136 due to the positioning and wrapping of its anchored objects, and
137 to format the frames, which have become invalid due to the anchored
138 object formatting in the iterative object positioning algorithm
140 @param _rAnchorTextFrame
141 input parameter - reference to anchor text frame, which has to be
142 formatted including its previous frames of the page.
144 static void FormatAnchorFrameAndItsPrevs( SwTextFrame
& _rAnchorTextFrame
);
146 /** method to check the conditions, if 'anchor is moved forward'
149 #i43913# - add output parameter <_boInFollow>
150 #i58182# - replace method by a corresponding static
151 method, because it's needed for the iterative positioning algorithm.
154 input parameter - anchored object, for which the condition has to checked.
157 input parameter - number of the page, on which the check is performed
159 @param _bAnchoredAtMasterBeforeFormatAnchor
160 input parameter - boolean indicating, that the given anchored object
161 was anchored at the master frame before the anchor frame has been
165 output parameter - number of page frame, the 'anchor' of the returned
169 output parameter - boolean, indicating that anchor text frame is
170 currently on the same page, but it's a follow of in a follow row,
171 which will move forward. value only relevant, if method return <true>.
174 indicating, if 'anchor is moved forward'
176 static bool CheckMovedFwdCondition( SwAnchoredObject
& _rAnchoredObj
,
177 const sal_uInt32 _nFromPageNum
,
178 const bool _bAnchoredAtMasterBeforeFormatAnchor
,
179 sal_uInt32
& _noToPageNum
,
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */