diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-11-01 15:32:54 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-11-01 15:32:54 +0100 |
commit | b5b8f1ecabe9fc92d357585202beb237fa813746 (patch) | |
tree | 37f1dadcaa5aa4b5b7669433e605b9a35bba2323 | |
parent | f6bf7a32d624cdef6fe31447b82de08a9e96a5df (diff) |
undoapi: moved the last remaining method of SfxMacroConfig (::Call) into the SfxApplication, and got rid of the class completely
-rw-r--r-- | sfx2/inc/sfx2/app.hxx | 6 | ||||
-rw-r--r-- | sfx2/inc/sfx2/macrconf.hxx | 51 | ||||
-rw-r--r-- | sfx2/inc/sfx2/objsh.hxx | 4 | ||||
-rw-r--r-- | sfx2/inc/sfxbasic.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/app.cxx | 21 | ||||
-rw-r--r-- | sfx2/source/control/macrconf.cxx | 30 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 15 | ||||
-rw-r--r-- | svx/source/form/fmview.cxx | 1 |
8 files changed, 38 insertions, 91 deletions
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index 6492ac8fbfce..4fe3033ea575 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -31,6 +31,7 @@ #include "sfx2/dllapi.h" #include "sal/types.h" #include <tools/solar.h> +#include <tools/errcode.hxx> #include <svl/smplhint.hxx> #include <svl/poolitem.hxx> #include <vcl/image.hxx> @@ -98,6 +99,8 @@ struct SfxStbCtrlFactory; struct SfxTbxCtrlFactory; class SimpleResMgr; class ModalDialog; +class SbxArray; +class SbxValue; namespace sfx2 { @@ -227,6 +230,9 @@ public: static sal_Bool IsXScriptURL( const String& rScriptURL ); static ::rtl::OUString ChooseScript(); static void MacroOrganizer( INT16 nTabId ); + static ErrCode CallBasic( const String&, BasicManager*, SbxArray *pArgs, SbxValue *pRet ); + static ErrCode CallAppBasic( const String& i_macroName, SbxArray* i_args = NULL, SbxValue* i_ret = NULL ) + { return CallBasic( i_macroName, SfxApplication::GetOrCreate()->GetBasicManager(), i_args, i_ret ); } BasicManager* GetBasicManager(); com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > GetDialogContainer(); diff --git a/sfx2/inc/sfx2/macrconf.hxx b/sfx2/inc/sfx2/macrconf.hxx deleted file mode 100644 index abc0f0ad5d4d..000000000000 --- a/sfx2/inc/sfx2/macrconf.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_MACROCONF_HXX -#define _SFX_MACROCONF_HXX - -#include "sal/config.h" -#include "sfx2/dllapi.h" -#include "sal/types.h" -#include <tools/errcode.hxx> - -class SfxMacroInfoItem; -class BasicManager; -class SbxValue; -class SbxObject; -class SbxArray; -class String; - -class SFX2_DLLPUBLIC SfxMacroConfig -{ -private: - SfxMacroConfig(); - ~SfxMacroConfig(); -public: - static ErrCode Call( SbxObject*, const String&, BasicManager*, SbxArray *pArgs=NULL, SbxValue *pRet=NULL ); -}; - -#endif diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 299cd2e596c0..1813a9ed18fa 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -364,8 +364,8 @@ public: Window *pParent, const SfxItemSet& ); ErrCode CallBasic( const String& rMacro, const String& rBasicName, - SbxObject* pVCtrl, SbxArray* pArgs = 0, SbxValue* pRet = 0 ); - ErrCode Call( const String & rCode, sal_Bool bIsBasicReturn, SbxObject * pVCtrl = NULL ); + SbxArray* pArgs = 0, SbxValue* pRet = 0 ); + ErrCode Call( const String & rCode, sal_Bool bIsBasicReturn ); ErrCode CallScript( const String & rScriptType, const String & rCode, const void* pArgs = NULL, void* pRet = NULL ); diff --git a/sfx2/inc/sfxbasic.hxx b/sfx2/inc/sfxbasic.hxx index fe4a7070ea18..5c367c52a2d4 100644 --- a/sfx2/inc/sfxbasic.hxx +++ b/sfx2/inc/sfxbasic.hxx @@ -29,6 +29,7 @@ class BasicManager; class SbMethod; +class String; //------------------------------------------------------------------ diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 7e4e9921573a..c0b426c387bc 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -36,11 +36,14 @@ #endif // UNX #include <sfx2/app.hxx> +#include "sfxbasic.hxx" #include <sfx2/frame.hxx> #include <vos/process.hxx> #include <tools/simplerm.hxx> #include <tools/config.hxx> #include <basic/basrdll.hxx> +#include <basic/sbmeth.hxx> +#include <basic/sbmod.hxx> #include <svtools/asynclink.hxx> #include <svl/stritem.hxx> #ifndef _SOUND_HXX //autogen @@ -843,3 +846,21 @@ void SfxApplication::MacroOrganizer( INT16 nTabId ) pSymbol( nTabId ); } +ErrCode SfxApplication::CallBasic( const String& rCode, BasicManager* pMgr, SbxArray* pArgs, SbxValue* pRet ) +{ + SfxApplication *pApp = SFX_APP(); + pApp->EnterBasicCall(); + SbMethod* pMethod = SfxQueryMacro( pMgr, rCode ); + ErrCode nErr = 0; + if( pMethod ) + { + if ( pArgs ) + pMethod->SetParameters( pArgs ); + nErr = pMethod->Call( pRet ); + } + else + nErr = ERRCODE_BASIC_PROC_UNDEFINED; + + pApp->LeaveBasicCall(); + return nErr; +} diff --git a/sfx2/source/control/macrconf.cxx b/sfx2/source/control/macrconf.cxx index ca0f9213c10a..30d8cd7a026f 100644 --- a/sfx2/source/control/macrconf.cxx +++ b/sfx2/source/control/macrconf.cxx @@ -28,8 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#include "sfx2/macrconf.hxx" -#include "sfx2/app.hxx" +#include "sfxbasic.hxx" #include <basic/sbmeth.hxx> #include <basic/sbmod.hxx> @@ -87,30 +86,3 @@ SbMethod* SfxQueryMacro( BasicManager* pMgr , const String& rMacro ) return SfxQueryMacro_Impl( pMgr, aMacro, aLibName, aModule ); } -//========================================================================== - -ErrCode SfxMacroConfig::Call( - SbxObject* /*pVCtrl*/, - const String& rCode, - BasicManager* pMgr, - SbxArray *pArgs, - SbxValue *pRet ) -{ - SfxApplication *pApp = SFX_APP(); - pApp->EnterBasicCall(); - SbMethod* pMethod = SfxQueryMacro( pMgr, rCode ); - ErrCode nErr = 0; - if( pMethod ) - { - if ( pArgs ) - pMethod->SetParameters( pArgs ); - nErr = pMethod->Call( pRet ); - } - else - nErr = ERRCODE_BASIC_PROC_UNDEFINED; - - pApp->LeaveBasicCall(); - return nErr; -} - - diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 18571366e80e..db4ddfea0ce6 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -140,7 +140,6 @@ using namespace ::com::sun::star::container; #include <sfx2/ctrlitem.hxx> #include "arrdecl.hxx" #include <sfx2/module.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/docfac.hxx> #include "helper.hxx" #include "doc.hrc" @@ -1652,7 +1651,7 @@ SfxModule* SfxObjectShell::GetModule() const } ErrCode SfxObjectShell::CallBasic( const String& rMacro, - const String& rBasic, SbxObject* pVCtrl, SbxArray* pArgs, + const String& rBasic, SbxArray* pArgs, SbxValue* pRet ) { SfxApplication* pApp = SFX_APP(); @@ -1665,15 +1664,15 @@ ErrCode SfxObjectShell::CallBasic( const String& rMacro, BasicManager *pMgr = GetBasicManager(); if( pApp->GetName() == rBasic ) pMgr = pApp->GetBasicManager(); - ErrCode nRet = SfxMacroConfig::Call( pVCtrl, rMacro, pMgr, pArgs, pRet ); + ErrCode nRet = SfxApplication::CallBasic( rMacro, pMgr, pArgs, pRet ); return nRet; } -ErrCode SfxObjectShell::Call( const String & rCode, sal_Bool bIsBasicReturn, SbxObject * pVCtrl ) +ErrCode SfxObjectShell::Call( const String & rCode, sal_Bool bIsBasicReturn ) { ErrCode nErr = ERRCODE_NONE; if ( bIsBasicReturn ) - CallBasic( rCode, String(), pVCtrl ); + CallBasic( rCode, String() ); return nErr; } @@ -1833,7 +1832,7 @@ ErrCode SfxObjectShell::CallStarBasicScript( const String& _rMacroName, const St #endif // call the script - ErrCode eError = CallBasic( _rMacroName, sMacroLocation, NULL, xMacroArguments, xReturn ); + ErrCode eError = CallBasic( _rMacroName, sMacroLocation, xMacroArguments, xReturn ); // translate the return value lcl_translateBasic2Uno( xReturn, _pReturn ); @@ -1861,7 +1860,7 @@ ErrCode SfxObjectShell::CallScript( SbxVariableRef xReturn = pRet ? new SbxVariable : NULL; // call the script - nErr = CallBasic( rCode, String(), NULL, xMacroArguments, xReturn ); + nErr = CallBasic( rCode, String(), xMacroArguments, xReturn ); // translate the return value lcl_translateBasic2Uno( xReturn, pRet ); @@ -1869,7 +1868,7 @@ ErrCode SfxObjectShell::CallScript( // did this fail because the method was not found? if ( nErr == ERRCODE_BASIC_PROC_UNDEFINED ) { // yep-> look in the application BASIC module - nErr = CallBasic( rCode, SFX_APP()->GetName(), NULL, xMacroArguments, xReturn ); + nErr = CallBasic( rCode, SFX_APP()->GetName(), xMacroArguments, xReturn ); } } else if( rScriptType.EqualsAscii( "JavaScript" ) ) diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 22681d511b82..71eed4a0c60e 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -46,7 +46,6 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <basic/sbuno.hxx> -#include <sfx2/macrconf.hxx> #include <basic/sbx.hxx> #include "fmitems.hxx" #include "fmobj.hxx" |