LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/view - tabview5.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 342 0.3 %
Date: 2012-12-27 Functions: 2 30 6.7 %
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           0 : 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           0 :     pFrameWin->EnableRTL( false );
      65             : 
      66             :     sal_uInt16 i;
      67             : 
      68           0 :     aScrollTimer.SetTimeout(10);
      69           0 :     aScrollTimer.SetTimeoutHdl( LINK( this, ScTabView, TimerHdl ) );
      70             : 
      71           0 :     for (i=0; i<4; i++)
      72           0 :         pGridWin[i] = NULL;
      73           0 :     pGridWin[SC_SPLIT_BOTTOMLEFT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_BOTTOMLEFT );
      74             : 
      75           0 :     pSelEngine = new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], this,
      76           0 :                                                 SC_SPLIT_BOTTOMLEFT );
      77           0 :     aFunctionSet.SetSelectionEngine( pSelEngine );
      78             : 
      79           0 :     pHdrSelEng = new ScHeaderSelectionEngine( pFrameWin, &aHdrFunc );
      80             : 
      81             :     pColBar[SC_SPLIT_LEFT] = new ScColBar( pFrameWin, &aViewData, SC_SPLIT_LEFT,
      82           0 :                                                 &aHdrFunc, pHdrSelEng );
      83           0 :     pColBar[SC_SPLIT_RIGHT] = NULL;
      84             :     pRowBar[SC_SPLIT_BOTTOM] = new ScRowBar( pFrameWin, &aViewData, SC_SPLIT_BOTTOM,
      85           0 :                                                 &aHdrFunc, pHdrSelEng );
      86           0 :     pRowBar[SC_SPLIT_TOP] = NULL;
      87           0 :     for (i=0; i<2; i++)
      88           0 :         pColOutline[i] = pRowOutline[i] = NULL;
      89             : 
      90           0 :     pHSplitter = new ScTabSplitter( pFrameWin, WinBits( WB_HSCROLL ), &aViewData );
      91           0 :     pVSplitter = new ScTabSplitter( pFrameWin, WinBits( WB_VSCROLL ), &aViewData );
      92             : 
      93             :     // SSA: override default keyboard step size to allow snap to row/column
      94           0 :     pHSplitter->SetKeyboardStepSize( 1 );
      95           0 :     pVSplitter->SetKeyboardStepSize( 1 );
      96             : 
      97           0 :     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           0 :     pTabControl->EnableRTL( Application::GetSettings().GetLayoutRTL() );
     103             : 
     104           0 :     InitScrollBar( aHScrollLeft,    MAXCOL+1 );
     105           0 :     InitScrollBar( aHScrollRight,   MAXCOL+1 );
     106           0 :     InitScrollBar( aVScrollTop,     MAXROW+1 );
     107           0 :     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           0 :     pHSplitter->SetSplitHdl( LINK( this, ScTabView, SplitHdl ) );
     119           0 :     pVSplitter->SetSplitHdl( LINK( this, ScTabView, SplitHdl ) );
     120             : 
     121             :     //  UpdateShow kommt beim Resize, oder bei Kopie einer bestehenden View aus dem ctor
     122             : 
     123           0 :     pDrawActual = NULL;
     124           0 :     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           0 :     TestHintWindow();
     131           0 : }
     132             : 
     133           0 : ScTabView::~ScTabView()
     134             : {
     135             :     sal_uInt16 i;
     136             : 
     137             :     //  remove selection object
     138           0 :     ScModule* pScMod = SC_MOD();
     139           0 :     ScSelectionTransferObj* pOld = pScMod->GetSelectionTransfer();
     140           0 :     if ( pOld && pOld->GetView() == this )
     141             :     {
     142           0 :         pOld->ForgetView();
     143           0 :         pScMod->SetSelectionTransfer( NULL );
     144           0 :         TransferableHelper::ClearSelection( GetActiveWin() );       // may delete pOld
     145             :     }
     146             : 
     147           0 :     DELETEZ(pBrushDocument);
     148           0 :     DELETEZ(pDrawBrushSet);
     149             : 
     150           0 :     DELETEZ(pPageBreakData);
     151             : 
     152           0 :     DELETEZ(pDrawOld);
     153           0 :     DELETEZ(pDrawActual);
     154             : 
     155           0 :     aViewData.KillEditView();           // solange GridWin's noch existieren
     156             : 
     157           0 :     if (pDrawView)
     158             :     {
     159           0 :         for (i=0; i<4; i++)
     160           0 :             if (pGridWin[i])
     161             :             {
     162           0 :                 pDrawView->VCRemoveWin(pGridWin[i]);
     163           0 :                 pDrawView->DeleteWindowFromPaintView(pGridWin[i]);
     164             :             }
     165             : 
     166           0 :         pDrawView->HideSdrPage();
     167           0 :         delete pDrawView;
     168             :     }
     169             : 
     170           0 :     delete pSelEngine;
     171             : 
     172             :     // Delete this before the grid windows, since its a child window of one of them.
     173           0 :     mpInputHintWindow.reset();
     174           0 :     for (i=0; i<4; i++)
     175           0 :         delete pGridWin[i];
     176             : 
     177           0 :     delete pHdrSelEng;
     178             : 
     179           0 :     for (i=0; i<2; i++)
     180             :     {
     181           0 :         delete pColBar[i];
     182           0 :         delete pRowBar[i];
     183           0 :         delete pColOutline[i];
     184           0 :         delete pRowOutline[i];
     185             :     }
     186             : 
     187           0 :     delete pHSplitter;
     188           0 :     delete pVSplitter;
     189             : 
     190           0 :     delete pTabControl;
     191           0 : }
     192             : 
     193           0 : void ScTabView::MakeDrawView( sal_uInt8 nForceDesignMode )
     194             : {
     195           0 :     if (!pDrawView)
     196             :     {
     197           0 :         ScDrawLayer* pLayer = aViewData.GetDocument()->GetDrawLayer();
     198             :         OSL_ENSURE(pLayer, "wo ist der Draw Layer ??");
     199             : 
     200             :         sal_uInt16 i;
     201           0 :         pDrawView = new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT], &aViewData );
     202           0 :         for (i=0; i<4; i++)
     203           0 :             if (pGridWin[i])
     204             :             {
     205           0 :                 if ( SC_SPLIT_BOTTOMLEFT != (ScSplitPos)i )
     206           0 :                     pDrawView->AddWindowToPaintView(pGridWin[i]);
     207           0 :                 pDrawView->VCAddWin(pGridWin[i]);
     208             :             }
     209           0 :         pDrawView->RecalcScale();
     210           0 :         for (i=0; i<4; i++)
     211           0 :             if (pGridWin[i])
     212             :             {
     213           0 :                 pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
     214             : 
     215           0 :                 pGridWin[i]->Update();      // wegen Invalidate im DrawView ctor (ShowPage),
     216             :                                             // damit gleich gezeichnet werden kann
     217             :             }
     218           0 :         SfxRequest aSfxRequest(SID_OBJECT_SELECT, 0,aViewData.GetViewShell()->GetPool());
     219           0 :         SetDrawFuncPtr(new FuSelection( aViewData.GetViewShell(), GetActiveWin(), pDrawView,
     220           0 :                                         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           0 :         if ( nForceDesignMode != SC_FORCEMODE_NONE )
     225           0 :             pDrawView->SetDesignMode( (sal_Bool)nForceDesignMode );
     226             : 
     227             :         //  an der FormShell anmelden
     228           0 :         FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell();
     229           0 :         if (pFormSh)
     230           0 :             pFormSh->SetView(pDrawView);
     231             : 
     232           0 :         if (aViewData.GetViewShell()->HasAccessibilityObjects())
     233           0 :             aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_MAKEDRAWLAYER));
     234             : 
     235             :     }
     236           0 : }
     237             : 
     238           0 : void ScTabView::DoAddWin( ScGridWindow* pWin )
     239             : {
     240           0 :     if (pDrawView)
     241             :     {
     242           0 :         pDrawView->AddWindowToPaintView(pWin);
     243           0 :         pDrawView->VCAddWin(pWin);
     244             : 
     245             :         // #114409#
     246           0 :         pWin->DrawLayerCreated();
     247             :     }
     248           0 : }
     249             : 
     250             : //==================================================================
     251             : 
     252           0 : void ScTabView::TabChanged( bool bSameTabButMoved )
     253             : {
     254           0 :     if (pDrawView)
     255             :     {
     256           0 :         DrawDeselectAll();      // beendet auch Text-Edit-Modus
     257             : 
     258             :         sal_uInt16 i;
     259           0 :         for (i=0; i<4; i++)
     260           0 :             if (pGridWin[i])
     261           0 :                 pDrawView->VCRemoveWin(pGridWin[i]);    // fuer alte Page
     262             : 
     263           0 :         SCTAB nTab = aViewData.GetTabNo();
     264           0 :         pDrawView->HideSdrPage();
     265           0 :         pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
     266             : 
     267           0 :         UpdateLayerLocks();
     268             : 
     269           0 :         pDrawView->RecalcScale();
     270           0 :         pDrawView->UpdateWorkArea();    // PageSize ist pro Page unterschiedlich
     271             : 
     272           0 :         for (i=0; i<4; i++)
     273           0 :             if (pGridWin[i])
     274           0 :                 pDrawView->VCAddWin(pGridWin[i]);       // fuer neue Page
     275             :     }
     276             : 
     277           0 :     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           0 :     rBindings.InvalidateAll(false);
     282             : 
     283           0 :     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           0 :     SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
     291           0 :     if (pViewFrame)
     292             :     {
     293           0 :         uno::Reference<frame::XController> xController = pViewFrame->GetFrame().GetController();
     294           0 :         if (xController.is())
     295             :         {
     296           0 :             ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
     297           0 :             if (pImp)
     298           0 :                 pImp->SheetChanged( bSameTabButMoved );
     299           0 :         }
     300             :     }
     301           0 : }
     302             : 
     303           0 : void ScTabView::UpdateLayerLocks()
     304             : {
     305           0 :     if (pDrawView)
     306             :     {
     307           0 :         SCTAB nTab = aViewData.GetTabNo();
     308           0 :         sal_Bool bEx = aViewData.GetViewShell()->IsDrawSelMode();
     309           0 :         sal_Bool bProt = aViewData.GetDocument()->IsTabProtected( nTab ) ||
     310           0 :                      aViewData.GetSfxDocShell()->IsReadOnly();
     311           0 :         sal_Bool bShared = aViewData.GetDocShell()->IsDocShared();
     312             : 
     313             :         SdrLayer* pLayer;
     314           0 :         SdrLayerAdmin& rAdmin = pDrawView->GetModel()->GetLayerAdmin();
     315           0 :         pLayer = rAdmin.GetLayerPerID(SC_LAYER_BACK);
     316           0 :         if (pLayer)
     317           0 :             pDrawView->SetLayerLocked( pLayer->GetName(), bProt || !bEx || bShared );
     318           0 :         pLayer = rAdmin.GetLayerPerID(SC_LAYER_INTERN);
     319           0 :         if (pLayer)
     320           0 :             pDrawView->SetLayerLocked( pLayer->GetName(), sal_True );
     321           0 :         pLayer = rAdmin.GetLayerPerID(SC_LAYER_FRONT);
     322           0 :         if (pLayer)
     323           0 :             pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
     324           0 :         pLayer = rAdmin.GetLayerPerID(SC_LAYER_CONTROLS);
     325           0 :         if (pLayer)
     326           0 :             pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
     327           0 :         pLayer = rAdmin.GetLayerPerID(SC_LAYER_HIDDEN);
     328           0 :         if (pLayer)
     329             :         {
     330           0 :             pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
     331           0 :             pDrawView->SetLayerVisible( pLayer->GetName(), false);
     332             :         }
     333             :     }
     334           0 : }
     335             : 
     336           0 : void ScTabView::DrawDeselectAll()
     337             : {
     338           0 :     if (pDrawView)
     339             :     {
     340           0 :         ScTabViewShell* pViewSh = aViewData.GetViewShell();
     341           0 :         if ( pDrawActual &&
     342           0 :             ( 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           0 :         pDrawView->ScEndTextEdit();
     350           0 :         pDrawView->UnmarkAll();
     351             : 
     352           0 :         if (!pViewSh->IsDrawSelMode())
     353           0 :             pViewSh->SetDrawShell( false );
     354             :     }
     355           0 : }
     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           0 : SvxZoomType ScTabView::GetZoomType() const
     366             : {
     367           0 :     return aViewData.GetZoomType();
     368             : }
     369             : 
     370           0 : void ScTabView::SetZoomType( SvxZoomType eNew, bool bAll )
     371             : {
     372           0 :     aViewData.SetZoomType( eNew, bAll );
     373           0 : }
     374             : 
     375           0 : void ScTabView::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll )
     376             : {
     377           0 :     aViewData.SetZoom( rNewX, rNewY, bAll );
     378           0 :     if (pDrawView)
     379           0 :         pDrawView->RecalcScale();
     380           0 :     ZoomChanged();              // einzeln wegen CLOOKs
     381           0 : }
     382             : 
     383           0 : void ScTabView::RefreshZoom()
     384             : {
     385           0 :     aViewData.RefreshZoom();
     386           0 :     if (pDrawView)
     387           0 :         pDrawView->RecalcScale();
     388           0 :     ZoomChanged();
     389           0 : }
     390             : 
     391           0 : void ScTabView::SetPagebreakMode( bool bSet )
     392             : {
     393           0 :     aViewData.SetPagebreakMode(bSet);
     394           0 :     if (pDrawView)
     395           0 :         pDrawView->RecalcScale();
     396           0 :     ZoomChanged();              // einzeln wegen CLOOKs
     397           0 : }
     398             : 
     399           0 : void ScTabView::ResetDrawDragMode()
     400             : {
     401           0 :     if (pDrawView)
     402           0 :         pDrawView->SetDragMode( SDRDRAG_MOVE );
     403           0 : }
     404             : 
     405           0 : void ScTabView::ViewOptionsHasChanged( bool bHScrollChanged, bool bGraphicsChanged )
     406             : {
     407             :     //  DrawView erzeugen, wenn Gitter angezeigt werden soll
     408           0 :     if ( !pDrawView && aViewData.GetOptions().GetGridOptions().GetGridVisible() )
     409           0 :         MakeDrawLayer();
     410             : 
     411           0 :     if (pDrawView)
     412           0 :         pDrawView->UpdateUserViewOptions();
     413             : 
     414           0 :     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           0 :     bool bGrow = ( aViewData.IsTabMode() && pTabControl->GetSizePixel().Width() <= 0 );
     419             : 
     420             :     // if ScrollBar is set to visible, TabBar must make room
     421           0 :     bool bShrink = ( bHScrollChanged && aViewData.IsTabMode() && aViewData.IsHScrollMode() &&
     422           0 :                      pTabControl->GetSizePixel().Width() > SC_TABBAR_DEFWIDTH );
     423             : 
     424           0 :     if ( bGrow || bShrink )
     425             :     {
     426           0 :         Size aSize = pTabControl->GetSizePixel();
     427           0 :         aSize.Width() = SC_TABBAR_DEFWIDTH;             // initial size
     428           0 :         pTabControl->SetSizePixel(aSize);               // DoResize is called later...
     429             :     }
     430           0 : }
     431             : 
     432             : // Helper-Funktion gegen das Include des Drawing Layers
     433             : 
     434           0 : SdrView* ScTabView::GetSdrView()
     435             : {
     436           0 :     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           0 : void ScTabView::DrawEnableAnim(bool bSet)
     491             : {
     492             :     sal_uInt16 i;
     493           0 :     if ( pDrawView )
     494             :     {
     495             :         //  dont start animations if display of graphics is disabled
     496             :         //  graphics are controlled by VOBJ_TYPE_OLE
     497           0 :         if ( bSet && aViewData.GetOptions().GetObjMode(VOBJ_TYPE_OLE) == VOBJ_MODE_SHOW )
     498             :         {
     499           0 :             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           0 : }
     516             : 
     517           0 : void ScTabView::UpdateDrawTextOutliner()
     518             : {
     519           0 :     if ( pDrawView )
     520             :     {
     521           0 :         Outliner* pOL = pDrawView->GetTextEditOutliner();
     522           0 :         if (pOL)
     523           0 :             aViewData.UpdateOutlinerFlags( *pOL );
     524             :     }
     525           0 : }
     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           0 : void ScTabView::ScrollToObject( SdrObject* pDrawObj )
     538             : {
     539           0 :     if ( pDrawObj )
     540             :     {
     541             :         // #i118524# use the BoundRect, this defines the visible area
     542           0 :         MakeVisible(pDrawObj->GetCurrentBoundRect());
     543             :     }
     544           0 : }
     545             : 
     546           0 : void ScTabView::MakeVisible( const Rectangle& rHMMRect )
     547             : {
     548           0 :     Window* pWin = GetActiveWin();
     549           0 :     Size aWinSize = pWin->GetOutputSizePixel();
     550           0 :     SCTAB nTab = aViewData.GetTabNo();
     551             : 
     552           0 :     Rectangle aRect = pWin->LogicToPixel( rHMMRect );
     553             : 
     554           0 :     long nScrollX=0, nScrollY=0;        // Pixel
     555             : 
     556           0 :     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           0 :     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           0 :     if ( aRect.Left() < 0 )             // links raus
     570           0 :         nScrollX = aRect.Left();        // linker Rand sichtbar
     571           0 :     if ( aRect.Top() < 0 )              // oben raus
     572           0 :         nScrollY = aRect.Top();         // oberer Rand sichtbar
     573             : 
     574           0 :     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           0 : }
     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          15 : }
     658             : 
     659             : 
     660             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10