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 /sc/source | |
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 'sc/source')
76 files changed, 118 insertions, 115 deletions
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 324c2c59c322..6bdee5cafc29 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -763,7 +763,7 @@ bool ScShrinkToFitCell::GetPresentation(SfxItemPresentation, OUString& rText, const IntlWrapper&) const { - const char* pId = GetValue() ? STR_SHRINKTOFITCELL_ON : STR_SHRINKTOFITCELL_OFF; + TranslateId pId = GetValue() ? STR_SHRINKTOFITCELL_ON : STR_SHRINKTOFITCELL_OFF; rText = ScResId(pId); return true; } @@ -783,7 +783,7 @@ bool ScVerticalStackCell::GetPresentation(SfxItemPresentation, OUString& rText, const IntlWrapper&) const { - const char* pId = GetValue() ? STR_VERTICALSTACKCELL_ON : STR_VERTICALSTACKCELL_OFF; + TranslateId pId = GetValue() ? STR_VERTICALSTACKCELL_ON : STR_VERTICALSTACKCELL_OFF; rText = ScResId(pId); return true; } @@ -803,7 +803,7 @@ bool ScLineBreakCell::GetPresentation(SfxItemPresentation, OUString& rText, const IntlWrapper&) const { - const char* pId = GetValue() ? STR_LINEBREAKCELL_ON : STR_LINEBREAKCELL_OFF; + TranslateId pId = GetValue() ? STR_LINEBREAKCELL_ON : STR_LINEBREAKCELL_OFF; rText = ScResId(pId); return true; } @@ -823,7 +823,7 @@ bool ScHyphenateCell::GetPresentation(SfxItemPresentation, OUString& rText, const IntlWrapper&) const { - const char* pId = GetValue() ? STR_HYPHENATECELL_ON : STR_HYPHENATECELL_OFF; + TranslateId pId = GetValue() ? STR_HYPHENATECELL_ON : STR_HYPHENATECELL_OFF; rText = ScResId(pId); return true; } diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx index fa9b2ded7d78..ec80ec3d664b 100644 --- a/sc/source/core/data/dpdimsave.cxx +++ b/sc/source/core/data/dpdimsave.cxx @@ -758,7 +758,7 @@ OUString ScDPDimensionSaveData::CreateGroupDimName( namespace { - const char* aDatePartIds[] = + const TranslateId aDatePartIds[] = { STR_DPFIELD_GROUP_BY_SECONDS, STR_DPFIELD_GROUP_BY_MINUTES, diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 287ccbcd36f3..ea0929f5a18d 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -3365,7 +3365,7 @@ public: } -const char* ScDPCollection::ReloadCache(const ScDPObject* pDPObj, o3tl::sorted_vector<ScDPObject*>& rRefs) +TranslateId ScDPCollection::ReloadCache(const ScDPObject* pDPObj, o3tl::sorted_vector<ScDPObject*>& rRefs) { if (!pDPObj) return STR_ERR_DATAPILOTSOURCE; @@ -3377,7 +3377,7 @@ const char* ScDPCollection::ReloadCache(const ScDPObject* pDPObj, o3tl::sorted_v if (!pDesc) return STR_ERR_DATAPILOTSOURCE; - const char* pErrId = pDesc->CheckSourceRange(); + TranslateId pErrId = pDesc->CheckSourceRange(); if (pErrId) return pErrId; @@ -3426,7 +3426,7 @@ const char* ScDPCollection::ReloadCache(const ScDPObject* pDPObj, o3tl::sorted_v GetAllTables(pDesc->GetCommandType(), pDesc->aDBName, pDesc->aObject, rRefs); } } - return nullptr; + return {}; } bool ScDPCollection::ReloadGroupsInCache(const ScDPObject* pDPObj, o3tl::sorted_vector<ScDPObject*>& rRefs) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index ca9b214b5605..ada646b361fc 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -284,7 +284,7 @@ void ScDPOutputImpl::OutputBlockFrame ( SCCOL nStartCol, SCROW nStartRow, SCCOL void lcl_SetStyleById(ScDocument* pDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const char* pStrId) + TranslateId pStrId) { if ( nCol1 > nCol2 || nRow1 > nRow2 ) { @@ -303,12 +303,12 @@ void lcl_SetStyleById(ScDocument* pDoc, SCTAB nTab, SfxStyleSearchBits::UserDefined ) ); pStyle->SetParent( ScResId(STR_STYLENAME_STANDARD) ); SfxItemSet& rSet = pStyle->GetItemSet(); - if (strcmp(pStrId, STR_PIVOT_STYLENAME_RESULT) == 0 || strcmp(pStrId, STR_PIVOT_STYLENAME_TITLE) == 0){ + if (pStrId == STR_PIVOT_STYLENAME_RESULT || pStrId == STR_PIVOT_STYLENAME_TITLE){ rSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) ); rSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_CJK_FONT_WEIGHT ) ); rSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_CTL_FONT_WEIGHT ) ); } - if (strcmp(pStrId, STR_PIVOT_STYLENAME_CATEGORY) == 0 || strcmp(pStrId, STR_PIVOT_STYLENAME_TITLE) == 0) + if (pStrId == STR_PIVOT_STYLENAME_CATEGORY || pStrId == STR_PIVOT_STYLENAME_TITLE) rSet.Put( SvxHorJustifyItem( SvxCellHorJustify::Left, ATTR_HOR_JUSTIFY ) ); } @@ -1483,7 +1483,7 @@ namespace { OUString lcl_GetDataFieldName( std::u16string_view rSourceName, sal_Int16 eFunc ) { - const char* pStrId = nullptr; + TranslateId pStrId; switch ( eFunc ) { case sheet::GeneralFunction2::SUM: pStrId = STR_FUN_TEXT_SUM; break; diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx index c15ba043fffe..36060b282d0c 100644 --- a/sc/source/core/data/dpshttab.cxx +++ b/sc/source/core/data/dpshttab.cxx @@ -283,7 +283,7 @@ const ScDPCache* ScSheetSourceDesc::CreateCache(const ScDPDimensionSaveData* pDi if (!mpDoc) return nullptr; - const char* pErrId = CheckSourceRange(); + TranslateId pErrId = CheckSourceRange(); if (pErrId) { OSL_FAIL( "Error Create Cache" ); @@ -303,7 +303,7 @@ const ScDPCache* ScSheetSourceDesc::CreateCache(const ScDPDimensionSaveData* pDi return rCaches.getCache(GetSourceRange(), pDimData); } -const char* ScSheetSourceDesc::CheckSourceRange() const +TranslateId ScSheetSourceDesc::CheckSourceRange() const { if (!mpDoc) return STR_ERR_DATAPILOTSOURCE; @@ -316,7 +316,7 @@ const char* ScSheetSourceDesc::CheckSourceRange() const if (rSrcRange.aStart.Col() > rSrcRange.aEnd.Col() || rSrcRange.aStart.Row() > rSrcRange.aEnd.Row()) return STR_ERR_DATAPILOTSOURCE; - return nullptr; + return {}; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 46311e3570a8..4c8f38c8e558 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -59,9 +59,9 @@ using ::com::sun::star::uno::Sequence; namespace { -const char* aFuncStrIds[] = // matching enum ScSubTotalFunc +const TranslateId aFuncStrIds[] = // matching enum ScSubTotalFunc { - nullptr, // SUBTOTAL_FUNC_NONE + {}, // SUBTOTAL_FUNC_NONE STR_FUN_TEXT_AVG, // SUBTOTAL_FUNC_AVE STR_FUN_TEXT_COUNT, // SUBTOTAL_FUNC_CNT STR_FUN_TEXT_COUNT, // SUBTOTAL_FUNC_CNT2 @@ -74,7 +74,7 @@ const char* aFuncStrIds[] = // matching enum ScSubTotalFunc STR_FUN_TEXT_VAR, // SUBTOTAL_FUNC_VAR STR_FUN_TEXT_VAR, // SUBTOTAL_FUNC_VARP STR_FUN_TEXT_MEDIAN, // SUBTOTAL_FUNC_MED - nullptr // SUBTOTAL_FUNC_SELECTION_COUNT - not used for pivot table + {} // SUBTOTAL_FUNC_SELECTION_COUNT - not used for pivot table }; bool lcl_SearchMember( const std::vector<std::unique_ptr<ScDPResultMember>>& list, SCROW nOrder, SCROW& rIndex) diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index 62d61a733055..07794c6c3a5d 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -362,8 +362,8 @@ sal_Int32 ScDPUtil::getDatePartValue( namespace { -const char* aFuncStrIds[] = { - nullptr, // SUBTOTAL_FUNC_NONE +const TranslateId aFuncStrIds[] = { + {}, // SUBTOTAL_FUNC_NONE STR_FUN_TEXT_AVG, // SUBTOTAL_FUNC_AVE STR_FUN_TEXT_COUNT, // SUBTOTAL_FUNC_CNT STR_FUN_TEXT_COUNT, // SUBTOTAL_FUNC_CNT2 @@ -376,7 +376,7 @@ const char* aFuncStrIds[] = { STR_FUN_TEXT_VAR, // SUBTOTAL_FUNC_VAR STR_FUN_TEXT_VAR, // SUBTOTAL_FUNC_VARP STR_FUN_TEXT_MEDIAN, // SUBTOTAL_FUNC_MED - nullptr // SUBTOTAL_FUNC_SELECTION_COUNT - not used for pivot table + {} // SUBTOTAL_FUNC_SELECTION_COUNT - not used for pivot table }; } @@ -384,7 +384,7 @@ const char* aFuncStrIds[] = { OUString ScDPUtil::getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc) { assert(unsigned(eFunc) < SAL_N_ELEMENTS(aFuncStrIds)); - const char* pId = aFuncStrIds[eFunc]; + TranslateId pId = aFuncStrIds[eFunc]; if (!pId) return rName; return ScResId(pId) + // function name diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index 4f3187d078e8..741b785e0869 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -49,7 +49,7 @@ struct ScFuncDescCore /* * Pointer to list of strings */ - const char** pResource; + const TranslateId* pResource; /* * Count of list of strings */ diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 8c18329ab67b..60f66f6fd97d 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -300,7 +300,7 @@ void ScGlobal::SetUserList( const ScUserList* pNewList ) OUString ScGlobal::GetErrorString(FormulaError nErr) { - const char* pErrNumber; + TranslateId pErrNumber; switch (nErr) { case FormulaError::NoRef: @@ -332,7 +332,7 @@ OUString ScGlobal::GetErrorString(FormulaError nErr) OUString ScGlobal::GetLongErrorString(FormulaError nErr) { - const char* pErrNumber; + TranslateId pErrNumber; switch (nErr) { case FormulaError::NONE: diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 48c05bcaa40d..b3af3c17ec73 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1914,7 +1914,7 @@ struct RowEntry } -static const char* lcl_GetSubTotalStrId(int id) +static TranslateId lcl_GetSubTotalStrId(int id) { switch ( id ) { @@ -2072,7 +2072,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) if (aOutString.isEmpty()) aOutString = ScResId( STR_EMPTYDATA ); aOutString += " "; - const char* pStrId = STR_TABLE_ERGEBNIS; + TranslateId pStrId = STR_TABLE_ERGEBNIS; if ( nResCount == 1 ) pStrId = lcl_GetSubTotalStrId(pResFunc[0]); aOutString += ScResId(pStrId); diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 9e88957575b4..7430eff33c91 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -563,7 +563,7 @@ void ScAutoFormatData::GetFromItemSet( sal_uInt16 nIndex, const SfxItemSet& rIte rField.SetRotateMode ( rItemSet.Get( ATTR_ROTATE_MODE ) ); } -static const char* RID_SVXSTR_TBLAFMT[] = +const TranslateId RID_SVXSTR_TBLAFMT[] = { RID_SVXSTR_TBLAFMT_3D, RID_SVXSTR_TBLAFMT_BLACK1, diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index d68009446dcc..24da3d93cc3a 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -671,7 +671,7 @@ void ScChangeActionIns::GetDescription( { ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning ); - const char* pWhatId; + TranslateId pWhatId; switch ( GetType() ) { case SC_CAT_INSERT_COLS : @@ -905,7 +905,7 @@ void ScChangeActionDel::GetDescription( { ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning ); - const char* pWhatId; + TranslateId pWhatId; switch ( GetType() ) { case SC_CAT_DELETE_COLS : diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 8156b4579499..53a95144b3fc 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -870,7 +870,7 @@ OUString lclGetDataFieldCaption( std::u16string_view rFieldName, ScGeneralFuncti { OUString aCaption; - const char* pResIdx = nullptr; + TranslateId pResIdx; switch( eFunc ) { case ScGeneralFunction::SUM: pResIdx = STR_FUN_TEXT_SUM; break; diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx index 89301c14da56..3b84e84924dd 100644 --- a/sc/source/filter/ftools/fprogressbar.cxx +++ b/sc/source/filter/ftools/fprogressbar.cxx @@ -42,7 +42,7 @@ ScfProgressBar::ScfProgressBar( SfxObjectShell* pDocShell, const OUString& rText Init( pDocShell ); } -ScfProgressBar::ScfProgressBar(SfxObjectShell* pDocShell, const char* pResId) +ScfProgressBar::ScfProgressBar(SfxObjectShell* pDocShell, TranslateId pResId) : maText(ScResId(pResId)) { Init( pDocShell ); @@ -200,7 +200,7 @@ ScfSimpleProgressBar::ScfSimpleProgressBar( std::size_t nSize, SfxObjectShell* p Init( nSize ); } -ScfSimpleProgressBar::ScfSimpleProgressBar(std::size_t nSize, SfxObjectShell* pDocShell, const char* pResId) +ScfSimpleProgressBar::ScfSimpleProgressBar(std::size_t nSize, SfxObjectShell* pDocShell, TranslateId pResId) : maProgress(pDocShell, pResId) { Init( nSize ); diff --git a/sc/source/filter/inc/fprogressbar.hxx b/sc/source/filter/inc/fprogressbar.hxx index e5ae8aaf5d6c..71baa3766edf 100644 --- a/sc/source/filter/inc/fprogressbar.hxx +++ b/sc/source/filter/inc/fprogressbar.hxx @@ -23,6 +23,7 @@ #include <memory> #include <rtl/ustring.hxx> #include <progress.hxx> +#include <unotools/resmgr.hxx> class SfxObjectShell; class SvStream; @@ -105,7 +106,7 @@ public: const ScfProgressBar operator=(const ScfProgressBar&) = delete; explicit ScfProgressBar(SfxObjectShell* pDocShell, const OUString& rText); - explicit ScfProgressBar(SfxObjectShell* pDocShell, const char* pResId); + explicit ScfProgressBar(SfxObjectShell* pDocShell, TranslateId pResId); ~ScfProgressBar(); /** Adds a new segment to the progress bar. @@ -186,7 +187,7 @@ class ScfSimpleProgressBar { public: explicit ScfSimpleProgressBar(std::size_t nSize, SfxObjectShell* pDocShell, const OUString& rText); - explicit ScfSimpleProgressBar(std::size_t nSize, SfxObjectShell* pDocShell, const char* pResId); + explicit ScfSimpleProgressBar(std::size_t nSize, SfxObjectShell* pDocShell, TranslateId pResId); /** Set progress bar to the specified position. */ void ProgressAbs( std::size_t nPos ) { maProgress.ProgressAbs( nPos ); } diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx index 9c59007314af..f6871ccffa46 100644 --- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx @@ -22,7 +22,7 @@ namespace { struct StatisticCalculation { - const char* aLabelId; + TranslateId aLabelId; const char* aFormula; const char* aResultRangeName; }; @@ -34,10 +34,10 @@ StatisticCalculation const lclBasicStatistics[] = { STRID_CALC_SUM, "=SUM(%RANGE%)", "SUM_RANGE" }, { STRID_CALC_MEAN, "=AVERAGE(%RANGE%)", "MEAN_RANGE" }, { STRID_CALC_VARIANCE, "=VAR(%RANGE%)", "VAR_RANGE" }, - { nullptr, nullptr, nullptr } + { {}, nullptr, nullptr } }; -const char* lclAnovaLabels[] = +const TranslateId lclAnovaLabels[] = { STR_ANOVA_LABEL_SOURCE_OF_VARIATION, STR_ANOVA_LABEL_SS, @@ -46,7 +46,7 @@ const char* lclAnovaLabels[] = STR_ANOVA_LABEL_F, STR_ANOVA_LABEL_P_VALUE, STR_ANOVA_LABEL_F_CRITICAL, - nullptr + {} }; constexpr OUStringLiteral strWildcardRange = u"%RANGE%"; @@ -116,7 +116,7 @@ void ScAnalysisOfVarianceDialog::Close() DoClose( ScAnalysisOfVarianceDialogWrapper::GetChildWindowId() ); } -const char* ScAnalysisOfVarianceDialog::GetUndoNameId() +TranslateId ScAnalysisOfVarianceDialog::GetUndoNameId() { return STR_ANALYSIS_OF_VARIANCE_UNDO_NAME; } @@ -164,7 +164,7 @@ void ScAnalysisOfVarianceDialog::RowColumn(ScRangeList& rRangeList, AddressWalke } else { - const char* pLabelId = (aGroupedBy == BY_COLUMN) ? STR_COLUMN_LABEL_TEMPLATE : STR_ROW_LABEL_TEMPLATE; + TranslateId pLabelId = (aGroupedBy == BY_COLUMN) ? STR_COLUMN_LABEL_TEMPLATE : STR_ROW_LABEL_TEMPLATE; OUString aLabelTemplate(ScResId(pLabelId)); for (size_t i = 0; i < rRangeList.size(); i++) diff --git a/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx b/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx index 7fb2d50d7dee..cfcf53699df9 100644 --- a/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx @@ -32,7 +32,7 @@ void ScChiSquareTestDialog::Close() DoClose(ScChiSquareTestDialogWrapper::GetChildWindowId()); } -const char* ScChiSquareTestDialog::GetUndoNameId() +TranslateId ScChiSquareTestDialog::GetUndoNameId() { return STR_CHI_SQUARE_TEST; } diff --git a/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx index 7abff79dc571..b2849d316c37 100644 --- a/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx @@ -21,7 +21,7 @@ ScCovarianceDialog::ScCovarianceDialog( "modules/scalc/ui/covariancedialog.ui", "CovarianceDialog") {} -const char* ScCovarianceDialog::GetUndoNameId() +TranslateId ScCovarianceDialog::GetUndoNameId() { return STR_COVARIANCE_UNDO_NAME; } diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx index ca2da6458860..0924278c50d9 100644 --- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx @@ -20,7 +20,7 @@ namespace { struct StatisticCalculation { - const char* aCalculationNameId; + TranslateId aCalculationNameId; const char* aFormula; }; @@ -41,7 +41,7 @@ const StatisticCalculation lclCalcDefinitions[] = { STRID_CALC_MAX, "=MAX(%RANGE%)"}, { STRID_CALC_SUM, "=SUM(%RANGE%)"}, { STRID_CALC_COUNT, "=COUNT(%RANGE%)" }, - { nullptr, nullptr } + { {}, nullptr } }; } @@ -63,7 +63,7 @@ void ScDescriptiveStatisticsDialog::Close() DoClose( ScDescriptiveStatisticsDialogWrapper::GetChildWindowId() ); } -const char* ScDescriptiveStatisticsDialog::GetUndoNameId() +TranslateId ScDescriptiveStatisticsDialog::GetUndoNameId() { return STR_DESCRIPTIVE_STATISTICS_UNDO_NAME; } diff --git a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx index df3aef026b50..1a87f5beb3cd 100644 --- a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx @@ -36,7 +36,7 @@ void ScExponentialSmoothingDialog::Close() DoClose( ScExponentialSmoothingDialogWrapper::GetChildWindowId() ); } -const char* ScExponentialSmoothingDialog::GetUndoNameId() +TranslateId ScExponentialSmoothingDialog::GetUndoNameId() { return STR_EXPONENTIAL_SMOOTHING_UNDO_NAME; } diff --git a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx index d7b86bc4869f..76b2bade62db 100644 --- a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx @@ -34,7 +34,7 @@ void ScFTestDialog::Close() DoClose( ScFTestDialogWrapper::GetChildWindowId() ); } -const char* ScFTestDialog::GetUndoNameId() +TranslateId ScFTestDialog::GetUndoNameId() { return STR_FTEST_UNDO_NAME; } diff --git a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx index 69da12adc126..13e622963f5b 100644 --- a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx @@ -49,7 +49,7 @@ void ScFourierAnalysisDialog::Close() DoClose(ScFourierAnalysisDialogWrapper::GetChildWindowId()); } -const char* ScFourierAnalysisDialog::GetUndoNameId() { return STR_FOURIER_ANALYSIS; } +TranslateId ScFourierAnalysisDialog::GetUndoNameId() { return STR_FOURIER_ANALYSIS; } ScRange ScFourierAnalysisDialog::ApplyOutput(ScDocShell* pDocShell) { diff --git a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx index 1b26119f8893..4345b816bb96 100644 --- a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx +++ b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx @@ -50,7 +50,7 @@ ScMatrixComparisonGenerator::ScMatrixComparisonGenerator( ScMatrixComparisonGenerator::~ScMatrixComparisonGenerator() {} -const char* ScMatrixComparisonGenerator::GetUndoNameId() +TranslateId ScMatrixComparisonGenerator::GetUndoNameId() { return STR_CORRELATION_UNDO_NAME; } diff --git a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx index 813378cab952..9d990ed5a406 100644 --- a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx @@ -37,7 +37,7 @@ void ScMovingAverageDialog::Close() DoClose( ScMovingAverageDialogWrapper::GetChildWindowId() ); } -const char* ScMovingAverageDialog::GetUndoNameId() +TranslateId ScMovingAverageDialog::GetUndoNameId() { return STR_MOVING_AVERAGE_UNDO_NAME; } diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index 3aa6b93626ee..91b43cbe0433 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -250,7 +250,7 @@ void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers() } template<class RNG> -void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG& randomGenerator, const char* pDistributionStringId, std::optional<sal_Int8> aDecimalPlaces) +void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG& randomGenerator, TranslateId pDistributionStringId, std::optional<sal_Int8> aDecimalPlaces) { OUString aUndo = ScResId(STR_UNDO_DISTRIBUTION_TEMPLATE); OUString aDistributionName = ScResId(pDistributionStringId); diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx index 5a4002f97d62..fb4342444e95 100644 --- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx @@ -103,7 +103,7 @@ namespace POWER }; - const char* constRegressionModel[] = + const TranslateId constRegressionModel[] = { STR_LABEL_LINEAR, STR_LABEL_LOGARITHMIC, @@ -167,7 +167,7 @@ void ScRegressionDialog::Close() DoClose(ScRegressionDialogWrapper::GetChildWindowId()); } -const char* ScRegressionDialog::GetUndoNameId() +TranslateId ScRegressionDialog::GetUndoNameId() { return STR_REGRESSION_UNDO_NAME; } @@ -396,7 +396,7 @@ void ScRegressionDialog::WriteRegressionStatistics(AddressWalkerWriter& rOutput, rOutput.writeString(ScResId(STR_LABEL_REGRESSION_STATISTICS)); rOutput.newLine(); - const char* aMeasureNames[] = + const TranslateId aMeasureNames[] = { STR_LABEL_RSQUARED, STRID_CALC_STD_ERROR, diff --git a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx index 9788fc192d4d..864d4ac4f6c2 100644 --- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx @@ -34,7 +34,7 @@ void ScTTestDialog::Close() DoClose( ScTTestDialogWrapper::GetChildWindowId() ); } -const char* ScTTestDialog::GetUndoNameId() +TranslateId ScTTestDialog::GetUndoNameId() { return STR_TTEST_UNDO_NAME; } diff --git a/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx b/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx index 2421b3ef19f7..a1731fa8f055 100644 --- a/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx @@ -34,7 +34,7 @@ void ScZTestDialog::Close() DoClose( ScZTestDialogWrapper::GetChildWindowId() ); } -const char* ScZTestDialog::GetUndoNameId() +TranslateId ScZTestDialog::GetUndoNameId() { return STR_ZTEST_UNDO_NAME; } diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index b3e644fc8620..1dea0d05109e 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2375,7 +2375,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn // whether it's part of an array or not or whether explicit cell // activation is requested (double-click or F2) or a click in input // line. - bool bShowError = (!bInputActivated || !aTester.GetMessageId() || strcmp(aTester.GetMessageId(), STR_PROTECTIONERR) != 0) && + bool bShowError = (!bInputActivated || !aTester.GetMessageId() || aTester.GetMessageId() != STR_PROTECTIONERR) && !pActiveViewSh->GetViewData().GetDocShell()->IsReadOnly(); if (bShowError) { diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 7aa3084fe84e..252e2f21a745 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2438,7 +2438,7 @@ IMPL_LINK_NOARG(ScPosWnd, ModifyHdl, weld::ComboBox&, void) // determine the action that would be taken for the current input ScNameInputType eType = lcl_GetInputType(m_xWidget->get_active_text()); // uses current view - const char* pStrId = nullptr; + TranslateId pStrId; switch ( eType ) { case SC_NAME_INPUT_CELL: @@ -2523,7 +2523,7 @@ void ScPosWnd::DoEnter() ScNameInputType eType = lcl_GetInputType( aText ); if ( eType == SC_NAME_INPUT_BAD_NAME || eType == SC_NAME_INPUT_BAD_SELECTION ) { - const char* pId = (eType == SC_NAME_INPUT_BAD_NAME) ? STR_NAME_ERROR_NAME : STR_NAME_ERROR_SELECTION; + TranslateId pId = (eType == SC_NAME_INPUT_BAD_NAME) ? STR_NAME_ERROR_NAME : STR_NAME_ERROR_SELECTION; pViewSh->ErrorMessage(pId); } else if ( eType == SC_NAME_INPUT_DEFINE ) diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 2dbebc32f675..b7f58002f71b 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -86,14 +86,14 @@ #include <filter.hxx> #include <scabstdlg.hxx> -OUString ScResId(std::string_view aId) +OUString ScResId(TranslateId aId) { return Translate::get(aId, SC_MOD()->GetResLocale()); } -OUString ScResId(std::string_view aId, int nCardinality) +OUString ScResId(TranslateNId aContextSingularPlural, int nCardinality) { - return Translate::nget(aId, nCardinality, SC_MOD()->GetResLocale()); + return Translate::nget(aContextSingularPlural, nCardinality, SC_MOD()->GetResLocale()); } void ScDLL::Init() diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index b595b6f8d157..00509b7e2559 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -103,7 +103,7 @@ OUString getExpression(sal_Int32 nIndex) OUString getDateString(sal_Int32 nIndex) { - const char* aCondStrs[] = + const TranslateId aCondStrs[] = { STR_COND_TODAY, STR_COND_YESTERDAY, diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index 39357771105d..05a9428eda5e 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -441,7 +441,7 @@ void ScPivotLayoutDialog::UpdateSourceRange() return; aSourceSheet.SetSourceRange(aSourceRange); - if (aSourceSheet.CheckSourceRange() != nullptr) + if (aSourceSheet.CheckSourceRange()) { mxSourceEdit->SetRefValid(false); return; diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index 0e5b5bfd4021..a894a03d14c4 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -25,7 +25,7 @@ namespace OUString lclGetFunctionMaskName(const PivotFunc nFunctionMask) { - const char* pStrId = nullptr; + TranslateId pStrId; switch (nFunctionMask) { case PivotFunc::Sum: pStrId = STR_FUN_TEXT_SUM; break; diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx index 3c63a9f14692..a4d02ac792b4 100644 --- a/sc/source/ui/dbgui/consdlg.cxx +++ b/sc/source/ui/dbgui/consdlg.cxx @@ -38,7 +38,7 @@ namespace { - void INFOBOX(weld::Window* pWindow, const char* id) + void INFOBOX(weld::Window* pWindow, TranslateId id) { std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow, VclMessageType::Info, VclButtonsType::Ok, diff --git a/sc/source/ui/dbgui/dpgroupdlg.cxx b/sc/source/ui/dbgui/dpgroupdlg.cxx index 4846a9c48aed..550695cc3199 100644 --- a/sc/source/ui/dbgui/dpgroupdlg.cxx +++ b/sc/source/ui/dbgui/dpgroupdlg.cxx @@ -43,7 +43,7 @@ const sal_Int32 spnDateParts[] = css::sheet::DataPilotFieldGroupBy::YEARS }; -const char* aDatePartResIds[] = +const TranslateId aDatePartResIds[] = { STR_DPFIELD_GROUP_BY_SECONDS, STR_DPFIELD_GROUP_BY_MINUTES, diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 4f47e4e940a1..030741e3e2bc 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -40,7 +40,7 @@ namespace { - void ERRORBOX(weld::Window* pParent, const char* rid) + void ERRORBOX(weld::Window* pParent, TranslateId rid) { std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::Ok, diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 6c374e1b09a3..b53d5842446c 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1640,7 +1640,7 @@ void ScDBDocFunc::RefreshPivotTables(const ScDPObject* pDPObj, bool bApi) return; o3tl::sorted_vector<ScDPObject*> aRefs; - const char* pErrId = pDPs->ReloadCache(pDPObj, aRefs); + TranslateId pErrId = pDPs->ReloadCache(pDPObj, aRefs); if (pErrId) return; diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 2d8f7dce8ddb..42b20f3d2cb5 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -142,7 +142,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, bool bSuccess = false; bool bTruncated = false; // for warning - const char* pErrStringId = nullptr; + TranslateId pErrStringId; OUString aErrorMessage; SCCOL nCol = rParam.nCol1; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 2133ee93bd6e..ac011281dd36 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5751,7 +5751,7 @@ void ScDocFunc::ConvertFormulaToValue( const ScRange& rRange, bool bInteraction aModificator.SetDocumentModified(); } -void ScDocFunc::EnterListAction(const char* pNameResId) +void ScDocFunc::EnterListAction(TranslateId pNameResId) { OUString aUndo(ScResId(pNameResId)); ViewShellId nViewShellId(-1); diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 08ac3b5f0fe0..3afc8c5b4fa5 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -67,7 +67,7 @@ using ::std::vector; // former viewfunc/dbfunc methods -void ScDocShell::ErrorMessage(const char* pGlobStrId) +void ScDocShell::ErrorMessage(TranslateId pGlobStrId) { //! StopMarking at the (active) view? @@ -75,7 +75,7 @@ void ScDocShell::ErrorMessage(const char* pGlobStrId) weld::WaitObject aWaitOff( pParent ); bool bFocus = pParent && pParent->has_focus(); - if (pGlobStrId && strcmp(pGlobStrId, STR_PROTECTIONERR) == 0) + if (pGlobStrId && pGlobStrId == STR_PROTECTIONERR) { if (IsReadOnly()) { diff --git a/sc/source/ui/docshell/editable.cxx b/sc/source/ui/docshell/editable.cxx index 1de616790124..86bbb9f2e004 100644 --- a/sc/source/ui/docshell/editable.cxx +++ b/sc/source/ui/docshell/editable.cxx @@ -149,10 +149,10 @@ void ScEditableTester::TestBlockForAction( } } -const char* ScEditableTester::GetMessageId() const +TranslateId ScEditableTester::GetMessageId() const { if (mbIsEditable) - return nullptr; + return {}; else if (mbOnlyMatrix) return STR_MATRIXFRAGMENTERR; else diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx index 6e9056027009..c112617652b4 100644 --- a/sc/source/ui/drawfunc/fuconrec.cxx +++ b/sc/source/ui/drawfunc/fuconrec.cxx @@ -56,7 +56,7 @@ FuConstRectangle::~FuConstRectangle() namespace { -::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel) +::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel& rModel) { ::basegfx::B2DPolyPolygon aRetval; XLineEndListRef pLineEndList(rModel.GetLineEndList()); diff --git a/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx index 675cc422e1e6..35c53e72778f 100644 --- a/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx +++ b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx @@ -54,7 +54,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/ChiSquareTestDialog.hxx b/sc/source/ui/inc/ChiSquareTestDialog.hxx index 584035c8e83c..20e7d696c95f 100644 --- a/sc/source/ui/inc/ChiSquareTestDialog.hxx +++ b/sc/source/ui/inc/ChiSquareTestDialog.hxx @@ -24,7 +24,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/CovarianceDialog.hxx b/sc/source/ui/inc/CovarianceDialog.hxx index ae30b34e086b..181bebeac154 100644 --- a/sc/source/ui/inc/CovarianceDialog.hxx +++ b/sc/source/ui/inc/CovarianceDialog.hxx @@ -24,7 +24,7 @@ public: protected: virtual OUString getLabel() override; virtual OUString getTemplate() override; - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx b/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx index 9edd1329021e..dd2488450beb 100644 --- a/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx +++ b/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx @@ -24,7 +24,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/ExponentialSmoothingDialog.hxx b/sc/source/ui/inc/ExponentialSmoothingDialog.hxx index 0d425fdbc0a2..54b877167805 100644 --- a/sc/source/ui/inc/ExponentialSmoothingDialog.hxx +++ b/sc/source/ui/inc/ExponentialSmoothingDialog.hxx @@ -30,7 +30,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/FTestDialog.hxx b/sc/source/ui/inc/FTestDialog.hxx index f1a0467b24d0..efd477ce08bb 100644 --- a/sc/source/ui/inc/FTestDialog.hxx +++ b/sc/source/ui/inc/FTestDialog.hxx @@ -24,7 +24,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/FourierAnalysisDialog.hxx b/sc/source/ui/inc/FourierAnalysisDialog.hxx index ab9507e31c49..f839b274e4d8 100644 --- a/sc/source/ui/inc/FourierAnalysisDialog.hxx +++ b/sc/source/ui/inc/FourierAnalysisDialog.hxx @@ -41,7 +41,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; virtual bool InputRangesValid() override; diff --git a/sc/source/ui/inc/MatrixComparisonGenerator.hxx b/sc/source/ui/inc/MatrixComparisonGenerator.hxx index e68d60772035..058b9611a758 100644 --- a/sc/source/ui/inc/MatrixComparisonGenerator.hxx +++ b/sc/source/ui/inc/MatrixComparisonGenerator.hxx @@ -26,7 +26,7 @@ public: virtual ~ScMatrixComparisonGenerator() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; virtual OUString getLabel() = 0; diff --git a/sc/source/ui/inc/MovingAverageDialog.hxx b/sc/source/ui/inc/MovingAverageDialog.hxx index fe03e2631d08..216b67c8b400 100644 --- a/sc/source/ui/inc/MovingAverageDialog.hxx +++ b/sc/source/ui/inc/MovingAverageDialog.hxx @@ -31,7 +31,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx index 40a457732909..0f890fc79936 100644 --- a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx +++ b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx @@ -62,7 +62,7 @@ private: template<class RNG> - void GenerateNumbers(RNG& randomGenerator, const char* pDistributionStringId, const std::optional<sal_Int8> aDecimalPlaces); + void GenerateNumbers(RNG& randomGenerator, TranslateId pDistributionStringId, const std::optional<sal_Int8> aDecimalPlaces); void SelectGeneratorAndGenerateNumbers(); diff --git a/sc/source/ui/inc/RegressionDialog.hxx b/sc/source/ui/inc/RegressionDialog.hxx index cab704d96384..59accf265c3b 100644 --- a/sc/source/ui/inc/RegressionDialog.hxx +++ b/sc/source/ui/inc/RegressionDialog.hxx @@ -40,7 +40,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; virtual bool InputRangesValid() override; diff --git a/sc/source/ui/inc/StatisticsInputOutputDialog.hxx b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx index 6f35e75472ea..2de05951b3ab 100644 --- a/sc/source/ui/inc/StatisticsInputOutputDialog.hxx +++ b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx @@ -37,7 +37,7 @@ protected: void CalculateInputAndWriteToOutput(); virtual ScRange ApplyOutput(ScDocShell* pDocShell) = 0; - virtual const char* GetUndoNameId() = 0; + virtual TranslateId GetUndoNameId() = 0; virtual bool InputRangesValid(); void ValidateDialogInput(); diff --git a/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx b/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx index 8ac10b3c42df..3b1d5e46781f 100644 --- a/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx +++ b/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx @@ -36,7 +36,7 @@ protected: void CalculateInputAndWriteToOutput(); virtual ScRange ApplyOutput(ScDocShell* pDocShell) = 0; - virtual const char* GetUndoNameId() = 0; + virtual TranslateId GetUndoNameId() = 0; virtual bool InputRangesValid(); void ValidateDialogInput(); diff --git a/sc/source/ui/inc/TTestDialog.hxx b/sc/source/ui/inc/TTestDialog.hxx index 1cfa7475c2d1..0ed370dce2d4 100644 --- a/sc/source/ui/inc/TTestDialog.hxx +++ b/sc/source/ui/inc/TTestDialog.hxx @@ -24,7 +24,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/ZTestDialog.hxx b/sc/source/ui/inc/ZTestDialog.hxx index c9b62603ca48..2476c38f32a7 100644 --- a/sc/source/ui/inc/ZTestDialog.hxx +++ b/sc/source/ui/inc/ZTestDialog.hxx @@ -24,7 +24,7 @@ public: virtual void Close() override; protected: - virtual const char* GetUndoNameId() override; + virtual TranslateId GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; }; diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 43839eb94d21..4a8cad6dc9d6 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -23,6 +23,7 @@ #include <global.hxx> #include <formula/grammar.hxx> #include <tabbgcolor.hxx> +#include <unotools/resmgr.hxx> #include <memory> #include <vector> @@ -73,7 +74,7 @@ public: void NotifyDrawUndo(std::unique_ptr<SdrUndoAction>); // for grouping multiple operations into one with a new name - void EnterListAction(const char* pNameResId); + void EnterListAction(TranslateId pNameResId); void EndListAction(); bool DetectiveAddPred(const ScAddress& rPos); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 57f172ef2b5e..83cd3a20857e 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -259,7 +259,7 @@ public: void DoAutoStyle( const ScRange& rRange, const OUString& rStyle ); static weld::Window* GetActiveDialogParent(); - void ErrorMessage(const char* pGlobStrId); + void ErrorMessage(TranslateId pGlobStrId); bool IsEditable() const; bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ); diff --git a/sc/source/ui/inc/editable.hxx b/sc/source/ui/inc/editable.hxx index e03a1235743a..1c229a1b11ef 100644 --- a/sc/source/ui/inc/editable.hxx +++ b/sc/source/ui/inc/editable.hxx @@ -20,6 +20,7 @@ #pragma once #include <address.hxx> +#include <unotools/resmgr.hxx> class ScDocument; class ScViewFunc; @@ -82,7 +83,7 @@ public: bool IsEditable() const { return mbIsEditable; } bool IsFormatEditable() const { return mbIsEditable || mbOnlyMatrix; } - const char* GetMessageId() const; + TranslateId GetMessageId() const; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 93cedfee36ec..0bdc143d3e62 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -576,7 +576,7 @@ public: void SplitAtPixel( const Point& rPixel ); void InvalidateSplit(); - void ErrorMessage(const char* pGlobStrId); + void ErrorMessage(TranslateId pGlobStrId); void EnableRefInput(bool bFlag); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index d477fef62439..a5d464821f12 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -163,7 +163,7 @@ ScContentTree::~ScContentTree() } } -static const char* SCSTR_CONTENT_ARY[] = +const TranslateId SCSTR_CONTENT_ARY[] = { SCSTR_CONTENT_ROOT, SCSTR_CONTENT_TABLE, diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index e90f32408fcd..2c52fcdd868d 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -51,7 +51,7 @@ enum { namespace { - void ERRORBOX(weld::Window* pParent, const char* rId) + void ERRORBOX(weld::Window* pParent, TranslateId rId) { std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::Ok, diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 6706b19adc0b..438cacb4884d 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1986,7 +1986,7 @@ ScUndoIndent::~ScUndoIndent() OUString ScUndoIndent::GetComment() const { - const char* pId = bIsIncrement ? STR_UNDO_INC_INDENT : STR_UNDO_DEC_INDENT; + TranslateId pId = bIsIncrement ? STR_UNDO_INC_INDENT : STR_UNDO_DEC_INDENT; return ScResId(pId); } diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 583e2dd4e832..8323cd824612 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -893,7 +893,7 @@ ScUndoDetective::~ScUndoDetective() OUString ScUndoDetective::GetComment() const { - const char* pId = STR_UNDO_DETDELALL; + TranslateId pId = STR_UNDO_DETDELALL; if ( !bIsDelete ) switch ( static_cast<ScDetOpType>(nAction) ) { diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index cd92934d1b6c..5f6578f71ff1 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -1419,7 +1419,7 @@ ScUndoDataPilot::ScUndoDataPilot( ScDocShell* pNewDocShell, OUString ScUndoDataPilot::GetComment() const { - const char* pResId; + TranslateId pResId; if (xOldUndoDoc && xNewUndoDoc) pResId = STR_UNDO_PIVOT_MODIFY; else if (xNewUndoDoc) diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx index 9596edb07a01..f110d0190051 100644 --- a/sc/source/ui/undo/undostyl.cxx +++ b/sc/source/ui/undo/undostyl.cxx @@ -83,7 +83,7 @@ ScUndoModifyStyle::~ScUndoModifyStyle() OUString ScUndoModifyStyle::GetComment() const { - const char* pId = (eFamily == SfxStyleFamily::Para) ? + TranslateId pId = (eFamily == SfxStyleFamily::Para) ? STR_UNDO_EDITCELLSTYLE : STR_UNDO_EDITPAGESTYLE; return ScResId(pId); diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index e0def882cea6..28f8188b34b0 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -1138,7 +1138,7 @@ bool ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const OUString ScUndoShowHideTab::GetComment() const { - const char* pId; + TranslateId pId; if (undoTabs.size() > 1) { pId = bShow ? STR_UNDO_SHOWTABS : STR_UNDO_HIDETABS; @@ -1214,7 +1214,7 @@ bool ScUndoDocProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const OUString ScUndoDocProtect::GetComment() const { - const char* pId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC; + TranslateId pId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC; return ScResId(pId); } @@ -1284,7 +1284,7 @@ bool ScUndoTabProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const OUString ScUndoTabProtect::GetComment() const { - const char* pId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB; + TranslateId pId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB; return ScResId(pId); } diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index dfbee4752ae7..98568aa82994 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -894,7 +894,7 @@ uno::Any SAL_CALL ScStyleFamilyObj::getPropertyValue( const OUString& sPropertyN } SolarMutexGuard aGuard; - const char* pResId = nullptr; + TranslateId pResId; switch ( eFamily ) { case SfxStyleFamily::Para: diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx index 35e695451ce1..b7ecd021f369 100644 --- a/sc/source/ui/unoobj/targuno.cxx +++ b/sc/source/ui/unoobj/targuno.cxx @@ -43,7 +43,7 @@ using namespace ::com::sun::star; -static const char* aTypeResIds[SC_LINKTARGETTYPE_COUNT] = +const TranslateId aTypeResIds[SC_LINKTARGETTYPE_COUNT] = { SCSTR_CONTENT_TABLE, // SC_LINKTARGETTYPE_SHEET SCSTR_CONTENT_RANGENAME, // SC_LINKTARGETTYPE_RANGENAME diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index fa0b55d75e66..972fe5675f54 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -3016,7 +3016,7 @@ void RunPivotLayoutDialog(ScModule* pScMod, void SetupRangeForPivotTableDialog(const ScRange& rRange, ScAddress& rDestPos, ScDocument* pDoc, - const char* pSrcErrorId, + TranslateId pSrcErrorId, std::unique_ptr<ScDPObject>& pNewDPObject) { ScSheetSourceDesc aShtDesc(pDoc); @@ -3035,7 +3035,7 @@ void SetupRangeForPivotTableDialog(const ScRange& rRange, rRange.aStart.Tab() ); } -void ErrorOrRunPivotLayoutDialog(const char* pSrcErrorId, +void ErrorOrRunPivotLayoutDialog(TranslateId pSrcErrorId, ScAddress& rDestPos, ScModule* pScMod, ScTabViewShell* pTabViewShell, @@ -3171,7 +3171,7 @@ void ScCellShell::ExecuteDataPilotDialog() } else { - const char* pSrcErrorId = nullptr; + TranslateId pSrcErrorId; if (pTypeDlg->IsNamedRange()) { diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 8258b52d6846..31a922ff0613 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -1395,7 +1395,7 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const OUString& rString ) return; } - const char* pErrorId = nullptr; + TranslateId pErrorId; pDPObj->BuildAllDimensionMembers(); ScDPSaveData aData( *pDPObj->GetSaveData() ); diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 0ec66ee6eb3c..ecfcd036c750 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1410,7 +1410,7 @@ void ScTabView::MakeDrawLayer() } } -void ScTabView::ErrorMessage(const char* pGlobStrId) +void ScTabView::ErrorMessage(TranslateId pGlobStrId) { if ( SC_MOD()->IsInExecuteDrop() ) { @@ -1424,7 +1424,7 @@ void ScTabView::ErrorMessage(const char* pGlobStrId) weld::WaitObject aWaitOff( pParent ); bool bFocus = pParent && pParent->has_focus(); - if (pGlobStrId && strcmp(pGlobStrId, STR_PROTECTIONERR) == 0) + if (pGlobStrId && pGlobStrId == STR_PROTECTIONERR) { if (aViewData.GetDocShell()->IsReadOnly()) { diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 07c915ad7b7f..a3f06eb69e63 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -86,7 +86,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode ) return true; } - const char* pGlobStrId = nullptr; + TranslateId pGlobStrId; switch (eFunc) { case SUBTOTAL_FUNC_AVE: pGlobStrId = STR_FUN_TEXT_AVG; break; diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 4e5e149c9755..31e36774d187 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1773,7 +1773,7 @@ void ScViewFunc::DeleteMulti( bool bRows ) // test if allowed - const char* pErrorId = nullptr; + TranslateId pErrorId; bool bNeedRefresh = false; for (size_t i = 0, n = aSpans.size(); i < n && !pErrorId; ++i) { |