LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbawindow.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 267 434 61.5 %
Date: 2014-11-03 Functions: 49 82 59.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include <vbahelper/helperdecl.hxx>
      20             : #include "vbawindow.hxx"
      21             : #include "vbaworksheets.hxx"
      22             : #include "vbaworksheet.hxx"
      23             : #include "vbaglobals.hxx"
      24             : #include "vbapane.hxx"
      25             : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
      26             : #include <com/sun/star/sheet/XSpreadsheet.hpp>
      27             : #include <com/sun/star/container/XNamed.hpp>
      28             : #include <com/sun/star/view/DocumentZoomType.hpp>
      29             : #include <com/sun/star/table/CellRangeAddress.hpp>
      30             : #include <ooo/vba/excel/XlWindowState.hpp>
      31             : #include <ooo/vba/excel/XlWindowView.hpp>
      32             : #include <ooo/vba/excel/Constants.hpp>
      33             : #include <com/sun/star/awt/XWindow.hpp>
      34             : #include <com/sun/star/awt/XWindow2.hpp>
      35             : #include <com/sun/star/awt/PosSize.hpp>
      36             : 
      37             : #include <docsh.hxx>
      38             : #include <tabvwsh.hxx>
      39             : #include <docuno.hxx>
      40             : #include <sc.hrc>
      41             : #include <boost/unordered_map.hpp>
      42             : #include <sfx2/viewfrm.hxx>
      43             : #include <vcl/wrkwin.hxx>
      44             : #include "unonames.hxx"
      45             : #include "markdata.hxx"
      46             : 
      47             : using namespace ::com::sun::star;
      48             : using namespace ::ooo::vba;
      49             : using namespace ::ooo::vba::excel::XlWindowState;
      50             : 
      51             : typedef  boost::unordered_map< OUString,
      52             : SCTAB, OUStringHash,
      53             : ::std::equal_to< OUString > > NameIndexHash;
      54             : 
      55             : typedef std::vector< uno::Reference< sheet::XSpreadsheet > > Sheets;
      56             : 
      57             : typedef ::cppu::WeakImplHelper1< container::XEnumeration > Enumeration_BASE;
      58             : 
      59             : typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess
      60             :     , com::sun::star::container::XIndexAccess
      61             :     , com::sun::star::container::XNameAccess
      62             :     > SelectedSheets_BASE;
      63             : 
      64           0 : class SelectedSheetsEnum : public Enumeration_BASE
      65             : {
      66             : public:
      67             :     uno::Reference< uno::XComponentContext > m_xContext;
      68             :     Sheets m_sheets;
      69             :     uno::Reference< frame::XModel > m_xModel;
      70             :     Sheets::const_iterator m_it;
      71             : 
      72           0 :     SelectedSheetsEnum( const uno::Reference< uno::XComponentContext >& xContext, const Sheets& sheets, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) :  m_xContext( xContext ), m_sheets( sheets ), m_xModel( xModel )
      73             :     {
      74           0 :         m_it = m_sheets.begin();
      75           0 :     }
      76             :     // XEnumeration
      77           0 :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
      78             :     {
      79           0 :         return m_it != m_sheets.end();
      80             :     }
      81           0 :     virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
      82             :     {
      83           0 :         if ( !hasMoreElements() )
      84             :         {
      85           0 :             throw container::NoSuchElementException();
      86             :         }
      87             :         // #FIXME needs ThisWorkbook as parent
      88           0 :         return uno::makeAny( uno::Reference< excel::XWorksheet > ( new ScVbaWorksheet( uno::Reference< XHelperInterface >(), m_xContext, *(m_it++), m_xModel ) ) );
      89             :     }
      90             : 
      91             : };
      92             : 
      93           0 : class SelectedSheetsEnumAccess : public SelectedSheets_BASE
      94             : {
      95             :     uno::Reference< uno::XComponentContext > m_xContext;
      96             :     NameIndexHash namesToIndices;
      97             :     Sheets sheets;
      98             :     uno::Reference< frame::XModel > m_xModel;
      99             : public:
     100           0 :     SelectedSheetsEnumAccess( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ):m_xContext( xContext ), m_xModel( xModel )
     101             :     {
     102           0 :         ScModelObj* pModel = static_cast< ScModelObj* >( m_xModel.get() );
     103           0 :         if ( !pModel )
     104           0 :             throw uno::RuntimeException("Cannot obtain current document" );
     105           0 :         ScDocShell* pDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject());
     106           0 :         if ( !pDocShell )
     107           0 :             throw uno::RuntimeException("Cannot obtain docshell" );
     108           0 :         ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     109           0 :         if ( !pViewShell )
     110           0 :             throw uno::RuntimeException("Cannot obtain view shell" );
     111             : 
     112           0 :         SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
     113           0 :         SCTAB nIndex = 0;
     114           0 :         const ScMarkData& rMarkData = pViewShell->GetViewData().GetMarkData();
     115           0 :         sheets.reserve( nTabCount );
     116           0 :         uno::Reference <sheet::XSpreadsheetDocument> xSpreadSheet( m_xModel, uno::UNO_QUERY_THROW );
     117           0 :         uno::Reference <container::XIndexAccess> xIndex( xSpreadSheet->getSheets(), uno::UNO_QUERY_THROW );
     118           0 :         ScMarkData::const_iterator itr = rMarkData.begin(), itrEnd = rMarkData.end();
     119           0 :         for (; itr != itrEnd && *itr < nTabCount; ++itr)
     120             :         {
     121           0 :             uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex( *itr ), uno::UNO_QUERY_THROW );
     122           0 :             uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
     123           0 :             sheets.push_back( xSheet );
     124           0 :             namesToIndices[ xNamed->getName() ] = nIndex++;
     125           0 :         }
     126             : 
     127           0 :     }
     128             : 
     129             :     //XEnumerationAccess
     130           0 :     virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
     131             :     {
     132           0 :         return new SelectedSheetsEnum( m_xContext, sheets, m_xModel  );
     133             :     }
     134             :     // XIndexAccess
     135           0 :     virtual ::sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
     136             :     {
     137           0 :         return sheets.size();
     138             :     }
     139           0 :     virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
     140             :     {
     141           0 :         if ( Index < 0
     142           0 :         || static_cast< Sheets::size_type >( Index ) >= sheets.size() )
     143           0 :             throw lang::IndexOutOfBoundsException();
     144             : 
     145           0 :         return uno::makeAny( sheets[ Index ] );
     146             :     }
     147             : 
     148             :     //XElementAccess
     149           0 :     virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
     150             :     {
     151           0 :         return cppu::UnoType<excel::XWorksheet>::get();
     152             :     }
     153             : 
     154           0 :     virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
     155             :     {
     156           0 :         return ( !sheets.empty() );
     157             :     }
     158             : 
     159             :     //XNameAccess
     160           0 :     virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
     161             :     {
     162           0 :         NameIndexHash::const_iterator it = namesToIndices.find( aName );
     163           0 :         if ( it == namesToIndices.end() )
     164           0 :             throw container::NoSuchElementException();
     165           0 :         return uno::makeAny( sheets[ it->second ] );
     166             : 
     167             :     }
     168             : 
     169           0 :     virtual uno::Sequence< OUString > SAL_CALL getElementNames(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
     170             :     {
     171           0 :         uno::Sequence< OUString > names( namesToIndices.size() );
     172           0 :         OUString* pString = names.getArray();
     173           0 :         NameIndexHash::const_iterator it = namesToIndices.begin();
     174           0 :         NameIndexHash::const_iterator it_end = namesToIndices.end();
     175           0 :         for ( ; it != it_end; ++it, ++pString )
     176           0 :             *pString = it->first;
     177           0 :         return names;
     178             :     }
     179             : 
     180           0 :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
     181             :     {
     182           0 :         NameIndexHash::const_iterator it = namesToIndices.find( aName );
     183           0 :         return (it != namesToIndices.end());
     184             :     }
     185             : 
     186             : };
     187             : 
     188         118 : ScVbaWindow::ScVbaWindow(
     189             :         const uno::Reference< XHelperInterface >& xParent,
     190             :         const uno::Reference< uno::XComponentContext >& xContext,
     191             :         const uno::Reference< frame::XModel >& xModel,
     192             :         const uno::Reference< frame::XController >& xController ) throw (uno::RuntimeException) :
     193         118 :     WindowImpl_BASE( xParent, xContext, xModel, xController )
     194             : {
     195         118 :     init();
     196         118 : }
     197             : 
     198           0 : ScVbaWindow::ScVbaWindow(
     199             :         const uno::Sequence< uno::Any >& args,
     200             :         const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) :
     201           0 :     WindowImpl_BASE( args, xContext )
     202             : {
     203           0 :     init();
     204           0 : }
     205             : 
     206             : void
     207         118 : ScVbaWindow::init()
     208             : {
     209             :     /*  This method is called from the constructor, thus the own refcount is
     210             :         still zero. The implementation of ActivePane() uses a UNO reference of
     211             :         this (to set this window as parent of the pane object). This requires
     212             :         the own refcount to be non-zero, otherwise this instance will be
     213             :         desctructed immediately! Guard the call to ActivePane() in try/catch to
     214             :         not miss the decrementation of the reference count on exception. */
     215         118 :     osl_atomic_increment( &m_refCount );
     216             :     try
     217             :     {
     218         118 :        m_xPane = ActivePane();
     219             :     }
     220           0 :     catch( uno::Exception& )
     221             :     {
     222             :     }
     223         118 :     osl_atomic_decrement( &m_refCount );
     224         118 : }
     225             : 
     226             : uno::Reference< beans::XPropertySet >
     227          88 : ScVbaWindow::getControllerProps() throw (uno::RuntimeException)
     228             : {
     229          88 :     return uno::Reference< beans::XPropertySet >( getController(), uno::UNO_QUERY_THROW );
     230             : }
     231             : 
     232             : uno::Reference< beans::XPropertySet >
     233          58 : ScVbaWindow::getFrameProps() throw (uno::RuntimeException)
     234             : {
     235          58 :     return uno::Reference< beans::XPropertySet >( getController()->getFrame(), uno::UNO_QUERY_THROW );
     236             : }
     237             : 
     238             : uno::Reference< awt::XDevice >
     239          12 : ScVbaWindow::getDevice() throw (uno::RuntimeException)
     240             : {
     241          12 :     return uno::Reference< awt::XDevice >( getWindow(), uno::UNO_QUERY_THROW );
     242             : }
     243             : 
     244             : void
     245          12 : ScVbaWindow::Scroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft, bool bLargeScroll ) throw (uno::RuntimeException)
     246             : {
     247          12 :     if( !m_xPane.is() )
     248           0 :         throw uno::RuntimeException();
     249          12 :     if( bLargeScroll )
     250           8 :         m_xPane->LargeScroll( Down, Up, ToRight, ToLeft );
     251             :     else
     252           4 :         m_xPane->SmallScroll( Down, Up, ToRight, ToLeft );
     253          12 : }
     254             : 
     255             : void SAL_CALL
     256           4 : ScVbaWindow::SmallScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException, std::exception)
     257             : {
     258           4 :     Scroll( Down, Up, ToRight, ToLeft );
     259           4 : }
     260             : 
     261             : void SAL_CALL
     262           8 : ScVbaWindow::LargeScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException, std::exception)
     263             : {
     264           8 :     Scroll( Down, Up, ToRight, ToLeft, true );
     265           8 : }
     266             : 
     267             : uno::Any SAL_CALL
     268           0 : ScVbaWindow::SelectedSheets( const uno::Any& aIndex ) throw (uno::RuntimeException, std::exception)
     269             : {
     270           0 :     uno::Reference< container::XEnumerationAccess > xEnumAccess( new SelectedSheetsEnumAccess( mxContext, m_xModel ) );
     271             :     // #FIXME needs a workbook as a parent
     272           0 :     uno::Reference< excel::XWorksheets > xSheets(  new ScVbaWorksheets( uno::Reference< XHelperInterface >(), mxContext, xEnumAccess, m_xModel ) );
     273           0 :     if ( aIndex.hasValue() )
     274             :     {
     275           0 :         uno::Reference< XCollection > xColl( xSheets, uno::UNO_QUERY_THROW );
     276           0 :         return xColl->Item( aIndex, uno::Any() );
     277             :     }
     278           0 :     return uno::makeAny( xSheets );
     279             : }
     280             : 
     281             : void SAL_CALL
     282           0 : ScVbaWindow::ScrollWorkbookTabs( const uno::Any& /*Sheets*/, const uno::Any& /*Position*/ ) throw (uno::RuntimeException, std::exception)
     283             : {
     284             : // #TODO #FIXME need some implementation to scroll through the tabs
     285             : // but where is this done?
     286             : /*
     287             :     sal_Int32 nSheets = 0;
     288             :     sal_Int32 nPosition = 0;
     289             :     throw uno::RuntimeException("No Implemented" );
     290             :     sal_Bool bSheets = ( Sheets >>= nSheets );
     291             :     sal_Bool bPosition = ( Position >>= nPosition );
     292             :     if ( bSheets || bPosition ) // at least one param specified
     293             :         if ( bSheets )
     294             :             ;// use sheets
     295             :         else if ( bPosition )
     296             :             ; //use position
     297             : */
     298             : 
     299           0 : }
     300             : 
     301             : uno::Any SAL_CALL
     302          56 : ScVbaWindow::getCaption() throw (uno::RuntimeException, std::exception)
     303             : {
     304          56 :     static OUString sCrud(" - OpenOffice.org Calc" );
     305          56 :     static sal_Int32 nCrudLen = sCrud.getLength();
     306             : 
     307          56 :     OUString sTitle;
     308          56 :     getFrameProps()->getPropertyValue( OUString( SC_UNONAME_TITLE ) ) >>= sTitle;
     309          56 :     sal_Int32 nCrudIndex = sTitle.indexOf( sCrud );
     310             :     // adjust title ( by removing crud )
     311             :     // sCrud string present
     312          56 :     if ( nCrudIndex != -1 )
     313             :     {
     314             :         // and ends with sCrud
     315           0 :         if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() )
     316             :         {
     317           0 :             sTitle = sTitle.copy( 0, nCrudIndex );
     318           0 :             ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
     319           0 :             OUString sName = workbook.getName();
     320             :             // rather bizare hack to make sure the name behavior
     321             :             // is like XL
     322             :             // if the adjusted title == workbook name, use name
     323             :             // if the adjusted title != workbook name but ...
     324             :             //  name == title + extension ( .csv, ,odt, .xls )
     325             :             //  etc. then also use the name
     326             : 
     327           0 :             if ( !sTitle.equals( sName ) )
     328             :             {
     329           0 :                 static OUString sDot(".");
     330             :                 // starts with title
     331           0 :                 if ( sName.startsWith( sTitle ) )
     332             :                     // extention starts immediately after
     333           0 :                     if ( sName.match( sDot, sTitle.getLength() ) )
     334           0 :                         sTitle = sName;
     335           0 :             }
     336             :         }
     337             :     }
     338          56 :     return uno::makeAny( sTitle );
     339             : }
     340             : 
     341             : void SAL_CALL
     342           2 : ScVbaWindow::setCaption( const uno::Any& _caption ) throw (uno::RuntimeException, std::exception)
     343             : {
     344           2 :     getFrameProps()->setPropertyValue( OUString( SC_UNONAME_TITLE ), _caption );
     345           2 : }
     346             : 
     347             : uno::Any SAL_CALL
     348          16 : ScVbaWindow::getScrollRow() throw (uno::RuntimeException, std::exception)
     349             : {
     350          16 :     sal_Int32 nValue = 0;
     351             :     // !! TODO !! get view shell from controller
     352          16 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     353          16 :     if ( pViewShell )
     354             :     {
     355          16 :         ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
     356          16 :         nValue = pViewShell->GetViewData().GetPosY(WhichV(eWhich));
     357             :     }
     358             : 
     359          16 :     return uno::makeAny( nValue + 1);
     360             : }
     361             : 
     362             : void SAL_CALL
     363           6 : ScVbaWindow::setScrollRow( const uno::Any& _scrollrow ) throw (uno::RuntimeException, std::exception)
     364             : {
     365             :     // !! TODO !! get view shell from controller
     366           6 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     367           6 :     if ( pViewShell )
     368             :     {
     369           6 :         sal_Int32 scrollRow = 0;
     370           6 :         _scrollrow >>= scrollRow;
     371           6 :         ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
     372           6 :         sal_Int32 nOldValue = pViewShell->GetViewData().GetPosY(WhichV(eWhich)) + 1;
     373           6 :         pViewShell->ScrollLines(0, scrollRow - nOldValue);
     374             :     }
     375           6 : }
     376             : 
     377             : uno::Any SAL_CALL
     378          20 : ScVbaWindow::getScrollColumn() throw (uno::RuntimeException, std::exception)
     379             : {
     380          20 :     sal_Int32 nValue = 0;
     381             :     // !! TODO !! get view shell from controller
     382          20 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     383          20 :     if ( pViewShell )
     384             :     {
     385          20 :         ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
     386          20 :         nValue = pViewShell->GetViewData().GetPosX(WhichH(eWhich));
     387             :     }
     388             : 
     389          20 :     return uno::makeAny( nValue + 1);
     390             : }
     391             : 
     392             : void SAL_CALL
     393           6 : ScVbaWindow::setScrollColumn( const uno::Any& _scrollcolumn ) throw (uno::RuntimeException, std::exception)
     394             : {
     395             :     // !! TODO !! get view shell from controller
     396           6 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     397           6 :     if ( pViewShell )
     398             :     {
     399           6 :         sal_Int32 scrollColumn = 0;
     400           6 :         _scrollcolumn >>= scrollColumn;
     401           6 :         ScSplitPos eWhich = pViewShell->GetViewData().GetActivePart();
     402           6 :         sal_Int32 nOldValue = pViewShell->GetViewData().GetPosX(WhichH(eWhich)) + 1;
     403           6 :         pViewShell->ScrollLines(scrollColumn - nOldValue, 0);
     404             :     }
     405           6 : }
     406             : 
     407             : uno::Any SAL_CALL
     408           0 : ScVbaWindow::getWindowState() throw (uno::RuntimeException, std::exception)
     409             : {
     410           0 :     sal_Int32 nwindowState = xlNormal;
     411             :     // !! TODO !! get view shell from controller
     412           0 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     413           0 :     SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
     414           0 :     WorkWindow* pWork = static_cast<WorkWindow*>( pViewFrame->GetFrame().GetSystemWindow() );
     415           0 :     if ( pWork )
     416             :     {
     417           0 :         if ( pWork -> IsMaximized())
     418           0 :             nwindowState = xlMaximized;
     419           0 :         else if (pWork -> IsMinimized())
     420           0 :             nwindowState = xlMinimized;
     421             :     }
     422           0 :     return uno::makeAny( nwindowState );
     423             : }
     424             : 
     425             : void SAL_CALL
     426           0 : ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException, std::exception)
     427             : {
     428           0 :     sal_Int32 nwindowState = xlMaximized;
     429           0 :     _windowstate >>= nwindowState;
     430             :     // !! TODO !! get view shell from controller
     431           0 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     432           0 :     SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
     433           0 :     WorkWindow* pWork = static_cast<WorkWindow*>( pViewFrame->GetFrame().GetSystemWindow() );
     434           0 :     if ( pWork )
     435             :     {
     436           0 :         if ( nwindowState == xlMaximized)
     437           0 :             pWork -> Maximize();
     438           0 :         else if (nwindowState == xlMinimized)
     439           0 :             pWork -> Minimize();
     440           0 :         else if (nwindowState == xlNormal)
     441           0 :             pWork -> Restore();
     442             :         else
     443           0 :             throw uno::RuntimeException("Invalid Parameter" );
     444             :     }
     445           0 : }
     446             : 
     447             : void
     448           2 : ScVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception)
     449             : {
     450           2 :     ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
     451             : 
     452           2 :     workbook.Activate();
     453           2 : }
     454             : 
     455             : void
     456           0 : ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException, std::exception)
     457             : {
     458           0 :     ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
     459           0 :     workbook.Close(SaveChanges, FileName, RouteWorkBook );
     460           0 : }
     461             : 
     462             : uno::Reference< excel::XPane > SAL_CALL
     463         120 : ScVbaWindow::ActivePane() throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     464             : {
     465         120 :     uno::Reference< sheet::XViewPane > xViewPane( getController(), uno::UNO_QUERY_THROW );
     466         120 :     return new ScVbaPane( this, mxContext, m_xModel, xViewPane );
     467             : }
     468             : 
     469             : uno::Reference< excel::XRange > SAL_CALL
     470          12 : ScVbaWindow::ActiveCell(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     471             : {
     472          12 :     uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
     473          12 :     return xApplication->getActiveCell();
     474             : }
     475             : 
     476             : uno::Any SAL_CALL
     477           6 : ScVbaWindow::Selection(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     478             : {
     479           6 :     uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
     480           6 :     return xApplication->getSelection();
     481             : }
     482             : 
     483             : uno::Reference< excel::XRange > SAL_CALL
     484           0 : ScVbaWindow::RangeSelection() throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     485             : {
     486             :     /*  TODO / FIXME: According to documentation, this method returns the range
     487             :         selection even if shapes are selected. */
     488           0 :     return uno::Reference< excel::XRange >( Selection(), uno::UNO_QUERY_THROW );
     489             : }
     490             : 
     491             : sal_Bool SAL_CALL
     492           4 : ScVbaWindow::getDisplayGridlines() throw (uno::RuntimeException, std::exception)
     493             : {
     494           4 :     OUString sName( SC_UNO_SHOWGRID );
     495           4 :     bool bGrid = true;
     496           4 :     getControllerProps()->getPropertyValue( sName ) >>= bGrid;
     497           4 :     return bGrid;
     498             : }
     499             : 
     500             : void SAL_CALL
     501           4 : ScVbaWindow::setDisplayGridlines( sal_Bool _displaygridlines ) throw (uno::RuntimeException, std::exception)
     502             : {
     503           4 :     OUString sName( SC_UNO_SHOWGRID );
     504           4 :     getControllerProps()->setPropertyValue( sName, uno::makeAny( _displaygridlines ));
     505           4 : }
     506             : 
     507             : sal_Bool SAL_CALL
     508          12 : ScVbaWindow::getDisplayHeadings() throw (uno::RuntimeException, std::exception)
     509             : {
     510          12 :     OUString sName( SC_UNO_COLROWHDR );
     511          12 :     bool bHeading = true;
     512          12 :     getControllerProps()->getPropertyValue( sName ) >>= bHeading;
     513          12 :     return bHeading;
     514             : }
     515             : 
     516             : void SAL_CALL
     517           8 : ScVbaWindow::setDisplayHeadings( sal_Bool _bDisplayHeadings ) throw (uno::RuntimeException, std::exception)
     518             : {
     519           8 :     OUString sName( SC_UNO_COLROWHDR );
     520           8 :     getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayHeadings ));
     521           8 : }
     522             : 
     523             : sal_Bool SAL_CALL
     524           8 : ScVbaWindow::getDisplayHorizontalScrollBar() throw (uno::RuntimeException, std::exception)
     525             : {
     526           8 :     OUString sName( SC_UNO_HORSCROLL );
     527           8 :     bool bHorizontalScrollBar = true;
     528           8 :     getControllerProps()->getPropertyValue( sName ) >>= bHorizontalScrollBar;
     529           8 :     return bHorizontalScrollBar;
     530             : }
     531             : 
     532             : void SAL_CALL
     533           4 : ScVbaWindow::setDisplayHorizontalScrollBar( sal_Bool _bDisplayHorizontalScrollBar ) throw (uno::RuntimeException, std::exception)
     534             : {
     535           4 :     OUString sName( SC_UNO_HORSCROLL );
     536           4 :     getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayHorizontalScrollBar ));
     537           4 : }
     538             : 
     539             : sal_Bool SAL_CALL
     540           8 : ScVbaWindow::getDisplayOutline() throw (uno::RuntimeException, std::exception)
     541             : {
     542           8 :     OUString sName( SC_UNO_OUTLSYMB );
     543           8 :     bool bOutline = true;
     544           8 :     getControllerProps()->getPropertyValue( sName ) >>= bOutline;
     545           8 :     return bOutline;
     546             : }
     547             : 
     548             : void SAL_CALL
     549           4 : ScVbaWindow::setDisplayOutline( sal_Bool _bDisplayOutline ) throw (uno::RuntimeException, std::exception)
     550             : {
     551           4 :     OUString sName( SC_UNO_OUTLSYMB );
     552           4 :     getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayOutline ));
     553           4 : }
     554             : 
     555             : sal_Bool SAL_CALL
     556           8 : ScVbaWindow::getDisplayVerticalScrollBar() throw (uno::RuntimeException, std::exception)
     557             : {
     558           8 :     OUString sName( SC_UNO_VERTSCROLL );
     559           8 :     bool bVerticalScrollBar = true;
     560           8 :     getControllerProps()->getPropertyValue( sName ) >>= bVerticalScrollBar;
     561           8 :     return bVerticalScrollBar;
     562             : }
     563             : 
     564             : void SAL_CALL
     565           4 : ScVbaWindow::setDisplayVerticalScrollBar( sal_Bool _bDisplayVerticalScrollBar ) throw (uno::RuntimeException, std::exception)
     566             : {
     567           4 :     OUString sName( SC_UNO_VERTSCROLL );
     568           4 :     getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayVerticalScrollBar ));
     569           4 : }
     570             : 
     571             : sal_Bool SAL_CALL
     572           8 : ScVbaWindow::getDisplayWorkbookTabs() throw (uno::RuntimeException, std::exception)
     573             : {
     574           8 :     OUString sName( SC_UNO_SHEETTABS );
     575           8 :     bool bWorkbookTabs = true;
     576           8 :     getControllerProps()->getPropertyValue( sName ) >>= bWorkbookTabs;
     577           8 :     return bWorkbookTabs;
     578             : }
     579             : 
     580             : void SAL_CALL
     581           4 : ScVbaWindow::setDisplayWorkbookTabs( sal_Bool _bDisplayWorkbookTabs ) throw (uno::RuntimeException, std::exception)
     582             : {
     583           4 :     OUString sName( SC_UNO_SHEETTABS );
     584           4 :     getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayWorkbookTabs ));
     585           4 : }
     586             : 
     587             : sal_Bool SAL_CALL
     588           6 : ScVbaWindow::getFreezePanes() throw (uno::RuntimeException, std::exception)
     589             : {
     590           6 :     uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW );
     591           6 :     return xViewFreezable->hasFrozenPanes();
     592             : }
     593             : 
     594             : void SAL_CALL
     595           8 : ScVbaWindow::setFreezePanes( sal_Bool _bFreezePanes ) throw (uno::RuntimeException, std::exception)
     596             : {
     597           8 :     uno::Reference< sheet::XViewPane > xViewPane( getController(), uno::UNO_QUERY_THROW );
     598          16 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( xViewPane, uno::UNO_QUERY_THROW );
     599          16 :     uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewPane, uno::UNO_QUERY_THROW );
     600           8 :     if( _bFreezePanes )
     601             :     {
     602           4 :         if( xViewSplitable->getIsWindowSplit() )
     603             :         {
     604             :             // if there is a split we freeze at the split
     605           2 :             sal_Int32 nColumn = getSplitColumn();
     606           2 :             sal_Int32 nRow = getSplitRow();
     607           2 :             xViewFreezable->freezeAtPosition( nColumn, nRow );
     608             :         }
     609             :         else
     610             :         {
     611             :             // otherwise we freeze in the center of the visible sheet
     612           2 :             table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange();
     613           2 :             sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 );
     614           2 :             sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 );
     615           2 :             xViewFreezable->freezeAtPosition( nColumn, nRow );
     616             :         }
     617             :     }
     618             :     else
     619             :     {
     620             :         //remove the freeze panes
     621           4 :         xViewSplitable->splitAtPosition(0,0);
     622           8 :     }
     623           8 : }
     624             : 
     625             : sal_Bool SAL_CALL
     626           0 : ScVbaWindow::getSplit() throw (uno::RuntimeException, std::exception)
     627             : {
     628           0 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     629           0 :     return xViewSplitable->getIsWindowSplit();
     630             : }
     631             : 
     632             : void SAL_CALL
     633           6 : ScVbaWindow::setSplit( sal_Bool _bSplit ) throw (uno::RuntimeException, std::exception)
     634             : {
     635           6 :     if( !_bSplit )
     636             :     {
     637           4 :         uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     638           4 :         xViewSplitable->splitAtPosition(0,0);
     639             :     }
     640             :     else
     641             :     {
     642           2 :         uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW );
     643           4 :         uno::Reference< excel::XRange > xRange = ActiveCell();
     644           2 :         sal_Int32 nRow = xRange->getRow();
     645           2 :         sal_Int32 nColumn = xRange->getColumn();
     646           4 :         SplitAtDefinedPosition( nColumn-1, nRow-1 );
     647             :     }
     648           6 : }
     649             : 
     650             : sal_Int32 SAL_CALL
     651          12 : ScVbaWindow::getSplitColumn() throw (uno::RuntimeException, std::exception)
     652             : {
     653          12 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     654          12 :     return xViewSplitable->getSplitColumn();
     655             : }
     656             : 
     657             : void SAL_CALL
     658           2 : ScVbaWindow::setSplitColumn( sal_Int32 _splitcolumn ) throw (uno::RuntimeException, std::exception)
     659             : {
     660           2 :     if( getSplitColumn() != _splitcolumn )
     661             :     {
     662           2 :         uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW );
     663           2 :         sal_Int32 nRow = getSplitRow();
     664           2 :         SplitAtDefinedPosition( _splitcolumn, nRow );
     665             :     }
     666           2 : }
     667             : 
     668             : double SAL_CALL
     669           4 : ScVbaWindow::getSplitHorizontal() throw (uno::RuntimeException, std::exception)
     670             : {
     671           4 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     672           4 :     return PixelsToPoints( getDevice(), xViewSplitable->getSplitHorizontal(), true );
     673             : }
     674             : 
     675             : void SAL_CALL
     676           2 : ScVbaWindow::setSplitHorizontal( double _splithorizontal ) throw (uno::RuntimeException, std::exception)
     677             : {
     678           2 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     679           2 :     double fHoriPixels = PointsToPixels( getDevice(), _splithorizontal, true );
     680           2 :     xViewSplitable->splitAtPosition( static_cast< sal_Int32 >( fHoriPixels ), 0 );
     681           2 : }
     682             : 
     683             : sal_Int32 SAL_CALL
     684          12 : ScVbaWindow::getSplitRow() throw (uno::RuntimeException, std::exception)
     685             : {
     686          12 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     687          12 :     return xViewSplitable->getSplitRow();
     688             : }
     689             : 
     690             : void SAL_CALL
     691           4 : ScVbaWindow::setSplitRow( sal_Int32 _splitrow ) throw (uno::RuntimeException, std::exception)
     692             : {
     693           4 :     if( getSplitRow() != _splitrow )
     694             :     {
     695           4 :         uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW );
     696           4 :         sal_Int32 nColumn = getSplitColumn();
     697           4 :         SplitAtDefinedPosition( nColumn, _splitrow );
     698             :     }
     699           4 : }
     700             : 
     701             : double SAL_CALL
     702           4 : ScVbaWindow::getSplitVertical() throw (uno::RuntimeException, std::exception)
     703             : {
     704           4 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     705           4 :     return PixelsToPoints( getDevice(), xViewSplitable->getSplitVertical(), false );
     706             : }
     707             : 
     708             : void SAL_CALL
     709           2 : ScVbaWindow::setSplitVertical(double _splitvertical ) throw (uno::RuntimeException, std::exception)
     710             : {
     711           2 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     712           2 :     double fVertiPixels = PointsToPixels( getDevice(), _splitvertical, false );
     713           2 :     xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) );
     714           2 : }
     715             : 
     716           8 : void ScVbaWindow::SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows )
     717             : {
     718           8 :     uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW );
     719          16 :     uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewSplitable, uno::UNO_QUERY_THROW );
     720             :     // nColumns and nRows means split columns/rows
     721           8 :     if( nColumns == 0 && nRows == 0 )
     722           8 :         return;
     723             : 
     724           8 :     sal_Int32 cellColumn = nColumns + 1;
     725           8 :     sal_Int32 cellRow = nRows + 1;
     726             : 
     727           8 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     728           8 :     if ( pViewShell )
     729             :     {
     730             :         //firstly remove the old splitter
     731           8 :         xViewSplitable->splitAtPosition(0,0);
     732             : 
     733           8 :         uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
     734          16 :         uno::Reference< excel::XWorksheet > xSheet( xApplication->getActiveSheet(), uno::UNO_QUERY_THROW );
     735           8 :         xSheet->Cells(uno::makeAny(cellRow), uno::makeAny(cellColumn))->Select();
     736             : 
     737             :         //pViewShell->FreezeSplitters( FALSE );
     738          16 :         dispatchExecute( pViewShell, SID_WINDOW_SPLIT );
     739           8 :     }
     740             : }
     741             : 
     742             : uno::Any SAL_CALL
     743          12 : ScVbaWindow::getZoom() throw (uno::RuntimeException, std::exception)
     744             : {
     745          12 :     uno::Reference< beans::XPropertySet > xProps = getControllerProps();
     746          24 :     OUString sName( SC_UNO_ZOOMTYPE );
     747          12 :     sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH;
     748          12 :     xProps->getPropertyValue( sName ) >>= nZoomType;
     749          12 :     if( nZoomType == view::DocumentZoomType::PAGE_WIDTH )
     750             :     {
     751           0 :         return uno::makeAny( sal_True );
     752             :     }
     753          12 :     else if( nZoomType == view::DocumentZoomType::BY_VALUE )
     754             :     {
     755          12 :         sName = OUString( SC_UNO_ZOOMVALUE);
     756          12 :         sal_Int16 nZoom = 100;
     757          12 :         xProps->getPropertyValue( sName ) >>= nZoom;
     758          12 :         return uno::makeAny( nZoom );
     759             :     }
     760          12 :     return uno::Any();
     761             : }
     762             : 
     763           4 : void SAL_CALL ScVbaWindow::setZoom(const uno::Any& _zoom)
     764             :     throw (uno::RuntimeException, std::exception)
     765             : {
     766           4 :     sal_Int16 nZoom = 100;
     767           4 :     _zoom >>= nZoom;
     768           4 :     uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( m_xModel, uno::UNO_QUERY_THROW );
     769           8 :     uno::Reference< excel::XWorksheet > xActiveSheet = ActiveSheet();
     770           4 :     SCTAB nTab = 0;
     771           4 :     if ( !ScVbaWorksheets::nameExists (xSpreadDoc, xActiveSheet->getName(), nTab) )
     772           0 :         throw uno::RuntimeException();
     773           8 :     std::vector< SCTAB > vTabs;
     774           4 :     vTabs.push_back( nTab );
     775           8 :     excel::implSetZoom( m_xModel, nZoom, vTabs );
     776           4 : }
     777             : 
     778             : uno::Reference< excel::XWorksheet > SAL_CALL
     779           8 : ScVbaWindow::ActiveSheet(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
     780             : {
     781           8 :     uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
     782           8 :     return xApplication->getActiveSheet();
     783             : }
     784             : 
     785             : uno::Any SAL_CALL
     786           4 : ScVbaWindow::getView() throw (uno::RuntimeException, std::exception)
     787             : {
     788           4 :     bool bPageBreak = false;
     789           4 :     sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;
     790             : 
     791           4 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     792           4 :     if (pViewShell)
     793           4 :         bPageBreak = pViewShell->GetViewData().IsPagebreakMode();
     794             : 
     795           4 :     if( bPageBreak )
     796           2 :         nWindowView = excel::XlWindowView::xlPageBreakPreview;
     797             :     else
     798           2 :         nWindowView = excel::XlWindowView::xlNormalView;
     799             : 
     800           4 :     return uno::makeAny( nWindowView );
     801             : }
     802             : 
     803             : void SAL_CALL
     804           4 : ScVbaWindow::setView( const uno::Any& _view) throw (uno::RuntimeException, std::exception)
     805             : {
     806           4 :     sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;
     807           4 :     _view >>= nWindowView;
     808           4 :     sal_uInt16 nSlot = FID_NORMALVIEWMODE;
     809           4 :     switch ( nWindowView )
     810             :     {
     811             :         case excel::XlWindowView::xlNormalView:
     812           2 :             nSlot = FID_NORMALVIEWMODE;
     813           2 :             break;
     814             :         case excel::XlWindowView::xlPageBreakPreview:
     815           2 :             nSlot = FID_PAGEBREAKMODE;
     816           2 :             break;
     817             :         default:
     818           0 :             DebugHelper::runtimeexception(SbERR_BAD_PARAMETER, OUString() );
     819             :     }
     820             :     // !! TODO !! get view shell from controller
     821           4 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     822           4 :     if ( pViewShell )
     823           4 :         dispatchExecute( pViewShell, nSlot );
     824           4 : }
     825             : 
     826             : uno::Reference< excel::XRange > SAL_CALL
     827           0 : ScVbaWindow::getVisibleRange() throw (uno::RuntimeException, std::exception)
     828             : {
     829           0 :     uno::Reference< container::XIndexAccess > xPanesIA( getController(), uno::UNO_QUERY_THROW );
     830           0 :     uno::Reference< sheet::XViewPane > xTopLeftPane( xPanesIA->getByIndex( 0 ), uno::UNO_QUERY_THROW );
     831           0 :     uno::Reference< excel::XPane > xPane( new ScVbaPane( this, mxContext, m_xModel, xTopLeftPane ) );
     832           0 :     return xPane->getVisibleRange();
     833             : }
     834             : 
     835             : sal_Int32 SAL_CALL
     836           0 : ScVbaWindow::PointsToScreenPixelsX(sal_Int32 _points) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     837             : {
     838           0 :     sal_Int32 nHundredthsofOneMillimeters = Millimeter::getInHundredthsOfOneMillimeter( _points );
     839           0 :     double fConvertFactor = (getDevice()->getInfo().PixelPerMeterX/100000);
     840           0 :     return static_cast<sal_Int32>(fConvertFactor * nHundredthsofOneMillimeters );
     841             : }
     842             : 
     843             : sal_Int32 SAL_CALL
     844           0 : ScVbaWindow::PointsToScreenPixelsY(sal_Int32 _points) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     845             : {
     846           0 :     sal_Int32 nHundredthsofOneMillimeters = Millimeter::getInHundredthsOfOneMillimeter( _points );
     847           0 :     double fConvertFactor = (getDevice()->getInfo().PixelPerMeterY/100000);
     848           0 :     return static_cast<sal_Int32>(fConvertFactor * nHundredthsofOneMillimeters );
     849             : }
     850             : 
     851             : void SAL_CALL
     852           0 : ScVbaWindow::PrintOut( const css::uno::Any& From, const css::uno::Any&To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     853             : {
     854             :     // need test, print current active sheet
     855             :     // !! TODO !! get view shell from controller
     856           0 :     PrintOutHelper( excel::getBestViewShell( m_xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, true );
     857           0 : }
     858             : 
     859             : void SAL_CALL
     860           0 : ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
     861             : {
     862             :     // need test, print preview current active sheet
     863             :     // !! TODO !! get view shell from controller
     864           0 :     PrintPreviewHelper( EnableChanges, excel::getBestViewShell( m_xModel ) );
     865           0 : }
     866             : 
     867           0 : double SAL_CALL ScVbaWindow::getTabRatio() throw (css::uno::RuntimeException, std::exception)
     868             : {
     869           0 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     870           0 :     if ( pViewShell && pViewShell->GetViewData().GetView() )
     871             :     {
     872           0 :         double fRatio = pViewShell->GetViewData().GetView()->GetRelTabBarWidth();
     873           0 :         if ( fRatio >= 0.0 && fRatio <= 1.0 )
     874           0 :             return fRatio;
     875             :     }
     876           0 :     return 0.0;
     877             : }
     878             : 
     879           0 : void SAL_CALL ScVbaWindow::setTabRatio( double fRatio ) throw (css::uno::RuntimeException, std::exception)
     880             : {
     881           0 :     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
     882           0 :     if ( pViewShell && pViewShell->GetViewData().GetView() )
     883             :     {
     884           0 :         if ( fRatio >= 0.0 && fRatio <= 1.0 )
     885           0 :             pViewShell->GetViewData().GetView()->SetRelTabBarWidth( fRatio );
     886             :     }
     887           0 : }
     888             : 
     889             : OUString
     890           0 : ScVbaWindow::getServiceImplName()
     891             : {
     892           0 :     return OUString("ScVbaWindow");
     893             : }
     894             : 
     895             : uno::Sequence< OUString >
     896           0 : ScVbaWindow::getServiceNames()
     897             : {
     898           0 :     static uno::Sequence< OUString > aServiceNames;
     899           0 :     if ( aServiceNames.getLength() == 0 )
     900             :     {
     901           0 :         aServiceNames.realloc( 1 );
     902           0 :         aServiceNames[ 0 ] = "ooo.vba.excel.Window";
     903             :     }
     904           0 :     return aServiceNames;
     905             : }
     906             : namespace window
     907             : {
     908             : namespace sdecl = comphelper::service_decl;
     909           4 : sdecl::vba_service_class_<ScVbaWindow, sdecl::with_args<true> > serviceImpl;
     910           4 : extern sdecl::ServiceDecl const serviceDecl(
     911             :     serviceImpl,
     912             :     "ScVbaWindow",
     913             :     "ooo.vba.excel.Window" );
     914          12 : }
     915             : 
     916             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10