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 : // --> #i28701#
32 : class SwMovedFwdFrmsByObjPos;
33 : class SwTxtFrm;
34 : // --> #i26945#
35 : class SwRowFrm;
36 : // --> #i35911#
37 : class SwObjsMarkedAsTmpConsiderWrapInfluence;
38 : class SwAnchoredObject;
39 : // --> #i65250#
40 : #include <boost/unordered_map.hpp>
41 : class SwFlowFrm;
42 : class SwLayoutFrm;
43 :
44 : #define LOOP_PAGE 1
45 :
46 : class SwLayouter
47 : {
48 : SwEndnoter* pEndnoter;
49 : SwLooping* pLooping;
50 : void _CollectEndnotes( SwSectionFrm* pSect );
51 : sal_Bool StartLooping( SwPageFrm* pPage );
52 :
53 : // --> #i28701#
54 : SwMovedFwdFrmsByObjPos* mpMovedFwdFrms;
55 : // --> #i35911#
56 : SwObjsMarkedAsTmpConsiderWrapInfluence* mpObjsTmpConsiderWrapInfl;
57 :
58 : public:
59 : // --> #i65250#
60 : // - data structure to collect moving backward layout information
61 : struct tMoveBwdLayoutInfoKey
62 : {
63 : // frame ID of flow frame
64 : sal_uInt32 mnFrmId;
65 : // position of new upper frame
66 : SwTwips mnNewUpperPosX;
67 : SwTwips mnNewUpperPosY;
68 : // size of new upper frame
69 : SwTwips mnNewUpperWidth;
70 : SwTwips mnNewUpperHeight;
71 : // free space in new upper frame
72 : SwTwips mnFreeSpaceInNewUpper;
73 :
74 : };
75 : private:
76 : struct fMoveBwdLayoutInfoKeyHash
77 : {
78 0 : size_t operator()( const tMoveBwdLayoutInfoKey& p_key ) const
79 : {
80 0 : return p_key.mnFrmId;
81 : }
82 : };
83 : struct fMoveBwdLayoutInfoKeyEq
84 : {
85 0 : bool operator()( const tMoveBwdLayoutInfoKey& p_key1,
86 : const tMoveBwdLayoutInfoKey& p_key2 ) const
87 : {
88 0 : return p_key1.mnFrmId == p_key2.mnFrmId &&
89 0 : p_key1.mnNewUpperPosX == p_key2.mnNewUpperPosX &&
90 0 : p_key1.mnNewUpperPosY == p_key2.mnNewUpperPosY &&
91 0 : p_key1.mnNewUpperWidth == p_key2.mnNewUpperWidth &&
92 0 : p_key1.mnNewUpperHeight == p_key2.mnNewUpperHeight &&
93 0 : p_key1.mnFreeSpaceInNewUpper == p_key2.mnFreeSpaceInNewUpper;
94 : }
95 : };
96 : boost::unordered_map< const tMoveBwdLayoutInfoKey, sal_uInt16,
97 : fMoveBwdLayoutInfoKeyHash,
98 : fMoveBwdLayoutInfoKeyEq > maMoveBwdLayoutInfo;
99 : public:
100 : SwLayouter();
101 : ~SwLayouter();
102 : void InsertEndnotes( SwSectionFrm* pSect );
103 : void CollectEndnote( SwFtnFrm* pFtn );
104 : bool HasEndnotes() const;
105 :
106 : void LoopControl( SwPageFrm* pPage, sal_uInt8 nLoop );
107 : void EndLoopControl();
108 : void LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm );
109 :
110 : static void CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect );
111 : static sal_Bool Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn );
112 : static sal_Bool StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage );
113 :
114 : // --> #i28701#
115 : static void ClearMovedFwdFrms( const SwDoc& _rDoc );
116 : static void InsertMovedFwdFrm( const SwDoc& _rDoc,
117 : const SwTxtFrm& _rMovedFwdFrmByObjPos,
118 : const sal_uInt32 _nToPageNum );
119 : static bool FrmMovedFwdByObjPos( const SwDoc& _rDoc,
120 : const SwTxtFrm& _rTxtFrm,
121 : sal_uInt32& _ornToPageNum );
122 : // --> #i40155# - ummark given frame as to be moved forward.
123 : static void RemoveMovedFwdFrm( const SwDoc& _rDoc,
124 : const SwTxtFrm& _rTxtFrm );
125 : // --> #i26945#
126 : static bool DoesRowContainMovedFwdFrm( const SwDoc& _rDoc,
127 : const SwRowFrm& _rRowFrm );
128 :
129 : // --> #i35911#
130 : static void ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc );
131 : static void InsertObjForTmpConsiderWrapInfluence(
132 : const SwDoc& _rDoc,
133 : SwAnchoredObject& _rAnchoredObj );
134 : // --> #i65250#
135 : static bool MoveBwdSuppressed( const SwDoc& p_rDoc,
136 : const SwFlowFrm& p_rFlowFrm,
137 : const SwLayoutFrm& p_rNewUpperFrm );
138 : static void ClearMoveBwdLayoutInfo( const SwDoc& p_rDoc );
139 : };
140 :
141 : extern void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm );
142 :
143 : #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYOUTER_HXX
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|