undoapi: removed SfxMacroConfig functionality which related to administration of slot runtime-generated slot IDs corresponding to script macros - the last (pseudo-) client of this was just removed, so all of this is dead

This commit is contained in:
Frank Schoenheit [fs] 2010-11-01 15:32:51 +01:00
parent 0c8fe3c858
commit db9a2bb5c0
4 changed files with 0 additions and 196 deletions

View file

@ -292,8 +292,6 @@ public:
SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
SAL_DLLPRIVATE void PropExec_Impl(SfxRequest &);
SAL_DLLPRIVATE void PropState_Impl(SfxItemSet &);
SAL_DLLPRIVATE void MacroExec_Impl(SfxRequest &);
SAL_DLLPRIVATE void MacroState_Impl(SfxItemSet &);
SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
SAL_DLLPRIVATE void OfaExec_Impl(SfxRequest &);

View file

@ -130,17 +130,12 @@ public:
//ASDBG const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rSource, void *pArgs, void *pRet );
static SbMethod* GetMethod_Impl( const String&, BasicManager* );
sal_uInt16 GetSlotId(SfxMacroInfoPtr);
void ReleaseSlotId(sal_uInt16 nId);
void RegisterSlotId(sal_uInt16 nId);
SfxMacroInfo* GetMacroInfo(sal_uInt16 nId) const;
sal_Bool ExecuteMacro(sal_uInt16 nId, const String& rArgs ) const;
sal_Bool ExecuteMacro( SfxObjectShell*, const SvxMacro*, const String& ) const;
//#if 0 // _SOLAR__PRIVATE
SAL_DLLPRIVATE static void Release_Impl();
SAL_DLLPRIVATE const SfxMacroInfo* GetMacroInfo_Impl( const SvxMacro *pMacro ) const;
DECL_DLLPRIVATE_LINK( CallbackHdl_Impl, SfxMacroConfig*);
DECL_DLLPRIVATE_LINK( EventHdl_Impl, SfxMacroInfo*);
//#endif
};

View file

@ -431,31 +431,6 @@ void SfxApplication::PropState_Impl( SfxItemSet &rSet )
}
}
//--------------------------------------------------------------------
void SfxApplication::MacroExec_Impl( SfxRequest& rReq )
{
DBG_MEMTEST();
if ( SfxMacroConfig::IsMacroSlot( rReq.GetSlot() ) )
{
// SlotId referenzieren, damit nicht im Execute der Slot abgeschossen
// werden kann
GetMacroConfig()->RegisterSlotId(rReq.GetSlot());
SFX_REQUEST_ARG(rReq, pArgs, SfxStringItem,
rReq.GetSlot(), sal_False);
String aArgs;
if( pArgs ) aArgs = pArgs->GetValue();
if ( GetMacroConfig()->ExecuteMacro(rReq.GetSlot(), aArgs ) )
rReq.Done();
GetMacroConfig()->ReleaseSlotId(rReq.GetSlot());
}
}
//--------------------------------------------------------------------
void SfxApplication::MacroState_Impl( SfxItemSet& )
{
DBG_MEMTEST();
}
//-------------------------------------------------------------------------
void SfxApplication::PlayMacro_Impl( SfxRequest &rReq, StarBASIC *pBasic )

View file

