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
,
100 bool& o_rbPageHasFlysAnchoredBelowThis
);
102 /** method to format the anchor frame for checking of the move forward condition
106 void FormatAnchorFrameForCheckMoveFwd();
108 /** method to determine if at least one anchored object has state
109 <temporarily consider wrapping style influence> set.
111 bool AtLeastOneObjIsTmpConsiderWrapInfluence();
115 virtual SwFrame
& GetAnchorFrame() override
;
118 virtual ~SwObjectFormatterTextFrame() override
;
120 // #i40147# - add parameter <_bCheckForMovedFwd>.
121 virtual bool DoFormatObj( SwAnchoredObject
& _rAnchoredObj
,
122 const bool _bCheckForMovedFwd
= false ) override
;
123 virtual bool DoFormatObjs() override
;
125 /** method to create an instance of <SwObjectFormatterTextFrame> is
128 static std::unique_ptr
<SwObjectFormatterTextFrame
> CreateObjFormatter(
129 SwTextFrame
& _rAnchorTextFrame
,
130 const SwPageFrame
& _rPageFrame
,
131 SwLayAction
* _pLayAction
);
133 /** method to format given anchor text frame and its previous frames
136 Usage: Needed to check, if the anchor text frame is moved forward
137 due to the positioning and wrapping of its anchored objects, and
138 to format the frames, which have become invalid due to the anchored
139 object formatting in the iterative object positioning algorithm
141 @param _rAnchorTextFrame
142 input parameter - reference to anchor text frame, which has to be
143 formatted including its previous frames of the page.
145 static void FormatAnchorFrameAndItsPrevs( SwTextFrame
& _rAnchorTextFrame
);
147 /** method to check the conditions, if 'anchor is moved forward'
150 #i43913# - add output parameter <_boInFollow>
151 #i58182# - replace method by a corresponding static
152 method, because it's needed for the iterative positioning algorithm.
155 input parameter - anchored object, for which the condition has to checked.
158 input parameter - number of the page, on which the check is performed
160 @param _bAnchoredAtMasterBeforeFormatAnchor
161 input parameter - boolean indicating, that the given anchored object
162 was anchored at the master frame before the anchor frame has been
166 output parameter - number of page frame, the 'anchor' of the returned
170 output parameter - boolean, indicating that anchor text frame is
171 currently on the same page, but it's a follow of in a follow row,
172 which will move forward. value only relevant, if method return <true>.
173 @param o_rbPageHasFlysAnchoredBelowThis
174 output parameter - indicates that the page has flys anchored
175 somewhere below the anchor of the passed _rAnchoredObj
178 indicating, if 'anchor is moved forward'
180 static bool CheckMovedFwdCondition( SwAnchoredObject
& _rAnchoredObj
,
181 SwPageFrame
const& rFromPageFrame
,
182 const bool _bAnchoredAtMasterBeforeFormatAnchor
,
183 sal_uInt32
& _noToPageNum
,
185 bool& o_rbPageHasFlysAnchoredBelowThis
);
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */