diff options
Diffstat (limited to 'sc/source/ui/unoobj/docuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 8e857adca09c..85c17f868b0a 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1392,7 +1392,8 @@ void SAL_CALL ScModelObj::enableAutomaticCalculation( sal_Bool bEnabled ) void SAL_CALL ScModelObj::protect( const rtl::OUString& aPassword ) throw(uno::RuntimeException) { ScUnoGuard aGuard; - if (pDocShell) + // #i108245# if already protected, don't change anything + if ( pDocShell && !pDocShell->GetDocument()->IsDocProtected() ) { String aString(aPassword); @@ -1410,9 +1411,9 @@ void SAL_CALL ScModelObj::unprotect( const rtl::OUString& aPassword ) String aString(aPassword); ScDocFunc aFunc(*pDocShell); - aFunc.Unprotect( TABLEID_DOC, aString, TRUE ); - - //! Rueckgabewert auswerten, Exception oder so + BOOL bDone = aFunc.Unprotect( TABLEID_DOC, aString, TRUE ); + if (!bDone) + throw lang::IllegalArgumentException(); } } @@ -2074,6 +2075,13 @@ sal_Int64 SAL_CALL ScModelObj::getSomething( return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); } + if ( rId.getLength() == 16 && + 0 == rtl_compareMemory( SfxObjectShell::getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell )); + } + // aggregated number formats supplier has XUnoTunnel, too // interface from aggregated object must be obtained via queryAggregation |