[ooo-build-commit] .: patches/dev300 patches/vba

Noel Power noelp at kemper.freedesktop.org
Tue Aug 31 10:22:20 PDT 2010


 patches/dev300/apply                        |    7 
 patches/vba/vba-misc-tweakupstream.diff     |   52 +++++
 patches/vba/vba-msvbahelper-splitbuilt.diff |  268 ++++++++--------------------
 3 files changed, 138 insertions(+), 189 deletions(-)

New commits:
commit b9906a9b6e68c76ed65eed566ae570aff184daea
Author: Noel Power <noel.power at novell.com>
Date:   Tue Aug 31 18:21:48 2010 +0100

    fix up m4 for split build

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 42b0b7c..0fcafef 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1530,17 +1530,18 @@ vba-oox-olenameoverride.diff, n#359933, n#403974
 fix-name-range-separator.diff, n#597351
 # remove dependency of vbahelper on oox ( added by container_controls.diff )
 vbahelper-no-oox.diff
-# misc changes to modify strange upstream changes
-vba-misc-tweakupstream-m2.diff
 
 [ VBAObjects <= ooo330-m2 ]
+# misc changes to modify strange upstream changes
+vba-misc-tweakupstream-m2.diff
 # unoize msvbahelper to solve some dependency issues for split build
 vba-msvbahelper-splitbuilt-m2.diff
 [ VBAObjects > ooo330-m3 ]
+vba-misc-tweakupstream.diff
 # unoize msvbahelper to solve some dependency issues for split build
 # FIXME disabled for m3f
 # FIXME cause build problems with m4; some stuff is missing
-#vba-msvbahelper-splitbuilt.diff
+vba-msvbahelper-splitbuilt.diff
 
 [VBAObjects]
 # fix upstream introduced Application::Intersection problem
