LCOV - code coverage report
Current view: top level - sc/source/ui/unoobj - viewuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 428 1320 32.4 %
Date: 2012-08-25 Functions: 55 122 45.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 441 2736 16.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/awt/MouseButton.hpp>
      31                 :            : #include <com/sun/star/script/vba/VBAEventId.hpp>
      32                 :            : #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
      33                 :            : #include <com/sun/star/view/DocumentZoomType.hpp>
      34                 :            : 
      35                 :            : #include <editeng/outliner.hxx>
      36                 :            : #include <svx/fmdpage.hxx>
      37                 :            : #include <svx/svditer.hxx>
      38                 :            : #include <svx/svdmark.hxx>
      39                 :            : #include <svx/svdouno.hxx>
      40                 :            : #include <svx/svdpage.hxx>
      41                 :            : #include <svx/svdpagv.hxx>
      42                 :            : #include <svx/svdview.hxx>
      43                 :            : #include <svx/unoshape.hxx>
      44                 :            : #include <svx/unoshcol.hxx>
      45                 :            : #include <svx/fmshell.hxx>
      46                 :            : #include <sfx2/bindings.hxx>
      47                 :            : #include <sfx2/dispatch.hxx>
      48                 :            : #include <sfx2/printer.hxx>
      49                 :            : #include <sfx2/request.hxx>
      50                 :            : #include <sfx2/viewfrm.hxx>
      51                 :            : #include <comphelper/servicehelper.hxx>
      52                 :            : #include <toolkit/helper/convert.hxx>
      53                 :            : #include <vcl/svapp.hxx>
      54                 :            : 
      55                 :            : #include "drawsh.hxx"
      56                 :            : #include "drtxtob.hxx"
      57                 :            : #include "transobj.hxx"
      58                 :            : #include "editsh.hxx"
      59                 :            : #include "viewuno.hxx"
      60                 :            : #include "cellsuno.hxx"
      61                 :            : #include "miscuno.hxx"
      62                 :            : #include "tabvwsh.hxx"
      63                 :            : #include "prevwsh.hxx"
      64                 :            : #include "docsh.hxx"
      65                 :            : #include "drwlayer.hxx"
      66                 :            : #include "drawview.hxx"
      67                 :            : #include "fupoor.hxx"
      68                 :            : #include "sc.hrc"
      69                 :            : #include "unonames.hxx"
      70                 :            : #include "scmod.hxx"
      71                 :            : #include "appoptio.hxx"
      72                 :            : #include "gridwin.hxx"
      73                 :            : #include "sheetevents.hxx"
      74                 :            : #include "markdata.hxx"
      75                 :            : #include "AccessibilityHints.hxx"
      76                 :            : #include "scextopt.hxx"
      77                 :            : #include "preview.hxx"
      78                 :            : #include <svx/sdrhittesthelper.hxx>
      79                 :            : #include <boost/foreach.hpp>
      80                 :            : 
      81                 :            : using namespace com::sun::star;
      82                 :            : 
      83                 :            : //------------------------------------------------------------------------
      84                 :            : 
      85                 :            : //! Clipping-Markierungen
      86                 :            : 
      87                 :            : //  alles ohne Which-ID, Map nur fuer PropertySetInfo
      88                 :            : 
      89                 :        229 : const SfxItemPropertyMapEntry* lcl_GetViewOptPropertyMap()
      90                 :            : {
      91                 :            :     static SfxItemPropertyMapEntry aViewOptPropertyMap_Impl[] =
      92                 :            :     {
      93         [ +  - ]:         42 :         {MAP_CHAR_LEN(OLD_UNO_COLROWHDR),   0,  &getBooleanCppuType(),          0, 0},
      94         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_GRIDCOLOR),    0,  &getCppuType((sal_Int32*)0),    0, 0},
      95         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_COLROWHDR),    0,  &getBooleanCppuType(),          0, 0},
      96         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_HORSCROLL),    0,  &getBooleanCppuType(),          0, 0},
      97         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHEETTABS),    0,  &getBooleanCppuType(),          0, 0},
      98         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_VERTSCROLL),   0,  &getBooleanCppuType(),          0, 0},
      99         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_HIDESPELL),    0,  &getBooleanCppuType(),          0, 0},  /* deprecated #i91949 */
     100         [ +  - ]:         42 :         {MAP_CHAR_LEN(OLD_UNO_HORSCROLL),   0,  &getBooleanCppuType(),          0, 0},
     101         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_OUTLSYMB),     0,  &getBooleanCppuType(),          0, 0},
     102         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_VALUEHIGH),    0,  &getBooleanCppuType(),          0, 0},
     103         [ +  - ]:         42 :         {MAP_CHAR_LEN(OLD_UNO_OUTLSYMB),    0,  &getBooleanCppuType(),          0, 0},
     104         [ +  - ]:         42 :         {MAP_CHAR_LEN(OLD_UNO_SHEETTABS),   0,  &getBooleanCppuType(),          0, 0},
     105         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWANCHOR),   0,  &getBooleanCppuType(),          0, 0},
     106         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWCHARTS),   0,  &getCppuType((sal_Int16*)0),    0, 0},
     107         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWDRAW),     0,  &getCppuType((sal_Int16*)0),    0, 0},
     108         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWFORM),     0,  &getBooleanCppuType(),          0, 0},
     109         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWGRID),     0,  &getBooleanCppuType(),          0, 0},
     110         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWHELP),     0,  &getBooleanCppuType(),          0, 0},
     111         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWNOTES),    0,  &getBooleanCppuType(),          0, 0},
     112         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWOBJ),      0,  &getCppuType((sal_Int16*)0),    0, 0},
     113         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWPAGEBR),   0,  &getBooleanCppuType(),          0, 0},
     114         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_SHOWZERO),     0,  &getBooleanCppuType(),          0, 0},
     115         [ +  - ]:         42 :         {MAP_CHAR_LEN(OLD_UNO_VALUEHIGH),   0,  &getBooleanCppuType(),          0, 0},
     116         [ +  - ]:         42 :         {MAP_CHAR_LEN(OLD_UNO_VERTSCROLL),  0,  &getBooleanCppuType(),          0, 0},
     117         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_VISAREA),      0,  &getCppuType((awt::Rectangle*)0), 0, 0},
     118         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_ZOOMTYPE),     0,  &getCppuType((sal_Int16*)0),    0, 0},
     119         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_ZOOMVALUE),    0,  &getCppuType((sal_Int16*)0),    0, 0},
     120         [ +  - ]:         42 :         {MAP_CHAR_LEN(SC_UNO_VISAREASCREEN),0,  &getCppuType((awt::Rectangle*)0), 0, 0},
     121                 :            :         {0,0,0,0,0,0}
     122 [ +  + ][ +  - ]:        271 :     };
                 [ #  # ]
     123                 :        229 :     return aViewOptPropertyMap_Impl;
     124                 :            : }
     125                 :            : 
     126                 :            : //------------------------------------------------------------------------
     127                 :            : 
     128                 :            : #define SCTABVIEWOBJ_SERVICE        "com.sun.star.sheet.SpreadsheetView"
     129                 :            : #define SCVIEWSETTINGS_SERVICE      "com.sun.star.sheet.SpreadsheetViewSettings"
     130                 :            : 
     131         [ #  # ]:          0 : SC_SIMPLE_SERVICE_INFO( ScViewPaneBase, "ScViewPaneObj", "com.sun.star.sheet.SpreadsheetViewPane" )
     132                 :            : 
     133                 :            : //------------------------------------------------------------------------
     134                 :            : 
     135                 :        231 : ScViewPaneBase::ScViewPaneBase(ScTabViewShell* pViewSh, sal_uInt16 nP) :
     136                 :            :     pViewShell( pViewSh ),
     137         [ +  - ]:        231 :     nPane( nP )
     138                 :            : {
     139         [ +  - ]:        231 :     if (pViewShell)
     140         [ +  - ]:        231 :         StartListening(*pViewShell);
     141                 :        231 : }
     142                 :            : 
     143         [ +  - ]:        205 : ScViewPaneBase::~ScViewPaneBase()
     144                 :            : {
     145         [ -  + ]:        205 :     if (pViewShell)
     146         [ #  # ]:          0 :         EndListening(*pViewShell);
     147         [ -  + ]:        205 : }
     148                 :            : 
     149                 :        227 : void ScViewPaneBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
     150                 :            : {
     151   [ +  -  +  - ]:        454 :     if ( rHint.ISA( SfxSimpleHint ) &&
                 [ +  - ]
     152                 :        227 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
     153                 :        227 :         pViewShell = NULL;
     154                 :        227 : }
     155                 :            : 
     156                 :      54061 : uno::Any SAL_CALL ScViewPaneBase::queryInterface( const uno::Type& rType )
     157                 :            :                                                 throw(uno::RuntimeException)
     158                 :            : {
     159 [ -  + ][ #  # ]:      54061 :     SC_QUERYINTERFACE( sheet::XViewPane )
     160 [ -  + ][ #  # ]:      54061 :     SC_QUERYINTERFACE( sheet::XCellRangeReferrer )
     161 [ -  + ][ #  # ]:      54061 :     SC_QUERYINTERFACE( view::XFormLayerAccess )
     162 [ +  + ][ +  - ]:      54061 :     SC_QUERYINTERFACE( view::XControlAccess )
     163 [ -  + ][ #  # ]:      54059 :     SC_QUERYINTERFACE( lang::XServiceInfo )
     164 [ +  + ][ +  - ]:      54059 :     SC_QUERYINTERFACE( lang::XTypeProvider )
     165                 :            : 
     166                 :      54061 :     return uno::Any();          // OWeakObject is in derived objects
     167                 :            : }
     168                 :            : 
     169                 :          2 : uno::Sequence<uno::Type> SAL_CALL ScViewPaneBase::getTypes() throw(uno::RuntimeException)
     170                 :            : {
     171 [ +  - ][ +  - ]:          2 :     static uno::Sequence<uno::Type> aTypes;
         [ +  - ][ #  # ]
     172         [ +  - ]:          2 :     if ( aTypes.getLength() == 0 )
     173                 :            :     {
     174                 :          2 :         aTypes.realloc(5);
     175                 :          2 :         uno::Type* pPtr = aTypes.getArray();
     176                 :          2 :         pPtr[0] = getCppuType((const uno::Reference<sheet::XViewPane>*)0);
     177                 :          2 :         pPtr[1] = getCppuType((const uno::Reference<sheet::XCellRangeReferrer>*)0);
     178                 :          2 :         pPtr[2] = getCppuType((const uno::Reference<view::XFormLayerAccess>*)0);
     179                 :          2 :         pPtr[3] = getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
     180                 :          2 :         pPtr[4] = getCppuType((const uno::Reference<lang::XTypeProvider>*)0);
     181                 :            :     }
     182                 :          2 :     return aTypes;
     183                 :            : }
     184                 :            : 
     185                 :            : namespace
     186                 :            : {
     187                 :            :     class theScViewPaneBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theScViewPaneBaseImplementationId > {};
     188                 :            : }
     189                 :            : 
     190                 :          0 : uno::Sequence<sal_Int8> SAL_CALL ScViewPaneBase::getImplementationId()
     191                 :            :                                                     throw(uno::RuntimeException)
     192                 :            : {
     193                 :          0 :     return theScViewPaneBaseImplementationId::get().getSeq();
     194                 :            : }
     195                 :            : 
     196                 :            : // XViewPane
     197                 :            : 
     198                 :          0 : sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleColumn() throw(uno::RuntimeException)
     199                 :            : {
     200         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     201         [ #  # ]:          0 :     if (pViewShell)
     202                 :            :     {
     203                 :          0 :         ScViewData* pViewData = pViewShell->GetViewData();
     204                 :            :         ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
     205                 :            :                                 pViewData->GetActivePart() :
     206         [ #  # ]:          0 :                                 (ScSplitPos) nPane;
     207                 :          0 :         ScHSplitPos eWhichH = WhichH( eWhich );
     208                 :            : 
     209                 :          0 :         return pViewData->GetPosX( eWhichH );
     210                 :            :     }
     211                 :            :     OSL_FAIL("keine View ?!?"); //! Exception?
     212         [ #  # ]:          0 :     return 0;
     213                 :            : }
     214                 :            : 
     215                 :          0 : void SAL_CALL ScViewPaneBase::setFirstVisibleColumn( sal_Int32 nFirstVisibleColumn )
     216                 :            :                                                 throw(uno::RuntimeException)
     217                 :            : {
     218         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     219         [ #  # ]:          0 :     if (pViewShell)
     220                 :            :     {
     221                 :          0 :         ScViewData* pViewData = pViewShell->GetViewData();
     222                 :            :         ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
     223                 :            :                                 pViewData->GetActivePart() :
     224         [ #  # ]:          0 :                                 (ScSplitPos) nPane;
     225                 :          0 :         ScHSplitPos eWhichH = WhichH( eWhich );
     226                 :            : 
     227                 :          0 :         long nDeltaX = ((long)nFirstVisibleColumn) - pViewData->GetPosX( eWhichH );
     228         [ #  # ]:          0 :         pViewShell->ScrollX( nDeltaX, eWhichH );
     229         [ #  # ]:          0 :     }
     230                 :          0 : }
     231                 :            : 
     232                 :          0 : sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleRow() throw(uno::RuntimeException)
     233                 :            : {
     234         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     235         [ #  # ]:          0 :     if (pViewShell)
     236                 :            :     {
     237                 :          0 :         ScViewData* pViewData = pViewShell->GetViewData();
     238                 :            :         ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
     239                 :            :                                 pViewData->GetActivePart() :
     240         [ #  # ]:          0 :                                 (ScSplitPos) nPane;
     241                 :          0 :         ScVSplitPos eWhichV = WhichV( eWhich );
     242                 :            : 
     243                 :          0 :         return pViewData->GetPosY( eWhichV );
     244                 :            :     }
     245                 :            :     OSL_FAIL("keine View ?!?"); //! Exception?
     246         [ #  # ]:          0 :     return 0;
     247                 :            : }
     248                 :            : 
     249                 :          0 : void SAL_CALL ScViewPaneBase::setFirstVisibleRow( sal_Int32 nFirstVisibleRow )
     250                 :            :                                                 throw(uno::RuntimeException)
     251                 :            : {
     252         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     253         [ #  # ]:          0 :     if (pViewShell)
     254                 :            :     {
     255                 :          0 :         ScViewData* pViewData = pViewShell->GetViewData();
     256                 :            :         ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
     257                 :            :                                 pViewData->GetActivePart() :
     258         [ #  # ]:          0 :                                 (ScSplitPos) nPane;
     259                 :          0 :         ScVSplitPos eWhichV = WhichV( eWhich );
     260                 :            : 
     261                 :          0 :         long nDeltaY = ((long)nFirstVisibleRow) - pViewData->GetPosY( eWhichV );
     262         [ #  # ]:          0 :         pViewShell->ScrollY( nDeltaY, eWhichV );
     263         [ #  # ]:          0 :     }
     264                 :          0 : }
     265                 :            : 
     266                 :          0 : table::CellRangeAddress SAL_CALL ScViewPaneBase::getVisibleRange() throw(uno::RuntimeException)
     267                 :            : {
     268         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     269                 :          0 :     table::CellRangeAddress aAdr;
     270         [ #  # ]:          0 :     if (pViewShell)
     271                 :            :     {
     272                 :          0 :         ScViewData* pViewData = pViewShell->GetViewData();
     273                 :            :         ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
     274                 :            :                                 pViewData->GetActivePart() :
     275         [ #  # ]:          0 :                                 (ScSplitPos) nPane;
     276                 :          0 :         ScHSplitPos eWhichH = WhichH( eWhich );
     277                 :          0 :         ScVSplitPos eWhichV = WhichV( eWhich );
     278                 :            : 
     279                 :            :         //  VisibleCellsX gibt nur komplett sichtbare Zellen,
     280                 :            :         //  VisibleRange in Excel auch teilweise sichtbare.
     281                 :            :         //! anpassen ???
     282                 :            : 
     283         [ #  # ]:          0 :         SCCOL nVisX = pViewData->VisibleCellsX( eWhichH );
     284         [ #  # ]:          0 :         SCROW nVisY = pViewData->VisibleCellsY( eWhichV );
     285         [ #  # ]:          0 :         if (!nVisX) nVisX = 1;  // irgendwas muss ja im Range sein
     286         [ #  # ]:          0 :         if (!nVisY) nVisY = 1;
     287                 :          0 :         aAdr.Sheet       = pViewData->GetTabNo();
     288                 :          0 :         aAdr.StartColumn = pViewData->GetPosX( eWhichH );
     289                 :          0 :         aAdr.StartRow    = pViewData->GetPosY( eWhichV );
     290                 :          0 :         aAdr.EndColumn   = aAdr.StartColumn + nVisX - 1;
     291                 :          0 :         aAdr.EndRow      = aAdr.StartRow    + nVisY - 1;
     292                 :            :     }
     293         [ #  # ]:          0 :     return aAdr;
     294                 :            : }
     295                 :            : 
     296                 :            : // XCellRangeSource
     297                 :            : 
     298                 :          0 : uno::Reference<table::XCellRange> SAL_CALL ScViewPaneBase::getReferredCells()
     299                 :            :                                                 throw(uno::RuntimeException)
     300                 :            : {
     301         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     302         [ #  # ]:          0 :     if (pViewShell)
     303                 :            :     {
     304                 :          0 :         ScDocShell* pDocSh = pViewShell->GetViewData()->GetDocShell();
     305                 :            : 
     306         [ #  # ]:          0 :         table::CellRangeAddress aAdr(getVisibleRange());        //! Hilfsfunktion mit ScRange?
     307                 :            :         ScRange aRange( (SCCOL)aAdr.StartColumn, (SCROW)aAdr.StartRow, aAdr.Sheet,
     308                 :          0 :                         (SCCOL)aAdr.EndColumn, (SCROW)aAdr.EndRow, aAdr.Sheet );
     309         [ #  # ]:          0 :         if ( aRange.aStart == aRange.aEnd )
     310 [ #  # ][ #  # ]:          0 :             return new ScCellObj( pDocSh, aRange.aStart );
                 [ #  # ]
     311                 :            :         else
     312 [ #  # ][ #  # ]:          0 :             return new ScCellRangeObj( pDocSh, aRange );
                 [ #  # ]
     313                 :            :     }
     314                 :            : 
     315 [ #  # ][ #  # ]:          0 :     return NULL;
     316                 :            : }
     317                 :            : 
     318                 :            : namespace
     319                 :            : {
     320                 :          2 :     bool lcl_prepareFormShellCall( ScTabViewShell* _pViewShell, sal_uInt16 _nPane, FmFormShell*& _rpFormShell, Window*& _rpWindow, SdrView*& _rpSdrView )
     321                 :            :     {
     322         [ -  + ]:          2 :         if ( !_pViewShell )
     323                 :          0 :             return false;
     324                 :            : 
     325                 :          2 :         ScViewData* pViewData = _pViewShell->GetViewData();
     326                 :            :         ScSplitPos eWhich = ( _nPane == SC_VIEWPANE_ACTIVE ) ?
     327                 :            :                                 pViewData->GetActivePart() :
     328         [ +  - ]:          2 :                                 (ScSplitPos) _nPane;
     329                 :          2 :         _rpWindow = _pViewShell->GetWindowByPos( eWhich );
     330                 :          2 :         _rpSdrView = _pViewShell->GetSdrView();
     331                 :          2 :         _rpFormShell = _pViewShell->GetFormShell();
     332 [ +  - ][ +  - ]:          2 :         return ( _rpFormShell != NULL ) && ( _rpSdrView != NULL )&& ( _rpWindow != NULL );
                 [ +  - ]
     333                 :            :     }
     334                 :            : }
     335                 :            : 
     336                 :            : // XFormLayerAccess
     337                 :          0 : uno::Reference< form::runtime::XFormController > SAL_CALL ScViewPaneBase::getFormController( const uno::Reference< form::XForm >& _Form ) throw (uno::RuntimeException)
     338                 :            : {
     339         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     340                 :            : 
     341                 :          0 :     uno::Reference< form::runtime::XFormController > xController;
     342                 :            : 
     343                 :          0 :     Window* pWindow( NULL );
     344                 :          0 :     SdrView* pSdrView( NULL );
     345                 :          0 :     FmFormShell* pFormShell( NULL );
     346 [ #  # ][ #  # ]:          0 :     if ( lcl_prepareFormShellCall( pViewShell, nPane, pFormShell, pWindow, pSdrView ) )
     347 [ #  # ][ #  # ]:          0 :         xController = pFormShell->GetFormController( _Form, *pSdrView, *pWindow );
     348                 :            : 
     349         [ #  # ]:          0 :     return xController;
     350                 :            : }
     351                 :            : 
     352                 :          0 : ::sal_Bool SAL_CALL ScViewPaneBase::isFormDesignMode(  ) throw (uno::RuntimeException)
     353                 :            : {
     354         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     355                 :            : 
     356                 :          0 :     sal_Bool bIsFormDesignMode( sal_True );
     357                 :            : 
     358         [ #  # ]:          0 :     FmFormShell* pFormShell( pViewShell ? pViewShell->GetFormShell() : NULL );
     359         [ #  # ]:          0 :     if ( pFormShell )
     360                 :          0 :         bIsFormDesignMode = pFormShell->IsDesignMode();
     361                 :            : 
     362         [ #  # ]:          0 :     return bIsFormDesignMode;
     363                 :            : }
     364                 :            : 
     365                 :          0 : void SAL_CALL ScViewPaneBase::setFormDesignMode( ::sal_Bool _DesignMode ) throw (uno::RuntimeException)
     366                 :            : {
     367         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     368                 :            : 
     369                 :          0 :     Window* pWindow( NULL );
     370                 :          0 :     SdrView* pSdrView( NULL );
     371                 :          0 :     FmFormShell* pFormShell( NULL );
     372 [ #  # ][ #  # ]:          0 :     if ( lcl_prepareFormShellCall( pViewShell, nPane, pFormShell, pWindow, pSdrView ) )
     373 [ #  # ][ #  # ]:          0 :         pFormShell->SetDesignMode( _DesignMode );
     374                 :          0 : }
     375                 :            : 
     376                 :            : // XControlAccess
     377                 :            : 
     378                 :          2 : uno::Reference<awt::XControl> SAL_CALL ScViewPaneBase::getControl(
     379                 :            :                             const uno::Reference<awt::XControlModel>& xModel )
     380                 :            :                 throw(container::NoSuchElementException, uno::RuntimeException)
     381                 :            : {
     382         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     383                 :            : 
     384                 :          2 :     uno::Reference<awt::XControl> xRet;
     385                 :            : 
     386                 :          2 :     Window* pWindow( NULL );
     387                 :          2 :     SdrView* pSdrView( NULL );
     388                 :          2 :     FmFormShell* pFormShell( NULL );
     389 [ +  - ][ +  - ]:          2 :     if ( lcl_prepareFormShellCall( pViewShell, nPane, pFormShell, pWindow, pSdrView ) )
     390         [ +  - ]:          2 :         pFormShell->GetFormControl( xModel, *pSdrView, *pWindow, xRet );
     391                 :            : 
     392         [ -  + ]:          2 :     if ( !xRet.is() )
     393         [ #  # ]:          0 :         throw container::NoSuchElementException();      // no control found
     394                 :            : 
     395         [ +  - ]:          2 :     return xRet;
     396                 :            : }
     397                 :            : 
     398                 :          0 : awt::Rectangle ScViewPaneBase::GetVisArea() const
     399                 :            : {
     400                 :          0 :     awt::Rectangle aVisArea;
     401         [ #  # ]:          0 :     if (pViewShell)
     402                 :            :     {
     403                 :            :         ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ?
     404                 :          0 :                                 pViewShell->GetViewData()->GetActivePart() :
     405         [ #  # ]:          0 :                                 (ScSplitPos) nPane;
     406                 :          0 :         ScGridWindow* pWindow = (ScGridWindow*)pViewShell->GetWindowByPos(eWhich);
     407                 :          0 :         ScDocument* pDoc = pViewShell->GetViewData()->GetDocument();
     408 [ #  # ][ #  # ]:          0 :         if (pWindow && pDoc)
     409                 :            :         {
     410                 :            :             ScHSplitPos eWhichH = ((eWhich == SC_SPLIT_TOPLEFT) || (eWhich == SC_SPLIT_BOTTOMLEFT)) ?
     411 [ #  # ][ #  # ]:          0 :                                     SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
     412                 :            :             ScVSplitPos eWhichV = ((eWhich == SC_SPLIT_TOPLEFT) || (eWhich == SC_SPLIT_TOPRIGHT)) ?
     413 [ #  # ][ #  # ]:          0 :                                     SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
     414                 :          0 :             ScAddress aCell(pViewShell->GetViewData()->GetPosX(eWhichH),
     415                 :            :                 pViewShell->GetViewData()->GetPosY(eWhichV),
     416                 :          0 :                 pViewShell->GetViewData()->GetTabNo());
     417         [ #  # ]:          0 :             Rectangle aCellRect( pDoc->GetMMRect( aCell.Col(), aCell.Row(), aCell.Col(), aCell.Row(), aCell.Tab() ) );
     418 [ #  # ][ #  # ]:          0 :             Size aVisSize( pWindow->PixelToLogic( pWindow->GetSizePixel(), pWindow->GetDrawMapMode( sal_True ) ) );
         [ #  # ][ #  # ]
     419                 :          0 :             Point aVisPos( aCellRect.TopLeft() );
     420 [ #  # ][ #  # ]:          0 :             if ( pDoc->IsLayoutRTL( aCell.Tab() ) )
     421                 :            :             {
     422         [ #  # ]:          0 :                 aVisPos = aCellRect.TopRight();
     423                 :          0 :                 aVisPos.X() -= aVisSize.Width();
     424                 :            :             }
     425         [ #  # ]:          0 :             Rectangle aVisRect( aVisPos, aVisSize );
     426         [ #  # ]:          0 :             aVisArea = AWTRectangle(aVisRect);
     427                 :            :         }
     428                 :            :     }
     429                 :          0 :     return aVisArea;
     430                 :            : }
     431                 :            : 
     432                 :            : //------------------------------------------------------------------------
     433                 :            : 
     434                 :          2 : ScViewPaneObj::ScViewPaneObj(ScTabViewShell* pViewSh, sal_uInt16 nP) :
     435                 :          2 :     ScViewPaneBase( pViewSh, nP )
     436                 :            : {
     437                 :          2 : }
     438                 :            : 
     439         [ +  - ]:          2 : ScViewPaneObj::~ScViewPaneObj()
     440                 :            : {
     441         [ -  + ]:          4 : }
     442                 :            : 
     443                 :          2 : uno::Any SAL_CALL ScViewPaneObj::queryInterface( const uno::Type& rType )
     444                 :            :                                                 throw(uno::RuntimeException)
     445                 :            : {
     446                 :            :     //  ScViewPaneBase has everything except OWeakObject
     447                 :            : 
     448                 :          2 :     uno::Any aRet(ScViewPaneBase::queryInterface( rType ));
     449         [ +  - ]:          2 :     if (!aRet.hasValue())
     450         [ +  - ]:          2 :         aRet = OWeakObject::queryInterface( rType );
     451                 :          2 :     return aRet;
     452                 :            : }
     453                 :            : 
     454                 :         13 : void SAL_CALL ScViewPaneObj::acquire() throw()
     455                 :            : {
     456                 :         13 :     OWeakObject::acquire();
     457                 :         13 : }
     458                 :            : 
     459                 :         13 : void SAL_CALL ScViewPaneObj::release() throw()
     460                 :            : {
     461                 :         13 :     OWeakObject::release();
     462                 :         13 : }
     463                 :            : 
     464                 :            : // To process sheet compatibile event
     465                 :            : typedef ::cppu::WeakImplHelper2< awt::XEnhancedMouseClickHandler, view::XSelectionChangeListener > TabViewEventListener_BASE;
     466                 :            : class ScTabViewEventListener: public TabViewEventListener_BASE
     467                 :            : {
     468                 :            : private:
     469                 :            :     ScTabViewObj* pViewObj;
     470                 :            :     uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper;
     471                 :            :     sal_Bool bDelaySelectionEvent;
     472                 :            :     sal_Bool bSelectionChangeOccurred;
     473                 :            : 
     474                 :            :     void fireSelectionChangeEvent();
     475                 :            : 
     476                 :            : public:
     477                 :            :     ScTabViewEventListener( ScTabViewObj* pObj, uno::Reference< script::vba::XVBAEventProcessor >& rVbaEventsHelper);
     478                 :            :     ~ScTabViewEventListener();
     479                 :            :     // XEnhancedMouseClickHandler
     480                 :            :     virtual sal_Bool SAL_CALL mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
     481                 :            :     virtual sal_Bool SAL_CALL mouseReleased( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
     482                 :            : 
     483                 :            :     // XSelectionChangeListener
     484                 :            :     virtual void SAL_CALL selectionChanged( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
     485                 :            :     // XEventListener
     486                 :            :     virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
     487                 :            : };
     488                 :            : 
     489                 :          4 : ScTabViewEventListener::ScTabViewEventListener(ScTabViewObj* pObj, uno::Reference< script::vba::XVBAEventProcessor >& rVbaEventsHelper):
     490                 :          4 :     pViewObj( pObj ),xVbaEventsHelper( rVbaEventsHelper ), bDelaySelectionEvent( false ), bSelectionChangeOccurred( false )
     491                 :            : {
     492                 :          4 : }
     493                 :            : 
     494                 :          2 : ScTabViewEventListener::~ScTabViewEventListener()
     495                 :            : {
     496         [ -  + ]:          4 : }
     497                 :            : 
     498                 :          2 : void SAL_CALL ScTabViewEventListener::disposing(  const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
     499                 :            : {
     500                 :          2 : }
     501                 :            : 
     502                 :          8 : void ScTabViewEventListener::fireSelectionChangeEvent()
     503                 :            : {
     504 [ +  - ][ +  - ]:          8 :     if ( xVbaEventsHelper.is() && pViewObj )
                 [ +  - ]
     505                 :            :     {
     506         [ +  - ]:          8 :         uno::Sequence< uno::Any > aArgs(1);
     507 [ +  - ][ +  - ]:          8 :         aArgs[0] = pViewObj->getSelection();
                 [ #  # ]
     508                 :            :                 try
     509                 :            :                 {
     510 [ +  - ][ +  - ]:          8 :             xVbaEventsHelper->processVbaEvent( script::vba::VBAEventId::WORKSHEET_SELECTIONCHANGE, aArgs );
     511                 :            :                 }
     512         [ #  # ]:          0 :                 catch( uno::Exception& )
     513                 :            :                 {
     514         [ +  - ]:          8 :                 }
     515                 :            :     }
     516                 :          8 :     bDelaySelectionEvent = false;
     517                 :          8 :     bSelectionChangeOccurred = false;
     518                 :          8 : }
     519                 :            : 
     520                 :          0 : sal_Bool SAL_CALL ScTabViewEventListener::mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException)
     521                 :            : {
     522                 :            :     // Delay to fire the selection change event if clicking the left mouse button to do selection.
     523                 :          0 :     bDelaySelectionEvent = ( e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT ) ? false : sal_True;
     524                 :          0 :     bSelectionChangeOccurred = false;
     525                 :            : 
     526                 :            :     // ScTabViewObj::MousePressed should handle process BeforeDoubleClick and BeforeRightClick events
     527                 :          0 :     return sal_True;
     528                 :            : }
     529                 :            : 
     530                 :          0 : sal_Bool SAL_CALL ScTabViewEventListener::mouseReleased( const awt::EnhancedMouseEvent&/*e*/) throw (uno::RuntimeException)
     531                 :            : {
     532         [ #  # ]:          0 :     if ( bSelectionChangeOccurred )
     533                 :          0 :         fireSelectionChangeEvent();
     534                 :          0 :     return sal_True;
     535                 :            : }
     536                 :            : 
     537                 :          8 : void SAL_CALL ScTabViewEventListener::selectionChanged( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
     538                 :            : {
     539         [ +  - ]:          8 :     if ( !bDelaySelectionEvent )
     540                 :            :     {
     541                 :          8 :         fireSelectionChangeEvent();
     542                 :            :     }
     543                 :            :     else
     544                 :            :     {
     545                 :          0 :         bSelectionChangeOccurred = sal_True;
     546                 :            :     }
     547                 :          8 : }
     548                 :            : 
     549                 :            : //------------------------------------------------------------------------
     550                 :            : 
     551                 :            : //  Default-ctor wird fuer SMART_REFLECTION_IMPLEMENTATION gebraucht
     552                 :            : 
     553                 :        229 : ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
     554                 :            :     ScViewPaneBase( pViewSh, SC_VIEWPANE_ACTIVE ),
     555                 :            :     SfxBaseController( pViewSh ),
     556                 :            :     aPropSet( lcl_GetViewOptPropertyMap() ),
     557                 :            :     aMouseClickHandlers( 0 ),
     558                 :            :     aActivationListeners( 0 ),
     559                 :            :     nPreviousTab( 0 ),
     560 [ +  - ][ +  - ]:        229 :     bDrawSelModeSet(false)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     561                 :            : {
     562         [ +  - ]:        229 :     if (!pViewSh)
     563                 :            :         return;
     564                 :            : 
     565                 :        229 :     nPreviousTab = pViewSh->GetViewData()->GetTabNo();
     566                 :        229 :     ScViewData* pViewData = pViewSh->GetViewData();
     567         [ +  - ]:        229 :     if (!pViewData)
     568                 :            :         return;
     569                 :            : 
     570                 :            :     uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper(
     571 [ +  - ][ +  - ]:        229 :         pViewData->GetDocument()->GetVbaEventProcessor(), uno::UNO_QUERY );
                 [ +  - ]
     572         [ +  + ]:        229 :     if (!xVbaEventsHelper.is())
     573                 :            :         return;
     574                 :            : 
     575         [ +  - ]:          4 :     ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
     576 [ +  - ][ +  - ]:          4 :     uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
     577         [ +  - ]:          4 :     addEnhancedMouseClickHandler( aMouseClickHandler );
     578 [ +  - ][ +  - ]:          4 :     uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
     579 [ +  + ][ +  - ]:        229 :     addSelectionChangeListener( aSelectionChangeListener );
     580                 :            : }
     581                 :            : 
     582 [ +  - ][ +  - ]:        203 : ScTabViewObj::~ScTabViewObj()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     583                 :            : {
     584                 :            :     //! Listening oder so
     585         [ +  + ]:        203 :     if (!aMouseClickHandlers.empty())
     586                 :            :     {
     587                 :          2 :         acquire();
     588         [ +  - ]:          2 :         EndMouseListening();
     589                 :            :     }
     590         [ -  + ]:        203 :     if (!aActivationListeners.empty())
     591                 :            :     {
     592                 :          0 :         acquire();
     593         [ #  # ]:          0 :         EndActivationListening();
     594                 :            :     }
     595         [ -  + ]:        406 : }
     596                 :            : 
     597                 :      56317 : uno::Any SAL_CALL ScTabViewObj::queryInterface( const uno::Type& rType )
     598                 :            :                                                 throw(uno::RuntimeException)
     599                 :            : {
     600 [ +  - ][ +  + ]:      56317 :     SC_QUERYINTERFACE( sheet::XSpreadsheetView )
         [ +  - ][ +  - ]
     601 [ +  - ][ -  + ]:      56257 :     SC_QUERYINTERFACE( sheet::XEnhancedMouseClickBroadcaster )
         [ #  # ][ #  # ]
     602 [ +  - ][ -  + ]:      56257 :     SC_QUERYINTERFACE( sheet::XActivationBroadcaster )
         [ #  # ][ #  # ]
     603 [ +  - ][ +  + ]:      56257 :     SC_QUERYINTERFACE( container::XEnumerationAccess )
         [ +  - ][ +  - ]
     604 [ +  - ][ +  + ]:      56256 :     SC_QUERYINTERFACE( container::XIndexAccess )
         [ +  - ][ +  - ]
     605 [ +  - ][ -  + ]:      56255 :     SC_QUERY_MULTIPLE( container::XElementAccess, container::XIndexAccess )
         [ #  # ][ #  # ]
     606 [ +  - ][ +  + ]:      56255 :     SC_QUERYINTERFACE( view::XSelectionSupplier )
         [ +  - ][ +  - ]
     607 [ +  - ][ +  + ]:      56241 :     SC_QUERYINTERFACE( beans::XPropertySet )
         [ +  - ][ +  - ]
     608 [ +  - ][ -  + ]:      55548 :     SC_QUERYINTERFACE( sheet::XViewSplitable )
         [ #  # ][ #  # ]
     609 [ +  - ][ -  + ]:      55548 :     SC_QUERYINTERFACE( sheet::XViewFreezable )
         [ #  # ][ #  # ]
     610 [ +  - ][ -  + ]:      55548 :     SC_QUERYINTERFACE( sheet::XRangeSelection )
         [ #  # ][ #  # ]
     611 [ +  - ][ +  + ]:      55548 :     SC_QUERYINTERFACE( lang::XUnoTunnel )
         [ +  - ][ +  - ]
     612 [ +  - ][ -  + ]:      54059 :     SC_QUERYINTERFACE( datatransfer::XTransferableSupplier )
         [ #  # ][ #  # ]
     613 [ +  - ][ -  + ]:      54059 :     SC_QUERYINTERFACE( sheet::XSelectedSheetsSupplier )
         [ #  # ][ #  # ]
     614                 :            : 
     615         [ +  - ]:      54059 :     uno::Any aRet(ScViewPaneBase::queryInterface( rType ));
     616         [ +  + ]:      54059 :     if (!aRet.hasValue())
     617         [ +  - ]:      54053 :         aRet = SfxBaseController::queryInterface( rType );
     618                 :      56317 :     return aRet;
     619                 :            : }
     620                 :            : 
     621                 :     322042 : void SAL_CALL ScTabViewObj::acquire() throw()
     622                 :            : {
     623                 :     322042 :     SfxBaseController::acquire();
     624                 :     322042 : }
     625                 :            : 
     626                 :     322456 : void SAL_CALL ScTabViewObj::release() throw()
     627                 :            : {
     628                 :     322456 :     SfxBaseController::release();
     629                 :     322456 : }
     630                 :            : 
     631                 :         48 : void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, sal_Int32 nEvent )
     632                 :            : {
     633                 :         48 :     ScDocument* pDoc = pDocSh->GetDocument();
     634                 :            :     // when deleting a sheet, nPreviousTab can be invalid
     635                 :            :     // (could be handled with reference updates)
     636         [ -  + ]:         48 :     if (!pDoc->HasTable(nTab))
     637                 :         48 :         return;
     638                 :            : 
     639                 :         48 :     const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab);
     640         [ -  + ]:         48 :     if (pEvents)
     641                 :            :     {
     642                 :          0 :         const rtl::OUString* pScript = pEvents->GetScript(nEvent);
     643         [ #  # ]:          0 :         if (pScript)
     644                 :            :         {
     645                 :          0 :             uno::Any aRet;
     646         [ #  # ]:          0 :             uno::Sequence<uno::Any> aParams;
     647         [ #  # ]:          0 :             uno::Sequence<sal_Int16> aOutArgsIndex;
     648         [ #  # ]:          0 :             uno::Sequence<uno::Any> aOutArgs;
     649 [ #  # ][ #  # ]:          0 :             /*ErrCode eRet =*/ pDocSh->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     650                 :            :         }
     651                 :            :     }
     652                 :            : 
     653                 :            :     // execute VBA event handlers
     654                 :            :     try
     655                 :            :     {
     656 [ +  - ][ -  + ]:         48 :         uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
     657                 :            :         // the parameter is the clicked object, as in the mousePressed call above
     658         [ #  # ]:          0 :         uno::Sequence< uno::Any > aArgs( 1 );
     659 [ #  # ][ #  # ]:          0 :         aArgs[ 0 ] <<= nTab;
     660 [ #  # ][ #  # ]:         48 :         xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( nEvent ), aArgs );
         [ #  # ][ #  # ]
                 [ -  + ]
     661                 :            :     }
     662                 :         48 :     catch( uno::Exception& )
     663                 :            :     {
     664                 :            :     }
     665                 :            : }
     666                 :            : 
     667                 :        303 : void ScTabViewObj::SheetChanged( bool bSameTabButMoved )
     668                 :            : {
     669         [ -  + ]:        303 :     if ( !GetViewShell() )
     670                 :        303 :         return;
     671                 :            : 
     672                 :        303 :     ScViewData* pViewData = GetViewShell()->GetViewData();
     673                 :        303 :     ScDocShell* pDocSh = pViewData->GetDocShell();
     674         [ -  + ]:        303 :     if (!aActivationListeners.empty())
     675                 :            :     {
     676         [ #  # ]:          0 :         sheet::ActivationEvent aEvent;
     677         [ #  # ]:          0 :         uno::Reference< sheet::XSpreadsheetView > xView(this);
     678         [ #  # ]:          0 :         uno::Reference< uno::XInterface > xSource(xView, uno::UNO_QUERY);
     679         [ #  # ]:          0 :         aEvent.Source = xSource;
     680 [ #  # ][ #  # ]:          0 :         aEvent.ActiveSheet = new ScTableSheetObj(pDocSh, pViewData->GetTabNo());
                 [ #  # ]
     681 [ #  # ][ #  # ]:          0 :         for (XActivationEventListenerVector::iterator it = aActivationListeners.begin(); it != aActivationListeners.end(); )
         [ #  # ][ #  # ]
     682                 :            :         {
     683                 :            :             try
     684                 :            :             {
     685 [ #  # ][ #  # ]:          0 :                 (*it)->activeSpreadsheetChanged( aEvent );
                 [ #  # ]
     686         [ #  # ]:          0 :                 ++it;
     687                 :            :             }
     688   [ #  #  #  # ]:          0 :             catch( uno::Exception& )
     689                 :            :             {
     690         [ #  # ]:          0 :                 it = aActivationListeners.erase( it);
     691                 :            :             }
     692         [ #  # ]:          0 :         }
     693                 :            :     }
     694                 :            : 
     695                 :            :     /*  Handle sheet events, but do not trigger event handlers, if the old
     696                 :            :         active sheet gets re-activated after inserting/deleting/moving a sheet. */
     697                 :        303 :     SCTAB nNewTab = pViewData->GetTabNo();
     698 [ +  + ][ +  + ]:        303 :     if ( !bSameTabButMoved && (nNewTab != nPreviousTab) )
     699                 :            :     {
     700                 :         24 :         lcl_CallActivate( pDocSh, nPreviousTab, SC_SHEETEVENT_UNFOCUS );
     701                 :         24 :         lcl_CallActivate( pDocSh, nNewTab, SC_SHEETEVENT_FOCUS );
     702                 :            :     }
     703                 :        303 :     nPreviousTab = nNewTab;
     704                 :            : }
     705                 :            : 
     706                 :          2 : uno::Sequence<uno::Type> SAL_CALL ScTabViewObj::getTypes() throw(uno::RuntimeException)
     707                 :            : {
     708 [ +  - ][ +  - ]:          2 :     static uno::Sequence<uno::Type> aTypes;
         [ +  - ][ #  # ]
     709         [ +  - ]:          2 :     if ( aTypes.getLength() == 0 )
     710                 :            :     {
     711         [ +  - ]:          2 :         uno::Sequence<uno::Type> aViewPaneTypes(ScViewPaneBase::getTypes());
     712                 :          2 :         long nViewPaneLen = aViewPaneTypes.getLength();
     713                 :          2 :         const uno::Type* pViewPanePtr = aViewPaneTypes.getConstArray();
     714                 :            : 
     715         [ +  - ]:          2 :         uno::Sequence<uno::Type> aControllerTypes(SfxBaseController::getTypes());
     716                 :          2 :         long nControllerLen = aControllerTypes.getLength();
     717                 :          2 :         const uno::Type* pControllerPtr = aControllerTypes.getConstArray();
     718                 :            : 
     719                 :          2 :         long nParentLen = nViewPaneLen + nControllerLen;
     720                 :            : 
     721         [ +  - ]:          2 :         aTypes.realloc( nParentLen + 12 );
     722         [ +  - ]:          2 :         uno::Type* pPtr = aTypes.getArray();
     723         [ +  - ]:          2 :         pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSpreadsheetView>*)0);
     724         [ +  - ]:          2 :         pPtr[nParentLen + 1] = getCppuType((const uno::Reference<container::XEnumerationAccess>*)0);
     725         [ +  - ]:          2 :         pPtr[nParentLen + 2] = getCppuType((const uno::Reference<container::XIndexAccess>*)0);
     726         [ +  - ]:          2 :         pPtr[nParentLen + 3] = getCppuType((const uno::Reference<view::XSelectionSupplier>*)0);
     727         [ +  - ]:          2 :         pPtr[nParentLen + 4] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
     728         [ +  - ]:          2 :         pPtr[nParentLen + 5] = getCppuType((const uno::Reference<sheet::XViewSplitable>*)0);
     729         [ +  - ]:          2 :         pPtr[nParentLen + 6] = getCppuType((const uno::Reference<sheet::XViewFreezable>*)0);
     730         [ +  - ]:          2 :         pPtr[nParentLen + 7] = getCppuType((const uno::Reference<sheet::XRangeSelection>*)0);
     731         [ +  - ]:          2 :         pPtr[nParentLen + 8] = getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
     732         [ +  - ]:          2 :         pPtr[nParentLen + 9] = getCppuType((const uno::Reference<sheet::XEnhancedMouseClickBroadcaster>*)0);
     733         [ +  - ]:          2 :         pPtr[nParentLen + 10] = getCppuType((const uno::Reference<sheet::XActivationBroadcaster>*)0);
     734         [ +  - ]:          2 :         pPtr[nParentLen + 11] = getCppuType((const uno::Reference<datatransfer::XTransferableSupplier>*)0);
     735                 :            : 
     736                 :            :         long i;
     737         [ +  + ]:         12 :         for (i=0; i<nViewPaneLen; i++)
     738                 :         10 :             pPtr[i] = pViewPanePtr[i];              // parent types first
     739         [ +  + ]:         24 :         for (i=0; i<nControllerLen; i++)
     740 [ +  - ][ +  - ]:         24 :             pPtr[nViewPaneLen+i] = pControllerPtr[i];
     741                 :            :     }
     742                 :          2 :     return aTypes;
     743                 :            : }
     744                 :            : 
     745                 :            : namespace
     746                 :            : {
     747                 :            :     class theScTabViewObjImplementationId : public rtl::Static< UnoTunnelIdInit, theScTabViewObjImplementationId > {};
     748                 :            : }
     749                 :            : 
     750                 :          2 : uno::Sequence<sal_Int8> SAL_CALL ScTabViewObj::getImplementationId()
     751                 :            :                                                 throw(uno::RuntimeException)
     752                 :            : {
     753                 :          2 :     return theScTabViewObjImplementationId::get().getSeq();
     754                 :            : }
     755                 :            : 
     756                 :            : // XDocumentView
     757                 :            : 
     758                 :          0 : sal_Bool lcl_TabInRanges( SCTAB nTab, const ScRangeList& rRanges )
     759                 :            : {
     760         [ #  # ]:          0 :     for (size_t i = 0, nCount = rRanges.size(); i < nCount; ++i)
     761                 :            :     {
     762                 :          0 :         const ScRange* pRange = rRanges[ i ];
     763 [ #  # ][ #  # ]:          0 :         if ( nTab >= pRange->aStart.Tab() && nTab <= pRange->aEnd.Tab() )
                 [ #  # ]
     764                 :          0 :             return sal_True;
     765                 :            :     }
     766                 :          0 :     return false;
     767                 :            : }
     768                 :            : 
     769                 :          0 : void lcl_ShowObject( ScTabViewShell& rViewSh, ScDrawView& rDrawView, SdrObject* pSelObj )
     770                 :            : {
     771                 :          0 :     sal_Bool bFound = false;
     772                 :          0 :     SCTAB nObjectTab = 0;
     773                 :            : 
     774                 :          0 :     SdrModel* pModel = rDrawView.GetModel();
     775                 :          0 :     sal_uInt16 nPageCount = pModel->GetPageCount();
     776 [ #  # ][ #  # ]:          0 :     for (sal_uInt16 i=0; i<nPageCount && !bFound; i++)
                 [ #  # ]
     777                 :            :     {
     778                 :          0 :         SdrPage* pPage = pModel->GetPage(i);
     779         [ #  # ]:          0 :         if (pPage)
     780                 :            :         {
     781         [ #  # ]:          0 :             SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
     782         [ #  # ]:          0 :             SdrObject* pObject = aIter.Next();
     783 [ #  # ][ #  # ]:          0 :             while (pObject && !bFound)
                 [ #  # ]
     784                 :            :             {
     785         [ #  # ]:          0 :                 if ( pObject == pSelObj )
     786                 :            :                 {
     787                 :          0 :                     bFound = sal_True;
     788                 :          0 :                     nObjectTab = static_cast<SCTAB>(i);
     789                 :            :                 }
     790         [ #  # ]:          0 :                 pObject = aIter.Next();
     791                 :          0 :             }
     792                 :            :         }
     793                 :            :     }
     794                 :            : 
     795         [ #  # ]:          0 :     if (bFound)
     796                 :            :     {
     797                 :          0 :         rViewSh.SetTabNo( nObjectTab );
     798                 :          0 :         rViewSh.ScrollToObject( pSelObj );
     799                 :            :     }
     800                 :          0 : }
     801                 :            : 
     802                 :          1 : sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
     803                 :            :                         throw(lang::IllegalArgumentException, uno::RuntimeException)
     804                 :            : {
     805         [ +  - ]:          1 :     SolarMutexGuard aGuard;
     806                 :          1 :     ScTabViewShell* pViewSh = GetViewShell();
     807                 :            : 
     808         [ -  + ]:          1 :     if ( !pViewSh )
     809                 :          0 :         return false;
     810                 :            : 
     811                 :            :     //! Type of aSelection can be some specific interface instead of XInterface
     812                 :            : 
     813                 :          1 :     sal_Bool bRet = false;
     814         [ +  - ]:          1 :     uno::Reference<uno::XInterface> xInterface(aSelection, uno::UNO_QUERY);
     815         [ -  + ]:          1 :     if ( !xInterface.is() )  //clear all selections
     816                 :            :     {
     817                 :          0 :         ScDrawView* pDrawView = pViewSh->GetScDrawView();
     818         [ #  # ]:          0 :         if (pDrawView)
     819                 :            :         {
     820         [ #  # ]:          0 :             pDrawView->ScEndTextEdit();
     821         [ #  # ]:          0 :             pDrawView->UnmarkAll();
     822                 :            :         }
     823                 :            :         else //#102232#; if there is  no DrawView remove range selection
     824         [ #  # ]:          0 :             pViewSh->Unmark();
     825                 :          0 :         bRet = sal_True;
     826                 :            :     }
     827                 :            : 
     828         [ -  + ]:          1 :     if (bDrawSelModeSet) // remove DrawSelMode if set by API; if necessary it will be set again later
     829                 :            :     {
     830                 :          0 :         pViewSh->SetDrawSelMode(false);
     831         [ #  # ]:          0 :         pViewSh->UpdateLayerLocks();
     832                 :          0 :         bDrawSelModeSet = false;
     833                 :            :     }
     834                 :            : 
     835         [ -  + ]:          1 :     if (bRet)
     836                 :          0 :         return bRet;
     837                 :            : 
     838                 :            : 
     839         [ +  - ]:          1 :     ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xInterface );
     840         [ +  - ]:          1 :     uno::Reference<drawing::XShapes> xShapeColl( xInterface, uno::UNO_QUERY );
     841         [ +  - ]:          1 :     uno::Reference<drawing::XShape> xShapeSel( xInterface, uno::UNO_QUERY );
     842         [ +  - ]:          1 :     SvxShape* pShapeImp = SvxShape::getImplementation( xShapeSel );
     843                 :            : 
     844         [ +  - ]:          1 :     if (pRangesImp)                                     // Zell-Ranges
     845                 :            :     {
     846                 :          1 :         ScViewData* pViewData = pViewSh->GetViewData();
     847         [ +  - ]:          1 :         if ( pViewData->GetDocShell() == pRangesImp->GetDocShell() )
     848                 :            :         {
     849                 :            :             //  Zuerst evtl. Drawing-Selektion aufheben
     850                 :            :             //  (MarkListHasChanged hebt Tabellen-Selektion auf)
     851                 :            : 
     852                 :          1 :             ScDrawView* pDrawView = pViewSh->GetScDrawView();
     853         [ +  - ]:          1 :             if (pDrawView)
     854                 :            :             {
     855         [ +  - ]:          1 :                 pDrawView->ScEndTextEdit();
     856         [ +  - ]:          1 :                 pDrawView->UnmarkAll();
     857                 :            :             }
     858                 :          1 :             FuPoor* pFunc = pViewSh->GetDrawFuncPtr();
     859 [ -  + ][ -  + ]:          1 :             if ( pFunc && pFunc->GetSlotID() != SID_OBJECT_SELECT )
                 [ +  - ]
     860                 :            :             {
     861                 :            :                 //  Slot der Zeichenfunktion nochmal ausfuehren -> abschalten
     862         [ #  # ]:          0 :                 SfxDispatcher* pDisp = pViewSh->GetDispatcher();
     863         [ #  # ]:          0 :                 if (pDisp)
     864         [ #  # ]:          0 :                     pDisp->Execute( pFunc->GetSlotID(), SFX_CALLMODE_SYNCHRON );
     865                 :            :             }
     866         [ +  - ]:          1 :             pViewSh->SetDrawShell(false);
     867                 :          1 :             pViewSh->SetDrawSelMode(false); // nach dem Dispatcher-Execute
     868                 :            : 
     869                 :            :             //  Ranges selektieren
     870                 :            : 
     871                 :          1 :             const ScRangeList& rRanges = pRangesImp->GetRangeList();
     872         [ +  - ]:          1 :             size_t nRangeCount = rRanges.size();
     873                 :            :             // for empty range list, remove selection (cursor remains where it was)
     874         [ -  + ]:          1 :             if ( nRangeCount == 0 )
     875         [ #  # ]:          0 :                 pViewSh->Unmark();
     876         [ +  - ]:          1 :             else if ( nRangeCount == 1 )
     877 [ +  - ][ +  - ]:          1 :                 pViewSh->MarkRange( *rRanges[ 0 ] );
     878                 :            :             else
     879                 :            :             {
     880                 :            :                 //  Mehrfachselektion
     881                 :            : 
     882         [ #  # ]:          0 :                 const ScRange* pFirst = rRanges[ 0 ];
     883 [ #  # ][ #  # ]:          0 :                 if ( pFirst && !lcl_TabInRanges( pViewData->GetTabNo(), rRanges ) )
         [ #  # ][ #  # ]
     884         [ #  # ]:          0 :                     pViewSh->SetTabNo( pFirst->aStart.Tab() );
     885         [ #  # ]:          0 :                 pViewSh->DoneBlockMode();
     886         [ #  # ]:          0 :                 pViewSh->InitOwnBlockMode();
     887 [ #  # ][ #  # ]:          0 :                 pViewData->GetMarkData().MarkFromRangeList( rRanges, sal_True );
     888         [ #  # ]:          0 :                 pViewSh->MarkDataChanged();
     889         [ #  # ]:          0 :                 pViewData->GetDocShell()->PostPaintGridAll();   // Markierung (alt&neu)
     890         [ #  # ]:          0 :                 if ( pFirst )
     891                 :            :                 {
     892                 :          0 :                     pViewSh->AlignToCursor( pFirst->aStart.Col(), pFirst->aStart.Row(),
     893         [ #  # ]:          0 :                                                 SC_FOLLOW_JUMP );
     894         [ #  # ]:          0 :                     pViewSh->SetCursor( pFirst->aStart.Col(), pFirst->aStart.Row() );
     895                 :            :                 }
     896                 :            : 
     897                 :            :                 //! Methode an der View, um RangeList zu selektieren
     898                 :            :             }
     899                 :          1 :             bRet = sal_True;
     900                 :            :         }
     901                 :            :     }
     902 [ #  # ][ #  # ]:          0 :     else if ( pShapeImp || xShapeColl.is() )            // Drawing-Layer
                 [ #  # ]
     903                 :            :     {
     904                 :          0 :         ScDrawView* pDrawView = pViewSh->GetScDrawView();
     905         [ #  # ]:          0 :         if (pDrawView)
     906                 :            :         {
     907         [ #  # ]:          0 :             pDrawView->ScEndTextEdit();
     908         [ #  # ]:          0 :             pDrawView->UnmarkAll();
     909                 :            : 
     910         [ #  # ]:          0 :             if (pShapeImp)      // einzelnes Shape
     911                 :            :             {
     912         [ #  # ]:          0 :                 SdrObject *pObj = pShapeImp->GetSdrObject();
     913         [ #  # ]:          0 :                 if (pObj)
     914                 :            :                 {
     915         [ #  # ]:          0 :                     lcl_ShowObject( *pViewSh, *pDrawView, pObj );
     916                 :          0 :                     SdrPageView* pPV = pDrawView->GetSdrPageView();
     917 [ #  # ][ #  # ]:          0 :                     if ( pPV && pObj->GetPage() == pPV->GetPage() )
         [ #  # ][ #  # ]
     918                 :            :                     {
     919         [ #  # ]:          0 :                         pDrawView->MarkObj( pObj, pPV );
     920                 :          0 :                         bRet = sal_True;
     921                 :            :                     }
     922                 :            :                 }
     923                 :            :             }
     924                 :            :             else                // Shape-Collection (xShapeColl ist nicht 0)
     925                 :            :             {
     926                 :            :                 //  Es wird auf die Tabelle des ersten Objekts umgeschaltet,
     927                 :            :                 //  und alle Objekte selektiert, die auf dieser Tabelle liegen
     928                 :            :                 //! Exception, wenn Objekte auf verschiedenen Tabellen?
     929                 :            : 
     930                 :          0 :                 SdrPageView* pPV = NULL;
     931 [ #  # ][ #  # ]:          0 :                 long nCount = xShapeColl->getCount();
     932         [ #  # ]:          0 :                 if (nCount)
     933                 :            :                 {
     934                 :          0 :                     sal_Bool bAllMarked(sal_True);
     935         [ #  # ]:          0 :                     for ( long i = 0; i < nCount; i++ )
     936                 :            :                     {
     937 [ #  # ][ #  # ]:          0 :                         uno::Reference<drawing::XShape> xShapeInt(xShapeColl->getByIndex(i), uno::UNO_QUERY);
                 [ #  # ]
     938         [ #  # ]:          0 :                         if (xShapeInt.is())
     939                 :            :                         {
     940         [ #  # ]:          0 :                             SvxShape* pShape = SvxShape::getImplementation( xShapeInt );
     941         [ #  # ]:          0 :                             if (pShape)
     942                 :            :                             {
     943         [ #  # ]:          0 :                                 SdrObject *pObj = pShape->GetSdrObject();
     944         [ #  # ]:          0 :                                 if (pObj)
     945                 :            :                                 {
     946 [ #  # ][ #  # ]:          0 :                                     if (!bDrawSelModeSet && (pObj->GetLayer() == SC_LAYER_BACK))
         [ #  # ][ #  # ]
     947                 :            :                                     {
     948                 :          0 :                                         pViewSh->SetDrawSelMode(sal_True);
     949         [ #  # ]:          0 :                                         pViewSh->UpdateLayerLocks();
     950                 :          0 :                                         bDrawSelModeSet = sal_True;
     951                 :            :                                     }
     952         [ #  # ]:          0 :                                     if (!pPV)               // erstes Objekt
     953                 :            :                                     {
     954         [ #  # ]:          0 :                                         lcl_ShowObject( *pViewSh, *pDrawView, pObj );
     955                 :          0 :                                         pPV = pDrawView->GetSdrPageView();
     956                 :            :                                     }
     957 [ #  # ][ #  # ]:          0 :                                     if ( pPV && pObj->GetPage() == pPV->GetPage() )
         [ #  # ][ #  # ]
     958                 :            :                                     {
     959 [ #  # ][ #  # ]:          0 :                                         if (pDrawView->IsObjMarkable( pObj, pPV ))
     960         [ #  # ]:          0 :                                             pDrawView->MarkObj( pObj, pPV );
     961                 :            :                                         else
     962                 :          0 :                                             bAllMarked = false;
     963                 :            :                                     }
     964                 :            :                                 }
     965                 :            :                             }
     966                 :            :                         }
     967                 :          0 :                     }
     968         [ #  # ]:          0 :                     if (bAllMarked)
     969                 :          0 :                         bRet = sal_True;
     970                 :            :                 }
     971                 :            :                 else
     972                 :          0 :                     bRet = sal_True; // empty XShapes (all shapes are deselected)
     973                 :            :             }
     974                 :            : 
     975         [ #  # ]:          0 :             if (bRet)
     976         [ #  # ]:          0 :                 pViewSh->SetDrawShell(sal_True);
     977                 :            :         }
     978                 :            :     }
     979                 :            : 
     980         [ -  + ]:          1 :     if (!bRet)
     981         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
     982                 :            : 
     983         [ +  - ]:          1 :     return bRet;
     984                 :            : }
     985                 :            : 
     986                 :         22 : uno::Any SAL_CALL ScTabViewObj::getSelection() throw(uno::RuntimeException)
     987                 :            : {
     988         [ +  - ]:         22 :     SolarMutexGuard aGuard;
     989                 :         22 :     ScTabViewShell* pViewSh = GetViewShell();
     990                 :         22 :     ScCellRangesBase* pObj = NULL;
     991         [ +  - ]:         22 :     if (pViewSh)
     992                 :            :     {
     993                 :            :         //  Ist auf dem Drawing-Layer etwas selektiert?
     994                 :            : 
     995         [ +  - ]:         22 :         SdrView* pDrawView = pViewSh->GetSdrView();
     996         [ +  - ]:         22 :         if (pDrawView)
     997                 :            :         {
     998                 :         22 :             const SdrMarkList& rMarkList = pDrawView->GetMarkedObjectList();
     999                 :         22 :             sal_uLong nMarkCount = rMarkList.GetMarkCount();
    1000         [ -  + ]:         22 :             if (nMarkCount)
    1001                 :            :             {
    1002                 :            :                 //  ShapeCollection erzeugen (wie in SdXImpressView::getSelection im Draw)
    1003                 :            :                 //  Zurueckgegeben wird XInterfaceRef, das muss das UsrObject-XInterface sein
    1004                 :            : 
    1005                 :          0 :                 SvxShapeCollection* pShapes = new SvxShapeCollection();
    1006         [ #  # ]:          0 :                 uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pShapes));
    1007                 :            : 
    1008         [ #  # ]:          0 :                 for (sal_uLong i=0; i<nMarkCount; i++)
    1009                 :            :                 {
    1010 [ #  # ][ #  # ]:          0 :                     SdrObject* pDrawObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
    1011         [ #  # ]:          0 :                     if (pDrawObj)
    1012                 :            :                     {
    1013 [ #  # ][ #  # ]:          0 :                         uno::Reference<drawing::XShape> xShape( pDrawObj->getUnoShape(), uno::UNO_QUERY );
    1014         [ #  # ]:          0 :                         if (xShape.is())
    1015         [ #  # ]:          0 :                             pShapes->add(xShape);
    1016                 :            :                     }
    1017                 :            :                 }
    1018         [ #  # ]:          0 :                 return uno::makeAny(xRet);
    1019                 :            :             }
    1020                 :            :         }
    1021                 :            : 
    1022                 :            :         //  sonst Tabellen-(Zellen-)Selektion
    1023                 :            : 
    1024                 :         22 :         ScViewData* pViewData = pViewSh->GetViewData();
    1025                 :         22 :         ScDocShell* pDocSh = pViewData->GetDocShell();
    1026                 :            : 
    1027         [ +  - ]:         22 :         const ScMarkData& rMark = pViewData->GetMarkData();
    1028         [ +  - ]:         22 :         SCTAB nTabs = rMark.GetSelectCount();
    1029                 :            : 
    1030                 :         22 :         ScRange aRange;
    1031         [ +  - ]:         22 :         ScMarkType eMarkType = pViewData->GetSimpleArea(aRange);
    1032 [ +  - ][ +  - ]:         22 :         if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE) )
    1033                 :            :         {
    1034         [ +  + ]:         44 :             if (aRange.aStart == aRange.aEnd)
    1035         [ +  - ]:         20 :                 pObj = new ScCellObj( pDocSh, aRange.aStart );
    1036                 :            :             else
    1037         [ +  - ]:          2 :                 pObj = new ScCellRangeObj( pDocSh, aRange );
    1038                 :            :         }
    1039 [ #  # ][ #  # ]:          0 :         else if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE_FILTERED) )
    1040                 :            :         {
    1041         [ #  # ]:          0 :             ScMarkData aFilteredMark( rMark );
    1042         [ #  # ]:          0 :             ScViewUtil::UnmarkFiltered( aFilteredMark, pDocSh->GetDocument());
    1043         [ #  # ]:          0 :             ScRangeList aRangeList;
    1044         [ #  # ]:          0 :             aFilteredMark.FillRangeListWithMarks( &aRangeList, false);
    1045                 :            :             // Theoretically a selection may start and end on a filtered row.
    1046         [ #  # ]:          0 :             switch ( aRangeList.size() )
              [ #  #  # ]
    1047                 :            :             {
    1048                 :            :                 case 0:
    1049                 :            :                     // No unfiltered row, we have to return some object, so
    1050                 :            :                     // here is one with no ranges.
    1051         [ #  # ]:          0 :                     pObj = new ScCellRangesObj( pDocSh, aRangeList );
    1052                 :          0 :                     break;
    1053                 :            :                 case 1:
    1054                 :            :                     {
    1055         [ #  # ]:          0 :                         const ScRange& rRange = *(aRangeList[ 0 ]);
    1056         [ #  # ]:          0 :                         if (rRange.aStart == rRange.aEnd)
    1057         [ #  # ]:          0 :                             pObj = new ScCellObj( pDocSh, rRange.aStart );
    1058                 :            :                         else
    1059         [ #  # ]:          0 :                             pObj = new ScCellRangeObj( pDocSh, rRange );
    1060                 :            :                     }
    1061                 :          0 :                     break;
    1062                 :            :                 default:
    1063         [ #  # ]:          0 :                     pObj = new ScCellRangesObj( pDocSh, aRangeList );
    1064 [ #  # ][ #  # ]:          0 :             }
    1065                 :            :         }
    1066                 :            :         else            //  Mehrfachselektion
    1067                 :            :         {
    1068                 :          0 :             ScRangeListRef xRanges;
    1069         [ #  # ]:          0 :             pViewData->GetMultiArea( xRanges );
    1070                 :            : 
    1071                 :            :             //  bei mehreren Tabellen Ranges kopieren
    1072                 :            :             //! sollte eigentlich schon in ScMarkData::FillRangeListWithMarks passieren?
    1073         [ #  # ]:          0 :             if ( nTabs > 1 )
    1074         [ #  # ]:          0 :                 rMark.ExtendRangeListTables( xRanges );
    1075                 :            : 
    1076 [ #  # ][ #  # ]:          0 :             pObj = new ScCellRangesObj( pDocSh, *xRanges );
    1077                 :            :         }
    1078                 :            : 
    1079 [ +  + ][ +  - ]:         22 :         if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
                 [ +  + ]
    1080                 :            :         {
    1081                 :            :             //  remember if the selection was from the cursor position without anything selected
    1082                 :            :             //  (used when rendering the selection)
    1083                 :            : 
    1084         [ +  - ]:         22 :             pObj->SetCursorOnly( sal_True );
    1085                 :            :         }
    1086                 :            :     }
    1087                 :            : 
    1088 [ +  - ][ +  - ]:         22 :     return uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
         [ +  - ][ +  - ]
    1089                 :            : }
    1090                 :            : 
    1091                 :            : // XEnumerationAccess
    1092                 :            : 
    1093                 :          1 : uno::Reference<container::XEnumeration> SAL_CALL ScTabViewObj::createEnumeration()
    1094                 :            :                                                     throw(uno::RuntimeException)
    1095                 :            : {
    1096         [ +  - ]:          1 :     SolarMutexGuard aGuard;
    1097 [ +  - ][ +  - ]:          1 :     return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetViewPanesEnumeration")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1098                 :            : }
    1099                 :            : 
    1100                 :            : // XIndexAccess
    1101                 :            : 
    1102                 :          2 : sal_Int32 SAL_CALL ScTabViewObj::getCount() throw(uno::RuntimeException)
    1103                 :            : {
    1104         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1105                 :          2 :     ScTabViewShell* pViewSh = GetViewShell();
    1106                 :          2 :     sal_uInt16 nPanes = 0;
    1107         [ +  - ]:          2 :     if (pViewSh)
    1108                 :            :     {
    1109                 :          2 :         nPanes = 1;
    1110                 :          2 :         ScViewData* pViewData = pViewSh->GetViewData();
    1111         [ -  + ]:          2 :         if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE )
    1112                 :          0 :             nPanes *= 2;
    1113         [ -  + ]:          2 :         if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
    1114                 :          0 :             nPanes *= 2;
    1115                 :            :     }
    1116         [ +  - ]:          2 :     return nPanes;
    1117                 :            : }
    1118                 :            : 
    1119                 :          3 : uno::Any SAL_CALL ScTabViewObj::getByIndex( sal_Int32 nIndex )
    1120                 :            :                             throw(lang::IndexOutOfBoundsException,
    1121                 :            :                                     lang::WrappedTargetException, uno::RuntimeException)
    1122                 :            : {
    1123         [ +  - ]:          3 :     SolarMutexGuard aGuard;
    1124 [ +  - ][ +  - ]:          3 :     uno::Reference<sheet::XViewPane> xPane(GetObjectByIndex_Impl((sal_uInt16)nIndex));
    1125         [ +  + ]:          3 :     if (xPane.is())
    1126         [ +  - ]:          4 :         return uno::makeAny(xPane);
    1127                 :            :     else
    1128 [ +  - ][ +  - ]:          3 :         throw lang::IndexOutOfBoundsException();
    1129                 :            : //    return uno::Any();
    1130                 :            : }
    1131                 :            : 
    1132                 :          0 : uno::Type SAL_CALL ScTabViewObj::getElementType() throw(uno::RuntimeException)
    1133                 :            : {
    1134         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1135 [ #  # ][ #  # ]:          0 :     return getCppuType((uno::Reference<sheet::XViewPane>*)0);
    1136                 :            : }
    1137                 :            : 
    1138                 :          0 : sal_Bool SAL_CALL ScTabViewObj::hasElements() throw(uno::RuntimeException)
    1139                 :            : {
    1140         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1141 [ #  # ][ #  # ]:          0 :     return ( getCount() != 0 );
    1142                 :            : }
    1143                 :            : 
    1144                 :            : // XSpreadsheetView
    1145                 :            : 
    1146                 :          3 : ScViewPaneObj* ScTabViewObj::GetObjectByIndex_Impl(sal_uInt16 nIndex) const
    1147                 :            : {
    1148                 :            :     static ScSplitPos ePosHV[4] =
    1149                 :            :         { SC_SPLIT_TOPLEFT, SC_SPLIT_BOTTOMLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMRIGHT };
    1150                 :            : 
    1151                 :          3 :     ScTabViewShell* pViewSh = GetViewShell();
    1152         [ +  - ]:          3 :     if (pViewSh)
    1153                 :            :     {
    1154                 :          3 :         ScSplitPos eWhich = SC_SPLIT_BOTTOMLEFT;    // default Position
    1155                 :          3 :         sal_Bool bError = false;
    1156                 :          3 :         ScViewData* pViewData = pViewSh->GetViewData();
    1157                 :          3 :         sal_Bool bHor = ( pViewData->GetHSplitMode() != SC_SPLIT_NONE );
    1158                 :          3 :         sal_Bool bVer = ( pViewData->GetVSplitMode() != SC_SPLIT_NONE );
    1159 [ #  # ][ -  + ]:          3 :         if ( bHor && bVer )
    1160                 :            :         {
    1161                 :            :             //  links oben, links unten, rechts oben, rechts unten - wie in Excel
    1162         [ #  # ]:          0 :             if ( nIndex < 4 )
    1163                 :          0 :                 eWhich = ePosHV[nIndex];
    1164                 :            :             else
    1165                 :          0 :                 bError = sal_True;
    1166                 :            :         }
    1167         [ -  + ]:          3 :         else if ( bHor )
    1168                 :            :         {
    1169         [ #  # ]:          0 :             if ( nIndex > 1 )
    1170                 :          0 :                 bError = sal_True;
    1171         [ #  # ]:          0 :             else if ( nIndex == 1 )
    1172                 :          0 :                 eWhich = SC_SPLIT_BOTTOMRIGHT;
    1173                 :            :             // sonst SC_SPLIT_BOTTOMLEFT
    1174                 :            :         }
    1175         [ -  + ]:          3 :         else if ( bVer )
    1176                 :            :         {
    1177         [ #  # ]:          0 :             if ( nIndex > 1 )
    1178                 :          0 :                 bError = sal_True;
    1179         [ #  # ]:          0 :             else if ( nIndex == 0 )
    1180                 :          0 :                 eWhich = SC_SPLIT_TOPLEFT;
    1181                 :            :             // sonst SC_SPLIT_BOTTOMLEFT
    1182                 :            :         }
    1183         [ +  + ]:          3 :         else if ( nIndex > 0 )
    1184                 :          1 :             bError = sal_True;          // nicht geteilt: nur 0 gueltig
    1185                 :            : 
    1186         [ +  + ]:          3 :         if (!bError)
    1187         [ +  - ]:          2 :             return new ScViewPaneObj( pViewSh, sal::static_int_cast<sal_uInt16>(eWhich) );
    1188                 :            :     }
    1189                 :            : 
    1190                 :          3 :     return NULL;
    1191                 :            : }
    1192                 :            : 
    1193                 :         60 : uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTabViewObj::getActiveSheet()
    1194                 :            :                                                 throw(uno::RuntimeException)
    1195                 :            : {
    1196         [ +  - ]:         60 :     SolarMutexGuard aGuard;
    1197                 :         60 :     ScTabViewShell* pViewSh = GetViewShell();
    1198         [ +  - ]:         60 :     if (pViewSh)
    1199                 :            :     {
    1200                 :         60 :         ScViewData* pData = pViewSh->GetViewData();
    1201                 :         60 :         SCTAB nTab = pData->GetTabNo();
    1202 [ +  - ][ +  - ]:         60 :         return new ScTableSheetObj( pData->GetDocShell(), nTab );
                 [ +  - ]
    1203                 :            :     }
    1204 [ #  # ][ +  - ]:         60 :     return NULL;
    1205                 :            : }
    1206                 :            : 
    1207                 :            : // support expand (but not replace) the active sheet
    1208                 :          0 : void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet )
    1209                 :            :                                                 throw(uno::RuntimeException)
    1210                 :            : {
    1211                 :          0 :     selectSheet(xActiveSheet, false);
    1212                 :          0 : }
    1213                 :            : 
    1214                 :            : void SAL_CALL
    1215                 :          0 : ScTabViewObj::selectSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet,
    1216                 :            :                              sal_Bool bExpand)
    1217                 :            :                                                 throw(uno::RuntimeException)
    1218                 :            : {
    1219         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1220                 :          0 :     sal_Bool bNew = bExpand;
    1221                 :            : 
    1222                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1223 [ #  # ][ #  # ]:          0 :     if ( pViewSh && xActiveSheet.is() )
                 [ #  # ]
    1224                 :            :     {
    1225                 :            :         //  XSpreadsheet und ScCellRangesBase -> muss ein Sheet sein
    1226                 :            : 
    1227         [ #  # ]:          0 :         ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xActiveSheet );
    1228 [ #  # ][ #  # ]:          0 :         if ( pRangesImp && pViewSh->GetViewData()->GetDocShell() == pRangesImp->GetDocShell() )
                 [ #  # ]
    1229                 :            :         {
    1230                 :          0 :             const ScRangeList& rRanges = pRangesImp->GetRangeList();
    1231 [ #  # ][ #  # ]:          0 :             if ( rRanges.size() == 1 )
    1232                 :            :             {
    1233         [ #  # ]:          0 :                 SCTAB nNewTab = rRanges[ 0 ]->aStart.Tab();
    1234 [ #  # ][ #  # ]:          0 :                 if ( pViewSh->GetViewData()->GetDocument()->HasTable(nNewTab) )
                 [ #  # ]
    1235         [ #  # ]:          0 :                     pViewSh->SetTabNo( nNewTab, bNew, bExpand );
    1236                 :            :             }
    1237                 :            :         }
    1238         [ #  # ]:          0 :     }
    1239                 :          0 : }
    1240                 :            : 
    1241                 :          0 : uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rPoint) const
    1242                 :            : {
    1243                 :          0 :     uno::Reference< uno::XInterface > xTarget;
    1244         [ #  # ]:          0 :     if (GetViewShell())
    1245                 :            :     {
    1246                 :            :         SCsCOL nX;
    1247                 :            :         SCsROW nY;
    1248                 :          0 :         ScViewData* pData = GetViewShell()->GetViewData();
    1249                 :          0 :         ScSplitPos eSplitMode = pData->GetActivePart();
    1250                 :          0 :         SCTAB nTab(pData->GetTabNo());
    1251         [ #  # ]:          0 :         pData->GetPosFromPixel( rPoint.X(), rPoint.Y(), eSplitMode, nX, nY);
    1252                 :            : 
    1253                 :          0 :         ScAddress aCellPos (nX, nY, nTab);
    1254         [ #  # ]:          0 :         ScCellObj* pCellObj = new ScCellObj(pData->GetDocShell(), aCellPos);
    1255                 :            : 
    1256 [ #  # ][ #  # ]:          0 :         xTarget.set(uno::Reference<table::XCell>(pCellObj), uno::UNO_QUERY);
                 [ #  # ]
    1257                 :            : 
    1258         [ #  # ]:          0 :         ScDocument* pDoc = pData->GetDocument();
    1259 [ #  # ][ #  # ]:          0 :         if (pDoc && pDoc->GetDrawLayer())
         [ #  # ][ #  # ]
    1260                 :            :         {
    1261                 :          0 :             SdrPage* pDrawPage = NULL;
    1262         [ #  # ]:          0 :             ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
    1263 [ #  # ][ #  # ]:          0 :             if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
         [ #  # ][ #  # ]
                 [ #  # ]
    1264         [ #  # ]:          0 :                 pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
    1265                 :            : 
    1266         [ #  # ]:          0 :             SdrView* pDrawView = GetViewShell()->GetSdrView();
    1267                 :            : 
    1268 [ #  # ][ #  # ]:          0 :             if (pDrawPage && pDrawView && pDrawView->GetSdrPageView())
         [ #  # ][ #  # ]
    1269                 :            :             {
    1270         [ #  # ]:          0 :                 Window* pActiveWin = pData->GetActiveWin();
    1271         [ #  # ]:          0 :                 Point aPos = pActiveWin->PixelToLogic(rPoint);
    1272                 :            : 
    1273                 :            :                 sal_uInt16 nHitLog = (sal_uInt16) pActiveWin->PixelToLogic(
    1274         [ #  # ]:          0 :                                  Size(pDrawView->GetHitTolerancePixel(),0)).Width();
    1275                 :            : 
    1276         [ #  # ]:          0 :                 sal_uInt32 nCount(pDrawPage->GetObjCount());
    1277                 :          0 :                 sal_Bool bFound(false);
    1278                 :          0 :                 sal_uInt32 i(0);
    1279 [ #  # ][ #  # ]:          0 :                 while (i < nCount && !bFound)
                 [ #  # ]
    1280                 :            :                 {
    1281         [ #  # ]:          0 :                     SdrObject* pObj = pDrawPage->GetObj(i);
    1282 [ #  # ][ #  # ]:          0 :                     if (pObj && SdrObjectPrimitiveHit(*pObj, aPos, nHitLog, *pDrawView->GetSdrPageView(), 0, false))
         [ #  # ][ #  # ]
    1283                 :            :                     {
    1284 [ #  # ][ #  # ]:          0 :                         xTarget.set(pObj->getUnoShape(), uno::UNO_QUERY);
    1285                 :          0 :                         bFound = sal_True;
    1286                 :            :                     }
    1287                 :          0 :                     ++i;
    1288                 :            :                 }
    1289                 :            :             }
    1290                 :            :         }
    1291                 :            :     }
    1292                 :          0 :     return xTarget;
    1293                 :            : }
    1294                 :            : 
    1295                 :          0 : bool ScTabViewObj::IsMouseListening() const
    1296                 :            : {
    1297         [ #  # ]:          0 :     if ( !aMouseClickHandlers.empty() )
    1298                 :          0 :         return true;
    1299                 :            : 
    1300                 :            :     // also include sheet events, because MousePressed must be called for them
    1301                 :          0 :     ScViewData* pViewData = GetViewShell()->GetViewData();
    1302                 :          0 :     ScDocument* pDoc = pViewData->GetDocument();
    1303                 :          0 :     SCTAB nTab = pViewData->GetTabNo();
    1304                 :            :     return
    1305                 :          0 :         pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_RIGHTCLICK, true ) ||
    1306 [ #  # ][ #  # ]:          0 :         pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_DOUBLECLICK, true );
    1307                 :            : }
    1308                 :            : 
    1309                 :          0 : sal_Bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
    1310                 :            :                                     throw (::uno::RuntimeException)
    1311                 :            : {
    1312                 :          0 :     sal_Bool bReturn(false);
    1313                 :            : 
    1314         [ #  # ]:          0 :     uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
    1315 [ #  # ][ #  # ]:          0 :     if (!aMouseClickHandlers.empty() && xTarget.is())
                 [ #  # ]
    1316                 :            :     {
    1317         [ #  # ]:          0 :         awt::EnhancedMouseEvent aMouseEvent;
    1318                 :            : 
    1319                 :          0 :         aMouseEvent.Buttons = e.Buttons;
    1320                 :          0 :         aMouseEvent.X = e.X;
    1321                 :          0 :         aMouseEvent.Y = e.Y;
    1322                 :          0 :         aMouseEvent.ClickCount = e.ClickCount;
    1323                 :          0 :         aMouseEvent.PopupTrigger = e.PopupTrigger;
    1324         [ #  # ]:          0 :         aMouseEvent.Target = xTarget;
    1325                 :            : 
    1326 [ #  # ][ #  # ]:          0 :         for (XMouseClickHandlerVector::iterator it = aMouseClickHandlers.begin(); it != aMouseClickHandlers.end(); )
         [ #  # ][ #  # ]
    1327                 :            :         {
    1328                 :            :             try
    1329                 :            :             {
    1330 [ #  # ][ #  # ]:          0 :                 if (!(*it)->mousePressed( aMouseEvent ))
         [ #  # ][ #  # ]
    1331                 :          0 :                     bReturn = sal_True;
    1332         [ #  # ]:          0 :                 ++it;
    1333                 :            :             }
    1334   [ #  #  #  # ]:          0 :             catch ( uno::Exception& )
    1335                 :            :             {
    1336         [ #  # ]:          0 :                 it = aMouseClickHandlers.erase(it);
    1337                 :            :             }
    1338         [ #  # ]:          0 :         }
    1339                 :            :     }
    1340                 :            : 
    1341                 :            :     // handle sheet events
    1342 [ #  # ][ #  # ]:          0 :     bool bDoubleClick = ( e.Buttons == awt::MouseButton::LEFT && e.ClickCount == 2 );
    1343 [ #  # ][ #  # ]:          0 :     bool bRightClick = ( e.Buttons == awt::MouseButton::RIGHT && e.ClickCount == 1 );
    1344 [ #  # ][ #  # ]:          0 :     if ( ( bDoubleClick || bRightClick ) && !bReturn && xTarget.is())
         [ #  # ][ #  # ]
                 [ #  # ]
    1345                 :            :     {
    1346         [ #  # ]:          0 :         sal_Int32 nEvent = bDoubleClick ? SC_SHEETEVENT_DOUBLECLICK : SC_SHEETEVENT_RIGHTCLICK;
    1347                 :            : 
    1348                 :          0 :         ScTabViewShell* pViewSh = GetViewShell();
    1349                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1350                 :          0 :         ScDocShell* pDocSh = pViewData->GetDocShell();
    1351                 :          0 :         ScDocument* pDoc = pDocSh->GetDocument();
    1352                 :          0 :         SCTAB nTab = pViewData->GetTabNo();
    1353         [ #  # ]:          0 :         const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab);
    1354         [ #  # ]:          0 :         if (pEvents)
    1355                 :            :         {
    1356         [ #  # ]:          0 :             const rtl::OUString* pScript = pEvents->GetScript(nEvent);
    1357         [ #  # ]:          0 :             if (pScript)
    1358                 :            :             {
    1359                 :            :                 // the macro parameter is the clicked object, as in the mousePressed call above
    1360         [ #  # ]:          0 :                 uno::Sequence<uno::Any> aParams(1);
    1361 [ #  # ][ #  # ]:          0 :                 aParams[0] <<= xTarget;
    1362                 :            : 
    1363                 :          0 :                 uno::Any aRet;
    1364         [ #  # ]:          0 :                 uno::Sequence<sal_Int16> aOutArgsIndex;
    1365         [ #  # ]:          0 :                 uno::Sequence<uno::Any> aOutArgs;
    1366                 :            : 
    1367 [ #  # ][ #  # ]:          0 :                 /*ErrCode eRet =*/ pDocSh->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
                 [ #  # ]
    1368                 :            : 
    1369                 :            :                 // look for a boolean return value of true
    1370                 :          0 :                 sal_Bool bRetValue = false;
    1371         [ #  # ]:          0 :                 if (aRet >>= bRetValue)
    1372                 :            :                 {
    1373         [ #  # ]:          0 :                     if (bRetValue)
    1374                 :          0 :                         bReturn = sal_True;
    1375 [ #  # ][ #  # ]:          0 :                 }
                 [ #  # ]
    1376                 :            :             }
    1377                 :            :         }
    1378                 :            : 
    1379                 :            :         // execute VBA event handler
    1380 [ #  # ][ #  # ]:          0 :         if (!bReturn && xTarget.is()) try
                 [ #  # ]
    1381                 :            :         {
    1382 [ #  # ][ #  # ]:          0 :             uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
    1383                 :            :             // the parameter is the clicked object, as in the mousePressed call above
    1384         [ #  # ]:          0 :             uno::Sequence< uno::Any > aArgs( 1 );
    1385 [ #  # ][ #  # ]:          0 :             aArgs[ 0 ] <<= xTarget;
    1386 [ #  # ][ #  # ]:          0 :             xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( nEvent ), aArgs );
         [ #  # ][ #  # ]
              [ #  #  # ]
    1387                 :            :         }
    1388         [ #  # ]:          0 :         catch( util::VetoException& )
    1389                 :            :         {
    1390                 :          0 :             bReturn = sal_True;
    1391                 :            :         }
    1392         [ #  # ]:          0 :         catch( uno::Exception& )
    1393                 :            :         {
    1394                 :            :         }
    1395                 :            :     }
    1396                 :            : 
    1397                 :          0 :     return bReturn;
    1398                 :            : }
    1399                 :            : 
    1400                 :          0 : sal_Bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e )
    1401                 :            :                                     throw (uno::RuntimeException)
    1402                 :            : {
    1403                 :          0 :     sal_Bool bReturn(false);
    1404                 :            : 
    1405         [ #  # ]:          0 :     if (!aMouseClickHandlers.empty())
    1406                 :            :     {
    1407         [ #  # ]:          0 :         uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
    1408                 :            : 
    1409         [ #  # ]:          0 :         if (xTarget.is())
    1410                 :            :         {
    1411         [ #  # ]:          0 :             awt::EnhancedMouseEvent aMouseEvent;
    1412                 :            : 
    1413                 :          0 :             aMouseEvent.Buttons = e.Buttons;
    1414                 :          0 :             aMouseEvent.X = e.X;
    1415                 :          0 :             aMouseEvent.Y = e.Y;
    1416                 :          0 :             aMouseEvent.ClickCount = e.ClickCount;
    1417                 :          0 :             aMouseEvent.PopupTrigger = e.PopupTrigger;
    1418         [ #  # ]:          0 :             aMouseEvent.Target = xTarget;
    1419                 :            : 
    1420 [ #  # ][ #  # ]:          0 :             for (XMouseClickHandlerVector::iterator it = aMouseClickHandlers.begin(); it != aMouseClickHandlers.end(); )
         [ #  # ][ #  # ]
    1421                 :            :             {
    1422                 :            :                 try
    1423                 :            :                 {
    1424 [ #  # ][ #  # ]:          0 :                     if (!(*it)->mouseReleased( aMouseEvent ))
         [ #  # ][ #  # ]
    1425                 :          0 :                         bReturn = sal_True;
    1426         [ #  # ]:          0 :                     ++it;
    1427                 :            :                 }
    1428   [ #  #  #  # ]:          0 :                 catch ( uno::Exception& )
    1429                 :            :                 {
    1430         [ #  # ]:          0 :                     it = aMouseClickHandlers.erase(it);
    1431                 :            :                 }
    1432         [ #  # ]:          0 :             }
    1433                 :          0 :         }
    1434                 :            :     }
    1435                 :          0 :     return bReturn;
    1436                 :            : }
    1437                 :            : 
    1438                 :            : // XEnhancedMouseClickBroadcaster
    1439                 :            : 
    1440                 :          4 : void ScTabViewObj::StartMouseListening()
    1441                 :            : {
    1442                 :          4 : }
    1443                 :            : 
    1444                 :          2 : void ScTabViewObj::EndMouseListening()
    1445                 :            : {
    1446         [ +  - ]:          2 :     lang::EventObject aEvent;
    1447         [ +  - ]:          2 :     aEvent.Source = (cppu::OWeakObject*)this;
    1448 [ +  - ][ +  - ]:          6 :     BOOST_FOREACH(const XMouseClickHandlerUnoRef rListener, aMouseClickHandlers)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
                 [ +  + ]
    1449                 :            :     {
    1450                 :            :         try
    1451                 :            :         {
    1452 [ +  - ][ +  - ]:          2 :             rListener->disposing(aEvent);
    1453                 :            :         }
    1454         [ #  # ]:          0 :         catch ( uno::Exception& )
    1455                 :            :         {
    1456                 :            :         }
    1457                 :          2 :     }
    1458 [ +  - ][ +  - ]:          2 :     aMouseClickHandlers.clear();
    1459         [ #  # ]:          2 : }
    1460                 :            : 
    1461                 :          0 : void ScTabViewObj::StartActivationListening()
    1462                 :            : {
    1463                 :          0 : }
    1464                 :            : 
    1465                 :          0 : void ScTabViewObj::EndActivationListening()
    1466                 :            : {
    1467         [ #  # ]:          0 :     lang::EventObject aEvent;
    1468         [ #  # ]:          0 :     aEvent.Source = (cppu::OWeakObject*)this;
    1469 [ #  # ][ #  # ]:          0 :     BOOST_FOREACH(const XActivationEventListenerUnoRef rListener, aActivationListeners)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1470                 :            :     {
    1471                 :            :         try
    1472                 :            :         {
    1473 [ #  # ][ #  # ]:          0 :             rListener->disposing(aEvent);
    1474                 :            :         }
    1475         [ #  # ]:          0 :         catch ( uno::Exception& )
    1476                 :            :         {
    1477                 :            :         }
    1478                 :          0 :     }
    1479 [ #  # ][ #  # ]:          0 :     aActivationListeners.clear();
    1480         [ #  # ]:          0 : }
    1481                 :            : 
    1482                 :          4 : void SAL_CALL ScTabViewObj::addEnhancedMouseClickHandler( const uno::Reference< awt::XEnhancedMouseClickHandler >& aListener )
    1483                 :            :                                     throw (uno::RuntimeException)
    1484                 :            : {
    1485         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1486                 :            : 
    1487         [ +  - ]:          4 :     if (aListener.is())
    1488                 :            :     {
    1489                 :          4 :         sal_uInt16 nCount = aMouseClickHandlers.size();
    1490                 :            :         uno::Reference<awt::XEnhancedMouseClickHandler> *pObj =
    1491                 :          4 :                 new uno::Reference<awt::XEnhancedMouseClickHandler>( aListener );
    1492         [ +  - ]:          4 :         aMouseClickHandlers.push_back( pObj );
    1493                 :            : 
    1494 [ +  - ][ +  - ]:          4 :         if (aMouseClickHandlers.size() == 1 && nCount == 0) // only if a listener added
                 [ +  - ]
    1495                 :          4 :             StartMouseListening();
    1496         [ +  - ]:          4 :     }
    1497                 :          4 : }
    1498                 :            : 
    1499                 :          0 : void SAL_CALL ScTabViewObj::removeEnhancedMouseClickHandler( const uno::Reference< awt::XEnhancedMouseClickHandler >& aListener )
    1500                 :            :                                     throw (uno::RuntimeException)
    1501                 :            : {
    1502         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1503                 :          0 :     sal_uInt16 nCount = aMouseClickHandlers.size();
    1504 [ #  # ][ #  # ]:          0 :     for (XMouseClickHandlerVector::iterator it = aMouseClickHandlers.begin(); it != aMouseClickHandlers.end(); )
         [ #  # ][ #  # ]
    1505                 :            :     {
    1506 [ #  # ][ #  # ]:          0 :         if ( *it == aListener )
                 [ #  # ]
    1507         [ #  # ]:          0 :             it = aMouseClickHandlers.erase(it);
    1508                 :            :         else
    1509         [ #  # ]:          0 :             ++it;
    1510                 :            :     }
    1511 [ #  # ][ #  # ]:          0 :     if ((aMouseClickHandlers.size() == 0) && (nCount > 0)) // only if last listener removed
                 [ #  # ]
    1512 [ #  # ][ #  # ]:          0 :         EndMouseListening();
    1513                 :          0 : }
    1514                 :            : 
    1515                 :            : // XActivationBroadcaster
    1516                 :            : 
    1517                 :          0 : void SAL_CALL ScTabViewObj::addActivationEventListener( const uno::Reference< sheet::XActivationEventListener >& aListener )
    1518                 :            :                                     throw (uno::RuntimeException)
    1519                 :            : {
    1520         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1521                 :            : 
    1522         [ #  # ]:          0 :     if (aListener.is())
    1523                 :            :     {
    1524                 :          0 :         sal_uInt16 nCount = aActivationListeners.size();
    1525                 :            :         uno::Reference<sheet::XActivationEventListener> *pObj =
    1526                 :          0 :                 new uno::Reference<sheet::XActivationEventListener>( aListener );
    1527         [ #  # ]:          0 :         aActivationListeners.push_back( pObj );
    1528                 :            : 
    1529 [ #  # ][ #  # ]:          0 :         if (aActivationListeners.size() == 1 && nCount == 0) // only if a listener added
                 [ #  # ]
    1530                 :          0 :             StartActivationListening();
    1531         [ #  # ]:          0 :     }
    1532                 :          0 : }
    1533                 :            : 
    1534                 :          0 : void SAL_CALL ScTabViewObj::removeActivationEventListener( const uno::Reference< sheet::XActivationEventListener >& aListener )
    1535                 :            :                                     throw (uno::RuntimeException)
    1536                 :            : {
    1537         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1538                 :          0 :     sal_uInt16 nCount = aActivationListeners.size();
    1539 [ #  # ][ #  # ]:          0 :     for (XActivationEventListenerVector::iterator it = aActivationListeners.begin(); it != aActivationListeners.end(); )
         [ #  # ][ #  # ]
    1540                 :            :     {
    1541 [ #  # ][ #  # ]:          0 :         if ( *it == aListener )
                 [ #  # ]
    1542         [ #  # ]:          0 :             it = aActivationListeners.erase(it);
    1543                 :            :         else
    1544         [ #  # ]:          0 :             ++it;
    1545                 :            :     }
    1546 [ #  # ][ #  # ]:          0 :     if ((aActivationListeners.size() == 0) && (nCount > 0)) // only if last listener removed
                 [ #  # ]
    1547 [ #  # ][ #  # ]:          0 :         EndActivationListening();
    1548                 :          0 : }
    1549                 :            : 
    1550                 :          0 : sal_Int16 ScTabViewObj::GetZoom(void) const
    1551                 :            : {
    1552                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1553         [ #  # ]:          0 :     if (pViewSh)
    1554                 :            :     {
    1555                 :          0 :         const Fraction& rZoomY = pViewSh->GetViewData()->GetZoomY();    // Y wird angezeigt
    1556                 :          0 :         return (sal_Int16)(( rZoomY.GetNumerator() * 100 ) / rZoomY.GetDenominator());
    1557                 :            :     }
    1558                 :          0 :     return 0;
    1559                 :            : }
    1560                 :            : 
    1561                 :          0 : void ScTabViewObj::SetZoom(sal_Int16 nZoom)
    1562                 :            : {
    1563                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1564         [ #  # ]:          0 :     if (pViewSh)
    1565                 :            :     {
    1566 [ #  # ][ #  # ]:          0 :         if ( nZoom != GetZoom() && nZoom != 0 )
                 [ #  # ]
    1567                 :            :         {
    1568         [ #  # ]:          0 :             if (!pViewSh->GetViewData()->IsPagebreakMode())
    1569                 :            :             {
    1570         [ #  # ]:          0 :                 ScModule* pScMod = SC_MOD();
    1571 [ #  # ][ #  # ]:          0 :                 ScAppOptions aNewOpt(pScMod->GetAppOptions());
    1572                 :          0 :                 aNewOpt.SetZoom( nZoom );
    1573         [ #  # ]:          0 :                 aNewOpt.SetZoomType( pViewSh->GetViewData()->GetView()->GetZoomType() );
    1574 [ #  # ][ #  # ]:          0 :                 pScMod->SetAppOptions( aNewOpt );
    1575                 :            :             }
    1576                 :            :         }
    1577         [ #  # ]:          0 :         Fraction aFract( nZoom, 100 );
    1578         [ #  # ]:          0 :         pViewSh->SetZoom( aFract, aFract, sal_True );
    1579         [ #  # ]:          0 :         pViewSh->PaintGrid();
    1580         [ #  # ]:          0 :         pViewSh->PaintTop();
    1581         [ #  # ]:          0 :         pViewSh->PaintLeft();
    1582         [ #  # ]:          0 :         pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
    1583         [ #  # ]:          0 :         pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
    1584                 :            :     }
    1585                 :          0 : }
    1586                 :            : 
    1587                 :          0 : sal_Int16 ScTabViewObj::GetZoomType(void) const
    1588                 :            : {
    1589                 :          0 :     sal_Int16 aZoomType = view::DocumentZoomType::OPTIMAL;
    1590                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1591         [ #  # ]:          0 :     if (pViewSh)
    1592                 :            :     {
    1593                 :          0 :         SvxZoomType eZoomType = pViewSh->GetViewData()->GetView()->GetZoomType();
    1594   [ #  #  #  #  :          0 :         switch (eZoomType)
                   #  # ]
    1595                 :            :         {
    1596                 :            :         case SVX_ZOOM_PERCENT:
    1597                 :          0 :             aZoomType = view::DocumentZoomType::BY_VALUE;
    1598                 :          0 :             break;
    1599                 :            :         case SVX_ZOOM_OPTIMAL:
    1600                 :          0 :             aZoomType = view::DocumentZoomType::OPTIMAL;
    1601                 :          0 :             break;
    1602                 :            :         case SVX_ZOOM_WHOLEPAGE:
    1603                 :          0 :             aZoomType = view::DocumentZoomType::ENTIRE_PAGE;
    1604                 :          0 :             break;
    1605                 :            :         case SVX_ZOOM_PAGEWIDTH:
    1606                 :          0 :             aZoomType = view::DocumentZoomType::PAGE_WIDTH;
    1607                 :          0 :             break;
    1608                 :            :         case SVX_ZOOM_PAGEWIDTH_NOBORDER:
    1609                 :          0 :             aZoomType = view::DocumentZoomType::PAGE_WIDTH_EXACT;
    1610                 :          0 :             break;
    1611                 :            :         }
    1612                 :            :     }
    1613                 :          0 :     return aZoomType;
    1614                 :            : }
    1615                 :            : 
    1616                 :          0 : void ScTabViewObj::SetZoomType(sal_Int16 aZoomType)
    1617                 :            : {
    1618                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1619         [ #  # ]:          0 :     if (pViewSh)
    1620                 :            :     {
    1621                 :          0 :         ScDBFunc* pView = pViewSh->GetViewData()->GetView();
    1622         [ #  # ]:          0 :         if (pView)
    1623                 :            :         {
    1624                 :            :             SvxZoomType eZoomType;
    1625   [ #  #  #  #  :          0 :             switch (aZoomType)
                   #  # ]
    1626                 :            :             {
    1627                 :            :             case view::DocumentZoomType::BY_VALUE:
    1628                 :          0 :                 eZoomType = SVX_ZOOM_PERCENT;
    1629                 :          0 :                 break;
    1630                 :            :             case view::DocumentZoomType::OPTIMAL:
    1631                 :          0 :                 eZoomType = SVX_ZOOM_OPTIMAL;
    1632                 :          0 :                 break;
    1633                 :            :             case view::DocumentZoomType::ENTIRE_PAGE:
    1634                 :          0 :                 eZoomType = SVX_ZOOM_WHOLEPAGE;
    1635                 :          0 :                 break;
    1636                 :            :             case view::DocumentZoomType::PAGE_WIDTH:
    1637                 :          0 :                 eZoomType = SVX_ZOOM_PAGEWIDTH;
    1638                 :          0 :                 break;
    1639                 :            :             case view::DocumentZoomType::PAGE_WIDTH_EXACT:
    1640                 :          0 :                 eZoomType = SVX_ZOOM_PAGEWIDTH_NOBORDER;
    1641                 :          0 :                 break;
    1642                 :            :             default:
    1643                 :          0 :                 eZoomType = SVX_ZOOM_OPTIMAL;
    1644                 :            :             }
    1645                 :          0 :             sal_Int16 nZoom(GetZoom());
    1646                 :          0 :             sal_Int16 nOldZoom(nZoom);
    1647         [ #  # ]:          0 :             if ( eZoomType == SVX_ZOOM_PERCENT )
    1648                 :            :             {
    1649         [ #  # ]:          0 :                 if ( nZoom < MINZOOM )  nZoom = MINZOOM;
    1650         [ #  # ]:          0 :                 if ( nZoom > MAXZOOM )  nZoom = MAXZOOM;
    1651                 :            :             }
    1652                 :            :             else
    1653                 :          0 :                 nZoom = pView->CalcZoom( eZoomType, nOldZoom );
    1654                 :            : 
    1655         [ #  # ]:          0 :             switch ( eZoomType )
    1656                 :            :             {
    1657                 :            :                 case SVX_ZOOM_WHOLEPAGE:
    1658                 :            :                 case SVX_ZOOM_PAGEWIDTH:
    1659                 :          0 :                     pView->SetZoomType( eZoomType, sal_True );
    1660                 :          0 :                     break;
    1661                 :            : 
    1662                 :            :                 default:
    1663                 :          0 :                     pView->SetZoomType( SVX_ZOOM_PERCENT, sal_True );
    1664                 :            :             }
    1665                 :          0 :             SetZoom( nZoom );
    1666                 :            :         }
    1667                 :            :     }
    1668                 :          0 : }
    1669                 :            : 
    1670                 :          0 : sal_Bool SAL_CALL ScTabViewObj::getIsWindowSplit() throw(uno::RuntimeException)
    1671                 :            : {
    1672         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1673                 :            :     //  wie Menue-Slot SID_WINDOW_SPLIT
    1674                 :            : 
    1675                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1676         [ #  # ]:          0 :     if (pViewSh)
    1677                 :            :     {
    1678                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1679                 :          0 :         return ( pViewData->GetHSplitMode() == SC_SPLIT_NORMAL ||
    1680 [ #  # ][ #  # ]:          0 :                  pViewData->GetVSplitMode() == SC_SPLIT_NORMAL );
    1681                 :            :     }
    1682                 :            : 
    1683         [ #  # ]:          0 :     return false;
    1684                 :            : }
    1685                 :            : 
    1686                 :          0 : sal_Bool SAL_CALL ScTabViewObj::hasFrozenPanes() throw(uno::RuntimeException)
    1687                 :            : {
    1688         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1689                 :            :     //  wie Menue-Slot SID_WINDOW_FIX
    1690                 :            : 
    1691                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1692         [ #  # ]:          0 :     if (pViewSh)
    1693                 :            :     {
    1694                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1695                 :          0 :         return ( pViewData->GetHSplitMode() == SC_SPLIT_FIX ||
    1696 [ #  # ][ #  # ]:          0 :                  pViewData->GetVSplitMode() == SC_SPLIT_FIX );
    1697                 :            :     }
    1698                 :            : 
    1699         [ #  # ]:          0 :     return false;
    1700                 :            : }
    1701                 :            : 
    1702                 :          0 : sal_Int32 SAL_CALL ScTabViewObj::getSplitHorizontal() throw(uno::RuntimeException)
    1703                 :            : {
    1704         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1705                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1706         [ #  # ]:          0 :     if (pViewSh)
    1707                 :            :     {
    1708                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1709         [ #  # ]:          0 :         if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE )
    1710                 :          0 :             return pViewData->GetHSplitPos();
    1711                 :            :     }
    1712         [ #  # ]:          0 :     return 0;
    1713                 :            : }
    1714                 :            : 
    1715                 :          0 : sal_Int32 SAL_CALL ScTabViewObj::getSplitVertical() throw(uno::RuntimeException)
    1716                 :            : {
    1717         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1718                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1719         [ #  # ]:          0 :     if (pViewSh)
    1720                 :            :     {
    1721                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1722         [ #  # ]:          0 :         if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
    1723                 :          0 :             return pViewData->GetVSplitPos();
    1724                 :            :     }
    1725         [ #  # ]:          0 :     return 0;
    1726                 :            : }
    1727                 :            : 
    1728                 :          0 : sal_Int32 SAL_CALL ScTabViewObj::getSplitColumn() throw(uno::RuntimeException)
    1729                 :            : {
    1730         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1731                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1732         [ #  # ]:          0 :     if (pViewSh)
    1733                 :            :     {
    1734                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1735         [ #  # ]:          0 :         if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE )
    1736                 :            :         {
    1737                 :          0 :             long nSplit = pViewData->GetHSplitPos();
    1738                 :            : 
    1739                 :          0 :             ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT;
    1740         [ #  # ]:          0 :             if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
    1741                 :          0 :                 ePos = SC_SPLIT_TOPLEFT;
    1742                 :            : 
    1743                 :            :             SCsCOL nCol;
    1744                 :            :             SCsROW nRow;
    1745         [ #  # ]:          0 :             pViewData->GetPosFromPixel( nSplit, 0, ePos, nCol, nRow, false );
    1746         [ #  # ]:          0 :             if ( nCol > 0 )
    1747                 :          0 :                 return nCol;
    1748                 :            :         }
    1749                 :            :     }
    1750         [ #  # ]:          0 :     return 0;
    1751                 :            : }
    1752                 :            : 
    1753                 :          0 : sal_Int32 SAL_CALL ScTabViewObj::getSplitRow() throw(uno::RuntimeException)
    1754                 :            : {
    1755         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1756                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1757         [ #  # ]:          0 :     if (pViewSh)
    1758                 :            :     {
    1759                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1760         [ #  # ]:          0 :         if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE )
    1761                 :            :         {
    1762                 :          0 :             long nSplit = pViewData->GetVSplitPos();
    1763                 :            : 
    1764                 :          0 :             ScSplitPos ePos = SC_SPLIT_TOPLEFT;     // es ist vertikal geteilt
    1765                 :            :             SCsCOL nCol;
    1766                 :            :             SCsROW nRow;
    1767         [ #  # ]:          0 :             pViewData->GetPosFromPixel( 0, nSplit, ePos, nCol, nRow, false );
    1768         [ #  # ]:          0 :             if ( nRow > 0 )
    1769                 :          0 :                 return nRow;
    1770                 :            :         }
    1771                 :            :     }
    1772         [ #  # ]:          0 :     return 0;
    1773                 :            : }
    1774                 :            : 
    1775                 :          0 : void SAL_CALL ScTabViewObj::splitAtPosition( sal_Int32 nPixelX, sal_Int32 nPixelY )
    1776                 :            :                                                 throw(uno::RuntimeException)
    1777                 :            : {
    1778         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1779                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1780         [ #  # ]:          0 :     if (pViewSh)
    1781                 :            :     {
    1782         [ #  # ]:          0 :         pViewSh->SplitAtPixel( Point( nPixelX, nPixelY ), sal_True, sal_True );
    1783         [ #  # ]:          0 :         pViewSh->FreezeSplitters( false );
    1784         [ #  # ]:          0 :         pViewSh->InvalidateSplit();
    1785         [ #  # ]:          0 :     }
    1786                 :          0 : }
    1787                 :            : 
    1788                 :          0 : void SAL_CALL ScTabViewObj::freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRows )
    1789                 :            :                                                 throw(uno::RuntimeException)
    1790                 :            : {
    1791         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1792                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    1793         [ #  # ]:          0 :     if (pViewSh)
    1794                 :            :     {
    1795                 :            :         //  erst alles aufheben -> kein Stress mit Scrolling zwischendurch o.ae.
    1796                 :            : 
    1797         [ #  # ]:          0 :         pViewSh->RemoveSplit();
    1798                 :            : 
    1799                 :          0 :         Point aWinStart;
    1800         [ #  # ]:          0 :         Window* pWin = pViewSh->GetWindowByPos( SC_SPLIT_BOTTOMLEFT );
    1801         [ #  # ]:          0 :         if (pWin)
    1802         [ #  # ]:          0 :             aWinStart = pWin->GetPosPixel();
    1803                 :            : 
    1804                 :          0 :         ScViewData* pViewData = pViewSh->GetViewData();
    1805         [ #  # ]:          0 :         Point aSplit(pViewData->GetScrPos( (SCCOL)nColumns, (SCROW)nRows, SC_SPLIT_BOTTOMLEFT, sal_True ));
    1806                 :          0 :         aSplit += aWinStart;
    1807                 :            : 
    1808         [ #  # ]:          0 :         pViewSh->SplitAtPixel( aSplit, sal_True, sal_True );
    1809         [ #  # ]:          0 :         pViewSh->FreezeSplitters( sal_True );
    1810         [ #  # ]:          0 :         pViewSh->InvalidateSplit();
    1811         [ #  # ]:          0 :     }
    1812                 :          0 : }
    1813                 :            : 
    1814                 :          9 : void SAL_CALL ScTabViewObj::addSelectionChangeListener(
    1815                 :            :                 const uno::Reference<view::XSelectionChangeListener>& xListener )
    1816                 :            :                                                     throw(uno::RuntimeException)
    1817                 :            : {
    1818         [ +  - ]:          9 :     SolarMutexGuard aGuard;
    1819                 :            :     uno::Reference<view::XSelectionChangeListener>* pObj =
    1820                 :          9 :             new uno::Reference<view::XSelectionChangeListener>( xListener );
    1821 [ +  - ][ +  - ]:          9 :     aSelectionChgListeners.push_back( pObj );
    1822                 :          9 : }
    1823                 :            : 
    1824                 :          0 : void SAL_CALL ScTabViewObj::removeSelectionChangeListener(
    1825                 :            :                 const uno::Reference< view::XSelectionChangeListener >& xListener )
    1826                 :            :                                                     throw(uno::RuntimeException)
    1827                 :            : {
    1828         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1829 [ #  # ][ #  # ]:          0 :     for (XSelectionChangeListenerVector::iterator it = aSelectionChgListeners.begin();
         [ #  # ][ #  # ]
    1830         [ #  # ]:          0 :          it != aSelectionChgListeners.end(); ++it )
    1831                 :            :     {
    1832 [ #  # ][ #  # ]:          0 :         if ( *it == xListener ) //! wozu der Mumpitz mit queryInterface?
                 [ #  # ]
    1833                 :            :         {
    1834         [ #  # ]:          0 :             aSelectionChgListeners.erase(it);
    1835                 :          0 :             break;
    1836                 :            :         }
    1837         [ #  # ]:          0 :     }
    1838                 :          0 : }
    1839                 :            : 
    1840                 :        351 : void ScTabViewObj::SelectionChanged()
    1841                 :            : {
    1842         [ +  - ]:        351 :     lang::EventObject aEvent;
    1843         [ +  - ]:        351 :     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
    1844 [ +  - ][ +  - ]:        371 :     BOOST_FOREACH(const XSelectionChangeListenerUnoRef rListener, aSelectionChgListeners)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
                 [ +  + ]
    1845 [ +  - ][ +  - ]:         20 :         rListener->selectionChanged( aEvent );
    1846                 :            : 
    1847                 :            :     // handle sheet events
    1848                 :        351 :     ScTabViewShell* pViewSh = GetViewShell();
    1849                 :        351 :     ScViewData* pViewData = pViewSh->GetViewData();
    1850                 :        351 :     ScDocShell* pDocSh = pViewData->GetDocShell();
    1851                 :        351 :     ScDocument* pDoc = pDocSh->GetDocument();
    1852                 :        351 :     SCTAB nTab = pViewData->GetTabNo();
    1853         [ +  - ]:        351 :     const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab);
    1854         [ -  + ]:        351 :     if (pEvents)
    1855                 :            :     {
    1856         [ #  # ]:          0 :         const rtl::OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_SELECT);
    1857         [ #  # ]:          0 :         if (pScript)
    1858                 :            :         {
    1859                 :            :             // the macro parameter is the selection as returned by getSelection
    1860         [ #  # ]:          0 :             uno::Sequence<uno::Any> aParams(1);
    1861 [ #  # ][ #  # ]:          0 :             aParams[0] = getSelection();
    1862                 :          0 :             uno::Any aRet;
    1863         [ #  # ]:          0 :             uno::Sequence<sal_Int16> aOutArgsIndex;
    1864         [ #  # ]:          0 :             uno::Sequence<uno::Any> aOutArgs;
    1865 [ #  # ][ #  # ]:          0 :             /*ErrCode eRet =*/ pDocSh->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1866                 :            :         }
    1867         [ +  - ]:        351 :     }
    1868                 :            :     // Removed Sun/Oracle code intentionally, it doesn't work properly ( selection should be fired after mouse release )
    1869                 :        351 : }
    1870                 :            : 
    1871                 :            : 
    1872                 :            : //  XPropertySet (View-Optionen)
    1873                 :            : //! auch an der Applikation anbieten?
    1874                 :            : 
    1875                 :        689 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTabViewObj::getPropertySetInfo()
    1876                 :            :                                                         throw(uno::RuntimeException)
    1877                 :            : {
    1878         [ +  - ]:        689 :     SolarMutexGuard aGuard;
    1879                 :            :     static uno::Reference<beans::XPropertySetInfo> aRef(
    1880 [ +  + ][ +  - ]:        689 :         new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
    1881         [ +  - ]:        689 :     return aRef;
    1882                 :            : }
    1883                 :            : 
    1884                 :          2 : void SAL_CALL ScTabViewObj::setPropertyValue(
    1885                 :            :                         const rtl::OUString& aPropertyName, const uno::Any& aValue )
    1886                 :            :                 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
    1887                 :            :                         lang::IllegalArgumentException, lang::WrappedTargetException,
    1888                 :            :                         uno::RuntimeException)
    1889                 :            : {
    1890         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1891         [ +  - ]:          2 :     String aString(aPropertyName);
    1892                 :            : 
    1893 [ +  - ][ -  + ]:          2 :     if ( aString.EqualsAscii(SC_UNO_FILTERED_RANGE_SELECTION) )
    1894                 :            :     {
    1895         [ #  # ]:          0 :         bFilteredRangeSelection = ScUnoHelpFunctions::GetBoolFromAny(aValue);
    1896                 :          2 :         return;
    1897                 :            :     }
    1898                 :            : 
    1899                 :          2 :     ScTabViewShell* pViewSh = GetViewShell();
    1900         [ +  - ]:          2 :     if (pViewSh)
    1901                 :            :     {
    1902                 :          2 :         ScViewData* pViewData = pViewSh->GetViewData();
    1903                 :          2 :         const ScViewOptions& rOldOpt = pViewSh->GetViewData()->GetOptions();
    1904         [ +  - ]:          2 :         ScViewOptions aNewOpt(rOldOpt);
    1905                 :            : 
    1906 [ +  - ][ +  - ]:          2 :         if ( aString.EqualsAscii( SC_UNO_COLROWHDR ) || aString.EqualsAscii( OLD_UNO_COLROWHDR ) )
         [ +  - ][ -  + ]
                 [ -  + ]
    1907         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1908 [ +  - ][ +  - ]:          2 :         else if ( aString.EqualsAscii( SC_UNO_HORSCROLL ) || aString.EqualsAscii( OLD_UNO_HORSCROLL ) )
         [ +  - ][ -  + ]
                 [ -  + ]
    1909         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_HSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1910 [ +  - ][ +  - ]:          2 :         else if ( aString.EqualsAscii( SC_UNO_OUTLSYMB ) || aString.EqualsAscii( OLD_UNO_OUTLSYMB ) )
         [ +  - ][ -  + ]
                 [ -  + ]
    1911         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1912 [ +  - ][ +  - ]:          2 :         else if ( aString.EqualsAscii( SC_UNO_SHEETTABS ) || aString.EqualsAscii( OLD_UNO_SHEETTABS ) )
         [ +  - ][ -  + ]
                 [ -  + ]
    1913         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1914 [ +  - ][ -  + ]:          2 :         else if ( aString.EqualsAscii( SC_UNO_SHOWANCHOR ) )
    1915         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_ANCHOR, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1916 [ +  - ][ -  + ]:          2 :         else if ( aString.EqualsAscii( SC_UNO_SHOWFORM ) )
    1917         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_FORMULAS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1918 [ +  - ][ +  - ]:          2 :         else if ( aString.EqualsAscii( SC_UNO_SHOWGRID ) )
    1919         [ +  - ]:          2 :             aNewOpt.SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1920 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWHELP ) )
    1921         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_HELPLINES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1922 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWNOTES ) )
    1923         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1924 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWPAGEBR ) )
    1925         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1926 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWZERO ) )
    1927         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1928 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_VALUEHIGH ) || aString.EqualsAscii( OLD_UNO_VALUEHIGH ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1929         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1930 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_VERTSCROLL ) || aString.EqualsAscii( OLD_UNO_VERTSCROLL ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1931         [ #  # ]:          0 :             aNewOpt.SetOption( VOPT_VSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
    1932 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWOBJ ) )
    1933                 :            :         {
    1934                 :          0 :             sal_Int16 nIntVal = 0;
    1935         [ #  # ]:          0 :             if ( aValue >>= nIntVal )
    1936                 :            :             {
    1937                 :            :                 //#i80528# adapt to new range eventually
    1938         [ #  # ]:          0 :                 if((sal_Int16)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int16)VOBJ_MODE_SHOW;
    1939                 :            : 
    1940                 :          0 :                 aNewOpt.SetObjMode( VOBJ_TYPE_OLE, (ScVObjMode)nIntVal);
    1941                 :            :             }
    1942                 :            :         }
    1943 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWCHARTS ) )
    1944                 :            :         {
    1945                 :          0 :             sal_Int16 nIntVal = 0;
    1946         [ #  # ]:          0 :             if ( aValue >>= nIntVal )
    1947                 :            :             {
    1948                 :            :                 //#i80528# adapt to new range eventually
    1949         [ #  # ]:          0 :                 if((sal_Int16)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int16)VOBJ_MODE_SHOW;
    1950                 :            : 
    1951                 :          0 :                 aNewOpt.SetObjMode( VOBJ_TYPE_CHART, (ScVObjMode)nIntVal);
    1952                 :            :             }
    1953                 :            :         }
    1954 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWDRAW ) )
    1955                 :            :         {
    1956                 :          0 :             sal_Int16 nIntVal = 0;
    1957         [ #  # ]:          0 :             if ( aValue >>= nIntVal )
    1958                 :            :             {
    1959                 :            :                 //#i80528# adapt to new range eventually
    1960         [ #  # ]:          0 :                 if((sal_Int16)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int16)VOBJ_MODE_SHOW;
    1961                 :            : 
    1962                 :          0 :                 aNewOpt.SetObjMode( VOBJ_TYPE_DRAW, (ScVObjMode)nIntVal);
    1963                 :            :             }
    1964                 :            :         }
    1965 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_GRIDCOLOR ) )
    1966                 :            :         {
    1967                 :          0 :             sal_Int32 nIntVal = 0;
    1968         [ #  # ]:          0 :             if ( aValue >>= nIntVal )
    1969 [ #  # ][ #  # ]:          0 :                 aNewOpt.SetGridColor( nIntVal, String() );
                 [ #  # ]
    1970                 :            :         }
    1971 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_ZOOMTYPE ) )
    1972                 :            :         {
    1973                 :          0 :             sal_Int16 nIntVal = 0;
    1974         [ #  # ]:          0 :             if ( aValue >>= nIntVal )
    1975         [ #  # ]:          0 :                 SetZoomType(nIntVal);
    1976                 :            :         }
    1977 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_ZOOMVALUE ) )
    1978                 :            :         {
    1979                 :          0 :             sal_Int16 nIntVal = 0;
    1980         [ #  # ]:          0 :             if ( aValue >>= nIntVal )
    1981         [ #  # ]:          0 :                 SetZoom(nIntVal);
    1982                 :            :         }
    1983                 :            : 
    1984                 :            :         //  Optionen werden an der View und am Dokument (fuer neue Views) gesetzt,
    1985                 :            :         //  damit sie beim Speichern erhalten bleiben.
    1986                 :            :         //! An der App (Module) braeuchte man noch eine Extra-Moeglichkeit,
    1987                 :            :         //! das einzustellen (fuer neue Dokumente)
    1988                 :            : 
    1989 [ +  - ][ +  - ]:          2 :         if ( aNewOpt != rOldOpt )
    1990                 :            :         {
    1991         [ +  - ]:          2 :             pViewData->SetOptions( aNewOpt );
    1992 [ +  - ][ +  - ]:          2 :             pViewData->GetDocument()->SetViewOptions( aNewOpt );
    1993         [ +  - ]:          2 :             pViewData->GetDocShell()->SetDocumentModified();    //! wirklich?
    1994                 :            : 
    1995         [ +  - ]:          2 :             pViewSh->UpdateFixPos();
    1996         [ +  - ]:          2 :             pViewSh->PaintGrid();
    1997         [ +  - ]:          2 :             pViewSh->PaintTop();
    1998         [ +  - ]:          2 :             pViewSh->PaintLeft();
    1999         [ +  - ]:          2 :             pViewSh->PaintExtras();
    2000         [ +  - ]:          2 :             pViewSh->InvalidateBorder();
    2001                 :            : 
    2002                 :          2 :             SfxBindings& rBindings = pViewSh->GetViewFrame()->GetBindings();
    2003         [ +  - ]:          2 :             rBindings.Invalidate( FID_TOGGLEHEADERS ); // -> Checks im Menue
    2004         [ +  - ]:          2 :             rBindings.Invalidate( FID_TOGGLESYNTAX );
    2005         [ +  - ]:          2 :         }
    2006 [ +  - ][ -  + ]:          2 :     }
         [ +  - ][ +  - ]
    2007                 :            : }
    2008                 :            : 
    2009                 :          0 : uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const rtl::OUString& aPropertyName )
    2010                 :            :                 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
    2011                 :            :                         uno::RuntimeException)
    2012                 :            : {
    2013         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2014         [ #  # ]:          0 :     String aString(aPropertyName);
    2015                 :          0 :     uno::Any aRet;
    2016                 :            : 
    2017 [ #  # ][ #  # ]:          0 :     if ( aString.EqualsAscii(SC_UNO_FILTERED_RANGE_SELECTION) )
    2018                 :            :     {
    2019         [ #  # ]:          0 :         ScUnoHelpFunctions::SetBoolInAny(aRet, bFilteredRangeSelection);
    2020                 :            :         return aRet;
    2021                 :            :     }
    2022                 :            : 
    2023                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    2024         [ #  # ]:          0 :     if (pViewSh)
    2025                 :            :     {
    2026                 :          0 :         const ScViewOptions& rOpt = pViewSh->GetViewData()->GetOptions();
    2027                 :            : 
    2028 [ #  # ][ #  # ]:          0 :         if ( aString.EqualsAscii( SC_UNO_COLROWHDR ) || aString.EqualsAscii( OLD_UNO_COLROWHDR ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2029         [ #  # ]:          0 :             ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HEADER ) );
    2030 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_HORSCROLL ) || aString.EqualsAscii( OLD_UNO_HORSCROLL ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2031         [ #  # ]:          0 :             ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HSCROLL ) );
    2032 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_OUTLSYMB ) || aString.EqualsAscii( OLD_UNO_OUTLSYMB ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2033         [ #  # ]:          0 :             ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_OUTLINER ) );
    2034 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHEETTABS ) || aString.EqualsAscii( OLD_UNO_SHEETTABS ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2035         [ #  # ]:          0 :             ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_TABCONTROLS ) );
    2036 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWANCHOR ) ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_ANCHOR ) );
                 [ #  # ]
    2037 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWFORM ) )   ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_FORMULAS ) );
                 [ #  # ]
    2038 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWGRID ) )   ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_GRID ) );
                 [ #  # ]
    2039 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWHELP ) )   ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HELPLINES ) );
                 [ #  # ]
    2040 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWNOTES ) )  ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_NOTES ) );
                 [ #  # ]
    2041 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWPAGEBR ) ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_PAGEBREAKS ) );
                 [ #  # ]
    2042 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWZERO ) )   ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_NULLVALS ) );
                 [ #  # ]
    2043 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_VALUEHIGH ) || aString.EqualsAscii( OLD_UNO_VALUEHIGH ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2044         [ #  # ]:          0 :             ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_SYNTAX ) );
    2045 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_VERTSCROLL ) || aString.EqualsAscii( OLD_UNO_VERTSCROLL ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2046         [ #  # ]:          0 :             ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_VSCROLL ) );
    2047 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWOBJ ) )    aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_OLE ) );
                 [ #  # ]
    2048 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWCHARTS ) ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_CHART ) );
                 [ #  # ]
    2049 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_SHOWDRAW ) )   aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_DRAW ) );
                 [ #  # ]
    2050 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_GRIDCOLOR ) )  aRet <<= (sal_Int32)( rOpt.GetGridColor().GetColor() );
         [ #  # ][ #  # ]
    2051 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_VISAREA ) ) aRet <<= GetVisArea();
         [ #  # ][ #  # ]
    2052 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_ZOOMTYPE ) ) aRet <<= GetZoomType();
         [ #  # ][ #  # ]
    2053 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_ZOOMVALUE ) ) aRet <<= GetZoom();
                 [ #  # ]
    2054 [ #  # ][ #  # ]:          0 :         else if ( aString.EqualsAscii( SC_UNO_VISAREASCREEN ) )
    2055                 :            :         {
    2056                 :          0 :             ScViewData* pViewData = pViewSh->GetViewData();
    2057 [ #  # ][ #  # ]:          0 :             Window* pActiveWin = ( pViewData ? pViewData->GetActiveWin() : NULL );
    2058         [ #  # ]:          0 :             if ( pActiveWin )
    2059                 :            :             {
    2060         [ #  # ]:          0 :                 Rectangle aRect = pActiveWin->GetWindowExtentsRelative( NULL );
    2061 [ #  # ][ #  # ]:          0 :                 aRet <<= AWTRectangle( aRect );
    2062                 :            :             }
    2063                 :            :         }
    2064                 :            :     }
    2065                 :            : 
    2066 [ #  # ][ #  # ]:          0 :     return aRet;
    2067                 :            : }
    2068                 :            : 
    2069                 :          0 : void SAL_CALL ScTabViewObj::addPropertyChangeListener( const ::rtl::OUString& /* aPropertyName */,
    2070                 :            :                                     const uno::Reference<beans::XPropertyChangeListener >& xListener )
    2071                 :            :                                 throw(beans::UnknownPropertyException,
    2072                 :            :                                     lang::WrappedTargetException,
    2073                 :            :                                     uno::RuntimeException)
    2074                 :            : {
    2075         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2076                 :            :     uno::Reference<beans::XPropertyChangeListener>* pObj =
    2077                 :          0 :             new uno::Reference<beans::XPropertyChangeListener>( xListener );
    2078 [ #  # ][ #  # ]:          0 :     aPropertyChgListeners.push_back( pObj );
    2079                 :          0 : }
    2080                 :            : 
    2081                 :          0 : void SAL_CALL ScTabViewObj::removePropertyChangeListener( const ::rtl::OUString& /* aPropertyName */,
    2082                 :            :                                     const uno::Reference<beans::XPropertyChangeListener >& xListener )
    2083                 :            :                                 throw(beans::UnknownPropertyException,
    2084                 :            :                                     lang::WrappedTargetException,
    2085                 :            :                                     uno::RuntimeException)
    2086                 :            : {
    2087         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2088 [ #  # ][ #  # ]:          0 :     for (XViewPropertyChangeListenerVector::iterator it = aPropertyChgListeners.begin();
         [ #  # ][ #  # ]
    2089         [ #  # ]:          0 :          it != aPropertyChgListeners.end(); ++it )
    2090                 :            :     {
    2091 [ #  # ][ #  # ]:          0 :         if ( *it == xListener ) //! wozu der Mumpitz mit queryInterface?
                 [ #  # ]
    2092                 :            :         {
    2093         [ #  # ]:          0 :             aPropertyChgListeners.erase(it);
    2094                 :          0 :             break;
    2095                 :            :         }
    2096         [ #  # ]:          0 :     }
    2097                 :          0 : }
    2098                 :            : 
    2099                 :          0 : void SAL_CALL ScTabViewObj::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */,
    2100                 :            :                                     const uno::Reference<beans::XVetoableChangeListener >& /* aListener */ )
    2101                 :            :                                 throw(beans::UnknownPropertyException,
    2102                 :            :                                     lang::WrappedTargetException,
    2103                 :            :                                     uno::RuntimeException)
    2104                 :            : {
    2105                 :          0 : }
    2106                 :            : 
    2107                 :          0 : void SAL_CALL ScTabViewObj::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */,
    2108                 :            :                                     const uno::Reference<beans::XVetoableChangeListener >& /* aListener */ )
    2109                 :            :                                 throw(beans::UnknownPropertyException,
    2110                 :            :                                     lang::WrappedTargetException,
    2111                 :            :                                     uno::RuntimeException)
    2112                 :            : {
    2113                 :          0 : }
    2114                 :            : 
    2115                 :        835 : void ScTabViewObj::VisAreaChanged()
    2116                 :            : {
    2117         [ +  - ]:        835 :     beans::PropertyChangeEvent aEvent;
    2118         [ +  - ]:        835 :     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
    2119 [ +  - ][ +  - ]:        835 :     BOOST_FOREACH(const XViewPropertyChangeListenerUnoRef rListener, aPropertyChgListeners)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ +  - ][ -  + ]
                 [ -  + ]
    2120 [ #  # ][ #  # ]:        835 :         rListener->propertyChange( aEvent );
                 [ +  - ]
    2121                 :        835 : }
    2122                 :            : 
    2123                 :            : // XRangeSelection
    2124                 :            : 
    2125                 :          0 : void SAL_CALL ScTabViewObj::startRangeSelection(
    2126                 :            :                                 const uno::Sequence<beans::PropertyValue>& aArguments )
    2127                 :            :                                     throw(uno::RuntimeException)
    2128                 :            : {
    2129         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2130                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    2131         [ #  # ]:          0 :     if (pViewSh)
    2132                 :            :     {
    2133 [ #  # ][ #  # ]:          0 :         String aInitVal, aTitle;
    2134                 :          0 :         sal_Bool bCloseOnButtonUp = false;
    2135                 :          0 :         sal_Bool bSingleCell = false;
    2136                 :          0 :         sal_Bool bMultiSelection = false;
    2137                 :            : 
    2138                 :          0 :         rtl::OUString aStrVal;
    2139                 :          0 :         const beans::PropertyValue* pPropArray = aArguments.getConstArray();
    2140                 :          0 :         long nPropCount = aArguments.getLength();
    2141         [ #  # ]:          0 :         for (long i = 0; i < nPropCount; i++)
    2142                 :            :         {
    2143                 :          0 :             const beans::PropertyValue& rProp = pPropArray[i];
    2144         [ #  # ]:          0 :             String aPropName(rProp.Name);
    2145                 :            : 
    2146 [ #  # ][ #  # ]:          0 :             if (aPropName.EqualsAscii( SC_UNONAME_CLOSEONUP ))
    2147         [ #  # ]:          0 :                 bCloseOnButtonUp = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
    2148 [ #  # ][ #  # ]:          0 :             else if (aPropName.EqualsAscii( SC_UNONAME_TITLE ))
    2149                 :            :             {
    2150         [ #  # ]:          0 :                 if ( rProp.Value >>= aStrVal )
    2151 [ #  # ][ #  # ]:          0 :                     aTitle = String( aStrVal );
                 [ #  # ]
    2152                 :            :             }
    2153 [ #  # ][ #  # ]:          0 :             else if (aPropName.EqualsAscii( SC_UNONAME_INITVAL ))
    2154                 :            :             {
    2155         [ #  # ]:          0 :                 if ( rProp.Value >>= aStrVal )
    2156 [ #  # ][ #  # ]:          0 :                     aInitVal = String( aStrVal );
                 [ #  # ]
    2157                 :            :             }
    2158 [ #  # ][ #  # ]:          0 :             else if (aPropName.EqualsAscii( SC_UNONAME_SINGLECELL ))
    2159         [ #  # ]:          0 :                 bSingleCell = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
    2160 [ #  # ][ #  # ]:          0 :             else if (aPropName.EqualsAscii( SC_UNONAME_MULTISEL ))
    2161         [ #  # ]:          0 :                 bMultiSelection = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
    2162         [ #  # ]:          0 :         }
    2163                 :            : 
    2164 [ #  # ][ #  # ]:          0 :         pViewSh->StartSimpleRefDialog( aTitle, aInitVal, bCloseOnButtonUp, bSingleCell, bMultiSelection );
                 [ #  # ]
    2165         [ #  # ]:          0 :     }
    2166                 :          0 : }
    2167                 :            : 
    2168                 :          0 : void SAL_CALL ScTabViewObj::abortRangeSelection() throw(uno::RuntimeException)
    2169                 :            : {
    2170         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2171                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    2172         [ #  # ]:          0 :     if (pViewSh)
    2173 [ #  # ][ #  # ]:          0 :         pViewSh->StopSimpleRefDialog();
    2174                 :          0 : }
    2175                 :            : 
    2176                 :          0 : void SAL_CALL ScTabViewObj::addRangeSelectionListener(
    2177                 :            :                                 const uno::Reference<sheet::XRangeSelectionListener>& xListener )
    2178                 :            :                                     throw(uno::RuntimeException)
    2179                 :            : {
    2180         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2181                 :            :     uno::Reference<sheet::XRangeSelectionListener>* pObj =
    2182                 :          0 :             new uno::Reference<sheet::XRangeSelectionListener>( xListener );
    2183 [ #  # ][ #  # ]:          0 :     aRangeSelListeners.push_back( pObj );
    2184                 :          0 : }
    2185                 :            : 
    2186                 :          0 : void SAL_CALL ScTabViewObj::removeRangeSelectionListener(
    2187                 :            :                                 const uno::Reference<sheet::XRangeSelectionListener>& xListener )
    2188                 :            :                                     throw(uno::RuntimeException)
    2189                 :            : {
    2190         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2191 [ #  # ][ #  # ]:          0 :     for (XRangeSelectionListenerVector::iterator it = aRangeSelListeners.begin();
         [ #  # ][ #  # ]
    2192         [ #  # ]:          0 :          it != aRangeSelListeners.end(); ++it )
    2193                 :            :     {
    2194 [ #  # ][ #  # ]:          0 :         if ( *it == xListener )
                 [ #  # ]
    2195                 :            :         {
    2196         [ #  # ]:          0 :             aRangeSelListeners.erase(it);
    2197                 :          0 :             break;
    2198                 :            :         }
    2199         [ #  # ]:          0 :     }
    2200                 :          0 : }
    2201                 :            : 
    2202                 :          0 : void SAL_CALL ScTabViewObj::addRangeSelectionChangeListener(
    2203                 :            :                                 const uno::Reference<sheet::XRangeSelectionChangeListener>& xListener )
    2204                 :            :                                     throw(uno::RuntimeException)
    2205                 :            : {
    2206         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2207                 :            :     uno::Reference<sheet::XRangeSelectionChangeListener>* pObj =
    2208                 :          0 :             new uno::Reference<sheet::XRangeSelectionChangeListener>( xListener );
    2209 [ #  # ][ #  # ]:          0 :     aRangeChgListeners.push_back( pObj );
    2210                 :          0 : }
    2211                 :            : 
    2212                 :          0 : void SAL_CALL ScTabViewObj::removeRangeSelectionChangeListener(
    2213                 :            :                                 const uno::Reference<sheet::XRangeSelectionChangeListener>& xListener )
    2214                 :            :                                     throw(uno::RuntimeException)
    2215                 :            : {
    2216         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2217 [ #  # ][ #  # ]:          0 :     for (XRangeSelectionChangeListenerVector::iterator it = aRangeChgListeners.begin();
         [ #  # ][ #  # ]
    2218         [ #  # ]:          0 :          it != aRangeChgListeners.end(); ++it )
    2219                 :            :     {
    2220 [ #  # ][ #  # ]:          0 :         if ( *it == xListener )
                 [ #  # ]
    2221                 :            :         {
    2222         [ #  # ]:          0 :             aRangeChgListeners.erase(it);
    2223                 :          0 :             break;
    2224                 :            :         }
    2225         [ #  # ]:          0 :     }
    2226                 :          0 : }
    2227                 :            : 
    2228                 :          0 : void ScTabViewObj::RangeSelDone( const String& rText )
    2229                 :            : {
    2230         [ #  # ]:          0 :     sheet::RangeSelectionEvent aEvent;
    2231         [ #  # ]:          0 :     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
    2232         [ #  # ]:          0 :     aEvent.RangeDescriptor = rtl::OUString( rText );
    2233                 :            : 
    2234 [ #  # ][ #  # ]:          0 :     BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2235 [ #  # ][ #  # ]:          0 :         rListener->done( aEvent );
                 [ #  # ]
    2236                 :          0 : }
    2237                 :            : 
    2238                 :          0 : void ScTabViewObj::RangeSelAborted( const String& rText )
    2239                 :            : {
    2240         [ #  # ]:          0 :     sheet::RangeSelectionEvent aEvent;
    2241         [ #  # ]:          0 :     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
    2242         [ #  # ]:          0 :     aEvent.RangeDescriptor = rtl::OUString( rText );
    2243                 :            : 
    2244 [ #  # ][ #  # ]:          0 :     BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2245 [ #  # ][ #  # ]:          0 :         rListener->aborted( aEvent );
                 [ #  # ]
    2246                 :          0 : }
    2247                 :            : 
    2248                 :          0 : void ScTabViewObj::RangeSelChanged( const String& rText )
    2249                 :            : {
    2250         [ #  # ]:          0 :     sheet::RangeSelectionEvent aEvent;
    2251         [ #  # ]:          0 :     aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
    2252         [ #  # ]:          0 :     aEvent.RangeDescriptor = rtl::OUString( rText );
    2253                 :            : 
    2254 [ #  # ][ #  # ]:          0 :     BOOST_FOREACH(const XRangeSelectionChangeListenerUnoRef rListener, aRangeChgListeners)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2255 [ #  # ][ #  # ]:          0 :         rListener->descriptorChanged( aEvent );
                 [ #  # ]
    2256                 :          0 : }
    2257                 :            : 
    2258                 :            : // XServiceInfo
    2259                 :            : 
    2260                 :          0 : rtl::OUString SAL_CALL ScTabViewObj::getImplementationName() throw(uno::RuntimeException)
    2261                 :            : {
    2262                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScTabViewObj" ));
    2263                 :            : }
    2264                 :            : 
    2265                 :          0 : sal_Bool SAL_CALL ScTabViewObj::supportsService( const rtl::OUString& rServiceName )
    2266                 :            :                                                     throw(uno::RuntimeException)
    2267                 :            : {
    2268         [ #  # ]:          0 :     String aServiceStr( rServiceName );
    2269         [ #  # ]:          0 :     return aServiceStr.EqualsAscii( SCTABVIEWOBJ_SERVICE ) ||
    2270 [ #  # ][ #  # ]:          0 :            aServiceStr.EqualsAscii( SCVIEWSETTINGS_SERVICE );
         [ #  # ][ #  # ]
    2271                 :            : }
    2272                 :            : 
    2273                 :          0 : uno::Sequence<rtl::OUString> SAL_CALL ScTabViewObj::getSupportedServiceNames()
    2274                 :            :                                                     throw(uno::RuntimeException)
    2275                 :            : {
    2276                 :          0 :     uno::Sequence<rtl::OUString> aRet(2);
    2277         [ #  # ]:          0 :     rtl::OUString* pArray = aRet.getArray();
    2278         [ #  # ]:          0 :     pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCTABVIEWOBJ_SERVICE ));
    2279         [ #  # ]:          0 :     pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCVIEWSETTINGS_SERVICE ));
    2280                 :          0 :     return aRet;
    2281                 :            : }
    2282                 :            : 
    2283                 :            : // XUnoTunnel
    2284                 :            : 
    2285                 :       1489 : sal_Int64 SAL_CALL ScTabViewObj::getSomething(
    2286                 :            :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
    2287                 :            : {
    2288   [ +  -  +  - ]:       2978 :     if ( rId.getLength() == 16 &&
                 [ +  - ]
    2289                 :       1489 :           0 == memcmp( getUnoTunnelId().getConstArray(),
    2290                 :       1489 :                                     rId.getConstArray(), 16 ) )
    2291                 :            :     {
    2292                 :       1489 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
    2293                 :            :     }
    2294                 :       1489 :     return 0;
    2295                 :            : }
    2296                 :            : 
    2297                 :            : namespace
    2298                 :            : {
    2299                 :            :     class theScTabViewObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTabViewObjUnoTunnelId> {};
    2300                 :            : }
    2301                 :            : 
    2302                 :       2978 : const uno::Sequence<sal_Int8>& ScTabViewObj::getUnoTunnelId()
    2303                 :            : {
    2304                 :       2978 :     return theScTabViewObjUnoTunnelId::get().getSeq();
    2305                 :            : }
    2306                 :            : 
    2307                 :       1489 : ScTabViewObj* ScTabViewObj::getImplementation( const uno::Reference<uno::XInterface> xObj )
    2308                 :            : {
    2309                 :       1489 :     ScTabViewObj* pRet = NULL;
    2310         [ +  - ]:       1489 :     uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
    2311         [ +  - ]:       1489 :     if (xUT.is())
    2312 [ +  - ][ +  - ]:       1489 :         pRet = reinterpret_cast<ScTabViewObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
                 [ +  - ]
    2313                 :       1489 :     return pRet;
    2314                 :            : }
    2315                 :            : 
    2316                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL ScTabViewObj::getTransferable(  ) throw (::com::sun::star::uno::RuntimeException)
    2317                 :            : {
    2318         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2319 [ #  # ][ #  # ]:          0 :     ScEditShell* pShell = PTR_CAST( ScEditShell, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2320         [ #  # ]:          0 :     if (pShell)
    2321         [ #  # ]:          0 :         return pShell->GetEditView()->GetTransferable();
    2322                 :            : 
    2323 [ #  # ][ #  # ]:          0 :     ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2324         [ #  # ]:          0 :     if (pTextShell)
    2325                 :            :     {
    2326                 :          0 :         ScViewData* pViewData = GetViewShell()->GetViewData();
    2327         [ #  # ]:          0 :         ScDrawView* pView = pViewData->GetScDrawView();
    2328                 :          0 :         OutlinerView* pOutView = pView->GetTextEditOutlinerView();
    2329         [ #  # ]:          0 :         if (pOutView)
    2330         [ #  # ]:          0 :             return pOutView->GetEditView().GetTransferable();
    2331                 :            :     }
    2332                 :            : 
    2333 [ #  # ][ #  # ]:          0 :     ScDrawShell* pDrawShell = PTR_CAST( ScDrawShell, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2334         [ #  # ]:          0 :     if (pDrawShell)
    2335 [ #  # ][ #  # ]:          0 :         return pDrawShell->GetDrawView()->CopyToTransferable();
    2336                 :            : 
    2337         [ #  # ]:          0 :     ScTransferObj* pObj = GetViewShell()->CopyToTransferable();
    2338 [ #  # ][ #  # ]:          0 :     uno::Reference<datatransfer::XTransferable> xTransferable( pObj );
    2339         [ #  # ]:          0 :     return xTransferable;
    2340                 :            : }
    2341                 :            : 
    2342                 :          0 : void SAL_CALL ScTabViewObj::insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException)
    2343                 :            : {
    2344         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2345 [ #  # ][ #  # ]:          0 :     ScEditShell* pShell = PTR_CAST( ScEditShell, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2346         [ #  # ]:          0 :     if (pShell)
    2347 [ #  # ][ #  # ]:          0 :         pShell->GetEditView()->InsertText( xTrans, ::rtl::OUString(), false );
                 [ #  # ]
    2348                 :            :     else
    2349                 :            :     {
    2350 [ #  # ][ #  # ]:          0 :         ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2351         [ #  # ]:          0 :         if (pTextShell)
    2352                 :            :         {
    2353                 :          0 :             ScViewData* pViewData = GetViewShell()->GetViewData();
    2354         [ #  # ]:          0 :             ScDrawView* pView = pViewData->GetScDrawView();
    2355                 :          0 :             OutlinerView* pOutView = pView->GetTextEditOutlinerView();
    2356         [ #  # ]:          0 :             if ( pOutView )
    2357                 :            :             {
    2358 [ #  # ][ #  # ]:          0 :                 pOutView->GetEditView().InsertText( xTrans, ::rtl::OUString(), false );
                 [ #  # ]
    2359                 :          0 :                 return;
    2360                 :            :             }
    2361                 :            :         }
    2362                 :            : 
    2363         [ #  # ]:          0 :         GetViewShell()->PasteFromTransferable( xTrans );
    2364 [ #  # ][ #  # ]:          0 :     }
    2365                 :            : }
    2366                 :            : 
    2367                 :            : namespace {
    2368                 :            : 
    2369                 :          0 : uno::Sequence<sal_Int32> toSequence(const ScMarkData::MarkedTabsType& rSelected)
    2370                 :            : {
    2371         [ #  # ]:          0 :     uno::Sequence<sal_Int32> aRet(rSelected.size());
    2372                 :          0 :     ScMarkData::MarkedTabsType::const_iterator itr = rSelected.begin(), itrEnd = rSelected.end();
    2373 [ #  # ][ #  # ]:          0 :     for (size_t i = 0; itr != itrEnd; ++itr, ++i)
                 [ #  # ]
    2374 [ #  # ][ #  # ]:          0 :         aRet[i] = static_cast<sal_Int32>(*itr);
    2375                 :            : 
    2376                 :          0 :     return aRet;
    2377                 :            : }
    2378                 :            : 
    2379                 :            : }
    2380                 :            : 
    2381                 :          0 : uno::Sequence<sal_Int32> ScTabViewObj::getSelectedSheets()
    2382                 :            :     throw (uno::RuntimeException)
    2383                 :            : {
    2384                 :          0 :     ScTabViewShell* pViewSh = GetViewShell();
    2385         [ #  # ]:          0 :     if (!pViewSh)
    2386                 :          0 :         return uno::Sequence<sal_Int32>();
    2387                 :            : 
    2388                 :          0 :     ScViewData* pViewData = pViewSh->GetViewData();
    2389         [ #  # ]:          0 :     if (!pViewData)
    2390                 :          0 :         return uno::Sequence<sal_Int32>();
    2391                 :            : 
    2392                 :            :     // #i95280# when printing from the shell, the view is never activated,
    2393                 :            :     // so Excel view settings must also be evaluated here.
    2394                 :          0 :     ScExtDocOptions* pExtOpt = pViewData->GetDocument()->GetExtDocOptions();
    2395 [ #  # ][ #  # ]:          0 :     if (pExtOpt && pExtOpt->IsChanged())
                 [ #  # ]
    2396                 :            :     {
    2397                 :          0 :         pViewSh->GetViewData()->ReadExtOptions(*pExtOpt);        // Excel view settings
    2398                 :          0 :         pViewSh->SetTabNo(pViewSh->GetViewData()->GetTabNo(), true);
    2399                 :          0 :         pExtOpt->SetChanged(false);
    2400                 :            :     }
    2401                 :            : 
    2402                 :          0 :     return toSequence(pViewData->GetMarkData().GetSelectedTabs());
    2403                 :            : }
    2404                 :            : 
    2405                 :         16 : ScPreviewObj::ScPreviewObj(ScPreviewShell* pViewSh) :
    2406                 :            :     SfxBaseController(pViewSh),
    2407         [ +  - ]:         16 :     mpViewShell(pViewSh)
    2408                 :            : {
    2409         [ +  - ]:         16 :     if (mpViewShell)
    2410         [ +  - ]:         16 :         StartListening(*mpViewShell);
    2411                 :         16 : }
    2412                 :            : 
    2413         [ +  - ]:         16 : ScPreviewObj::~ScPreviewObj()
    2414                 :            : {
    2415         [ -  + ]:         16 :     if (mpViewShell)
    2416         [ #  # ]:          0 :         EndListening(*mpViewShell);
    2417         [ -  + ]:         32 : }
    2418                 :            : 
    2419                 :       3761 : uno::Any ScPreviewObj::queryInterface(const uno::Type& rType)
    2420                 :            :     throw(uno::RuntimeException)
    2421                 :            : {
    2422 [ -  + ][ #  # ]:       3761 :     SC_QUERYINTERFACE(sheet::XSelectedSheetsSupplier)
    2423                 :       3761 :     return SfxBaseController::queryInterface(rType);
    2424                 :            : }
    2425                 :            : 
    2426                 :      14022 : void ScPreviewObj::acquire() throw()
    2427                 :            : {
    2428                 :      14022 :     SfxBaseController::acquire();
    2429                 :      14022 : }
    2430                 :            : 
    2431                 :      14054 : void ScPreviewObj::release() throw()
    2432                 :            : {
    2433                 :      14054 :     SfxBaseController::release();
    2434                 :      14054 : }
    2435                 :            : 
    2436                 :         16 : void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint)
    2437                 :            : {
    2438         [ -  + ]:         16 :     const SfxSimpleHint* p = dynamic_cast<const SfxSimpleHint*>(&rHint);
    2439 [ +  - ][ +  - ]:         16 :     if (p && p->GetId() == SFX_HINT_DYING)
                 [ +  - ]
    2440                 :         16 :         mpViewShell = NULL;
    2441                 :         16 : }
    2442                 :            : 
    2443                 :          0 : uno::Sequence<sal_Int32> ScPreviewObj::getSelectedSheets()
    2444                 :            :     throw (uno::RuntimeException)
    2445                 :            : {
    2446                 :          0 :     ScPreview* p = mpViewShell->GetPreview();
    2447         [ #  # ]:          0 :     if (!p)
    2448                 :          0 :         return uno::Sequence<sal_Int32>();
    2449                 :            : 
    2450                 :          0 :     return toSequence(p->GetSelectedTabs());
    2451                 :            : }
    2452                 :            : 
    2453                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10