From 33ecd0d5c4fff9511a8436513936a3f7044a775a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 27 Aug 2020 11:40:59 +0200 Subject: Change OUStringLiteral from char[] to char16_t[] This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- .../WrappedAxisAndGridExistenceProperties.cxx | 4 +-- .../dialogs/ChartTypeDialogController.cxx | 20 +++++++------- chart2/source/controller/dialogs/DialogModel.cxx | 2 +- chart2/source/controller/dialogs/res_DataLabel.cxx | 2 +- chart2/source/controller/dialogs/tp_DataSource.cxx | 2 +- .../controller/main/ChartController_Window.cxx | 2 +- .../controller/sidebar/ChartColorWrapper.cxx | 4 +-- chart2/source/model/main/ChartModel.cxx | 4 +-- chart2/source/tools/ErrorBar.cxx | 32 +++++++++++----------- .../tools/ExponentialRegressionCurveCalculator.cxx | 2 +- chart2/source/view/main/ChartView.cxx | 4 +-- 11 files changed, 39 insertions(+), 39 deletions(-) (limited to 'chart2') diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx index 7b9d07f002bb..f69c7c20f5ec 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx @@ -342,14 +342,14 @@ WrappedAxisLabelExistenceProperty::WrappedAxisLabelExistenceProperty(bool bMain, switch( m_nDimensionIndex ) { case 0: - m_aOuterName = m_bMain ? OUStringLiteral("HasXAxisDescription") : OUStringLiteral("HasSecondaryXAxisDescription"); + m_aOuterName = m_bMain ? OUStringLiteral(u"HasXAxisDescription") : OUStringLiteral(u"HasSecondaryXAxisDescription"); break; case 2: OSL_ENSURE(m_bMain,"there is no description available for a secondary z axis"); m_aOuterName = "HasZAxisDescription"; break; default: - m_aOuterName = m_bMain ? OUStringLiteral("HasYAxisDescription") : OUStringLiteral("HasSecondaryYAxisDescription"); + m_aOuterName = m_bMain ? OUStringLiteral(u"HasYAxisDescription") : OUStringLiteral(u"HasSecondaryYAxisDescription"); break; } } diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 6153c03ede8f..7939fcf06c12 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -401,7 +401,7 @@ OUString ColumnChartDialogController::getName() OUString ColumnChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_COLUMN); + return OUStringLiteral(u"" BMP_TYPE_COLUMN); } const tTemplateServiceChartTypeParameterMap& ColumnChartDialogController::getTemplateMap() const @@ -478,7 +478,7 @@ OUString BarChartDialogController::getName() OUString BarChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_BAR); + return OUStringLiteral(u"" BMP_TYPE_BAR); } const tTemplateServiceChartTypeParameterMap& BarChartDialogController::getTemplateMap() const @@ -554,7 +554,7 @@ OUString PieChartDialogController::getName() OUString PieChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_PIE); + return OUStringLiteral(u"" BMP_TYPE_PIE); } const tTemplateServiceChartTypeParameterMap& PieChartDialogController::getTemplateMap() const @@ -620,7 +620,7 @@ OUString LineChartDialogController::getName() OUString LineChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_LINE); + return OUStringLiteral(u"" BMP_TYPE_LINE); } const tTemplateServiceChartTypeParameterMap& LineChartDialogController::getTemplateMap() const @@ -767,7 +767,7 @@ OUString XYChartDialogController::getName() OUString XYChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_XY); + return OUStringLiteral(u"" BMP_TYPE_XY); } const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplateMap() const @@ -870,7 +870,7 @@ OUString AreaChartDialogController::getName() OUString AreaChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_AREA); + return OUStringLiteral(u"" BMP_TYPE_AREA); } bool AreaChartDialogController::shouldShow_3DLookControl() const @@ -957,7 +957,7 @@ OUString NetChartDialogController::getName() OUString NetChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_NET); + return OUStringLiteral(u"" BMP_TYPE_NET); } bool NetChartDialogController::shouldShow_StackingControl() const @@ -1052,7 +1052,7 @@ OUString StockChartDialogController::getName() OUString StockChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_STOCK); + return OUStringLiteral(u"" BMP_TYPE_STOCK); } const tTemplateServiceChartTypeParameterMap& StockChartDialogController::getTemplateMap() const @@ -1097,7 +1097,7 @@ OUString CombiColumnLineChartDialogController::getName() OUString CombiColumnLineChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_COLUMN_LINE); + return OUStringLiteral(u"" BMP_TYPE_COLUMN_LINE); } const tTemplateServiceChartTypeParameterMap& CombiColumnLineChartDialogController::getTemplateMap() const @@ -1227,7 +1227,7 @@ OUString BubbleChartDialogController::getName() OUString BubbleChartDialogController::getImage() { - return OUStringLiteral(BMP_TYPE_BUBBLE); + return OUStringLiteral(u"" BMP_TYPE_BUBBLE); } const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTemplateMap() const diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index b8485a8b4c5b..6ee640a8ff3f 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -54,7 +54,7 @@ using ::com::sun::star::uno::Sequence; namespace { -const OUStringLiteral lcl_aLabelRole( "label" ); +const OUStringLiteral lcl_aLabelRole( u"label" ); struct lcl_ChartTypeToSeriesCnt { diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index bd71bf51240e..35f96f775e01 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -39,7 +39,7 @@ namespace chart namespace { -const OUStringLiteral our_aLBEntryMap[] = {" ", ", ", "; ", "\n", ". "}; +const OUStringLiteral our_aLBEntryMap[] = {u" ", u", ", u"; ", u"\n", u". "}; bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, sal_uInt16 nValueWhich, sal_uInt16 nSourceFormatWhich, sal_uLong& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut ) { diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index 4ef2c21483b3..99b24f47d5f4 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -46,7 +46,7 @@ using ::com::sun::star::uno::Sequence; namespace { -const OUStringLiteral lcl_aLabelRole( "label" ); +const OUStringLiteral lcl_aLabelRole( u"label" ); void lcl_UpdateCurrentRange(weld::TreeView& rOutListBox, const OUString & rRole, const OUString& rRange) diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index f41b18af994a..9e00bf784550 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1015,7 +1015,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) OUString aMenuName; if ( isShapeContext() ) // #i12587# support for shapes in chart - aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUStringLiteral( "drawtext" ) : OUStringLiteral( "draw" ); + aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUStringLiteral( u"drawtext" ) : OUStringLiteral( u"draw" ); else { // todo: the context menu should be specified by an xml file in uiconfig diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx index d9903b12c275..133d02354dbc 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx @@ -96,8 +96,8 @@ void ChartColorWrapper::updateModel(const css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 520115092833..14d96c15a874 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -70,9 +70,9 @@ using namespace ::chart::CloneHelper; namespace { const OUStringLiteral lcl_aGDIMetaFileMIMEType( - "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""); + u"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""); const OUStringLiteral lcl_aGDIMetaFileMIMETypeHighContrast( - "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""); + u"application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""); } // anonymous namespace diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx index 32fa6c39ec52..91d6c003a067 100644 --- a/chart2/source/tools/ErrorBar.cxx +++ b/chart2/source/tools/ErrorBar.cxx @@ -53,22 +53,22 @@ const SfxItemPropertySet* GetErrorBarPropertySet() { static const SfxItemPropertyMapEntry aErrorBarPropertyMap_Impl[] = { - {"ShowPositiveError",0,cppu::UnoType::get(), 0, 0}, - {"ShowNegativeError",1,cppu::UnoType::get(), 0, 0}, - {"PositiveError",2,cppu::UnoType::get(),0,0}, - {"NegativeError",3,cppu::UnoType::get(), 0, 0}, - {"PercentageError",4,cppu::UnoType::get(), 0, 0}, - {"ErrorBarStyle",5,cppu::UnoType::get(),0,0}, - {"ErrorBarRangePositive",6,cppu::UnoType::get(),0,0}, // read-only for export - {"ErrorBarRangeNegative",7,cppu::UnoType::get(),0,0}, // read-only for export - {"Weight",8,cppu::UnoType::get(),0,0}, - {"LineStyle",9,cppu::UnoType::get(),0,0}, - {"LineDash",10,cppu::UnoType::get(),0,0}, - {"LineWidth",11,cppu::UnoType::get(),0,0}, - {"LineColor",12,cppu::UnoType::get(),0,0}, - {"LineTransparence",13,cppu::UnoType::get(),0,0}, - {"LineJoint",14,cppu::UnoType::get(),0,0}, - { "", 0, css::uno::Type(), 0, 0 } + {u"ShowPositiveError",0,cppu::UnoType::get(), 0, 0}, + {u"ShowNegativeError",1,cppu::UnoType::get(), 0, 0}, + {u"PositiveError",2,cppu::UnoType::get(),0,0}, + {u"NegativeError",3,cppu::UnoType::get(), 0, 0}, + {u"PercentageError",4,cppu::UnoType::get(), 0, 0}, + {u"ErrorBarStyle",5,cppu::UnoType::get(),0,0}, + {u"ErrorBarRangePositive",6,cppu::UnoType::get(),0,0}, // read-only for export + {u"ErrorBarRangeNegative",7,cppu::UnoType::get(),0,0}, // read-only for export + {u"Weight",8,cppu::UnoType::get(),0,0}, + {u"LineStyle",9,cppu::UnoType::get(),0,0}, + {u"LineDash",10,cppu::UnoType::get(),0,0}, + {u"LineWidth",11,cppu::UnoType::get(),0,0}, + {u"LineColor",12,cppu::UnoType::get(),0,0}, + {u"LineTransparence",13,cppu::UnoType::get(),0,0}, + {u"LineJoint",14,cppu::UnoType::get(),0,0}, + { u"", 0, css::uno::Type(), 0, 0 } }; static SfxItemPropertySet aPropSet( aErrorBarPropertyMap_Impl ); return &aPropSet; diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx index 7d85b19b5a3d..13ddf1582cd0 100644 --- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx @@ -199,7 +199,7 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation( OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogIntercept, pValueLength ); if ( aValueString != "0" ) // aValueString may be rounded to 0 if nValueLength is small { - aTmpBuf.append( aValueString ).append( (m_fLogSlope < 0.0) ? OUStringLiteral(" ") : OUStringLiteral(" + ") ); + aTmpBuf.append( aValueString ).append( (m_fLogSlope < 0.0) ? OUStringLiteral(u" ") : OUStringLiteral(u" + ") ); } } } diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 02c5ab550df8..bea37d729506 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1109,9 +1109,9 @@ void ChartView::impl_deleteCoordinateSystems() namespace { const OUStringLiteral lcl_aGDIMetaFileMIMEType( - "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ); + u"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ); const OUStringLiteral lcl_aGDIMetaFileMIMETypeHighContrast( - "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" ); + u"application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" ); } // anonymous namespace void ChartView::getMetaFile( const uno::Reference< io::XOutputStream >& xOutStream -- cgit