Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_CORE_INC_LAYOUTER_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_INC_LAYOUTER_HXX
21 :
22 : #include "swtypes.hxx"
23 : #include <unordered_map>
24 :
25 : class SwEndnoter;
26 : class SwDoc;
27 : class SwSectionFrm;
28 : class SwFootnoteFrm;
29 : class SwPageFrm;
30 : class SwLooping;
31 :
32 : class SwMovedFwdFrmsByObjPos;
33 : class SwTextFrm;
34 : class SwRowFrm;
35 : class SwObjsMarkedAsTmpConsiderWrapInfluence;
36 : class SwAnchoredObject;
37 : class SwFlowFrm;
38 : class SwLayoutFrm;
39 :
40 : #define LOOP_PAGE 1
41 :
42 : class SwLayouter
43 : {
44 : SwEndnoter* mpEndnoter;
45 : SwLooping* mpLooping;
46 : void _CollectEndnotes( SwSectionFrm* pSect );
47 : bool StartLooping( SwPageFrm* pPage );
48 :
49 : // --> #i28701#
50 : SwMovedFwdFrmsByObjPos* mpMovedFwdFrms;
51 : // --> #i35911#
52 : SwObjsMarkedAsTmpConsiderWrapInfluence* mpObjsTmpConsiderWrapInfl;
53 :
54 : public:
55 : // --> #i65250#
56 : // - data structure to collect moving backward layout information
57 : struct tMoveBwdLayoutInfoKey
58 : {
59 : // frame ID of flow frame
60 : sal_uInt32 mnFrmId;
61 : // position of new upper frame
62 : SwTwips mnNewUpperPosX;
63 : SwTwips mnNewUpperPosY;
64 : // size of new upper frame
65 : SwTwips mnNewUpperWidth;
66 : SwTwips mnNewUpperHeight;
67 : // free space in new upper frame
68 : SwTwips mnFreeSpaceInNewUpper;
69 :
70 : };
71 : private:
72 : struct fMoveBwdLayoutInfoKeyHash
73 : {
74 6797 : size_t operator()( const tMoveBwdLayoutInfoKey& p_key ) const
75 : {
76 6797 : return p_key.mnFrmId;
77 : }
78 : };
79 : struct fMoveBwdLayoutInfoKeyEq
80 : {
81 746 : bool operator()( const tMoveBwdLayoutInfoKey& p_key1,
82 : const tMoveBwdLayoutInfoKey& p_key2 ) const
83 : {
84 1492 : return p_key1.mnFrmId == p_key2.mnFrmId &&
85 1444 : p_key1.mnNewUpperPosX == p_key2.mnNewUpperPosX &&
86 1377 : p_key1.mnNewUpperPosY == p_key2.mnNewUpperPosY &&
87 1358 : p_key1.mnNewUpperWidth == p_key2.mnNewUpperWidth &&
88 1832 : p_key1.mnNewUpperHeight == p_key2.mnNewUpperHeight &&
89 1153 : p_key1.mnFreeSpaceInNewUpper == p_key2.mnFreeSpaceInNewUpper;
90 : }
91 : };
92 : std::unordered_map< tMoveBwdLayoutInfoKey, sal_uInt16,
93 : fMoveBwdLayoutInfoKeyHash,
94 : fMoveBwdLayoutInfoKeyEq > maMoveBwdLayoutInfo;
95 : public:
96 : SwLayouter();
97 : ~SwLayouter();
98 : void InsertEndnotes( SwSectionFrm* pSect );
99 : void CollectEndnote( SwFootnoteFrm* pFootnote );
100 : bool HasEndnotes() const;
101 :
102 : void LoopControl( SwPageFrm* pPage, sal_uInt8 nLoop );
103 : void EndLoopControl();
104 : void LoopingLouieLight( const SwDoc& rDoc, const SwTextFrm& rFrm );
105 :
106 : static void CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect );
107 : static bool Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFootnoteFrm* pFootnote );
108 : static bool StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage );
109 :
110 : // --> #i28701#
111 : static void ClearMovedFwdFrms( const SwDoc& _rDoc );
112 : static void InsertMovedFwdFrm( const SwDoc& _rDoc,
113 : const SwTextFrm& _rMovedFwdFrmByObjPos,
114 : const sal_uInt32 _nToPageNum );
115 : static bool FrmMovedFwdByObjPos( const SwDoc& _rDoc,
116 : const SwTextFrm& _rTextFrm,
117 : sal_uInt32& _ornToPageNum );
118 : // --> #i40155# - ummark given frame as to be moved forward.
119 : static void RemoveMovedFwdFrm( const SwDoc& _rDoc,
120 : const SwTextFrm& _rTextFrm );
121 : // --> #i26945#
122 : static bool DoesRowContainMovedFwdFrm( const SwDoc& _rDoc,
123 : const SwRowFrm& _rRowFrm );
124 :
125 : // --> #i35911#
126 : static void ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc );
127 : static void InsertObjForTmpConsiderWrapInfluence(
128 : const SwDoc& _rDoc,
129 : SwAnchoredObject& _rAnchoredObj );
130 : // --> #i65250#
131 : static bool MoveBwdSuppressed( const SwDoc& p_rDoc,
132 : const SwFlowFrm& p_rFlowFrm,
133 : const SwLayoutFrm& p_rNewUpperFrm );
134 : static void ClearMoveBwdLayoutInfo( const SwDoc& p_rDoc );
135 : };
136 :
137 : extern void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTextFrm& rTextFrm );
138 :
139 : #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYOUTER_HXX
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|