ooo-build r12908 - in trunk: . patches/vba
- From: pflin svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r12908 - in trunk: . patches/vba
- Date: Tue, 17 Jun 2008 09:04:12 +0000 (UTC)
Author: pflin
Date: Tue Jun 17 09:04:11 2008
New Revision: 12908
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12908&view=rev
Log:
Clean up the vba event patch
Modified:
trunk/ChangeLog
trunk/patches/vba/vba-workbook-worksheet-events-dev300.diff
Modified: trunk/patches/vba/vba-workbook-worksheet-events-dev300.diff
==============================================================================
--- trunk/patches/vba/vba-workbook-worksheet-events-dev300.diff (original)
+++ trunk/patches/vba/vba-workbook-worksheet-events-dev300.diff Tue Jun 17 09:04:11 2008
@@ -1,6 +1,6 @@
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/VbaEventId.idl 2008-06-03 14:25:19.000000000 +0800
-@@ -0,0 +1,83 @@
+--- /dev/null 2008-04-03 19:37:22.000000000 +0800
++++ offapi/com/sun/star/document/VbaEventId.idl 2008-06-16 14:27:47.000000000 +0800
+@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -43,6 +43,7 @@
+module com { module sun { module star { module document {
+//=============================================================================
+
++/* VBA compatibility event id */
+constants VbaEventId
+{
+ // Worksheet
@@ -67,8 +68,6 @@
+ const long VBAEVENT_WORKBOOK_WINDOWACTIVATE = 28;
+ const long VBAEVENT_WORKBOOK_WINDOWDEACTIVATE = 29;
+ const long VBAEVENT_WORKBOOK_WINDOWRESIZE = 30;
-+ const long VBAEVENT_WORKBOOK_WINDOWCOLSE = 31;
-+ const long VBAEVENT_WORKBOOK_CLOSE = 32;
+ // Workbook_sheet
+ const long VBAEVENT_WORKBOOK_SHEET_ACTIVATE = 51;
+ const long VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK = 52;
@@ -84,9 +83,9 @@
+}; }; }; };
+
+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/XVbaEventsHelper.idl 2008-06-03 14:25:19.000000000 +0800
-@@ -0,0 +1,54 @@
+--- /dev/null 2008-04-03 19:37:22.000000000 +0800
++++ offapi/com/sun/star/document/XVbaEventsHelper.idl 2008-06-12 10:59:31.000000000 +0800
+@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -134,15 +133,20 @@
+
+interface XVbaEventsHelper
+{
-+ // nTab -1 for workbook.
-+ boolean ProcessCompatibleVbaEvent( [in] long VbaEvent, [in] sequence< any > aArgs );
++ /**
++ Execute VBA compatible event.
++ VbaEvent: Compatible VBA event id.
++ aArgs: the array of input arguments.
++ return: True if execute successfully, or False.
++ **/
++ boolean ProcessCompatibleVbaEvent( [in] long nEventId, [in] sequence< any > aArgs );
+};
+
+}; }; }; };
+
+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/VbaEventsHelper.idl 2008-06-03 14:25:19.000000000 +0800
+--- /dev/null 2008-04-03 19:37:22.000000000 +0800
++++ offapi/com/sun/star/document/VbaEventsHelper.idl 2008-06-05 18:11:39.000000000 +0800
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
@@ -199,9 +203,9 @@
+}; }; }; };
+
+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl 2008-06-03 14:25:19.000000000 +0800
-@@ -0,0 +1,50 @@
+--- /dev/null 2008-04-03 19:37:22.000000000 +0800
++++ offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl 2008-06-09 08:28:28.000000000 +0800
+@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -244,7 +248,10 @@
+//=============================================================================
+interface XDocumentEventCompatibleHelper
+{
-+ boolean processCompatibleEvent( [in] short nStatus, [in] short nEventId );
++ /* Execute some compatible VBA event related to document, such as document save, document print.
++ nEventId: event id.
++ */
++ boolean processCompatibleEvent( [in] short nEventId );
+};
+
+//=============================================================================
@@ -252,8 +259,8 @@
+}; }; }; };
+
+#endif
---- offapi/com/sun/star/document/makefile.mk.bak 2008-06-03 14:25:12.000000000 +0800
-+++ offapi/com/sun/star/document/makefile.mk 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/offapi/com/sun/star/document/makefile.mk 2008-06-16 21:30:17.000000000 +0800
++++ offapi/com/sun/star/document/makefile.mk 2008-06-05 18:11:39.000000000 +0800
@@ -109,6 +109,10 @@ IDLFILES=\
DocumentRevisionListPersistence.idl \
XDocumentLanguages.idl \
@@ -265,9 +272,9 @@
# ------------------------------------------------------------------
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbaeventshelper.hxx 2008-06-03 14:25:19.000000000 +0800
-@@ -0,0 +1,92 @@
+--- /dev/null 2008-04-03 19:37:22.000000000 +0800
++++ sc/source/ui/vba/vbaeventshelper.hxx 2008-06-16 13:57:16.000000000 +0800
+@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -308,20 +315,16 @@
+
+#include "document.hxx"
+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/container/XNameReplace.hpp>
-+#include <com/sun/star/awt/XEnhancedMouseClickHandler.hpp>
+#include <com/sun/star/document/VbaEventId.hpp>
+#include <com/sun/star/document/XVbaEventsHelper.hpp>
+#include "vbahelper.hxx"
+
+using namespace com::sun::star;
++#define INVALID_TAB -1
+
+typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBAWorkbookEvent_BASE;
+
-+//class ScTablesHint;
+class VbaWindowListener;
-+class SfxEventHint;
-+class ImplVbaEventNameInfo;
+class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
+{
+private:
@@ -332,37 +335,30 @@
+
+ String getSheetModuleName( SCTAB nTab );
+ String workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
-+
+ uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
+ uno::Any createRange( const uno::Any& aRange );
+ uno::Any createHyperlink( const uno::Any& rCell );
+ uno::Any createWindow( SfxObjectShell* pShell );
-+ sal_Bool executeWorkBookMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet );
-+ sal_Bool processVbaEventWithCancel( const sal_Int32 nEventId );
-+ sal_Bool processDocBeforeSaveMacro( sal_Bool bSaveAsUI );
-+ void processVbaEventMacro_noreturn( const sal_Int32 nEventId );
-+ void processVbaEventMacroWithArgs( const sal_Int32 nEventId, uno::Sequence< uno::Any >& rArgs );
-+ void WorkbookWindowMacro( const sal_Int32 nHint );
-+ SCTAB getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos );
-+protected:
-+ rtl::OUString GetEventName( const sal_Int32 nId );
-+ rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab );
++ sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet );
++ SCTAB getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos = 0 );
++ rtl::OUString getEventName( const sal_Int32 nEventId );
++ rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
++ sal_Bool processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
+
+public:
+ ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mpWindowListener( NULL ), mbOpened( sal_False ){};
+ ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
+ ~ScVbaEventsHelper();
+ ScDocument* getDocument() { return pDoc; };
-+ sal_Bool executeSheetMacro( USHORT nEvent, SCTAB nTab, uno::Sequence< uno::Any >& rArgs );
+ // XVBAWorkbookEventHelper
-+ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 VbaEvent, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException);
++ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException);
+};
+
+#endif
+
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbaeventshelper.cxx 2008-06-04 10:32:41.000000000 +0800
-@@ -0,0 +1,1059 @@
+--- /dev/null 2008-04-03 19:37:22.000000000 +0800
++++ sc/source/ui/vba/vbaeventshelper.cxx 2008-06-17 13:25:46.000000000 +0800
+@@ -0,0 +1,958 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -411,7 +407,6 @@
+#include <toolkit/unohlp.hxx>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
@@ -421,10 +416,7 @@
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/awt/WindowEvent.hpp>
-+#include <com/sun/star/awt/XMouseListener.hpp>
-+#include <com/sun/star/awt/MouseEvent.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
-+#include <com/sun/star/awt/MouseButton.hpp>
+#include "cellsuno.hxx"
+
+#include <map>
@@ -440,9 +432,9 @@
+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
+const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
+
-+//typedef ::cppu::WeakImplHelper2< awt::XWindowListener, awt::XMouseListener > WindowListener_BASE;
+typedef ::cppu::WeakImplHelper1< awt::XWindowListener > WindowListener_BASE;
+
++// This class is to process Workbook window related event
+class VbaWindowListener : public WindowListener_BASE
+{
+ ScVbaEventsHelper* pVbaEventsHelper;
@@ -468,7 +460,6 @@
+{
+ m_xModel.set( pVbaEventsHelper->getDocument()->GetDocumentShell()->GetModel(), uno::UNO_QUERY );
+ m_bPrepare = sal_False;
-+ //m_pTimer = 0;
+}
+uno::Reference< awt::XWindow >
+VbaWindowListener::GetContainerWindow()
@@ -493,7 +484,7 @@
+ }
+ }
+ }
-+ catch( uno::Exception& e )
++ catch( uno::Exception& /*e*/ )
+ {
+ }
+ return uno::Reference< awt::XWindow >();
@@ -513,7 +504,6 @@
+void
+VbaWindowListener::startWindowLinstener()
+{
-+ OSL_TRACE( "VbaWindowListener::startWindowLinstener" );
+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
+ if( xWindow.is() )
+ xWindow->addWindowListener( this );
@@ -521,7 +511,6 @@
+void
+VbaWindowListener::stopWindowLinstener()
+{
-+ OSL_TRACE( "VbaWindowListener::stopWindowLinstener" );
+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
+ if( xWindow.is() )
+ {
@@ -545,7 +534,6 @@
+ delete pTimer;
+ pTimer = 0;
+ m_bPrepare = sal_False;
-+ OSL_TRACE("\tfiredMacroAtHere");
+ processWindowResizeMacro();
+ }
+ }
@@ -554,6 +542,8 @@
+void SAL_CALL
+VbaWindowListener::windowResized( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
+{
++ // Workbook_window_resize event
++
+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
+ if( pWindow && !m_bPrepare )
+ {
@@ -561,31 +551,26 @@
+ AutoTimer* pTimer = new AutoTimer();
+ pTimer->SetTimeoutHdl( LINK( this, VbaWindowListener, fireResizeMacro ) );
+ pTimer->Start();
-+ OSL_TRACE("\tVbaWindowListener::windowResized");
+ }
+}
+void SAL_CALL
+VbaWindowListener::windowMoved( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
+{
+ // not interest this time
-+ OSL_TRACE("\tVbaWindowListener::windowMoved");
+}
+void SAL_CALL
+VbaWindowListener::windowShown( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
+{
+ // not interest this time
-+ OSL_TRACE("\tVbaWindowListener::windowShown");
+}
+void SAL_CALL
+VbaWindowListener::windowHidden( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
+{
+ // not interest this time
-+ OSL_TRACE("\tVbaWindowListener::windowHidden");
+}
+void SAL_CALL
+VbaWindowListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
+{
-+ OSL_TRACE("\tVbaWindowListener::disposing");
+ pVbaEventsHelper = NULL;
+}
+
@@ -619,7 +604,10 @@
+ImplVbaEventNameInfo::~ImplVbaEventNameInfo()
+{
+ if( pImplVbaEventNameInfo )
++ {
+ delete pImplVbaEventNameInfo;
++ pImplVbaEventNameInfo = NULL;
++ }
+}
+
+ImplVbaEventNameInfo*
@@ -668,13 +656,11 @@
+ INSERT_WORKBOOK_EVENT_INFO( WINDOWACTIVATE, "WindowActivate" );
+ INSERT_WORKBOOK_EVENT_INFO( WINDOWDEACTIVATE, "WindowDeactivate" );
+ INSERT_WORKBOOK_EVENT_INFO( WINDOWRESIZE, "WindowResize" );
-+ // VBAEVENT_WORKBOOK_WINDOWCOLSE and VBAEVENT_WORKBOOK_CLOSE doesn't be used
+}
+
+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext )
+ : m_xContext( xContext ), mpWindowListener( NULL ), mbOpened( sal_False )
+{
-+ OSL_TRACE( "ScVbaEventsHelper::ScVbaEventsHelper" );
+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
+ ScDocShell* pDocShell = getDocShell( xModel );
+ pDoc = pDocShell->GetDocument();
@@ -682,7 +668,6 @@
+
+ScVbaEventsHelper::~ScVbaEventsHelper()
+{
-+ OSL_TRACE("ScVbaEventsHelper::~ScVbaEventsHelper");
+ if( mpWindowListener )
+ {
+ mpWindowListener->stopWindowLinstener();
@@ -691,7 +676,7 @@
+}
+
+rtl::OUString
-+ScVbaEventsHelper::GetEventName( const sal_Int32 nId )
++ScVbaEventsHelper::getEventName( const sal_Int32 nId )
+{
+ rtl::OUString sEventName;
+ ImplVbaEventNameInfo* pEventInfo = ImplVbaEventNameInfo::GetImplVbaEventNameInfo();
@@ -701,7 +686,7 @@
+}
+
+// Treat the args as possible inouts ( convertion at bottom of method )
-+sal_Bool ScVbaEventsHelper::executeWorkBookMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
++sal_Bool ScVbaEventsHelper::executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
+{
+ // until ObjectModules ( and persisting of codenames ) is supported, if this is a
+ // document saved from XL then we won't be able to determine the codename for the Workbook
@@ -780,16 +765,6 @@
+ return sFullName;
+}
+
-+sal_Bool ScVbaEventsHelper::processVbaEventWithCancel( const sal_Int32 nEventId )
-+{
-+ uno::Sequence< uno::Any > aArgs( 1 );
-+ sal_Bool bCancel = sal_False;
-+ aArgs[ 0 ] <<= bCancel;
-+ processVbaEventMacroWithArgs( nEventId, aArgs );
-+ aArgs[ 0 ] >>= bCancel;
-+ return bCancel;
-+}
-+
+uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
+{
+ uno::Any aRet;
@@ -885,6 +860,25 @@
+ return aRet;
+}
+
++uno::Any ScVbaEventsHelper::createWindow( SfxObjectShell* pShell )
++{
++ try
++ {
++ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
++ uno::Reference< frame::XModel > xModel( pShell->GetModel(), uno::UNO_QUERY );
++ uno::Sequence< uno::Any > aWindowArgs(2);
++ aWindowArgs[0] = uno::Any( uno::Reference< uno::XInterface > () );
++ aWindowArgs[1] = uno::Any( xModel );
++ uno::Reference< uno::XInterface > xWindow( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Window" ) ), aWindowArgs ), uno::UNO_QUERY );
++ if( xWindow.is() )
++ return uno::makeAny( xWindow );
++ }
++ catch( uno::Exception& e )
++ {
++ }
++ return uno::Any();
++}
++
+String ScVbaEventsHelper::getSheetModuleName( SCTAB nTab )
+{
+ ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
@@ -901,7 +895,7 @@
+{
+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
+ rtl::OUString sMacroPath;
-+ rtl::OUString sMacroName = GetEventName( nEventId );
++ rtl::OUString sMacroName = getEventName( nEventId );
+ switch( nEventId )
+ {
+ // Worksheet
@@ -931,8 +925,6 @@
+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE :
+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE :
+ case VBAEVENT_WORKBOOK_WINDOWRESIZE :
-+ case VBAEVENT_WORKBOOK_WINDOWCOLSE :
-+ case VBAEVENT_WORKBOOK_CLOSE :
+ // Workbook_sheet
+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
@@ -964,34 +956,39 @@
+ return sMacroPath;
+}
+
-+sal_Bool ScVbaEventsHelper::executeSheetMacro( USHORT nEvent, SCTAB nTab, uno::Sequence< uno::Any >& rArgs )
++sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs, const SCTAB nTab )
+{
+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
+
+ sal_Bool result = sal_False;
++ sal_Bool bCancel = sal_False;
+ uno::Sequence< uno::Any > aArgs;
+ uno::Any aRet;
-+
-+ rtl::OUString sMacroPath = getMacroPath( nEvent, nTab );
++
++ // For most cases, there is no corresponsible event macro in the document.
++ // It is better fo check if the event macro exists before process the arguments to improve performance.
++ rtl::OUString sMacroPath = getMacroPath( nEventId, nTab );
+ if( sMacroPath.getLength() )
+ {
-+ switch( nEvent )
++ switch( nEventId )
+ {
+ case VBAEVENT_WORKSHEET_ACTIVATE:
+ case VBAEVENT_WORKSHEET_CALCULATE:
+ case VBAEVENT_WORKSHEET_DEACTIVATE:
++ case VBAEVENT_WORKBOOK_ACTIVATE:
++ case VBAEVENT_WORKBOOK_DEACTIVATE:
++ case VBAEVENT_WORKBOOK_OPEN:
+ {
+ // no arguments
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE :
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
++ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE:
++ case VBAEVENT_WORKBOOK_SHEET_CALCULATE:
++ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE:
++ case VBAEVENT_WORKBOOK_NEWSHEET:
+ {
+ aArgs = uno::Sequence< uno::Any >(1);
+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
+ break;
+ }
+ case VBAEVENT_WORKSHEET_CHANGE:
@@ -1001,17 +998,15 @@
+ uno::Any aRange = createRange( rArgs[0] );
+ aArgs = uno::Sequence< uno::Any >(1);
+ aArgs[0] = aRange;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE :
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE :
++ case VBAEVENT_WORKBOOK_SHEET_CHANGE:
++ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE:
+ {
+ uno::Any aRange = createRange( rArgs[0] );
+ aArgs = uno::Sequence< uno::Any >(2);
+ aArgs[0] = createWorkSheet( pShell, nTab );
+ aArgs[1] = aRange;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
+ break;
+ }
+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK:
@@ -1021,22 +1016,19 @@
+ uno::Any aRange = createRange( rArgs[0] );
+ aArgs = uno::Sequence< uno::Any >(2);
+ aArgs[0] = aRange;
-+ aArgs[1] = rArgs[1];
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ // return the cancel value
-+ rArgs[1] = aArgs[1];
++ aArgs[1] <<= bCancel;
++ // TODO: process "cancel" action
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK :
++ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK:
++ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK:
+ {
+ uno::Any aRange = createRange( rArgs[0] );
+ aArgs = uno::Sequence< uno::Any >(3);
+ aArgs[0] = createWorkSheet( pShell, nTab );
+ aArgs[1] = aRange;
-+ aArgs[2] = aArgs[1];
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ rArgs[2] = aArgs[2];
++ aArgs[2] <<= bCancel;
++ // TODO: process "cancel" action
+ break;
+ }
+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK:
@@ -1045,108 +1037,64 @@
+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
+ aArgs = uno::Sequence< uno::Any >(1);
+ aArgs[0] = aHyperlink;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK :
++ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK:
+ {
+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
+ aArgs = uno::Sequence< uno::Any >(2);
+ aArgs[0] = createWorkSheet( pShell, nTab );
+ aArgs[1] = aHyperlink;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
+ break;
+ }
+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE:
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE :
++ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE:
+ {
+ // one argument: pivottable
-+ break;
++ // TODO: not support yet
++ return result;
+ }
++ case VBAEVENT_WORKBOOK_BEFORECLOSE:
++ case VBAEVENT_WORKBOOK_BEFOREPRINT:
++ {
++ // process Cancel argument
++ aArgs = uno::Sequence< uno::Any >(1);
++ aArgs[0] <<= bCancel;
++ executeMacro( pShell, sMacroPath, aArgs, aRet );
++ aArgs[0] >>= bCancel;
++ return bCancel;
++ }
++ case VBAEVENT_WORKBOOK_BEFORESAVE:
++ {
++ // two arguments: SaveAs and Cancel
++ aArgs = uno::Sequence< uno::Any >(2);
++ aArgs[0] = rArgs[0];
++ aArgs[1] <<= bCancel;
++ executeMacro( pShell, sMacroPath, aArgs, aRet );
++ aArgs[1] >>= bCancel;
++ return bCancel;
++ }
++ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
++ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
++ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
++ {
++ // one argument: windows
++ aArgs = uno::Sequence< uno::Any >(1);
++ aArgs[0] = createWindow( pShell );
++ break;
++ }
++ default:
++ return result;
+ }
++
++ // excute the macro
++ result = executeMacro( pShell, sMacroPath, aArgs, aRet );
+ }
-+
++
+ return result;
+}
+
-+uno::Any ScVbaEventsHelper::createWindow( SfxObjectShell* pShell )
-+{
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pShell->GetModel(), uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aWindowArgs(2);
-+ aWindowArgs[0] = uno::Any( uno::Reference< uno::XInterface > () );
-+ aWindowArgs[1] = uno::Any( xModel );
-+ uno::Reference< uno::XInterface > xWindow( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Window" ) ), aWindowArgs ), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ return uno::makeAny( xWindow );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return uno::Any();
-+}
-+
-+void ScVbaEventsHelper::processVbaEventMacro_noreturn( const sal_Int32 nEventId )
-+{
-+ uno::Sequence< uno::Any > aArgs;
-+ processVbaEventMacroWithArgs( nEventId, aArgs );
-+}
-+
-+void ScVbaEventsHelper::processVbaEventMacroWithArgs( const sal_Int32 nEventId, uno::Sequence< uno::Any >& rArgs )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell )
-+ return;
-+
-+ rtl::OUString sMacroPath = getMacroPath( nEventId, -1 );
-+ if( sMacroPath.getLength() )
-+ {
-+ uno::Any aRet;
-+ executeWorkBookMacro( pShell, sMacroPath, rArgs, aRet );
-+ }
-+}
-+
-+void ScVbaEventsHelper::WorkbookWindowMacro( const sal_Int32 nHint )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell )
-+ return;
-+ uno::Sequence< uno::Any > aArgs(1);
-+ uno::Any aElement = createWindow( pShell );
-+ aArgs[0] = aElement;
-+ switch( nHint )
-+ {
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
-+ // it will be called when close the doc. but should not launch the macro.
-+ processVbaEventMacroWithArgs( nHint, aArgs );
-+ break;
-+ case VBAEVENT_WORKBOOK_WINDOWCOLSE:
-+ // ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWDEACTIVATE, uno::Sequence< uno::Any >() );
-+ // does Doc be closed surely? if yes. should frie the workbook deactivate event.
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_DEACTIVATE, uno::Sequence< uno::Any >() );
-+ break;
-+ default:
-+ break;
-+ }
-+}
-+
-+sal_Bool ScVbaEventsHelper::processDocBeforeSaveMacro( sal_Bool bSaveAsUI )
-+{
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ sal_Bool bCancel = sal_False;
-+ aArgs[ 0 ] <<= bSaveAsUI;
-+ aArgs[ 1 ] <<= bCancel;
-+ processVbaEventMacroWithArgs( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ aArgs[ 1 ] >>= bCancel;
-+ return bCancel;
-+}
-+
-+SCTAB
-+ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos )
++SCTAB ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos )
+{
+ SCTAB nTab = -1;
+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( getXSomethingFromArgs< sheet::XCellRangeAddressable >( aArgs, nPos ), uno::UNO_QUERY );
@@ -1158,176 +1106,134 @@
+ return nTab;
+}
+
-+#define INVALID_TAB -1
-+
+sal_Bool SAL_CALL
-+ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 VbaEvent, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
++ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
+{
+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
+ if( !pShell )
+ return sal_False;
+
-+ sal_Int32 nTab = INVALID_TAB;
-+ uno::Sequence< uno::Any > aTmpArgs( aArgs );
-+ switch( VbaEvent )
++ // In order to better support "withevents" in the future,
++ // it is better to process a event at a time
++ SCTAB nTab = INVALID_TAB;
++ switch( nEventId )
+ {
+ // Worksheet
-+ case VBAEVENT_WORKSHEET_ACTIVATE :
++ case VBAEVENT_WORKSHEET_ACTIVATE:
+ {
-+ if( aArgs[0] >>= nTab )
++ aArgs[0] >>= nTab;
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ // recursive call related workbook sheet event.
++ // process the event
++ processVbaEvent( nEventId, aArgs, nTab );
++ // recursive process related workbook sheet event.
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_ACTIVATE, aArgs );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK :
++ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK:
+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
++ nTab = getTabFromArgs( aArgs );
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK, aArgs );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK :
++ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK:
+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
++ nTab = getTabFromArgs( aArgs );
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK, aArgs );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKSHEET_CALCULATE :
++ case VBAEVENT_WORKSHEET_CALCULATE:
+ {
-+ if( aArgs[0] >>= nTab )
++ aArgs[0] >>= nTab;
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CALCULATE, aArgs );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKSHEET_CHANGE :
++ case VBAEVENT_WORKSHEET_CHANGE:
+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
++ nTab = getTabFromArgs( aArgs );
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CHANGE, aArgs );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKSHEET_DEACTIVATE :
++ case VBAEVENT_WORKSHEET_DEACTIVATE:
+ {
-+ if( aArgs[0] >>= nTab )
++ aArgs[0] >>= nTab;
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_DEACTIVATE, aArgs );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK :
++ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK:
+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
++ nTab = getTabFromArgs( aArgs );
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK, aArgs );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE :
++ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE:
+ // TODO
+ break;
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
++ case VBAEVENT_WORKSHEET_SELECTIONCHANGE:
+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
++ nTab = getTabFromArgs( aArgs );
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE, aArgs );
+ }
+ break;
+ }
+ // Workbook_sheet
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE :
++ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE:
++ case VBAEVENT_WORKBOOK_SHEET_CALCULATE:
++ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE:
+ {
-+ if( aArgs[0] >>= nTab )
++ aArgs[0] >>= nTab;
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE :
++ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK:
++ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK:
++ case VBAEVENT_WORKBOOK_SHEET_CHANGE:
++ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK:
++ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE:
+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
++ nTab = getTabFromArgs( aArgs );
++ if( nTab != INVALID_TAB )
+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE :
++ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE:
+ // TODO
+ break;
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
+ // Workbook
-+ case VBAEVENT_WORKBOOK_ACTIVATE :
++ case VBAEVENT_WORKBOOK_ACTIVATE:
+ {
+ // if workbook open event do not be fired. fired it before
+ // workbook activate event to compatible with MSO.
@@ -1335,26 +1241,26 @@
+ {
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_OPEN, aArgs );
+ }
-+ processVbaEventMacro_noreturn( VBAEVENT_WORKBOOK_ACTIVATE );
-+ // workbook window activate event same as this one
++ // process workbook activate event
++ processVbaEvent( nEventId, aArgs );
++ // process workbook window activate event at the same time
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWACTIVATE, aArgs );
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_DEACTIVATE :
++ case VBAEVENT_WORKBOOK_DEACTIVATE:
+ {
-+ processVbaEventMacro_noreturn( VBAEVENT_WORKBOOK_DEACTIVATE );
++ processVbaEvent( nEventId, aArgs );
+ // same as workbook window deactivate
+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWDEACTIVATE, aArgs );
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_OPEN :
++ case VBAEVENT_WORKBOOK_OPEN:
+ {
+ // process workbook open macro
+ // does auto open work here?
-+ //WorkbookAutoOpen();
+ if( !mbOpened )
+ {
-+ processVbaEventMacro_noreturn( VBAEVENT_WORKBOOK_OPEN );
++ processVbaEvent( nEventId, aArgs );
+ mbOpened = sal_True;
+ }
+ // register the window listener.
@@ -1365,11 +1271,12 @@
+ }
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_AUTOOPEN :
++ case VBAEVENT_WORKBOOK_AUTOOPEN:
++ // TODO
+ break;
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE :
++ case VBAEVENT_WORKBOOK_BEFORECLOSE:
+ {
-+ sal_Bool bCancel = processVbaEventWithCancel( VbaEvent );
++ sal_Bool bCancel = processVbaEvent( nEventId, aArgs );
+ if( mpWindowListener && !bCancel )
+ {
+ mpWindowListener->stopWindowLinstener();
@@ -1377,35 +1284,23 @@
+ }
+ return bCancel;
+ }
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT :
++ case VBAEVENT_WORKBOOK_BEFOREPRINT:
++ case VBAEVENT_WORKBOOK_BEFORESAVE:
++ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
++ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
++ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
+ {
-+ return processVbaEventWithCancel( VbaEvent );
++ return processVbaEvent( nEventId, aArgs );
+ }
-+ case VBAEVENT_WORKBOOK_BEFORESAVE :
++ case VBAEVENT_WORKBOOK_NEWSHEET:
+ {
-+ sal_Bool bUISave = sal_Bool();
-+ if( aArgs.getLength() && ( aArgs[0] >>= bUISave ) )
-+ return processDocBeforeSaveMacro( bUISave );
-+ }
-+ case VBAEVENT_WORKBOOK_NEWSHEET :
-+ {
-+ SCTAB nTabNum;
-+ if( aArgs.getLength() && ( aArgs[0] >>= nTabNum ) )
++ aArgs[0] >>= nTab;
++ if( nTab != INVALID_TAB )
+ {
-+ uno::Sequence< uno::Any > rArgs(1);
-+ rArgs[0] = createWorkSheet( pShell, nTabNum );
-+ processVbaEventMacroWithArgs( VBAEVENT_WORKBOOK_NEWSHEET, rArgs );
++ processVbaEvent( nEventId, aArgs, nTab );
+ }
+ break;
+ }
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE :
-+ case VBAEVENT_WORKBOOK_WINDOWCOLSE :
-+ WorkbookWindowMacro( VbaEvent );
-+ break;
-+ case VBAEVENT_WORKBOOK_CLOSE :
-+ break;
+ default:
+ OSL_TRACE( "Invalid Event" );
+ }
@@ -1422,25 +1317,9 @@
+ "ScVbaEventsHelper",
+ "com.sun.star.document.VbaEventsHelper" );
+}
---- sc/inc/document.hxx.orig 2008-06-03 14:24:49.000000000 +0800
-+++ sc/inc/document.hxx 2008-06-03 14:25:19.000000000 +0800
-@@ -42,6 +42,7 @@
- #include "brdcst.hxx"
- #include "tabopparams.hxx"
- #include "grammar.hxx"
-+//#include <org/openoffice/vba/XVBAWorkbookEventHelper.hpp>
-
- #include <memory>
- #include <map>
-@@ -134,6 +135,7 @@ class ScAutoNameCache;
- class ScTemporaryChartLock;
- class ScLookupCache;
- struct ScLookupCacheMapImpl;
-+//class ScVbaEventsHelper;
-
- namespace com { namespace sun { namespace star {
- namespace lang {
-@@ -151,6 +153,9 @@ namespace com { namespace sun { namespac
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/inc/document.hxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/inc/document.hxx 2008-06-16 14:34:49.000000000 +0800
+@@ -151,6 +151,9 @@ namespace com { namespace sun { namespac
}
} } }
@@ -1450,17 +1329,16 @@
#include <svtools/zforlist.hxx>
/*
#ifdef _ZFORLIST_DECLARE_TABLE
-@@ -309,6 +314,9 @@ private:
+@@ -309,6 +312,8 @@ private:
Timer aTrackTimer;
-+ //ScVbaEventsHelper* pVbaEventsHelper;
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > rVbaEventsHelper;
++ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
+
public:
ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
ScInterpreterTableOpParams aLastTableOpParams; // remember last params
-@@ -1722,6 +1730,8 @@ public:
+@@ -1722,6 +1727,8 @@ public:
void GetSortParam( ScSortParam& rParam, SCTAB nTab );
void SetSortParam( ScSortParam& rParam, SCTAB nTab );
@@ -1469,8 +1347,8 @@
/** Should only be GRAM_PODF or GRAM_ODFF. */
void SetStorageGrammar( ScGrammar::Grammar eGrammar );
ScGrammar::Grammar GetStorageGrammar() const
---- sc/source/core/data/documen2.cxx.orig 2008-06-03 14:24:49.000000000 +0800
-+++ sc/source/core/data/documen2.cxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/core/data/documen2.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/core/data/documen2.cxx 2008-06-16 14:35:26.000000000 +0800
@@ -93,6 +93,7 @@
#include "listenercalls.hxx"
#include "recursionhelper.hxx"
@@ -1479,28 +1357,7 @@
// pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
// dtor is convenient.
-@@ -147,6 +148,7 @@ ScDocument::ScDocument( ScDocumentMode e
- pRecursionHelper( NULL ),
- pAutoNameCache( NULL ),
- pLookupCacheMapImpl( NULL ),
-+ //rVbaEventsHelper( NULL ),
- nUnoObjectId( 0 ),
- nRangeOverflowType( 0 ),
- aCurTextWidthCalcPos(MAXCOL,0,0),
-@@ -434,6 +436,12 @@ ScDocument::~ScDocument()
- delete pOtherObjects;
- delete pRecursionHelper;
-
-+ /*if( rVbaEventsHelper )
-+ {
-+ delete pVbaEventsHelper;
-+ pVbaEventsHelper = NULL;
-+ }*/
-+
- DBG_ASSERT( !pAutoNameCache, "AutoNameCache still set in dtor" );
- }
-
-@@ -1863,3 +1871,26 @@ void ScDocument::RemoveLookupCache( ScLo
+@@ -1863,3 +1864,26 @@ void ScDocument::RemoveLookupCache( ScLo
EndListeningArea( pCache->getRange(), &rCache);
}
}
@@ -1509,7 +1366,7 @@
+uno::Reference< document::XVbaEventsHelper >
+ScDocument::GetVbaEventsHelper()
+{
-+ if( !rVbaEventsHelper.is() )
++ if( !mxVbaEventsHelper.is() )
+ {
+ try
+ {
@@ -1519,16 +1376,16 @@
+ aArgs[0] = uno::Any( xModel );
+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.VbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
+ // helper will always be created successfully.
-+ rVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
++ mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
+ }
+ catch( uno::Exception& e )
+ {
+ }
+ }
-+ return rVbaEventsHelper;
++ return mxVbaEventsHelper;
+}
---- sc/source/core/data/documen7.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/source/core/data/documen7.cxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/core/data/documen7.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/core/data/documen7.cxx 2008-06-05 18:11:39.000000000 +0800
@@ -59,7 +59,15 @@
@@ -1585,8 +1442,8 @@
}
DBG_ASSERT( nFormulaTrackCount==0, "TrackFormulas: nFormulaTrackCount!=0" );
}
---- sc/source/ui/docshell/docsh.cxx.orig 2008-06-03 14:24:49.000000000 +0800
-+++ sc/source/ui/docshell/docsh.cxx 2008-06-04 10:42:22.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/docshell/docsh.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/docshell/docsh.cxx 2008-06-16 17:15:54.000000000 +0800
@@ -126,6 +126,13 @@
#include <rtl/logfile.hxx>
@@ -1601,7 +1458,7 @@
using namespace com::sun::star;
-@@ -714,9 +721,70 @@ BOOL __EXPORT ScDocShell::Load( SfxMediu
+@@ -714,9 +721,71 @@ BOOL __EXPORT ScDocShell::Load( SfxMediu
return bRet;
}
@@ -1635,7 +1492,7 @@
+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_DEACTIVATE, aArgs );
+ }
+ break;
-+ case SFX_EVENT_CLOSEDOC :
++ /*case SFX_EVENT_CLOSEDOC :
+ {
+ uno::Sequence< uno::Any > aArgs;
+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_CLOSE, aArgs );
@@ -1647,6 +1504,7 @@
+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWCOLSE, aArgs );
+ }
+ break;
++ */
+ case SFX_EVENT_OPENDOC:
+ {
+ // some later than workbook activate.
@@ -1672,7 +1530,7 @@
if (rHint.ISA(SfxSimpleHint)) // ohne Parameter
{
ULONG nSlot = ((const SfxSimpleHint&)rHint).GetId();
-@@ -2276,6 +2344,16 @@ USHORT __EXPORT ScDocShell::PrepareClose
+@@ -2276,6 +2345,16 @@ USHORT __EXPORT ScDocShell::PrepareClose
DoEnterHandler();
@@ -1689,14 +1547,12 @@
USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
if (nRet == TRUE) // TRUE = schliessen
aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
-@@ -2485,6 +2563,43 @@ void ScDocShell::SetModified( BOOL bModi
+@@ -2485,6 +2564,34 @@ void ScDocShell::SetModified( BOOL bModi
}
}
+void ScDocShell::PostContentChanged( const ScRange& rRange )
+{
-+// OSL_TRACE("ScDocShell::PostContentChanged. Changed Range Address: nTab1 = %d, nCol1 = %d, nRow1 = %d; nTab2 = %d, nCol2 = %d, nRow2 = %d;", rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Tab(), rRange.aEnd.Col(), rRange.aEnd.Row() );
-+
+ ScRangeList aList;
+ aList.Append(rRange);
+ PostContentChanged(aList);
@@ -1704,13 +1560,6 @@
+
+void ScDocShell::PostContentChanged( const ScRangeList& rList )
+{
-+#if 0
-+ String aStr;
-+ rList.Format(aStr, SCR_ABS, &aDocument, ScAddress::CONV_XL_A1);
-+ fprintf(stdout, "ScDocShell::PostContentChanged: range = '%s'\n",
-+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
-+#endif
-+
+ ScCellRangesBase* pObj = NULL;
+ const ScRange& rRange = *(rList.GetObject(0));
+ if( rList.Count() == 1 )
@@ -1733,8 +1582,8 @@
void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
{
---- sc/source/ui/inc/docsh.hxx.orig 2008-06-03 14:24:49.000000000 +0800
-+++ sc/source/ui/inc/docsh.hxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/inc/docsh.hxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/inc/docsh.hxx 2008-06-05 18:11:39.000000000 +0800
@@ -47,6 +47,7 @@
#include "refreshtimer.hxx"
@@ -1752,8 +1601,8 @@
void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
---- sc/source/ui/undo/undoblk3.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/source/ui/undo/undoblk3.cxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/undo/undoblk3.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/undo/undoblk3.cxx 2008-06-05 18:11:39.000000000 +0800
@@ -79,7 +79,17 @@ TYPEINIT1(ScUndoInsertAreaLink, SfxUndo
TYPEINIT1(ScUndoRemoveAreaLink, SfxUndoAction);
TYPEINIT1(ScUndoUpdateAreaLink, SfxUndoAction);
@@ -1798,8 +1647,21 @@
}
---- sc/source/ui/undo/undoblk.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/source/ui/undo/undoblk.cxx 2008-06-03 14:25:19.000000000 +0800
+@@ -845,10 +859,10 @@ void ScUndoMerge::DoChange( const BOOL b
+ {
+ pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aStart.Tab(),
+- SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
++ SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER ) );
+ pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aStart.Tab(),
+- SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
++ SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER ) );
+ }
+ }
+
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/undo/undoblk.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/undo/undoblk.cxx 2008-06-05 18:11:39.000000000 +0800
@@ -125,6 +125,7 @@ ScUndoInsertCells::ScUndoInsertCells( Sc
}
@@ -1896,8 +1758,8 @@
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
}
---- sc/source/ui/undo/undocell.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/source/ui/undo/undocell.cxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/undo/undocell.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/undo/undocell.cxx 2008-06-05 18:11:39.000000000 +0800
@@ -214,6 +214,7 @@ ScUndoEnterData::ScUndoEnterData( ScDocS
nCount( nNewCount )
{
@@ -1970,8 +1832,8 @@
}
void __EXPORT ScUndoPutCell::Repeat(SfxRepeatTarget& /* rTarget */)
---- sc/source/ui/unoobj/viewuno.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/source/ui/unoobj/viewuno.cxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/unoobj/viewuno.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/unoobj/viewuno.cxx 2008-06-16 21:21:54.000000000 +0800
@@ -71,8 +71,12 @@
#include "gridwin.hxx"
#include <com/sun/star/view/DocumentZoomType.hpp>
@@ -1985,136 +1847,112 @@
//------------------------------------------------------------------------
-@@ -480,7 +484,6 @@ ScTabViewObj::ScTabViewObj( ScTabViewShe
- aActivationListeners( 0 ),
- bDrawSelModeSet(sal_False)
- {
-- //! Listening oder so
+@@ -458,6 +462,78 @@ void SAL_CALL ScViewPaneObj::release() t
+ OWeakObject::release();
}
- ScTabViewObj::~ScTabViewObj()
-@@ -1206,36 +1209,67 @@ sal_Bool ScTabViewObj::MousePressed( con
- {
- sal_Bool bReturn(sal_False);
-
-- if (aMouseClickHandlers.Count())
-- {
-- uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
-+ uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
-
-- if (xTarget.is())
-- {
-- awt::EnhancedMouseEvent aMouseEvent;
-+ if (xTarget.is())
-+ {
-+ // Handle BeforeDoubleClick and BeforeRightClick events
-+ uno::Reference<table::XCell> xCell( xTarget, uno::UNO_QUERY );
-+ if( xCell.is() )
-+ {
-+ ScTabViewShell* pViewSh = GetViewShell();
-+ if ( pViewSh )
-+ {
-+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if ( pViewData )
-+ {
-+ if( e.ClickCount == 2 || e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(2);
-+ sal_Bool bCancel = sal_False;
-+ aArgs[0] = getSelection();
-+ aArgs[1] <<= bCancel;
-+
-+ USHORT nEvent = VBAEVENT_WORKSHEET_BEFORERIGHTCLICK;
-+ if( e.ClickCount == 2 )
-+ nEvent = VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( nEvent, aArgs );
++// To process sheet compatibile event
++typedef ::cppu::WeakImplHelper2< awt::XEnhancedMouseClickHandler, view::XSelectionChangeListener > TabViewEventListener_BASE;
++class ScTabViewEventListener: public TabViewEventListener_BASE
++{
++private:
++ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper;
++ ScTabViewObj* pViewObj;
++
++public:
++ ScTabViewEventListener( ScTabViewObj* pObj, uno::Reference< document::XVbaEventsHelper >& rVbaEventsHelper);
++ ~ScTabViewEventListener();
++ // XEnhancedMouseClickHandler
++ virtual sal_Bool SAL_CALL mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
++ virtual sal_Bool SAL_CALL mouseReleased( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
++
++ // XSelectionChangeListener
++ virtual void SAL_CALL selectionChanged( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
++ // XEventListener
++ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
++};
+
-+ // TODO... handle the cancel argument
-+ aArgs[1] >>= bCancel;
-+ }
-+ }
-+ }
-+ }
++ScTabViewEventListener::ScTabViewEventListener(ScTabViewObj* pObj, uno::Reference< document::XVbaEventsHelper >& rVbaEventsHelper):
++ pViewObj( pObj ),xVbaEventsHelper( rVbaEventsHelper )
++{
++}
++
++ScTabViewEventListener::~ScTabViewEventListener()
++{
++}
++
++void SAL_CALL ScTabViewEventListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
++{
++}
++
++sal_Bool SAL_CALL ScTabViewEventListener::mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException)
++{
++ sal_Bool result = sal_False;
++ // process BeforeDoubleClick and BeforeRightClick events
++ if( e.ClickCount == 2 || e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT )
++ {
++ // ensure the target is a cell
++ uno::Reference< table::XCell > xCell( e.Target, uno::UNO_QUERY );
++ if( xCell.is() && xVbaEventsHelper.is() && pViewObj)
++ {
++ uno::Sequence< uno::Any > aArgs(1);
++ aArgs[0] = pViewObj->getSelection();
++ sal_Int32 nEventId = VBAEVENT_WORKSHEET_BEFORERIGHTCLICK;
++ if( e.ClickCount == 2 )
++ nEventId = VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK;
++
++ result = xVbaEventsHelper->ProcessCompatibleVbaEvent( nEventId, aArgs );
++ // TODO: process Cancel argument
+ }
-+
-+ awt::EnhancedMouseEvent aMouseEvent;
-
-- aMouseEvent.Buttons = e.Buttons;
-- aMouseEvent.X = e.X;
-- aMouseEvent.Y = e.Y;
-- aMouseEvent.ClickCount = e.ClickCount;
-- aMouseEvent.PopupTrigger = e.PopupTrigger;
-- aMouseEvent.Target = xTarget;
-+ aMouseEvent.Buttons = e.Buttons;
-+ aMouseEvent.X = e.X;
-+ aMouseEvent.Y = e.Y;
-+ aMouseEvent.ClickCount = e.ClickCount;
-+ aMouseEvent.PopupTrigger = e.PopupTrigger;
-+ aMouseEvent.Target = xTarget;
-
-- for ( USHORT n=0; n<aMouseClickHandlers.Count(); n++ )
-+ for ( USHORT n=0; n<aMouseClickHandlers.Count(); n++ )
-+ {
-+ try
- {
-- try
-- {
-- if (!(*aMouseClickHandlers[n])->mousePressed( aMouseEvent ))
-- bReturn = sal_True;
-- }
-- catch ( uno::Exception& )
-- {
-- aMouseClickHandlers.DeleteAndDestroy(n);
-- --n; // because it will be increased again in the loop
-- }
-+ if (!(*aMouseClickHandlers[n])->mousePressed( aMouseEvent ))
-+ bReturn = sal_True;
-+ }
-+ catch ( uno::Exception& )
-+ {
-+ aMouseClickHandlers.DeleteAndDestroy(n);
-+ --n; // because it will be increased again in the loop
- }
- }
- }
++ }
++ return result;
++}
+
- return bReturn;
- }
-
-@@ -1709,6 +1743,22 @@ void SAL_CALL ScTabViewObj::removeSelect
++sal_Bool SAL_CALL ScTabViewEventListener::mouseReleased( const awt::EnhancedMouseEvent&/*e*/) throw (uno::RuntimeException)
++{
++ return sal_False;
++}
++
++void SAL_CALL ScTabViewEventListener::selectionChanged( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
++{
++ if ( xVbaEventsHelper.is() && pViewObj)
++ {
++ uno::Sequence< uno::Any > aArgs(1);
++ aArgs[0] = pViewObj->getSelection();
++ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_SELECTIONCHANGE, aArgs );
++ }
++}
++
+ //------------------------------------------------------------------------
- void ScTabViewObj::SelectionChanged()
+ // Default-ctor wird fuer SMART_REFLECTION_IMPLEMENTATION gebraucht
+@@ -480,7 +556,19 @@ ScTabViewObj::ScTabViewObj( ScTabViewShe
+ aActivationListeners( 0 ),
+ bDrawSelModeSet(sal_False)
{
-+ ScTabViewShell* pViewSh = GetViewShell();
-+ if ( pViewSh )
+- //! Listening oder so
++ if( pViewSh )
+ {
+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if ( pViewData )
++ if( pViewData )
+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = getSelection();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_SELECTIONCHANGE, aArgs );
-+ }
++ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper (pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
++ ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
++ uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
++ addEnhancedMouseClickHandler( aMouseClickHandler );
++ uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
++ addSelectionChangeListener( aSelectionChangeListener );
+ }
+ }
-+
- lang::EventObject aEvent;
- aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
- for ( USHORT n=0; n<aSelectionListeners.Count(); n++ )
---- sc/source/ui/unoobj/docuno.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/source/ui/unoobj/docuno.cxx 2008-06-03 16:01:07.000000000 +0800
-@@ -92,7 +92,12 @@
+ }
+
+ ScTabViewObj::~ScTabViewObj()
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/unoobj/docuno.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/unoobj/docuno.cxx 2008-06-16 15:09:05.000000000 +0800
+@@ -92,7 +92,10 @@
#include "rangeutl.hxx"
#include "ViewSettingsSequenceDefines.hxx"
-+#define BEFORE 0
-+#define AFTER 1
+#include <com/sun/star/document/XVbaEventsHelper.hpp>
+#include <com/sun/star/document/VbaEventId.hpp>
using namespace com::sun::star;
@@ -2122,7 +1960,7 @@
//------------------------------------------------------------------------
-@@ -329,6 +334,7 @@ uno::Any SAL_CALL ScModelObj::queryInter
+@@ -329,6 +332,7 @@ uno::Any SAL_CALL ScModelObj::queryInter
SC_QUERYINTERFACE( document::XLinkTargetSupplier )
SC_QUERYINTERFACE( beans::XPropertySet )
SC_QUERYINTERFACE( document::XCodeNameQuery )
@@ -2130,17 +1968,16 @@
SC_QUERYINTERFACE( lang::XMultiServiceFactory )
SC_QUERYINTERFACE( lang::XServiceInfo )
-@@ -1730,6 +1736,52 @@ ScModelObj::getCodeNameForObject( const
+@@ -1730,6 +1734,39 @@ ScModelObj::getCodeNameForObject( const
// Probably should throw here ( if !bMatched )
return sCodeName;
}
+// XVbaEventHelper
+// For Vba Event
-+// status, 0 before, 1 done...
+sal_Bool SAL_CALL
-+ScModelObj::processCompatibleEvent( sal_Int16 nStatus, sal_Int16 nSlotId ) throw( ::com::sun::star::uno::RuntimeException )
++ScModelObj::processCompatibleEvent( sal_Int16 nSlotId ) throw( ::com::sun::star::uno::RuntimeException )
+{
-+ USHORT nId = nSlotId;
++ USHORT nId = (USHORT)nSlotId;
+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
+ if( xVbaEventsHelper.is() )
+ {
@@ -2148,33 +1985,21 @@
+ {
+ case SID_SAVEDOC:
+ {
-+ if( nStatus == BEFORE )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_False;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ break;
++ uno::Sequence< uno::Any > aArgs(1);
++ aArgs[0] <<= sal_False;
++ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
+ }
+ case SID_SAVEASDOC:
+ {
-+ if( nStatus == BEFORE )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_True;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ break;
++ uno::Sequence< uno::Any > aArgs(1);
++ aArgs[0] <<= sal_True;
++ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
+ }
+ case SID_PRINTDOC:
+ case SID_PRINTDOCDIRECT:
+ {
-+ if( nStatus == BEFORE )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFOREPRINT, aArgs );
-+ }
-+ break;
++ uno::Sequence< uno::Any > aArgs;
++ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFOREPRINT, aArgs );
+ }
+ }
+ }
@@ -2183,8 +2008,8 @@
// XServiceInfo
rtl::OUString SAL_CALL ScModelObj::getImplementationName() throw(uno::RuntimeException)
---- sc/inc/docuno.hxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/inc/docuno.hxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/inc/docuno.hxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/inc/docuno.hxx 2008-06-16 15:08:17.000000000 +0800
@@ -55,6 +55,7 @@
#include <com/sun/star/sheet/XSheetAnnotations.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -2206,12 +2031,12 @@
virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
throw(::com::sun::star::uno::RuntimeException);
+ // XVbaEventHelper
-+ virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nStatus, sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
++ virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
};
---- sc/source/ui/view/gridwin.cxx.orig 2008-06-03 14:24:49.000000000 +0800
-+++ sc/source/ui/view/gridwin.cxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/view/gridwin.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/view/gridwin.cxx 2008-06-16 17:37:15.000000000 +0800
@@ -150,7 +150,13 @@
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <vcl/svapp.hxx>
@@ -2294,14 +2119,7 @@
return;
}
}
-@@ -2442,13 +2495,13 @@ long ScGridWindow::PreNotify( NotifyEven
- if (xController.is())
- {
- ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
-- if (pImp && pImp->IsMouseListening())
-+ if (pImp)
- {
- ::com::sun::star::awt::MouseEvent aEvent;
+@@ -2448,7 +2501,7 @@ long ScGridWindow::PreNotify( NotifyEven
lcl_InitMouseEvent( aEvent, *rNEvt.GetMouseEvent() );
if ( rNEvt.GetWindow() )
aEvent.Source = rNEvt.GetWindow()->GetComponentInterface();
@@ -2340,8 +2158,8 @@
ScHideTextCursor aHideCursor( pViewData, eWhich ); // before GetEditArea (MapMode is changed)
---- sc/source/ui/view/tabview3.cxx.orig 2008-06-03 14:24:49.000000000 +0800
-+++ sc/source/ui/view/tabview3.cxx 2008-06-03 14:25:19.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/view/tabview3.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/view/tabview3.cxx 2008-06-05 18:11:39.000000000 +0800
@@ -82,6 +82,10 @@
#include "client.hxx"
@@ -2391,16 +2209,47 @@
TabChanged(); // DrawView
aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
if ( !bUnoRefDialog )
---- sc/source/ui/vba/makefile.mk.orig 2008-06-03 14:24:59.000000000 +0800
-+++ sc/source/ui/vba/makefile.mk 2008-06-03 14:25:28.000000000 +0800
-@@ -122,6 +122,7 @@ SLOFILES= \
- $(SLO)$/vbamultipage.obj \
- $(SLO)$/vbapages.obj \
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/vba/makefile.mk 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/vba/makefile.mk 2008-06-05 18:11:39.000000000 +0800
+@@ -128,6 +128,7 @@ SLOFILES= \
+ $(SLO)$/vbahyperlink.obj \
+ $(SLO)$/vbapagesetup.obj \
$(SLO)$/service.obj \
+ $(SLO)$/vbaeventshelper.obj \
# --- Targets ------------------------------------------------------
+--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/vba/service.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sc/source/ui/vba/service.cxx 2008-06-05 18:11:39.000000000 +0800
+@@ -69,6 +69,10 @@ namespace hyperlink
+ {
+ extern sdecl::ServiceDecl const serviceDecl;
+ }
++namespace vbaeventshelper
++{
++extern sdecl::ServiceDecl const serviceDecl;
++}
+
+
+ extern "C"
+@@ -87,7 +91,7 @@ extern "C"
+
+ // Component registration
+ if ( component_writeInfoHelper( pServiceManager, pRegistryKey,
+- range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) )
++ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
+ {
+ // Singleton registration
+ try
+@@ -116,6 +120,8 @@ extern "C"
+ OSL_TRACE("In component_getFactory for %s", pImplName );
+ void* pRet = component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl );
++ if( !pRet )
++ pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl );
+ OSL_TRACE("Ret is 0x%x", pRet);
+ return pRet;
+ }
--- sfx2/inc/sfx2/objsh.hxx.orig 2008-06-04 11:30:47.000000000 +0800
+++ sfx2/inc/sfx2/objsh.hxx 2008-06-04 10:41:41.000000000 +0800
@@ -304,6 +304,7 @@ public:
@@ -2463,18 +2312,9 @@
}
//-------------------------------------------------------------------------
---- sfx2/source/doc/objserv.cxx.orig 2008-06-03 14:24:49.000000000 +0800
-+++ sfx2/source/doc/objserv.cxx 2008-06-03 14:25:19.000000000 +0800
-@@ -28,6 +28,8 @@
- *
- ************************************************************************/
-
-+#define BEFORE 0
-+#define AFTER 1
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sfx2.hxx"
-
-@@ -109,6 +111,7 @@
+--- /home/feng/work/ooo-build/build/dev300-m14/sfx2/source/doc/objserv.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sfx2/source/doc/objserv.cxx 2008-06-16 15:11:04.000000000 +0800
+@@ -109,6 +109,7 @@
#include <com/sun/star/document/XDocumentInfo.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -2482,7 +2322,7 @@
#ifndef _SFX_HELPID_HRC
#include "helpid.hrc"
-@@ -522,6 +525,18 @@ void SfxObjectShell::ExecFile_Impl(SfxRe
+@@ -522,6 +523,18 @@ void SfxObjectShell::ExecFile_Impl(SfxRe
case SID_SAVEASDOC:
case SID_SAVEDOC:
{
@@ -2491,7 +2331,7 @@
+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( GetModel(), uno::UNO_QUERY );
+ if( xVbaEventHelper.is() )
+ {
-+ if( xVbaEventHelper->processCompatibleEvent( BEFORE, nId ) )
++ if( xVbaEventHelper->processCompatibleEvent( nId ) )
+ {
+ rReq.SetReturnValue( SfxBoolItem( 0, sal_True ) );
+ return;
@@ -2501,14 +2341,9 @@
//!! detaillierte Auswertung eines Fehlercodes
SfxObjectShellRef xLock( this );
---- sfx2/source/view/viewprn.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sfx2/source/view/viewprn.cxx 2008-06-03 14:25:19.000000000 +0800
-@@ -28,10 +28,12 @@
- *
- ************************************************************************/
-
-+#define BEFORE 0
- // MARKER(update_precomp.py): autogen include statement, do not remove
+--- /home/feng/work/ooo-build/build/dev300-m14/sfx2/source/view/viewprn.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sfx2/source/view/viewprn.cxx 2008-06-16 15:12:05.000000000 +0800
+@@ -32,6 +32,7 @@
#include "precompiled_sfx2.hxx"
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -2516,7 +2351,7 @@
#include <com/sun/star/view/PrintableState.hpp>
#include <svtools/itempool.hxx>
#ifndef _MSGBOX_HXX //autogen
-@@ -67,6 +69,8 @@
+@@ -67,6 +68,8 @@
#include "view.hrc"
#include "helpid.hrc"
@@ -2525,7 +2360,7 @@
TYPEINIT1(SfxPrintingHint, SfxHint);
// -----------------------------------------------------------------------
-@@ -405,6 +409,22 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
+@@ -405,6 +408,22 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
case SID_SETUPPRINTER:
case SID_PRINTER_NAME :
{
@@ -2537,7 +2372,7 @@
+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
+ if( xVbaEventHelper.is() )
+ {
-+ if( xVbaEventHelper->processCompatibleEvent( BEFORE, nId ) )
++ if( xVbaEventHelper->processCompatibleEvent( nId ) )
+ {
+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
+ return;
@@ -2548,14 +2383,14 @@
// quiet mode (AppEvent, API call)
SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE);
bSilent = pSilentItem && pSilentItem->GetValue();
-@@ -714,6 +734,15 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
+@@ -714,6 +733,15 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
if ( SID_PRINTDOCDIRECT == nId )
{
SfxObjectShell* pDoc = GetObjectShell();
+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
+ if( xVbaEventHelper.is() )
+ {
-+ if( xVbaEventHelper->processCompatibleEvent( BEFORE, nId ) )
++ if( xVbaEventHelper->processCompatibleEvent( nId ) )
+ {
+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
+ return;
@@ -2564,8 +2399,8 @@
bool bDetectHidden = ( !bSilent && pDoc );
if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
return;
---- sfx2/source/doc/objxtor.cxx.orig 2008-06-03 18:53:27.000000000 +0800
-+++ sfx2/source/doc/objxtor.cxx 2008-06-04 10:41:41.000000000 +0800
+--- /home/feng/work/ooo-build/build/dev300-m14/sfx2/source/doc/objxtor.cxx 2008-06-16 21:30:17.000000000 +0800
++++ sfx2/source/doc/objxtor.cxx 2008-06-05 18:11:40.000000000 +0800
@@ -594,6 +594,13 @@ SfxObjectShell* SfxObjectShell::Current(
return pFrame ? pFrame->GetObjectShell() : 0;
}
@@ -2580,34 +2415,3 @@
//------------------------------------------------------------------------
struct BoolEnv_Impl
---- sc/source/ui/vba/service.cxx.orig 2008-06-03 14:25:12.000000000 +0800
-+++ sc/source/ui/vba/service.cxx 2008-06-03 14:25:19.000000000 +0800
-@@ -69,6 +69,10 @@ namespace hyperlink
- {
- extern sdecl::ServiceDecl const serviceDecl;
- }
-+namespace vbaeventshelper
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-
-
- extern "C"
-@@ -87,7 +91,7 @@ extern "C"
-
- // Component registration
- if ( component_writeInfoHelper( pServiceManager, pRegistryKey,
-- range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) )
-+ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
- {
- // Singleton registration
- try
-@@ -116,6 +120,8 @@ extern "C"
- OSL_TRACE("In component_getFactory for %s", pImplName );
- void* pRet = component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl );
-+ if( !pRet )
-+ pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]