xref: /aoo41x/main/sw/source/core/inc/layouter.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _LAYOUTER_HXX
28 #define _LAYOUTER_HXX
29 
30 #include "swtypes.hxx"
31 
32 class SwEndnoter;
33 class SwDoc;
34 class SwSectionFrm;
35 class SwFtnFrm;
36 class SwPageFrm;
37 class SwLooping;
38 class IDocumentLayoutAccess;
39 
40 // --> OD 2004-06-23 #i28701#
41 class SwMovedFwdFrmsByObjPos;
42 class SwTxtFrm;
43 // <--
44 // --> OD 2004-10-05 #i26945#
45 class SwRowFrm;
46 // <--
47 // --> OD 2004-10-22 #i35911#
48 class SwObjsMarkedAsTmpConsiderWrapInfluence;
49 class SwAnchoredObject;
50 // <--
51 // --> OD 2005-01-12 #i40155#
52 #include <vector>
53 class SwFrm;
54 // <--
55 // --> OD 2006-05-10 #i65250#
56 #include <swtypes.hxx>
57 #include <hash_map>
58 class SwFlowFrm;
59 class SwLayoutFrm;
60 // <--
61 
62 #define LOOP_PAGE 1
63 
64 class SwLayouter
65 {
66 	SwEndnoter* pEndnoter;
67 	SwLooping* pLooping;
68 	void _CollectEndnotes( SwSectionFrm* pSect );
69 	sal_Bool StartLooping( SwPageFrm* pPage );
70 
71     // --> OD 2004-06-23 #i28701#
72     SwMovedFwdFrmsByObjPos* mpMovedFwdFrms;
73     // <--
74     // --> OD 2004-10-22 #i35911#
75     SwObjsMarkedAsTmpConsiderWrapInfluence* mpObjsTmpConsiderWrapInfl;
76     // <--
77     // --> OD 2005-01-12 #i40155# - data structure to collect frames, which are
78     // marked not to wrap around objects.
79     std::vector< const SwFrm* > maFrmsNotToWrap;
80     // <--
81 
82 public:
83     // --> OD 2006-05-10 #i65250#
84     // - data structure to collect moving backward layout information
85     struct tMoveBwdLayoutInfoKey
86     {
87         // frame ID of flow frame
88         sal_uInt32 mnFrmId;
89         // position of new upper frame
90         SwTwips mnNewUpperPosX;
91         SwTwips mnNewUpperPosY;
92         // size of new upper frame
93         SwTwips mnNewUpperWidth;
94         SwTwips mnNewUpperHeight;
95         // free space in new upper frame
96         SwTwips mnFreeSpaceInNewUpper;
97 
98     };
99 private:
100     struct fMoveBwdLayoutInfoKeyHash
101     {
102         size_t operator()( const tMoveBwdLayoutInfoKey& p_key ) const
103         {
104             return p_key.mnFrmId;
105         }
106     };
107     struct fMoveBwdLayoutInfoKeyEq
108     {
109         bool operator()( const tMoveBwdLayoutInfoKey& p_key1,
110                          const tMoveBwdLayoutInfoKey& p_key2 ) const
111         {
112             return p_key1.mnFrmId == p_key2.mnFrmId &&
113                    p_key1.mnNewUpperPosX == p_key2.mnNewUpperPosX &&
114                    p_key1.mnNewUpperPosY == p_key2.mnNewUpperPosY &&
115                    p_key1.mnNewUpperWidth == p_key2.mnNewUpperWidth &&
116                    p_key1.mnNewUpperHeight == p_key2.mnNewUpperHeight &&
117                    p_key1.mnFreeSpaceInNewUpper == p_key2.mnFreeSpaceInNewUpper;
118         }
119     };
120     std::hash_map< const tMoveBwdLayoutInfoKey, sal_uInt16,
121                    fMoveBwdLayoutInfoKeyHash,
122                    fMoveBwdLayoutInfoKeyEq > maMoveBwdLayoutInfo;
123     // <--
124 public:
125 	SwLayouter();
126 	~SwLayouter();
127 	void InsertEndnotes( SwSectionFrm* pSect );
128 	void CollectEndnote( SwFtnFrm* pFtn );
129 	sal_Bool HasEndnotes() const;
130 
131 	void LoopControl( SwPageFrm* pPage, sal_uInt8 nLoop );
132 	void EndLoopControl();
133     void LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm );
134 
135 	static void CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect );
136 	static sal_Bool Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn );
137 	static sal_Bool StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage );
138 
139     // --> OD 2004-06-23 #i28701#
140     static void ClearMovedFwdFrms( const SwDoc& _rDoc );
141     static void InsertMovedFwdFrm( const SwDoc& _rDoc,
142                                    const SwTxtFrm& _rMovedFwdFrmByObjPos,
143                                    const sal_uInt32 _nToPageNum );
144     static bool FrmMovedFwdByObjPos( const SwDoc& _rDoc,
145                                      const SwTxtFrm& _rTxtFrm,
146                                      sal_uInt32& _ornToPageNum );
147     // <--
148     // --> OD 2005-01-12 #i40155# - ummark given frame as to be moved forward.
149     static void RemoveMovedFwdFrm( const SwDoc& _rDoc,
150                                    const SwTxtFrm& _rTxtFrm );
151     // <--
152     // --> OD 2004-10-05 #i26945#
153     static bool DoesRowContainMovedFwdFrm( const SwDoc& _rDoc,
154                                            const SwRowFrm& _rRowFrm );
155     // <--
156 
157     // --> OD 2004-10-22 #i35911#
158     static void ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc );
159     static void InsertObjForTmpConsiderWrapInfluence(
160                                         const SwDoc& _rDoc,
161                                         SwAnchoredObject& _rAnchoredObj );
162     // <--
163     // --> OD 2005-01-12 #i40155#
164     static void ClearFrmsNotToWrap( const SwDoc& _rDoc );
165     static void InsertFrmNotToWrap( const SwDoc& _rDoc,
166                                     const SwFrm& _rFrm );
167     static bool FrmNotToWrap( const IDocumentLayoutAccess& _rIDLA,
168                               const SwFrm& _rFrm );
169     // <--
170     // --> OD 2006-05-10 #i65250#
171     static bool MoveBwdSuppressed( const SwDoc& p_rDoc,
172                                    const SwFlowFrm& p_rFlowFrm,
173                                    const SwLayoutFrm& p_rNewUpperFrm );
174     static void ClearMoveBwdLayoutInfo( const SwDoc& p_rDoc );
175     // <--
176 };
177 
178 
179 extern void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm );
180 
181 #endif  //_LAYOUTER_HXX
182 
183 
184