diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-08-26 14:15:19 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-08-26 14:15:19 +0200 |
commit | 7e8aec45e5b2313a682fcec37e47e2f6ee8a2a47 (patch) | |
tree | 1a3134ca57e9d0cf0b99874ad869ea13d9b819de /sc | |
parent | mib19: #163419# corrected wrong commit (diff) | |
download | core-7e8aec45e5b2313a682fcec37e47e2f6ee8a2a47.tar.gz core-7e8aec45e5b2313a682fcec37e47e2f6ee8a2a47.zip |
mib19: #163428# VBA symbol Worksheet.Visible supports xlSheetVeryHidden now
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/vba/vbaworksheet.cxx | 43 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaworksheet.hxx | 5 |
2 files changed, 33 insertions, 15 deletions
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 6ee6fa1f6b19..b2421727f109 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/form/XFormsSupplier.hpp> #include <ooo/vba/excel/XlEnableSelection.hpp> +#include <ooo/vba/excel/XlSheetVisibility.hpp> #include <ooo/vba/excel/XWorkbook.hpp> #include <ooo/vba/XControlProvider.hpp> @@ -179,18 +180,18 @@ openNewDoc(rtl::OUString aSheetName ) return xModel; } -ScVbaWorksheet::ScVbaWorksheet( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : WorksheetImpl_BASE( xParent, xContext ) +ScVbaWorksheet::ScVbaWorksheet( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : WorksheetImpl_BASE( xParent, xContext ), mbVeryHidden( false ) { } ScVbaWorksheet::ScVbaWorksheet(const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheet >& xSheet, - const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : WorksheetImpl_BASE( xParent, xContext ), mxSheet( xSheet ), mxModel(xModel) + const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : WorksheetImpl_BASE( xParent, xContext ), mxSheet( xSheet ), mxModel(xModel), mbVeryHidden( false ) { } ScVbaWorksheet::ScVbaWorksheet( uno::Sequence< uno::Any> const & args, - uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : WorksheetImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) + uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : WorksheetImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ), mbVeryHidden( false ) { if ( args.getLength() < 2 ) throw lang::IllegalArgumentException(); @@ -221,24 +222,40 @@ ScVbaWorksheet::setName(const ::rtl::OUString &rName ) throw (uno::RuntimeExcept xNamed->setName( rName ); } -sal_Bool +sal_Int32 ScVbaWorksheet::getVisible() throw (uno::RuntimeException) { uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW ); - uno::Any aValue = xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ) ); - sal_Bool bRet = false; - aValue >>= bRet; - return bRet; + bool bVisible = false; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ) ) >>= bVisible; + using namespace ::ooo::vba::excel::XlSheetVisibility; + return bVisible ? xlSheetVisible : (mbVeryHidden ? xlSheetVeryHidden : xlSheetHidden); } void -ScVbaWorksheet::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) +ScVbaWorksheet::setVisible( sal_Int32 nVisible ) throw (uno::RuntimeException) { + using namespace ::ooo::vba::excel::XlSheetVisibility; + bool bVisible = true; + switch( nVisible ) + { + case xlSheetVisible: case 1: // Excel accepts -1 and 1 for visible sheets + bVisible = true; + mbVeryHidden = false; + break; + case xlSheetHidden: + bVisible = false; + mbVeryHidden = false; + break; + case xlSheetVeryHidden: + bVisible = false; + mbVeryHidden = true; + break; + default: + throw uno::RuntimeException(); + } uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW ); - uno::Any aValue( bVisible ); - xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ), aValue); + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ), uno::Any( bVisible ) ); } sal_Int16 diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx index 78bcc2503a49..ff5850b7c445 100644 --- a/sc/source/ui/vba/vbaworksheet.hxx +++ b/sc/source/ui/vba/vbaworksheet.hxx @@ -62,6 +62,7 @@ class ScVbaWorksheet : public WorksheetImpl_BASE css::uno::Reference< ov::excel::XChartObjects > mxCharts; css::uno::Reference< ov::excel::XHyperlinks > mxHlinks; ::rtl::Reference< ScVbaSheetObjectsBase > mxButtons; + bool mbVeryHidden; css::uno::Reference< ov::excel::XWorksheet > getSheetAtOffset(SCTAB offset) throw (css::uno::RuntimeException); css::uno::Reference< ov::excel::XRange > getSheetRange() throw (css::uno::RuntimeException); @@ -91,8 +92,8 @@ public: // Attributes virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getVisible() throw (css::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Int32 nVisible ) throw (css::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getStandardWidth() throw (css::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getStandardHeight() throw (css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getProtectionMode() throw (css::uno::RuntimeException); |