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