cui/source/customize/eventdlg.cxx | 2 cui/source/customize/macropg.cxx | 162 ++++++++++++++++++----------------- cui/source/inc/macropg.hxx | 14 --- cui/source/options/treeopt.cxx | 173 ++++++++++++++++++-------------------- 4 files changed, 168 insertions(+), 183 deletions(-)
New commits: commit e888503ee0aecbce8f3075b106243cf68b8dddc7 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue May 7 14:02:33 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri May 10 18:42:22 2024 +0200 replace createFromAscii with OUString literals in OfaTreeOptionsDialog Change-Id: Ibe4de7e2ac6f0f00ba495ecbd18d97154283169c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167474 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 646b3bdee917..f010df6f42a1 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -293,112 +293,109 @@ namespace { struct OptionsMapping_Impl { - const char* m_pGroupName; - const char* m_pPageName; + OUString m_aGroupName; + OUString m_aPageName; sal_uInt16 m_nPageId; }; } -OptionsMapping_Impl const OptionsMap_Impl[] = +constexpr OptionsMapping_Impl OptionsMap_Impl[] { // GROUP PAGE PAGE-ID - { "ProductName", nullptr, SID_GENERAL_OPTIONS }, - { "ProductName", "UserData", RID_SFXPAGE_GENERAL }, - { "ProductName", "General", OFA_TP_MISC }, - { "ProductName", "View", OFA_TP_VIEW }, - { "ProductName", "Print", RID_SFXPAGE_PRINTOPTIONS }, - { "ProductName", "Paths", RID_SFXPAGE_PATH }, - { "ProductName", "Fonts", RID_SVX_FONT_SUBSTITUTION }, - { "ProductName", "Security", RID_SVXPAGE_INET_SECURITY }, - { "ProductName", "Personalization", RID_SVXPAGE_PERSONALIZATION }, - { "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG }, - { "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG }, - { "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA }, - { "ProductName", "BasicIDEOptions", RID_SVXPAGE_BASICIDE_OPTIONS }, - { "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE }, - { "LanguageSettings", nullptr, SID_LANGUAGE_OPTIONS }, - { "LanguageSettings", "Languages", OFA_TP_LANGUAGES }, - { "LanguageSettings", "WritingAids", RID_SFXPAGE_LINGU }, - { "LanguageSettings", "SearchingInJapanese", RID_SVXPAGE_JSEARCH_OPTIONS }, - { "LanguageSettings", "AsianLayout", RID_SVXPAGE_ASIAN_LAYOUT }, - { "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL }, - { "Internet", nullptr, SID_INET_DLG }, - { "Internet", "Proxy", RID_SVXPAGE_INET_PROXY }, - { "Internet", "Email", RID_SVXPAGE_INET_MAIL }, - { "LoadSave", nullptr, SID_FILTER_DLG }, - { "LoadSave", "General", RID_SFXPAGE_SAVE }, - { "LoadSave", "VBAProperties", SID_OPTFILTER_MSOFFICE }, - { "LoadSave", "MicrosoftOffice", RID_OFAPAGE_MSFILTEROPT2 }, - { "LoadSave", "HTMLCompatibility", RID_OFAPAGE_HTMLOPT }, - { "Writer", nullptr, SID_SW_EDITOPTIONS }, - { "Writer", "General", RID_SW_TP_OPTLOAD_PAGE }, - { "Writer", "View", RID_SW_TP_CONTENT_OPT }, - { "Writer", "FormattingAids", RID_SW_TP_OPTSHDWCRSR }, - { "Writer", "Grid", RID_SVXPAGE_GRID }, - { "Writer", "BasicFontsWestern", RID_SW_TP_STD_FONT }, - { "Writer", "BasicFontsAsian", RID_SW_TP_STD_FONT_CJK }, - { "Writer", "BasicFontsCTL", RID_SW_TP_STD_FONT_CTL }, - { "Writer", "Print", RID_SW_TP_OPTPRINT_PAGE }, - { "Writer", "Table", RID_SW_TP_OPTTABLE_PAGE }, - { "Writer", "Changes", RID_SW_TP_REDLINE_OPT }, - { "Writer", "Comparison", RID_SW_TP_COMPARISON_OPT }, - { "Writer", "Compatibility", RID_SW_TP_OPTCOMPATIBILITY_PAGE }, - { "Writer", "AutoCaption", RID_SW_TP_OPTCAPTION_PAGE }, - { "Writer", "MailMerge", RID_SW_TP_MAILCONFIG }, - { "WriterWeb", nullptr, SID_SW_ONLINEOPTIONS }, - { "WriterWeb", "View", RID_SW_TP_HTML_CONTENT_OPT }, - { "WriterWeb", "FormattingAids", RID_SW_TP_HTML_OPTSHDWCRSR }, - { "WriterWeb", "Grid", RID_SW_TP_HTML_OPTGRID_PAGE }, - { "WriterWeb", "Print", RID_SW_TP_HTML_OPTPRINT_PAGE }, - { "WriterWeb", "Table", RID_SW_TP_HTML_OPTTABLE_PAGE }, - { "WriterWeb", "Background", RID_SW_TP_BACKGROUND }, - { "Math", nullptr, SID_SM_EDITOPTIONS }, - { "Math", "Settings", SID_SM_TP_PRINTOPTIONS }, - { "Calc", nullptr, SID_SC_EDITOPTIONS }, - { "Calc", "General", SID_SC_TP_LAYOUT }, - { "Calc", "View", SID_SC_TP_CONTENT }, - { "Calc", "Calculate", SID_SC_TP_CALC }, - { "Calc", "Formula", SID_SC_TP_FORMULA }, - { "Calc", "SortLists", SID_SC_TP_USERLISTS }, - { "Calc", "Changes", SID_SC_TP_CHANGES }, - { "Calc", "Compatibility", SID_SC_TP_COMPATIBILITY }, - { "Calc", "Grid", SID_SC_TP_GRID }, - { "Calc", "Print", RID_SC_TP_PRINT }, - { "Impress", nullptr, SID_SD_EDITOPTIONS }, - { "Impress", "General", SID_SI_TP_MISC }, - { "Impress", "View", SID_SI_TP_CONTENTS }, - { "Impress", "Grid", SID_SI_TP_SNAP }, - { "Impress", "Print", SID_SI_TP_PRINT }, - { "Draw", nullptr, SID_SD_GRAPHIC_OPTIONS }, - { "Draw", "General", SID_SD_TP_MISC }, - { "Draw", "View", SID_SD_TP_CONTENTS }, - { "Draw", "Grid", SID_SD_TP_SNAP }, - { "Draw", "Print", SID_SD_TP_PRINT }, - { "Charts", nullptr, SID_SCH_EDITOPTIONS }, - { "Charts", "DefaultColors", RID_OPTPAGE_CHART_DEFCOLORS }, - { "Base", nullptr, SID_SB_STARBASEOPTIONS }, - { "Base", "Connections", SID_SB_CONNECTIONPOOLING }, - { "Base", "Databases", SID_SB_DBREGISTEROPTIONS }, - { nullptr, nullptr, 0 } + { u"ProductName"_ustr, u""_ustr, SID_GENERAL_OPTIONS }, + { u"ProductName"_ustr, u"UserData"_ustr, RID_SFXPAGE_GENERAL }, + { u"ProductName"_ustr, u"General"_ustr, OFA_TP_MISC }, + { u"ProductName"_ustr, u"View"_ustr, OFA_TP_VIEW }, + { u"ProductName"_ustr, u"Print"_ustr, RID_SFXPAGE_PRINTOPTIONS }, + { u"ProductName"_ustr, u"Paths"_ustr, RID_SFXPAGE_PATH }, + { u"ProductName"_ustr, u"Fonts"_ustr, RID_SVX_FONT_SUBSTITUTION }, + { u"ProductName"_ustr, u"Security"_ustr, RID_SVXPAGE_INET_SECURITY }, + { u"ProductName"_ustr, u"Personalization"_ustr, RID_SVXPAGE_PERSONALIZATION }, + { u"ProductName"_ustr, u"Appearance"_ustr, RID_SVXPAGE_COLORCONFIG }, + { u"ProductName"_ustr, u"Accessibility"_ustr, RID_SVXPAGE_ACCESSIBILITYCONFIG }, + { u"ProductName"_ustr, u"Java"_ustr, RID_SVXPAGE_OPTIONS_JAVA }, + { u"ProductName"_ustr, u"BasicIDEOptions"_ustr, RID_SVXPAGE_BASICIDE_OPTIONS }, + { u"ProductName"_ustr, u"OnlineUpdate"_ustr, RID_SVXPAGE_ONLINEUPDATE }, + { u"LanguageSettings"_ustr, u""_ustr, SID_LANGUAGE_OPTIONS }, + { u"LanguageSettings"_ustr, u"Languages"_ustr, OFA_TP_LANGUAGES }, + { u"LanguageSettings"_ustr, u"WritingAids"_ustr, RID_SFXPAGE_LINGU }, + { u"LanguageSettings"_ustr, u"SearchingInJapanese"_ustr, RID_SVXPAGE_JSEARCH_OPTIONS }, + { u"LanguageSettings"_ustr, u"AsianLayout"_ustr, RID_SVXPAGE_ASIAN_LAYOUT }, + { u"LanguageSettings"_ustr, u"ComplexTextLayout"_ustr, RID_SVXPAGE_OPTIONS_CTL }, + { u"Internet"_ustr, u""_ustr, SID_INET_DLG }, + { u"Internet"_ustr, u"Proxy"_ustr, RID_SVXPAGE_INET_PROXY }, + { u"Internet"_ustr, u"Email"_ustr, RID_SVXPAGE_INET_MAIL }, + { u"LoadSave"_ustr, u""_ustr, SID_FILTER_DLG }, + { u"LoadSave"_ustr, u"General"_ustr, RID_SFXPAGE_SAVE }, + { u"LoadSave"_ustr, u"VBAProperties"_ustr, SID_OPTFILTER_MSOFFICE }, + { u"LoadSave"_ustr, u"MicrosoftOffice"_ustr, RID_OFAPAGE_MSFILTEROPT2 }, + { u"LoadSave"_ustr, u"HTMLCompatibility"_ustr, RID_OFAPAGE_HTMLOPT }, + { u"Writer"_ustr, u""_ustr, SID_SW_EDITOPTIONS }, + { u"Writer"_ustr, u"General"_ustr, RID_SW_TP_OPTLOAD_PAGE }, + { u"Writer"_ustr, u"View"_ustr, RID_SW_TP_CONTENT_OPT }, + { u"Writer"_ustr, u"FormattingAids"_ustr, RID_SW_TP_OPTSHDWCRSR }, + { u"Writer"_ustr, u"Grid"_ustr, RID_SVXPAGE_GRID }, + { u"Writer"_ustr, u"BasicFontsWestern"_ustr, RID_SW_TP_STD_FONT }, + { u"Writer"_ustr, u"BasicFontsAsian"_ustr, RID_SW_TP_STD_FONT_CJK }, + { u"Writer"_ustr, u"BasicFontsCTL"_ustr, RID_SW_TP_STD_FONT_CTL }, + { u"Writer"_ustr, u"Print"_ustr, RID_SW_TP_OPTPRINT_PAGE }, + { u"Writer"_ustr, u"Table"_ustr, RID_SW_TP_OPTTABLE_PAGE }, + { u"Writer"_ustr, u"Changes"_ustr, RID_SW_TP_REDLINE_OPT }, + { u"Writer"_ustr, u"Comparison"_ustr, RID_SW_TP_COMPARISON_OPT }, + { u"Writer"_ustr, u"Compatibility"_ustr, RID_SW_TP_OPTCOMPATIBILITY_PAGE }, + { u"Writer"_ustr, u"AutoCaption"_ustr, RID_SW_TP_OPTCAPTION_PAGE }, + { u"Writer"_ustr, u"MailMerge"_ustr, RID_SW_TP_MAILCONFIG }, + { u"WriterWeb"_ustr, u""_ustr, SID_SW_ONLINEOPTIONS }, + { u"WriterWeb"_ustr, u"View"_ustr, RID_SW_TP_HTML_CONTENT_OPT }, + { u"WriterWeb"_ustr, u"FormattingAids"_ustr, RID_SW_TP_HTML_OPTSHDWCRSR }, + { u"WriterWeb"_ustr, u"Grid"_ustr, RID_SW_TP_HTML_OPTGRID_PAGE }, + { u"WriterWeb"_ustr, u"Print"_ustr, RID_SW_TP_HTML_OPTPRINT_PAGE }, + { u"WriterWeb"_ustr, u"Table"_ustr, RID_SW_TP_HTML_OPTTABLE_PAGE }, + { u"WriterWeb"_ustr, u"Background"_ustr, RID_SW_TP_BACKGROUND }, + { u"Math"_ustr, u""_ustr, SID_SM_EDITOPTIONS }, + { u"Math"_ustr, u"Settings"_ustr, SID_SM_TP_PRINTOPTIONS }, + { u"Calc"_ustr, u""_ustr, SID_SC_EDITOPTIONS }, + { u"Calc"_ustr, u"General"_ustr, SID_SC_TP_LAYOUT }, + { u"Calc"_ustr, u"View"_ustr, SID_SC_TP_CONTENT }, + { u"Calc"_ustr, u"Calculate"_ustr, SID_SC_TP_CALC }, + { u"Calc"_ustr, u"Formula"_ustr, SID_SC_TP_FORMULA }, + { u"Calc"_ustr, u"SortLists"_ustr, SID_SC_TP_USERLISTS }, + { u"Calc"_ustr, u"Changes"_ustr, SID_SC_TP_CHANGES }, + { u"Calc"_ustr, u"Compatibility"_ustr, SID_SC_TP_COMPATIBILITY }, + { u"Calc"_ustr, u"Grid"_ustr, SID_SC_TP_GRID }, + { u"Calc"_ustr, u"Print"_ustr, RID_SC_TP_PRINT }, + { u"Impress"_ustr, u""_ustr, SID_SD_EDITOPTIONS }, + { u"Impress"_ustr, u"General"_ustr, SID_SI_TP_MISC }, + { u"Impress"_ustr, u"View"_ustr, SID_SI_TP_CONTENTS }, + { u"Impress"_ustr, u"Grid"_ustr, SID_SI_TP_SNAP }, + { u"Impress"_ustr, u"Print"_ustr, SID_SI_TP_PRINT }, + { u"Draw"_ustr, u""_ustr, SID_SD_GRAPHIC_OPTIONS }, + { u"Draw"_ustr, u"General"_ustr, SID_SD_TP_MISC }, + { u"Draw"_ustr, u"View"_ustr, SID_SD_TP_CONTENTS }, + { u"Draw"_ustr, u"Grid"_ustr, SID_SD_TP_SNAP }, + { u"Draw"_ustr, u"Print"_ustr, SID_SD_TP_PRINT }, + { u"Charts"_ustr, u""_ustr, SID_SCH_EDITOPTIONS }, + { u"Charts"_ustr, u"DefaultColors"_ustr, RID_OPTPAGE_CHART_DEFCOLORS }, + { u"Base"_ustr, u""_ustr, SID_SB_STARBASEOPTIONS }, + { u"Base"_ustr, u"Connections"_ustr, SID_SB_CONNECTIONPOOLING }, + { u"Base"_ustr, u"Databases"_ustr, SID_SB_DBREGISTEROPTIONS }, }; static bool lcl_getStringFromID( sal_uInt16 _nPageId, OUString& _rGroupName, OUString& _rPageName ) { bool bRet = false; - sal_uInt16 nIdx = 0; - while ( OptionsMap_Impl[nIdx].m_pGroupName != nullptr ) + for (const auto & rMapping : OptionsMap_Impl ) { - if ( _nPageId == OptionsMap_Impl[nIdx].m_nPageId ) + if ( _nPageId == rMapping.m_nPageId ) { bRet = true; - _rGroupName = OUString::createFromAscii( OptionsMap_Impl[nIdx].m_pGroupName ); - if ( OptionsMap_Impl[nIdx].m_pPageName != nullptr ) - _rPageName = OUString::createFromAscii( OptionsMap_Impl[nIdx].m_pPageName ); + _rGroupName = rMapping.m_aGroupName; + if ( !rMapping.m_aPageName.isEmpty() ) + _rPageName = rMapping.m_aPageName; break; } - ++nIdx; } return bRet; commit f7d4029e6f0551a9b425839cde03445c0967aac0 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue May 7 13:54:49 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri May 10 18:42:13 2024 +0200 replace createFromAscii with OUString literals in SvxMacroAssignDlg Change-Id: I360d1dc46909f904ac9f984b2f06bb80f4a72c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167472 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx index b78aabf6ed62..1dc004c33b57 100644 --- a/cui/source/customize/eventdlg.cxx +++ b/cui/source/customize/eventdlg.cxx @@ -50,8 +50,6 @@ SvxEventConfigPage::SvxEventConfigPage(weld::Container* pPage, weld::DialogContr mpImpl->xEventLB->set_size_request(mpImpl->xEventLB->get_approximate_digit_width() * 70, mpImpl->xEventLB->get_height_rows(20)); - InitResources(); - m_xSaveInListBox->connect_changed( LINK( this, SvxEventConfigPage, SelectHdl_Impl ) ); diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index a352ea4b97dc..b042ffb71668 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -87,87 +87,93 @@ SvxMacroTabPage_::~SvxMacroTabPage_() mpImpl.reset(); } -void SvxMacroTabPage_::InitResources() +namespace { +struct EventDisplayName { - // Note: the order here controls the order in which the events are displayed in the UI! - - // the event name to UI string mappings for App Events - aDisplayNames.emplace_back( "OnStartApp", RID_CUISTR_EVENT_STARTAPP ); - aDisplayNames.emplace_back( "OnCloseApp", RID_CUISTR_EVENT_CLOSEAPP ); - aDisplayNames.emplace_back( "OnCreate", RID_CUISTR_EVENT_CREATEDOC ); - aDisplayNames.emplace_back( "OnNew", RID_CUISTR_EVENT_NEWDOC ); - aDisplayNames.emplace_back( "OnLoadFinished", RID_CUISTR_EVENT_LOADDOCFINISHED ); - aDisplayNames.emplace_back( "OnLoad", RID_CUISTR_EVENT_OPENDOC ); - aDisplayNames.emplace_back( "OnPrepareUnload", RID_CUISTR_EVENT_PREPARECLOSEDOC ); - aDisplayNames.emplace_back( "OnUnload", RID_CUISTR_EVENT_CLOSEDOC ) ; - aDisplayNames.emplace_back( "OnViewCreated", RID_CUISTR_EVENT_VIEWCREATED ); - aDisplayNames.emplace_back( "OnPrepareViewClosing", RID_CUISTR_EVENT_PREPARECLOSEVIEW ); - aDisplayNames.emplace_back( "OnViewClosed", RID_CUISTR_EVENT_CLOSEVIEW ) ; - aDisplayNames.emplace_back( "OnFocus", RID_CUISTR_EVENT_ACTIVATEDOC ); - aDisplayNames.emplace_back( "OnUnfocus", RID_CUISTR_EVENT_DEACTIVATEDOC ); - aDisplayNames.emplace_back( "OnSave", RID_CUISTR_EVENT_SAVEDOC ); - aDisplayNames.emplace_back( "OnSaveDone", RID_CUISTR_EVENT_SAVEDOCDONE ); - aDisplayNames.emplace_back( "OnSaveFailed", RID_CUISTR_EVENT_SAVEDOCFAILED ); - aDisplayNames.emplace_back( "OnSaveAs", RID_CUISTR_EVENT_SAVEASDOC ); - aDisplayNames.emplace_back( "OnSaveAsDone", RID_CUISTR_EVENT_SAVEASDOCDONE ); - aDisplayNames.emplace_back( "OnSaveAsFailed", RID_CUISTR_EVENT_SAVEASDOCFAILED ); - aDisplayNames.emplace_back( "OnCopyTo", RID_CUISTR_EVENT_COPYTODOC ); - aDisplayNames.emplace_back( "OnCopyToDone", RID_CUISTR_EVENT_COPYTODOCDONE ); - aDisplayNames.emplace_back( "OnCopyToFailed", RID_CUISTR_EVENT_COPYTODOCFAILED ); - aDisplayNames.emplace_back( "OnPrint", RID_CUISTR_EVENT_PRINTDOC ); - aDisplayNames.emplace_back( "OnModifyChanged", RID_CUISTR_EVENT_MODIFYCHANGED ); - aDisplayNames.emplace_back( "OnTitleChanged", RID_CUISTR_EVENT_TITLECHANGED ); + OUString aAsciiEventName; + TranslateId pEventResourceID; +}; +} + +// Note: the order here controls the order in which the events are displayed in the UI! +// the event name to UI string mappings for App Events +constexpr EventDisplayName gDisplayNames[] { + { u"OnStartApp"_ustr, RID_CUISTR_EVENT_STARTAPP }, + { u"OnCloseApp"_ustr, RID_CUISTR_EVENT_CLOSEAPP }, + { u"OnCreate"_ustr, RID_CUISTR_EVENT_CREATEDOC }, + { u"OnNew"_ustr, RID_CUISTR_EVENT_NEWDOC }, + { u"OnLoadFinished"_ustr, RID_CUISTR_EVENT_LOADDOCFINISHED }, + { u"OnLoad"_ustr, RID_CUISTR_EVENT_OPENDOC }, + { u"OnPrepareUnload"_ustr, RID_CUISTR_EVENT_PREPARECLOSEDOC }, + { u"OnUnload"_ustr, RID_CUISTR_EVENT_CLOSEDOC }, + { u"OnViewCreated"_ustr, RID_CUISTR_EVENT_VIEWCREATED }, + { u"OnPrepareViewClosing"_ustr, RID_CUISTR_EVENT_PREPARECLOSEVIEW }, + { u"OnViewClosed"_ustr, RID_CUISTR_EVENT_CLOSEVIEW }, + { u"OnFocus"_ustr, RID_CUISTR_EVENT_ACTIVATEDOC }, + { u"OnUnfocus"_ustr, RID_CUISTR_EVENT_DEACTIVATEDOC }, + { u"OnSave"_ustr, RID_CUISTR_EVENT_SAVEDOC }, + { u"OnSaveDone"_ustr, RID_CUISTR_EVENT_SAVEDOCDONE }, + { u"OnSaveFailed"_ustr, RID_CUISTR_EVENT_SAVEDOCFAILED }, + { u"OnSaveAs"_ustr, RID_CUISTR_EVENT_SAVEASDOC }, + { u"OnSaveAsDone"_ustr, RID_CUISTR_EVENT_SAVEASDOCDONE }, + { u"OnSaveAsFailed"_ustr, RID_CUISTR_EVENT_SAVEASDOCFAILED }, + { u"OnCopyTo"_ustr, RID_CUISTR_EVENT_COPYTODOC }, + { u"OnCopyToDone"_ustr, RID_CUISTR_EVENT_COPYTODOCDONE }, + { u"OnCopyToFailed"_ustr, RID_CUISTR_EVENT_COPYTODOCFAILED }, + { u"OnPrint"_ustr, RID_CUISTR_EVENT_PRINTDOC }, + { u"OnModifyChanged"_ustr, RID_CUISTR_EVENT_MODIFYCHANGED }, + { u"OnTitleChanged"_ustr, RID_CUISTR_EVENT_TITLECHANGED }, // application specific events - aDisplayNames.emplace_back( "OnMailMerge", RID_CUISTR_EVENT_MAILMERGE ); - aDisplayNames.emplace_back( "OnMailMergeFinished", RID_CUISTR_EVENT_MAILMERGE_END ); - aDisplayNames.emplace_back( "OnFieldMerge", RID_CUISTR_EVENT_FIELDMERGE ); - aDisplayNames.emplace_back( "OnFieldMergeFinished", RID_CUISTR_EVENT_FIELDMERGE_FINISHED ); - aDisplayNames.emplace_back( "OnPageCountChange", RID_CUISTR_EVENT_PAGECOUNTCHANGE ); - aDisplayNames.emplace_back( "OnSubComponentOpened", RID_CUISTR_EVENT_SUBCOMPONENT_OPENED ); - aDisplayNames.emplace_back( "OnSubComponentClosed", RID_CUISTR_EVENT_SUBCOMPONENT_CLOSED ); - aDisplayNames.emplace_back( "OnSelect", RID_CUISTR_EVENT_SELECTIONCHANGED ); - aDisplayNames.emplace_back( "OnDoubleClick", RID_CUISTR_EVENT_DOUBLECLICK ); - aDisplayNames.emplace_back( "OnRightClick", RID_CUISTR_EVENT_RIGHTCLICK ); - aDisplayNames.emplace_back( "OnCalculate", RID_CUISTR_EVENT_CALCULATE ); - aDisplayNames.emplace_back( "OnChange", RID_CUISTR_EVENT_CONTENTCHANGED ); + { u"OnMailMerge"_ustr, RID_CUISTR_EVENT_MAILMERGE }, + { u"OnMailMergeFinished"_ustr, RID_CUISTR_EVENT_MAILMERGE_END }, + { u"OnFieldMerge"_ustr, RID_CUISTR_EVENT_FIELDMERGE }, + { u"OnFieldMergeFinished"_ustr, RID_CUISTR_EVENT_FIELDMERGE_FINISHED }, + { u"OnPageCountChange"_ustr, RID_CUISTR_EVENT_PAGECOUNTCHANGE }, + { u"OnSubComponentOpened"_ustr, RID_CUISTR_EVENT_SUBCOMPONENT_OPENED }, + { u"OnSubComponentClosed"_ustr, RID_CUISTR_EVENT_SUBCOMPONENT_CLOSED }, + { u"OnSelect"_ustr, RID_CUISTR_EVENT_SELECTIONCHANGED }, + { u"OnDoubleClick"_ustr, RID_CUISTR_EVENT_DOUBLECLICK }, + { u"OnRightClick"_ustr, RID_CUISTR_EVENT_RIGHTCLICK }, + { u"OnCalculate"_ustr, RID_CUISTR_EVENT_CALCULATE }, + { u"OnChange"_ustr, RID_CUISTR_EVENT_CONTENTCHANGED }, // the event name to UI string mappings for forms & dialogs - aDisplayNames.emplace_back( "approveAction", RID_CUISTR_EVENT_APPROVEACTIONPERFORMED ); - aDisplayNames.emplace_back( "actionPerformed", RID_CUISTR_EVENT_ACTIONPERFORMED ); - aDisplayNames.emplace_back( "changed", RID_CUISTR_EVENT_CHANGED ); - aDisplayNames.emplace_back( "textChanged", RID_CUISTR_EVENT_TEXTCHANGED ); - aDisplayNames.emplace_back( "itemStateChanged", RID_CUISTR_EVENT_ITEMSTATECHANGED ); - aDisplayNames.emplace_back( "focusGained", RID_CUISTR_EVENT_FOCUSGAINED ); - aDisplayNames.emplace_back( "focusLost", RID_CUISTR_EVENT_FOCUSLOST ); - aDisplayNames.emplace_back( "keyPressed", RID_CUISTR_EVENT_KEYTYPED ); - aDisplayNames.emplace_back( "keyReleased", RID_CUISTR_EVENT_KEYUP ); - aDisplayNames.emplace_back( "mouseEntered", RID_CUISTR_EVENT_MOUSEENTERED ); - aDisplayNames.emplace_back( "mouseDragged", RID_CUISTR_EVENT_MOUSEDRAGGED ); - aDisplayNames.emplace_back( "mouseMoved", RID_CUISTR_EVENT_MOUSEMOVED ); - aDisplayNames.emplace_back( "mousePressed", RID_CUISTR_EVENT_MOUSEPRESSED ); - aDisplayNames.emplace_back( "mouseReleased", RID_CUISTR_EVENT_MOUSERELEASED ); - aDisplayNames.emplace_back( "mouseExited", RID_CUISTR_EVENT_MOUSEEXITED ); - aDisplayNames.emplace_back( "approveReset", RID_CUISTR_EVENT_APPROVERESETTED ); - aDisplayNames.emplace_back( "resetted", RID_CUISTR_EVENT_RESETTED ); - aDisplayNames.emplace_back( "approveSubmit", RID_CUISTR_EVENT_SUBMITTED ); - aDisplayNames.emplace_back( "approveUpdate", RID_CUISTR_EVENT_BEFOREUPDATE ); - aDisplayNames.emplace_back( "updated", RID_CUISTR_EVENT_AFTERUPDATE ); - aDisplayNames.emplace_back( "loaded", RID_CUISTR_EVENT_LOADED ); - aDisplayNames.emplace_back( "reloading", RID_CUISTR_EVENT_RELOADING ); - aDisplayNames.emplace_back( "reloaded", RID_CUISTR_EVENT_RELOADED ); - aDisplayNames.emplace_back( "unloading", RID_CUISTR_EVENT_UNLOADING ); - aDisplayNames.emplace_back( "unloaded", RID_CUISTR_EVENT_UNLOADED ); - aDisplayNames.emplace_back( "confirmDelete", RID_CUISTR_EVENT_CONFIRMDELETE ); - aDisplayNames.emplace_back( "approveRowChange", RID_CUISTR_EVENT_APPROVEROWCHANGE ); - aDisplayNames.emplace_back( "rowChanged", RID_CUISTR_EVENT_ROWCHANGE ); - aDisplayNames.emplace_back( "approveCursorMove", RID_CUISTR_EVENT_POSITIONING ); - aDisplayNames.emplace_back( "cursorMoved", RID_CUISTR_EVENT_POSITIONED ); - aDisplayNames.emplace_back( "approveParameter", RID_CUISTR_EVENT_APPROVEPARAMETER ); - aDisplayNames.emplace_back( "errorOccured", RID_CUISTR_EVENT_ERROROCCURRED ); - aDisplayNames.emplace_back( "adjustmentValueChanged", RID_CUISTR_EVENT_ADJUSTMENTVALUECHANGED ); -} + { u"approveAction"_ustr, RID_CUISTR_EVENT_APPROVEACTIONPERFORMED }, + { u"actionPerformed"_ustr, RID_CUISTR_EVENT_ACTIONPERFORMED }, + { u"changed"_ustr, RID_CUISTR_EVENT_CHANGED }, + { u"textChanged"_ustr, RID_CUISTR_EVENT_TEXTCHANGED }, + { u"itemStateChanged"_ustr, RID_CUISTR_EVENT_ITEMSTATECHANGED }, + { u"focusGained"_ustr, RID_CUISTR_EVENT_FOCUSGAINED }, + { u"focusLost"_ustr, RID_CUISTR_EVENT_FOCUSLOST }, + { u"keyPressed"_ustr, RID_CUISTR_EVENT_KEYTYPED }, + { u"keyReleased"_ustr, RID_CUISTR_EVENT_KEYUP }, + { u"mouseEntered"_ustr, RID_CUISTR_EVENT_MOUSEENTERED }, + { u"mouseDragged"_ustr, RID_CUISTR_EVENT_MOUSEDRAGGED }, + { u"mouseMoved"_ustr, RID_CUISTR_EVENT_MOUSEMOVED }, + { u"mousePressed"_ustr, RID_CUISTR_EVENT_MOUSEPRESSED }, + { u"mouseReleased"_ustr, RID_CUISTR_EVENT_MOUSERELEASED }, + { u"mouseExited"_ustr, RID_CUISTR_EVENT_MOUSEEXITED }, + { u"approveReset"_ustr, RID_CUISTR_EVENT_APPROVERESETTED }, + { u"resetted"_ustr, RID_CUISTR_EVENT_RESETTED }, + { u"approveSubmit"_ustr, RID_CUISTR_EVENT_SUBMITTED }, + { u"approveUpdate"_ustr, RID_CUISTR_EVENT_BEFOREUPDATE }, + { u"updated"_ustr, RID_CUISTR_EVENT_AFTERUPDATE }, + { u"loaded"_ustr, RID_CUISTR_EVENT_LOADED }, + { u"reloading"_ustr, RID_CUISTR_EVENT_RELOADING }, + { u"reloaded"_ustr, RID_CUISTR_EVENT_RELOADED }, + { u"unloading"_ustr, RID_CUISTR_EVENT_UNLOADING }, + { u"unloaded"_ustr, RID_CUISTR_EVENT_UNLOADED }, + { u"confirmDelete"_ustr, RID_CUISTR_EVENT_CONFIRMDELETE }, + { u"approveRowChange"_ustr, RID_CUISTR_EVENT_APPROVEROWCHANGE }, + { u"rowChanged"_ustr, RID_CUISTR_EVENT_ROWCHANGE }, + { u"approveCursorMove"_ustr, RID_CUISTR_EVENT_POSITIONING }, + { u"cursorMoved"_ustr, RID_CUISTR_EVENT_POSITIONED }, + { u"approveParameter"_ustr, RID_CUISTR_EVENT_APPROVEPARAMETER }, + { u"errorOccured"_ustr, RID_CUISTR_EVENT_ERROROCCURRED }, + { u"adjustmentValueChanged"_ustr, RID_CUISTR_EVENT_ADJUSTMENTVALUECHANGED }, +}; // the following method is called when the user clicks OK // We use the contents of the hashes to replace the settings @@ -328,9 +334,9 @@ void SvxMacroTabPage_::DisplayAppEvents( bool appEvents) return; } - for (auto const& displayableEvent : aDisplayNames) + for (auto const& displayableEvent : gDisplayNames) { - OUString sEventName( OUString::createFromAscii( displayableEvent.pAsciiEventName ) ); + const OUString & sEventName( displayableEvent.aAsciiEventName ); if ( !nameReplace->hasByName( sEventName ) ) continue; @@ -654,8 +660,6 @@ SvxMacroTabPage::SvxMacroTabPage(weld::Container* pPage, weld::DialogController* mpImpl->xAssignComponentPB->set_sensitive(false); } - InitResources(); - InitAndSetHandler( xNameReplace, Reference< container::XNameReplace>(nullptr), Reference< util::XModifiable >(nullptr)); DisplayAppEvents(true); mpImpl->xEventLB->select(nSelectedIndex); diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx index 2f2471bb09eb..1d9f2230f048 100644 --- a/cui/source/inc/macropg.hxx +++ b/cui/source/inc/macropg.hxx @@ -33,20 +33,8 @@ typedef std::pair<OUString, OUString> EventPair; typedef std::unordered_map<OUString, EventPair> EventsHash; -struct EventDisplayName -{ - const char* pAsciiEventName; - TranslateId pEventResourceID; - EventDisplayName(const char* pAsciiName, TranslateId pResId) - : pAsciiEventName(pAsciiName) - , pEventResourceID(pResId) - { - } -}; - class SvxMacroTabPage_; class SvTabListBox; - class SvxMacroTabPage_Impl; @@ -69,7 +57,6 @@ protected: EventsHash m_docEventsHash; int m_nAssignedEvents; bool bDocModified, bAppEvents, bInitialized; - std::vector< EventDisplayName > aDisplayNames; SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet& rItemSet); @@ -80,7 +67,6 @@ protected: public: virtual ~SvxMacroTabPage_() override; - void InitResources(); void InitAndSetHandler( const css::uno::Reference< css::container::XNameReplace >& xAppEvents, const css::uno::Reference< css::container::XNameReplace >& xDocEvents, const css::uno::Reference< css::util::XModifiable >& xModifiable ); virtual bool FillItemSet( SfxItemSet* rSet ) override;