xref: /aoo4110/main/sw/source/core/inc/layouter.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _LAYOUTER_HXX
24 #define _LAYOUTER_HXX
25 
26 #include "swtypes.hxx"
27 
28 class SwEndnoter;
29 class SwDoc;
30 class SwSectionFrm;
31 class SwFtnFrm;
32 class SwPageFrm;
33 class SwLooping;
34 class IDocumentLayoutAccess;
35 
36 // --> OD 2004-06-23 #i28701#
37 class SwMovedFwdFrmsByObjPos;
38 class SwTxtFrm;
39 // <--
40 // --> OD 2004-10-05 #i26945#
41 class SwRowFrm;
42 // <--
43 // --> OD 2004-10-22 #i35911#
44 class SwObjsMarkedAsTmpConsiderWrapInfluence;
45 class SwAnchoredObject;
46 // <--
47 // --> OD 2005-01-12 #i40155#
48 #include <vector>
49 class SwFrm;
50 // <--
51 // --> OD 2006-05-10 #i65250#
52 #include <swtypes.hxx>
53 #include <hash_map>
54 class SwFlowFrm;
55 class SwLayoutFrm;
56 // <--
57 
58 #define LOOP_PAGE 1
59 
60 class SwLayouter
61 {
62 	SwEndnoter* pEndnoter;
63 	SwLooping* pLooping;
64 	void _CollectEndnotes( SwSectionFrm* pSect );
65 	sal_Bool StartLooping( SwPageFrm* pPage );
66 
67     // --> OD 2004-06-23 #i28701#
68     SwMovedFwdFrmsByObjPos* mpMovedFwdFrms;
69     // <--
70     // --> OD 2004-10-22 #i35911#
71     SwObjsMarkedAsTmpConsiderWrapInfluence* mpObjsTmpConsiderWrapInfl;
72     // <--
73     // --> OD 2005-01-12 #i40155# - data structure to collect frames, which are
74     // marked not to wrap around objects.
75     std::vector< const SwFrm* > maFrmsNotToWrap;
76     // <--
77 
78 public:
79     // --> OD 2006-05-10 #i65250#
80     // - data structure to collect moving backward layout information
81     struct tMoveBwdLayoutInfoKey
82     {
83         // frame ID of flow frame
84         sal_uInt32 mnFrmId;
85         // position of new upper frame
86         SwTwips mnNewUpperPosX;
87         SwTwips mnNewUpperPosY;
88         // size of new upper frame
89         SwTwips mnNewUpperWidth;
90         SwTwips mnNewUpperHeight;
91         // free space in new upper frame
92         SwTwips mnFreeSpaceInNewUpper;
93 
94     };
95 private:
96     struct fMoveBwdLayoutInfoKeyHash
97     {
operator ()SwLayouter::fMoveBwdLayoutInfoKeyHash98         size_t operator()( const tMoveBwdLayoutInfoKey& p_key ) const
99         {
100             return p_key.mnFrmId;
101         }
102     };
103     struct fMoveBwdLayoutInfoKeyEq
104     {
operator ()SwLayouter::fMoveBwdLayoutInfoKeyEq105         bool operator()( const tMoveBwdLayoutInfoKey& p_key1,
106                          const tMoveBwdLayoutInfoKey& p_key2 ) const
107         {
108             return p_key1.mnFrmId == p_key2.mnFrmId &&
109                    p_key1.mnNewUpperPosX == p_key2.mnNewUpperPosX &&
110                    p_key1.mnNewUpperPosY == p_key2.mnNewUpperPosY &&
111                    p_key1.mnNewUpperWidth == p_key2.mnNewUpperWidth &&
112                    p_key1.mnNewUpperHeight == p_key2.mnNewUpperHeight &&
113                    p_key1.mnFreeSpaceInNewUpper == p_key2.mnFreeSpaceInNewUpper;
114         }
115     };
116     std::hash_map< const tMoveBwdLayoutInfoKey, sal_uInt16,
117                    fMoveBwdLayoutInfoKeyHash,
118                    fMoveBwdLayoutInfoKeyEq > maMoveBwdLayoutInfo;
119     // <--
120 public:
121 	SwLayouter();
122 	~SwLayouter();
123 	void InsertEndnotes( SwSectionFrm* pSect );
124 	void CollectEndnote( SwFtnFrm* pFtn );
125 	sal_Bool HasEndnotes() const;
126 
127 	void LoopControl( SwPageFrm* pPage, sal_uInt8 nLoop );
128 	void EndLoopControl();
129     void LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm );
130 
131 	static void CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect );
132 	static sal_Bool Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn );
133 	static sal_Bool StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage );
134 
135     // --> OD 2004-06-23 #i28701#
136     static void ClearMovedFwdFrms( const SwDoc& _rDoc );
137     static void InsertMovedFwdFrm( const SwDoc& _rDoc,
138                                    const SwTxtFrm& _rMovedFwdFrmByObjPos,
139                                    const sal_uInt32 _nToPageNum );
140     static bool FrmMovedFwdByObjPos( const SwDoc& _rDoc,
141                                      const SwTxtFrm& _rTxtFrm,
142                                      sal_uInt32& _ornToPageNum );
143     // <--
144     // --> OD 2005-01-12 #i40155# - ummark given frame as to be moved forward.
145     static void RemoveMovedFwdFrm( const SwDoc& _rDoc,
146                                    const SwTxtFrm& _rTxtFrm );
147     // <--
148     // --> OD 2004-10-05 #i26945#
149     static bool DoesRowContainMovedFwdFrm( const SwDoc& _rDoc,
150                                            const SwRowFrm& _rRowFrm );
151     // <--
152 
153     // --> OD 2004-10-22 #i35911#
154     static void ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc );
155     static void InsertObjForTmpConsiderWrapInfluence(
156                                         const SwDoc& _rDoc,
157                                         SwAnchoredObject& _rAnchoredObj );
158     // <--
159     // --> OD 2005-01-12 #i40155#
160     static void ClearFrmsNotToWrap( const SwDoc& _rDoc );
161     static void InsertFrmNotToWrap( const SwDoc& _rDoc,
162                                     const SwFrm& _rFrm );
163     static bool FrmNotToWrap( const IDocumentLayoutAccess& _rIDLA,
164                               const SwFrm& _rFrm );
165     // <--
166     // --> OD 2006-05-10 #i65250#
167     static bool MoveBwdSuppressed( const SwDoc& p_rDoc,
168                                    const SwFlowFrm& p_rFlowFrm,
169                                    const SwLayoutFrm& p_rNewUpperFrm );
170     static void ClearMoveBwdLayoutInfo( const SwDoc& p_rDoc );
171     // <--
172 };
173 
174 
175 extern void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm );
176 
177 #endif  //_LAYOUTER_HXX
178 
179 
180