@ -419,73 +419,6 @@ SfxMacroConfig::~SfxMacroConfig()
//==========================================================================
SFX_STATE_STUB( SfxApplication, MacroState_Impl )
SFX_EXEC_STUB( SfxApplication, MacroExec_Impl )
sal_uInt16 SfxMacroConfig::GetSlotId(SfxMacroInfoPtr pInfo)
{
sal_uInt16 nCount = pImp->aArr.Count(); // Macro suchen
sal_uInt16 i;
for (i=0; i<nCount; i++)
if ((*(pImp->aArr)[i]) == (*pInfo))
break;
if (i == nCount)
{ // Macro noch unbekannt
nCount = aIdArray.Count();
sal_uInt16 n;
for (n=0; n<nCount; n++) // freie SlotId suchen
if (aIdArray[n] > SID_MACRO_START + n)
break;
sal_uInt16 nNewSlotId = SID_MACRO_START + n;
if ( nNewSlotId > SID_MACRO_END )
return 0;
aIdArray.Insert( SID_MACRO_START + n, n );
SfxSlot *pNewSlot = new SfxSlot;
pNewSlot->nSlotId = SID_MACRO_START + n;
pNewSlot->nGroupId = 0;
pNewSlot->nFlags = SFX_SLOT_ASYNCHRON;
pNewSlot->nMasterSlotId = 0;
pNewSlot->nValue = 0;
pNewSlot->fnExec = SFX_STUB_PTR(SfxApplication,MacroExec_Impl);
pNewSlot->fnState = SFX_STUB_PTR(SfxApplication,MacroState_Impl);
pNewSlot->pType = 0; HACK(SFX_TYPE(SfxVoidItem))
pNewSlot->pName = pNewSlot->pMethodName = U2S(pInfo->aMethodName).getStr();
pNewSlot->pLinkedSlot = 0;
pNewSlot->nArgDefCount = 0;
pNewSlot->pFirstArgDef = 0;
pNewSlot->pUnoName = 0;
if (nCount)
{
SfxSlot *pSlot = (pImp->aArr)[0]->pSlot;
pNewSlot->pNextSlot = pSlot->pNextSlot;
pSlot->pNextSlot = pNewSlot;
}
else
pNewSlot->pNextSlot = pNewSlot;
// Macro uebernehmen
SfxMacroInfoPtr pNewInfo = new SfxMacroInfo(*pInfo);
pNewInfo->nSlotId = SID_MACRO_START + n;
pImp->aArr.Insert(pNewInfo,n);
pNewInfo->pSlot = pNewSlot;
pInfo->nSlotId = pNewInfo->nSlotId;
pNewInfo->nRefCnt++;
}
else
{
pInfo->nSlotId = (pImp->aArr)[i]->nSlotId;
(pImp->aArr)[i]->nRefCnt++;
}
return pInfo->nSlotId;
}
//==========================================================================
void SfxMacroConfig::ReleaseSlotId(sal_uInt16 nId)
{
DBG_ASSERT( IsMacroSlot( nId ), "SlotId ist kein Macro!");
@ -572,103 +505,6 @@ SfxMacroInfo* SfxMacroConfig::GetMacroInfo(sal_uInt16 nId) const
return 0;
}
//==========================================================================
const SfxMacroInfo* SfxMacroConfig::GetMacroInfo_Impl( const SvxMacro *pMacro ) const
{
sal_uInt16 nCount = pImp->aArr.Count();
for (sal_uInt16 i=0; i<nCount; i++)
if ((pImp->aArr)[i]->Compare(*pMacro) )
return (pImp->aArr)[i];
return 0;
}
//==========================================================================
sal_Bool SfxMacroConfig::ExecuteMacro( sal_uInt16 nId, const String& rArgs ) const
{
const SfxMacroInfo* pInfo = GetMacroInfo( nId );
if ( !pInfo )
return sal_False;
SfxObjectShell* pSh = SfxObjectShell::Current();
SvxMacro aMacro( pInfo->GetQualifiedName(), pInfo->GetBasicName(), STARBASIC );
sal_Bool bRet = ExecuteMacro( pSh, &aMacro, rArgs );
// Release, da im Dispatcher-Execute ein Register gemacht wurde
((SfxMacroConfig*)this)->ReleaseSlotId( nId );
return bRet;
}
sal_Bool SfxMacroConfig::ExecuteMacro( SfxObjectShell *pSh, const SvxMacro* pMacro, const String& /*rArgs*/ ) const
{
SfxApplication *pApp = SFX_APP();
// Name des Macros oder Scripts bzw. ScriptCode
String aCode( pMacro->GetMacName() );
ErrCode nErr = ERRCODE_NONE;
// Ist es ein Basic-Macro ?
ScriptType eSType = pMacro->GetScriptType();
sal_Bool bIsBasic = eSType == STARBASIC;
sal_Bool bIsStarScript = ( eSType == EXTENDED_STYPE && pMacro->GetLibName().SearchAscii( "StarScript" ) != STRING_NOTFOUND );
sal_Bool bIsBasicLibBased = bIsBasic || bIsStarScript || !pSh;
if ( bIsBasicLibBased )
{
pApp->EnterBasicCall();
BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
if( bIsBasic )
{
// BasicManager von Document?
BasicManager *pMgr = pSh ? pSh->GetBasicManager() : NULL;
// Da leider der Name zwischendurch h"aufig gewechselt hat ...
if( SFX_APP()->GetName() == pMacro->GetLibName() ||
pMacro->GetLibName().EqualsAscii("StarDesktop") )
pMgr = pAppMgr;
else if ( pMgr == pAppMgr )
pMgr = NULL;
if ( pSh && pMgr && pMgr != pAppMgr )
{
if ( !pSh->AdjustMacroMode( String() ) )
return sal_False;
}
if ( pSh && pMgr && pMgr == pAppMgr )
{
::com::sun::star::uno::Any aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pSh->GetModel() ) );
nErr = Call( 0, aCode, pMgr );
pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
}
else if ( pMgr )
nErr = Call( 0, aCode, pMgr );
else
nErr = SbxERR_NO_METHOD;
}
pApp->LeaveBasicCall();
}
else
{
nErr = SbxERR_NO_METHOD;
}
return ( nErr == ERRCODE_NONE );
}
//==========================================================================
IMPL_LINK( SfxMacroConfig, CallbackHdl_Impl, SfxMacroConfig*, pConfig )
{
(void)pConfig; // unused
pImp->bWaitingForCallback = sal_False;
return 0;
}
IMPL_LINK( SfxMacroConfig, EventHdl_Impl, SfxMacroInfo*, pInfo )
{
delete pInfo;