diff --git a/patches/vba/vba-misc-tweakupstream.diff b/patches/vba/vba-misc-tweakupstream.diff
new file mode 100644
index 0000000..3b325b2
--- /dev/null
+++ b/patches/vba/vba-misc-tweakupstream.diff
@@ -0,0 +1,52 @@
+diff --git oox/source/ole/vbaproject.cxx oox/source/ole/vbaproject.cxx
+index 5acff7f..3db6de4 100755
+--- oox/source/ole/vbaproject.cxx
++++ oox/source/ole/vbaproject.cxx
+@@ -373,7 +373,10 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
+         // set library container to VBA compatibility mode
+         try
+         {
+-            Reference< XVBACompatibility >( getLibraryContainer( PROP_BasicLibraries ), UNO_QUERY_THROW )->setVBACompatibilityMode( sal_True );
++            Reference< XVBACompatibility > xVBACompat( getLibraryContainer( PROP_BasicLibraries ), UNO_QUERY_THROW );
++            xVBACompat->setVBACompatibilityMode( sal_True );
++            xVBACompat->setProjectName( maPrjName );
++
+         }
+         catch( Exception& )
+         {
+diff --git basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
+index 9d3b51a..e429217 100644
+--- basic/source/runtime/methods1.cxx
++++ basic/source/runtime/methods1.cxx
+@@ -532,11 +532,18 @@ RTLFUNC(DoEvents)
+     (void)pBasic;
+     (void)bWrite;
+     (void)rPar;
++// don't undstand what upstream are up to
++// we already process application events etc. in between
++// basic runtime pcode ( on a timed basis )
++#if 0
+     Timer aTimer;
+     aTimer.SetTimeout( 1 );
+     aTimer.Start();
+     while ( aTimer.IsActive() )
+         Application::Yield();
++#endif
++    // always return 0
++    rPar.Get(0)->PutInteger( 0 );
+ }
+
+ RTLFUNC(GetGUIVersion)
+diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
+index 38b995d..89de3b0 100644
+--- basic/source/runtime/stdobj.cxx
++++ basic/source/runtime/stdobj.cxx
+@@ -260,7 +260,7 @@ static Methods aMethods[] = {
+ { "Dir",            SbxSTRING,    2 | _FUNCTION, RTLNAME(Dir),0             },
+   { "FileSpec",     SbxSTRING,        _OPT, NULL,0 },
+   { "attrmask",     SbxINTEGER,       _OPT, NULL,0 },
+-{ "DoEvents",		SbxEMPTY,     _FUNCTION, RTLNAME(DoEvents),0			},
++{ "DoEvents",		SbxINTEGER,     _FUNCTION, RTLNAME(DoEvents),0			},
+ { "DumpAllObjects", SbxEMPTY,     2 | _SUB, RTLNAME(DumpAllObjects),0       },
+   { "FileSpec",     SbxSTRING, 0,NULL,0 },
+   { "DumpAll",      SbxINTEGER,		  _OPT, NULL,0 },
diff --git a/patches/vba/vba-msvbahelper-splitbuilt.diff b/patches/vba/vba-msvbahelper-splitbuilt.diff
index 2edfc42..0695465 100644
--- a/patches/vba/vba-msvbahelper-splitbuilt.diff
+++ b/patches/vba/vba-msvbahelper-splitbuilt.diff
@@ -120,8 +120,9 @@ index eead43c..3b92f80 100644
              sControlData.push_back( aProp );
 diff --git filter/source/msfilter/msvbahelper.cxx filter/source/msfilter/msvbahelper.cxx
 deleted file mode 100644
---- filter/source/msfilter/msvbahelper.cxx	2010-08-23 14:26:18.000000000 +0200
-+++ /dev/null	2010-05-08 11:31:08.000000000 +0200
+index 64256f6..0000000
+--- filter/source/msfilter/msvbahelper.cxx
++++ /dev/null
 @@ -1,411 +0,0 @@
 -/*************************************************************************
 - *
@@ -608,10 +609,10 @@ index 0000000..7d4b37e
 +}; }; }; };
 +#endif
 diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
-index 0282816..c9927c3 100644
+index 8c46453..bc75a92 100644
 --- offapi/com/sun/star/script/makefile.mk
 +++ offapi/com/sun/star/script/makefile.mk
-@@ -54,7 +54,11 @@ IDLFILES=\
+@@ -51,7 +51,11 @@ IDLFILES=\
  	XLibraryQueryExecutable.idl \
      ModuleSizeExceededRequest.idl\
      ModuleInfo.idl\
@@ -637,7 +638,7 @@ index a84f4aa..e8b170e 100644
          $(SLO)$/xlchart.obj					\
          $(SLO)$/xlformula.obj				\
 diff --git sc/source/filter/excel/xlescher.cxx sc/source/filter/excel/xlescher.cxx
-index 13ac02f..6e1067d 100644
+index 3360b02..9f6ed58 100644
 --- sc/source/filter/excel/xlescher.cxx
 +++ sc/source/filter/excel/xlescher.cxx
 @@ -32,6 +32,7 @@
@@ -696,107 +697,6 @@ index e2bb19d..51146d5 100644
      return OUString();
  }
  
-# FIXME ooo330-m4: resolveVBAMacro is not longer called in sc/source/ui/vba/vbaeventshelper.cxx
-#diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-#index db7340e..346c05d 100644
-#--- sc/source/ui/vba/vbaeventshelper.cxx
-#+++ sc/source/ui/vba/vbaeventshelper.cxx
-#@@ -48,6 +48,7 @@
-# #include <com/sun/star/table/XCell.hpp> 
-# #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-# #include <com/sun/star/sheet/XSpreadsheet.hpp>
-#+
-# #include <com/sun/star/container/XNamed.hpp>
-# #include <com/sun/star/awt/WindowEvent.hpp>
-# #include <com/sun/star/lang/EventObject.hpp>
-#@@ -62,7 +63,6 @@
-# #include <cellsuno.hxx> 
-# #include <convuno.hxx>
-# #include <map>
-#-#include <filter/msfilter/msvbahelper.hxx>
-# #include <vcl/svapp.hxx>
-# #include <basic/basmgr.hxx>
-# #include <ooo/vba/XHelperInterface.hpp>
-#@@ -586,7 +586,11 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
-# {
-# 	SfxObjectShell* pShell = pDoc->GetDocumentShell();
-#     String sMacroName = getEventName( nEventId );
-#-    VBAMacroResolvedInfo sMacroResolvedInfo;
-#+   
-#+    if ( !m_xMacroHelper.is() )
-#+        return rtl::OUString(); // no singleton ( fatal error ) #FIXME can we handle this better ? 
-#+    uno::Reference< script::XVBAMacroResolvedInfo > xResolvedMacroInfo;
-#+
-#     switch( nEventId )
-#     {
-#         // Worksheet
-#@@ -602,7 +606,7 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
-#         {
-#             String  aSheetModuleName = getSheetModuleName( nTab );
-#             sMacroName.Insert( '.', 0 ).Insert( aSheetModuleName, 0);
-#-            sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
-#+            xResolvedMacroInfo = m_xMacroHelper->resolveVBAMacro( pShell->GetModel(), sMacroName, sal_False );
-#             break;
-#         }
-#         // Workbook
-#@@ -636,18 +640,18 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
-#             }
-#            
-#             sMacroName.Insert( '.', 0 ).Insert( sWorkbookModuleName, 0);
-#-            sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
-#+            xResolvedMacroInfo = m_xMacroHelper->resolveVBAMacro( pShell->GetModel(), sMacroName, sal_False );
-#             break;
-#         }
-#     	case VBAEVENT_WORKBOOK_AUTOOPEN                       :
-#         {
-#-            sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
-#+            xResolvedMacroInfo = m_xMacroHelper->resolveVBAMacro( pShell->GetModel(), sMacroName, sal_False );
-#             break;
-#         }
-#         default:
-#             break;
-#     }
-#-    return sMacroResolvedInfo.ResolvedMacro();
-#+    return xResolvedMacroInfo->getResolvedMacro();
-# }
-# 
-# sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs, const SCTAB nTab )
-#@@ -663,7 +667,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
-#     // 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() )
-#+	if( m_xMacroHelper.is() && sMacroPath.getLength() )
-# 	{
-# 		switch( nEventId )
-# 		{
-#@@ -756,7 +760,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
-#                 // process Cancel argument
-#                 aArgs = uno::Sequence< uno::Any >(1);
-#                 aArgs[0] <<= bCancel;
-#-                executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
-#+                m_xMacroHelper->executeMacro( pShell->GetModel(), sMacroPath, aArgs, aRet, aDummyCaller );
-#                 aArgs[0] >>= bCancel;
-#                 return bCancel;
-#             }
-#@@ -766,7 +770,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
-#                 aArgs = uno::Sequence< uno::Any >(2);
-#                 aArgs[0] = rArgs[0];
-#                 aArgs[1] <<= bCancel;
-#-                executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
-#+                m_xMacroHelper->executeMacro( pShell->GetModel(), sMacroPath, aArgs, aRet, aDummyCaller );
-#                 aArgs[1] >>= bCancel;
-#                 return bCancel;
-#             }
-#@@ -784,7 +788,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
-# 		}
-#     
-#         // excute the macro
-#-        result = executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
-#+        result = m_xMacroHelper->executeMacro( pShell->GetModel(), sMacroPath, aArgs, aRet, aDummyCaller );
-# 	}
-#     
-# 	return result;
 diff --git sc/source/ui/vba/vbasheetobject.cxx sc/source/ui/vba/vbasheetobject.cxx
 index 215a62c..daad041 100755
 --- sc/source/ui/vba/vbasheetobject.cxx
@@ -886,7 +786,7 @@ index a7af036..e5f3c21 100755
  
  // ============================================================================
 diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index 8411b09..caf2324 100644
+index 53dc7d2..89f10fc 100644
 --- scripting/source/vbaevents/eventhelper.cxx
 +++ scripting/source/vbaevents/eventhelper.cxx
 @@ -78,10 +78,7 @@
@@ -980,8 +880,9 @@ index 6815f28..8ea6b81 100644
          $(SLO)$/UnoNameItemTable.obj \
 diff --git svx/source/unodraw/msvbahelper.cxx svx/source/unodraw/msvbahelper.cxx
 new file mode 100644
---- /dev/null	2010-05-08 11:31:08.000000000 +0200
-+++ svx/source/unodraw/msvbahelper.cxx	2010-08-23 14:55:52.000000000 +0200
+index 0000000..f818b95
+--- /dev/null
++++ svx/source/unodraw/msvbahelper.cxx
 @@ -0,0 +1,533 @@
 +/*************************************************************************
 + *
@@ -1615,7 +1516,7 @@ index 060ab89..6503abc 100644
          {
              xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
 diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index d1ed65d..041f019 100644
+index c71f885..394b2af 100644
 --- sw/source/filter/ww8/ww8par.cxx
 +++ sw/source/filter/ww8/ww8par.cxx
 @@ -155,7 +155,6 @@ using namespace nsHdFtFlags;
@@ -1626,67 +1527,8 @@ index d1ed65d..041f019 100644
  #include <unotools/pathoptions.hxx>
  #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
  
-# FIXME ooo330-m4: resolveVBAMacro is not longer called in sw/source/ui/vba/vbaeventshelper.cxx
-#diff --git sw/source/ui/vba/vbaeventshelper.cxx sw/source/ui/vba/vbaeventshelper.cxx
-#index 2c6f212..3008c73 100644
-#--- sw/source/ui/vba/vbaeventshelper.cxx
-#+++ sw/source/ui/vba/vbaeventshelper.cxx
-#@@ -37,7 +37,7 @@
-# #include <sfx2/objsh.hxx> 
-# #include <comphelper/processfactory.hxx>
-# #include <cppuhelper/implbase1.hxx>
-#-#include <filter/msfilter/msvbahelper.hxx>
-#+
-# #include "wordvbahelper.hxx"
-# 
-# using namespace com::sun::star;
-#@@ -70,7 +70,11 @@ rtl::OUString
-# SwVbaEventsHelper::getMacroPath( const sal_Int32 nEventId )
-# {
-#     String sMacroName = getEventName( nEventId );
-#-    VBAMacroResolvedInfo sMacroResolvedInfo;
-#+
-#+    if ( !m_xMacroHelper.is() )
-#+        return rtl::OUString(); // failed to get helper singleton, #FIXME can we handle this more elegantly
-#+    uno::Reference< script::XVBAMacroResolvedInfo > xMacroResolvedInfo;
-#+
-#     switch( nEventId )
-#     {
-#         // Document events
-#@@ -79,19 +83,19 @@ SwVbaEventsHelper::getMacroPath( const sal_Int32 nEventId )
-#     	case VBAEVENT_DOCUMENT_CLOSE:
-#         {
-#             sMacroName.Insert( '.', 0 ).Insert( sThisDocument, 0);
-#-            sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
-#+            xMacroResolvedInfo = m_xMacroHelper->resolveVBAMacro( pDocShell->GetModel(), sMacroName, sal_False );
-#             break;
-#         }
-#     	case VBAEVENT_DOCUMENT_AUTONEW:
-#     	case VBAEVENT_DOCUMENT_AUTOOPEN:
-#         {
-#-            sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
-#+            xMacroResolvedInfo = m_xMacroHelper->resolveVBAMacro( pDocShell->GetModel(), sMacroName, sal_False );
-#             break;
-#         }
-#         default:
-#             break;
-#     }
-#-    return sMacroResolvedInfo.ResolvedMacro();
-#+    return xMacroResolvedInfo->getResolvedMacro();
-# }
-# 
-# sal_Bool SwVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& /*rArgs*/ )
-#@@ -107,7 +111,7 @@ sal_Bool SwVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
-# 	if( sMacroPath.getLength() )
-# 	{
-#         // excute the macro
-#-        result = executeMacro( pDocShell, sMacroPath, aArgs, aRet, aDummyCaller );
-#+        result = m_xMacroHelper->executeMacro( pDocShell->GetModel(), sMacroPath, aArgs, aRet, aDummyCaller );
-# 	}
-#     
-# 	return result;
 diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-index a320075..99d5c47 100644
