diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-03 12:12:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-03 17:58:24 +0100 |
commit | 9b0202bf43133fd440fae62ccb4727dafb2da211 (patch) | |
tree | a0829601a140e382c649f73bdbdc5646777557e5 | |
parent | 30f41d99af6cf84b5993d5c5c24fc49ef39bd756 (diff) |
loplugin:stringliteraldefine in xmloff
Change-Id: I9216c18d3ba4a4a528a49198fdfe547a66c06b6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126284
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/xmloff/ProgressBarHelper.hxx | 8 | ||||
-rw-r--r-- | include/xmloff/families.hxx | 38 | ||||
-rw-r--r-- | include/xmloff/odffields.hxx | 37 | ||||
-rw-r--r-- | include/xmloff/xmlnumfe.hxx | 2 | ||||
-rw-r--r-- | include/xmloff/xmlnumfi.hxx | 2 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlStyleImport.cxx | 13 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlstyli.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/forms/strings.hxx | 66 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextMarkImportContext.cxx | 10 |
9 files changed, 91 insertions, 94 deletions
diff --git a/include/xmloff/ProgressBarHelper.hxx b/include/xmloff/ProgressBarHelper.hxx index aa1b3585a3b0..7fe92ab9bb74 100644 --- a/include/xmloff/ProgressBarHelper.hxx +++ b/include/xmloff/ProgressBarHelper.hxx @@ -24,10 +24,10 @@ #include <xmloff/dllapi.h> #include <com/sun/star/task/XStatusIndicator.hpp> -#define XML_PROGRESSRANGE "ProgressRange" -#define XML_PROGRESSMAX "ProgressMax" -#define XML_PROGRESSCURRENT "ProgressCurrent" -#define XML_PROGRESSREPEAT "ProgressRepeat" +inline constexpr OUStringLiteral XML_PROGRESSRANGE = u"ProgressRange"; +inline constexpr OUStringLiteral XML_PROGRESSMAX = u"ProgressMax"; +inline constexpr OUStringLiteral XML_PROGRESSCURRENT = u"ProgressCurrent"; +inline constexpr OUStringLiteral XML_PROGRESSREPEAT = u"ProgressRepeat"; class XMLOFF_DLLPUBLIC ProgressBarHelper { diff --git a/include/xmloff/families.hxx b/include/xmloff/families.hxx index 58143393bc9d..05e355a3ce7d 100644 --- a/include/xmloff/families.hxx +++ b/include/xmloff/families.hxx @@ -23,26 +23,26 @@ used in the SvXMLAutoStylePoolP. */ -#define XML_STYLE_FAMILY_PAGE_MASTER_NAME "page-layout" -#define XML_STYLE_FAMILY_PAGE_MASTER_PREFIX "pm" -#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME "table" -#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX "ta" -#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME "table-column" -#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX "co" -#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME "table-row" -#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX "ro" -#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME "table-cell" -#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX "ce" -#define XML_STYLE_FAMILY_SD_GRAPHICS_NAME u"graphic" -#define XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX "gr" -#define XML_STYLE_FAMILY_SD_PRESENTATION_NAME u"presentation" -#define XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX "pr" +inline constexpr OUStringLiteral XML_STYLE_FAMILY_PAGE_MASTER_NAME = u"page-layout"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_PAGE_MASTER_PREFIX = u"pm"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME = u"table"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX = u"ta"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME = u"table-column"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX = u"co"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME = u"table-row"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX = u"ro"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME = u"table-cell"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX = u"ce"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME = u"graphic"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX = u"gr"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_NAME = u"presentation"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX = u"pr"; #define XML_STYLE_FAMILY_SD_POOL_NAME u"default" -#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME u"drawing-page" -#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX "dp" -#define XML_STYLE_FAMILY_SCH_CHART_NAME u"chart" -#define XML_STYLE_FAMILY_SCH_CHART_PREFIX "ch" -#define XML_STYLE_FAMILY_CONTROL_PREFIX "ctrl" +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME = u"drawing-page"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX = u"dp"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SCH_CHART_NAME = u"chart"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SCH_CHART_PREFIX = u"ch"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_CONTROL_PREFIX = u"ctrl"; enum class XmlStyleFamily { diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx index 89c2e6174335..8a0b103ba9b8 100644 --- a/include/xmloff/odffields.hxx +++ b/include/xmloff/odffields.hxx @@ -20,24 +20,27 @@ #ifndef INCLUDED_XMLOFF_ODFFIELDS_HXX #define INCLUDED_XMLOFF_ODFFIELDS_HXX -#define ODF_FORMTEXT "vnd.oasis.opendocument.field.FORMTEXT" +inline constexpr OUStringLiteral ODF_FORMTEXT = u"vnd.oasis.opendocument.field.FORMTEXT"; #define ODF_FORMFIELD_DEFAULT_LENGTH 5 -#define ODF_FORMCHECKBOX u"vnd.oasis.opendocument.field.FORMCHECKBOX" -#define ODF_FORMCHECKBOX_HELPTEXT "Checkbox_HelpText" -#define ODF_FORMCHECKBOX_NAME "Checkbox_Name" -#define ODF_FORMCHECKBOX_RESULT "Checkbox_Checked" +inline constexpr OUStringLiteral ODF_FORMCHECKBOX = u"vnd.oasis.opendocument.field.FORMCHECKBOX"; +inline constexpr OUStringLiteral ODF_FORMCHECKBOX_HELPTEXT = u"Checkbox_HelpText"; +inline constexpr OUStringLiteral ODF_FORMCHECKBOX_NAME = u"Checkbox_Name"; +inline constexpr OUStringLiteral ODF_FORMCHECKBOX_RESULT = u"Checkbox_Checked"; -#define ODF_FORMDROPDOWN u"vnd.oasis.opendocument.field.FORMDROPDOWN" -#define ODF_FORMDROPDOWN_LISTENTRY "Dropdown_ListEntry" -#define ODF_FORMDROPDOWN_RESULT "Dropdown_Selected" +inline constexpr OUStringLiteral ODF_FORMDROPDOWN = u"vnd.oasis.opendocument.field.FORMDROPDOWN"; +inline constexpr OUStringLiteral ODF_FORMDROPDOWN_LISTENTRY = u"Dropdown_ListEntry"; +inline constexpr OUStringLiteral ODF_FORMDROPDOWN_RESULT = u"Dropdown_Selected"; #define ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT 25 -#define ODF_FORMDATE "vnd.oasis.opendocument.field.FORMDATE" -#define ODF_FORMDATE_DATEFORMAT "DateField_DateFormat" // e.g. "MM.DD.YY" -#define ODF_FORMDATE_DATEFORMAT_LANGUAGE "DateField_DateFormat_Language" // e.g. "en-US", "hu-HU" -#define ODF_FORMDATE_CURRENTDATE "DateField_CurrentDate" // date string in a specific format -#define ODF_FORMDATE_CURRENTDATE_FORMAT u"YYYY-MM-DD" // Coming from MSO +inline constexpr OUStringLiteral ODF_FORMDATE = u"vnd.oasis.opendocument.field.FORMDATE"; +inline constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT + = u"DateField_DateFormat"; // e.g. "MM.DD.YY"; +inline constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT_LANGUAGE + = u"DateField_DateFormat_Language"; // e.g. "en-US", "hu-HU"; +inline constexpr OUStringLiteral ODF_FORMDATE_CURRENTDATE + = u"DateField_CurrentDate"; // date string in a specific format +inline constexpr OUStringLiteral ODF_FORMDATE_CURRENTDATE_FORMAT = u"YYYY-MM-DD"; // Coming from MSO #define ODF_FORMDATE_CURRENTDATE_LANGUAGE LANGUAGE_ENGLISH_US #define ODF_TOC "vnd.oasis.opendocument.field.TOC" @@ -46,10 +49,10 @@ #define ODF_PAGEREF "vnd.oasis.opendocument.field.PAGEREF" -#define ODF_UNHANDLED "vnd.oasis.opendocument.field.UNHANDLED" -#define ODF_OLE_PARAM "vnd.oasis.opendocument.field.ole" -#define ODF_ID_PARAM "vnd.oasis.opendocument.field.id" -#define ODF_CODE_PARAM "vnd.oasis.opendocument.field.code" +inline constexpr OUStringLiteral ODF_UNHANDLED = u"vnd.oasis.opendocument.field.UNHANDLED"; +inline constexpr OUStringLiteral ODF_OLE_PARAM = u"vnd.oasis.opendocument.field.ole"; +inline constexpr OUStringLiteral ODF_ID_PARAM = u"vnd.oasis.opendocument.field.id"; +inline constexpr OUStringLiteral ODF_CODE_PARAM = u"vnd.oasis.opendocument.field.code"; #endif // INCLUDED_XMLOFF_ODFFIELDS_HXX diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx index 2949aed76679..38216a073107 100644 --- a/include/xmloff/xmlnumfe.hxx +++ b/include/xmloff/xmlnumfe.hxx @@ -32,7 +32,7 @@ namespace com::sun::star::lang { struct Locale; } namespace com::sun::star::uno { template <typename > class Reference; } namespace com::sun::star::util { class XNumberFormatsSupplier; } -#define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles" +inline constexpr OUStringLiteral XML_WRITTENNUMBERSTYLES = u"WrittenNumberStyles"; class Color; class LocaleDataWrapper; diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx index d45a1aaa83e2..9a18893df3c6 100644 --- a/include/xmloff/xmlnumfi.hxx +++ b/include/xmloff/xmlnumfi.hxx @@ -33,7 +33,7 @@ namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::util { class XNumberFormatsSupplier; } namespace com::sun::star::xml::sax { class XAttributeList; } -#define XML_NUMBERSTYLES "NumberStyles" +inline constexpr OUStringLiteral XML_NUMBERSTYLES = u"NumberStyles"; enum class SvXMLStylesTokens { diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx index e6b103abc586..221645ac097d 100644 --- a/reportdesign/source/filter/xml/xmlStyleImport.cxx +++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx @@ -143,11 +143,6 @@ void OControlStyleContext::SetAttribute( sal_Int32 nElement, } -constexpr OUStringLiteral g_sTableStyleFamilyName( u"" XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME ); -constexpr OUStringLiteral g_sColumnStyleFamilyName( u"" XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ); -constexpr OUStringLiteral g_sRowStyleFamilyName( u"" XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME ); -constexpr OUStringLiteral g_sCellStyleFamilyName( u"" XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME ); - OReportStylesContext::OReportStylesContext( ORptFilter& rImport, const bool bTempAutoStyles ) : SvXMLStylesContext( rImport ), @@ -360,16 +355,16 @@ OUString OReportStylesContext::GetServiceName( XmlStyleFamily nFamily ) const switch( nFamily ) { case XmlStyleFamily::TABLE_TABLE: - sServiceName = g_sTableStyleFamilyName; + sServiceName = XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME; break; case XmlStyleFamily::TABLE_COLUMN: - sServiceName = g_sColumnStyleFamilyName; + sServiceName = XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME; break; case XmlStyleFamily::TABLE_ROW: - sServiceName = g_sRowStyleFamilyName; + sServiceName = XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME; break; case XmlStyleFamily::TABLE_CELL: - sServiceName = g_sCellStyleFamilyName; + sServiceName = XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME; break; default: break; diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 08e2d94538ba..ba327e605d51 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -655,9 +655,6 @@ SvXMLStyleContext *XMLTableStylesContext::CreateDefaultStyleStyleChildContext( } constexpr OUStringLiteral gsCellStyleServiceName(u"com.sun.star.style.CellStyle"); -constexpr OUStringLiteral gsColumnStyleServiceName(u"" XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME); -constexpr OUStringLiteral gsRowStyleServiceName(u"" XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME); -constexpr OUStringLiteral gsTableStyleServiceName(u"" XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME); XMLTableStylesContext::XMLTableStylesContext( SvXMLImport& rImport, const bool bTempAutoStyles ) @@ -826,16 +823,16 @@ OUString XMLTableStylesContext::GetServiceName( XmlStyleFamily nFamily ) const switch( nFamily ) { case XmlStyleFamily::TABLE_COLUMN: - sServiceName = gsColumnStyleServiceName; + sServiceName = XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME; break; case XmlStyleFamily::TABLE_ROW: - sServiceName = gsRowStyleServiceName; + sServiceName = XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME; break; case XmlStyleFamily::TABLE_CELL: sServiceName = gsCellStyleServiceName; break; case XmlStyleFamily::TABLE_TABLE: - sServiceName = gsTableStyleServiceName; + sServiceName = XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME; break; default: break; } diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx index fbf400787f0b..f12067504d7a 100644 --- a/xmloff/source/forms/strings.hxx +++ b/xmloff/source/forms/strings.hxx @@ -19,6 +19,8 @@ #pragma once +#include <rtl/ustring.hxx> + namespace xmloff { @@ -141,12 +143,12 @@ namespace xmloff #define PROPERTY_RICH_TEXT "RichText" // services - #define SERVICE_SPREADSHEET_DOCUMENT "com.sun.star.sheet.SpreadsheetDocument" - #define SERVICE_CELLVALUEBINDING "com.sun.star.table.CellValueBinding" - #define SERVICE_LISTINDEXCELLBINDING "com.sun.star.table.ListPositionCellBinding" - #define SERVICE_CELLRANGELISTSOURCE "com.sun.star.table.CellRangeListSource" - #define SERVICE_ADDRESS_CONVERSION "com.sun.star.table.CellAddressConversion" - #define SERVICE_RANGEADDRESS_CONVERSION "com.sun.star.table.CellRangeAddressConversion" + inline constexpr OUStringLiteral SERVICE_SPREADSHEET_DOCUMENT = u"com.sun.star.sheet.SpreadsheetDocument"; + inline constexpr OUStringLiteral SERVICE_CELLVALUEBINDING = u"com.sun.star.table.CellValueBinding"; + inline constexpr OUStringLiteral SERVICE_LISTINDEXCELLBINDING = u"com.sun.star.table.ListPositionCellBinding"; + inline constexpr OUStringLiteral SERVICE_CELLRANGELISTSOURCE = u"com.sun.star.table.CellRangeListSource"; + inline constexpr OUStringLiteral SERVICE_ADDRESS_CONVERSION = u"com.sun.star.table.CellAddressConversion"; + inline constexpr OUStringLiteral SERVICE_RANGEADDRESS_CONVERSION = u"com.sun.star.table.CellRangeAddressConversion"; // old service names (compatibility) #define SERVICE_PERSISTENT_COMPONENT_FORM "stardiv.one.form.component.Form" @@ -171,36 +173,36 @@ namespace xmloff #define SERVICE_PERSISTENT_COMPONENT_FORMATTEDFIELD "stardiv.one.form.component.FormattedField" // new service names, the old ones are translated into this new ones - #define SERVICE_FORM "com.sun.star.form.component.Form" - #define SERVICE_EDIT "com.sun.star.form.component.TextField" - #define SERVICE_LISTBOX "com.sun.star.form.component.ListBox" - #define SERVICE_COMBOBOX "com.sun.star.form.component.ComboBox" - #define SERVICE_RADIOBUTTON "com.sun.star.form.component.RadioButton" - #define SERVICE_GROUPBOX "com.sun.star.form.component.GroupBox" - #define SERVICE_FIXEDTEXT "com.sun.star.form.component.FixedText" - #define SERVICE_COMMANDBUTTON "com.sun.star.form.component.CommandButton" - #define SERVICE_CHECKBOX "com.sun.star.form.component.CheckBox" - #define SERVICE_GRID "com.sun.star.form.component.GridControl" - #define SERVICE_IMAGEBUTTON "com.sun.star.form.component.ImageButton" - #define SERVICE_FILECONTROL "com.sun.star.form.component.FileControl" - #define SERVICE_TIMEFIELD "com.sun.star.form.component.TimeField" - #define SERVICE_DATEFIELD "com.sun.star.form.component.DateField" - #define SERVICE_NUMERICFIELD "com.sun.star.form.component.NumericField" - #define SERVICE_CURRENCYFIELD "com.sun.star.form.component.CurrencyField" - #define SERVICE_PATTERNFIELD "com.sun.star.form.component.PatternField" - #define SERVICE_HIDDENCONTROL "com.sun.star.form.component.HiddenControl" - #define SERVICE_IMAGECONTROL "com.sun.star.form.component.DatabaseImageControl" - #define SERVICE_FORMATTEDFIELD "com.sun.star.form.component.FormattedField" + inline constexpr OUStringLiteral SERVICE_FORM = u"com.sun.star.form.component.Form"; + inline constexpr OUStringLiteral SERVICE_EDIT = u"com.sun.star.form.component.TextField"; + inline constexpr OUStringLiteral SERVICE_LISTBOX = u"com.sun.star.form.component.ListBox"; + inline constexpr OUStringLiteral SERVICE_COMBOBOX = u"com.sun.star.form.component.ComboBox"; + inline constexpr OUStringLiteral SERVICE_RADIOBUTTON = u"com.sun.star.form.component.RadioButton"; + inline constexpr OUStringLiteral SERVICE_GROUPBOX = u"com.sun.star.form.component.GroupBox"; + inline constexpr OUStringLiteral SERVICE_FIXEDTEXT = u"com.sun.star.form.component.FixedText"; + inline constexpr OUStringLiteral SERVICE_COMMANDBUTTON = u"com.sun.star.form.component.CommandButton"; + inline constexpr OUStringLiteral SERVICE_CHECKBOX = u"com.sun.star.form.component.CheckBox"; + inline constexpr OUStringLiteral SERVICE_GRID = u"com.sun.star.form.component.GridControl"; + inline constexpr OUStringLiteral SERVICE_IMAGEBUTTON = u"com.sun.star.form.component.ImageButton"; + inline constexpr OUStringLiteral SERVICE_FILECONTROL = u"com.sun.star.form.component.FileControl"; + inline constexpr OUStringLiteral SERVICE_TIMEFIELD = u"com.sun.star.form.component.TimeField"; + inline constexpr OUStringLiteral SERVICE_DATEFIELD = u"com.sun.star.form.component.DateField"; + inline constexpr OUStringLiteral SERVICE_NUMERICFIELD = u"com.sun.star.form.component.NumericField"; + inline constexpr OUStringLiteral SERVICE_CURRENCYFIELD = u"com.sun.star.form.component.CurrencyField"; + inline constexpr OUStringLiteral SERVICE_PATTERNFIELD = u"com.sun.star.form.component.PatternField"; + inline constexpr OUStringLiteral SERVICE_HIDDENCONTROL = u"com.sun.star.form.component.HiddenControl"; + inline constexpr OUStringLiteral SERVICE_IMAGECONTROL = u"com.sun.star.form.component.DatabaseImageControl"; + inline constexpr OUStringLiteral SERVICE_FORMATTEDFIELD = u"com.sun.star.form.component.FormattedField"; // various strings #define EVENT_NAME_SEPARATOR "::" - #define EVENT_TYPE "EventType" - #define EVENT_LIBRARY "Library" - #define EVENT_LOCALMACRONAME "MacroName" - #define EVENT_SCRIPTURL "Script" - #define EVENT_STAROFFICE "StarOffice" + inline constexpr OUStringLiteral EVENT_TYPE = u"EventType"; + inline constexpr OUStringLiteral EVENT_LIBRARY = u"Library"; + inline constexpr OUStringLiteral EVENT_LOCALMACRONAME = u"MacroName"; + inline constexpr OUStringLiteral EVENT_SCRIPTURL = u"Script"; + inline constexpr OUStringLiteral EVENT_STAROFFICE = u"StarOffice"; #define EVENT_STARBASIC "StarBasic" - #define EVENT_APPLICATION "application" + inline constexpr OUStringLiteral EVENT_APPLICATION = u"application"; } // namespace xmloff diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index 44f652aaf6fa..8e823d6c1757 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -125,7 +125,7 @@ SvXMLEnumMapEntry<lcl_MarkType> const lcl_aMarkTypeMap[] = }; -static const sal_Unicode *lcl_getFormFieldmarkName(std::u16string_view name) +static OUString lcl_getFormFieldmarkName(std::u16string_view name) { if (name == ODF_FORMCHECKBOX || name == u"msoffice.field.FORMCHECKBOX" || @@ -135,7 +135,7 @@ static const sal_Unicode *lcl_getFormFieldmarkName(std::u16string_view name) name == u"ecma.office-open-xml.field.FORMDROPDOWN") return ODF_FORMDROPDOWN; else - return nullptr; + return OUString(); } static OUString lcl_getFieldmarkName(OUString const& name) @@ -287,8 +287,8 @@ void XMLTextMarkImportContext::endFastElement(sal_Int32 nElement) [[fallthrough]]; case TypeFieldmark: { - const sal_Unicode *formFieldmarkName=lcl_getFormFieldmarkName(m_sFieldName); - bool bImportAsField = (nTmp==TypeFieldmark && formFieldmarkName!=nullptr); //@TODO handle abbreviation cases... + const OUString formFieldmarkName=lcl_getFormFieldmarkName(m_sFieldName); + bool bImportAsField = (nTmp==TypeFieldmark && !formFieldmarkName.isEmpty()); //@TODO handle abbreviation cases... // export point bookmark const Reference<XInterface> xContent( CreateAndInsertMark(GetImport(), @@ -300,7 +300,7 @@ void XMLTextMarkImportContext::endFastElement(sal_Int32 nElement) if (xContent.is() && bImportAsField) { // setup fieldmark... Reference< css::text::XFormField> xFormField(xContent, UNO_QUERY); - xFormField->setFieldType(OUString(formFieldmarkName)); + xFormField->setFieldType(formFieldmarkName); if (xFormField.is() && m_rHelper.hasCurrentFieldCtx()) { m_rHelper.setCurrentFieldParamsTo(xFormField); } |