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

Generated by: LCOV version 1.10