LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbaworkbook.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 45 192 23.4 %
Date: 2012-08-25 Functions: 8 29 27.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 49 361 13.6 %

           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                 :            : #include <vbahelper/helperdecl.hxx>
      29                 :            : #include <tools/urlobj.hxx>
      30                 :            : #include <comphelper/unwrapargs.hxx>
      31                 :            : #include <comphelper/servicehelper.hxx>
      32                 :            : 
      33                 :            : #include <com/sun/star/util/XModifiable.hpp>
      34                 :            : #include <com/sun/star/util/XProtectable.hpp>
      35                 :            : #include <com/sun/star/sheet/XSpreadsheetView.hpp>
      36                 :            : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
      37                 :            : #include <com/sun/star/frame/XStorable.hpp>
      38                 :            : #include <com/sun/star/frame/XFrame.hpp>
      39                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      40                 :            : #include <ooo/vba/excel/XlFileFormat.hpp>
      41                 :            : #include <ooo/vba/excel/XApplication.hpp>
      42                 :            : 
      43                 :            : #include "scextopt.hxx"
      44                 :            : #include "vbaworksheet.hxx"
      45                 :            : #include "vbaworksheets.hxx"
      46                 :            : #include "vbaworkbook.hxx"
      47                 :            : #include "vbawindows.hxx"
      48                 :            : #include "vbastyles.hxx"
      49                 :            : #include "excelvbahelper.hxx"
      50                 :            : #include "vbapalette.hxx"
      51                 :            : #include <osl/file.hxx>
      52                 :            : #include <stdio.h>
      53                 :            : #include "vbanames.hxx"
      54                 :            : #include "nameuno.hxx"
      55                 :            : #include "docoptio.hxx"
      56                 :            : #include "unonames.hxx"
      57                 :            : 
      58                 :            : // Much of the impl. for the equivalend UNO module is
      59                 :            : // sc/source/ui/unoobj/docuno.cxx, viewuno.cxx
      60                 :            : 
      61                 :            : using namespace ::ooo::vba;
      62                 :            : using namespace ::com::sun::star;
      63                 :            : 
      64                 :          3 : uno::Sequence< sal_Int32 > ScVbaWorkbook::ColorData;
      65                 :            : 
      66                 :          2 : void ScVbaWorkbook::initColorData( const uno::Sequence< sal_Int32 >& sColors )
      67                 :            : {
      68                 :          2 :         const sal_Int32* pSource = sColors.getConstArray();
      69                 :          2 :         sal_Int32* pDest = ColorData.getArray();
      70                 :          2 :         const sal_Int32* pEnd = pSource + sColors.getLength();
      71         [ +  + ]:        114 :         for ( ; pSource != pEnd; ++pSource, ++pDest )
      72                 :        112 :             *pDest = *pSource;
      73                 :          2 : }
      74                 :            : 
      75                 :            : 
      76                 :            : void SAL_CALL
      77                 :          2 : ScVbaWorkbook::ResetColors(  ) throw (::script::BasicErrorException, ::uno::RuntimeException)
      78                 :            : {
      79 [ +  - ][ +  - ]:          2 :         uno::Reference< container::XIndexAccess > xIndexAccess( ScVbaPalette::getDefaultPalette(), uno::UNO_QUERY_THROW );
      80 [ +  - ][ +  - ]:          2 :         sal_Int32 nLen = xIndexAccess->getCount();
      81         [ +  - ]:          2 :         ColorData.realloc( nLen );
      82                 :            : 
      83         [ +  - ]:          2 :         uno::Sequence< sal_Int32 > dDefaultColors( nLen );
      84         [ +  - ]:          2 :         sal_Int32* pDest = dDefaultColors.getArray();
      85         [ +  + ]:        114 :         for ( sal_Int32 index=0; index < nLen; ++pDest, ++index )
      86 [ +  - ][ +  - ]:        112 :             xIndexAccess->getByIndex( index )  >>= (*pDest);
      87 [ +  - ][ +  - ]:          2 :         initColorData( dDefaultColors );
      88                 :          2 : }
      89                 :            : 
      90                 :            : ::uno::Any SAL_CALL
      91                 :          0 : ScVbaWorkbook::Colors( const ::uno::Any& Index ) throw (::script::BasicErrorException, ::uno::RuntimeException)
      92                 :            : {
      93                 :          0 :     uno::Any aRet;
      94         [ #  # ]:          0 :     if ( Index.getValue() )
      95                 :            :     {
      96                 :          0 :         sal_Int32 nIndex = 0;
      97                 :          0 :         Index >>= nIndex;
      98 [ #  # ][ #  # ]:          0 :         aRet = uno::makeAny( XLRGBToOORGB( ColorData[ --nIndex ] ) );
                 [ #  # ]
      99                 :            :     }
     100                 :            :     else
     101         [ #  # ]:          0 :         aRet = uno::makeAny( ColorData );
     102                 :          0 :     return aRet;
     103                 :            : }
     104                 :            : 
     105                 :            : ::sal_Int32 SAL_CALL
     106                 :          0 : ScVbaWorkbook::getFileFormat(  ) throw (::uno::RuntimeException)
     107                 :            : {
     108                 :          0 :         sal_Int32 aFileFormat = 0;
     109                 :          0 :         rtl::OUString aFilterName;
     110 [ #  # ][ #  # ]:          0 :         uno::Sequence< beans::PropertyValue > aArgs = getModel()->getArgs();
                 [ #  # ]
     111                 :            : 
     112                 :            :         // #FIXME - seems suspect should we not walk through the properties
     113                 :            :         // to find the FilterName
     114 [ #  # ][ #  # ]:          0 :         if ( aArgs[0].Name == "FilterName" ) {
     115         [ #  # ]:          0 :             aArgs[0].Value >>= aFilterName;
     116                 :            :         } else {
     117         [ #  # ]:          0 :            aArgs[1].Value >>= aFilterName;
     118                 :            :         }
     119                 :            : 
     120         [ #  # ]:          0 :         if (aFilterName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Text - txt - csv (StarCalc)"))) {
     121                 :          0 :             aFileFormat = excel::XlFileFormat::xlCSV; //xlFileFormat.
     122                 :            :         }
     123                 :            : 
     124         [ #  # ]:          0 :         if ( aFilterName == "DBF" ) {
     125                 :          0 :             aFileFormat = excel::XlFileFormat::xlDBF4;
     126                 :            :         }
     127                 :            : 
     128         [ #  # ]:          0 :         if ( aFilterName == "DIF" ) {
     129                 :          0 :             aFileFormat = excel::XlFileFormat::xlDIF;
     130                 :            :         }
     131                 :            : 
     132         [ #  # ]:          0 :         if ( aFilterName == "Lotus" ) {
     133                 :          0 :             aFileFormat = excel::XlFileFormat::xlWK3;
     134                 :            :         }
     135                 :            : 
     136         [ #  # ]:          0 :         if ( aFilterName == "MS Excel 4.0" ) {
     137                 :          0 :             aFileFormat = excel::XlFileFormat::xlExcel4Workbook;
     138                 :            :         }
     139                 :            : 
     140         [ #  # ]:          0 :         if ( aFilterName == "MS Excel 5.0/95" ) {
     141                 :          0 :             aFileFormat = excel::XlFileFormat::xlExcel5;
     142                 :            :         }
     143                 :            : 
     144         [ #  # ]:          0 :         if ( aFilterName == "MS Excel 97" ) {
     145                 :          0 :             aFileFormat = excel::XlFileFormat::xlExcel9795;
     146                 :            :         }
     147                 :            : 
     148         [ #  # ]:          0 :         if (aFilterName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HTML (StarCalc)"))) {
     149                 :          0 :             aFileFormat = excel::XlFileFormat::xlHtml;
     150                 :            :         }
     151                 :            : 
     152         [ #  # ]:          0 :         if ( aFilterName == "calc_StarOffice_XML_Calc_Template" ) {
     153                 :          0 :             aFileFormat = excel::XlFileFormat::xlTemplate;
     154                 :            :         }
     155                 :            : 
     156         [ #  # ]:          0 :         if (aFilterName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("StarOffice XML (Calc)"))) {
     157                 :          0 :             aFileFormat = excel::XlFileFormat::xlWorkbookNormal;
     158                 :            :         }
     159         [ #  # ]:          0 :         if ( aFilterName == "calc8" ) {
     160                 :          0 :             aFileFormat = excel::XlFileFormat::xlWorkbookNormal;
     161                 :            :         }
     162                 :            : 
     163         [ #  # ]:          0 :         return aFileFormat;
     164                 :            : }
     165                 :            : 
     166                 :            : // Convert Excel fileformat to OO file filter
     167                 :          0 : ::rtl::OUString ScVbaWorkbook::convertFileFormat(sal_Int32 aFileFormat)
     168                 :            : {
     169                 :          0 :     rtl::OUString aFilterName;
     170                 :            : 
     171      [ #  #  # ]:          0 :     switch(aFileFormat)
     172                 :            :     {
     173                 :            :         case excel::XlFileFormat::xlCSV:
     174         [ #  # ]:          0 :                 aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text - txt - csv (StarCalc)" ) );
     175                 :          0 :                 break;
     176                 :            :         case excel::XlFileFormat::xlExcel9795:
     177         [ #  # ]:          0 :                 aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MS Excel 97" ) );
     178                 :          0 :                 break;
     179                 :            :     }
     180                 :            : 
     181                 :          0 :     return aFilterName;
     182                 :            : }
     183                 :            : 
     184                 :            : void
     185                 :          4 : ScVbaWorkbook::init()
     186                 :            : {
     187         [ +  + ]:          4 :     if ( !ColorData.getLength() )
     188                 :          2 :         ResetColors();
     189                 :          4 : }
     190                 :          0 : ScVbaWorkbook::ScVbaWorkbook(   const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext) :ScVbaWorkbook_BASE( xParent, xContext )
     191                 :            : {
     192                 :            :     //#FIXME this persists the color data per office instance and
     193                 :            :     // not per workbook instance, need to hook the data into XModel
     194                 :            :     // ( e.g. we already store the imported palette in there )
     195                 :            :     // so we should,
     196                 :            :     // a) make the class that does that a service
     197                 :            :     // b) make that service implement XIndexContainer
     198         [ #  # ]:          0 :     init();
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : ScVbaWorkbook::ScVbaWorkbook(   const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::frame::XModel > xModel ) : ScVbaWorkbook_BASE( xParent, xContext, xModel )
     202                 :            : {
     203         [ #  # ]:          0 :     init();
     204                 :          0 : }
     205                 :            : 
     206                 :          4 : ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args,
     207                 :          4 :     uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( args, xContext )
     208                 :            : {
     209         [ +  - ]:          4 :     init();
     210                 :          4 : }
     211                 :            : 
     212                 :            : namespace
     213                 :            : {
     214                 :            :     class theScVbaWorkbookUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScVbaWorkbookUnoTunnelId > {};
     215                 :            : }
     216                 :            : 
     217                 :            : const uno::Sequence<sal_Int8>&
     218                 :          0 : ScVbaWorkbook::getUnoTunnelId()
     219                 :            : {
     220                 :          0 :     return theScVbaWorkbookUnoTunnelId::get().getSeq();
     221                 :            : }
     222                 :            : 
     223                 :            : uno::Reference< excel::XWorksheet >
     224                 :         12 : ScVbaWorkbook::getActiveSheet() throw (uno::RuntimeException)
     225                 :            : {
     226 [ +  - ][ +  - ]:         12 :     uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ), uno::UNO_SET_THROW );
     227 [ +  - ][ +  - ]:         12 :     uno::Reference< sheet::XSpreadsheetView > xView( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
                 [ +  - ]
     228 [ +  - ][ +  - ]:         12 :     uno::Reference< beans::XPropertySet > xSheetProps( xView->getActiveSheet(), uno::UNO_QUERY_THROW );
                 [ +  - ]
     229                 :            :     // return the original document module wrapper object, instead of a new instance
     230                 :         12 :     ::rtl::OUString aCodeName;
     231 [ +  - ][ +  - ]:         12 :     xSheetProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_CODENAME ) ) ) >>= aCodeName;
                 [ +  - ]
     232         [ +  - ]:         12 :     ScDocShell* pShell = excel::getDocShell( xModel );
     233         [ -  + ]:         12 :     if( !pShell )
     234         [ #  # ]:          0 :         throw uno::RuntimeException();
     235 [ +  - ][ +  - ]:         12 :     return uno::Reference< excel::XWorksheet >( getUnoDocModule( aCodeName, pShell ), uno::UNO_QUERY_THROW );
         [ +  - ][ +  - ]
     236                 :            : }
     237                 :            : 
     238                 :            : uno::Any SAL_CALL
     239                 :          0 : ScVbaWorkbook::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
     240                 :            : {
     241                 :          0 :     return Worksheets( aIndex );
     242                 :            : }
     243                 :            : 
     244                 :            : uno::Any SAL_CALL
     245                 :         22 : ScVbaWorkbook::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
     246                 :            : {
     247         [ +  - ]:         22 :     uno::Reference< frame::XModel > xModel( getModel() );
     248         [ +  - ]:         22 :     uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
     249 [ +  - ][ +  - ]:         22 :     uno::Reference<container::XIndexAccess > xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
                 [ +  - ]
     250 [ +  - ][ +  - ]:         22 :     uno::Reference< XCollection > xWorkSheets(  new ScVbaWorksheets( this, mxContext, xSheets, xModel ) );
         [ +  - ][ +  - ]
     251         [ -  + ]:         22 :     if (  aIndex.getValueTypeClass() == uno::TypeClass_VOID )
     252                 :            :     {
     253         [ #  # ]:          0 :         return uno::Any( xWorkSheets );
     254                 :            :     }
     255                 :            :     // pass on to collection
     256 [ +  - ][ +  - ]:         22 :     return uno::Any( xWorkSheets->Item( aIndex, uno::Any() ) );
     257                 :            : }
     258                 :            : uno::Any SAL_CALL
     259                 :          0 : ScVbaWorkbook::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException)
     260                 :            : {
     261                 :            : 
     262 [ #  # ][ #  # ]:          0 :     uno::Reference< excel::XWindows >  xWindows( new ScVbaWindows( getParent(), mxContext ) );
         [ #  # ][ #  # ]
     263         [ #  # ]:          0 :     if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
     264         [ #  # ]:          0 :         return uno::Any( xWindows );
     265 [ #  # ][ #  # ]:          0 :     return uno::Any( xWindows->Item( aIndex, uno::Any() ) );
     266                 :            : }
     267                 :            : 
     268                 :            : void SAL_CALL
     269                 :          0 : ScVbaWorkbook::Activate() throw (uno::RuntimeException)
     270                 :            : {
     271                 :          0 :     VbaDocumentBase::Activate();
     272                 :          0 : }
     273                 :            : 
     274                 :            : void
     275                 :          0 : ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
     276                 :            : {
     277                 :          0 :     VbaDocumentBase::Protect( aPassword );
     278                 :          0 : }
     279                 :            : 
     280                 :            : ::sal_Bool
     281                 :          0 : ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
     282                 :            : {
     283 [ #  # ][ #  # ]:          0 :     uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
     284 [ #  # ][ #  # ]:          0 :     return xProt->isProtected();
     285                 :            : }
     286                 :            : 
     287                 :          0 : ::sal_Bool SAL_CALL ScVbaWorkbook::getPrecisionAsDisplayed() throw (uno::RuntimeException)
     288                 :            : {
     289 [ #  # ][ #  # ]:          0 :     uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
     290         [ #  # ]:          0 :     ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
     291         [ #  # ]:          0 :     return pDoc->GetDocOptions().IsCalcAsShown();
     292                 :            : }
     293                 :            : 
     294                 :          0 : void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDisplayed ) throw (uno::RuntimeException)
     295                 :            : {
     296 [ #  # ][ #  # ]:          0 :     uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
     297         [ #  # ]:          0 :     ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
     298 [ #  # ][ #  # ]:          0 :     ScDocOptions aOpt = pDoc->GetDocOptions();
     299                 :          0 :     aOpt.SetCalcAsShown( _precisionAsDisplayed );
     300 [ #  # ][ #  # ]:          0 :     pDoc->SetDocOptions( aOpt );
     301                 :          0 : }
     302                 :            : 
     303                 :            : void
     304                 :          0 : ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::RuntimeException)
     305                 :            : {
     306                 :          0 :     rtl::OUString aURL;
     307         [ #  # ]:          0 :     osl::FileBase::getFileURLFromSystemPath( sFileName, aURL );
     308 [ #  # ][ #  # ]:          0 :     uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
     309         [ #  # ]:          0 :     uno::Sequence<  beans::PropertyValue > storeProps(1);
     310 [ #  # ][ #  # ]:          0 :     storeProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
     311 [ #  # ][ #  # ]:          0 :     storeProps[0].Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MS Excel 97" ) );
                 [ #  # ]
     312 [ #  # ][ #  # ]:          0 :     xStor->storeToURL( aURL, storeProps );
                 [ #  # ]
     313                 :          0 : }
     314                 :            : 
     315                 :            : // Add Workbook.SaveAs.
     316                 :            : void
     317                 :          0 : ScVbaWorkbook::SaveAs( const rtl::OUString& FileName, const uno::Any& FileFormat, const uno::Any& /*CreateBackup*/ ) throw ( uno::RuntimeException)
     318                 :            : {
     319                 :          0 :     rtl::OUString aURL;
     320         [ #  # ]:          0 :     osl::FileBase::getFileURLFromSystemPath( FileName, aURL );
     321                 :            :     //if the input parameter "FileName" takes the form as "MyFile", we need to get the current directory and combine the current directory and the file name
     322         [ #  # ]:          0 :     INetURLObject aFileNameURL( aURL );
     323         [ #  # ]:          0 :     aURL = aFileNameURL.GetMainURL( INetURLObject::NO_DECODE );
     324         [ #  # ]:          0 :     if ( aURL.isEmpty() )
     325                 :            :     {
     326 [ #  # ][ #  # ]:          0 :         uno::Reference< excel::XApplication > xApplication ( Application(),uno::UNO_QUERY_THROW );
     327 [ #  # ][ #  # ]:          0 :         rtl::OUString aPathStr = xApplication->getDefaultFilePath();
     328                 :          0 :         rtl::OUString aPathURLStr;
     329         [ #  # ]:          0 :         osl::FileBase::getFileURLFromSystemPath( aPathStr, aPathURLStr );
     330         [ #  # ]:          0 :         INetURLObject aPathURL( aPathURLStr );
     331         [ #  # ]:          0 :         aPathURL.Append( FileName );
     332 [ #  # ][ #  # ]:          0 :         aURL = aPathURL.GetMainURL( INetURLObject::NO_DECODE );
     333                 :            :     }
     334                 :            : 
     335 [ #  # ][ #  # ]:          0 :     uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
     336                 :            : 
     337                 :          0 :     sal_Int32 aFileFormat = excel::XlFileFormat::xlExcel9795;
     338                 :          0 :     FileFormat >>= aFileFormat;
     339                 :            : 
     340         [ #  # ]:          0 :     if (  FileName.indexOf('.') == -1 )
     341                 :            :     {
     342         [ #  # ]:          0 :         if ( aFileFormat == excel::XlFileFormat::xlExcel9795 )
     343                 :            :         {
     344         [ #  # ]:          0 :             aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".xls" ) );
     345                 :            :         }
     346         [ #  # ]:          0 :         else if ( aFileFormat == excel::XlFileFormat::xlCSV )
     347                 :            :         {
     348         [ #  # ]:          0 :             aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".csv" ) );
     349                 :            :         }
     350                 :            :     }
     351                 :            : 
     352         [ #  # ]:          0 :     uno::Sequence<  beans::PropertyValue > storeProps(1);
     353 [ #  # ][ #  # ]:          0 :     storeProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
     354 [ #  # ][ #  # ]:          0 :     storeProps[0].Value <<= convertFileFormat(aFileFormat);
                 [ #  # ]
     355                 :            : 
     356 [ #  # ][ #  # ]:          0 :     xStor->storeAsURL( aURL, storeProps );
         [ #  # ][ #  # ]
     357                 :          0 : }
     358                 :            : 
     359                 :            : css::uno::Any SAL_CALL
     360                 :          0 : ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException)
     361                 :            : {
     362                 :            :     // quick look and Styles object doesn't seem to have a valid parent
     363                 :            :     // or a least the object browser just shows an object that has no
     364                 :            :     // variables ( therefore... leave as NULL for now )
     365 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > dStyles = new ScVbaStyles( uno::Reference< XHelperInterface >(), mxContext, getModel() );
         [ #  # ][ #  # ]
     366         [ #  # ]:          0 :     if ( Item.hasValue() )
     367 [ #  # ][ #  # ]:          0 :         return dStyles->Item( Item, uno::Any() );
     368         [ #  # ]:          0 :     return uno::makeAny( dStyles );
     369                 :            : }
     370                 :            : 
     371                 :            : uno::Any SAL_CALL
     372                 :          0 : ScVbaWorkbook::Names( const uno::Any& aIndex ) throw (uno::RuntimeException)
     373                 :            : {
     374 [ #  # ][ #  # ]:          0 :     uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
     375         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xProps( xModel, uno::UNO_QUERY_THROW );
     376 [ #  # ][ #  # ]:          0 :     uno::Reference< sheet::XNamedRanges > xNamedRanges(  xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NamedRanges") ) ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     377 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xNames( new ScVbaNames( this, mxContext, xNamedRanges, xModel ) );
         [ #  # ][ #  # ]
     378         [ #  # ]:          0 :     if ( aIndex.hasValue() )
     379 [ #  # ][ #  # ]:          0 :         return uno::Any( xNames->Item( aIndex, uno::Any() ) );
     380         [ #  # ]:          0 :     return uno::Any( xNames );
     381                 :            : }
     382                 :            : 
     383                 :            : rtl::OUString
     384                 :          0 : ScVbaWorkbook::getServiceImplName()
     385                 :            : {
     386                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaWorkbook"));
     387                 :            : }
     388                 :            : 
     389                 :            : uno::Sequence< rtl::OUString >
     390                 :          0 : ScVbaWorkbook::getServiceNames()
     391                 :            : {
     392 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
     393         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
     394                 :            :     {
     395                 :          0 :         aServiceNames.realloc( 1 );
     396         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook" ) );
     397                 :            :     }
     398                 :          0 :     return aServiceNames;
     399                 :            : }
     400                 :            : 
     401                 :            : ::rtl::OUString SAL_CALL
     402                 :          0 : ScVbaWorkbook::getCodeName() throw (css::uno::RuntimeException)
     403                 :            : {
     404 [ #  # ][ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xModelProp( getModel(), uno::UNO_QUERY_THROW );
     405 [ #  # ][ #  # ]:          0 :     return xModelProp->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CodeName" ) ) ).get< ::rtl::OUString >();
         [ #  # ][ #  # ]
     406                 :            : }
     407                 :            : 
     408                 :            : sal_Int64
     409                 :          0 : ScVbaWorkbook::getSomething(const uno::Sequence<sal_Int8 >& rId ) throw(css::uno::RuntimeException)
     410                 :            : {
     411   [ #  #  #  # ]:          0 :     if (rId.getLength() == 16 &&
                 [ #  # ]
     412                 :          0 :         0 == memcmp( ScVbaWorksheet::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ))
     413                 :            :     {
     414                 :          0 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     415                 :            :     }
     416                 :          0 :     return 0;
     417                 :            : }
     418                 :            : 
     419                 :            : namespace workbook
     420                 :            : {
     421                 :            : namespace sdecl = comphelper::service_decl;
     422                 :          3 : sdecl::vba_service_class_<ScVbaWorkbook, sdecl::with_args<true> > serviceImpl;
     423                 :          3 : extern sdecl::ServiceDecl const serviceDecl(
     424                 :            :     serviceImpl,
     425                 :            :     "ScVbaWorkbook",
     426                 :            :     "ooo.vba.excel.Workbook" );
     427 [ +  - ][ +  - ]:          9 : }
     428                 :            : 
     429                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10