diff options
Diffstat (limited to 'svx')
52 files changed, 212 insertions, 165 deletions
diff --git a/svx/inc/DescriptionGenerator.hxx b/svx/inc/DescriptionGenerator.hxx index daf169f9b478..8b3ac3f5cac2 100644 --- a/svx/inc/DescriptionGenerator.hxx +++ b/svx/inc/DescriptionGenerator.hxx @@ -21,6 +21,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <rtl/ustrbuf.hxx> +#include <unotools/resmgr.hxx> namespace com::sun::star::beans { @@ -75,7 +76,7 @@ public: shape that is made more specific by later calls to <member>addProperty</member>. */ - void Initialize(const char* pResourceId); + void Initialize(TranslateId pResourceId); /** Returns the description string and then resets it. Usually called as last method before destroying the object. diff --git a/svx/inc/fieldunit.hrc b/svx/inc/fieldunit.hrc index f16238550efe..28c160c7fcf0 100644 --- a/svx/inc/fieldunit.hrc +++ b/svx/inc/fieldunit.hrc @@ -23,9 +23,9 @@ #include <tools/fldunit.hxx> #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)) -const std::pair<const char*, FieldUnit> RID_SVXSTR_FIELDUNIT_TABLE[] = +const std::pair<TranslateId, FieldUnit> RID_SVXSTR_FIELDUNIT_TABLE[] = { { NC_("RID_SVXSTR_FIELDUNIT_TABLE", "Millimeter") , FieldUnit::MM }, { NC_("RID_SVXSTR_FIELDUNIT_TABLE", "Centimeter") , FieldUnit::CM }, diff --git a/svx/inc/fmstring.hrc b/svx/inc/fmstring.hrc index 7a78d0ae2623..08f78b7f2cc3 100644 --- a/svx/inc/fmstring.hrc +++ b/svx/inc/fmstring.hrc @@ -20,9 +20,9 @@ #ifndef INCLUDED_SVX_INC_FMSTRING_HRC #define INCLUDED_SVX_INC_FMSTRING_HRC -#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 char* RID_RSC_SQL_INTERNATIONAL[] = +const TranslateId RID_RSC_SQL_INTERNATIONAL[] = { NC_("RID_RSC_SQL_INTERNATIONAL", "LIKE"), NC_("RID_RSC_SQL_INTERNATIONAL", "NOT"), diff --git a/svx/inc/formnavi.hrc b/svx/inc/formnavi.hrc index f105cca63292..3326bc69517c 100644 --- a/svx/inc/formnavi.hrc +++ b/svx/inc/formnavi.hrc @@ -20,9 +20,9 @@ #ifndef INCLUDED_SVX_INC_FRMSEL_HRC #define INCLUDED_SVX_INC_FRMSEL_HRC -#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 char* RID_SVXSW_CONVERTMENU[] = +const TranslateId RID_SVXSW_CONVERTMENU[] = { NC_("RID_SVXSW_CONVERTMENU|ConvertToEdit", "~Text Box"), NC_("RID_SVXSW_CONVERTMENU|ConvertToButton", "~Button"), diff --git a/svx/inc/frmsel.hrc b/svx/inc/frmsel.hrc index 893d84de2faa..147d4fa9cb08 100644 --- a/svx/inc/frmsel.hrc +++ b/svx/inc/frmsel.hrc @@ -23,9 +23,9 @@ #include <utility> #include <sal/types.h> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -std::pair<const char*, sal_uInt16> RID_SVXSTR_FRMSEL_TEXTS[] = +std::pair<TranslateId, sal_uInt16> RID_SVXSTR_FRMSEL_TEXTS[] = { { NC_("RID_SVXSTR_FRMSEL_TEXTS", "Border setting") , 0 }, { NC_("RID_SVXSTR_FRMSEL_TEXTS", "Left border line") , 1 }, @@ -38,7 +38,7 @@ std::pair<const char*, sal_uInt16> RID_SVXSTR_FRMSEL_TEXTS[] = { NC_("RID_SVXSTR_FRMSEL_TEXTS", "Diagonal border line from bottom left to top right") , 8 }, }; -std::pair<const char*, sal_uInt16> RID_SVXSTR_FRMSEL_DESCRIPTIONS[] = +std::pair<TranslateId, sal_uInt16> RID_SVXSTR_FRMSEL_DESCRIPTIONS[] = { { NC_("RID_SVXSTR_FRMSEL_DESCRIPTIONS", "Border setting") , 0 }, { NC_("RID_SVXSTR_FRMSEL_DESCRIPTIONS", "Left border line") , 1 }, diff --git a/svx/inc/inspectorvalues.hrc b/svx/inc/inspectorvalues.hrc index 863b13b899e8..0c09dc4a060d 100644 --- a/svx/inc/inspectorvalues.hrc +++ b/svx/inc/inspectorvalues.hrc @@ -9,8 +9,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)) /*-------------------------------------------------------------------- Description: API names for Paragraph, Character diff --git a/svx/inc/numberingtype.hrc b/svx/inc/numberingtype.hrc index 7181aeb385e9..404a7534e00b 100644 --- a/svx/inc/numberingtype.hrc +++ b/svx/inc/numberingtype.hrc @@ -22,9 +22,9 @@ #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)) -const std::pair<const char*, int> RID_SVXSTRARY_NUMBERINGTYPE[] = +const std::pair<TranslateId, int> RID_SVXSTRARY_NUMBERINGTYPE[] = { { /* SVX_NUM_NUMBER_NONE */ NC_("RID_SVXSTRARY_NUMBERINGTYPE", "None") , 5 }, { /* SVX_NUM_CHAR_SPECIAL */ NC_("RID_SVXSTRARY_NUMBERINGTYPE", "Bullet") , 6 }, diff --git a/svx/inc/rotationstrings.hrc b/svx/inc/rotationstrings.hrc index 229f2bee53c5..bb9a81c6b68b 100644 --- a/svx/inc/rotationstrings.hrc +++ b/svx/inc/rotationstrings.hrc @@ -10,9 +10,9 @@ #ifndef INCLUDED_SVX_INC_ROTATIONSTRINGS_HRC #define INCLUDED_SVX_INC_ROTATIONSTRINGS_HRC -#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 char* RID_SVXITEMS_ROTATE_MODE[] = +const TranslateId RID_SVXITEMS_ROTATE_MODE[] = { // enum SvxRotateMode ---------------------------------------------------- NC_("RID_SVXITEMS_ROTATE_MODE_STANDARD", "Rotation only within cell"), diff --git a/svx/inc/samecontent.hrc b/svx/inc/samecontent.hrc index b4a6bc8d667d..99ff7a37c040 100644 --- a/svx/inc/samecontent.hrc +++ b/svx/inc/samecontent.hrc @@ -11,9 +11,9 @@ #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)) -const std::pair<const char*, int> RID_SVXSTRARY_SAMECONTENT[] = +const std::pair<TranslateId, int> RID_SVXSTRARY_SAMECONTENT[] = { { NC_("RID_SVXSTRARY_SAMECONTENT", "All Pages"), 0 }, { NC_("RID_SVXSTRARY_SAMECONTENT", "First Page"), 1 }, diff --git a/svx/inc/spacing.hrc b/svx/inc/spacing.hrc index 8c9ba6da29a2..280e534b4896 100644 --- a/svx/inc/spacing.hrc +++ b/svx/inc/spacing.hrc @@ -9,11 +9,11 @@ #ifndef INCLUDED_SVX_INC_SPACING_HRC #define INCLUDED_SVX_INC_SPACING_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) struct measurement { - const char* key; + TranslateId key; int twips; int human; }; @@ -29,7 +29,7 @@ const measurement RID_SVXSTRARY_SPACING_INCH[] = { NC_("RID_SVXSTRARY_SPACING_INCH", "Medium Large (1/2″)"), 720, 0 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Large (3/4″)"), 1077, 0 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Extra Large (1″)"), 1440, 0 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; // To translators: this is a listbox labelled by "Spacing:", cm units @@ -50,7 +50,7 @@ const measurement RID_SVXSTRARY_SPACING_CM[] = { NC_("RID_SVXSTRARY_SPACING_CM", "Large (%1)"), 1077, 190 }, // Extra Large (2.54 cm) { NC_("RID_SVXSTRARY_SPACING_CM", "Extra Large (%1)"), 1440, 254 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; // To translators: this is a listbox labelled by "Margins:", inch units @@ -64,7 +64,7 @@ const measurement RID_SVXSTRARY_MARGINS_INCH[] = { NC_("RID_SVXSTRARY_MARGINS_INCH", "Medium Large (1/2″)"), 720, 0 }, { NC_("RID_SVXSTRARY_MARGINS_INCH", "Large (3/4″)"), 1077, 0 }, { NC_("RID_SVXSTRARY_MARGINS_INCH", "Extra Large (1″)"), 1440, 0 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; // To translators: this is a listbox labelled by "Margins:", cm units @@ -85,7 +85,7 @@ const measurement RID_SVXSTRARY_MARGINS_CM[] = { NC_("RID_SVXSTRARY_MARGINS_CM", "Large (%1)"), 1077, 190 }, // Extra Large (2.54 cm) { NC_("RID_SVXSTRARY_MARGINS_CM", "Extra Large (%1)"), 1440, 254 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; #endif diff --git a/svx/inc/svxerr.hrc b/svx/inc/svxerr.hrc index 9691386c94e7..40066df41531 100644 --- a/svx/inc/svxerr.hrc +++ b/svx/inc/svxerr.hrc @@ -20,7 +20,7 @@ #ifndef INCLUDED_SVX_INC_SVXERR_HRC #define INCLUDED_SVX_INC_SVXERR_HRC -#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 <svx/svxerr.hxx> #include <editeng/editerr.hxx> @@ -40,7 +40,7 @@ const ErrMsgCode RID_SVXERRCTX[] = ErrCode(ERRCTX_SVX_BACKGROUND) }, { NC_("RID_SVXERRCTX", "$(ERR) loading the graphics.") , ErrCode(ERRCTX_SVX_IMPORT_GRAPHIC) }, - { nullptr, ERRCODE_NONE } + { {}, ERRCODE_NONE } }; // Error-Code ------------------------------------------------------------ @@ -70,7 +70,7 @@ const ErrMsgCode RID_SVXERRCODE[] = ERRCODE_SVX_READ_FILTER_PPOINT }, { NC_("RID_SVXERRCODE", "Password protection is not supported when documents are saved in a Microsoft Office format.\nDo you want to save the document without password protection?"), ERRCODE_SVX_EXPORT_FILTER_CRYPT }, - { nullptr, ERRCODE_NONE } + { {}, ERRCODE_NONE } }; #endif diff --git a/svx/inc/swframeposstrings.hrc b/svx/inc/swframeposstrings.hrc index 1d3da664b208..b89608350e32 100644 --- a/svx/inc/swframeposstrings.hrc +++ b/svx/inc/swframeposstrings.hrc @@ -20,10 +20,10 @@ #ifndef INCLUDED_SVX_INC_SWFRAMEPOSSTRINGS_HRC #define INCLUDED_SVX_INC_SWFRAMEPOSSTRINGS_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) //the following string have to match the (enum values) positions in svx/swframeposstrings.hxx! -const char* RID_SVXSW_FRAMEPOSITIONS[] = +const TranslateId RID_SVXSW_FRAMEPOSITIONS[] = { NC_("RID_SVXSW_FRAMEPOSITIONS", "Left"), NC_("RID_SVXSW_FRAMEPOSITIONS", "Right"), diff --git a/svx/inc/tabwin.hrc b/svx/inc/tabwin.hrc index 8ab1888038da..dd609a5bcb58 100644 --- a/svx/inc/tabwin.hrc +++ b/svx/inc/tabwin.hrc @@ -20,9 +20,9 @@ #ifndef INCLUDED_SVX_INC_TABWIN_HRC #define INCLUDED_SVX_INC_TABWIN_HRC -#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 char* RID_RSC_TABWIN_PREFIX[] = +const TranslateId RID_RSC_TABWIN_PREFIX[] = { NC_("RID_RSC_TABWIN_PREFIX", "Table"), NC_("RID_RSC_TABWIN_PREFIX", "Query"), diff --git a/svx/inc/txenctab.hrc b/svx/inc/txenctab.hrc index e7171fbd1097..e140015a7eb3 100644 --- a/svx/inc/txenctab.hrc +++ b/svx/inc/txenctab.hrc @@ -23,11 +23,11 @@ #include <rtl/textenc.h> #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)) // Encodings for which no conversion exist yet are commented out. -const std::pair<const char*, rtl_TextEncoding> RID_SVXSTR_TEXTENCODING_TABLE[] = +const std::pair<TranslateId, rtl_TextEncoding> RID_SVXSTR_TEXTENCODING_TABLE[] = { { NC_("RID_SVXSTR_TEXTENCODING_TABLE", "Western Europe (Windows-1252/WinLatin 1)") , RTL_TEXTENCODING_MS_1252 }, { NC_("RID_SVXSTR_TEXTENCODING_TABLE", "Western Europe (Apple Macintosh)") , RTL_TEXTENCODING_APPLE_ROMAN }, diff --git a/svx/source/accessibility/DescriptionGenerator.cxx b/svx/source/accessibility/DescriptionGenerator.cxx index 2a473ed40563..430f22c98c01 100644 --- a/svx/source/accessibility/DescriptionGenerator.cxx +++ b/svx/source/accessibility/DescriptionGenerator.cxx @@ -44,7 +44,7 @@ DescriptionGenerator::DescriptionGenerator(const uno::Reference<drawing::XShape> DescriptionGenerator::~DescriptionGenerator() {} -void DescriptionGenerator::Initialize(const char* pResourceId) +void DescriptionGenerator::Initialize(TranslateId pResourceId) { // Get the string from the resource for the specified id. OUString sPrefix; diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx index 368c2f698ee9..1a485b503772 100644 --- a/svx/source/accessibility/ShapeTypeHandler.cxx +++ b/svx/source/accessibility/ShapeTypeHandler.cxx @@ -191,7 +191,7 @@ tools::Long ShapeTypeHandler::GetSlotId (const uno::Reference<drawing::XShape>& /// get the accessible base name for an object OUString ShapeTypeHandler::CreateAccessibleBaseName (const uno::Reference<drawing::XShape>& rxShape) { - const char* pResourceId; + TranslateId pResourceId; OUString sName; switch (ShapeTypeHandler::Instance().GetTypeId (rxShape)) @@ -276,7 +276,7 @@ OUString ShapeTypeHandler::CreateAccessibleBaseName (const uno::Reference<drawin pResourceId = STR_ObjNameSingulFONTWORK; else { - pResourceId = nullptr; + pResourceId = {}; sName = pCustomShape->GetCustomShapeName(); } } @@ -286,7 +286,7 @@ OUString ShapeTypeHandler::CreateAccessibleBaseName (const uno::Reference<drawin pResourceId = STR_ObjNameSingulTEXT; break; default: - pResourceId = nullptr; + pResourceId = {}; sName = "UnknownAccessibleShape"; if (rxShape.is()) sName += ": " + rxShape->getShapeType(); diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index cd8c9af53988..bca421c29a51 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -52,8 +52,8 @@ namespace { struct ChildIndexToPointData { - const char* pResIdName; - const char* pResIdDescr; + TranslateId pResIdName; + TranslateId pResIdDescr; RectPoint ePoint; }; } diff --git a/svx/source/dialog/dialmgr.cxx b/svx/source/dialog/dialmgr.cxx index 1281324eaad9..9fdd50ddab08 100644 --- a/svx/source/dialog/dialmgr.cxx +++ b/svx/source/dialog/dialmgr.cxx @@ -17,11 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <unotools/resmgr.hxx> #include <svx/dialmgr.hxx> std::locale SvxResLocale() { return Translate::Create("svx"); } -OUString SvxResId(std::string_view aId) { return Translate::get(aId, SvxResLocale()); } +OUString SvxResId(TranslateId aId) { return Translate::get(aId, SvxResLocale()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 1eab1accf726..1c86f078042f 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -622,7 +622,7 @@ void SaveProgressDialog::end() m_xDialog->response(DLG_RET_OK); } -static short impl_askUserForWizardCancel(weld::Widget* pParent, const char* pRes) +static short impl_askUserForWizardCancel(weld::Widget* pParent, TranslateId pRes) { std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::YesNo, SvxResId(pRes))); diff --git a/svx/source/dialog/page.hrc b/svx/source/dialog/page.hrc index ec845957e31f..c5e9a75b1cc6 100644 --- a/svx/source/dialog/page.hrc +++ b/svx/source/dialog/page.hrc @@ -23,9 +23,9 @@ #include <i18nutil/paper.hxx> #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)) -const std::pair<const char*, int> RID_SVXSTRARY_PAPERSIZE_STD[] = +const std::pair<TranslateId, int> RID_SVXSTRARY_PAPERSIZE_STD[] = { { NC_("RID_SVXSTRARY_PAPERSIZE_STD", "A6") , PAPER_A6 }, { NC_("RID_SVXSTRARY_PAPERSIZE_STD", "A5") , PAPER_A5 }, @@ -59,7 +59,7 @@ const std::pair<const char*, int> RID_SVXSTRARY_PAPERSIZE_STD[] = { NC_("RID_SVXSTRARY_PAPERSIZE_STD", "Japanese Postcard") , PAPER_POSTCARD_JP} }; -const std::pair<const char*, int> RID_SVXSTRARY_PAPERSIZE_DRAW[] = +const std::pair<TranslateId, int> RID_SVXSTRARY_PAPERSIZE_DRAW[] = { { NC_("RID_SVXSTRARY_PAPERSIZE_DRAW", "A6") , PAPER_A6 }, { NC_("RID_SVXSTRARY_PAPERSIZE_DRAW", "A5") , PAPER_A5 }, diff --git a/svx/source/dialog/papersizelistbox.cxx b/svx/source/dialog/papersizelistbox.cxx index f746a023c38d..fc0211a8bad4 100644 --- a/svx/source/dialog/papersizelistbox.cxx +++ b/svx/source/dialog/papersizelistbox.cxx @@ -29,7 +29,7 @@ SvxPaperSizeListBox::SvxPaperSizeListBox(std::unique_ptr<weld::ComboBox> pContro void SvxPaperSizeListBox::FillPaperSizeEntries( PaperSizeApp eApp ) { - const std::pair<const char*, int>* pPaperAry = eApp == PaperSizeApp::Std ? + const std::pair<TranslateId, int>* pPaperAry = eApp == PaperSizeApp::Std ? RID_SVXSTRARY_PAPERSIZE_STD : RID_SVXSTRARY_PAPERSIZE_DRAW; sal_uInt32 nCnt = eApp == PaperSizeApp::Std ? SAL_N_ELEMENTS(RID_SVXSTRARY_PAPERSIZE_STD) : SAL_N_ELEMENTS(RID_SVXSTRARY_PAPERSIZE_DRAW); diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx index 5698c99ba090..9736b5703317 100644 --- a/svx/source/dialog/svxbmpnumvalueset.cxx +++ b/svx/source/dialog/svxbmpnumvalueset.cxx @@ -95,7 +95,7 @@ static void lcl_PaintLevel(OutputDevice* pVDev, sal_Int16 nNumberingType, } } -static const char* RID_SVXSTR_BULLET_DESCRIPTIONS[] = + const TranslateId RID_SVXSTR_BULLET_DESCRIPTIONS[] = { RID_SVXSTR_BULLET_DESCRIPTION_0, RID_SVXSTR_BULLET_DESCRIPTION_1, @@ -107,7 +107,7 @@ static const char* RID_SVXSTR_BULLET_DESCRIPTIONS[] = RID_SVXSTR_BULLET_DESCRIPTION_7 }; -static const char* RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] = +const TranslateId RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] = { RID_SVXSTR_SINGLENUM_DESCRIPTION_0, RID_SVXSTR_SINGLENUM_DESCRIPTION_1, @@ -119,7 +119,7 @@ static const char* RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] = RID_SVXSTR_SINGLENUM_DESCRIPTION_7 }; -static const char* RID_SVXSTR_OUTLINENUM_DESCRIPTIONS[] = +const TranslateId RID_SVXSTR_OUTLINENUM_DESCRIPTIONS[] = { RID_SVXSTR_OUTLINENUM_DESCRIPTION_0, RID_SVXSTR_OUTLINENUM_DESCRIPTION_1, diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index e6b57aac5fb7..43000ea7279c 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -3280,7 +3280,7 @@ void SvxRuler::TabMenuSelect(const OString& rIdent) } } -static const char* RID_SVXSTR_RULER_TAB[] = +const TranslateId RID_SVXSTR_RULER_TAB[] = { RID_SVXSTR_RULER_TAB_LEFT, RID_SVXSTR_RULER_TAB_RIGHT, diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 0e1a6a87389a..a3bcd5816214 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -410,7 +410,7 @@ IMPL_LINK_NOARG( FmGridHeader, OnAsyncExecuteDrop, void*, void ) // Create Column based on type, default textfield std::vector<OString> aPossibleTypes; std::vector<OUString> aImgResId; - std::vector<const char*> aStrResId; + std::vector<TranslateId> aStrResId; switch (nDataType) { @@ -512,7 +512,7 @@ IMPL_LINK_NOARG( FmGridHeader, OnAsyncExecuteDrop, void*, void ) int nMenuPos = 0; std::vector<OString>::const_iterator iter; - std::vector<const char*>::const_iterator striter; + std::vector<TranslateId>::const_iterator striter; std::vector<OUString>::const_iterator imgiter; for (iter = aPossibleTypes.begin(), imgiter = aImgResId.begin(), striter = aStrResId.begin(); iter != aPossibleTypes.end(); ++iter, ++striter, ++imgiter) diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index b400918b4bc8..93ecd07b9d60 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -413,7 +413,7 @@ namespace svxform std::unique_ptr<ItemNode> pNode; Reference< css::xml::dom::XNode > xParentNode; Reference< XPropertySet > xNewBinding; - const char* pResId = nullptr; + TranslateId pResId; bool bIsElement = true; if ( DGTInstance == m_eGroup ) { @@ -583,7 +583,7 @@ namespace svxform AddDataItemDialog aDlg(m_pNaviWin->GetFrameWeld(), pNode, m_xUIHelper); DataItemType eType = DITElement; - const char* pResId = RID_STR_DATANAV_EDIT_ELEMENT; + TranslateId pResId = RID_STR_DATANAV_EDIT_ELEMENT; if ( pNode && pNode->m_xNode.is() ) { try @@ -871,7 +871,7 @@ namespace svxform DBG_ASSERT( pNode->m_xNode.is(), "XFormsPage::RemoveEntry(): no XNode" ); css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType(); bool bIsElement = ( eChildType == css::xml::dom::NodeType_ELEMENT_NODE ); - const char* pResId = bIsElement ? RID_STR_QRY_REMOVE_ELEMENT : RID_STR_QRY_REMOVE_ATTRIBUTE; + TranslateId pResId = bIsElement ? RID_STR_QRY_REMOVE_ELEMENT : RID_STR_QRY_REMOVE_ATTRIBUTE; OUString sVar = bIsElement ? OUString(ELEMENTNAME) : OUString(ATTRIBUTENAME); std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(m_pNaviWin->GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, @@ -906,7 +906,7 @@ namespace svxform { DBG_ASSERT( pNode->m_xPropSet.is(), "XFormsPage::RemoveEntry(): no propset" ); bool bSubmission = ( DGTSubmission == m_eGroup ); - const char* pResId = bSubmission ? RID_STR_QRY_REMOVE_SUBMISSION : RID_STR_QRY_REMOVE_BINDING; + TranslateId pResId = bSubmission ? RID_STR_QRY_REMOVE_SUBMISSION : RID_STR_QRY_REMOVE_BINDING; OUString sProperty = bSubmission ? OUString(PN_SUBMISSION_ID) : OUString(PN_BINDING_ID); OUString sSearch = bSubmission ? OUString(SUBMISSIONNAME) : OUString(BINDINGNAME); OUString sName; @@ -1221,8 +1221,8 @@ namespace svxform if ( DGTInstance != m_eGroup ) return; - const char* pResId1 = RID_STR_DATANAV_EDIT_ELEMENT; - const char* pResId2 = RID_STR_DATANAV_REMOVE_ELEMENT; + TranslateId pResId1 = RID_STR_DATANAV_EDIT_ELEMENT; + TranslateId pResId2 = RID_STR_DATANAV_REMOVE_ELEMENT; if (bEntry) { ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64()); diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 8f793c4ce7f8..1f083fa49f88 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -92,7 +92,7 @@ FmPropBrwMgr::FmPropBrwMgr( vcl::Window* _pParent, sal_uInt16 _nId, static OUString GetUIHeadlineName(sal_Int16 nClassId, const Any& aUnoObj) { - const char* pClassNameResourceId = nullptr; + TranslateId pClassNameResourceId; switch ( nClassId ) { diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 009bafb85b5d..e98da0466786 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -456,7 +456,7 @@ namespace svxform OUString sInitialLabel; OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_NAME ) >>= sInitialLabel ); - const char* pTitleResId = nullptr; + TranslateId pTitleResId; switch ( nClassId ) { case FormComponentType::COMMANDBUTTON: pTitleResId = RID_STR_PROPTITLE_PUSHBUTTON; break; @@ -630,7 +630,7 @@ namespace svxform OUString FormControlFactory::getDefaultName( sal_Int16 _nClassId, const Reference< XServiceInfo >& _rxObject ) { - const char* pResId(nullptr); + TranslateId pResId; switch ( _nClassId ) { diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index b6b5b00d9a0f..ceb8a0fea7b4 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -63,7 +63,7 @@ const std::pair<sal_uInt16, const char*> aUnlocalized[] = { GALLERY_THEME_FONTWORK_VERTICAL, RID_GALLERYSTR_THEME_FONTWORK_VERTICAL } }; -const std::pair<sal_uInt16, const char*> aLocalized[] = +const std::pair<sal_uInt16, TranslateId> aLocalized[] = { { RID_GALLERY_THEME_3D, RID_GALLERYSTR_THEME_3D }, { RID_GALLERY_THEME_ANIMATIONS, RID_GALLERYSTR_THEME_ANIMATIONS }, diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index d432963f4b3d..470096993f47 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -110,7 +110,8 @@ bool SvxOrientationItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ OUString SvxOrientationItem::GetValueText( SvxCellOrientation nVal ) { - return SvxResId(RID_SVXITEMS_ORI_STANDARD + static_cast<int>(nVal)); + OString id = OString::Concat(RID_SVXITEMS_ORI_STANDARD.mpId) + OString::number(static_cast<int>(nVal)); + return SvxResId(TranslateId(RID_SVXITEMS_ORI_STANDARD.mpContext, id.getStr())); } SvxOrientationItem* SvxOrientationItem::Clone( SfxItemPool* ) const diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index db45b3e9fe62..ad600c68fc0e 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -87,7 +87,7 @@ static OUString GetUsageText( const SvxPageUsage eU ) } } -static const char* RID_SVXITEMS_PAGE_NUMS[] = +const TranslateId RID_SVXITEMS_PAGE_NUMS[] = { RID_SVXITEMS_PAGE_NUM_CHR_UPPER, RID_SVXITEMS_PAGE_NUM_CHR_LOWER, diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index fbbc3b3da03a..f53ebb677a0a 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -263,7 +263,8 @@ void BulletsTypeMgr::Init() pActualBullets[i] = new BulletsSettings; pActualBullets[i]->cBulletChar = aDefaultBulletTypes[i]; pActualBullets[i]->aFont = rActBulletFont; - pActualBullets[i]->sDescription = SvxResId( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); + OString id = OString::Concat(RID_SVXSTR_BULLET_DESCRIPTION_0.mpId) + OString::number(i); + pActualBullets[i]->sDescription = SvxResId( TranslateId(RID_SVXSTR_BULLET_DESCRIPTION_0.mpContext, id.getStr()) ); } } sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) @@ -380,7 +381,7 @@ NumberingTypeMgr::~NumberingTypeMgr() { } -static const char* RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] = +const TranslateId RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] = { RID_SVXSTR_SINGLENUM_DESCRIPTION_0, RID_SVXSTR_SINGLENUM_DESCRIPTION_1, @@ -588,7 +589,8 @@ void OutlineTypeMgr::Init() { pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; - pItemArr->sDescription = SvxResId( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); + OString id = OString::Concat(RID_SVXSTR_OUTLINENUM_DESCRIPTION_0.mpId) + OString::number(nItem); + pItemArr->sDescription = SvxResId( TranslateId(RID_SVXSTR_OUTLINENUM_DESCRIPTION_0.mpContext, id.getStr()) ); pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) diff --git a/svx/source/stbctrls/modctrl.cxx b/svx/source/stbctrls/modctrl.cxx index fa91f98588cf..2d3fc7a5d133 100644 --- a/svx/source/stbctrls/modctrl.cxx +++ b/svx/source/stbctrls/modctrl.cxx @@ -90,7 +90,7 @@ void SvxModifyControl::StateChangedAtStatusBarControl( sal_uInt16, SfxItemState _repaint(); - const char* pResId = modified ? RID_SVXSTR_DOC_MODIFIED_YES : RID_SVXSTR_DOC_MODIFIED_NO; + TranslateId pResId = modified ? RID_SVXSTR_DOC_MODIFIED_YES : RID_SVXSTR_DOC_MODIFIED_NO; GetStatusBar().SetQuickHelpText(GetId(), SvxResId(pResId)); if ( start ) diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx index b79afa7eeaff..e85868cda947 100644 --- a/svx/source/stbctrls/xmlsecctrl.cxx +++ b/svx/source/stbctrls/xmlsecctrl.cxx @@ -84,7 +84,7 @@ void XmlSecStatusBarControl::StateChangedAtStatusBarControl( sal_uInt16, SfxItem GetStatusBar().SetItemText( GetId(), "" ); // necessary ? - const char* pResId = RID_SVXSTR_XMLSEC_NO_SIG; + TranslateId pResId = RID_SVXSTR_XMLSEC_NO_SIG; if ( mpImpl->mnState == SignatureState::OK ) pResId = RID_SVXSTR_XMLSEC_SIG_OK; else if ( mpImpl->mnState == SignatureState::BROKEN ) diff --git a/svx/source/svdraw/ActionDescriptionProvider.cxx b/svx/source/svdraw/ActionDescriptionProvider.cxx index a471f3e85763..0dc5e895c755 100644 --- a/svx/source/svdraw/ActionDescriptionProvider.cxx +++ b/svx/source/svdraw/ActionDescriptionProvider.cxx @@ -25,7 +25,7 @@ OUString ActionDescriptionProvider::createDescription( ActionType eActionType , std::u16string_view rObjectName ) { - const char* pResID = nullptr; + TranslateId pResID; switch( eActionType ) { case ActionType::Insert: diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 411294962d45..982e6d7e8c18 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -403,7 +403,7 @@ bool SdrItemPool::GetPresentation( OUString SdrItemPool::GetItemName(sal_uInt16 nWhich) { - const char* pResId = SIP_UNKNOWN_ATTR; + TranslateId pResId = SIP_UNKNOWN_ATTR; switch (nWhich) { @@ -938,7 +938,7 @@ sal_uInt16 SdrCaptionTypeItem::GetValueCount() const { return 4; } OUString SdrCaptionTypeItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALCAPTIONTYPES[] = + static TranslateId ITEMVALCAPTIONTYPES[] = { STR_ItemValCAPTIONTYPE1, STR_ItemValCAPTIONTYPE2, @@ -966,7 +966,7 @@ sal_uInt16 SdrCaptionEscDirItem::GetValueCount() const { return 3; } OUString SdrCaptionEscDirItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALCAPTIONTYPES[] = + static TranslateId ITEMVALCAPTIONTYPES[] = { STR_ItemValCAPTIONESCHORI, STR_ItemValCAPTIONESCVERT, @@ -1010,7 +1010,7 @@ sal_uInt16 SdrTextFitToSizeTypeItem::GetValueCount() const { return 4; } OUString SdrTextFitToSizeTypeItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALFITTISIZETYPES[] = + static TranslateId ITEMVALFITTISIZETYPES[] = { STR_ItemValFITTOSIZENONE, STR_ItemValFITTOSIZEPROP, @@ -1072,7 +1072,7 @@ sal_uInt16 SdrTextVertAdjustItem::GetValueCount() const { return 5; } OUString SdrTextVertAdjustItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALTEXTVADJTYPES[] = + static TranslateId ITEMVALTEXTVADJTYPES[] = { STR_ItemValTEXTVADJTOP, STR_ItemValTEXTVADJCENTER, @@ -1131,7 +1131,7 @@ sal_uInt16 SdrTextHorzAdjustItem::GetValueCount() const { return 5; } OUString SdrTextHorzAdjustItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALTEXTHADJTYPES[] = + static TranslateId ITEMVALTEXTHADJTYPES[] = { STR_ItemValTEXTHADJLEFT, STR_ItemValTEXTHADJCENTER, @@ -1183,7 +1183,7 @@ sal_uInt16 SdrTextAniKindItem::GetValueCount() const { return 5; } OUString SdrTextAniKindItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALTEXTANITYPES[] = + static TranslateId ITEMVALTEXTANITYPES[] = { STR_ItemValTEXTANI_NONE, STR_ItemValTEXTANI_BLINK, @@ -1234,7 +1234,7 @@ sal_uInt16 SdrTextAniDirectionItem::GetValueCount() const { return 4; } OUString SdrTextAniDirectionItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALTEXTANITYPES[] = + static TranslateId ITEMVALTEXTANITYPES[] = { STR_ItemValTEXTANI_LEFT, STR_ItemValTEXTANI_UP, @@ -1387,7 +1387,7 @@ sal_uInt16 SdrEdgeKindItem::GetValueCount() const { return 4; } OUString SdrEdgeKindItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALEDGES[] = + static TranslateId ITEMVALEDGES[] = { STR_ItemValEDGE_ORTHOLINES, STR_ItemValEDGE_THREELINES, @@ -1555,7 +1555,7 @@ sal_uInt16 SdrMeasureKindItem::GetValueCount() const { return 2; } OUString SdrMeasureKindItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALMEASURETYPES[] = + static TranslateId ITEMVALMEASURETYPES[] = { STR_ItemValMEASURE_STD, STR_ItemValMEASURE_RADIUS @@ -1603,7 +1603,7 @@ sal_uInt16 SdrMeasureTextHPosItem::GetValueCount() const { return 4; } OUString SdrMeasureTextHPosItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALMEASURETEXTTYPES[] = + static TranslateId ITEMVALMEASURETEXTTYPES[] = { STR_ItemValMEASURE_TEXTHAUTO, STR_ItemValMEASURE_TEXTLEFTOUTSIDE, @@ -1652,7 +1652,7 @@ sal_uInt16 SdrMeasureTextVPosItem::GetValueCount() const { return 5; } OUString SdrMeasureTextVPosItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALMEASURETEXTTYPES[] = + static TranslateId ITEMVALMEASURETEXTTYPES[] = { STR_ItemValMEASURE_TEXTVAUTO, STR_ItemValMEASURE_ABOVE, @@ -1741,7 +1741,7 @@ sal_uInt16 SdrCircKindItem::GetValueCount() const { return 4; } OUString SdrCircKindItem::GetValueTextByPos(sal_uInt16 nPos) { - static const char* ITEMVALCIRCTYPES[] = + static TranslateId ITEMVALCIRCTYPES[] = { STR_ItemValCIRC_FULL, STR_ItemValCIRC_SECT, diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index b0ec9365712d..36ec07b795f3 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -552,7 +552,7 @@ void SdrDragMethod::createSdrDragEntries_GlueDrag() } } -OUString SdrDragMethod::ImpGetDescriptionStr(const char* pStrCacheID) const +OUString SdrDragMethod::ImpGetDescriptionStr(TranslateId pStrCacheID) const { ImpGetDescriptionOptions nOpt=ImpGetDescriptionOptions::NONE; if (IsDraggingPoints()) { diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 5d29b1b3dc4f..d8ba459c4d2e 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -2000,7 +2000,7 @@ void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea) bool bMrkChg = false; const size_t nMarkCount=GetMarkedObjectCount(); - const char* pDscrID = nullptr; + TranslateId pDscrID; if(bLineToArea) { if(nMarkCount == 1) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 495a0bd64c74..41778c8af6cf 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -2593,7 +2593,7 @@ const tools::Rectangle& SdrMarkView::GetMarkedObjRect() const } -OUString SdrMarkView::ImpGetDescriptionString(const char* pStrCacheID, ImpGetDescriptionOptions nOpt) const +OUString SdrMarkView::ImpGetDescriptionString(TranslateId pStrCacheID, ImpGetDescriptionOptions nOpt) const { OUString sStr = SvxResId(pStrCacheID); const sal_Int32 nPos = sStr.indexOf("%1"); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 15b9cc6dcfcf..b6c39ed1d762 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1097,7 +1097,7 @@ OUString SdrObject::TakeObjNamePlural() const return SvxResId(STR_ObjNamePluralNONE); } -OUString SdrObject::ImpGetDescriptionStr(const char* pStrCacheID) const +OUString SdrObject::ImpGetDescriptionStr(TranslateId pStrCacheID) const { OUString aStr = SvxResId(pStrCacheID); sal_Int32 nPos = aStr.indexOf("%1"); diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 6739e6082a57..9254c2bcefef 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -319,7 +319,7 @@ void SdrCircObj::RecalcXPoly() OUString SdrCircObj::TakeObjNameSingul() const { - const char* pID=STR_ObjNameSingulCIRC; + TranslateId pID=STR_ObjNameSingulCIRC; if (maRect.GetWidth() == maRect.GetHeight() && maGeo.nShearAngle==0_deg100) { switch (meCircleKind) { @@ -348,7 +348,7 @@ OUString SdrCircObj::TakeObjNameSingul() const OUString SdrCircObj::TakeObjNamePlural() const { - const char* pID=STR_ObjNamePluralCIRC; + TranslateId pID=STR_ObjNamePluralCIRC; if (maRect.GetWidth() == maRect.GetHeight() && maGeo.nShearAngle==0_deg100) { switch (meCircleKind) { diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 5ec2219cbef3..3de8f5fa7f5f 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -645,7 +645,7 @@ OUString SdrGrafObj::TakeObjNameSingul() const { case GraphicType::Bitmap: { - const char* pId = ( ( mpGraphicObject->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ? + TranslateId pId = ( ( mpGraphicObject->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ? ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) : ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) ); @@ -720,7 +720,7 @@ OUString SdrGrafObj::TakeObjNamePlural() const { case GraphicType::Bitmap: { - const char* pId = ( ( mpGraphicObject->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ? + TranslateId pId = ( ( mpGraphicObject->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ? ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) : ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) ); diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 7f2b4f1fb77c..1c36760ae929 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -1836,7 +1836,7 @@ OUString SdrPathObj::TakeObjNameSingul() const if(OBJ_LINE == meKind) { - const char* pId(STR_ObjNameSingulLINE); + TranslateId pId(STR_ObjNameSingulLINE); if(lcl_ImpIsLine(GetPathPoly())) { @@ -1872,7 +1872,7 @@ OUString SdrPathObj::TakeObjNameSingul() const else if(OBJ_PLIN == meKind || OBJ_POLY == meKind) { const bool bClosed(OBJ_POLY == meKind); - const char* pId(nullptr); + TranslateId pId; if(mpDAC && mpDAC->IsCreating()) { diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 7221a3c71b76..cd91f6f06c31 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -209,7 +209,7 @@ OUString SdrRectObj::TakeObjNameSingul() const } bool bRounded = GetEckenradius() != 0; // rounded down - const char* pResId = bRounded ? STR_ObjNameSingulRECTRND : STR_ObjNameSingulRECT; + TranslateId pResId = bRounded ? STR_ObjNameSingulRECTRND : STR_ObjNameSingulRECT; if (maGeo.nShearAngle) { pResId = bRounded ? STR_ObjNameSingulPARALRND : STR_ObjNameSingulPARAL; // parallelogram or, maybe, rhombus @@ -235,7 +235,7 @@ OUString SdrRectObj::TakeObjNamePlural() const } bool bRounded = GetEckenradius() != 0; // rounded down - const char* pResId = bRounded ? STR_ObjNamePluralRECTRND : STR_ObjNamePluralRECT; + TranslateId pResId = bRounded ? STR_ObjNamePluralRECTRND : STR_ObjNamePluralRECT; if (maGeo.nShearAngle) { pResId = bRounded ? STR_ObjNamePluralPARALRND : STR_ObjNamePluralPARAL; // parallelogram or rhombus diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 2e81d8acd91f..2fac21a7fa22 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -195,7 +195,7 @@ SdrUndoObj::SdrUndoObj(SdrObject& rNewObj) { } -OUString SdrUndoObj::GetDescriptionStringForObject( const SdrObject& _rForObject, const char* pStrCacheID, bool bRepeat ) +OUString SdrUndoObj::GetDescriptionStringForObject( const SdrObject& _rForObject, TranslateId pStrCacheID, bool bRepeat ) { const OUString rStr {SvxResId(pStrCacheID)}; @@ -209,7 +209,7 @@ OUString SdrUndoObj::GetDescriptionStringForObject( const SdrObject& _rForObject return rStr.replaceAt(nPos, 2, _rForObject.TakeObjNameSingul()); } -OUString SdrUndoObj::ImpGetDescriptionStr(const char* pStrCacheID, bool bRepeat) const +OUString SdrUndoObj::ImpGetDescriptionStr(TranslateId pStrCacheID, bool bRepeat) const { if ( pObj ) return GetDescriptionStringForObject( *pObj, pStrCacheID, bRepeat ); @@ -1330,7 +1330,7 @@ void SdrUndoPage::ImpMovePage(sal_uInt16 nOldNum, sal_uInt16 nNewNum) } } -OUString SdrUndoPage::ImpGetDescriptionStr(const char* pStrCacheID) +OUString SdrUndoPage::ImpGetDescriptionStr(TranslateId pStrCacheID) { return SvxResId(pStrCacheID); } diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 6e040da5b1dd..bed16752433f 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -99,7 +99,7 @@ const std::u16string_view aDirectionBmps[] = u"" RID_SVXBMP_DIRECTION_DIRECTION_SE }; -static const char* aDirectionStrs[] = +static TranslateId aDirectionStrs[] = { RID_SVXSTR_DIRECTION_NW, RID_SVXSTR_DIRECTION_N, @@ -382,7 +382,7 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) { meUnit = eUnit; - const char* aDepths[] = + const TranslateId aDepths[] = { RID_SVXSTR_DEPTH_0, RID_SVXSTR_DEPTH_1, @@ -391,7 +391,7 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) RID_SVXSTR_DEPTH_4 }; - const char* aDepthsInch[] = + const TranslateId aDepthsInch[] = { RID_SVXSTR_DEPTH_0_INCH, RID_SVXSTR_DEPTH_1_INCH, @@ -402,7 +402,7 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) assert(SAL_N_ELEMENTS(aDepths) == SAL_N_ELEMENTS(aDepthsInch)); - const char** pResource = IsMetric(eUnit) ? aDepths : aDepthsInch; + const TranslateId* pResource = IsMetric(eUnit) ? aDepths : aDepthsInch; mxDepth0->set_label(SvxResId(pResource[0])); mxDepth1->set_label(SvxResId(pResource[1])); diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index 9c31edf4e7a3..7adb99ecaaa2 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -99,7 +99,7 @@ SvxPopupWindowListBox::SvxPopupWindowListBox(SvxUndoRedoControl* pControl, weld: void SvxUndoRedoControl::SetInfo( sal_Int32 nCount ) { - const char* pId; + TranslateId pId; if (nCount == 1) pId = getCommandURL() == ".uno:Undo" ? RID_SVXSTR_NUM_UNDO_ACTION : RID_SVXSTR_NUM_REDO_ACTION; else diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index 51fecface297..90af6561d6ff 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -454,7 +454,7 @@ static void impl_execute( SfxRequest const & rReq, SdrCustomShapeGeometryItem& r void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindings& rBindings ) { sal_uInt16 nSID = rReq.GetSlot(); - const char* pStrResId = nullptr; + TranslateId pStrResId; const bool bUndo = pSdrView && pSdrView->IsUndoEnabled(); diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 0f27578eab18..7ec966ab4f09 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -409,7 +409,7 @@ static void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem void FontworkBar::execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindings& rBindings ) { - const char* pStrResId = nullptr; + TranslateId pStrResId; sal_uInt16 nSID = rReq.GetSlot(); switch( nSID ) diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 9cc61bcea7ae..a421268cdd4a 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1118,7 +1118,7 @@ static const char* RID_SVXSTR_BMP_DEF[] = RID_SVXSTR_BMP92_DEF }; -static const char* RID_SVXSTR_BMP[] = +const TranslateId RID_SVXSTR_BMP[] = { RID_SVXSTR_BMP0, RID_SVXSTR_BMP1, @@ -1251,7 +1251,7 @@ static const char* RID_SVXSTR_DASH_DEF[] = }; -static const char* RID_SVXSTR_DASH[] = +const TranslateId RID_SVXSTR_DASH[] = { RID_SVXSTR_DASH0, RID_SVXSTR_DASH1, @@ -1322,7 +1322,7 @@ static const char* RID_SVXSTR_LEND_DEF[] = RID_SVXSTR_LEND31_DEF }; -static const char* RID_SVXSTR_LEND[] = +const TranslateId RID_SVXSTR_LEND[] = { RID_SVXSTR_LEND0, RID_SVXSTR_LEND1, @@ -1447,7 +1447,7 @@ static const char* RID_SVXSTR_GRDT_DEF[] = RID_SVXSTR_GRDT84_DEF }; -static const char* RID_SVXSTR_GRDT[] = +const TranslateId RID_SVXSTR_GRDT[] = { RID_SVXSTR_GRDT0, RID_SVXSTR_GRDT1, @@ -1556,7 +1556,7 @@ static const char* RID_SVXSTR_HATCHS_DEF[] = RID_SVXSTR_HATCH15_DEF }; -static const char* RID_SVXSTR_HATCHS[] = +const TranslateId RID_SVXSTR_HATCHS[] = { RID_SVXSTR_HATCH0, RID_SVXSTR_HATCH1, @@ -1581,12 +1581,12 @@ static const char* RID_SVXSTR_TRASNGR_DEF[] = RID_SVXSTR_TRASNGR0_DEF }; -static const char* RID_SVXSTR_TRASNGR[] = +const TranslateId RID_SVXSTR_TRASNGR[] = { RID_SVXSTR_TRASNGR0 }; -static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const char**& pApiResIds, const char**& pIntResIds, int& nCount ) noexcept +static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const char**& pApiResIds, const TranslateId*& pIntResIds, int& nCount ) noexcept { switch( nWhich ) { @@ -1633,7 +1633,7 @@ static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const char**& pApi } /// @throws std::exception -static bool SvxUnoConvertResourceString(const char **pSourceResIds, const char** pDestResIds, int nCount, OUString& rString, bool bToApi) +static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, const char** pDestResIds, int nCount, OUString& rString) { // first, calculate the search string length without an optional number after the name sal_Int32 nLength = rString.getLength(); @@ -1663,39 +1663,67 @@ static bool SvxUnoConvertResourceString(const char **pSourceResIds, const char** for (int i = 0; i < nCount; ++i) { - if (bToApi) + const OUString & aCompare = SvxResId(pSourceResIds[i]); + if( aShortString == aCompare ) { - const OUString & aCompare = SvxResId(pSourceResIds[i]); - if( aShortString == aCompare ) - { - rString = rString.replaceAt( 0, aShortString.getLength(), OUString::createFromAscii(pDestResIds[i]) ); - return true; - } - else if( rString == aCompare ) - { - rString = OUString::createFromAscii(pDestResIds[i]); - return true; - } + rString = rString.replaceAt( 0, aShortString.getLength(), OUString::createFromAscii(pDestResIds[i]) ); + return true; } - else + else if( rString == aCompare ) { - auto pCompare = pSourceResIds[i]; - if( aShortString.equalsAscii(pCompare) ) - { - rString = rString.replaceAt( 0, aShortString.getLength(), SvxResId(pDestResIds[i]) ); - return true; - } - else if( rString.equalsAscii(pCompare) ) - { - rString = SvxResId(pDestResIds[i]); - return true; - } + rString = OUString::createFromAscii(pDestResIds[i]); + return true; } } return false; } +static bool SvxUnoConvertResourceStringFromApi(const char** pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) +{ + // first, calculate the search string length without an optional number after the name + sal_Int32 nLength = rString.getLength(); + while( nLength > 0 ) + { + const sal_Unicode nChar = rString[ nLength - 1 ]; + if( (nChar < '0') || (nChar > '9') ) + break; + + nLength--; + } + + // if we cut off a number, also cut of some spaces + if( nLength != rString.getLength() ) + { + while( nLength > 0 ) + { + const sal_Unicode nChar = rString[ nLength - 1 ]; + if( nChar != ' ' ) + break; + + nLength--; + } + } + + const OUString aShortString( rString.copy( 0, nLength ) ); + + for (int i = 0; i < nCount; ++i) + { + auto pCompare = pSourceResIds[i]; + if( aShortString.equalsAscii(pCompare) ) + { + rString = rString.replaceAt( 0, aShortString.getLength(), SvxResId(pDestResIds[i]) ); + return true; + } + else if( rString.equalsAscii(pCompare) ) + { + rString = SvxResId(pDestResIds[i]); + return true; + } + } + + return false; +} // #i122649# Some comments on the below arrays: // - They need to have the same order and count of items @@ -1812,7 +1840,7 @@ static const char* SvxUnoColorNameDefResId[] = RID_SVXSTR_COLOR_LIBRE_YELLOW_ACCENT_DEF }; -static const char* SvxUnoColorNameResId[] = +const TranslateId SvxUnoColorNameResId[] = { RID_SVXSTR_COLOR_BLUEGREY, RID_SVXSTR_COLOR_BLACK, @@ -1917,7 +1945,7 @@ static const char* SvxUnoColorNameResId[] = }; /// @throws std::exception -static bool SvxUnoConvertResourceStringBuiltIn(const char** pSourceResIds, const char** pDestResIds, int nCount, OUString& rString, bool bToApi) +static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceResIds, const char** pDestResIds, int nCount, OUString& rString) { //We replace e.g. "Gray 10%" with the translation of Gray, but we shouldn't //replace "Red Hat 1" with the translation of Red :-) @@ -1933,24 +1961,39 @@ static bool SvxUnoConvertResourceStringBuiltIn(const char** pSourceResIds, const for(int i = 0; i < nCount; ++i ) { - if (bToApi) + OUString aStrDefName = SvxResId(pSourceResIds[i]); + if( sStr == aStrDefName ) { - OUString aStrDefName = SvxResId(pSourceResIds[i]); - if( sStr == aStrDefName ) - { - OUString aReplace = OUString::createFromAscii(pDestResIds[i]); - rString = rString.replaceAt( 0, aStrDefName.getLength(), aReplace ); - return true; - } + OUString aReplace = OUString::createFromAscii(pDestResIds[i]); + rString = rString.replaceAt( 0, aStrDefName.getLength(), aReplace ); + return true; } - else + } + + return false; +} + +static bool SvxUnoConvertResourceStringBuiltInFromApi(const char** pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) +{ + //We replace e.g. "Gray 10%" with the translation of Gray, but we shouldn't + //replace "Red Hat 1" with the translation of Red :-) + sal_Int32 nLength = rString.getLength(); + while( nLength > 0 ) + { + const sal_Unicode nChar = rString[nLength-1]; + if (nChar != '%' && (nChar < '0' || nChar > '9')) + break; + nLength--; + } + OUString sStr = rString.copy(0, nLength).trim(); + + for(int i = 0; i < nCount; ++i ) + { + if( sStr.equalsAscii(pSourceResIds[i]) ) { - if( sStr.equalsAscii(pSourceResIds[i]) ) - { - OUString aReplace = SvxResId(pDestResIds[i]); - rString = rString.replaceAt( 0, strlen(pSourceResIds[i]), aReplace ); - return true; - } + OUString aReplace = SvxResId(pDestResIds[i]); + rString = rString.replaceAt( 0, strlen(pSourceResIds[i]), aReplace ); + return true; } } @@ -1966,7 +2009,7 @@ OUString SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString& rInter if( nWhich == sal_uInt16(XATTR_LINECOLOR) ) { - if (SvxUnoConvertResourceStringBuiltIn(SvxUnoColorNameResId, SvxUnoColorNameDefResId, SAL_N_ELEMENTS(SvxUnoColorNameResId), aNew, true)) + if (SvxUnoConvertResourceStringBuiltInToApi(SvxUnoColorNameResId, SvxUnoColorNameDefResId, SAL_N_ELEMENTS(SvxUnoColorNameResId), aNew)) { return aNew; } @@ -1974,12 +2017,12 @@ OUString SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString& rInter else { const char** pApiResIds; - const char** pIntResIds; + const TranslateId* pIntResIds; int nCount; if( SvxUnoGetResourceRanges(nWhich, pApiResIds, pIntResIds, nCount)) { - if (SvxUnoConvertResourceString(pIntResIds, pApiResIds, nCount, aNew, true)) + if (SvxUnoConvertResourceStringToApi(pIntResIds, pApiResIds, nCount, aNew)) { return aNew; } @@ -1999,7 +2042,7 @@ OUString SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString& r if( nWhich == sal_uInt16(XATTR_LINECOLOR) ) { - if (SvxUnoConvertResourceStringBuiltIn(SvxUnoColorNameDefResId, SvxUnoColorNameResId, SAL_N_ELEMENTS(SvxUnoColorNameResId), aNew, false)) + if (SvxUnoConvertResourceStringBuiltInFromApi(SvxUnoColorNameDefResId, SvxUnoColorNameResId, SAL_N_ELEMENTS(SvxUnoColorNameResId), aNew)) { return aNew; } @@ -2007,12 +2050,12 @@ OUString SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString& r else { const char** pApiResIds; - const char** pIntResIds; + const TranslateId* pIntResIds; int nCount; if (SvxUnoGetResourceRanges(nWhich, pApiResIds, pIntResIds, nCount)) { - if (SvxUnoConvertResourceString(pApiResIds, pIntResIds, nCount, aNew, false)) + if (SvxUnoConvertResourceStringFromApi(pApiResIds, pIntResIds, nCount, aNew)) { return aNew; } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 3057a8406038..fe9c280a62b2 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -125,7 +125,7 @@ NameOrIndex* NameOrIndex::Clone(SfxItemPool* /*pPool*/) const Argument pPool2 can be null. If returned string equals NameOrIndex->GetName(), the name was already unique. */ -OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, SvxCompareValueFunc pCompareValueFunc, const char* pPrefixResId, const XPropertyListRef &pDefaults ) +OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, SvxCompareValueFunc pCompareValueFunc, TranslateId pPrefixResId, const XPropertyListRef &pDefaults ) { bool bForceNew = false; @@ -354,7 +354,7 @@ bool XLineStyleItem::GetPresentation { rText.clear(); - const char* pId = nullptr; + TranslateId pId; switch( GetValue() ) { @@ -1756,7 +1756,7 @@ bool XFillStyleItem::GetPresentation { rText.clear(); - const char* pId = nullptr; + TranslateId pId; switch( GetValue() ) { diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx index f64230ef8134..30517283c748 100644 --- a/svx/source/xoutdev/xattr2.cxx +++ b/svx/source/xoutdev/xattr2.cxx @@ -101,7 +101,7 @@ bool XLineJointItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*e { rText.clear(); - const char* pId = nullptr; + TranslateId pId; switch( GetValue() ) { @@ -256,7 +256,7 @@ XLineCapItem* XLineCapItem::Clone(SfxItemPool* /*pPool*/) const bool XLineCapItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/, OUString& rText, const IntlWrapper&) const { - const char* pId; + TranslateId pId; switch( GetValue() ) { diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index b0f3e7ee49c3..97f0468f3ace 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <vcl/BitmapTools.hxx> #include <vcl/GraphicLoader.hxx> +#include <unotools/resmgr.hxx> #include <libxml/xmlwriter.h> |