diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-07-15 14:30:44 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-07-15 14:30:44 +0200 |
commit | dfb885a53b8e92b766f13b8f67660f0b58882761 (patch) | |
tree | 21bbac6ea19deb535ceab223c97419cfd1eb3345 | |
parent | 476d5154563c7357c3f10069725dfcff5016712a (diff) |
mib17: #i112634# do not use an UNO interface to handle VBA BeforeSave and BeforePrint events
-rw-r--r-- | sfx2/inc/sfx2/objsh.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 14 |
5 files changed, 22 insertions, 32 deletions
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 49223c23de75..abe6a8068513 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -346,6 +346,9 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); virtual void UpdateLinks(); + // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action + virtual sal_Bool QuerySlotExecutable( USHORT nSlotId ); + sal_Bool SaveChildren(BOOL bObjectsOnly=FALSE); sal_Bool SaveAsChildren( SfxMedium &rMedium ); sal_Bool SwitchChildrenPersistance( diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index ae3b527ff7a6..066f366b09bd 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -100,7 +100,6 @@ #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> -#include <com/sun/star/script/vba/XCoreEventProcessor.hpp> #include "helpid.hrc" @@ -490,21 +489,12 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_SAVEASDOC: case SID_SAVEDOC: { - // ask VBA emulation at document model whether to save the document - if( nId == SID_SAVEDOC || nId == SID_SAVEASDOC ) try + // derived class may decide to abort this + if( !QuerySlotExecutable( nId ) ) { - Reference< script::vba::XCoreEventProcessor > xEventProcessor( GetModel(), UNO_QUERY_THROW ); - xEventProcessor->processCoreVbaEvent( nId ); - } - catch( util::VetoException& ) - { - // VBA event handler indicates to cancel saving the document - rReq.SetReturnValue( SfxBoolItem( 0, TRUE ) ); + rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) ); return; } - catch( Exception& ) - { - } //!! detaillierte Auswertung eines Fehlercodes SfxObjectShellRef xLock( this ); @@ -914,13 +904,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) //------------------------------------------------------------------------- -sal_Bool SfxObjectShell::IsInPrepareClose() const -{ - return pImp->bInPrepareClose; -} - -//-------------------------------------------------------------------- - void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) { DBG_CHKTHIS(SfxObjectShell, 0); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 6e1d89f2a8cd..e1b22ca26a22 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -195,6 +195,13 @@ sal_Bool SfxObjectShell::SaveAs( SfxMedium& rMedium ) //------------------------------------------------------------------------- +sal_Bool SfxObjectShell::QuerySlotExecutable( USHORT /*nSlotId*/ ) +{ + return sal_True; +} + +//------------------------------------------------------------------------- + sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd ) { const SfxPoolItem* pItem = NULL; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 6502eeaeb78c..f8b6cfe44407 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -524,6 +524,13 @@ SfxObjectShell* SfxObjectShell::Current() return pFrame ? pFrame->GetObjectShell() : 0; } +//------------------------------------------------------------------------- + +sal_Bool SfxObjectShell::IsInPrepareClose() const +{ + return pImp->bInPrepareClose; +} + //------------------------------------------------------------------------ struct BoolEnv_Impl diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index faf392c90f32..227099e7d783 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -29,7 +29,6 @@ #include "precompiled_sfx2.hxx" #include <com/sun/star/document/XDocumentProperties.hpp> -#include <com/sun/star/script/vba/XCoreEventProcessor.hpp> #include <com/sun/star/view/PrintableState.hpp> #include "com/sun/star/view/XRenderable.hpp" @@ -699,21 +698,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { SfxObjectShell* pDoc = GetObjectShell(); - // ask VBA emulation at document model whether to print the document - try + // derived class may decide to abort this + if( !pDoc->QuerySlotExecutable( nId ) ) { - uno::Reference< script::vba::XCoreEventProcessor > xEventProcessor( pDoc->GetModel(), uno::UNO_QUERY_THROW ); - xEventProcessor->processCoreVbaEvent( nId ); - } - catch( util::VetoException& ) - { - // VBA event handler indicates to cancel printing the document rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) ); return; } - catch( uno::Exception& ) - { - } bool bDetectHidden = ( !bSilent && pDoc ); if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES ) |