diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-19 13:18:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-05 09:39:11 +0200 |
commit | 14cfff500e93f0d6cbf8412065feea85c01ea81d (patch) | |
tree | 76e3fb8fbf2b0d8a12c8406d8cf994ea6a37aaff /sd | |
parent | d924ce30e0ca260682bd2aed192b8b1b2ca3e7c0 (diff) |
Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and
joining of strings like this.
Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
25 files changed, 71 insertions, 67 deletions
diff --git a/sd/inc/DocumentRenderer.hrc b/sd/inc/DocumentRenderer.hrc index 3cdd5b004f55..755fa5a66bbb 100644 --- a/sd/inc/DocumentRenderer.hrc +++ b/sd/inc/DocumentRenderer.hrc @@ -19,9 +19,11 @@ #pragma once -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#include <unotools/resmgr.hxx> -const char* STR_IMPRESS_PRINT_UI_CONTENT_CHOICES[] = +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) + +const TranslateId STR_IMPRESS_PRINT_UI_CONTENT_CHOICES[] = { NC_("STR_IMPRESS_PRINT_UI_CONTENT_CHOICES", "Slides"), NC_("STR_IMPRESS_PRINT_UI_CONTENT_CHOICES", "Handouts"), @@ -29,7 +31,7 @@ const char* STR_IMPRESS_PRINT_UI_CONTENT_CHOICES[] = NC_("STR_IMPRESS_PRINT_UI_CONTENT_CHOICES", "Outline") }; -const char* STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES[] = +const TranslateId STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES[] = { NC_("STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES", "According to layout"), NC_("STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES", "1"), @@ -40,20 +42,20 @@ const char* STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES[] = NC_("STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES", "9") }; -const char* STR_IMPRESS_PRINT_UI_ORDER_CHOICES[] = +const TranslateId STR_IMPRESS_PRINT_UI_ORDER_CHOICES[] = { NC_("STR_IMPRESS_PRINT_UI_ORDER_CHOICES", "Left to right, then down"), NC_("STR_IMPRESS_PRINT_UI_ORDER_CHOICES", "Top to bottom, then right") }; -const char* STR_IMPRESS_PRINT_UI_QUALITY_CHOICES[] = +const TranslateId STR_IMPRESS_PRINT_UI_QUALITY_CHOICES[] = { NC_("STR_IMPRESS_PRINT_UI_QUALITY_CHOICES", "Original colors"), NC_("STR_IMPRESS_PRINT_UI_QUALITY_CHOICES", "Grayscale"), NC_("STR_IMPRESS_PRINT_UI_QUALITY_CHOICES", "Black & white") }; -const char* STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES[] = +const TranslateId STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES[] = { NC_("STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES", "Original size"), NC_("STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES", "Fit to printable page"), @@ -61,7 +63,7 @@ const char* STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES[] = NC_("STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES", "Tile sheet of paper with repeated slides") }; -const char* STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW[] = +const TranslateId STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW[] = { NC_("STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW", "Original size"), NC_("STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW", "Fit to printable page"), @@ -69,21 +71,21 @@ const char* STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW[] = NC_("STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW", "Tile sheet of paper with repeated pages") }; -const char* STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST[] = +const TranslateId STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST[] = { NC_("STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST", "All pages"), NC_("STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST", "Front sides / right pages"), NC_("STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST", "Back sides / left pages") }; -const char* STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE[] = +const TranslateId STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE[] = { NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "All ~Slides"), NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "S~lides:"), NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "~Selection") }; -const char* STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE[] = +const TranslateId STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE[] = { NC_("STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE", "All ~Pages"), NC_("STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE", "~Pages:"), diff --git a/sd/inc/errhdl.hrc b/sd/inc/errhdl.hrc index affe12ac4331..ea7d4e7127d7 100644 --- a/sd/inc/errhdl.hrc +++ b/sd/inc/errhdl.hrc @@ -19,7 +19,7 @@ #pragma once -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) #include <svtools/ehdl.hxx> #include <vcl/errcode.hxx> @@ -33,7 +33,7 @@ const ErrMsgCode RID_SD_ERRHDL[] = ERR_FORMAT_FILE_ROWCOL }, { NC_("RID_SD_ERRHDL", "Format error discovered in the file in sub-document $(ARG1) at position $(ARG2)(row,col)."), WARN_FORMAT_FILE_ROWCOL }, - { nullptr, ERRCODE_NONE } + { {}, ERRCODE_NONE } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/inc/family.hrc b/sd/inc/family.hrc index 28a1d4429b81..dcfd31e17d46 100644 --- a/sd/inc/family.hrc +++ b/sd/inc/family.hrc @@ -21,22 +21,22 @@ #include <svl/style.hxx> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const std::pair<const char*, SfxStyleSearchBits> RID_GRAPHICSTYLEFAMILY[] = +const std::pair<TranslateId, SfxStyleSearchBits> RID_GRAPHICSTYLEFAMILY[] = { { NC_("RID_GRAPHICSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, { NC_("RID_GRAPHICSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, { NC_("RID_GRAPHICSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, { NC_("RID_GRAPHICSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, - { nullptr, SfxStyleSearchBits::Auto } + { {}, SfxStyleSearchBits::Auto } }; -const std::pair<const char*, SfxStyleSearchBits> RID_PRESENTATIONSTYLEFAMILY[] = +const std::pair<TranslateId, SfxStyleSearchBits> RID_PRESENTATIONSTYLEFAMILY[] = { { NC_("RID_PRESENTATIONSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, { NC_("RID_PRESENTATIONSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, - { nullptr, SfxStyleSearchBits::Auto } + { {}, SfxStyleSearchBits::Auto } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/inc/pageformatpanel.hrc b/sd/inc/pageformatpanel.hrc index 3eb2f5763ae2..bf29cc9b4602 100644 --- a/sd/inc/pageformatpanel.hrc +++ b/sd/inc/pageformatpanel.hrc @@ -11,13 +11,13 @@ #include <utility> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) namespace sd { // To translators: this is a listbox labelled by "Margins:", inch units -const std::pair<const char*, int> RID_PAGEFORMATPANEL_MARGINS_INCH[] = +const std::pair<TranslateId, int> RID_PAGEFORMATPANEL_MARGINS_INCH[] = { { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "None"), 0 }, { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Narrow"), 0 }, @@ -32,7 +32,7 @@ const std::pair<const char*, int> RID_PAGEFORMATPANEL_MARGINS_INCH[] = }; // To translators: this is a listbox labelled by "Margins:", cm units -const std::pair<const char*, int> RID_PAGEFORMATPANEL_MARGINS_CM[] = +const std::pair<TranslateId, int> RID_PAGEFORMATPANEL_MARGINS_CM[] = { { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "None"), 0 }, { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Narrow"), 0 }, diff --git a/sd/inc/sdresid.hxx b/sd/inc/sdresid.hxx index 768b9a14998d..2ed8cd42cf20 100644 --- a/sd/inc/sdresid.hxx +++ b/sd/inc/sdresid.hxx @@ -21,8 +21,9 @@ #include <rtl/ustring.hxx> #include "sddllapi.h" +#include <unotools/resmgr.hxx> -SD_DLLPUBLIC OUString SdResId(std::string_view aId); -SD_DLLPUBLIC OUString SdResId(std::string_view aId, int nCardinality); +SD_DLLPUBLIC OUString SdResId(TranslateId aId); +SD_DLLPUBLIC OUString SdResId(TranslateNId aContextSingularPlural, int nCardinality); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc index d55bf8824568..e1f9f0706930 100644 --- a/sd/inc/strings.hrc +++ b/sd/inc/strings.hrc @@ -19,8 +19,8 @@ #pragma once -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) -#define NNC_(Context, StringSingular, StringPlural) reinterpret_cast<char const *>(Context "\004" u8##StringSingular "\004" u8##StringPlural) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) +#define NNC_(Context, StringSingular, StringPlural) TranslateNId(Context, reinterpret_cast<char const *>(u8##StringSingular), reinterpret_cast<char const *>(u8##StringPlural)) #define STR_NULL NC_("STR_NULL", "None") #define STR_INSERTPAGE NC_("STR_INSERTPAGE", "Insert Slide") diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index d15aaf632b04..503bb3f184b5 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -929,7 +929,7 @@ void SdStyleSheetPool::UpdateStdNames() SfxStyleFamily eFam = pStyle->GetFamily(); bool bHelpKnown = true; - const char* pNameId = nullptr; + TranslateId pNameId; switch( nHelpId ) { case HID_STANDARD_STYLESHEET_NAME: pNameId = STR_STANDARD_STYLESHEET_NAME; break; @@ -989,7 +989,7 @@ void SdStyleSheetPool::UpdateStdNames() OUString aNewName; if (pNameId) { - if (strcmp(pNameId, STR_PSEUDOSHEET_OUTLINE) == 0) + if (pNameId == STR_PSEUDOSHEET_OUTLINE) { aNewName += " " + OUString::number( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE ) ); } diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index ebceaee3b10a..edf39df51513 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -110,7 +110,7 @@ void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, ErrCode nStrea return; } - const char* pId; + TranslateId pId; if( nFilterError == ERRCODE_GRFILTER_OPENERROR ) pId = STR_IMPORT_GRFILTER_OPENERROR; @@ -123,11 +123,11 @@ void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, ErrCode nStrea else if( nFilterError == ERRCODE_GRFILTER_TOOBIG ) pId = STR_IMPORT_GRFILTER_TOOBIG; else if( nFilterError == ERRCODE_NONE ) - pId = nullptr; + ; else pId = STR_IMPORT_GRFILTER_FILTERERROR; - if (pId && strcmp(pId, STR_IMPORT_GRFILTER_IOERROR) == 0) + if (pId && pId == STR_IMPORT_GRFILTER_IOERROR) ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); else { diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index a0836ce8758b..9f6b80f1f4bf 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -3164,7 +3164,6 @@ void EasyFile::close() // This class helps reporting errors during file i/o HtmlErrorContext::HtmlErrorContext() : ErrorContext(nullptr) - , mpResId(nullptr) { } @@ -3182,14 +3181,14 @@ bool HtmlErrorContext::GetString( ErrCode, OUString& rCtxStr ) return true; } -void HtmlErrorContext::SetContext(const char* pResId, const OUString& rURL) +void HtmlErrorContext::SetContext(TranslateId pResId, const OUString& rURL) { mpResId = pResId; maURL1 = rURL; maURL2.clear(); } -void HtmlErrorContext::SetContext(const char* pResId, const OUString& rURL1, const OUString& rURL2 ) +void HtmlErrorContext::SetContext(TranslateId pResId, const OUString& rURL1, const OUString& rURL2 ) { mpResId = pResId; maURL1 = rURL1; diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx index aeef943cb8f6..5f6f06e49b27 100644 --- a/sd/source/filter/html/htmlex.hxx +++ b/sd/source/filter/html/htmlex.hxx @@ -24,6 +24,7 @@ #include <tools/color.hxx> #include <tools/solar.h> #include <vcl/errinf.hxx> +#include <unotools/resmgr.hxx> #include "htmlpublishmode.hxx" @@ -63,7 +64,7 @@ class ButtonSet; class HtmlErrorContext : public ErrorContext { private: - const char* mpResId; + TranslateId mpResId; OUString maURL1; OUString maURL2; @@ -72,8 +73,8 @@ public: virtual bool GetString( ErrCode nErrId, OUString& rCtxStr ) override; - void SetContext(const char* pResId, const OUString& rURL); - void SetContext(const char* pResId, const OUString& rURL1, const OUString& rURL2); + void SetContext(TranslateId pResId, const OUString& rURL); + void SetContext(TranslateId pResId, const OUString& rURL1, const OUString& rURL2); }; /// this class exports an Impress Document as a HTML Presentation. diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 6da902023f3c..ca1fe2d84f24 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -826,7 +826,7 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForward) // The question text depends on the search direction. bool bImpress = mpDoc->GetDocumentType() == DocumentType::Impress; - const char* pStringId; + TranslateId pStringId; if(bForward) pStringId = bImpress ? STR_ANNOTATION_WRAP_FORWARD : STR_ANNOTATION_WRAP_FORWARD_DRAW; else diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index 4d99ce7aacf3..73b01b282e32 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -80,14 +80,14 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) mpVirtualRefDevice->SetReferenceDevice ( VirtualDevice::RefDevMode::Dpi600 ); } -OUString SdResId(std::string_view aId) +OUString SdResId(TranslateId aId) { return Translate::get(aId, SD_MOD()->GetResLocale()); } -OUString SdResId(std::string_view aId, int nCardinality) +OUString SdResId(TranslateNId aContextSingularPlural, int nCardinality) { - return Translate::nget(aId, nCardinality, SD_MOD()->GetResLocale()); + return Translate::nget(aContextSingularPlural, nCardinality, SD_MOD()->GetResLocale()); } // Dtor diff --git a/sd/source/ui/controller/displaymodecontroller.cxx b/sd/source/ui/controller/displaymodecontroller.cxx index 8dc1a743897b..4d794d8bcfdc 100644 --- a/sd/source/ui/controller/displaymodecontroller.cxx +++ b/sd/source/ui/controller/displaymodecontroller.cxx @@ -74,7 +74,7 @@ struct snewfoil_value_info { sal_uInt16 mnId; const char* msBmpResId; - const char* mpStrResId; + TranslateId mpStrResId; const char* msUnoCommand; }; @@ -98,7 +98,7 @@ const snewfoil_value_info editmodes[] = BMP_DISPLAYMODE_SLIDE_SORTER, STR_SLIDE_SORTER_MODE, ".uno:DiaMode" }, - {0, "", nullptr, "" } + {0, "", {}, "" } }; const snewfoil_value_info mastermodes[] = @@ -115,7 +115,7 @@ const snewfoil_value_info mastermodes[] = BMP_DISPLAYMODE_HANDOUT_MASTER, STR_HANDOUT_MASTER_MODE, ".uno:HandoutMode" }, - {0, "", nullptr, "" } + {0, "", {}, "" } }; diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index 41ab38cad0b1..26c0d5bebcb2 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -79,7 +79,7 @@ private: struct snewfoil_value_info_layout { const char* msBmpResId; - const char* mpStrResId; + TranslateId mpStrResId; AutoLayout maAutoLayout; }; @@ -88,7 +88,7 @@ struct snewfoil_value_info_layout const snewfoil_value_info_layout notes[] = { {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, AUTOLAYOUT_NOTES}, - {nullptr, nullptr, AUTOLAYOUT_NONE}, + {nullptr, {}, AUTOLAYOUT_NONE}, }; const snewfoil_value_info_layout handout[] = @@ -99,7 +99,7 @@ const snewfoil_value_info_layout handout[] = {BMP_FOILH_04, STR_AUTOLAYOUT_HANDOUT4, AUTOLAYOUT_HANDOUT4}, {BMP_FOILH_06, STR_AUTOLAYOUT_HANDOUT6, AUTOLAYOUT_HANDOUT6}, {BMP_FOILH_09, STR_AUTOLAYOUT_HANDOUT9, AUTOLAYOUT_HANDOUT9}, - {nullptr, nullptr, AUTOLAYOUT_NONE}, + {nullptr, {}, AUTOLAYOUT_NONE}, }; const snewfoil_value_info_layout standard[] = @@ -116,7 +116,7 @@ const snewfoil_value_info_layout standard[] = {BMP_LAYOUT_HEAD02B, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT }, {BMP_LAYOUT_HEAD04, STR_AUTOLAYOUT_4CONTENT, AUTOLAYOUT_TITLE_4CONTENT }, {BMP_LAYOUT_HEAD06, STR_AUTOLAYOUT_6CONTENT, AUTOLAYOUT_TITLE_6CONTENT }, - {nullptr, nullptr, AUTOLAYOUT_NONE} + {nullptr, {}, AUTOLAYOUT_NONE} }; const snewfoil_value_info_layout v_standard[] = @@ -126,7 +126,7 @@ const snewfoil_value_info_layout v_standard[] = {BMP_LAYOUT_VERTICAL01, STR_AL_VERT_TITLE_VERT_OUTLINE, AUTOLAYOUT_VTITLE_VCONTENT }, {BMP_LAYOUT_HEAD02, STR_AL_TITLE_VERT_OUTLINE, AUTOLAYOUT_TITLE_VCONTENT }, {BMP_LAYOUT_HEAD02A, STR_AL_TITLE_VERT_OUTLINE_CLIPART, AUTOLAYOUT_TITLE_2VTEXT }, - {nullptr, nullptr, AUTOLAYOUT_NONE} + {nullptr, {}, AUTOLAYOUT_NONE} }; static void fillLayoutValueSet( ValueSet* pValue, const snewfoil_value_info_layout* pInfo ) diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index a40acd367d6c..7f73e005b4c5 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -40,7 +40,7 @@ PaneChildWindow::PaneChildWindow ( sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo, - const char* pTitleBarResId) + TranslateId pTitleBarResId) : SfxChildWindow (pParentWindow, nId) { SetWindow( VclPtr<PaneDockingWindow>::Create( diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 4cd0cf68af9d..46611d147eb6 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -232,7 +232,7 @@ void SdTPAction::Construct() // fill Action-Listbox for (const presentation::ClickAction & rAction : maCurrentActions) { - const char* pRId = GetClickActionSdResId(rAction); + TranslateId pRId = GetClickActionSdResId(rAction); m_xLbAction->append_text(SdResId(pRId)); } @@ -798,7 +798,7 @@ OUString SdTPAction::GetEditText( bool bFullDocDestination ) return aStr; } -const char* SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) +TranslateId SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) { switch( eCA ) { @@ -816,7 +816,7 @@ const char* SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION; default: OSL_FAIL( "No StringResource for ClickAction available!" ); } - return nullptr; + return {}; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index 26be546af0c9..b354138af287 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -648,7 +648,7 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj) /** * set line starts and ends for the object to be created */ -static ::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel) +static ::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel& rModel) { ::basegfx::B2DPolyPolygon aRetval; XLineEndListRef pLineEndList(rModel.GetLineEndList()); diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index 4d6c8463996d..e323353ee187 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -20,6 +20,7 @@ #pragma once #include <sfx2/childwin.hxx> +#include <unotools/resmgr.hxx> namespace sd { @@ -33,7 +34,7 @@ public: sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo, - const char* pTitleBarResId); + TranslateId pTitleBarResId); virtual ~PaneChildWindow() override; }; diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx index ac0c6fb8b0d0..22c4dd82a779 100644 --- a/sd/source/ui/inc/tpaction.hxx +++ b/sd/source/ui/inc/tpaction.hxx @@ -81,7 +81,7 @@ private: void SetActualClickAction( css::presentation::ClickAction eCA ); void SetEditText( OUString const & rStr ); OUString GetEditText( bool bURL = false ); - static const char* GetClickActionSdResId(css::presentation::ClickAction eCA); + static TranslateId GetClickActionSdResId(css::presentation::ClickAction eCA); public: SdTPAction(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 0e2e8aae890f..8483616c5e10 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -75,7 +75,7 @@ namespace { struct snewfoil_value_info { const char* msBmpResId; - const char* mpStrResId; + TranslateId mpStrResId; WritingMode meWritingMode; AutoLayout maAutoLayout; }; @@ -86,7 +86,7 @@ const snewfoil_value_info notes[] = { {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB, AUTOLAYOUT_NOTES}, - {"", nullptr, WritingMode_LR_TB, AUTOLAYOUT_NONE}, + {"", {}, WritingMode_LR_TB, AUTOLAYOUT_NONE}, }; const snewfoil_value_info handout[] = @@ -103,7 +103,7 @@ const snewfoil_value_info handout[] = AUTOLAYOUT_HANDOUT6}, {BMP_FOILH_09, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB, AUTOLAYOUT_HANDOUT9}, - {"", nullptr, WritingMode_LR_TB, AUTOLAYOUT_NONE}, + {"", {}, WritingMode_LR_TB, AUTOLAYOUT_NONE}, }; const snewfoil_value_info standard[] = @@ -126,7 +126,7 @@ const snewfoil_value_info standard[] = {BMP_LAYOUT_VERTICAL01, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VTITLE_VCONTENT}, {BMP_LAYOUT_HEAD02, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VCONTENT}, {BMP_LAYOUT_HEAD02A, STR_AL_TITLE_VERT_OUTLINE_CLIPART, WritingMode_TB_RL, AUTOLAYOUT_TITLE_2VTEXT}, - {"", nullptr, WritingMode_LR_TB, AUTOLAYOUT_NONE} + {"", {}, WritingMode_LR_TB, AUTOLAYOUT_NONE} }; class LayoutValueSet : public ValueSet @@ -538,7 +538,7 @@ void LayoutMenu::Fill() } Clear(); - for (sal_uInt16 i=1; pInfo!=nullptr && pInfo->mpStrResId != nullptr; i++, pInfo++) + for (sal_uInt16 i=1; pInfo!=nullptr && pInfo->mpStrResId; i++, pInfo++) { if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical) { diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index a37b3b6ddeb0..3db225efba2d 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -157,7 +157,7 @@ private: Size maSmallPreviewSizePixel; Size maLargePreviewSizePixel; - Image GetPreviewSubstitution(const char* pId, PreviewSize ePreviewSize); + Image GetPreviewSubstitution(TranslateId pId, PreviewSize ePreviewSize); void CleanContainer(); }; @@ -841,14 +841,14 @@ SdDrawDocument* MasterPageContainer::Implementation::GetDocument() } Image MasterPageContainer::Implementation::GetPreviewSubstitution ( - const char* pId, + TranslateId pId, PreviewSize ePreviewSize) { const ::osl::MutexGuard aGuard (maMutex); Image aPreview; - if (strcmp(pId, STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION) == 0) + if (pId == STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION) { Image& rPreview (ePreviewSize==SMALL ? maSmallPreviewBeingCreated @@ -861,7 +861,7 @@ Image MasterPageContainer::Implementation::GetPreviewSubstitution ( } aPreview = rPreview; } - else if (strcmp(pId, STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION) == 0) + else if (pId == STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION) { Image& rPreview (ePreviewSize==SMALL ? maSmallPreviewNotAvailable diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index d0cc984e249b..ed93441139a1 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -665,7 +665,7 @@ namespace { maProperties.push_back( aVal ); } - static Sequence<OUString> CreateChoice(const char** pResourceId, size_t nCount) + static Sequence<OUString> CreateChoice(const TranslateId* pResourceId, size_t nCount) { Sequence<OUString> aChoices (nCount); for (size_t nIndex=0; nIndex < nCount; ++nIndex) diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 66e25ad8438a..dd823204ced1 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1439,7 +1439,7 @@ bool SdOutliner::ShowWrapAroundDialog() // The question text depends on the search direction. bool bImpress = mpDrawDocument && mpDrawDocument->GetDocumentType() == DocumentType::Impress; - const char* pStringId; + TranslateId pStringId; if (mbDirectionIsForward) pStringId = bImpress ? STR_SAR_WRAP_FORWARD : STR_SAR_WRAP_FORWARD_DRAW; else diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index b370a0d551bb..7a1c81c89bf7 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -2349,7 +2349,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_SHOW_NEXT_LEVEL: { - const char* const STR_PRESOBJ_MPOUTLINE_ARY[] + const TranslateId STR_PRESOBJ_MPOUTLINE_ARY[] { STR_PRESOBJ_MPOUTLINE, STR_PRESOBJ_MPOUTLLAYER2, diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index d1db1e73a194..935d88555120 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -62,7 +62,7 @@ class ImageButtonHdl; } const sal_uInt16 gButtonSlots[] = { SID_INSERT_TABLE, SID_INSERT_DIAGRAM, SID_INSERT_GRAPHIC, SID_INSERT_AVMEDIA }; -static const char* gButtonToolTips[] = { STR_INSERT_TABLE, STR_INSERT_CHART, STR_INSERT_PICTURE, STR_INSERT_MOVIE }; +const TranslateId gButtonToolTips[] = { STR_INSERT_TABLE, STR_INSERT_CHART, STR_INSERT_PICTURE, STR_INSERT_MOVIE }; const std::u16string_view aSmallPlaceHolders[] = { |