Kaydet (Commit) b1b1015e authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS scriptingf9 (1.10.2); FILE MERGED

2004/12/02 15:45:01 toconnor 1.10.2.2: #i36218# remove Basic specific code
2004/12/01 15:43:23 toconnor 1.10.2.1: #i31395# fix numerous help id problems
üst 15ecb4b9
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: selector.cxx,v $ * $RCSfile: selector.cxx,v $
* *
* $Revision: 1.10 $ * $Revision: 1.11 $
* *
* last change: $Author: obo $ $Date: 2004-11-21 15:02:13 $ * last change: $Author: vg $ $Date: 2004-12-23 11:53:28 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -68,21 +68,6 @@ ...@@ -68,21 +68,6 @@
#ifndef _SV_METRIC_HXX //autogen #ifndef _SV_METRIC_HXX //autogen
#include <vcl/metric.hxx> #include <vcl/metric.hxx>
#endif #endif
#ifndef _SBXCLASS_HXX //autogen
#include <svtools/sbx.hxx>
#endif
#ifndef _SB_SBSTAR_HXX //autogen
#include <basic/sbstar.hxx>
#endif
#ifndef __SBX_SBXMETHOD_HXX //autogen
#include <svtools/sbxmeth.hxx>
#endif
#ifndef _SB_SBMOD_HXX //autogen
#include <basic/sbmod.hxx>
#endif
#ifndef _BASMGR_HXX //autogen
#include <basic/basmgr.hxx>
#endif
#pragma hdrstop #pragma hdrstop
...@@ -105,52 +90,23 @@ ...@@ -105,52 +90,23 @@
#include <unotools/processfactory.hxx> #include <unotools/processfactory.hxx>
#endif #endif
#ifndef _UNOTOOLS_CONFIGMGR_HXX_
#include <unotools/configmgr.hxx>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
#include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/uno/RuntimeException.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_XSCRIPTPROVIDERSUPPLIER_HPP_
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_XSCRIPTPROVIDER_HPP_
#include <com/sun/star/script/provider/XScriptProvider.hpp> #include <com/sun/star/script/provider/XScriptProvider.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_BROWSE_XBROWSENODE_HPP_
#include <com/sun/star/script/browse/XBrowseNode.hpp> #include <com/sun/star/script/browse/XBrowseNode.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_BROWSE_BROWSENODETYPES_HPP_
#include <com/sun/star/script/browse/BrowseNodeTypes.hpp> #include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_BROWSE_BROWSENODEFACTORY_HPP_
#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp> #include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_BROWSE_BROWSENODEFACTORYVIEWTYPE_HPP_
#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp> #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
#endif
#include <drafts/com/sun/star/frame/XModuleManager.hpp> #include <drafts/com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp> #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#ifndef _COM_SUN_STAR_FRAME_XDISPATCHINFORMATIONPROVIDER_HPP_
#include <com/sun/star/frame/XDispatchInformationProvider.hpp> #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_DISPATCHINFORMATION_HPP_
#include <com/sun/star/frame/DispatchInformation.hpp> #include <com/sun/star/frame/DispatchInformation.hpp>
#endif
using ::rtl::OUString; using ::rtl::OUString;
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -271,19 +227,12 @@ void SvxConfigFunctionListBox_Impl::ClearAll() ...@@ -271,19 +227,12 @@ void SvxConfigFunctionListBox_Impl::ClearAll()
{ {
SvxGroupInfo_Impl *pData = aArr[i]; SvxGroupInfo_Impl *pData = aArr[i];
if ( pData->nKind == SFX_CFGFUNCTION_SLOT && pData->pObject != NULL ) if ( pData->nKind == SVX_CFGFUNCTION_SLOT && pData->pObject != NULL )
{ {
delete (OUString*)pData->pObject; delete (OUString*)pData->pObject;
} }
if ( pData->nKind == SFX_CFGFUNCTION_MACRO ) if ( pData->nKind == SVX_CFGFUNCTION_SCRIPT )
{
SfxMacroInfo *pInfo = (SfxMacroInfo*) pData->pObject;
SFX_APP()->GetMacroConfig()->ReleaseSlotId( pInfo->GetSlotId() );
delete pInfo;
}
if ( pData->nKind == SFX_CFGFUNCTION_SCRIPT )
{ {
ScriptInfo *pInfo = (ScriptInfo*) pData->pObject; ScriptInfo *pInfo = (ScriptInfo*) pData->pObject;
if ( pInfo != NULL ) if ( pInfo != NULL )
...@@ -292,7 +241,7 @@ void SvxConfigFunctionListBox_Impl::ClearAll() ...@@ -292,7 +241,7 @@ void SvxConfigFunctionListBox_Impl::ClearAll()
} }
} }
if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER ) if ( pData->nKind == SVX_CFGGROUP_SCRIPTCONTAINER )
{ {
XInterface* xi = static_cast<XInterface *>(pData->pObject); XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL) if (xi != NULL)
...@@ -335,20 +284,6 @@ SvLBoxEntry* SvxConfigFunctionListBox_Impl::GetEntry_Impl( USHORT nId ) ...@@ -335,20 +284,6 @@ SvLBoxEntry* SvxConfigFunctionListBox_Impl::GetEntry_Impl( USHORT nId )
return NULL; return NULL;
} }
SfxMacroInfo* SvxConfigFunctionListBox_Impl::GetMacroInfo()
{
SvLBoxEntry *pEntry = GetLastSelectedEntry();
if ( pEntry )
{
SvxGroupInfo_Impl *pData = (SvxGroupInfo_Impl*) pEntry->GetUserData();
if ( pData && ( pData->nKind == SFX_CFGFUNCTION_MACRO ||
pData->nKind == SFX_CFGFUNCTION_SCRIPT ) )
return (SfxMacroInfo*) pData->pObject;
}
return 0;
}
USHORT SvxConfigFunctionListBox_Impl::GetId( SvLBoxEntry *pEntry ) USHORT SvxConfigFunctionListBox_Impl::GetId( SvLBoxEntry *pEntry )
{ {
SvxGroupInfo_Impl *pData = pEntry ? SvxGroupInfo_Impl *pData = pEntry ?
...@@ -366,7 +301,7 @@ String SvxConfigFunctionListBox_Impl::GetHelpText( SvLBoxEntry *pEntry ) ...@@ -366,7 +301,7 @@ String SvxConfigFunctionListBox_Impl::GetHelpText( SvLBoxEntry *pEntry )
if ( pInfo ) if ( pInfo )
{ {
if ( pInfo->nKind == SFX_CFGFUNCTION_SLOT ) if ( pInfo->nKind == SVX_CFGFUNCTION_SLOT )
{ {
OUString* aCmdURL = (OUString*) pInfo->pObject; OUString* aCmdURL = (OUString*) pInfo->pObject;
...@@ -375,17 +310,11 @@ String SvxConfigFunctionListBox_Impl::GetHelpText( SvLBoxEntry *pEntry ) ...@@ -375,17 +310,11 @@ String SvxConfigFunctionListBox_Impl::GetHelpText( SvLBoxEntry *pEntry )
return aHelpText; return aHelpText;
} }
else if ( pInfo->nKind == SFX_CFGFUNCTION_SCRIPT ) else if ( pInfo->nKind == SVX_CFGFUNCTION_SCRIPT )
{ {
ScriptInfo* pScriptInfo = (ScriptInfo*) pInfo->pObject; ScriptInfo* pScriptInfo = (ScriptInfo*) pInfo->pObject;
return pScriptInfo->GetHelpText(); return pScriptInfo->GetHelpText();
} }
else if ( pInfo->nKind == SFX_CFGFUNCTION_MACRO )
{
// Eintrag ist ein Macro, Hilfe aus der MacroInfo
SfxMacroInfo *pMacInfo = (SfxMacroInfo*) pInfo->pObject;
return pMacInfo->GetHelpText();
}
} }
return String(); return String();
...@@ -419,7 +348,7 @@ SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl( ...@@ -419,7 +348,7 @@ SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl(
Window* pParent, const ResId& rResId, Window* pParent, const ResId& rResId,
ULONG nConfigMode, const Reference< frame::XFrame >& xFrame ) ULONG nConfigMode, const Reference< frame::XFrame >& xFrame )
: SvTreeListBox( pParent, rResId ) : SvTreeListBox( pParent, rResId )
, nMode( nConfigMode ), bShowSF( FALSE ), bShowBasic( TRUE ), , nMode( nConfigMode ), bShowSF( TRUE ),
m_sMyMacros(ResId(STR_MYMACROS)), m_sMyMacros(ResId(STR_MYMACROS)),
m_sProdMacros(ResId(STR_PRODMACROS)), m_sProdMacros(ResId(STR_PRODMACROS)),
m_hdImage(ResId(IMG_HARDDISK)), m_hdImage(ResId(IMG_HARDDISK)),
...@@ -451,37 +380,6 @@ SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl( ...@@ -451,37 +380,6 @@ SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl(
aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ), aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ), aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
BMP_COLOR_HIGHCONTRAST ); BMP_COLOR_HIGHCONTRAST );
// Check configuration to see whether only Basic macros,
// only Scripting Framework scripts, or both should be listed
Any value;
sal_Bool tmp;
value = ::utl::ConfigManager::GetConfigManager()->GetLocalProperty(
OUString::createFromAscii(
"Office.Scripting/ScriptDisplaySettings/ShowBasic" ) );
value >>= tmp;
if (tmp == sal_True) {
bShowBasic = TRUE;
}
else {
bShowBasic = FALSE;
}
value = ::utl::ConfigManager::GetConfigManager()->GetLocalProperty(
OUString::createFromAscii(
"Office.Scripting/ScriptDisplaySettings/ShowSF" ) );
value >>= tmp;
if (tmp == sal_True) {
bShowSF = TRUE;
}
else {
bShowSF = FALSE;
}
} }
...@@ -496,7 +394,7 @@ void SvxConfigGroupListBox_Impl::ClearAll() ...@@ -496,7 +394,7 @@ void SvxConfigGroupListBox_Impl::ClearAll()
for ( USHORT i=0; i<nCount; i++ ) for ( USHORT i=0; i<nCount; i++ )
{ {
SvxGroupInfo_Impl *pData = aArr[i]; SvxGroupInfo_Impl *pData = aArr[i];
if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER ) if ( pData->nKind == SVX_CFGGROUP_SCRIPTCONTAINER )
{ {
XInterface* xi = static_cast<XInterface *>(pData->pObject); XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL) if (xi != NULL)
...@@ -511,38 +409,6 @@ void SvxConfigGroupListBox_Impl::ClearAll() ...@@ -511,38 +409,6 @@ void SvxConfigGroupListBox_Impl::ClearAll()
Clear(); Clear();
} }
String SvxConfigGroupListBox_Impl::GetGroup()
{
SvLBoxEntry *pEntry = FirstSelected();
while ( pEntry )
{
SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData();
if ( pInfo->nKind == SFX_CFGGROUP_FUNCTION )
{
return GetEntryText( pEntry );
break;
}
if ( pInfo->nKind == SFX_CFGGROUP_BASICMGR )
{
BasicManager *pMgr = (BasicManager*) pInfo->pObject;
return pMgr->GetName();
break;
}
if ( pInfo->nKind == SFX_CFGGROUP_DOCBASICMGR )
{
SfxObjectShell *pDoc = (SfxObjectShell*) pInfo->pObject;
return pDoc->GetTitle();
break;
}
pEntry = GetParent( pEntry );
}
return String();
}
void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr ) void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr )
{ {
SetUpdateMode(FALSE); SetUpdateMode(FALSE);
...@@ -651,7 +517,7 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr ) ...@@ -651,7 +517,7 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr )
SvLBoxEntry *pEntry = InsertEntry( group, NULL ); SvLBoxEntry *pEntry = InsertEntry( group, NULL );
SvxGroupInfo_Impl *pInfo = SvxGroupInfo_Impl *pInfo =
new SvxGroupInfo_Impl( SFX_CFGGROUP_FUNCTION, gids[i] ); new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] );
aArr.Insert( pInfo, aArr.Count() ); aArr.Insert( pInfo, aArr.Count() );
pEntry->SetUserData( pInfo ); pEntry->SetUserData( pInfo );
...@@ -659,95 +525,6 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr ) ...@@ -659,95 +525,6 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr )
} }
} }
if ( bShowBasic )
{
// Basics einsammeln
SfxApplication* pSfxApp = SFX_APP();
pSfxApp->EnterBasicCall();
String aMacroName(' ');
aMacroName += String( ResId( STR_BASICMACROS, DIALOG_MGR() ) );
// Zuerst AppBasic
BasicManager *pAppBasicMgr = pSfxApp->GetBasicManager();
BOOL bInsert = TRUE;
if ( pArr )
{
bInsert = FALSE;
for ( USHORT n=0; n<pArr->Count(); n++ )
{
if ( *(*pArr)[n] == pSfxApp->GetName() )
{
bInsert = TRUE;
break;
}
}
}
if ( bInsert )
{
pAppBasicMgr->SetName( pSfxApp->GetName() );
if ( pAppBasicMgr->GetLibCount() )
{
// Nur einf"ugen, wenn Bibliotheken vorhanden
OUString aAppBasTitle;
utl::ConfigManager::GetDirectConfigProperty(
utl::ConfigManager::PRODUCTNAME) >>= aAppBasTitle;
aAppBasTitle += aMacroName;
SvLBoxEntry *pEntry = InsertEntry( aAppBasTitle, 0 );
SvxGroupInfo_Impl *pInfo = new SvxGroupInfo_Impl( SFX_CFGGROUP_BASICMGR, 0, pAppBasicMgr );
aArr.Insert( pInfo, aArr.Count() );
pEntry->SetUserData( pInfo );
pEntry->EnableChildsOnDemand( TRUE );
// Expand( pEntry );
}
}
//SfxObjectShell *pDoc = SfxObjectShell::GetFirst();
SfxObjectShell *pDoc = SfxObjectShell::GetWorkingDocument();
//while ( pDoc )
if ( pDoc )
{
BOOL bInsert = TRUE;
if ( pArr )
{
bInsert = FALSE;
for ( USHORT n=0; n<pArr->Count(); n++ )
{
if ( *(*pArr)[n] == pDoc->GetTitle() )
{
bInsert = TRUE;
break;
}
}
}
if ( bInsert )
{
BasicManager *pBasicMgr = pDoc->GetBasicManager();
if ( pBasicMgr != pAppBasicMgr && pBasicMgr->GetLibCount() )
{
pBasicMgr->SetName( pDoc->GetTitle() );
// Nur einf"ugen, wenn eigenes Basic mit Bibliotheken
SvLBoxEntry *pEntry = InsertEntry( pDoc->GetTitle().Append(aMacroName), NULL );
SvxGroupInfo_Impl *pInfo =
new SvxGroupInfo_Impl( SFX_CFGGROUP_DOCBASICMGR, 0, pDoc );
aArr.Insert( pInfo, aArr.Count() );
pEntry->SetUserData( pInfo );
pEntry->EnableChildsOnDemand( TRUE );
// Expand( pEntry );
}
}
//pDoc = SfxObjectShell::GetNext(*pDoc);
}
pSfxApp->LeaveBasicCall();
}
if ( bShowSF && xContext.is() ) if ( bShowSF && xContext.is() )
{ {
// Add Scripting Framework entries // Add Scripting Framework entries
...@@ -781,7 +558,7 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr ) ...@@ -781,7 +558,7 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr )
rootNode->acquire(); rootNode->acquire();
SvxGroupInfo_Impl *pInfo = SvxGroupInfo_Impl *pInfo =
new SvxGroupInfo_Impl( SFX_CFGGROUP_SCRIPTCONTAINER, 0, new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0,
static_cast<void *>(rootNode.get())); static_cast<void *>(rootNode.get()));
String aTitle = String aTitle =
...@@ -864,7 +641,7 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr ) ...@@ -864,7 +641,7 @@ void SvxConfigGroupListBox_Impl::Init( SvStringsDtor *pArr )
theChild->acquire(); theChild->acquire();
SvxGroupInfo_Impl* pInfo = SvxGroupInfo_Impl* pInfo =
new SvxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, new SvxGroupInfo_Impl(SVX_CFGGROUP_SCRIPTCONTAINER,
0, static_cast<void *>( theChild.get())); 0, static_cast<void *>( theChild.get()));
OSL_TRACE("adding child node %s",::rtl::OUStringToOString( uiName, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); OSL_TRACE("adding child node %s",::rtl::OUStringToOString( uiName, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
...@@ -1045,9 +822,8 @@ void SvxConfigGroupListBox_Impl::GroupSelected() ...@@ -1045,9 +822,8 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData(); SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData();
pFunctionListBox->SetUpdateMode(FALSE); pFunctionListBox->SetUpdateMode(FALSE);
pFunctionListBox->ClearAll(); pFunctionListBox->ClearAll();
if ( pInfo->nKind != SFX_CFGGROUP_FUNCTION && if ( pInfo->nKind != SVX_CFGGROUP_FUNCTION &&
pInfo->nKind != SFX_CFGGROUP_BASICMOD && pInfo->nKind != SVX_CFGGROUP_SCRIPTCONTAINER )
pInfo->nKind != SFX_CFGGROUP_SCRIPTCONTAINER )
{ {
pFunctionListBox->SetUpdateMode(TRUE); pFunctionListBox->SetUpdateMode(TRUE);
return; return;
...@@ -1055,7 +831,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected() ...@@ -1055,7 +831,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
switch ( pInfo->nKind ) switch ( pInfo->nKind )
{ {
case SFX_CFGGROUP_FUNCTION : case SVX_CFGGROUP_FUNCTION :
{ {
SvLBoxEntry *pEntry = FirstSelected(); SvLBoxEntry *pEntry = FirstSelected();
if ( pEntry != NULL ) if ( pEntry != NULL )
...@@ -1086,7 +862,6 @@ void SvxConfigGroupListBox_Impl::GroupSelected() ...@@ -1086,7 +862,6 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
Image aImage; Image aImage;
OUString* aCmdURL = new OUString( commands[i].Command ); OUString* aCmdURL = new OUString( commands[i].Command );
// RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) );
if ( m_pImageProvider ) if ( m_pImageProvider )
{ {
...@@ -1133,7 +908,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected() ...@@ -1133,7 +908,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
} }
SvxGroupInfo_Impl *pInfo = new SvxGroupInfo_Impl( SvxGroupInfo_Impl *pInfo = new SvxGroupInfo_Impl(
SFX_CFGFUNCTION_SLOT, 123, aCmdURL ); SVX_CFGFUNCTION_SLOT, 123, aCmdURL );
pFunctionListBox->aArr.Insert( pFunctionListBox->aArr.Insert(
pInfo, pFunctionListBox->aArr.Count() ); pInfo, pFunctionListBox->aArr.Count() );
...@@ -1144,48 +919,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected() ...@@ -1144,48 +919,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
break; break;
} }
case SFX_CFGGROUP_BASICMOD : case SVX_CFGGROUP_SCRIPTCONTAINER:
{
SvLBoxEntry *pLibEntry = GetParent( pEntry );
SvxGroupInfo_Impl *pLibInfo =
(SvxGroupInfo_Impl*) pLibEntry->GetUserData();
SvLBoxEntry *pBasEntry = GetParent( pLibEntry );
SvxGroupInfo_Impl *pBasInfo =
(SvxGroupInfo_Impl*) pBasEntry->GetUserData();
StarBASIC *pLib = (StarBASIC*) pLibInfo->pObject;
SfxObjectShell *pDoc = NULL;
if ( pBasInfo->nKind == SFX_CFGGROUP_DOCBASICMGR )
pDoc = (SfxObjectShell*) pBasInfo->pObject;
SbModule *pMod = (SbModule*) pInfo->pObject;
for ( USHORT nMeth=0; nMeth < pMod->GetMethods()->Count(); nMeth++ )
{
SbxMethod *pMeth = (SbxMethod*)pMod->GetMethods()->Get(nMeth);
SfxMacroInfoPtr pInf = new SfxMacroInfo( pDoc,
pLib->GetName(),
pMod->GetName(),
pMeth->GetName());
if ( pMeth->GetInfo() )
pInf->SetHelpText( pMeth->GetInfo()->GetComment() );
USHORT nId = SFX_APP()->GetMacroConfig()->GetSlotId( pInf );
if ( !nId )
break; // Kein Slot mehr frei
SvLBoxEntry* pFuncEntry =
pFunctionListBox->InsertEntry( pMeth->GetName(), NULL );
SvxGroupInfo_Impl *pInfo =
new SvxGroupInfo_Impl( SFX_CFGFUNCTION_MACRO, nId, pInf );
pFunctionListBox->aArr.Insert( pInfo, pFunctionListBox->aArr.Count() );
pFuncEntry->SetUserData( pInfo );
}
break;
}
case SFX_CFGGROUP_SCRIPTCONTAINER:
{
if ( !GetChildCount( pEntry ) )
{ {
Reference< browse::XBrowseNode > rootNode( Reference< browse::XBrowseNode > rootNode(
reinterpret_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ; reinterpret_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
...@@ -1228,7 +962,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected() ...@@ -1228,7 +962,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
SvxGroupInfo_Impl* pInfo = SvxGroupInfo_Impl* pInfo =
new SvxGroupInfo_Impl( new SvxGroupInfo_Impl(
SFX_CFGFUNCTION_SCRIPT, 123, aInfo ); SVX_CFGFUNCTION_SCRIPT, 123, aInfo );
Image aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False, BMP_COLOR_NORMAL ); Image aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False, BMP_COLOR_NORMAL );
SvLBoxEntry* pNewEntry = SvLBoxEntry* pNewEntry =
...@@ -1251,7 +985,6 @@ void SvxConfigGroupListBox_Impl::GroupSelected() ...@@ -1251,7 +985,6 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
catch (RuntimeException &e) { catch (RuntimeException &e) {
// do nothing, the entry will not be displayed in the UI // do nothing, the entry will not be displayed in the UI
} }
}
break; break;
} }
...@@ -1311,74 +1044,7 @@ void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry ) ...@@ -1311,74 +1044,7 @@ void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry )
pInfo->bWasOpened = TRUE; pInfo->bWasOpened = TRUE;
switch ( pInfo->nKind ) switch ( pInfo->nKind )
{ {
case SFX_CFGGROUP_BASICMGR : case SVX_CFGGROUP_SCRIPTCONTAINER:
case SFX_CFGGROUP_DOCBASICMGR :
{
if ( !GetChildCount( pEntry ) )
{
// Erstmaliges "Offnen
BasicManager *pMgr;
if ( pInfo->nKind == SFX_CFGGROUP_DOCBASICMGR )
pMgr = ((SfxObjectShell*)pInfo->pObject)->GetBasicManager();
else
pMgr = (BasicManager*) pInfo->pObject;
SvLBoxEntry *pLibEntry = 0;
for ( USHORT nLib=0; nLib<pMgr->GetLibCount(); nLib++)
{
StarBASIC* pLib = pMgr->GetLib( nLib );
pLibEntry = InsertEntry( pMgr->GetLibName( nLib ), pEntry );
SvxGroupInfo_Impl *pInfo = new SvxGroupInfo_Impl( SFX_CFGGROUP_BASICLIB, nLib, pLib );
aArr.Insert( pInfo, aArr.Count() );
pLibEntry->SetUserData( pInfo );
pLibEntry->EnableChildsOnDemand( TRUE );
}
}
break;
}
case SFX_CFGGROUP_BASICLIB :
{
if ( !GetChildCount( pEntry ) )
{
// Erstmaliges "Offnen
StarBASIC *pLib = (StarBASIC*) pInfo->pObject;
if ( !pLib )
{
// Lib mu\s nachgeladen werden
SvLBoxEntry *pParent = GetParent( pEntry );
SvxGroupInfo_Impl *pInf =
(SvxGroupInfo_Impl*) pParent->GetUserData();
BasicManager *pMgr;
if ( pInf->nKind == SFX_CFGGROUP_DOCBASICMGR )
pMgr = ((SfxObjectShell*)pInf->pObject)->GetBasicManager();
else
pMgr = (BasicManager*) pInf->pObject;
if ( pMgr->LoadLib( pInfo->nOrd ) )
pInfo->pObject = pLib = pMgr->GetLib( pInfo->nOrd );
else
break;
}
SvLBoxEntry *pModEntry = 0;
for ( USHORT nMod=0; nMod<pLib->GetModules()->Count(); nMod++ )
{
SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod );
pModEntry = InsertEntry( pMod->GetName(), pEntry );
SvxGroupInfo_Impl *pInfo =
new SvxGroupInfo_Impl( SFX_CFGGROUP_BASICMOD, 0, pMod );
aArr.Insert( pInfo, aArr.Count() );
pModEntry->SetUserData( pInfo );
}
}
break;
}
case SFX_CFGGROUP_SCRIPTCONTAINER:
{ {
if ( !GetChildCount( pEntry ) ) if ( !GetChildCount( pEntry ) )
{ {
...@@ -1454,7 +1120,7 @@ void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry ) ...@@ -1454,7 +1120,7 @@ void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry )
theChild->acquire(); theChild->acquire();
SvxGroupInfo_Impl* pInfo = SvxGroupInfo_Impl* pInfo =
new SvxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, new SvxGroupInfo_Impl(SVX_CFGGROUP_SCRIPTCONTAINER,
0, static_cast<void *>( theChild.get())); 0, static_cast<void *>( theChild.get()));
OUString uiName = theChild->getName(); OUString uiName = theChild->getName();
...@@ -1508,74 +1174,6 @@ void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry ) ...@@ -1508,74 +1174,6 @@ void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry )
} }
} }
void SvxConfigGroupListBox_Impl::SelectMacro( const SfxMacroInfoItem *pItem )
{
SelectMacro( pItem->GetBasicManager()->GetName(),
pItem->GetQualifiedName() );
}
void SvxConfigGroupListBox_Impl::SelectMacro( const String& rBasic,
const String& rMacro )
{
String aBasicName( rBasic );
aBasicName += ' ';
aBasicName += String( ResId( STR_BASICMACROS, DIALOG_MGR() ) );
String aLib, aModule, aMethod;
USHORT nCount = rMacro.GetTokenCount('.');
aMethod = rMacro.GetToken( nCount-1, '.' );
if ( nCount > 2 )
{
aLib = rMacro.GetToken( 0, '.' );
aModule = rMacro.GetToken( nCount-2, '.' );
}
SvLBoxEntry *pEntry = FirstChild(0);
while ( pEntry )
{
String aEntryBas = GetEntryText( pEntry );
if ( aEntryBas == aBasicName )
{
Expand( pEntry );
SvLBoxEntry *pLib = FirstChild( pEntry );
while ( pLib )
{
String aEntryLib = GetEntryText( pLib );
if ( aEntryLib == aLib )
{
Expand( pLib );
SvLBoxEntry *pMod = FirstChild( pLib );
while ( pMod )
{
String aEntryMod = GetEntryText( pMod );
if ( aEntryMod == aModule )
{
Expand( pMod );
MakeVisible( pMod );
Select( pMod );
SvLBoxEntry *pMethod = pFunctionListBox->First();
while ( pMethod )
{
String aEntryMethod = GetEntryText( pMethod );
if ( aEntryMethod == aMethod )
{
pFunctionListBox->Select( pMethod );
pFunctionListBox->MakeVisible( pMethod );
return;
}
pMethod = pFunctionListBox->Next( pMethod );
}
}
pMod = NextSibling( pMod );
}
}
pLib = NextSibling( pLib );
}
}
pEntry = NextSibling( pEntry );
}
}
void void
SvxScriptSelectorDialog::GetDocTitle( SvxScriptSelectorDialog::GetDocTitle(
const Reference< frame::XModel >& xModel, const Reference< frame::XModel >& xModel,
...@@ -1674,7 +1272,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog( ...@@ -1674,7 +1272,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
aOKButton.SetText( String( ResId( STR_SELECTOR_ADD, pMgr ) ) ); aOKButton.SetText( String( ResId( STR_SELECTOR_ADD, pMgr ) ) );
aCancelButton.SetText( String( ResId( STR_SELECTOR_CLOSE, pMgr ) ) ); aCancelButton.SetText( String( ResId( STR_SELECTOR_CLOSE, pMgr ) ) );
aFunctionText.SetText( String( ResId( STR_SELECTOR_COMMANDS, pMgr ) ) ); aFunctionText.SetText( String( ResId( STR_SELECTOR_COMMANDS, pMgr ) ) );
aDialogDescription.SetText( SetDialogDescription(
String( ResId( STR_SELECTOR_ADD_COMMANDS_DESCRIPTION, pMgr ) ) ); String( ResId( STR_SELECTOR_ADD_COMMANDS_DESCRIPTION, pMgr ) ) );
SetText( String( ResId( STR_SELECTOR_ADD_COMMANDS, pMgr ) ) ); SetText( String( ResId( STR_SELECTOR_ADD_COMMANDS, pMgr ) ) );
...@@ -1845,6 +1443,12 @@ SvxScriptSelectorDialog::SetRunLabel() ...@@ -1845,6 +1443,12 @@ SvxScriptSelectorDialog::SetRunLabel()
aOKButton.SetText( String( ResId( STR_SELECTOR_RUN, DIALOG_MGR() ) ) ); aOKButton.SetText( String( ResId( STR_SELECTOR_RUN, DIALOG_MGR() ) ) );
} }
void
SvxScriptSelectorDialog::SetDialogDescription( const String& rDescription )
{
aDialogDescription.SetText( rDescription );
}
USHORT USHORT
SvxScriptSelectorDialog::GetSelectedId() SvxScriptSelectorDialog::GetSelectedId()
{ {
...@@ -1860,7 +1464,7 @@ SvxScriptSelectorDialog::GetScriptURL() ...@@ -1860,7 +1464,7 @@ SvxScriptSelectorDialog::GetScriptURL()
if ( pEntry ) if ( pEntry )
{ {
SvxGroupInfo_Impl *pData = (SvxGroupInfo_Impl*) pEntry->GetUserData(); SvxGroupInfo_Impl *pData = (SvxGroupInfo_Impl*) pEntry->GetUserData();
if ( pData->nKind == SFX_CFGFUNCTION_SLOT ) if ( pData->nKind == SVX_CFGFUNCTION_SLOT )
{ {
if ( pData->pObject != NULL ) if ( pData->pObject != NULL )
{ {
...@@ -1868,7 +1472,7 @@ SvxScriptSelectorDialog::GetScriptURL() ...@@ -1868,7 +1472,7 @@ SvxScriptSelectorDialog::GetScriptURL()
result = OUString( *tmp ); result = OUString( *tmp );
} }
} }
else if ( pData->nKind == SFX_CFGFUNCTION_SCRIPT ) else if ( pData->nKind == SVX_CFGFUNCTION_SCRIPT )
{ {
ScriptInfo* pInfo = (ScriptInfo*) pData->pObject; ScriptInfo* pInfo = (ScriptInfo*) pData->pObject;
if ( pInfo != NULL ) if ( pInfo != NULL )
...@@ -1876,15 +1480,6 @@ SvxScriptSelectorDialog::GetScriptURL() ...@@ -1876,15 +1480,6 @@ SvxScriptSelectorDialog::GetScriptURL()
result = pInfo->GetURI(); result = pInfo->GetURI();
} }
} }
else
{
SfxMacroInfo* info = aCommands.GetMacroInfo();
if ( info != NULL )
{
result = info->GetURL();
}
}
} }
return result; return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment