LCOV - code coverage report
Current view: top level - sc/source/ui/view - viewdata.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 848 1711 49.6 %
Date: 2012-08-25 Functions: 61 103 59.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 630 2302 27.4 %

           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                 :            : 
      30                 :            : #include "scitems.hxx"
      31                 :            : #include <editeng/eeitem.hxx>
      32                 :            : 
      33                 :            : 
      34                 :            : #include <sfx2/viewfrm.hxx>
      35                 :            : #include <editeng/adjitem.hxx>
      36                 :            : #include <svx/algitem.hxx>
      37                 :            : #include <editeng/brshitem.hxx>
      38                 :            : #include <svtools/colorcfg.hxx>
      39                 :            : #include <editeng/editview.hxx>
      40                 :            : #include <editeng/editstat.hxx>
      41                 :            : #include <editeng/outliner.hxx>
      42                 :            : #include <editeng/unolingu.hxx>
      43                 :            : #include <editeng/justifyitem.hxx>
      44                 :            : 
      45                 :            : #include <vcl/svapp.hxx>
      46                 :            : #include <rtl/math.hxx>
      47                 :            : 
      48                 :            : #include <sax/tools/converter.hxx>
      49                 :            : 
      50                 :            : #include "viewdata.hxx"
      51                 :            : #include "docoptio.hxx"
      52                 :            : #include "scmod.hxx"
      53                 :            : #include "global.hxx"
      54                 :            : #include "document.hxx"
      55                 :            : #include "attrib.hxx"
      56                 :            : #include "tabview.hxx"
      57                 :            : #include "tabvwsh.hxx"
      58                 :            : #include "docsh.hxx"
      59                 :            : #include "sc.hrc"
      60                 :            : #include "patattr.hxx"
      61                 :            : #include "editutil.hxx"
      62                 :            : #include "scextopt.hxx"
      63                 :            : #include "miscuno.hxx"
      64                 :            : #include "unonames.hxx"
      65                 :            : #include "inputopt.hxx"
      66                 :            : #include "viewutil.hxx"
      67                 :            : #include "markdata.hxx"
      68                 :            : #include "stlalgorithm.hxx"
      69                 :            : #include "ViewSettingsSequenceDefines.hxx"
      70                 :            : #include <rtl/ustrbuf.hxx>
      71                 :            : #include <comphelper/processfactory.hxx>
      72                 :            : #include <comphelper/string.hxx>
      73                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      74                 :            : 
      75                 :            : using namespace com::sun::star;
      76                 :            : 
      77                 :            : #define SC_GROWY_SMALL_EXTRA    100
      78                 :            : #define SC_GROWY_BIG_EXTRA      200
      79                 :            : 
      80                 :            : #define TAG_TABBARWIDTH "tw:"
      81                 :            : 
      82                 :            : static sal_Bool bMoveArea = false;              //! Member?
      83                 :            : sal_uInt16 nEditAdjust = SVX_ADJUST_LEFT;       //! Member !!!
      84                 :            : 
      85                 :        298 : ScViewDataTable::ScViewDataTable() :
      86                 :            :                 eZoomType( SVX_ZOOM_PERCENT ),
      87                 :            :                 aZoomX( 1,1 ),
      88                 :            :                 aZoomY( 1,1 ),
      89                 :            :                 aPageZoomX( 3,5 ),              // Page-Default: 60%
      90                 :            :                 aPageZoomY( 3,5 ),
      91                 :            :                 nHSplitPos( 0 ),
      92                 :            :                 nVSplitPos( 0 ),
      93                 :            :                 eHSplitMode( SC_SPLIT_NONE ),
      94                 :            :                 eVSplitMode( SC_SPLIT_NONE ),
      95                 :            :                 eWhichActive( SC_SPLIT_BOTTOMLEFT ),
      96                 :            :                 nFixPosX( 0 ),
      97                 :            :                 nFixPosY( 0 ),
      98                 :            :                 nCurX( 0 ),
      99                 :            :                 nCurY( 0 ),
     100                 :            :                 bShowGrid( true ),
     101                 :        298 :                 mbOldCursorValid( false )
     102                 :            : {
     103                 :        298 :     nPosX[0]=nPosX[1]=0;
     104                 :        298 :     nPosY[0]=nPosY[1]=0;
     105                 :        298 :     nTPosX[0]=nTPosX[1]=0;
     106                 :        298 :     nTPosY[0]=nTPosY[1]=0;
     107                 :        298 :     nMPosX[0]=nMPosX[1]=0;
     108                 :        298 :     nMPosY[0]=nMPosY[1]=0;
     109                 :        298 :     nPixPosX[0]=nPixPosX[1]=0;
     110                 :        298 :     nPixPosY[0]=nPixPosY[1]=0;
     111                 :        298 : }
     112                 :            : 
     113                 :        290 : ScViewDataTable::~ScViewDataTable()
     114                 :            : {
     115                 :        290 : }
     116                 :            : 
     117                 :        239 : void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSettings, const ScViewData& /*rViewData*/, SCTAB /*nTab*/) const
     118                 :            : {
     119                 :        239 :     rSettings.realloc(SC_TABLE_VIEWSETTINGS_COUNT);
     120                 :        239 :     beans::PropertyValue* pSettings = rSettings.getArray();
     121         [ +  - ]:        239 :     if (pSettings)
     122                 :            :     {
     123         [ +  - ]:        239 :         pSettings[SC_CURSOR_X].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CURSORPOSITIONX));
     124         [ +  - ]:        239 :         pSettings[SC_CURSOR_X].Value <<= sal_Int32(nCurX);
     125         [ +  - ]:        239 :         pSettings[SC_CURSOR_Y].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CURSORPOSITIONY));
     126         [ +  - ]:        239 :         pSettings[SC_CURSOR_Y].Value <<= sal_Int32(nCurY);
     127         [ +  - ]:        239 :         pSettings[SC_HORIZONTAL_SPLIT_MODE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_HORIZONTALSPLITMODE));
     128         [ +  - ]:        239 :         pSettings[SC_HORIZONTAL_SPLIT_MODE].Value <<= sal_Int16(eHSplitMode);
     129         [ +  - ]:        239 :         pSettings[SC_VERTICAL_SPLIT_MODE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_VERTICALSPLITMODE));
     130         [ +  - ]:        239 :         pSettings[SC_VERTICAL_SPLIT_MODE].Value <<= sal_Int16(eVSplitMode);
     131         [ +  - ]:        239 :         pSettings[SC_HORIZONTAL_SPLIT_POSITION].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_HORIZONTALSPLITPOSITION));
     132         [ -  + ]:        239 :         if (eHSplitMode == SC_SPLIT_FIX)
     133         [ #  # ]:          0 :             pSettings[SC_HORIZONTAL_SPLIT_POSITION].Value <<= sal_Int32(nFixPosX);
     134                 :            :         else
     135         [ +  - ]:        239 :             pSettings[SC_HORIZONTAL_SPLIT_POSITION].Value <<= sal_Int32(nHSplitPos);
     136         [ +  - ]:        239 :         pSettings[SC_VERTICAL_SPLIT_POSITION].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_VERTICALSPLITPOSITION));
     137         [ -  + ]:        239 :         if (eVSplitMode == SC_SPLIT_FIX)
     138         [ #  # ]:          0 :             pSettings[SC_VERTICAL_SPLIT_POSITION].Value <<= sal_Int32(nFixPosY);
     139                 :            :         else
     140         [ +  - ]:        239 :             pSettings[SC_VERTICAL_SPLIT_POSITION].Value <<= sal_Int32(nVSplitPos);
     141         [ +  - ]:        239 :         pSettings[SC_ACTIVE_SPLIT_RANGE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ACTIVESPLITRANGE));
     142         [ +  - ]:        239 :         pSettings[SC_ACTIVE_SPLIT_RANGE].Value <<= sal_Int16(eWhichActive);
     143         [ +  - ]:        239 :         pSettings[SC_POSITION_LEFT].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_POSITIONLEFT));
     144         [ +  - ]:        239 :         pSettings[SC_POSITION_LEFT].Value <<= sal_Int32(nPosX[SC_SPLIT_LEFT]);
     145         [ +  - ]:        239 :         pSettings[SC_POSITION_RIGHT].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_POSITIONRIGHT));
     146         [ +  - ]:        239 :         pSettings[SC_POSITION_RIGHT].Value <<= sal_Int32(nPosX[SC_SPLIT_RIGHT]);
     147         [ +  - ]:        239 :         pSettings[SC_POSITION_TOP].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_POSITIONTOP));
     148         [ +  - ]:        239 :         pSettings[SC_POSITION_TOP].Value <<= sal_Int32(nPosY[SC_SPLIT_TOP]);
     149         [ +  - ]:        239 :         pSettings[SC_POSITION_BOTTOM].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_POSITIONBOTTOM));
     150         [ +  - ]:        239 :         pSettings[SC_POSITION_BOTTOM].Value <<= sal_Int32(nPosY[SC_SPLIT_BOTTOM]);
     151                 :            : 
     152                 :        239 :         sal_Int32 nZoomValue ((aZoomY.GetNumerator() * 100) / aZoomY.GetDenominator());
     153                 :        239 :         sal_Int32 nPageZoomValue ((aPageZoomY.GetNumerator() * 100) / aPageZoomY.GetDenominator());
     154         [ +  - ]:        239 :         pSettings[SC_TABLE_ZOOM_TYPE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ZOOMTYPE));
     155         [ +  - ]:        239 :         pSettings[SC_TABLE_ZOOM_TYPE].Value <<= sal_Int16(eZoomType);
     156         [ +  - ]:        239 :         pSettings[SC_TABLE_ZOOM_VALUE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ZOOMVALUE));
     157         [ +  - ]:        239 :         pSettings[SC_TABLE_ZOOM_VALUE].Value <<= nZoomValue;
     158         [ +  - ]:        239 :         pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_PAGEVIEWZOOMVALUE));
     159         [ +  - ]:        239 :         pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Value <<= nPageZoomValue;
     160                 :            : 
     161         [ +  - ]:        239 :         pSettings[SC_TABLE_SHOWGRID].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWGRID));
     162         [ +  - ]:        239 :         pSettings[SC_TABLE_SHOWGRID].Value <<= static_cast<sal_Bool>(bShowGrid);
     163                 :            :     }
     164                 :        239 : }
     165                 :            : 
     166                 :        251 : void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>& aSettings, ScViewData& rViewData, SCTAB nTab, bool& rHasZoom )
     167                 :            : {
     168                 :        251 :     rHasZoom = false;
     169                 :            : 
     170                 :        251 :     sal_Int32 nCount(aSettings.getLength());
     171                 :        251 :     sal_Int32 nTemp32(0);
     172                 :        251 :     sal_Int16 nTemp16(0);
     173                 :        251 :     sal_Int32 nTempPosV(0);
     174                 :        251 :     sal_Int32 nTempPosH(0);
     175                 :        251 :     sal_Int32 nTempPosVTw(0);
     176                 :        251 :     sal_Int32 nTempPosHTw(0);
     177                 :        251 :     bool bHasVSplitInTwips = false;
     178                 :        251 :     bool bHasHSplitInTwips = false;
     179         [ +  + ]:       4217 :     for (sal_Int32 i = 0; i < nCount; i++)
     180                 :            :     {
     181                 :       3966 :         rtl::OUString sName(aSettings[i].Name);
     182         [ +  + ]:       3966 :         if (sName.compareToAscii(SC_CURSORPOSITIONX) == 0)
     183                 :            :         {
     184                 :        251 :             aSettings[i].Value >>= nTemp32;
     185                 :        251 :             nCurX = SanitizeCol( static_cast<SCCOL>(nTemp32));
     186                 :            :         }
     187         [ +  + ]:       3715 :         else if (sName.compareToAscii(SC_CURSORPOSITIONY) == 0)
     188                 :            :         {
     189                 :        251 :             aSettings[i].Value >>= nTemp32;
     190                 :        251 :             nCurY = SanitizeRow( static_cast<SCROW>(nTemp32));
     191                 :            :         }
     192         [ +  + ]:       3464 :         else if (sName.compareToAscii(SC_HORIZONTALSPLITMODE) == 0)
     193                 :            :         {
     194                 :        251 :             aSettings[i].Value >>= nTemp16;
     195                 :        251 :             eHSplitMode = static_cast<ScSplitMode>(nTemp16);
     196                 :            :         }
     197         [ +  + ]:       3213 :         else if (sName.compareToAscii(SC_VERTICALSPLITMODE) == 0)
     198                 :            :         {
     199                 :        251 :             aSettings[i].Value >>= nTemp16;
     200                 :        251 :             eVSplitMode = static_cast<ScSplitMode>(nTemp16);
     201                 :            :         }
     202         [ +  + ]:       2962 :         else if (sName.compareToAscii(SC_HORIZONTALSPLITPOSITION) == 0)
     203                 :            :         {
     204                 :        251 :             aSettings[i].Value >>= nTempPosH;
     205                 :        251 :             bHasHSplitInTwips = false;
     206                 :            :         }
     207         [ +  + ]:       2711 :         else if (sName.compareToAscii(SC_VERTICALSPLITPOSITION) == 0)
     208                 :            :         {
     209                 :        251 :             aSettings[i].Value >>= nTempPosV;
     210                 :        251 :             bHasVSplitInTwips = false;
     211                 :            :         }
     212         [ -  + ]:       2460 :         else if (sName.compareToAscii(SC_HORIZONTALSPLITPOSITION_TWIPS) == 0)
     213                 :            :         {
     214                 :          0 :             aSettings[i].Value >>= nTempPosHTw;
     215                 :          0 :             bHasHSplitInTwips = true;
     216                 :            :         }
     217         [ -  + ]:       2460 :         else if (sName.compareToAscii(SC_VERTICALSPLITPOSITION_TWIPS) == 0)
     218                 :            :         {
     219                 :          0 :             aSettings[i].Value >>= nTempPosVTw;
     220                 :          0 :             bHasVSplitInTwips = true;
     221                 :            :         }
     222         [ +  + ]:       2460 :         else if (sName.compareToAscii(SC_ACTIVESPLITRANGE) == 0)
     223                 :            :         {
     224                 :        251 :             aSettings[i].Value >>= nTemp16;
     225                 :        251 :             eWhichActive = static_cast<ScSplitPos>(nTemp16);
     226                 :            :         }
     227         [ +  + ]:       2209 :         else if (sName.compareToAscii(SC_POSITIONLEFT) == 0)
     228                 :            :         {
     229                 :        251 :             aSettings[i].Value >>= nTemp32;
     230                 :        251 :             nPosX[SC_SPLIT_LEFT] = SanitizeCol( static_cast<SCCOL>(nTemp32));
     231                 :            :         }
     232         [ +  + ]:       1958 :         else if (sName.compareToAscii(SC_POSITIONRIGHT) == 0)
     233                 :            :         {
     234                 :        251 :             aSettings[i].Value >>= nTemp32;
     235                 :        251 :             nPosX[SC_SPLIT_RIGHT] = SanitizeCol( static_cast<SCCOL>(nTemp32));
     236                 :            :         }
     237         [ +  + ]:       1707 :         else if (sName.compareToAscii(SC_POSITIONTOP) == 0)
     238                 :            :         {
     239                 :        251 :             aSettings[i].Value >>= nTemp32;
     240                 :        251 :             nPosY[SC_SPLIT_TOP] = SanitizeRow( static_cast<SCROW>(nTemp32));
     241                 :            :         }
     242         [ +  + ]:       1456 :         else if (sName.compareToAscii(SC_POSITIONBOTTOM) == 0)
     243                 :            :         {
     244                 :        251 :             aSettings[i].Value >>= nTemp32;
     245                 :        251 :             nPosY[SC_SPLIT_BOTTOM] = SanitizeRow( static_cast<SCROW>(nTemp32));
     246                 :            :         }
     247         [ +  + ]:       1205 :         else if (sName.compareToAscii(SC_ZOOMTYPE) == 0)
     248                 :            :         {
     249                 :        250 :             aSettings[i].Value >>= nTemp16;
     250                 :        250 :             eZoomType = SvxZoomType(nTemp16);
     251                 :        250 :             rHasZoom = true;        // set if there is any zoom information
     252                 :            :         }
     253         [ +  + ]:        955 :         else if (sName.compareToAscii(SC_ZOOMVALUE) == 0)
     254                 :            :         {
     255                 :        250 :             aSettings[i].Value >>= nTemp32;
     256         [ +  - ]:        250 :             Fraction aZoom(nTemp32, 100);
     257 [ +  - ][ +  - ]:        250 :             aZoomX = aZoomY = aZoom;
     258                 :        250 :             rHasZoom = true;
     259                 :            :         }
     260         [ +  + ]:        705 :         else if (sName.compareToAscii(SC_PAGEVIEWZOOMVALUE) == 0)
     261                 :            :         {
     262                 :        250 :             aSettings[i].Value >>= nTemp32;
     263         [ +  - ]:        250 :             Fraction aZoom(nTemp32, 100);
     264 [ +  - ][ +  - ]:        250 :             aPageZoomX = aPageZoomY = aZoom;
     265                 :        250 :             rHasZoom = true;
     266                 :            :         }
     267         [ +  + ]:        455 :         else if (sName.compareToAscii(SC_UNO_SHOWGRID) == 0)
     268                 :            :         {
     269                 :        250 :             aSettings[i].Value >>= bShowGrid;
     270                 :            :         }
     271         [ -  + ]:        205 :         else if (sName.compareToAscii(SC_TABLESELECTED) == 0)
     272                 :            :         {
     273                 :          0 :             bool bSelected = false;
     274                 :          0 :             aSettings[i].Value >>= bSelected;
     275 [ #  # ][ #  # ]:          0 :             rViewData.GetMarkData().SelectTable( nTab, bSelected );
     276                 :            :         }
     277         [ -  + ]:        205 :         else if (sName.compareToAscii(SC_UNONAME_TABCOLOR) == 0)
     278                 :            :         {
     279                 :            :             // There are documents out there that have their tab color defined as a view setting.
     280                 :          0 :             sal_Int32 nColor = COL_AUTO;
     281                 :          0 :             aSettings[i].Value >>= nColor;
     282         [ #  # ]:          0 :             if (static_cast<ColorData>(nColor) != COL_AUTO)
     283                 :            :             {
     284         [ #  # ]:          0 :                 ScDocument* pDoc = rViewData.GetDocument();
     285         [ #  # ]:          0 :                 pDoc->SetTabBgColor(nTab, Color(static_cast<ColorData>(nColor)));
     286                 :            :             }
     287                 :            :         }
     288                 :       3966 :     }
     289         [ -  + ]:        251 :     if (eHSplitMode == SC_SPLIT_FIX)
     290         [ #  # ]:          0 :         nFixPosX = SanitizeCol( static_cast<SCCOL>( bHasHSplitInTwips ? nTempPosHTw : nTempPosH ));
     291                 :            :     else
     292         [ -  + ]:        251 :         nHSplitPos = bHasHSplitInTwips ? static_cast< long >( nTempPosHTw * rViewData.GetPPTX() ) : nTempPosH;
     293                 :            : 
     294         [ -  + ]:        251 :     if (eVSplitMode == SC_SPLIT_FIX)
     295         [ #  # ]:          0 :         nFixPosY = SanitizeRow( static_cast<SCROW>( bHasVSplitInTwips ? nTempPosVTw : nTempPosV ));
     296                 :            :     else
     297         [ -  + ]:        251 :         nVSplitPos = bHasVSplitInTwips ? static_cast< long >( nTempPosVTw * rViewData.GetPPTY() ) : nTempPosV;
     298                 :        251 : }
     299                 :            : 
     300                 :        233 : ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
     301         [ +  - ]:        233 :         mpMarkData(new ScMarkData),
     302                 :            :         pDocShell   ( pDocSh ),
     303                 :            :         pDoc        ( NULL ),
     304                 :            :         pView       ( pViewSh ),
     305                 :            :         pViewShell  ( pViewSh ),
     306         [ +  - ]:        233 :         pOptions    ( new ScViewOptions ),
     307                 :            :         pSpellingView ( NULL ),
     308                 :            :         aLogicMode  ( MAP_100TH_MM ),
     309                 :            :         eDefZoomType( SVX_ZOOM_PERCENT ),
     310                 :            :         aDefZoomX   ( 1,1 ),
     311                 :            :         aDefZoomY   ( 1,1 ),
     312                 :            :         aDefPageZoomX( 3,5 ),
     313                 :            :         aDefPageZoomY( 3,5 ),
     314                 :            :         eRefType    ( SC_REFTYPE_NONE ),
     315                 :            :         nTabNo      ( 0 ),
     316                 :            :         nRefTabNo   ( 0 ),
     317                 :            :         nPasteFlags ( SC_PASTE_NONE ),
     318                 :            :         eEditActivePart( SC_SPLIT_BOTTOMLEFT ),
     319                 :            :         nFillMode   ( SC_FILL_NONE ),
     320                 :            :         bActive     ( true ),                   //! wie initialisieren?
     321                 :            :         bIsRefMode  ( false ),
     322                 :            :         bDelMarkValid( false ),
     323                 :            :         bPagebreak  ( false ),
     324 [ +  - ][ +  + ]:        699 :         bSelCtrlMouseClick( false )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     325                 :            : {
     326         [ +  - ]:        233 :     mpMarkData->SelectOneTable(0); // Sync with nTabNo.
     327                 :            : 
     328                 :        233 :     SetGridMode     ( sal_True );
     329                 :        233 :     SetSyntaxMode   ( false );
     330                 :        233 :     SetHeaderMode   ( sal_True );
     331                 :        233 :     SetTabMode      ( sal_True );
     332                 :        233 :     SetVScrollMode  ( sal_True );
     333                 :        233 :     SetHScrollMode  ( sal_True );
     334                 :        233 :     SetOutlineMode  ( sal_True );
     335                 :            : 
     336                 :            :     aScrSize = Size( (long) ( STD_COL_WIDTH           * PIXEL_PER_TWIPS * OLE_STD_CELLS_X ),
     337                 :        233 :                      (long) ( ScGlobal::nStdRowHeight * PIXEL_PER_TWIPS * OLE_STD_CELLS_Y ) );
     338 [ +  - ][ +  - ]:        233 :     maTabData.push_back( new ScViewDataTable );
                 [ +  - ]
     339                 :        233 :     pThisTab = maTabData[nTabNo];
     340         [ +  + ]:       1165 :     for (sal_uInt16 j=0; j<4; j++)
     341                 :            :     {
     342                 :        932 :         pEditView[j] = NULL;
     343                 :        932 :         bEditActive[j] = false;
     344                 :            :     }
     345                 :            : 
     346                 :        233 :     nEditEndCol = nEditStartCol = nEditCol = 0;
     347                 :        233 :     nEditEndRow = nEditRow = 0;
     348                 :        233 :     nTabStartCol = SC_TABSTART_NONE;
     349                 :            : 
     350         [ +  - ]:        233 :     if (pDocShell)
     351                 :            :     {
     352                 :        233 :         pDoc = pDocShell->GetDocument();
     353 [ +  - ][ +  - ]:        233 :         *pOptions = pDoc->GetViewOptions();
     354                 :            :     }
     355                 :            : 
     356                 :            :     //  keine ausgeblendete Tabelle anzeigen:
     357 [ +  - ][ +  - ]:        233 :     if (pDoc && !pDoc->IsVisible(nTabNo))
         [ -  + ][ -  + ]
     358                 :            :     {
     359 [ #  # ][ #  # ]:          0 :         while ( !pDoc->IsVisible(nTabNo) && pDoc->HasTable(nTabNo+1) )
         [ #  # ][ #  # ]
                 [ #  # ]
     360                 :            :         {
     361                 :          0 :             ++nTabNo;
     362         [ #  # ]:          0 :             maTabData.push_back(NULL);
     363                 :            :         }
     364 [ #  # ][ #  # ]:          0 :         maTabData[nTabNo] = new ScViewDataTable() ;
     365                 :          0 :         pThisTab = maTabData[nTabNo];
     366                 :            :     }
     367                 :            : 
     368         [ +  - ]:        233 :     CalcPPT();
     369                 :        233 : }
     370                 :            : 
     371                 :          0 : ScViewData::ScViewData( const ScViewData& rViewData ) :
     372                 :            :         maTabData( rViewData.maTabData ),
     373         [ #  # ]:          0 :         mpMarkData(new ScMarkData(*rViewData.mpMarkData)),
     374                 :            :         pDocShell   ( rViewData.pDocShell ),
     375                 :            :         pDoc        ( rViewData.pDoc ),
     376                 :            :         pView       ( rViewData.pView ),
     377                 :            :         pViewShell  ( rViewData.pViewShell ),
     378         [ #  # ]:          0 :         pOptions    ( new ScViewOptions( *(rViewData.pOptions) )  ),
     379                 :            :         pSpellingView ( rViewData.pSpellingView ),
     380                 :            :         aLogicMode  ( rViewData.aLogicMode ),
     381                 :            :         eDefZoomType( rViewData.eDefZoomType ),
     382                 :            :         aDefZoomX   ( rViewData.aDefZoomX ),
     383                 :            :         aDefZoomY   ( rViewData.aDefZoomY ),
     384                 :            :         aDefPageZoomX( rViewData.aDefPageZoomX ),
     385                 :            :         aDefPageZoomY( rViewData.aDefPageZoomY ),
     386                 :            :         eRefType    ( SC_REFTYPE_NONE ),
     387                 :            :         nTabNo      ( rViewData.nTabNo ),
     388                 :            :         nRefTabNo   ( rViewData.nTabNo ),           // kein RefMode
     389                 :            :         eEditActivePart( rViewData.eEditActivePart ),
     390                 :            :         nFillMode   ( SC_FILL_NONE ),
     391                 :            :         bActive     ( true ),                               //! wie initialisieren?
     392                 :            :         bIsRefMode  ( false ),
     393                 :            :         bDelMarkValid( false ),
     394                 :            :         bPagebreak  ( rViewData.bPagebreak ),
     395 [ #  # ][ #  # ]:          0 :         bSelCtrlMouseClick( rViewData.bSelCtrlMouseClick )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     396                 :            : {
     397                 :            : 
     398                 :          0 :     SetGridMode     ( rViewData.IsGridMode() );
     399                 :          0 :     SetSyntaxMode   ( rViewData.IsSyntaxMode() );
     400                 :          0 :     SetHeaderMode   ( rViewData.IsHeaderMode() );
     401                 :          0 :     SetTabMode      ( rViewData.IsTabMode() );
     402                 :          0 :     SetVScrollMode  ( rViewData.IsVScrollMode() );
     403                 :          0 :     SetHScrollMode  ( rViewData.IsHScrollMode() );
     404                 :          0 :     SetOutlineMode  ( rViewData.IsOutlineMode() );
     405                 :            : 
     406                 :          0 :     aScrSize = rViewData.aScrSize;
     407                 :            : 
     408                 :          0 :     pThisTab = maTabData[nTabNo];
     409         [ #  # ]:          0 :     for (sal_uInt16 j=0; j<4; j++)
     410                 :            :     {
     411                 :          0 :         pEditView[j] = NULL;
     412                 :          0 :         bEditActive[j] = false;
     413                 :            :     }
     414                 :            : 
     415                 :          0 :     nEditEndCol = nEditStartCol = nEditCol = 0;
     416                 :          0 :     nEditEndRow = nEditRow = 0;
     417                 :          0 :     nTabStartCol = SC_TABSTART_NONE;
     418         [ #  # ]:          0 :     CalcPPT();
     419                 :          0 : }
     420                 :            : 
     421                 :          0 : void ScViewData::InitData( ScDocument* pDocument )
     422                 :            : {
     423                 :          0 :     pDoc = pDocument;
     424                 :          0 :     *pOptions = pDoc->GetViewOptions();
     425                 :          0 : }
     426                 :            : 
     427                 :            : 
     428                 :     133108 : ScDocument* ScViewData::GetDocument() const
     429                 :            : {
     430         [ +  - ]:     133108 :     if (pDoc)
     431                 :     133108 :         return pDoc;
     432         [ #  # ]:          0 :     else if (pDocShell)
     433                 :          0 :         return pDocShell->GetDocument();
     434                 :            : 
     435                 :            :     OSL_FAIL("kein Document an ViewData");
     436                 :     133108 :     return NULL;
     437                 :            : }
     438                 :            : 
     439 [ +  - ][ +  - ]:        229 : ScViewData::~ScViewData()
     440                 :            : {
     441         [ +  - ]:        229 :     KillEditView();
     442 [ +  - ][ +  - ]:        229 :     delete pOptions;
     443                 :            :     ::std::for_each(
     444         [ +  - ]:        229 :         maTabData.begin(), maTabData.end(), ScDeleteObjectByPtr<ScViewDataTable>());
     445                 :        229 : }
     446                 :            : 
     447                 :         62 : void ScViewData::UpdateCurrentTab()
     448                 :            : {
     449                 :         62 :     pThisTab = maTabData[nTabNo];
     450         [ -  + ]:         62 :     while (!pThisTab)
     451                 :            :     {
     452         [ #  # ]:          0 :         if (nTabNo > 0)
     453                 :          0 :             pThisTab = maTabData[--nTabNo];
     454                 :            :         else
     455         [ #  # ]:          0 :             pThisTab = maTabData[0] = new ScViewDataTable;
     456                 :            :     }
     457                 :         62 : }
     458                 :            : 
     459                 :         43 : void ScViewData::InsertTab( SCTAB nTab )
     460                 :            : {
     461         [ -  + ]:         43 :     if( nTab >= static_cast<SCTAB>(maTabData.size()))
     462         [ #  # ]:          0 :         maTabData.resize(nTab+1, NULL);
     463                 :            :     else
     464 [ +  - ][ +  - ]:         43 :         maTabData.insert( maTabData.begin() + nTab, NULL );
     465                 :         43 :     CreateTabData( nTab );
     466                 :            : 
     467                 :         43 :     UpdateCurrentTab();
     468                 :         43 :     mpMarkData->InsertTab( nTab );
     469                 :         43 : }
     470                 :            : 
     471                 :          0 : void ScViewData::InsertTabs( SCTAB nTab, SCTAB nNewSheets )
     472                 :            : {
     473         [ #  # ]:          0 :     if( nTab+nNewSheets >= static_cast<SCTAB>(maTabData.size()))
     474         [ #  # ]:          0 :         maTabData.resize(nTab+nNewSheets, NULL);
     475                 :            :     else
     476                 :            :     {
     477 [ #  # ][ #  # ]:          0 :         maTabData.insert( maTabData.begin() + nTab, nNewSheets, NULL );
     478                 :            :     }
     479         [ #  # ]:          0 :     for (SCTAB i = nTab; i < nTab + nNewSheets; ++i)
     480                 :            :     {
     481                 :          0 :         CreateTabData( i );
     482                 :          0 :         mpMarkData->InsertTab( i );
     483                 :            :     }
     484                 :          0 :     UpdateCurrentTab();
     485                 :          0 : }
     486                 :            : 
     487                 :         19 : void ScViewData::DeleteTab( SCTAB nTab )
     488                 :            : {
     489         [ +  - ]:         19 :     delete maTabData.at(nTab);
     490                 :            : 
     491 [ +  - ][ +  - ]:         19 :     maTabData.erase(maTabData.begin() + nTab);
     492                 :         19 :     UpdateCurrentTab();
     493                 :         19 :     mpMarkData->DeleteTab( nTab );
     494                 :         19 : }
     495                 :            : 
     496                 :          0 : void ScViewData::DeleteTabs( SCTAB nTab, SCTAB nSheets )
     497                 :            : {
     498         [ #  # ]:          0 :     for (SCTAB i = 0; i < nSheets; ++i)
     499                 :            :     {
     500                 :          0 :         mpMarkData->DeleteTab( nTab + i );
     501         [ #  # ]:          0 :         delete maTabData.at(nTab + i);
     502                 :            :     }
     503                 :            : 
     504 [ #  # ][ #  # ]:          0 :     maTabData.erase(maTabData.begin() + nTab, maTabData.begin()+ nTab+nSheets);
         [ #  # ][ #  # ]
     505                 :          0 :     UpdateCurrentTab();
     506                 :          0 : }
     507                 :            : 
     508                 :          0 : void ScViewData::CopyTab( SCTAB nSrcTab, SCTAB nDestTab )
     509                 :            : {
     510         [ #  # ]:          0 :     if (nDestTab==SC_TAB_APPEND)
     511                 :          0 :         nDestTab = pDoc->GetTableCount() - 1;   // am Doc muss vorher kopiert worden sein
     512                 :            : 
     513         [ #  # ]:          0 :     if (nDestTab > MAXTAB)
     514                 :            :     {
     515                 :            :         OSL_FAIL("Zuviele Tabellen");
     516                 :          0 :         return;
     517                 :            :     }
     518                 :            : 
     519                 :          0 :     if (nSrcTab >= static_cast<SCTAB>(maTabData.size()))
     520                 :            :         OSL_FAIL("pTabData out of bounds, FIX IT");
     521                 :            : 
     522                 :          0 :     EnsureTabDataSize(nDestTab + 1);
     523                 :            : 
     524         [ #  # ]:          0 :     if ( maTabData[nSrcTab] )
     525 [ #  # ][ #  # ]:          0 :         maTabData.insert(maTabData.begin() + nDestTab, new ScViewDataTable( *maTabData[nSrcTab] ));
                 [ #  # ]
     526                 :            :     else
     527 [ #  # ][ #  # ]:          0 :         maTabData.insert(maTabData.begin() + nDestTab, NULL);
     528                 :            : 
     529                 :          0 :     UpdateCurrentTab();
     530                 :          0 :     mpMarkData->InsertTab( nDestTab );
     531                 :            : }
     532                 :            : 
     533                 :          0 : void ScViewData::MoveTab( SCTAB nSrcTab, SCTAB nDestTab )
     534                 :            : {
     535         [ #  # ]:          0 :     if (nDestTab==SC_TAB_APPEND)
     536         [ #  # ]:          0 :         nDestTab = pDoc->GetTableCount() - 1;
     537                 :          0 :     ScViewDataTable* pTab = NULL;
     538         [ #  # ]:          0 :     if (nSrcTab < static_cast<SCTAB>(maTabData.size()))
     539                 :            :     {
     540                 :          0 :         pTab = maTabData[nSrcTab];
     541 [ #  # ][ #  # ]:          0 :         maTabData.erase( maTabData.begin() + nSrcTab );
     542                 :            :     }
     543                 :            : 
     544         [ #  # ]:          0 :     if (nDestTab < static_cast<SCTAB>(maTabData.size()))
     545 [ #  # ][ #  # ]:          0 :         maTabData.insert( maTabData.begin() + nDestTab, pTab );
     546                 :            :     else
     547                 :            :     {
     548         [ #  # ]:          0 :         EnsureTabDataSize(nDestTab + 1);
     549                 :          0 :         maTabData[nDestTab] = pTab;
     550                 :            :     }
     551                 :            : 
     552         [ #  # ]:          0 :     UpdateCurrentTab();
     553         [ #  # ]:          0 :     mpMarkData->DeleteTab( nSrcTab );
     554         [ #  # ]:          0 :     mpMarkData->InsertTab( nDestTab );            // ggf. angepasst
     555                 :          0 : }
     556                 :            : 
     557                 :          0 : void ScViewData::CreateTabData( std::vector< SCTAB >& rvTabs )
     558                 :            : {
     559                 :          0 :     std::vector< SCTAB >::iterator it_end = rvTabs.end();
     560 [ #  # ][ #  # ]:          0 :     for ( std::vector< SCTAB >::iterator it = rvTabs.begin(); it != it_end; ++it )
                 [ #  # ]
     561 [ #  # ][ #  # ]:          0 :         CreateTabData(*it);
     562                 :          0 : }
     563                 :            : 
     564                 :        229 : void ScViewData::SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs )
     565                 :            : {
     566                 :        229 :     sal_Bool bAll = ( tabs.empty() );
     567                 :            : 
     568         [ -  + ]:        229 :     if ( !bAll ) // create associated table data
     569                 :          0 :         CreateTabData( tabs );
     570                 :            : 
     571         [ +  - ]:        229 :     if ( bAll )
     572                 :            :     {
     573         [ +  + ]:        458 :         for ( SCTAB i = 0; i < static_cast<SCTAB>(maTabData.size()); ++i )
     574                 :            :         {
     575         [ +  - ]:        229 :             if ( maTabData[i] )
     576                 :        229 :                 maTabData[i]->eZoomType = eNew;
     577                 :            :         }
     578                 :        229 :         eDefZoomType = eNew;
     579                 :            :     }
     580                 :            :     else
     581                 :            :     {
     582                 :          0 :         std::vector< SCTAB >::iterator it_end = tabs.end();
     583                 :          0 :         std::vector< SCTAB >::iterator it = tabs.begin();
     584 [ #  # ][ #  # ]:          0 :         for ( ; it != it_end; ++it )
                 [ #  # ]
     585                 :            :         {
     586         [ #  # ]:          0 :             SCTAB i = *it;
     587 [ #  # ][ #  # ]:          0 :             if ( i < static_cast<SCTAB>(maTabData.size()) && maTabData[i] )
                 [ #  # ]
     588                 :          0 :                 maTabData[i]->eZoomType = eNew;
     589                 :            :         }
     590                 :            :     }
     591                 :        229 : }
     592                 :            : 
     593                 :        229 : void ScViewData::SetZoomType( SvxZoomType eNew, sal_Bool bAll )
     594                 :            : {
     595         [ +  - ]:        229 :     std::vector< SCTAB > vTabs; // Empty for all tabs
     596         [ -  + ]:        229 :     if ( !bAll ) // get selected tabs
     597                 :            :     {
     598 [ #  # ][ #  # ]:          0 :         ScMarkData::iterator itr = mpMarkData->begin(), itrEnd = mpMarkData->end();
     599         [ #  # ]:          0 :         vTabs.insert(vTabs.begin(), itr, itrEnd);
     600                 :            :     }
     601         [ +  - ]:        229 :     SetZoomType( eNew, vTabs );
     602                 :        229 : }
     603                 :            : 
     604                 :        229 : void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs )
     605                 :            : {
     606                 :        229 :     sal_Bool bAll = ( tabs.empty() );
     607         [ -  + ]:        229 :     if ( !bAll ) // create associated table data
     608         [ #  # ]:          0 :         CreateTabData( tabs );
     609         [ +  - ]:        229 :     Fraction aFrac20( 1,5 );
     610         [ +  - ]:        229 :     Fraction aFrac400( 4,1 );
     611                 :            : 
     612         [ +  - ]:        229 :     Fraction aValidX = rNewX;
     613 [ +  - ][ -  + ]:        229 :     if (aValidX<aFrac20)
     614         [ #  # ]:          0 :         aValidX = aFrac20;
     615 [ +  - ][ -  + ]:        229 :     if (aValidX>aFrac400)
     616         [ #  # ]:          0 :         aValidX = aFrac400;
     617                 :            : 
     618         [ +  - ]:        229 :     Fraction aValidY = rNewY;
     619 [ +  - ][ -  + ]:        229 :     if (aValidY<aFrac20)
     620         [ #  # ]:          0 :         aValidY = aFrac20;
     621 [ +  - ][ -  + ]:        229 :     if (aValidY>aFrac400)
     622         [ #  # ]:          0 :         aValidY = aFrac400;
     623                 :            : 
     624         [ +  - ]:        229 :     if ( bAll )
     625                 :            :     {
     626         [ +  + ]:        458 :         for ( SCTAB i = 0; i < static_cast<SCTAB>(maTabData.size()); ++i )
     627                 :            :         {
     628         [ +  - ]:        229 :             if ( maTabData[i] )
     629                 :            :             {
     630         [ -  + ]:        229 :                 if ( bPagebreak )
     631                 :            :                 {
     632         [ #  # ]:          0 :                     maTabData[i]->aPageZoomX = aValidX;
     633         [ #  # ]:          0 :                     maTabData[i]->aPageZoomY = aValidY;
     634                 :            :                 }
     635                 :            :                 else
     636                 :            :                 {
     637         [ +  - ]:        229 :                     maTabData[i]->aZoomX = aValidX;
     638         [ +  - ]:        229 :                     maTabData[i]->aZoomY = aValidY;
     639                 :            :                 }
     640                 :            :             }
     641                 :            :         }
     642         [ -  + ]:        229 :         if ( bPagebreak )
     643                 :            :         {
     644         [ #  # ]:          0 :             aDefPageZoomX = aValidX;
     645         [ #  # ]:          0 :             aDefPageZoomY = aValidY;
     646                 :            :         }
     647                 :            :         else
     648                 :            :         {
     649         [ +  - ]:        229 :             aDefZoomX = aValidX;
     650         [ +  - ]:        229 :             aDefZoomY = aValidY;
     651                 :            :         }
     652                 :            :     }
     653                 :            :     else
     654                 :            :     {
     655                 :          0 :         std::vector< SCTAB >::iterator it_end = tabs.end();
     656                 :          0 :         std::vector< SCTAB >::iterator it = tabs.begin();
     657 [ #  # ][ #  # ]:          0 :         for ( ; it != it_end; ++it )
                 [ #  # ]
     658                 :            :         {
     659         [ #  # ]:          0 :             SCTAB i = *it;
     660 [ #  # ][ #  # ]:          0 :             if ( i < static_cast<SCTAB>(maTabData.size()) && maTabData[i] )
                 [ #  # ]
     661                 :            :             {
     662         [ #  # ]:          0 :                 if ( bPagebreak )
     663                 :            :                 {
     664         [ #  # ]:          0 :                     maTabData[i]->aPageZoomX = aValidX;
     665         [ #  # ]:          0 :                     maTabData[i]->aPageZoomY = aValidY;
     666                 :            :                 }
     667                 :            :                 else
     668                 :            :                 {
     669         [ #  # ]:          0 :                     maTabData[i]->aZoomX = aValidX;
     670         [ #  # ]:          0 :                     maTabData[i]->aZoomY = aValidY;
     671                 :            :                 }
     672                 :            :             }
     673                 :            :         }
     674                 :            :     }
     675         [ +  - ]:        229 :     RefreshZoom();
     676                 :        229 : }
     677                 :            : 
     678                 :        229 : void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, sal_Bool bAll )
     679                 :            : {
     680         [ +  - ]:        229 :     std::vector< SCTAB > vTabs;
     681         [ -  + ]:        229 :     if ( !bAll ) // get selected tabs
     682                 :            :     {
     683 [ #  # ][ #  # ]:          0 :         ScMarkData::iterator itr = mpMarkData->begin(), itrEnd = mpMarkData->end();
     684         [ #  # ]:          0 :         vTabs.insert(vTabs.begin(), itr, itrEnd);
     685                 :            :     }
     686         [ +  - ]:        229 :     SetZoom( rNewX, rNewY, vTabs );
     687                 :        229 : }
     688                 :            : 
     689                 :          0 : void ScViewData::SetShowGrid( bool bShow )
     690                 :            : {
     691                 :          0 :     CreateSelectedTabData();
     692                 :          0 :     maTabData[nTabNo]->bShowGrid = bShow;
     693                 :          0 : }
     694                 :            : 
     695                 :        765 : void ScViewData::RefreshZoom()
     696                 :            : {
     697                 :            :     // recalculate zoom-dependent values (only for current sheet)
     698                 :            : 
     699                 :        765 :     CalcPPT();
     700                 :        765 :     RecalcPixPos();
     701                 :        765 :     aScenButSize = Size(0,0);
     702                 :        765 :     aLogicMode.SetScaleX( GetZoomX() );
     703                 :        765 :     aLogicMode.SetScaleY( GetZoomY() );
     704                 :        765 : }
     705                 :            : 
     706                 :        233 : void ScViewData::SetPagebreakMode( bool bSet )
     707                 :            : {
     708                 :        233 :     bPagebreak = bSet;
     709                 :            : 
     710                 :        233 :     RefreshZoom();
     711                 :        233 : }
     712                 :            : 
     713                 :            : 
     714                 :       5514 : ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const
     715                 :            : {
     716                 :       5514 :     ScMarkType eMarkType = SC_MARK_NONE;
     717                 :            : 
     718 [ +  + ][ +  + ]:       5514 :     if ( rNewMark.IsMarked() || rNewMark.IsMultiMarked() )
                 [ +  + ]
     719                 :            :     {
     720         [ +  + ]:        105 :         if ( rNewMark.IsMultiMarked() )
     721                 :         68 :             rNewMark.MarkToSimple();
     722                 :            : 
     723 [ +  - ][ +  - ]:        105 :         if ( rNewMark.IsMarked() && !rNewMark.IsMultiMarked() )
                 [ +  - ]
     724                 :            :         {
     725                 :        105 :             rNewMark.GetMarkArea( rRange );
     726         [ -  + ]:        105 :             if (ScViewUtil::HasFiltered( rRange, GetDocument()))
     727                 :          0 :                 eMarkType = SC_MARK_SIMPLE_FILTERED;
     728                 :            :             else
     729                 :        105 :                 eMarkType = SC_MARK_SIMPLE;
     730                 :            :         }
     731                 :            :         else
     732                 :          0 :             eMarkType = SC_MARK_MULTI;
     733                 :            :     }
     734 [ +  + ][ +  - ]:       5514 :     if (eMarkType != SC_MARK_SIMPLE && eMarkType != SC_MARK_SIMPLE_FILTERED)
     735                 :            :     {
     736         [ +  - ]:       5409 :         if (eMarkType == SC_MARK_NONE)
     737                 :       5409 :             eMarkType = SC_MARK_SIMPLE;
     738                 :       5409 :         rRange = ScRange( GetCurX(), GetCurY(), GetTabNo() );
     739                 :            :     }
     740                 :       5514 :     return eMarkType;
     741                 :            : }
     742                 :            : 
     743                 :            : 
     744                 :       1951 : ScMarkType ScViewData::GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
     745                 :            :                                 SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const
     746                 :            : {
     747                 :            :     //  parameter bMergeMark is no longer needed: The view's selection is never modified
     748                 :            :     //  (a local copy is used), and a multi selection that adds to a single range can always
     749                 :            :     //  be treated like a single selection (GetSimpleArea isn't used in selection
     750                 :            :     //  handling itself)
     751                 :            : 
     752                 :       1951 :     ScRange aRange;
     753         [ +  - ]:       1951 :     ScMarkData aNewMark(*mpMarkData);       // use a local copy for MarkToSimple
     754         [ +  - ]:       1951 :     ScMarkType eMarkType = GetSimpleArea( aRange, aNewMark);
     755                 :       1951 :     aRange.GetVars( rStartCol, rStartRow, rStartTab, rEndCol, rEndRow, rEndTab);
     756         [ +  - ]:       1951 :     return eMarkType;
     757                 :            : }
     758                 :            : 
     759                 :       3547 : ScMarkType ScViewData::GetSimpleArea( ScRange& rRange ) const
     760                 :            : {
     761                 :            :     //  parameter bMergeMark is no longer needed, see above
     762                 :            : 
     763         [ +  - ]:       3547 :     ScMarkData aNewMark(*mpMarkData);       // use a local copy for MarkToSimple
     764 [ +  - ][ +  - ]:       3547 :     return GetSimpleArea( rRange, aNewMark);
     765                 :            : }
     766                 :            : 
     767                 :          0 : void ScViewData::GetMultiArea( ScRangeListRef& rRange ) const
     768                 :            : {
     769                 :            :     //  parameter bMergeMark is no longer needed, see GetSimpleArea
     770                 :            : 
     771         [ #  # ]:          0 :     ScMarkData aNewMark(*mpMarkData);       // use a local copy for MarkToSimple
     772                 :            : 
     773                 :          0 :     sal_Bool bMulti = aNewMark.IsMultiMarked();
     774         [ #  # ]:          0 :     if (bMulti)
     775                 :            :     {
     776         [ #  # ]:          0 :         aNewMark.MarkToSimple();
     777                 :          0 :         bMulti = aNewMark.IsMultiMarked();
     778                 :            :     }
     779         [ #  # ]:          0 :     if (bMulti)
     780                 :            :     {
     781 [ #  # ][ #  # ]:          0 :         rRange = new ScRangeList;
                 [ #  # ]
     782         [ #  # ]:          0 :         aNewMark.FillRangeListWithMarks( rRange, false );
     783                 :            :     }
     784                 :            :     else
     785                 :            :     {
     786                 :          0 :         ScRange aSimple;
     787         [ #  # ]:          0 :         GetSimpleArea(aSimple);
     788 [ #  # ][ #  # ]:          0 :         rRange = new ScRangeList;
                 [ #  # ]
     789         [ #  # ]:          0 :         rRange->Append(aSimple);
     790         [ #  # ]:          0 :     }
     791                 :          0 : }
     792                 :            : 
     793                 :        267 : sal_Bool ScViewData::SimpleColMarked()
     794                 :            : {
     795                 :            :     SCCOL nStartCol;
     796                 :            :     SCROW nStartRow;
     797                 :            :     SCTAB nStartTab;
     798                 :            :     SCCOL nEndCol;
     799                 :            :     SCROW nEndRow;
     800                 :            :     SCTAB nEndTab;
     801 [ +  - ][ +  - ]:        267 :     if (GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE)
     802 [ +  - ][ -  + ]:        267 :         if (nStartRow==0 && nEndRow==MAXROW)
     803                 :          0 :             return sal_True;
     804                 :            : 
     805                 :        267 :     return false;
     806                 :            : }
     807                 :            : 
     808                 :        267 : sal_Bool ScViewData::SimpleRowMarked()
     809                 :            : {
     810                 :            :     SCCOL nStartCol;
     811                 :            :     SCROW nStartRow;
     812                 :            :     SCTAB nStartTab;
     813                 :            :     SCCOL nEndCol;
     814                 :            :     SCROW nEndRow;
     815                 :            :     SCTAB nEndTab;
     816 [ +  - ][ +  - ]:        267 :     if (GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE)
     817 [ +  - ][ -  + ]:        267 :         if (nStartCol==0 && nEndCol==MAXCOL)
     818                 :          0 :             return sal_True;
     819                 :            : 
     820                 :        267 :     return false;
     821                 :            : }
     822                 :            : 
     823                 :        536 : sal_Bool ScViewData::IsMultiMarked()
     824                 :            : {
     825                 :            :     // Test for "real" multi selection, calling MarkToSimple on a local copy,
     826                 :            :     // and taking filtered in simple area marks into account.
     827                 :            : 
     828                 :        536 :     ScRange aDummy;
     829         [ +  - ]:        536 :     ScMarkType eType = GetSimpleArea(aDummy);
     830                 :        536 :     return (eType & SC_MARK_SIMPLE) != SC_MARK_SIMPLE;
     831                 :            : }
     832                 :            : 
     833                 :          0 : void ScViewData::SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
     834                 :            : {
     835                 :          0 :     nFillMode   = SC_FILL_FILL;
     836                 :          0 :     nFillStartX = nStartCol;
     837                 :          0 :     nFillStartY = nStartRow;
     838                 :          0 :     nFillEndX   = nEndCol;
     839                 :          0 :     nFillEndY   = nEndRow;
     840                 :          0 : }
     841                 :            : 
     842                 :          0 : void ScViewData::SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
     843                 :            :                                 sal_uInt8 nMode )
     844                 :            : {
     845                 :          0 :     nFillMode   = nMode;
     846                 :          0 :     nFillStartX = nStartCol;
     847                 :          0 :     nFillStartY = nStartRow;
     848                 :          0 :     nFillEndX   = nEndCol;
     849                 :          0 :     nFillEndY   = nEndRow;
     850                 :          0 : }
     851                 :            : 
     852                 :          0 : void ScViewData::ResetFillMode()
     853                 :            : {
     854                 :          0 :     nFillMode   = SC_FILL_NONE;
     855                 :          0 : }
     856                 :            : 
     857                 :          0 : void ScViewData::GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
     858                 :            :                                 SCCOL& rEndCol, SCROW& rEndRow )
     859                 :            : {
     860                 :          0 :     rStartCol = nFillStartX;
     861                 :          0 :     rStartRow = nFillStartY;
     862                 :          0 :     rEndCol   = nFillEndX;
     863                 :          0 :     rEndRow   = nFillEndY;
     864                 :          0 : }
     865                 :            : 
     866                 :          0 : SCCOL ScViewData::GetOldCurX() const
     867                 :            : {
     868         [ #  # ]:          0 :     if (pThisTab->mbOldCursorValid)
     869                 :          0 :         return pThisTab->nOldCurX;
     870                 :            :     else
     871                 :          0 :         return pThisTab->nCurX;
     872                 :            : }
     873                 :            : 
     874                 :          0 : SCROW ScViewData::GetOldCurY() const
     875                 :            : {
     876         [ #  # ]:          0 :     if (pThisTab->mbOldCursorValid)
     877                 :          0 :         return pThisTab->nOldCurY;
     878                 :            :     else
     879                 :          0 :         return pThisTab->nCurY;
     880                 :            : }
     881                 :            : 
     882                 :          0 : void ScViewData::SetOldCursor( SCCOL nNewX, SCROW nNewY )
     883                 :            : {
     884                 :          0 :     pThisTab->nOldCurX = nNewX;
     885                 :          0 :     pThisTab->nOldCurY = nNewY;
     886                 :          0 :     pThisTab->mbOldCursorValid = true;
     887                 :          0 : }
     888                 :            : 
     889                 :        306 : void ScViewData::ResetOldCursor()
     890                 :            : {
     891                 :        306 :     pThisTab->mbOldCursorValid = false;
     892                 :        306 : }
     893                 :            : 
     894                 :          0 : Rectangle ScViewData::GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY,
     895                 :            :                                     Window* pWin, const ScPatternAttr* pPattern,
     896                 :            :                                     sal_Bool bForceToTop )
     897                 :            : {
     898                 :          0 :     return ScEditUtil( pDoc, nPosX, nPosY, nTabNo, GetScrPos(nPosX,nPosY,eWhich,sal_True),
     899                 :          0 :                         pWin, nPPTX, nPPTY, GetZoomX(), GetZoomY() ).
     900 [ #  # ][ #  # ]:          0 :                             GetEditArea( pPattern, bForceToTop );
     901                 :            : }
     902                 :            : 
     903                 :          0 : void ScViewData::SetEditEngine( ScSplitPos eWhich,
     904                 :            :                                 ScEditEngineDefaulter* pNewEngine,
     905                 :            :                                 Window* pWin, SCCOL nNewX, SCROW nNewY )
     906                 :            : {
     907         [ #  # ]:          0 :     sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTabNo );
     908                 :          0 :     ScHSplitPos eHWhich = WhichH(eWhich);
     909                 :            : 
     910                 :          0 :     sal_Bool bWasThere = false;
     911         [ #  # ]:          0 :     if (pEditView[eWhich])
     912                 :            :     {
     913                 :            :         //  Wenn die View schon da ist, nichts aufrufen, was die Cursorposition aendert
     914                 :            : 
     915         [ #  # ]:          0 :         if (bEditActive[eWhich])
     916                 :          0 :             bWasThere = sal_True;
     917                 :            :         else
     918 [ #  # ][ #  # ]:          0 :             pEditView[eWhich]->SetEditEngine(pNewEngine);
     919                 :            : 
     920 [ #  # ][ #  # ]:          0 :         if (pEditView[eWhich]->GetWindow() != pWin)
     921                 :            :         {
     922         [ #  # ]:          0 :             pEditView[eWhich]->SetWindow(pWin);
     923                 :            :             OSL_FAIL("EditView Window geaendert");
     924                 :            :         }
     925                 :            :     }
     926                 :            :     else
     927                 :            :     {
     928 [ #  # ][ #  # ]:          0 :         pEditView[eWhich] = new EditView( pNewEngine, pWin );
                 [ #  # ]
     929                 :            :     }
     930                 :            : 
     931                 :            :     //  bei IdleFormat wird manchmal ein Cursor gemalt, wenn die View schon weg ist (23576)
     932                 :            : 
     933         [ #  # ]:          0 :     sal_uLong nEC = pNewEngine->GetControlWord();
     934         [ #  # ]:          0 :     pNewEngine->SetControlWord(nEC & ~EE_CNTRL_DOIDLEFORMAT);
     935                 :            : 
     936         [ #  # ]:          0 :     sal_uLong nVC = pEditView[eWhich]->GetControlWord();
     937         [ #  # ]:          0 :     pEditView[eWhich]->SetControlWord(nVC & ~EV_CNTRL_AUTOSCROLL);
     938                 :            : 
     939                 :          0 :     bEditActive[eWhich] = true;
     940                 :            : 
     941         [ #  # ]:          0 :     const ScPatternAttr* pPattern = pDoc->GetPattern( nNewX, nNewY, nTabNo );
     942                 :            :     SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem&)
     943         [ #  # ]:          0 :                                     pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
     944                 :            : 
     945                 :            :     sal_Bool bBreak = ( eJust == SVX_HOR_JUSTIFY_BLOCK ) ||
     946 [ #  # ][ #  # ]:          0 :                     ((SfxBoolItem&)pPattern->GetItem(ATTR_LINEBREAK)).GetValue();
                 [ #  # ]
     947                 :            : 
     948         [ #  # ]:          0 :     sal_Bool bAsianVertical = pNewEngine->IsVertical();     // set by InputHandler
     949                 :            : 
     950                 :          0 :     Rectangle aPixRect = ScEditUtil( pDoc, nNewX,nNewY,nTabNo, GetScrPos(nNewX,nNewY,eWhich),
     951                 :          0 :                                         pWin, nPPTX,nPPTY,GetZoomX(),GetZoomY() ).
     952 [ #  # ][ #  # ]:          0 :                                             GetEditArea( pPattern, sal_True );
                 [ #  # ]
     953                 :            : 
     954                 :            :     //  when right-aligned, leave space for the cursor
     955                 :            :     //  in vertical mode, editing is always right-aligned
     956 [ #  # ][ #  # ]:          0 :     if ( nEditAdjust == SVX_ADJUST_RIGHT || bAsianVertical )
     957                 :          0 :         aPixRect.Right() += 1;
     958                 :            : 
     959 [ #  # ][ #  # ]:          0 :     Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, GetLogicMode() );
     960         [ #  # ]:          0 :     pEditView[eWhich]->SetOutputArea( aOutputArea );
     961                 :            : 
     962 [ #  # ][ #  # ]:          0 :     if ( bActive && eWhich == GetActivePart() )
                 [ #  # ]
     963                 :            :     {
     964                 :            :         // keep the part that has the active edit view available after
     965                 :            :         // switching sheets or reference input on a different part
     966                 :          0 :         eEditActivePart = eWhich;
     967                 :            : 
     968                 :            :         //  modify members nEditCol etc. only if also extending for needed area
     969                 :          0 :         nEditCol = nNewX;
     970                 :          0 :         nEditRow = nNewY;
     971         [ #  # ]:          0 :         const ScMergeAttr* pMergeAttr = (ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE);
     972                 :          0 :         nEditEndCol = nEditCol;
     973         [ #  # ]:          0 :         if (pMergeAttr->GetColMerge() > 1)
     974                 :          0 :             nEditEndCol += pMergeAttr->GetColMerge() - 1;
     975                 :          0 :         nEditEndRow = nEditRow;
     976         [ #  # ]:          0 :         if (pMergeAttr->GetRowMerge() > 1)
     977                 :          0 :             nEditEndRow += pMergeAttr->GetRowMerge() - 1;
     978                 :          0 :         nEditStartCol = nEditCol;
     979                 :            : 
     980                 :            :         //  For growing use only the alignment value from the attribute, numbers
     981                 :            :         //  (existing or started) with default aligment extend to the right.
     982                 :          0 :         sal_Bool bGrowCentered = ( eJust == SVX_HOR_JUSTIFY_CENTER );
     983                 :          0 :         sal_Bool bGrowToLeft = ( eJust == SVX_HOR_JUSTIFY_RIGHT );      // visual left
     984                 :          0 :         sal_Bool bGrowBackwards = bGrowToLeft;                          // logical left
     985         [ #  # ]:          0 :         if ( bLayoutRTL )
     986                 :          0 :             bGrowBackwards = !bGrowBackwards;                       // invert on RTL sheet
     987         [ #  # ]:          0 :         if ( bAsianVertical )
     988                 :          0 :             bGrowCentered = bGrowToLeft = bGrowBackwards = false;   // keep old behavior for asian mode
     989                 :            : 
     990                 :            :         long nSizeXPix;
     991 [ #  # ][ #  # ]:          0 :         if (bBreak && !bAsianVertical)
     992         [ #  # ]:          0 :             nSizeXPix = aPixRect.GetWidth();    // Papersize -> kein H-Scrolling
     993                 :            :         else
     994                 :            :         {
     995                 :            :             OSL_ENSURE(pView,"keine View fuer EditView");
     996                 :            : 
     997         [ #  # ]:          0 :             if ( bGrowCentered )
     998                 :            :             {
     999                 :            :                 //  growing into both directions until one edge is reached
    1000                 :            :                 //! should be limited to whole cells in both directions
    1001                 :          0 :                 long nLeft = aPixRect.Left();
    1002         [ #  # ]:          0 :                 long nRight = pView->GetGridWidth(eHWhich) - aPixRect.Right();
    1003         [ #  # ]:          0 :                 nSizeXPix = aPixRect.GetWidth() + 2 * Min( nLeft, nRight );
    1004                 :            :             }
    1005         [ #  # ]:          0 :             else if ( bGrowToLeft )
    1006                 :          0 :                 nSizeXPix = aPixRect.Right();   // space that's available in the window when growing to the left
    1007                 :            :             else
    1008         [ #  # ]:          0 :                 nSizeXPix = pView->GetGridWidth(eHWhich) - aPixRect.Left();
    1009                 :            : 
    1010         [ #  # ]:          0 :             if ( nSizeXPix <= 0 )
    1011         [ #  # ]:          0 :                 nSizeXPix = aPixRect.GetWidth();    // editing outside to the right of the window -> keep cell width
    1012                 :            :         }
    1013                 :            :         OSL_ENSURE(pView,"keine View fuer EditView");
    1014         [ #  # ]:          0 :         long nSizeYPix = pView->GetGridHeight(WhichV(eWhich)) - aPixRect.Top();
    1015         [ #  # ]:          0 :         if ( nSizeYPix <= 0 )
    1016         [ #  # ]:          0 :             nSizeYPix = aPixRect.GetHeight();   // editing outside below the window -> keep cell height
    1017                 :            : 
    1018 [ #  # ][ #  # ]:          0 :         Size aPaperSize = pView->GetActiveWin()->PixelToLogic( Size( nSizeXPix, nSizeYPix ), GetLogicMode() );
                 [ #  # ]
    1019 [ #  # ][ #  # ]:          0 :         if ( bBreak && !bAsianVertical && SC_MOD()->GetInputOptions().GetTextWysiwyg() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1020                 :            :         {
    1021                 :            :             //  if text is formatted for printer, use the exact same paper width
    1022                 :            :             //  (and same line breaks) as for output.
    1023                 :            : 
    1024         [ #  # ]:          0 :             Fraction aFract(1,1);
    1025                 :            :             Rectangle aUtilRect = ScEditUtil( pDoc,nNewX,nNewY,nTabNo, Point(0,0), pWin,
    1026 [ #  # ][ #  # ]:          0 :                                     HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, false );
    1027         [ #  # ]:          0 :             aPaperSize.Width() = aUtilRect.GetWidth();
    1028                 :            :         }
    1029         [ #  # ]:          0 :         pNewEngine->SetPaperSize( aPaperSize );
    1030                 :            : 
    1031                 :            :         // sichtbarer Ausschnitt
    1032         [ #  # ]:          0 :         Size aPaper = pNewEngine->GetPaperSize();
    1033         [ #  # ]:          0 :         Rectangle aVis = pEditView[eWhich]->GetVisArea();
    1034                 :          0 :         long nDiff = aVis.Right() - aVis.Left();
    1035         [ #  # ]:          0 :         if ( nEditAdjust == SVX_ADJUST_RIGHT )
    1036                 :            :         {
    1037                 :          0 :             aVis.Right() = aPaper.Width() - 1;
    1038                 :          0 :             bMoveArea = !bLayoutRTL;
    1039                 :            :         }
    1040         [ #  # ]:          0 :         else if ( nEditAdjust == SVX_ADJUST_CENTER )
    1041                 :            :         {
    1042                 :          0 :             aVis.Right() = ( aPaper.Width() - 1 + nDiff ) / 2;
    1043                 :          0 :             bMoveArea = sal_True;   // always
    1044                 :            :         }
    1045                 :            :         else
    1046                 :            :         {
    1047                 :          0 :             aVis.Right() = nDiff;
    1048                 :          0 :             bMoveArea = bLayoutRTL;
    1049                 :            :         }
    1050                 :          0 :         aVis.Left() = aVis.Right() - nDiff;
    1051                 :            :         // #i49561# Important note:
    1052                 :            :         // The set offset of the visible area of the EditView for centered and
    1053                 :            :         // right alignment in horizontal layout is consider by instances of
    1054                 :            :         // class <ScEditObjectViewForwarder> in its methods <LogicToPixel(..)>
    1055                 :            :         // and <PixelToLogic(..)>. This is needed for the correct visibility
    1056                 :            :         // of paragraphs in edit mode at the accessibility API.
    1057         [ #  # ]:          0 :         pEditView[eWhich]->SetVisArea(aVis);
    1058                 :            :         //  UpdateMode has been disabled in ScInputHandler::StartTable
    1059                 :            :         //  must be enabled before EditGrowY (GetTextHeight)
    1060         [ #  # ]:          0 :         pNewEngine->SetUpdateMode( sal_True );
    1061                 :            : 
    1062 [ #  # ][ #  # ]:          0 :         pNewEngine->SetStatusEventHdl( LINK( this, ScViewData, EditEngineHdl ) );
    1063                 :            : 
    1064         [ #  # ]:          0 :         EditGrowY( sal_True );      // adjust to existing text content
    1065         [ #  # ]:          0 :         EditGrowX();
    1066                 :            : 
    1067         [ #  # ]:          0 :         Point aDocPos = pEditView[eWhich]->GetWindowPosTopLeft(0);
    1068         [ #  # ]:          0 :         if (aDocPos.Y() < aOutputArea.Top())
    1069         [ #  # ]:          0 :             pEditView[eWhich]->Scroll( 0, aOutputArea.Top() - aDocPos.Y() );
    1070                 :            :     }
    1071                 :            : 
    1072                 :            :                                                     // hier muss bEditActive schon gesetzt sein
    1073                 :            :                                                     // (wegen Map-Mode bei Paint)
    1074         [ #  # ]:          0 :     if (!bWasThere)
    1075         [ #  # ]:          0 :         pNewEngine->InsertView(pEditView[eWhich]);
    1076                 :            : 
    1077                 :            :     //      background color of the cell
    1078         [ #  # ]:          0 :     Color aBackCol = ((const SvxBrushItem&)pPattern->GetItem(ATTR_BACKGROUND)).GetColor();
    1079                 :            : 
    1080         [ #  # ]:          0 :     ScModule* pScMod = SC_MOD();
    1081         [ #  # ]:          0 :     if ( aBackCol.GetTransparency() > 0 )
    1082                 :            :     {
    1083 [ #  # ][ #  # ]:          0 :         aBackCol.SetColor( pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor );
    1084                 :            :     }
    1085         [ #  # ]:          0 :     pEditView[eWhich]->SetBackgroundColor( aBackCol );
    1086                 :            : 
    1087         [ #  # ]:          0 :     pEditView[eWhich]->Invalidate();            //  needed ??
    1088                 :            :     //  needed, wenn position changed
    1089                 :          0 : }
    1090                 :            : 
    1091                 :          0 : IMPL_LINK_NOARG_INLINE_START(ScViewData, EmptyEditHdl)
    1092                 :            : {
    1093                 :          0 :     return 0;
    1094                 :            : }
    1095                 :          0 : IMPL_LINK_NOARG_INLINE_END(ScViewData, EmptyEditHdl)
    1096                 :            : 
    1097                 :          0 : IMPL_LINK( ScViewData, EditEngineHdl, EditStatus *, pStatus )
    1098                 :            : {
    1099                 :          0 :     sal_uLong nStatus = pStatus->GetStatusWord();
    1100         [ #  # ]:          0 :     if (nStatus & (EE_STAT_HSCROLL | EE_STAT_TEXTHEIGHTCHANGED | EE_STAT_TEXTWIDTHCHANGED | EE_STAT_CURSOROUT))
    1101                 :            :     {
    1102                 :          0 :         EditGrowY();
    1103                 :          0 :         EditGrowX();
    1104                 :            : 
    1105         [ #  # ]:          0 :         if (nStatus & EE_STAT_CURSOROUT)
    1106                 :            :         {
    1107                 :          0 :             ScSplitPos eWhich = GetActivePart();
    1108         [ #  # ]:          0 :             if (pEditView[eWhich])
    1109                 :          0 :                 pEditView[eWhich]->ShowCursor(false);
    1110                 :            :         }
    1111                 :            :     }
    1112                 :          0 :     return 0;
    1113                 :            : }
    1114                 :            : 
    1115                 :          0 : void ScViewData::EditGrowX()
    1116                 :            : {
    1117         [ #  # ]:          0 :     ScDocument* pLocalDoc = GetDocument();
    1118                 :            : 
    1119                 :          0 :     ScSplitPos eWhich = GetActivePart();
    1120                 :          0 :     ScHSplitPos eHWhich = WhichH(eWhich);
    1121                 :          0 :     EditView* pCurView = pEditView[eWhich];
    1122                 :            : 
    1123 [ #  # ][ #  # ]:          0 :     if ( !pCurView || !bEditActive[eWhich])
    1124                 :          0 :         return;
    1125                 :            : 
    1126         [ #  # ]:          0 :     sal_Bool bLayoutRTL = pLocalDoc->IsLayoutRTL( nTabNo );
    1127                 :            : 
    1128                 :            :     ScEditEngineDefaulter* pEngine =
    1129 [ #  # ][ #  # ]:          0 :         (ScEditEngineDefaulter*) pCurView->GetEditEngine();
    1130         [ #  # ]:          0 :     Window* pWin = pCurView->GetWindow();
    1131                 :            : 
    1132                 :          0 :     SCCOL nLeft = GetPosX(eHWhich);
    1133         [ #  # ]:          0 :     SCCOL nRight = nLeft + VisibleCellsX(eHWhich);
    1134                 :            : 
    1135         [ #  # ]:          0 :     Size        aSize = pEngine->GetPaperSize();
    1136         [ #  # ]:          0 :     Rectangle   aArea = pCurView->GetOutputArea();
    1137                 :          0 :     long        nOldRight = aArea.Right();
    1138                 :            : 
    1139                 :            :     //  Margin ist schon bei der urspruenglichen Breite beruecksichtigt
    1140         [ #  # ]:          0 :     long nTextWidth = pEngine->CalcTextWidth();
    1141                 :            : 
    1142                 :          0 :     sal_Bool bChanged = false;
    1143         [ #  # ]:          0 :     sal_Bool bAsianVertical = pEngine->IsVertical();
    1144                 :            : 
    1145                 :            :     //  get bGrow... variables the same way as in SetEditEngine
    1146         [ #  # ]:          0 :     const ScPatternAttr* pPattern = pLocalDoc->GetPattern( nEditCol, nEditRow, nTabNo );
    1147                 :            :     SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem&)
    1148         [ #  # ]:          0 :                                     pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
    1149                 :          0 :     sal_Bool bGrowCentered = ( eJust == SVX_HOR_JUSTIFY_CENTER );
    1150                 :          0 :     sal_Bool bGrowToLeft = ( eJust == SVX_HOR_JUSTIFY_RIGHT );      // visual left
    1151                 :          0 :     sal_Bool bGrowBackwards = bGrowToLeft;                          // logical left
    1152         [ #  # ]:          0 :     if ( bLayoutRTL )
    1153                 :          0 :         bGrowBackwards = !bGrowBackwards;                       // invert on RTL sheet
    1154         [ #  # ]:          0 :     if ( bAsianVertical )
    1155                 :          0 :         bGrowCentered = bGrowToLeft = bGrowBackwards = false;   // keep old behavior for asian mode
    1156                 :            : 
    1157                 :          0 :     sal_Bool bUnevenGrow = false;
    1158         [ #  # ]:          0 :     if ( bGrowCentered )
    1159                 :            :     {
    1160 [ #  # ][ #  # ]:          0 :         while (aArea.GetWidth() + 0 < nTextWidth && ( nEditStartCol > nLeft || nEditEndCol < nRight ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1161                 :            :         {
    1162                 :          0 :             long nLogicLeft = 0;
    1163         [ #  # ]:          0 :             if ( nEditStartCol > nLeft )
    1164                 :            :             {
    1165                 :          0 :                 --nEditStartCol;
    1166         [ #  # ]:          0 :                 long nLeftPix = ToPixel( pLocalDoc->GetColWidth( nEditStartCol, nTabNo ), nPPTX );
    1167         [ #  # ]:          0 :                 nLogicLeft = pWin->PixelToLogic(Size(nLeftPix,0)).Width();
    1168                 :            :             }
    1169                 :          0 :             long nLogicRight = 0;
    1170         [ #  # ]:          0 :             if ( nEditEndCol < nRight )
    1171                 :            :             {
    1172                 :          0 :                 ++nEditEndCol;
    1173         [ #  # ]:          0 :                 long nRightPix = ToPixel( pLocalDoc->GetColWidth( nEditEndCol, nTabNo ), nPPTX );
    1174         [ #  # ]:          0 :                 nLogicRight = pWin->PixelToLogic(Size(nRightPix,0)).Width();
    1175                 :            :             }
    1176                 :            : 
    1177         [ #  # ]:          0 :             aArea.Left() -= bLayoutRTL ? nLogicRight : nLogicLeft;
    1178         [ #  # ]:          0 :             aArea.Right() += bLayoutRTL ? nLogicLeft : nLogicRight;
    1179                 :            : 
    1180         [ #  # ]:          0 :             if ( aArea.Right() > aArea.Left() + aSize.Width() - 1 )
    1181                 :            :             {
    1182                 :          0 :                 long nCenter = ( aArea.Left() + aArea.Right() ) / 2;
    1183                 :          0 :                 long nHalf = aSize.Width() / 2;
    1184                 :          0 :                 aArea.Left() = nCenter - nHalf + 1;
    1185                 :          0 :                 aArea.Right() = nCenter + aSize.Width() - nHalf - 1;
    1186                 :            :             }
    1187                 :            : 
    1188                 :          0 :             bChanged = sal_True;
    1189         [ #  # ]:          0 :             if ( nLogicLeft != nLogicRight )
    1190                 :          0 :                 bUnevenGrow = sal_True;
    1191                 :            :         }
    1192                 :            :     }
    1193         [ #  # ]:          0 :     else if ( bGrowBackwards )
    1194                 :            :     {
    1195 [ #  # ][ #  # ]:          0 :         while (aArea.GetWidth() + 0 < nTextWidth && nEditStartCol > nLeft)
         [ #  # ][ #  # ]
    1196                 :            :         {
    1197                 :          0 :             --nEditStartCol;
    1198         [ #  # ]:          0 :             long nPix = ToPixel( pLocalDoc->GetColWidth( nEditStartCol, nTabNo ), nPPTX );
    1199         [ #  # ]:          0 :             long nLogicWidth = pWin->PixelToLogic(Size(nPix,0)).Width();
    1200         [ #  # ]:          0 :             if ( !bLayoutRTL )
    1201                 :          0 :                 aArea.Left() -= nLogicWidth;
    1202                 :            :             else
    1203                 :          0 :                 aArea.Right() += nLogicWidth;
    1204                 :            : 
    1205         [ #  # ]:          0 :             if ( aArea.Right() > aArea.Left() + aSize.Width() - 1 )
    1206                 :            :             {
    1207         [ #  # ]:          0 :                 if ( !bLayoutRTL )
    1208                 :          0 :                     aArea.Left() = aArea.Right() - aSize.Width() + 1;
    1209                 :            :                 else
    1210                 :          0 :                     aArea.Right() = aArea.Left() + aSize.Width() - 1;
    1211                 :            :             }
    1212                 :            : 
    1213                 :          0 :             bChanged = sal_True;
    1214                 :            :         }
    1215                 :            :     }
    1216                 :            :     else
    1217                 :            :     {
    1218 [ #  # ][ #  # ]:          0 :         while (aArea.GetWidth() + 0 < nTextWidth && nEditEndCol < nRight)
         [ #  # ][ #  # ]
    1219                 :            :         {
    1220                 :          0 :             ++nEditEndCol;
    1221         [ #  # ]:          0 :             long nPix = ToPixel( pLocalDoc->GetColWidth( nEditEndCol, nTabNo ), nPPTX );
    1222         [ #  # ]:          0 :             long nLogicWidth = pWin->PixelToLogic(Size(nPix,0)).Width();
    1223         [ #  # ]:          0 :             if ( bLayoutRTL )
    1224                 :          0 :                 aArea.Left() -= nLogicWidth;
    1225                 :            :             else
    1226                 :          0 :                 aArea.Right() += nLogicWidth;
    1227                 :            : 
    1228         [ #  # ]:          0 :             if ( aArea.Right() > aArea.Left() + aSize.Width() - 1 )
    1229                 :            :             {
    1230         [ #  # ]:          0 :                 if ( bLayoutRTL )
    1231                 :          0 :                     aArea.Left() = aArea.Right() - aSize.Width() + 1;
    1232                 :            :                 else
    1233                 :          0 :                     aArea.Right() = aArea.Left() + aSize.Width() - 1;
    1234                 :            :             }
    1235                 :            : 
    1236                 :          0 :             bChanged = sal_True;
    1237                 :            :         }
    1238                 :            :     }
    1239                 :            : 
    1240         [ #  # ]:          0 :     if (bChanged)
    1241                 :            :     {
    1242 [ #  # ][ #  # ]:          0 :         if ( bMoveArea || bGrowCentered || bGrowBackwards || bLayoutRTL )
         [ #  # ][ #  # ]
    1243                 :            :         {
    1244         [ #  # ]:          0 :             Rectangle aVis = pCurView->GetVisArea();
    1245                 :            : 
    1246         [ #  # ]:          0 :             if ( bGrowCentered )
    1247                 :            :             {
    1248                 :            :                 //  switch to center-aligned (undo?) and reset VisArea to center
    1249                 :            : 
    1250 [ #  # ][ #  # ]:          0 :                 pEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
                 [ #  # ]
    1251                 :            : 
    1252                 :          0 :                 long nCenter = aSize.Width() / 2;
    1253         [ #  # ]:          0 :                 long nVisSize = aArea.GetWidth();
    1254                 :          0 :                 aVis.Left() = nCenter - nVisSize / 2;
    1255                 :          0 :                 aVis.Right() = aVis.Left() + nVisSize - 1;
    1256                 :            :             }
    1257         [ #  # ]:          0 :             else if ( bGrowToLeft )
    1258                 :            :             {
    1259                 :            :                 //  switch to right-aligned (undo?) and reset VisArea to the right
    1260                 :            : 
    1261 [ #  # ][ #  # ]:          0 :                 pEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
                 [ #  # ]
    1262                 :            : 
    1263                 :          0 :                 aVis.Right() = aSize.Width() - 1;
    1264         [ #  # ]:          0 :                 aVis.Left() = aSize.Width() - aArea.GetWidth();     // with the new, increased area
    1265                 :            :             }
    1266                 :            :             else
    1267                 :            :             {
    1268                 :            :                 //  switch to left-aligned (undo?) and reset VisArea to the left
    1269                 :            : 
    1270 [ #  # ][ #  # ]:          0 :                 pEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
                 [ #  # ]
    1271                 :            : 
    1272                 :          0 :                 long nMove = aVis.Left();
    1273                 :          0 :                 aVis.Left() = 0;
    1274                 :          0 :                 aVis.Right() -= nMove;
    1275                 :            :             }
    1276         [ #  # ]:          0 :             pCurView->SetVisArea( aVis );
    1277                 :          0 :             bMoveArea = false;
    1278                 :            :         }
    1279                 :            : 
    1280         [ #  # ]:          0 :         pCurView->SetOutputArea(aArea);
    1281                 :            : 
    1282                 :            :         //  In vertical mode, the whole text is moved to the next cell (right-aligned),
    1283                 :            :         //  so everything must be repainted. Otherwise, paint only the new area.
    1284                 :            :         //  If growing in centered alignment, if the cells left and right have different sizes,
    1285                 :            :         //  the whole text will move, and may not even obscure all of the original display.
    1286         [ #  # ]:          0 :         if ( bUnevenGrow )
    1287                 :            :         {
    1288         [ #  # ]:          0 :             aArea.Left() = pWin->PixelToLogic( Point(0,0) ).X();
    1289         [ #  # ]:          0 :             aArea.Right() = pWin->PixelToLogic( aScrSize ).Width();
    1290                 :            :         }
    1291 [ #  # ][ #  # ]:          0 :         else if ( !bAsianVertical && !bGrowToLeft && !bGrowCentered )
                 [ #  # ]
    1292                 :          0 :             aArea.Left() = nOldRight;
    1293         [ #  # ]:          0 :         pWin->Invalidate(aArea);
    1294                 :            :     }
    1295                 :            : }
    1296                 :            : 
    1297                 :          0 : void ScViewData::EditGrowY( sal_Bool bInitial )
    1298                 :            : {
    1299                 :          0 :     ScSplitPos eWhich = GetActivePart();
    1300                 :          0 :     ScVSplitPos eVWhich = WhichV(eWhich);
    1301                 :          0 :     EditView* pCurView = pEditView[eWhich];
    1302                 :            : 
    1303 [ #  # ][ #  # ]:          0 :     if ( !pCurView || !bEditActive[eWhich])
    1304                 :            :         return;
    1305                 :            : 
    1306         [ #  # ]:          0 :     sal_uLong nControl = pEditView[eWhich]->GetControlWord();
    1307         [ #  # ]:          0 :     if ( nControl & EV_CNTRL_AUTOSCROLL )
    1308                 :            :     {
    1309                 :            :         //  if end of screen had already been reached and scrolling enabled,
    1310                 :            :         //  don't further try to grow the edit area
    1311                 :            : 
    1312 [ #  # ][ #  # ]:          0 :         pCurView->SetOutputArea( pCurView->GetOutputArea() );   // re-align to pixels
    1313                 :            :         return;
    1314                 :            :     }
    1315                 :            : 
    1316         [ #  # ]:          0 :     EditEngine* pEngine = pCurView->GetEditEngine();
    1317         [ #  # ]:          0 :     Window* pWin = pCurView->GetWindow();
    1318                 :            : 
    1319         [ #  # ]:          0 :     SCROW nBottom = GetPosY(eVWhich) + VisibleCellsY(eVWhich);
    1320                 :            : 
    1321         [ #  # ]:          0 :     Size        aSize = pEngine->GetPaperSize();
    1322         [ #  # ]:          0 :     Rectangle   aArea = pCurView->GetOutputArea();
    1323                 :          0 :     long        nOldBottom = aArea.Bottom();
    1324         [ #  # ]:          0 :     long        nTextHeight = pEngine->GetTextHeight();
    1325                 :            : 
    1326                 :            :     //  When editing a formula in a cell with optimal height, allow a larger portion
    1327                 :            :     //  to be clipped before extending to following rows, to avoid obscuring cells for
    1328                 :            :     //  reference input (next row is likely to be useful in formulas).
    1329                 :          0 :     long nAllowedExtra = SC_GROWY_SMALL_EXTRA;
    1330 [ #  # ][ #  # ]:          0 :     if ( nEditEndRow == nEditRow && !( pDoc->GetRowFlags( nEditRow, nTabNo ) & CR_MANUALSIZE ) &&
         [ #  # ][ #  # ]
                 [ #  # ]
    1331         [ #  # ]:          0 :             pEngine->GetParagraphCount() <= 1 )
    1332                 :            :     {
    1333                 :            :         //  If the (only) paragraph starts with a '=', it's a formula.
    1334                 :            :         //  If this is the initial call and the text is empty, allow the larger value, too,
    1335                 :            :         //  because this occurs in the normal progress of editing a formula.
    1336                 :            :         //  Subsequent calls with empty text might involve changed attributes (including
    1337                 :            :         //  font height), so they are treated like normal text.
    1338         [ #  # ]:          0 :         String aText = pEngine->GetText( (sal_uInt16) 0 );
    1339 [ #  # ][ #  # ]:          0 :         if ( ( aText.Len() == 0 && bInitial ) || aText.GetChar(0) == (sal_Unicode)'=' )
         [ #  # ][ #  # ]
    1340         [ #  # ]:          0 :             nAllowedExtra = SC_GROWY_BIG_EXTRA;
    1341                 :            :     }
    1342                 :            : 
    1343                 :          0 :     sal_Bool bChanged = false;
    1344                 :          0 :     sal_Bool bMaxReached = false;
    1345 [ #  # ][ #  # ]:          0 :     while (aArea.GetHeight() + nAllowedExtra < nTextHeight && nEditEndRow < nBottom && !bMaxReached)
         [ #  # ][ #  # ]
                 [ #  # ]
    1346                 :            :     {
    1347                 :          0 :         ++nEditEndRow;
    1348         [ #  # ]:          0 :         ScDocument* pLocalDoc = GetDocument();
    1349         [ #  # ]:          0 :         long nPix = ToPixel( pLocalDoc->GetRowHeight( nEditEndRow, nTabNo ), nPPTY );
    1350         [ #  # ]:          0 :         aArea.Bottom() += pWin->PixelToLogic(Size(0,nPix)).Height();
    1351                 :            : 
    1352         [ #  # ]:          0 :         if ( aArea.Bottom() > aArea.Top() + aSize.Height() - 1 )
    1353                 :            :         {
    1354                 :          0 :             aArea.Bottom() = aArea.Top() + aSize.Height() - 1;
    1355                 :          0 :             bMaxReached = sal_True;     // don't occupy more cells beyond paper size
    1356                 :            :         }
    1357                 :            : 
    1358                 :          0 :         bChanged = sal_True;
    1359                 :          0 :         nAllowedExtra = SC_GROWY_SMALL_EXTRA;   // larger value is only for first row
    1360                 :            :     }
    1361                 :            : 
    1362         [ #  # ]:          0 :     if (bChanged)
    1363                 :            :     {
    1364         [ #  # ]:          0 :         pCurView->SetOutputArea(aArea);
    1365                 :            : 
    1366 [ #  # ][ #  # ]:          0 :         if (nEditEndRow >= nBottom || bMaxReached)
    1367                 :            :         {
    1368         [ #  # ]:          0 :             if ((nControl & EV_CNTRL_AUTOSCROLL) == 0)
    1369         [ #  # ]:          0 :                 pCurView->SetControlWord( nControl | EV_CNTRL_AUTOSCROLL );
    1370                 :            :         }
    1371                 :            : 
    1372                 :          0 :         aArea.Top() = nOldBottom;
    1373         [ #  # ]:          0 :         pWin->Invalidate(aArea);
    1374                 :            :     }
    1375                 :            : }
    1376                 :            : 
    1377                 :       1315 : void ScViewData::ResetEditView()
    1378                 :            : {
    1379                 :       1315 :     EditEngine* pEngine = NULL;
    1380         [ +  + ]:       6575 :     for (sal_uInt16 i=0; i<4; i++)
    1381         [ -  + ]:       5260 :         if (pEditView[i])
    1382                 :            :         {
    1383         [ #  # ]:          0 :             if (bEditActive[i])
    1384                 :            :             {
    1385                 :          0 :                 pEngine = pEditView[i]->GetEditEngine();
    1386                 :          0 :                 pEngine->RemoveView(pEditView[i]);
    1387         [ #  # ]:          0 :                 pEditView[i]->SetOutputArea( Rectangle() );
    1388                 :            :             }
    1389                 :          0 :             bEditActive[i] = false;
    1390                 :            :         }
    1391                 :            : 
    1392         [ -  + ]:       1315 :     if (pEngine)
    1393         [ #  # ]:          0 :         pEngine->SetStatusEventHdl( LINK( this, ScViewData, EmptyEditHdl ) );
    1394                 :       1315 : }
    1395                 :            : 
    1396                 :        454 : void ScViewData::KillEditView()
    1397                 :            : {
    1398         [ +  + ]:       2270 :     for (sal_uInt16 i=0; i<4; i++)
    1399         [ -  + ]:       1816 :         if (pEditView[i])
    1400                 :            :         {
    1401         [ #  # ]:          0 :             if (bEditActive[i])
    1402                 :          0 :                 pEditView[i]->GetEditEngine()->RemoveView(pEditView[i]);
    1403         [ #  # ]:          0 :             delete pEditView[i];
    1404                 :          0 :             pEditView[i] = NULL;
    1405                 :            :         }
    1406                 :        454 : }
    1407                 :            : 
    1408                 :          0 : void ScViewData::GetEditView( ScSplitPos eWhich, EditView*& rViewPtr, SCCOL& rCol, SCROW& rRow )
    1409                 :            : {
    1410                 :          0 :     rViewPtr = pEditView[eWhich];
    1411                 :          0 :     rCol = nEditCol;
    1412                 :          0 :     rRow = nEditRow;
    1413                 :          0 : }
    1414                 :            : 
    1415                 :        354 : void ScViewData::CreateTabData( SCTAB nNewTab )
    1416                 :            : {
    1417                 :        354 :     EnsureTabDataSize(nNewTab + 1);
    1418                 :            : 
    1419         [ +  + ]:        354 :     if (!maTabData[nNewTab])
    1420                 :            :     {
    1421         [ +  - ]:         43 :         maTabData[nNewTab] = new ScViewDataTable;
    1422                 :            : 
    1423                 :         43 :         maTabData[nNewTab]->eZoomType  = eDefZoomType;
    1424                 :         43 :         maTabData[nNewTab]->aZoomX     = aDefZoomX;
    1425                 :         43 :         maTabData[nNewTab]->aZoomY     = aDefZoomY;
    1426                 :         43 :         maTabData[nNewTab]->aPageZoomX = aDefPageZoomX;
    1427                 :         43 :         maTabData[nNewTab]->aPageZoomY = aDefPageZoomY;
    1428                 :            :     }
    1429                 :        354 : }
    1430                 :            : 
    1431                 :          0 : void ScViewData::CreateSelectedTabData()
    1432                 :            : {
    1433 [ #  # ][ #  # ]:          0 :     ScMarkData::iterator itr = mpMarkData->begin(), itrEnd = mpMarkData->end();
    1434 [ #  # ][ #  # ]:          0 :     for (; itr != itrEnd; ++itr)
                 [ #  # ]
    1435 [ #  # ][ #  # ]:          0 :         CreateTabData(*itr);
    1436                 :          0 : }
    1437                 :            : 
    1438                 :        834 : void ScViewData::EnsureTabDataSize(size_t nSize)
    1439                 :            : {
    1440         [ +  + ]:        834 :     if (nSize >= maTabData.size())
    1441                 :            :     {
    1442                 :        249 :         size_t n = nSize - maTabData.size() + 1;
    1443         [ +  - ]:        249 :         maTabData.insert(maTabData.end(), n, NULL);
    1444                 :            :     }
    1445                 :        834 : }
    1446                 :            : 
    1447                 :        311 : void ScViewData::SetTabNo( SCTAB nNewTab )
    1448                 :            : {
    1449         [ -  + ]:        311 :     if (!ValidTab(nNewTab))
    1450                 :            :     {
    1451                 :            :         OSL_FAIL("falsche Tabellennummer");
    1452                 :        311 :         return;
    1453                 :            :     }
    1454                 :            : 
    1455                 :        311 :     nTabNo = nNewTab;
    1456                 :        311 :     CreateTabData(nTabNo);
    1457                 :        311 :     pThisTab = maTabData[nTabNo];
    1458                 :            : 
    1459                 :        311 :     CalcPPT();          //  for common column width correction
    1460                 :        311 :     RecalcPixPos();     //! nicht immer noetig!
    1461                 :            : }
    1462                 :            : 
    1463                 :          4 : void ScViewData::SetActivePart( ScSplitPos eNewActive )
    1464                 :            : {
    1465                 :          4 :     pThisTab->eWhichActive = eNewActive;
    1466                 :          4 : }
    1467                 :            : 
    1468                 :         28 : Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScHSplitPos eWhich ) const
    1469                 :            : {
    1470                 :            :     OSL_ENSURE( eWhich==SC_SPLIT_LEFT || eWhich==SC_SPLIT_RIGHT, "Falsche Position" );
    1471         [ +  - ]:         28 :     ScSplitPos ePos = ( eWhich == SC_SPLIT_LEFT ) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
    1472                 :         28 :     return GetScrPos( nWhereX, nWhereY, ePos );
    1473                 :            : }
    1474                 :            : 
    1475                 :        145 : Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich ) const
    1476                 :            : {
    1477                 :            :     OSL_ENSURE( eWhich==SC_SPLIT_TOP || eWhich==SC_SPLIT_BOTTOM, "Falsche Position" );
    1478         [ -  + ]:        145 :     ScSplitPos ePos = ( eWhich == SC_SPLIT_TOP ) ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
    1479                 :        145 :     return GetScrPos( nWhereX, nWhereY, ePos );
    1480                 :            : }
    1481                 :            : 
    1482                 :      15768 : Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
    1483                 :            :                                 sal_Bool bAllowNeg ) const
    1484                 :            : {
    1485                 :      15768 :     ScHSplitPos eWhichX = SC_SPLIT_LEFT;
    1486                 :      15768 :     ScVSplitPos eWhichY = SC_SPLIT_BOTTOM;
    1487   [ -  -  +  -  :      15768 :     switch( eWhich )
                      - ]
    1488                 :            :     {
    1489                 :            :         case SC_SPLIT_TOPLEFT:
    1490                 :          0 :             eWhichX = SC_SPLIT_LEFT;
    1491                 :          0 :             eWhichY = SC_SPLIT_TOP;
    1492                 :          0 :             break;
    1493                 :            :         case SC_SPLIT_TOPRIGHT:
    1494                 :          0 :             eWhichX = SC_SPLIT_RIGHT;
    1495                 :          0 :             eWhichY = SC_SPLIT_TOP;
    1496                 :          0 :             break;
    1497                 :            :         case SC_SPLIT_BOTTOMLEFT:
    1498                 :      15768 :             eWhichX = SC_SPLIT_LEFT;
    1499                 :      15768 :             eWhichY = SC_SPLIT_BOTTOM;
    1500                 :      15768 :             break;
    1501                 :            :         case SC_SPLIT_BOTTOMRIGHT:
    1502                 :          0 :             eWhichX = SC_SPLIT_RIGHT;
    1503                 :          0 :             eWhichY = SC_SPLIT_BOTTOM;
    1504                 :          0 :             break;
    1505                 :            :     }
    1506                 :            : 
    1507         [ +  - ]:      15768 :     if (pView)
    1508                 :            :     {
    1509                 :      15768 :         ((ScViewData*)this)->aScrSize.Width()  = pView->GetGridWidth(eWhichX);
    1510                 :      15768 :         ((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY);
    1511                 :            :     }
    1512                 :            : 
    1513                 :            :     sal_uInt16 nTSize;
    1514                 :            : 
    1515                 :      15768 :     SCCOL   nPosX = GetPosX(eWhichX);
    1516                 :            :     SCCOL   nX;
    1517                 :            : 
    1518                 :      15768 :     long nScrPosX=0;
    1519         [ +  - ]:      15768 :     if (nWhereX >= nPosX)
    1520 [ +  + ][ +  + ]:      44566 :         for (nX=nPosX; nX<nWhereX && (bAllowNeg || nScrPosX<=aScrSize.Width()); nX++)
         [ +  + ][ +  + ]
    1521                 :            :         {
    1522         [ -  + ]:      28798 :             if ( nX > MAXCOL )
    1523                 :          0 :                 nScrPosX = 65535;
    1524                 :            :             else
    1525                 :            :             {
    1526                 :      28798 :                 nTSize = pDoc->GetColWidth( nX, nTabNo );
    1527         [ +  - ]:      28798 :                 if (nTSize)
    1528                 :            :                 {
    1529                 :      28798 :                     long nSizeXPix = ToPixel( nTSize, nPPTX );
    1530                 :      28798 :                     nScrPosX += nSizeXPix;
    1531                 :            :                 }
    1532                 :            :             }
    1533                 :            :         }
    1534         [ #  # ]:          0 :     else if (bAllowNeg)
    1535         [ #  # ]:          0 :         for (nX=nPosX; nX>nWhereX;)
    1536                 :            :         {
    1537                 :          0 :             --nX;
    1538                 :          0 :             nTSize = pDoc->GetColWidth( nX, nTabNo );
    1539         [ #  # ]:          0 :             if (nTSize)
    1540                 :            :             {
    1541                 :          0 :                 long nSizeXPix = ToPixel( nTSize, nPPTX );
    1542                 :          0 :                 nScrPosX -= nSizeXPix;
    1543                 :            :             }
    1544                 :            :         }
    1545                 :            : 
    1546                 :      15768 :     SCROW   nPosY = GetPosY(eWhichY);
    1547                 :            :     SCROW   nY;
    1548                 :            : 
    1549                 :      15768 :     long nScrPosY=0;
    1550         [ +  + ]:      15768 :     if (nWhereY >= nPosY)
    1551 [ +  + ][ +  + ]:      50132 :         for (nY=nPosY; nY<nWhereY && (bAllowNeg || nScrPosY<=aScrSize.Height()); nY++)
         [ +  + ][ +  + ]
    1552                 :            :         {
    1553         [ -  + ]:      34368 :             if ( nY > MAXROW )
    1554                 :          0 :                 nScrPosY = 65535;
    1555                 :            :             else
    1556                 :            :             {
    1557                 :      34368 :                 nTSize = pDoc->GetRowHeight( nY, nTabNo );
    1558         [ +  + ]:      34368 :                 if (nTSize)
    1559                 :            :                 {
    1560                 :      34239 :                     long nSizeYPix = ToPixel( nTSize, nPPTY );
    1561                 :      34239 :                     nScrPosY += nSizeYPix;
    1562                 :            :                 }
    1563         [ +  - ]:        129 :                 else if ( nY < MAXROW )
    1564                 :            :                 {
    1565                 :            :                     // skip multiple hidden rows (forward only for now)
    1566                 :        129 :                     SCROW nNext = pDoc->FirstVisibleRow(nY + 1, MAXROW, nTabNo);
    1567         [ -  + ]:        129 :                     if ( nNext > MAXROW )
    1568                 :          0 :                         nY = MAXROW;
    1569                 :            :                     else
    1570                 :        129 :                         nY = nNext - 1;     // +=nDir advances to next visible row
    1571                 :            :                 }
    1572                 :            :             }
    1573                 :            :         }
    1574         [ -  + ]:          4 :     else if (bAllowNeg)
    1575         [ #  # ]:          0 :         for (nY=nPosY; nY>nWhereY;)
    1576                 :            :         {
    1577                 :          0 :             --nY;
    1578                 :          0 :             nTSize = pDoc->GetRowHeight( nY, nTabNo );
    1579         [ #  # ]:          0 :             if (nTSize)
    1580                 :            :             {
    1581                 :          0 :                 long nSizeYPix = ToPixel( nTSize, nPPTY );
    1582                 :          0 :                 nScrPosY -= nSizeYPix;
    1583                 :            :             }
    1584                 :            :         }
    1585                 :            : 
    1586         [ +  + ]:      15768 :     if ( pDoc->IsLayoutRTL( nTabNo ) )
    1587                 :            :     {
    1588                 :            :         //  mirror horizontal position
    1589                 :         20 :         nScrPosX = aScrSize.Width() - 1 - nScrPosX;
    1590                 :            :     }
    1591                 :            : 
    1592         [ -  + ]:      15768 :     if (nScrPosX > 32767) nScrPosX=32767;
    1593         [ -  + ]:      15768 :     if (nScrPosY > 32767) nScrPosY=32767;
    1594                 :      15768 :     return Point( nScrPosX, nScrPosY );
    1595                 :            : }
    1596                 :            : 
    1597                 :            : //
    1598                 :            : //      Number of cells on a screen
    1599                 :            : //
    1600                 :            : 
    1601                 :      11479 : SCCOL ScViewData::CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeX ) const
    1602                 :            : {
    1603                 :            :     OSL_ENSURE( nDir==1 || nDir==-1, "falscher CellsAt Aufruf" );
    1604                 :            : 
    1605         [ +  - ]:      11479 :     if (pView)
    1606                 :      11479 :         ((ScViewData*)this)->aScrSize.Width()  = pView->GetGridWidth(eWhichX);
    1607                 :            : 
    1608                 :            :     SCsCOL  nX;
    1609                 :      11479 :     sal_uInt16  nScrPosX = 0;
    1610         [ +  - ]:      11479 :     if (nScrSizeX == SC_SIZE_NONE) nScrSizeX = (sal_uInt16) aScrSize.Width();
    1611                 :            : 
    1612         [ +  - ]:      11479 :     if (nDir==1)
    1613                 :      11479 :         nX = nPosX;             // vorwaerts
    1614                 :            :     else
    1615                 :          0 :         nX = nPosX-1;           // rueckwaerts
    1616                 :            : 
    1617                 :      11479 :     sal_Bool bOut = false;
    1618 [ +  + ][ +  - ]:     112881 :     for ( ; nScrPosX<=nScrSizeX && !bOut; nX = sal::static_int_cast<SCsCOL>(nX + nDir) )
                 [ +  + ]
    1619                 :            :     {
    1620                 :     101402 :         SCsCOL  nColNo = nX;
    1621 [ +  - ][ -  + ]:     101402 :         if ( nColNo < 0 || nColNo > MAXCOL )
    1622                 :          0 :             bOut = sal_True;
    1623                 :            :         else
    1624                 :            :         {
    1625                 :     101402 :             sal_uInt16 nTSize = pDoc->GetColWidth( nColNo, nTabNo );
    1626         [ +  - ]:     101402 :             if (nTSize)
    1627                 :            :             {
    1628                 :     101402 :                 long nSizeXPix = ToPixel( nTSize, nPPTX );
    1629                 :     101402 :                 nScrPosX = sal::static_int_cast<sal_uInt16>( nScrPosX + (sal_uInt16) nSizeXPix );
    1630                 :            :             }
    1631                 :            :         }
    1632                 :            :     }
    1633                 :            : 
    1634         [ +  - ]:      11479 :     if (nDir==1)
    1635                 :      11479 :         nX = sal::static_int_cast<SCsCOL>( nX - nPosX );
    1636                 :            :     else
    1637                 :          0 :         nX = (nPosX-1)-nX;
    1638                 :            : 
    1639         [ +  - ]:      11479 :     if (nX>0) --nX;
    1640                 :      11479 :     return nX;
    1641                 :            : }
    1642                 :            : 
    1643                 :      15759 : SCROW ScViewData::CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_uInt16 nScrSizeY ) const
    1644                 :            : {
    1645                 :            :     OSL_ENSURE( nDir==1 || nDir==-1, "falscher CellsAt Aufruf" );
    1646                 :            : 
    1647         [ +  - ]:      15759 :     if (pView)
    1648         [ +  - ]:      15759 :         ((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY);
    1649                 :            : 
    1650         [ +  - ]:      15759 :     if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (sal_uInt16) aScrSize.Height();
    1651                 :            : 
    1652                 :            :     SCROW nY;
    1653                 :            : 
    1654         [ +  - ]:      15759 :     if (nDir==1)
    1655                 :            :     {
    1656                 :            :         // forward
    1657                 :      15759 :         nY = nPosY;
    1658                 :      15759 :         long nScrPosY = 0;
    1659         [ +  - ]:      15759 :         AddPixelsWhile( nScrPosY, nScrSizeY, nY, MAXROW, nPPTY, pDoc, nTabNo);
    1660                 :            :         // Original loop ended on last evaluated +1 or if that was MAXROW even
    1661                 :            :         // on MAXROW+2.
    1662         [ -  + ]:      15759 :         nY += (nY == MAXROW ? 2 : 1);
    1663                 :      15759 :         nY -= nPosY;
    1664                 :            :     }
    1665                 :            :     else
    1666                 :            :     {
    1667                 :            :         // backward
    1668                 :          0 :         nY = nPosY-1;
    1669                 :          0 :         long nScrPosY = 0;
    1670         [ #  # ]:          0 :         AddPixelsWhileBackward( nScrPosY, nScrSizeY, nY, 0, nPPTY, pDoc, nTabNo);
    1671                 :            :         // Original loop ended on last evaluated -1 or if that was 0 even on
    1672                 :            :         // -2.
    1673         [ #  # ]:          0 :         nY -= (nY == 0 ? 2 : 1);
    1674                 :          0 :         nY = (nPosY-1)-nY;
    1675                 :            :     }
    1676                 :            : 
    1677         [ +  - ]:      15759 :     if (nY>0) --nY;
    1678                 :      15759 :     return nY;
    1679                 :            : }
    1680                 :            : 
    1681                 :      11479 : SCCOL ScViewData::VisibleCellsX( ScHSplitPos eWhichX ) const
    1682                 :            : {
    1683                 :      11479 :     return CellsAtX( GetPosX( eWhichX ), 1, eWhichX, SC_SIZE_NONE );
    1684                 :            : }
    1685                 :            : 
    1686                 :      11481 : SCROW ScViewData::VisibleCellsY( ScVSplitPos eWhichY ) const
    1687                 :            : {
    1688                 :      11481 :     return CellsAtY( GetPosY( eWhichY ), 1, eWhichY, SC_SIZE_NONE );
    1689                 :            : }
    1690                 :            : 
    1691                 :          0 : SCCOL ScViewData::PrevCellsX( ScHSplitPos eWhichX ) const
    1692                 :            : {
    1693                 :          0 :     return CellsAtX( GetPosX( eWhichX ), -1, eWhichX, SC_SIZE_NONE );
    1694                 :            : }
    1695                 :            : 
    1696                 :          0 : SCROW ScViewData::PrevCellsY( ScVSplitPos eWhichY ) const
    1697                 :            : {
    1698                 :          0 :     return CellsAtY( GetPosY( eWhichY ), -1, eWhichY, SC_SIZE_NONE );
    1699                 :            : }
    1700                 :            : 
    1701                 :            : 
    1702                 :       3448 : sal_Bool ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix )
    1703                 :            : {
    1704                 :       3448 :     const ScMergeAttr* pMerge = (const ScMergeAttr*) pDoc->GetAttr( nX,nY,nTabNo, ATTR_MERGE );
    1705 [ -  + ][ +  + ]:       3448 :     if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 )
                 [ +  + ]
    1706                 :            :     {
    1707                 :          4 :         long nOutWidth = 0;
    1708                 :          4 :         long nOutHeight = 0;
    1709                 :          4 :         SCCOL nCountX = pMerge->GetColMerge();
    1710         [ +  + ]:         20 :         for (SCCOL i=0; i<nCountX; i++)
    1711                 :         16 :             nOutWidth += ToPixel( pDoc->GetColWidth(nX+i,nTabNo), nPPTX );
    1712                 :          4 :         SCROW nCountY = pMerge->GetRowMerge();
    1713                 :            : 
    1714         [ +  + ]:         22 :         for (SCROW nRow = nY; nRow <= nY+nCountY-1; ++nRow)
    1715                 :            :         {
    1716                 :         18 :             SCROW nLastRow = nRow;
    1717 [ +  - ][ -  + ]:         18 :             if (pDoc->RowHidden(nRow, nTabNo, NULL, &nLastRow))
    1718                 :            :             {
    1719                 :          0 :                 nRow = nLastRow;
    1720                 :          0 :                 continue;
    1721                 :            :             }
    1722                 :            : 
    1723         [ +  - ]:         18 :             sal_uInt16 nHeight = pDoc->GetRowHeight(nRow, nTabNo);
    1724                 :         18 :             nOutHeight += ToPixel(nHeight, nPPTY);
    1725                 :            :         }
    1726                 :            : 
    1727                 :          4 :         rSizeXPix = nOutWidth;
    1728                 :          4 :         rSizeYPix = nOutHeight;
    1729                 :          4 :         return sal_True;
    1730                 :            :     }
    1731                 :            :     else
    1732                 :            :     {
    1733                 :       3444 :         rSizeXPix = ToPixel( pDoc->GetColWidth( nX, nTabNo ), nPPTX );
    1734                 :       3444 :         rSizeYPix = ToPixel( pDoc->GetRowHeight( nY, nTabNo ), nPPTY );
    1735                 :       3448 :         return false;
    1736                 :            :     }
    1737                 :            : }
    1738                 :            : 
    1739                 :         10 : sal_Bool ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
    1740                 :            :                                         SCsCOL& rPosX, SCsROW& rPosY,
    1741                 :            :                                         sal_Bool bTestMerge, sal_Bool bRepair, sal_Bool bNextIfLarge )
    1742                 :            : {
    1743                 :            :     //  special handling of 0 is now in ScViewFunctionSet::SetCursorAtPoint
    1744                 :            : 
    1745                 :         10 :     ScHSplitPos eHWhich = WhichH(eWhich);
    1746                 :         10 :     ScVSplitPos eVWhich = WhichV(eWhich);
    1747                 :            : 
    1748 [ -  + ][ +  - ]:         10 :     if ( pDoc->IsLayoutRTL( nTabNo ) )
    1749                 :            :     {
    1750                 :            :         //  mirror horizontal position
    1751         [ #  # ]:          0 :         if (pView)
    1752         [ #  # ]:          0 :             aScrSize.Width() = pView->GetGridWidth(eHWhich);
    1753                 :          0 :         nClickX = aScrSize.Width() - 1 - nClickX;
    1754                 :            :     }
    1755                 :            : 
    1756                 :         10 :     SCsCOL nStartPosX = GetPosX(eHWhich);
    1757                 :         10 :     SCsROW nStartPosY = GetPosY(eVWhich);
    1758                 :         10 :     rPosX = nStartPosX;
    1759                 :         10 :     rPosY = nStartPosY;
    1760                 :         10 :     long nScrX = 0;
    1761                 :         10 :     long nScrY = 0;
    1762                 :            : 
    1763         [ +  - ]:         10 :     if (nClickX > 0)
    1764                 :            :     {
    1765 [ +  - ][ +  + ]:         65 :         while ( rPosX<=MAXCOL && nClickX >= nScrX )
                 [ +  + ]
    1766                 :            :         {
    1767         [ +  - ]:         55 :             nScrX += ToPixel( pDoc->GetColWidth( rPosX, nTabNo ), nPPTX );
    1768                 :         55 :             ++rPosX;
    1769                 :            :         }
    1770                 :         10 :         --rPosX;
    1771                 :            :     }
    1772                 :            :     else
    1773                 :            :     {
    1774 [ #  # ][ #  # ]:          0 :         while ( rPosX>0 && nClickX < nScrX )
                 [ #  # ]
    1775                 :            :         {
    1776                 :          0 :             --rPosX;
    1777         [ #  # ]:          0 :             nScrX -= ToPixel( pDoc->GetColWidth( rPosX, nTabNo ), nPPTX );
    1778                 :            :         }
    1779                 :            :     }
    1780                 :            : 
    1781         [ +  - ]:         10 :     if (nClickY > 0)
    1782         [ +  - ]:         10 :         AddPixelsWhile( nScrY, nClickY, rPosY, MAXROW, nPPTY, pDoc, nTabNo );
    1783                 :            :     else
    1784                 :            :     {
    1785                 :            :         /* TODO: could need some "SubPixelsWhileBackward" method */
    1786 [ #  # ][ #  # ]:          0 :         while ( rPosY>0 && nClickY < nScrY )
                 [ #  # ]
    1787                 :            :         {
    1788                 :          0 :             --rPosY;
    1789         [ #  # ]:          0 :             nScrY -= ToPixel( pDoc->GetRowHeight( rPosY, nTabNo ), nPPTY );
    1790                 :            :         }
    1791                 :            :     }
    1792                 :            : 
    1793         [ +  - ]:         10 :     if (bNextIfLarge)       //  zu grosse Zellen ?
    1794                 :            :     {
    1795 [ +  + ][ +  - ]:         10 :         if ( rPosX == nStartPosX && nClickX > 0 )
    1796                 :            :         {
    1797         [ +  - ]:          5 :             if (pView)
    1798         [ +  - ]:          5 :                 aScrSize.Width() = pView->GetGridWidth(eHWhich);
    1799         [ -  + ]:          5 :             if ( nClickX > aScrSize.Width() )
    1800                 :          0 :                 ++rPosX;
    1801                 :            :         }
    1802 [ +  + ][ +  - ]:         10 :         if ( rPosY == nStartPosY && nClickY > 0 )
    1803                 :            :         {
    1804         [ +  - ]:          5 :             if (pView)
    1805         [ +  - ]:          5 :                 aScrSize.Height() = pView->GetGridHeight(eVWhich);
    1806         [ -  + ]:          5 :             if ( nClickY > aScrSize.Height() )
    1807                 :          0 :                 ++rPosY;
    1808                 :            :         }
    1809                 :            :     }
    1810                 :            : 
    1811         [ -  + ]:         10 :     if (rPosX<0) rPosX=0;
    1812         [ -  + ]:         10 :     if (rPosX>MAXCOL) rPosX=MAXCOL;
    1813         [ -  + ]:         10 :     if (rPosY<0) rPosY=0;
    1814         [ -  + ]:         10 :     if (rPosY>MAXROW) rPosY=MAXROW;
    1815                 :            : 
    1816         [ +  - ]:         10 :     if (bTestMerge)
    1817                 :            :     {
    1818                 :            :         //! public Methode um Position anzupassen
    1819                 :            : 
    1820                 :         10 :         SCCOL nOrigX = rPosX;
    1821                 :         10 :         SCROW nOrigY = rPosY;
    1822         [ +  - ]:         10 :         pDoc->SkipOverlapped(rPosX, rPosY, nTabNo);
    1823                 :         10 :         bool bHOver = (nOrigX != rPosX);
    1824                 :         10 :         bool bVOver = (nOrigY != rPosY);
    1825                 :            : 
    1826 [ -  + ][ #  # ]:         10 :         if ( bRepair && ( bHOver || bVOver ) )
                 [ #  # ]
    1827                 :            :         {
    1828                 :            :             const ScMergeAttr* pMerge = (const ScMergeAttr*)
    1829         [ #  # ]:          0 :                                 pDoc->GetAttr( rPosX, rPosY, nTabNo, ATTR_MERGE );
    1830 [ #  # ][ #  # ]:          0 :             if ( ( bHOver && pMerge->GetColMerge() <= 1 ) ||
           [ #  #  #  # ]
                 [ #  # ]
    1831                 :          0 :                  ( bVOver && pMerge->GetRowMerge() <= 1 ) )
    1832                 :            :             {
    1833                 :            :                 OSL_FAIL("Merge-Fehler gefunden");
    1834                 :            : 
    1835         [ #  # ]:          0 :                 pDoc->RemoveFlagsTab( 0,0, MAXCOL,MAXROW, nTabNo, SC_MF_HOR | SC_MF_VER );
    1836                 :          0 :                 SCCOL nEndCol = MAXCOL;
    1837                 :          0 :                 SCROW nEndRow = MAXROW;
    1838         [ #  # ]:          0 :                 pDoc->ExtendMerge( 0,0, nEndCol,nEndRow, nTabNo, sal_True );
    1839         [ #  # ]:          0 :                 if (pDocShell)
    1840 [ #  # ][ #  # ]:          0 :                     pDocShell->PostPaint( ScRange(0,0,nTabNo,MAXCOL,MAXROW,nTabNo), PAINT_GRID );
                 [ #  # ]
    1841                 :            :             }
    1842                 :            :         }
    1843                 :            :     }
    1844                 :            : 
    1845                 :         10 :     return false;
    1846                 :            : }
    1847                 :            : 
    1848                 :          0 : void ScViewData::GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
    1849                 :            :                                         SCsCOL nPosX, SCsROW nPosY, sal_Bool& rLeft, sal_Bool& rTop )
    1850                 :            : {
    1851         [ #  # ]:          0 :     sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTabNo );
    1852         [ #  # ]:          0 :     long nLayoutSign = bLayoutRTL ? -1 : 1;
    1853                 :            : 
    1854         [ #  # ]:          0 :     Point aCellStart = GetScrPos( nPosX, nPosY, eWhich, sal_True );
    1855                 :            :     long nSizeX;
    1856                 :            :     long nSizeY;
    1857         [ #  # ]:          0 :     GetMergeSizePixel( nPosX, nPosY, nSizeX, nSizeY );
    1858                 :          0 :     rLeft = ( rClickPos.X() - aCellStart.X() ) * nLayoutSign <= nSizeX / 2;
    1859                 :          0 :     rTop  = rClickPos.Y() - aCellStart.Y() <= nSizeY / 2;
    1860                 :          0 : }
    1861                 :            : 
    1862                 :          4 : void ScViewData::SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX )
    1863                 :            : {
    1864         [ -  + ]:          4 :     if (nNewPosX != 0)
    1865                 :            :     {
    1866                 :          0 :         SCCOL nOldPosX = pThisTab->nPosX[eWhich];
    1867                 :          0 :         long nTPosX = pThisTab->nTPosX[eWhich];
    1868                 :          0 :         long nPixPosX = pThisTab->nPixPosX[eWhich];
    1869                 :            :         SCCOL i;
    1870         [ #  # ]:          0 :         if ( nNewPosX > nOldPosX )
    1871         [ #  # ]:          0 :             for ( i=nOldPosX; i<nNewPosX; i++ )
    1872                 :            :             {
    1873                 :          0 :                 long nThis = pDoc->GetColWidth( i,nTabNo );
    1874                 :          0 :                 nTPosX -= nThis;
    1875                 :          0 :                 nPixPosX -= ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTX);
    1876                 :            :             }
    1877                 :            :         else
    1878         [ #  # ]:          0 :             for ( i=nNewPosX; i<nOldPosX; i++ )
    1879                 :            :             {
    1880                 :          0 :                 long nThis = pDoc->GetColWidth( i,nTabNo );
    1881                 :          0 :                 nTPosX += nThis;
    1882                 :          0 :                 nPixPosX += ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTX);
    1883                 :            :             }
    1884                 :            : 
    1885                 :          0 :         pThisTab->nPosX[eWhich] = nNewPosX;
    1886                 :          0 :         pThisTab->nTPosX[eWhich] = nTPosX;
    1887                 :          0 :         pThisTab->nMPosX[eWhich] = (long) (nTPosX * HMM_PER_TWIPS);
    1888                 :          0 :         pThisTab->nPixPosX[eWhich] = nPixPosX;
    1889                 :            :     }
    1890                 :            :     else
    1891                 :          4 :         pThisTab->nPixPosX[eWhich] =
    1892                 :          8 :         pThisTab->nTPosX[eWhich] =
    1893                 :          8 :         pThisTab->nMPosX[eWhich] =
    1894                 :          4 :         pThisTab->nPosX[eWhich] = 0;
    1895                 :          4 : }
    1896                 :            : 
    1897                 :          4 : void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY )
    1898                 :            : {
    1899         [ -  + ]:          4 :     if (nNewPosY != 0)
    1900                 :            :     {
    1901                 :          0 :         SCROW nOldPosY = pThisTab->nPosY[eWhich];
    1902                 :          0 :         long nTPosY = pThisTab->nTPosY[eWhich];
    1903                 :          0 :         long nPixPosY = pThisTab->nPixPosY[eWhich];
    1904                 :            :         SCROW i, nHeightEndRow;
    1905         [ #  # ]:          0 :         if ( nNewPosY > nOldPosY )
    1906         [ #  # ]:          0 :             for ( i=nOldPosY; i<nNewPosY; i++ )
    1907                 :            :             {
    1908         [ #  # ]:          0 :                 long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
    1909         [ #  # ]:          0 :                 SCROW nRows = std::min( nNewPosY, nHeightEndRow + 1) - i;
    1910                 :          0 :                 i = nHeightEndRow;
    1911                 :          0 :                 nTPosY -= nThis * nRows;
    1912                 :          0 :                 nPixPosY -= ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTY) * nRows;
    1913                 :            :             }
    1914                 :            :         else
    1915         [ #  # ]:          0 :             for ( i=nNewPosY; i<nOldPosY; i++ )
    1916                 :            :             {
    1917         [ #  # ]:          0 :                 long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
    1918         [ #  # ]:          0 :                 SCROW nRows = std::min( nOldPosY, nHeightEndRow + 1) - i;
    1919                 :          0 :                 i = nHeightEndRow;
    1920                 :          0 :                 nTPosY += nThis * nRows;
    1921                 :          0 :                 nPixPosY += ToPixel(sal::static_int_cast<sal_uInt16>(nThis), nPPTY) * nRows;
    1922                 :            :             }
    1923                 :            : 
    1924                 :          0 :         pThisTab->nPosY[eWhich] = nNewPosY;
    1925                 :          0 :         pThisTab->nTPosY[eWhich] = nTPosY;
    1926                 :          0 :         pThisTab->nMPosY[eWhich] = (long) (nTPosY * HMM_PER_TWIPS);
    1927                 :          0 :         pThisTab->nPixPosY[eWhich] = nPixPosY;
    1928                 :            :     }
    1929                 :            :     else
    1930                 :          4 :         pThisTab->nPixPosY[eWhich] =
    1931                 :          8 :         pThisTab->nTPosY[eWhich] =
    1932                 :          8 :         pThisTab->nMPosY[eWhich] =
    1933                 :          4 :         pThisTab->nPosY[eWhich] = 0;
    1934                 :          4 : }
    1935                 :            : 
    1936                 :       1078 : void ScViewData::RecalcPixPos()             // nach Zoom-Aenderungen
    1937                 :            : {
    1938         [ +  + ]:       3234 :     for (sal_uInt16 eWhich=0; eWhich<2; eWhich++)
    1939                 :            :     {
    1940                 :       2156 :         long nPixPosX = 0;
    1941                 :       2156 :         SCCOL nPosX = pThisTab->nPosX[eWhich];
    1942         [ -  + ]:       2156 :         for (SCCOL i=0; i<nPosX; i++)
    1943                 :          0 :             nPixPosX -= ToPixel(pDoc->GetColWidth(i,nTabNo), nPPTX);
    1944                 :       2156 :         pThisTab->nPixPosX[eWhich] = nPixPosX;
    1945                 :            : 
    1946                 :       2156 :         long nPixPosY = 0;
    1947                 :       2156 :         SCROW nPosY = pThisTab->nPosY[eWhich];
    1948         [ +  + ]:       2492 :         for (SCROW j=0; j<nPosY; j++)
    1949                 :        336 :             nPixPosY -= ToPixel(pDoc->GetRowHeight(j,nTabNo), nPPTY);
    1950                 :       2156 :         pThisTab->nPixPosY[eWhich] = nPixPosY;
    1951                 :            :     }
    1952                 :       1078 : }
    1953                 :            : 
    1954                 :       1577 : const MapMode& ScViewData::GetLogicMode( ScSplitPos eWhich )
    1955                 :            : {
    1956                 :       1577 :     aLogicMode.SetOrigin( Point( pThisTab->nMPosX[WhichH(eWhich)],
    1957         [ +  - ]:       3154 :                                     pThisTab->nMPosY[WhichV(eWhich)] ) );
    1958                 :       1577 :     return aLogicMode;
    1959                 :            : }
    1960                 :            : 
    1961                 :      12936 : const MapMode& ScViewData::GetLogicMode()
    1962                 :            : {
    1963         [ +  - ]:      12936 :     aLogicMode.SetOrigin( Point() );
    1964                 :      12936 :     return aLogicMode;
    1965                 :            : }
    1966                 :            : 
    1967                 :          0 : void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
    1968                 :            : {
    1969                 :            :     SCCOL nCol;
    1970                 :            :     SCROW nRow;
    1971                 :            :     sal_uInt16 nTSize;
    1972                 :            :     long nSizePix;
    1973                 :          0 :     long nScrPosX = 0;
    1974                 :          0 :     long nScrPosY = 0;
    1975                 :            : 
    1976                 :          0 :     SetActivePart( SC_SPLIT_BOTTOMLEFT );
    1977                 :          0 :     SetPosX( SC_SPLIT_LEFT, nCol1 );
    1978                 :          0 :     SetPosY( SC_SPLIT_BOTTOM, nRow1 );
    1979                 :            : 
    1980         [ #  # ]:          0 :     for (nCol=nCol1; nCol<=nCol2; nCol++)
    1981                 :            :     {
    1982                 :          0 :         nTSize = pDoc->GetColWidth( nCol, nTabNo );
    1983         [ #  # ]:          0 :         if (nTSize)
    1984                 :            :         {
    1985                 :          0 :             nSizePix = ToPixel( nTSize, nPPTX );
    1986                 :          0 :             nScrPosX += (sal_uInt16) nSizePix;
    1987                 :            :         }
    1988                 :            :     }
    1989                 :            : 
    1990         [ #  # ]:          0 :     for (nRow=nRow1; nRow<=nRow2; nRow++)
    1991                 :            :     {
    1992                 :          0 :         nTSize = pDoc->GetRowHeight( nRow, nTabNo );
    1993         [ #  # ]:          0 :         if (nTSize)
    1994                 :            :         {
    1995                 :          0 :             nSizePix = ToPixel( nTSize, nPPTY );
    1996                 :          0 :             nScrPosY += (sal_uInt16) nSizePix;
    1997                 :            :         }
    1998                 :            :     }
    1999                 :            : 
    2000                 :          0 :     aScrSize = Size( nScrPosX, nScrPosY );
    2001                 :          0 : }
    2002                 :            : 
    2003                 :          4 : void ScViewData::SetScreenPos( const Point& rVisAreaStart )
    2004                 :            : {
    2005                 :            :     long nSize;
    2006                 :            :     long nTwips;
    2007                 :            :     long nAdd;
    2008                 :            :     sal_Bool bEnd;
    2009                 :            : 
    2010                 :          4 :     nSize = 0;
    2011                 :          4 :     nTwips = (long) (rVisAreaStart.X() / HMM_PER_TWIPS);
    2012         [ -  + ]:          4 :     if ( pDoc->IsLayoutRTL( nTabNo ) )
    2013                 :          0 :         nTwips = -nTwips;
    2014                 :          4 :     SCCOL nX1 = 0;
    2015                 :          4 :     bEnd = false;
    2016         [ +  + ]:          8 :     while (!bEnd)
    2017                 :            :     {
    2018                 :          4 :         nAdd = (long) pDoc->GetColWidth(nX1,nTabNo);
    2019 [ #  # ][ -  + ]:          4 :         if (nSize+nAdd <= nTwips+1 && nX1<MAXCOL)
    2020                 :            :         {
    2021                 :          0 :             nSize += nAdd;
    2022                 :          0 :             ++nX1;
    2023                 :            :         }
    2024                 :            :         else
    2025                 :          4 :             bEnd = sal_True;
    2026                 :            :     }
    2027                 :            : 
    2028                 :          4 :     nSize = 0;
    2029                 :          4 :     nTwips = (long) (rVisAreaStart.Y() / HMM_PER_TWIPS);
    2030                 :          4 :     SCROW nY1 = 0;
    2031                 :          4 :     bEnd = false;
    2032         [ +  + ]:          8 :     while (!bEnd)
    2033                 :            :     {
    2034                 :          4 :         nAdd = (long) pDoc->GetRowHeight(nY1,nTabNo);
    2035 [ #  # ][ -  + ]:          4 :         if (nSize+nAdd <= nTwips+1 && nY1<MAXROW)
    2036                 :            :         {
    2037                 :          0 :             nSize += nAdd;
    2038                 :          0 :             ++nY1;
    2039                 :            :         }
    2040                 :            :         else
    2041                 :          4 :             bEnd = sal_True;
    2042                 :            :     }
    2043                 :            : 
    2044                 :          4 :     SetActivePart( SC_SPLIT_BOTTOMLEFT );
    2045                 :          4 :     SetPosX( SC_SPLIT_LEFT, nX1 );
    2046                 :          4 :     SetPosY( SC_SPLIT_BOTTOM, nY1 );
    2047                 :            : 
    2048                 :          4 :     SetCurX( nX1 );
    2049                 :          4 :     SetCurY( nY1 );
    2050                 :          4 : }
    2051                 :            : 
    2052                 :          4 : void ScViewData::SetScreen( const Rectangle& rVisArea )
    2053                 :            : {
    2054         [ +  - ]:          4 :     SetScreenPos( rVisArea.TopLeft() );
    2055                 :            : 
    2056                 :            :     //  hier ohne GetOutputFactor(), weil fuer Ausgabe in Metafile
    2057                 :            : 
    2058                 :          4 :     aScrSize = rVisArea.GetSize();
    2059                 :          4 :     aScrSize.Width() = (long)
    2060                 :          4 :         ( aScrSize.Width() * ScGlobal::nScreenPPTX / HMM_PER_TWIPS );
    2061                 :          4 :     aScrSize.Height() = (long)
    2062                 :          4 :         ( aScrSize.Height() * ScGlobal::nScreenPPTY / HMM_PER_TWIPS );
    2063                 :          4 : }
    2064                 :            : 
    2065                 :        771 : SfxObjectShell* ScViewData::GetSfxDocShell() const
    2066                 :            : {
    2067                 :        771 :     return pDocShell;
    2068                 :            : }
    2069                 :            : 
    2070                 :          0 : ScDocFunc& ScViewData::GetDocFunc() const
    2071                 :            : {
    2072                 :          0 :     return pDocShell->GetDocFunc();
    2073                 :            : }
    2074                 :            : 
    2075                 :       3181 : SfxBindings& ScViewData::GetBindings()
    2076                 :            : {
    2077                 :            :     OSL_ENSURE( pViewShell, "GetBindings() without ViewShell" );
    2078                 :       3181 :     return pViewShell->GetViewFrame()->GetBindings();
    2079                 :            : }
    2080                 :            : 
    2081                 :        520 : SfxDispatcher& ScViewData::GetDispatcher()
    2082                 :            : {
    2083                 :            :     OSL_ENSURE( pViewShell, "GetDispatcher() without ViewShell" );
    2084                 :        520 :     return *pViewShell->GetViewFrame()->GetDispatcher();
    2085                 :            : }
    2086                 :            : 
    2087                 :      21297 : ScMarkData& ScViewData::GetMarkData()
    2088                 :            : {
    2089                 :      21297 :     return *mpMarkData;
    2090                 :            : }
    2091                 :            : 
    2092                 :         21 : const ScMarkData& ScViewData::GetMarkData() const
    2093                 :            : {
    2094                 :         21 :     return *mpMarkData;
    2095                 :            : }
    2096                 :            : 
    2097                 :          0 : Window* ScViewData::GetDialogParent()
    2098                 :            : {
    2099                 :            :     OSL_ENSURE( pViewShell, "GetDialogParent() ohne ViewShell" );
    2100                 :          0 :     return pViewShell->GetDialogParent();
    2101                 :            : }
    2102                 :            : 
    2103                 :        386 : Window* ScViewData::GetActiveWin()
    2104                 :            : {
    2105                 :            :     OSL_ENSURE( pView, "GetActiveWin() ohne View" );
    2106                 :        386 :     return pView->GetActiveWin();
    2107                 :            : }
    2108                 :            : 
    2109                 :        463 : ScDrawView* ScViewData::GetScDrawView()
    2110                 :            : {
    2111                 :            :     OSL_ENSURE( pView, "GetScDrawView() ohne View" );
    2112                 :        463 :     return pView->GetScDrawView();
    2113                 :            : }
    2114                 :            : 
    2115                 :       1278 : sal_Bool ScViewData::IsMinimized()
    2116                 :            : {
    2117                 :            :     OSL_ENSURE( pView, "IsMinimized() ohne View" );
    2118                 :       1278 :     return pView->IsMinimized();
    2119                 :            : }
    2120                 :            : 
    2121                 :          0 : void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY )
    2122                 :            : {
    2123         [ #  # ]:          0 :     Fraction aOldX = GetZoomX();
    2124         [ #  # ]:          0 :     Fraction aOldY = GetZoomY();
    2125                 :            : 
    2126         [ #  # ]:          0 :     SetZoom( rNewX, rNewY, false );
    2127                 :            : 
    2128         [ #  # ]:          0 :     Fraction aWidth = GetZoomX();
    2129 [ #  # ][ #  # ]:          0 :     aWidth *= Fraction( aScrSize.Width(),1 );
    2130         [ #  # ]:          0 :     aWidth /= aOldX;
    2131                 :            : 
    2132         [ #  # ]:          0 :     Fraction aHeight = GetZoomY();
    2133 [ #  # ][ #  # ]:          0 :     aHeight *= Fraction( aScrSize.Height(),1 );
    2134         [ #  # ]:          0 :     aHeight /= aOldY;
    2135                 :            : 
    2136         [ #  # ]:          0 :     aScrSize.Width()  = (long) aWidth;
    2137         [ #  # ]:          0 :     aScrSize.Height() = (long) aHeight;
    2138                 :          0 : }
    2139                 :            : 
    2140                 :       1309 : void ScViewData::CalcPPT()
    2141                 :            : {
    2142                 :       1309 :     nPPTX = ScGlobal::nScreenPPTX * (double) GetZoomX();
    2143         [ +  - ]:       1309 :     if (pDocShell)
    2144                 :       1309 :         nPPTX = nPPTX / pDocShell->GetOutputFactor();   // Faktor ist Drucker zu Bildschirm
    2145                 :       1309 :     nPPTY = ScGlobal::nScreenPPTY * (double) GetZoomY();
    2146                 :            : 
    2147                 :            :     //  if detective objects are present,
    2148                 :            :     //  try to adjust horizontal scale so the most common column width has minimal rounding errors,
    2149                 :            :     //  to avoid differences between cell and drawing layer output
    2150                 :            : 
    2151 [ -  + ][ -  + ]:       1309 :     if ( pDoc && pDoc->HasDetectiveObjects(nTabNo) )
                 [ +  - ]
    2152                 :            :     {
    2153                 :          0 :         SCCOL nEndCol = 0;
    2154                 :          0 :         SCROW nDummy = 0;
    2155         [ #  # ]:          0 :         pDoc->GetTableArea( nTabNo, nEndCol, nDummy );
    2156         [ #  # ]:          0 :         if (nEndCol<20)
    2157                 :          0 :             nEndCol = 20;           // same end position as when determining draw scale
    2158                 :            : 
    2159         [ #  # ]:          0 :         sal_uInt16 nTwips = pDoc->GetCommonWidth( nEndCol, nTabNo );
    2160         [ #  # ]:          0 :         if ( nTwips )
    2161                 :            :         {
    2162                 :          0 :             double fOriginal = nTwips * nPPTX;
    2163         [ #  # ]:          0 :             if ( fOriginal < static_cast<double>(nEndCol) )
    2164                 :            :             {
    2165                 :            :                 //  if one column is smaller than the column count,
    2166                 :            :                 //  rounding errors are likely to add up to a whole column.
    2167                 :            : 
    2168                 :          0 :                 double fRounded = ::rtl::math::approxFloor( fOriginal + 0.5 );
    2169         [ #  # ]:          0 :                 if ( fRounded > 0.0 )
    2170                 :            :                 {
    2171                 :          0 :                     double fScale = fRounded / fOriginal + 1E-6;
    2172 [ #  # ][ #  # ]:          0 :                     if ( fScale >= 0.9 && fScale <= 1.1 )
    2173                 :          0 :                         nPPTX *= fScale;
    2174                 :            :                 }
    2175                 :            :             }
    2176                 :            :         }
    2177                 :            :     }
    2178                 :       1309 : }
    2179                 :            : 
    2180                 :            : #define SC_OLD_TABSEP   '/'
    2181                 :            : #define SC_NEW_TABSEP   '+'
    2182                 :            : 
    2183                 :          2 : void ScViewData::WriteUserData(String& rData)
    2184                 :            : {
    2185                 :            :     //  nZoom (bis 364v) oder nZoom/nPageZoom/bPageMode (ab 364w)
    2186                 :            :     //  nTab
    2187                 :            :     //  Tab-ControlBreite
    2188                 :            :     //  pro Tabelle:
    2189                 :            :     //  CursorX/CursorY/HSplitMode/VSplitMode/HSplitPos/VSplitPos/SplitActive/
    2190                 :            :     //  PosX[links]/PosX[rechts]/PosY[oben]/PosY[unten]
    2191                 :            :     //  wenn Zeilen groesser 8192, "+" statt "/"
    2192                 :            : 
    2193                 :          2 :     sal_uInt16 nZoom = (sal_uInt16)((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator());
    2194         [ +  - ]:          2 :     rData = String::CreateFromInt32( nZoom );
    2195                 :          2 :     rData += '/';
    2196                 :          2 :     nZoom = (sal_uInt16)((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator());
    2197         [ +  - ]:          2 :     rData += String::CreateFromInt32( nZoom );
    2198                 :          2 :     rData += '/';
    2199         [ -  + ]:          2 :     if (bPagebreak)
    2200                 :          0 :         rData += '1';
    2201                 :            :     else
    2202                 :          2 :         rData += '0';
    2203                 :            : 
    2204                 :          2 :     rData += ';';
    2205         [ +  - ]:          2 :     rData += String::CreateFromInt32( nTabNo );
    2206                 :          2 :     rData += ';';
    2207                 :          2 :     rData.AppendAscii(RTL_CONSTASCII_STRINGPARAM( TAG_TABBARWIDTH ));
    2208         [ +  - ]:          2 :     rData += String::CreateFromInt32( pView->GetTabBarWidth() );
    2209                 :            : 
    2210                 :          2 :     SCTAB nTabCount = pDoc->GetTableCount();
    2211         [ +  + ]:          4 :     for (SCTAB i=0; i<nTabCount; i++)
    2212                 :            :     {
    2213                 :          2 :         rData += ';';                   // Numerierung darf auf keinen Fall durcheinanderkommen
    2214 [ +  - ][ +  - ]:          2 :         if (i < static_cast<SCTAB>(maTabData.size()) && maTabData[i])
                 [ +  - ]
    2215                 :            :         {
    2216                 :          2 :             sal_Unicode cTabSep = SC_OLD_TABSEP;                // wie 3.1
    2217   [ +  -  +  -  :          8 :             if ( maTabData[i]->nCurY > MAXROW_30 ||
          +  -  -  +  #  
              # ][ -  + ]
    2218                 :          4 :                  maTabData[i]->nPosY[0] > MAXROW_30 || maTabData[i]->nPosY[1] > MAXROW_30 ||
    2219                 :          2 :                  ( maTabData[i]->eVSplitMode == SC_SPLIT_FIX &&
    2220                 :          0 :                     maTabData[i]->nFixPosY > MAXROW_30 ) )
    2221                 :            :             {
    2222                 :          0 :                 cTabSep = SC_NEW_TABSEP;        // um eine 3.1-Version nicht umzubringen
    2223                 :            :             }
    2224                 :            : 
    2225                 :            : 
    2226         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->nCurX );
    2227                 :          2 :             rData += cTabSep;
    2228         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->nCurY );
    2229                 :          2 :             rData += cTabSep;
    2230         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->eHSplitMode );
    2231                 :          2 :             rData += cTabSep;
    2232         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->eVSplitMode );
    2233                 :          2 :             rData += cTabSep;
    2234         [ -  + ]:          2 :             if ( maTabData[i]->eHSplitMode == SC_SPLIT_FIX )
    2235         [ #  # ]:          0 :                 rData += String::CreateFromInt32( maTabData[i]->nFixPosX );
    2236                 :            :             else
    2237         [ +  - ]:          2 :                 rData += String::CreateFromInt32( maTabData[i]->nHSplitPos );
    2238                 :          2 :             rData += cTabSep;
    2239         [ -  + ]:          2 :             if ( maTabData[i]->eVSplitMode == SC_SPLIT_FIX )
    2240         [ #  # ]:          0 :                 rData += String::CreateFromInt32( maTabData[i]->nFixPosY );
    2241                 :            :             else
    2242         [ +  - ]:          2 :                 rData += String::CreateFromInt32( maTabData[i]->nVSplitPos );
    2243                 :          2 :             rData += cTabSep;
    2244         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->eWhichActive );
    2245                 :          2 :             rData += cTabSep;
    2246         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->nPosX[0] );
    2247                 :          2 :             rData += cTabSep;
    2248         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->nPosX[1] );
    2249                 :          2 :             rData += cTabSep;
    2250         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->nPosY[0] );
    2251                 :          2 :             rData += cTabSep;
    2252         [ +  - ]:          2 :             rData += String::CreateFromInt32( maTabData[i]->nPosY[1] );
    2253                 :            :         }
    2254                 :            :     }
    2255                 :          2 : }
    2256                 :            : 
    2257                 :          0 : void ScViewData::ReadUserData(const String& rData)
    2258                 :            : {
    2259         [ #  # ]:          0 :     if (!rData.Len())       // Leerer String kommt bei "neu Laden"
    2260                 :            :         return;             // dann auch ohne Assertion beenden
    2261                 :            : 
    2262 [ #  # ][ #  # ]:          0 :     xub_StrLen nCount = comphelper::string::getTokenCount(rData, ';');
    2263         [ #  # ]:          0 :     if ( nCount <= 2 )
    2264                 :            :     {
    2265                 :            :         //  beim Reload in der Seitenansicht sind evtl. die Preview-UserData
    2266                 :            :         //  stehengelassen worden. Den Zoom von der Preview will man hier nicht...
    2267                 :            :         OSL_FAIL("ReadUserData: das sind nicht meine Daten");
    2268                 :            :         return;
    2269                 :            :     }
    2270                 :            : 
    2271         [ #  # ]:          0 :     String aTabOpt;
    2272                 :          0 :     xub_StrLen nTagLen = RTL_CONSTASCII_LENGTH(TAG_TABBARWIDTH);
    2273                 :            : 
    2274                 :            :     // nicht pro Tabelle:
    2275                 :          0 :     SCTAB nTabStart = 2;
    2276                 :            : 
    2277                 :          0 :     Fraction aZoomX, aZoomY, aPageZoomX, aPageZoomY;    //! evaluate (all sheets?)
    2278                 :            : 
    2279         [ #  # ]:          0 :     String aZoomStr = rData.GetToken(0);                        // Zoom/PageZoom/Modus
    2280 [ #  # ][ #  # ]:          0 :     sal_uInt16 nNormZoom = sal::static_int_cast<sal_uInt16>(aZoomStr.GetToken(0,'/').ToInt32());
                 [ #  # ]
    2281 [ #  # ][ #  # ]:          0 :     if ( nNormZoom >= MINZOOM && nNormZoom <= MAXZOOM )
    2282 [ #  # ][ #  # ]:          0 :         aZoomX = aZoomY = Fraction( nNormZoom, 100 );           //  "normaler" Zoom (immer)
                 [ #  # ]
    2283 [ #  # ][ #  # ]:          0 :     sal_uInt16 nPageZoom = sal::static_int_cast<sal_uInt16>(aZoomStr.GetToken(1,'/').ToInt32());
                 [ #  # ]
    2284 [ #  # ][ #  # ]:          0 :     if ( nPageZoom >= MINZOOM && nPageZoom <= MAXZOOM )
    2285 [ #  # ][ #  # ]:          0 :         aPageZoomX = aPageZoomY = Fraction( nPageZoom, 100 );   // Pagebreak-Zoom, wenn gesetzt
                 [ #  # ]
    2286 [ #  # ][ #  # ]:          0 :     sal_Unicode cMode = aZoomStr.GetToken(2,'/').GetChar(0);    // 0 oder "0"/"1"
    2287         [ #  # ]:          0 :     SetPagebreakMode( cMode == '1' );
    2288                 :            :     // SetPagebreakMode muss immer gerufen werden wegen CalcPPT / RecalcPixPos()
    2289                 :            : 
    2290                 :            :     //
    2291                 :            :     //  Tabelle kann ungueltig geworden sein (z.B. letzte Version):
    2292                 :            :     //
    2293 [ #  # ][ #  # ]:          0 :     SCTAB nNewTab = static_cast<SCTAB>(rData.GetToken(1).ToInt32());
                 [ #  # ]
    2294 [ #  # ][ #  # ]:          0 :     if (pDoc->HasTable( nNewTab ))
    2295         [ #  # ]:          0 :         SetTabNo(nNewTab);
    2296                 :            : 
    2297                 :            :     //
    2298                 :            :     // wenn vorhanden, TabBar-Breite holen:
    2299                 :            :     //
    2300 [ #  # ][ #  # ]:          0 :     aTabOpt = rData.GetToken(2);
                 [ #  # ]
    2301                 :            : 
    2302 [ #  # ][ #  # ]:          0 :     if ( nTagLen && aTabOpt.Copy(0,nTagLen).EqualsAscii(TAG_TABBARWIDTH) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    2303                 :            :     {
    2304 [ #  # ][ #  # ]:          0 :         pView->SetTabBarWidth( aTabOpt.Copy(nTagLen).ToInt32() );
         [ #  # ][ #  # ]
    2305                 :          0 :         nTabStart = 3;
    2306                 :            :     }
    2307                 :            : 
    2308                 :            :     // pro Tabelle:
    2309                 :          0 :     SCTAB nPos = 0;
    2310         [ #  # ]:          0 :     while ( nCount > nPos+nTabStart )
    2311                 :            :     {
    2312 [ #  # ][ #  # ]:          0 :         aTabOpt = rData.GetToken(static_cast<xub_StrLen>(nPos+nTabStart));
                 [ #  # ]
    2313         [ #  # ]:          0 :         EnsureTabDataSize(nPos + 1);
    2314         [ #  # ]:          0 :         if (!maTabData[nPos])
    2315 [ #  # ][ #  # ]:          0 :             maTabData[nPos] = new ScViewDataTable;
    2316                 :            : 
    2317                 :          0 :         sal_Unicode cTabSep = 0;
    2318 [ #  # ][ #  # ]:          0 :         if (comphelper::string::getTokenCount(aTabOpt, SC_OLD_TABSEP) >= 11)
                 [ #  # ]
    2319                 :          0 :             cTabSep = SC_OLD_TABSEP;
    2320                 :            : #ifndef SC_LIMIT_ROWS
    2321 [ #  # ][ #  # ]:          0 :         else if (comphelper::string::getTokenCount(aTabOpt, SC_NEW_TABSEP) >= 11)
                 [ #  # ]
    2322                 :          0 :             cTabSep = SC_NEW_TABSEP;
    2323                 :            :         // '+' ist nur erlaubt, wenn wir mit Zeilen > 8192 umgehen koennen
    2324                 :            : #endif
    2325                 :            : 
    2326         [ #  # ]:          0 :         if (cTabSep)
    2327                 :            :         {
    2328 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->nCurX = SanitizeCol( static_cast<SCCOL>(aTabOpt.GetToken(0,cTabSep).ToInt32()));
                 [ #  # ]
    2329 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->nCurY = SanitizeRow( aTabOpt.GetToken(1,cTabSep).ToInt32());
                 [ #  # ]
    2330 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->eHSplitMode = (ScSplitMode) aTabOpt.GetToken(2,cTabSep).ToInt32();
                 [ #  # ]
    2331 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->eVSplitMode = (ScSplitMode) aTabOpt.GetToken(3,cTabSep).ToInt32();
                 [ #  # ]
    2332                 :            : 
    2333         [ #  # ]:          0 :             if ( maTabData[nPos]->eHSplitMode == SC_SPLIT_FIX )
    2334                 :            :             {
    2335 [ #  # ][ #  # ]:          0 :                 maTabData[nPos]->nFixPosX = SanitizeCol( static_cast<SCCOL>(aTabOpt.GetToken(4,cTabSep).ToInt32()));
                 [ #  # ]
    2336         [ #  # ]:          0 :                 UpdateFixX(nPos);
    2337                 :            :             }
    2338                 :            :             else
    2339 [ #  # ][ #  # ]:          0 :                 maTabData[nPos]->nHSplitPos = aTabOpt.GetToken(4,cTabSep).ToInt32();
                 [ #  # ]
    2340                 :            : 
    2341         [ #  # ]:          0 :             if ( maTabData[nPos]->eVSplitMode == SC_SPLIT_FIX )
    2342                 :            :             {
    2343 [ #  # ][ #  # ]:          0 :                 maTabData[nPos]->nFixPosY = SanitizeRow( aTabOpt.GetToken(5,cTabSep).ToInt32());
                 [ #  # ]
    2344         [ #  # ]:          0 :                 UpdateFixY(nPos);
    2345                 :            :             }
    2346                 :            :             else
    2347 [ #  # ][ #  # ]:          0 :                 maTabData[nPos]->nVSplitPos = aTabOpt.GetToken(5,cTabSep).ToInt32();
                 [ #  # ]
    2348                 :            : 
    2349 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->eWhichActive = (ScSplitPos) aTabOpt.GetToken(6,cTabSep).ToInt32();
                 [ #  # ]
    2350 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->nPosX[0] = SanitizeCol( static_cast<SCCOL>(aTabOpt.GetToken(7,cTabSep).ToInt32()));
                 [ #  # ]
    2351 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->nPosX[1] = SanitizeCol( static_cast<SCCOL>(aTabOpt.GetToken(8,cTabSep).ToInt32()));
                 [ #  # ]
    2352 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->nPosY[0] = SanitizeRow( aTabOpt.GetToken(9,cTabSep).ToInt32());
                 [ #  # ]
    2353 [ #  # ][ #  # ]:          0 :             maTabData[nPos]->nPosY[1] = SanitizeRow( aTabOpt.GetToken(10,cTabSep).ToInt32());
                 [ #  # ]
    2354                 :            : 
    2355                 :            :             //  Test, ob der aktive Teil laut SplitMode ueberhaupt existiert
    2356                 :            :             //  (Bug #44516#)
    2357                 :          0 :             ScSplitPos eTest = maTabData[nPos]->eWhichActive;
    2358 [ #  # ][ #  #  :          0 :             if ( ( WhichH( eTest ) == SC_SPLIT_RIGHT &&
          #  #  #  #  #  
                      # ]
    2359                 :          0 :                     maTabData[nPos]->eHSplitMode == SC_SPLIT_NONE ) ||
    2360                 :          0 :                  ( WhichV( eTest ) == SC_SPLIT_TOP &&
    2361                 :          0 :                     maTabData[nPos]->eVSplitMode == SC_SPLIT_NONE ) )
    2362                 :            :             {
    2363                 :            :                 //  dann wieder auf Default (unten links)
    2364                 :          0 :                 maTabData[nPos]->eWhichActive = SC_SPLIT_BOTTOMLEFT;
    2365                 :            :                 OSL_FAIL("SplitPos musste korrigiert werden");
    2366                 :            :             }
    2367                 :            :         }
    2368                 :          0 :         ++nPos;
    2369                 :            :     }
    2370                 :            : 
    2371 [ #  # ][ #  # ]:          0 :     RecalcPixPos();
                 [ #  # ]
    2372                 :            : }
    2373                 :            : 
    2374                 :          0 : void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
    2375                 :            : {
    2376                 :            :     // *** Fill extended document data for export filters ***
    2377                 :            : 
    2378                 :            :     // document settings
    2379                 :          0 :     ScExtDocSettings& rDocSett = rDocOpt.GetDocSettings();
    2380                 :            : 
    2381                 :            :     // displayed sheet
    2382                 :          0 :     rDocSett.mnDisplTab = GetTabNo();
    2383                 :            : 
    2384                 :            :     // width of the tabbar, relative to frame window width
    2385                 :          0 :     rDocSett.mfTabBarWidth = pView->GetPendingRelTabBarWidth();
    2386         [ #  # ]:          0 :     if( rDocSett.mfTabBarWidth < 0.0 )
    2387                 :          0 :         rDocSett.mfTabBarWidth = pView->GetRelTabBarWidth();
    2388                 :            : 
    2389                 :            :     // sheet settings
    2390         [ #  # ]:          0 :     for( SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabData.size()); ++nTab )
    2391                 :            :     {
    2392         [ #  # ]:          0 :         if( const ScViewDataTable* pViewTab = maTabData[ nTab ] )
    2393                 :            :         {
    2394                 :          0 :             ScExtTabSettings& rTabSett = rDocOpt.GetOrCreateTabSettings( nTab );
    2395                 :            : 
    2396                 :            :             // split mode
    2397                 :          0 :             ScSplitMode eHSplit = pViewTab->eHSplitMode;
    2398                 :          0 :             ScSplitMode eVSplit = pViewTab->eVSplitMode;
    2399                 :          0 :             bool bHSplit = eHSplit != SC_SPLIT_NONE;
    2400                 :          0 :             bool bVSplit = eVSplit != SC_SPLIT_NONE;
    2401 [ #  # ][ #  # ]:          0 :             bool bRealSplit = (eHSplit == SC_SPLIT_NORMAL) || (eVSplit == SC_SPLIT_NORMAL);
    2402 [ #  # ][ #  # ]:          0 :             bool bFrozen    = (eHSplit == SC_SPLIT_FIX)    || (eVSplit == SC_SPLIT_FIX);
    2403                 :            :             OSL_ENSURE( !bRealSplit || !bFrozen, "ScViewData::WriteExtOptions - split and freeze in same sheet" );
    2404 [ #  # ][ #  # ]:          0 :             rTabSett.mbFrozenPanes = !bRealSplit && bFrozen;
    2405                 :            : 
    2406                 :            :             // split and freeze position
    2407                 :          0 :             rTabSett.maSplitPos = Point( 0, 0 );
    2408                 :          0 :             rTabSett.maFreezePos.Set( 0, 0, nTab );
    2409         [ #  # ]:          0 :             if( bRealSplit )
    2410                 :            :             {
    2411                 :          0 :                 Point& rSplitPos = rTabSett.maSplitPos;
    2412 [ #  # ][ #  # ]:          0 :                 rSplitPos = Point( bHSplit ? pViewTab->nHSplitPos : 0, bVSplit ? pViewTab->nVSplitPos : 0 );
    2413 [ #  # ][ #  # ]:          0 :                 rSplitPos = Application::GetDefaultDevice()->PixelToLogic( rSplitPos, MapMode( MAP_TWIP ) );
    2414         [ #  # ]:          0 :                 if( pDocShell )
    2415                 :          0 :                     rSplitPos.X() = (long)((double)rSplitPos.X() / pDocShell->GetOutputFactor());
    2416                 :            :             }
    2417         [ #  # ]:          0 :             else if( bFrozen )
    2418                 :            :             {
    2419         [ #  # ]:          0 :                 if( bHSplit ) rTabSett.maFreezePos.SetCol( pViewTab->nFixPosX );
    2420         [ #  # ]:          0 :                 if( bVSplit ) rTabSett.maFreezePos.SetRow( pViewTab->nFixPosY );
    2421                 :            :             }
    2422                 :            : 
    2423                 :            :             // first visible cell in top-left and additional panes
    2424         [ #  # ]:          0 :             rTabSett.maFirstVis.Set( pViewTab->nPosX[ SC_SPLIT_LEFT ], pViewTab->nPosY[ bVSplit ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM ], nTab );
    2425                 :          0 :             rTabSett.maSecondVis.Set( pViewTab->nPosX[ SC_SPLIT_RIGHT ], pViewTab->nPosY[ SC_SPLIT_BOTTOM ], nTab );
    2426                 :            : 
    2427                 :            :             // active pane
    2428   [ #  #  #  #  :          0 :             switch( pViewTab->eWhichActive )
                      # ]
    2429                 :            :             {
    2430                 :            :                 // no horizontal split -> always use left panes
    2431                 :            :                 // no vertical split -> always use top panes
    2432                 :            :                 case SC_SPLIT_TOPLEFT:
    2433                 :          0 :                     rTabSett.meActivePane = SCEXT_PANE_TOPLEFT;
    2434                 :          0 :                 break;
    2435                 :            :                 case SC_SPLIT_TOPRIGHT:
    2436         [ #  # ]:          0 :                     rTabSett.meActivePane = bHSplit ? SCEXT_PANE_TOPRIGHT : SCEXT_PANE_TOPLEFT;
    2437                 :          0 :                 break;
    2438                 :            :                 case SC_SPLIT_BOTTOMLEFT:
    2439         [ #  # ]:          0 :                     rTabSett.meActivePane = bVSplit ? SCEXT_PANE_BOTTOMLEFT : SCEXT_PANE_TOPLEFT;
    2440                 :          0 :                 break;
    2441                 :            :                 case SC_SPLIT_BOTTOMRIGHT:
    2442                 :            :                     rTabSett.meActivePane = bHSplit ?
    2443                 :            :                         (bVSplit ? SCEXT_PANE_BOTTOMRIGHT : SCEXT_PANE_TOPRIGHT) :
    2444 [ #  # ][ #  # ]:          0 :                         (bVSplit ? SCEXT_PANE_BOTTOMLEFT : SCEXT_PANE_TOPLEFT);
                 [ #  # ]
    2445                 :          0 :                 break;
    2446                 :            :             }
    2447                 :            : 
    2448                 :            :             // cursor position
    2449                 :          0 :             rTabSett.maCursor.Set( pViewTab->nCurX, pViewTab->nCurY, nTab );
    2450                 :            : 
    2451                 :            :             // sheet selection and selected ranges
    2452                 :          0 :             const ScMarkData& rMarkData = GetMarkData();
    2453                 :          0 :             rTabSett.mbSelected = rMarkData.GetTableSelect( nTab );
    2454                 :          0 :             rMarkData.FillRangeListWithMarks( &rTabSett.maSelection, sal_True );
    2455                 :            : 
    2456                 :            :             // grid color
    2457                 :          0 :             rTabSett.maGridColor.SetColor( COL_AUTO );
    2458         [ #  # ]:          0 :             if( pOptions )
    2459                 :            :             {
    2460                 :          0 :                 const Color& rGridColor = pOptions->GetGridColor();
    2461         [ #  # ]:          0 :                 if( rGridColor.GetColor() != SC_STD_GRIDCOLOR )
    2462                 :          0 :                     rTabSett.maGridColor = rGridColor;
    2463                 :            :             }
    2464                 :          0 :             rTabSett.mbShowGrid = pViewTab->bShowGrid;
    2465                 :            : 
    2466                 :            :             // view mode and zoom
    2467                 :          0 :             rTabSett.mbPageMode = bPagebreak;
    2468 [ #  # ][ #  # ]:          0 :             rTabSett.mnNormalZoom = static_cast< long >( pViewTab->aZoomY * Fraction( 100.0 ) );
    2469 [ #  # ][ #  # ]:          0 :             rTabSett.mnPageZoom = static_cast< long >( pViewTab->aPageZoomY * Fraction( 100.0 ) );
    2470                 :            :         }
    2471                 :            :     }
    2472                 :          0 : }
    2473                 :            : 
    2474                 :          4 : void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
    2475                 :            : {
    2476                 :            :     // *** Get extended document data from import filters ***
    2477                 :            : 
    2478         [ -  + ]:          8 :     if( !rDocOpt.IsChanged() ) return;
    2479                 :            : 
    2480                 :            :     // document settings
    2481                 :          4 :     const ScExtDocSettings& rDocSett = rDocOpt.GetDocSettings();
    2482                 :            : 
    2483                 :            :     // displayed sheet
    2484                 :          4 :     SetTabNo( rDocSett.mnDisplTab );
    2485                 :            : 
    2486                 :            :     /*  Width of the tabbar, relative to frame window width. We do not have the
    2487                 :            :         correct width of the frame window here -> store in ScTabView, which sets
    2488                 :            :         the size in the next resize. */
    2489                 :          4 :     pView->SetPendingRelTabBarWidth( rDocSett.mfTabBarWidth );
    2490                 :            : 
    2491                 :            :     // sheet settings
    2492         [ +  + ]:         12 :     for( SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabData.size()); ++nTab )
    2493                 :            :     {
    2494         [ +  - ]:          8 :         if( const ScExtTabSettings* pTabSett = rDocOpt.GetTabSettings( nTab ) )
    2495                 :            :         {
    2496         [ +  + ]:          8 :             if( !maTabData[ nTab ] )
    2497         [ +  - ]:          4 :                 maTabData[ nTab ] = new ScViewDataTable;
    2498                 :            : 
    2499                 :          8 :             const ScExtTabSettings& rTabSett = *pTabSett;
    2500                 :          8 :             ScViewDataTable& rViewTab = *maTabData[ nTab ];
    2501                 :            : 
    2502                 :            :             // split mode initialization
    2503                 :          8 :             bool bFrozen = rTabSett.mbFrozenPanes;
    2504         [ -  + ]:          8 :             bool bHSplit = bFrozen ? (rTabSett.maFreezePos.Col() > 0) : (rTabSett.maSplitPos.X() > 0);
    2505         [ -  + ]:          8 :             bool bVSplit = bFrozen ? (rTabSett.maFreezePos.Row() > 0) : (rTabSett.maSplitPos.Y() > 0);
    2506                 :            : 
    2507                 :            :             // first visible cell of top-left pane and additional panes
    2508                 :          8 :             rViewTab.nPosX[ SC_SPLIT_LEFT ] = rTabSett.maFirstVis.Col();
    2509         [ -  + ]:          8 :             rViewTab.nPosY[ bVSplit ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM ] = rTabSett.maFirstVis.Row();
    2510         [ -  + ]:          8 :             if( bHSplit ) rViewTab.nPosX[ SC_SPLIT_RIGHT ] = rTabSett.maSecondVis.Col();
    2511         [ -  + ]:          8 :             if( bVSplit ) rViewTab.nPosY[ SC_SPLIT_BOTTOM ] = rTabSett.maSecondVis.Row();
    2512                 :            : 
    2513                 :            :             // split mode, split and freeze position
    2514                 :          8 :             rViewTab.eHSplitMode = rViewTab.eVSplitMode = SC_SPLIT_NONE;
    2515                 :          8 :             rViewTab.nHSplitPos = rViewTab.nVSplitPos = 0;
    2516                 :          8 :             rViewTab.nFixPosX = 0;
    2517                 :          8 :             rViewTab.nFixPosY = 0;
    2518         [ -  + ]:          8 :             if( bFrozen )
    2519                 :            :             {
    2520         [ #  # ]:          0 :                 if( bHSplit )
    2521                 :            :                 {
    2522                 :          0 :                     rViewTab.eHSplitMode = SC_SPLIT_FIX;
    2523                 :          0 :                     rViewTab.nFixPosX = rTabSett.maFreezePos.Col();
    2524                 :          0 :                     UpdateFixX( nTab );
    2525                 :            :                 }
    2526         [ #  # ]:          0 :                 if( bVSplit )
    2527                 :            :                 {
    2528                 :          0 :                     rViewTab.eVSplitMode = SC_SPLIT_FIX;
    2529                 :          0 :                     rViewTab.nFixPosY = rTabSett.maFreezePos.Row();
    2530                 :          0 :                     UpdateFixY( nTab );
    2531                 :            :                 }
    2532                 :            :             }
    2533                 :            :             else
    2534                 :            :             {
    2535                 :            :                 Point aPixel = Application::GetDefaultDevice()->LogicToPixel(
    2536 [ +  - ][ +  - ]:          8 :                                 rTabSett.maSplitPos, MapMode( MAP_TWIP ) );  //! Zoom?
         [ +  - ][ +  - ]
    2537                 :            :                 // the test for use of printer metrics for text formatting here
    2538                 :            :                 // effectively results in the nFactor = 1.0 regardless of the Option setting.
    2539 [ +  - ][ +  - ]:          8 :                 if( pDocShell && SC_MOD()->GetInputOptions().GetTextWysiwyg())
         [ +  - ][ -  + ]
                 [ -  + ]
    2540                 :            :                 {
    2541         [ #  # ]:          0 :                     double nFactor = pDocShell->GetOutputFactor();
    2542                 :          0 :                     aPixel.X() = (long)( aPixel.X() * nFactor + 0.5 );
    2543                 :            :                 }
    2544         [ -  + ]:          8 :                 if( bHSplit )
    2545                 :            :                 {
    2546                 :          0 :                     rViewTab.eHSplitMode = SC_SPLIT_NORMAL;
    2547                 :          0 :                     rViewTab.nHSplitPos = aPixel.X();
    2548                 :            :                 }
    2549         [ -  + ]:          8 :                 if( bVSplit )
    2550                 :            :                 {
    2551                 :          0 :                     rViewTab.eVSplitMode = SC_SPLIT_NORMAL;
    2552                 :          8 :                     rViewTab.nVSplitPos = aPixel.Y();
    2553                 :            :                 }
    2554                 :            :             }
    2555                 :            : 
    2556                 :            :             // active pane
    2557                 :          8 :             ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
    2558   [ +  -  -  -  :          8 :             switch( rTabSett.meActivePane )
                      - ]
    2559                 :            :             {
    2560                 :            :                 // no horizontal split -> always use left panes
    2561                 :            :                 // no vertical split -> always use *bottom* panes
    2562                 :            :                 case SCEXT_PANE_TOPLEFT:
    2563         [ -  + ]:          8 :                     ePos = bVSplit ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
    2564                 :          8 :                 break;
    2565                 :            :                 case SCEXT_PANE_TOPRIGHT:
    2566                 :            :                     ePos = bHSplit ?
    2567                 :            :                         (bVSplit ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT) :
    2568 [ #  # ][ #  # ]:          0 :                         (bVSplit ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT);
                 [ #  # ]
    2569                 :          0 :                 break;
    2570                 :            :                 case SCEXT_PANE_BOTTOMLEFT:
    2571                 :          0 :                     ePos = SC_SPLIT_BOTTOMLEFT;
    2572                 :          0 :                 break;
    2573                 :            :                 case SCEXT_PANE_BOTTOMRIGHT:
    2574         [ #  # ]:          0 :                     ePos = bHSplit ? SC_SPLIT_BOTTOMRIGHT : SC_SPLIT_BOTTOMLEFT;
    2575                 :          0 :                 break;
    2576                 :            :             }
    2577                 :          8 :             rViewTab.eWhichActive = ePos;
    2578                 :            : 
    2579                 :            :             // cursor position
    2580                 :          8 :             const ScAddress& rCursor = rTabSett.maCursor;
    2581         [ +  - ]:          8 :             if( rCursor.IsValid() )
    2582                 :            :             {
    2583                 :          8 :                 rViewTab.nCurX = rCursor.Col();
    2584                 :          8 :                 rViewTab.nCurY = rCursor.Row();
    2585                 :            :             }
    2586                 :            : 
    2587                 :            :             // sheet selection and selected ranges
    2588                 :          8 :             ScMarkData& rMarkData = GetMarkData();
    2589                 :          8 :             rMarkData.SelectTable( nTab, rTabSett.mbSelected );
    2590                 :            : 
    2591                 :            :             // zoom for each sheet
    2592         [ +  - ]:          8 :             if( rTabSett.mnNormalZoom )
    2593 [ +  - ][ +  - ]:          8 :                 rViewTab.aZoomX = rViewTab.aZoomY = Fraction( rTabSett.mnNormalZoom, 100L );
    2594         [ +  - ]:          8 :             if( rTabSett.mnPageZoom )
    2595 [ +  - ][ +  - ]:          8 :                 rViewTab.aPageZoomX = rViewTab.aPageZoomY = Fraction( rTabSett.mnPageZoom, 100L );
    2596                 :            : 
    2597                 :          8 :             rViewTab.bShowGrid = rTabSett.mbShowGrid;
    2598                 :            : 
    2599                 :            :             // get some settings from displayed Excel sheet, set at Calc document
    2600         [ +  + ]:          8 :             if( nTab == GetTabNo() )
    2601                 :            :             {
    2602                 :            :                 // grid color -- #i47435# set automatic grid color explicitly
    2603         [ +  - ]:          4 :                 if( pOptions )
    2604                 :            :                 {
    2605                 :          4 :                     Color aGridColor( rTabSett.maGridColor );
    2606         [ +  - ]:          4 :                     if( aGridColor.GetColor() == COL_AUTO )
    2607                 :          4 :                         aGridColor.SetColor( SC_STD_GRIDCOLOR );
    2608 [ +  - ][ +  - ]:          4 :                     pOptions->SetGridColor( aGridColor, EMPTY_STRING );
    2609                 :            :                 }
    2610                 :            : 
    2611                 :            :                 // view mode and default zoom (for new sheets) from current sheet
    2612         [ +  - ]:          4 :                 if( rTabSett.mnNormalZoom )
    2613 [ +  - ][ +  - ]:          4 :                     aDefZoomX = aDefZoomY = Fraction( rTabSett.mnNormalZoom, 100L );
    2614         [ +  - ]:          4 :                 if( rTabSett.mnPageZoom )
    2615 [ +  - ][ +  - ]:          4 :                     aDefPageZoomX = aDefPageZoomY = Fraction( rTabSett.mnPageZoom, 100L );
    2616                 :            :                 /*  #i46820# set pagebreak mode via SetPagebreakMode(), this will
    2617                 :            :                     update map modes that are needed to draw text correctly. */
    2618                 :          4 :                 SetPagebreakMode( rTabSett.mbPageMode );
    2619                 :            :             }
    2620                 :            :         }
    2621                 :            :     }
    2622                 :            : 
    2623                 :            :     // RecalcPixPos oder so - auch nMPos - auch bei ReadUserData ??!?!
    2624                 :            : }
    2625                 :            : 
    2626                 :        235 : void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSettings) const
    2627                 :            : {
    2628                 :        235 :     rSettings.realloc(SC_VIEWSETTINGS_COUNT);
    2629                 :            :     // + 1, because we have to put the view id in the sequence
    2630                 :        235 :     beans::PropertyValue* pSettings = rSettings.getArray();
    2631         [ +  - ]:        235 :     if (pSettings)
    2632                 :            :     {
    2633         [ +  - ]:        235 :         sal_uInt16 nViewID(pViewShell->GetViewFrame()->GetCurViewId());
    2634         [ +  - ]:        235 :         pSettings[SC_VIEW_ID].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_VIEWID));
    2635 [ +  - ][ +  - ]:        235 :         rtl::OUStringBuffer sBuffer(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_VIEW)));
    2636                 :            :         ::sax::Converter::convertNumber(sBuffer,
    2637         [ +  - ]:        235 :                 static_cast<sal_Int32>(nViewID));
    2638 [ +  - ][ +  - ]:        235 :         pSettings[SC_VIEW_ID].Value <<= sBuffer.makeStringAndClear();
    2639                 :            : 
    2640                 :            :         uno::Reference<lang::XMultiServiceFactory> xServiceFactory =
    2641         [ +  - ]:        235 :                                         comphelper::getProcessServiceFactory();
    2642                 :            :         OSL_ENSURE( xServiceFactory.is(), "got no service manager" );
    2643         [ +  - ]:        235 :         if( xServiceFactory.is() )
    2644                 :            :         {
    2645         [ +  - ]:        235 :             rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.NamedPropertyValues"));
    2646 [ +  - ][ +  - ]:        235 :             uno::Reference<container::XNameContainer> xNameContainer = uno::Reference<container::XNameContainer>(xServiceFactory->createInstance(sName), uno::UNO_QUERY);
                 [ +  - ]
              [ #  #  # ]
    2647         [ +  - ]:        235 :             if (xNameContainer.is())
    2648                 :            :             {
    2649         [ +  + ]:        510 :                 for (SCTAB nTab=0; nTab<static_cast<SCTAB>(maTabData.size()); nTab++)
    2650                 :            :                 {
    2651         [ +  + ]:        275 :                     if (maTabData[nTab])
    2652                 :            :                     {
    2653         [ +  - ]:        239 :                         uno::Sequence <beans::PropertyValue> aTableViewSettings;
    2654         [ +  - ]:        239 :                         maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *this, nTab);
    2655                 :        239 :                         rtl::OUString sTabName;
    2656 [ +  - ][ +  - ]:        239 :                         GetDocument()->GetName( nTab, sTabName );
    2657                 :        239 :                         uno::Any aAny;
    2658         [ +  - ]:        239 :                         aAny <<= aTableViewSettings;
    2659                 :            :                         try
    2660                 :            :                         {
    2661 [ +  - ][ +  - ]:        239 :                             xNameContainer->insertByName(sTabName, aAny);
    2662                 :            :                         }
    2663                 :            :                         //#101739#; two tables with the same name are possible
    2664         [ #  # ]:          0 :                         catch ( container::ElementExistException& )
    2665                 :            :                         {
    2666                 :            :                             OSL_FAIL("seems there are two tables with the same name");
    2667                 :            :                         }
    2668         [ #  # ]:          0 :                         catch ( uno::RuntimeException& )
    2669                 :            :                         {
    2670                 :            :                             OSL_FAIL("something went wrong");
    2671         [ +  - ]:        239 :                         }
    2672                 :            :                     }
    2673                 :            :                 }
    2674         [ +  - ]:        235 :                 pSettings[SC_TABLE_VIEWSETTINGS].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_TABLES));
    2675         [ +  - ]:        235 :                 pSettings[SC_TABLE_VIEWSETTINGS].Value <<= xNameContainer;
    2676                 :        235 :             }
    2677                 :            :         }
    2678                 :            : 
    2679                 :        235 :         rtl::OUString sName;
    2680 [ +  - ][ +  - ]:        235 :         GetDocument()->GetName( nTabNo, sName );
    2681         [ +  - ]:        235 :         pSettings[SC_ACTIVE_TABLE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ACTIVETABLE));
    2682         [ +  - ]:        235 :         pSettings[SC_ACTIVE_TABLE].Value <<= sName;
    2683         [ +  - ]:        235 :         pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_HORIZONTALSCROLLBARWIDTH));
    2684 [ +  - ][ +  - ]:        235 :         pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Value <<= sal_Int32(pView->GetTabBarWidth());
    2685                 :        235 :         sal_Int32 nZoomValue ((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator());
    2686                 :        235 :         sal_Int32 nPageZoomValue ((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator());
    2687         [ +  - ]:        235 :         pSettings[SC_ZOOM_TYPE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ZOOMTYPE));
    2688         [ +  - ]:        235 :         pSettings[SC_ZOOM_TYPE].Value <<= sal_Int16(pThisTab->eZoomType);
    2689         [ +  - ]:        235 :         pSettings[SC_ZOOM_VALUE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ZOOMVALUE));
    2690         [ +  - ]:        235 :         pSettings[SC_ZOOM_VALUE].Value <<= nZoomValue;
    2691         [ +  - ]:        235 :         pSettings[SC_PAGE_VIEW_ZOOM_VALUE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_PAGEVIEWZOOMVALUE));
    2692         [ +  - ]:        235 :         pSettings[SC_PAGE_VIEW_ZOOM_VALUE].Value <<= nPageZoomValue;
    2693         [ +  - ]:        235 :         pSettings[SC_PAGE_BREAK_PREVIEW].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_SHOWPAGEBREAKPREVIEW));
    2694         [ +  - ]:        235 :         ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_PAGE_BREAK_PREVIEW].Value, bPagebreak);
    2695                 :            : 
    2696         [ +  - ]:        235 :         if (pOptions)
    2697                 :            :         {
    2698         [ +  - ]:        235 :             pSettings[SC_SHOWZERO].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWZERO));
    2699         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_SHOWZERO].Value, pOptions->GetOption( VOPT_NULLVALS ) );
    2700         [ +  - ]:        235 :             pSettings[SC_SHOWNOTES].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWNOTES));
    2701         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_SHOWNOTES].Value, pOptions->GetOption( VOPT_NOTES ) );
    2702         [ +  - ]:        235 :             pSettings[SC_SHOWGRID].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWGRID));
    2703         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_SHOWGRID].Value, pOptions->GetOption( VOPT_GRID ) );
    2704         [ +  - ]:        235 :             pSettings[SC_GRIDCOLOR].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_GRIDCOLOR));
    2705         [ +  - ]:        235 :             String aColorName;
    2706         [ +  - ]:        235 :             Color aColor = pOptions->GetGridColor(&aColorName);
    2707         [ +  - ]:        235 :             pSettings[SC_GRIDCOLOR].Value <<= static_cast<sal_Int64>(aColor.GetColor());
    2708         [ +  - ]:        235 :             pSettings[SC_SHOWPAGEBR].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWPAGEBR));
    2709         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_SHOWPAGEBR].Value, pOptions->GetOption( VOPT_PAGEBREAKS ) );
    2710         [ +  - ]:        235 :             pSettings[SC_COLROWHDR].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_COLROWHDR));
    2711         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_COLROWHDR].Value, pOptions->GetOption( VOPT_HEADER ) );
    2712         [ +  - ]:        235 :             pSettings[SC_SHEETTABS].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHEETTABS));
    2713         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_SHEETTABS].Value, pOptions->GetOption( VOPT_TABCONTROLS ) );
    2714         [ +  - ]:        235 :             pSettings[SC_OUTLSYMB].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_OUTLSYMB));
    2715         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_OUTLSYMB].Value, pOptions->GetOption( VOPT_OUTLINER ) );
    2716                 :            : 
    2717                 :        235 :             const ScGridOptions& aGridOpt = pOptions->GetGridOptions();
    2718         [ +  - ]:        235 :             pSettings[SC_SNAPTORASTER].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SNAPTORASTER));
    2719         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_SNAPTORASTER].Value, aGridOpt.GetUseGridSnap() );
    2720         [ +  - ]:        235 :             pSettings[SC_RASTERVIS].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_RASTERVIS));
    2721         [ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_RASTERVIS].Value, aGridOpt.GetGridVisible() );
    2722         [ +  - ]:        235 :             pSettings[SC_RASTERRESX].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_RASTERRESX));
    2723         [ +  - ]:        235 :             pSettings[SC_RASTERRESX].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() );
    2724         [ +  - ]:        235 :             pSettings[SC_RASTERRESY].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_RASTERRESY));
    2725         [ +  - ]:        235 :             pSettings[SC_RASTERRESY].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() );
    2726         [ +  - ]:        235 :             pSettings[SC_RASTERSUBX].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_RASTERSUBX));
    2727         [ +  - ]:        235 :             pSettings[SC_RASTERSUBX].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() );
    2728         [ +  - ]:        235 :             pSettings[SC_RASTERSUBY].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_RASTERSUBY));
    2729         [ +  - ]:        235 :             pSettings[SC_RASTERSUBY].Value <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() );
    2730         [ +  - ]:        235 :             pSettings[SC_RASTERSYNC].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_RASTERSYNC));
    2731 [ +  - ][ +  - ]:        235 :             ScUnoHelpFunctions::SetBoolInAny( pSettings[SC_RASTERSYNC].Value, aGridOpt.GetSynchronize() );
    2732                 :        235 :         }
    2733                 :            :     }
    2734                 :        235 : }
    2735                 :            : 
    2736                 :        229 : void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>& rSettings)
    2737                 :            : {
    2738                 :        229 :     Fraction aZoomX, aZoomY, aPageZoomX, aPageZoomY;    //! evaluate (all sheets?)
    2739                 :            : 
    2740 [ +  - ][ +  - ]:        229 :     std::vector<bool> aHasZoomVect( GetDocument()->GetTableCount(), false );
                 [ +  - ]
    2741                 :            : 
    2742                 :        229 :     sal_Int32 nCount(rSettings.getLength());
    2743                 :        229 :     sal_Int32 nTemp32(0);
    2744                 :        229 :     sal_Int16 nTemp16(0);
    2745                 :        229 :     sal_Bool bPageMode(false);
    2746                 :            : 
    2747 [ +  - ][ +  - ]:        229 :     EnsureTabDataSize(GetDocument()->GetTableCount()-1);
                 [ +  - ]
    2748                 :            : 
    2749         [ +  + ]:       5496 :     for (sal_Int32 i = 0; i < nCount; i++)
    2750                 :            :     {
    2751                 :            :         // SC_VIEWID has to parse and use by mba
    2752                 :       5267 :         rtl::OUString sName(rSettings[i].Name);
    2753         [ +  + ]:       5267 :         if (sName.compareToAscii(SC_TABLES) == 0)
    2754                 :            :         {
    2755                 :        229 :             uno::Reference<container::XNameContainer> xNameContainer;
    2756 [ +  - ][ +  - ]:        229 :             if ((rSettings[i].Value >>= xNameContainer) && xNameContainer->hasElements())
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    2757                 :            :             {
    2758 [ +  - ][ +  - ]:        229 :                 uno::Sequence< rtl::OUString > aNames(xNameContainer->getElementNames());
    2759         [ +  + ]:        480 :                 for (sal_Int32 nTabPos = 0; nTabPos < aNames.getLength(); nTabPos++)
    2760                 :            :                 {
    2761 [ +  - ][ +  - ]:        251 :                     String sTabName(aNames[nTabPos]);
    2762                 :        251 :                     SCTAB nTab(0);
    2763 [ +  - ][ +  - ]:        251 :                     if (GetDocument()->GetTable(sTabName, nTab))
         [ +  - ][ +  - ]
    2764                 :            :                     {
    2765 [ +  - ][ +  - ]:        251 :                         uno::Any aAny = xNameContainer->getByName(aNames[nTabPos]);
                 [ +  - ]
    2766         [ +  - ]:        251 :                         uno::Sequence<beans::PropertyValue> aTabSettings;
    2767 [ +  - ][ +  - ]:        251 :                         if (aAny >>= aTabSettings)
    2768                 :            :                         {
    2769         [ +  - ]:        251 :                             EnsureTabDataSize(nTab + 1);
    2770         [ +  + ]:        251 :                             if (!maTabData[nTab])
    2771 [ +  - ][ +  - ]:         18 :                                 maTabData[nTab] = new ScViewDataTable;
    2772                 :            : 
    2773                 :        251 :                             bool bHasZoom = false;
    2774         [ +  - ]:        251 :                             maTabData[nTab]->ReadUserDataSequence(aTabSettings, *this, nTab, bHasZoom);
    2775         [ +  - ]:        251 :                             aHasZoomVect[nTab] = bHasZoom;
    2776         [ +  - ]:        251 :                         }
    2777                 :            :                     }
    2778 [ +  - ][ +  - ]:        480 :                 }
    2779                 :        229 :             }
    2780                 :            :         }
    2781         [ +  + ]:       5038 :         else if (sName.compareToAscii(SC_ACTIVETABLE) == 0)
    2782                 :            :         {
    2783                 :        229 :             rtl::OUString sValue;
    2784         [ +  - ]:        229 :             if(rSettings[i].Value >>= sValue)
    2785                 :            :             {
    2786         [ +  - ]:        229 :                 String sTabName(sValue);
    2787                 :        229 :                 SCTAB nTab(0);
    2788 [ +  - ][ +  - ]:        229 :                 if (GetDocument()->GetTable(sTabName, nTab))
         [ +  - ][ +  - ]
    2789         [ +  - ]:        229 :                     nTabNo = nTab;
    2790                 :        229 :             }
    2791                 :            :         }
    2792         [ +  + ]:       4809 :         else if (sName.compareToAscii(SC_HORIZONTALSCROLLBARWIDTH) == 0)
    2793                 :            :         {
    2794         [ +  - ]:        229 :             if (rSettings[i].Value >>= nTemp32)
    2795         [ +  - ]:        229 :                 pView->SetTabBarWidth(nTemp32);
    2796                 :            :         }
    2797         [ -  + ]:       4580 :         else if (sName.compareToAscii(SC_RELHORIZONTALTABBARWIDTH) == 0)
    2798                 :            :         {
    2799                 :          0 :             double fWidth = 0.0;
    2800         [ #  # ]:          0 :             if (rSettings[i].Value >>= fWidth)
    2801         [ #  # ]:          0 :                 pView->SetPendingRelTabBarWidth( fWidth );
    2802                 :            :         }
    2803         [ +  + ]:       4580 :         else if (sName.compareToAscii(SC_ZOOMTYPE) == 0)
    2804                 :            :         {
    2805         [ +  - ]:        229 :             if (rSettings[i].Value >>= nTemp16)
    2806                 :        229 :                 eDefZoomType = SvxZoomType(nTemp16);
    2807                 :            :         }
    2808         [ +  + ]:       4351 :         else if (sName.compareToAscii(SC_ZOOMVALUE) == 0)
    2809                 :            :         {
    2810         [ +  - ]:        229 :             if (rSettings[i].Value >>= nTemp32)
    2811                 :            :             {
    2812         [ +  - ]:        229 :                 Fraction aZoom(nTemp32, 100);
    2813 [ +  - ][ +  - ]:        229 :                 aDefZoomX = aDefZoomY = aZoom;
    2814                 :            :             }
    2815                 :            :         }
    2816         [ +  + ]:       4122 :         else if (sName.compareToAscii(SC_PAGEVIEWZOOMVALUE) == 0)
    2817                 :            :         {
    2818         [ +  - ]:        229 :             if (rSettings[i].Value >>= nTemp32)
    2819                 :            :             {
    2820         [ +  - ]:        229 :                 Fraction aZoom(nTemp32, 100);
    2821 [ +  - ][ +  - ]:        229 :                 aDefPageZoomX = aDefPageZoomY = aZoom;
    2822                 :            :             }
    2823                 :            :         }
    2824         [ +  + ]:       3893 :         else if (sName.compareToAscii(SC_SHOWPAGEBREAKPREVIEW) == 0)
    2825         [ +  - ]:        229 :             bPageMode = ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value );
    2826         [ +  + ]:       3664 :         else if ( sName.compareToAscii( SC_UNO_SHOWZERO ) == 0 )
    2827         [ +  - ]:        229 :             pOptions->SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2828         [ +  + ]:       3435 :         else if ( sName.compareToAscii( SC_UNO_SHOWNOTES ) == 0 )
    2829         [ +  - ]:        229 :             pOptions->SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2830         [ +  + ]:       3206 :         else if ( sName.compareToAscii( SC_UNO_SHOWGRID ) == 0 )
    2831         [ +  - ]:        229 :             pOptions->SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2832         [ +  + ]:       2977 :         else if ( sName.compareToAscii( SC_UNO_GRIDCOLOR ) == 0 )
    2833                 :            :         {
    2834                 :        229 :             sal_Int64 nColor = 0;
    2835         [ +  - ]:        229 :             if (rSettings[i].Value >>= nColor)
    2836                 :            :             {
    2837         [ +  - ]:        229 :                 String aColorName;
    2838                 :        229 :                 Color aColor(static_cast<sal_uInt32>(nColor));
    2839                 :            :                 // #i47435# set automatic grid color explicitly
    2840         [ -  + ]:        229 :                 if( aColor.GetColor() == COL_AUTO )
    2841                 :          0 :                     aColor.SetColor( SC_STD_GRIDCOLOR );
    2842 [ +  - ][ +  - ]:        229 :                 pOptions->SetGridColor(aColor, aColorName);
    2843                 :            :             }
    2844                 :            :         }
    2845         [ +  + ]:       2748 :         else if ( sName.compareToAscii( SC_UNO_SHOWPAGEBR ) == 0 )
    2846         [ +  - ]:        229 :             pOptions->SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2847         [ +  + ]:       2519 :         else if ( sName.compareToAscii( SC_UNO_COLROWHDR ) == 0 )
    2848         [ +  - ]:        229 :             pOptions->SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2849         [ +  + ]:       2290 :         else if ( sName.compareToAscii( SC_UNO_SHEETTABS ) == 0 )
    2850         [ +  - ]:        229 :             pOptions->SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2851         [ +  + ]:       2061 :         else if ( sName.compareToAscii( SC_UNO_OUTLSYMB ) == 0 )
    2852         [ +  - ]:        229 :             pOptions->SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2853         [ -  + ]:       1832 :         else if ( sName.compareToAscii( SC_UNO_SHOWOBJ ) == 0 )
    2854                 :            :         {
    2855                 :            :             // #i80528# placeholders not supported anymore
    2856         [ #  # ]:          0 :             if ( rSettings[i].Value >>= nTemp16 )
    2857         [ #  # ]:          0 :                 pOptions->SetObjMode( VOBJ_TYPE_OLE, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW );
    2858                 :            :         }
    2859         [ -  + ]:       1832 :         else if ( sName.compareToAscii( SC_UNO_SHOWCHARTS ) == 0 )
    2860                 :            :         {
    2861                 :            :             // #i80528# placeholders not supported anymore
    2862         [ #  # ]:          0 :             if ( rSettings[i].Value >>= nTemp16 )
    2863         [ #  # ]:          0 :                 pOptions->SetObjMode( VOBJ_TYPE_CHART, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW );
    2864                 :            :         }
    2865         [ -  + ]:       1832 :         else if ( sName.compareToAscii( SC_UNO_SHOWDRAW ) == 0 )
    2866                 :            :         {
    2867                 :            :             // #i80528# placeholders not supported anymore
    2868         [ #  # ]:          0 :             if ( rSettings[i].Value >>= nTemp16 )
    2869         [ #  # ]:          0 :                 pOptions->SetObjMode( VOBJ_TYPE_DRAW, (nTemp16 == 1) ? VOBJ_MODE_HIDE : VOBJ_MODE_SHOW );
    2870                 :            :         }
    2871                 :            :         else
    2872                 :            :         {
    2873                 :       1832 :             ScGridOptions aGridOpt(pOptions->GetGridOptions());
    2874         [ +  + ]:       1832 :             if ( sName.compareToAscii( SC_UNO_SNAPTORASTER ) == 0 )
    2875         [ +  - ]:        229 :                 aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2876         [ +  + ]:       1603 :             else if ( sName.compareToAscii( SC_UNO_RASTERVIS ) == 0 )
    2877         [ +  - ]:        229 :                 aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2878         [ +  + ]:       1374 :             else if ( sName.compareToAscii( SC_UNO_RASTERRESX ) == 0 )
    2879         [ +  - ]:        229 :                 aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( rSettings[i].Value ) ) );
    2880         [ +  + ]:       1145 :             else if ( sName.compareToAscii( SC_UNO_RASTERRESY ) == 0 )
    2881         [ +  - ]:        229 :                 aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( rSettings[i].Value ) ) );
    2882         [ +  + ]:        916 :             else if ( sName.compareToAscii( SC_UNO_RASTERSUBX ) == 0 )
    2883         [ +  - ]:        229 :                 aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( rSettings[i].Value ) ) );
    2884         [ +  + ]:        687 :             else if ( sName.compareToAscii( SC_UNO_RASTERSUBY ) == 0 )
    2885         [ +  - ]:        229 :                 aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( rSettings[i].Value ) ) );
    2886         [ +  + ]:        458 :             else if ( sName.compareToAscii( SC_UNO_RASTERSYNC ) == 0 )
    2887         [ +  - ]:        229 :                 aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( rSettings[i].Value ) );
    2888 [ +  - ][ +  - ]:       1832 :             pOptions->SetGridOptions(aGridOpt);
    2889                 :            :         }
    2890                 :       5267 :     }
    2891                 :            : 
    2892                 :            :     // copy default zoom to sheets where a different one wasn't specified
    2893         [ +  + ]:        719 :     for (SCTAB nZoomTab=0; nZoomTab< static_cast<SCTAB>(maTabData.size()); ++nZoomTab)
    2894 [ +  + ][ +  - ]:        490 :         if (maTabData[nZoomTab] && ( nZoomTab >= static_cast<SCTAB>(aHasZoomVect.size()) || !aHasZoomVect[nZoomTab] ))
         [ +  - ][ +  + ]
                 [ +  + ]
           [ +  +  #  # ]
    2895                 :            :         {
    2896                 :          1 :             maTabData[nZoomTab]->eZoomType  = eDefZoomType;
    2897         [ +  - ]:          1 :             maTabData[nZoomTab]->aZoomX     = aDefZoomX;
    2898         [ +  - ]:          1 :             maTabData[nZoomTab]->aZoomY     = aDefZoomY;
    2899         [ +  - ]:          1 :             maTabData[nZoomTab]->aPageZoomX = aDefPageZoomX;
    2900         [ +  - ]:          1 :             maTabData[nZoomTab]->aPageZoomY = aDefPageZoomY;
    2901                 :            :         }
    2902                 :            : 
    2903         [ +  - ]:        229 :     if (nCount)
    2904         [ +  - ]:        229 :         SetPagebreakMode( bPageMode );
    2905                 :            : 
    2906                 :            :     // #i47426# write view options to document, needed e.g. for Excel export
    2907         [ +  - ]:        229 :     pDoc->SetViewOptions( *pOptions );
    2908                 :        229 : }
    2909                 :            : 
    2910                 :          2 : void ScViewData::SetOptions( const ScViewOptions& rOpt )
    2911                 :            : {
    2912                 :            :     //  if visibility of horiz. ScrollBar is changed, TabBar may have to be resized...
    2913                 :          2 :     sal_Bool bHScrollChanged = ( rOpt.GetOption(VOPT_HSCROLL) != pOptions->GetOption(VOPT_HSCROLL) );
    2914                 :            : 
    2915                 :            :     //  if graphics are turned on or off, animation has to be started or stopped
    2916                 :            :     //  graphics are controlled by VOBJ_TYPE_OLE
    2917                 :          2 :     sal_Bool bGraphicsChanged = ( pOptions->GetObjMode(VOBJ_TYPE_OLE) !=
    2918                 :          2 :                                    rOpt.GetObjMode(VOBJ_TYPE_OLE) );
    2919                 :            : 
    2920                 :          2 :     *pOptions = rOpt;
    2921                 :            :     OSL_ENSURE( pView, "No View" );
    2922                 :            : 
    2923         [ +  - ]:          2 :     if( pView )
    2924                 :            :     {
    2925                 :          2 :         pView->ViewOptionsHasChanged( bHScrollChanged, bGraphicsChanged );
    2926                 :            :     }
    2927                 :          2 : }
    2928                 :            : 
    2929                 :          0 : Point ScViewData::GetMousePosPixel()
    2930                 :            : {
    2931                 :            :     OSL_ENSURE( pView, "GetMousePosPixel() ohne View" );
    2932                 :          0 :     return pView->GetMousePosPixel();
    2933                 :            : }
    2934                 :            : 
    2935                 :          0 : void ScViewData::UpdateInputHandler( sal_Bool bForce, sal_Bool bStopEditing )
    2936                 :            : {
    2937         [ #  # ]:          0 :     if (pViewShell)
    2938                 :          0 :         pViewShell->UpdateInputHandler( bForce, bStopEditing );
    2939                 :          0 : }
    2940                 :            : 
    2941                 :          0 : sal_Bool ScViewData::IsOle()
    2942                 :            : {
    2943 [ #  # ][ #  # ]:          0 :     return pDocShell && pDocShell->IsOle();
    2944                 :            : }
    2945                 :            : 
    2946                 :          0 : sal_Bool ScViewData::UpdateFixX( SCTAB nTab )               // sal_True = Wert geaendert
    2947                 :            : {
    2948         [ #  # ]:          0 :     if (!ValidTab(nTab))        // Default
    2949                 :          0 :         nTab=nTabNo;        // akuelle Tabelle
    2950                 :            : 
    2951 [ #  # ][ #  # ]:          0 :     if (!pView || maTabData[nTab]->eHSplitMode != SC_SPLIT_FIX)
                 [ #  # ]
    2952                 :          0 :         return false;
    2953                 :            : 
    2954                 :          0 :     ScDocument* pLocalDoc = GetDocument();
    2955         [ #  # ]:          0 :     if (!pLocalDoc->HasTable(nTab))          // if called from reload, the sheet may not exist
    2956                 :          0 :         return false;
    2957                 :            : 
    2958                 :          0 :     SCCOL nFix = maTabData[nTab]->nFixPosX;
    2959                 :          0 :     long nNewPos = 0;
    2960         [ #  # ]:          0 :     for (SCCOL nX=maTabData[nTab]->nPosX[SC_SPLIT_LEFT]; nX<nFix; nX++)
    2961                 :            :     {
    2962                 :          0 :         sal_uInt16 nTSize = pLocalDoc->GetColWidth( nX, nTab );
    2963         [ #  # ]:          0 :         if (nTSize)
    2964                 :            :         {
    2965                 :          0 :             long nPix = ToPixel( nTSize, nPPTX );
    2966                 :          0 :             nNewPos += nPix;
    2967                 :            :         }
    2968                 :            :     }
    2969                 :          0 :     nNewPos += pView->GetGridOffset().X();
    2970         [ #  # ]:          0 :     if (nNewPos != maTabData[nTab]->nHSplitPos)
    2971                 :            :     {
    2972                 :          0 :         maTabData[nTab]->nHSplitPos = nNewPos;
    2973         [ #  # ]:          0 :         if (nTab == nTabNo)
    2974                 :          0 :             RecalcPixPos();                 //! sollte nicht noetig sein !!!
    2975                 :          0 :         return sal_True;
    2976                 :            :     }
    2977                 :            : 
    2978                 :          0 :     return false;
    2979                 :            : }
    2980                 :            : 
    2981                 :          0 : sal_Bool ScViewData::UpdateFixY( SCTAB nTab )               // sal_True = Wert geaendert
    2982                 :            : {
    2983         [ #  # ]:          0 :     if (!ValidTab(nTab))        // Default
    2984                 :          0 :         nTab=nTabNo;        // akuelle Tabelle
    2985                 :            : 
    2986 [ #  # ][ #  # ]:          0 :     if (!pView || maTabData[nTab]->eVSplitMode != SC_SPLIT_FIX)
                 [ #  # ]
    2987                 :          0 :         return false;
    2988                 :            : 
    2989                 :          0 :     ScDocument* pLocalDoc = GetDocument();
    2990         [ #  # ]:          0 :     if (!pLocalDoc->HasTable(nTab))          // if called from reload, the sheet may not exist
    2991                 :          0 :         return false;
    2992                 :            : 
    2993                 :          0 :     SCROW nFix = maTabData[nTab]->nFixPosY;
    2994                 :          0 :     long nNewPos = 0;
    2995         [ #  # ]:          0 :     for (SCROW nY=maTabData[nTab]->nPosY[SC_SPLIT_TOP]; nY<nFix; nY++)
    2996                 :            :     {
    2997                 :          0 :         sal_uInt16 nTSize = pLocalDoc->GetRowHeight( nY, nTab );
    2998         [ #  # ]:          0 :         if (nTSize)
    2999                 :            :         {
    3000                 :          0 :             long nPix = ToPixel( nTSize, nPPTY );
    3001                 :          0 :             nNewPos += nPix;
    3002                 :            :         }
    3003                 :            :     }
    3004                 :          0 :     nNewPos += pView->GetGridOffset().Y();
    3005         [ #  # ]:          0 :     if (nNewPos != maTabData[nTab]->nVSplitPos)
    3006                 :            :     {
    3007                 :          0 :         maTabData[nTab]->nVSplitPos = nNewPos;
    3008         [ #  # ]:          0 :         if (nTab == nTabNo)
    3009                 :          0 :             RecalcPixPos();                 //! sollte nicht noetig sein !!!
    3010                 :          0 :         return sal_True;
    3011                 :            :     }
    3012                 :            : 
    3013                 :          0 :     return false;
    3014                 :            : }
    3015                 :            : 
    3016                 :          0 : void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const
    3017                 :            : {
    3018                 :          0 :     ScDocument* pLocalDoc = GetDocument();
    3019                 :          0 :     sal_Bool bOnlineSpell = pLocalDoc->GetDocOptions().IsAutoSpell();
    3020                 :            : 
    3021                 :          0 :     sal_uLong nCntrl = rOutl.GetControlWord();
    3022                 :          0 :     nCntrl |= EE_CNTRL_URLSFXEXECUTE;
    3023                 :          0 :     nCntrl |= EE_CNTRL_MARKFIELDS;
    3024                 :          0 :     nCntrl |= EE_CNTRL_AUTOCORRECT;
    3025         [ #  # ]:          0 :     if( bOnlineSpell )
    3026                 :          0 :         nCntrl |= EE_CNTRL_ONLINESPELLING;
    3027                 :            :     else
    3028                 :          0 :         nCntrl &= ~EE_CNTRL_ONLINESPELLING;
    3029                 :          0 :     rOutl.SetControlWord(nCntrl);
    3030                 :            : 
    3031                 :          0 :     rOutl.SetCalcFieldValueHdl( LINK( SC_MOD(), ScModule, CalcFieldValueHdl ) );
    3032                 :            : 
    3033                 :            :     //  don't call GetSpellChecker if online spelling isn't enabled.
    3034                 :            :     //  The language for AutoCorrect etc. is taken from the pool defaults
    3035                 :            :     //  (set in ScDocument::UpdateDrawLanguages)
    3036                 :            : 
    3037         [ #  # ]:          0 :     if ( bOnlineSpell )
    3038                 :            :     {
    3039         [ #  # ]:          0 :         com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellChecker1> xXSpellChecker1( LinguMgr::GetSpellChecker() );
    3040         [ #  # ]:          0 :         rOutl.SetSpeller( xXSpellChecker1 );
    3041                 :            :     }
    3042                 :            : 
    3043                 :            :     rOutl.SetDefaultHorizontalTextDirection(
    3044                 :          0 :         (EEHorizontalTextDirection)pLocalDoc->GetEditTextDirection( nTabNo ) );
    3045                 :          0 : }
    3046                 :            : 
    3047                 :          7 : ScAddress ScViewData::GetCurPos() const
    3048                 :            : {
    3049                 :          7 :     return ScAddress( GetCurX(), GetCurY(), GetTabNo() );
    3050                 :            : }
    3051                 :            : 
    3052                 :            : 
    3053                 :      18253 : void ScViewData::AddPixelsWhile( long & rScrY, long nEndPixels, SCROW & rPosY,
    3054                 :            :         SCROW nEndRow, double nPPTY, const ScDocument * pDoc, SCTAB nTabNo )
    3055                 :            : {
    3056                 :      18253 :     SCROW nRow = rPosY;
    3057 [ +  + ][ +  - ]:      44468 :     while (rScrY <= nEndPixels && nRow <= nEndRow)
                 [ +  + ]
    3058                 :            :     {
    3059                 :            :         SCROW nHeightEndRow;
    3060         [ +  - ]:      26215 :         sal_uInt16 nHeight = pDoc->GetRowHeight( nRow, nTabNo, NULL, &nHeightEndRow);
    3061         [ -  + ]:      26215 :         if (nHeightEndRow > nEndRow)
    3062                 :          0 :             nHeightEndRow = nEndRow;
    3063         [ +  + ]:      26215 :         if (!nHeight)
    3064                 :        472 :             nRow = nHeightEndRow + 1;
    3065                 :            :         else
    3066                 :            :         {
    3067                 :      25743 :             SCROW nRows = nHeightEndRow - nRow + 1;
    3068                 :      25743 :             sal_Int64 nPixel = ToPixel( nHeight, nPPTY);
    3069                 :      25743 :             sal_Int64 nAdd = nPixel * nRows;
    3070         [ +  + ]:      25743 :             if (nAdd + rScrY > nEndPixels)
    3071                 :            :             {
    3072                 :      18253 :                 sal_Int64 nDiff = rScrY + nAdd - nEndPixels;
    3073                 :      18253 :                 nRows -= static_cast<SCROW>(nDiff / nPixel);
    3074                 :      18253 :                 nAdd = nPixel * nRows;
    3075                 :            :                 // We're looking for a value that satisfies loop condition.
    3076         [ +  + ]:      18253 :                 if (nAdd + rScrY <= nEndPixels)
    3077                 :            :                 {
    3078                 :       2422 :                     ++nRows;
    3079                 :       2422 :                     nAdd += nPixel;
    3080                 :            :                 }
    3081                 :            :             }
    3082                 :      25743 :             rScrY += static_cast<long>(nAdd);
    3083                 :      26215 :             nRow += nRows;
    3084                 :            :         }
    3085                 :            :     }
    3086         [ +  - ]:      18253 :     if (nRow > rPosY)
    3087                 :      18253 :         --nRow;
    3088                 :      18253 :     rPosY = nRow;
    3089                 :      18253 : }
    3090                 :            : 
    3091                 :            : 
    3092                 :          0 : void ScViewData::AddPixelsWhileBackward( long & rScrY, long nEndPixels,
    3093                 :            :         SCROW & rPosY, SCROW nStartRow, double nPPTY, const ScDocument * pDoc,
    3094                 :            :         SCTAB nTabNo )
    3095                 :            : {
    3096                 :          0 :     SCROW nRow = rPosY;
    3097 [ #  # ][ #  # ]:          0 :     while (rScrY <= nEndPixels && nRow >= nStartRow)
                 [ #  # ]
    3098                 :            :     {
    3099                 :            :         SCROW nHeightStartRow;
    3100         [ #  # ]:          0 :         sal_uInt16 nHeight = pDoc->GetRowHeight( nRow, nTabNo, &nHeightStartRow, NULL);
    3101         [ #  # ]:          0 :         if (nHeightStartRow < nStartRow)
    3102                 :          0 :             nHeightStartRow = nStartRow;
    3103         [ #  # ]:          0 :         if (!nHeight)
    3104                 :          0 :             nRow = nHeightStartRow - 1;
    3105                 :            :         else
    3106                 :            :         {
    3107                 :          0 :             SCROW nRows = nRow - nHeightStartRow + 1;
    3108                 :          0 :             sal_Int64 nPixel = ToPixel( nHeight, nPPTY);
    3109                 :          0 :             sal_Int64 nAdd = nPixel * nRows;
    3110         [ #  # ]:          0 :             if (nAdd + rScrY > nEndPixels)
    3111                 :            :             {
    3112                 :          0 :                 sal_Int64 nDiff = nAdd + rScrY - nEndPixels;
    3113                 :          0 :                 nRows -= static_cast<SCROW>(nDiff / nPixel);
    3114                 :          0 :                 nAdd = nPixel * nRows;
    3115                 :            :                 // We're looking for a value that satisfies loop condition.
    3116         [ #  # ]:          0 :                 if (nAdd + rScrY <= nEndPixels)
    3117                 :            :                 {
    3118                 :          0 :                     ++nRows;
    3119                 :          0 :                     nAdd += nPixel;
    3120                 :            :                 }
    3121                 :            :             }
    3122                 :          0 :             rScrY += static_cast<long>(nAdd);
    3123                 :          0 :             nRow -= nRows;
    3124                 :            :         }
    3125                 :            :     }
    3126         [ #  # ]:          0 :     if (nRow < rPosY)
    3127                 :          0 :         ++nRow;
    3128                 :          0 :     rPosY = nRow;
    3129                 :          0 : }
    3130                 :            : 
    3131                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10