1 --- oovbaapi/ooo/vba/excel/XWorksheet.idl.orig 2008-07-29 18:14:09.000000000 +0800
2 +++ oovbaapi/ooo/vba/excel/XWorksheet.idl 2008-07-29 18:17:10.000000000 +0800
3 @@ -70,6 +70,7 @@ interface XWorksheet
4 [attribute, readonly] XWorksheet Previous;
5 [attribute, readonly] string CodeName;
6 [attribute, readonly] short Index;
7 + [attribute] long EnableSelection;
11 --- sc/source/ui/vba/vbaworksheet.hxx.orig 2008-07-29 18:14:09.000000000 +0800
12 +++ sc/source/ui/vba/vbaworksheet.hxx 2008-07-29 18:17:49.000000000 +0800
13 @@ -96,6 +96,8 @@ public:
14 virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getNext() throw (css::uno::RuntimeException);
15 virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getPrevious() throw (css::uno::RuntimeException);
16 virtual sal_Int16 SAL_CALL getIndex() throw (css::uno::RuntimeException);
17 + virtual sal_Int32 SAL_CALL getEnableSelection() throw (css::uno::RuntimeException);
18 + virtual void SAL_CALL setEnableSelection( sal_Int32 nSelection ) throw (css::uno::RuntimeException);
21 virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
22 --- sc/source/ui/vba/vbaworksheet.cxx.orig 2008-07-29 18:14:32.000000000 +0800
23 +++ sc/source/ui/vba/vbaworksheet.cxx 2008-07-29 18:22:43.000000000 +0800
25 #include <com/sun/star/drawing/XControlShape.hpp>
26 #include <com/sun/star/form/FormComponentType.hpp>
27 #include <com/sun/star/form/XFormsSupplier.hpp>
28 +#include <ooo/vba/excel/XlEnableSelection.hpp>
30 #include <comphelper/processfactory.hxx>
32 @@ -257,6 +258,83 @@ ScVbaWorksheet::getIndex() throw (uno::R
33 return getSheetID() + 1;
37 +ScVbaWorksheet::getEnableSelection() throw (uno::RuntimeException)
39 + uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
41 + rtl::OUString aSheetName = getName();
42 + bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab);
45 + uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
46 + ScDocument* pDoc = getDocShell( xModel )->GetDocument();
47 + ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
48 + sal_Bool bLockedCells = sal_False;
49 + sal_Bool bUnlockedCells = sal_False;
52 + bLockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
53 + bUnlockedCells = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
56 + return excel::XlEnableSelection::xlNoRestrictions;
57 + if( bUnlockedCells )
58 + return excel::XlEnableSelection::xlUnlockedCells;
59 + return excel::XlEnableSelection::xlNoSelection;
62 + throw uno::RuntimeException(::rtl::OUString(
63 + RTL_CONSTASCII_USTRINGPARAM( "Sheet Name does not exist. ") ),
64 + uno::Reference< XInterface >() );
65 + return excel::XlEnableSelection::xlNoSelection;
70 +ScVbaWorksheet::setEnableSelection( sal_Int32 nSelection ) throw (uno::RuntimeException)
72 + if( (nSelection != excel::XlEnableSelection::xlNoRestrictions) &&
73 + (nSelection != excel::XlEnableSelection::xlUnlockedCells) &&
74 + (nSelection != excel::XlEnableSelection::xlNoSelection) )
76 + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
79 + uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
81 + rtl::OUString aSheetName = getName();
82 + bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab);
85 + uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
86 + ScDocument* pDoc = getDocShell( xModel )->GetDocument();
87 + ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
88 + // default is xlNoSelection
89 + sal_Bool bLockedCells = sal_False;
90 + sal_Bool bUnlockedCells = sal_False;
91 + if( nSelection == excel::XlEnableSelection::xlNoRestrictions )
93 + bLockedCells = sal_True;
94 + bUnlockedCells = sal_True;
96 + else if( nSelection == excel::XlEnableSelection::xlUnlockedCells )
98 + bUnlockedCells = sal_True;
102 + pProtect->setOption( ScTableProtection::SELECT_LOCKED_CELLS, bLockedCells );
103 + pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, bUnlockedCells );
107 + throw uno::RuntimeException(::rtl::OUString(
108 + RTL_CONSTASCII_USTRINGPARAM( "Sheet Name does not exist. ") ),
109 + uno::Reference< XInterface >() );
113 uno::Reference< excel::XRange >
114 ScVbaWorksheet::getUsedRange() throw (uno::RuntimeException)