ooo-build r13730 - in trunk: . patches/vba
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13730 - in trunk: . patches/vba
- Date: Fri, 29 Aug 2008 15:07:11 +0000 (UTC)
Author: noelpwer
Date: Fri Aug 29 15:07:11 2008
New Revision: 13730
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13730&view=rev
Log:
2008-08-29 Noel Power <noel power novell com>
* patches/vba/ObjectModule.diff: import some stuff from abandoned
native import patches, also fix for n#417320
* patches/vba/vba-userform.diff: various tweaks, fix yet another
initialize event cockup
* patches/vba/vba-workbook-worksheet-events.diff:
* patches/vba/enhanced-form-userform-controls.diff: allow named ranges
to be used for rowsource
Modified:
trunk/ChangeLog
trunk/patches/vba/ObjectModule.diff
trunk/patches/vba/enhanced-form-userform-controls.diff
trunk/patches/vba/vba-userform.diff
trunk/patches/vba/vba-workbook-worksheet-events.diff
Modified: trunk/patches/vba/ObjectModule.diff
==============================================================================
--- trunk/patches/vba/ObjectModule.diff (original)
+++ trunk/patches/vba/ObjectModule.diff Fri Aug 29 15:07:11 2008
@@ -2,7 +2,7 @@
index aed5958..3d79067 100644
--- basctl/source/basicide/basides1.cxx
+++ basctl/source/basicide/basides1.cxx
-@@ -1201,10 +1201,16 @@ IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const
+@@ -1201,10 +1201,16 @@ IDEBaseWindow* BasicIDEShell::FindWindow
// return any non-suspended window
return pWin;
}
@@ -25,7 +25,7 @@
index 76dcea0..90cec19 100644
--- basctl/source/basicide/basides2.cxx
+++ basctl/source/basicide/basides2.cxx
-@@ -251,9 +251,12 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
+@@ -251,9 +251,12 @@ ModulWindow* BasicIDEShell::CreateBasWin
if ( bSuccess )
{
@@ -41,7 +41,7 @@
}
}
else
-@@ -268,7 +271,8 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
+@@ -268,7 +271,8 @@ ModulWindow* BasicIDEShell::CreateBasWin
}
DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
}
@@ -137,7 +137,7 @@
TYPEINIT1( BasicIDEShell, SfxViewShell );
-@@ -124,6 +192,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell
+@@ -124,6 +192,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFra
m_bAppBasicModified( FALSE ),
m_aNotifier( *this )
{
@@ -158,7 +158,7 @@
// MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die
// ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war.
// GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
-@@ -935,7 +1010,15 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName,
+@@ -935,7 +1010,15 @@ void BasicIDEShell::SetCurLib( const Scr
{
if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
{
@@ -175,7 +175,7 @@
if ( bUpdateWindows )
UpdateWindows();
diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index d5990a4..408f88d 100644
+index fbe3f67..7e48d82 100644
--- basctl/source/basicide/scriptdocument.cxx
+++ basctl/source/basicide/scriptdocument.cxx
@@ -56,6 +56,7 @@
@@ -210,7 +210,26 @@
xLib->insertByName( _rNewName, aElement );
return true;
}
-@@ -1392,7 +1403,15 @@ namespace basctl
+@@ -738,8 +749,16 @@ namespace basctl
+ Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
+ if ( !xLib->hasByName( _rModName ) )
+ return false;
+-
+- xLib->replaceByName( _rModName, makeAny( _rModuleCode ) );
++ ModuleInfo mInfo;
++ Any aMod;
++ if ( xLib->getByName( _rModName ) >>= mInfo )
++ {
++ mInfo.ModuleSource = _rModuleCode;
++ aMod <<= mInfo;
++ }
++ else
++ aMod <<= _rModuleCode;
++ xLib->replaceByName( _rModName, aMod );
+ return true;
+ }
+ catch( const Exception& )
+@@ -1392,7 +1411,15 @@ namespace basctl
Any aCode;
if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) )
return false;
@@ -228,7 +247,7 @@
}
diff --git basctl/source/inc/basidesh.hxx basctl/source/inc/basidesh.hxx
-index 6b3690c..e34c58c 100644
+index 6b3690c..3919bd9 100644
--- basctl/source/inc/basidesh.hxx
+++ basctl/source/inc/basidesh.hxx
@@ -49,6 +49,7 @@
@@ -239,7 +258,7 @@
//----------------------------------------------------------------------------
-@@ -107,6 +108,8 @@ friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const Strin
+@@ -107,6 +108,8 @@ friend bool BasicIDE::RemoveDialog( cons
BOOL m_bAppBasicModified;
::basctl::DocumentEventNotifier
m_aNotifier;
@@ -296,10 +315,10 @@
#ifndef __SB_SBMODULEREF_HXX
diff --git basic/inc/basic/sbobjmod.hxx basic/inc/basic/sbobjmod.hxx
new file mode 100644
-index 0000000..7a8f096
+index 0000000..cb581c1
--- /dev/null
+++ basic/inc/basic/sbobjmod.hxx
-@@ -0,0 +1,65 @@
+@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -355,6 +374,7 @@
+ SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
+ SbxVariable* GetObject();
++ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
+};
+
+#ifndef __SB_SBOBJMODULEREF_HXX
@@ -405,10 +425,18 @@
// #60175 TRUE: SFX-Resource wird bei Basic-Fehlern nicht angezogen
static void StaticSuppressSfxResource( BOOL bSuppress );
diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index 73eb4cb..931498e 100644
+index 73eb4cb..1c8962c 100644
--- basic/source/basmgr/basmgr.cxx
+++ basic/source/basmgr/basmgr.cxx
-@@ -67,6 +67,8 @@
+@@ -44,6 +44,7 @@
+ #include <tools/debug.hxx>
+ #include <tools/diagnose_ex.h>
+ #include <basic/sbmod.hxx>
++#include <basic/sbobjmod.hxx>
+
+ #include <basic/sbuno.hxx>
+ #include <basic/basmgr.hxx>
+@@ -67,6 +68,8 @@
#include <com/sun/star/script/XStarBasicDialogInfo.hpp>
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
@@ -417,7 +445,7 @@
#include <cppuhelper/implbase1.hxx>
-@@ -243,9 +245,18 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
+@@ -243,9 +246,18 @@ void BasMgrContainerListenerImpl::addLib
{
::rtl::OUString aModuleName = pNames[ j ];
Any aElement = xLibNameAccess->getByName( aModuleName );
@@ -439,7 +467,7 @@
}
}
-@@ -282,8 +293,6 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
+@@ -282,8 +294,6 @@ void SAL_CALL BasMgrContainerListenerImp
}
else
{
@@ -448,7 +476,7 @@
StarBASIC* pLib = mpMgr->GetLib( maLibName );
DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::elementInserted: Unknown lib!");
-@@ -292,7 +301,17 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
+@@ -292,7 +302,17 @@ void SAL_CALL BasMgrContainerListenerImp
SbModule* pMod = pLib->FindModule( aName );
if( !pMod )
{
@@ -467,34 +495,43 @@
pLib->SetModified( FALSE );
}
}
-@@ -318,13 +337,23 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const ContainerEvent
+@@ -316,15 +336,35 @@ void SAL_CALL BasMgrContainerListenerImp
+ DBG_ASSERT( !bLibContainer, "library container fired elementReplaced()");
+
StarBASIC* pLib = mpMgr->GetLib( maLibName );
++
if( pLib )
{
- SbModule* pMod = pLib->FindModule( aName );
-- ::rtl::OUString aMod;
++ SbModule* pMod = pLib->FindModule( aName );
+ ::rtl::OUString aMod;
- Event.Element >>= aMod;
-- if( pMod )
-- pMod->SetSource32( aMod );
++ ModuleInfo mInfo;
++ if( Event.Element >>= mInfo )
++ aMod = mInfo.ModuleSource;
++ else
++ Event.Element >>= aMod;
+ if( pMod )
++ {
+ pMod->SetSource32( aMod );
- else
- pLib->MakeModule32( aName, aMod );
-+ ModuleInfo mInfo;
-+ if( Event.Element >>= mInfo )
-+ {
-+ OSL_TRACE("#elementReplaced Mod");
-+ pLib->MakeModule32( mInfo );
-+ }
++ if ( mInfo.ModuleType == ModuleType::Document )
++ {
++ SbObjModule* pObjModule = dynamic_cast< SbObjModule* >( pMod );
++ if ( pObjModule )
++ pObjModule->SetUnoObject( makeAny( mInfo.ModuleObject ) );
++ }
++ }
+ else
-+ {
-+ SbModule* pMod = pLib->FindModule( aName );
-+
-+ ::rtl::OUString aMod;
-+ Event.Element >>= aMod;
-+ if( pMod )
-+ pMod->SetSource32( aMod );
-+ else
-+ pLib->MakeModule32( aName, aMod );
-+ }
++ // Probably we should have an assert for
++ // unknow module type, e.g. either we are using
++ // the ModuleInfo structure ( vba ) for *all* modules
++ // or not ( normal )
++ if ( mInfo.ModuleType == ModuleType::Unknown )
++ pLib->MakeModule32( aName, aMod );
++ else
++ pLib->MakeModule32( mInfo );
pLib->SetModified( FALSE );
}
@@ -520,7 +557,7 @@
// #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE )
SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
-@@ -249,6 +254,8 @@ SbxObject* SbiFactory::CreateObject( const String& rClass )
+@@ -249,6 +254,8 @@ SbxObject* SbiFactory::CreateObject( con
else
if( rClass.EqualsIgnoreCaseAscii( "Collection" ) )
{
@@ -529,7 +566,7 @@
String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
return new BasicCollection( aCollectionName );
}
-@@ -446,6 +453,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
+@@ -446,6 +453,7 @@ SbClassModuleObject::SbClassModuleObject
}
}
}
@@ -537,7 +574,7 @@
}
SbClassModuleObject::~SbClassModuleObject()
-@@ -581,6 +589,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
+@@ -581,6 +589,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL
SetParent( p );
pLibInfo = NULL;
bNoRtl = bBreak = FALSE;
@@ -545,7 +582,7 @@
pModules = new SbxArray;
if( !GetSbData()->nInst++ )
-@@ -683,12 +692,38 @@ SbModule* StarBASIC::MakeModule( const String& rName, const String& rSrc )
+@@ -683,12 +692,38 @@ SbModule* StarBASIC::MakeModule( const S
SbModule* StarBASIC::MakeModule32( const String& rName, const ::rtl::OUString& rSrc )
{
@@ -587,7 +624,7 @@
}
void StarBASIC::Insert( SbxVariable* pVar )
-@@ -862,6 +897,12 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t )
+@@ -862,6 +897,12 @@ SbxVariable* StarBASIC::Find( const Stri
}
pNamed = p;
}
@@ -601,7 +638,7 @@
// GBLSEARCH-Flag rausnehmen (wg. Rekursion)
USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index d738539..0d6c647 100644
+index 42c4536..8ea4b64 100644
--- basic/source/classes/sbxmod.cxx
+++ basic/source/classes/sbxmod.cxx
@@ -51,6 +51,8 @@
@@ -639,7 +676,7 @@
SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-@@ -221,12 +235,13 @@ extern "C" int CDECL compare_strings( const void *arg1, const void *arg2 )
+@@ -221,12 +235,13 @@ extern "C" int CDECL compare_strings( co
// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
// Elemente von anderen Modulen aus gefunden werden koennen.
@@ -666,7 +703,7 @@
if( !pRes && pImage )
{
SbiInstance* pInst = pINST;
-@@ -561,6 +579,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
+@@ -561,6 +579,7 @@ void SbModule::SetSource32( const ::rtl:
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
@@ -689,7 +726,7 @@
}
eLastTok = eCurTok;
}
-@@ -731,10 +750,19 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
+@@ -731,10 +742,19 @@ void ClearUnoObjectsInRTL_Impl( StarBASI
if( ((StarBASIC*)p) != pBasic )
ClearUnoObjectsInRTL_Impl_Rek( (StarBASIC*)p );
}
@@ -709,7 +746,7 @@
static USHORT nMaxCallLevel = 0;
static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
-@@ -826,10 +854,10 @@ USHORT SbModule::Run( SbMethod* pMeth )
+@@ -826,10 +846,10 @@ USHORT SbModule::Run( SbMethod* pMeth )
if( pRt->pNext )
pRt->pNext->block();
pINST->pRun = pRt;
@@ -722,7 +759,7 @@
}
while( pRt->Step() ) {}
if( pRt->pNext )
-@@ -1404,7 +1432,6 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm )
+@@ -1404,7 +1424,6 @@ BOOL SbModule::LoadBinaryData( SvStream&
return bRet;
}
@@ -730,7 +767,7 @@
BOOL SbModule::LoadCompleted()
{
SbxArray* p = GetMethods();
-@@ -2207,6 +2234,47 @@ SbJScriptMethod::~SbJScriptMethod()
+@@ -2207,6 +2226,53 @@ SbJScriptMethod::~SbJScriptMethod()
/////////////////////////////////////////////////////////////////////////
@@ -738,23 +775,29 @@
+ : SbModule( mInfo.ModuleName, bIsVbaCompatible )
+{
+ SetModuleType( mInfo.ModuleType );
-+ try
++ if ( mInfo.ModuleType == script::ModuleType::Form )
+ {
-+ com::sun::star::uno::Any aObject( mInfo.ModuleObject );
-+ pDocObject = new SbUnoObject( GetName(), aObject );
-+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObject, com::sun::star::uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
-+ }
-+ else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Workbook" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
-+ }
++ SetClassName( rtl::OUString::createFromAscii( "Form" ) );
++ }
++ else if ( mInfo.ModuleObject.is() )
++ SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
++}
++void
++SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
++{
++ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxVariable*)pDocObject);
++ if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
++ return;
++ pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
++
++ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
++ if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
++ {
++ SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
+ }
-+ catch( com::sun::star::uno::RuntimeException e )
++ else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Workbook" ) ) )
+ {
-+ OSL_TRACE("***** Failed to initialise API Object." );
++ SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
+ }
+}
+
@@ -819,10 +862,10 @@
}
if( nPass == 1 )
diff --git basic/source/comp/parser.cxx basic/source/comp/parser.cxx
-index 4d571fb..2fa8821 100644
+index 3259f77..1a4dc06 100644
--- basic/source/comp/parser.cxx
+++ basic/source/comp/parser.cxx
-@@ -144,7 +144,8 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
+@@ -145,7 +145,8 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
bNewGblDefs =
bSingleLineIf =
bExplicit = FALSE;
@@ -832,7 +875,7 @@
pPool = &aPublics;
for( short i = 0; i < 26; i++ )
eDefTypes[ i ] = SbxVARIANT; // Kein expliziter Defaulttyp
-@@ -157,6 +158,10 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
+@@ -158,6 +159,10 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
rTypeArray = new SbxArray; // Array fuer Benutzerdefinierte Typen
rEnumArray = new SbxArray; // Array for Enum types
@@ -843,7 +886,7 @@
}
-@@ -755,8 +760,9 @@ void SbiParser::Option()
+@@ -778,8 +783,9 @@ void SbiParser::Option()
case CLASSMODULE:
bClassModule = TRUE;
@@ -854,7 +897,7 @@
if( Next() == NUMBER )
{
if ( nVal == 1 || nVal == 0 )
-@@ -764,6 +770,10 @@ void SbiParser::Option()
+@@ -787,6 +793,10 @@ void SbiParser::Option()
bVBASupportOn = ( nVal == 1 );
if ( bVBASupportOn )
EnableCompatibility();
@@ -941,7 +984,7 @@
return result;
}
-@@ -64,6 +65,24 @@ void StarBASIC::StaticEnableReschedule( BOOL bReschedule )
+@@ -64,6 +65,24 @@ void StarBASIC::StaticEnableReschedule(
{
bStaticGlobalEnableReschedule = bReschedule;
}
@@ -966,7 +1009,7 @@
struct SbiArgvStack { // Argv stack:
-@@ -520,6 +539,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
+@@ -520,6 +539,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, Sb
nForLvl = 0;
nOps = 0;
refExprStk = new SbxArray;
@@ -974,7 +1017,7 @@
#if defined GCC
SetParameters( pe ? pe->GetParameters() : (class SbxArray *)NULL );
#else
-@@ -527,7 +547,6 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
+@@ -527,7 +547,6 @@ SbiRuntime::SbiRuntime( SbModule* pm, Sb
#endif
pRefSaveList = NULL;
pItemStoreList = NULL;
@@ -983,7 +1026,7 @@
SbiRuntime::~SbiRuntime()
diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
-index 12b1a67..5c9c44b 100644
+index d96a569..da495ca 100644
--- basic/source/uno/namecont.cxx
+++ basic/source/uno/namecont.cxx
@@ -76,6 +76,9 @@
@@ -996,7 +1039,7 @@
namespace basic
{
-@@ -155,7 +158,7 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement )
+@@ -155,7 +158,7 @@ void NameContainer::replaceByName( const
throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
Type aAnyType = aElement.getValueType();
@@ -1005,7 +1048,7 @@
throw IllegalArgumentException();
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -197,7 +200,7 @@ void NameContainer::insertByName( const OUString& aName, const Any& aElement )
+@@ -197,7 +200,7 @@ void NameContainer::insertByName( const
throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
Type aAnyType = aElement.getValueType();
@@ -1018,7 +1061,7 @@
index f47dc64..4a46e98 100644
--- basic/source/uno/scriptcont.cxx
+++ basic/source/uno/scriptcont.cxx
-@@ -214,7 +214,12 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
+@@ -214,7 +214,12 @@ void SAL_CALL SfxScriptLibraryContainer:
xmlscript::ModuleDescriptor aMod;
aMod.aName = aElementName;
aMod.aLanguage = maScriptLanguage;
@@ -1032,7 +1075,7 @@
xmlscript::exportScriptModule( xHandler, aMod );
}
-@@ -1171,7 +1176,11 @@ void SfxScriptLibrary::storeResourcesToStorage( const ::com::sun::star::uno::Ref
+@@ -1171,7 +1176,11 @@ void SfxScriptLibrary::storeResourcesToS
bool SfxScriptLibrary::containsValidModule( const Any& aElement )
{
OUString sModuleText;
@@ -1061,10 +1104,29 @@
diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 0df678a..fa27688 100644
+index 0df678a..aff8877 100644
--- sc/source/filter/excel/excimp8.cxx
+++ sc/source/filter/excel/excimp8.cxx
-@@ -273,6 +273,7 @@ bool lcl_hasVBAEnabled()
+@@ -103,6 +103,7 @@
+
+ #include <com/sun/star/document/XDocumentProperties.hpp>
+ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
++#include <com/sun/star/script/ModuleInfo.hpp>
+
+
+ using namespace com::sun::star;
+@@ -110,8 +111,8 @@ using namespace com::sun::star;
+
+ #define INVALID_POS 0xFFFFFFFF
+
+-
+-
++// defined in docfunc.cxx ( really this needs a new name )
++script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
+
+ ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
+ ImportExcel( rImpData, rStrm ), mnTab(0)
+@@ -273,6 +274,7 @@ bool lcl_hasVBAEnabled()
void ImportExcel8::ReadBasic( void )
{
@@ -1072,7 +1134,7 @@
bHasBasic = TRUE;
SfxObjectShell* pShell = GetDocShell();
-@@ -302,6 +303,10 @@ void ImportExcel8::EndSheet( void )
+@@ -302,6 +304,10 @@ void ImportExcel8::EndSheet( void )
void ImportExcel8::PostDocLoad( void )
{
@@ -1083,8 +1145,57 @@
// #i11776# filtered ranges before outlines and hidden rows
if( pExcRoot->pAutoFilterBuffer )
pExcRoot->pAutoFilterBuffer->Apply();
+diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
+index 62c11ca..22f163d 100644
+--- sc/source/ui/docshell/docsh5.cxx
++++ sc/source/ui/docshell/docsh5.cxx
+@@ -68,6 +68,10 @@
+ #include "sc.hrc"
+ #include "waitoff.hxx"
+ #include "sizedev.hxx"
++#include <basic/sbstar.hxx>
++
++// defined in docfunc.cxx
++void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName, String& sModuleSource );
+
+ // ---------------------------------------------------------------------------
+
+@@ -832,6 +836,33 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
+ GetUndoManager()->AddUndoAction(
+ new ScUndoCopyTab( this, aSrcList, aDestList ) );
+ }
++
++ StarBASIC* pStarBASIC = GetBasic();
++ BOOL bVbaEnabled = pStarBASIC ? pStarBASIC->isVBAEnabled() : FALSE;
++ if ( bVbaEnabled )
++ {
++ String sCodeName;
++ String sSource;
++ aDocument.GetCodeName( nDestTab, sCodeName );
++ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = GetBasicContainer();
++ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
++ if( xLibContainer.is() )
++ {
++ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
++ com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
++ aLibAny >>= xLib;
++ }
++ if( xLib.is() )
++ {
++ String sSrcCodeName;
++ aDocument.GetCodeName( nSrcTab, sSrcCodeName );
++ rtl::OUString sModName = sSrcCodeName;
++ com::sun::star::script::ModuleInfo sModuleInfo;
++ xLib->getByName( sModName ) >>= sModuleInfo;
++ sSource = sModuleInfo.ModuleSource;
++ }
++ lcl_InsertModule( *this, nDestTab, sCodeName, sSource );
++ }
+ }
+
+ Broadcast( ScTablesHint( SC_TAB_COPIED, nSrcTab, nDestTab ) );
diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
-index af1a2cc..2cc592c 100644
+index eb1b419..7f1c44b 100644
--- sc/source/filter/excel/read.cxx
+++ sc/source/filter/excel/read.cxx
@@ -947,7 +947,8 @@ FltError ImportExcel8::Read( void )
@@ -1098,10 +1209,10 @@
case 0x01BA: Codename( TRUE ); break;
diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index ea6f221..e3e8b97 100644
+index 9c687ed..c8339df 100644
--- sc/source/filter/excel/xiescher.cxx
+++ sc/source/filter/excel/xiescher.cxx
-@@ -834,7 +834,7 @@ bool XclImpTbxControlObj::FillMacroDescriptor( ScriptEventDescriptor& rEvent ) c
+@@ -834,7 +834,7 @@ bool XclImpTbxControlObj::FillMacroDescr
{
// set the macro name
rEvent.ScriptType = XclControlObjHelper::GetTbxScriptType();
@@ -1110,7 +1221,7 @@
return true;
}
}
-@@ -1728,7 +1728,7 @@ SdrObject* XclImpDffManager::ProcessObj( SvStream& rEscherStrm,
+@@ -1728,7 +1728,7 @@ SdrObject* XclImpDffManager::ProcessObj(
if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( xSdrObj.get(), TRUE ) )
{
if ( rMacro.Len() > 0 )
@@ -1135,7 +1246,7 @@
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
-@@ -405,9 +408,16 @@ OUString XclControlObjHelper::GetTbxScriptType()
+@@ -405,9 +408,16 @@ OUString XclControlObjHelper::GetTbxScri
#define EXC_TBX_MACRONAME_PRE "vnd.sun.star.script:Standard."
#define EXC_TBX_MACRONAME_SUF "?language=Basic&location=document"
@@ -1168,7 +1279,7 @@
static String GetXclMacroName( const ::rtl::OUString& rScMacroName );
};
diff --git sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
-index 90c210e..105f743 100644
+index 4a4af03..eee88d8 100644
--- sc/source/ui/docshell/docfunc.cxx
+++ sc/source/ui/docshell/docfunc.cxx
@@ -51,6 +51,12 @@
@@ -1192,34 +1303,43 @@
// STATIC DATA -----------------------------------------------------------
//========================================================================
-@@ -2021,6 +2028,85 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
+@@ -2021,6 +2028,92 @@ BOOL ScDocFunc::MoveBlock( const ScRange
}
//------------------------------------------------------------------------
-+script::ModuleInfo lcl_InitModuleInfo( ScDocShell& rDocSh, String& sModule )
++uno::Reference< uno::XInterface > GetDocModuleObject( SfxObjectShell& rDocSh, String& sCodeName )
+{
-+ ::rtl::OUString aModName( sModule );
+ uno::Reference< lang::XMultiServiceFactory> xSF(rDocSh.GetModel(), uno::UNO_QUERY);
-+ ::rtl::OUString sVbaOption( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
-+ script::ModuleInfo sModuleInfo;
-+ sModuleInfo.ModuleName = aModName;
-+ sModuleInfo.ModuleSource = sVbaOption;
-+ sModuleInfo.ModuleType = script::ModuleType::Document;
+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
++ uno::Reference< uno::XInterface > xDocModuleApiObject;
+ if ( xSF.is() )
+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( aModName );
-+ xVBACodeNamedObjectAccess.set( xSF->createInstanceWithArguments( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider")), aArgs), uno::UNO_QUERY );
-+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( aModName ), uno::UNO_QUERY );
++ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
++ xDocModuleApiObject.set( xVBACodeNamedObjectAccess->getByName( sCodeName ), uno::UNO_QUERY );
+ }
++ return xDocModuleApiObject;
++
++}
++
++script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule, String& sSource )
++{
++ ::rtl::OUString aModName( sModule );
++ ::rtl::OUString sVbaOption( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
++ script::ModuleInfo sModuleInfo;
++ sModuleInfo.ModuleName = aModName;
++ if ( sSource.Len() > 0 )
++ sModuleInfo.ModuleSource = sSource;
++ else
++ sModuleInfo.ModuleSource = sVbaOption;
++ sModuleInfo.ModuleType = script::ModuleType::Document;
++ sModuleInfo.ModuleObject = GetDocModuleObject( rDocSh, sModule );
+ return sModuleInfo;
+}
+
-+void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName )
++void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName, String& sSource )
+{
+ SFX_APP()->EnterBasicCall();
-+ script::ModuleInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, sModuleName );
++ script::ModuleInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, sModuleName, sSource );
+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
+
@@ -1232,21 +1352,19 @@
+ }
+ if( xLib.is() )
+ {
-+ // test Module has exist
-+ // if the Module is exist. changed to another name
-+ // and at this time the string like "SheetX"
++ // if the Module with codename exists then find a new name
+ sal_Int32 nNum = 1;
++ sModuleInfo.ModuleName = sModuleName;
+ while( xLib->hasByName( sModuleInfo.ModuleName ) )
+ {
-+ sModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( nNum );
++ sModuleInfo.ModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( nNum );
+ nNum += 1;
+ }
-+ sModuleInfo.ModuleName = sModuleName;
+ uno::Any aSourceAny;
+ aSourceAny <<= sModuleInfo;
-+ xLib->insertByName( sModuleName, aSourceAny );
++ xLib->insertByName( sModuleInfo.ModuleName, aSourceAny );
+ ScDocument* pDoc = rDocSh.GetDocument();
-+ String sCodeName( sModuleName );
++ String sCodeName( sModuleInfo.ModuleName );
+ pDoc->SetCodeName( nTab, sCodeName );
+ }
+ SFX_APP()->LeaveBasicCall();
@@ -1278,32 +1396,47 @@
BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
{
-@@ -2030,8 +2116,12 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL
+@@ -2030,8 +2120,18 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
ScDocShellModificator aModificator( rDocShell );
ScDocument* pDoc = rDocShell.GetDocument();
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- if (bRecord && !pDoc->IsUndoEnabled())
+- if (bRecord && !pDoc->IsUndoEnabled())
++ // Strange loop, also basic is loaded too early ( InsertTable )
++ // is called via the xml import for sheets in described in odf
++ BOOL bInsertDocModule = false;
++
++ if( !rDocShell.GetDocument()->IsImportingXML() )
++ {
++ StarBASIC* pStarBASIC = rDocShell.GetBasic();
++ bInsertDocModule = pStarBASIC ? pStarBASIC->isVBAEnabled() : false;
++ }
++ if ( bInsertDocModule || ( bRecord && !pDoc->IsUndoEnabled() ) )
bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
++
if (bRecord)
pDoc->BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
-@@ -2046,6 +2136,11 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL
+@@ -2042,10 +2142,19 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
+
+ if (pDoc->InsertTab( nTab, rName ))
+ {
++ String sCodeName;
+ if (bRecord)
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoInsertTab( &rDocShell, nTab, bAppend, rName));
// Views updaten:
-+ if( bVbaEnabled )
++ // Only insert vba modules if vba mode ( and not currently importing XML )
++ if( bInsertDocModule )
+ {
-+ String sCodeName( rName );
-+ lcl_InsertModule( rDocShell, nTab, sCodeName );
++ if ( sCodeName.Len() == 0 )
++ sCodeName = rName;
++ String sSource;
++ lcl_InsertModule( rDocShell, nTab, sCodeName, sSource );
+ }
rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
rDocShell.PostPaintExtras();
-@@ -2067,8 +2162,12 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab, BOOL bRecord, BOOL /* bApi */ )
+@@ -2067,8 +2175,12 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
BOOL bSuccess = FALSE;
ScDocument* pDoc = rDocShell.GetDocument();
@@ -1316,7 +1449,7 @@
BOOL bWasLinked = pDoc->IsLinked(nTab);
ScDocument* pUndoDoc = NULL;
ScRefUndoData* pUndoData = NULL;
-@@ -2109,6 +2208,8 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab, BOOL bRecord, BOOL /* bApi */ )
+@@ -2109,6 +2221,8 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
pUndoData = new ScRefUndoData( pDoc );
}
@@ -1325,7 +1458,7 @@
if (pDoc->DeleteTab( nTab, pUndoDoc ))
{
if (bRecord)
-@@ -2119,6 +2220,13 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab, BOOL bRecord, BOOL /* bApi */ )
+@@ -2119,6 +2233,13 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
new ScUndoDeleteTab( &rDocShell, theTabs, pUndoDoc, pUndoData ));
}
// Views updaten:
@@ -1455,7 +1588,7 @@
//------------------------------------------------------------------------
-@@ -112,7 +208,8 @@ static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
+@@ -112,7 +208,8 @@ static const sal_Char* __FAR_DATA aProvN
SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
@@ -1465,7 +1598,7 @@
};
//
-@@ -164,7 +261,8 @@ static const sal_Char* __FAR_DATA aOldNames[SC_SERVICE_COUNT] =
+@@ -164,7 +261,8 @@ static const sal_Char* __FAR_DATA aOldNa
"", // SC_SERVICE_SHEETDOCSET
"", // SC_SERVICE_CHDATAPROV
"", // SC_SERVICE_FORMULAPARS
@@ -1475,7 +1608,7 @@
};
-@@ -357,6 +455,9 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
+@@ -357,6 +455,9 @@ uno::Reference<uno::XInterface> ScServic
case SC_SERVICE_OPCODEMAPPER:
xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj));
break;
@@ -1501,7 +1634,7 @@
#include "viewfunc.hxx"
#include "sc.hrc"
-@@ -2092,15 +2097,42 @@ BOOL ScViewFunc::DeleteTable( SCTAB nTab, BOOL bRecord )
+@@ -2092,15 +2097,42 @@ BOOL ScViewFunc::DeleteTable( SCTAB nTab
return bSuccess;
}
@@ -1544,7 +1677,7 @@
while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) )
--nNewTab;
-@@ -2167,9 +2199,18 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
+@@ -2167,9 +2199,18 @@ BOOL ScViewFunc::DeleteTables(const SvSh
for(i=TheTabs.Count()-1;i>=0;i--)
{
@@ -1563,7 +1696,7 @@
pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[sal::static_int_cast<USHORT>(i)] ) );
}
}
-@@ -2197,6 +2238,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
+@@ -2197,6 +2238,7 @@ BOOL ScViewFunc::DeleteTables(const SvSh
pDocSh->PostPaintExtras();
pDocSh->SetDocumentModified();
@@ -1584,7 +1717,7 @@
/*
A few urls which may in the future be of some use
http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
-@@ -432,7 +434,7 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
+@@ -432,7 +434,7 @@ int VBA_Impl::ReadVBAProject(const SvSto
*
*/
@@ -1593,7 +1726,7 @@
{
ModuleTypeHash::iterator iter = mhModHash.find( rModuleName );
ModuleTypeHash::iterator iterEnd = mhModHash.end();
-@@ -440,7 +442,7 @@ ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
+@@ -440,7 +442,7 @@ ModuleType VBA_Impl::GetModuleType( cons
{
return iter->second;
}
@@ -1602,7 +1735,7 @@
}
bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
-@@ -483,7 +485,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
+@@ -483,7 +485,7 @@ bool VBA_Impl::Open( const String &rTopl
static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
@@ -1611,7 +1744,7 @@
while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
{
xub_StrLen index = tmp.Search( '=' );
-@@ -493,14 +495,14 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
+@@ -493,14 +495,14 @@ bool VBA_Impl::Open( const String &rTopl
String value = tmp.Copy( index + 1 );
if ( key == sClass )
{
@@ -1628,7 +1761,7 @@
OSL_TRACE("Module %s is of type Form",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-@@ -513,14 +515,14 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
+@@ -513,14 +515,14 @@ bool VBA_Impl::Open( const String &rTopl
// value is of form <name>/&H<identifier>, strip the identifier
value.Erase( value.Search( '/' ) );
@@ -1684,7 +1817,7 @@
std::vector<String> maReferences;
private:
diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index d5878ad..441562a 100644
+index d5878ad..d6ce988 100644
--- svx/source/msfilter/svxmsbas.cxx
+++ svx/source/msfilter/svxmsbas.cxx
@@ -53,6 +53,7 @@ using namespace com::sun::star::awt;
@@ -1695,9 +1828,12 @@
using namespace com::sun::star::container;
using namespace com::sun::star::script;
using namespace com::sun::star::uno;
-@@ -268,6 +269,20 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+@@ -266,8 +268,22 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
+ Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
}
- if( xLib.is() )
+- if( xLib.is() )
++ if( xLib.is() )
{
+ Reference< container::XNameAccess > xVBAObjectForCodeName;
+ if ( !bAsComment )
@@ -1716,7 +1852,7 @@
for( UINT16 i=0; i<nStreamCount;i++)
{
StringArray aDecompressed = aVBA.Decompress(i);
-@@ -301,7 +316,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+@@ -301,7 +317,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
// is the same as the encoding for the names
// that are keys in the map used by GetModuleType method
const String &sOrigVBAModName = aVBA.GetStreamName( i );
@@ -1725,7 +1861,7 @@
rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
-@@ -309,23 +324,23 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+@@ -309,23 +325,23 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
switch( mType )
{
@@ -1754,7 +1890,7 @@
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
break;
-@@ -335,10 +350,10 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+@@ -335,10 +351,10 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
}
static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
@@ -1767,7 +1903,7 @@
modeTypeComment = modeTypeComment + sClassOption;
}
-@@ -405,12 +420,24 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+@@ -405,12 +421,41 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
aSource += rtl::OUString::createFromAscii("\nEnd Sub");
}
::rtl::OUString aModName( sModule );
@@ -1778,15 +1914,32 @@
Any aSourceAny;
- aSourceAny <<= aSource;
+ OSL_TRACE("erm %d", mType );
-+ if ( xVBAObjectForCodeName.is() && ( mType == ModuleType::Document || mType == ModuleType::Class ) )
++ if ( !bAsComment )
+ {
+ OSL_TRACE("vba processing %d", mType );
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleName = aModName;
+ sModuleInfo.ModuleSource = aSource;
+ sModuleInfo.ModuleType = mType;
-+ if ( mType != ModuleType::Class )
-+ sModuleInfo.ModuleObject.set( xVBAObjectForCodeName->getByName( aModName ), UNO_QUERY );
++ if ( mType == ModuleType::Form )
++ // hack, the module ( imo document basic should...
++ // know the XModel... ) but it doesn't
++ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
++ // document modules, we should be able to access
++ // the api objects at this time
++ else if ( mType == ModuleType::Document )
++ {
++ uno::Reference< lang::XMultiServiceFactory> xSF( rDocSh.GetModel(), uno::UNO_QUERY);
++ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
++ if ( xSF.is() )
++ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
++ // get the api object for the codename
++ if ( xVBACodeNamedObjectAccess.is() )
++ {
++ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( sModuleInfo.ModuleName ), uno::UNO_QUERY );
++ OSL_TRACE("** Straight up creation of Module");
++ }
++ }
+ aSourceAny <<= sModuleInfo;
+ }
+ else
@@ -1794,7 +1947,7 @@
if( xLib->hasByName( aModName ) )
xLib->replaceByName( aModName, aSourceAny );
else
-@@ -420,6 +447,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+@@ -420,6 +465,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
bRet = true;
}
}
Modified: trunk/patches/vba/enhanced-form-userform-controls.diff
==============================================================================
--- trunk/patches/vba/enhanced-form-userform-controls.diff (original)
+++ trunk/patches/vba/enhanced-form-userform-controls.diff Fri Aug 29 15:07:11 2008
@@ -65,7 +65,7 @@
}
diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index 408f88d..645c396 100644
+index bc0d0f1..7e48d82 100644
--- basctl/source/basicide/scriptdocument.cxx
+++ basctl/source/basicide/scriptdocument.cxx
@@ -663,7 +663,7 @@ namespace basctl
@@ -86,7 +86,7 @@
aElement <<= xISP;
}
-@@ -783,7 +783,7 @@ namespace basctl
+@@ -791,7 +791,7 @@ namespace basctl
xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
// export dialog model
@@ -357,10 +357,10 @@
public:
diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
-index fcfd0fb..73b3744 100644
+index aa2820b..b2c45ac 100644
--- sc/inc/unonames.hxx
+++ sc/inc/unonames.hxx
-@@ -590,6 +590,7 @@
+@@ -591,6 +591,7 @@
#define SC_UNONAME_ADDRESS "Address"
#define SC_UNONAME_UIREPR "UserInterfaceRepresentation"
#define SC_UNONAME_PERSREPR "PersistentRepresentation"
@@ -536,10 +536,10 @@
// to use the new XScriptListener ( which converts the old style macro
// to a SF url )
diff --git svx/inc/svx/msocximex.hxx svx/inc/svx/msocximex.hxx
-index 7447e10..3d52e4d 100644
+index 9c397fe..c94eaeb 100644
--- svx/inc/svx/msocximex.hxx
+++ svx/inc/svx/msocximex.hxx
-@@ -405,6 +405,8 @@ public:
+@@ -406,6 +406,8 @@ public:
sal_uInt32 nGroupNameLen;
sal_uInt32 nUnknown10;
@@ -548,7 +548,7 @@
char *pValue;
char *pCaption;
char *pGroupName;
-@@ -488,6 +490,8 @@ struct ContainerRecord
+@@ -490,6 +492,8 @@ struct ContainerRecord
::rtl::OUString cName;
::rtl::OUString controlTip;
@@ -557,7 +557,7 @@
sal_uInt32 nTop;
sal_uInt32 nLeft;
-@@ -914,7 +918,8 @@ public:
+@@ -918,7 +922,8 @@ public:
OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton"))
{
msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
@@ -567,7 +567,7 @@
mnBackColor = 0x80000005L;
mnForeColor = 0x80000008L;
aFontData.SetHasAlign(TRUE);
-@@ -1015,7 +1020,7 @@ class OCX_ComboBox : public OCX_ModernCo
+@@ -1019,7 +1024,7 @@ class OCX_ComboBox : public OCX_ModernCo
public:
OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){
msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
@@ -576,7 +576,7 @@
mnBackColor = 0x80000005;
mnForeColor = 0x80000008;
nBorderColor = 0x80000006;
-@@ -1040,7 +1045,8 @@ class OCX_ListBox : public OCX_ModernCon
+@@ -1044,7 +1049,8 @@ class OCX_ListBox : public OCX_ModernCon
public:
OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){
msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
@@ -587,7 +587,7 @@
mnForeColor = 0x80000008;
nBorderColor = 0x80000006;
diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index c2bd3b2..85cabda 100644
+index fd5d2e5..039f7d6 100644
--- svx/source/msfilter/msocximex.cxx
+++ svx/source/msfilter/msocximex.cxx
@@ -49,6 +49,10 @@
@@ -601,9 +601,9 @@
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
-@@ -80,6 +84,13 @@
- #include <algorithm>
- #include <memory>
+@@ -86,6 +90,14 @@
+ #include <comphelper/componentcontext.hxx>
+ #include <unotools/streamwrap.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
@@ -611,11 +611,12 @@
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/sheet/XSpreadsheetView.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
++#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
+
#ifndef C2S
#define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
#endif
-@@ -707,14 +718,22 @@ class ContainerRecReader
+@@ -759,14 +771,22 @@ class ContainerRecReader
if( nCtrlSrcBufSize > 0 )
{
ReadAlign( pS, pS->Tell() - nStartPos, 4 );
@@ -640,10 +641,37 @@
}
// seek to end of data
-@@ -1489,7 +1508,69 @@ sal_Bool OCX_ImageButton::Export(SvStora
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+@@ -1554,6 +1574,99 @@ sal_Bool OCX_ImageButton::Export(SvStora
return WriteContents(xContents,rPropSet,rSize);
}
+
++bool lcl_isNamedRange( const rtl::OUString& sAddress, uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
++{
++ bool bRes = false;
++ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
++ uno::Reference< sheet::XCellRangeReferrer > xReferrer;
++ try
++ {
++ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
++ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
++ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
++ }
++ catch( uno::Exception& /*e*/ )
++ {
++ // do nothing
++ }
++ if ( xReferrer.is() )
++ {
++ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
++ if ( xRangeAddressable.is() )
++ {
++ aAddress = xRangeAddressable->getRangeAddress();
++ bRes = true;
++ }
++ }
++ return bRes;
++}
++
+void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
+{
+// XBindable etc.
@@ -690,16 +718,19 @@
+ table::CellRangeAddress aAddress;
+ if ( xConvertor.is() )
+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
++ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
++ {
++ // we need this service to properly convert XL notation also
++ // Should be easy to extend
++ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
++ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
++ }
+ }
+
+ beans::NamedValue aArg1;
+ aArg1.Name = C2U("CellRange");
+ aArg1.Value <<= aAddress;
-
++
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[ 0 ] <<= aArg1;
+
@@ -710,7 +741,7 @@
sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
com::sun::star::beans::XPropertySet> &rPropSet)
-@@ -1561,7 +1642,8 @@ sal_Bool OCX_OptionButton::Import(com::s
+@@ -1625,7 +1738,8 @@ sal_Bool OCX_OptionButton::Import(com::s
aTmp <<= sGroupName;
rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
}
@@ -720,7 +751,7 @@
aFontData.Import(rPropSet);
return sal_True;
}
-@@ -2452,6 +2534,9 @@ sal_Bool OCX_ComboBox::Import(com::sun::
+@@ -2516,6 +2630,9 @@ sal_Bool OCX_ComboBox::Import(com::sun::
aTmp <<= nTmp;
rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
@@ -730,7 +761,7 @@
aFontData.Import(rPropSet);
return sal_True;
}
-@@ -2672,7 +2757,8 @@ sal_Bool OCX_ListBox::Import(com::sun::s
+@@ -2736,7 +2853,8 @@ sal_Bool OCX_ListBox::Import(com::sun::s
aTmp <<= ImportColor( nBorderColor );
rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
@@ -740,7 +771,7 @@
aFontData.Import(rPropSet);
return sal_True;
}
-@@ -3447,15 +3533,29 @@ void OCX_ContainerControl::ProcessContro
+@@ -3520,15 +3638,29 @@ void OCX_ContainerControl::ProcessContro
{
// A container control needs to read the f stream in
// the folder ( substorage ) associated with this control
@@ -777,7 +808,7 @@
pControl->sName = rec.cName;
pControl->msToolTip = rec.controlTip;
// Position of controls is relative to the container
-@@ -4084,7 +4184,7 @@ sal_Bool OCX_UserForm::Import(
+@@ -4161,7 +4293,7 @@ sal_Bool OCX_UserForm::Import(
OCX_ContainerControl::Import( xPropSet );
uno::Reference<io::XInputStreamProvider> xSource =
Modified: trunk/patches/vba/vba-userform.diff
==============================================================================
--- trunk/patches/vba/vba-userform.diff (original)
+++ trunk/patches/vba/vba-userform.diff Fri Aug 29 15:07:11 2008
@@ -12,7 +12,7 @@
protected:
::rtl::OUString aOUSource;
diff --git basic/inc/basic/sbobjmod.hxx basic/inc/basic/sbobjmod.hxx
-index 7a8f096..eeb7869 100644
+index cb581c1..96cbe9b 100644
--- basic/inc/basic/sbobjmod.hxx
+++ basic/inc/basic/sbobjmod.hxx
@@ -41,6 +41,7 @@
@@ -32,8 +32,8 @@
public:
TYPEINFO();
SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
-@@ -55,6 +58,32 @@ public:
- SbxVariable* GetObject();
+@@ -56,6 +59,32 @@ public:
+ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
};
+class SbUserFormModule : public SbObjModule
@@ -92,7 +92,7 @@
// GBLSEARCH-Flag rausnehmen (wg. Rekursion)
USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index 5ad04db..bfb0cf6 100644
+index 8ea4b64..d3dd8d5 100644
--- basic/source/classes/sbxmod.cxx
+++ basic/source/classes/sbxmod.cxx
@@ -73,7 +73,6 @@
@@ -111,19 +111,7 @@
SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-@@ -2230,6 +2230,11 @@ SbObjModule::SbObjModule( const com::sun
- : SbModule( mInfo.ModuleName, bIsVbaCompatible )
- {
- SetModuleType( mInfo.ModuleType );
-+ if ( mInfo.ModuleType == script::ModuleType::Form )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Form" ) );
-+ return;
-+ }
- try
- {
- com::sun::star::uno::Any aObject( mInfo.ModuleObject );
-@@ -2266,6 +2271,228 @@ SbObjModule::Find( const XubString& rNam
+@@ -2272,6 +2272,242 @@ SbObjModule::Find( const XubString& rNam
pVar = SbModule::Find( rName, t );
return pVar;
}
@@ -137,10 +125,11 @@
+ bool mbDisposed;
+ sal_Bool mbOpened;
+ sal_Bool mbActivated;
++ sal_Bool mbShowing;
+ FormObjEventListenerImpl(); // not defined
+ FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined
+public:
-+ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False )
++ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
+ {
+ if ( mxComponent.is() );
+ {
@@ -155,6 +144,7 @@
+ {
+ removeListener();
+ }
++ sal_Bool isShowing() { return mbShowing; }
+ void removeListener()
+ {
+ try
@@ -174,6 +164,7 @@
+ if ( mpUserForm )
+ {
+ mbOpened = sal_True;
++ mbShowing = sal_True;
+ if ( mbActivated )
+ {
+ mbOpened = mbActivated = sal_False;
@@ -182,7 +173,7 @@
+ }
+ }
+ virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+ virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
++ virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) { mbOpened = sal_False; mbShowing = sal_False; }
+ virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
+ virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException){}
+ virtual void SAL_CALL windowActivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
@@ -298,8 +289,19 @@
+ OSL_TRACE("Attempting too run the UnloadObjectMethod");
+ m_xDialog = NULL; //release ref to the uno object
+ SbxValues aVals;
-+ pMeth->Get( aVals );
-+ ResetApiObj();
++ FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
++ bool bWaitForDispose = true; // assume dialog is showing
++ if ( pFormListener )
++ {
++ bWaitForDispose = pFormListener->isShowing();
++ OSL_TRACE("Showing %d", bWaitForDispose );
++ }
++ pMeth->Get( aVals);
++ if ( !bWaitForDispose )
++ {
++ // we've either already got a dispose or we'er never going to get one
++ ResetApiObj();
++ } // else wait for dispose
+ OSL_TRACE("UnloadObject completed ( we hope )");
+ }
+}
@@ -345,7 +347,7 @@
+SbxVariable*
+SbUserFormModule::Find( const XubString& rName, SbxClassType t )
+{
-+ if ( !pDocObject && pImage->bInit )
++ if ( !pDocObject && !GetSbData()->bRunInit )
+ InitObject();
+ return SbObjModule::Find( rName, t );
+}
@@ -393,31 +395,3 @@
{
SbxVariable* pVar = ((SbxObject*)pObj)->
Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD );
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index 441562a..7acf7db 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -425,15 +425,20 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
-
- Any aSourceAny;
- OSL_TRACE("erm %d", mType );
-- if ( xVBAObjectForCodeName.is() && ( mType == ModuleType::Document || mType == ModuleType::Class ) )
-+ if ( xVBAObjectForCodeName.is() && ( mType == ModuleType::Document || mType == ModuleType::Class || mType == ModuleType::Form ) )
- {
- OSL_TRACE("vba processing %d", mType );
- script::ModuleInfo sModuleInfo;
- sModuleInfo.ModuleName = aModName;
- sModuleInfo.ModuleSource = aSource;
- sModuleInfo.ModuleType = mType;
-- if ( mType != ModuleType::Class )
-- sModuleInfo.ModuleObject.set( xVBAObjectForCodeName->getByName( aModName ), UNO_QUERY );
-+ if ( mType == ModuleType::Form )
-+ // hack, the module ( in document basic should...
-+ // know the XModel... ) needs fixing in basic
-+ // somewhere
-+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
-+ else if ( mType != ModuleType::Class )
-+ sModuleInfo.ModuleObject.set( xVBAObjectForCodeName->getByName( aModName ), UNO_QUERY );
- aSourceAny <<= sModuleInfo;
- }
- else
Modified: trunk/patches/vba/vba-workbook-worksheet-events.diff
==============================================================================
--- trunk/patches/vba/vba-workbook-worksheet-events.diff (original)
+++ trunk/patches/vba/vba-workbook-worksheet-events.diff Fri Aug 29 15:07:11 2008
@@ -1213,7 +1213,7 @@
+ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
+{
+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell )
++ if( !pShell || mbIgnoreEvents)
+ return sal_False;
+
+ // In order to better support "withevents" in the future,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]