diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-09-08 09:48:17 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-09-16 23:02:09 +0200 |
commit | e6dfaf9f44f9939abc338c83b3024108431d0f69 (patch) | |
tree | 2e220510dc589fa4ce9b205696b9d0b58d38b60a /sd | |
parent | eb55bc5eae82873492cfd7577fb553b1c5abff6b (diff) |
Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString
...from which an OUString can cheaply be instantiated. This is the OUString
equivalent of 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "Turn OStringLiteral into
a consteval'ed, static-refcound rtl_String". Most remarks about that commit
apply here too (this commit is just substantially bigger and a bit more
complicated because there were so much more uses of OUStringLiteral than of
OStringLiteral):
The one downside is that OUStringLiteral now needs to be a template abstracting
over the string length. But any uses for which that is a problem (e.g., as the
element type of a container that would no longer be homogeneous, or in the
signature of a function that shall not be turned into a template for one reason
or another) can be replaced with std::u16string_view, without loss of efficiency
compared to the original OUStringLiteral, and without loss of expressivity.
The new OUStringLiteral ctor code would probably not be very efficient if it
were ever executed at runtime, but it is intended to be only executed at compile
time. Where available, C++20 "consteval" is used to statically ensure that.
The intended use of the new OUStringLiteral is in all cases where an
object that shall itself not be an OUString (e.g., because it shall be a
global static variable for which the OUString ctor/dtor would be detrimental at
library load/unload) must be converted to an OUString instance in at least one
place. Other string literal abstractions could use std::u16string_view (or just
plain char16_t const[N]), but interestingly OUStringLiteral might be more
efficient than constexpr std::u16string_view even for such cases, as it should
not need any relocations at library load time. For now, no existing uses of
OUStringLiteral have been changed to some other abstraction (unless technically
necessary as discussed above), and no additional places that would benefit from
OUStringLiteral have been changed to use it.
Global constexpr OUStringLiteral variables defined in an included file would be
somewhat suboptimal, as each translation unit that uses them would create its
own, unshared instance. The envisioned solution is to turn them into static
data members of some class (and there may be a loplugin coming to find and fix
affected places). Another approach that has been taken here in a few cases
where such variables were only used in one .cxx anyway is to move their
definitions from the .hxx into that one .cxx (in turn causing some files to
become empty and get removed completely)---which also silenced some GCC
-Werror=unused-variable if a variable from a .hxx was not used in some .cxx
including it.
To keep individual commits reasonably manageable, some consumers of
OUStringLiteral in rtl/ustrbuf.hxx and rtl/ustring.hxx are left in a somewhat
odd state for now, where they don't take advantage of OUStringLiteral's
equivalence to rtl_uString, but just keep extracting its contents and copy it
elsewhere. In follow-up commits, those consumers should be changed
appropriately, making them treat OUStringLiteral like an rtl_uString or
dropping the OUStringLiteral overload in favor of an existing (and cheap to use
now) OUString overload, etc.
In a similar vein, comparison operators between OUString and std::u16string_view
have been added to the existing plethora of comparison operator overloads. It
would be nice to eventually consolidate them, esp. with the overloads taking
OUStringLiteral and/or char16_t const[N] string literals, but that appears
tricky to get right without introducing new ambiguities. Also, a handful of
places across the code base use comparisons between OUString and OUStringNumber,
which are now ambiguous (converting the OUStringNumber to either OUString or
std::u16string_view). For simplicity, those few places have manually been fixed
for now by adding explicit conversion to std::u16string_view.
Also some compilerplugins code needed to be adapted, and some of the
compilerplugins/test cases have become irrelevant (and have been removed), as
the tested code would no longer compile in the first place.
sal/qa/rtl/strings/test_oustring_concat.cxx documents a workaround for GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878> "Failed class template
argument deduction in unevaluated, parenthesized context". That place, as well
as uses of OUStringLiteral in extensions/source/abpilot/fieldmappingimpl.cxx and
i18npool/source/localedata/localedata.cxx, which have been replaced with
OUString::Concat (and which is arguably a better choice, anyway), also caused
failures with at least Clang 5.0.2 (but would not have caused failures with at
least recent Clang 12 trunk, so appear to be bugs in Clang that have meanwhile
been fixed).
Change-Id: I34174462a28f2000cfeb2d219ffd533a767920b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102222
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/strmname.h | 35 | ||||
-rw-r--r-- | sd/source/core/stlsheet.cxx | 69 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/dlg/tpaction.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/framework/tools/FrameworkHelper.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/inc/ToolBarManager.hxx | 42 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/FrameworkHelper.hxx | 24 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/view/ToolBarManager.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/view/viewoverlaymanager.cxx | 8 |
13 files changed, 104 insertions, 137 deletions
diff --git a/sd/inc/strmname.h b/sd/inc/strmname.h deleted file mode 100644 index 08b2c4c025e7..000000000000 --- a/sd/inc/strmname.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SD_INC_STRMNAME_H -#define INCLUDED_SD_INC_STRMNAME_H - -#include <rtl/ustring.hxx> - -// PowerPoint-Filter -const OUStringLiteral pFilterPowerPoint97( u"MS PowerPoint 97" ); -const OUStringLiteral pFilterPowerPoint97Template( u"MS PowerPoint 97 Vorlage" ); -const OUStringLiteral pFilterPowerPoint97AutoPlay( u"MS PowerPoint 97 AutoPlay" ); - -// XML content stream -const OUStringLiteral pStarDrawXMLContent( u"content.xml" ); - -#endif // INCLUDED_SD_INC_STRMNAME_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 616da711d329..52d05351b3b9 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -61,6 +61,7 @@ #include <cstddef> #include <memory> +#include <string_view> using ::osl::MutexGuard; using ::osl::ClearableMutexGuard; @@ -572,42 +573,42 @@ namespace { struct ApiNameMap { - OUStringLiteral mpApiName; + std::u16string_view mpApiName; sal_uInt32 mnHelpId; } const pApiNameMap[] - = { { OUStringLiteral(u"title"), HID_PSEUDOSHEET_TITLE }, - { OUStringLiteral(u"subtitle"), HID_PSEUDOSHEET_SUBTITLE }, - { OUStringLiteral(u"background"), HID_PSEUDOSHEET_BACKGROUND }, - { OUStringLiteral(u"backgroundobjects"), HID_PSEUDOSHEET_BACKGROUNDOBJECTS }, - { OUStringLiteral(u"notes"), HID_PSEUDOSHEET_NOTES }, - { OUStringLiteral(u"standard"), HID_STANDARD_STYLESHEET_NAME }, - { OUStringLiteral(u"objectwithoutfill"), HID_POOLSHEET_OBJWITHOUTFILL }, - - { OUStringLiteral(u"Text"), HID_POOLSHEET_TEXT }, - { OUStringLiteral(u"A4"), HID_POOLSHEET_A4 }, - { OUStringLiteral(u"Title A4"), HID_POOLSHEET_A4_TITLE }, - { OUStringLiteral(u"Heading A4"), HID_POOLSHEET_A4_HEADLINE }, - { OUStringLiteral(u"Text A4"), HID_POOLSHEET_A4_TEXT }, - { OUStringLiteral(u"A4"), HID_POOLSHEET_A0 }, - { OUStringLiteral(u"Title A0"), HID_POOLSHEET_A0_TITLE }, - { OUStringLiteral(u"Heading A0"), HID_POOLSHEET_A0_HEADLINE }, - { OUStringLiteral(u"Text A0"), HID_POOLSHEET_A0_TEXT }, - - { OUStringLiteral(u"Graphic"), HID_POOLSHEET_GRAPHIC }, - { OUStringLiteral(u"Shapes"), HID_POOLSHEET_SHAPES }, - { OUStringLiteral(u"Filled"), HID_POOLSHEET_FILLED }, - { OUStringLiteral(u"Filled Blue"), HID_POOLSHEET_FILLED_BLUE }, - { OUStringLiteral(u"Filled Green"), HID_POOLSHEET_FILLED_GREEN }, - { OUStringLiteral(u"Filled Red"), HID_POOLSHEET_FILLED_RED }, - { OUStringLiteral(u"Filled Yellow"), HID_POOLSHEET_FILLED_YELLOW }, - { OUStringLiteral(u"Outlined"), HID_POOLSHEET_OUTLINE }, - { OUStringLiteral(u"Outlined Blue"), HID_POOLSHEET_OUTLINE_BLUE }, - { OUStringLiteral(u"Outlined Green"), HID_POOLSHEET_OUTLINE_GREEN }, - { OUStringLiteral(u"Outlined Red"), HID_POOLSHEET_OUTLINE_RED }, - { OUStringLiteral(u"Outlined Yellow"), HID_POOLSHEET_OUTLINE_YELLOW }, - { OUStringLiteral(u"Lines"), HID_POOLSHEET_LINES }, - { OUStringLiteral(u"Arrow Line"), HID_POOLSHEET_MEASURE }, - { OUStringLiteral(u"Arrow Dashed"), HID_POOLSHEET_LINES_DASHED } + = { { std::u16string_view(u"title"), HID_PSEUDOSHEET_TITLE }, + { std::u16string_view(u"subtitle"), HID_PSEUDOSHEET_SUBTITLE }, + { std::u16string_view(u"background"), HID_PSEUDOSHEET_BACKGROUND }, + { std::u16string_view(u"backgroundobjects"), HID_PSEUDOSHEET_BACKGROUNDOBJECTS }, + { std::u16string_view(u"notes"), HID_PSEUDOSHEET_NOTES }, + { std::u16string_view(u"standard"), HID_STANDARD_STYLESHEET_NAME }, + { std::u16string_view(u"objectwithoutfill"), HID_POOLSHEET_OBJWITHOUTFILL }, + + { std::u16string_view(u"Text"), HID_POOLSHEET_TEXT }, + { std::u16string_view(u"A4"), HID_POOLSHEET_A4 }, + { std::u16string_view(u"Title A4"), HID_POOLSHEET_A4_TITLE }, + { std::u16string_view(u"Heading A4"), HID_POOLSHEET_A4_HEADLINE }, + { std::u16string_view(u"Text A4"), HID_POOLSHEET_A4_TEXT }, + { std::u16string_view(u"A4"), HID_POOLSHEET_A0 }, + { std::u16string_view(u"Title A0"), HID_POOLSHEET_A0_TITLE }, + { std::u16string_view(u"Heading A0"), HID_POOLSHEET_A0_HEADLINE }, + { std::u16string_view(u"Text A0"), HID_POOLSHEET_A0_TEXT }, + + { std::u16string_view(u"Graphic"), HID_POOLSHEET_GRAPHIC }, + { std::u16string_view(u"Shapes"), HID_POOLSHEET_SHAPES }, + { std::u16string_view(u"Filled"), HID_POOLSHEET_FILLED }, + { std::u16string_view(u"Filled Blue"), HID_POOLSHEET_FILLED_BLUE }, + { std::u16string_view(u"Filled Green"), HID_POOLSHEET_FILLED_GREEN }, + { std::u16string_view(u"Filled Red"), HID_POOLSHEET_FILLED_RED }, + { std::u16string_view(u"Filled Yellow"), HID_POOLSHEET_FILLED_YELLOW }, + { std::u16string_view(u"Outlined"), HID_POOLSHEET_OUTLINE }, + { std::u16string_view(u"Outlined Blue"), HID_POOLSHEET_OUTLINE_BLUE }, + { std::u16string_view(u"Outlined Green"), HID_POOLSHEET_OUTLINE_GREEN }, + { std::u16string_view(u"Outlined Red"), HID_POOLSHEET_OUTLINE_RED }, + { std::u16string_view(u"Outlined Yellow"), HID_POOLSHEET_OUTLINE_YELLOW }, + { std::u16string_view(u"Lines"), HID_POOLSHEET_LINES }, + { std::u16string_view(u"Arrow Line"), HID_POOLSHEET_MEASURE }, + { std::u16string_view(u"Arrow Dashed"), HID_POOLSHEET_LINES_DASHED } }; OUString GetApiNameForHelpId(sal_uLong nId) diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 26453ed7033c..eaf8fa476d41 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -91,6 +91,7 @@ #include <cassert> #include <memory> +#include <string_view> using namespace ::com::sun::star; @@ -1892,7 +1893,7 @@ OUString ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const } if ( bRefStrValid ) { - if ( OUString::number(nSoundRef) == aRefStr ) + if ( std::u16string_view(OUString::number(nSoundRef)) == aRefStr ) { rStCtrl.Seek( nOldPos2 ); if ( SeekToRec( rStCtrl, PPT_PST_CString, nStrLen ) ) diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 891e21b0d418..69c87586a9c4 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -48,7 +48,6 @@ #include <View.hxx> #include <sdresid.hxx> #include <tpaction.hxx> -#include <strmname.h> #include <ViewShell.hxx> #include <drawdoc.hxx> #include <DrawDocShell.hxx> @@ -64,6 +63,9 @@ using namespace com::sun::star::lang; #define DOCUMENT_TOKEN '#' +// XML content stream +const OUStringLiteral pStarDrawXMLContent( u"content.xml" ); + /** * Constructor of the Tab dialog: appends the pages to the dialog */ diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 1aaa92150cc6..6b7a9c953596 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -49,7 +49,6 @@ #include <app.hrc> #include <strings.hrc> -#include <strmname.h> #include <FrameView.hxx> #include <optsitem.hxx> #include <Outliner.hxx> @@ -81,6 +80,11 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using ::sd::framework::FrameworkHelper; +// PowerPoint-Filter +const OUStringLiteral pFilterPowerPoint97( u"MS PowerPoint 97" ); +const OUStringLiteral pFilterPowerPoint97Template( u"MS PowerPoint 97 Vorlage" ); +const OUStringLiteral pFilterPowerPoint97AutoPlay( u"MS PowerPoint 97 AutoPlay" ); + namespace sd { /** diff --git a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx index 2a284dd62697..088253d5606b 100644 --- a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx +++ b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include "GenericConfigurationChangeRequest.hxx" #include <framework/FrameworkHelper.hxx> @@ -62,8 +66,9 @@ void SAL_CALL GenericConfigurationChangeRequest::execute ( OUString SAL_CALL GenericConfigurationChangeRequest::getName() { - return "GenericConfigurationChangeRequest " - + (meMode==Activation ? OUStringLiteral(u"activate ") : OUStringLiteral(u"deactivate ")) + return OUString::Concat("GenericConfigurationChangeRequest ") + + (meMode==Activation + ? std::u16string_view(u"activate ") : std::u16string_view(u"deactivate ")) + FrameworkHelper::ResourceIdToString(mxResourceId); } diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index a6c4fbc67660..8c6f702d6f3c 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -175,7 +175,6 @@ namespace { // Pane URLS. -const OUStringLiteral FrameworkHelper::msPaneURLPrefix(u"private:resource/pane/"); const OUString FrameworkHelper::msCenterPaneURL( msPaneURLPrefix + "CenterPane"); const OUString FrameworkHelper::msFullScreenPaneURL( msPaneURLPrefix + "FullScreenPane"); const OUString FrameworkHelper::msLeftImpressPaneURL( msPaneURLPrefix + "LeftImpressPane"); @@ -183,7 +182,6 @@ const OUString FrameworkHelper::msLeftDrawPaneURL( msPaneURLPrefix + "LeftDrawPa // View URLs. -const OUStringLiteral FrameworkHelper::msViewURLPrefix(u"private:resource/view/"); const OUString FrameworkHelper::msImpressViewURL( msViewURLPrefix + "ImpressView"); const OUString FrameworkHelper::msDrawViewURL( msViewURLPrefix + "GraphicView"); const OUString FrameworkHelper::msOutlineViewURL( msViewURLPrefix + "OutlineView"); @@ -195,21 +193,8 @@ const OUString FrameworkHelper::msSidebarViewURL( msViewURLPrefix + "SidebarView // Tool bar URLs. -const OUStringLiteral FrameworkHelper::msToolBarURLPrefix(u"private:resource/toolbar/"); const OUString FrameworkHelper::msViewTabBarURL( msToolBarURLPrefix + "ViewTabBar"); -// Task panel URLs. -const OUStringLiteral FrameworkHelper::msTaskPanelURLPrefix( u"private:resource/toolpanel/" ); - -// Event URLs. -const OUStringLiteral FrameworkHelper::msResourceActivationRequestEvent( u"ResourceActivationRequested" ); -const OUStringLiteral FrameworkHelper::msResourceDeactivationRequestEvent( u"ResourceDeactivationRequest" ); -const OUStringLiteral FrameworkHelper::msResourceActivationEvent( u"ResourceActivation" ); -const OUStringLiteral FrameworkHelper::msResourceDeactivationEvent( u"ResourceDeactivation" ); -const OUStringLiteral FrameworkHelper::msResourceDeactivationEndEvent( u"ResourceDeactivationEnd" ); -const OUStringLiteral FrameworkHelper::msConfigurationUpdateStartEvent( u"ConfigurationUpdateStart" ); -const OUStringLiteral FrameworkHelper::msConfigurationUpdateEndEvent( u"ConfigurationUpdateEnd" ); - //----- helper ---------------------------------------------------------------- namespace { diff --git a/sd/source/ui/inc/ToolBarManager.hxx b/sd/source/ui/inc/ToolBarManager.hxx index a7577b444870..53a15a80d783 100644 --- a/sd/source/ui/inc/ToolBarManager.hxx +++ b/sd/source/ui/inc/ToolBarManager.hxx @@ -97,21 +97,33 @@ public: /** The set of tool bars that are handled by this manager class. */ - const static OUStringLiteral msToolBar; // Draw_Toolbox_Sd, 23011 - const static OUStringLiteral msOptionsToolBar; // Draw_Options_Toolbox, 23020 - const static OUStringLiteral msCommonTaskToolBar; // Draw_CommonTask_Toolbox, 23021 - const static OUStringLiteral msViewerToolBar; // Draw_Viewer_Toolbox, 23023 - const static OUStringLiteral msSlideSorterToolBar; // Slide_Toolbox, 23012 - const static OUStringLiteral msSlideSorterObjectBar; // Slide_Obj_Toolbox, 23014 - const static OUStringLiteral msOutlineToolBar; // Outline_Toolbox, 23017 - const static OUStringLiteral msMasterViewToolBar; // SID_MASTERPAGE, 27053 - const static OUStringLiteral msDrawingObjectToolBar; // Draw_Obj_Toolbox, 23013 - const static OUStringLiteral msGluePointsToolBar; // Gluepoints_Toolbox, 23019 - const static OUStringLiteral msTextObjectBar; // Draw_Text_Toolbox_Sd, 23016 - const static OUStringLiteral msBezierObjectBar; // Bezier_Toolbox_Sd, 23015 - const static OUStringLiteral msGraphicObjectBar; // Draw_Graf_Toolbox, 23030 - const static OUStringLiteral msMediaObjectBar; // Draw_Media_Toolbox, 23031 - const static OUStringLiteral msTableObjectBar; // Draw_Table_Toolbox, 23018 + constexpr static OUStringLiteral msToolBar = u"toolbar"; // Draw_Toolbox_Sd, 23011 + constexpr static OUStringLiteral msOptionsToolBar = u"optionsbar"; + // Draw_Options_Toolbox, 23020 + constexpr static OUStringLiteral msCommonTaskToolBar = u"commontaskbar"; + // Draw_CommonTask_Toolbox, 23021 + constexpr static OUStringLiteral msViewerToolBar = u"viewerbar"; // Draw_Viewer_Toolbox, 23023 + constexpr static OUStringLiteral msSlideSorterToolBar = u"slideviewtoolbar"; + // Slide_Toolbox, 23012 + constexpr static OUStringLiteral msSlideSorterObjectBar = u"slideviewobjectbar"; + // Slide_Obj_Toolbox, 23014 + constexpr static OUStringLiteral msOutlineToolBar = u"outlinetoolbar"; // Outline_Toolbox, 23017 + constexpr static OUStringLiteral msMasterViewToolBar = u"masterviewtoolbar"; + // SID_MASTERPAGE, 27053 + constexpr static OUStringLiteral msDrawingObjectToolBar = u"drawingobjectbar"; + // Draw_Obj_Toolbox, 23013 + constexpr static OUStringLiteral msGluePointsToolBar = u"gluepointsobjectbar"; + // Gluepoints_Toolbox, 23019 + constexpr static OUStringLiteral msTextObjectBar = u"textobjectbar"; + // Draw_Text_Toolbox_Sd, 23016 + constexpr static OUStringLiteral msBezierObjectBar = u"bezierobjectbar"; + // Bezier_Toolbox_Sd, 23015 + constexpr static OUStringLiteral msGraphicObjectBar = u"graphicobjectbar"; + // Draw_Graf_Toolbox, 23030 + constexpr static OUStringLiteral msMediaObjectBar = u"mediaobjectbar"; + // Draw_Media_Toolbox, 23031 + constexpr static OUStringLiteral msTableObjectBar = u"tableobjectbar"; + // Draw_Table_Toolbox, 23018 /** The set of tool bar groups. */ diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx index a38b541a74c8..c0114ffeb6b5 100644 --- a/sd/source/ui/inc/framework/FrameworkHelper.hxx +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -56,14 +56,14 @@ class FrameworkHelper { public: // URLs of frequently used panes. - static const OUStringLiteral msPaneURLPrefix; + static constexpr OUStringLiteral msPaneURLPrefix = u"private:resource/pane/"; static const OUString msCenterPaneURL; static const OUString msFullScreenPaneURL; static const OUString msLeftImpressPaneURL; static const OUString msLeftDrawPaneURL; // URLs of frequently used views. - static const OUStringLiteral msViewURLPrefix; + static constexpr OUStringLiteral msViewURLPrefix = u"private:resource/view/"; static const OUString msImpressViewURL; static const OUString msDrawViewURL; static const OUString msOutlineViewURL; @@ -74,20 +74,22 @@ public: static const OUString msSidebarViewURL; // URLs of frequently used tool bars. - static const OUStringLiteral msToolBarURLPrefix; + static constexpr OUStringLiteral msToolBarURLPrefix = u"private:resource/toolbar/"; static const OUString msViewTabBarURL; // URLs of task panels. - static const OUStringLiteral msTaskPanelURLPrefix; + static constexpr OUStringLiteral msTaskPanelURLPrefix = u"private:resource/toolpanel/"; // Names of frequently used events. - static const OUStringLiteral msResourceActivationRequestEvent; - static const OUStringLiteral msResourceDeactivationRequestEvent; - static const OUStringLiteral msResourceActivationEvent; - static const OUStringLiteral msResourceDeactivationEvent; - static const OUStringLiteral msResourceDeactivationEndEvent; - static const OUStringLiteral msConfigurationUpdateStartEvent; - static const OUStringLiteral msConfigurationUpdateEndEvent; + static constexpr OUStringLiteral msResourceActivationRequestEvent + = u"ResourceActivationRequested"; + static constexpr OUStringLiteral msResourceDeactivationRequestEvent + = u"ResourceDeactivationRequest"; + static constexpr OUStringLiteral msResourceActivationEvent = u"ResourceActivation"; + static constexpr OUStringLiteral msResourceDeactivationEvent = u"ResourceDeactivation"; + static constexpr OUStringLiteral msResourceDeactivationEndEvent = u"ResourceDeactivationEnd"; + static constexpr OUStringLiteral msConfigurationUpdateStartEvent = u"ConfigurationUpdateStart"; + static constexpr OUStringLiteral msConfigurationUpdateEndEvent = u"ConfigurationUpdateEnd"; /** Return the FrameworkHelper object that is associated with the given ViewShellBase. If such an object does not yet exist, a new one is diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 26b4a8e72cfc..9e29e3e47b89 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <memory> +#include <string_view> #include <utility> #include <com/sun/star/style/XStyle.hpp> @@ -805,7 +806,7 @@ SdAnimationInfo* SdXShape::GetAnimationInfo( bool bCreate ) const uno::Sequence< OUString > SAL_CALL SdXShape::getSupportedServiceNames() { - std::vector<OUStringLiteral> aAdd{ u"com.sun.star.presentation.Shape", + std::vector<std::u16string_view> aAdd{ u"com.sun.star.presentation.Shape", u"com.sun.star.document.LinkTarget" }; SdrObject* pObj = mpShape->GetSdrObject(); diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 16cca9c0ef34..1c95cb1820a6 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <initializer_list> +#include <string_view> #include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -1491,7 +1492,7 @@ Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames() { return comphelper::concatSequences( SvxFmDrawPage::getSupportedServiceNames(), - std::initializer_list<OUStringLiteral>{ u"com.sun.star.drawing.GenericDrawPage", + std::initializer_list<std::u16string_view>{ u"com.sun.star.drawing.GenericDrawPage", u"com.sun.star.document.LinkTarget", u"com.sun.star.document.LinkTargetSupplier" }); } @@ -2192,7 +2193,7 @@ Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throwIfDisposed(); - std::vector<OUStringLiteral> aAdd{ u"com.sun.star.drawing.DrawPage" }; + std::vector<std::u16string_view> aAdd{ u"com.sun.star.drawing.DrawPage" }; if( IsImpressDocument() ) aAdd.emplace_back(u"com.sun.star.presentation.DrawPage"); @@ -2714,7 +2715,7 @@ Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throwIfDisposed(); - std::vector<OUStringLiteral> aAdd{ u"com.sun.star.drawing.MasterPage" }; + std::vector<std::u16string_view> aAdd{ u"com.sun.star.drawing.MasterPage" }; if( SvxFmDrawPage::mpPage && static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetPageKind() == PageKind::Handout ) aAdd.emplace_back(u"com.sun.star.presentation.HandoutMasterPage"); diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 307eb40e1ea1..4373284d7708 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -328,22 +328,6 @@ private: //===== ToolBarManager ======================================================== -const OUStringLiteral ToolBarManager::msToolBar(u"toolbar"); -const OUStringLiteral ToolBarManager::msOptionsToolBar(u"optionsbar"); -const OUStringLiteral ToolBarManager::msCommonTaskToolBar(u"commontaskbar"); -const OUStringLiteral ToolBarManager::msViewerToolBar(u"viewerbar"); -const OUStringLiteral ToolBarManager::msSlideSorterToolBar(u"slideviewtoolbar"); -const OUStringLiteral ToolBarManager::msSlideSorterObjectBar(u"slideviewobjectbar"); -const OUStringLiteral ToolBarManager::msOutlineToolBar(u"outlinetoolbar"); -const OUStringLiteral ToolBarManager::msMasterViewToolBar(u"masterviewtoolbar"); -const OUStringLiteral ToolBarManager::msDrawingObjectToolBar(u"drawingobjectbar"); -const OUStringLiteral ToolBarManager::msGluePointsToolBar(u"gluepointsobjectbar"); -const OUStringLiteral ToolBarManager::msTextObjectBar(u"textobjectbar"); -const OUStringLiteral ToolBarManager::msBezierObjectBar(u"bezierobjectbar"); -const OUStringLiteral ToolBarManager::msGraphicObjectBar(u"graphicobjectbar"); -const OUStringLiteral ToolBarManager::msMediaObjectBar(u"mediaobjectbar"); -const OUStringLiteral ToolBarManager::msTableObjectBar(u"tableobjectbar"); - std::shared_ptr<ToolBarManager> ToolBarManager::Create ( ViewShellBase& rBase, const std::shared_ptr<sd::tools::EventMultiplexer>& rpMultiplexer, diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index b4511d898c31..0bcd5fcb3ddd 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> @@ -60,7 +64,7 @@ class ImageButtonHdl; const sal_uInt16 gButtonSlots[] = { SID_INSERT_TABLE, SID_INSERT_DIAGRAM, SID_INSERT_GRAPHIC, SID_INSERT_AVMEDIA }; static const char* gButtonToolTips[] = { STR_INSERT_TABLE, STR_INSERT_CHART, STR_INSERT_PICTURE, STR_INSERT_MOVIE }; -const OUStringLiteral aSmallPlaceHolders[] = +const std::u16string_view aSmallPlaceHolders[] = { u"" BMP_PLACEHOLDER_TABLE_SMALL, u"" BMP_PLACEHOLDER_CHART_SMALL, @@ -72,7 +76,7 @@ const OUStringLiteral aSmallPlaceHolders[] = u"" BMP_PLACEHOLDER_MOVIE_SMALL_HOVER }; -const OUStringLiteral aBigPlaceHolders[] = +const std::u16string_view aBigPlaceHolders[] = { u"" BMP_PLACEHOLDER_TABLE_LARGE, u"" BMP_PLACEHOLDER_CHART_LARGE, |