summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-08-27 11:40:59 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-08-28 08:07:09 +0200
commit33ecd0d5c4fff9511a8436513936a3f7044a775a (patch)
treec25809adda140ff89d9f2a2b6dfadba17e188fb0 /oox
parent554834484a3323f73b5aeace246bcd9635368967 (diff)
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 <sbergman@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/core/xmlfilterbase.cxx6
-rw-r--r--oox/source/crypto/Standard2007Engine.cxx2
-rw-r--r--oox/source/export/drawingml.cxx2
-rw-r--r--oox/source/export/shapes.cxx122
-rw-r--r--oox/source/helper/modelobjecthelper.cxx10
-rw-r--r--oox/source/ole/vbacontrol.cxx2
-rw-r--r--oox/source/vml/vmlshapecontext.cxx2
7 files changed, 73 insertions, 73 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 467758091ae7..eae0a4f615fc 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -180,7 +180,7 @@ struct XmlFilterBaseImpl
explicit XmlFilterBaseImpl();
};
-const OUStringLiteral gaBinSuffix( ".bin" );
+const OUStringLiteral gaBinSuffix( u".bin" );
XmlFilterBaseImpl::XmlFilterBaseImpl() :
mrNamespaceMap(StaticNamespaceMap::get())
@@ -247,7 +247,7 @@ void XmlFilterBase::putPropertiesToDocumentGrabBag(const css::uno::Reference<css
{
uno::Reference<beans::XPropertySetInfo> xPropsInfo = xDocProps->getPropertySetInfo();
- static const OUStringLiteral aGrabBagPropName = "InteropGrabBag";
+ static const OUStringLiteral aGrabBagPropName = u"InteropGrabBag";
if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(aGrabBagPropName))
{
// get existing grab bag
@@ -1033,7 +1033,7 @@ void XmlFilterBase::exportCustomFragments()
uno::Reference<beans::XPropertySet> xPropSet(xModel, uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
- static const OUStringLiteral aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
+ static const OUStringLiteral aName = u"" UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
if (!xPropSetInfo->hasPropertyByName(aName))
return;
diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx
index cf8796e119d6..ebfac58ee3f8 100644
--- a/oox/source/crypto/Standard2007Engine.cxx
+++ b/oox/source/crypto/Standard2007Engine.cxx
@@ -32,7 +32,7 @@ void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 aSize)
rtl_random_destroyPool(aRandomPool);
}
-const OUStringLiteral lclCspName = "Microsoft Enhanced RSA and AES Cryptographic Provider";
+const OUStringLiteral lclCspName = u"Microsoft Enhanced RSA and AES Cryptographic Provider";
constexpr const sal_uInt32 AES128Size = 16;
} // end anonymous namespace
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 869d1782643f..06bbfea85d61 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2908,7 +2908,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
OUString sPresetWarp(PresetGeometryTypeNames::GetMsoName(sShapeType));
// ODF may have user defined TextPath, use "textPlain" as ersatz.
if (sPresetWarp.isEmpty())
- sPresetWarp = bIsFontworkShape ? OUStringLiteral("textPlain") : OUStringLiteral("textNoShape");
+ sPresetWarp = bIsFontworkShape ? OUStringLiteral(u"textPlain") : OUStringLiteral(u"textNoShape");
bool bFromWordArt = !bScaleX
&& ( sPresetWarp == "textArchDown" || sPresetWarp == "textArchUp"
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 6ca713ade63d..3121aa745a16 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -521,65 +521,65 @@ ShapeExport& ShapeExport::WriteGroupShape(const uno::Reference<drawing::XShape>&
static bool lcl_IsOnDenylist(OUString const & rShapeType)
{
static const std::initializer_list<OUStringLiteral> vDenylist = {
- "block-arc",
- "rectangle",
- "ellipse",
- "ring",
- "can",
- "cube",
- "paper",
- "frame",
- "forbidden",
- "smiley",
- "sun",
- "flower",
- "bracket-pair",
- "brace-pair",
- "col-60da8460",
- "col-502ad400",
- "quad-bevel",
- "round-rectangular-callout",
- "rectangular-callout",
- "round-callout",
- "cloud-callout",
- "line-callout-1",
- "line-callout-2",
- "line-callout-3",
- "paper",
- "vertical-scroll",
- "horizontal-scroll",
- "mso-spt34",
- "mso-spt75",
- "mso-spt164",
- "mso-spt180",
- "flowchart-process",
- "flowchart-alternate-process",
- "flowchart-decision",
- "flowchart-data",
- "flowchart-predefined-process",
- "flowchart-internal-storage",
- "flowchart-document",
- "flowchart-multidocument",
- "flowchart-terminator",
- "flowchart-preparation",
- "flowchart-manual-input",
- "flowchart-manual-operation",
- "flowchart-connector",
- "flowchart-off-page-connector",
- "flowchart-card",
- "flowchart-punched-tape",
- "flowchart-summing-junction",
- "flowchart-or",
- "flowchart-collate",
- "flowchart-sort",
- "flowchart-extract",
- "flowchart-merge",
- "flowchart-stored-data",
- "flowchart-delay",
- "flowchart-sequential-access",
- "flowchart-magnetic-disk",
- "flowchart-direct-access-storage",
- "flowchart-display"
+ u"block-arc",
+ u"rectangle",
+ u"ellipse",
+ u"ring",
+ u"can",
+ u"cube",
+ u"paper",
+ u"frame",
+ u"forbidden",
+ u"smiley",
+ u"sun",
+ u"flower",
+ u"bracket-pair",
+ u"brace-pair",
+ u"col-60da8460",
+ u"col-502ad400",
+ u"quad-bevel",
+ u"round-rectangular-callout",
+ u"rectangular-callout",
+ u"round-callout",
+ u"cloud-callout",
+ u"line-callout-1",
+ u"line-callout-2",
+ u"line-callout-3",
+ u"paper",
+ u"vertical-scroll",
+ u"horizontal-scroll",
+ u"mso-spt34",
+ u"mso-spt75",
+ u"mso-spt164",
+ u"mso-spt180",
+ u"flowchart-process",
+ u"flowchart-alternate-process",
+ u"flowchart-decision",
+ u"flowchart-data",
+ u"flowchart-predefined-process",
+ u"flowchart-internal-storage",
+ u"flowchart-document",
+ u"flowchart-multidocument",
+ u"flowchart-terminator",
+ u"flowchart-preparation",
+ u"flowchart-manual-input",
+ u"flowchart-manual-operation",
+ u"flowchart-connector",
+ u"flowchart-off-page-connector",
+ u"flowchart-card",
+ u"flowchart-punched-tape",
+ u"flowchart-summing-junction",
+ u"flowchart-or",
+ u"flowchart-collate",
+ u"flowchart-sort",
+ u"flowchart-extract",
+ u"flowchart-merge",
+ u"flowchart-stored-data",
+ u"flowchart-delay",
+ u"flowchart-sequential-access",
+ u"flowchart-magnetic-disk",
+ u"flowchart-direct-access-storage",
+ u"flowchart-display"
};
return std::find(vDenylist.begin(), vDenylist.end(), rShapeType) != vDenylist.end();
@@ -588,8 +588,8 @@ static bool lcl_IsOnDenylist(OUString const & rShapeType)
static bool lcl_IsOnAllowlist(OUString const & rShapeType)
{
static const std::initializer_list<OUStringLiteral> vAllowlist = {
- "heart",
- "puzzle"
+ u"heart",
+ u"puzzle"
};
return std::find(vAllowlist.begin(), vAllowlist.end(), rShapeType) != vAllowlist.end();
diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx
index d2c761d28d3b..da84bd63c6c8 100644
--- a/oox/source/helper/modelobjecthelper.cxx
+++ b/oox/source/helper/modelobjecthelper.cxx
@@ -88,11 +88,11 @@ void ObjectContainer::createContainer() const
OSL_ENSURE( mxContainer.is(), "ObjectContainer::createContainer - container not found" );
}
-const OUStringLiteral gaDashNameBase( "msLineDash " ); ///< Base name for all named line dashes.
-const OUStringLiteral gaGradientNameBase( "msFillGradient " ); ///< Base name for all named fill gradients.
-const OUStringLiteral gaTransGradNameBase( "msTransGradient " ); ///< Base name for all named fill gradients.
-const OUStringLiteral gaBitmapUrlNameBase( "msFillBitmap " ); ///< Base name for all named fill bitmap URLs.
-const OUStringLiteral gaHatchNameBase( "msFillHatch " ); ///< Base name for all named fill hatches.
+const OUStringLiteral gaDashNameBase( u"msLineDash " ); ///< Base name for all named line dashes.
+const OUStringLiteral gaGradientNameBase( u"msFillGradient " ); ///< Base name for all named fill gradients.
+const OUStringLiteral gaTransGradNameBase( u"msTransGradient " ); ///< Base name for all named fill gradients.
+const OUStringLiteral gaBitmapUrlNameBase( u"msFillBitmap " ); ///< Base name for all named fill bitmap URLs.
+const OUStringLiteral gaHatchNameBase( u"msFillHatch " ); ///< Base name for all named fill hatches.
ModelObjectHelper::ModelObjectHelper( const Reference< XMultiServiceFactory >& rxModelFactory ) :
maMarkerContainer( rxModelFactory, "com.sun.star.drawing.MarkerTable" ),
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 7f61855ccf68..18bcb2226805 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -100,7 +100,7 @@ private:
sal_Int32 mnIndex;
};
-const OUStringLiteral gaDummyBaseName( "DummyGroupSep" );
+const OUStringLiteral gaDummyBaseName( u"DummyGroupSep" );
VbaControlNamesSet::VbaControlNamesSet() :
mnIndex( 0 )
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index f9ce59b8e431..6613f476930a 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -290,7 +290,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent,
{
mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
// get ShapeType and ShapeId from name for compatibility
- static const OUStringLiteral sShapeTypePrefix = "shapetype_";
+ static const OUStringLiteral sShapeTypePrefix = u"shapetype_";
if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
{
mrTypeModel.maShapeId = mrTypeModel.maShapeName;