ooo-build r14501 - in trunk: . patches/vba/native-export
- From: pflin svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14501 - in trunk: . patches/vba/native-export
- Date: Fri, 14 Nov 2008 04:24:39 +0000 (UTC)
Author: pflin
Date: Fri Nov 14 04:24:39 2008
New Revision: 14501
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14501&view=rev
Log:
2008-11-14 Fong Lin <pflin novell com>
* patches/vba/native-export/basic-ide-module-object-name-combile.diff:
merge vba-fix-ide-friendly-modulename.diff into this patch.
* patches/vba/native-export/vba-basic-macrochoose-dialog.diff:
merge vba-fix-basic-macro-organizer.diff into this patch, and tweak to
use XBasicLibraryInfo.
* patches/vba/native-export/vba-ui-option.diff: Add ui option to enable/
disable vba.
Added:
trunk/patches/vba/native-export/vba-ui-option.diff
Modified:
trunk/ChangeLog
trunk/patches/vba/native-export/basic-ide-module-object-name-combile.diff
trunk/patches/vba/native-export/vba-basic-macrochoose-dialog.diff
Modified: trunk/patches/vba/native-export/basic-ide-module-object-name-combile.diff
==============================================================================
--- trunk/patches/vba/native-export/basic-ide-module-object-name-combile.diff (original)
+++ trunk/patches/vba/native-export/basic-ide-module-object-name-combile.diff Fri Nov 14 04:24:39 2008
@@ -1,8 +1,8 @@
diff --git basctl/source/basicide/basides2.cxx basctl/source/basicide/basides2.cxx
-index 90cec19..c647b89 100644
+index 90cec19..bdc087c 100644
--- basctl/source/basicide/basides2.cxx
+++ basctl/source/basicide/basides2.cxx
-@@ -55,11 +55,34 @@
+@@ -55,11 +55,39 @@
#include <tools/diagnose_ex.h>
#include <sfx2/sfxdefs.hxx>
#include <sfx2/signaturestate.hxx>
@@ -17,27 +17,32 @@
+void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
+{
-+ uno::Any aElement( rLib->getByName( rModName ) );
-+ script::ModuleInfo aModuleInfo;
-+ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( aModuleInfo.ModuleObject, uno::UNO_QUERY );
++ try
++ {
++ uno::Any aElement( rLib->getByName( rModName ) );
++ script::ModuleInfo aModuleInfo;
++ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
++ {
++ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
++ uno::Reference< lang::XServiceInfo > xServiceInfo( aModuleInfo.ModuleObject, uno::UNO_QUERY );
+
-+ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-+ {
-+ uno::Reference< container::XNamed > xNamed( aModuleInfo.ModuleObject, uno::UNO_QUERY );
-+ if( xNamed.is() )
-+ rObjName = xNamed->getName();
-+ }
-+ }
++ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
++ {
++ uno::Reference< container::XNamed > xNamed( aModuleInfo.ModuleObject, uno::UNO_QUERY );
++ if( xNamed.is() )
++ rObjName = xNamed->getName();
++ }
++ }
++ }catch( uno::Exception& )
++ {
++ }
+}
+
IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG )
{
ShowObjectDialog( FALSE, TRUE );
-@@ -232,7 +255,7 @@ ModulWindow* BasicIDEShell::CreateBasWin
+@@ -232,7 +260,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
if ( !aLibName.Len() )
aLibName = String::CreateFromAscii( "Standard" );
@@ -46,7 +51,7 @@
if ( !aModName.Len() )
aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
-@@ -272,7 +295,20 @@ ModulWindow* BasicIDEShell::CreateBasWin
+@@ -272,7 +300,20 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
}
if( nKey )
Modified: trunk/patches/vba/native-export/vba-basic-macrochoose-dialog.diff
==============================================================================
--- trunk/patches/vba/native-export/vba-basic-macrochoose-dialog.diff (original)
+++ trunk/patches/vba/native-export/vba-basic-macrochoose-dialog.diff Fri Nov 14 04:24:39 2008
@@ -14,18 +14,19 @@
#endif // _SVX_NOIDERESIDS
diff --git basctl/source/basicide/baside2.cxx basctl/source/basicide/baside2.cxx
-index a1e47ed..78a276b 100644
+index a1e47ed..5a3fdba 100644
--- basctl/source/basicide/baside2.cxx
+++ basctl/source/basicide/baside2.cxx
-@@ -49,6 +49,7 @@
+@@ -49,6 +49,8 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
#include <com/sun/star/document/MacroExecMode.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <sfx2/docfile.hxx>
#include <basic/basrdll.hxx>
-@@ -110,6 +111,8 @@ DBG_NAME( ModulWindow )
+@@ -110,6 +112,8 @@ DBG_NAME( ModulWindow )
TYPEINIT1( ModulWindow , IDEBaseWindow );
@@ -34,21 +35,21 @@
void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle )
{
short nLeftMargin = LMARGPRN;
-@@ -1347,7 +1350,39 @@ BasicEntryDescriptor ModulWindow::Create
+@@ -1347,7 +1351,39 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor()
ScriptDocument aDocument( GetDocument() );
String aLibName( GetLibName() );
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_MODULE );
+ String aModName( GetName() );
+ String aLibSubName;
-+ if( xBasic.Is() && xBasic->isVBAEnabled() && xModule.Is() )
++ if( xModule.Is() && aDocument.isVBAEnabled( E_SCRIPTS, aLibName ) )
+ {
+ switch( xModule->GetModuleType() )
+ {
+ case script::ModuleType::Document:
+ {
+ aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) );
-+ uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
++ uno::Reference< container::XNameContainer > xLib = aDocument.getLibrary( E_SCRIPTS, aLibName, TRUE );
+ if( xLib.is() )
+ {
+ String sObjName;
@@ -76,10 +77,10 @@
void ModulWindow::SetReadOnly( BOOL b )
diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index 12c8e0c..e89c22f 100644
+index 63ea754..a0e9f1b 100644
--- basctl/source/basicide/baside3.cxx
+++ basctl/source/basicide/baside3.cxx
-@@ -894,8 +894,9 @@ BasicEntryDescriptor DialogWindow::Creat
+@@ -912,8 +912,9 @@ BasicEntryDescriptor DialogWindow::CreateEntryDescriptor()
{
ScriptDocument aDocument( GetDocument() );
String aLibName( GetLibName() );
@@ -118,7 +119,7 @@
#define MN_EDIT 20
#define MN_VIEW 21
diff --git basctl/source/basicide/bastype2.cxx basctl/source/basicide/bastype2.cxx
-index 7754d71..94a981c 100644
+index 7754d71..ace0a3f 100644
--- basctl/source/basicide/bastype2.cxx
+++ basctl/source/basicide/bastype2.cxx
@@ -53,10 +53,27 @@
@@ -149,7 +150,7 @@
BasicEntry::~BasicEntry()
{
-@@ -91,20 +108,22 @@ BasicEntryDescriptor::BasicEntryDescript
+@@ -91,20 +108,22 @@ BasicEntryDescriptor::BasicEntryDescriptor()
{
}
@@ -174,7 +175,7 @@
,m_aName( rName )
,m_aMethodName( rMethodName )
,m_eType( eType )
-@@ -120,6 +139,7 @@ BasicEntryDescriptor::BasicEntryDescript
+@@ -120,6 +139,7 @@ BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc )
:m_aDocument( rDesc.m_aDocument )
,m_eLocation( rDesc.m_eLocation )
,m_aLibName( rDesc.m_aLibName )
@@ -182,7 +183,7 @@
,m_aName( rDesc.m_aName )
,m_aMethodName( rDesc.m_aMethodName )
,m_eType( rDesc.m_eType )
-@@ -131,6 +151,7 @@ BasicEntryDescriptor& BasicEntryDescript
+@@ -131,6 +151,7 @@ BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescripto
m_aDocument = rDesc.m_aDocument;
m_eLocation = rDesc.m_eLocation;
m_aLibName = rDesc.m_aLibName;
@@ -190,7 +191,7 @@
m_aName = rDesc.m_aName;
m_aMethodName = rDesc.m_aMethodName;
m_eType = rDesc.m_eType;
-@@ -143,6 +164,7 @@ bool BasicEntryDescriptor::operator==( c
+@@ -143,6 +164,7 @@ bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const
return m_aDocument == rDesc.m_aDocument &&
m_eLocation == rDesc.m_eLocation &&
m_aLibName == rDesc.m_aLibName &&
@@ -198,7 +199,7 @@
m_aName == rDesc.m_aName &&
m_aMethodName == rDesc.m_aMethodName &&
m_eType == rDesc.m_eType;
-@@ -286,50 +308,58 @@ void BasicTreeListBox::ImpCreateLibSubEn
+@@ -286,50 +308,55 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) )
{
try
@@ -242,10 +243,7 @@
- }
- }
+ {
-+ BasicManager* pBasMgr = rDocument.getBasicManager();
-+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( rLibName ) : 0;
-+ sal_Bool bVBAEnabled = pBasic ? pBasic->isVBAEnabled(): sal_False;
-+ if( bVBAEnabled )
++ if( rDocument.isVBAEnabled( E_SCRIPTS, aOULibName) )
+ ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName );
+ else
+ {
@@ -299,7 +297,7 @@
}
}
-@@ -368,6 +398,139 @@ void BasicTreeListBox::ImpCreateLibSubEn
+@@ -368,6 +395,139 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
}
}
@@ -439,7 +437,7 @@
void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
{
UpdateEntries();
-@@ -480,10 +643,11 @@ long BasicTreeListBox::ExpandingHdl()
+@@ -480,10 +640,11 @@ long BasicTreeListBox::ExpandingHdl()
if ( aDocument.isAlive() )
{
String aLibName( aDesc.GetLibName() );
@@ -452,7 +450,7 @@
{
// check password, if library is password protected and not verified
::rtl::OUString aOULibName( aLibName );
-@@ -636,7 +800,7 @@ void BasicTreeListBox::SetCurrentEntry(
+@@ -636,7 +797,7 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
aDesc = BasicEntryDescriptor(
ScriptDocument::getApplicationScriptDocument(),
LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
@@ -461,7 +459,7 @@
}
ScriptDocument aDocument( aDesc.GetDocument() );
OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
-@@ -653,14 +817,24 @@ void BasicTreeListBox::SetCurrentEntry(
+@@ -653,14 +814,24 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
if ( pLibEntry )
{
pCurEntry = pLibEntry;
@@ -543,7 +541,7 @@
index c282f5d..accbce2 100644
--- basctl/source/basicide/bastype3.cxx
+++ basctl/source/basicide/bastype3.cxx
-@@ -134,6 +134,14 @@ void __EXPORT BasicTreeListBox::Requesti
+@@ -134,6 +134,14 @@ void __EXPORT BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry )
}
}
}
@@ -558,7 +556,7 @@
else {
DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
}
-@@ -204,6 +212,7 @@ SbxVariable* BasicTreeListBox::FindVaria
+@@ -204,6 +212,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
}
SbxVariable* pVar = 0;
@@ -566,7 +564,7 @@
if ( aEntries.Count() )
{
for ( USHORT n = 0; n < aEntries.Count(); n++ )
-@@ -226,6 +235,12 @@ SbxVariable* BasicTreeListBox::FindVaria
+@@ -226,6 +235,12 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
case OBJ_TYPE_MODULE:
{
DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" );
@@ -579,7 +577,7 @@
pVar = ((StarBASIC*)pVar)->FindModule( aName );
}
break;
-@@ -240,6 +255,15 @@ SbxVariable* BasicTreeListBox::FindVaria
+@@ -240,6 +255,15 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
// sbx dialogs removed
}
break;
@@ -595,7 +593,7 @@
default:
{
DBG_ERROR( "FindVariable: Unbekannter Typ!" );
-@@ -260,12 +284,13 @@ BasicEntryDescriptor BasicTreeListBox::G
+@@ -260,12 +284,13 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
String aLibName;
@@ -610,7 +608,7 @@
EntryArray aEntries;
-@@ -332,6 +357,15 @@ BasicEntryDescriptor BasicTreeListBox::G
+@@ -332,6 +357,15 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
eType = pBE->GetType();
}
break;
@@ -626,7 +624,7 @@
default:
{
DBG_ERROR( "GetEntryDescriptor: Unbekannter Typ!" );
-@@ -345,7 +379,7 @@ BasicEntryDescriptor BasicTreeListBox::G
+@@ -345,7 +379,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
}
}
@@ -635,7 +633,7 @@
}
USHORT BasicTreeListBox::ConvertType( BasicEntryType eType )
-@@ -427,6 +461,14 @@ bool BasicTreeListBox::IsValidEntry( SvL
+@@ -427,6 +461,14 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry )
bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName );
}
break;
@@ -670,7 +668,7 @@
else if ( pBasic->GetModules()->Count() )
pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
-@@ -713,6 +721,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Butt
+@@ -713,6 +721,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
BasicManager* pBasMgr = aDocument.getBasicManager();
String aLib( aDesc.GetLibName() );
String aMod( aDesc.GetName() );
@@ -684,10 +682,18 @@
SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() );
if ( pButton == &aEditButton )
diff --git basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
-index cd2c032..23b890c 100644
+index cd2c032..6a5e331 100644
--- basctl/source/basicide/moduldlg.cxx
+++ basctl/source/basicide/moduldlg.cxx
-@@ -87,7 +87,7 @@ BOOL __EXPORT ExtBasicTreeListBox::Editi
+@@ -56,6 +56,7 @@
+ #include <com/sun/star/script/XLibraryContainerPassword.hpp>
+ #include <com/sun/star/resource/XStringResourceManager.hpp>
+ #include <com/sun/star/lang/XMultiServiceFactory.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ #include <comphelper/processfactory.hxx>
+ #include <xmlscript/xmldlg_imexp.hxx>
+
+@@ -87,7 +88,7 @@ BOOL __EXPORT ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection&
if ( pEntry )
{
USHORT nDepth = GetModel()->GetDepth( pEntry );
@@ -696,7 +702,7 @@
{
BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
ScriptDocument aDocument( aDesc.GetDocument() );
-@@ -165,7 +165,7 @@ DragDropMode __EXPORT ExtBasicTreeListBo
+@@ -165,7 +166,7 @@ DragDropMode __EXPORT ExtBasicTreeListBox::NotifyStartDrag( TransferDataContaine
if ( pEntry )
{
USHORT nDepth = GetModel()->GetDepth( pEntry );
@@ -705,7 +711,7 @@
{
nMode_ = SV_DRAGDROP_CTRL_COPY;
BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
-@@ -213,7 +213,7 @@ BOOL __EXPORT ExtBasicTreeListBox::Notif
+@@ -213,7 +214,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry )
// don't drop on a library, which is not loaded, readonly or password protected
// or which already has a module/dialog with this name
@@ -714,7 +720,7 @@
{
// get source module/dialog name
BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) );
-@@ -351,7 +351,7 @@ BOOL __EXPORT ExtBasicTreeListBox::Notif
+@@ -351,7 +352,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, Sv
rpNewParent = pTarget;
rNewChildPos = 0;
}
@@ -723,7 +729,7 @@
{
// Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen...
rpNewParent = GetParent( pTarget );
-@@ -626,20 +626,27 @@ void ObjectPage::CheckButtons()
+@@ -626,20 +627,29 @@ void ObjectPage::CheckButtons()
{
// enable/disable edit button
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
@@ -731,16 +737,19 @@
+ ScriptDocument aDocument( aDesc.GetDocument() );
+ ::rtl::OUString aOULibName( aDesc.GetLibName() );
+ String aLibSubName( aDesc.GetLibSubName() );
-+ BasicManager* pBasMgr = aDocument.getBasicManager();
-+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( aOULibName ) : 0;
-+ sal_Bool bVBAEnabled = pBasic ? pBasic->isVBAEnabled(): sal_False;
++ bool bVBAEnabled = aDocument.isVBAEnabled( E_SCRIPTS, aOULibName );
+ USHORT nMode = aBasicBox.GetMode();
+
USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
- if ( nDepth == 2 )
-+ if ( ( !bVBAEnabled && ( nDepth == 2 ) )
-+ || ( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 3 ) ) )
- aEditButton.Enable();
+- aEditButton.Enable();
++ if ( nDepth >= 2 )
++ {
++ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) )
++ aEditButton.Disable();
++ else
++ aEditButton.Enable();
++ }
else
aEditButton.Disable();
@@ -756,17 +765,25 @@
Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
-@@ -660,7 +667,8 @@ void ObjectPage::CheckButtons()
+@@ -660,9 +670,14 @@ void ObjectPage::CheckButtons()
}
// enable/disable delete button
- if ( nDepth == 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
-+ if ( ( ( !bVBAEnabled && nDepth == 2 ) || ( bVBAEnabled && ( nDepth == 3 ) && !aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
-+ && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
- aDelButton.Enable();
- else
+- aDelButton.Enable();
+- else
++ if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
++ {
++ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
++ aDelButton.Disable();
++ else
++ aDelButton.Enable();
++ }
++ else
aDelButton.Disable();
-@@ -688,13 +696,20 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button
+ }
+
+@@ -688,13 +703,20 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton )
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
DBG_ASSERT( pCurEntry, "Entry?!" );
@@ -789,7 +806,7 @@
pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
}
}
-@@ -976,14 +991,14 @@ SbModule* createModImpl( Window* pWin, c
+@@ -976,14 +998,14 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
try
{
::rtl::OUString sModuleCode;
@@ -810,13 +827,13 @@
SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE );
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
-@@ -1005,14 +1020,27 @@ SbModule* createModImpl( Window* pWin, c
+@@ -1005,14 +1027,27 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
{
if ( !rBasicBox.IsExpanded( pLibEntry ) )
rBasicBox.Expand( pLibEntry );
- SvLBoxEntry* pEntry = rBasicBox.FindEntry( pLibEntry, aModName, OBJ_TYPE_MODULE );
+ SvLBoxEntry* pSubRootEntry = pLibEntry;
-+ if( pBasic && pBasic->isVBAEnabled() )
++ if( rDocument.isVBAEnabled( E_SCRIPTS, aLibName ) )
+ {
+ // add the new module in the "Modules" entry
+ SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_MODULES ) ) , OBJ_TYPE_NORMAL_MODULES );
@@ -840,3 +857,57 @@
std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
}
+diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
+index fbe3f67..ebd3c06 100644
+--- basctl/source/basicide/scriptdocument.cxx
++++ basctl/source/basicide/scriptdocument.cxx
+@@ -56,6 +56,7 @@
+ #include <com/sun/star/frame/XModel2.hpp>
+ #include <com/sun/star/awt/XWindow2.hpp>
+ #include <com/sun/star/document/XEmbeddedScripts.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ /** === end UNO includes === **/
+
+ #include <sfx2/objsh.hxx>
+@@ -142,6 +143,7 @@ namespace basctl
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::document::XEventBroadcaster;
+ using ::com::sun::star::document::XEmbeddedScripts;
++ using ::com::sun::star::script::XBasicLibraryInfo;
+ /** === end UNO using === **/
+ namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
+ namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
+@@ -1591,6 +1593,18 @@ namespace basctl
+ return m_pImpl->allowMacros();
+ }
+
++ //--------------------------------------------------------------------
++ bool ScriptDocument::isVBAEnabled( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
++ {
++ bool bVBAEnabled = false;
++ if( hasLibrary( _eType, _rLibName ) )
++ {
++ Reference< XBasicLibraryInfo > xVBAInfo( getLibrary( _eType, _rLibName, TRUE ), UNO_QUERY );
++ bVBAEnabled = xVBAInfo.is() ? xVBAInfo->getVBACompatMode() : false;
++ }
++ return bVBAEnabled;
++ }
++
+ //........................................................................
+ } // namespace basctl
+ //........................................................................
+diff --git basctl/source/inc/scriptdocument.hxx basctl/source/inc/scriptdocument.hxx
+index e1730ac..c676ec3 100644
+--- basctl/source/inc/scriptdocument.hxx
++++ basctl/source/inc/scriptdocument.hxx
+@@ -513,6 +513,10 @@ namespace basctl
+ only to be called for real documents (->isDocument)
+ */
+ bool allowMacros() const;
++
++ /** determines whether the VBA mode is enabled for a library of the given type, with the given name
++ */
++ bool isVBAEnabled( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const;
+ };
+
+ //........................................................................
Added: trunk/patches/vba/native-export/vba-ui-option.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/native-export/vba-ui-option.diff Fri Nov 14 04:24:39 2008
@@ -0,0 +1,175 @@
+diff --git basctl/sdi/baside.sdi basctl/sdi/baside.sdi
+index fbdef2d..aa52897 100644
+--- basctl/sdi/baside.sdi
++++ basctl/sdi/baside.sdi
+@@ -126,6 +126,12 @@ shell BasicIDEShell
+ StateMethod = GetState;
+ ]
+
++ SID_BASICIDE_VBAENABLED
++ [
++ ExecMethod = ExecuteCurrent;
++ StateMethod = GetState;
++ ]
++
+ // ========================================================
+ // Global: Egal, welches Fenster gerade aktiv ist:
+ // ========================================================
+diff --git basctl/source/basicide/basides1.cxx basctl/source/basicide/basides1.cxx
+index 3d79067..d1c759a 100644
+--- basctl/source/basicide/basides1.cxx
++++ basctl/source/basicide/basides1.cxx
+@@ -74,6 +74,8 @@
+ #include <com/sun/star/script/XLibraryContainerPassword.hpp>
+ #include <com/sun/star/frame/XDispatchProvider.hpp>
+ #include <com/sun/star/frame/XLayoutManager.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
++#include <com/sun/star/lang/XServiceInfo.hpp>
+
+ #include <algorithm>
+ #include <memory>
+@@ -260,6 +262,28 @@ void __EXPORT BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
+ }
+ }
+ break;
++ case SID_BASICIDE_VBAENABLED:
++ {
++ if( pCurWin )
++ {
++ ScriptDocument aDocument( pCurWin->GetDocument() );
++ if( aDocument.isDocument() )
++ {
++ Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
++ if( xModLibContainer.is() && xModLibContainer->hasByName( m_aCurLibName ) )
++ {
++ Reference< script::XBasicLibraryInfo > xLib;
++ xModLibContainer->getByName( m_aCurLibName ) >>= xLib;
++ if( xLib.is() )
++ {
++ sal_Bool bVBAEnabled = xLib->getVBACompatMode();
++ xLib->setVBACompatMode( !bVBAEnabled );
++ }
++ }
++ }
++ }
++ }
++ break;
+ default:
+ {
+ pCurWin->ExecuteCommand( rReq );
+@@ -1011,6 +1035,37 @@ void __EXPORT BasicIDEShell::GetState(SfxItemSet &rSet)
+ rSet.DisableItem( nWh );
+ }
+ break;
++ case SID_BASICIDE_VBAENABLED:
++ {
++ BOOL bDisable = TRUE;
++ //Reference< XModel > xModel( GetCurrentDocument(), UNO_QUERY );
++ Reference< lang::XServiceInfo > xServiceInfo( GetCurrentDocument(), UNO_QUERY );
++ if( xServiceInfo.is() )
++ {
++ sal_Bool bSupports = xServiceInfo->supportsService( ::rtl::OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument") );
++ bDisable = !bSupports;
++ }
++
++ if( bDisable )
++ {
++ rSet.DisableItem( nWh );
++ }
++ else
++ {
++ ScriptDocument aDocument( pCurWin->GetDocument() );
++ Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
++ if( xModLibContainer.is() && xModLibContainer->hasByName( m_aCurLibName ) )
++ {
++ Reference< script::XBasicLibraryInfo > xLib;
++ xModLibContainer->getByName( m_aCurLibName ) >>= xLib;
++ if( xLib.is() )
++ {
++ rSet.Put( SfxBoolItem( nWh, xLib->getVBACompatMode() ) );
++ }
++ }
++ }
++ }
++ break;
+ }
+ }
+ if ( pCurWin )
+diff --git basctl/uiconfig/basicide/menubar/menubar.xml basctl/uiconfig/basicide/menubar/menubar.xml
+index 8093ae4..d634dc1 100644
+--- basctl/uiconfig/basicide/menubar/menubar.xml
++++ basctl/uiconfig/basicide/menubar/menubar.xml
+@@ -59,6 +59,7 @@
+ <menu:menuitem menu:id=".uno:MacroRecorder"/>
+ <menu:menuitem menu:id=".uno:RunMacro"/>
+ <menu:menu menu:id=".uno:ScriptOrganizer"/>
++ <menu:menuitem menu:id=".uno:VBAEnabled"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1"/>
+ </menu:menupopup>
+diff --git officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+index ff2fa98..6d796ab 100644
+--- officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
++++ officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+@@ -4198,6 +4198,11 @@
+ <value xml:lang="en-US">R~un Macro...</value>
+ </prop>
+ </node>
++ <node oor:name=".uno:VBAEnabled" oor:op="replace">
++ <prop oor:name="Label" oor:type="xs:string">
++ <value xml:lang="en-US">VBA Enabled</value>
++ </prop>
++ </node>
+ <node oor:name=".uno:Gallery" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Gallery</value>
+diff --git sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxsids.hrc
+index 0b61bb6..672a667 100644
+--- sfx2/inc/sfx2/sfxsids.hrc
++++ sfx2/inc/sfx2/sfxsids.hrc
+@@ -1197,6 +1197,7 @@
+ #define SID_BASICIDE_ARG_DOCUMENT_MODEL ( SID_BASICIDE_START + 51 )
+ #define SID_BASICIDE_MANAGE_LANG ( SID_BASICIDE_START + 52 )
+ #define SID_BASICIDE_CURRENT_LANG ( SID_BASICIDE_START + 53 )
++#define SID_BASICIDE_VBAENABLED ( SID_BASICIDE_START + 54 )
+
+ // SlotIds f"ur Apps --------------------------------------------------------
+ #define FN_PARAM (SID_SW_START + 1100)
+diff --git sfx2/sdi/sfx.sdi sfx2/sdi/sfx.sdi
+index e5c5be8..55fe3fb 100644
+--- sfx2/sdi/sfx.sdi
++++ sfx2/sdi/sfx.sdi
+@@ -1036,6 +1036,33 @@ SfxStringItem ChooseMacro SID_BASICIDE_CHOOSEMACRO
+ ]
+
+ //--------------------------------------------------------------------------
++SfxBoolItem VBAEnabled SID_BASICIDE_VBAENABLED
++
++[
++ /* flags: */
++ AutoUpdate = TRUE,
++ Cachable = Cachable,
++ FastCall = FALSE,
++ HasCoreId = FALSE,
++ HasDialog = FALSE,
++ ReadOnlyDoc = TRUE,
++ Toggle = FALSE,
++ Container = TRUE,
++ RecordAbsolute = FALSE,
++ NoRecord;
++ Synchron;
++
++ Readonly = FALSE,
++
++ /* config: */
++ AccelConfig = TRUE,
++ MenuConfig = TRUE,
++ StatusBarConfig = FALSE,
++ ToolBoxConfig = TRUE,
++ GroupId = GID_MACRO;
++]
++
++//--------------------------------------------------------------------------
+ SfxVoidItem ClearHistory SID_CLEARHISTORY
+ ()
+ [
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]