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

Generated by: LCOV version 1.10