xref: /trunk/main/sw/source/core/layout/newfrm.cxx (revision 26ea3662)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24*26ea3662SArmin Le Grand 
25cdf0e10cSrcweir #include <svx/svdmodel.hxx>
26cdf0e10cSrcweir #include <svx/svdpage.hxx>
27cdf0e10cSrcweir #include <fmtfordr.hxx>
28cdf0e10cSrcweir #include <fmtpdsc.hxx>
29cdf0e10cSrcweir #include <frmfmt.hxx>
30cdf0e10cSrcweir #include <swtable.hxx>
31cdf0e10cSrcweir #include <rootfrm.hxx>
32cdf0e10cSrcweir #include <pagefrm.hxx>
33cdf0e10cSrcweir #include <cntfrm.hxx>
34cdf0e10cSrcweir #include <viewsh.hxx>
35cdf0e10cSrcweir #include <doc.hxx>
36cdf0e10cSrcweir #include <node.hxx>
37cdf0e10cSrcweir #include <dflyobj.hxx>
38cdf0e10cSrcweir #include <frmtool.hxx>
39cdf0e10cSrcweir #include <virtoutp.hxx>
40cdf0e10cSrcweir #include <blink.hxx>
41cdf0e10cSrcweir #include <ndindex.hxx>
42cdf0e10cSrcweir #include <sectfrm.hxx>
43cdf0e10cSrcweir #include <notxtfrm.hxx>
44cdf0e10cSrcweir #include <pagedesc.hxx>
45cdf0e10cSrcweir #include "viewimp.hxx"
46cdf0e10cSrcweir #include "IDocumentTimerAccess.hxx"
47cdf0e10cSrcweir #include "IDocumentLayoutAccess.hxx"
48cdf0e10cSrcweir #include "IDocumentFieldsAccess.hxx"
49cdf0e10cSrcweir #include "IDocumentSettingAccess.hxx"
50cdf0e10cSrcweir #include "IDocumentDrawModelAccess.hxx"
51cdf0e10cSrcweir #include <hints.hxx>
52cdf0e10cSrcweir #include <viewopt.hxx>
53*26ea3662SArmin Le Grand #include <drawdoc.hxx>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir SwLayVout     *SwRootFrm::pVout = 0;
56cdf0e10cSrcweir sal_Bool 		   SwRootFrm::bInPaint = sal_False;
57cdf0e10cSrcweir sal_Bool 		   SwRootFrm::bNoVirDev = sal_False;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir SwCache *SwFrm::pCache = 0;
60cdf0e10cSrcweir 
FirstMinusSecond(long nFirst,long nSecond)61cdf0e10cSrcweir long FirstMinusSecond( long nFirst, long nSecond )
62cdf0e10cSrcweir     { return nFirst - nSecond; }
SecondMinusFirst(long nFirst,long nSecond)63cdf0e10cSrcweir long SecondMinusFirst( long nFirst, long nSecond )
64cdf0e10cSrcweir     { return nSecond - nFirst; }
SwIncrement(long nA,long nAdd)65cdf0e10cSrcweir long SwIncrement( long nA, long nAdd )
66cdf0e10cSrcweir     { return nA + nAdd; }
SwDecrement(long nA,long nSub)67cdf0e10cSrcweir long SwDecrement( long nA, long nSub )
68cdf0e10cSrcweir     { return nA - nSub; }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir static SwRectFnCollection aHorizontal = {
71cdf0e10cSrcweir     /* fnRectGet      */
72cdf0e10cSrcweir     &SwRect::_Top,
73cdf0e10cSrcweir     &SwRect::_Bottom,
74cdf0e10cSrcweir     &SwRect::_Left,
75cdf0e10cSrcweir     &SwRect::_Right,
76cdf0e10cSrcweir     &SwRect::_Width,
77cdf0e10cSrcweir     &SwRect::_Height,
78cdf0e10cSrcweir     &SwRect::TopLeft,
79cdf0e10cSrcweir     &SwRect::_Size,
80cdf0e10cSrcweir     /* fnRectSet      */
81cdf0e10cSrcweir     &SwRect::_Top,
82cdf0e10cSrcweir     &SwRect::_Bottom,
83cdf0e10cSrcweir     &SwRect::_Left,
84cdf0e10cSrcweir     &SwRect::_Right,
85cdf0e10cSrcweir     &SwRect::_Width,
86cdf0e10cSrcweir     &SwRect::_Height,
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     &SwRect::SubTop,
89cdf0e10cSrcweir     &SwRect::AddBottom,
90cdf0e10cSrcweir     &SwRect::SubLeft,
91cdf0e10cSrcweir     &SwRect::AddRight,
92cdf0e10cSrcweir     &SwRect::AddWidth,
93cdf0e10cSrcweir     &SwRect::AddHeight,
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     &SwRect::SetPosX,
96cdf0e10cSrcweir     &SwRect::SetPosY,
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     &SwFrm::GetTopMargin,
99cdf0e10cSrcweir     &SwFrm::GetBottomMargin,
100cdf0e10cSrcweir     &SwFrm::GetLeftMargin,
101cdf0e10cSrcweir     &SwFrm::GetRightMargin,
102cdf0e10cSrcweir     &SwFrm::SetLeftRightMargins,
103cdf0e10cSrcweir     &SwFrm::SetTopBottomMargins,
104cdf0e10cSrcweir     &SwFrm::GetPrtTop,
105cdf0e10cSrcweir     &SwFrm::GetPrtBottom,
106cdf0e10cSrcweir     &SwFrm::GetPrtLeft,
107cdf0e10cSrcweir     &SwFrm::GetPrtRight,
108cdf0e10cSrcweir     &SwRect::GetTopDistance,
109cdf0e10cSrcweir     &SwRect::GetBottomDistance,
110cdf0e10cSrcweir     &SwRect::GetLeftDistance,
111cdf0e10cSrcweir     &SwRect::GetRightDistance,
112cdf0e10cSrcweir     &SwFrm::SetMaxBottom,
113cdf0e10cSrcweir     &SwRect::OverStepBottom,
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     &SwRect::SetUpperLeftCorner,
116cdf0e10cSrcweir     &SwFrm::MakeBelowPos,
117cdf0e10cSrcweir     &FirstMinusSecond,
118cdf0e10cSrcweir     &FirstMinusSecond,
119cdf0e10cSrcweir     &SwIncrement,
120cdf0e10cSrcweir     &SwIncrement,
121cdf0e10cSrcweir     &SwRect::SetLeftAndWidth,
122cdf0e10cSrcweir     &SwRect::SetTopAndHeight
123cdf0e10cSrcweir };
124cdf0e10cSrcweir 
125cdf0e10cSrcweir static SwRectFnCollection aVertical = {
126cdf0e10cSrcweir     /* fnRectGet      */
127cdf0e10cSrcweir     &SwRect::_Right,
128cdf0e10cSrcweir     &SwRect::_Left,
129cdf0e10cSrcweir     &SwRect::_Top,
130cdf0e10cSrcweir     &SwRect::_Bottom,
131cdf0e10cSrcweir     &SwRect::_Height,
132cdf0e10cSrcweir     &SwRect::_Width,
133cdf0e10cSrcweir     &SwRect::TopRight,
134cdf0e10cSrcweir     &SwRect::SwappedSize,
135cdf0e10cSrcweir     /* fnRectSet      */
136cdf0e10cSrcweir     &SwRect::_Right,
137cdf0e10cSrcweir     &SwRect::_Left,
138cdf0e10cSrcweir     &SwRect::_Top,
139cdf0e10cSrcweir     &SwRect::_Bottom,
140cdf0e10cSrcweir     &SwRect::_Height,
141cdf0e10cSrcweir     &SwRect::_Width,
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     &SwRect::AddRight,
144cdf0e10cSrcweir     &SwRect::SubLeft,
145cdf0e10cSrcweir     &SwRect::SubTop,
146cdf0e10cSrcweir     &SwRect::AddBottom,
147cdf0e10cSrcweir     &SwRect::AddHeight,
148cdf0e10cSrcweir     &SwRect::AddWidth,
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     &SwRect::SetPosY,
151cdf0e10cSrcweir     &SwRect::SetPosX,
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     &SwFrm::GetRightMargin,
154cdf0e10cSrcweir     &SwFrm::GetLeftMargin,
155cdf0e10cSrcweir     &SwFrm::GetTopMargin,
156cdf0e10cSrcweir     &SwFrm::GetBottomMargin,
157cdf0e10cSrcweir     &SwFrm::SetTopBottomMargins,
158cdf0e10cSrcweir     &SwFrm::SetRightLeftMargins,
159cdf0e10cSrcweir     &SwFrm::GetPrtRight,
160cdf0e10cSrcweir     &SwFrm::GetPrtLeft,
161cdf0e10cSrcweir     &SwFrm::GetPrtTop,
162cdf0e10cSrcweir     &SwFrm::GetPrtBottom,
163cdf0e10cSrcweir     &SwRect::GetRightDistance,
164cdf0e10cSrcweir     &SwRect::GetLeftDistance,
165cdf0e10cSrcweir     &SwRect::GetTopDistance,
166cdf0e10cSrcweir     &SwRect::GetBottomDistance,
167cdf0e10cSrcweir     &SwFrm::SetMinLeft,
168cdf0e10cSrcweir     &SwRect::OverStepLeft,
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     &SwRect::SetUpperRightCorner,
171cdf0e10cSrcweir     &SwFrm::MakeLeftPos,
172cdf0e10cSrcweir     &FirstMinusSecond,
173cdf0e10cSrcweir     &SecondMinusFirst,
174cdf0e10cSrcweir     &SwIncrement,
175cdf0e10cSrcweir     &SwDecrement,
176cdf0e10cSrcweir     &SwRect::SetTopAndHeight,
177cdf0e10cSrcweir     &SwRect::SetRightAndWidth
178cdf0e10cSrcweir };
179cdf0e10cSrcweir 
180cdf0e10cSrcweir static SwRectFnCollection aBottomToTop = {
181cdf0e10cSrcweir     /* fnRectGet      */
182cdf0e10cSrcweir     &SwRect::_Bottom,
183cdf0e10cSrcweir     &SwRect::_Top,
184cdf0e10cSrcweir     &SwRect::_Left,
185cdf0e10cSrcweir     &SwRect::_Right,
186cdf0e10cSrcweir     &SwRect::_Width,
187cdf0e10cSrcweir     &SwRect::_Height,
188cdf0e10cSrcweir     &SwRect::BottomLeft,
189cdf0e10cSrcweir     &SwRect::_Size,
190cdf0e10cSrcweir     /* fnRectSet      */
191cdf0e10cSrcweir     &SwRect::_Bottom,
192cdf0e10cSrcweir     &SwRect::_Top,
193cdf0e10cSrcweir     &SwRect::_Left,
194cdf0e10cSrcweir     &SwRect::_Right,
195cdf0e10cSrcweir     &SwRect::_Width,
196cdf0e10cSrcweir     &SwRect::_Height,
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     &SwRect::AddBottom,
199cdf0e10cSrcweir     &SwRect::SubTop,
200cdf0e10cSrcweir     &SwRect::SubLeft,
201cdf0e10cSrcweir     &SwRect::AddRight,
202cdf0e10cSrcweir     &SwRect::AddWidth,
203cdf0e10cSrcweir     &SwRect::AddHeight,
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     &SwRect::SetPosX,
206cdf0e10cSrcweir     &SwRect::SetPosY,
207cdf0e10cSrcweir 
208cdf0e10cSrcweir     &SwFrm::GetBottomMargin,
209cdf0e10cSrcweir     &SwFrm::GetTopMargin,
210cdf0e10cSrcweir     &SwFrm::GetLeftMargin,
211cdf0e10cSrcweir     &SwFrm::GetRightMargin,
212cdf0e10cSrcweir     &SwFrm::SetLeftRightMargins,
213cdf0e10cSrcweir     &SwFrm::SetBottomTopMargins,
214cdf0e10cSrcweir     &SwFrm::GetPrtBottom,
215cdf0e10cSrcweir     &SwFrm::GetPrtTop,
216cdf0e10cSrcweir     &SwFrm::GetPrtLeft,
217cdf0e10cSrcweir     &SwFrm::GetPrtRight,
218cdf0e10cSrcweir     &SwRect::GetBottomDistance,
219cdf0e10cSrcweir     &SwRect::GetTopDistance,
220cdf0e10cSrcweir     &SwRect::GetLeftDistance,
221cdf0e10cSrcweir     &SwRect::GetRightDistance,
222cdf0e10cSrcweir     &SwFrm::SetMinTop,
223cdf0e10cSrcweir     &SwRect::OverStepTop,
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     &SwRect::SetLowerLeftCorner,
226cdf0e10cSrcweir     &SwFrm::MakeUpperPos,
227cdf0e10cSrcweir     &FirstMinusSecond,
228cdf0e10cSrcweir     &SecondMinusFirst,
229cdf0e10cSrcweir     &SwIncrement,
230cdf0e10cSrcweir     &SwDecrement,
231cdf0e10cSrcweir     &SwRect::SetLeftAndWidth,
232cdf0e10cSrcweir     &SwRect::SetBottomAndHeight
233cdf0e10cSrcweir };
234cdf0e10cSrcweir 
235cdf0e10cSrcweir static SwRectFnCollection aVerticalRightToLeft = {
236cdf0e10cSrcweir     /* fnRectGet      */
237cdf0e10cSrcweir     &SwRect::_Left,
238cdf0e10cSrcweir     &SwRect::_Right,
239cdf0e10cSrcweir     &SwRect::_Top,
240cdf0e10cSrcweir     &SwRect::_Bottom,
241cdf0e10cSrcweir     &SwRect::_Height,
242cdf0e10cSrcweir     &SwRect::_Width,
243cdf0e10cSrcweir     &SwRect::BottomRight,
244cdf0e10cSrcweir     &SwRect::SwappedSize,
245cdf0e10cSrcweir     /* fnRectSet      */
246cdf0e10cSrcweir     &SwRect::_Left,
247cdf0e10cSrcweir     &SwRect::_Right,
248cdf0e10cSrcweir     &SwRect::_Top,
249cdf0e10cSrcweir     &SwRect::_Bottom,
250cdf0e10cSrcweir     &SwRect::_Height,
251cdf0e10cSrcweir     &SwRect::_Width,
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     &SwRect::SubLeft,
254cdf0e10cSrcweir     &SwRect::AddRight,
255cdf0e10cSrcweir     &SwRect::SubTop,
256cdf0e10cSrcweir     &SwRect::AddBottom,
257cdf0e10cSrcweir     &SwRect::AddHeight,
258cdf0e10cSrcweir     &SwRect::AddWidth,
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     &SwRect::SetPosY,
261cdf0e10cSrcweir     &SwRect::SetPosX,
262cdf0e10cSrcweir 
263cdf0e10cSrcweir     &SwFrm::GetLeftMargin,
264cdf0e10cSrcweir     &SwFrm::GetRightMargin,
265cdf0e10cSrcweir     &SwFrm::GetTopMargin,
266cdf0e10cSrcweir     &SwFrm::GetBottomMargin,
267cdf0e10cSrcweir     &SwFrm::SetTopBottomMargins,
268cdf0e10cSrcweir     &SwFrm::SetLeftRightMargins,
269cdf0e10cSrcweir     &SwFrm::GetPrtLeft,
270cdf0e10cSrcweir     &SwFrm::GetPrtRight,
271cdf0e10cSrcweir     &SwFrm::GetPrtBottom,
272cdf0e10cSrcweir     &SwFrm::GetPrtTop,
273cdf0e10cSrcweir     &SwRect::GetLeftDistance,
274cdf0e10cSrcweir     &SwRect::GetRightDistance,
275cdf0e10cSrcweir     &SwRect::GetBottomDistance,
276cdf0e10cSrcweir     &SwRect::GetTopDistance,
277cdf0e10cSrcweir     &SwFrm::SetMaxRight,
278cdf0e10cSrcweir     &SwRect::OverStepRight,
279cdf0e10cSrcweir 
280cdf0e10cSrcweir     &SwRect::SetLowerLeftCorner,
281cdf0e10cSrcweir     &SwFrm::MakeRightPos,
282cdf0e10cSrcweir     &FirstMinusSecond,
283cdf0e10cSrcweir     &FirstMinusSecond,
284cdf0e10cSrcweir     &SwDecrement,
285cdf0e10cSrcweir     &SwIncrement,
286cdf0e10cSrcweir     &SwRect::SetBottomAndHeight,
287cdf0e10cSrcweir     &SwRect::SetLeftAndWidth
288cdf0e10cSrcweir };
289cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
290cdf0e10cSrcweir static SwRectFnCollection aVerticalLeftToRight = {
291cdf0e10cSrcweir     /* fnRectGet      */
292cdf0e10cSrcweir     &SwRect::_Left,
293cdf0e10cSrcweir     &SwRect::_Right,
294cdf0e10cSrcweir     &SwRect::_Top,
295cdf0e10cSrcweir     &SwRect::_Bottom,
296cdf0e10cSrcweir     &SwRect::_Height,
297cdf0e10cSrcweir     &SwRect::_Width,
298cdf0e10cSrcweir     &SwRect::TopLeft,
299cdf0e10cSrcweir     &SwRect::SwappedSize,
300cdf0e10cSrcweir     /* fnRectSet      */
301cdf0e10cSrcweir     &SwRect::_Left,
302cdf0e10cSrcweir     &SwRect::_Right,
303cdf0e10cSrcweir     &SwRect::_Top,
304cdf0e10cSrcweir     &SwRect::_Bottom,
305cdf0e10cSrcweir     &SwRect::_Height,
306cdf0e10cSrcweir     &SwRect::_Width,
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     &SwRect::SubLeft,
309cdf0e10cSrcweir     &SwRect::AddRight,
310cdf0e10cSrcweir     &SwRect::SubTop,
311cdf0e10cSrcweir     &SwRect::AddBottom,
312cdf0e10cSrcweir     &SwRect::AddHeight,
313cdf0e10cSrcweir     &SwRect::AddWidth,
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     &SwRect::SetPosY,
316cdf0e10cSrcweir     &SwRect::SetPosX,
317cdf0e10cSrcweir 
318cdf0e10cSrcweir     &SwFrm::GetLeftMargin,
319cdf0e10cSrcweir     &SwFrm::GetRightMargin,
320cdf0e10cSrcweir     &SwFrm::GetTopMargin,
321cdf0e10cSrcweir     &SwFrm::GetBottomMargin,
322cdf0e10cSrcweir     &SwFrm::SetTopBottomMargins,
323cdf0e10cSrcweir     &SwFrm::SetLeftRightMargins,
324cdf0e10cSrcweir     &SwFrm::GetPrtLeft,
325cdf0e10cSrcweir     &SwFrm::GetPrtRight,
326cdf0e10cSrcweir     &SwFrm::GetPrtTop,
327cdf0e10cSrcweir     &SwFrm::GetPrtBottom,
328cdf0e10cSrcweir     &SwRect::GetLeftDistance,
329cdf0e10cSrcweir     &SwRect::GetRightDistance,
330cdf0e10cSrcweir     &SwRect::GetTopDistance,
331cdf0e10cSrcweir     &SwRect::GetBottomDistance,
332cdf0e10cSrcweir     &SwFrm::SetMaxRight,
333cdf0e10cSrcweir     &SwRect::OverStepRight,
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     &SwRect::SetUpperLeftCorner,
336cdf0e10cSrcweir     &SwFrm::MakeRightPos,
337cdf0e10cSrcweir     &FirstMinusSecond,
338cdf0e10cSrcweir     &FirstMinusSecond,
339cdf0e10cSrcweir     &SwIncrement,
340cdf0e10cSrcweir     &SwIncrement,
341cdf0e10cSrcweir     &SwRect::SetTopAndHeight,
342cdf0e10cSrcweir     &SwRect::SetLeftAndWidth
343cdf0e10cSrcweir };
344cdf0e10cSrcweir //End of SCMS
345cdf0e10cSrcweir SwRectFn fnRectHori = &aHorizontal;
346cdf0e10cSrcweir SwRectFn fnRectVert = &aVertical;
347cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
348cdf0e10cSrcweir SwRectFn fnRectVertL2R = &aVerticalLeftToRight;
349cdf0e10cSrcweir //End of SCMS
350cdf0e10cSrcweir SwRectFn fnRectB2T = &aBottomToTop;
351cdf0e10cSrcweir SwRectFn fnRectVL2R = &aVerticalRightToLeft;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir // --> OD 2006-05-10 #i65250#
354cdf0e10cSrcweir sal_uInt32 SwFrm::mnLastFrmId=0;
355cdf0e10cSrcweir // <--
356cdf0e10cSrcweir 
357cdf0e10cSrcweir TYPEINIT1(SwFrm,SwClient);		//rtti fuer SwFrm
358cdf0e10cSrcweir TYPEINIT1(SwCntntFrm,SwFrm);	//rtti fuer SwCntntFrm
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 
_FrmInit()361cdf0e10cSrcweir void _FrmInit()
362cdf0e10cSrcweir {
363cdf0e10cSrcweir 	SwRootFrm::pVout = new SwLayVout();
364cdf0e10cSrcweir 	SwCache *pNew = new SwCache( 100, 100
365cdf0e10cSrcweir #ifdef DBG_UTIL
366cdf0e10cSrcweir 	, "static SwBorderAttrs::pCache"
367cdf0e10cSrcweir #endif
368cdf0e10cSrcweir 	);
369cdf0e10cSrcweir 	SwFrm::SetCache( pNew );
370cdf0e10cSrcweir }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 
_FrmFinit()374cdf0e10cSrcweir void _FrmFinit()
375cdf0e10cSrcweir {
376cdf0e10cSrcweir #ifdef DBG_UTIL
377cdf0e10cSrcweir 	// im Chache duerfen nur noch 0-Pointer stehen
378cdf0e10cSrcweir 	for( sal_uInt16 n = SwFrm::GetCachePtr()->Count(); n; )
379cdf0e10cSrcweir 		if( (*SwFrm::GetCachePtr())[ --n ] )
380cdf0e10cSrcweir 		{
381cdf0e10cSrcweir 			SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ];
382cdf0e10cSrcweir 			ASSERT( !pObj, "Wer hat sich nicht ausgetragen?")
383cdf0e10cSrcweir 		}
384cdf0e10cSrcweir #endif
385cdf0e10cSrcweir 	delete SwRootFrm::pVout;
386cdf0e10cSrcweir 	delete SwFrm::GetCachePtr();
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir /*************************************************************************
390cdf0e10cSrcweir |*
391cdf0e10cSrcweir |*	RootFrm::Alles was so zur CurrShell gehoert
392cdf0e10cSrcweir |*
393cdf0e10cSrcweir |*	Ersterstellung		MA 09. Sep. 98
394cdf0e10cSrcweir |*	Letzte Aenderung	MA 18. Feb. 99
395cdf0e10cSrcweir |*
396cdf0e10cSrcweir |*************************************************************************/
397cdf0e10cSrcweir 
398cdf0e10cSrcweir typedef CurrShell* CurrShellPtr;
399cdf0e10cSrcweir SV_DECL_PTRARR_SORT(SwCurrShells,CurrShellPtr,4,4)
SV_IMPL_PTRARR_SORT(SwCurrShells,CurrShellPtr)400cdf0e10cSrcweir SV_IMPL_PTRARR_SORT(SwCurrShells,CurrShellPtr)
401cdf0e10cSrcweir 
402cdf0e10cSrcweir CurrShell::CurrShell( ViewShell *pNew )
403cdf0e10cSrcweir {
404cdf0e10cSrcweir 	ASSERT( pNew, "0-Shell einsetzen?" );
405cdf0e10cSrcweir 	pRoot = pNew->GetLayout();
406cdf0e10cSrcweir 	if ( pRoot )
407cdf0e10cSrcweir 	{
408cdf0e10cSrcweir 		pPrev = pRoot->pCurrShell;
409cdf0e10cSrcweir 		pRoot->pCurrShell = pNew;
410cdf0e10cSrcweir 		pRoot->pCurrShells->Insert( this );
411cdf0e10cSrcweir 	}
412cdf0e10cSrcweir 	else
413cdf0e10cSrcweir 		pPrev = 0;
414cdf0e10cSrcweir }
415cdf0e10cSrcweir 
~CurrShell()416cdf0e10cSrcweir CurrShell::~CurrShell()
417cdf0e10cSrcweir {
418cdf0e10cSrcweir 	if ( pRoot )
419cdf0e10cSrcweir 	{
420cdf0e10cSrcweir 		pRoot->pCurrShells->Remove( this );
421cdf0e10cSrcweir 		if ( pPrev )
422cdf0e10cSrcweir 			pRoot->pCurrShell = pPrev;
423cdf0e10cSrcweir 		if ( !pRoot->pCurrShells->Count() && pRoot->pWaitingCurrShell )
424cdf0e10cSrcweir 		{
425cdf0e10cSrcweir 			pRoot->pCurrShell = pRoot->pWaitingCurrShell;
426cdf0e10cSrcweir 			pRoot->pWaitingCurrShell = 0;
427cdf0e10cSrcweir 		}
428cdf0e10cSrcweir 	}
429cdf0e10cSrcweir }
430cdf0e10cSrcweir 
SetShell(ViewShell * pSh)431cdf0e10cSrcweir void SetShell( ViewShell *pSh )
432cdf0e10cSrcweir {
433cdf0e10cSrcweir 	SwRootFrm *pRoot = pSh->GetLayout();
434cdf0e10cSrcweir 	if ( !pRoot->pCurrShells->Count() )
435cdf0e10cSrcweir 		pRoot->pCurrShell = pSh;
436cdf0e10cSrcweir 	else
437cdf0e10cSrcweir 		pRoot->pWaitingCurrShell = pSh;
438cdf0e10cSrcweir }
439cdf0e10cSrcweir 
DeRegisterShell(ViewShell * pSh)440cdf0e10cSrcweir void SwRootFrm::DeRegisterShell( ViewShell *pSh )
441cdf0e10cSrcweir {
442cdf0e10cSrcweir 	//Wenn moeglich irgendeine Shell aktivieren
443cdf0e10cSrcweir 	if ( pCurrShell == pSh )
444cdf0e10cSrcweir 		pCurrShell = pSh->GetNext() != pSh ? (ViewShell*)pSh->GetNext() : 0;
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 	//Das hat sich eruebrigt
447cdf0e10cSrcweir 	if ( pWaitingCurrShell == pSh )
448cdf0e10cSrcweir 		pWaitingCurrShell = 0;
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 	//Referenzen entfernen.
451cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < pCurrShells->Count(); ++i )
452cdf0e10cSrcweir 	{
453cdf0e10cSrcweir 		CurrShell *pC = (*pCurrShells)[i];
454cdf0e10cSrcweir 		if (pC->pPrev == pSh)
455cdf0e10cSrcweir 			pC->pPrev = 0;
456cdf0e10cSrcweir 	}
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
InitCurrShells(SwRootFrm * pRoot)459cdf0e10cSrcweir void InitCurrShells( SwRootFrm *pRoot )
460cdf0e10cSrcweir {
461cdf0e10cSrcweir 	pRoot->pCurrShells = new SwCurrShells;
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir 
465cdf0e10cSrcweir /*************************************************************************
466cdf0e10cSrcweir |*
467cdf0e10cSrcweir |*	SwRootFrm::SwRootFrm()
468cdf0e10cSrcweir |*
469cdf0e10cSrcweir |*	Beschreibung:
470cdf0e10cSrcweir |* 		Der RootFrm laesst sich grundsaetzlich vom Dokument ein eigenes
471cdf0e10cSrcweir |* 		FrmFmt geben. Dieses loescht er dann selbst im DTor.
472cdf0e10cSrcweir |* 		Das eigene FrmFmt wird vom uebergebenen Format abgeleitet.
473cdf0e10cSrcweir |*	Ersterstellung		SS 05-Apr-1991
474cdf0e10cSrcweir |*	Letzte Aenderung	MA 12. Dec. 94
475cdf0e10cSrcweir |*
476cdf0e10cSrcweir |*************************************************************************/
477cdf0e10cSrcweir 
478cdf0e10cSrcweir 
SwRootFrm(SwFrmFmt * pFmt,ViewShell * pSh)479cdf0e10cSrcweir SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) :
480cdf0e10cSrcweir 	SwLayoutFrm( pFmt->GetDoc()->MakeFrmFmt(
481cdf0e10cSrcweir 		XubString( "Root", RTL_TEXTENCODING_MS_1252 ), pFmt ), 0 ),
482cdf0e10cSrcweir     // --> PAGES01
483cdf0e10cSrcweir     maPagesArea(),
484cdf0e10cSrcweir     mnViewWidth( -1 ),
485cdf0e10cSrcweir     mnColumns( 0 ),
486cdf0e10cSrcweir     mbBookMode( false ),
487cdf0e10cSrcweir     mbSidebarChanged( false ),
488cdf0e10cSrcweir     mbNeedGrammarCheck( false ),
489cdf0e10cSrcweir     // <--
490cdf0e10cSrcweir     nBrowseWidth( MM50*4 ), //2cm Minimum
491cdf0e10cSrcweir     pTurbo( 0 ),
492cdf0e10cSrcweir 	pLastPage( 0 ),
493cdf0e10cSrcweir 	pCurrShell( pSh ),
494cdf0e10cSrcweir 	pWaitingCurrShell( 0 ),
495cdf0e10cSrcweir     pDrawPage( 0 ),
496cdf0e10cSrcweir     pDestroy( 0 ),
497cdf0e10cSrcweir 	nPhyPageNums( 0 ),
498cdf0e10cSrcweir     nAccessibleShells( 0 )
499cdf0e10cSrcweir {
500cdf0e10cSrcweir     nType = FRMC_ROOT;
501cdf0e10cSrcweir 	bIdleFormat = bTurboAllowed = bAssertFlyPages = bIsNewLayout = sal_True;
502cdf0e10cSrcweir 	bCheckSuperfluous = bBrowseWidthValid = sal_False;
503cdf0e10cSrcweir     setRootFrm( this );
504cdf0e10cSrcweir }
505cdf0e10cSrcweir 
Init(SwFrmFmt * pFmt)506cdf0e10cSrcweir void SwRootFrm::Init( SwFrmFmt* pFmt )
507cdf0e10cSrcweir {
508cdf0e10cSrcweir 	InitCurrShells( this );
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 	IDocumentTimerAccess *pTimerAccess = pFmt->getIDocumentTimerAccess();
511cdf0e10cSrcweir 	IDocumentLayoutAccess *pLayoutAccess = pFmt->getIDocumentLayoutAccess();
512cdf0e10cSrcweir 	IDocumentFieldsAccess *pFieldsAccess = pFmt->getIDocumentFieldsAccess();
513cdf0e10cSrcweir 	const IDocumentSettingAccess *pSettingAccess = pFmt->getIDocumentSettingAccess();
514cdf0e10cSrcweir 	pTimerAccess->StopIdling();
515cdf0e10cSrcweir 	pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() );		//Fuer das Erzeugen der Flys durch MakeFrms()	//swmod 071108//swmod 071225
516cdf0e10cSrcweir 	bCallbackActionEnabled = sal_False;	//vor Verlassen auf sal_True setzen!
517cdf0e10cSrcweir 
518*26ea3662SArmin Le Grand     SwDrawModel* pMd = pFmt->getIDocumentDrawModelAccess()->GetDrawModel();
519cdf0e10cSrcweir 	if ( pMd )
520cdf0e10cSrcweir 	{
521cdf0e10cSrcweir         // Disable "multiple layout"
522cdf0e10cSrcweir 		pDrawPage = pMd->GetPage(0); //pMd->AllocPage( FALSE );
523cdf0e10cSrcweir         //pMd->InsertPage( pDrawPage );
524cdf0e10cSrcweir         // end of disabling
525cdf0e10cSrcweir 
526cdf0e10cSrcweir 		pDrawPage->SetSize( Frm().SSize() );
527cdf0e10cSrcweir 	}
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 	//Initialisierung des Layouts: Seiten erzeugen. Inhalt mit cntnt verbinden
530cdf0e10cSrcweir 	//usw.
531cdf0e10cSrcweir 	//Zuerst einiges initialiseren und den ersten Node besorgen (der wird
532cdf0e10cSrcweir 	//fuer den PageDesc benoetigt).
533cdf0e10cSrcweir 
534cdf0e10cSrcweir     SwDoc* pDoc = pFmt->GetDoc();
535cdf0e10cSrcweir 	SwNodeIndex aIndex( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
536cdf0e10cSrcweir 	SwCntntNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, sal_True, sal_False );
537cdf0e10cSrcweir     // --> FME 2005-05-25 #123067# pNode = 0 can really happen:
538cdf0e10cSrcweir     SwTableNode *pTblNd= pNode ? pNode->FindTableNode() : 0;
539cdf0e10cSrcweir     // <--
540cdf0e10cSrcweir 
541cdf0e10cSrcweir 	//PageDesc besorgen (entweder vom FrmFmt des ersten Node oder den
542cdf0e10cSrcweir 	//initialen.)
543cdf0e10cSrcweir 	SwPageDesc *pDesc = 0;
544cdf0e10cSrcweir 	sal_uInt16 nPgNum = 1;
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 	if ( pTblNd )
547cdf0e10cSrcweir 	{
548cdf0e10cSrcweir 		const SwFmtPageDesc &rDesc = pTblNd->GetTable().GetFrmFmt()->GetPageDesc();
549cdf0e10cSrcweir 		pDesc = (SwPageDesc*)rDesc.GetPageDesc();
550cdf0e10cSrcweir 		//#19104# Seitennummeroffset beruecksictigen!!
551cdf0e10cSrcweir 		bIsVirtPageNum = 0 != ( nPgNum = rDesc.GetNumOffset() );
552cdf0e10cSrcweir 	}
553cdf0e10cSrcweir 	else if ( pNode )
554cdf0e10cSrcweir 	{
555cdf0e10cSrcweir 		const SwFmtPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
556cdf0e10cSrcweir 		pDesc = (SwPageDesc*)rDesc.GetPageDesc();
557cdf0e10cSrcweir 		//#19104# Seitennummeroffset beruecksictigen!!
558cdf0e10cSrcweir 		bIsVirtPageNum = 0 != ( nPgNum = rDesc.GetNumOffset() );
559cdf0e10cSrcweir 	}
560cdf0e10cSrcweir 	else
561cdf0e10cSrcweir 		bIsVirtPageNum = sal_False;
562cdf0e10cSrcweir 	if ( !pDesc )
563cdf0e10cSrcweir 		pDesc = (SwPageDesc*)
564cdf0e10cSrcweir             &const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 );
565cdf0e10cSrcweir 	const sal_Bool bOdd = !nPgNum || 0 != ( nPgNum % 2 );
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 	//Eine Seite erzeugen und in das Layout stellen
568cdf0e10cSrcweir 	SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, sal_False, sal_False, 0 );
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 	//Erstes Blatt im Bodytext-Bereich suchen.
571cdf0e10cSrcweir 	SwLayoutFrm *pLay = pPage->FindBodyCont();
572cdf0e10cSrcweir 	while( pLay->Lower() )
573cdf0e10cSrcweir 		pLay = (SwLayoutFrm*)pLay->Lower();
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 	SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
576cdf0e10cSrcweir 	::_InsertCnt( pLay, pDoc, aTmp.GetIndex(), sal_True );
577cdf0e10cSrcweir 	//Noch nicht ersetzte Master aus der Liste entfernen.
578cdf0e10cSrcweir 	RemoveMasterObjs( pDrawPage );
579cdf0e10cSrcweir 	if( pSettingAccess->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
580cdf0e10cSrcweir 		pFieldsAccess->UpdateRefFlds( NULL );
581cdf0e10cSrcweir     //b6433357: Update page fields after loading
582cdf0e10cSrcweir     // --->
583cdf0e10cSrcweir     if ( !pCurrShell || !pCurrShell->Imp()->IsUpdateExpFlds() )
584cdf0e10cSrcweir     {
585cdf0e10cSrcweir         SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
586cdf0e10cSrcweir         pFieldsAccess->UpdatePageFlds( &aMsgHnt );
587cdf0e10cSrcweir     }
588cdf0e10cSrcweir     // <---
589cdf0e10cSrcweir 
590cdf0e10cSrcweir     pTimerAccess->StartIdling();
591cdf0e10cSrcweir 	bCallbackActionEnabled = sal_True;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir     ViewShell *pViewSh  = GetCurrShell();
594cdf0e10cSrcweir     if (pViewSh)
595cdf0e10cSrcweir         mbNeedGrammarCheck = pViewSh->GetViewOptions()->IsOnlineSpell();
596cdf0e10cSrcweir }
597cdf0e10cSrcweir 
598cdf0e10cSrcweir /*************************************************************************
599cdf0e10cSrcweir |*
600cdf0e10cSrcweir |*	SwRootFrm::~SwRootFrm()
601cdf0e10cSrcweir |*
602cdf0e10cSrcweir |*	Ersterstellung		SS 05-Apr-1991
603cdf0e10cSrcweir |*	Letzte Aenderung	MA 12. Dec. 94
604cdf0e10cSrcweir |*
605cdf0e10cSrcweir |*************************************************************************/
606cdf0e10cSrcweir 
607cdf0e10cSrcweir 
608cdf0e10cSrcweir 
~SwRootFrm()609cdf0e10cSrcweir SwRootFrm::~SwRootFrm()
610cdf0e10cSrcweir {
611cdf0e10cSrcweir 	bTurboAllowed = sal_False;
612cdf0e10cSrcweir 	pTurbo = 0;
613cdf0e10cSrcweir 	if(pBlink)
614cdf0e10cSrcweir 		pBlink->FrmDelete( this );
615cdf0e10cSrcweir 	static_cast<SwFrmFmt*>(GetRegisteredInNonConst())->GetDoc()->DelFrmFmt( static_cast<SwFrmFmt*>(GetRegisteredInNonConst()) );
616cdf0e10cSrcweir 	delete pDestroy;
617cdf0e10cSrcweir     pDestroy = 0;
618cdf0e10cSrcweir 
619cdf0e10cSrcweir 	//Referenzen entfernen.
620cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < pCurrShells->Count(); ++i )
621cdf0e10cSrcweir 		(*pCurrShells)[i]->pRoot = 0;
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 	delete pCurrShells;
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 	ASSERT( 0==nAccessibleShells, "Some accessible shells are left" );
626cdf0e10cSrcweir }
627cdf0e10cSrcweir 
628cdf0e10cSrcweir /*************************************************************************
629cdf0e10cSrcweir |*
630cdf0e10cSrcweir |*	SwRootFrm::RemoveMasterObjs()
631cdf0e10cSrcweir |*
632cdf0e10cSrcweir |*	Ersterstellung		MA 19.10.95
633cdf0e10cSrcweir |*	Letzte Aenderung	MA 19.10.95
634cdf0e10cSrcweir |*
635cdf0e10cSrcweir |*************************************************************************/
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 
RemoveMasterObjs(SdrPage * pPg)638cdf0e10cSrcweir void SwRootFrm::RemoveMasterObjs( SdrPage *pPg )
639cdf0e10cSrcweir {
640cdf0e10cSrcweir 	//Alle Masterobjekte aus der Page entfernen. Nicht loeschen!!
641cdf0e10cSrcweir 	for( sal_uLong i = pPg ? pPg->GetObjCount() : 0; i; )
642cdf0e10cSrcweir 	{
643cdf0e10cSrcweir 		SdrObject* pObj = pPg->GetObj( --i );
644cdf0e10cSrcweir 		if( pObj->ISA(SwFlyDrawObj ) )
645cdf0e10cSrcweir 			pPg->RemoveObject( i );
646cdf0e10cSrcweir 	}
647cdf0e10cSrcweir }
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 
AllCheckPageDescs() const650cdf0e10cSrcweir void SwRootFrm::AllCheckPageDescs() const
651cdf0e10cSrcweir {
652cdf0e10cSrcweir 	CheckPageDescs( (SwPageFrm*)this->Lower() );
653cdf0e10cSrcweir }
654cdf0e10cSrcweir //swmod 080226
AllInvalidateAutoCompleteWords() const655cdf0e10cSrcweir void SwRootFrm::AllInvalidateAutoCompleteWords() const
656cdf0e10cSrcweir {
657cdf0e10cSrcweir 	SwPageFrm *pPage = (SwPageFrm*)this->Lower();
658cdf0e10cSrcweir 	while ( pPage )
659cdf0e10cSrcweir 	{
660cdf0e10cSrcweir 		pPage->InvalidateAutoCompleteWords();
661cdf0e10cSrcweir 		pPage = (SwPageFrm*)pPage->GetNext();
662cdf0e10cSrcweir 	}
663cdf0e10cSrcweir }//swmod 080305
AllAddPaintRect() const664cdf0e10cSrcweir void SwRootFrm::AllAddPaintRect() const
665cdf0e10cSrcweir {
666cdf0e10cSrcweir 	GetCurrShell()->AddPaintRect( this->Frm() );
667cdf0e10cSrcweir }//swmod 080305
AllRemoveFtns()668cdf0e10cSrcweir void SwRootFrm::AllRemoveFtns()
669cdf0e10cSrcweir {
670cdf0e10cSrcweir 	RemoveFtns();
671cdf0e10cSrcweir }
AllInvalidateSmartTagsOrSpelling(sal_Bool bSmartTags) const672cdf0e10cSrcweir void SwRootFrm::AllInvalidateSmartTagsOrSpelling(sal_Bool bSmartTags) const
673cdf0e10cSrcweir {
674cdf0e10cSrcweir 	SwPageFrm *pPage = (SwPageFrm*)this->Lower();
675cdf0e10cSrcweir 	while ( pPage )
676cdf0e10cSrcweir 	{
677cdf0e10cSrcweir 		if ( bSmartTags )
678cdf0e10cSrcweir 			pPage->InvalidateSmartTags();
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 		pPage->InvalidateSpelling();
681cdf0e10cSrcweir 		pPage = (SwPageFrm*)pPage->GetNext();
682cdf0e10cSrcweir 	}	//swmod 080218
683cdf0e10cSrcweir }
684cdf0e10cSrcweir 
685