+index d1ef76c..737274d 100644
 --- vbahelper/inc/vbahelper/vbaapplicationbase.hxx
 +++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx
 @@ -30,6 +30,8 @@
@@ -1707,8 +1549,9 @@ index a320075..99d5c47 100644
      virtual ~VbaApplicationBase();
  
 diff --git vbahelper/inc/vbahelper/vbaeventshelperbase.hxx vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
---- vbahelper/inc/vbahelper/vbaeventshelperbase.hxx.old	2010-08-11 13:35:12.000000000 +0200
-+++ vbahelper/inc/vbahelper/vbaeventshelperbase.hxx	2010-08-23 15:50:35.000000000 +0200
+index b0dd184..8443251 100755
+--- vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
++++ vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
 @@ -30,6 +30,7 @@
  
  #include <com/sun/star/lang/XEventListener.hpp>
@@ -1717,14 +1560,16 @@ diff --git vbahelper/inc/vbahelper/vbaeventshelperbase.hxx vbahelper/inc/vbahelp
  #include <cppuhelper/implbase2.hxx>
  #include <map>
  #include <deque>
-@@ -147,6 +148,7 @@ private:
+@@ -147,7 +148,9 @@ private:
      void stopListening();
  
  protected:
-+    css::uno::Reference< css::script::XVBAMacroHelper > m_xMacroHelper;
++    css::uno::Reference< css::script::XVBAMacroHelper > mxMacroHelper;
      css::uno::Reference< css::frame::XModel > mxModel;
++    css::uno::Reference< css::uno::XComponentContext > mxContext;
      SfxObjectShell* mpShell;
  
+ private:
 diff --git vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacombobox.cxx
 index 5c05894..f7346f4 100644
 --- vbahelper/source/msforms/vbacombobox.cxx
@@ -1738,7 +1583,7 @@ index 5c05894..f7346f4 100644
  #include <basic/sbmod.hxx>
  
 diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index 8cfc6d1..3cee693 100644
+index bb12c44..1541d97 100644
 --- vbahelper/source/vbahelper/vbaapplicationbase.cxx
 +++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
 @@ -40,9 +40,10 @@
@@ -1753,7 +1598,7 @@ index 8cfc6d1..3cee693 100644
  #include <tools/datetime.hxx>
  
  #include <basic/sbx.hxx>
-@@ -181,6 +182,13 @@ VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentCon
+@@ -182,6 +183,13 @@ VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentCon
                      : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext )
                      , m_pImpl( new VbaApplicationBase_Impl )
  {
@@ -1767,7 +1612,7 @@ index 8cfc6d1..3cee693 100644
  }
  
  VbaApplicationBase::~VbaApplicationBase()
-@@ -335,8 +343,10 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
+@@ -345,8 +353,10 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
  
      
      // search the global tempalte
@@ -1780,7 +1625,7 @@ index 8cfc6d1..3cee693 100644
      {
          // handle the arguments
          const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 };
-@@ -362,7 +372,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
+@@ -372,7 +382,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
  
          uno::Any aRet;
          uno::Any aDummyCaller;
@@ -1819,27 +1664,78 @@ index 1b2d013..3378a4d 100644
          setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
          ApplyChange();
 diff --git vbahelper/source/vbahelper/vbaeventshelperbase.cxx vbahelper/source/vbahelper/vbaeventshelperbase.cxx
---- vbahelper/source/vbahelper/vbaeventshelperbase.cxx.old	2010-08-11 13:35:12.000000000 +0200
-+++ vbahelper/source/vbahelper/vbaeventshelperbase.cxx	2010-08-23 15:47:11.000000000 +0200
-@@ -26,6 +26,7 @@
+index ee6eccb..43f63f3 100755
+--- vbahelper/source/vbahelper/vbaeventshelperbase.cxx
++++ vbahelper/source/vbahelper/vbaeventshelperbase.cxx
+@@ -26,14 +26,15 @@
   ************************************************************************/
  
  #include "vbahelper/vbaeventshelperbase.hxx"
+-#include <filter/msfilter/msvbahelper.hxx>
 +#include <com/sun/star/script/theVBAMacroHelper.hpp>
