Revert "reduce symbol visibility in sw"
[LibreOffice.git] / sw / source / core / inc / objectformatter.hxx
blobf85c12dc5f2da07bbe729009db150eea73b88827
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_INC_OBJECTFORMATTER_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_OBJECTFORMATTER_HXX
22 #include <sal/types.h>
23 #include <memory>
25 class SwFrame;
26 // #i26945#
27 class SwTextFrame;
28 class SwLayoutFrame;
29 class SwPageFrame;
30 class SwAnchoredObject;
31 class SwLayAction;
32 // OD 2004-10-04 #i26945#
33 class SwPageNumAndTypeOfAnchors;
35 // #i28701#
36 // Format floating screen objects, which are anchored at the given anchor frame
37 // and registered at the given page frame.
39 class SwObjectFormatter
41 private:
42 // page frame, at which the floating screen objects are registered.
43 const SwPageFrame& mrPageFrame;
45 // value of document compatibility option 'Consider wrapping style on
46 // object positioning'
47 const bool mbConsiderWrapOnObjPos;
49 // layout action calling the format of the floating screen objects
50 SwLayAction* mpLayAction;
52 // data structure to collect page number of object's 'anchor'
53 // #i26945#
54 std::unique_ptr<SwPageNumAndTypeOfAnchors> mpPgNumAndTypeOfAnchors;
56 /** helper method for method <FormatObj_(..)> - performs the intrinsic
57 format of the layout of the given layout frame and all its lower
58 layout frames.
60 #i28701#
61 IMPORTANT NOTE:
62 Method corresponds to methods <SwLayAction::FormatLayoutFly(..)> and
63 <SwLayAction::FormatLayout(..)>. Thus, its code for the formatting have
64 to be synchronised.
66 void FormatLayout_( SwLayoutFrame& _rLayoutFrame );
68 /** helper method for method <FormatObj_(..)> - performs the intrinsic
69 format of the content of the given floating screen object.
71 #i28701#
73 void FormatObjContent( SwAnchoredObject& _rAnchoredObj );
75 protected:
76 SwObjectFormatter( const SwPageFrame& _rPageFrame,
77 SwLayAction* _pLayAction,
78 const bool _bCollectPgNumOfAnchors = false );
80 static std::unique_ptr<SwObjectFormatter> CreateObjFormatter( SwFrame& _rAnchorFrame,
81 const SwPageFrame& _rPageFrame,
82 SwLayAction* _pLayAction );
84 virtual SwFrame& GetAnchorFrame() = 0;
86 const SwPageFrame& GetPageFrame() const
88 return mrPageFrame;
91 bool ConsiderWrapOnObjPos() const
93 return mbConsiderWrapOnObjPos;
96 SwLayAction* GetLayAction()
98 return mpLayAction;
101 /** performs the intrinsic format of a given floating screen object and its content.
103 void FormatObj_( SwAnchoredObject& _rAnchoredObj );
105 /** invokes the intrinsic format method for all floating screen objects,
106 anchored at anchor frame on the given page frame
108 for format of floating screen objects for
109 follow text frames, the 'master' text frame is passed to the method.
110 Thus, the objects, whose anchor character is inside the follow text
111 frame can be formatted.
113 @param _pMasterTextFrame
114 input parameter - pointer to 'master' text frame. default value: NULL
116 bool FormatObjsAtFrame_( SwTextFrame* _pMasterTextFrame = nullptr );
118 /** accessor to collected anchored object
120 SwAnchoredObject* GetCollectedObj( const sal_uInt32 _nIndex );
122 /** accessor to 'anchor' page number of collected anchored object
124 sal_uInt32 GetPgNumOfCollected( const sal_uInt32 _nIndex );
126 /** accessor to 'anchor' type of collected anchored object
128 bool IsCollectedAnchoredAtMaster( const sal_uInt32 _nIndex );
130 /** accessor to total number of collected anchored objects
132 sal_uInt32 CountOfCollected();
134 public:
135 virtual ~SwObjectFormatter();
137 /** intrinsic method to format a certain floating screen object
139 #i40147# - add parameter <_bCheckForMovedFwd>
141 @param _rAnchoredObj
142 input parameter - anchored object, which have to be formatted.
144 @param _bCheckForMovedFwd
145 input parameter - boolean indicating, that after a successful
146 format of the anchored object the anchor frame has to be checked,
147 if it would moved forward due to the positioning of the anchored object.
148 default value: false
149 value only considered, if wrapping style influence has to be
150 considered for the positioning of the anchored object.
152 virtual bool DoFormatObj( SwAnchoredObject& _rAnchoredObj,
153 const bool _bCheckForMovedFwd = false ) = 0;
155 /** intrinsic method to format all floating screen objects
157 virtual bool DoFormatObjs() = 0;
159 /** method to format all floating screen objects at the given anchor frame
161 static bool FormatObjsAtFrame( SwFrame& _rAnchorFrame,
162 const SwPageFrame& _rPageFrame,
163 SwLayAction* _pLayAction = nullptr );
165 /** method to format a given floating screen object
167 static bool FormatObj( SwAnchoredObject& _rAnchoredObj,
168 SwFrame* _pAnchorFrame = nullptr,
169 const SwPageFrame* _pPageFrame = nullptr,
170 SwLayAction* pLayAction = nullptr );
173 #endif
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */