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 :
24 : class SwEndnoter;
25 : class SwDoc;
26 : class SwSectionFrm;
27 : class SwFtnFrm;
28 : class SwPageFrm;
29 : class SwLooping;
30 :
31 : class SwMovedFwdFrmsByObjPos;
32 : class SwTxtFrm;
33 : class SwRowFrm;
34 : class SwObjsMarkedAsTmpConsiderWrapInfluence;
35 : class SwAnchoredObject;
36 : #include <boost/unordered_map.hpp>
37 : class SwFlowFrm;
38 : class SwLayoutFrm;
39 :
40 : #define LOOP_PAGE 1
41 :
42 : class SwLayouter
43 : {
44 : SwEndnoter* pEndnoter;
45 : SwLooping* pLooping;
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 12792 : size_t operator()( const tMoveBwdLayoutInfoKey& p_key ) const
75 : {
76 12792 : return p_key.mnFrmId;
77 : }
78 : };
79 : struct fMoveBwdLayoutInfoKeyEq
80 : {
81 1322 : bool operator()( const tMoveBwdLayoutInfoKey& p_key1,
82 : const tMoveBwdLayoutInfoKey& p_key2 ) const
83 : {
84 2644 : return p_key1.mnFrmId == p_key2.mnFrmId &&
85 2600 : p_key1.mnNewUpperPosX == p_key2.mnNewUpperPosX &&
86 2518 : p_key1.mnNewUpperPosY == p_key2.mnNewUpperPosY &&
87 2480 : p_key1.mnNewUpperWidth == p_key2.mnNewUpperWidth &&
88 3368 : p_key1.mnNewUpperHeight == p_key2.mnNewUpperHeight &&
89 2128 : p_key1.mnFreeSpaceInNewUpper == p_key2.mnFreeSpaceInNewUpper;
90 : }
91 : };
92 : boost::unordered_map< const tMoveBwdLayoutInfoKey, sal_uInt16,
93 : fMoveBwdLayoutInfoKeyHash,
94 : fMoveBwdLayoutInfoKeyEq > maMoveBwdLayoutInfo;
95 : public:
96 : SwLayouter();
97 : ~SwLayouter();
98 : void InsertEndnotes( SwSectionFrm* pSect );
99 : void CollectEndnote( SwFtnFrm* pFtn );
100 : bool HasEndnotes() const;
101 :
102 : void LoopControl( SwPageFrm* pPage, sal_uInt8 nLoop );
103 : void EndLoopControl();
104 : void LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm );
105 :
106 : static void CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect );
107 : static bool Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn );
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 SwTxtFrm& _rMovedFwdFrmByObjPos,
114 : const sal_uInt32 _nToPageNum );
115 : static bool FrmMovedFwdByObjPos( const SwDoc& _rDoc,
116 : const SwTxtFrm& _rTxtFrm,
117 : sal_uInt32& _ornToPageNum );
118 : // --> #i40155# - ummark given frame as to be moved forward.
119 : static void RemoveMovedFwdFrm( const SwDoc& _rDoc,
120 : const SwTxtFrm& _rTxtFrm );
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 SwTxtFrm& rTxtFrm );
138 :
139 : #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYOUTER_HXX
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|