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