xref: /aoo41x/main/sw/source/core/view/viewimp.cxx (revision 4d7c9de0)
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 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "crsrsh.hxx"
29cdf0e10cSrcweir #include "rootfrm.hxx"
30cdf0e10cSrcweir #include "pagefrm.hxx"
31cdf0e10cSrcweir #include "viewimp.hxx"
32cdf0e10cSrcweir #include "errhdl.hxx"
33cdf0e10cSrcweir #include "viewopt.hxx"
34cdf0e10cSrcweir #include "flyfrm.hxx"
35cdf0e10cSrcweir #include "frmfmt.hxx"
36cdf0e10cSrcweir #include "layact.hxx"
37cdf0e10cSrcweir #include "swregion.hxx"
38cdf0e10cSrcweir #include "dflyobj.hxx"
39cdf0e10cSrcweir #include "dview.hxx"
40cdf0e10cSrcweir #include <tools/shl.hxx>
41cdf0e10cSrcweir #include <swmodule.hxx>
42cdf0e10cSrcweir #include <svx/svdpage.hxx>
43cdf0e10cSrcweir #include <accmap.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir // OD 12.12.2002 #103492#
46cdf0e10cSrcweir #include <pagepreviewlayout.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include <comcore.hrc>
49cdf0e10cSrcweir #include <svx/svdundo.hxx>
50cdf0e10cSrcweir #include <IDocumentLayoutAccess.hxx>
51cdf0e10cSrcweir #include <IDocumentDrawModelAccess.hxx>
52cdf0e10cSrcweir #include <IDocumentDeviceAccess.hxx>
53cdf0e10cSrcweir #include <IDocumentSettingAccess.hxx>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir /*************************************************************************
56cdf0e10cSrcweir |*
57cdf0e10cSrcweir |*	SwViewImp::Init()
58cdf0e10cSrcweir |*
59cdf0e10cSrcweir |*	Ersterstellung		MA 25. Jul. 94
60cdf0e10cSrcweir |*	Letzte Aenderung	MA 03. Nov. 95
61cdf0e10cSrcweir |*
62cdf0e10cSrcweir |*************************************************************************/
63cdf0e10cSrcweir 
Init(const SwViewOption * pNewOpt)64cdf0e10cSrcweir void SwViewImp::Init( const SwViewOption *pNewOpt )
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	ASSERT( pDrawView, "SwViewImp::Init without DrawView" );
67cdf0e10cSrcweir 	//Jetzt die PageView erzeugen wenn sie noch nicht existiert.
68cdf0e10cSrcweir     SwRootFrm *pRoot = pSh->GetLayout();	//swmod 071108//swmod 071225
69cdf0e10cSrcweir 	if ( !pSdrPageView )
70cdf0e10cSrcweir 	{
71cdf0e10cSrcweir         IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
72cdf0e10cSrcweir 		if ( !pRoot->GetDrawPage() )
73cdf0e10cSrcweir             pRoot->SetDrawPage( pIDDMA->GetDrawModel()->GetPage( 0 ) );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 		if ( pRoot->GetDrawPage()->GetSize() != pRoot->Frm().SSize() )
76cdf0e10cSrcweir             pRoot->GetDrawPage()->SetSize( pRoot->Frm().SSize() );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         pSdrPageView = pDrawView->ShowSdrPage( pRoot->GetDrawPage());
79cdf0e10cSrcweir         // OD 26.06.2003 #108784# - notify drawing page view about invisible
80cdf0e10cSrcweir         // layers.
81cdf0e10cSrcweir         pIDDMA->NotifyInvisibleLayers( *pSdrPageView );
82cdf0e10cSrcweir 	}
83cdf0e10cSrcweir 	pDrawView->SetDragStripes( pNewOpt->IsCrossHair() );
84cdf0e10cSrcweir 	pDrawView->SetGridSnap( pNewOpt->IsSnap() );
85cdf0e10cSrcweir 	pDrawView->SetGridVisible( pNewOpt->IsGridVisible() );
86cdf0e10cSrcweir 	const Size &rSz = pNewOpt->GetSnapSize();
87cdf0e10cSrcweir 	pDrawView->SetGridCoarse( rSz );
88cdf0e10cSrcweir 	const Size aFSize
89cdf0e10cSrcweir 			( rSz.Width() ? rSz.Width() /Max(short(1),pNewOpt->GetDivisionX()):0,
90cdf0e10cSrcweir 			  rSz.Height()? rSz.Height()/Max(short(1),pNewOpt->GetDivisionY()):0);
91cdf0e10cSrcweir  	pDrawView->SetGridFine( aFSize );
92cdf0e10cSrcweir 	Fraction aSnGrWdtX(rSz.Width(), pNewOpt->GetDivisionX() + 1);
93cdf0e10cSrcweir 	Fraction aSnGrWdtY(rSz.Height(), pNewOpt->GetDivisionY() + 1);
94cdf0e10cSrcweir 	pDrawView->SetSnapGridWidth( aSnGrWdtX, aSnGrWdtY );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	if ( pRoot->Frm().HasArea() )
97cdf0e10cSrcweir 		pDrawView->SetWorkArea( pRoot->Frm().SVRect() );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	if ( GetShell()->IsPreView() )
100cdf0e10cSrcweir 		pDrawView->SetAnimationEnabled( sal_False );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	pDrawView->SetUseIncompatiblePathCreateInterface( sal_False );
103cdf0e10cSrcweir 	pDrawView->SetSolidMarkHdl(pNewOpt->IsSolidMarkHdl());
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	// it's a JOE interface !
106cdf0e10cSrcweir 	pDrawView->SetMarkHdlSizePixel(pNewOpt->IsBigMarkHdl() ? 9 : 7);
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir /*************************************************************************
110cdf0e10cSrcweir |*
111cdf0e10cSrcweir |*	SwViewImp::SwViewImp()	CTor fuer die Core-Internas
112cdf0e10cSrcweir |*
113cdf0e10cSrcweir |*	Ersterstellung		MA 25. Jul. 94
114cdf0e10cSrcweir |*	Letzte Aenderung	MA 06. Sep. 96
115cdf0e10cSrcweir |*
116cdf0e10cSrcweir |*************************************************************************/
117cdf0e10cSrcweir 
SwViewImp(ViewShell * pParent)118cdf0e10cSrcweir SwViewImp::SwViewImp( ViewShell *pParent ) :
119cdf0e10cSrcweir 	pSh( pParent ),
120cdf0e10cSrcweir     pDrawView( 0 ),
121cdf0e10cSrcweir     pSdrPageView( 0 ),
122cdf0e10cSrcweir     pFirstVisPage( 0 ),
123cdf0e10cSrcweir 	pRegion( 0 ),
124cdf0e10cSrcweir 	pLayAct( 0 ),
125cdf0e10cSrcweir 	pIdleAct( 0 ),
126cdf0e10cSrcweir     pAccMap( 0 ),
127cdf0e10cSrcweir     pSdrObjCached(NULL),
128cdf0e10cSrcweir     nRestoreActions( 0 ),
129cdf0e10cSrcweir     // OD 12.12.2002 #103492#
130cdf0e10cSrcweir     mpPgPrevwLayout( 0 )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	//bResetXorVisibility =
133cdf0e10cSrcweir 	//HMHbShowHdlPaint =
134cdf0e10cSrcweir     bResetHdlHiddenPaint =
135cdf0e10cSrcweir     bSmoothUpdate = bStopSmooth = bStopPrt = sal_False;
136cdf0e10cSrcweir     bFirstPageInvalid = sal_True;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir /******************************************************************************
140cdf0e10cSrcweir |*
141cdf0e10cSrcweir |*	SwViewImp::~SwViewImp()
142cdf0e10cSrcweir |*
143cdf0e10cSrcweir |*	Ersterstellung		MA 25. Jul. 94
144cdf0e10cSrcweir |*	Letzte Aenderung	MA 16. Dec. 94
145cdf0e10cSrcweir |*
146cdf0e10cSrcweir ******************************************************************************/
147cdf0e10cSrcweir 
~SwViewImp()148cdf0e10cSrcweir SwViewImp::~SwViewImp()
149cdf0e10cSrcweir {
150cdf0e10cSrcweir 	delete pAccMap;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     // OD 12.12.2002 #103492#
153cdf0e10cSrcweir     delete mpPgPrevwLayout;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     //JP 29.03.96: nach ShowSdrPage muss auch HideSdrPage gemacht werden!!!
156cdf0e10cSrcweir 	if( pDrawView )
157cdf0e10cSrcweir  		pDrawView->HideSdrPage();
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	delete pDrawView;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     DelRegion();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	ASSERT( !pLayAct, "Have action for the rest of your life." );
164cdf0e10cSrcweir 	ASSERT( !pIdleAct,"Be idle for the rest of your life." );
165cdf0e10cSrcweir }
166cdf0e10cSrcweir 
167cdf0e10cSrcweir /******************************************************************************
168cdf0e10cSrcweir |*
169cdf0e10cSrcweir |*	SwViewImp::DelRegions()
170cdf0e10cSrcweir |*
171cdf0e10cSrcweir |*	Ersterstellung		MA 14. Apr. 94
172cdf0e10cSrcweir |*	Letzte Aenderung	MA 14. Apr. 94
173cdf0e10cSrcweir |*
174cdf0e10cSrcweir ******************************************************************************/
175cdf0e10cSrcweir 
DelRegion()176cdf0e10cSrcweir void SwViewImp::DelRegion()
177cdf0e10cSrcweir {
178cdf0e10cSrcweir 	DELETEZ(pRegion);
179cdf0e10cSrcweir }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir /******************************************************************************
182cdf0e10cSrcweir |*
183cdf0e10cSrcweir |*	SwViewImp::AddPaintRect()
184cdf0e10cSrcweir |*
185cdf0e10cSrcweir |*	Ersterstellung		MA ??
186cdf0e10cSrcweir |*	Letzte Aenderung	MA 27. Jul. 94
187cdf0e10cSrcweir |*
188cdf0e10cSrcweir ******************************************************************************/
189cdf0e10cSrcweir 
AddPaintRect(const SwRect & rRect)190cdf0e10cSrcweir sal_Bool SwViewImp::AddPaintRect( const SwRect &rRect )
191cdf0e10cSrcweir {
192cdf0e10cSrcweir 	if ( rRect.IsOver( pSh->VisArea() ) )
193cdf0e10cSrcweir 	{
194cdf0e10cSrcweir 		if ( !pRegion )
195cdf0e10cSrcweir 			pRegion = new SwRegionRects( pSh->VisArea() );
196cdf0e10cSrcweir 		(*pRegion) -= rRect;
197cdf0e10cSrcweir 		return sal_True;
198cdf0e10cSrcweir 	}
199cdf0e10cSrcweir 	return sal_False;
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 
203cdf0e10cSrcweir /******************************************************************************
204cdf0e10cSrcweir |*
205cdf0e10cSrcweir |*	ViewImp::CheckWaitCrsr()
206cdf0e10cSrcweir |*
207cdf0e10cSrcweir |*	Ersterstellung		MA 10. Aug. 94
208cdf0e10cSrcweir |*	Letzte Aenderung	MA 10. Aug. 94
209cdf0e10cSrcweir |*
210cdf0e10cSrcweir ******************************************************************************/
211cdf0e10cSrcweir 
CheckWaitCrsr()212cdf0e10cSrcweir void SwViewImp::CheckWaitCrsr()
213cdf0e10cSrcweir {
214cdf0e10cSrcweir 	if ( pLayAct )
215cdf0e10cSrcweir 		pLayAct->CheckWaitCrsr();
216cdf0e10cSrcweir }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir /******************************************************************************
219cdf0e10cSrcweir |*
220cdf0e10cSrcweir |*	ViewImp::IsCalcLayoutProgress()
221cdf0e10cSrcweir |*
222cdf0e10cSrcweir |*	Ersterstellung		MA 12. Aug. 94
223cdf0e10cSrcweir |*	Letzte Aenderung	MA 12. Aug. 94
224cdf0e10cSrcweir |*
225cdf0e10cSrcweir ******************************************************************************/
226cdf0e10cSrcweir 
IsCalcLayoutProgress() const227cdf0e10cSrcweir sal_Bool SwViewImp::IsCalcLayoutProgress() const
228cdf0e10cSrcweir {
229cdf0e10cSrcweir 	if ( pLayAct )
230cdf0e10cSrcweir 		return pLayAct->IsCalcLayout();
231cdf0e10cSrcweir 	return sal_False;
232cdf0e10cSrcweir }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir /******************************************************************************
235cdf0e10cSrcweir |*
236cdf0e10cSrcweir |*	ViewImp::IsUpdateExpFlds()
237cdf0e10cSrcweir |*
238cdf0e10cSrcweir |*	Ersterstellung		MA 28. Mar. 96
239cdf0e10cSrcweir |*	Letzte Aenderung	MA 28. Mar. 96
240cdf0e10cSrcweir |*
241cdf0e10cSrcweir ******************************************************************************/
242cdf0e10cSrcweir 
IsUpdateExpFlds()243cdf0e10cSrcweir sal_Bool SwViewImp::IsUpdateExpFlds()
244cdf0e10cSrcweir {
245cdf0e10cSrcweir 	if ( pLayAct && pLayAct->IsCalcLayout() )
246cdf0e10cSrcweir 	{
247cdf0e10cSrcweir 		pLayAct->SetUpdateExpFlds();
248cdf0e10cSrcweir 		return sal_True;
249cdf0e10cSrcweir 	}
250cdf0e10cSrcweir  	return sal_False;
251cdf0e10cSrcweir }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 
254cdf0e10cSrcweir /******************************************************************************
255cdf0e10cSrcweir |*
256cdf0e10cSrcweir |*	SwViewImp::SetFirstVisPage(), ImplGetFirstVisPage();
257cdf0e10cSrcweir |*
258cdf0e10cSrcweir |*	Ersterstellung		MA 21. Sep. 93
259cdf0e10cSrcweir |*	Letzte Aenderung	MA 08. Mar. 94
260cdf0e10cSrcweir |*
261cdf0e10cSrcweir ******************************************************************************/
262cdf0e10cSrcweir 
SetFirstVisPage()263cdf0e10cSrcweir void SwViewImp::SetFirstVisPage()
264cdf0e10cSrcweir {
265cdf0e10cSrcweir 	if ( pSh->bDocSizeChgd && pSh->VisArea().Top() > pSh->GetLayout()->Frm().Height() )
266cdf0e10cSrcweir 	{
267cdf0e10cSrcweir 		//Wir stecken in einer Action und die VisArea sitzt wegen
268cdf0e10cSrcweir 		//Loeschoperationen hinter der erste sichtbaren Seite.
269cdf0e10cSrcweir 		//Damit nicht zu heftig Formatiert wird, liefern wir die letzte Seite
270cdf0e10cSrcweir 		//zurueck.
271cdf0e10cSrcweir 		pFirstVisPage = (SwPageFrm*)pSh->GetLayout()->Lower();
272cdf0e10cSrcweir 		while ( pFirstVisPage && pFirstVisPage->GetNext() )
273cdf0e10cSrcweir 			pFirstVisPage = (SwPageFrm*)pFirstVisPage->GetNext();
274cdf0e10cSrcweir 	}
275cdf0e10cSrcweir 	else
276cdf0e10cSrcweir 	{
277cdf0e10cSrcweir         const SwViewOption* pSwViewOption = GetShell()->GetViewOptions();
278cdf0e10cSrcweir         const bool bBookMode = pSwViewOption->IsViewLayoutBookMode();
279cdf0e10cSrcweir 
280cdf0e10cSrcweir         SwPageFrm *pPage = (SwPageFrm*)pSh->GetLayout()->Lower();
281cdf0e10cSrcweir         SwRect aPageRect = pPage->Frm();
282cdf0e10cSrcweir 		while ( pPage && !aPageRect.IsOver( pSh->VisArea() ) )
283cdf0e10cSrcweir         {
284cdf0e10cSrcweir 			pPage = (SwPageFrm*)pPage->GetNext();
285cdf0e10cSrcweir             if ( pPage )
286cdf0e10cSrcweir             {
287cdf0e10cSrcweir                 aPageRect = pPage->Frm();
288cdf0e10cSrcweir                 if ( bBookMode && pPage->IsEmptyPage() )
289cdf0e10cSrcweir                 {
290cdf0e10cSrcweir                     const SwPageFrm& rFormatPage = pPage->GetFormatPage();
291cdf0e10cSrcweir                     aPageRect.SSize() = rFormatPage.Frm().SSize();
292cdf0e10cSrcweir                 }
293cdf0e10cSrcweir             }
294cdf0e10cSrcweir         }
295cdf0e10cSrcweir 		pFirstVisPage = pPage ? pPage : (SwPageFrm*)pSh->GetLayout()->Lower();
296cdf0e10cSrcweir 	}
297cdf0e10cSrcweir 	bFirstPageInvalid = sal_False;
298cdf0e10cSrcweir }
299cdf0e10cSrcweir 
300cdf0e10cSrcweir /******************************************************************************
301cdf0e10cSrcweir |*
302cdf0e10cSrcweir |*	SwViewImp::MakeDrawView();
303cdf0e10cSrcweir |*
304cdf0e10cSrcweir |*	Ersterstellung		AMA 01. Nov. 95
305cdf0e10cSrcweir |*	Letzte Aenderung	AMA 01. Nov. 95
306cdf0e10cSrcweir |*
307cdf0e10cSrcweir ******************************************************************************/
308cdf0e10cSrcweir 
MakeDrawView()309cdf0e10cSrcweir void SwViewImp::MakeDrawView()
310cdf0e10cSrcweir {
311cdf0e10cSrcweir     IDocumentDrawModelAccess* pIDDMA = GetShell()->getIDocumentDrawModelAccess();
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	// the else here is not an error, _MakeDrawModel() calls this method again
314cdf0e10cSrcweir 	// after the DrawModel is created to create DrawViews for all shells...
315cdf0e10cSrcweir 	if( !pIDDMA->GetDrawModel() )
316cdf0e10cSrcweir 	{
317cdf0e10cSrcweir         pIDDMA->_MakeDrawModel();
318cdf0e10cSrcweir 	}
319cdf0e10cSrcweir 	else
320cdf0e10cSrcweir 	{
321cdf0e10cSrcweir 		if ( !pDrawView )
322cdf0e10cSrcweir 		{
323cdf0e10cSrcweir 			// #i72809#
324cdf0e10cSrcweir 			// Discussed with FME, he also thinks that the getPrinter is old and not correct. When i got
325cdf0e10cSrcweir 			// him right, it anyways returns GetOut() when it's a printer, but NULL when not. He suggested
326cdf0e10cSrcweir 			// to use GetOut() and check the existing cases.
327cdf0e10cSrcweir 			// Check worked well. Took a look at viewing, printing, PDF export and print preview with a test
328cdf0e10cSrcweir 			// document which has an empty 2nd page (right page, see bug)
329cdf0e10cSrcweir 			OutputDevice* pOutDevForDrawView = GetShell()->GetWin();
330cdf0e10cSrcweir 
331cdf0e10cSrcweir 			if(!pOutDevForDrawView)
332cdf0e10cSrcweir 			{
333cdf0e10cSrcweir 				// pOutDevForDrawView = (OutputDevice*)GetShell()->getIDocumentDeviceAccess()->getPrinter( false );
334cdf0e10cSrcweir 				pOutDevForDrawView = GetShell()->GetOut();
335cdf0e10cSrcweir 			}
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 			pDrawView = new SwDrawView( *this, pIDDMA->GetDrawModel(), pOutDevForDrawView);
338cdf0e10cSrcweir 		}
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 		GetDrawView()->SetActiveLayer( XubString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Heaven" ) ) );
341cdf0e10cSrcweir 		const SwViewOption* pSwViewOption = GetShell()->GetViewOptions();
342cdf0e10cSrcweir 		Init(pSwViewOption);
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 		// #i68597# If document is read-only, we will not profit from overlay,
345cdf0e10cSrcweir 		// so switch it off.
346cdf0e10cSrcweir 		if(pDrawView && pDrawView->IsBufferedOverlayAllowed())
347cdf0e10cSrcweir 		{
348cdf0e10cSrcweir 			bool bIsReadOnly(pSwViewOption->IsReadonly());
349cdf0e10cSrcweir 
350cdf0e10cSrcweir #ifdef DBG_UTIL
351cdf0e10cSrcweir 			// add test possibilities
352cdf0e10cSrcweir 			static bool bAlwaysActivateForTest(false);
353cdf0e10cSrcweir 			if(bAlwaysActivateForTest && bIsReadOnly)
354cdf0e10cSrcweir 			{
355cdf0e10cSrcweir 				bIsReadOnly = false;
356cdf0e10cSrcweir 			}
357cdf0e10cSrcweir #endif
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 			if(bIsReadOnly)
360cdf0e10cSrcweir 			{
361cdf0e10cSrcweir 				pDrawView->SetBufferedOverlayAllowed(false);
362cdf0e10cSrcweir 			}
363cdf0e10cSrcweir 		}
364cdf0e10cSrcweir 	}
365cdf0e10cSrcweir }
366cdf0e10cSrcweir 
367cdf0e10cSrcweir /******************************************************************************
368cdf0e10cSrcweir |*
369cdf0e10cSrcweir |*	SwViewImp::GetRetoucheColor()
370cdf0e10cSrcweir |*
371cdf0e10cSrcweir |*	Ersterstellung		MA 24. Jun. 98
372cdf0e10cSrcweir |*	Letzte Aenderung	MA 24. Jun. 98
373cdf0e10cSrcweir |*
374cdf0e10cSrcweir ******************************************************************************/
375cdf0e10cSrcweir 
GetRetoucheColor() const376cdf0e10cSrcweir Color SwViewImp::GetRetoucheColor() const
377cdf0e10cSrcweir {
378cdf0e10cSrcweir     Color aRet( COL_TRANSPARENT );
379cdf0e10cSrcweir 	const ViewShell &rSh = *GetShell();
380cdf0e10cSrcweir 	if ( rSh.GetWin() )
381cdf0e10cSrcweir 	{
382cdf0e10cSrcweir         if ( rSh.GetViewOptions()->getBrowseMode() &&
383cdf0e10cSrcweir 			 COL_TRANSPARENT != rSh.GetViewOptions()->GetRetoucheColor().GetColor() )
384cdf0e10cSrcweir 			aRet = rSh.GetViewOptions()->GetRetoucheColor();
385cdf0e10cSrcweir         else if(rSh.GetViewOptions()->IsPagePreview()  &&
386cdf0e10cSrcweir                     !SW_MOD()->GetAccessibilityOptions().GetIsForPagePreviews())
387cdf0e10cSrcweir             aRet.SetColor(COL_WHITE);
388cdf0e10cSrcweir         else
389cdf0e10cSrcweir             aRet = SwViewOption::GetDocColor();
390cdf0e10cSrcweir     }
391cdf0e10cSrcweir 	return aRet;
392cdf0e10cSrcweir }
393cdf0e10cSrcweir 
394cdf0e10cSrcweir /** create page preview layout
395cdf0e10cSrcweir 
396cdf0e10cSrcweir     OD 12.12.2002 #103492#
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     @author OD
399cdf0e10cSrcweir */
InitPagePreviewLayout()400cdf0e10cSrcweir void SwViewImp::InitPagePreviewLayout()
401cdf0e10cSrcweir {
402cdf0e10cSrcweir     ASSERT( pSh->GetLayout(), "no layout - page preview layout can not be created.");
403cdf0e10cSrcweir     if ( pSh->GetLayout() )
404cdf0e10cSrcweir         mpPgPrevwLayout = new SwPagePreviewLayout( *pSh, *(pSh->GetLayout()) );
405cdf0e10cSrcweir }
406cdf0e10cSrcweir 
UpdateAccessible()407cdf0e10cSrcweir void SwViewImp::UpdateAccessible()
408cdf0e10cSrcweir {
409cdf0e10cSrcweir 	// We require a layout and an XModel to be accessible.
410cdf0e10cSrcweir     IDocumentLayoutAccess* pIDLA = GetShell()->getIDocumentLayoutAccess();
411cdf0e10cSrcweir 	Window *pWin = GetShell()->GetWin();
412cdf0e10cSrcweir     ASSERT( GetShell()->GetLayout(), "no layout, no access" );	//swmod 071108//swmod 071225
413cdf0e10cSrcweir 	ASSERT( pWin, "no window, no access" );
414cdf0e10cSrcweir 
415cdf0e10cSrcweir     if( IsAccessible() && pIDLA->GetCurrentViewShell() && pWin )	//swmod 071108//swmod 071225
416cdf0e10cSrcweir 		GetAccessibleMap().GetDocumentView();
417cdf0e10cSrcweir }
418cdf0e10cSrcweir 
DisposeAccessible(const SwFrm * pFrm,const SdrObject * pObj,sal_Bool bRecursive)419cdf0e10cSrcweir void SwViewImp::DisposeAccessible( const SwFrm *pFrm,
420cdf0e10cSrcweir 								   const SdrObject *pObj,
421cdf0e10cSrcweir 								   sal_Bool bRecursive )
422cdf0e10cSrcweir {
423cdf0e10cSrcweir 	ASSERT( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" );
424cdf0e10cSrcweir 	ViewShell *pVSh = GetShell();
425cdf0e10cSrcweir 	ViewShell *pTmp = pVSh;
426cdf0e10cSrcweir 	do
427cdf0e10cSrcweir 	{
428cdf0e10cSrcweir 		if( pTmp->Imp()->IsAccessible() )
429cdf0e10cSrcweir             pTmp->Imp()->GetAccessibleMap().Dispose( pFrm, pObj, 0, bRecursive );
430cdf0e10cSrcweir 		pTmp = (ViewShell *)pTmp->GetNext();
431cdf0e10cSrcweir 	} while ( pTmp != pVSh );
432cdf0e10cSrcweir }
433cdf0e10cSrcweir 
MoveAccessible(const SwFrm * pFrm,const SdrObject * pObj,const SwRect & rOldFrm)434cdf0e10cSrcweir void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
435cdf0e10cSrcweir 								const SwRect& rOldFrm )
436cdf0e10cSrcweir {
437cdf0e10cSrcweir 	ASSERT( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" );
438cdf0e10cSrcweir 	ViewShell *pVSh = GetShell();
439cdf0e10cSrcweir 	ViewShell *pTmp = pVSh;
440cdf0e10cSrcweir 	do
441cdf0e10cSrcweir 	{
442cdf0e10cSrcweir 		if( pTmp->Imp()->IsAccessible() )
443cdf0e10cSrcweir             pTmp->Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrm, pObj, 0,
444cdf0e10cSrcweir 																 rOldFrm );
445cdf0e10cSrcweir 		pTmp = (ViewShell *)pTmp->GetNext();
446cdf0e10cSrcweir 	} while ( pTmp != pVSh );
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
FirePageChangeEvent(sal_uInt16 nOldPage,sal_uInt16 nNewPage)449*ca62e2c2SSteve Yin void SwViewImp::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
450*ca62e2c2SSteve Yin {
451*ca62e2c2SSteve Yin 	if( IsAccessible() )
452*ca62e2c2SSteve Yin 		GetAccessibleMap().FirePageChangeEvent( nOldPage, nNewPage);
453*ca62e2c2SSteve Yin }
454*ca62e2c2SSteve Yin 
FireSectionChangeEvent(sal_uInt16 nOldSection,sal_uInt16 nNewSection)455*ca62e2c2SSteve Yin void SwViewImp::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
456*ca62e2c2SSteve Yin {
457*ca62e2c2SSteve Yin 	if( IsAccessible() )
458*ca62e2c2SSteve Yin 		GetAccessibleMap().FireSectionChangeEvent(nOldSection, nNewSection);
459*ca62e2c2SSteve Yin }
FireColumnChangeEvent(sal_uInt16 nOldColumn,sal_uInt16 nNewColumn)460*ca62e2c2SSteve Yin void SwViewImp::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
461*ca62e2c2SSteve Yin {
462*ca62e2c2SSteve Yin 	if( IsAccessible() )
463*ca62e2c2SSteve Yin 		GetAccessibleMap().FireColumnChangeEvent(nOldColumn,  nNewColumn);
464*ca62e2c2SSteve Yin }
InvalidateAccessibleFrmContent(const SwFrm * pFrm)465cdf0e10cSrcweir void SwViewImp::InvalidateAccessibleFrmContent( const SwFrm *pFrm )
466cdf0e10cSrcweir {
467cdf0e10cSrcweir 	ASSERT( pFrm->IsAccessibleFrm(), "frame is not accessible" );
468cdf0e10cSrcweir 	ViewShell *pVSh = GetShell();
469cdf0e10cSrcweir 	ViewShell *pTmp = pVSh;
470cdf0e10cSrcweir 	do
471cdf0e10cSrcweir 	{
472cdf0e10cSrcweir 		if( pTmp->Imp()->IsAccessible() )
473cdf0e10cSrcweir 			pTmp->Imp()->GetAccessibleMap().InvalidateContent( pFrm );
474cdf0e10cSrcweir 		pTmp = (ViewShell *)pTmp->GetNext();
475cdf0e10cSrcweir 	} while ( pTmp != pVSh );
476cdf0e10cSrcweir }
477cdf0e10cSrcweir 
InvalidateAccessibleCursorPosition(const SwFrm * pFrm)478cdf0e10cSrcweir void SwViewImp::InvalidateAccessibleCursorPosition( const SwFrm *pFrm )
479cdf0e10cSrcweir {
480cdf0e10cSrcweir 	if( IsAccessible() )
481cdf0e10cSrcweir 		GetAccessibleMap().InvalidateCursorPosition( pFrm );
482cdf0e10cSrcweir }
483cdf0e10cSrcweir 
InvalidateAccessibleEditableState(sal_Bool bAllShells,const SwFrm * pFrm)484cdf0e10cSrcweir void SwViewImp::InvalidateAccessibleEditableState( sal_Bool bAllShells,
485cdf0e10cSrcweir 	   											   const SwFrm *pFrm	)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir 	if( bAllShells )
488cdf0e10cSrcweir 	{
489cdf0e10cSrcweir 		ViewShell *pVSh = GetShell();
490cdf0e10cSrcweir 		ViewShell *pTmp = pVSh;
491cdf0e10cSrcweir 		do
492cdf0e10cSrcweir 		{
493cdf0e10cSrcweir 			if( pTmp->Imp()->IsAccessible() )
494cdf0e10cSrcweir 				pTmp->Imp()->GetAccessibleMap().InvalidateStates( ACC_STATE_EDITABLE, pFrm );
495cdf0e10cSrcweir 			pTmp = (ViewShell *)pTmp->GetNext();
496cdf0e10cSrcweir 		} while ( pTmp != pVSh );
497cdf0e10cSrcweir 	}
498cdf0e10cSrcweir 	else if( IsAccessible() )
499cdf0e10cSrcweir 	{
500cdf0e10cSrcweir 		GetAccessibleMap().InvalidateStates( ACC_STATE_EDITABLE, pFrm );
501cdf0e10cSrcweir 	}
502cdf0e10cSrcweir }
503cdf0e10cSrcweir 
InvalidateAccessibleRelationSet(const SwFlyFrm * pMaster,const SwFlyFrm * pFollow)504cdf0e10cSrcweir void SwViewImp::InvalidateAccessibleRelationSet( const SwFlyFrm *pMaster,
505cdf0e10cSrcweir                                                  const SwFlyFrm *pFollow )
506cdf0e10cSrcweir {
507cdf0e10cSrcweir 	ViewShell *pVSh = GetShell();
508cdf0e10cSrcweir 	ViewShell *pTmp = pVSh;
509cdf0e10cSrcweir 	do
510cdf0e10cSrcweir 	{
511cdf0e10cSrcweir 		if( pTmp->Imp()->IsAccessible() )
512cdf0e10cSrcweir 			pTmp->Imp()->GetAccessibleMap().InvalidateRelationSet( pMaster,
513cdf0e10cSrcweir                                                                    pFollow );
514cdf0e10cSrcweir 		pTmp = (ViewShell *)pTmp->GetNext();
515cdf0e10cSrcweir 	} while ( pTmp != pVSh );
516cdf0e10cSrcweir }
517cdf0e10cSrcweir 
518cdf0e10cSrcweir  /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
519cdf0e10cSrcweir 
520cdf0e10cSrcweir     OD 2005-12-01 #i27138#
521cdf0e10cSrcweir 
522cdf0e10cSrcweir     @author OD
523cdf0e10cSrcweir */
_InvalidateAccessibleParaFlowRelation(const SwTxtFrm * _pFromTxtFrm,const SwTxtFrm * _pToTxtFrm)524cdf0e10cSrcweir void SwViewImp::_InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm,
525cdf0e10cSrcweir                                                        const SwTxtFrm* _pToTxtFrm )
526cdf0e10cSrcweir {
527cdf0e10cSrcweir     if ( !_pFromTxtFrm && !_pToTxtFrm )
528cdf0e10cSrcweir     {
529cdf0e10cSrcweir         // No text frame provided. Thus, nothing to do.
530cdf0e10cSrcweir         return;
531cdf0e10cSrcweir     }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir     ViewShell* pVSh = GetShell();
534cdf0e10cSrcweir     ViewShell* pTmp = pVSh;
535cdf0e10cSrcweir     do
536cdf0e10cSrcweir     {
537cdf0e10cSrcweir         if ( pTmp->Imp()->IsAccessible() )
538cdf0e10cSrcweir         {
539cdf0e10cSrcweir             if ( _pFromTxtFrm )
540cdf0e10cSrcweir             {
541cdf0e10cSrcweir                 pTmp->Imp()->GetAccessibleMap().
542cdf0e10cSrcweir                             InvalidateParaFlowRelation( *_pFromTxtFrm, true );
543cdf0e10cSrcweir             }
544cdf0e10cSrcweir             if ( _pToTxtFrm )
545cdf0e10cSrcweir             {
546cdf0e10cSrcweir                 pTmp->Imp()->GetAccessibleMap().
547cdf0e10cSrcweir                             InvalidateParaFlowRelation( *_pToTxtFrm, false );
548cdf0e10cSrcweir             }
549cdf0e10cSrcweir         }
550cdf0e10cSrcweir         pTmp = (ViewShell *)pTmp->GetNext();
551cdf0e10cSrcweir     } while ( pTmp != pVSh );
552cdf0e10cSrcweir }
553cdf0e10cSrcweir 
554cdf0e10cSrcweir /** invalidate text selection for paragraphs
555cdf0e10cSrcweir 
556cdf0e10cSrcweir     OD 2005-12-12 #i27301#
557cdf0e10cSrcweir 
558cdf0e10cSrcweir     @author OD
559cdf0e10cSrcweir */
_InvalidateAccessibleParaTextSelection()560cdf0e10cSrcweir void SwViewImp::_InvalidateAccessibleParaTextSelection()
561cdf0e10cSrcweir {
562cdf0e10cSrcweir     ViewShell* pVSh = GetShell();
563cdf0e10cSrcweir     ViewShell* pTmp = pVSh;
564cdf0e10cSrcweir     do
565cdf0e10cSrcweir     {
566cdf0e10cSrcweir         if ( pTmp->Imp()->IsAccessible() )
567cdf0e10cSrcweir         {
568cdf0e10cSrcweir             pTmp->Imp()->GetAccessibleMap().InvalidateTextSelectionOfAllParas();
569cdf0e10cSrcweir         }
570cdf0e10cSrcweir 
571cdf0e10cSrcweir         pTmp = (ViewShell *)pTmp->GetNext();
572cdf0e10cSrcweir     } while ( pTmp != pVSh );
573cdf0e10cSrcweir }
574cdf0e10cSrcweir 
575cdf0e10cSrcweir /** invalidate attributes for paragraphs
576cdf0e10cSrcweir 
577cdf0e10cSrcweir     OD 2009-01-06 #i88069#
578cdf0e10cSrcweir 
579cdf0e10cSrcweir     @author OD
580cdf0e10cSrcweir */
_InvalidateAccessibleParaAttrs(const SwTxtFrm & rTxtFrm)581cdf0e10cSrcweir void SwViewImp::_InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm )
582cdf0e10cSrcweir {
583cdf0e10cSrcweir     ViewShell* pVSh = GetShell();
584cdf0e10cSrcweir     ViewShell* pTmp = pVSh;
585cdf0e10cSrcweir     do
586cdf0e10cSrcweir     {
587cdf0e10cSrcweir         if ( pTmp->Imp()->IsAccessible() )
588cdf0e10cSrcweir         {
589cdf0e10cSrcweir             pTmp->Imp()->GetAccessibleMap().InvalidateAttr( rTxtFrm );
590cdf0e10cSrcweir         }
591cdf0e10cSrcweir 
592cdf0e10cSrcweir         pTmp = (ViewShell *)pTmp->GetNext();
593cdf0e10cSrcweir     } while ( pTmp != pVSh );
594cdf0e10cSrcweir }
595cdf0e10cSrcweir 
596cdf0e10cSrcweir // OD 15.01.2003 #103492# - method signature change due to new page preview functionality
UpdateAccessiblePreview(const std::vector<PrevwPage * > & _rPrevwPages,const Fraction & _rScale,const SwPageFrm * _pSelectedPageFrm,const Size & _rPrevwWinSize)597cdf0e10cSrcweir void SwViewImp::UpdateAccessiblePreview( const std::vector<PrevwPage*>& _rPrevwPages,
598cdf0e10cSrcweir                                          const Fraction&  _rScale,
599cdf0e10cSrcweir                                          const SwPageFrm* _pSelectedPageFrm,
600cdf0e10cSrcweir                                          const Size&      _rPrevwWinSize )
601cdf0e10cSrcweir {
602cdf0e10cSrcweir     if( IsAccessible() )
603cdf0e10cSrcweir         GetAccessibleMap().UpdatePreview( _rPrevwPages, _rScale,
604cdf0e10cSrcweir                                           _pSelectedPageFrm, _rPrevwWinSize );
605cdf0e10cSrcweir }
606cdf0e10cSrcweir 
InvalidateAccessiblePreViewSelection(sal_uInt16 nSelPage)607cdf0e10cSrcweir void SwViewImp::InvalidateAccessiblePreViewSelection( sal_uInt16 nSelPage )
608cdf0e10cSrcweir {
609cdf0e10cSrcweir     if( IsAccessible() )
610cdf0e10cSrcweir         GetAccessibleMap().InvalidatePreViewSelection( nSelPage );
611cdf0e10cSrcweir }
612cdf0e10cSrcweir 
CreateAccessibleMap()613cdf0e10cSrcweir SwAccessibleMap *SwViewImp::CreateAccessibleMap()
614cdf0e10cSrcweir {
615cdf0e10cSrcweir 	ASSERT( !pAccMap, "accessible map exists" )
616cdf0e10cSrcweir 	pAccMap = new SwAccessibleMap( GetShell() );
617cdf0e10cSrcweir 	return pAccMap;
618cdf0e10cSrcweir }
619cdf0e10cSrcweir 
FireAccessibleEvents()620cdf0e10cSrcweir void SwViewImp::FireAccessibleEvents()
621cdf0e10cSrcweir {
622cdf0e10cSrcweir 	if( IsAccessible() )
623cdf0e10cSrcweir 		GetAccessibleMap().FireEvents();
624cdf0e10cSrcweir }
625cdf0e10cSrcweir 
IMPL_LINK(SwViewImp,SetStopPrt,void *,EMPTYARG)626cdf0e10cSrcweir IMPL_LINK(SwViewImp, SetStopPrt, void *, EMPTYARG)
627cdf0e10cSrcweir {
628cdf0e10cSrcweir 	bStopPrt = sal_True;
629cdf0e10cSrcweir 
630cdf0e10cSrcweir 	return 0;
631cdf0e10cSrcweir }
632cdf0e10cSrcweir 
633