diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2011-01-28 11:59:17 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2011-01-28 11:59:17 +0100 |
commit | f4731b6f2e2a0192aa2858a95f8c7d676b1e20ea (patch) | |
tree | e49eee66d7be71365fa7255fe679a6752a1aa241 | |
parent | dd8d794f7e36c45c185b397a777f2f5e9cb36d99 (diff) | |
parent | ddf597390850c7693937d4629c53bd480fd73810 (diff) |
CWS-TOOLING: integrate CWS undoapi
30 files changed, 357 insertions, 877 deletions
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx index 4ab42fbe97a7..fa7954172134 100644 --- a/basctl/source/basicide/basicbox.cxx +++ b/basctl/source/basicide/basicbox.cxx @@ -144,9 +144,7 @@ void DocListenerBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ void DocListenerBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ ) { - if ( SFX_APP()->IsInBasicCall() ) - // Nicht wenn Office beendet - FillBox(); + FillBox(); } void DocListenerBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index d0a8ca1a6ddb..77a9af87df03 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1332,7 +1332,7 @@ USHORT ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem, BOO return nFound; } -SfxUndoManager* __EXPORT ModulWindow::GetUndoManager() +::svl::IUndoManager* __EXPORT ModulWindow::GetUndoManager() { if ( GetEditEngine() ) return &GetEditEngine()->GetUndoManager(); diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 280bb6ee3ab6..925e5fab1d4b 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -443,7 +443,8 @@ public: virtual void BasicStarted(); virtual void BasicStopped(); - virtual SfxUndoManager* GetUndoManager(); + virtual ::svl::IUndoManager* + GetUndoManager(); const ::rtl::OUString& GetModule() const { return m_aModule; } void SetModule( const ::rtl::OUString& aModule ) { m_aModule = aModule; } diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 84291656c755..5dfc2d281f25 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -1281,7 +1281,7 @@ BOOL __EXPORT DialogWindow::IsModified() return pEditor->IsModified(); } -SfxUndoManager* __EXPORT DialogWindow::GetUndoManager() +::svl::IUndoManager* __EXPORT DialogWindow::GetUndoManager() { return pUndoMgr; } diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 0af7b9dda920..02dbb525b972 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -210,8 +210,6 @@ void BasicIDEShell::Init() SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BasicIDE" ) ) ); SetHelpId( SVX_INTERFACE_BASIDE_VIEWSH ); - SFX_APP()->EnterBasicCall(); - LibBoxControl::RegisterControl( SID_BASICIDE_LIBSELECTOR ); LanguageBoxControl::RegisterControl( SID_BASICIDE_CURRENT_LANG ); @@ -289,7 +287,6 @@ __EXPORT BasicIDEShell::~BasicIDEShell() // ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war. // GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); - SFX_APP()->LeaveBasicCall(); IDE_DLL()->GetExtraData()->ShellInCriticalSection() = FALSE; GnBasicIDEShellCount--; @@ -554,9 +551,9 @@ void BasicIDEShell::ArrangeTabBar() -SfxUndoManager* BasicIDEShell::GetUndoManager() +::svl::IUndoManager* BasicIDEShell::GetUndoManager() { - SfxUndoManager* pMgr = NULL; + ::svl::IUndoManager* pMgr = NULL; if( pCurWin ) pMgr = pCurWin->GetUndoManager(); diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 9604a8bd9933..88c5b6fd63ec 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -30,23 +30,29 @@ #include <ide_pch.hxx> -#include <vector> -#include <algorithm> -#include <basic/sbx.hxx> -#include <unotools/moduleoptions.hxx> +#include "basobj.hxx" +#include "iderdll.hxx" +#include "iderdll2.hxx" +#include "iderid.hxx" +#include "macrodlg.hxx" +#include "moduldlg.hxx" +#include "basidesh.hxx" +#include "basidesh.hrc" +#include "baside2.hxx" +#include "basicmod.hxx" +#include "basdoc.hxx" + #include <com/sun/star/document/XEmbeddedScripts.hpp> #include <com/sun/star/document/XScriptInvocationContext.hpp> -#include <basobj.hxx> -#include <iderdll.hxx> -#include <iderdll2.hxx> -#include <iderid.hxx> -#include <macrodlg.hxx> -#include <moduldlg.hxx> -#include <basidesh.hxx> -#include <basidesh.hrc> -#include <baside2.hxx> -#include <basicmod.hxx> -#include <basdoc.hxx> + +#include <basic/sbx.hxx> +#include <framework/documentundoguard.hxx> +#include <tools/diagnose_ex.h> +#include <unotools/moduleoptions.hxx> + +#include <vector> +#include <algorithm> +#include <memory> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -216,6 +222,51 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const return true; } + +//---------------------------------------------------------------------------- + +namespace +{ + struct MacroExecutionData + { + ScriptDocument aDocument; + SbMethodRef xMethod; + + MacroExecutionData() + :aDocument( ScriptDocument::NoDocument ) + ,xMethod( NULL ) + { + } + }; + + class MacroExecution + { + public: + DECL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData* ); + }; + + + IMPL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData*, i_pData ) + { + (void)pThis; + ENSURE_OR_RETURN( i_pData, "wrong MacroExecutionData", 0L ); + // take ownership of the data + ::std::auto_ptr< MacroExecutionData > pData( i_pData ); + + DBG_ASSERT( pData->xMethod->GetParent()->GetFlags() & SBX_EXTSEARCH, "Kein EXTSEARCH!" ); + + // in case this is a document-local macro, try to protect the document's Undo Manager from + // flawed scripts + ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard; + if ( pData->aDocument.isDocument() ) + pUndoGuard.reset( new ::framework::DocumentUndoGuard( pData->aDocument.getDocument() ) ); + + BasicIDE::RunMethod( pData->xMethod ); + + return 1L; + } +} + //---------------------------------------------------------------------------- ::rtl::OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, BOOL bChooseOnly, const ::rtl::OUString& rMacroDesc ) @@ -225,13 +276,12 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const BasicIDEDLL::Init(); IDE_DLL()->GetExtraData()->ChoosingMacro() = TRUE; - SFX_APP()->EnterBasicCall(); String aScriptURL; BOOL bError = FALSE; SbMethod* pMethod = NULL; - MacroChooser* pChooser = new MacroChooser( NULL, TRUE ); + ::std::auto_ptr< MacroChooser > pChooser( new MacroChooser( NULL, TRUE ) ); if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() ) pChooser->SetMode( MACROCHOOSER_CHOOSEONLY ); @@ -251,103 +301,95 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const if ( !pMethod && pChooser->GetMode() == MACROCHOOSER_RECORDING ) pMethod = pChooser->CreateMacro(); - if ( pMethod ) + if ( !pMethod ) + break; + + SbModule* pModule = pMethod->GetModule(); + ENSURE_OR_BREAK( pModule, "BasicIDE::ChooseMacro: No Module found!" ); + + StarBASIC* pBasic = (StarBASIC*)pModule->GetParent(); + ENSURE_OR_BREAK( pBasic, "BasicIDE::ChooseMacro: No Basic found!" ); + + BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); + ENSURE_OR_BREAK( pBasMgr, "BasicIDE::ChooseMacro: No BasicManager found!" ); + + // name + String aName; + aName += pBasic->GetName(); + aName += '.'; + aName += pModule->GetName(); + aName += '.'; + aName += pMethod->GetName(); + + // language + String aLanguage = String::CreateFromAscii("Basic"); + + // location + String aLocation; + ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); + if ( aDocument.isDocument() ) { - SbModule* pModule = pMethod->GetModule(); - DBG_ASSERT(pModule, "BasicIDE::ChooseMacro: No Module found!"); - if ( pModule ) - { - StarBASIC* pBasic = (StarBASIC*)pModule->GetParent(); - DBG_ASSERT(pBasic, "BasicIDE::ChooseMacro: No Basic found!"); - if ( pBasic ) - { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - DBG_ASSERT(pBasMgr, "BasicIDE::ChooseMacro: No BasicManager found!"); - if ( pBasMgr ) - { - // name - String aName; - aName += pBasic->GetName(); - aName += '.'; - aName += pModule->GetName(); - aName += '.'; - aName += pMethod->GetName(); - - // language - String aLanguage = String::CreateFromAscii("Basic"); - - // location - String aLocation; - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - if ( aDocument.isDocument() ) - { - // document basic - aLocation = String::CreateFromAscii("document"); - - if ( rxLimitToDocument.is() ) - { - uno::Reference< frame::XModel > xLimitToDocument( rxLimitToDocument ); - - uno::Reference< document::XEmbeddedScripts > xScripts( rxLimitToDocument, UNO_QUERY ); - if ( !xScripts.is() ) - { // the document itself does not support embedding scripts - uno::Reference< document::XScriptInvocationContext > xContext( rxLimitToDocument, UNO_QUERY ); - if ( xContext.is() ) - xScripts = xContext->getScriptContainer(); - if ( xScripts.is() ) - { // but it is able to refer to a document which actually does support this - xLimitToDocument.set( xScripts, UNO_QUERY ); - if ( !xLimitToDocument.is() ) - { - OSL_ENSURE( false, "BasicIDE::ChooseMacro: a script container which is no document!?" ); - xLimitToDocument = rxLimitToDocument; - } - } - } - - if ( xLimitToDocument != aDocument.getDocument() ) - { - // error - bError = TRUE; - ErrorBox( NULL, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_ERRORCHOOSEMACRO ) ) ).Execute(); - } - } - } - else - { - // application basic - aLocation = String::CreateFromAscii("application"); - } + // document basic + aLocation = String::CreateFromAscii("document"); - // script URL - if ( !bError ) + if ( rxLimitToDocument.is() ) + { + uno::Reference< frame::XModel > xLimitToDocument( rxLimitToDocument ); + + uno::Reference< document::XEmbeddedScripts > xScripts( rxLimitToDocument, UNO_QUERY ); + if ( !xScripts.is() ) + { // the document itself does not support embedding scripts + uno::Reference< document::XScriptInvocationContext > xContext( rxLimitToDocument, UNO_QUERY ); + if ( xContext.is() ) + xScripts = xContext->getScriptContainer(); + if ( xScripts.is() ) + { // but it is able to refer to a document which actually does support this + xLimitToDocument.set( xScripts, UNO_QUERY ); + if ( !xLimitToDocument.is() ) { - aScriptURL = String::CreateFromAscii("vnd.sun.star.script:"); - aScriptURL += aName; - aScriptURL += String::CreateFromAscii("?language="); - aScriptURL += aLanguage; - aScriptURL += String::CreateFromAscii("&location="); - aScriptURL += aLocation; + OSL_ENSURE( false, "BasicIDE::ChooseMacro: a script container which is no document!?" ); + xLimitToDocument = rxLimitToDocument; } } } + + if ( xLimitToDocument != aDocument.getDocument() ) + { + // error + bError = TRUE; + ErrorBox( NULL, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_ERRORCHOOSEMACRO ) ) ).Execute(); + } } } + else + { + // application basic + aLocation = String::CreateFromAscii("application"); + } + + // script URL + if ( !bError ) + { + aScriptURL = String::CreateFromAscii("vnd.sun.star.script:"); + aScriptURL += aName; + aScriptURL += String::CreateFromAscii("?language="); + aScriptURL += aLanguage; + aScriptURL += String::CreateFromAscii("&location="); + aScriptURL += aLocation; + } - if ( pMethod && !rxLimitToDocument.is() ) + if ( !rxLimitToDocument.is() ) { - pMethod->AddRef(); // festhalten, bis Event abgearbeitet. - Application::PostUserEvent( LINK( IDE_DLL()->GetExtraData(), BasicIDEData, ExecuteMacroEvent ), pMethod ); + MacroExecutionData* pExecData = new MacroExecutionData; + pExecData->aDocument = aDocument; + pExecData->xMethod = pMethod; // keep alive until the event has been processed + Application::PostUserEvent( STATIC_LINK( NULL, MacroExecution, ExecuteMacroEvent ), pExecData ); } } break; } - delete pChooser; - - SFX_APP()->LeaveBasicCall(); - - return ::rtl::OUString( aScriptURL ); + return aScriptURL; } //---------------------------------------------------------------------------- diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 150e10a5a76f..223d82604c47 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -260,7 +260,7 @@ Window* __EXPORT IDEBaseWindow::GetLayoutWindow() return this; } -SfxUndoManager* __EXPORT IDEBaseWindow::GetUndoManager() +::svl::IUndoManager* __EXPORT IDEBaseWindow::GetUndoManager() { return NULL; } diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx index a15bed689b6f..25f00564c703 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -211,20 +211,3 @@ IMPL_LINK( BasicIDEData, GlobalBasicBreakHdl, StarBASIC *, pBasic ) return nRet; } - -IMPL_LINK( BasicIDEData, ExecuteMacroEvent, void *, pData ) -{ - if ( pData ) - { - SFX_APP()->EnterBasicCall(); - SbMethod* pMethod = (SbMethod*)pData; - - // Ist es eine StarScript-Methode? Am Parent erkennen - DBG_ASSERT( pMethod->GetParent()->GetFlags() & SBX_EXTSEARCH, "Kein EXTSEARCH!" ); - BasicIDE::RunMethod( pMethod ); - pMethod->ReleaseRef(); // muss vorher inkrementiert worden sein! - SFX_APP()->LeaveBasicCall(); - } - return 0; -} - diff --git a/basctl/source/basicide/iderdll2.hxx b/basctl/source/basicide/iderdll2.hxx index 162d08ddcb5e..fd811de71b08 100644 --- a/basctl/source/basicide/iderdll2.hxx +++ b/basctl/source/basicide/iderdll2.hxx @@ -100,8 +100,6 @@ public: const String& GetAddLibFilter() const { return aAddLibFilter; } void SetAddLibFilter( const String& rFilter ) { aAddLibFilter = rFilter; } - - DECL_LINK( ExecuteMacroEvent, void * ); }; diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx index c55e5bd721d5..92bb2b22998a 100644 --- a/basctl/source/inc/baside3.hxx +++ b/basctl/source/inc/baside3.hxx @@ -106,7 +106,8 @@ public: virtual BOOL IsModified(); virtual BOOL IsPasteAllowed(); - virtual SfxUndoManager* GetUndoManager(); + virtual ::svl::IUndoManager* + GetUndoManager(); // return number of pages to be printed virtual sal_Int32 countPages( Printer* pPrinter ); // print page diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 07bc2dfa3149..f404a486eb11 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -197,7 +197,8 @@ public: SdrView* GetCurDlgView() const; - SfxUndoManager* GetUndoManager(); + ::svl::IUndoManager* + GetUndoManager(); virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable(); diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index bc588fccaf14..33f2d45549ad 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -164,9 +164,13 @@ public: #define BASWIN_INRESCHEDULE 0x08 class Printer; -class SfxUndoManager; class BasicEntryDescriptor; +namespace svl +{ + class IUndoManager; +} + class IDEBaseWindow : public Window { private: @@ -228,7 +232,8 @@ public: virtual Window* GetLayoutWindow(); - virtual SfxUndoManager* GetUndoManager(); + virtual ::svl::IUndoManager* + GetUndoManager(); virtual USHORT GetSearchOptions(); diff --git a/basctl/util/makefile.mk b/basctl/util/makefile.mk index e690a5a20a3b..1719a7c9c078 100644 --- a/basctl/util/makefile.mk +++ b/basctl/util/makefile.mk @@ -54,6 +54,7 @@ SHL1STDLIBS= \ $(SVXCORELIB) \ $(SVXLIB) \ $(SFX2LIB) \ + $(FWELIB) \ $(BASICLIB) \ $(SVTOOLLIB) \ $(TKLIB) \ diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 25ccabf2789b..6fc47499b003 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -36,7 +36,6 @@ #include <dialmgr.hxx> #include <sfx2/msg.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/app.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/minfitem.hxx> @@ -1442,9 +1441,6 @@ void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet ) const SfxPoolItem* pFontItem=0; if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, TRUE, &pFontItem ) ) m_pFontItem = PTR_CAST( SfxStringItem, pFontItem ); - - if ( m_pStringItem ) - pGroupLBox->AddAndSelect( m_pStringItem, m_pFontItem ); } } diff --git a/cui/source/customize/acccfg.hrc b/cui/source/customize/acccfg.hrc index be0771b83fc8..d358b757949c 100644 --- a/cui/source/customize/acccfg.hrc +++ b/cui/source/customize/acccfg.hrc @@ -63,7 +63,7 @@ #define STR_PDF_EXPORT_SEND 59 #define STR_RECHECK_DOCUMENT 60 #define IMG_INFO 61 -#define STR_BASICNAME 62 + // FREE #define BMP_COLLAPSED 63 #define BMP_EXPANDED 64 #define BMP_COLLAPSED_HC 65 diff --git a/cui/source/customize/acccfg.src b/cui/source/customize/acccfg.src index de5d4b89f186..a03fa9c3eb00 100644 --- a/cui/source/customize/acccfg.src +++ b/cui/source/customize/acccfg.src @@ -271,10 +271,6 @@ Resource RID_SVXPAGE_CONFIGGROUPBOX ImageBitmap = Bitmap { File = "imh30826.png"; }; MASKCOLOR }; - String STR_BASICNAME - { - Text = "%PRODUCTNAME Basic" ; - }; Image BMP_COLLAPSED { ImageBitmap = Bitmap diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 858564af4e40..4c46f5d0f259 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -54,7 +54,6 @@ #include <sfx2/msg.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/mnumgr.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/minfitem.hxx> #include <sfx2/objsh.hxx> #include <sfx2/request.hxx> diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index b85ec24adee2..ceb6b8f1e30e 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -59,7 +59,6 @@ #include <tools/urlobj.hxx> #include "cuires.hrc" #include <sfx2/app.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/minfitem.hxx> #include <unotools/processfactory.hxx> #include <comphelper/documentinfo.hxx> @@ -350,16 +349,13 @@ void SfxConfigFunctionListBox_Impl::ClearAll() { SfxGroupInfo_Impl *pData = aArr[i]; - if ( pData->nKind == SFX_CFGFUNCTION_MACRO || - pData->nKind == SFX_CFGFUNCTION_SCRIPT ) + if ( pData->nKind == SFX_CFGFUNCTION_SCRIPT ) { - SfxMacroInfo *pInfo = (SfxMacroInfo*) pData->pObject; - SFX_APP()->GetMacroConfig()->ReleaseSlotId( pInfo->GetSlotId() ); - delete pInfo; + String* pScriptURI = (String*)pData->pObject; + delete pScriptURI; } if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER - || pData->nKind == SFX_CFGGROUP_DOCBASICMGR ) { XInterface* xi = static_cast<XInterface *>(pData->pObject); @@ -376,21 +372,16 @@ void SfxConfigFunctionListBox_Impl::ClearAll() Clear(); } -SfxMacroInfo* SfxConfigFunctionListBox_Impl::GetMacroInfo() -/* Beschreibung - Gibt die MacroInfo des selektierten Entry zur"uck ( sofern vorhanden ). -*/ +String SfxConfigFunctionListBox_Impl::GetSelectedScriptURI() { SvLBoxEntry *pEntry = FirstSelected(); if ( pEntry ) { SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - if ( pData && ( pData->nKind == SFX_CFGFUNCTION_MACRO || - pData->nKind == SFX_CFGFUNCTION_SCRIPT ) ) - return (SfxMacroInfo*) pData->pObject; + if ( pData && ( pData->nKind == SFX_CFGFUNCTION_SCRIPT ) ) + return *(String*)pData->pObject; } - - return 0; + return String(); } String SfxConfigFunctionListBox_Impl::GetCurCommand() @@ -449,7 +440,6 @@ struct SvxConfigGroupBoxResource_Impl : public Resource String m_sDlgMacros; String m_aHumanAppName; String m_aStrGroupStyles; - String m_aScriptType; Image m_collapsedImage; Image m_collapsedImage_hc; Image m_expandedImage; @@ -474,7 +464,6 @@ SvxConfigGroupBoxResource_Impl::SvxConfigGroupBoxResource_Impl() : m_sDlgMacros(String(CUI_RES(STR_DLG_MACROS))), m_aHumanAppName(String(CUI_RES(STR_HUMAN_APPNAME))), m_aStrGroupStyles(String(CUI_RES(STR_GROUP_STYLES))), - m_aScriptType(String(CUI_RES(STR_BASICNAME))), m_collapsedImage(CUI_RES(BMP_COLLAPSED)), m_collapsedImage_hc(CUI_RES(BMP_COLLAPSED_HC)), m_expandedImage(CUI_RES(BMP_EXPANDED)), @@ -486,42 +475,11 @@ SvxConfigGroupBoxResource_Impl::SvxConfigGroupBoxResource_Impl() : SfxConfigGroupListBox_Impl::SfxConfigGroupListBox_Impl( Window* pParent, const ResId& rResId, ULONG nConfigMode ) : SvTreeListBox( pParent, rResId ) - , pImp(new SvxConfigGroupBoxResource_Impl()), pFunctionListBox(0), nMode( nConfigMode ), bShowSF( FALSE ), bShowBasic( TRUE ), pStylesInfo(0) + , pImp(new SvxConfigGroupBoxResource_Impl()), pFunctionListBox(0), nMode( nConfigMode ), pStylesInfo(0) { SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); SetNodeBitmaps( pImp->m_collapsedImage, pImp->m_expandedImage, BMP_COLOR_NORMAL ); SetNodeBitmaps( pImp->m_collapsedImage_hc, pImp->m_expandedImage_hc, 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 = false; - - value = ::utl::ConfigManager::GetConfigManager()->GetLocalProperty( - ::rtl::OUString::createFromAscii( - "Office.Scripting/ScriptDisplaySettings/ShowBasic" ) ); - - value >>= tmp; - - if (tmp == sal_True) { - bShowBasic = TRUE; - } - else { - bShowBasic = FALSE; - } - - value = ::utl::ConfigManager::GetConfigManager()->GetLocalProperty( - ::rtl::OUString::createFromAscii( - "Office.Scripting/ScriptDisplaySettings/ShowSF" ) ); - - value >>= tmp; - - if (tmp == sal_True) { - bShowSF = TRUE; - } - else { - bShowSF = FALSE; - } } @@ -537,7 +495,6 @@ void SfxConfigGroupListBox_Impl::ClearAll() { SfxGroupInfo_Impl *pData = aArr[i]; if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER - || pData->nKind == SFX_CFGGROUP_DOCBASICMGR ) { XInterface* xi = static_cast<XInterface *>(pData->pObject); @@ -553,31 +510,6 @@ void SfxConfigGroupListBox_Impl::ClearAll() Clear(); } -void SfxConfigGroupListBox_Impl::SetScriptType( const String& rScriptType ) -{ - pImp->m_aScriptType = rScriptType; - ULONG nPos=0; - SvLBoxEntry *pEntry = (SvLBoxEntry*) GetModel()->GetEntryAtAbsPos( nPos++ ); - while ( pEntry ) - { - SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - if ( pInfo->nKind == SFX_CFGGROUP_BASICLIB && ( IsExpanded( pEntry ) || pInfo->bWasOpened ) ) - { - Collapse( pEntry ); - SvLBoxEntry *pChild = FirstChild( pEntry ); - while (pChild) - { - GetModel()->Remove( pChild ); - pChild = FirstChild( pEntry ); - } - - Expand( pEntry ); - } - - pEntry = (SvLBoxEntry*) GetModel()->GetEntryAtAbsPos( nPos++ ); - } -} - void SfxConfigGroupListBox_Impl::SetStylesInfo(SfxStylesInfo_Impl* pStyles) { pStylesInfo = pStyles; @@ -596,18 +528,6 @@ String SfxConfigGroupListBox_Impl::GetGroup() if ( pInfo->nKind == SFX_CFGGROUP_FUNCTION ) return GetEntryText( pEntry ); - if ( pInfo->nKind == SFX_CFGGROUP_BASICMGR ) - { - BasicManager *pMgr = (BasicManager*) pInfo->pObject; - return pMgr->GetName(); - } - - if ( pInfo->nKind == SFX_CFGGROUP_DOCBASICMGR ) - { - Reference< XModel > xDoc( static_cast< XModel* >( pInfo->pObject ) ); - return ::comphelper::DocumentInfo::getDocumentTitle( xDoc ); - } - pEntry = GetParent( pEntry ); } @@ -615,27 +535,6 @@ String SfxConfigGroupListBox_Impl::GetGroup() } //----------------------------------------------- -BasicManager* SfxConfigGroupListBox_Impl::GetBasicManager( const SvLBoxEntry& _rEntry ) -{ - BasicManager* pBasMgr = NULL; - - SfxGroupInfo_Impl* pInfo = (SfxGroupInfo_Impl*) _rEntry.GetUserData(); - switch ( pInfo->nKind ) - { - case SFX_CFGGROUP_BASICMGR : - pBasMgr = (BasicManager*) pInfo->pObject; - break; - case SFX_CFGGROUP_DOCBASICMGR : - { - Reference< XModel > xDoc( static_cast< XModel* >( pInfo->pObject ) ); - pBasMgr = ::basic::BasicManagerRepository::getDocumentBasicManager( xDoc ); - } - break; - } - return pBasMgr; -} - -//----------------------------------------------- void SfxConfigGroupListBox_Impl::InitModule() { try @@ -758,253 +657,144 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul InitStyles(); } - /* - - // Verwendet wird der aktuelle Slotpool - if ( nMode ) + OSL_TRACE("** ** About to initialise SF Scripts"); + // Add Scripting Framework entries + Reference< browse::XBrowseNode > rootNode; + Reference< XComponentContext > xCtx; + try { - pSlotPool = pPool ? pPool : &SFX_SLOTPOOL(); - for ( USHORT i=1; i<pSlotPool->GetGroupCount(); i++ ) - { - // Gruppe anw"ahlen ( Gruppe 0 ist intern ) - String aName = pSlotPool->SeekGroup( i ); - const SfxSlot *pSfxSlot = pSlotPool->FirstSlot(); - if ( pSfxSlot ) - { - // Check if all entries are not useable. Don't - // insert a group without any useable function. - sal_Bool bActiveEntries = sal_False; - while ( pSfxSlot ) - { - USHORT nId = pSfxSlot->GetSlotId(); - if ( pSfxSlot->GetMode() & nMode ) - { - bActiveEntries = sal_True; - break; - } - - pSfxSlot = pSlotPool->NextSlot(); - } - - if ( bActiveEntries ) - { - // Wenn Gruppe nicht leer - SvLBoxEntry *pEntry = InsertEntry( aName, NULL ); - SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_FUNCTION, i ); - aArr.Insert( pInfo, aArr.Count() ); - pEntry->SetUserData( pInfo ); - } - } - } + Reference < beans::XPropertySet > xProps( + ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + xCtx.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW ); + Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName( + ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory") ), UNO_QUERY_THROW ); + rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) ); + //rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROORGANIZER ) ); } -*/ - SfxApplication *pSfxApp = SFX_APP(); - if ( bShowBasic ) + catch( Exception& e ) { - // Basics einsammeln - pSfxApp->EnterBasicCall(); - String aMacroName(' '); - aMacroName += pImp->m_sDlgMacros; - - // 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 - String aAppBasTitle( pImp->m_aHumanAppName ); - aAppBasTitle += aMacroName; - SvLBoxEntry *pEntry = InsertEntry( aAppBasTitle, 0 ); - SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_BASICMGR, 0, pAppBasicMgr ); - // aArr.Insert( pInfo, aArr.Count() ); - pEntry->SetUserData( pInfo ); - pEntry->EnableChildsOnDemand( TRUE ); - // Expand( pEntry ); - } - } - - Reference< XModel > xDoc( lcl_getScriptableDocument_nothrow( m_xFrame ) ); - if ( xDoc.is() ) - { - BasicManager* pBasicMgr = ::basic::BasicManagerRepository::getDocumentBasicManager( xDoc ); - if ( pBasicMgr != pAppBasicMgr && pBasicMgr->GetLibCount() ) - { - String sDocTitle( ::comphelper::DocumentInfo::getDocumentTitle( xDoc ) ); - pBasicMgr->SetName( sDocTitle ); - - // Nur einf"ugen, wenn eigenes Basic mit Bibliotheken - SvLBoxEntry *pEntry = InsertEntry( sDocTitle.Append( aMacroName ), NULL ); - xDoc->acquire(); - SfxGroupInfo_Impl *pInfo = - new SfxGroupInfo_Impl( SFX_CFGGROUP_DOCBASICMGR, 0, xDoc.get() ); - pEntry->SetUserData( pInfo ); - pEntry->EnableChildsOnDemand( TRUE ); - } - } - - pSfxApp->LeaveBasicCall(); + OSL_TRACE(" Caught some exception whilst retrieving browse nodes from factory... Exception: %s", + ::rtl::OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer ); + // TODO exception handling } - OSL_TRACE("** ** About to initialise SF Scripts"); - if ( bShowSF ) + + if ( rootNode.is() ) { - OSL_TRACE("** ** bShowSF"); - // Add Scripting Framework entries - Reference< browse::XBrowseNode > rootNode; - Reference< XComponentContext > xCtx; - try + if ( nMode ) { - Reference < beans::XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - xCtx.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW ); - Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName( - ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory") ), UNO_QUERY_THROW ); - rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) ); - //rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROORGANIZER ) ); + //We call acquire on the XBrowseNode so that it does not + //get autodestructed and become invalid when accessed later. + rootNode->acquire(); + + SfxGroupInfo_Impl *pInfo = + new SfxGroupInfo_Impl( SFX_CFGGROUP_SCRIPTCONTAINER, 0, + static_cast<void *>(rootNode.get())); + + String aTitle(pImp->m_sDlgMacros); + SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL ); + pNewEntry->SetUserData( pInfo ); + pNewEntry->EnableChildsOnDemand( TRUE ); + aArr.Insert( pInfo, aArr.Count() ); } - catch( Exception& e ) + else { - OSL_TRACE(" Caught some exception whilst retrieving browse nodes from factory... Exception: %s", - ::rtl::OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - // TODO exception handling - } - + //We are only showing scripts not slot APIs so skip + //Root node and show location nodes + try { + if ( rootNode->hasChildNodes() ) + { + Sequence< Reference< browse::XBrowseNode > > children = + rootNode->getChildNodes(); + BOOL bIsRootNode = FALSE; - if ( rootNode.is() ) - { - if ( nMode ) - { - //We call acquire on the XBrowseNode so that it does not - //get autodestructed and become invalid when accessed later. - rootNode->acquire(); - - SfxGroupInfo_Impl *pInfo = - new SfxGroupInfo_Impl( SFX_CFGGROUP_SCRIPTCONTAINER, 0, - static_cast<void *>(rootNode.get())); - - String aTitle(pImp->m_sDlgMacros); - SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL ); - pNewEntry->SetUserData( pInfo ); - pNewEntry->EnableChildsOnDemand( TRUE ); - aArr.Insert( pInfo, aArr.Count() ); - } - else - { - //We are only showing scripts not slot APIs so skip - //Root node and show location nodes - try { - if ( rootNode->hasChildNodes() ) + ::rtl::OUString user = ::rtl::OUString::createFromAscii("user"); + ::rtl::OUString share = ::rtl::OUString::createFromAscii("share"); + if ( rootNode->getName().equals(::rtl::OUString::createFromAscii("Root") )) { - Sequence< Reference< browse::XBrowseNode > > children = - rootNode->getChildNodes(); - BOOL bIsRootNode = FALSE; - - ::rtl::OUString user = ::rtl::OUString::createFromAscii("user"); - ::rtl::OUString share = ::rtl::OUString::createFromAscii("share"); - if ( rootNode->getName().equals(::rtl::OUString::createFromAscii("Root") )) - { - bIsRootNode = TRUE; - } + bIsRootNode = TRUE; + } - //To mimic current starbasic behaviour we - //need to make sure that only the current document - //is displayed in the config tree. Tests below - //set the bDisplay flag to FALSE if the current - //node is a first level child of the Root and is NOT - //either the current document, user or share - ::rtl::OUString currentDocTitle; - Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) ); - if ( xDocument.is() ) - { - currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument ); - } + //To mimic current starbasic behaviour we + //need to make sure that only the current document + //is displayed in the config tree. Tests below + //set the bDisplay flag to FALSE if the current + //node is a first level child of the Root and is NOT + //either the current document, user or share + ::rtl::OUString currentDocTitle; + Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) ); + if ( xDocument.is() ) + { + currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument ); + } - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) + for ( sal_Int32 n = 0; n < children.getLength(); n++ ) + { + Reference< browse::XBrowseNode >& theChild = children[n]; + BOOL bDisplay = TRUE; + ::rtl::OUString uiName = theChild->getName(); + if ( bIsRootNode ) { - Reference< browse::XBrowseNode >& theChild = children[n]; - BOOL bDisplay = TRUE; - ::rtl::OUString uiName = theChild->getName(); - if ( bIsRootNode ) + if ( ! ((theChild->getName().equals( user ) || theChild->getName().equals( share ) || + theChild->getName().equals( currentDocTitle ) ) ) ) + { + bDisplay=FALSE; + } + else { - if ( ! ((theChild->getName().equals( user ) || theChild->getName().equals( share ) || - theChild->getName().equals( currentDocTitle ) ) ) ) + if ( uiName.equals( user ) ) { - bDisplay=FALSE; + uiName = pImp->m_sMyMacros; } - else + else if ( uiName.equals( share ) ) { - if ( uiName.equals( user ) ) - { - uiName = pImp->m_sMyMacros; - } - else if ( uiName.equals( share ) ) - { - uiName = pImp->m_sProdMacros; - } + uiName = pImp->m_sProdMacros; } } - if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay ) - { + } + if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay ) + { // We call acquire on the XBrowseNode so that it does not // get autodestructed and become invalid when accessed later. - theChild->acquire(); + theChild->acquire(); - SfxGroupInfo_Impl* pInfo = - new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, - 0, static_cast<void *>( theChild.get())); + SfxGroupInfo_Impl* pInfo = + new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, + 0, static_cast<void *>( theChild.get())); - Image aImage = GetImage( theChild, xCtx, bIsRootNode,BMP_COLOR_NORMAL ); - SvLBoxEntry* pNewEntry = - InsertEntry( uiName, NULL); - SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL); - SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL); - aImage = GetImage( theChild, xCtx, bIsRootNode,BMP_COLOR_HIGHCONTRAST ); - SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST); - SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST); + Image aImage = GetImage( theChild, xCtx, bIsRootNode,BMP_COLOR_NORMAL ); + SvLBoxEntry* pNewEntry = + InsertEntry( uiName, NULL); + SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL); + SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_NORMAL); + aImage = GetImage( theChild, xCtx, bIsRootNode,BMP_COLOR_HIGHCONTRAST ); + SetExpandedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST); + SetCollapsedEntryBmp(pNewEntry, aImage, BMP_COLOR_HIGHCONTRAST); - pNewEntry->SetUserData( pInfo ); - aArr.Insert( pInfo, aArr.Count() ); + pNewEntry->SetUserData( pInfo ); + aArr.Insert( pInfo, aArr.Count() ); - if ( children[n]->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > grandchildren = - children[n]->getChildNodes(); + if ( children[n]->hasChildNodes() ) + { + Sequence< Reference< browse::XBrowseNode > > grandchildren = + children[n]->getChildNodes(); - for ( sal_Int32 m = 0; m < grandchildren.getLength(); m++ ) + for ( sal_Int32 m = 0; m < grandchildren.getLength(); m++ ) + { + if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER ) { - if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER ) - { - pNewEntry->EnableChildsOnDemand( TRUE ); - m = grandchildren.getLength(); - } + pNewEntry->EnableChildsOnDemand( TRUE ); + m = grandchildren.getLength(); } } } } } } - catch (RuntimeException&) { - // do nothing, the entry will not be displayed in the UI - } + } + catch (RuntimeException&) { + // do nothing, the entry will not be displayed in the UI } } } @@ -1020,14 +810,6 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul pEntry->EnableChildsOnDemand( TRUE ); } -/* { - String sSymbols( String::CreateFromAscii("Symbols") ); - SvLBoxEntry *pEntry = InsertEntry( sSymbols, 0 ); - SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_SPECIALCHARACTERS, 0, 0 ); // TODO last parameter should contain user data - aArr.Insert( pInfo, aArr.Count() ); - pEntry->SetUserData( pInfo ); - } */ - MakeVisible( GetEntry( 0,0 ) ); SetUpdateMode( TRUE ); } @@ -1208,7 +990,6 @@ void SfxConfigGroupListBox_Impl::GroupSelected() pFunctionListBox->SetUpdateMode(FALSE); pFunctionListBox->ClearAll(); if ( pInfo->nKind != SFX_CFGGROUP_FUNCTION && - pInfo->nKind != SFX_CFGGROUP_BASICMOD && pInfo->nKind != SFX_CFGGROUP_SCRIPTCONTAINER && pInfo->nKind != SFX_CFGGROUP_STYLES ) { @@ -1220,7 +1001,7 @@ void SfxConfigGroupListBox_Impl::GroupSelected() { case SFX_CFGGROUP_FUNCTION : { - USHORT nGroup = pInfo->nOrd; + USHORT nGroup = pInfo->nUniqueID; css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW); css::uno::Sequence< css::frame::DispatchInformation > lCommands = xProvider->getConfigurableDispatchInformation(nGroup); sal_Int32 c = lCommands.getLength(); @@ -1240,45 +1021,6 @@ void SfxConfigGroupListBox_Impl::GroupSelected() break; } - case SFX_CFGGROUP_BASICMOD : - { - SvLBoxEntry *pLibEntry = GetParent( pEntry ); - SfxGroupInfo_Impl *pLibInfo = - (SfxGroupInfo_Impl*) pLibEntry->GetUserData(); - SvLBoxEntry *pBasEntry = GetParent( pLibEntry ); - SfxGroupInfo_Impl *pBasInfo = - (SfxGroupInfo_Impl*) pBasEntry->GetUserData(); - - StarBASIC *pLib = (StarBASIC*) pLibInfo->pObject; - Reference< XModel > xDoc; - if ( pBasInfo->nKind == SFX_CFGGROUP_DOCBASICMGR ) - xDoc = static_cast< XModel* >( 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( !xDoc.is(), - 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 ); - SfxGroupInfo_Impl *pGrpInfo = - new SfxGroupInfo_Impl( SFX_CFGFUNCTION_MACRO, nId, pInf ); - pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() ); - pFuncEntry->SetUserData( pGrpInfo ); - } - - break; - } - case SFX_CFGGROUP_SCRIPTCONTAINER: { if ( !GetChildCount( pEntry ) ) @@ -1308,13 +1050,8 @@ void SfxConfigGroupListBox_Impl::GroupSelected() xPropSet->getPropertyValue( String::CreateFromAscii( "URI" ) ); value >>= uri; - SfxMacroInfo* aInfo = new SfxMacroInfo( (String)uri ); - aInfo->SetHelpText( uri ); - SFX_APP()->GetMacroConfig()->GetSlotId( aInfo ); - - SfxGroupInfo_Impl* pGrpInfo = - new SfxGroupInfo_Impl(SFX_CFGFUNCTION_SCRIPT, - aInfo->GetSlotId(), aInfo); + String* pScriptURI = new String( uri ); + SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGFUNCTION_SCRIPT, 0, pScriptURI ); Image aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False, BMP_COLOR_NORMAL ); SvLBoxEntry* pNewEntry = @@ -1422,66 +1159,6 @@ void SfxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry ) pInfo->bWasOpened = TRUE; switch ( pInfo->nKind ) { - case SFX_CFGGROUP_BASICMGR : - case SFX_CFGGROUP_DOCBASICMGR : - { - if ( !GetChildCount( pEntry ) ) - { - // Erstmaliges "Offnen - BasicManager* pMgr( GetBasicManager( *pEntry ) ); - - SvLBoxEntry *pLibEntry = 0; - for ( USHORT nLib=0; nLib<pMgr->GetLibCount(); nLib++) - { - StarBASIC* pLib = pMgr->GetLib( nLib ); - pLibEntry = InsertEntry( pMgr->GetLibName( nLib ), pEntry ); - SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_BASICLIB, nLib, pLib ); - aArr.Insert( pGrpInfo, aArr.Count() ); - pLibEntry->SetUserData( pGrpInfo ); - 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 ); - BasicManager *pMgr( GetBasicManager( *pParent ) ); - - 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 ); - - BOOL bIsStarScript = FALSE; //pMod->ISA( SbJScriptModule ); - BOOL bWantsStarScript = pImp->m_aScriptType.EqualsAscii("StarScript"); - if ( bIsStarScript != bWantsStarScript ) - continue; - pModEntry = InsertEntry( pMod->GetName(), pEntry ); - SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_BASICMOD, 0, pMod ); - aArr.Insert( pGrpInfo, aArr.Count() ); - pModEntry->SetUserData( pGrpInfo ); - } - } - - break; - } - case SFX_CFGGROUP_SCRIPTCONTAINER: { if ( !GetChildCount( pEntry ) ) @@ -1604,25 +1281,6 @@ void SfxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry ) } } -void SfxConfigGroupListBox_Impl::AddAndSelect( const SfxStringItem* , const SfxStringItem* ) -{ - /* - if ( pText ) - { - Select( GetEntry( GetEntryCount()-1) ); - SvLBoxEntry* pFuncEntry = pFunctionListBox->InsertEntry( pText->GetValue(), NULL ); - SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_SPECIALCHARACTERS, 0, 0 ); - String aCommand = String::CreateFromAscii(".uno:InsertSymbol?Symbols:string="); - aCommand += pText->GetValue(); - pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() ); - pGrpInfo->sCommand = aCommand; - pGrpInfo->sLabel = String::CreateFromAscii("Symbols: "); - pGrpInfo->sLabel += pText->GetValue(); - pFuncEntry->SetUserData( pGrpInfo ); - } - */ -} - void SfxConfigGroupListBox_Impl::SelectMacro( const SfxMacroInfoItem *pItem ) { SelectMacro( pItem->GetBasicManager()->GetName(), diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx index 8592dbaded5f..be7658957535 100644 --- a/cui/source/customize/eventdlg.cxx +++ b/cui/source/customize/eventdlg.cxx @@ -43,7 +43,6 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/evntconf.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/minfitem.hxx> #include <sfx2/app.hxx> #include <sfx2/objsh.hxx> diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 9b5453553ef3..8b9bd789c48f 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -38,7 +38,6 @@ #include <tools/diagnose_ex.h> #include <sfx2/app.hxx> #include <sfx2/objsh.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/sfxdefs.hxx> #include <com/sun/star/container/NoSuchElementException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -212,7 +211,7 @@ void _HeaderTabListBox::Enable( bool bEnable, bool bChild ) // assign button ("Add Command") is enabled only if it is not read only // delete button ("Remove Command") is enabled if a current binding exists // and it is not read only -void _SvxMacroTabPage::EnableButtons( const String& /*rLangName*/ ) +void _SvxMacroTabPage::EnableButtons() { const SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected(); if ( pE ) @@ -592,7 +591,7 @@ void _SvxMacroTabPage::DisplayAppEvents( bool appEvents) } rListBox.SetUpdateMode( TRUE ); - EnableButtons( String() ); + EnableButtons(); } // select event handler on the listbox @@ -610,7 +609,7 @@ IMPL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG ) return 0; } - pThis->EnableButtons( String() ); + pThis->EnableButtons(); return 0; } @@ -736,7 +735,7 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* rListBox.MakeVisible( pE ); rListBox.SetUpdateMode( TRUE ); - pThis->EnableButtons( String() ); + pThis->EnableButtons(); return 0; } diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 3defe910f5a5..1bdd559d8f14 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -39,7 +39,6 @@ #include <sfx2/app.hxx> #include <sfx2/msg.hxx> #include <sfx2/msgpool.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/minfitem.hxx> #include <sfx2/objsh.hxx> #include <sfx2/dispatch.hxx> diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 4fde01da986e..c4adc9dc64c4 100755 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -88,14 +88,16 @@ struct SpellDialog_Impl // ----------------------------------------------------------------------- //#define VENDOR_IMAGE_HEIGHT 44 //as specified -#define SPELLUNDO_CHANGE_LANGUAGE (TEXTUNDO_USER + 1) -#define SPELLUNDO_CHANGE_TEXTENGINE (TEXTUNDO_USER + 2) -#define SPELLUNDO_CHANGE_NEXTERROR (TEXTUNDO_USER + 3) -#define SPELLUNDO_CHANGE_ADD_TO_DICTIONARY (TEXTUNDO_USER + 4) -#define SPELLUNDO_CHANGE_GROUP (TEXTUNDO_USER + 5) //undo list -#define SPELLUNDO_MOVE_ERROREND (TEXTUNDO_USER + 6) -#define SPELLUNDO_UNDO_EDIT_MODE (TEXTUNDO_USER + 7) -#define SPELLUNDO_ADD_IGNORE_RULE (TEXTUNDO_USER + 8) +#define SPELLUNDO_START 200 + +#define SPELLUNDO_CHANGE_LANGUAGE (SPELLUNDO_START + 1) +#define SPELLUNDO_CHANGE_TEXTENGINE (SPELLUNDO_START + 2) +#define SPELLUNDO_CHANGE_NEXTERROR (SPELLUNDO_START + 3) +#define SPELLUNDO_CHANGE_ADD_TO_DICTIONARY (SPELLUNDO_START + 4) +#define SPELLUNDO_CHANGE_GROUP (SPELLUNDO_START + 5) //undo list +#define SPELLUNDO_MOVE_ERROREND (SPELLUNDO_START + 6) +#define SPELLUNDO_UNDO_EDIT_MODE (SPELLUNDO_START + 7) +#define SPELLUNDO_ADD_IGNORE_RULE (SPELLUNDO_START + 8) namespace svx{ class SpellUndoAction_Impl : public SfxUndoAction @@ -628,7 +630,7 @@ IMPL_LINK( SpellDialog, ChangeHdl, Button *, EMPTYARG ) aSentenceED.ChangeMarkedWord(aString, GetSelectedLang_Impl()); SpellContinue_Impl(); bModified = false; - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); + aSentenceED.UndoActionEnd(); } if(!aChangePB.IsEnabled()) aIgnorePB.GrabFocus(); @@ -670,7 +672,7 @@ IMPL_LINK( SpellDialog, ChangeAllHdl, Button *, EMPTYARG ) aSentenceED.ChangeMarkedWord(aString, eLang); SpellContinue_Impl(); bModified = false; - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); + aSentenceED.UndoActionEnd(); return 1; } // ----------------------------------------------------------------------- @@ -715,7 +717,7 @@ IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton ) SpellContinue_Impl(); bModified = false; - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); + aSentenceED.UndoActionEnd(); return 1; } /*-- 06.11.2003 11:24:08--------------------------------------------------- @@ -1044,7 +1046,7 @@ IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton ) // go on SpellContinue_Impl(); - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); + aSentenceED.UndoActionEnd(); return 0; } /*------------------------------------------------------------------------- @@ -1755,7 +1757,7 @@ void SentenceEditWindow_Impl::ChangeMarkedWord(const String& rNewWord, LanguageT TextSelection aSel(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd)); //Remove spell errror attribute ExtTextEngine* pTextEngine = GetTextEngine(); - pTextEngine->UndoActionStart( TEXTUNDO_INSERT ); + pTextEngine->UndoActionStart(); const TextCharAttrib* pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR ); DBG_ASSERT(pErrorAttrib, "no error attribute found"); // Reference <XSpellAlternatives> xAlternatives; @@ -1808,7 +1810,7 @@ void SentenceEditWindow_Impl::ChangeMarkedWord(const String& rNewWord, LanguageT if(pSpellErrorDescription) SetAttrib( SpellErrorAttrib(*pSpellErrorDescription), 0, m_nErrorStart, m_nErrorEnd ); SetAttrib( SpellLanguageAttrib(eLanguage), 0, m_nErrorStart, m_nErrorEnd ); - pTextEngine->UndoActionEnd( TEXTUNDO_INSERT ); + pTextEngine->UndoActionEnd(); } /* -----------------08.10.2003 13:18----------------- @@ -2032,7 +2034,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnore -----------------------------------------------------------------------*/ void SentenceEditWindow_Impl::Undo() { - SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); + ::svl::IUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); DBG_ASSERT(GetUndoActionCount(), "no undo actions available" ); if(!GetUndoActionCount()) return; @@ -2060,7 +2062,7 @@ void SentenceEditWindow_Impl::ResetUndo() -----------------------------------------------------------------------*/ void SentenceEditWindow_Impl::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg ) { - SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); + ::svl::IUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); rUndoMgr.AddUndoAction(pAction, bTryMerg); GetSpellDialog()->aUndoPB.Enable(); } @@ -2082,9 +2084,9 @@ void SentenceEditWindow_Impl::UndoActionStart( USHORT nId ) /*-- 12.11.2003 12:12:38--------------------------------------------------- -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::UndoActionEnd( USHORT nId ) +void SentenceEditWindow_Impl::UndoActionEnd() { - GetTextEngine()->UndoActionEnd(nId); + GetTextEngine()->UndoActionEnd(); } /*-- 12.11.2003 12:12:38--------------------------------------------------- diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 8d233b71e890..47a5c1d527e0 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -121,7 +121,7 @@ public: void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE ); USHORT GetUndoActionCount(); void UndoActionStart( USHORT nId ); - void UndoActionEnd( USHORT nId ); + void UndoActionEnd(); void MoveErrorEnd(long nOffset); diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx index 944fca908b8a..66238e7ac7f3 100644 --- a/cui/source/inc/cfgutil.hxx +++ b/cui/source/inc/cfgutil.hxx @@ -50,7 +50,6 @@ class SfxSlotPool; class SfxStringItem; class SfxFontItem; class SfxMacroInfoItem; -class SfxMacroInfo; struct SfxStyleInfo_Impl; struct SfxStylesInfo_Impl; @@ -95,29 +94,27 @@ struct SfxStylesInfo_Impl static ::rtl::OUString generateCommand(const ::rtl::OUString& sFamily, const ::rtl::OUString& sStyle); }; -#define SFX_CFGGROUP_FUNCTION 1 -#define SFX_CFGGROUP_BASICMGR 2 -#define SFX_CFGGROUP_DOCBASICMGR 3 -#define SFX_CFGGROUP_BASICLIB 4 -#define SFX_CFGGROUP_BASICMOD 5 -#define SFX_CFGFUNCTION_MACRO 6 -#define SFX_CFGFUNCTION_SLOT 7 -#define SFX_CFGGROUP_SCRIPTCONTAINER 8 -#define SFX_CFGFUNCTION_SCRIPT 9 -#define SFX_CFGGROUP_STYLES 10 -#define SFX_CFGGROUP_SPECIALCHARACTERS 11 +#define SFX_CFGGROUP_FUNCTION 1 +#define SFX_CFGFUNCTION_SLOT 2 +#define SFX_CFGGROUP_SCRIPTCONTAINER 3 +#define SFX_CFGFUNCTION_SCRIPT 4 +#define SFX_CFGGROUP_STYLES 5 struct SfxGroupInfo_Impl { USHORT nKind; - USHORT nOrd; + USHORT nUniqueID; void* pObject; BOOL bWasOpened; String sCommand; String sLabel; SfxGroupInfo_Impl( USHORT n, USHORT nr, void* pObj = 0 ) : - nKind( n ), nOrd( nr ), pObject( pObj ), bWasOpened(FALSE) {} + nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(FALSE) {} +}; + +struct CuiMacroInfo +{ }; typedef SfxGroupInfo_Impl* SfxGroupInfoPtr; @@ -143,7 +140,7 @@ public: String GetHelpText( SvLBoxEntry *pEntry ); String GetCurCommand(); String GetCurLabel(); - SfxMacroInfo* GetMacroInfo(); + String GetSelectedScriptURI(); void FunctionSelected(); void SetStylesInfo(SfxStylesInfo_Impl* pStyles); }; @@ -156,8 +153,6 @@ class SfxConfigGroupListBox_Impl : public SvTreeListBox SfxConfigFunctionListBox_Impl* pFunctionListBox; SfxGroupInfoArr_Impl aArr; ULONG nMode; - BOOL bShowSF; // show Scripting Framework scripts - BOOL bShowBasic; // show Basic scripts ::rtl::OUString m_sModuleLongName; css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; @@ -198,11 +193,8 @@ public: void Open( SvLBoxEntry*, BOOL ); void GroupSelected(); void SelectMacro( const SfxMacroInfoItem* ); - void AddAndSelect( const SfxStringItem*, const SfxStringItem* ); void SelectMacro( const String&, const String& ); String GetGroup(); - BasicManager* GetBasicManager( const SvLBoxEntry& _rEntry ); - void SetScriptType( const String& rScriptType ); void SetStylesInfo(SfxStylesInfo_Impl* pStyles); }; diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx index 45cf2fdbf79e..d2a5a5cb3326 100755..100644 --- a/cui/source/inc/macroass.hxx +++ b/cui/source/inc/macroass.hxx @@ -41,9 +41,6 @@ class SvTabListBox; class Edit; class String; -typedef SvStringsDtor* (*FNGetRangeHdl)( _SfxMacroTabPage*, const String& rLanguage ); -typedef SvStringsDtor* (*FNGetMacrosOfRangeHdl)( _SfxMacroTabPage*, const String& rLanguage, const String& rRange ); - class SfxConfigGroupListBox_Impl; class SfxConfigFunctionListBox_Impl; class _HeaderTabListBox; @@ -59,7 +56,6 @@ class _SfxMacroTabPage : public SfxTabPage DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, DoubleClickHdl_Impl, Control* ); DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton * ); - DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton * ); DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer* ); protected: @@ -70,7 +66,7 @@ protected: void InitAndSetHandler(); void FillEvents(); void FillMacroList(); - void EnableButtons( const String& rLanguage ); + void EnableButtons(); public: @@ -82,7 +78,7 @@ public: void SetMacroTbl( const SvxMacroTableDtor& rTbl ); void ClearMacroTbl(); - virtual void ScriptChanged( const String& rLanguage ); + virtual void ScriptChanged(); virtual void PageCreated (SfxAllItemSet aSet); // --------- Erben aus der Basis ------------- diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx index 0359a330c1f0..7943c3ff6727 100644 --- a/cui/source/inc/macropg.hxx +++ b/cui/source/inc/macropg.hxx @@ -90,7 +90,7 @@ protected: _SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet ); - void EnableButtons( const String& rLanguage ); + void EnableButtons(); ::com::sun::star::uno::Any GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash ); ::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny ); diff --git a/cui/source/options/optlingu.src b/cui/source/options/optlingu.src index ace1f8e193bf..12192ad8ac4b 100644..100755 --- a/cui/source/options/optlingu.src +++ b/cui/source/options/optlingu.src @@ -354,11 +354,4 @@ QueryBox RID_SFXQB_DELDICT DefButton = WB_DEF_NO ; Message [ en-US ] = "Do you want to delete the dictionary?" ; }; - // RID_SFXQB_DEL_IGNORELIST ---------------------------------------------- -QueryBox RID_SFXQB_DEL_IGNORELIST -{ - Buttons = WB_YES_NO ; - DefButton = WB_DEF_NO ; - Message [ en-US ] = "Do you want to delete the ignore list?" ; -}; // ******************************************************************* EOF diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index c18ebf6f2a68..db58ba5dc9cd 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -43,10 +43,11 @@ #include <svtools/svmedit.hxx> #include "cfgutil.hxx" #include <sfx2/app.hxx> +#include <sfx2/evntconf.hxx> #include <sfx2/objsh.hxx> #include "macroass.hrc" #include "cuires.hrc" -#include <sfx2/macrconf.hxx> +#include <vcl/fixed.hxx> #include "headertablistbox.hxx" using ::com::sun::star::uno::Reference; @@ -63,7 +64,6 @@ public: PushButton* pDeletePB; String* pStrEvent; String* pAssignedMacro; - ListBox* pScriptTypeLB; _HeaderTabListBox* pEventLB; SfxConfigGroupListBox_Impl* pGroupLB; FixedText* pFT_MacroLBLabel; @@ -71,8 +71,6 @@ public: FixedText* pMacroFT; String* pMacroStr; - FNGetRangeHdl fnGetRange; - FNGetMacrosOfRangeHdl fnGetMacroOfRange; BOOL bReadOnly; Timer maFillGroupTimer; @@ -84,15 +82,12 @@ _SfxMacroTabPage_Impl::_SfxMacroTabPage_Impl( void ) : pDeletePB( NULL ), pStrEvent( NULL ), pAssignedMacro( NULL ), - pScriptTypeLB( NULL ), pEventLB( NULL ), pGroupLB( NULL ), pFT_MacroLBLabel( NULL ), pMacroLB( NULL ), pMacroFT( NULL ), pMacroStr( NULL ), - fnGetRange( NULL ), - fnGetMacroOfRange( NULL ), bReadOnly( FALSE ), bGotEvents( FALSE ) { @@ -104,7 +99,6 @@ _SfxMacroTabPage_Impl::~_SfxMacroTabPage_Impl() delete pDeletePB; delete pStrEvent; delete pAssignedMacro; - delete pScriptTypeLB; delete pEventLB; delete pGroupLB; delete pMacroLB; @@ -114,9 +108,6 @@ _SfxMacroTabPage_Impl::~_SfxMacroTabPage_Impl() } -SvStringsDtor* _ImpGetRangeHdl( _SfxMacroTabPage*, const String& rLanguage ); -SvStringsDtor* _ImpGetMacrosOfRangeHdl( _SfxMacroTabPage*, const String& rLanguage, const String& rRange ); - static USHORT __FAR_DATA aPageRg[] = { SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, 0 @@ -139,7 +130,7 @@ static long nTabs[] = #define LB_EVENTS_ITEMPOS 1 #define LB_MACROS_ITEMPOS 2 -String ConvertToUIName_Impl( SvxMacro *pMacro, const String& /*rLanguage*/ ) +String ConvertToUIName_Impl( SvxMacro *pMacro ) { String aName( pMacro->GetMacName() ); String aEntry; @@ -161,7 +152,7 @@ String ConvertToUIName_Impl( SvxMacro *pMacro, const String& /*rLanguage*/ ) return aName; } -void _SfxMacroTabPage::EnableButtons( const String& rLangName ) +void _SfxMacroTabPage::EnableButtons() { // Solange die Eventbox leer ist, nichts tun const SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected(); @@ -171,26 +162,14 @@ void _SfxMacroTabPage::EnableButtons( const String& rLangName ) const SvxMacro* pM = aTbl.Get( (USHORT)(ULONG) pE->GetUserData() ); mpImpl->pDeletePB->Enable( 0 != pM && !mpImpl->bReadOnly ); - // Bei gleichem ScriptType Zuweisung nur, wenn Macro sich - // ge"andert hat; bei verschiedenem ScriptType, wenn Script nicht leer String sEventMacro; sEventMacro = ((SvLBoxString*)pE->GetItem( LB_MACROS_ITEMPOS ))->GetText(); - if ( rLangName.EqualsAscii("JavaScript") ) - { - DBG_ERROR( "_SfxMacroTabPage::EnableButtons(): this is not an up to date usage!" ); - } - else - { - SfxMacroInfo* pInfo = mpImpl->pMacroLB->GetMacroInfo(); - String sSelMacro; - if ( pInfo ) - sSelMacro = pInfo->GetMacroName(); - if( pM && rLangName != pM->GetLanguage() ) - mpImpl->pAssignPB->Enable( pInfo != 0 && !mpImpl->bReadOnly ); - else - mpImpl->pAssignPB->Enable( pInfo && !mpImpl->bReadOnly && !sSelMacro.EqualsIgnoreCaseAscii( sEventMacro ) ); - } + + String sScriptURI = mpImpl->pMacroLB->GetSelectedScriptURI(); + mpImpl->pAssignPB->Enable( !mpImpl->bReadOnly && !sScriptURI.EqualsIgnoreCaseAscii( sEventMacro ) ); } + else + mpImpl->pAssignPB->Enable( FALSE ); } _SfxMacroTabPage::_SfxMacroTabPage( Window* pParent, const ResId& rResId, const SfxItemSet& rAttrSet ) @@ -198,8 +177,6 @@ _SfxMacroTabPage::_SfxMacroTabPage( Window* pParent, const ResId& rResId, const { mpImpl = new _SfxMacroTabPage_Impl; - mpImpl->fnGetRange = &_ImpGetRangeHdl; - mpImpl->fnGetMacroOfRange = &_ImpGetMacrosOfRangeHdl; } _SfxMacroTabPage::~_SfxMacroTabPage() @@ -216,7 +193,7 @@ void _SfxMacroTabPage::AddEvent( const String & rEventName, USHORT nEventId ) SvxMacro* pM = aTbl.Get( nEventId ); if( pM ) { - String sNew( ConvertToUIName_Impl( pM, mpImpl->pScriptTypeLB->GetSelectEntry() ) ); + String sNew( ConvertToUIName_Impl( pM ) ); sTmp += sNew; } @@ -224,17 +201,16 @@ void _SfxMacroTabPage::AddEvent( const String & rEventName, USHORT nEventId ) pE->SetUserData( reinterpret_cast< void* >( sal::static_int_cast< sal_IntPtr >( nEventId )) ); } -void _SfxMacroTabPage::ScriptChanged( const String& aLangName ) +void _SfxMacroTabPage::ScriptChanged() { // neue Bereiche und deren Funktionen besorgen { - mpImpl->pGroupLB->SetScriptType( aLangName ); mpImpl->pGroupLB->Show(); mpImpl->pMacroLB->Show(); mpImpl->pMacroFT->SetText( *mpImpl->pMacroStr ); } - EnableButtons( aLangName ); + EnableButtons(); } BOOL _SfxMacroTabPage::FillItemSet( SfxItemSet& rSet ) @@ -311,24 +287,8 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG ) return 0; } - USHORT nEventId = (USHORT)(ULONG)pE->GetUserData(); - String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry(); - - const SvxMacro* pM = pThis->aTbl.Get( nEventId ); - if( pM ) - { - if( aLanguage != pM->GetLanguage() ) - { - pImpl->pScriptTypeLB->SelectEntry( pM->GetLanguage() ); - pThis->ScriptChanged( pM->GetLanguage() ); - } - else - { - DBG_ASSERT( !aLanguage.EqualsAscii("JavaScript"), "_SfxMacroTabPage, SelectEvent_Impl(): outdated use!" ); - } - } - - pThis->EnableButtons( aLanguage ); + pThis->ScriptChanged(); + pThis->EnableButtons(); return 0; } @@ -336,26 +296,14 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox*, EMPTYARG ) { _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; String sSel( pImpl->pGroupLB->GetGroup() ); - String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry(); - if( !aLanguage.EqualsAscii( "JavaScript" ) ) - { - pImpl->pGroupLB->GroupSelected(); - SfxMacroInfo* pMacro = pImpl->pMacroLB->GetMacroInfo(); - String aLabelText; - if( pMacro ) - { - aLabelText = pImpl->maStaticMacroLBLabel; - aLabelText += pMacro->GetModuleName(); - } - else - { - // Wenn dort ein Macro drin ist, wurde es selektiert und der - // AssignButton schon in SelectMacro richtig enabled - pImpl->pAssignPB->Enable( FALSE ); - } - - pImpl->pFT_MacroLBLabel->SetText( aLabelText ); - } + pImpl->pGroupLB->GroupSelected(); + const String sScriptURI = pImpl->pMacroLB->GetSelectedScriptURI(); + String aLabelText; + if( sScriptURI.Len() > 0 ) + aLabelText = pImpl->maStaticMacroLBLabel; + pImpl->pFT_MacroLBLabel->SetText( aLabelText ); + + pThis->EnableButtons(); return 0; } @@ -363,7 +311,7 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox*, EMPTYARG ) { _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; pImpl->pMacroLB->FunctionSelected(); - pThis->EnableButtons( pImpl->pScriptTypeLB->GetSelectEntry() ); + pThis->EnableButtons(); return 0; } @@ -387,51 +335,31 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn ) SvxMacro *pRemoveMacro = pThis->aTbl.Remove( nEvent ); delete pRemoveMacro; - String aLanguage = pImpl->pScriptTypeLB->GetSelectEntry(); - String sNew; + String sScriptURI; if( bAssEnabled ) { - String sGroup; - String sMacro; - String aEntryText( sNew ); - DBG_ASSERT( !aLanguage.EqualsAscii("JavaScript"), "_SfxMacroTabPage, AssignDeleteHdl_Impl(): outdated use!" ); - - SfxMacroInfo* pMacro = pImpl->pMacroLB->GetMacroInfo(); - sMacro = pMacro->GetQualifiedName(); - sGroup = pImpl->pGroupLB->GetGroup(); - sNew = pMacro->GetMacroName(); - - if( sMacro.CompareToAscii( "vnd.sun.star.script:", 20 ) == COMPARE_EQUAL ) + sScriptURI = pImpl->pMacroLB->GetSelectedScriptURI(); + if( sScriptURI.CompareToAscii( "vnd.sun.star.script:", 20 ) == COMPARE_EQUAL ) { - OSL_TRACE("ASSIGN_DELETE: Its a script"); pThis->aTbl.Insert( - nEvent, new SvxMacro( sMacro, String::CreateFromAscii("Script") ) ); + nEvent, new SvxMacro( sScriptURI, String::CreateFromAscii( SVX_MACRO_LANGUAGE_SF ) ) ); } else { - OSL_TRACE("ASSIGN_DELETE: Its a basic macro"); - String sBasicName/*(SfxResId(STR_BASICNAME))*/; - if ( aLanguage == sBasicName ) - pThis->aTbl.Insert( nEvent, new SvxMacro( sMacro, sGroup, STARBASIC ) ); - else - pThis->aTbl.Insert( nEvent, new SvxMacro( sMacro, aLanguage ) ); + OSL_ENSURE( false, "_SfxMacroTabPage::AssignDeleteHdl_Impl: this branch is *not* dead? (out of interest: tell fs, please!)" ); + pThis->aTbl.Insert( + nEvent, new SvxMacro( sScriptURI, String::CreateFromAscii( SVX_MACRO_LANGUAGE_STARBASIC ) ) ); } } pImpl->pEventLB->SetUpdateMode( FALSE ); - pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS ); + pE->ReplaceItem( new SvLBoxString( pE, 0, sScriptURI ), LB_MACROS_ITEMPOS ); rListBox.GetModel()->InvalidateEntry( pE ); rListBox.Select( pE ); rListBox.MakeVisible( pE ); rListBox.SetUpdateMode( TRUE ); - pThis->EnableButtons( aLanguage ); - return 0; -} - -IMPL_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton*, EMPTYARG ) -{ - pThis->ScriptChanged( pThis->mpImpl->pScriptTypeLB->GetSelectEntry() ); + pThis->EnableButtons(); return 0; } @@ -469,8 +397,6 @@ void _SfxMacroTabPage::InitAndSetHandler() mpImpl->pGroupLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectGroup_Impl )); mpImpl->pMacroLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectMacro_Impl )); - mpImpl->pScriptTypeLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, ChangeScriptHdl_Impl )); - rListBox.SetSelectionMode( SINGLE_SELECTION ); rListBox.SetTabs( &nTabs[0], MAP_APPFONT ); Size aSize( nTabs[ 2 ], 0 ); @@ -486,11 +412,6 @@ void _SfxMacroTabPage::InitAndSetHandler() mpImpl->pGroupLB->Enable( TRUE ); mpImpl->pMacroLB->Enable( TRUE ); - mpImpl->pScriptTypeLB->SetDropDownLineCount( 3 ); - String sBasicName/*(SfxResId(STR_BASICNAME))*/; - mpImpl->pScriptTypeLB->InsertEntry( sBasicName ); - mpImpl->pScriptTypeLB->SelectEntry( sBasicName ); - mpImpl->pGroupLB->SetFunctionListBox( mpImpl->pMacroLB ); mpImpl->maFillGroupTimer.SetTimeoutHdl( STATIC_LINK( this, _SfxMacroTabPage, TimeOut_Impl ) ); @@ -500,29 +421,17 @@ void _SfxMacroTabPage::InitAndSetHandler() void _SfxMacroTabPage::FillMacroList() { - String aLanguage = mpImpl->pScriptTypeLB->GetSelectEntry(); - if( ! aLanguage.EqualsAscii("JavaScript") ) - { - // 2 Listboxen - SvStringsDtor* pArr = (*mpImpl->fnGetRange)( this, String(/*SfxResId(STR_BASICNAME)*/) ); - if( pArr ) - { - mpImpl->pGroupLB->Init( - ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >(), - GetFrame(), - ::rtl::OUString() ); - - delete pArr; - } - } + mpImpl->pGroupLB->Init( + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >(), + GetFrame(), + ::rtl::OUString() ); } void _SfxMacroTabPage::FillEvents() { SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - String aLanguage = mpImpl->pScriptTypeLB->GetSelectEntry(); ULONG nEntryCnt = rListBox.GetEntryCount(); // Events aus der Tabelle holen und die EventListBox entsprechen fuellen @@ -538,7 +447,7 @@ void _SfxMacroTabPage::FillEvents() String sNew; USHORT nEventId = ( USHORT ) ( ULONG ) pE->GetUserData(); if( aTbl.IsKeyValid( nEventId ) ) - sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ), aLanguage ); + sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ) ); if( sOld != sNew ) { @@ -549,78 +458,6 @@ void _SfxMacroTabPage::FillEvents() } } -SvStringsDtor* __EXPORT _ImpGetRangeHdl( _SfxMacroTabPage* /*pTbPg*/, const String& rLanguage ) -{ - SvStringsDtor* pNew = new SvStringsDtor; - SfxApplication* pSfxApp = SFX_APP(); - - if ( !rLanguage.EqualsAscii("JavaScript") ) - { - pSfxApp->EnterBasicCall(); - - // AppBasic einf"ugen - String* pNewEntry = new String( pSfxApp->GetName() ); - pNew->Insert( pNewEntry, pNew->Count() ); - - // Aktuelles Dokument - SfxObjectShell* pDoc = SfxObjectShell::Current(); - if ( pDoc ) - { - String aTitle = pDoc->GetTitle(); - - // Hack f"ur Aufruf aus der Basic-IDE : das Basic ermitteln, das - // gerade bearbeitet wird - - String aAppName(DEFINE_CONST_UNICODE("BASIC - ")); - USHORT nLen = aAppName.Len(); - if ( aTitle.CompareIgnoreCaseToAscii( aAppName, nLen ) == COMPARE_EQUAL ) - { - // Basic-Namensprefix entfernen - aTitle.Erase( 0, nLen ); - USHORT nIndex=0, nCount=aTitle.GetTokenCount('.'); - if ( nCount > 1 ) - { - // Namen der Library entfernen - aTitle.GetToken( nCount-2, '.', nIndex ); - aTitle.Erase( nIndex-1 ); - } - - // Wenn das App-Basic gerade in der Basic-IDE bearbeitet wird, kein - // Dokument verwenden - pDoc = SfxObjectShell::GetFirst(); - while( pDoc ) - { - if ( aTitle == pDoc->GetTitle() ) - break; - pDoc = SfxObjectShell::GetNext( *pDoc ); - } - } - - if ( pDoc && pDoc->GetBasicManager() != SFX_APP()->GetBasicManager() && - pDoc->GetBasicManager()->GetLibCount() ) - { - pNewEntry = new String( aTitle ); - pNew->Insert( pNewEntry, pNew->Count() ); - } - } - - pSfxApp->LeaveBasicCall(); - } - - return pNew; -} - -// besorgen der Funktionen eines Bereiches -SvStringsDtor* __EXPORT _ImpGetMacrosOfRangeHdl( - _SfxMacroTabPage* /*pTbPg*/, - const String& /*rLanguage*/, - const String& /*rRange*/ ) -{ - SvStringsDtor* pNew = new SvStringsDtor; - return pNew; -} - - SfxMacroTabPage::SfxMacroTabPage( Window* pParent, const ResId& rResId, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) : _SfxMacroTabPage( pParent, rResId, rSet ) { @@ -629,8 +466,6 @@ SfxMacroTabPage::SfxMacroTabPage( Window* pParent, const ResId& rResId, const Re mpImpl->pEventLB = new _HeaderTabListBox( this, CUI_RES( LB_EVENT ) ); mpImpl->pAssignPB = new PushButton( this, CUI_RES( PB_ASSIGN ) ); mpImpl->pDeletePB = new PushButton( this, CUI_RES( PB_DELETE ) ); - mpImpl->pScriptTypeLB = new ListBox(this, CUI_RES( LB_SCRIPTTYPE ) ); - mpImpl->pScriptTypeLB->Hide(); mpImpl->pMacroFT = new FixedText( this, CUI_RES( FT_MACRO ) ); mpImpl->pGroupLB = new SfxConfigGroupListBox_Impl( this, CUI_RES( LB_GROUP ) ); mpImpl->pFT_MacroLBLabel = new FixedText( this, CUI_RES( FT_LABEL4LB_MACROS ) ); @@ -644,7 +479,7 @@ SfxMacroTabPage::SfxMacroTabPage( Window* pParent, const ResId& rResId, const Re InitAndSetHandler(); - ScriptChanged( String( /*SfxResId(STR_BASICNAME)*/ ) ); + ScriptChanged(); } SfxTabPage* SfxMacroTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) diff --git a/cui/source/tabpages/macroass.hrc b/cui/source/tabpages/macroass.hrc index 614711e1981e..73292a7f1b0e 100644 --- a/cui/source/tabpages/macroass.hrc +++ b/cui/source/tabpages/macroass.hrc @@ -38,7 +38,7 @@ #define FT_MACRO 5 #define LB_GROUP 6 #define LB_MACROS 7 -#define LB_SCRIPTTYPE 8 + // FREE #define FT_LABEL4LB_MACROS 9 #define STR_JAVASCRIPT 10 #define STR_MACROS 11 diff --git a/cui/source/tabpages/macroass.src b/cui/source/tabpages/macroass.src index 9a5bb519d460..05e81658b8a3 100644 --- a/cui/source/tabpages/macroass.src +++ b/cui/source/tabpages/macroass.src @@ -78,7 +78,7 @@ TabPage RID_SVXPAGE_EVENTASSIGN Pos = MAP_APPFONT ( COL2 , ROW7 ) ; Size = MAP_APPFONT ( WIDTH1 , RSC_CD_FIXEDTEXT_HEIGHT + HEIGHT_EXTRA7 ) ; WordBreak = TRUE; - Text [ en-US ] = "~Existing macros in:\n" ; + Text [ en-US ] = "~Existing macros\n" ; }; Control LB_MACROS { @@ -107,17 +107,6 @@ TabPage RID_SVXPAGE_EVENTASSIGN TabStop = TRUE ; Text [ en-US ] = "~Remove" ; }; - ListBox LB_SCRIPTTYPE - { - HelpID = "cui:ListBox:RID_SVXPAGE_EVENTASSIGN:LB_SCRIPTTYPE"; - Pos = MAP_APPFONT ( COL4 , ROW4 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , 60 ) ; - // en-US was missing - Text [ en-US ] = "~Scripting Language" ; - TabStop = TRUE ; - Disable = FALSE ; - DropDown = TRUE ; - }; String STR_MACROS { Text [ en-US ] = "Macros" ; |