diff options
Diffstat (limited to 'sc/source/ui/vba/vbaworksheets.cxx')
-rw-r--r-- | sc/source/ui/vba/vbaworksheets.cxx | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index cb345950958b..5263b9a8ea34 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -61,7 +61,7 @@ using namespace ::com::sun::star; typedef ::cppu::WeakImplHelper1< container::XEnumeration > SheetEnumeration_BASE; typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > SheetCollectionHelper_BASE; -// a map ( or hashmap ) wont do as we need also to preserve the order +// a map ( or hashmap ) wont do as we need also to preserve the order // (as added ) of the items typedef std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap; @@ -69,7 +69,7 @@ typedef std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap; // #FIXME #TODO the implementation of the Sheets collections sucks, // e.g. there is no support for tracking sheets added/removed from the collection -uno::Reference< uno::XInterface > +uno::Reference< uno::XInterface > lcl_getModulAsUnoObject( const uno::Reference< sheet::XSpreadsheet >& xSheet, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) { uno::Reference< uno::XInterface > xRet; @@ -80,7 +80,7 @@ lcl_getModulAsUnoObject( const uno::Reference< sheet::XSpreadsheet >& xSheet, co xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_CODENAME ) ) ) >>= sName; ScDocShell* pShell = excel::getDocShell( xModel ); - + if ( pShell ) xRet = getUnoDocModule( sName, pShell ); return xRet; @@ -114,7 +114,7 @@ public: // XElementAccess virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return sheet::XSpreadsheet::static_type(0); } virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return ( mSheetMap.size() > 0 ); } - // XNameAcess + // XNameAcess virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { if ( !hasByName(aName) ) @@ -130,7 +130,7 @@ public: for ( ; it != it_end; ++it, ++pString ) { - uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW ); *pString = xName->getName(); } return sNames; @@ -141,7 +141,7 @@ public: SheetMap::iterator it_end = mSheetMap.end(); for ( ; cachePos != it_end; ++cachePos ) { - uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW ); if ( aName.equals( xName->getName() ) ) break; } @@ -149,12 +149,12 @@ public: } // XElementAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) { return mSheetMap.size(); } + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) { return mSheetMap.size(); } virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) { if ( Index < 0 || Index >= getCount() ) throw lang::IndexOutOfBoundsException(); - + return uno::makeAny( mSheetMap[ Index ] ); } @@ -171,35 +171,35 @@ class SheetsEnumeration : public EnumerationHelperImpl public: SheetsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_xModel( xModel ) {} - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { uno::Reference< sheet::XSpreadsheet > xSheet( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); uno::Reference< uno::XInterface > xIf = lcl_getModulAsUnoObject( xSheet, m_xModel ); uno::Any aRet; if ( !xIf.is() ) { - // if the Sheet is in a document created by the api unfortunately ( at the + // if the Sheet is in a document created by the api unfortunately ( at the // moment, it actually wont have the special Document modules uno::Reference< excel::XWorksheet > xNewSheet( new ScVbaWorksheet( m_xParent, m_xContext, xSheet, m_xModel ) ); - aRet <<= xNewSheet; + aRet <<= xNewSheet; } else - aRet <<= xIf; + aRet <<= xIf; return aRet; } }; -ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xSheets, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, xSheets ), mxModel( xModel ), m_xSheets( uno::Reference< sheet::XSpreadsheets >( xSheets, uno::UNO_QUERY ) ) +ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xSheets, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, xSheets ), mxModel( xModel ), m_xSheets( uno::Reference< sheet::XSpreadsheets >( xSheets, uno::UNO_QUERY ) ) { } -ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XEnumerationAccess >& xEnumAccess, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xEnumAccess, uno::UNO_QUERY ) ), mxModel(xModel) +ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XEnumerationAccess >& xEnumAccess, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xEnumAccess, uno::UNO_QUERY ) ), mxModel(xModel) { } // XEnumerationAccess -uno::Type +uno::Type ScVbaWorksheets::getElementType() throw (uno::RuntimeException) { return excel::XWorksheet::static_type(0); @@ -211,7 +211,7 @@ ScVbaWorksheets::createEnumeration() throw (uno::RuntimeException) if ( !m_xSheets.is() ) { uno::Reference< container::XEnumerationAccess > xAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); - return xAccess->createEnumeration(); + return xAccess->createEnumeration(); } uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xSheets, uno::UNO_QUERY_THROW ); return new SheetsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel ); @@ -225,7 +225,7 @@ ScVbaWorksheets::createCollectionObject( const uno::Any& aSource ) uno::Any aRet; if ( !xIf.is() ) { - // if the Sheet is in a document created by the api unfortunately ( at the + // if the Sheet is in a document created by the api unfortunately ( at the // moment, it actually wont have the special Document modules uno::Reference< excel::XWorksheet > xNewSheet( new ScVbaWorksheet( getParent(), mxContext, xSheet, mxModel ) ); aRet <<= xNewSheet; @@ -242,7 +242,7 @@ ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After, { if ( isSelectedSheets() ) return uno::Any(); // or should we throw? - + rtl::OUString aStringSheet; sal_Bool bBefore(sal_True); SCTAB nSheetIndex = 0; @@ -291,7 +291,7 @@ ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After, nSheetIndex++; SCTAB nSheetName = nCount + 1L; - String aStringBase( RTL_CONSTASCII_USTRINGPARAM("Sheet") ); + String aStringBase( RTL_CONSTASCII_USTRINGPARAM("Sheet") ); uno::Any result; for (SCTAB i=0; i < nNewSheets; i++, nSheetName++) { @@ -308,7 +308,7 @@ ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After, } uno::Reference< excel::XWorksheet > xNewSheet( result, uno::UNO_QUERY ); if ( xNewSheet.is() ) - xNewSheet->Activate(); + xNewSheet->Activate(); return result; } @@ -333,7 +333,7 @@ ScVbaWorksheets::isSelectedSheets() return !m_xSheets.is(); } -void SAL_CALL +void SAL_CALL ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException) { sal_Int32 nTo = 0; @@ -354,7 +354,7 @@ ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno:: PrintOutHelper( excel::getBestViewShell( mxModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection ); } -uno::Any SAL_CALL +uno::Any SAL_CALL ScVbaWorksheets::getVisible() throw (uno::RuntimeException) { sal_Bool bVisible = sal_True; @@ -371,7 +371,7 @@ ScVbaWorksheets::getVisible() throw (uno::RuntimeException) return uno::makeAny( bVisible ); } -void SAL_CALL +void SAL_CALL ScVbaWorksheets::setVisible( const uno::Any& _visible ) throw (uno::RuntimeException) { sal_Bool bState = sal_False; @@ -385,24 +385,24 @@ ScVbaWorksheets::setVisible( const uno::Any& _visible ) throw (uno::RuntimeExcep } } else - throw uno::RuntimeException( rtl::OUString( + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible property doesn't support non boolean #FIXME" ) ), uno::Reference< uno::XInterface >() ); } -void SAL_CALL +void SAL_CALL ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException) { ScTabViewShell* pViewShell = excel::getBestViewShell( mxModel ); if ( !pViewShell ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() ); - + ScMarkData& rMarkData = pViewShell->GetViewData()->GetMarkData(); sal_Bool bReplace = sal_True; Replace >>= bReplace; - // Replace is defaulted to True, meanining this current collection + // Replace is defaulted to True, meanining this current collection // becomes the Selection, if it were false then the current selection would // be extended - bool bSelectSingle = bReplace; + bool bSelectSingle = bReplace; sal_Int32 nElems = getCount(); for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem ) { @@ -417,15 +417,15 @@ ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException) } else rMarkData.SelectTable( static_cast< SCTAB >( pSheet->getSheetID() ), TRUE ); - + } } - + } //ScVbaCollectionBaseImpl -uno::Any SAL_CALL +uno::Any SAL_CALL ScVbaWorksheets::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException) { if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE ) @@ -447,28 +447,28 @@ ScVbaWorksheets::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (u uno::Reference< container::XNamed > xName( xSheet, uno::UNO_QUERY_THROW ); mSheets.push_back( xSheet ); } - } + } uno::Reference< container::XIndexAccess > xIndexAccess = new SheetCollectionHelper( mSheets ); uno::Reference< XCollection > xSelectedSheets( new ScVbaWorksheets( this->getParent(), mxContext, xIndexAccess, mxModel ) ); return uno::makeAny( xSelectedSheets ); } - return ScVbaWorksheets_BASE::Item( Index, Index2 ); + return ScVbaWorksheets_BASE::Item( Index, Index2 ); } -uno::Any +uno::Any ScVbaWorksheets::getItemByStringIndex( const rtl::OUString& sIndex ) throw (uno::RuntimeException) { return ScVbaWorksheets_BASE::getItemByStringIndex( sIndex ); } -rtl::OUString& +rtl::OUString& ScVbaWorksheets::getServiceImplName() { static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorksheets") ); return sImplName; } -css::uno::Sequence<rtl::OUString> +css::uno::Sequence<rtl::OUString> ScVbaWorksheets::getServiceNames() { static uno::Sequence< rtl::OUString > sNames; |