xref: /trunk/main/sc/source/ui/view/tabview5.cxx (revision 079eb148)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 
32 
33 // INCLUDE ---------------------------------------------------------------
34 
35 #include "scitems.hxx"
36 #include <editeng/eeitem.hxx>
37 
38 
39 #include <svx/fmshell.hxx>
40 #include <svx/svdobj.hxx>
41 #include <svx/svdoutl.hxx>
42 #include <sfx2/bindings.hxx>
43 #include <sfx2/dispatch.hxx>
44 #include <sfx2/objsh.hxx>
45 #include <tools/ref.hxx>
46 
47 #include "tabview.hxx"
48 #include "tabvwsh.hxx"
49 #include "document.hxx"
50 #include "gridwin.hxx"
51 #include "olinewin.hxx"
52 #include "tabsplit.hxx"
53 #include "colrowba.hxx"
54 #include "tabcont.hxx"
55 #include "hintwin.hxx"
56 #include "sc.hrc"
57 #include "pagedata.hxx"
58 #include "hiranges.hxx"
59 #include "drawview.hxx"
60 #include "drwlayer.hxx"
61 #include "fusel.hxx"                // Start-Function
62 #include "seltrans.hxx"
63 #include "scmod.hxx"
64 #include "AccessibilityHints.hxx"
65 #include "docsh.hxx"
66 #include "viewuno.hxx"
67 
68 #include <vcl/svapp.hxx>
69 
70 using namespace com::sun::star;
71 
72 // STATIC DATA -----------------------------------------------------------
73 
74 
75 void __EXPORT ScTabView::Init()
76 {
77     /*  RTL layout of the view windows is done manually, because it depends on
78         the sheet orientation, not the UI setting. Note: controls that are
79         already constructed (e.g. scroll bars) have the RTL setting of the GUI.
80         Eventually this has to be disabled manually (see below). */
81     pFrameWin->EnableRTL( sal_False );
82 
83 	sal_uInt16 i;
84 
85 	aScrollTimer.SetTimeout(10);
86 	aScrollTimer.SetTimeoutHdl( LINK( this, ScTabView, TimerHdl ) );
87 
88 	for (i=0; i<4; i++)
89 		pGridWin[i] = NULL;
90 	pGridWin[SC_SPLIT_BOTTOMLEFT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_BOTTOMLEFT );
91 
92 	pSelEngine = new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], this,
93 												SC_SPLIT_BOTTOMLEFT );
94 	aFunctionSet.SetSelectionEngine( pSelEngine );
95 
96 	pHdrSelEng = new ScHeaderSelectionEngine( pFrameWin, &aHdrFunc );
97 
98 	pColBar[SC_SPLIT_LEFT] = new ScColBar( pFrameWin, &aViewData, SC_SPLIT_LEFT,
99 												&aHdrFunc, pHdrSelEng );
100 	pColBar[SC_SPLIT_RIGHT] = NULL;
101 	pRowBar[SC_SPLIT_BOTTOM] = new ScRowBar( pFrameWin, &aViewData, SC_SPLIT_BOTTOM,
102 												&aHdrFunc, pHdrSelEng );
103 	pRowBar[SC_SPLIT_TOP] = NULL;
104 	for (i=0; i<2; i++)
105 		pColOutline[i] = pRowOutline[i] = NULL;
106 
107 	pHSplitter = new ScTabSplitter( pFrameWin, WinBits( WB_HSCROLL ), &aViewData );
108 	pVSplitter = new ScTabSplitter( pFrameWin, WinBits( WB_VSCROLL ), &aViewData );
109 
110     // SSA: override default keyboard step size to allow snap to row/column
111     pHSplitter->SetKeyboardStepSize( 1 );
112     pVSplitter->SetKeyboardStepSize( 1 );
113 
114 	pTabControl = new ScTabControl( pFrameWin, &aViewData );
115     /*  #i97900# The tab control has to remain in RTL mode if GUI is RTL, this
116         is needed to draw the 3D effect correctly. The base TabBar implementes
117         mirroring independent from the GUI direction. Have to set RTL mode
118         explicitly because the parent frame window is already RTL disabled. */
119     pTabControl->EnableRTL( Application::GetSettings().GetLayoutRTL() );
120 
121 	InitScrollBar( aHScrollLeft,	MAXCOL+1 );
122 	InitScrollBar( aHScrollRight,	MAXCOL+1 );
123 	InitScrollBar( aVScrollTop, 	MAXROW+1 );
124 	InitScrollBar( aVScrollBottom,	MAXROW+1 );
125     /*  #i97900# scrollbars remain in correct RTL mode, needed mirroring etc.
126         is now handled correctly at the respective places. */
127 
128 	//	Hier noch nichts anzeigen (Show), weil noch falsch angeordnet ist
129 	//	Show kommt dann aus UpdateShow beim ersten Resize
130 	//		pTabControl, pGridWin, aHScrollLeft, aVScrollBottom,
131 	//		aCornerButton, aScrollBarBox, pHSplitter, pVSplitter
132 
133 	//		Splitter
134 
135 	pHSplitter->SetSplitHdl( LINK( this, ScTabView, SplitHdl ) );
136 	pVSplitter->SetSplitHdl( LINK( this, ScTabView, SplitHdl ) );
137 
138 	//	UpdateShow kommt beim Resize, oder bei Kopie einer bestehenden View aus dem ctor
139 
140 	pDrawActual = NULL;
141 	pDrawOld	= NULL;
142 
143 			//	DrawView darf nicht im TabView - ctor angelegt werden,
144 			//	wenn die ViewShell noch nicht konstruiert ist...
145 			//	Das gilt auch fuer ViewOptionsHasChanged()
146 
147 	TestHintWindow();
148 }
149 
150 __EXPORT ScTabView::~ScTabView()
151 {
152 	sal_uInt16 i;
153 
154 	//	remove selection object
155 	ScModule* pScMod = SC_MOD();
156 	ScSelectionTransferObj* pOld = pScMod->GetSelectionTransfer();
157 	if ( pOld && pOld->GetView() == this )
158 	{
159 		pOld->ForgetView();
160 		pScMod->SetSelectionTransfer( NULL );
161 		TransferableHelper::ClearSelection( GetActiveWin() );		// may delete pOld
162 	}
163 
164     DELETEZ(pBrushDocument);
165     DELETEZ(pDrawBrushSet);
166 
167 	DELETEZ(pPageBreakData);
168 	DELETEZ(pHighlightRanges);
169 
170 	DELETEZ(pDrawOld);
171 	DELETEZ(pDrawActual);
172 
173 	aViewData.KillEditView();			// solange GridWin's noch existieren
174 
175 	DELETEZ(pInputHintWindow);
176 
177 	if (pDrawView)
178 	{
179 		for (i=0; i<4; i++)
180 			if (pGridWin[i])
181 			{
182 				pDrawView->VCRemoveWin(pGridWin[i]);
183 				pDrawView->DeleteWindowFromPaintView(pGridWin[i]);
184 			}
185 
186 		pDrawView->HideSdrPage();
187 		delete pDrawView;
188 	}
189 
190 	delete pSelEngine;
191 
192 	for (i=0; i<4; i++)
193 		delete pGridWin[i];
194 
195 	delete pHdrSelEng;
196 
197 	for (i=0; i<2; i++)
198 	{
199 		delete pColBar[i];
200 		delete pRowBar[i];
201 		delete pColOutline[i];
202 		delete pRowOutline[i];
203 	}
204 
205 	delete pHSplitter;
206 	delete pVSplitter;
207 
208 	delete pTabControl;
209 }
210 
211 void ScTabView::MakeDrawView( sal_uInt8 nForceDesignMode )
212 {
213 	if (!pDrawView)
214 	{
215 		ScDrawLayer* pLayer = aViewData.GetDocument()->GetDrawLayer();
216 		DBG_ASSERT(pLayer, "wo ist der Draw Layer ??");
217 
218 		sal_uInt16 i;
219 		pDrawView = new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT], &aViewData );
220 		for (i=0; i<4; i++)
221 			if (pGridWin[i])
222 			{
223 				if ( SC_SPLIT_BOTTOMLEFT != (ScSplitPos)i )
224 					pDrawView->AddWindowToPaintView(pGridWin[i]);
225 				pDrawView->VCAddWin(pGridWin[i]);
226 			}
227 		pDrawView->RecalcScale();
228 		for (i=0; i<4; i++)
229 			if (pGridWin[i])
230 			{
231 				pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
232 
233 				pGridWin[i]->Update();		// wegen Invalidate im DrawView ctor (ShowPage),
234 											// damit gleich gezeichnet werden kann
235 			}
236 		SfxRequest aSfxRequest(SID_OBJECT_SELECT, 0,aViewData.GetViewShell()->GetPool());
237 		SetDrawFuncPtr(new FuSelection( aViewData.GetViewShell(), GetActiveWin(), pDrawView,
238 										pLayer,aSfxRequest));
239 
240 		//	#106334# used when switching back from page preview: restore saved design mode state
241 		//	(otherwise, keep the default from the draw view ctor)
242 		if ( nForceDesignMode != SC_FORCEMODE_NONE )
243 			pDrawView->SetDesignMode( (sal_Bool)nForceDesignMode );
244 
245 		//	an der FormShell anmelden
246 		FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell();
247 		if (pFormSh)
248 			pFormSh->SetView(pDrawView);
249 
250 	    if (aViewData.GetViewShell()->HasAccessibilityObjects())
251 		    aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_MAKEDRAWLAYER));
252 
253 	}
254 }
255 
256 void ScTabView::DoAddWin( ScGridWindow* pWin )
257 {
258 	if (pDrawView)
259 	{
260 		pDrawView->AddWindowToPaintView(pWin);
261 		pDrawView->VCAddWin(pWin);
262 
263 		// #114409#
264 		pWin->DrawLayerCreated();
265 	}
266 }
267 
268 //==================================================================
269 
270 void ScTabView::TabChanged( bool bSameTabButMoved )
271 {
272 	if (pDrawView)
273 	{
274 		DrawDeselectAll();		// beendet auch Text-Edit-Modus
275 
276 		sal_uInt16 i;
277 		for (i=0; i<4; i++)
278 			if (pGridWin[i])
279 				pDrawView->VCRemoveWin(pGridWin[i]);	// fuer alte Page
280 
281 		SCTAB nTab = aViewData.GetTabNo();
282 		pDrawView->HideSdrPage();
283 		pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
284 
285 		UpdateLayerLocks();
286 
287 		pDrawView->RecalcScale();
288 		pDrawView->UpdateWorkArea();	// #54782# PageSize ist pro Page unterschiedlich
289 
290 		for (i=0; i<4; i++)
291 			if (pGridWin[i])
292 				pDrawView->VCAddWin(pGridWin[i]);		// fuer neue Page
293 	}
294 
295 	SfxBindings& rBindings = aViewData.GetBindings();
296 
297 	//	Es gibt keine einfache Moeglichkeit, alle Slots der FormShell zu invalidieren
298 	//	(fuer disablete Slots auf geschuetzten Tabellen), darum hier einfach alles...
299 	rBindings.InvalidateAll(sal_False);
300 
301 #if 0
302 	rBindings.Invalidate( SID_SELECT_SCENARIO );
303 	rBindings.Invalidate( FID_PROTECT_TABLE );
304 	rBindings.Invalidate( FID_DELETE_TABLE );
305 	rBindings.Invalidate( FID_TABLE_SHOW );
306 	rBindings.Invalidate( FID_TABLE_HIDE );
307 
308 				// Auswirkungen von geschuetzten Tabellen.
309 	rBindings.Invalidate( FID_TAB_RENAME );
310 	rBindings.Invalidate( FID_TAB_MOVE );
311 	rBindings.Invalidate( SID_DEL_ROWS );
312 	rBindings.Invalidate( SID_DEL_COLS );
313 	rBindings.Invalidate( FID_INS_ROW );
314 	rBindings.Invalidate( FID_INS_COLUMN );
315 	rBindings.Invalidate( FID_INS_CELL );
316 	rBindings.Invalidate( FID_INS_CELLSDOWN	);
317 	rBindings.Invalidate( FID_INS_CELLSRIGHT );
318 	rBindings.Invalidate( FID_DELETE_CELL );
319 
320 	rBindings.Invalidate( SID_OPENDLG_CHART );
321 	rBindings.Invalidate( SID_INSERT_OBJECT );
322 	rBindings.Invalidate( SID_INSERT_DIAGRAM );
323 	rBindings.Invalidate( SID_INSERT_SMATH );
324 	rBindings.Invalidate( SID_INSERT_GRAPHIC );
325 #endif
326 
327 	if (aViewData.GetViewShell()->HasAccessibilityObjects())
328 	{
329 		SfxSimpleHint aAccHint(SC_HINT_ACC_TABLECHANGED);
330 		aViewData.GetViewShell()->BroadcastAccessibility(aAccHint);
331 	}
332 
333     // notification for XActivationBroadcaster
334     SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
335     if (pViewFrame)
336     {
337         uno::Reference<frame::XController> xController = pViewFrame->GetFrame().GetController();
338         if (xController.is())
339         {
340             ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
341             if (pImp)
342                 pImp->SheetChanged( bSameTabButMoved );
343         }
344     }
345 }
346 
347 void ScTabView::UpdateLayerLocks()
348 {
349 	if (pDrawView)
350 	{
351 		SCTAB nTab = aViewData.GetTabNo();
352 		sal_Bool bEx = aViewData.GetViewShell()->IsDrawSelMode();
353 		sal_Bool bProt = aViewData.GetDocument()->IsTabProtected( nTab ) ||
354 					 aViewData.GetSfxDocShell()->IsReadOnly();
355         sal_Bool bShared = aViewData.GetDocShell()->IsDocShared();
356 
357 		SdrLayer* pLayer;
358 		SdrLayerAdmin& rAdmin = pDrawView->GetModel()->GetLayerAdmin();
359 		pLayer = rAdmin.GetLayerPerID(SC_LAYER_BACK);
360 		if (pLayer)
361 			pDrawView->SetLayerLocked( pLayer->GetName(), bProt || !bEx || bShared );
362 		pLayer = rAdmin.GetLayerPerID(SC_LAYER_INTERN);
363 		if (pLayer)
364 			pDrawView->SetLayerLocked( pLayer->GetName(), sal_True );
365 		pLayer = rAdmin.GetLayerPerID(SC_LAYER_FRONT);
366 		if (pLayer)
367 			pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
368 		pLayer = rAdmin.GetLayerPerID(SC_LAYER_CONTROLS);
369 		if (pLayer)
370 			pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
371 		pLayer = rAdmin.GetLayerPerID(SC_LAYER_HIDDEN);
372 		if (pLayer)
373         {
374 			pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
375             pDrawView->SetLayerVisible( pLayer->GetName(), sal_False);
376         }
377 	}
378 }
379 
380 void ScTabView::DrawDeselectAll()
381 {
382 	if (pDrawView)
383 	{
384 		ScTabViewShell* pViewSh = aViewData.GetViewShell();
385 		if ( pDrawActual &&
386 			( pViewSh->IsDrawTextShell() || pDrawActual->GetSlotID() == SID_DRAW_NOTEEDIT ) )
387 		{
388 			// end text edit (as if escape pressed, in FuDraw)
389 			aViewData.GetDispatcher().Execute( pDrawActual->GetSlotID(),
390 										SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
391 		}
392 
393 		pDrawView->ScEndTextEdit();
394 		pDrawView->UnmarkAll();
395 
396 		if (!pViewSh->IsDrawSelMode())
397 			pViewSh->SetDrawShell( sal_False );
398 	}
399 }
400 
401 sal_Bool ScTabView::IsDrawTextEdit() const
402 {
403 	if (pDrawView)
404 		return pDrawView->IsTextEdit();
405 	else
406 		return sal_False;
407 }
408 
409 //UNUSED2008-05  String ScTabView::GetSelectedChartName() const
410 //UNUSED2008-05  {
411 //UNUSED2008-05      if (pDrawView)
412 //UNUSED2008-05          return pDrawView->GetSelectedChartName();
413 //UNUSED2008-05      else
414 //UNUSED2008-05          return EMPTY_STRING;
415 //UNUSED2008-05  }
416 
417 SvxZoomType ScTabView::GetZoomType() const
418 {
419     return aViewData.GetZoomType();
420 }
421 
422 void ScTabView::SetZoomType( SvxZoomType eNew, sal_Bool bAll )
423 {
424     aViewData.SetZoomType( eNew, bAll );
425 }
426 
427 void ScTabView::SetZoom( const Fraction& rNewX, const Fraction& rNewY, sal_Bool bAll )
428 {
429     aViewData.SetZoom( rNewX, rNewY, bAll );
430 	if (pDrawView)
431 		pDrawView->RecalcScale();
432 	ZoomChanged();				// einzeln wegen CLOOKs
433 }
434 
435 void ScTabView::RefreshZoom()
436 {
437     aViewData.RefreshZoom();
438     if (pDrawView)
439         pDrawView->RecalcScale();
440     ZoomChanged();
441 }
442 
443 void ScTabView::SetPagebreakMode( sal_Bool bSet )
444 {
445 	aViewData.SetPagebreakMode(bSet);
446 	if (pDrawView)
447 		pDrawView->RecalcScale();
448 	ZoomChanged();				// einzeln wegen CLOOKs
449 }
450 
451 void ScTabView::ResetDrawDragMode()
452 {
453 	if (pDrawView)
454 		pDrawView->SetDragMode( SDRDRAG_MOVE );
455 }
456 
457 void ScTabView::ViewOptionsHasChanged( sal_Bool bHScrollChanged, sal_Bool bGraphicsChanged )
458 {
459 	//	DrawView erzeugen, wenn Gitter angezeigt werden soll
460 	if ( !pDrawView && aViewData.GetOptions().GetGridOptions().GetGridVisible() )
461 		MakeDrawLayer();
462 
463 	if (pDrawView)
464 		pDrawView->UpdateUserViewOptions();
465 
466 	if (bGraphicsChanged)
467 		DrawEnableAnim(sal_True);	// DrawEnableAnim checks the options state
468 
469 	// if TabBar is set to visible, make sure its size is not 0
470 	sal_Bool bGrow = ( aViewData.IsTabMode() && pTabControl->GetSizePixel().Width() <= 0 );
471 
472 	// if ScrollBar is set to visible, TabBar must make room
473 	sal_Bool bShrink = ( bHScrollChanged && aViewData.IsTabMode() && aViewData.IsHScrollMode() &&
474 						pTabControl->GetSizePixel().Width() > SC_TABBAR_DEFWIDTH );
475 
476 	if ( bGrow || bShrink )
477 	{
478 		Size aSize = pTabControl->GetSizePixel();
479 		aSize.Width() = SC_TABBAR_DEFWIDTH;				// initial size
480 		pTabControl->SetSizePixel(aSize);				// DoResize is called later...
481 	}
482 }
483 
484 // Helper-Funktion gegen das Include des Drawing Layers
485 
486 SdrView* ScTabView::GetSdrView()
487 {
488 	return pDrawView;
489 }
490 
491 void ScTabView::DrawMarkListHasChanged()
492 {
493 	if ( pDrawView )
494 		pDrawView->MarkListHasChanged();
495 }
496 
497 void ScTabView::UpdateAnchorHandles()
498 {
499 	if ( pDrawView )
500 		pDrawView->AdjustMarkHdl();
501 }
502 
503 void ScTabView::UpdateIMap( SdrObject* pObj )
504 {
505 	if ( pDrawView )
506 		pDrawView->UpdateIMap( pObj );
507 }
508 
509 void ScTabView::DrawMarkRect( const Rectangle& rRect )
510 {
511 	//!	store rectangle for repaint during drag
512 
513 	for (sal_uInt16 i=0; i<4; i++)
514 	{
515 		if ( pGridWin[i] && pGridWin[i]->IsVisible() )
516 		{
517 			RasterOp aROp = pGridWin[i]->GetRasterOp();
518 			sal_Bool bHasLine = pGridWin[i]->IsLineColor();
519 			Color aLine	  = pGridWin[i]->GetLineColor();
520 			sal_Bool bHasFill = pGridWin[i]->IsFillColor();
521 			Color aFill   = pGridWin[i]->GetFillColor();
522 
523 			pGridWin[i]->SetRasterOp( ROP_INVERT );
524 			pGridWin[i]->SetLineColor( COL_BLACK );
525 			pGridWin[i]->SetFillColor();
526 
527 			pGridWin[i]->DrawRect(rRect);
528 
529 			pGridWin[i]->SetRasterOp(aROp);
530 			if (bHasLine)
531 				pGridWin[i]->SetLineColor(aLine);
532 			else
533 				pGridWin[i]->SetLineColor();
534 			if (bHasFill)
535 				pGridWin[i]->SetFillColor(aFill);
536 			else
537 				pGridWin[i]->SetFillColor();
538 		}
539 	}
540 }
541 
542 void ScTabView::DrawEnableAnim(sal_Bool bSet)
543 {
544 	sal_uInt16 i;
545 	if ( pDrawView )
546 	{
547 		//	#71040# dont start animations if display of graphics is disabled
548 		//	graphics are controlled by VOBJ_TYPE_OLE
549 		if ( bSet && aViewData.GetOptions().GetObjMode(VOBJ_TYPE_OLE) == VOBJ_MODE_SHOW )
550 		{
551 			if ( !pDrawView->IsAnimationEnabled() )
552 			{
553 				pDrawView->SetAnimationEnabled(sal_True);
554 
555 				//	Animierte GIFs muessen wieder gestartet werden:
556 				ScDocument* pDoc = aViewData.GetDocument();
557 				for (i=0; i<4; i++)
558 					if ( pGridWin[i] && pGridWin[i]->IsVisible() )
559 						pDoc->StartAnimations( aViewData.GetTabNo(), pGridWin[i] );
560 			}
561 		}
562 		else
563 		{
564 			pDrawView->SetAnimationEnabled(sal_False);
565 		}
566 	}
567 }
568 
569 //HMHvoid ScTabView::DrawShowMarkHdl(sal_Bool bShow)
570 //HMH{
571 	//HMHif (!pDrawView)
572 	//HMH	return;
573 
574 	//HMHif (bShow)
575 	//HMH{
576 	//HMH	if (!pDrawView->IsDisableHdl())
577 	//HMH		pDrawView->ShowMarkHdl();
578 	//HMH}
579 	//HMHelse
580 	//HMH	pDrawView->HideMarkHdl();
581 //HMH}
582 
583 void ScTabView::UpdateDrawTextOutliner()
584 {
585 	if ( pDrawView )
586 	{
587 		Outliner* pOL = pDrawView->GetTextEditOutliner();
588 		if (pOL)
589 			aViewData.UpdateOutlinerFlags( *pOL );
590 	}
591 }
592 
593 void ScTabView::DigitLanguageChanged()
594 {
595 	LanguageType eNewLang = SC_MOD()->GetOptDigitLanguage();
596 	for (sal_uInt16 i=0; i<4; i++)
597 		if ( pGridWin[i] )
598 			pGridWin[i]->SetDigitLanguage( eNewLang );
599 }
600 
601 //---------------------------------------------------------------
602 
603 void ScTabView::ScrollToObject( SdrObject* pDrawObj )
604 {
605 	if ( pDrawObj )
606     {
607         // #i118524# use the BoundRect, this defines the visible area
608 		MakeVisible(pDrawObj->GetCurrentBoundRect());
609     }
610 }
611 
612 void ScTabView::MakeVisible( const Rectangle& rHMMRect )
613 {
614 	Window* pWin = GetActiveWin();
615 	Size aWinSize = pWin->GetOutputSizePixel();
616 	SCTAB nTab = aViewData.GetTabNo();
617 
618 	Rectangle aRect = pWin->LogicToPixel( rHMMRect );
619 
620 	long nScrollX=0, nScrollY=0;		// Pixel
621 
622 	if ( aRect.Right() >= aWinSize.Width() )				// rechts raus
623 	{
624 		nScrollX = aRect.Right() - aWinSize.Width() + 1;	// rechter Rand sichtbar
625 		if ( aRect.Left() < nScrollX )
626 			nScrollX = aRect.Left();						// links sichtbar (falls zu gross)
627 	}
628 	if ( aRect.Bottom() >= aWinSize.Height() )				// unten raus
629 	{
630 		nScrollY = aRect.Bottom() - aWinSize.Height() + 1;	// unterer Rand sichtbar
631 		if ( aRect.Top() < nScrollY )
632 			nScrollY = aRect.Top();							// oben sichtbar (falls zu gross)
633 	}
634 
635 	if ( aRect.Left() < 0 )				// links raus
636 		nScrollX = aRect.Left();		// linker Rand sichtbar
637 	if ( aRect.Top() < 0 )				// oben raus
638 		nScrollY = aRect.Top();			// oberer Rand sichtbar
639 
640 	if (nScrollX || nScrollY)
641 	{
642 		ScDocument* pDoc = aViewData.GetDocument();
643 		if ( pDoc->IsNegativePage( nTab ) )
644 			nScrollX = -nScrollX;
645 
646 		double nPPTX = aViewData.GetPPTX();
647 		double nPPTY = aViewData.GetPPTY();
648 		ScSplitPos eWhich = aViewData.GetActivePart();
649 		SCCOL nPosX = aViewData.GetPosX(WhichH(eWhich));
650 		SCROW nPosY = aViewData.GetPosY(WhichV(eWhich));
651 
652 		long nLinesX=0, nLinesY=0;		// Spalten/Zeilen - um mindestens nScrollX/Y scrollen
653 
654 		if (nScrollX > 0)
655 			while (nScrollX > 0 && nPosX < MAXCOL)
656 			{
657 				nScrollX -= (long) ( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
658 				++nPosX;
659 				++nLinesX;
660 			}
661 		else if (nScrollX < 0)
662 			while (nScrollX < 0 && nPosX > 0)
663 			{
664 				--nPosX;
665 				nScrollX += (long) ( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
666 				--nLinesX;
667 			}
668 
669 		if (nScrollY > 0)
670 			while (nScrollY > 0 && nPosY < MAXROW)
671 			{
672 				nScrollY -= (long) ( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
673 				++nPosY;
674 				++nLinesY;
675 			}
676 		else if (nScrollY < 0)
677 			while (nScrollY < 0 && nPosY > 0)
678 			{
679 				--nPosY;
680 				nScrollY += (long) ( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
681 				--nLinesY;
682 			}
683 
684 		ScrollLines( nLinesX, nLinesY );					// ausfuehren
685 	}
686 }
687 
688 //---------------------------------------------------------------
689 
690 void ScTabView::SetBrushDocument( ScDocument* pNew, sal_Bool bLock )
691 {
692     delete pBrushDocument;
693     delete pDrawBrushSet;
694 
695     pBrushDocument = pNew;
696     pDrawBrushSet = NULL;
697 
698     bLockPaintBrush = bLock;
699 
700     aViewData.GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
701 }
702 
703 void ScTabView::SetDrawBrushSet( SfxItemSet* pNew, sal_Bool bLock )
704 {
705     delete pBrushDocument;
706     delete pDrawBrushSet;
707 
708     pBrushDocument = NULL;
709     pDrawBrushSet = pNew;
710 
711     bLockPaintBrush = bLock;
712 
713     aViewData.GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
714 }
715 
716 void ScTabView::ResetBrushDocument()
717 {
718     if ( HasPaintBrush() )
719     {
720         SetBrushDocument( NULL, sal_False );
721         SetActivePointer( Pointer( POINTER_ARROW ) );   // switch pointers also when ended with escape key
722     }
723 }
724 
725 
726