Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / layouter.hxx
bloba3979cf4670acc082642f8873e8c03cf84d8dc68
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_LAYOUTER_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_LAYOUTER_HXX
22 #include <swtypes.hxx>
23 #include <unordered_map>
24 #include <memory>
26 class SwEndnoter;
27 class SwDoc;
28 class SwSectionFrame;
29 class SwFootnoteFrame;
30 class SwPageFrame;
31 class SwLooping;
33 class SwMovedFwdFramesByObjPos;
34 class SwTextFrame;
35 class SwRowFrame;
36 class SwObjsMarkedAsTmpConsiderWrapInfluence;
37 class SwAnchoredObject;
38 class SwFlowFrame;
39 class SwLayoutFrame;
41 #define LOOP_PAGE 1
43 class SwLayouter
45 std::unique_ptr<SwEndnoter> mpEndnoter;
46 std::unique_ptr<SwLooping> mpLooping;
47 void CollectEndnotes_( SwSectionFrame* pSect );
48 bool StartLooping( SwPageFrame const * pPage );
50 // --> #i28701#
51 std::unique_ptr<SwMovedFwdFramesByObjPos> mpMovedFwdFrames;
52 // --> #i35911#
53 std::unique_ptr<SwObjsMarkedAsTmpConsiderWrapInfluence> mpObjsTmpConsiderWrapInfl;
55 public:
56 // --> #i65250#
57 // - data structure to collect moving backward layout information
58 struct tMoveBwdLayoutInfoKey
60 // frame ID of flow frame
61 sal_uInt32 mnFrameId;
62 // position of new upper frame
63 SwTwips mnNewUpperPosX;
64 SwTwips mnNewUpperPosY;
65 // size of new upper frame
66 SwTwips mnNewUpperWidth;
67 SwTwips mnNewUpperHeight;
68 // free space in new upper frame
69 SwTwips mnFreeSpaceInNewUpper;
72 private:
73 struct fMoveBwdLayoutInfoKeyHash
75 size_t operator()( const tMoveBwdLayoutInfoKey& p_key ) const
77 return p_key.mnFrameId;
80 struct fMoveBwdLayoutInfoKeyEq
82 bool operator()( const tMoveBwdLayoutInfoKey& p_key1,
83 const tMoveBwdLayoutInfoKey& p_key2 ) const
85 return p_key1.mnFrameId == p_key2.mnFrameId &&
86 p_key1.mnNewUpperPosX == p_key2.mnNewUpperPosX &&
87 p_key1.mnNewUpperPosY == p_key2.mnNewUpperPosY &&
88 p_key1.mnNewUpperWidth == p_key2.mnNewUpperWidth &&
89 p_key1.mnNewUpperHeight == p_key2.mnNewUpperHeight &&
90 p_key1.mnFreeSpaceInNewUpper == p_key2.mnFreeSpaceInNewUpper;
93 std::unordered_map< tMoveBwdLayoutInfoKey, sal_uInt16,
94 fMoveBwdLayoutInfoKeyHash,
95 fMoveBwdLayoutInfoKeyEq > maMoveBwdLayoutInfo;
96 public:
97 SwLayouter();
98 ~SwLayouter();
99 void InsertEndnotes( SwSectionFrame const * pSect );
100 void CollectEndnote( SwFootnoteFrame* pFootnote );
101 bool HasEndnotes() const;
103 void LoopControl( SwPageFrame* pPage );
104 void EndLoopControl();
105 void LoopingLouieLight( const SwDoc& rDoc, const SwTextFrame& rFrame );
107 static void CollectEndnotes( SwDoc* pDoc, SwSectionFrame* pSect );
108 static bool Collecting( SwDoc* pDoc, SwSectionFrame const * pSect, SwFootnoteFrame* pFootnote );
109 static bool StartLoopControl( SwDoc* pDoc, SwPageFrame const *pPage );
111 // --> #i28701#
112 static void ClearMovedFwdFrames( const SwDoc& _rDoc );
113 static void InsertMovedFwdFrame( const SwDoc& _rDoc,
114 const SwTextFrame& _rMovedFwdFrameByObjPos,
115 const sal_uInt32 _nToPageNum );
116 static bool FrameMovedFwdByObjPos( const SwDoc& _rDoc,
117 const SwTextFrame& _rTextFrame,
118 sal_uInt32& _ornToPageNum );
119 // --> #i40155# - unmark given frame as to be moved forward.
120 static void RemoveMovedFwdFrame( const SwDoc& _rDoc,
121 const SwTextFrame& _rTextFrame );
122 // --> #i26945#
123 static bool DoesRowContainMovedFwdFrame( const SwDoc& _rDoc,
124 const SwRowFrame& _rRowFrame );
126 // --> #i35911#
127 static void ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc );
128 static void InsertObjForTmpConsiderWrapInfluence(
129 const SwDoc& _rDoc,
130 SwAnchoredObject& _rAnchoredObj );
131 static void RemoveObjForTmpConsiderWrapInfluence(
132 const SwDoc& _rDoc,
133 SwAnchoredObject& _rAnchoredObj );
135 // --> #i65250#
136 static bool MoveBwdSuppressed( const SwDoc& p_rDoc,
137 const SwFlowFrame& p_rFlowFrame,
138 const SwLayoutFrame& p_rNewUpperFrame );
139 static void ClearMoveBwdLayoutInfo( const SwDoc& p_rDoc );
142 extern void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTextFrame& rTextFrame );
144 #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYOUTER_HXX
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */