ooo-build r12521 - in trunk: . patches/test/vba patches/vba
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r12521 - in trunk: . patches/test/vba patches/vba
- Date: Mon, 12 May 2008 17:23:31 +0100 (BST)
Author: noelpwer
Date: Mon May 12 16:23:31 2008
New Revision: 12521
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12521&view=rev
Log:
2008-05-12 Noel Power <noel power novell com>
* patches/vba/vbaevents-services-sources.diff: some refactoring
* patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff: ported to m10 ( note:
not applied )
Modified:
trunk/ChangeLog
trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff
trunk/patches/vba/vbaevents-services-sources.diff
Modified: trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff
==============================================================================
--- trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff (original)
+++ trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff Mon May 12 16:23:31 2008
@@ -260,29 +260,22 @@
OSL_TRACE("Module %s is of type Normal VBA",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/svx/source/msfilter/msvbasic.hxx svx/source/msfilter/msvbasic.hxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/svx/source/msfilter/msvbasic.hxx 2006-06-19 17:20:43.000000000 +0100
-+++ svx/source/msfilter/msvbasic.hxx 2008-03-28 10:30:33.000000000 +0000
-@@ -50,11 +50,13 @@
- #ifndef _DYNARY_HXX
- #include <tools/dynary.hxx>
- #endif
-+#include <com/sun/star/script/ModuleType.hpp>
- #ifndef __SGI_STL_VECTOR
+--- svx/source/msfilter/msvbasic.hxx 2008-04-11 03:07:15.000000000 +0100
++++ svx.patched/source/msfilter/msvbasic.hxx 2008-05-09 17:13:58.000000000 +0100
+@@ -45,6 +45,8 @@
#include <vector>
#endif
#include<map>
-
++#include <com/sun/star/script/ModuleType.hpp>
+using namespace ::com::sun::star::script::ModuleType;
+
/* class VBA:
* The VBA class provides a set of methods to handle Visual Basic For
- * Applications streams, the constructor is given the root ole2 stream
-@@ -77,13 +79,13 @@ DECLARE_DYNARRAY(StringArray,String *)
+@@ -68,13 +70,12 @@ DECLARE_DYNARRAY(StringArray,String *)
// #117718# define internal types to distinguish between
// module types, form, class & normal
// #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet
-enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
-+//enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
// #117718# define map to hold types of module
//
@@ -294,7 +287,7 @@
class VBA_Impl
{
-@@ -104,7 +106,7 @@ public:
+@@ -95,7 +96,7 @@ public:
void Output(int len, const sal_uInt8 *data);
//
// #117718# member map of module names to types of module
@@ -544,150 +537,30 @@
// Calls import on contained pages
return OCX_ContainerControl::Import( xPropSet );
}
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/inc/document.hxx sc/inc/document.hxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/inc/document.hxx 2008-03-29 23:08:24.000000000 +0000
-+++ sc/inc/document.hxx 2008-03-28 10:30:33.000000000 +0000
-@@ -308,6 +308,7 @@ private:
-
- com::sun::star::uno::Sequence<sal_Int8> aProtectPass;
- String aDocName; // opt: Dokumentname
-+ String aDocCodeName; // opt: Dokumentname
- ScRangePairListRef xColNameRanges;
- ScRangePairListRef xRowNameRanges;
-
-@@ -451,6 +452,8 @@ public:
-
- const String& GetName() const { return aDocName; }
- void SetName( const String& r ) { aDocName = r; }
-+ const String& GetCodeName() const { return aDocCodeName; }
-+ void SetCodeName( const String& r ) { aDocCodeName = r; }
-
- void GetDocStat( ScDocStat& rDocStat );
-
-@@ -538,6 +541,8 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollec
-
- BOOL HasTable( SCTAB nTab ) const;
- SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName );
- BOOL GetTable( const String& rName, SCTAB& rTab ) const;
- inline SCTAB GetTableCount() const { return nMaxTableNumber; }
- SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/inc/servuno.hxx 2008-04-02 12:15:17.000000000 +0100
-+++ sc/inc/servuno.hxx 2008-03-28 10:30:33.000000000 +0000
-@@ -103,7 +103,9 @@ class ScDocShell;
+--- sc/inc/servuno.hxx 2008-04-10 19:53:59.000000000 +0100
++++ sc/inc/servuno.hxx 2008-05-09 18:11:50.000000000 +0100
+@@ -93,8 +93,8 @@ class ScDocShell;
+
#define SC_SERVICE_FORMULAPARS 38
#define SC_SERVICE_OPCODEMAPPER 39
-
+-
-#define SC_SERVICE_COUNT 40
+#define SC_SERVICE_VBAOBJECTPROVIDER 40
-+#define SC_SERVICE_VBACONTROL_EVENTS 41
-+#define SC_SERVICE_COUNT 42
++#define SC_SERVICE_COUNT 41
#define SC_SERVICE_INVALID USHRT_MAX
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/unoobj/servuno.cxx 2008-04-02 12:07:01.000000000 +0100
-+++ sc/source/ui/unoobj/servuno.cxx 2008-04-02 11:35:42.000000000 +0100
-@@ -46,10 +46,19 @@
- #include <svx/unonrule.hxx>
- #endif
-
-+#include <com/sun/star/script/XEventAttacherManager.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <org/openoffice/vba/XVBAToOOEventDescGen.hpp>
-+#include <org/openoffice/vba/XFakeVBAEventDescriptorSupplier.hpp>
-+#include <comphelper/processfactory.hxx>
-+
- #ifndef _COM_SUN_STAR_SHEET_XSPREADSHEETDOCUMENT_HPP_
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #endif
-
-+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+
- #include "servuno.hxx"
- #include "unonames.hxx"
- #include "cellsuno.hxx"
-@@ -77,8 +86,164 @@
+--- sc/source/ui/unoobj/servuno.cxx 2008-04-11 01:43:36.000000000 +0100
++++ sc/source/ui/unoobj/servuno.cxx 2008-05-09 18:16:21.000000000 +0100
+@@ -61,8 +61,93 @@
+ #include <svx/xmleohlp.hxx>
#include <svx/xmlgrhlp.hxx>
- #endif
-+#include "scextopt.hxx"
+#include <com/sun/star/script/XObjectProvider.hpp>
+#include <comphelper/processfactory.hxx>
+
using namespace ::com::sun::star;
-+typedef ::cppu::WeakImplHelper1< org::openoffice::vba::XFakeVBAEventDescriptorSupplier > Initialization_BASE;
-+
-+class ScFakeVBACntrlEvtSupport : public Initialization_BASE
-+{
-+ ScDocShell* mpDoc;
-+ ScFakeVBACntrlEvtSupport();
-+ uno::Sequence< script::ScriptEventDescriptor > getFakeEvents( const uno::Reference< uno::XInterface >& xIf, sal_Int32 pageIndex )
-+ {
-+ rtl::OUString sServiceName;
-+ uno::Reference< beans::XPropertySet > xProps( xIf, uno::UNO_QUERY );
-+ xProps->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl" ) ) >>= sServiceName;
-+ OSL_TRACE("Control serviceName is %s", rtl::OUStringToOString( sServiceName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ xProps.set( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Reference< org::openoffice::vba::XVBAToOOEventDescGen > xEvtDescGen( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( "org.openoffice.vba.VBAToOOEventDesc" ), xContext ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< rtl::OUString > sHandlerExtns;
-+ String sLibModName;
-+ mpDoc->GetDocument()->GetCodeName( pageIndex, sLibModName );
-+
-+ if( !sLibModName.Len() )
-+ mpDoc->GetDocument()->GetName( pageIndex, sLibModName );
-+
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents = xEvtDescGen->getEventDescriptions( xContext->getServiceManager()->createInstanceWithContext( sServiceName, xContext ), sLibModName, sHandlerExtns ) ;
-+ return aFakeEvents;
-+ }
-+public:
-+ ScFakeVBACntrlEvtSupport( ScDocShell* pDoc ) : mpDoc( pDoc )
-+ {
-+ OSL_TRACE("*** In ScFakeVBACntrlEvtSupport ");
-+ }
-+ virtual uno::Sequence< com::sun::star::script::ScriptEventDescriptor > SAL_CALL getEventDescriptions( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
-+ {
-+ OSL_TRACE( "*** In ScFakeVBACntrlEvtSupport::getEventDescriptions");
-+ // need to find the page ( and index ) for this control
-+ uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mpDoc->GetModel(), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-+
-+ sal_Int32 nLen = xIndex->getCount();
-+ bool bMatched = false;
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+ for ( sal_Int32 index = 0; index < nLen; ++index )
-+ {
-+ try
-+ {
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container
-+ uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCntrls = xFormControls->getCount();
-+ for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+ {
-+ uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-+ bMatched = ( xControl == xIf );
-+ if ( bMatched )
-+ {
-+ aFakeEvents = getFakeEvents( xIf, index );
-+ break;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ if ( bMatched )
-+ break;
-+ }
-+ // Probably should throw here ( if !bMatched )
-+ return aFakeEvents;
-+ }
-+};
-+
+class ScVbaObjectProvider : public ::cppu::WeakImplHelper2< script::XObjectProvider, lang::XInitialization >
+{
+ ScDocShell* mpDocShell;
@@ -773,230 +646,36 @@
//------------------------------------------------------------------------
-@@ -128,7 +293,10 @@ static const sal_Char* __FAR_DATA aProvN
+@@ -112,7 +197,8 @@ static const sal_Char* __FAR_DATA aProvN
SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
- SC_SERVICENAME_OPCODEMAPPER // SC_SERVICE_OPCODEMAPPER
+ SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
-+ "org.openoffice.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
-+ "org.openoffice.vba.controlevents", // SC_SERVICE_VBACONTROL_EVENTS
-+
++"org.openoffice.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
};
//
-@@ -180,7 +348,9 @@ static const sal_Char* __FAR_DATA aOldNa
+@@ -164,7 +250,8 @@ static const sal_Char* __FAR_DATA aOldNa
"", // SC_SERVICE_SHEETDOCSET
"", // SC_SERVICE_CHDATAPROV
"", // SC_SERVICE_FORMULAPARS
- "" // SC_SERVICE_OPCODEMAPPER
+ "", // SC_SERVICE_OPCODEMAPPER
+ "", // SC_SERVICE_VBAOBJECTPROVIDER
-+ "", // SC_SERVICE_VBACONTROL_EVENTS
};
-@@ -373,6 +543,12 @@ uno::Reference<uno::XInterface> ScServic
+@@ -357,6 +444,9 @@ uno::Reference<uno::XInterface> ScServic
case SC_SERVICE_OPCODEMAPPER:
xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj));
break;
+ case SC_SERVICE_VBAOBJECTPROVIDER:
+ xRet.set(static_cast<script::XObjectProvider*>(new ScVbaObjectProvider( pDocShell )));
+ break;
-+ case SC_SERVICE_VBACONTROL_EVENTS:
-+ xRet.set(static_cast<org::openoffice::vba::XFakeVBAEventDescriptorSupplier*>(new ScFakeVBACntrlEvtSupport( pDocShell ) ));
-+ break;
}
return xRet;
}
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/inc/table.hxx sc/inc/table.hxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/inc/table.hxx 2008-03-29 23:08:24.000000000 +0000
-+++ sc/inc/table.hxx 2008-03-28 10:30:33.000000000 +0000
-@@ -104,6 +104,7 @@ private:
- ScColumn aCol[MAXCOLCOUNT];
-
- String aName;
-+ String aCodeName;
- String aComment;
- BOOL bScenario;
- BOOL bLayoutRTL;
-@@ -237,6 +238,9 @@ public:
- void GetName( String& rName ) const;
- void SetName( const String& rNewName );
-
-+ void GetCodeName( String& rName ) const { rName = aCodeName; }
-+ void SetCodeName( const String& rNewName ) { aCodeName = rNewName; }
-+
- const String& GetUpperName() const;
-
- const String& GetPageStyle() const { return aPageStyle; }
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/core/data/document.cxx sc/source/core/data/document.cxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/core/data/document.cxx 2008-03-29 23:08:20.000000000 +0000
-+++ sc/source/core/data/document.cxx 2008-03-28 10:30:33.000000000 +0000
-@@ -101,6 +101,7 @@
- #include "scextopt.hxx"
- #include "postit.hxx"
-
-+
- struct ScDefaultAttr
- {
- const ScPatternAttr* pAttr;
-@@ -155,6 +156,32 @@ BOOL ScDocument::GetName( SCTAB nTab, St
- return FALSE;
- }
-
-+BOOL ScDocument::SetCodeName( SCTAB nTab, String& rName )
-+{
-+ if (VALIDTAB(nTab))
-+ {
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->SetCodeName( rName );
-+ return TRUE;
-+ }
-+ }
-+ OSL_TRACE( "**** can't set code name %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return FALSE;
-+}
-+
-+BOOL ScDocument::GetCodeName( SCTAB nTab, String& rName ) const
-+{
-+ if (VALIDTAB(nTab))
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->GetCodeName( rName );
-+ return TRUE;
-+ }
-+ rName.Erase();
-+ return FALSE;
-+}
-+
-
- BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
- {
-@@ -280,7 +307,6 @@ void ScDocument::CreateValidTabName(Stri
- }
- }
-
--
- BOOL ScDocument::InsertTab( SCTAB nPos, const String& rName,
- BOOL bExternalDocument )
- {
-@@ -294,12 +320,7 @@ BOOL ScDocument::InsertTab( SCTAB nPos,
- if (nPos == SC_TAB_APPEND || nPos == nTabCount)
- {
- pTab[nTabCount] = new ScTable(this, nTabCount, rName);
-- // if we are mapping codenames then a new tab always has has
-- // codename = sheetname
-- if ( pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- pExtOptions->SetCodeName( rName, nTabCount );
-- }
-+ pTab[nTabCount]->SetCodeName( rName );
- ++nMaxTableNumber;
- if ( bExternalDocument )
- pTab[nTabCount]->SetVisible( FALSE );
-@@ -334,24 +355,10 @@ BOOL ScDocument::InsertTab( SCTAB nPos,
- for (i = nTabCount; i > nPos; i--)
- {
- pTab[i] = pTab[i - 1];
-- if ( pTab[i] && pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- String sCodeName = pExtOptions->GetCodeName( i - 1 );
-- if ( sCodeName.Len() )
-- {
-- OSL_TRACE("Associating codeName %s with tab %d", rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), i );
-- pExtOptions->SetCodeName( sCodeName, i );
-- }
-- }
-- }
--
-- if ( pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- OSL_TRACE("Inserting codeName %s with tab %d", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(),nPos );
-- pExtOptions->SetCodeName( rName, nPos );
- }
-
- pTab[nPos] = new ScTable(this, nPos, rName);
-+ pTab[nPos]->SetCodeName( rName );
- ++nMaxTableNumber;
-
- for (i = 0; i <= MAXTAB; i++)
-@@ -441,22 +448,7 @@ BOOL ScDocument::DeleteTab( SCTAB nTab,
- delete pTab[nTab];
- for (i=nTab + 1; i < nTabCount; i++)
- {
-- if ( pTab[i - 1 ] && pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- String sCodeName = pExtOptions->GetCodeName( i );
-- if ( sCodeName.Len() )
-- {
-- OSL_TRACE("Associating codeName %s with tab %d", rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), i - 1 );
-- pExtOptions->SetCodeName( sCodeName, i - 1 );
-- }
-- }
- pTab[i - 1] = pTab[i];
--
-- }
-- if ( pTab[i - 1 ] && pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- OSL_TRACE("Deleting codename %s as %d", rtl::OUStringToOString( pExtOptions->GetCodeName( nTabCount-1 ), RTL_TEXTENCODING_UTF8 ).getStr(), nTabCount - 1 ) ;
-- pExtOptions->DeleteCodeName( nTabCount - 1 );
- }
-
- pTab[nTabCount - 1] = NULL;
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/core/data/table1.cxx sc/source/core/data/table1.cxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/core/data/table1.cxx 2008-03-29 23:08:24.000000000 +0000
-+++ sc/source/core/data/table1.cxx 2008-03-28 10:30:33.000000000 +0000
-@@ -130,6 +130,7 @@ extern BOOL bIsOlk, bOderSo;
- ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
- BOOL bColInfo, BOOL bRowInfo ) :
- aName( rNewName ),
-+ aCodeName( rNewName ),
- bScenario( FALSE ),
- bLayoutRTL( FALSE ),
- bLoadingRTL( FALSE ),
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/filter/excel/excimp8.cxx 2008-03-29 23:08:10.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx 2008-03-28 10:30:33.000000000 +0000
-@@ -148,7 +148,7 @@ using namespace com::sun::star;
-
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
-- ImportExcel( rImpData, rStrm )
-+ ImportExcel( rImpData, rStrm ), mnTab(0)
- {
- delete pFormConv;
-
-@@ -284,9 +284,15 @@ void ImportExcel8::Codename( BOOL bWorkb
- if( aName.Len() )
- {
- if( bWorkbookGlobals )
-- GetExtDocOptions().GetDocSettings().maGlobCodeName = aName;
-+ {
-+ //GetExtDocOptions().GetDocSettings().maGlobCodeName = aName;
-+ GetDoc().SetCodeName( aName );
-+ }
- else
-- GetExtDocOptions().AppendCodeName( aName );
-+ {
-+ //GetExtDocOptions().AppendCodeName( aName );
-+ GetDoc().SetCodeName( mnTab++, aName );
-+ }
- }
- }
- }
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/filter/inc/excimp8.hxx sc/source/filter/inc/excimp8.hxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/filter/inc/excimp8.hxx 2008-03-29 23:08:10.000000000 +0000
-+++ sc/source/filter/inc/excimp8.hxx 2008-03-28 10:30:33.000000000 +0000
-@@ -69,6 +69,7 @@ class XclImpStream;
-
- class ImportExcel8 : public ImportExcel
- {
-+ SCTAB mnTab;
- protected:
- ExcScenarioList aScenList;
-
diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
--- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/docshell/docfunc.cxx 2008-03-29 23:08:20.000000000 +0000
+++ sc/source/ui/docshell/docfunc.cxx 2008-03-28 10:30:33.000000000 +0000
@@ -1321,9 +1000,9 @@
--- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/basctl/source/basicide/basidesh.cxx 2008-01-14 16:00:46.000000000 +0000
+++ basctl/source/basicide/basidesh.cxx 2008-03-28 10:30:34.000000000 +0000
@@ -97,6 +97,9 @@
- #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+ #include <com/sun/star/script/XLibraryContainer.hpp>
+ #include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
- #endif
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
@@ -1828,16 +1507,16 @@
USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
--- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/basic/source/classes/sbxmod.cxx 2008-04-08 12:03:51.000000000 +0100
+++ basic/source/classes/sbxmod.cxx 2008-04-06 21:34:40.000000000 +0100
-@@ -62,6 +62,9 @@
- #include "sbunoobj.hxx"
+@@ -51,6 +51,9 @@
#include <basic/hilight.hxx>
#include <basic/basrdll.hxx>
+ #include <vos/mutex.hxx>
+#include <basic/sbobjmod.hxx>
+#include <com/sun/star/script/XObjectProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
- #ifndef _VOS_MUTEX_HXX_
- #include <vos/mutex.hxx>
+ // for the bsearch
+ #ifdef WNT
@@ -80,7 +83,20 @@
#include <stdio.h>
@@ -2179,16 +1858,14 @@
diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
--- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/basic/source/runtime/methods1.cxx 2007-09-20 16:55:19.000000000 +0100
+++ basic/source/runtime/methods1.cxx 2008-03-28 10:30:34.000000000 +0000
-@@ -60,6 +60,9 @@
+@@ -44,6 +44,7 @@
#ifndef _SBX_HXX
#include <basic/sbx.hxx>
#endif
-+#ifndef _SBSTAR_HXX
+#include <basic/sbstar.hxx>
-+#endif
- #ifndef _ZFORLIST_HXX //autogen
#include <svtools/zforlist.hxx>
- #endif
+ #include <tools/fsys.hxx>
+ #include <tools/urlobj.hxx>
@@ -86,6 +89,7 @@
#endif
@@ -2505,516 +2182,6 @@
}
}
}
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl 2007-04-27 08:32:41.000000000 +0100
-+++ oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl 2008-03-28 10:30:34.000000000 +0000
-@@ -50,5 +50,10 @@ interface XVBAToOOEventDescGen : com::su
- com::sun::star::script::XScriptEventsSupplier getEventSupplier( [in] com::sun::star::uno::XInterface xControl );
- };
-
-+interface XFakeVBAEventDescriptorSupplier : com::sun::star::uno::XInterface
-+{
-+ sequence< com::sun::star::script::ScriptEventDescriptor > getEventDescriptions( [in] com::sun::star::uno::XInterface xControl );
-+};
-+
- }; }; };
- #endif
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/forms/source/inc/InterfaceContainer.hxx forms/source/inc/InterfaceContainer.hxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/forms/source/inc/InterfaceContainer.hxx 2007-01-29 15:46:36.000000000 +0000
-+++ forms/source/inc/InterfaceContainer.hxx 2008-03-28 10:30:34.000000000 +0000
-@@ -319,6 +319,9 @@ protected:
- void implCheckIndex( const sal_Int32 _nIndex ) SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) );
-
- private:
-+ // hack for Vba Events
-+ void fakeVbaEventsHack( sal_Int32 _nIndex );
-+
- // the runtime event format has changed from version SO5.2 to OOo
- enum EventFormat
- {
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/forms/source/misc/InterfaceContainer.cxx forms/source/misc/InterfaceContainer.cxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/forms/source/misc/InterfaceContainer.cxx 2006-12-01 16:55:25.000000000 +0000
-+++ forms/source/misc/InterfaceContainer.cxx 2008-03-28 10:30:34.000000000 +0000
-@@ -105,11 +105,14 @@
- #include <rtl/logfile.hxx>
- #endif
-
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <org/openoffice/vba/XFakeVBAEventDescriptorSupplier.hpp>
- //.........................................................................
- namespace frm
- {
- //.........................................................................
-
-+using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
-@@ -127,6 +130,83 @@ namespace
- }
- }
-
-+bool
-+lcl_hasVbaEvents( const Sequence< ScriptEventDescriptor >& sEvents )
-+{
-+ const ScriptEventDescriptor* pDesc = sEvents.getConstArray();
-+ const ScriptEventDescriptor* pEnd = ( pDesc + sEvents.getLength() );
-+ for ( ; pDesc != pEnd; ++pDesc )
-+ {
-+ if ( pDesc->ScriptType.equals( rtl::OUString::createFromAscii( "VBAInterop" ) ) )
-+ return true;
-+ }
-+ return false;
-+}
-+
-+Sequence< ScriptEventDescriptor >
-+lcl_stripVbaEvents( const Sequence< ScriptEventDescriptor >& sEvents )
-+{
-+ Sequence< ScriptEventDescriptor > sStripped( sEvents.getLength() );
-+
-+ const ScriptEventDescriptor* pDesc = sEvents.getConstArray();
-+ const ScriptEventDescriptor* pEnd = ( pDesc + sEvents.getLength() );
-+ sal_Int32 nCopied = 0;
-+ for ( ; pDesc != pEnd; ++pDesc )
-+ {
-+ if ( !pDesc->ScriptType.equals( rtl::OUString::createFromAscii( "VBAInterop" ) ) )
-+ {
-+ sStripped[ nCopied++ ] = *pDesc;
-+ }
-+ }
-+ if ( nCopied )
-+ sStripped.realloc( nCopied );
-+ return sStripped;
-+}
-+
-+void
-+OInterfaceContainer::fakeVbaEventsHack( sal_Int32 _nIndex )
-+{
-+ // we are dealing with form controls
-+ try
-+ {
-+ Reference< XFormComponent > xForm( static_cast< XContainer* >(this), UNO_QUERY_THROW );
-+ // grand-parent should be the model, no parent ? if not
-+ // we'll ignore, we'll get called back here anyway )
-+ Reference< XChild > xChild( xForm->getParent(), UNO_QUERY_THROW );
-+ Reference< XModel > xDocOwner( xChild->getParent(), UNO_QUERY );
-+ OSL_TRACE(" Is DOC ????? %s", xDocOwner.is() ? "true" : "false" );
-+ if ( xDocOwner.is() )
-+ {
-+ bool hasVBABindings = lcl_hasVbaEvents( m_xEventAttacher->getScriptEvents( _nIndex ) );
-+ if ( hasVBABindings )
-+ {
-+ OSL_TRACE("Has VBA bindings already, returning ");
-+ return;
-+ }
-+ Reference< XMultiServiceFactory > xFac( xDocOwner, UNO_QUERY );
-+ if ( xFac.is() )
-+ {
-+ try
-+ {
-+ Reference< org::openoffice::vba::XFakeVBAEventDescriptorSupplier > xDescSupplier( xFac->createInstance( rtl::OUString::createFromAscii( "org.openoffice.vba.controlevents" ) ), UNO_QUERY_THROW );
-+ Reference< XInterface > xIf( getByIndex( _nIndex ) , UNO_QUERY_THROW );
-+ Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( xIf );
-+ // register the vba script events
-+ if ( m_xEventAttacher.is() )
-+ {
-+ m_xEventAttacher->registerScriptEvents( _nIndex, vbaEvents );
-+ }
-+ }
-+ catch( Exception& e ){ OSL_TRACE("lcl_fakevbaevents - Caught Exception trying to create control eventstuff "); }
-+ }
-+
-+ }
-+ }
-+ catch( Exception& e )
-+ {
-+ }
-+
-+}
- //==================================================================
- //= ElementDescription
- //==================================================================
-@@ -726,6 +806,7 @@ void OInterfaceContainer::approveNewElem
- void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XPropertySet >& _rxElement,
- sal_Bool _bEvents, ElementDescription* _pApprovalResult, sal_Bool _bFire ) throw( IllegalArgumentException )
- {
-+ OSL_TRACE("OInterfaceContainer::implInsert( %d)", _nIndex );
- RTL_LOGFILE_CONTEXT( aLogger, "forms::OInterfaceContainer::implInsert" );
-
- ::osl::ClearableMutexGuard aGuard( m_rMutex );
-@@ -775,6 +856,23 @@ void OInterfaceContainer::implInsert(sal
- {
- m_xEventAttacher->insertEntry(_nIndex);
- m_xEventAttacher->attach( _nIndex, pElementMetaData->xInterface, makeAny( _rxElement ) );
-+ // insert fake events?
-+ Reference< XEventAttacherManager > xMgr ( pElementMetaData->xInterface, UNO_QUERY );
-+ if ( xMgr.is() )
-+ {
-+ OInterfaceContainer* pIfcMgr = dynamic_cast< OInterfaceContainer* >( xMgr.get() );
-+ sal_Int32 nLen = getCount();
-+ for ( sal_Int32 i = 0; (i < nLen) && pIfcMgr ; ++i )
-+ {
-+ // add fake events to the control at index i
-+ pIfcMgr->fakeVbaEventsHack( i );
-+ }
-+ }
-+ else
-+ {
-+ // add fake events to the control at index i
-+ fakeVbaEventsHack( _nIndex );
-+ }
- }
-
- // notify derived classes
-@@ -1054,20 +1152,29 @@ void SAL_CALL OInterfaceContainer::remov
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::registerScriptEvent( sal_Int32 nIndex, const ScriptEventDescriptor& aScriptEvent ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** registerScriptEvent %d", nIndex);
- if ( m_xEventAttacher.is() )
-+ {
- m_xEventAttacher->registerScriptEvent( nIndex, aScriptEvent );
-+ fakeVbaEventsHack( nIndex ); // add fake vba events
-+ }
- }
-
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::registerScriptEvents( sal_Int32 nIndex, const Sequence< ScriptEventDescriptor >& aScriptEvents ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** registerScriptEvent(s) %d", nIndex);
- if ( m_xEventAttacher.is() )
-+ {
- m_xEventAttacher->registerScriptEvents( nIndex, aScriptEvents );
-+ fakeVbaEventsHack( nIndex ); // add fake vba events
-+ }
- }
-
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** revokeScriptEvent %d listenertype %s, eventMethod %s", nIndex, rtl::OUStringToOString( aListenerType, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( aEventMethod, RTL_TEXTENCODING_UTF8 ).getStr());
- if ( m_xEventAttacher.is() )
- m_xEventAttacher->revokeScriptEvent( nIndex, aListenerType, aEventMethod, aRemoveListenerParam );
- }
-@@ -1096,9 +1203,16 @@ void SAL_CALL OInterfaceContainer::remov
- //------------------------------------------------------------------------
- Sequence< ScriptEventDescriptor > SAL_CALL OInterfaceContainer::getScriptEvents( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("getScriptEvents");
- Sequence< ScriptEventDescriptor > aReturn;
- if ( m_xEventAttacher.is() )
-+ {
- aReturn = m_xEventAttacher->getScriptEvents( nIndex );
-+ if ( lcl_hasVbaEvents( aReturn ) )
-+ {
-+ aReturn = lcl_stripVbaEvents( aReturn );
-+ }
-+ }
- return aReturn;
- }
-
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/forms/source/misc/makefile.mk forms/source/misc/makefile.mk
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/forms/source/misc/makefile.mk 2005-09-09 00:01:56.000000000 +0100
-+++ forms/source/misc/makefile.mk 2008-03-28 10:30:34.000000000 +0000
-@@ -48,6 +48,7 @@ ENABLE_EXCEPTIONS=TRUE
- # --- Types -------------------------------------
-
- INCPRE+=$(SOLARINCDIR)$/offuh
-+INCPRE*=$(INCCOM)$/$(TARGET)
-
- # --- Files -------------------------------------
-
-@@ -65,3 +66,12 @@ SLOFILES= $(SLO)$/limitedformats.obj \
-
- .INCLUDE : target.mk
-
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/scripting/source/dlgprov/dlgevtatt.hxx scripting/source/dlgprov/dlgevtatt.hxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/scripting/source/dlgprov/dlgevtatt.hxx 2008-03-29 23:07:53.000000000 +0000
-+++ scripting/source/dlgprov/dlgevtatt.hxx 2008-03-28 12:09:13.000000000 +0000
-@@ -68,6 +68,9 @@
- #include <com/sun/star/script/XScriptEventsSupplier.hpp>
-
- #include <hash_map>
-+
-+#define FAKE_VBA_EVENT_SUPPORT 1
-+
- //.........................................................................
- namespace dlgprov
- {
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/scripting/source/vbaevents/eventhelper.cxx 2008-04-08 14:28:35.000000000 +0100
-+++ scripting/source/vbaevents/eventhelper.cxx 2008-04-03 13:28:01.000000000 +0100
-@@ -23,6 +23,7 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
-
- #include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XDialog.hpp>
- #include <com/sun/star/awt/KeyEvent.hpp>
- #include <com/sun/star/awt/MouseEvent.hpp>
-
-@@ -94,7 +95,7 @@ Sequence< ::rtl::OUString> getEventMetho
- return aNames;
- }
-
--// for debug only ( conditionalize out? )
-+#if 0
- void dumpListeners( const Reference< beans::XIntrospection >& xIntrospection, const Reference<XInterface>& xIfc)
- {
- Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
-@@ -164,6 +165,7 @@ void dumpEvent( const ScriptEvent& evt )
- }
- }
-
-+#endif
-
- bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params )
- {
-@@ -277,6 +279,9 @@ EventInfoHash& getEventTransInfo()
- info.sVBAName = rtl::OUString::createFromAscii("_Click");
- info.toVBA = NULL;
- actionInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ actionInfos.push_back( info );
- eventTransInfo[ rtl::OUString::createFromAscii("actionPerformed") ] = actionInfos;
- // changed ooo event
- std::list< TranslateInfo > changeInfos;
-@@ -336,7 +341,7 @@ EventInfoHash& getEventTransInfo()
- eventTransInfo[ rtl::OUString::createFromAscii("mousePressed") ] = mousePressedInfos;
- // mouseMoved ooo event
- std::list< TranslateInfo > mouseMovedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_MouseMoved");
-+ info.sVBAName = rtl::OUString::createFromAscii("_MouseMove");
- info.toVBA = ooMouseEvtToVBAMouseEvt;
- mouseMovedInfos.push_back( info );
- eventTransInfo[ rtl::OUString::createFromAscii("mouseMoved") ] = mouseMovedInfos;
-@@ -393,41 +398,17 @@ eventMethodToDescriptors( const ::rtl::O
- EventInfoHash::const_iterator eventInfo_it = infos.find( sMethodName );
- EventInfoHash::const_iterator it_end = infos.end();
-
-- // sLibModName ( could ) include the uri bits :-) from calc
-- rtl::OUString sPartialMacroName = sLibModName + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$macro"));
--
-- if ( sMethodName.getLength()
-- && sTypeName.getLength()
-- && ( infos.find( sMethodName ) != infos.end() ) )
-+ if ( infos.find( sMethodName ) != infos.end() )
- {
-- std::list< TranslateInfo >::const_iterator txInfo =
-- eventInfo_it->second.begin();
-- std::list< TranslateInfo >::const_iterator txInfo_end =
-- eventInfo_it->second.end();
-- for ( ; txInfo != txInfo_end; ++txInfo )
-- {
-- // Check if extension is support for this method, if
-- // so create an eventdescription for that
-- const rtl::OUString* pExt = sHandlerExts.getConstArray();
-- sal_Int32 nCount = sHandlerExts.getLength();
-- for ( sal_Int32 counter=0; counter<nCount; ++counter, ++pExt )
-- {
-- if ( (*txInfo).sVBAName.equals( *pExt ) ) // handler for event
-- {
-- sal_Int32 nIndex = evtDescs.getLength();
-- evtDescs.realloc( evtDescs.getLength() + 1 );
-- evtDescs[ nIndex ].ScriptCode = sPartialMacroName + *pExt;
-- evtDescs[ nIndex ].ListenerType = sTypeName;
-- evtDescs[ nIndex ].EventMethod = sMethodName;
--
-- // set this it VBAInterop, ensures that it doesn't
-- // get persisted or shown in property editors
-- evtDescs[ nIndex ].ScriptType = rtl::OUString::createFromAscii( "VBAInterop" );
-- }
-- }
-- }
-+ sal_Int32 nIndex = evtDescs.getLength();
-+ evtDescs.realloc( evtDescs.getLength() + 1 );
-+ evtDescs[ nIndex ].ScriptType = rtl::OUString::createFromAscii( "VBAInterop" );
-+ evtDescs[ nIndex ].ScriptCode = sLibModName; // codeName
-+ evtDescs[ nIndex ].ListenerType = sTypeName;
-+ evtDescs[ nIndex ].EventMethod = sMethodName;
- return true;
- }
-+
- return false;
-
- }
-@@ -522,8 +503,10 @@ ScriptEventFactory::getEventListeners( c
- Reference< beans::XIntrospection > xIntrospection(
- xMFac->createInstanceWithContext( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ), instance().m_xCtx ), UNO_QUERY );
-- //dumpListeners( xIntrospection, xControl );
-- //dumpListeners( xIntrospection, xControl->getModel() );
-+#if 0
-+ dumpListeners( xIntrospection, xControl );
-+ dumpListeners( xIntrospection, xControl->getModel() );
-+#endif
- Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
- if ( xIntrospection.is() )
- {
-@@ -583,7 +566,8 @@ ScriptEventFactory::createEvents( const
- ::rtl::OUString sNoNameSpaceMethod = *pSrc;
- if ( ( lastDotIndex = pSrc->lastIndexOf( '.' ) ) > -1 )
- sNoNameSpaceMethod = sNoNameSpaceMethod.copy( lastDotIndex + 1 );
-- Sequence< ScriptEventDescriptor> evtDescs;
-+
-+ Sequence< ScriptEventDescriptor > evtDescs;
- if ( eventMethodToDescriptors( sNoNameSpaceMethod, xControl, sLibModName, sHandlerExts, evtDescs ) )
- {
- sal_Int32 dIndex = nEvts;
-@@ -826,13 +810,28 @@ EventListener::getPropertySetInfo( ) th
- void
- EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeException)
- {
-- OSL_TRACE("EventListener::firing_Impl !!!");
-+ OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )");
- static const ::rtl::OUString vbaInterOp =
- ::rtl::OUString::createFromAscii("VBAInterop");
-
- // let default handlers deal with non vba stuff
- if ( !evt.ScriptType.equals( vbaInterOp ) )
- return;
-+ lang::EventObject aEvent;
-+ evt.Arguments[ 0 ] >>= aEvent;
-+ OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("Getting Control");
-+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
-+ OSL_TRACE("Getting properties");
-+ uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sName;
-+ OSL_TRACE("Getting Name");
-+
-+ uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY );
-+ if ( xDlg.is() )
-+ sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm") );
-+ else
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
- //dumpEvent( evt );
- EventInfoHash& infos = getEventTransInfo();
- EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName );
-@@ -858,14 +857,11 @@ EventListener::firing_Impl(const ScriptE
- {
- // see if we have a match for the handlerextension
- // where ScriptCode is methodname_handlerextension
-- rtl::OUString sTemp = evt.ScriptCode;
-- sal_Int32 lastIndexOf_ = sTemp.lastIndexOf( '_' );
-- if ( lastIndexOf_ != -1 )
-- sTemp = sTemp.copy( lastIndexOf_ );
-- OSL_TRACE("*** trying to match %s with %s",
-- rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr(),
-- rtl::OUStringToOString( (*txInfo).sVBAName, RTL_TEXTENCODING_UTF8 ).getStr() );
-- if ( sTemp.equals( (*txInfo).sVBAName ) )
-+ rtl::OUString sTemp = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") ).concat( sName ).concat( (*txInfo).sVBAName );
-+
-+ OSL_TRACE("*** trying to invoke %s ",
-+ rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ //if ( sTemp.equals( (*txInfo).sVBAName ) )
- {
- // !! translate arguments & emulate events where necessary
- Sequence< Any > aArguments;
-@@ -881,7 +877,7 @@ EventListener::firing_Impl(const ScriptE
- static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-
- // create script url
-- rtl::OUString url = part1 + evt.ScriptCode + part2;
-+ rtl::OUString url = part1 + sTemp + part2;
-
- OSL_TRACE("script url = %s",
- rtl::OUStringToOString( url,
-@@ -893,16 +889,7 @@ EventListener::firing_Impl(const ScriptE
- {
- uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
- if ( xScript.is() )
-- {
-- uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-- if ( xProps.is() )
-- {
-- Sequence< Any > aCallerHack(1);
-- aCallerHack[ 0 ] = uno::makeAny( rtl::OUString::createFromAscii("Error") );
-- xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
-- }
-- xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
-- }
-+ xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
- }
- catch ( uno::Exception& e )
- {
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/docshell/vbaevents.cxx 2008-04-08 14:28:35.000000000 +0100
-+++ sc/source/ui/docshell/vbaevents.cxx 2008-04-06 18:32:45.000000000 +0100
-@@ -60,11 +60,7 @@ const static rtl::OUString sUrlPart2 = r
- rtl::OUString sCodeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
- if ( pShell )
- {
-- if ( ScExtDocOptions* pExtDocOpts = pShell->GetDocument()->GetExtDocOptions() )
-- {
-- if ( pExtDocOpts->GetDocSettings().maGlobCodeName.Len() > 0 )
-- sCodeName = pExtDocOpts->GetDocSettings().maGlobCodeName;
-- }
-+ pShell->GetDocument()->GetCodeName();
- }
- return sCodeName;
- }
-@@ -103,6 +99,8 @@ bool executeWorkBookMacro( ScDocShell* p
- String docMacroExists( ScDocShell* pShell,
- const String& sMod, const String& sMacro )
- {
-+OSL_TRACE( "*** docMacroExists for macro %s, module ->%s<-",
-+ rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr() );
- String sFullName;
- // would use the script provider to see if the macro exists but
- // called at this stage tdoc content handler stuff is not set up
-@@ -137,7 +135,8 @@ const String& sMod, const String& sMacro
- }
- }
- }
-- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ //else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_DONTCARE ) ) )
- {
- if( SbModule* pModule = pMethod->GetModule() )
- {
-@@ -159,7 +158,8 @@ bool processDocBeforeCloseMacro( ScDocSh
- bool bCancel = sal_False;
- aArgs[ 0 ] <<= bCancel;
- const static String sBeforeClose( RTL_CONSTASCII_USTRINGPARAM("Workbook_BeforeClose") );
-- String sFullClose = docMacroExists( pShell, String(), sBeforeClose );
-+ rtl::OUString workbookModule = getWorkbookModuleName( pShell );
-+ String sFullClose = docMacroExists( pShell, workbookModule, sBeforeClose );
- if ( sFullClose.Len() > 0 )
- {
- if ( !executeWorkBookMacro( pShell, sFullClose, aArgs, aRet ) )
-@@ -224,8 +224,8 @@ bool processDocOpenMacro( ScDocShell* pS
- // until ObjectModules ( and persisting of codename ) are supported if this is a
- // document saved from XL then we won't be able to determine the codename for the Workbook
- // Module, so... we have no choice but to search all modules for the moment
-- //rtl::OUString workbookModule = getWorkbookModuleName( pShell );
-- rtl::OUString workbookModule; // no name means all modules will be searched
-+ rtl::OUString workbookModule = getWorkbookModuleName( pShell );
-+ //rtl::OUString workbookModule; // no name means all modules will be searched
- String sFullOpen = docMacroExists( pShell, workbookModule, sOpenMacro );
- if ( sFullOpen.Len() > 0 )
- {
-@@ -316,12 +316,8 @@ uno::Any createRange( const uno::Any& aR
-
- String getSheetModuleName( ScDocShell* pShell, SCTAB nTab )
- {
-- ScExtDocOptions* pExtOptions = pShell->GetDocument()->GetExtDocOptions();
- String aCodeName;
-- pShell->GetDocument()->GetName( nTab, aCodeName);
-- // Use code name if that exists
-- if ( pExtOptions )
-- aCodeName = pExtOptions->GetCodeName( nTab );
-+ pShell->GetDocument()->GetCodeName( nTab, aCodeName);
- return aCodeName;
- }
-
--- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/toolkit/source/controls/unocontrols.cxx 2008-01-24 15:30:00.000000000 +0000
+++ toolkit/source/controls/unocontrols.cxx 2008-04-11 11:07:03.000000000 +0100
@@ -1887,6 +1887,77 @@ sal_Bool UnoGroupBoxControl::isTranspare
@@ -3395,3 +2562,124 @@
// bulletinboard
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
{
+--- sc/source/core/tool/vbaeventshelper.cxx 2008-05-12 17:34:02.000000000 +0100
++++ sc/source/core/tool/vbaeventshelper.cxx 2008-05-12 17:44:52.000000000 +0100
+@@ -204,11 +204,10 @@ VbaWindowListener::disposing( const lan
+
+ String ScVbaEventsHelper::getWorkbookModuleName()
+ {
+- String sCodeName( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
++ String sCodeName; // leave blank to force a search of all modules
+ if ( ScExtDocOptions* pExtDocOpts = pDoc->GetExtDocOptions() )
+ {
+- if ( pExtDocOpts->GetDocSettings().maGlobCodeName.Len() > 0 )
+- sCodeName = pExtDocOpts->GetDocSettings().maGlobCodeName;
++ sCodeName = pDoc->GetCodeName();
+ }
+ return sCodeName;
+ }
+@@ -305,7 +304,8 @@ sal_Bool ScVbaEventsHelper::processDocBe
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] <<= bCancel;
+ const static String sBeforeClose( RTL_CONSTASCII_USTRINGPARAM("Workbook_BeforeClose") );
+- String sFullClose = docMacroExists( pShell, String(), sBeforeClose );
++ rtl::OUString workbookModule = getWorkbookModuleName();
++ String sFullClose = docMacroExists( pShell, workbookModule, sBeforeClose );
+ if ( sFullClose.Len() > 0 )
+ {
+ if ( !executeWorkBookMacro( pShell, sFullClose, aArgs, aRet ) )
+@@ -512,12 +512,11 @@ void ScVbaEventsHelper::getSheetEventNam
+
+ String ScVbaEventsHelper::getSheetModuleName( SCTAB nTab )
+ {
+- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
+- String aCodeName;
+- pDoc->GetName( nTab, aCodeName);
++ String aCodeName; // leave blank to force full search
+ // Use code name if that exists
+- if ( pExtOptions )
+- aCodeName = pExtOptions->GetCodeName( nTab );
++ if ( ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions() )
++ // for an imported excel doc we always have the codename
++ pDoc->GetCodeName( nTab, aCodeName );
+ return aCodeName;
+ }
+
+@@ -649,7 +648,8 @@ sal_Bool ScVbaEventsHelper::processDocBe
+ sal_Bool bCancel = sal_False;
+ aArgs[ 0 ] <<= bCancel;
+ const static String sBeforeClose( RTL_CONSTASCII_USTRINGPARAM("Workbook_BeforePrint") );
+- String sFullClose = docMacroExists( pShell, String(), sBeforeClose );
++ rtl::OUString workbookModule = getWorkbookModuleName();
++ String sFullClose = docMacroExists( pShell, workbookModule, sBeforeClose );
+ if ( sFullClose.Len() > 0 )
+ {
+ if ( !executeWorkBookMacro( pShell, sFullClose, aArgs, aRet ) )
+@@ -667,7 +667,8 @@ void ScVbaEventsHelper::processDocNewShe
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[0] = aElement;
+ const static String sNewSheet( RTL_CONSTASCII_USTRINGPARAM("Workbook_NewSheet") );
+- String sFullClose = docMacroExists( pShell, String(), sNewSheet );
++ rtl::OUString workbookModule = getWorkbookModuleName();
++ String sFullClose = docMacroExists( pShell, workbookModule, sNewSheet );
+ if ( sFullClose.Len() > 0 )
+ {
+ executeWorkBookMacro( pShell, sFullClose, aArgs, aRet );
+@@ -702,7 +703,8 @@ void ScVbaEventsHelper::processWindowMac
+ {
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[0] = aElement;
+- String sMacro = docMacroExists( pShell, String(), sFuncName );
++ rtl::OUString workbookModule = getWorkbookModuleName();
++ String sMacro = docMacroExists( pShell, workbookModule, sFuncName );
+ if ( sMacro.Len() > 0 )
+ {
+ executeWorkBookMacro( pShell, sMacro, aArgs, aRet );
+@@ -767,7 +769,7 @@ sal_Bool ScVbaEventsHelper::processDocAc
+ sal_Bool result = sal_True;
+ const static rtl::OUString sAtctivateMacro( RTL_CONSTASCII_USTRINGPARAM("Workbook_Activate") );
+ const static rtl::OUString sOnFocusEvt( RTL_CONSTASCII_USTRINGPARAM("OnFocus") );
+- rtl::OUString sWorkbookModule;
++ rtl::OUString sWorkbookModule = getWorkbookModuleName();
+ String sFullOnFocus = docMacroExists( pShell, sWorkbookModule, sAtctivateMacro );
+ if( sFullOnFocus.Len() > 0 )
+ {
+@@ -782,7 +784,7 @@ sal_Bool ScVbaEventsHelper::processDocDe
+ sal_Bool result = sal_True;
+ const static rtl::OUString sDeatctivateMacro( RTL_CONSTASCII_USTRINGPARAM("Workbook_Deactivate") );
+ const static rtl::OUString sOnFocusEvt( RTL_CONSTASCII_USTRINGPARAM("OnUnfocus") );
+- rtl::OUString sWorkbookModule;
++ rtl::OUString sWorkbookModule = getWorkbookModuleName();
+ String sFullUnOnfocus = docMacroExists( pShell, sWorkbookModule, sDeatctivateMacro );
+ if( sFullUnOnfocus.Len() > 0 )
+ {
+@@ -797,7 +799,8 @@ void ScVbaEventsHelper::processDocDeacti
+ uno::Any aRet;
+ uno::Sequence< uno::Any > aArgs;
+ const static String sDeactivate( RTL_CONSTASCII_USTRINGPARAM("Workbook_Deactivate") );
+- String sDeactivateMacro = docMacroExists( pShell, String(), sDeactivate );
++ rtl::OUString sWorkbookModule = getWorkbookModuleName();
++ String sDeactivateMacro = docMacroExists( pShell, sWorkbookModule, sDeactivate );
+ if ( sDeactivateMacro.Len() > 0 )
+ {
+ executeWorkBookMacro( pShell, sDeactivateMacro, aArgs, aRet );
+@@ -853,7 +856,8 @@ sal_Bool ScVbaEventsHelper::processDocBe
+ aArgs[ 0 ] <<= bSaveAsUI;
+ aArgs[ 1 ] <<= bCancel;
+ const static String sBeforeClose( RTL_CONSTASCII_USTRINGPARAM("Workbook_BeforeSave") );
+- String sFullClose = docMacroExists( pShell, String(), sBeforeClose );
++ rtl::OUString workbookModule = getWorkbookModuleName();
++ String sFullClose = docMacroExists( pShell, workbookModule, sBeforeClose );
+ if ( sFullClose.Len() > 0 )
+ {
+ if ( !executeWorkBookMacro( pShell, sFullClose, aArgs, aRet ) )
+@@ -880,8 +884,7 @@ sal_Bool ScVbaEventsHelper::processDocOp
+ // until ObjectModules ( and persisting of codename ) are supported if this is a
+ // document saved from XL then we won't be able to determine the codename for the Workbook
+ // Module, so... we have no choice but to search all modules for the moment
+- //rtl::OUString workbookModule = getWorkbookModuleName( pShell );
+- rtl::OUString workbookModule; // no name means all modules will be searched
++ rtl::OUString workbookModule = getWorkbookModuleName();
+ String sFullOpen = docMacroExists( pShell, workbookModule, sOpenMacro );
+ if ( sFullOpen.Len() > 0 )
+ {
Modified: trunk/patches/vba/vbaevents-services-sources.diff
==============================================================================
--- trunk/patches/vba/vbaevents-services-sources.diff (original)
+++ trunk/patches/vba/vbaevents-services-sources.diff Mon May 12 16:23:31 2008
@@ -60,8 +60,8 @@
+
+.INCLUDE : target.mk
--- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ scripting/source/vbaevents/eventhelper.cxx 2008-04-30 17:50:07.000000000 +0100
-@@ -0,0 +1,977 @@
++++ scripting/source/vbaevents/eventhelper.cxx 2008-05-09 12:06:59.000000000 +0100
+@@ -0,0 +1,919 @@
+#include <comphelper/processfactory.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/proparrhlp.hxx>
@@ -111,6 +111,7 @@
+#include <com/sun/star/script/XScriptListener.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
++#include <comphelper/evtlistenerhlp.hxx>
+
+#include <set>
+#include <list>
@@ -126,39 +127,6 @@
+const static rtl::OUString DELIM = rtl::OUString::createFromAscii( "::" );
+const static sal_Int32 DELIMLEN = DELIM.getLength();
+
-+// Helper Methods
-+
-+// TODO this method now appears/is-defined in at least three places
-+// svx/source/forms/fmtools.cxx extensions/source/propctrlr/formcontroller.cxx
-+// and here. We must do better than that
-+Sequence< ::rtl::OUString> getEventMethods(const Type& type)
-+{
-+ typelib_InterfaceTypeDescription *pType=0;
-+ type.getDescription( (typelib_TypeDescription**)&pType);
-+
-+ if(!pType)
-+ return Sequence< ::rtl::OUString>();
-+
-+ Sequence< ::rtl::OUString> aNames(pType->nMembers);
-+ ::rtl::OUString* pNames = aNames.getArray();
-+ for(sal_Int32 i=0;i<pType->nMembers;i++,++pNames)
-+ {
-+ // the decription reference
-+ typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
-+ // the description for the reference
-+ typelib_TypeDescription* pMemberDescription = NULL;
-+ typelib_typedescriptionreference_getDescription(&pMemberDescription, pMemberDescriptionReference);
-+ if (pMemberDescription)
-+ {
-+ typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
-+ reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
-+ *pNames = pRealMemberDescription->pMemberName;
-+ }
-+ }
-+ typelib_typedescription_release( (typelib_TypeDescription *)pType );
-+ return aNames;
-+}
-+
+#if 0
+void dumpListeners( const Reference< beans::XIntrospection >& xIntrospection, const Reference<XInterface>& xIfc)
+{
@@ -181,7 +149,7 @@
+ {
+ sTypeName = sFullTypeName.copy( lastDotIndex + 1 );
+ }
-+ Sequence< ::rtl::OUString > sMeths = getEventMethods( listType );
++ Sequence< ::rtl::OUString > sMeths = comphelper::EventHelper::getEventMethodsForType( listType );
+ sal_Int32 sMethLen = sMeths.getLength();
+ for ( sal_Int32 j=0 ; j < sMethLen; ++j )
+ {
@@ -425,16 +393,15 @@
+
+// Helper class
+
-+class ScriptEventFactory
++class ScriptEventHelper
+{
+public:
-+ static Sequence< ScriptEventDescriptor > createEvents( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName );
-+ static ScriptEventFactory& instance() { static ScriptEventFactory inst; return inst; }
-+ static rtl::OUString getControlName( const Reference< XInterface >& xControl );
-+ static Sequence< rtl::OUString > getEventListeners( const Reference< XInterface >& xControl );
++ ScriptEventHelper( const Reference< XInterface >& xControl );
++ Sequence< ScriptEventDescriptor > createEvents( const rtl::OUString& sCodeName );
++ Sequence< rtl::OUString > getEventListeners();
+private:
-+ ScriptEventFactory();
+ Reference< XComponentContext > m_xCtx;
++ Reference< XInterface > m_xControl;
+};
+
+bool
@@ -479,7 +446,7 @@
+
+}
+
-+ScriptEventFactory::ScriptEventFactory()
++ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ) : m_xControl( xControl )
+{
+ Reference < beans::XPropertySet > xProps(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
@@ -487,55 +454,28 @@
+ RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
+ uno::UNO_QUERY_THROW );
+}
-+rtl::OUString
-+ScriptEventFactory::getControlName( const Reference< XInterface >& rXControl )
-+{
-+ Reference< XInterface > xIfModel;
-+ Reference< awt::XControl > xControl( rXControl, UNO_QUERY );
-+ if ( xControl.is() )
-+ xIfModel = xControl->getModel();
-+ else
-+ xIfModel = rXControl;
-+
-+ Reference< beans::XPropertySet > xProps( xIfModel, UNO_QUERY );
-+ ::rtl::OUString sName;
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ xProps->getPropertyValue(
-+ ::rtl::OUString::createFromAscii("Name") ) >>= sName;
-+ }
-+ catch(Exception& e)
-+ {
-+ OSL_TRACE("PropertyStuff mucked up no name got exception: %s",
-+ (const sal_Char *) rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ));
-+ }
-+ }
-+ return sName;
-+}
+
+Sequence< rtl::OUString >
-+ScriptEventFactory::getEventListeners( const Reference< XInterface >& xControl )
++ScriptEventHelper::getEventListeners()
+{
+ Reference< lang::XMultiComponentFactory > xMFac(
-+ instance().m_xCtx->getServiceManager(), UNO_QUERY );
++ m_xCtx->getServiceManager(), UNO_QUERY );
+ std::list< rtl::OUString > eventMethods;
+
+ if ( xMFac.is() )
+ {
+ Reference< beans::XIntrospection > xIntrospection(
+ xMFac->createInstanceWithContext( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ), instance().m_xCtx ), UNO_QUERY );
++ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ), m_xCtx ), UNO_QUERY );
+#if 0
-+ dumpListeners( xIntrospection, xControl );
-+ dumpListeners( xIntrospection, xControl->getModel() );
++ dumpListeners( xIntrospection, m_xControl );
++ dumpListeners( xIntrospection, m_xControl->getModel() );
+#endif
+ Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
+ if ( xIntrospection.is() )
+ {
+ xIntrospectionAccess = xIntrospection->inspect(
-+ makeAny( xControl ) );
++ makeAny( m_xControl ) );
+ Sequence< Type > aControlListeners =
+ xIntrospectionAccess->getSupportedListeners();
+ sal_Int32 nLength = aControlListeners.getLength();
@@ -544,7 +484,7 @@
+ Type& listType = aControlListeners[ i ];
+ rtl::OUString sFullTypeName = listType.getTypeName();
+ Sequence< ::rtl::OUString > sMeths =
-+ getEventMethods( listType );
++ comphelper::EventHelper::getEventMethodsForType( listType );
+ sal_Int32 sMethLen = sMeths.getLength();
+ for ( sal_Int32 j=0 ; j < sMethLen; ++j )
+ {
@@ -569,9 +509,9 @@
+}
+
+Sequence< ScriptEventDescriptor >
-+ScriptEventFactory::createEvents( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName )
++ScriptEventHelper::createEvents( const rtl::OUString& sCodeName )
+{
-+ Sequence< rtl::OUString > aControlListeners = ScriptEventFactory::instance().getEventListeners( xControl );
++ Sequence< rtl::OUString > aControlListeners = getEventListeners();
+ rtl::OUString* pSrc = aControlListeners.getArray();
+ sal_Int32 nLength = aControlListeners.getLength();
+
@@ -755,7 +695,7 @@
+};
+
+EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
-+OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext )
++OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 )
+{
+ registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
+ beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
@@ -768,7 +708,7 @@
+ // reset mpShell
+ mpShell = 0;
+ SfxObjectShell* pShell = SfxObjectShell::GetFirst();
-+ while ( pShell )
++ while ( m_xModel.is() && pShell )
+ {
+ if ( pShell->GetModel() == m_xModel )
+ {
@@ -932,7 +872,7 @@
+ {
+ uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
+ if ( xScript.is() )
-+ xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
++ xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
+ }
+ catch ( uno::Exception& e )
+ {
@@ -965,15 +905,17 @@
+Sequence< ScriptEventDescriptor > SAL_CALL
+VBAToOOEventDescGen::getEventDescriptions( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (RuntimeException)
+{
-+ return ScriptEventFactory::instance().createEvents( xControl, sCodeName );
++ ScriptEventHelper evntHelper( xControl );
++ return evntHelper.createEvents( sCodeName );
+}
+
+Reference< XScriptEventsSupplier > SAL_CALL
+VBAToOOEventDescGen::getEventSupplier( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (::com::sun::star::uno::RuntimeException)
+{
++ ScriptEventHelper evntHelper( xControl );
+ Reference< XScriptEventsSupplier > xSupplier =
+ new ReadOnlyEventsSupplier(
-+ ScriptEventFactory::instance().getEventListeners( xControl ), sCodeName ) ;
++ evntHelper.getEventListeners(), sCodeName ) ;
+ return xSupplier;
+}
+
@@ -1185,6 +1127,29 @@
diff -rup scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
--- scripting/source/dlgprov/dlgevtatt.cxx 2008-04-29 13:37:12.000000000 +0100
+++ scripting/source/dlgprov/dlgevtatt.cxx 2008-04-28 22:20:38.000000000 +0100
+@@ -121,18 +121,20 @@ namespace dlgprov
+ DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext )
+ {
+ Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
++ Sequence< Any > args(1);
+ if ( xSMgr.is() )
+ {
+- Sequence< Any > args(1);
+ args[0] <<= xModel;
+ mxListener = Reference< XScriptListener >( xSMgr->createInstanceWithArgumentsAndContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.EventListener" ) ), args, m_xContext ), UNO_QUERY );
+ }
+ if ( rxControl.is() )
+ {
+- Reference< XPropertySet > xProps( rxControl->getModel(), UNO_QUERY );
+ try
+ {
++ Reference< XPropertySet > xProps( rxControl->getModel(), UNO_QUERY_THROW );
+ xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= msDialogCodeName;
++ xProps.set( mxListener, UNO_QUERY_THROW );
++ xProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ), args[ 0 ] );
+ }
+ catch ( Exception& ) {}
+ }
@@ -232,7 +232,7 @@ namespace dlgprov
return it->second;
}
@@ -1871,3 +1836,175 @@
void SAL_CALL
ScVbaWorksheet::setCodeName( const rtl::OUString& sCodeName ) throw (css::uno::RuntimeException)
{
+diff -up comphelper/source/misc/evtlistenerhlp.cxx comphelper.patched/source/misc/evtlistenerhlp.cxx
+--- comphelper/source/misc/evtlistenerhlp.cxx 2008-04-11 12:08:06.000000000 +0100
++++ comphelper/source/misc/evtlistenerhlp.cxx 2008-05-09 12:00:24.000000000 +0100
+@@ -32,8 +32,40 @@
+ #include "precompiled_comphelper.hxx"
+ #include "comphelper/evtlistenerhlp.hxx"
+
++using ::com::sun::star::uno::Sequence;
++using ::com::sun::star::uno::Type;
++
+ namespace comphelper
+ {
++
++ Sequence< ::rtl::OUString> EventHelper::getEventMethodsForType(const Type& type)
++ {
++ typelib_InterfaceTypeDescription *pType=0;
++ type.getDescription( (typelib_TypeDescription**)&pType);
++
++ if(!pType)
++ return Sequence< ::rtl::OUString>();
++
++ Sequence< ::rtl::OUString> aNames(pType->nMembers);
++ ::rtl::OUString* pNames = aNames.getArray();
++ for(sal_Int32 i=0;i<pType->nMembers;i++,++pNames)
++ {
++ // the decription reference
++ typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
++ // the description for the reference
++ typelib_TypeDescription* pMemberDescription = NULL;
++ typelib_typedescriptionreference_getDescription(&pMemberDescription, pMemberDescriptionReference);
++ if (pMemberDescription)
++ {
++ typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
++ reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
++ *pNames = pRealMemberDescription->pMemberName;
++ }
++ }
++ typelib_typedescription_release( (typelib_TypeDescription *)pType );
++ return aNames;
++ }
++
+ OEventListenerHelper::OEventListenerHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>&
+ _rxListener) : m_xListener(_rxListener)
+ {
+diff -up comphelper/inc/comphelper/evtlistenerhlp.hxx comphelper.patched/inc/comphelper/evtlistenerhlp.hxx
+--- comphelper/inc/comphelper/evtlistenerhlp.hxx 2008-04-11 11:29:59.000000000 +0100
++++ comphelper/inc/comphelper/evtlistenerhlp.hxx 2008-05-09 11:50:55.000000000 +0100
+@@ -39,6 +39,11 @@
+ //........................................................................
+ namespace comphelper
+ {
++ class COMPHELPER_DLLPUBLIC EventHelper
++ {
++ public:
++ static ::com::sun::star::uno::Sequence< ::rtl::OUString> getEventMethodsForType(const ::com::sun::star::uno::Type& type);
++ };
+ //........................................................................
+
+ //==========================================================================
+--- extensions/source/propctrlr/eventhandler.cxx 2008-04-11 11:47:33.000000000 +0100
++++ extensions/source/propctrlr/eventhandler.cxx 2008-05-09 15:08:21.000000000 +0100
+@@ -62,6 +62,7 @@
+ /** === end UNO includes === **/
+
+ #include <comphelper/namedvaluecollection.hxx>
++#include <comphelper/evtlistenerhlp.hxx>
+ #include <comphelper/types.hxx>
+ #include <cppuhelper/implbase1.hxx>
+ #include <rtl/ref.hxx>
+@@ -165,36 +166,6 @@ namespace pcr
+ namespace
+ {
+ //....................................................................
+- Sequence< ::rtl::OUString > lcl_getListenerMethodsForType( const Type& type )
+- {
+- typelib_InterfaceTypeDescription *pType=0;
+- type.getDescription( (typelib_TypeDescription**)&pType);
+-
+- if ( !pType )
+- return Sequence< ::rtl::OUString>();
+-
+- Sequence< ::rtl::OUString > aNames( pType->nMembers );
+- ::rtl::OUString* pNames = aNames.getArray();
+- for ( sal_Int32 i = 0; i < pType->nMembers; ++i, ++pNames)
+- {
+- // the decription reference
+- typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
+- // the description for the reference
+- typelib_TypeDescription* pMemberDescription = NULL;
+- typelib_typedescriptionreference_getDescription( &pMemberDescription, pMemberDescriptionReference );
+- if ( pMemberDescription )
+- {
+- typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
+- reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
+- *pNames = pRealMemberDescription->pMemberName;
+- }
+- }
+-
+- typelib_typedescription_release( (typelib_TypeDescription*)pType );
+- return aNames;
+- }
+-
+- //....................................................................
+ #define DESCRIBE_EVENT( asciinamespace, asciilistener, asciimethod, id_postfix ) \
+ s_aKnownEvents.insert( EventMap::value_type( \
+ ::rtl::OUString::createFromAscii( asciimethod ), \
+@@ -762,7 +733,7 @@ namespace pcr
+ continue;
+
+ // loop through all methods
+- Sequence< ::rtl::OUString > aMethods( lcl_getListenerMethodsForType( *pListeners ) );
++ Sequence< ::rtl::OUString > aMethods( comphelper::EventHelper::getEventMethodsForType( *pListeners ) );
+
+ const ::rtl::OUString* pMethods = aMethods.getConstArray();
+ sal_uInt32 methodCount = aMethods.getLength();
+--- svx/source/form/fmtools.cxx 2008-04-11 02:13:38.000000000 +0100
++++ svx/source/form/fmtools.cxx 2008-05-09 15:17:26.000000000 +0100
+@@ -105,6 +105,7 @@
+ #include <comphelper/uno3.hxx>
+ #include <connectivity/dbexception.hxx>
+ #include <comphelper/extract.hxx>
++#include <comphelper/evtlistenerhlp.hxx>
+ #include <cppuhelper/typeprovider.hxx>
+ #include <algorithm>
+
+@@ -719,36 +720,6 @@ sal_Int16 getControlTypeByObject(const R
+ return ::rtl::OUString();
+ }
+ //------------------------------------------------------------------------------
+-Sequence< ::rtl::OUString> getEventMethods(const Type& type)
+-{
+- typelib_InterfaceTypeDescription *pType=0;
+- type.getDescription( (typelib_TypeDescription**)&pType);
+-
+- if(!pType)
+- return Sequence< ::rtl::OUString>();
+-
+- Sequence< ::rtl::OUString> aNames(pType->nMembers);
+- ::rtl::OUString* pNames = aNames.getArray();
+- for(sal_Int32 i=0;i<pType->nMembers;i++,++pNames)
+- {
+- // the decription reference
+- typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
+- // the description for the reference
+- typelib_TypeDescription* pMemberDescription = NULL;
+- typelib_typedescriptionreference_getDescription(&pMemberDescription, pMemberDescriptionReference);
+- if (pMemberDescription)
+- {
+- typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
+- reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
+- *pNames = pRealMemberDescription->pMemberName;
+- }
+- }
+- typelib_typedescription_release( (typelib_TypeDescription *)pType );
+- return aNames;
+-}
+-
+-
+-//------------------------------------------------------------------------------
+ void TransferEventScripts(const Reference< ::com::sun::star::awt::XControlModel>& xModel, const Reference< ::com::sun::star::awt::XControl>& xControl,
+ const Sequence< ::com::sun::star::script::ScriptEventDescriptor>& rTransferIfAvailable)
+ {
+@@ -821,7 +792,8 @@ void TransferEventScripts(const Referenc
+ continue;
+
+ // now check the methods
+- Sequence< ::rtl::OUString> aMethodsNames = getEventMethods(*pCurrentListeners);
++ Sequence< ::rtl::OUString> aMethodsNames = ::comphelper::EventHelper::getEventMethodsForType(*pCurrentListeners);
++
+ const ::rtl::OUString* pMethodsNames = aMethodsNames.getConstArray();
+ for (k=0; k<aMethodsNames.getLength(); ++k, ++pMethodsNames)
+ {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]