LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/ui/view - tabview5.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 226 342 66.1 %
Date: 2013-07-09 Functions: 21 30 70.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10