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