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