- #include <filter/msfilter/msvbahelper.hxx>
  
  using namespace ::com::sun::star;
-@@ -48,6 +49,13 @@ VbaEventsHelperBase::VbaEventsHelperBase
-     }
+ using namespace ::ooo::vba;
+
+ // ============================================================================
+
+-VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) :
++VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& xContext ) :
++    mxContext( xContext ),
+     mpShell( 0 ),
+     mbDisposed( false )
+ {
+@@ -49,6 +50,17 @@ VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs
      catch( uno::Exception& )
      {
-+    }
+     }
 +    try
 +    {
-+        m_xMacroHelper =  script::theVBAMacroHelper::get( m_xContext );
++        // Our custom context does not handler requests for singletons
++        // we need to get the system context for that
++        uno::Reference< beans::XPropertySet > xProps( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
++        uno::Reference< uno::XComponentContext > xDfltContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ), uno::UNO_QUERY_THROW );
++        mxMacroHelper =  script::theVBAMacroHelper::get( xDfltContext );
 +    }
 +    catch( uno::Exception& )
 +    {
++    }
+ }
+
+ VbaEventsHelperBase::~VbaEventsHelperBase()
+@@ -111,7 +123,7 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
+             // search the event handler macro in the document
+             ::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
+             bool bEventSuccess = false;
+-            if( aMacroPath.getLength() > 0 )
++            if( mxMacroHelper.is() && aMacroPath.getLength() > 0 )
+             {
+                 // build the argument list
+                 uno::Sequence< uno::Any > aVbaArgs = implBuildArgumentList( rInfo, aEventArgs );
+@@ -124,7 +136,9 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
+                 }
+                 // execute the event handler
+                 uno::Any aRet, aCaller;
+-                bEventSuccess = executeMacro( mpShell, aMacroPath, aVbaArgs, aRet, aCaller );
++
++                bEventSuccess = mxMacroHelper->executeMacro( mpShell->GetModel(), aMacroPath, aVbaArgs, aRet, aCaller );
++
+                 // extract new cancel value
+                 if( rInfo.mnCancelIndex >= 0 )
+                 {
+@@ -200,7 +214,14 @@ const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandle
+                 append( sal_Unicode( '.' ) ).append( rInfo.maMacroName ).makeStringAndClear();
+         break;
      }
+-    return resolveVBAMacro( mpShell, aMacroName ).ResolvedMacro();
++    rtl::OUString sResolvedMacro;
++    if ( mxMacroHelper.is() )
++    {
++        uno::Reference< script::XVBAMacroResolvedInfo > xResolvedMacroInfo = mxMacroHelper->resolveVBAMacro( mpShell->GetModel(), aMacroName, sal_False );
++        if ( xResolvedMacroInfo.is() )
++            sResolvedMacro  = xResolvedMacroInfo->getResolvedMacro();
++    }
++    return sResolvedMacro;
  }
  
+ void VbaEventsHelperBase::stopListening()


More information about the ooo-build-commit mailing list