diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-03-09 16:20:50 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-03-09 16:20:50 -0600 |
commit | ab1deb45e8bdfcb406ed40cc279412bfb8ebb7da (patch) | |
tree | 4fabc6cfb877b36a045647e22ab9afb895a0c6e2 /cui/source/tabpages/macroass.cxx | |
parent | 8d39bcae009afc1022974a6b0efdbbdb5b057ad4 (diff) | |
parent | e887a292fa3a7662fea0fc682d41f55e9e170a33 (diff) |
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
* commit 'ooo/DEV300_m101': (185 commits)
masterfix DEV300: #i10000# usage of L10N build_type
masterfix: #i10000# INT16 -> sal_Int16
fixed compile errors after resync to m100, part2
gridsort: post-rebase fixes
CWS gnumake3: found another tools integer type
removetooltypes01: Fix build problems after rebase to DEV300m99 in basctl, cui, reportdesign, sw
native359: #i114398# changing mac langpack icon
native359: #i115669# fixing package description for solaris packages
gnumake3: remove comphelper version; fix including extract.hxx
locales34: #i106785# add Haitian_Haiti [ht-HT] to language list and locale data; locale data contributed by <jcpoulard>
sb138: #i116659# timely termination of OnLogRotateThread
accfixes: removed include of obsolete header file
accfixes: removed obsolete file
removetooltypes01: #i112600# Fix build problems on non-pro
accfixes: moved some shared strings to svx part2
accfixes: moved some shared strings to svx
accfixes: added more accessibility information and fixed tab orders in multiple dialogs (cui module)
removetooltypes01: #i112600# Remove tools types for Mac specific parts
fixed tab order in BasicIDE, Library dialog tab page
added some accessible names in BasicIDE
...
Conflicts:
UnoControls/source/base/registercontrols.cxx
accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx
automation/inc/automation/communi.hxx
automation/inc/automation/simplecm.hxx
automation/source/communi/communi.cxx
automation/source/inc/rcontrol.hxx
automation/source/miniapp/servuid.hxx
automation/source/server/XMLParser.cxx
automation/source/server/cmdbasestream.cxx
automation/source/server/profiler.hxx
automation/source/server/recorder.cxx
automation/source/server/retstrm.hxx
automation/source/server/server.cxx
automation/source/server/sta_list.cxx
automation/source/server/statemnt.cxx
automation/source/server/statemnt.hxx
automation/source/simplecm/packethandler.cxx
automation/source/simplecm/simplecm.cxx
automation/source/simplecm/tcpio.cxx
automation/source/simplecm/tcpio.hxx
automation/source/testtool/comm_bas.hxx
automation/source/testtool/cretstrm.hxx
automation/source/testtool/httprequest.cxx
automation/source/testtool/httprequest.hxx
automation/source/testtool/objtest.cxx
automation/source/testtool/objtest.hxx
basctl/source/basicide/baside2.cxx
basctl/source/basicide/baside2.hxx
basctl/source/basicide/baside2b.cxx
basctl/source/basicide/baside3.cxx
basctl/source/basicide/basides1.cxx
basctl/source/basicide/basides2.cxx
basctl/source/basicide/basidesh.cxx
basctl/source/basicide/basidesh.src
basctl/source/basicide/basobj3.cxx
basctl/source/basicide/bastype2.cxx
basctl/source/basicide/bastype3.cxx
basctl/source/basicide/bastypes.cxx
basctl/source/basicide/brkdlg.cxx
basctl/source/basicide/iderdll.cxx
basctl/source/basicide/macrodlg.cxx
basctl/source/basicide/moduldl2.cxx
basctl/source/basicide/moduldlg.cxx
basctl/source/basicide/objdlg.cxx
basctl/source/basicide/scriptdocument.cxx
basctl/source/basicide/tbxctl.cxx
basctl/source/basicide/tbxctl.hxx
basctl/source/basicide/tbxctl.src
basctl/source/dlged/dlged.cxx
basctl/source/dlged/dlgedfunc.cxx
basctl/source/dlged/dlgedobj.cxx
basctl/source/inc/basidesh.hxx
basctl/source/inc/bastypes.hxx
basctl/source/inc/dlgedmod.hxx
basctl/source/inc/dlgedpage.hxx
crashrep/prj/build.lst
cui/inc/pch/precompiled_cui.hxx
cui/source/customize/acccfg.cxx
cui/source/customize/acccfg.hrc
cui/source/customize/acccfg.src
cui/source/customize/cfg.cxx
cui/source/customize/cfgutil.cxx
cui/source/customize/macropg.cxx
cui/source/customize/macropg.src
cui/source/customize/selector.cxx
cui/source/dialogs/SpellDialog.cxx
cui/source/dialogs/commonlingui.cxx
cui/source/dialogs/cuicharmap.cxx
cui/source/dialogs/cuifmsearch.cxx
cui/source/dialogs/cuigaldlg.cxx
cui/source/dialogs/cuigrfflt.cxx
cui/source/dialogs/hldocntp.cxx
cui/source/dialogs/hldoctp.cxx
cui/source/dialogs/hlinettp.cxx
cui/source/dialogs/hlmailtp.cxx
cui/source/dialogs/hlmarkwn.cxx
cui/source/dialogs/hlmarkwn.src
cui/source/dialogs/hltpbase.cxx
cui/source/dialogs/iconcdlg.cxx
cui/source/dialogs/passwdomdlg.cxx
cui/source/dialogs/pastedlg.cxx
cui/source/dialogs/scriptdlg.cxx
cui/source/dialogs/thesdlg.cxx
cui/source/dialogs/zoom.cxx
cui/source/factory/dlgfact.hxx
cui/source/inc/SpellDialog.hxx
cui/source/inc/autocdlg.hxx
cui/source/inc/backgrnd.hxx
cui/source/inc/bbdlg.hxx
cui/source/inc/cfg.hxx
cui/source/inc/cfgutil.hxx
cui/source/inc/cuigaldlg.hxx
cui/source/inc/cuigrfflt.hxx
cui/source/inc/cuitabarea.hxx
cui/source/inc/cuitabline.hxx
cui/source/inc/hldocntp.hxx
cui/source/inc/hltpbase.hxx
cui/source/inc/iconcdlg.hxx
cui/source/inc/numpages.hxx
cui/source/inc/page.hxx
cui/source/inc/postdlg.hxx
cui/source/inc/scriptdlg.hxx
cui/source/inc/transfrm.hxx
cui/source/inc/zoom.hxx
cui/source/options/cfgchart.cxx
cui/source/options/cuisrchdlg.cxx
cui/source/options/dbregister.cxx
cui/source/options/dbregister.src
cui/source/options/fontsubs.cxx
cui/source/options/internationaloptions.cxx
cui/source/options/optasian.cxx
cui/source/options/optchart.cxx
cui/source/options/optcolor.cxx
cui/source/options/optcolor.src
cui/source/options/optfltr.cxx
cui/source/options/optfltr.src
cui/source/options/optgdlg.cxx
cui/source/options/optgdlg.src
cui/source/options/optgenrl.cxx
cui/source/options/opthtml.cxx
cui/source/options/optimprove.cxx
cui/source/options/optinet2.cxx
cui/source/options/optinet2.hxx
cui/source/options/optjava.cxx
cui/source/options/optlingu.cxx
cui/source/options/optsave.cxx
cui/source/options/optsave.hxx
cui/source/options/treeopt.cxx
cui/source/options/webconninfo.cxx
cui/source/tabpages/autocdlg.cxx
cui/source/tabpages/backgrnd.cxx
cui/source/tabpages/border.cxx
cui/source/tabpages/chardlg.cxx
cui/source/tabpages/dstribut.cxx
cui/source/tabpages/grfpage.cxx
cui/source/tabpages/macroass.cxx
cui/source/tabpages/measure.cxx
cui/source/tabpages/numfmt.cxx
cui/source/tabpages/numpages.cxx
cui/source/tabpages/page.cxx
cui/source/tabpages/paragrph.cxx
cui/source/tabpages/swpossizetabpage.cxx
cui/source/tabpages/tabarea.src
cui/source/tabpages/textanim.cxx
cui/source/tabpages/textattr.cxx
cui/source/tabpages/tparea.cxx
cui/source/tabpages/tpbitmap.cxx
cui/source/tabpages/tpcolor.cxx
cui/source/tabpages/tpgradnt.cxx
cui/source/tabpages/tphatch.cxx
cui/source/tabpages/tpline.cxx
cui/source/tabpages/tplnedef.cxx
cui/source/tabpages/tplneend.cxx
cui/source/tabpages/tpshadow.cxx
cui/source/tabpages/transfrm.cxx
embedserv/source/embed/register.cxx
extensions/inc/pch/precompiled_extensions.hxx
extensions/inc/propctrlr.hrc
extensions/source/abpilot/abpservices.cxx
extensions/source/bibliography/bibload.cxx
extensions/source/bibliography/datman.cxx
extensions/source/bibliography/general.cxx
extensions/source/dbpilots/dbpservices.cxx
extensions/source/inc/componentmodule.cxx
extensions/source/nsplugin/source/so_env.cxx
extensions/source/ole/oleobjw.cxx
extensions/source/ole/oleobjw.hxx
extensions/source/oooimprovement/invite_job.cxx
extensions/source/oooimprovement/onlogrotate_job.cxx
extensions/source/plugin/base/service.cxx
extensions/source/plugin/inc/plugin/unx/mediator.hxx
extensions/source/plugin/inc/plugin/unx/plugcon.hxx
extensions/source/plugin/unx/mediator.cxx
extensions/source/plugin/unx/nppapi.cxx
extensions/source/plugin/unx/plugcon.cxx
extensions/source/preload/services.cxx
extensions/source/propctrlr/formmetadata.cxx
extensions/source/propctrlr/pcrservices.cxx
extensions/source/resource/resource.cxx
extensions/source/scanner/sane.hxx
extensions/source/scanner/sanedlg.cxx
extensions/source/scanner/scanunx.cxx
extensions/source/scanner/scanwin.cxx
extensions/source/scanner/twain.cxx
extensions/source/scanner/twain.hxx
extensions/source/update/check/updatecheckconfig.cxx
extensions/test/stm/datatest.cxx
extensions/test/stm/marktest.cxx
extensions/test/stm/pipetest.cxx
extensions/test/stm/testfactreg.cxx
extensions/workben/testpgp.cxx
forms/qa/complex/forms/CheckOGroupBoxModel.java
forms/qa/makefile.mk
forms/source/component/Button.cxx
forms/source/component/Button.hxx
forms/source/component/ListBox.cxx
forms/source/inc/forms_module_impl.hxx
forms/source/misc/services.cxx
forms/source/solar/control/navtoolbar.cxx
javainstaller2/prj/build.lst
javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java
lingucomponent/prj/build.lst
lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
lingucomponent/source/spellcheck/spell/sreg.cxx
lingucomponent/source/spellcheck/spell/sspellimp.cxx
package/source/manifest/ManifestExport.cxx
package/source/manifest/UnoRegister.cxx
package/source/xstor/owriteablestream.cxx
package/source/xstor/owriteablestream.hxx
package/source/xstor/xstorage.hxx
package/source/zippackage/ZipPackageFolder.cxx
package/source/zippackage/ZipPackageStream.cxx
setup_native/source/mac/ooo/DS_Store
setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
xmlsecurity/prj/build.lst
xmlsecurity/source/component/registerservices.cxx
xmlsecurity/source/dialogs/stbcontrl.cxx
xmlsecurity/source/framework/xsec_framework.cxx
xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
xmlsecurity/tools/demo/util.hxx
xmlsecurity/workben/signaturetest.cxx
Diffstat (limited to 'cui/source/tabpages/macroass.cxx')
-rw-r--r-- | cui/source/tabpages/macroass.cxx | 356 |
1 files changed, 71 insertions, 285 deletions
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index b9c560dc9..fb33590d8 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -41,10 +41,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; @@ -61,7 +62,6 @@ public: PushButton* pDeletePB; String* pStrEvent; String* pAssignedMacro; - ListBox* pScriptTypeLB; _HeaderTabListBox* pEventLB; SfxConfigGroupListBox_Impl* pGroupLB; FixedText* pFT_MacroLBLabel; @@ -69,12 +69,10 @@ public: FixedText* pMacroFT; String* pMacroStr; - FNGetRangeHdl fnGetRange; - FNGetMacrosOfRangeHdl fnGetMacroOfRange; - BOOL bReadOnly; + sal_Bool bReadOnly; Timer maFillGroupTimer; - BOOL bGotEvents; + sal_Bool bGotEvents; }; _SfxMacroTabPage_Impl::_SfxMacroTabPage_Impl( void ) : @@ -82,17 +80,14 @@ _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 ) + bReadOnly( sal_False ), + bGotEvents( sal_False ) { } @@ -102,7 +97,6 @@ _SfxMacroTabPage_Impl::~_SfxMacroTabPage_Impl() delete pDeletePB; delete pStrEvent; delete pAssignedMacro; - delete pScriptTypeLB; delete pEventLB; delete pGroupLB; delete pMacroLB; @@ -112,10 +106,7 @@ _SfxMacroTabPage_Impl::~_SfxMacroTabPage_Impl() } -SvStringsDtor* _ImpGetRangeHdl( _SfxMacroTabPage*, const String& rLanguage ); -SvStringsDtor* _ImpGetMacrosOfRangeHdl( _SfxMacroTabPage*, const String& rLanguage, const String& rRange ); - -static USHORT aPageRg[] = { +static sal_uInt16 aPageRg[] = { SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, 0 }; @@ -137,13 +128,13 @@ 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; if ( ! pMacro->GetLanguage().EqualsAscii("JavaScript") ) { - USHORT nCount = aName.GetTokenCount('.'); + sal_uInt16 nCount = aName.GetTokenCount('.'); aEntry = aName.GetToken( nCount-1, '.' ); if ( nCount > 2 ) { @@ -159,36 +150,24 @@ 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(); if ( pE ) { // Gebundenes Macro holen - const SvxMacro* pM = aTbl.Get( (USHORT)(ULONG) pE->GetUserData() ); + const SvxMacro* pM = aTbl.Get( (sal_uInt16)(sal_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") ) - { - OSL_FAIL( "_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( sal_False ); } _SfxMacroTabPage::_SfxMacroTabPage( Window* pParent, const ResId& rResId, const SfxItemSet& rAttrSet ) @@ -196,8 +175,6 @@ _SfxMacroTabPage::_SfxMacroTabPage( Window* pParent, const ResId& rResId, const { mpImpl = new _SfxMacroTabPage_Impl; - mpImpl->fnGetRange = &_ImpGetRangeHdl; - mpImpl->fnGetMacroOfRange = &_ImpGetMacrosOfRangeHdl; } _SfxMacroTabPage::~_SfxMacroTabPage() @@ -205,7 +182,7 @@ _SfxMacroTabPage::~_SfxMacroTabPage() DELETEZ( mpImpl ); } -void _SfxMacroTabPage::AddEvent( const String & rEventName, USHORT nEventId ) +void _SfxMacroTabPage::AddEvent( const String & rEventName, sal_uInt16 nEventId ) { String sTmp( rEventName ); sTmp += '\t'; @@ -214,7 +191,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; } @@ -222,60 +199,39 @@ 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 ); -} - -void _SfxMacroTabPage::SetGetRangeLink( FNGetRangeHdl pFn ) -{ - mpImpl->fnGetRange = pFn; -} - -FNGetRangeHdl _SfxMacroTabPage::GetGetRangeLink() const -{ - return mpImpl->fnGetRange; -} - -void _SfxMacroTabPage::SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn ) -{ - mpImpl->fnGetMacroOfRange = pFn; -} - -FNGetMacrosOfRangeHdl _SfxMacroTabPage::GetGetMacrosOfRangeLink() const -{ - return mpImpl->fnGetMacroOfRange; + EnableButtons(); } -BOOL _SfxMacroTabPage::FillItemSet( SfxItemSet& rSet ) +sal_Bool _SfxMacroTabPage::FillItemSet( SfxItemSet& rSet ) { SvxMacroItem aItem( GetWhich( aPageRg[0] ) ); ((SvxMacroTableDtor&)aItem.GetMacroTable()) = aTbl; const SfxPoolItem* pItem; - if( SFX_ITEM_SET != GetItemSet().GetItemState( aItem.Which(), TRUE, &pItem ) + if( SFX_ITEM_SET != GetItemSet().GetItemState( aItem.Which(), sal_True, &pItem ) || aItem != *(SvxMacroItem*)pItem ) { rSet.Put( aItem ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } void _SfxMacroTabPage::PageCreated (SfxAllItemSet aSet) { const SfxPoolItem* pEventsItem; - if( !mpImpl->bGotEvents && SFX_ITEM_SET == aSet.GetItemState( SID_EVENTCONFIG, TRUE, &pEventsItem ) ) + if( !mpImpl->bGotEvents && SFX_ITEM_SET == aSet.GetItemState( SID_EVENTCONFIG, sal_True, &pEventsItem ) ) { - mpImpl->bGotEvents = TRUE; + mpImpl->bGotEvents = sal_True; const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents(); for ( size_t nNo = 0, nCnt = rList.size(); nNo < nCnt; ++nNo ) { @@ -288,13 +244,13 @@ void _SfxMacroTabPage::PageCreated (SfxAllItemSet aSet) void _SfxMacroTabPage::Reset( const SfxItemSet& rSet ) { const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( aPageRg[0] ), TRUE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( aPageRg[0] ), sal_True, &pItem )) aTbl = ((SvxMacroItem*)pItem)->GetMacroTable(); const SfxPoolItem* pEventsItem; - if( !mpImpl->bGotEvents && SFX_ITEM_SET == rSet.GetItemState( SID_EVENTCONFIG, TRUE, &pEventsItem ) ) + if( !mpImpl->bGotEvents && SFX_ITEM_SET == rSet.GetItemState( SID_EVENTCONFIG, sal_True, &pEventsItem ) ) { - mpImpl->bGotEvents = TRUE; + mpImpl->bGotEvents = sal_True; const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents(); for ( size_t nNo = 0, nCnt = rList.size(); nNo < nCnt; ++nNo ) { @@ -311,12 +267,7 @@ void _SfxMacroTabPage::Reset( const SfxItemSet& rSet ) rListBox.SetCurEntry( pE ); } -void _SfxMacroTabPage::SetReadOnly( BOOL bSet ) -{ - mpImpl->bReadOnly = bSet; -} - -BOOL _SfxMacroTabPage::IsReadOnly() const +sal_Bool _SfxMacroTabPage::IsReadOnly() const { return mpImpl->bReadOnly; } @@ -326,7 +277,7 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG ) _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); SvLBoxEntry* pE = rListBox.FirstSelected(); - ULONG nPos; + sal_uLong nPos; if( !pE || LISTBOX_ENTRY_NOTFOUND == ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) { @@ -334,24 +285,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; } @@ -359,26 +294,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; } @@ -386,13 +309,7 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox*, EMPTYARG ) { _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; pImpl->pMacroLB->FunctionSelected(); - pThis->EnableButtons( pImpl->pScriptTypeLB->GetSelectEntry() ); - return 0; -} - -IMPL_STATIC_LINK( _SfxMacroTabPage, GetFocus_Impl, Edit*, EMPTYARG ) -{ - pThis->EnableButtons( DEFINE_CONST_UNICODE("JavaScript") ); + pThis->EnableButtons(); return 0; } @@ -401,7 +318,7 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn ) _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); SvLBoxEntry* pE = rListBox.FirstSelected(); - ULONG nPos; + sal_uLong nPos; if( !pE || LISTBOX_ENTRY_NOTFOUND == ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) { @@ -409,58 +326,38 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn ) return 0; } - const BOOL bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled(); + const sal_Bool bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled(); // aus der Tabelle entfernen - USHORT nEvent = (USHORT)(ULONG)pE->GetUserData(); + sal_uInt16 nEvent = (sal_uInt16)(sal_uLong)pE->GetUserData(); 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 ); + pImpl->pEventLB->SetUpdateMode( sal_False ); + 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; -} + rListBox.SetUpdateMode( sal_True ); -IMPL_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton*, EMPTYARG ) -{ - pThis->ScriptChanged( pThis->mpImpl->pScriptTypeLB->GetSelectEntry() ); + pThis->EnableButtons(); return 0; } @@ -472,12 +369,12 @@ IMPL_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer*, EMPTYARG ) if ( pTabDlg ) { pTabDlg->EnterWait(); - pTabDlg->EnableInput( FALSE ); + pTabDlg->EnableInput( sal_False ); } pThis->FillMacroList(); if ( pTabDlg ) { - pTabDlg->EnableInput( TRUE ); + pTabDlg->EnableInput( sal_True ); pTabDlg->LeaveWait(); } return 0; @@ -498,8 +395,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 ); @@ -511,14 +406,9 @@ void _SfxMacroTabPage::InitAndSetHandler() mpImpl->pEventLB->Show(); mpImpl->pEventLB->ConnectElements(); - mpImpl->pEventLB->Enable( TRUE ); - 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->pEventLB->Enable( sal_True ); + mpImpl->pGroupLB->Enable( sal_True ); + mpImpl->pMacroLB->Enable( sal_True ); mpImpl->pGroupLB->SetFunctionListBox( mpImpl->pMacroLB ); @@ -529,33 +419,21 @@ 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(); + sal_uLong nEntryCnt = rListBox.GetEntryCount(); // Events aus der Tabelle holen und die EventListBox entsprechen fuellen - for( ULONG n = 0 ; n < nEntryCnt ; ++n ) + for( sal_uLong n = 0 ; n < nEntryCnt ; ++n ) { SvLBoxEntry* pE = rListBox.GetEntry( n ); if( pE ) @@ -565,9 +443,9 @@ void _SfxMacroTabPage::FillEvents() String sOld( pLItem->GetText() ); String sNew; - USHORT nEventId = ( USHORT ) ( ULONG ) pE->GetUserData(); + sal_uInt16 nEventId = ( sal_uInt16 ) ( sal_uLong ) pE->GetUserData(); if( aTbl.IsKeyValid( nEventId ) ) - sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ), aLanguage ); + sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ) ); if( sOld != sNew ) { @@ -578,96 +456,6 @@ void _SfxMacroTabPage::FillEvents() } } -void _SfxMacroTabPage::SelectEvent( const String & /*rEventName*/, USHORT nEventId ) -{ - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - ULONG nEntryCnt = rListBox.GetEntryCount(); - - for( ULONG n = 0 ; n < nEntryCnt ; ++n ) - { - SvLBoxEntry* pE = rListBox.GetEntry( n ); - if( pE && ( USHORT ) ( ULONG ) pE->GetUserData() == nEventId ) - { - rListBox.SetCurEntry( pE ); - rListBox.MakeVisible( pE ); - break; - } - } -} - - -SvStringsDtor* _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* _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 ) { @@ -676,8 +464,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 ) ); @@ -691,7 +477,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 ) |