LCOV - code coverage report
Current view: top level - sc/source/ui/view - tabview.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 389 1274 30.5 %
Date: 2012-08-25 Functions: 28 70 40.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 264 1540 17.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <vcl/svapp.hxx>
      30                 :            : 
      31                 :            : ///////////////////////////////////////////////////////////////////////////
      32                 :            : // NODRAW.HXX
      33                 :            : // Erweiterte Konstanten, um CLOKs mit SVDRAW.HXX zu vermeiden
      34                 :            : // Die u.a. Aenderungen nehmen vorgeschlagene Konstante vorweg
      35                 :            : ///////////////////////////////////////////////////////////////////////////
      36                 :            : 
      37                 :            : ////////////////////// Umsetzen der Standard-Defines //////////////////////
      38                 :            : 
      39                 :            : #define _SVDPAGE_HXX        // SdrPage
      40                 :            : 
      41                 :            : #ifdef _SDR_NOGRAFOBJ
      42                 :            :     #undef _SDR_NOGRAFOBJ
      43                 :            :     #define _SVDOGRAF_HXX
      44                 :            : #else
      45                 :            :     #undef _SVDOTEXT_HXX
      46                 :            :     #undef _SVDORECT_HXX
      47                 :            : #endif
      48                 :            : 
      49                 :            : #ifdef _SDR_NOOLE2OBJ
      50                 :            :     #undef _SDR_NOOLE2OBJ
      51                 :            :     #define _SVDOOLE2_HXX
      52                 :            : #else
      53                 :            :     #undef _SVDOTEXT_HXX
      54                 :            :     #undef _SVDORECT_HXX
      55                 :            : #endif
      56                 :            : 
      57                 :            : ////////////////////// Ende der SVDRAW-Modifikationen /////////////////////
      58                 :            : 
      59                 :            : #include "scitems.hxx"
      60                 :            : #include <sfx2/viewfrm.hxx>
      61                 :            : #include <sfx2/bindings.hxx>
      62                 :            : #include <vcl/help.hxx>
      63                 :            : #include <rtl/logfile.hxx>
      64                 :            : 
      65                 :            : #include "tabview.hxx"
      66                 :            : #include "tabvwsh.hxx"
      67                 :            : #include "document.hxx"
      68                 :            : #include "gridwin.hxx"
      69                 :            : #include "olinewin.hxx"
      70                 :            : #include "olinetab.hxx"
      71                 :            : #include "tabsplit.hxx"
      72                 :            : #include "colrowba.hxx"
      73                 :            : #include "tabcont.hxx"
      74                 :            : #include "scmod.hxx"
      75                 :            : #include "sc.hrc"
      76                 :            : #include "viewutil.hxx"
      77                 :            : #include "globstr.hrc"
      78                 :            : #include "drawview.hxx"
      79                 :            : #include "docsh.hxx"
      80                 :            : #include "viewuno.hxx"
      81                 :            : #include "AccessibilityHints.hxx"
      82                 :            : #include "appoptio.hxx"
      83                 :            : #include "attrib.hxx"
      84                 :            : #include "hintwin.hxx"
      85                 :            : 
      86                 :            : #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
      87                 :            : 
      88                 :            : #include <string>
      89                 :            : #include <algorithm>
      90                 :            : 
      91                 :            : #include <basegfx/tools/zoomtools.hxx>
      92                 :            : 
      93                 :            : #define SPLIT_MARGIN    30
      94                 :            : #define SPLIT_HANDLE_SIZE   5
      95                 :            : #define SC_ICONSIZE     36
      96                 :            : 
      97                 :            : #define SC_SCROLLBAR_MIN    30
      98                 :            : #define SC_TABBAR_MIN       6
      99                 :            : 
     100                 :            : using namespace ::com::sun::star;
     101                 :            : 
     102                 :            : // STATIC DATA -----------------------------------------------------------
     103                 :            : 
     104                 :            : 
     105                 :            : //==================================================================
     106                 :            : 
     107                 :            : //  Corner-Button
     108                 :            : 
     109                 :        458 : ScCornerButton::ScCornerButton( Window* pParent, ScViewData* pData, bool bAdditional ) :
     110                 :            :     Window( pParent, WinBits( 0 ) ),
     111                 :            :     pViewData( pData ),
     112                 :        458 :     bAdd( bAdditional )
     113                 :            : {
     114                 :        458 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     115 [ +  - ][ +  - ]:        458 :     SetBackground( rStyleSettings.GetFaceColor() );
                 [ +  - ]
     116         [ +  - ]:        458 :     EnableRTL( false );
     117                 :        458 : }
     118                 :            : 
     119                 :        450 : ScCornerButton::~ScCornerButton()
     120                 :            : {
     121         [ -  + ]:        450 : }
     122                 :            : 
     123                 :        217 : void ScCornerButton::Paint( const Rectangle& rRect )
     124                 :            : {
     125                 :        217 :     Size aSize = GetOutputSizePixel();
     126                 :        217 :     long nPosX = aSize.Width()-1;
     127                 :        217 :     long nPosY = aSize.Height()-1;
     128                 :            : 
     129                 :        217 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     130                 :            : 
     131         [ +  - ]:        217 :     Window::Paint(rRect);
     132                 :            : 
     133 [ +  - ][ +  - ]:        217 :     bool bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
     134         [ +  + ]:        217 :     long nDarkX = bLayoutRTL ? 0 : nPosX;
     135                 :            : 
     136         [ +  - ]:        217 :     if ( !bAdd )
     137                 :            :     {
     138                 :            :         // match the shaded look of column/row headers
     139                 :            : 
     140                 :        217 :         Color aFace( rStyleSettings.GetFaceColor() );
     141                 :        217 :         Color aWhite( COL_WHITE );
     142                 :        217 :         Color aCenter( aFace );
     143         [ +  - ]:        217 :         aCenter.Merge( aWhite, 0xd0 );          // lighten up a bit
     144                 :        217 :         Color aOuter( aFace );
     145         [ +  - ]:        217 :         aOuter.Merge( aWhite, 0xa0 );           // lighten up more
     146                 :            : 
     147                 :        217 :         long nCenterX = (aSize.Width() / 2) - 1;
     148                 :        217 :         long nCenterY = (aSize.Height() / 2) - 1;
     149                 :            : 
     150         [ +  - ]:        217 :         SetLineColor();
     151         [ +  - ]:        217 :         SetFillColor(aCenter);
     152 [ +  - ][ +  - ]:        217 :         DrawRect( Rectangle( nCenterX, nCenterY, nCenterX, nPosY ) );
     153 [ +  - ][ +  - ]:        217 :         DrawRect( Rectangle( nCenterX, nCenterY, nDarkX, nCenterY ) );
     154         [ +  - ]:        217 :         SetFillColor(aOuter);
     155 [ +  - ][ +  - ]:        217 :         DrawRect( Rectangle( 0, 0, nPosX, nCenterY-1 ) );
     156         [ +  + ]:        217 :         if ( bLayoutRTL )
     157 [ +  - ][ +  - ]:          2 :             DrawRect( Rectangle( nCenterX+1, nCenterY, nPosX, nPosY ) );
     158                 :            :         else
     159 [ +  - ][ +  - ]:        217 :             DrawRect( Rectangle( 0, nCenterY, nCenterX-1, nPosY ) );
     160                 :            :     }
     161                 :            : 
     162                 :            :     //  both buttons have the same look now - only dark right/bottom lines
     163         [ +  - ]:        217 :     SetLineColor( rStyleSettings.GetDarkShadowColor() );
     164         [ +  - ]:        217 :     DrawLine( Point(0,nPosY), Point(nPosX,nPosY) );
     165         [ +  - ]:        217 :     DrawLine( Point(nDarkX,0), Point(nDarkX,nPosY) );
     166                 :        217 : }
     167                 :            : 
     168                 :        932 : void ScCornerButton::StateChanged( StateChangedType nType )
     169                 :            : {
     170                 :        932 :     Window::StateChanged( nType );
     171                 :            : 
     172                 :        932 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     173         [ +  - ]:        932 :     SetBackground( rStyleSettings.GetFaceColor() );
     174                 :        932 :     Invalidate();
     175                 :        932 : }
     176                 :            : 
     177                 :            : // -----------------------------------------------------------------------
     178                 :            : 
     179                 :          0 : void ScCornerButton::DataChanged( const DataChangedEvent& rDCEvt )
     180                 :            : {
     181                 :          0 :     Window::DataChanged( rDCEvt );
     182                 :            : 
     183                 :          0 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     184         [ #  # ]:          0 :     SetBackground( rStyleSettings.GetFaceColor() );
     185                 :          0 :     Invalidate();
     186                 :          0 : }
     187                 :            : 
     188                 :            : 
     189                 :        458 : void ScCornerButton::Resize()
     190                 :            : {
     191                 :        458 :     Invalidate();
     192                 :        458 : }
     193                 :            : 
     194                 :          0 : void ScCornerButton::MouseButtonDown( const MouseEvent& rMEvt )
     195                 :            : {
     196                 :          0 :     ScModule* pScMod = SC_MOD();
     197 [ #  # ][ #  # ]:          0 :     bool bDisable = pScMod->IsFormulaMode() || pScMod->IsModalMode();
     198         [ #  # ]:          0 :     if (!bDisable)
     199                 :            :     {
     200                 :          0 :         ScTabViewShell* pViewSh = pViewData->GetViewShell();
     201                 :          0 :         pViewSh->SetActive();                                   // Appear und SetViewFrame
     202                 :          0 :         pViewSh->ActiveGrabFocus();
     203                 :            : 
     204                 :          0 :         bool bControl = rMEvt.IsMod1();
     205                 :          0 :         pViewSh->SelectAll( bControl );
     206                 :            :     }
     207                 :          0 : }
     208                 :            : 
     209                 :            : //==================================================================
     210                 :            : 
     211                 :       3043 : bool lcl_HasColOutline( const ScViewData& rViewData )
     212                 :            : {
     213                 :       3043 :     const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
     214         [ +  + ]:       3043 :     if (pTable)
     215                 :            :     {
     216                 :         96 :         const ScOutlineArray* pArray = pTable->GetColArray();
     217         [ -  + ]:         96 :         if ( pArray->GetDepth() > 0 )
     218                 :          0 :             return true;
     219                 :            :     }
     220                 :       3043 :     return false;
     221                 :            : }
     222                 :            : 
     223                 :       3043 : bool lcl_HasRowOutline( const ScViewData& rViewData )
     224                 :            : {
     225                 :       3043 :     const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
     226         [ +  + ]:       3043 :     if (pTable)
     227                 :            :     {
     228                 :         96 :         const ScOutlineArray* pArray = pTable->GetRowArray();
     229         [ +  + ]:         96 :         if ( pArray->GetDepth() > 0 )
     230                 :          4 :             return true;
     231                 :            :     }
     232                 :       3043 :     return false;
     233                 :            : }
     234                 :            : 
     235                 :        229 : ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
     236                 :            :     pFrameWin( pParent ),
     237                 :            :     aViewData( &rDocSh, pViewShell ),
     238                 :            :     pSelEngine( NULL ),
     239                 :            :     aFunctionSet( &aViewData ),
     240                 :            :     pHdrSelEng( NULL ),
     241                 :            :     aHdrFunc( &aViewData ),
     242                 :            :     pDrawView( NULL ),
     243                 :            :     aVScrollTop( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ),
     244                 :            :     aVScrollBottom( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ),
     245                 :            :     aHScrollLeft( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ),
     246                 :            :     aHScrollRight( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ),
     247                 :            :     aCornerButton( pFrameWin, &aViewData, false ),
     248                 :            :     aTopButton( pFrameWin, &aViewData, sal_True ),
     249                 :            :     aScrollBarBox( pFrameWin, WB_SIZEABLE ),
     250                 :            :     mpInputHintWindow( NULL ),
     251                 :            :     pPageBreakData( NULL ),
     252                 :            :     pBrushDocument( NULL ),
     253                 :            :     pDrawBrushSet( NULL ),
     254                 :            :     pTimerWindow( NULL ),
     255                 :            :     nTipVisible( 0 ),
     256                 :            :     meBlockMode(None),
     257                 :            :     mfPendingTabBarWidth( -1.0 ),
     258                 :            :     bMinimized( false ),
     259                 :            :     bInUpdateHeader( false ),
     260                 :            :     bInActivatePart( false ),
     261                 :            :     bInZoomUpdate( false ),
     262                 :            :     bMoveIsShift( false ),
     263                 :            :     bDrawSelMode( false ),
     264                 :            :     bLockPaintBrush( false ),
     265                 :            :     bDragging( false ),
     266                 :            :     bBlockNeg( false ),
     267                 :            :     bBlockCols( false ),
     268 [ +  - ][ +  - ]:        229 :     bBlockRows( false )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     269                 :            : {
     270                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" );
     271                 :            : 
     272         [ +  - ]:        229 :     Init();
     273                 :        229 : }
     274                 :            : 
     275                 :            : 
     276                 :        916 : void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal )
     277                 :            : {
     278         [ +  - ]:        916 :     rScrollBar.SetRange( Range( 0, nMaxVal ) );
     279                 :        916 :     rScrollBar.SetLineSize( 1 );
     280                 :        916 :     rScrollBar.SetPageSize( 1 );                // wird getrennt abgefragt
     281                 :        916 :     rScrollBar.SetVisibleSize( 10 );            // wird bei Resize neu gesetzt
     282                 :            : 
     283                 :        916 :     rScrollBar.SetScrollHdl( LINK(this, ScTabView, ScrollHdl) );
     284                 :        916 :     rScrollBar.SetEndScrollHdl( LINK(this, ScTabView, EndScrollHdl) );
     285                 :        916 : }
     286                 :            : 
     287                 :            : //  Scroll-Timer
     288                 :            : 
     289                 :          0 : void ScTabView::SetTimer( ScGridWindow* pWin, const MouseEvent& rMEvt )
     290                 :            : {
     291                 :          0 :     pTimerWindow = pWin;
     292                 :          0 :     aTimerMEvt   = rMEvt;
     293                 :          0 :     aScrollTimer.Start();
     294                 :          0 : }
     295                 :            : 
     296                 :          0 : void ScTabView::ResetTimer()
     297                 :            : {
     298                 :          0 :     aScrollTimer.Stop();
     299                 :          0 :     pTimerWindow = NULL;
     300                 :          0 : }
     301                 :            : 
     302                 :          0 : IMPL_LINK_NOARG(ScTabView, TimerHdl)
     303                 :            : {
     304         [ #  # ]:          0 :     if (pTimerWindow)
     305                 :          0 :         pTimerWindow->MouseMove( aTimerMEvt );
     306                 :            : 
     307                 :          0 :     return 0;
     308                 :            : }
     309                 :            : 
     310                 :            : // --- Resize ---------------------------------------------------------------------
     311                 :            : 
     312                 :       8186 : void lcl_SetPosSize( Window& rWindow, const Point& rPos, const Size& rSize,
     313                 :            :                         long nTotalWidth, bool bLayoutRTL )
     314                 :            : {
     315                 :       8186 :     Point aNewPos = rPos;
     316         [ +  + ]:       8186 :     if ( bLayoutRTL )
     317                 :            :     {
     318                 :         24 :         aNewPos.X() = nTotalWidth - rPos.X() - rSize.Width();
     319 [ -  + ][ #  # ]:         24 :         if ( aNewPos == rWindow.GetPosPixel() && rSize.Width() != rWindow.GetSizePixel().Width() )
         [ #  # ][ -  + ]
         [ +  - ][ -  +  
             #  #  #  # ]
                 [ +  - ]
     320                 :            :         {
     321                 :            :             //  Document windows are manually painted right-to-left, so they need to
     322                 :            :             //  be repainted if the size changes.
     323         [ #  # ]:          0 :             rWindow.Invalidate();
     324                 :            :         }
     325                 :            :     }
     326         [ +  - ]:       8186 :     rWindow.SetPosSizePixel( aNewPos, rSize );
     327                 :       8186 : }
     328                 :            : 
     329                 :       1076 : void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
     330                 :            : {
     331                 :       1076 :     HideListBox();
     332                 :            : 
     333                 :       1076 :     bool bHasHint = HasHintWindow();
     334         [ -  + ]:       1076 :     if (bHasHint)
     335                 :          0 :         RemoveHintWindow();
     336                 :            : 
     337                 :       1076 :     bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
     338                 :       1076 :     long nTotalWidth = rSize.Width();
     339         [ +  + ]:       1076 :     if ( bLayoutRTL )
     340                 :          2 :         nTotalWidth += 2*rOffset.X();
     341                 :            : 
     342                 :       1076 :     bool bVScroll    = aViewData.IsVScrollMode();
     343                 :       1076 :     bool bHScroll    = aViewData.IsHScrollMode();
     344                 :       1076 :     bool bTabControl = aViewData.IsTabMode();
     345                 :       1076 :     bool bHeaders    = aViewData.IsHeaderMode();
     346                 :       1076 :     bool bOutlMode   = aViewData.IsOutlineMode();
     347 [ -  + ][ +  - ]:       1076 :     bool bHOutline   = bOutlMode && lcl_HasColOutline(aViewData);
     348 [ +  - ][ +  + ]:       1076 :     bool bVOutline   = bOutlMode && lcl_HasRowOutline(aViewData);
     349                 :            : 
     350         [ -  + ]:       1076 :     if ( aViewData.GetDocShell()->IsPreview() )
     351                 :          0 :         bHScroll = bVScroll = bTabControl = bHeaders = bOutlMode = bHOutline = bVOutline = false;
     352                 :            : 
     353                 :       1076 :     long nBarX = 0;
     354                 :       1076 :     long nBarY = 0;
     355                 :       1076 :     long nOutlineX = 0;
     356                 :       1076 :     long nOutlineY = 0;
     357                 :            :     long nOutPosX;
     358                 :            :     long nOutPosY;
     359                 :            : 
     360                 :       1076 :     long nPosX = rOffset.X();
     361                 :       1076 :     long nPosY = rOffset.Y();
     362                 :       1076 :     long nSizeX = rSize.Width();
     363                 :       1076 :     long nSizeY = rSize.Height();
     364                 :            : 
     365 [ -  + ][ +  + ]:       1076 :     bMinimized = ( nSizeX<=SC_ICONSIZE || nSizeY<=SC_ICONSIZE );
     366         [ +  + ]:       1076 :     if ( bMinimized )
     367                 :       1076 :         return;
     368                 :            : 
     369                 :        682 :     long nSplitSizeX = SPLIT_HANDLE_SIZE;
     370         [ -  + ]:        682 :     if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
     371                 :          0 :         nSplitSizeX = 1;
     372                 :        682 :     long nSplitSizeY = SPLIT_HANDLE_SIZE;
     373         [ -  + ]:        682 :     if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
     374                 :          0 :         nSplitSizeY = 1;
     375                 :            : 
     376                 :        682 :     const long nOverlap = 0;    // ScrollBar::GetWindowOverlapPixel();
     377                 :            : 
     378                 :        682 :     aBorderPos = rOffset;
     379                 :        682 :     aFrameSize = rSize;
     380                 :            : 
     381         [ -  + ]:        682 :     if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
     382         [ #  # ]:          0 :         if ( aViewData.GetHSplitPos() > nSizeX - SPLIT_MARGIN )
     383                 :            :         {
     384                 :          0 :             aViewData.SetHSplitMode( SC_SPLIT_NONE );
     385         [ #  # ]:          0 :             if ( WhichH( aViewData.GetActivePart() ) == SC_SPLIT_RIGHT )
     386                 :          0 :                 ActivatePart( SC_SPLIT_BOTTOMLEFT );
     387                 :          0 :             InvalidateSplit();
     388                 :            :         }
     389         [ -  + ]:        682 :     if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
     390         [ #  # ]:          0 :         if ( aViewData.GetVSplitPos() > nSizeY - SPLIT_MARGIN )
     391                 :            :         {
     392                 :          0 :             aViewData.SetVSplitMode( SC_SPLIT_NONE );
     393         [ #  # ]:          0 :             if ( WhichV( aViewData.GetActivePart() ) == SC_SPLIT_TOP )
     394                 :          0 :                 ActivatePart( SC_SPLIT_BOTTOMLEFT );
     395                 :          0 :             InvalidateSplit();
     396                 :            :         }
     397                 :            : 
     398                 :        682 :     UpdateShow();
     399                 :            : 
     400 [ #  # ][ -  + ]:        682 :     if (bHScroll || bVScroll)       // Scrollbars horizontal oder vertikal
     401                 :            :     {
     402                 :        682 :         long nScrollBarSize = pFrameWin->GetSettings().GetStyleSettings().GetScrollBarSize();
     403         [ +  - ]:        682 :         if (bVScroll)
     404                 :            :         {
     405                 :        682 :             nBarX = nScrollBarSize;
     406                 :        682 :             nSizeX -= nBarX - nOverlap;
     407                 :            :         }
     408         [ +  - ]:        682 :         if (bHScroll)
     409                 :            :         {
     410                 :        682 :             nBarY = nScrollBarSize;
     411                 :        682 :             nSizeY -= nBarY - nOverlap;
     412                 :            :         }
     413                 :            : 
     414                 :            :         //  window at the bottom right
     415                 :            :         lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ),
     416         [ +  - ]:        682 :                         nTotalWidth, bLayoutRTL );
     417                 :            : 
     418         [ +  - ]:        682 :         if (bHScroll)                               // Scrollbars horizontal
     419                 :            :         {
     420                 :        682 :             long nSizeLt = 0;       // left scroll bar
     421                 :        682 :             long nSizeRt = 0;       // right scroll bar
     422                 :        682 :             long nSizeSp = 0;       // splitter
     423                 :            : 
     424   [ +  -  -  - ]:        682 :             switch (aViewData.GetHSplitMode())
     425                 :            :             {
     426                 :            :                 case SC_SPLIT_NONE:
     427                 :        682 :                     nSizeSp = nSplitSizeX;
     428                 :        682 :                     nSizeLt = nSizeX - nSizeSp + nOverlap;          // Ecke ueberdecken
     429                 :        682 :                     break;
     430                 :            :                 case SC_SPLIT_NORMAL:
     431                 :          0 :                     nSizeSp = nSplitSizeX;
     432                 :          0 :                     nSizeLt = aViewData.GetHSplitPos();
     433                 :          0 :                     break;
     434                 :            :                 case SC_SPLIT_FIX:
     435                 :          0 :                     nSizeSp = 0;
     436                 :          0 :                     nSizeLt = 0;
     437                 :          0 :                     break;
     438                 :            :             }
     439                 :        682 :             nSizeRt = nSizeX - nSizeLt - nSizeSp;
     440                 :            : 
     441                 :        682 :             long nTabSize = 0;
     442         [ +  - ]:        682 :             if (bTabControl)
     443                 :            :             {
     444                 :            :                 // pending relative tab bar width from extended document options
     445         [ +  + ]:        682 :                 if( mfPendingTabBarWidth >= 0.0 )
     446                 :            :                 {
     447                 :          4 :                     SetRelTabBarWidth( mfPendingTabBarWidth );
     448                 :          4 :                     mfPendingTabBarWidth = -1.0;
     449                 :            :                 }
     450                 :            : 
     451                 :        682 :                 nTabSize = pTabControl->GetSizePixel().Width()-nOverlap;
     452                 :            : 
     453         [ +  - ]:        682 :                 if ( aViewData.GetHSplitMode() != SC_SPLIT_FIX )    // bei linkem Scrollbar
     454                 :            :                 {
     455         [ -  + ]:        682 :                     if (nTabSize > nSizeLt-SC_SCROLLBAR_MIN) nTabSize = nSizeLt-SC_SCROLLBAR_MIN;
     456         [ -  + ]:        682 :                     if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN;
     457                 :        682 :                     nSizeLt -= nTabSize;
     458                 :            :                 }
     459                 :            :                 else                                                // bei rechtem Scrollbar
     460                 :            :                 {
     461         [ #  # ]:          0 :                     if (nTabSize > nSizeRt-SC_SCROLLBAR_MIN) nTabSize = nSizeRt-SC_SCROLLBAR_MIN;
     462         [ #  # ]:          0 :                     if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN;
     463                 :          0 :                     nSizeRt -= nTabSize;
     464                 :            :                 }
     465                 :            :             }
     466                 :            : 
     467                 :            :             lcl_SetPosSize( *pTabControl, Point(nPosX-nOverlap, nPosY+nSizeY),
     468         [ +  - ]:        682 :                                                 Size(nTabSize+nOverlap, nBarY), nTotalWidth, bLayoutRTL );
     469                 :        682 :             pTabControl->SetSheetLayoutRTL( bLayoutRTL );
     470                 :            : 
     471                 :            :             lcl_SetPosSize( aHScrollLeft, Point(nPosX+nTabSize-nOverlap, nPosY+nSizeY),
     472         [ +  - ]:        682 :                                                 Size(nSizeLt+2*nOverlap, nBarY), nTotalWidth, bLayoutRTL );
     473                 :            :             lcl_SetPosSize( *pHSplitter, Point( nPosX+nTabSize+nSizeLt, nPosY+nSizeY ),
     474         [ +  - ]:        682 :                                             Size( nSizeSp, nBarY ), nTotalWidth, bLayoutRTL );
     475                 :            :             lcl_SetPosSize( aHScrollRight, Point(nPosX+nTabSize+nSizeLt+nSizeSp-nOverlap,
     476                 :            :                                                     nPosY+nSizeY),
     477         [ +  - ]:        682 :                                             Size(nSizeRt+2*nOverlap, nBarY), nTotalWidth, bLayoutRTL );
     478                 :            : 
     479                 :            :             //  SetDragRectPixel is done below
     480                 :            :         }
     481                 :            : 
     482         [ +  - ]:        682 :         if (bVScroll)                               // Scrollbars vertikal
     483                 :            :         {
     484                 :        682 :             long nSizeUp = 0;       // upper scroll bar
     485                 :        682 :             long nSizeSp = 0;       // splitter
     486                 :            :             long nSizeDn;           // unterer Scrollbar
     487                 :            : 
     488   [ +  -  -  - ]:        682 :             switch (aViewData.GetVSplitMode())
     489                 :            :             {
     490                 :            :                 case SC_SPLIT_NONE:
     491                 :        682 :                     nSizeUp = 0;
     492                 :        682 :                     nSizeSp = nSplitSizeY;
     493                 :        682 :                     break;
     494                 :            :                 case SC_SPLIT_NORMAL:
     495                 :          0 :                     nSizeUp = aViewData.GetVSplitPos();
     496                 :          0 :                     nSizeSp = nSplitSizeY;
     497                 :          0 :                     break;
     498                 :            :                 case SC_SPLIT_FIX:
     499                 :          0 :                     nSizeUp = 0;
     500                 :          0 :                     nSizeSp = 0;
     501                 :          0 :                     break;
     502                 :            :             }
     503                 :        682 :             nSizeDn = nSizeY - nSizeUp - nSizeSp;
     504                 :            : 
     505                 :            :             lcl_SetPosSize( aVScrollTop, Point(nPosX+nSizeX, nPosY-nOverlap),
     506         [ +  - ]:        682 :                                             Size(nBarX,nSizeUp+2*nOverlap), nTotalWidth, bLayoutRTL );
     507                 :            :             lcl_SetPosSize( *pVSplitter, Point( nPosX+nSizeX, nPosY+nSizeUp ),
     508         [ +  - ]:        682 :                                             Size( nBarX, nSizeSp ), nTotalWidth, bLayoutRTL );
     509                 :            :             lcl_SetPosSize( aVScrollBottom, Point(nPosX+nSizeX,
     510                 :            :                                                 nPosY+nSizeUp+nSizeSp-nOverlap),
     511         [ +  - ]:        682 :                                             Size(nBarX, nSizeDn+2*nOverlap), nTotalWidth, bLayoutRTL );
     512                 :            : 
     513                 :            :             //  SetDragRectPixel is done below
     514                 :            :         }
     515                 :            :     }
     516                 :            : 
     517                 :            :     //  SetDragRectPixel auch ohne Scrollbars etc., wenn schon gesplittet ist
     518 [ -  + ][ #  # ]:        682 :     if ( bHScroll || aViewData.GetHSplitMode() != SC_SPLIT_NONE )
                 [ +  - ]
     519                 :            :         pHSplitter->SetDragRectPixel(
     520         [ +  - ]:        682 :             Rectangle( nPosX, nPosY, nPosX+nSizeX, nPosY+nSizeY ), pFrameWin );
     521 [ -  + ][ #  # ]:        682 :     if ( bVScroll || aViewData.GetVSplitMode() != SC_SPLIT_NONE )
                 [ +  - ]
     522                 :            :         pVSplitter->SetDragRectPixel(
     523         [ +  - ]:        682 :             Rectangle( nPosX, nPosY, nPosX+nSizeX, nPosY+nSizeY ), pFrameWin );
     524                 :            : 
     525 [ +  - ][ -  + ]:        682 :     if (bTabControl && ! bHScroll )
     526                 :            :     {
     527                 :          0 :         nBarY = aHScrollLeft.GetSizePixel().Height();
     528                 :          0 :         nBarX = aVScrollBottom.GetSizePixel().Width();
     529                 :            : 
     530                 :          0 :         long nSize1 = nSizeX + nOverlap;
     531                 :            : 
     532                 :          0 :         long nTabSize = nSize1;
     533         [ #  # ]:          0 :         if (nTabSize < 0) nTabSize = 0;
     534                 :            : 
     535                 :            :         lcl_SetPosSize( *pTabControl, Point(nPosX-nOverlap, nPosY+nSizeY-nBarY),
     536         [ #  # ]:          0 :                                         Size(nTabSize+nOverlap, nBarY), nTotalWidth, bLayoutRTL );
     537                 :          0 :         nSizeY -= nBarY - nOverlap;
     538                 :            :         lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ),
     539         [ #  # ]:          0 :                                         nTotalWidth, bLayoutRTL );
     540                 :            : 
     541         [ #  # ]:          0 :         if( bVScroll )
     542                 :            :         {
     543         [ #  # ]:          0 :             Size aVScrSize = aVScrollBottom.GetSizePixel();
     544                 :          0 :             aVScrSize.Height() -= nBarY;
     545         [ #  # ]:          0 :             aVScrollBottom.SetSizePixel( aVScrSize );
     546                 :            :         }
     547                 :            :     }
     548                 :            : 
     549                 :        682 :     nOutPosX = nPosX;
     550                 :        682 :     nOutPosY = nPosY;
     551                 :            : 
     552                 :            :     // Outline-Controls
     553 [ +  + ][ +  - ]:        682 :     if (bVOutline && pRowOutline[SC_SPLIT_BOTTOM])
     554                 :            :     {
     555                 :          2 :         nOutlineX = pRowOutline[SC_SPLIT_BOTTOM]->GetDepthSize();
     556                 :          2 :         nSizeX -= nOutlineX;
     557                 :          2 :         nPosX += nOutlineX;
     558                 :            :     }
     559 [ -  + ][ #  # ]:        682 :     if (bHOutline && pColOutline[SC_SPLIT_LEFT])
     560                 :            :     {
     561                 :          0 :         nOutlineY = pColOutline[SC_SPLIT_LEFT]->GetDepthSize();
     562                 :          0 :         nSizeY -= nOutlineY;
     563                 :          0 :         nPosY += nOutlineY;
     564                 :            :     }
     565                 :            : 
     566         [ +  - ]:        682 :     if (bHeaders)                               // Spalten/Zeilen-Header
     567                 :            :     {
     568                 :        682 :         nBarX = pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
     569                 :        682 :         nBarY = pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
     570                 :        682 :         nSizeX -= nBarX;
     571                 :        682 :         nSizeY -= nBarY;
     572                 :        682 :         nPosX += nBarX;
     573                 :        682 :         nPosY += nBarY;
     574                 :            :     }
     575                 :            :     else
     576                 :          0 :         nBarX = nBarY = 0;
     577                 :            : 
     578                 :            :         //
     579                 :            :         //      Splitter auswerten
     580                 :            :         //
     581                 :            : 
     582                 :        682 :     long nLeftSize   = nSizeX;
     583                 :        682 :     long nRightSize  = 0;
     584                 :        682 :     long nTopSize    = 0;
     585                 :        682 :     long nBottomSize = nSizeY;
     586                 :        682 :     long nSplitPosX  = nPosX;
     587                 :        682 :     long nSplitPosY  = nPosY;
     588                 :            : 
     589         [ -  + ]:        682 :     if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
     590                 :            :     {
     591                 :          0 :         long nSplitHeight = rSize.Height();
     592         [ #  # ]:          0 :         if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
     593                 :            :         {
     594                 :            :             //  Fixier-Splitter nicht mit Scrollbar/TabBar ueberlappen lassen
     595         [ #  # ]:          0 :             if ( bHScroll )
     596                 :          0 :                 nSplitHeight -= aHScrollLeft.GetSizePixel().Height();
     597 [ #  # ][ #  # ]:          0 :             else if ( bTabControl && pTabControl )
     598                 :          0 :                 nSplitHeight -= pTabControl->GetSizePixel().Height();
     599                 :            :         }
     600                 :          0 :         nSplitPosX = aViewData.GetHSplitPos();
     601                 :            :         lcl_SetPosSize( *pHSplitter,
     602         [ #  # ]:          0 :             Point( nSplitPosX, nOutPosY ), Size( nSplitSizeX, nSplitHeight ), nTotalWidth, bLayoutRTL );
     603                 :          0 :         nLeftSize = nSplitPosX - nPosX;
     604                 :          0 :         nSplitPosX += nSplitSizeX;
     605                 :          0 :         nRightSize = nSizeX - nLeftSize - nSplitSizeX;
     606                 :            :     }
     607         [ -  + ]:        682 :     if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
     608                 :            :     {
     609                 :          0 :         long nSplitWidth = rSize.Width();
     610 [ #  # ][ #  # ]:          0 :         if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX && bVScroll )
                 [ #  # ]
     611                 :          0 :             nSplitWidth -= aVScrollBottom.GetSizePixel().Width();
     612                 :          0 :         nSplitPosY = aViewData.GetVSplitPos();
     613                 :            :         lcl_SetPosSize( *pVSplitter,
     614         [ #  # ]:          0 :             Point( nOutPosX, nSplitPosY ), Size( nSplitWidth, nSplitSizeY ), nTotalWidth, bLayoutRTL );
     615                 :          0 :         nTopSize = nSplitPosY - nPosY;
     616                 :          0 :         nSplitPosY += nSplitSizeY;
     617                 :          0 :         nBottomSize = nSizeY - nTopSize - nSplitSizeY;
     618                 :            :     }
     619                 :            : 
     620                 :            :     //  ShowHide fuer pColOutline / pRowOutline passiert in UpdateShow
     621                 :            : 
     622         [ -  + ]:        682 :     if (bHOutline)                              // Outline-Controls
     623                 :            :     {
     624         [ #  # ]:          0 :         if (pColOutline[SC_SPLIT_LEFT])
     625                 :            :         {
     626                 :          0 :             pColOutline[SC_SPLIT_LEFT]->SetHeaderSize( nBarX );
     627                 :          0 :             lcl_SetPosSize( *pColOutline[SC_SPLIT_LEFT],
     628         [ #  # ]:          0 :                     Point(nPosX-nBarX,nOutPosY), Size(nLeftSize+nBarX,nOutlineY), nTotalWidth, bLayoutRTL );
     629                 :            :         }
     630         [ #  # ]:          0 :         if (pColOutline[SC_SPLIT_RIGHT])
     631                 :            :         {
     632                 :          0 :             pColOutline[SC_SPLIT_RIGHT]->SetHeaderSize( 0 );    // always call to update RTL flag
     633                 :          0 :             lcl_SetPosSize( *pColOutline[SC_SPLIT_RIGHT],
     634         [ #  # ]:          0 :                     Point(nSplitPosX,nOutPosY), Size(nRightSize,nOutlineY), nTotalWidth, bLayoutRTL );
     635                 :            :         }
     636                 :            :     }
     637         [ +  + ]:        682 :     if (bVOutline)
     638                 :            :     {
     639         [ -  + ]:          2 :         if (nTopSize)
     640                 :            :         {
     641 [ #  # ][ #  # ]:          0 :             if (pRowOutline[SC_SPLIT_TOP] && pRowOutline[SC_SPLIT_BOTTOM])
     642                 :            :             {
     643                 :          0 :                 pRowOutline[SC_SPLIT_TOP]->SetHeaderSize( nBarY );
     644                 :          0 :                 lcl_SetPosSize( *pRowOutline[SC_SPLIT_TOP],
     645         [ #  # ]:          0 :                         Point(nOutPosX,nPosY-nBarY), Size(nOutlineX,nTopSize+nBarY), nTotalWidth, bLayoutRTL );
     646                 :          0 :                 pRowOutline[SC_SPLIT_BOTTOM]->SetHeaderSize( 0 );
     647                 :          0 :                 lcl_SetPosSize( *pRowOutline[SC_SPLIT_BOTTOM],
     648         [ #  # ]:          0 :                         Point(nOutPosX,nSplitPosY), Size(nOutlineX,nBottomSize), nTotalWidth, bLayoutRTL );
     649                 :            :             }
     650                 :            :         }
     651         [ +  - ]:          2 :         else if (pRowOutline[SC_SPLIT_BOTTOM])
     652                 :            :         {
     653                 :          2 :             pRowOutline[SC_SPLIT_BOTTOM]->SetHeaderSize( nBarY );
     654                 :          2 :             lcl_SetPosSize( *pRowOutline[SC_SPLIT_BOTTOM],
     655         [ +  - ]:          2 :                     Point(nOutPosX,nSplitPosY-nBarY), Size(nOutlineX,nBottomSize+nBarY), nTotalWidth, bLayoutRTL );
     656                 :            :         }
     657                 :            :     }
     658 [ -  + ][ #  # ]:        682 :     if (bHOutline && bVOutline)
     659                 :            :     {
     660         [ #  # ]:          0 :         lcl_SetPosSize( aTopButton, Point(nOutPosX,nOutPosY), Size(nOutlineX,nOutlineY), nTotalWidth, bLayoutRTL );
     661                 :          0 :         aTopButton.Show();
     662                 :            :     }
     663                 :            :     else
     664                 :        682 :         aTopButton.Hide();
     665                 :            : 
     666         [ +  - ]:        682 :     if (bHeaders)                               // Spalten/Zeilen-Header
     667                 :            :     {
     668                 :        682 :         lcl_SetPosSize( *pColBar[SC_SPLIT_LEFT],
     669         [ +  - ]:        682 :             Point(nPosX,nPosY-nBarY), Size(nLeftSize,nBarY), nTotalWidth, bLayoutRTL );
     670         [ -  + ]:        682 :         if (pColBar[SC_SPLIT_RIGHT])
     671                 :          0 :             lcl_SetPosSize( *pColBar[SC_SPLIT_RIGHT],
     672         [ #  # ]:          0 :                 Point(nSplitPosX,nPosY-nBarY), Size(nRightSize,nBarY), nTotalWidth, bLayoutRTL );
     673                 :            : 
     674         [ -  + ]:        682 :         if (pRowBar[SC_SPLIT_TOP])
     675                 :          0 :             lcl_SetPosSize( *pRowBar[SC_SPLIT_TOP],
     676         [ #  # ]:          0 :                 Point(nPosX-nBarX,nPosY), Size(nBarX,nTopSize), nTotalWidth, bLayoutRTL );
     677                 :        682 :         lcl_SetPosSize( *pRowBar[SC_SPLIT_BOTTOM],
     678         [ +  - ]:        682 :             Point(nPosX-nBarX,nSplitPosY), Size(nBarX,nBottomSize), nTotalWidth, bLayoutRTL );
     679                 :            : 
     680         [ +  - ]:        682 :         lcl_SetPosSize( aCornerButton, Point(nPosX-nBarX,nPosY-nBarY), Size(nBarX,nBarY), nTotalWidth, bLayoutRTL );
     681                 :        682 :         aCornerButton.Show();
     682                 :        682 :         pColBar[SC_SPLIT_LEFT]->Show();
     683                 :        682 :         pRowBar[SC_SPLIT_BOTTOM]->Show();
     684                 :            :     }
     685                 :            :     else
     686                 :            :     {
     687                 :          0 :         aCornerButton.Hide();
     688                 :          0 :         pColBar[SC_SPLIT_LEFT]->Hide();         // immer da
     689                 :          0 :         pRowBar[SC_SPLIT_BOTTOM]->Hide();
     690                 :            :     }
     691                 :            : 
     692                 :            : 
     693                 :            :                                             // Grid-Windows
     694                 :            : 
     695         [ -  + ]:        682 :     if (bInner)
     696                 :            :     {
     697         [ #  # ]:          0 :         long nInnerPosX = bLayoutRTL ? ( nTotalWidth - nPosX - nLeftSize ) : nPosX;
     698         [ #  # ]:          0 :         pGridWin[SC_SPLIT_BOTTOMLEFT]->SetPosPixel( Point(nInnerPosX,nSplitPosY) );
     699                 :            :     }
     700                 :            :     else
     701                 :            :     {
     702                 :        682 :         lcl_SetPosSize( *pGridWin[SC_SPLIT_BOTTOMLEFT],
     703         [ +  - ]:        682 :             Point(nPosX,nSplitPosY), Size(nLeftSize,nBottomSize), nTotalWidth, bLayoutRTL );
     704         [ -  + ]:        682 :         if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
     705                 :          0 :             lcl_SetPosSize( *pGridWin[SC_SPLIT_BOTTOMRIGHT],
     706         [ #  # ]:          0 :                 Point(nSplitPosX,nSplitPosY), Size(nRightSize,nBottomSize), nTotalWidth, bLayoutRTL );
     707         [ -  + ]:        682 :         if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
     708                 :          0 :             lcl_SetPosSize( *pGridWin[SC_SPLIT_TOPLEFT],
     709         [ #  # ]:          0 :                 Point(nPosX,nPosY), Size(nLeftSize,nTopSize), nTotalWidth, bLayoutRTL );
     710 [ -  + ][ #  # ]:        682 :         if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE && aViewData.GetVSplitMode() != SC_SPLIT_NONE )
                 [ -  + ]
     711                 :          0 :             lcl_SetPosSize( *pGridWin[SC_SPLIT_TOPRIGHT],
     712         [ #  # ]:          0 :                 Point(nSplitPosX,nPosY), Size(nRightSize,nTopSize), nTotalWidth, bLayoutRTL );
     713                 :            :     }
     714                 :            : 
     715                 :            :                 //
     716                 :            :                 //  Scrollbars updaten
     717                 :            :                 //
     718                 :            : 
     719         [ +  + ]:        682 :     if (!bInUpdateHeader)
     720                 :            :     {
     721                 :        453 :         UpdateScrollBars();     // Scrollbars nicht beim Scrollen neu setzen
     722                 :        453 :         UpdateHeaderWidth();
     723                 :            : 
     724                 :        453 :         InterpretVisible();     // have everything calculated before painting
     725                 :            :     }
     726                 :            : 
     727         [ -  + ]:        682 :     if (bHasHint)
     728                 :          0 :         TestHintWindow();       // neu positionieren
     729                 :            : 
     730                 :        682 :     UpdateVarZoom();    //  update variable zoom types (after resizing GridWindows)
     731                 :            : 
     732         [ +  + ]:        682 :     if (aViewData.GetViewShell()->HasAccessibilityObjects())
     733         [ +  - ]:          4 :         aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_WINDOWRESIZED));
     734                 :            : }
     735                 :            : 
     736                 :        985 : void ScTabView::UpdateVarZoom()
     737                 :            : {
     738                 :            :     //  update variable zoom types
     739                 :            : 
     740                 :        985 :     SvxZoomType eZoomType = GetZoomType();
     741 [ #  # ][ -  + ]:        985 :     if ( eZoomType != SVX_ZOOM_PERCENT && !bInZoomUpdate )
     742                 :            :     {
     743                 :          0 :         bInZoomUpdate = true;
     744                 :          0 :         const Fraction& rOldX = GetViewData()->GetZoomX();
     745                 :          0 :         const Fraction& rOldY = GetViewData()->GetZoomY();
     746                 :          0 :         long nOldPercent = ( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator();
     747         [ #  # ]:          0 :         sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent );
     748         [ #  # ]:          0 :         Fraction aNew( nNewZoom, 100 );
     749                 :            : 
     750 [ #  # ][ #  # ]:          0 :         if ( aNew != rOldX || aNew != rOldY )
         [ #  # ][ #  # ]
                 [ #  # ]
     751                 :            :         {
     752         [ #  # ]:          0 :             SetZoom( aNew, aNew, false );   // always separately per sheet
     753         [ #  # ]:          0 :             PaintGrid();
     754         [ #  # ]:          0 :             PaintTop();
     755         [ #  # ]:          0 :             PaintLeft();
     756         [ #  # ]:          0 :             aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
     757         [ #  # ]:          0 :             aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
     758                 :            :         }
     759                 :          0 :         bInZoomUpdate = false;
     760                 :            :     }
     761                 :        985 : }
     762                 :            : 
     763                 :        763 : void ScTabView::UpdateFixPos()
     764                 :            : {
     765                 :        763 :     bool bResize = false;
     766         [ -  + ]:        763 :     if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
     767         [ #  # ]:          0 :         if (aViewData.UpdateFixX())
     768                 :          0 :             bResize = true;
     769         [ -  + ]:        763 :     if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
     770         [ #  # ]:          0 :         if (aViewData.UpdateFixY())
     771                 :          0 :             bResize = true;
     772         [ -  + ]:        763 :     if (bResize)
     773                 :          0 :         RepeatResize(false);
     774                 :        763 : }
     775                 :            : 
     776                 :        249 : void ScTabView::RepeatResize( bool bUpdateFix )
     777                 :            : {
     778         [ +  - ]:        249 :     if ( bUpdateFix )
     779                 :            :     {
     780                 :        249 :         ScSplitMode eHSplit = aViewData.GetHSplitMode();
     781                 :        249 :         ScSplitMode eVSplit = aViewData.GetVSplitMode();
     782                 :            : 
     783                 :            :         // #i46796# UpdateFixX / UpdateFixY uses GetGridOffset, which requires the
     784                 :            :         // outline windows to be available. So UpdateShow has to be called before
     785                 :            :         // (also called from DoResize).
     786 [ -  + ][ +  - ]:        249 :         if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX )
     787                 :          0 :             UpdateShow();
     788                 :            : 
     789         [ -  + ]:        249 :         if ( eHSplit == SC_SPLIT_FIX )
     790                 :          0 :             aViewData.UpdateFixX();
     791         [ -  + ]:        249 :         if ( eVSplit == SC_SPLIT_FIX )
     792                 :          0 :             aViewData.UpdateFixY();
     793                 :            :     }
     794                 :            : 
     795                 :        249 :     DoResize( aBorderPos, aFrameSize );
     796                 :            : 
     797                 :            :     //! Border muss neu gesetzt werden ???
     798                 :        249 : }
     799                 :            : 
     800                 :        982 : void ScTabView::GetBorderSize( SvBorder& rBorder, const Size& /* rSize */ )
     801                 :            : {
     802                 :        982 :     sal_Bool bScrollBars = aViewData.IsVScrollMode();
     803                 :        982 :     sal_Bool bHeaders    = aViewData.IsHeaderMode();
     804                 :        982 :     sal_Bool bOutlMode   = aViewData.IsOutlineMode();
     805 [ -  + ][ +  - ]:        982 :     sal_Bool bHOutline   = bOutlMode && lcl_HasColOutline(aViewData);
     806 [ +  - ][ -  + ]:        982 :     sal_Bool bVOutline   = bOutlMode && lcl_HasRowOutline(aViewData);
     807                 :        982 :     sal_Bool bLayoutRTL  = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
     808                 :            : 
     809         [ +  - ]:        982 :     rBorder = SvBorder();
     810                 :            : 
     811         [ +  - ]:        982 :     if (bScrollBars)                            // Scrollbars horizontal oder vertikal
     812                 :            :     {
     813                 :        982 :         rBorder.Right()  += aVScrollBottom.GetSizePixel().Width();
     814                 :        982 :         rBorder.Bottom() += aHScrollLeft.GetSizePixel().Height();
     815                 :            :     }
     816                 :            : 
     817                 :            :     // Outline-Controls
     818 [ -  + ][ #  # ]:        982 :     if (bVOutline && pRowOutline[SC_SPLIT_BOTTOM])
     819                 :          0 :         rBorder.Left() += pRowOutline[SC_SPLIT_BOTTOM]->GetDepthSize();
     820 [ -  + ][ #  # ]:        982 :     if (bHOutline && pColOutline[SC_SPLIT_LEFT])
     821                 :          0 :         rBorder.Top()  += pColOutline[SC_SPLIT_LEFT]->GetDepthSize();
     822                 :            : 
     823         [ +  - ]:        982 :     if (bHeaders)                               // Spalten/Zeilen-Header
     824                 :            :     {
     825                 :        982 :         rBorder.Left() += pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
     826                 :        982 :         rBorder.Top()  += pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
     827                 :            :     }
     828                 :            : 
     829         [ -  + ]:        982 :     if ( bLayoutRTL )
     830                 :          0 :         ::std::swap( rBorder.Left(), rBorder.Right() );
     831                 :        982 : }
     832                 :            : 
     833                 :          0 : IMPL_LINK_NOARG(ScTabView, TabBarResize)
     834                 :            : {
     835         [ #  # ]:          0 :     if (aViewData.IsHScrollMode())
     836                 :            :     {
     837                 :          0 :         const long nOverlap = 0;    // ScrollBar::GetWindowOverlapPixel();
     838                 :          0 :         long nSize = pTabControl->GetSplitSize();
     839                 :            : 
     840         [ #  # ]:          0 :         if (aViewData.GetHSplitMode() != SC_SPLIT_FIX)
     841                 :            :         {
     842                 :          0 :             long nMax = pHSplitter->GetPosPixel().X();
     843         [ #  # ]:          0 :             if( pTabControl->IsEffectiveRTL() )
     844                 :          0 :                 nMax = pFrameWin->GetSizePixel().Width() - nMax;
     845                 :          0 :             --nMax;
     846         [ #  # ]:          0 :             if (nSize>nMax) nSize = nMax;
     847                 :            :         }
     848                 :            : 
     849         [ #  # ]:          0 :         if ( nSize != pTabControl->GetSizePixel().Width() )
     850                 :            :         {
     851                 :            :             pTabControl->SetSizePixel( Size( nSize+nOverlap,
     852         [ #  # ]:          0 :                                         pTabControl->GetSizePixel().Height() ) );
     853                 :          0 :             RepeatResize();
     854                 :            :         }
     855                 :            :     }
     856                 :            : 
     857                 :          0 :     return 0;
     858                 :            : }
     859                 :            : 
     860                 :        237 : void ScTabView::SetTabBarWidth( long nNewWidth )
     861                 :            : {
     862         [ +  - ]:        237 :     Size aSize = pTabControl->GetSizePixel();
     863                 :            : 
     864         [ +  + ]:        237 :     if ( aSize.Width() != nNewWidth )
     865                 :            :     {
     866                 :          6 :         aSize.Width() = nNewWidth;
     867         [ +  - ]:          6 :         pTabControl->SetSizePixel( aSize );
     868                 :            :     }
     869                 :        237 : }
     870                 :            : 
     871                 :          8 : void ScTabView::SetRelTabBarWidth( double fRelTabBarWidth )
     872                 :            : {
     873 [ +  - ][ +  - ]:          8 :     if( (0.0 <= fRelTabBarWidth) && (fRelTabBarWidth <= 1.0) )
     874         [ +  - ]:          8 :         if( long nFrameWidth = pFrameWin->GetSizePixel().Width() )
     875                 :          8 :             SetTabBarWidth( static_cast< long >( fRelTabBarWidth * nFrameWidth + 0.5 ) );
     876                 :          8 : }
     877                 :            : 
     878                 :          4 : void ScTabView::SetPendingRelTabBarWidth( double fRelTabBarWidth )
     879                 :            : {
     880                 :          4 :     mfPendingTabBarWidth = fRelTabBarWidth;
     881                 :          4 :     SetRelTabBarWidth( fRelTabBarWidth );
     882                 :          4 : }
     883                 :            : 
     884                 :        237 : long ScTabView::GetTabBarWidth() const
     885                 :            : {
     886                 :        237 :     return pTabControl->GetSizePixel().Width();
     887                 :            : }
     888                 :            : 
     889                 :          0 : double ScTabView::GetRelTabBarWidth() const
     890                 :            : {
     891         [ #  # ]:          0 :     if( long nFrameWidth = pFrameWin->GetSizePixel().Width() )
     892                 :          0 :         return static_cast< double >( GetTabBarWidth() ) / nFrameWidth;
     893                 :          0 :     return 0.0;
     894                 :            : }
     895                 :            : 
     896                 :          0 : double ScTabView::GetPendingRelTabBarWidth() const
     897                 :            : {
     898                 :          0 :     return mfPendingTabBarWidth;
     899                 :            : }
     900                 :            : 
     901                 :       1930 : Window* ScTabView::GetActiveWin()
     902                 :            : {
     903                 :       1930 :     ScSplitPos ePos = aViewData.GetActivePart();
     904                 :            :     OSL_ENSURE(pGridWin[ePos],"kein aktives Fenster");
     905                 :       1930 :     return pGridWin[ePos];
     906                 :            : }
     907                 :            : 
     908                 :        695 : Window* ScTabView::GetWindowByPos( ScSplitPos ePos )
     909                 :            : {
     910                 :        695 :     return pGridWin[ePos];
     911                 :            : }
     912                 :            : 
     913                 :          0 : void ScTabView::SetActivePointer( const Pointer& rPointer )
     914                 :            : {
     915         [ #  # ]:          0 :     for (sal_uInt16 i=0; i<4; i++)
     916         [ #  # ]:          0 :         if (pGridWin[i])
     917                 :          0 :             pGridWin[i]->SetPointer( rPointer );
     918                 :          0 : }
     919                 :            : 
     920                 :            : 
     921                 :          0 : void ScTabView::ActiveGrabFocus()
     922                 :            : {
     923                 :          0 :     ScSplitPos ePos = aViewData.GetActivePart();
     924         [ #  # ]:          0 :     if (pGridWin[ePos])
     925                 :          0 :         pGridWin[ePos]->GrabFocus();
     926                 :          0 : }
     927                 :            : 
     928                 :            : 
     929                 :          0 : ScSplitPos ScTabView::FindWindow( Window* pWindow ) const
     930                 :            : {
     931                 :          0 :     ScSplitPos eVal = SC_SPLIT_BOTTOMLEFT;      // Default
     932         [ #  # ]:          0 :     for (sal_uInt16 i=0; i<4; i++)
     933         [ #  # ]:          0 :         if ( pGridWin[i] == pWindow )
     934                 :          0 :             eVal = (ScSplitPos) i;
     935                 :            : 
     936                 :          0 :     return eVal;
     937                 :            : }
     938                 :            : 
     939                 :          0 : Point ScTabView::GetGridOffset() const
     940                 :            : {
     941                 :          0 :     Point aPos;
     942                 :            : 
     943                 :            :         // Groessen hier wie in DoResize
     944                 :            : 
     945                 :          0 :     sal_Bool bHeaders    = aViewData.IsHeaderMode();
     946                 :          0 :     sal_Bool bOutlMode   = aViewData.IsOutlineMode();
     947 [ #  # ][ #  # ]:          0 :     sal_Bool bHOutline   = bOutlMode && lcl_HasColOutline(aViewData);
     948 [ #  # ][ #  # ]:          0 :     sal_Bool bVOutline   = bOutlMode && lcl_HasRowOutline(aViewData);
     949                 :            : 
     950                 :            :     // Outline-Controls
     951 [ #  # ][ #  # ]:          0 :     if (bVOutline && pRowOutline[SC_SPLIT_BOTTOM])
     952                 :          0 :         aPos.X() += pRowOutline[SC_SPLIT_BOTTOM]->GetDepthSize();
     953 [ #  # ][ #  # ]:          0 :     if (bHOutline && pColOutline[SC_SPLIT_LEFT])
     954                 :          0 :         aPos.Y() += pColOutline[SC_SPLIT_LEFT]->GetDepthSize();
     955                 :            : 
     956         [ #  # ]:          0 :     if (bHeaders)                               // Spalten/Zeilen-Header
     957                 :            :     {
     958         [ #  # ]:          0 :         if (pRowBar[SC_SPLIT_BOTTOM])
     959                 :          0 :             aPos.X() += pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
     960         [ #  # ]:          0 :         if (pColBar[SC_SPLIT_LEFT])
     961                 :          0 :             aPos.Y() += pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
     962                 :            :     }
     963                 :            : 
     964                 :          0 :     return aPos;
     965                 :            : }
     966                 :            : 
     967                 :            : // ---  Scroll-Bars  --------------------------------------------------------
     968                 :            : 
     969                 :          0 : bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
     970                 :            : {
     971                 :          0 :     HideNoteMarker();
     972                 :            : 
     973                 :          0 :     bool bDone = false;
     974                 :          0 :     const CommandWheelData* pData = rCEvt.GetWheelData();
     975 [ #  # ][ #  # ]:          0 :     if ( pData && pData->GetMode() == COMMAND_WHEEL_ZOOM )
                 [ #  # ]
     976                 :            :     {
     977         [ #  # ]:          0 :         if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() )
     978                 :            :         {
     979                 :            :             //  for ole inplace editing, the scale is defined by the visarea and client size
     980                 :            :             //  and can't be changed directly
     981                 :            : 
     982                 :          0 :             const Fraction& rOldY = aViewData.GetZoomY();
     983                 :          0 :             long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
     984                 :          0 :             long nNew = nOld;
     985         [ #  # ]:          0 :             if ( pData->GetDelta() < 0 )
     986                 :          0 :                 nNew = Max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld ));
     987                 :            :             else
     988                 :          0 :                 nNew = Min( (long) MAXZOOM, basegfx::zoomtools::zoomIn( nOld ));
     989                 :            : 
     990         [ #  # ]:          0 :             if ( nNew != nOld )
     991                 :            :             {
     992                 :            :                 // scroll wheel doesn't set the AppOptions default
     993                 :            : 
     994 [ #  # ][ #  # ]:          0 :                 sal_Bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
     995         [ #  # ]:          0 :                 SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom );
     996         [ #  # ]:          0 :                 Fraction aFract( nNew, 100 );
     997         [ #  # ]:          0 :                 SetZoom( aFract, aFract, bSyncZoom );
     998         [ #  # ]:          0 :                 PaintGrid();
     999         [ #  # ]:          0 :                 PaintTop();
    1000         [ #  # ]:          0 :                 PaintLeft();
    1001 [ #  # ][ #  # ]:          0 :                 aViewData.GetBindings().Invalidate( SID_ATTR_ZOOM );
    1002 [ #  # ][ #  # ]:          0 :                 aViewData.GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
    1003                 :            :             }
    1004                 :            : 
    1005                 :          0 :             bDone = true;
    1006                 :            :         }
    1007                 :            :     }
    1008                 :            :     else
    1009                 :            :     {
    1010                 :          0 :         ScHSplitPos eHPos = WhichH(ePos);
    1011                 :          0 :         ScVSplitPos eVPos = WhichV(ePos);
    1012         [ #  # ]:          0 :         ScrollBar* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? &aHScrollLeft : &aHScrollRight;
    1013         [ #  # ]:          0 :         ScrollBar* pVScroll = ( eVPos == SC_SPLIT_TOP )  ? &aVScrollTop  : &aVScrollBottom;
    1014         [ #  # ]:          0 :         if ( pGridWin[ePos] )
    1015                 :          0 :             bDone = pGridWin[ePos]->HandleScrollCommand( rCEvt, pHScroll, pVScroll );
    1016                 :            :     }
    1017                 :          0 :     return bDone;
    1018                 :            : }
    1019                 :            : 
    1020                 :          0 : IMPL_LINK( ScTabView, EndScrollHdl, ScrollBar*, pScroll )
    1021                 :            : {
    1022                 :          0 :     sal_Bool bOnlineScroll = sal_True;      //! Optionen
    1023                 :            : 
    1024         [ #  # ]:          0 :     if ( bDragging )
    1025                 :            :     {
    1026         [ #  # ]:          0 :         if ( bOnlineScroll )                // nur Ranges aktualisieren
    1027                 :          0 :             UpdateScrollBars();
    1028                 :            :         else
    1029                 :            :         {
    1030                 :          0 :             long nScrollMin = 0;        // RangeMin simulieren
    1031 [ #  # ][ #  # ]:          0 :             if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
                 [ #  # ]
    1032                 :          0 :                 nScrollMin = aViewData.GetFixPosX();
    1033 [ #  # ][ #  # ]:          0 :             if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
                 [ #  # ]
    1034                 :          0 :                 nScrollMin = aViewData.GetFixPosY();
    1035                 :            : 
    1036 [ #  # ][ #  # ]:          0 :             if ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight )
    1037                 :            :             {
    1038                 :          0 :                 bool bMirror = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) != Application::GetSettings().GetLayoutRTL();
    1039                 :          0 :                 ScHSplitPos eWhich = (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
    1040                 :          0 :                 long nDelta = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin - aViewData.GetPosX(eWhich);
    1041         [ #  # ]:          0 :                 if (nDelta) ScrollX( nDelta, eWhich );
    1042                 :            :             }
    1043                 :            :             else                            // VScroll...
    1044                 :            :             {
    1045                 :          0 :                 ScVSplitPos eWhich = (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
    1046                 :          0 :                 long nDelta = GetScrollBarPos( *pScroll, false ) + nScrollMin - aViewData.GetPosY(eWhich);
    1047         [ #  # ]:          0 :                 if (nDelta) ScrollY( nDelta, eWhich );
    1048                 :            :             }
    1049                 :            :         }
    1050                 :          0 :         bDragging = false;
    1051                 :            :     }
    1052                 :          0 :     return 0;
    1053                 :            : }
    1054                 :            : 
    1055                 :          0 : IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll )
    1056                 :            : {
    1057                 :          0 :     sal_Bool bOnlineScroll = sal_True;      //! Optionen
    1058                 :            : 
    1059 [ #  # ][ #  # ]:          0 :     bool bHoriz = ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight );
    1060                 :            :     long nViewPos;
    1061         [ #  # ]:          0 :     if ( bHoriz )
    1062                 :            :         nViewPos = aViewData.GetPosX( (pScroll == &aHScrollLeft) ?
    1063                 :          0 :                                         SC_SPLIT_LEFT : SC_SPLIT_RIGHT );
    1064                 :            :     else
    1065                 :            :         nViewPos = aViewData.GetPosY( (pScroll == &aVScrollTop) ?
    1066                 :          0 :                                         SC_SPLIT_TOP : SC_SPLIT_BOTTOM );
    1067                 :            : 
    1068                 :          0 :     bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
    1069 [ #  # ][ #  # ]:          0 :     bool bMirror = bHoriz && (bLayoutRTL != Application::GetSettings().GetLayoutRTL());
    1070                 :            : 
    1071                 :          0 :     ScrollType eType = pScroll->GetType();
    1072         [ #  # ]:          0 :     if ( eType == SCROLL_DRAG )
    1073                 :            :     {
    1074         [ #  # ]:          0 :         if (!bDragging)
    1075                 :            :         {
    1076                 :          0 :             bDragging = true;
    1077                 :          0 :             nPrevDragPos = nViewPos;
    1078                 :            :         }
    1079                 :            : 
    1080                 :            :         //  Scroll-Position anzeigen
    1081                 :            :         //  (nur QuickHelp, in der Statuszeile gibt es keinen Eintrag dafuer)
    1082                 :            : 
    1083         [ #  # ]:          0 :         if (Help::IsQuickHelpEnabled())
    1084                 :            :         {
    1085         [ #  # ]:          0 :             Size aSize = pScroll->GetSizePixel();
    1086                 :            : 
    1087                 :            :             /*  Convert scrollbar mouse position to screen position. If RTL
    1088                 :            :                 mode of scrollbar differs from RTL mode of its parent, then the
    1089                 :            :                 direct call to Window::OutputToNormalizedScreenPixel() will
    1090                 :            :                 give unusable results, because calcualtion of screen position
    1091                 :            :                 is based on parent orientation and expects equal orientation of
    1092                 :            :                 the child position. Need to mirror mouse position before. */
    1093         [ #  # ]:          0 :             Point aMousePos = pScroll->GetPointerPosPixel();
    1094 [ #  # ][ #  # ]:          0 :             if( pScroll->IsRTLEnabled() != pScroll->GetParent()->IsRTLEnabled() )
    1095                 :          0 :                 aMousePos.X() = aSize.Width() - aMousePos.X() - 1;
    1096         [ #  # ]:          0 :             aMousePos = pScroll->OutputToNormalizedScreenPixel( aMousePos );
    1097                 :            : 
    1098                 :            :             // convert top-left position of scrollbar to screen position
    1099         [ #  # ]:          0 :             Point aPos = pScroll->OutputToNormalizedScreenPixel( Point() );
    1100                 :            : 
    1101                 :            :             // get scrollbar scroll position for help text (row number/column name)
    1102                 :          0 :             long nScrollMin = 0;        // RangeMin simulieren
    1103 [ #  # ][ #  # ]:          0 :             if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
                 [ #  # ]
    1104                 :          0 :                 nScrollMin = aViewData.GetFixPosX();
    1105 [ #  # ][ #  # ]:          0 :             if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
                 [ #  # ]
    1106                 :          0 :                 nScrollMin = aViewData.GetFixPosY();
    1107         [ #  # ]:          0 :             long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
    1108                 :            : 
    1109         [ #  # ]:          0 :             String aHelpStr;
    1110         [ #  # ]:          0 :             Rectangle aRect;
    1111                 :            :             sal_uInt16 nAlign;
    1112         [ #  # ]:          0 :             if (bHoriz)
    1113                 :            :             {
    1114 [ #  # ][ #  # ]:          0 :                 aHelpStr = ScGlobal::GetRscString(STR_COLUMN);
    1115         [ #  # ]:          0 :                 aHelpStr += ' ';
    1116 [ #  # ][ #  # ]:          0 :                 aHelpStr += ScColToAlpha((SCCOL) nScrollPos);
                 [ #  # ]
    1117                 :            : 
    1118                 :          0 :                 aRect.Left() = aMousePos.X();
    1119                 :          0 :                 aRect.Top()  = aPos.Y() - 4;
    1120                 :          0 :                 nAlign       = QUICKHELP_BOTTOM|QUICKHELP_CENTER;
    1121                 :            :             }
    1122                 :            :             else
    1123                 :            :             {
    1124 [ #  # ][ #  # ]:          0 :                 aHelpStr = ScGlobal::GetRscString(STR_ROW);
    1125         [ #  # ]:          0 :                 aHelpStr += ' ';
    1126 [ #  # ][ #  # ]:          0 :                 aHelpStr += String::CreateFromInt32(nScrollPos + 1);
                 [ #  # ]
    1127                 :            : 
    1128                 :            :                 // show quicktext always inside sheet area
    1129         [ #  # ]:          0 :                 aRect.Left() = bLayoutRTL ? (aPos.X() + aSize.Width() + 8) : (aPos.X() - 8);
    1130                 :          0 :                 aRect.Top()  = aMousePos.Y();
    1131         [ #  # ]:          0 :                 nAlign       = (bLayoutRTL ? QUICKHELP_LEFT : QUICKHELP_RIGHT) | QUICKHELP_VCENTER;
    1132                 :            :             }
    1133                 :          0 :             aRect.Right()   = aRect.Left();
    1134                 :          0 :             aRect.Bottom()  = aRect.Top();
    1135                 :            : 
    1136 [ #  # ][ #  # ]:          0 :             Help::ShowQuickHelp(pScroll->GetParent(), aRect, aHelpStr, nAlign);
                 [ #  # ]
    1137                 :            :         }
    1138                 :            :     }
    1139                 :            : 
    1140 [ #  # ][ #  # ]:          0 :     if ( bOnlineScroll || eType != SCROLL_DRAG )
    1141                 :            :     {
    1142         [ #  # ]:          0 :         if ( bMirror )
    1143                 :            :         {
    1144                 :            :             // change scroll type so visible/previous cells calculation below remains the same
    1145   [ #  #  #  #  :          0 :             switch ( eType )
                      # ]
    1146                 :            :             {
    1147                 :          0 :                 case SCROLL_LINEUP:     eType = SCROLL_LINEDOWN;    break;
    1148                 :          0 :                 case SCROLL_LINEDOWN:   eType = SCROLL_LINEUP;      break;
    1149                 :          0 :                 case SCROLL_PAGEUP:     eType = SCROLL_PAGEDOWN;    break;
    1150                 :          0 :                 case SCROLL_PAGEDOWN:   eType = SCROLL_PAGEUP;      break;
    1151                 :            :                 default:
    1152                 :            :                 {
    1153                 :            :                     // added to avoid warnings
    1154                 :            :                 }
    1155                 :            :             }
    1156                 :            :         }
    1157                 :          0 :         long nDelta = pScroll->GetDelta();
    1158   [ #  #  #  #  :          0 :         switch ( eType )
                   #  # ]
    1159                 :            :         {
    1160                 :            :             case SCROLL_LINEUP:
    1161                 :          0 :                 nDelta = -1;
    1162                 :          0 :                 break;
    1163                 :            :             case SCROLL_LINEDOWN:
    1164                 :          0 :                 nDelta = 1;
    1165                 :          0 :                 break;
    1166                 :            :             case SCROLL_PAGEUP:
    1167         [ #  # ]:          0 :                 if ( pScroll == &aHScrollLeft ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT );
    1168         [ #  # ]:          0 :                 if ( pScroll == &aHScrollRight ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT );
    1169         [ #  # ]:          0 :                 if ( pScroll == &aVScrollTop ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP );
    1170         [ #  # ]:          0 :                 if ( pScroll == &aVScrollBottom ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM );
    1171         [ #  # ]:          0 :                 if (nDelta==0) nDelta=-1;
    1172                 :          0 :                 break;
    1173                 :            :             case SCROLL_PAGEDOWN:
    1174         [ #  # ]:          0 :                 if ( pScroll == &aHScrollLeft ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT );
    1175         [ #  # ]:          0 :                 if ( pScroll == &aHScrollRight ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT );
    1176         [ #  # ]:          0 :                 if ( pScroll == &aVScrollTop ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP );
    1177         [ #  # ]:          0 :                 if ( pScroll == &aVScrollBottom ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
    1178         [ #  # ]:          0 :                 if (nDelta==0) nDelta=1;
    1179                 :          0 :                 break;
    1180                 :            :             case SCROLL_DRAG:
    1181                 :            :                 {
    1182                 :            :                     //  nur in die richtige Richtung scrollen, nicht um ausgeblendete
    1183                 :            :                     //  Bereiche herumzittern
    1184                 :            : 
    1185                 :          0 :                     long nScrollMin = 0;        // RangeMin simulieren
    1186 [ #  # ][ #  # ]:          0 :                     if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight )
                 [ #  # ]
    1187                 :          0 :                         nScrollMin = aViewData.GetFixPosX();
    1188 [ #  # ][ #  # ]:          0 :                     if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom )
                 [ #  # ]
    1189                 :          0 :                         nScrollMin = aViewData.GetFixPosY();
    1190                 :            : 
    1191                 :          0 :                     long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin;
    1192                 :          0 :                     nDelta = nScrollPos - nViewPos;
    1193         [ #  # ]:          0 :                     if ( nScrollPos > nPrevDragPos )
    1194                 :            :                     {
    1195         [ #  # ]:          0 :                         if (nDelta<0) nDelta=0;
    1196                 :            :                     }
    1197         [ #  # ]:          0 :                     else if ( nScrollPos < nPrevDragPos )
    1198                 :            :                     {
    1199         [ #  # ]:          0 :                         if (nDelta>0) nDelta=0;
    1200                 :            :                     }
    1201                 :            :                     else
    1202                 :          0 :                         nDelta = 0;
    1203                 :          0 :                     nPrevDragPos = nScrollPos;
    1204                 :            :                 }
    1205                 :          0 :                 break;
    1206                 :            :             default:
    1207                 :            :             {
    1208                 :            :                 // added to avoid warnings
    1209                 :            :             }
    1210                 :            :         }
    1211                 :            : 
    1212         [ #  # ]:          0 :         if (nDelta)
    1213                 :            :         {
    1214                 :          0 :             sal_Bool bUpdate = ( eType != SCROLL_DRAG );    // bei Drag die Ranges nicht aendern
    1215         [ #  # ]:          0 :             if ( bHoriz )
    1216                 :          0 :                 ScrollX( nDelta, (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate );
    1217                 :            :             else
    1218                 :          0 :                 ScrollY( nDelta, (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate );
    1219                 :            :         }
    1220                 :            :     }
    1221                 :            : 
    1222                 :          0 :     return 0;
    1223                 :            : }
    1224                 :            : 
    1225                 :          0 : void ScTabView::ScrollX( long nDeltaX, ScHSplitPos eWhich, bool bUpdBars )
    1226                 :            : {
    1227                 :          0 :     SCCOL nOldX = aViewData.GetPosX(eWhich);
    1228                 :          0 :     SCsCOL nNewX = static_cast<SCsCOL>(nOldX) + static_cast<SCsCOL>(nDeltaX);
    1229         [ #  # ]:          0 :     if ( nNewX < 0 )
    1230                 :            :     {
    1231                 :          0 :         nDeltaX -= nNewX;
    1232                 :          0 :         nNewX = 0;
    1233                 :            :     }
    1234         [ #  # ]:          0 :     if ( nNewX > MAXCOL )
    1235                 :            :     {
    1236                 :          0 :         nDeltaX -= nNewX - MAXCOL;
    1237                 :          0 :         nNewX = MAXCOL;
    1238                 :            :     }
    1239                 :            : 
    1240         [ #  # ]:          0 :     SCsCOL nDir = ( nDeltaX > 0 ) ? 1 : -1;
    1241         [ #  # ]:          0 :     ScDocument* pDoc = aViewData.GetDocument();
    1242                 :          0 :     SCTAB nTab = aViewData.GetTabNo();
    1243 [ #  # ][ #  # ]:          0 :     while ( pDoc->ColHidden(nNewX, nTab) &&
         [ #  # ][ #  # ]
                 [ #  # ]
    1244                 :            :             nNewX+nDir >= 0 && nNewX+nDir <= MAXCOL )
    1245                 :          0 :         nNewX = sal::static_int_cast<SCsCOL>( nNewX + nDir );
    1246                 :            : 
    1247                 :            :     //  Fixierung
    1248                 :            : 
    1249         [ #  # ]:          0 :     if (aViewData.GetHSplitMode() == SC_SPLIT_FIX)
    1250                 :            :     {
    1251         [ #  # ]:          0 :         if (eWhich == SC_SPLIT_LEFT)
    1252                 :          0 :             nNewX = static_cast<SCsCOL>(nOldX);                             // links immer stehenlassen
    1253                 :            :         else
    1254                 :            :         {
    1255                 :          0 :             SCsCOL nFixX = static_cast<SCsCOL>(aViewData.GetFixPosX());
    1256         [ #  # ]:          0 :             if (nNewX < nFixX)
    1257                 :          0 :                 nNewX = nFixX;
    1258                 :            :         }
    1259                 :            :     }
    1260         [ #  # ]:          0 :     if (nNewX == static_cast<SCsCOL>(nOldX))
    1261                 :          0 :         return;
    1262                 :            : 
    1263         [ #  # ]:          0 :     HideAllCursors();
    1264                 :            : 
    1265 [ #  # ][ #  # ]:          0 :     if ( nNewX >= 0 && nNewX <= MAXCOL && nDeltaX )
                 [ #  # ]
    1266                 :            :     {
    1267         [ #  # ]:          0 :         SCCOL nTrackX = std::max( nOldX, static_cast<SCCOL>(nNewX) );
    1268                 :            : 
    1269                 :            :             //  Mit VCL wirkt Update() im Moment immer auf alle Fenster, beim Update
    1270                 :            :             //  nach dem Scrollen des GridWindow's wuerde darum der Col-/RowBar evtl.
    1271                 :            :             //  mit schon geaenderter Pos. gepainted werden -
    1272                 :            :             //  darum vorher einmal Update am Col-/RowBar
    1273                 :            : 
    1274         [ #  # ]:          0 :         if (pColBar[eWhich])
    1275         [ #  # ]:          0 :             pColBar[eWhich]->Update();
    1276                 :            : 
    1277         [ #  # ]:          0 :         long nOldPos = aViewData.GetScrPos( nTrackX, 0, eWhich ).X();
    1278         [ #  # ]:          0 :         aViewData.SetPosX( eWhich, static_cast<SCCOL>(nNewX) );
    1279         [ #  # ]:          0 :         long nDiff = aViewData.GetScrPos( nTrackX, 0, eWhich ).X() - nOldPos;
    1280                 :            : 
    1281         [ #  # ]:          0 :         if ( eWhich==SC_SPLIT_LEFT )
    1282                 :            :         {
    1283         [ #  # ]:          0 :             pGridWin[SC_SPLIT_BOTTOMLEFT]->ScrollPixel( nDiff, 0 );
    1284         [ #  # ]:          0 :             if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
    1285         [ #  # ]:          0 :                 pGridWin[SC_SPLIT_TOPLEFT]->ScrollPixel( nDiff, 0 );
    1286                 :            :         }
    1287                 :            :         else
    1288                 :            :         {
    1289         [ #  # ]:          0 :             pGridWin[SC_SPLIT_BOTTOMRIGHT]->ScrollPixel( nDiff, 0 );
    1290         [ #  # ]:          0 :             if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
    1291         [ #  # ]:          0 :                 pGridWin[SC_SPLIT_TOPRIGHT]->ScrollPixel( nDiff, 0 );
    1292                 :            :         }
    1293 [ #  # ][ #  # ]:          0 :         if (pColBar[eWhich])     { pColBar[eWhich]->Scroll( nDiff,0 ); pColBar[eWhich]->Update(); }
                 [ #  # ]
    1294 [ #  # ][ #  # ]:          0 :         if (pColOutline[eWhich]) pColOutline[eWhich]->ScrollPixel( nDiff );
    1295         [ #  # ]:          0 :         if (bUpdBars)
    1296         [ #  # ]:          0 :             UpdateScrollBars();
    1297                 :            :     }
    1298                 :            : 
    1299 [ #  # ][ #  # ]:          0 :     if (nDeltaX==1 || nDeltaX==-1)
    1300         [ #  # ]:          0 :         pGridWin[aViewData.GetActivePart()]->Update();
    1301                 :            : 
    1302         [ #  # ]:          0 :     ShowAllCursors();
    1303                 :            : 
    1304         [ #  # ]:          0 :     SetNewVisArea();            // MapMode muss schon gesetzt sein
    1305                 :            : 
    1306         [ #  # ]:          0 :     TestHintWindow();
    1307                 :            : }
    1308                 :            : 
    1309                 :          0 : void ScTabView::ScrollY( long nDeltaY, ScVSplitPos eWhich, bool bUpdBars )
    1310                 :            : {
    1311                 :          0 :     SCROW nOldY = aViewData.GetPosY(eWhich);
    1312                 :          0 :     SCsROW nNewY = static_cast<SCsROW>(nOldY) + static_cast<SCsROW>(nDeltaY);
    1313         [ #  # ]:          0 :     if ( nNewY < 0 )
    1314                 :            :     {
    1315                 :          0 :         nDeltaY -= nNewY;
    1316                 :          0 :         nNewY = 0;
    1317                 :            :     }
    1318         [ #  # ]:          0 :     if ( nNewY > MAXROW )
    1319                 :            :     {
    1320                 :          0 :         nDeltaY -= nNewY - MAXROW;
    1321                 :          0 :         nNewY = MAXROW;
    1322                 :            :     }
    1323                 :            : 
    1324         [ #  # ]:          0 :     SCsROW nDir = ( nDeltaY > 0 ) ? 1 : -1;
    1325         [ #  # ]:          0 :     ScDocument* pDoc = aViewData.GetDocument();
    1326                 :          0 :     SCTAB nTab = aViewData.GetTabNo();
    1327 [ #  # ][ #  # ]:          0 :     while ( pDoc->RowHidden(nNewY, nTab) &&
         [ #  # ][ #  # ]
                 [ #  # ]
    1328                 :            :             nNewY+nDir >= 0 && nNewY+nDir <= MAXROW )
    1329                 :          0 :         nNewY += nDir;
    1330                 :            : 
    1331                 :            :     //  Fixierung
    1332                 :            : 
    1333         [ #  # ]:          0 :     if (aViewData.GetVSplitMode() == SC_SPLIT_FIX)
    1334                 :            :     {
    1335         [ #  # ]:          0 :         if (eWhich == SC_SPLIT_TOP)
    1336                 :          0 :             nNewY = static_cast<SCsROW>(nOldY);                             // oben immer stehenlassen
    1337                 :            :         else
    1338                 :            :         {
    1339                 :          0 :             SCsROW nFixY = static_cast<SCsROW>(aViewData.GetFixPosY());
    1340         [ #  # ]:          0 :             if (nNewY < nFixY)
    1341                 :          0 :                 nNewY = nFixY;
    1342                 :            :         }
    1343                 :            :     }
    1344         [ #  # ]:          0 :     if (nNewY == static_cast<SCsROW>(nOldY))
    1345                 :          0 :         return;
    1346                 :            : 
    1347         [ #  # ]:          0 :     HideAllCursors();
    1348                 :            : 
    1349 [ #  # ][ #  # ]:          0 :     if ( nNewY >= 0 && nNewY <= MAXROW && nDeltaY )
                 [ #  # ]
    1350                 :            :     {
    1351         [ #  # ]:          0 :         SCROW nTrackY = std::max( nOldY, static_cast<SCROW>(nNewY) );
    1352                 :            : 
    1353                 :            :         //  Zeilenkoepfe anpassen vor dem eigentlichen Scrolling, damit nicht
    1354                 :            :         //  doppelt gepainted werden muss
    1355                 :            :         //  PosY darf dann auch noch nicht umgesetzt sein, neuen Wert uebergeben
    1356                 :          0 :         SCROW nUNew = static_cast<SCROW>(nNewY);
    1357         [ #  # ]:          0 :         UpdateHeaderWidth( &eWhich, &nUNew );               // Zeilenkoepfe anpassen
    1358                 :            : 
    1359         [ #  # ]:          0 :         if (pRowBar[eWhich])
    1360         [ #  # ]:          0 :             pRowBar[eWhich]->Update();
    1361                 :            : 
    1362         [ #  # ]:          0 :         long nOldPos = aViewData.GetScrPos( 0, nTrackY, eWhich ).Y();
    1363         [ #  # ]:          0 :         aViewData.SetPosY( eWhich, static_cast<SCROW>(nNewY) );
    1364         [ #  # ]:          0 :         long nDiff = aViewData.GetScrPos( 0, nTrackY, eWhich ).Y() - nOldPos;
    1365                 :            : 
    1366         [ #  # ]:          0 :         if ( eWhich==SC_SPLIT_TOP )
    1367                 :            :         {
    1368         [ #  # ]:          0 :             pGridWin[SC_SPLIT_TOPLEFT]->ScrollPixel( 0, nDiff );
    1369         [ #  # ]:          0 :             if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
    1370         [ #  # ]:          0 :                 pGridWin[SC_SPLIT_TOPRIGHT]->ScrollPixel( 0, nDiff );
    1371                 :            :         }
    1372                 :            :         else
    1373                 :            :         {
    1374         [ #  # ]:          0 :             pGridWin[SC_SPLIT_BOTTOMLEFT]->ScrollPixel( 0, nDiff );
    1375         [ #  # ]:          0 :             if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
    1376         [ #  # ]:          0 :                 pGridWin[SC_SPLIT_BOTTOMRIGHT]->ScrollPixel( 0, nDiff );
    1377                 :            :         }
    1378 [ #  # ][ #  # ]:          0 :         if (pRowBar[eWhich])     { pRowBar[eWhich]->Scroll( 0,nDiff ); pRowBar[eWhich]->Update(); }
                 [ #  # ]
    1379 [ #  # ][ #  # ]:          0 :         if (pRowOutline[eWhich]) pRowOutline[eWhich]->ScrollPixel( nDiff );
    1380         [ #  # ]:          0 :         if (bUpdBars)
    1381         [ #  # ]:          0 :             UpdateScrollBars();
    1382                 :            :     }
    1383                 :            : 
    1384 [ #  # ][ #  # ]:          0 :     if (nDeltaY==1 || nDeltaY==-1)
    1385         [ #  # ]:          0 :         pGridWin[aViewData.GetActivePart()]->Update();
    1386                 :            : 
    1387         [ #  # ]:          0 :     ShowAllCursors();
    1388                 :            : 
    1389         [ #  # ]:          0 :     SetNewVisArea();            // MapMode muss schon gesetzt sein
    1390                 :            : 
    1391         [ #  # ]:          0 :     TestHintWindow();
    1392                 :            : }
    1393                 :            : 
    1394                 :          0 : void ScTabView::ScrollLines( long nDeltaX, long nDeltaY )
    1395                 :            : {
    1396                 :          0 :     ScSplitPos eWhich = aViewData.GetActivePart();
    1397         [ #  # ]:          0 :     if (nDeltaX)
    1398                 :          0 :         ScrollX(nDeltaX,WhichH(eWhich));
    1399         [ #  # ]:          0 :     if (nDeltaY)
    1400                 :          0 :         ScrollY(nDeltaY,WhichV(eWhich));
    1401                 :          0 : }
    1402                 :            : 
    1403                 :          0 : SCROW lcl_LastVisible( ScViewData& rViewData )
    1404                 :            : {
    1405                 :            :     //  wenn am Dokumentende viele Zeilen ausgeblendet sind (welcher Trottel macht sowas?),
    1406                 :            :     //  soll dadurch nicht auf breite Zeilenkoepfe geschaltet werden
    1407                 :            :     //! als Member ans Dokument ???
    1408                 :            : 
    1409                 :          0 :     ScDocument* pDoc = rViewData.GetDocument();
    1410                 :          0 :     SCTAB nTab = rViewData.GetTabNo();
    1411                 :            : 
    1412                 :          0 :     SCROW nVis = MAXROW;
    1413 [ #  # ][ #  # ]:          0 :     while ( nVis > 0 && pDoc->GetRowHeight( nVis, nTab ) == 0 )
                 [ #  # ]
    1414                 :          0 :         --nVis;
    1415                 :          0 :     return nVis;
    1416                 :            : }
    1417                 :            : 
    1418                 :       4278 : void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY )
    1419                 :            : {
    1420         [ -  + ]:       4278 :     if ( !pRowBar[SC_SPLIT_BOTTOM] || MAXROW < 10000 )
    1421                 :       4278 :         return;
    1422                 :            : 
    1423                 :       4278 :     SCROW nEndPos = MAXROW;
    1424         [ +  - ]:       4278 :     if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() )
    1425                 :            :     {
    1426                 :            :         //  fuer OLE Inplace immer MAXROW
    1427                 :            : 
    1428 [ -  + ][ #  # ]:       4278 :         if ( pWhich && *pWhich == SC_SPLIT_BOTTOM && pPosY )
                 [ #  # ]
    1429                 :          0 :             nEndPos = *pPosY;
    1430                 :            :         else
    1431                 :       4278 :             nEndPos = aViewData.GetPosY( SC_SPLIT_BOTTOM );
    1432                 :       4278 :         nEndPos += aViewData.CellsAtY( nEndPos, 1, SC_SPLIT_BOTTOM, SC_SIZE_NONE ); // VisibleCellsY
    1433         [ -  + ]:       4278 :         if (nEndPos > MAXROW)
    1434                 :          0 :             nEndPos = lcl_LastVisible( aViewData );
    1435                 :            : 
    1436         [ -  + ]:       4278 :         if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
    1437                 :            :         {
    1438                 :            :             SCROW nTopEnd;
    1439 [ #  # ][ #  # ]:          0 :             if ( pWhich && *pWhich == SC_SPLIT_TOP && pPosY )
                 [ #  # ]
    1440                 :          0 :                 nTopEnd = *pPosY;
    1441                 :            :             else
    1442                 :          0 :                 nTopEnd = aViewData.GetPosY( SC_SPLIT_TOP );
    1443                 :          0 :             nTopEnd += aViewData.CellsAtY( nTopEnd, 1, SC_SPLIT_TOP, SC_SIZE_NONE );// VisibleCellsY
    1444         [ #  # ]:          0 :             if (nTopEnd > MAXROW)
    1445                 :          0 :                 nTopEnd = lcl_LastVisible( aViewData );
    1446                 :            : 
    1447         [ #  # ]:          0 :             if ( nTopEnd > nEndPos )
    1448                 :          0 :                 nEndPos = nTopEnd;
    1449                 :            :         }
    1450                 :            :     }
    1451                 :            : 
    1452                 :       4278 :     long nSmall = pRowBar[SC_SPLIT_BOTTOM]->GetSmallWidth();
    1453                 :       4278 :     long nBig   = pRowBar[SC_SPLIT_BOTTOM]->GetBigWidth();
    1454                 :       4278 :     long nDiff  = nBig - nSmall;
    1455                 :            : 
    1456         [ -  + ]:       4278 :     if (nEndPos>10000)
    1457                 :          0 :         nEndPos = 10000;
    1458         [ -  + ]:       4278 :     else if (nEndPos<1)     // avoid extra step at 0 (when only one row is visible)
    1459                 :          0 :         nEndPos = 1;
    1460                 :       4278 :     long nWidth = nBig - ( 10000 - nEndPos ) * nDiff / 10000;
    1461                 :            : 
    1462 [ +  + ][ +  - ]:       4278 :     if ( nWidth != pRowBar[SC_SPLIT_BOTTOM]->GetWidth() && !bInUpdateHeader )
                 [ +  + ]
    1463                 :            :     {
    1464                 :        229 :         bInUpdateHeader = true;
    1465                 :            : 
    1466                 :        229 :         pRowBar[SC_SPLIT_BOTTOM]->SetWidth( nWidth );
    1467         [ -  + ]:        229 :         if (pRowBar[SC_SPLIT_TOP])
    1468                 :          0 :             pRowBar[SC_SPLIT_TOP]->SetWidth( nWidth );
    1469                 :            : 
    1470                 :        229 :         RepeatResize();
    1471                 :            : 
    1472                 :            :         // auf VCL gibt's Update ohne Ende (jedes Update gilt fuer alle Fenster)
    1473                 :            :         //aCornerButton.Update();       // der bekommt sonst nie ein Update
    1474                 :            : 
    1475                 :        229 :         bInUpdateHeader = false;
    1476                 :            :     }
    1477                 :            : }
    1478                 :            : 
    1479                 :      16745 : inline void ShowHide( Window* pWin, sal_Bool bShow )
    1480                 :            : {
    1481                 :            :     OSL_ENSURE(pWin || !bShow, "Fenster ist nicht da");
    1482         [ +  + ]:      16745 :     if (pWin)
    1483                 :       7884 :         pWin->Show(bShow);
    1484                 :      16745 : }
    1485                 :            : 
    1486                 :        985 : void ScTabView::UpdateShow()
    1487                 :            : {
    1488                 :        985 :     sal_Bool bHScrollMode = aViewData.IsHScrollMode();
    1489                 :        985 :     sal_Bool bVScrollMode = aViewData.IsVScrollMode();
    1490                 :        985 :     sal_Bool bTabMode     = aViewData.IsTabMode();
    1491                 :        985 :     sal_Bool bOutlMode    = aViewData.IsOutlineMode();
    1492 [ -  + ][ +  - ]:        985 :     sal_Bool bHOutline    = bOutlMode && lcl_HasColOutline(aViewData);
    1493 [ +  - ][ +  + ]:        985 :     sal_Bool bVOutline    = bOutlMode && lcl_HasRowOutline(aViewData);
    1494                 :        985 :     sal_Bool bHeader      = aViewData.IsHeaderMode();
    1495                 :            : 
    1496                 :        985 :     sal_Bool bShowH = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE );
    1497                 :        985 :     sal_Bool bShowV = ( aViewData.GetVSplitMode() != SC_SPLIT_NONE );
    1498                 :            : 
    1499         [ -  + ]:        985 :     if ( aViewData.GetDocShell()->IsPreview() )
    1500                 :          0 :         bHScrollMode = bVScrollMode = bTabMode = bHeader = bOutlMode = bHOutline = bVOutline = false;
    1501                 :            : 
    1502                 :            :         //
    1503                 :            :         //  Windows anlegen
    1504                 :            :         //
    1505                 :            : 
    1506 [ -  + ][ #  # ]:        985 :     if (bShowH && !pGridWin[SC_SPLIT_BOTTOMRIGHT])
    1507                 :            :     {
    1508         [ #  # ]:          0 :         pGridWin[SC_SPLIT_BOTTOMRIGHT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_BOTTOMRIGHT );
    1509                 :          0 :         DoAddWin( pGridWin[SC_SPLIT_BOTTOMRIGHT] );
    1510                 :            :     }
    1511 [ -  + ][ #  # ]:        985 :     if (bShowV && !pGridWin[SC_SPLIT_TOPLEFT])
    1512                 :            :     {
    1513         [ #  # ]:          0 :         pGridWin[SC_SPLIT_TOPLEFT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_TOPLEFT );
    1514                 :          0 :         DoAddWin( pGridWin[SC_SPLIT_TOPLEFT] );
    1515                 :            :     }
    1516 [ -  + ][ #  # ]:        985 :     if (bShowH && bShowV && !pGridWin[SC_SPLIT_TOPRIGHT])
                 [ #  # ]
    1517                 :            :     {
    1518         [ #  # ]:          0 :         pGridWin[SC_SPLIT_TOPRIGHT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_TOPRIGHT );
    1519                 :          0 :         DoAddWin( pGridWin[SC_SPLIT_TOPRIGHT] );
    1520                 :            :     }
    1521                 :            : 
    1522 [ -  + ][ #  # ]:        985 :     if (bHOutline && !pColOutline[SC_SPLIT_LEFT])
    1523         [ #  # ]:          0 :         pColOutline[SC_SPLIT_LEFT] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMLEFT );
    1524 [ -  + ][ #  # ]:        985 :     if (bShowH && bHOutline && !pColOutline[SC_SPLIT_RIGHT])
                 [ #  # ]
    1525         [ #  # ]:          0 :         pColOutline[SC_SPLIT_RIGHT] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMRIGHT );
    1526                 :            : 
    1527 [ +  + ][ +  - ]:        985 :     if (bVOutline && !pRowOutline[SC_SPLIT_BOTTOM])
    1528         [ +  - ]:          2 :         pRowOutline[SC_SPLIT_BOTTOM] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_BOTTOMLEFT );
    1529 [ -  + ][ #  # ]:        985 :     if (bShowV && bVOutline && !pRowOutline[SC_SPLIT_TOP])
                 [ #  # ]
    1530         [ #  # ]:          0 :         pRowOutline[SC_SPLIT_TOP] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_TOPLEFT );
    1531                 :            : 
    1532 [ -  + ][ #  # ]:        985 :     if (bShowH && bHeader && !pColBar[SC_SPLIT_RIGHT])
                 [ #  # ]
    1533                 :            :         pColBar[SC_SPLIT_RIGHT] = new ScColBar( pFrameWin, &aViewData, SC_SPLIT_RIGHT,
    1534         [ #  # ]:          0 :                                                 &aHdrFunc, pHdrSelEng );
    1535 [ -  + ][ #  # ]:        985 :     if (bShowV && bHeader && !pRowBar[SC_SPLIT_TOP])
                 [ #  # ]
    1536                 :            :         pRowBar[SC_SPLIT_TOP] = new ScRowBar( pFrameWin, &aViewData, SC_SPLIT_TOP,
    1537         [ #  # ]:          0 :                                                 &aHdrFunc, pHdrSelEng );
    1538                 :            : 
    1539                 :            :         //
    1540                 :            :         //  Windows anzeigen
    1541                 :            :         //
    1542                 :            : 
    1543                 :        985 :     ShowHide( &aHScrollLeft, bHScrollMode );
    1544 [ #  # ][ -  + ]:        985 :     ShowHide( &aHScrollRight, bShowH && bHScrollMode );
    1545                 :        985 :     ShowHide( &aVScrollBottom, bVScrollMode );
    1546 [ #  # ][ -  + ]:        985 :     ShowHide( &aVScrollTop, bShowV && bVScrollMode );
    1547 [ #  # ][ -  + ]:        985 :     ShowHide( &aScrollBarBox, bVScrollMode || bHScrollMode );
    1548                 :            : 
    1549 [ #  # ][ -  + ]:        985 :     ShowHide( pHSplitter, bHScrollMode || bShowH );         // immer angelegt
    1550 [ #  # ][ -  + ]:        985 :     ShowHide( pVSplitter, bVScrollMode || bShowV );
    1551                 :        985 :     ShowHide( pTabControl, bTabMode );
    1552                 :            : 
    1553                 :            :                                                     // ab hier dynamisch angelegte
    1554                 :            : 
    1555                 :        985 :     ShowHide( pGridWin[SC_SPLIT_BOTTOMRIGHT], bShowH );
    1556                 :        985 :     ShowHide( pGridWin[SC_SPLIT_TOPLEFT], bShowV );
    1557 [ #  # ][ -  + ]:        985 :     ShowHide( pGridWin[SC_SPLIT_TOPRIGHT], bShowH && bShowV );
    1558                 :            : 
    1559                 :        985 :     ShowHide( pColOutline[SC_SPLIT_LEFT], bHOutline );
    1560 [ #  # ][ -  + ]:        985 :     ShowHide( pColOutline[SC_SPLIT_RIGHT], bShowH && bHOutline );
    1561                 :            : 
    1562                 :        985 :     ShowHide( pRowOutline[SC_SPLIT_BOTTOM], bVOutline );
    1563 [ #  # ][ -  + ]:        985 :     ShowHide( pRowOutline[SC_SPLIT_TOP], bShowV && bVOutline );
    1564                 :            : 
    1565 [ #  # ][ -  + ]:        985 :     ShowHide( pColBar[SC_SPLIT_RIGHT], bShowH && bHeader );
    1566 [ #  # ][ -  + ]:        985 :     ShowHide( pRowBar[SC_SPLIT_TOP], bShowV && bHeader );
    1567                 :            : 
    1568                 :            : 
    1569                 :            :     //! neue Gridwindows eintragen
    1570                 :        985 : }
    1571                 :            : 
    1572                 :        303 : void ScTabView::UpdateVisibleRange()
    1573                 :            : {
    1574         [ +  + ]:       1515 :     for (int i = 0; i < 4; ++i)
    1575                 :            :     {
    1576 [ +  + ][ -  + ]:       1212 :         if (!pGridWin[i] || !pGridWin[i]->IsVisible())
                 [ +  + ]
    1577                 :        909 :             continue;
    1578                 :            : 
    1579                 :        303 :         pGridWin[i]->UpdateVisibleRange();
    1580                 :            :     }
    1581                 :        303 : }
    1582                 :            : 
    1583                 :            : // ---  Splitter  --------------------------------------------------------
    1584                 :            : 
    1585                 :          0 : IMPL_LINK( ScTabView, SplitHdl, Splitter*, pSplitter )
    1586                 :            : {
    1587         [ #  # ]:          0 :     if ( pSplitter == pHSplitter )
    1588                 :          0 :         DoHSplit( pHSplitter->GetSplitPosPixel() );
    1589                 :            :     else
    1590                 :          0 :         DoVSplit( pVSplitter->GetSplitPosPixel() );
    1591                 :            : 
    1592 [ #  # ][ #  # ]:          0 :     if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX || aViewData.GetVSplitMode() == SC_SPLIT_FIX )
                 [ #  # ]
    1593                 :          0 :         FreezeSplitters( sal_True );
    1594                 :            : 
    1595                 :          0 :     DoResize( aBorderPos, aFrameSize );
    1596                 :            : 
    1597                 :          0 :     return 0;
    1598                 :            : }
    1599                 :            : 
    1600                 :          0 : void ScTabView::DoHSplit(long nSplitPos)
    1601                 :            : {
    1602                 :            :     //  nSplitPos is the real pixel position on the frame window,
    1603                 :            :     //  mirroring for RTL has to be done here.
    1604                 :            : 
    1605                 :          0 :     sal_Bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
    1606         [ #  # ]:          0 :     if ( bLayoutRTL )
    1607                 :          0 :         nSplitPos = pFrameWin->GetOutputSizePixel().Width() - nSplitPos - 1;
    1608                 :            : 
    1609                 :            :     long nMinPos;
    1610                 :            :     long nMaxPos;
    1611                 :            :     SCCOL nOldDelta;
    1612                 :            :     SCCOL nNewDelta;
    1613                 :            : 
    1614                 :          0 :     nMinPos = SPLIT_MARGIN;
    1615 [ #  # ][ #  # ]:          0 :     if ( pRowBar[SC_SPLIT_BOTTOM] && pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width() >= nMinPos )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1616                 :          0 :         nMinPos = pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width() + 1;
    1617                 :          0 :     nMaxPos = aFrameSize.Width() - SPLIT_MARGIN;
    1618                 :            : 
    1619                 :          0 :     ScSplitMode aOldMode = aViewData.GetHSplitMode();
    1620                 :          0 :     ScSplitMode aNewMode = SC_SPLIT_NORMAL;
    1621                 :            : 
    1622                 :          0 :     aViewData.SetHSplitPos( nSplitPos );
    1623 [ #  # ][ #  # ]:          0 :     if ( nSplitPos < nMinPos || nSplitPos > nMaxPos )
    1624                 :          0 :         aNewMode = SC_SPLIT_NONE;
    1625                 :            : 
    1626                 :          0 :     aViewData.SetHSplitMode( aNewMode );
    1627                 :            : 
    1628         [ #  # ]:          0 :     if ( aNewMode != aOldMode )
    1629                 :            :     {
    1630                 :          0 :         UpdateShow();       // vor ActivatePart !!
    1631                 :            : 
    1632         [ #  # ]:          0 :         if ( aNewMode == SC_SPLIT_NONE )
    1633                 :            :         {
    1634         [ #  # ]:          0 :             if (aViewData.GetActivePart() == SC_SPLIT_TOPRIGHT)
    1635                 :          0 :                 ActivatePart( SC_SPLIT_TOPLEFT );
    1636         [ #  # ]:          0 :             if (aViewData.GetActivePart() == SC_SPLIT_BOTTOMRIGHT)
    1637                 :          0 :                 ActivatePart( SC_SPLIT_BOTTOMLEFT );
    1638                 :            :         }
    1639                 :            :         else
    1640                 :            :         {
    1641                 :          0 :             nOldDelta = aViewData.GetPosX( SC_SPLIT_LEFT );
    1642                 :          0 :             long nLeftWidth = nSplitPos - pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
    1643         [ #  # ]:          0 :             if ( nLeftWidth < 0 ) nLeftWidth = 0;
    1644                 :            :             nNewDelta = nOldDelta + aViewData.CellsAtX( nOldDelta, 1, SC_SPLIT_LEFT,
    1645                 :          0 :                             (sal_uInt16) nLeftWidth );
    1646         [ #  # ]:          0 :             if ( nNewDelta > MAXCOL )
    1647                 :          0 :                 nNewDelta = MAXCOL;
    1648                 :          0 :             aViewData.SetPosX( SC_SPLIT_RIGHT, nNewDelta );
    1649         [ #  # ]:          0 :             if ( nNewDelta > aViewData.GetCurX() )
    1650                 :          0 :                 ActivatePart( (WhichV(aViewData.GetActivePart()) == SC_SPLIT_BOTTOM) ?
    1651         [ #  # ]:          0 :                     SC_SPLIT_BOTTOMLEFT : SC_SPLIT_TOPLEFT );
    1652                 :            :             else
    1653                 :          0 :                 ActivatePart( (WhichV(aViewData.GetActivePart()) == SC_SPLIT_BOTTOM) ?
    1654         [ #  # ]:          0 :                     SC_SPLIT_BOTTOMRIGHT : SC_SPLIT_TOPRIGHT );
    1655                 :            :         }
    1656                 :            : 
    1657                 :            :         //  Form-Layer muss den sichtbaren Ausschnitt aller Fenster kennen
    1658                 :            :         //  dafuer muss hier schon der MapMode stimmen
    1659         [ #  # ]:          0 :         for (sal_uInt16 i=0; i<4; i++)
    1660         [ #  # ]:          0 :             if (pGridWin[i])
    1661         [ #  # ]:          0 :                 pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() );
    1662                 :          0 :         SetNewVisArea();
    1663                 :            : 
    1664                 :          0 :         PaintGrid();
    1665                 :          0 :         PaintTop();
    1666                 :            : 
    1667                 :          0 :         InvalidateSplit();
    1668                 :            :     }
    1669                 :          0 : }
    1670                 :            : 
    1671                 :          0 : void ScTabView::DoVSplit(long nSplitPos)
    1672                 :            : {
    1673                 :            :     long nMinPos;
    1674                 :            :     long nMaxPos;
    1675                 :            :     SCROW nOldDelta;
    1676                 :            :     SCROW nNewDelta;
    1677                 :            : 
    1678                 :          0 :     nMinPos = SPLIT_MARGIN;
    1679 [ #  # ][ #  # ]:          0 :     if ( pColBar[SC_SPLIT_LEFT] && pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height() >= nMinPos )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1680                 :          0 :         nMinPos = pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height() + 1;
    1681                 :          0 :     nMaxPos = aFrameSize.Height() - SPLIT_MARGIN;
    1682                 :            : 
    1683                 :          0 :     ScSplitMode aOldMode = aViewData.GetVSplitMode();
    1684                 :          0 :     ScSplitMode aNewMode = SC_SPLIT_NORMAL;
    1685                 :            : 
    1686                 :          0 :     aViewData.SetVSplitPos( nSplitPos );
    1687 [ #  # ][ #  # ]:          0 :     if ( nSplitPos < nMinPos || nSplitPos > nMaxPos )
    1688                 :          0 :         aNewMode = SC_SPLIT_NONE;
    1689                 :            : 
    1690                 :          0 :     aViewData.SetVSplitMode( aNewMode );
    1691                 :            : 
    1692         [ #  # ]:          0 :     if ( aNewMode != aOldMode )
    1693                 :            :     {
    1694                 :          0 :         UpdateShow();       // vor ActivatePart !!
    1695                 :            : 
    1696         [ #  # ]:          0 :         if ( aNewMode == SC_SPLIT_NONE )
    1697                 :            :         {
    1698                 :          0 :             nOldDelta = aViewData.GetPosY( SC_SPLIT_TOP );
    1699                 :          0 :             aViewData.SetPosY( SC_SPLIT_BOTTOM, nOldDelta );
    1700                 :            : 
    1701         [ #  # ]:          0 :             if (aViewData.GetActivePart() == SC_SPLIT_TOPLEFT)
    1702                 :          0 :                 ActivatePart( SC_SPLIT_BOTTOMLEFT );
    1703         [ #  # ]:          0 :             if (aViewData.GetActivePart() == SC_SPLIT_TOPRIGHT)
    1704                 :          0 :                 ActivatePart( SC_SPLIT_BOTTOMRIGHT );
    1705                 :            :         }
    1706                 :            :         else
    1707                 :            :         {
    1708         [ #  # ]:          0 :             if ( aOldMode == SC_SPLIT_NONE )
    1709                 :          0 :                 nOldDelta = aViewData.GetPosY( SC_SPLIT_BOTTOM );
    1710                 :            :             else
    1711                 :          0 :                 nOldDelta = aViewData.GetPosY( SC_SPLIT_TOP );
    1712                 :            : 
    1713                 :          0 :             aViewData.SetPosY( SC_SPLIT_TOP, nOldDelta );
    1714                 :          0 :             long nTopHeight = nSplitPos - pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
    1715         [ #  # ]:          0 :             if ( nTopHeight < 0 ) nTopHeight = 0;
    1716                 :            :             nNewDelta = nOldDelta + aViewData.CellsAtY( nOldDelta, 1, SC_SPLIT_TOP,
    1717                 :          0 :                             (sal_uInt16) nTopHeight );
    1718         [ #  # ]:          0 :             if ( nNewDelta > MAXROW )
    1719                 :          0 :                 nNewDelta = MAXROW;
    1720                 :          0 :             aViewData.SetPosY( SC_SPLIT_BOTTOM, nNewDelta );
    1721         [ #  # ]:          0 :             if ( nNewDelta > aViewData.GetCurY() )
    1722                 :          0 :                 ActivatePart( (WhichH(aViewData.GetActivePart()) == SC_SPLIT_LEFT) ?
    1723                 :          0 :                     SC_SPLIT_TOPLEFT : SC_SPLIT_TOPRIGHT );
    1724                 :            :             else
    1725                 :          0 :                 ActivatePart( (WhichH(aViewData.GetActivePart()) == SC_SPLIT_LEFT) ?
    1726         [ #  # ]:          0 :                     SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT );
    1727                 :            :         }
    1728                 :            : 
    1729                 :            :         //  Form-Layer muss den sichtbaren Ausschnitt aller Fenster kennen
    1730                 :            :         //  dafuer muss hier schon der MapMode stimmen
    1731         [ #  # ]:          0 :         for (sal_uInt16 i=0; i<4; i++)
    1732         [ #  # ]:          0 :             if (pGridWin[i])
    1733         [ #  # ]:          0 :                 pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() );
    1734                 :          0 :         SetNewVisArea();
    1735                 :            : 
    1736                 :          0 :         PaintGrid();
    1737                 :          0 :         PaintLeft();
    1738                 :            : 
    1739                 :          0 :         InvalidateSplit();
    1740                 :            :     }
    1741                 :          0 : }
    1742                 :            : 
    1743                 :          0 : Point ScTabView::GetInsertPos()
    1744                 :            : {
    1745                 :          0 :     ScDocument* pDoc = aViewData.GetDocument();
    1746                 :          0 :     SCCOL nCol = aViewData.GetCurX();
    1747                 :          0 :     SCROW nRow = aViewData.GetCurY();
    1748                 :          0 :     SCTAB nTab = aViewData.GetTabNo();
    1749                 :          0 :     long nPosX = 0;
    1750         [ #  # ]:          0 :     for (SCCOL i=0; i<nCol; i++)
    1751                 :          0 :         nPosX += pDoc->GetColWidth(i,nTab);
    1752                 :          0 :     nPosX = (long)(nPosX * HMM_PER_TWIPS);
    1753         [ #  # ]:          0 :     if ( pDoc->IsNegativePage( nTab ) )
    1754                 :          0 :         nPosX = -nPosX;
    1755                 :          0 :     long nPosY = (long) pDoc->GetRowHeight( 0, nRow-1, nTab);
    1756                 :          0 :     nPosY = (long)(nPosY * HMM_PER_TWIPS);
    1757                 :          0 :     return Point(nPosX,nPosY);
    1758                 :            : }
    1759                 :            : 
    1760                 :          0 : Point ScTabView::GetChartInsertPos( const Size& rSize, const ScRange& rCellRange )
    1761                 :            : {
    1762                 :          0 :     Point aInsertPos;
    1763                 :          0 :     const long nBorder = 100;   // leave 1mm for border
    1764                 :          0 :     long nNeededWidth = rSize.Width() + 2 * nBorder;
    1765                 :          0 :     long nNeededHeight = rSize.Height() + 2 * nBorder;
    1766                 :            : 
    1767                 :            :     // use the active window, or lower/right if frozen (as in CalcZoom)
    1768                 :          0 :     ScSplitPos eUsedPart = aViewData.GetActivePart();
    1769         [ #  # ]:          0 :     if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
    1770         [ #  # ]:          0 :         eUsedPart = (WhichV(eUsedPart)==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT;
    1771         [ #  # ]:          0 :     if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
    1772         [ #  # ]:          0 :         eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
    1773                 :            : 
    1774                 :          0 :     ScGridWindow* pWin = pGridWin[eUsedPart];
    1775                 :            :     OSL_ENSURE( pWin, "Window not found" );
    1776         [ #  # ]:          0 :     if (pWin)
    1777                 :            :     {
    1778         [ #  # ]:          0 :         ActivatePart( eUsedPart );
    1779                 :            : 
    1780                 :            :         //  get the visible rectangle in logic units
    1781                 :            : 
    1782         [ #  # ]:          0 :         MapMode aDrawMode = pWin->GetDrawMapMode();
    1783 [ #  # ][ #  # ]:          0 :         Rectangle aVisible( pWin->PixelToLogic( Rectangle( Point(0,0), pWin->GetOutputSizePixel() ), aDrawMode ) );
    1784                 :            : 
    1785         [ #  # ]:          0 :         ScDocument* pDoc = aViewData.GetDocument();
    1786                 :          0 :         SCTAB nTab = aViewData.GetTabNo();
    1787         [ #  # ]:          0 :         sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
    1788         [ #  # ]:          0 :         long nLayoutSign = bLayoutRTL ? -1 : 1;
    1789                 :            : 
    1790         [ #  # ]:          0 :         long nDocX = (long)( (double) pDoc->GetColOffset( MAXCOL + 1, nTab ) * HMM_PER_TWIPS ) * nLayoutSign;
    1791         [ #  # ]:          0 :         long nDocY = (long)( (double) pDoc->GetRowOffset( MAXROW + 1, nTab ) * HMM_PER_TWIPS );
    1792                 :            : 
    1793         [ #  # ]:          0 :         if ( aVisible.Left() * nLayoutSign > nDocX * nLayoutSign )
    1794                 :          0 :             aVisible.Left() = nDocX;
    1795         [ #  # ]:          0 :         if ( aVisible.Right() * nLayoutSign > nDocX * nLayoutSign )
    1796                 :          0 :             aVisible.Right() = nDocX;
    1797         [ #  # ]:          0 :         if ( aVisible.Top() > nDocY )
    1798                 :          0 :             aVisible.Top() = nDocY;
    1799         [ #  # ]:          0 :         if ( aVisible.Bottom() > nDocY )
    1800                 :          0 :             aVisible.Bottom() = nDocY;
    1801                 :            : 
    1802                 :            :         //  get the logic position of the selection
    1803                 :            : 
    1804                 :          0 :         Rectangle aSelection = pDoc->GetMMRect( rCellRange.aStart.Col(), rCellRange.aStart.Row(),
    1805         [ #  # ]:          0 :                                                 rCellRange.aEnd.Col(), rCellRange.aEnd.Row(), nTab );
    1806                 :            : 
    1807                 :          0 :         long nLeftSpace = aSelection.Left() - aVisible.Left();
    1808                 :          0 :         long nRightSpace = aVisible.Right() - aSelection.Right();
    1809                 :          0 :         long nTopSpace = aSelection.Top() - aVisible.Top();
    1810                 :          0 :         long nBottomSpace = aVisible.Bottom() - aSelection.Bottom();
    1811                 :            : 
    1812                 :          0 :         bool bFitLeft = ( nLeftSpace >= nNeededWidth );
    1813                 :          0 :         bool bFitRight = ( nRightSpace >= nNeededWidth );
    1814                 :            : 
    1815 [ #  # ][ #  # ]:          0 :         if ( bFitLeft || bFitRight )
    1816                 :            :         {
    1817                 :            :             // first preference: completely left or right of the selection
    1818                 :            : 
    1819                 :            :             // if both fit, prefer left in RTL mode, right otherwise
    1820 [ #  # ][ #  # ]:          0 :             bool bPutLeft = bFitLeft && ( bLayoutRTL || !bFitRight );
                 [ #  # ]
    1821                 :            : 
    1822         [ #  # ]:          0 :             if ( bPutLeft )
    1823                 :          0 :                 aInsertPos.X() = aSelection.Left() - nNeededWidth;
    1824                 :            :             else
    1825                 :          0 :                 aInsertPos.X() = aSelection.Right() + 1;
    1826                 :            : 
    1827                 :            :             // align with top of selection (is moved again if it doesn't fit)
    1828         [ #  # ]:          0 :             aInsertPos.Y() = std::max( aSelection.Top(), aVisible.Top() );
    1829                 :            :         }
    1830 [ #  # ][ #  # ]:          0 :         else if ( nTopSpace >= nNeededHeight || nBottomSpace >= nNeededHeight )
    1831                 :            :         {
    1832                 :            :             // second preference: completely above or below the selection
    1833                 :            : 
    1834         [ #  # ]:          0 :             if ( nBottomSpace > nNeededHeight )             // bottom is preferred
    1835                 :          0 :                 aInsertPos.Y() = aSelection.Bottom() + 1;
    1836                 :            :             else
    1837                 :          0 :                 aInsertPos.Y() = aSelection.Top() - nNeededHeight;
    1838                 :            : 
    1839                 :            :             // align with (logic) left edge of selection (moved again if it doesn't fit)
    1840         [ #  # ]:          0 :             if ( bLayoutRTL )
    1841         [ #  # ]:          0 :                 aInsertPos.X() = std::min( aSelection.Right(), aVisible.Right() ) - nNeededWidth + 1;
    1842                 :            :             else
    1843         [ #  # ]:          0 :                 aInsertPos.X() = std::max( aSelection.Left(), aVisible.Left() );
    1844                 :            :         }
    1845                 :            :         else
    1846                 :            :         {
    1847                 :            :             // place to the (logic) right of the selection and move so it fits
    1848                 :            : 
    1849         [ #  # ]:          0 :             if ( bLayoutRTL )
    1850                 :          0 :                 aInsertPos.X() = aSelection.Left() - nNeededWidth;
    1851                 :            :             else
    1852                 :          0 :                 aInsertPos.X() = aSelection.Right() + 1;
    1853         [ #  # ]:          0 :             aInsertPos.Y() = std::max( aSelection.Top(), aVisible.Top() );
    1854                 :            :         }
    1855                 :            : 
    1856                 :            :         // move the position if the object doesn't fit in the screen
    1857                 :            : 
    1858         [ #  # ]:          0 :         Rectangle aCompareRect( aInsertPos, Size( nNeededWidth, nNeededHeight ) );
    1859         [ #  # ]:          0 :         if ( aCompareRect.Right() > aVisible.Right() )
    1860                 :          0 :             aInsertPos.X() -= aCompareRect.Right() - aVisible.Right();
    1861         [ #  # ]:          0 :         if ( aCompareRect.Bottom() > aVisible.Bottom() )
    1862                 :          0 :             aInsertPos.Y() -= aCompareRect.Bottom() - aVisible.Bottom();
    1863                 :            : 
    1864         [ #  # ]:          0 :         if ( aInsertPos.X() < aVisible.Left() )
    1865                 :          0 :             aInsertPos.X() = aVisible.Left();
    1866         [ #  # ]:          0 :         if ( aInsertPos.Y() < aVisible.Top() )
    1867                 :          0 :             aInsertPos.Y() = aVisible.Top();
    1868                 :            : 
    1869                 :            :         // nNeededWidth / nNeededHeight includes all borders - move aInsertPos to the
    1870                 :            :         // object position, inside the border
    1871                 :            : 
    1872                 :          0 :         aInsertPos.X() += nBorder;
    1873         [ #  # ]:          0 :         aInsertPos.Y() += nBorder;
    1874                 :            :     }
    1875                 :          0 :     return aInsertPos;
    1876                 :            : }
    1877                 :            : 
    1878                 :          0 : Point ScTabView::GetChartDialogPos( const Size& rDialogSize, const Rectangle& rLogicChart )
    1879                 :            : {
    1880                 :            :     // rDialogSize must be in pixels, rLogicChart in 1/100 mm. Return value is in pixels.
    1881                 :            : 
    1882                 :          0 :     Point aRet;
    1883                 :            : 
    1884                 :            :     // use the active window, or lower/right if frozen (as in CalcZoom)
    1885                 :          0 :     ScSplitPos eUsedPart = aViewData.GetActivePart();
    1886         [ #  # ]:          0 :     if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
    1887         [ #  # ]:          0 :         eUsedPart = (WhichV(eUsedPart)==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT;
    1888         [ #  # ]:          0 :     if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
    1889         [ #  # ]:          0 :         eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
    1890                 :            : 
    1891                 :          0 :     ScGridWindow* pWin = pGridWin[eUsedPart];
    1892                 :            :     OSL_ENSURE( pWin, "Window not found" );
    1893         [ #  # ]:          0 :     if (pWin)
    1894                 :            :     {
    1895         [ #  # ]:          0 :         MapMode aDrawMode = pWin->GetDrawMapMode();
    1896         [ #  # ]:          0 :         Rectangle aObjPixel = pWin->LogicToPixel( rLogicChart, aDrawMode );
    1897                 :          0 :         Rectangle aObjAbs( pWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ),
    1898         [ #  # ]:          0 :                            pWin->OutputToAbsoluteScreenPixel( aObjPixel.BottomRight() ) );
           [ #  #  #  # ]
                 [ #  # ]
    1899                 :            : 
    1900         [ #  # ]:          0 :         Rectangle aDesktop = pWin->GetDesktopRectPixel();
    1901 [ #  # ][ #  # ]:          0 :         Size aSpace = pWin->LogicToPixel( Size( 8, 12 ), MAP_APPFONT );
                 [ #  # ]
    1902                 :            : 
    1903         [ #  # ]:          0 :         ScDocument* pDoc = aViewData.GetDocument();
    1904                 :          0 :         SCTAB nTab = aViewData.GetTabNo();
    1905         [ #  # ]:          0 :         sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
    1906                 :            : 
    1907                 :          0 :         bool bCenterHor = false;
    1908                 :            : 
    1909         [ #  # ]:          0 :         if ( aDesktop.Bottom() - aObjAbs.Bottom() >= rDialogSize.Height() + aSpace.Height() )
    1910                 :            :         {
    1911                 :            :             // first preference: below the chart
    1912                 :            : 
    1913                 :          0 :             aRet.Y() = aObjAbs.Bottom() + aSpace.Height();
    1914                 :          0 :             bCenterHor = true;
    1915                 :            :         }
    1916         [ #  # ]:          0 :         else if ( aObjAbs.Top() - aDesktop.Top() >= rDialogSize.Height() + aSpace.Height() )
    1917                 :            :         {
    1918                 :            :             // second preference: above the chart
    1919                 :            : 
    1920                 :          0 :             aRet.Y() = aObjAbs.Top() - rDialogSize.Height() - aSpace.Height();
    1921                 :          0 :             bCenterHor = true;
    1922                 :            :         }
    1923                 :            :         else
    1924                 :            :         {
    1925                 :          0 :             bool bFitLeft = ( aObjAbs.Left() - aDesktop.Left() >= rDialogSize.Width() + aSpace.Width() );
    1926                 :          0 :             bool bFitRight = ( aDesktop.Right() - aObjAbs.Right() >= rDialogSize.Width() + aSpace.Width() );
    1927                 :            : 
    1928 [ #  # ][ #  # ]:          0 :             if ( bFitLeft || bFitRight )
    1929                 :            :             {
    1930                 :            :                 // if both fit, prefer right in RTL mode, left otherwise
    1931 [ #  # ][ #  # ]:          0 :                 bool bPutRight = bFitRight && ( bLayoutRTL || !bFitLeft );
                 [ #  # ]
    1932         [ #  # ]:          0 :                 if ( bPutRight )
    1933                 :          0 :                     aRet.X() = aObjAbs.Right() + aSpace.Width();
    1934                 :            :                 else
    1935                 :          0 :                     aRet.X() = aObjAbs.Left() - rDialogSize.Width() - aSpace.Width();
    1936                 :            : 
    1937                 :            :                 // center vertically
    1938         [ #  # ]:          0 :                 aRet.Y() = aObjAbs.Top() + ( aObjAbs.GetHeight() - rDialogSize.Height() ) / 2;
    1939                 :            :             }
    1940                 :            :             else
    1941                 :            :             {
    1942                 :            :                 // doesn't fit on any edge - put at the bottom of the screen
    1943                 :          0 :                 aRet.Y() = aDesktop.Bottom() - rDialogSize.Height();
    1944                 :          0 :                 bCenterHor = true;
    1945                 :            :             }
    1946                 :            :         }
    1947         [ #  # ]:          0 :         if ( bCenterHor )
    1948         [ #  # ]:          0 :             aRet.X() = aObjAbs.Left() + ( aObjAbs.GetWidth() - rDialogSize.Width() ) / 2;
    1949                 :            : 
    1950                 :            :         // limit to screen (centering might lead to invalid positions)
    1951         [ #  # ]:          0 :         if ( aRet.X() + rDialogSize.Width() - 1 > aDesktop.Right() )
    1952                 :          0 :             aRet.X() = aDesktop.Right() - rDialogSize.Width() + 1;
    1953         [ #  # ]:          0 :         if ( aRet.X() < aDesktop.Left() )
    1954                 :          0 :             aRet.X() = aDesktop.Left();
    1955         [ #  # ]:          0 :         if ( aRet.Y() + rDialogSize.Height() - 1 > aDesktop.Bottom() )
    1956                 :          0 :             aRet.Y() = aDesktop.Bottom() - rDialogSize.Height() + 1;
    1957         [ #  # ]:          0 :         if ( aRet.Y() < aDesktop.Top() )
    1958         [ #  # ]:          0 :             aRet.Y() = aDesktop.Top();
    1959                 :            :     }
    1960                 :            : 
    1961                 :          0 :     return aRet;
    1962                 :            : }
    1963                 :            : 
    1964                 :          0 : void ScTabView::LockModifiers( sal_uInt16 nModifiers )
    1965                 :            : {
    1966                 :          0 :     pSelEngine->LockModifiers( nModifiers );
    1967                 :          0 :     pHdrSelEng->LockModifiers( nModifiers );
    1968                 :          0 : }
    1969                 :            : 
    1970                 :        247 : sal_uInt16 ScTabView::GetLockedModifiers() const
    1971                 :            : {
    1972                 :        247 :     return pSelEngine->GetLockedModifiers();
    1973                 :            : }
    1974                 :            : 
    1975                 :          0 : Point ScTabView::GetMousePosPixel()
    1976                 :            : {
    1977                 :          0 :     Point aPos;
    1978                 :          0 :     ScGridWindow* pWin = (ScGridWindow*)GetActiveWin();
    1979                 :            : 
    1980         [ #  # ]:          0 :     if ( pWin )
    1981                 :          0 :         aPos = pWin->GetMousePosPixel();
    1982                 :            : 
    1983                 :          0 :     return aPos;
    1984                 :            : }
    1985                 :            : 
    1986                 :          0 : sal_Bool lcl_MouseIsOverWin( const Point& rScreenPosPixel, Window* pWin )
    1987                 :            : {
    1988         [ #  # ]:          0 :     if (pWin)
    1989                 :            :     {
    1990                 :            :         //  SPLIT_HANDLE_SIZE draufaddieren, damit das Einrasten genau
    1991                 :            :         //  auf dem Splitter nicht aussetzt
    1992                 :            : 
    1993         [ #  # ]:          0 :         Point aRel = pWin->NormalizedScreenToOutputPixel( rScreenPosPixel );
    1994                 :          0 :         Size aWinSize = pWin->GetOutputSizePixel();
    1995   [ #  #  #  #  :          0 :         if ( aRel.X() >= 0 && aRel.X() < aWinSize.Width() + SPLIT_HANDLE_SIZE &&
           #  # ][ #  # ]
                 [ #  # ]
    1996                 :          0 :                 aRel.Y() >= 0 && aRel.Y() < aWinSize.Height() + SPLIT_HANDLE_SIZE )
    1997                 :          0 :             return sal_True;
    1998                 :            :     }
    1999                 :          0 :     return false;
    2000                 :            : }
    2001                 :            : 
    2002                 :          0 : void ScTabView::SnapSplitPos( Point& rScreenPosPixel )
    2003                 :            : {
    2004                 :          0 :     sal_Bool bOverWin = false;
    2005                 :            :     sal_uInt16 i;
    2006         [ #  # ]:          0 :     for (i=0; i<4; i++)
    2007 [ #  # ][ #  # ]:          0 :         if (lcl_MouseIsOverWin(rScreenPosPixel,pGridWin[i]))
    2008                 :          0 :             bOverWin = sal_True;
    2009                 :            : 
    2010         [ #  # ]:          0 :     if (!bOverWin)
    2011                 :            :         return;
    2012                 :            : 
    2013                 :            :     //  don't snap to cells if the scale will be modified afterwards
    2014 [ #  # ][ #  # ]:          0 :     if ( GetZoomType() != SVX_ZOOM_PERCENT )
    2015                 :            :         return;
    2016                 :            : 
    2017                 :          0 :     ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
    2018         [ #  # ]:          0 :     if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
    2019                 :          0 :         ePos = SC_SPLIT_TOPLEFT;
    2020                 :            : 
    2021                 :          0 :     Window* pWin = pGridWin[ePos];
    2022         [ #  # ]:          0 :     if (!pWin)
    2023                 :            :     {
    2024                 :            :         OSL_FAIL("Window NULL");
    2025                 :            :         return;
    2026                 :            :     }
    2027                 :            : 
    2028         [ #  # ]:          0 :     Point aMouse = pWin->NormalizedScreenToOutputPixel( rScreenPosPixel );
    2029                 :            :     SCsCOL nPosX;
    2030                 :            :     SCsROW nPosY;
    2031                 :            :     //  bNextIfLarge=FALSE: nicht auf naechste Zelle, wenn ausserhalb des Fensters
    2032         [ #  # ]:          0 :     aViewData.GetPosFromPixel( aMouse.X(), aMouse.Y(), ePos, nPosX, nPosY, true, false, false );
    2033                 :            :     sal_Bool bLeft;
    2034                 :            :     sal_Bool bTop;
    2035         [ #  # ]:          0 :     aViewData.GetMouseQuadrant( aMouse, ePos, nPosX, nPosY, bLeft, bTop );
    2036         [ #  # ]:          0 :     if (!bLeft)
    2037                 :          0 :         ++nPosX;
    2038         [ #  # ]:          0 :     if (!bTop)
    2039                 :          0 :         ++nPosY;
    2040         [ #  # ]:          0 :     aMouse = aViewData.GetScrPos( static_cast<SCCOL>(nPosX), static_cast<SCROW>(nPosY), ePos, sal_True );
    2041         [ #  # ]:          0 :     rScreenPosPixel = pWin->OutputToNormalizedScreenPixel( aMouse );
    2042                 :            : }
    2043                 :            : 
    2044                 :          0 : void ScTabView::FreezeSplitters( bool bFreeze )
    2045                 :            : {
    2046                 :          0 :     ScSplitMode eOldH = aViewData.GetHSplitMode();
    2047                 :          0 :     ScSplitMode eOldV = aViewData.GetVSplitMode();
    2048                 :            : 
    2049                 :          0 :     ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
    2050         [ #  # ]:          0 :     if ( eOldV != SC_SPLIT_NONE )
    2051                 :          0 :         ePos = SC_SPLIT_TOPLEFT;
    2052                 :          0 :     Window* pWin = pGridWin[ePos];
    2053                 :            : 
    2054                 :          0 :     bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
    2055                 :            : 
    2056         [ #  # ]:          0 :     if ( bFreeze )
    2057                 :            :     {
    2058         [ #  # ]:          0 :         Point aWinStart = pWin->GetPosPixel();
    2059                 :            : 
    2060                 :          0 :         Point aSplit;
    2061                 :            :         SCsCOL nPosX;
    2062                 :            :         SCsROW nPosY;
    2063 [ #  # ][ #  # ]:          0 :         if (eOldH != SC_SPLIT_NONE || eOldV != SC_SPLIT_NONE)
    2064                 :            :         {
    2065         [ #  # ]:          0 :             if (eOldH != SC_SPLIT_NONE)
    2066                 :            :             {
    2067                 :          0 :                 long nSplitPos = aViewData.GetHSplitPos();
    2068         [ #  # ]:          0 :                 if ( bLayoutRTL )
    2069                 :          0 :                     nSplitPos = pFrameWin->GetOutputSizePixel().Width() - nSplitPos - 1;
    2070                 :          0 :                 aSplit.X() = nSplitPos - aWinStart.X();
    2071                 :            :             }
    2072         [ #  # ]:          0 :             if (eOldV != SC_SPLIT_NONE)
    2073                 :          0 :                 aSplit.Y() = aViewData.GetVSplitPos() - aWinStart.Y();
    2074                 :            : 
    2075         [ #  # ]:          0 :             aViewData.GetPosFromPixel( aSplit.X(), aSplit.Y(), ePos, nPosX, nPosY );
    2076                 :            :             sal_Bool bLeft;
    2077                 :            :             sal_Bool bTop;
    2078         [ #  # ]:          0 :             aViewData.GetMouseQuadrant( aSplit, ePos, nPosX, nPosY, bLeft, bTop );
    2079         [ #  # ]:          0 :             if (!bLeft)
    2080                 :          0 :                 ++nPosX;
    2081         [ #  # ]:          0 :             if (!bTop)
    2082                 :          0 :                 ++nPosY;
    2083                 :            :         }
    2084                 :            :         else
    2085                 :            :         {
    2086                 :          0 :             nPosX = static_cast<SCsCOL>( aViewData.GetCurX());
    2087                 :          0 :             nPosY = static_cast<SCsROW>( aViewData.GetCurY());
    2088                 :            :         }
    2089                 :            : 
    2090                 :          0 :         SCCOL nLeftPos = aViewData.GetPosX(SC_SPLIT_LEFT);
    2091                 :          0 :         SCROW nTopPos = aViewData.GetPosY(SC_SPLIT_BOTTOM);
    2092                 :          0 :         SCCOL nRightPos = static_cast<SCCOL>(nPosX);
    2093                 :          0 :         SCROW nBottomPos = static_cast<SCROW>(nPosY);
    2094         [ #  # ]:          0 :         if (eOldH != SC_SPLIT_NONE)
    2095         [ #  # ]:          0 :             if (aViewData.GetPosX(SC_SPLIT_RIGHT) > nRightPos)
    2096                 :          0 :                 nRightPos = aViewData.GetPosX(SC_SPLIT_RIGHT);
    2097         [ #  # ]:          0 :         if (eOldV != SC_SPLIT_NONE)
    2098                 :            :         {
    2099                 :          0 :             nTopPos = aViewData.GetPosY(SC_SPLIT_TOP);
    2100         [ #  # ]:          0 :             if (aViewData.GetPosY(SC_SPLIT_BOTTOM) > nBottomPos)
    2101                 :          0 :                 nBottomPos = aViewData.GetPosY(SC_SPLIT_BOTTOM);
    2102                 :            :         }
    2103                 :            : 
    2104         [ #  # ]:          0 :         aSplit = aViewData.GetScrPos( static_cast<SCCOL>(nPosX), static_cast<SCROW>(nPosY), ePos, true );
    2105         [ #  # ]:          0 :         if (nPosX > aViewData.GetPosX(SC_SPLIT_LEFT))       // (aSplit.X() > 0) doesn't work for RTL
    2106                 :            :         {
    2107                 :          0 :             long nSplitPos = aSplit.X() + aWinStart.X();
    2108         [ #  # ]:          0 :             if ( bLayoutRTL )
    2109                 :          0 :                 nSplitPos = pFrameWin->GetOutputSizePixel().Width() - nSplitPos - 1;
    2110                 :            : 
    2111                 :          0 :             aViewData.SetHSplitMode( SC_SPLIT_FIX );
    2112                 :          0 :             aViewData.SetHSplitPos( nSplitPos );
    2113                 :          0 :             aViewData.SetFixPosX( nPosX );
    2114                 :            : 
    2115         [ #  # ]:          0 :             aViewData.SetPosX(SC_SPLIT_LEFT, nLeftPos);
    2116         [ #  # ]:          0 :             aViewData.SetPosX(SC_SPLIT_RIGHT, nRightPos);
    2117                 :            :         }
    2118                 :            :         else
    2119                 :          0 :             aViewData.SetHSplitMode( SC_SPLIT_NONE );
    2120         [ #  # ]:          0 :         if (aSplit.Y() > 0)
    2121                 :            :         {
    2122                 :          0 :             aViewData.SetVSplitMode( SC_SPLIT_FIX );
    2123                 :          0 :             aViewData.SetVSplitPos( aSplit.Y() + aWinStart.Y() );
    2124                 :          0 :             aViewData.SetFixPosY( nPosY );
    2125                 :            : 
    2126         [ #  # ]:          0 :             aViewData.SetPosY(SC_SPLIT_TOP, nTopPos);
    2127         [ #  # ]:          0 :             aViewData.SetPosY(SC_SPLIT_BOTTOM, nBottomPos);
    2128                 :            :         }
    2129                 :            :         else
    2130                 :          0 :             aViewData.SetVSplitMode( SC_SPLIT_NONE );
    2131                 :            :     }
    2132                 :            :     else                        // Fixierung aufheben
    2133                 :            :     {
    2134         [ #  # ]:          0 :         if ( eOldH == SC_SPLIT_FIX )
    2135                 :          0 :             aViewData.SetHSplitMode( SC_SPLIT_NORMAL );
    2136         [ #  # ]:          0 :         if ( eOldV == SC_SPLIT_FIX )
    2137                 :          0 :             aViewData.SetVSplitMode( SC_SPLIT_NORMAL );
    2138                 :            :     }
    2139                 :            : 
    2140                 :            :     //  Form-Layer muss den sichtbaren Ausschnitt aller Fenster kennen
    2141                 :            :     //  dafuer muss hier schon der MapMode stimmen
    2142         [ #  # ]:          0 :     for (sal_uInt16 i=0; i<4; i++)
    2143         [ #  # ]:          0 :         if (pGridWin[i])
    2144         [ #  # ]:          0 :             pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() );
    2145                 :          0 :     SetNewVisArea();
    2146                 :            : 
    2147                 :          0 :     RepeatResize(false);
    2148                 :            : 
    2149                 :          0 :     UpdateShow();
    2150                 :          0 :     PaintLeft();
    2151                 :          0 :     PaintTop();
    2152                 :          0 :     PaintGrid();
    2153                 :            : 
    2154                 :            :     //  SC_FOLLOW_NONE: only update active part
    2155                 :          0 :     AlignToCursor( aViewData.GetCurX(), aViewData.GetCurY(), SC_FOLLOW_NONE );
    2156                 :          0 :     UpdateAutoFillMark();
    2157                 :            : 
    2158                 :          0 :     InvalidateSplit();
    2159                 :          0 : }
    2160                 :            : 
    2161                 :          0 : void ScTabView::RemoveSplit()
    2162                 :            : {
    2163                 :          0 :     DoHSplit( 0 );
    2164                 :          0 :     DoVSplit( 0 );
    2165                 :          0 :     RepeatResize();
    2166                 :          0 : }
    2167                 :            : 
    2168                 :          0 : void ScTabView::SplitAtCursor()
    2169                 :            : {
    2170                 :          0 :     ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
    2171         [ #  # ]:          0 :     if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
    2172                 :          0 :         ePos = SC_SPLIT_TOPLEFT;
    2173                 :          0 :     Window* pWin = pGridWin[ePos];
    2174         [ #  # ]:          0 :     Point aWinStart = pWin->GetPosPixel();
    2175                 :            : 
    2176                 :          0 :     SCCOL nPosX = aViewData.GetCurX();
    2177                 :          0 :     SCROW nPosY = aViewData.GetCurY();
    2178         [ #  # ]:          0 :     Point aSplit = aViewData.GetScrPos( nPosX, nPosY, ePos, sal_True );
    2179         [ #  # ]:          0 :     if ( nPosX > 0 )
    2180         [ #  # ]:          0 :         DoHSplit( aSplit.X() + aWinStart.X() );
    2181                 :            :     else
    2182         [ #  # ]:          0 :         DoHSplit( 0 );
    2183         [ #  # ]:          0 :     if ( nPosY > 0 )
    2184         [ #  # ]:          0 :         DoVSplit( aSplit.Y() + aWinStart.Y() );
    2185                 :            :     else
    2186         [ #  # ]:          0 :         DoVSplit( 0 );
    2187         [ #  # ]:          0 :     RepeatResize();
    2188                 :          0 : }
    2189                 :            : 
    2190                 :          0 : void ScTabView::SplitAtPixel( const Point& rPixel, bool bHor, bool bVer )
    2191                 :            : {
    2192                 :            :     //  Pixel ist auf die ganze View bezogen, nicht auf das erste GridWin
    2193                 :            : 
    2194         [ #  # ]:          0 :     if (bHor)
    2195                 :            :     {
    2196         [ #  # ]:          0 :         if ( rPixel.X() > 0 )
    2197                 :          0 :             DoHSplit( rPixel.X() );
    2198                 :            :         else
    2199                 :          0 :             DoHSplit( 0 );
    2200                 :            :     }
    2201         [ #  # ]:          0 :     if (bVer)
    2202                 :            :     {
    2203         [ #  # ]:          0 :         if ( rPixel.Y() > 0 )
    2204                 :          0 :             DoVSplit( rPixel.Y() );
    2205                 :            :         else
    2206                 :          0 :             DoVSplit( 0 );
    2207                 :            :     }
    2208                 :          0 :     RepeatResize();
    2209                 :          0 : }
    2210                 :            : 
    2211                 :        303 : void ScTabView::InvalidateSplit()
    2212                 :            : {
    2213                 :        303 :     SfxBindings& rBindings = aViewData.GetBindings();
    2214                 :        303 :     rBindings.Invalidate( SID_WINDOW_SPLIT );
    2215                 :        303 :     rBindings.Invalidate( SID_WINDOW_FIX );
    2216                 :            : 
    2217                 :        303 :     pHSplitter->SetFixed( aViewData.GetHSplitMode() == SC_SPLIT_FIX );
    2218                 :        303 :     pVSplitter->SetFixed( aViewData.GetVSplitMode() == SC_SPLIT_FIX );
    2219                 :        303 : }
    2220                 :            : 
    2221                 :       1064 : void ScTabView::SetNewVisArea()
    2222                 :            : {
    2223                 :            :     //  fuer die Controls muss bei VisAreaChanged der Draw-MapMode eingestellt sein
    2224                 :            :     //  (auch wenn ansonsten der Edit-MapMode gesetzt ist)
    2225 [ +  - ][ +  + ]:       9576 :     MapMode aOldMode[4];
           [ +  -  #  #  
                   #  # ]
    2226 [ +  - ][ +  + ]:       9576 :     MapMode aDrawMode[4];
           [ +  -  #  #  
                   #  # ]
    2227                 :            :     sal_uInt16 i;
    2228         [ +  + ]:       5320 :     for (i=0; i<4; i++)
    2229         [ +  + ]:       4256 :         if (pGridWin[i])
    2230                 :            :         {
    2231         [ +  - ]:       1064 :             aOldMode[i] = pGridWin[i]->GetMapMode();
    2232 [ +  - ][ +  - ]:       1064 :             aDrawMode[i] = pGridWin[i]->GetDrawMapMode();
                 [ +  - ]
    2233 [ +  - ][ -  + ]:       1064 :             if (aDrawMode[i] != aOldMode[i])
    2234         [ #  # ]:          0 :                 pGridWin[i]->SetMapMode(aDrawMode[i]);
    2235                 :            :         }
    2236                 :            : 
    2237                 :       1064 :     Window* pActive = pGridWin[aViewData.GetActivePart()];
    2238         [ +  - ]:       1064 :     if (pActive)
    2239                 :       1064 :         aViewData.GetViewShell()->VisAreaChanged(
    2240         [ +  - ]:       2128 :             pActive->PixelToLogic(Rectangle(Point(),pActive->GetOutputSizePixel())) );
           [ +  -  +  - ]
    2241         [ +  + ]:       1064 :     if (pDrawView)
    2242         [ +  - ]:        854 :         pDrawView->VisAreaChanged();    // kein Window uebergeben -> alle Fenster
    2243                 :            : 
    2244         [ +  - ]:       1064 :     UpdateAllOverlays();                // #i79909# with drawing MapMode set
    2245                 :            : 
    2246         [ +  + ]:       5320 :     for (i=0; i<4; i++)
    2247 [ +  + ][ +  - ]:       4256 :         if (pGridWin[i] && aDrawMode[i] != aOldMode[i])
         [ -  + ][ -  + ]
    2248                 :            :         {
    2249         [ #  # ]:          0 :             pGridWin[i]->flushOverlayManager();     // #i79909# flush overlays before switching to edit MapMode
    2250         [ #  # ]:          0 :             pGridWin[i]->SetMapMode(aOldMode[i]);
    2251                 :            :         }
    2252                 :            : 
    2253                 :       1064 :     SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
    2254         [ +  - ]:       1064 :     if (pViewFrame)
    2255                 :            :     {
    2256         [ +  - ]:       1064 :         SfxFrame& rFrame = pViewFrame->GetFrame();
    2257         [ +  - ]:       1064 :         com::sun::star::uno::Reference<com::sun::star::frame::XController> xController = rFrame.GetController();
    2258         [ +  + ]:       1064 :         if (xController.is())
    2259                 :            :         {
    2260         [ +  - ]:        835 :             ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
    2261         [ +  - ]:        835 :             if (pImp)
    2262         [ +  - ]:        835 :                 pImp->VisAreaChanged();
    2263                 :       1064 :         }
    2264                 :            :     }
    2265 [ +  - ][ -  + ]:       1064 :     if (aViewData.GetViewShell()->HasAccessibilityObjects())
    2266 [ #  # ][ #  # ]:       9576 :         aViewData.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_VISAREACHANGED));
         [ #  # ][ +  + ]
                 [ +  + ]
           [ #  #  #  # ]
    2267                 :       1064 : }
    2268                 :            : 
    2269                 :          0 : bool ScTabView::HasPageFieldDataAtCursor() const
    2270                 :            : {
    2271                 :          0 :     ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
    2272                 :          0 :     SCCOL nCol = aViewData.GetCurX();
    2273                 :          0 :     SCROW nRow = aViewData.GetCurY();
    2274         [ #  # ]:          0 :     if (pWin)
    2275                 :          0 :         return pWin->GetDPFieldOrientation( nCol, nRow ) == sheet::DataPilotFieldOrientation_PAGE;
    2276                 :            : 
    2277                 :          0 :     return false;
    2278                 :            : }
    2279                 :            : 
    2280                 :          0 : void ScTabView::StartDataSelect()
    2281                 :            : {
    2282                 :          0 :     ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
    2283                 :          0 :     SCCOL nCol = aViewData.GetCurX();
    2284                 :          0 :     SCROW nRow = aViewData.GetCurY();
    2285                 :            : 
    2286         [ #  # ]:          0 :     if (!pWin)
    2287                 :          0 :         return;
    2288                 :            : 
    2289      [ #  #  # ]:          0 :     switch (pWin->GetDPFieldOrientation(nCol, nRow))
    2290                 :            :     {
    2291                 :            :         case sheet::DataPilotFieldOrientation_PAGE:
    2292                 :            :             //  #i36598# If the cursor is on a page field's data cell,
    2293                 :            :             //  no meaningful input is possible anyway, so this function
    2294                 :            :             //  can be used to select a page field entry.
    2295                 :          0 :             pWin->LaunchPageFieldMenu( nCol, nRow );
    2296                 :          0 :             return;
    2297                 :            :         case sheet::DataPilotFieldOrientation_COLUMN:
    2298                 :            :         case sheet::DataPilotFieldOrientation_ROW:
    2299                 :          0 :             pWin->LaunchDPFieldMenu( nCol, nRow );
    2300                 :          0 :             return;
    2301                 :            :         default:
    2302                 :            :             ;
    2303                 :            :     }
    2304                 :            : 
    2305                 :            :     // Do autofilter if the current cell has autofilter button.  Otherwise do
    2306                 :            :     // a normal data select popup.
    2307                 :            :     const ScMergeFlagAttr* pAttr = static_cast<const ScMergeFlagAttr*>(
    2308                 :            :         aViewData.GetDocument()->GetAttr(
    2309                 :          0 :             nCol, nRow, aViewData.GetTabNo(), ATTR_MERGE_FLAG));
    2310                 :            : 
    2311         [ #  # ]:          0 :     if (pAttr->HasAutoFilter())
    2312                 :          0 :         pWin->LaunchAutoFilterMenu(nCol, nRow);
    2313                 :            :     else
    2314                 :          0 :         pWin->LaunchDataSelectMenu(nCol, nRow, true);
    2315                 :            : }
    2316                 :            : 
    2317                 :          0 : void ScTabView::EnableRefInput(bool bFlag)
    2318                 :            : {
    2319                 :          0 :     aHScrollLeft.EnableInput(bFlag);
    2320                 :          0 :     aHScrollRight.EnableInput(bFlag);
    2321                 :          0 :     aVScrollBottom.EnableInput(bFlag);
    2322                 :          0 :     aVScrollTop.EnableInput(bFlag);
    2323                 :          0 :     aScrollBarBox.EnableInput(bFlag);
    2324                 :            : 
    2325                 :            :     // ab hier dynamisch angelegte
    2326                 :            : 
    2327         [ #  # ]:          0 :     if(pTabControl!=NULL) pTabControl->EnableInput(bFlag,true);
    2328                 :            : 
    2329         [ #  # ]:          0 :     if(pGridWin[SC_SPLIT_BOTTOMLEFT]!=NULL)
    2330                 :          0 :         pGridWin[SC_SPLIT_BOTTOMLEFT]->EnableInput(bFlag,false);
    2331         [ #  # ]:          0 :     if(pGridWin[SC_SPLIT_BOTTOMRIGHT]!=NULL)
    2332                 :          0 :         pGridWin[SC_SPLIT_BOTTOMRIGHT]->EnableInput(bFlag,false);
    2333         [ #  # ]:          0 :     if(pGridWin[SC_SPLIT_TOPLEFT]!=NULL)
    2334                 :          0 :         pGridWin[SC_SPLIT_TOPLEFT]->EnableInput(bFlag,false);
    2335         [ #  # ]:          0 :     if(pGridWin[SC_SPLIT_TOPRIGHT]!=NULL)
    2336                 :          0 :         pGridWin[SC_SPLIT_TOPRIGHT]->EnableInput(bFlag,false);
    2337         [ #  # ]:          0 :     if(pColBar[SC_SPLIT_RIGHT]!=NULL)
    2338                 :          0 :         pColBar[SC_SPLIT_RIGHT]->EnableInput(bFlag,false);
    2339         [ #  # ]:          0 :     if(pRowBar[SC_SPLIT_TOP]!=NULL)
    2340                 :          0 :         pRowBar[SC_SPLIT_TOP]->EnableInput(bFlag,false);
    2341                 :          0 : }
    2342                 :            : 
    2343                 :            : 
    2344                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10