[Libreoffice-commits] core.git: comphelper/source compilerplugins/clang cui/source include/oox include/rtl include/svtools include/svx include/vbahelper include/xmloff oox/source package/source registry/source reportdesign/source sc/source sd/source solenv/CompilerTest_compilerplugins_clang.mk svtools/source svx/source sw/source ucb/source vbahelper/source xmloff/inc xmloff/source xmlscript/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Aug 22 11:32:24 UTC 2018
comphelper/source/misc/backupfilehelper.cxx | 12
comphelper/source/officeinstdir/officeinstallationdirectories.cxx | 19
comphelper/source/officeinstdir/officeinstallationdirectories.hxx | 2
comphelper/source/xml/ofopxmlhelper.cxx | 78 -
compilerplugins/clang/conststringfield.cxx | 57
compilerplugins/clang/test/conststringfield.cxx | 43
cui/source/dialogs/colorpicker.cxx | 13
include/oox/helper/modelobjecthelper.hxx | 4
include/oox/vml/vmlinputstream.hxx | 2
include/rtl/ustring.hxx | 3
include/svtools/unoevent.hxx | 2
include/svx/xmleohlp.hxx | 2
include/vbahelper/vbaglobalbase.hxx | 1
include/xmloff/SettingsExportHelper.hxx | 8
include/xmloff/XMLEventExport.hxx | 2
include/xmloff/XMLPageExport.hxx | 3
include/xmloff/XMLTextMasterPageContext.hxx | 1
include/xmloff/XMLTextMasterPageExport.hxx | 14
include/xmloff/XMLTextShapeImportHelper.hxx | 4
include/xmloff/XMLTextShapeStyleContext.hxx | 2
include/xmloff/numehelp.hxx | 4
include/xmloff/prstylei.hxx | 2
include/xmloff/shapeexport.hxx | 22
include/xmloff/shapeimport.hxx | 5
include/xmloff/styleexp.hxx | 5
include/xmloff/txtparae.hxx | 95 -
include/xmloff/xmlnume.hxx | 3
include/xmloff/xmlnumi.hxx | 4
include/xmloff/xmlstyle.hxx | 3
oox/source/core/xmlfilterbase.cxx | 8
oox/source/helper/modelobjecthelper.cxx | 19
oox/source/ole/vbacontrol.cxx | 6
oox/source/vml/vmlinputstream.cxx | 9
package/source/manifest/ManifestImport.cxx | 289 ++---
package/source/manifest/ManifestImport.hxx | 71 -
registry/source/keyimpl.cxx | 22
registry/source/regimpl.cxx | 5
registry/source/regimpl.hxx | 2
reportdesign/source/filter/xml/xmlStyleImport.cxx | 17
reportdesign/source/filter/xml/xmlStyleImport.hxx | 4
sc/source/filter/excel/xeroot.cxx | 6
sc/source/filter/excel/xiescher.cxx | 9
sc/source/filter/excel/xlroot.cxx | 5
sc/source/filter/inc/xiescher.hxx | 1
sc/source/filter/inc/xlroot.hxx | 4
sc/source/filter/oox/pagesettings.cxx | 30
sc/source/filter/oox/worksheethelper.cxx | 6
sc/source/filter/xml/XMLStylesExportHelper.cxx | 43
sc/source/filter/xml/XMLStylesExportHelper.hxx | 11
sc/source/filter/xml/xmlexprt.cxx | 5
sc/source/filter/xml/xmlexprt.hxx | 1
sc/source/filter/xml/xmlstyli.cxx | 17
sc/source/filter/xml/xmlstyli.hxx | 4
sd/source/filter/html/htmlex.cxx | 27
sd/source/filter/html/htmlex.hxx | 2
sd/source/filter/xml/sdtransform.cxx | 16
sd/source/ui/presenter/PresenterTextView.cxx | 51
sd/source/ui/unoidl/unoobj.cxx | 117 --
solenv/CompilerTest_compilerplugins_clang.mk | 1
svtools/source/uno/unoevent.cxx | 6
svx/source/table/tablelayouter.cxx | 14
svx/source/table/tablelayouter.hxx | 2
svx/source/table/tablertfexporter.cxx | 8
svx/source/tbxctrls/extrusioncontrols.cxx | 17
svx/source/tbxctrls/extrusioncontrols.hxx | 2
svx/source/tbxctrls/fontworkgallery.cxx | 38
svx/source/xml/xmleohlp.cxx | 11
sw/source/filter/xml/xmltexte.cxx | 11
sw/source/filter/xml/xmltexte.hxx | 2
ucb/source/ucp/file/bc.cxx | 16
ucb/source/ucp/file/filtask.cxx | 37
ucb/source/ucp/file/filtask.hxx | 21
vbahelper/source/vbahelper/vbaglobalbase.cxx | 14
xmloff/inc/XMLFootnoteConfigurationImportContext.hxx | 13
xmloff/inc/XMLImageMapContext.hxx | 2
xmloff/inc/XMLImageMapExport.hxx | 12
xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx | 11
xmloff/inc/XMLLineNumberingImportContext.hxx | 12
xmloff/inc/XMLScriptContextFactory.hxx | 4
xmloff/inc/XMLScriptExportHandler.hxx | 2
xmloff/inc/XMLStarBasicContextFactory.hxx | 5
xmloff/inc/XMLStarBasicExportHandler.hxx | 6
xmloff/inc/XMLTextColumnsContext.hxx | 9
xmloff/inc/XMLTextColumnsExport.hxx | 9
xmloff/inc/txtflde.hxx | 76 -
xmloff/inc/txtfldi.hxx | 20
xmloff/source/core/SettingsExportHelper.cxx | 21
xmloff/source/draw/XMLImageMapContext.cxx | 12
xmloff/source/draw/XMLImageMapExport.cxx | 47
xmloff/source/draw/sdxmlexp.cxx | 13
xmloff/source/draw/sdxmlexp_impl.hxx | 2
xmloff/source/draw/shapeexport.cxx | 89 -
xmloff/source/draw/shapeimport.cxx | 15
xmloff/source/script/XMLEventExport.cxx | 4
xmloff/source/script/XMLScriptContextFactory.cxx | 15
xmloff/source/script/XMLScriptExportHandler.cxx | 6
xmloff/source/script/XMLStarBasicContextFactory.cxx | 19
xmloff/source/script/XMLStarBasicExportHandler.cxx | 23
xmloff/source/style/XMLPageExport.cxx | 15
xmloff/source/style/numehelp.cxx | 32
xmloff/source/style/prstylei.cxx | 14
xmloff/source/style/styleexp.cxx | 47
xmloff/source/style/xmlnume.cxx | 17
xmloff/source/style/xmlnumi.cxx | 20
xmloff/source/style/xmlstyle.cxx | 9
xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx | 48
xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx | 43
xmloff/source/text/XMLLineNumberingImportContext.cxx | 45
xmloff/source/text/XMLTextColumnsContext.cxx | 29
xmloff/source/text/XMLTextColumnsExport.cxx | 35
xmloff/source/text/XMLTextMasterPageContext.cxx | 9
xmloff/source/text/XMLTextMasterPageExport.cxx | 49
xmloff/source/text/XMLTextShapeImportHelper.cxx | 15
xmloff/source/text/XMLTextShapeStyleContext.cxx | 7
xmloff/source/text/txtflde.cxx | 571 +++++-----
xmloff/source/text/txtfldi.cxx | 75 -
xmloff/source/text/txtftne.cxx | 32
xmloff/source/text/txtparae.cxx | 384 +++---
xmloff/source/text/txtsecte.cxx | 4
xmloff/source/text/txtstyle.cxx | 10
xmlscript/source/xml_helper/xml_impctx.cxx | 19
121 files changed, 1517 insertions(+), 1881 deletions(-)
New commits:
commit 60bc26354763fa3461db49a3e827da552484150d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 16 16:57:15 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 22 13:31:57 2018 +0200
new loplugin:conststringfield
Look for const string fields which can be static, and
mostly convert them to OUStringLiteral
And add a getLength() method to OUStringLiteral to make
the transition easier.
Remove dead code in XclExpRoot::GenerateDefaultEncryptionData,
default password is never empty.
Change-Id: Iae75514d9dbb87289fd5b016222f640abe755091
Reviewed-on: https://gerrit.libreoffice.org/59204
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index d47c9904c696..7e5a76983e43 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -545,16 +545,16 @@ namespace
typedef std::vector< ExtensionInfoEntry > ExtensionInfoEntryVector;
+ static const OUStringLiteral gaRegPath { "/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml" };
+
class ExtensionInfo
{
private:
ExtensionInfoEntryVector maEntries;
- OUString const maRegPath;
public:
ExtensionInfo()
- : maEntries(),
- maRegPath("/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml")
+ : maEntries()
{
}
@@ -677,19 +677,19 @@ namespace
public:
void createUserExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL)
{
- const OUString aPath(rUserConfigWorkURL + "/uno_packages/cache" + maRegPath);
+ const OUString aPath(rUserConfigWorkURL + "/uno_packages/cache" + gaRegPath);
createExtensionRegistryEntriesFromXML(aPath);
}
void createSharedExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL)
{
- const OUString aPath(rUserConfigWorkURL + "/extensions/shared" + maRegPath);
+ const OUString aPath(rUserConfigWorkURL + "/extensions/shared" + gaRegPath);
createExtensionRegistryEntriesFromXML(aPath);
}
void createBundledExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL)
{
- const OUString aPath(rUserConfigWorkURL + "/extensions/bundled" + maRegPath);
+ const OUString aPath(rUserConfigWorkURL + "/extensions/bundled" + gaRegPath);
createExtensionRegistryEntriesFromXML(aPath);
}
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
index a1850d4b6fc8..1323f79a22de 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
@@ -75,11 +75,12 @@ static bool makeCanonicalFileURL( OUString & rURL )
namespace comphelper {
+static OUString const g_aOfficeBrandDirMacro("$(brandbaseurl)");
+static OUString const g_aUserDirMacro("$(userdataurl)");
+
OfficeInstallationDirectories::OfficeInstallationDirectories(
const uno::Reference< uno::XComponentContext > & xCtx )
-: m_aOfficeBrandDirMacro( "$(brandbaseurl)" ),
- m_aUserDirMacro( "$(userdataurl)" ),
- m_xCtx( xCtx ),
+: m_xCtx( xCtx ),
m_pOfficeBrandDir( nullptr ),
m_pUserDir( nullptr )
{
@@ -131,7 +132,7 @@ OfficeInstallationDirectories::makeRelocatableURL( const OUString& URL )
return
aCanonicalURL.replaceAt( nIndex,
m_pOfficeBrandDir->getLength(),
- m_aOfficeBrandDirMacro );
+ g_aOfficeBrandDirMacro );
}
else
{
@@ -141,7 +142,7 @@ OfficeInstallationDirectories::makeRelocatableURL( const OUString& URL )
return
aCanonicalURL.replaceAt( nIndex,
m_pUserDir->getLength(),
- m_aUserDirMacro );
+ g_aUserDirMacro );
}
}
}
@@ -155,26 +156,26 @@ OfficeInstallationDirectories::makeAbsoluteURL( const OUString& URL )
{
if ( !URL.isEmpty() )
{
- sal_Int32 nIndex = URL.indexOf( m_aOfficeBrandDirMacro );
+ sal_Int32 nIndex = URL.indexOf( g_aOfficeBrandDirMacro );
if ( nIndex != -1 )
{
initDirs();
return
URL.replaceAt( nIndex,
- m_aOfficeBrandDirMacro.getLength(),
+ g_aOfficeBrandDirMacro.getLength(),
*m_pOfficeBrandDir );
}
else
{
- nIndex = URL.indexOf( m_aUserDirMacro );
+ nIndex = URL.indexOf( g_aUserDirMacro );
if ( nIndex != -1 )
{
initDirs();
return
URL.replaceAt( nIndex,
- m_aUserDirMacro.getLength(),
+ g_aUserDirMacro.getLength(),
*m_pUserDir );
}
}
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
index e2b04a7687fb..bfcde8d72876 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
@@ -69,8 +69,6 @@ public:
private:
void initDirs();
- OUString const m_aOfficeBrandDirMacro;
- OUString const m_aUserDirMacro;
css::uno::Reference< css::uno::XComponentContext > m_xCtx;
std::unique_ptr<OUString> m_pOfficeBrandDir;
std::unique_ptr<OUString> m_pUserDir;
diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx
index 62cd50aba2ca..4a2bf122b39e 100644
--- a/comphelper/source/xml/ofopxmlhelper.cxx
+++ b/comphelper/source/xml/ofopxmlhelper.cxx
@@ -47,22 +47,6 @@ class OFOPXMLHelper_Impl
{
sal_uInt16 const m_nFormat; // which format to parse
- // Relations info related strings
- OUString const m_aRelListElement;
- OUString const m_aRelElement;
- OUString const m_aIDAttr;
- OUString const m_aTypeAttr;
- OUString const m_aTargetModeAttr;
- OUString const m_aTargetAttr;
-
- // ContentType related strings
- OUString const m_aTypesElement;
- OUString const m_aDefaultElement;
- OUString const m_aOverrideElement;
- OUString const m_aExtensionAttr;
- OUString const m_aPartNameAttr;
- OUString const m_aContentTypeAttr;
-
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > m_aResultSeq;
std::vector< OUString > m_aElementsSeq; // stack of elements being parsed
@@ -284,20 +268,24 @@ uno::Sequence< uno::Sequence< beans::StringPair > > ReadSequence_Impl(
} // namespace OFOPXMLHelper
+// Relations info related strings
+static OUString const g_aRelListElement("Relationships");
+static OUString const g_aRelElement( "Relationship" );
+static OUString const g_aIDAttr( "Id" );
+static OUString const g_aTypeAttr( "Type" );
+static OUString const g_aTargetModeAttr( "TargetMode" );
+static OUString const g_aTargetAttr( "Target" );
+
+// ContentType related strings
+static OUString const g_aTypesElement( "Types" );
+static OUString const g_aDefaultElement( "Default" );
+static OUString const g_aOverrideElement( "Override" );
+static OUString const g_aExtensionAttr( "Extension" );
+static OUString const g_aPartNameAttr( "PartName" );
+static OUString const g_aContentTypeAttr( "ContentType" );
+
OFOPXMLHelper_Impl::OFOPXMLHelper_Impl( sal_uInt16 nFormat )
: m_nFormat( nFormat )
-, m_aRelListElement( "Relationships" )
-, m_aRelElement( "Relationship" )
-, m_aIDAttr( "Id" )
-, m_aTypeAttr( "Type" )
-, m_aTargetModeAttr( "TargetMode" )
-, m_aTargetAttr( "Target" )
-, m_aTypesElement( "Types" )
-, m_aDefaultElement( "Default" )
-, m_aOverrideElement( "Override" )
-, m_aExtensionAttr( "Extension" )
-, m_aPartNameAttr( "PartName" )
-, m_aContentTypeAttr( "ContentType" )
{
}
@@ -324,7 +312,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
{
if ( m_nFormat == RELATIONINFO_FORMAT )
{
- if ( aName == m_aRelListElement )
+ if ( aName == g_aRelListElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
@@ -335,7 +323,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
return; // nothing to do
}
- else if ( aName == m_aRelElement )
+ else if ( aName == g_aRelElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
if ( nNewLength != 2 )
@@ -348,32 +336,32 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
sal_Int32 nAttrNum = 0;
m_aResultSeq[nNewEntryNum-1].realloc( 4 ); // the maximal expected number of arguments is 4
- OUString aIDValue = xAttribs->getValueByName( m_aIDAttr );
+ OUString aIDValue = xAttribs->getValueByName( g_aIDAttr );
if ( aIDValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the ID value must present
- OUString aTypeValue = xAttribs->getValueByName( m_aTypeAttr );
- OUString aTargetValue = xAttribs->getValueByName( m_aTargetAttr );
- OUString aTargetModeValue = xAttribs->getValueByName( m_aTargetModeAttr );
+ OUString aTypeValue = xAttribs->getValueByName( g_aTypeAttr );
+ OUString aTargetValue = xAttribs->getValueByName( g_aTargetAttr );
+ OUString aTargetModeValue = xAttribs->getValueByName( g_aTargetModeAttr );
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aIDAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aIDAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aIDValue;
if ( !aTypeValue.isEmpty() )
{
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTypeAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aTypeAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTypeValue;
}
if ( !aTargetValue.isEmpty() )
{
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aTargetAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetValue;
}
if ( !aTargetModeValue.isEmpty() )
{
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetModeAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aTargetModeAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetModeValue;
}
@@ -384,7 +372,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
}
else if ( m_nFormat == CONTENTTYPE_FORMAT )
{
- if ( aName == m_aTypesElement )
+ if ( aName == g_aTypesElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
@@ -398,7 +386,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
return; // nothing to do
}
- else if ( aName == m_aDefaultElement )
+ else if ( aName == g_aDefaultElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
if ( nNewLength != 2 )
@@ -412,11 +400,11 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
if ( m_aResultSeq.getLength() != 2 )
throw uno::RuntimeException();
- const OUString aExtensionValue = xAttribs->getValueByName( m_aExtensionAttr );
+ const OUString aExtensionValue = xAttribs->getValueByName( g_aExtensionAttr );
if ( aExtensionValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the Extension value must present
- const OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
+ const OUString aContentTypeValue = xAttribs->getValueByName( g_aContentTypeAttr );
if ( aContentTypeValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the ContentType value must present
@@ -426,7 +414,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
m_aResultSeq[0][nNewResultLen-1].First = aExtensionValue;
m_aResultSeq[0][nNewResultLen-1].Second = aContentTypeValue;
}
- else if ( aName == m_aOverrideElement )
+ else if ( aName == g_aOverrideElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
if ( nNewLength != 2 )
@@ -440,11 +428,11 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
if ( m_aResultSeq.getLength() != 2 )
throw uno::RuntimeException();
- OUString aPartNameValue = xAttribs->getValueByName( m_aPartNameAttr );
+ OUString aPartNameValue = xAttribs->getValueByName( g_aPartNameAttr );
if ( aPartNameValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the PartName value must present
- OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
+ OUString aContentTypeValue = xAttribs->getValueByName( g_aContentTypeAttr );
if ( aContentTypeValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the ContentType value must present
diff --git a/compilerplugins/clang/conststringfield.cxx b/compilerplugins/clang/conststringfield.cxx
new file mode 100644
index 000000000000..23a7db9ebea2
--- /dev/null
+++ b/compilerplugins/clang/conststringfield.cxx
@@ -0,0 +1,57 @@
+/* -*- 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/.
+ */
+
+#include "plugin.hxx"
+#include "check.hxx"
+#include "compat.hxx"
+#include <iostream>
+
+namespace
+{
+class ConstStringField : public loplugin::FilteringPlugin<ConstStringField>
+{
+public:
+ explicit ConstStringField(loplugin::InstantiationData const& data)
+ : loplugin::FilteringPlugin<ConstStringField>(data)
+ {
+ }
+
+ void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+
+ bool TraverseConstructorInitializer(CXXCtorInitializer* init);
+};
+
+bool ConstStringField::TraverseConstructorInitializer(CXXCtorInitializer* init)
+{
+ if (!init->getSourceLocation().isValid() || ignoreLocation(init->getSourceLocation()))
+ return true;
+ if (!init->getMember())
+ return true;
+ auto tc = loplugin::TypeCheck(init->getMember()->getType());
+ if (!tc.Const().Class("OUString").Namespace("rtl").GlobalNamespace()
+ && !tc.Const().Class("OString").Namespace("rtl").GlobalNamespace())
+ return true;
+ if (auto constructExpr = dyn_cast<CXXConstructExpr>(init->getInit()))
+ {
+ if (constructExpr->getNumArgs() >= 1 && isa<clang::StringLiteral>(constructExpr->getArg(0)))
+ {
+ report(DiagnosticsEngine::Warning, "string field can be static const",
+ init->getSourceLocation())
+ << init->getSourceRange();
+ report(DiagnosticsEngine::Note, "field here", init->getMember()->getLocation())
+ << init->getMember()->getSourceRange();
+ }
+ }
+ return RecursiveASTVisitor::TraverseConstructorInitializer(init);
+}
+
+loplugin::Plugin::Registration<ConstStringField> X("conststringfield", true);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/test/conststringfield.cxx b/compilerplugins/clang/test/conststringfield.cxx
new file mode 100644
index 000000000000..fa8785713521
--- /dev/null
+++ b/compilerplugins/clang/test/conststringfield.cxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#include <rtl/ustring.hxx>
+#include <rtl/string.hxx>
+
+class Class1
+{
+ OUString const m_field1; // expected-note {{field here [loplugin:conststringfield]}}
+ Class1()
+ : m_field1("xxxx")
+ // expected-error at -1 {{string field can be static const [loplugin:conststringfield]}}
+ {
+ }
+};
+
+class Class2
+{
+ OString const m_field1; // expected-note {{field here [loplugin:conststringfield]}}
+ Class2()
+ : m_field1("xxxx")
+ // expected-error at -1 {{string field can be static const [loplugin:conststringfield]}}
+ {
+ }
+};
+
+// no warning expected
+class Class4
+{
+ OUString m_field1;
+ Class4()
+ : m_field1("xxxx")
+ {
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index c928c0493e45..24a498238d2f 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -1212,8 +1212,6 @@ public:
private:
OUString msTitle;
- const OUString msColorKey;
- const OUString msModeKey;
Color mnColor;
sal_Int16 mnMode;
Reference<css::awt::XWindow> mxParent;
@@ -1235,10 +1233,11 @@ Sequence< OUString > ColorPicker_getSupportedServiceNames()
return seq;
}
+static const OUStringLiteral gsColorKey( "Color" );
+static const OUStringLiteral gsModeKey( "Mode" );
+
ColorPicker::ColorPicker()
: ColorPickerBase( m_aMutex )
- , msColorKey( "Color" )
- , msModeKey( "Mode" )
, mnColor( 0 )
, mnMode( 0 )
{
@@ -1273,7 +1272,7 @@ Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( )
Sequence< PropertyValue > SAL_CALL ColorPicker::getPropertyValues( )
{
Sequence< PropertyValue > props(1);
- props[0].Name = msColorKey;
+ props[0].Name = gsColorKey;
props[0].Value <<= mnColor;
return props;
}
@@ -1282,11 +1281,11 @@ void SAL_CALL ColorPicker::setPropertyValues( const Sequence< PropertyValue >& a
{
for( sal_Int32 n = 0; n < aProps.getLength(); n++ )
{
- if( aProps[n].Name == msColorKey )
+ if( aProps[n].Name == gsColorKey )
{
aProps[n].Value >>= mnColor;
}
- else if( aProps[n].Name == msModeKey )
+ else if( aProps[n].Name == gsModeKey )
{
aProps[n].Value >>= mnMode;
}
diff --git a/include/oox/helper/modelobjecthelper.hxx b/include/oox/helper/modelobjecthelper.hxx
index eb9c7ba97228..5b5dea4f4092 100644
--- a/include/oox/helper/modelobjecthelper.hxx
+++ b/include/oox/helper/modelobjecthelper.hxx
@@ -117,10 +117,6 @@ private:
ObjectContainer maGradientContainer; ///< Contains all named fill gradients.
ObjectContainer maTransGradContainer; ///< Contains all named transparency Gradients.
ObjectContainer maBitmapUrlContainer; ///< Contains all named fill bitmap URLs.
- const OUString maDashNameBase; ///< Base name for all named line dashes.
- const OUString maGradientNameBase; ///< Base name for all named fill gradients.
- const OUString maTransGradNameBase; ///< Base name for all named fill gradients.
- const OUString maBitmapUrlNameBase; ///< Base name for all named fill bitmap URLs.
};
diff --git a/include/oox/vml/vmlinputstream.hxx b/include/oox/vml/vmlinputstream.hxx
index ed5db08330f4..54b93bbe4344 100644
--- a/include/oox/vml/vmlinputstream.hxx
+++ b/include/oox/vml/vmlinputstream.hxx
@@ -90,8 +90,6 @@ private:
mxTextStrm;
css::uno::Sequence< sal_Unicode > maOpeningBracket;
css::uno::Sequence< sal_Unicode > maClosingBracket;
- const OString maOpeningCData;
- const OString maClosingCData;
OString maBuffer;
sal_Int32 mnBufferPos;
};
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 1795f486162b..7ab872e9d61d 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -87,6 +87,9 @@ struct SAL_WARN_UNUSED OUStringLiteral
int size;
const char* data;
+
+ // So we can use this struct in some places interchangeably with OUString
+ constexpr sal_Int32 getLength() const { return size; }
};
/// @endcond
diff --git a/include/svtools/unoevent.hxx b/include/svtools/unoevent.hxx
index 74470085ff52..bb2d438fe04f 100644
--- a/include/svtools/unoevent.hxx
+++ b/include/svtools/unoevent.hxx
@@ -207,8 +207,6 @@ class SVT_DLLPUBLIC SvDetachedEventDescriptor : public SvBaseEventDescriptor
// the macros; aMacros[i] is the value for aSupportedMacroItemIDs[i]
std::vector<std::unique_ptr<SvxMacro>> aMacros;
- const OUString sImplName;
-
public:
SvDetachedEventDescriptor(const SvEventDescription* pSupportedMacroItems);
diff --git a/include/svx/xmleohlp.hxx b/include/svx/xmleohlp.hxx
index c96f40c3d75c..2cd352bc159d 100644
--- a/include/svx/xmleohlp.hxx
+++ b/include/svx/xmleohlp.hxx
@@ -46,8 +46,6 @@ class SVX_DLLPUBLIC SvXMLEmbeddedObjectHelper final :
{
::osl::Mutex maMutex;
- const OUString maReplacementGraphicsContainerStorageName;
- const OUString maReplacementGraphicsContainerStorageName60;
OUString maCurContainerStorageName;
diff --git a/include/vbahelper/vbaglobalbase.hxx b/include/vbahelper/vbaglobalbase.hxx
index fe338acd7f21..ed1f2114fcfb 100644
--- a/include/vbahelper/vbaglobalbase.hxx
+++ b/include/vbahelper/vbaglobalbase.hxx
@@ -48,7 +48,6 @@ class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
{
protected:
const OUString msDocCtxName;
- const OUString msApplication;
bool hasServiceName( const OUString& serviceName );
void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
diff --git a/include/xmloff/SettingsExportHelper.hxx b/include/xmloff/SettingsExportHelper.hxx
index df73af11999d..ff503b2b2749 100644
--- a/include/xmloff/SettingsExportHelper.hxx
+++ b/include/xmloff/SettingsExportHelper.hxx
@@ -46,14 +46,6 @@ class XMLOFF_DLLPUBLIC XMLSettingsExportHelper
css::uno::Reference< css::util::XStringSubstitution > mxStringSubsitution;
- const OUString msPrinterIndependentLayout;
- const OUString msColorTableURL;
- const OUString msLineEndTableURL;
- const OUString msHatchTableURL;
- const OUString msDashTableURL;
- const OUString msGradientTableURL;
- const OUString msBitmapTableURL;
-
void ManipulateSetting( css::uno::Any& rAny, const OUString& rName ) const;
void CallTypeFunction(const css::uno::Any& rAny,
diff --git a/include/xmloff/XMLEventExport.hxx b/include/xmloff/XMLEventExport.hxx
index 5ca4a2b23448..797fc4a6dde3 100644
--- a/include/xmloff/XMLEventExport.hxx
+++ b/include/xmloff/XMLEventExport.hxx
@@ -58,8 +58,6 @@ typedef ::std::map< OUString, XMLEventName > NameMap;
*/
class XMLOFF_DLLPUBLIC XMLEventExport
{
- const OUString sEventType;
-
SvXMLExport& rExport;
HandlerMap aHandlerMap;
diff --git a/include/xmloff/XMLPageExport.hxx b/include/xmloff/XMLPageExport.hxx
index 0bfee31c8b59..4df54310e731 100644
--- a/include/xmloff/XMLPageExport.hxx
+++ b/include/xmloff/XMLPageExport.hxx
@@ -53,9 +53,6 @@ class XMLOFF_DLLPUBLIC XMLPageExport : public salhelper::SimpleReferenceObject
{
SvXMLExport& rExport;
- const OUString sIsPhysical;
- const OUString sFollowStyle;
-
css::uno::Reference< css::container::XNameAccess > xPageStyles;
::std::vector< XMLPageExportNameEntry > aNameVector;
diff --git a/include/xmloff/XMLTextMasterPageContext.hxx b/include/xmloff/XMLTextMasterPageContext.hxx
index ca715494dcca..cda2bb4a77a4 100644
--- a/include/xmloff/XMLTextMasterPageContext.hxx
+++ b/include/xmloff/XMLTextMasterPageContext.hxx
@@ -31,7 +31,6 @@ namespace com { namespace sun { namespace star {
class XMLOFF_DLLPUBLIC XMLTextMasterPageContext : public SvXMLStyleContext
{
- const OUString sFollowStyle;
OUString sFollow;
OUString sPageMasterName;
diff --git a/include/xmloff/XMLTextMasterPageExport.hxx b/include/xmloff/XMLTextMasterPageExport.hxx
index 150a74020c48..c56e90116c31 100644
--- a/include/xmloff/XMLTextMasterPageExport.hxx
+++ b/include/xmloff/XMLTextMasterPageExport.hxx
@@ -32,20 +32,6 @@ namespace com { namespace sun { namespace star {
class XMLOFF_DLLPUBLIC XMLTextMasterPageExport : public XMLPageExport
{
- const OUString sHeaderText;
- const OUString sHeaderOn;
- const OUString sHeaderShareContent;
- const OUString sHeaderTextFirst;
- const OUString sHeaderTextLeft;
-
- const OUString sFirstShareContent;
-
- const OUString sFooterText;
- const OUString sFooterOn;
- const OUString sFooterShareContent;
- const OUString sFooterTextFirst;
- const OUString sFooterTextLeft;
-
protected:
virtual void exportHeaderFooterContent(
diff --git a/include/xmloff/XMLTextShapeImportHelper.hxx b/include/xmloff/XMLTextShapeImportHelper.hxx
index 7a1a0a03f6fe..42f5d412f5b4 100644
--- a/include/xmloff/XMLTextShapeImportHelper.hxx
+++ b/include/xmloff/XMLTextShapeImportHelper.hxx
@@ -28,10 +28,6 @@ class XMLOFF_DLLPUBLIC XMLTextShapeImportHelper : public XMLShapeImportHelper
{
SvXMLImport& rImport;
- const OUString sAnchorType;
- const OUString sAnchorPageNo;
- const OUString sVertOrientPosition;
-
public:
XMLTextShapeImportHelper( SvXMLImport& rImp );
diff --git a/include/xmloff/XMLTextShapeStyleContext.hxx b/include/xmloff/XMLTextShapeStyleContext.hxx
index f1f9bf5a49d5..830da64c1838 100644
--- a/include/xmloff/XMLTextShapeStyleContext.hxx
+++ b/include/xmloff/XMLTextShapeStyleContext.hxx
@@ -25,8 +25,6 @@
class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext : public XMLShapeStyleContext
{
- const OUString sIsAutoUpdate;
-
bool bAutoUpdate : 1;
SvXMLImportContextRef xEventContext;
diff --git a/include/xmloff/numehelp.hxx b/include/xmloff/numehelp.hxx
index dba76e714ed7..9402eaec011c 100644
--- a/include/xmloff/numehelp.hxx
+++ b/include/xmloff/numehelp.hxx
@@ -59,16 +59,12 @@ class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper
{
css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
SvXMLExport* pExport;
- const OUString sStandardFormat;
- const OUString sType;
const OUString sAttrValue;
const OUString sAttrDateValue;
const OUString sAttrTimeValue;
const OUString sAttrBooleanValue;
const OUString sAttrStringValue;
const OUString sAttrCurrency;
- const OUString msCurrencySymbol;
- const OUString msCurrencyAbbreviation;
XMLNumberFormatSet aNumberFormats;
public:
XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier);
diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx
index 1fbda3c11f77..da79ed726ad7 100644
--- a/include/xmloff/prstylei.hxx
+++ b/include/xmloff/prstylei.hxx
@@ -40,8 +40,6 @@ typedef std::unordered_set<OUString> OldFillStyleDefinitionSet;
class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
{
private:
- const OUString msIsPhysical;
- const OUString msFollowStyle;
::std::vector< XMLPropertyState > maProperties;
css::uno::Reference < css::style::XStyle > mxStyle;
SvXMLImportContextRef mxStyles;
diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx
index 1865210d5bde..def1bd936536 100644
--- a/include/xmloff/shapeexport.hxx
+++ b/include/xmloff/shapeexport.hxx
@@ -182,28 +182,6 @@ private:
SAL_DLLPRIVATE const rtl::Reference< SvXMLExportPropertyMapper >& GetPropertySetMapper() const { return mxPropertySetMapper; }
- const OUString msZIndex;
- const OUString msPrintable;
- const OUString msVisible;
-
- const OUString msModel;
- const OUString msStartShape;
- const OUString msEndShape;
- const OUString msOnClick;
- const OUString msEventType;
- const OUString msPresentation;
- const OUString msMacroName;
- const OUString msScript;
- const OUString msLibrary;
- const OUString msClickAction;
- const OUString msBookmark;
- const OUString msEffect;
- const OUString msPlayFull;
- const OUString msVerb;
- const OUString msSoundURL;
- const OUString msSpeed;
- const OUString msStarBasic;
-
OUStringBuffer msBuffer;
SAL_DLLPRIVATE void ImpCalcShapeType(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType& eShapeType);
diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx
index 080b71a02d0f..db7804be82b5 100644
--- a/include/xmloff/shapeimport.hxx
+++ b/include/xmloff/shapeimport.hxx
@@ -242,11 +242,6 @@ class XMLOFF_DLLPUBLIC XMLShapeImportHelper : public salhelper::SimpleReferenceO
std::unique_ptr<SvXMLTokenMap> mp3DSphereObjectAttrTokenMap;
std::unique_ptr<SvXMLTokenMap> mp3DLightAttrTokenMap;
- const OUString msStartShape;
- const OUString msEndShape;
- const OUString msStartGluePointIndex;
- const OUString msEndGluePointIndex;
-
rtl::Reference< XMLTableImport > mxShapeTableImport;
protected:
diff --git a/include/xmloff/styleexp.hxx b/include/xmloff/styleexp.hxx
index 0418aaebc8e5..66a23053005e 100644
--- a/include/xmloff/styleexp.hxx
+++ b/include/xmloff/styleexp.hxx
@@ -52,11 +52,6 @@ class SvXMLExport;
class XMLOFF_DLLPUBLIC XMLStyleExport : public salhelper::SimpleReferenceObject
{
SvXMLExport& rExport;
- const OUString sIsPhysical;
- const OUString sIsAutoUpdate;
- const OUString sFollowStyle;
- const OUString sNumberingStyleName;
- const OUString sOutlineLevel;
SvXMLAutoStylePoolP *pAutoStylePool;
protected:
diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index 6a09abdaf30f..f19080d0c518 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -132,83 +132,28 @@ public:
private:
// Implement Title/Description Elements UI (#i73249#)
- const OUString sTitle;
- const OUString sDescription;
- const OUString sAnchorCharStyleName;
- const OUString sAnchorPageNo;
- const OUString sAnchorType;
- const OUString sBeginNotice;
- const OUString sBookmark;
- const OUString sCategory;
- const OUString sChainNextName;
- const OUString sCharStyleName;
- const OUString sCharStyleNames;
- const OUString sContourPolyPolygon;
- const OUString sDocumentIndexMark;
- const OUString sEndNotice;
- const OUString sFootnote;
- const OUString sFootnoteCounting;
- const OUString sFrame;
- const OUString sGraphicFilter;
- const OUString sGraphicRotation;
- const OUString sHeight;
- const OUString sHoriOrient;
- const OUString sHoriOrientPosition;
- const OUString sHyperLinkName;
- const OUString sHyperLinkTarget;
- const OUString sHyperLinkURL;
- const OUString sIsAutomaticContour;
- const OUString sIsCollapsed;
- const OUString sIsPixelContour;
- const OUString sIsStart;
- const OUString sIsSyncHeightToWidth;
- const OUString sIsSyncWidthToHeight;
- const OUString sNumberingRules;
- const OUString sNumberingType;
- const OUString sPageDescName;
- const OUString sPageStyleName;
- const OUString sParaConditionalStyleName;
- const OUString sParagraphService;
- const OUString sParaStyleName;
- const OUString sPositionEndOfDoc;
- const OUString sPrefix;
- const OUString sRedline;
- const OUString sReferenceId;
- const OUString sReferenceMark;
- const OUString sRelativeHeight;
- const OUString sRelativeWidth;
- const OUString sRuby;
- const OUString sRubyCharStyleName;
- const OUString sRubyText;
- const OUString sServerMap;
- const OUString sShapeService;
- const OUString sSizeType;
- const OUString sSoftPageBreak;
- const OUString sStartAt;
- const OUString sSuffix;
- const OUString sTableService;
- const OUString sText;
- const OUString sTextContentService;
- const OUString sTextEmbeddedService;
- const OUString sTextEndnoteService;
- const OUString sTextField;
- const OUString sTextFieldService;
- const OUString sTextFrameService;
- const OUString sTextGraphicService;
- const OUString sTextPortionType;
- const OUString sTextSection;
- const OUString sUnvisitedCharStyleName;
- const OUString sVertOrient;
- const OUString sVertOrientPosition;
- const OUString sVisitedCharStyleName;
- const OUString sWidth;
- const OUString sWidthType;
- const OUString sTextFieldStart;
- const OUString sTextFieldEnd;
- const OUString sTextFieldStartEnd;
+ static const OUStringLiteral gsAnchorCharStyleName;
+ static const OUStringLiteral gsBeginNotice;
+ static const OUStringLiteral gsCategory;
+ static const OUStringLiteral gsCharStyleName;
+ static const OUStringLiteral gsCharStyleNames;
+ static const OUStringLiteral gsEndNotice;
+ static const OUStringLiteral gsFootnote;
+ static const OUStringLiteral gsFootnoteCounting;
+ static const OUStringLiteral gsNumberingType;
+ static const OUStringLiteral gsPageDescName;
+ static const OUStringLiteral gsPageStyleName;
+ static const OUStringLiteral gsParaStyleName;
+ static const OUStringLiteral gsPositionEndOfDoc;
+ static const OUStringLiteral gsPrefix;
+ static const OUStringLiteral gsReferenceId;
+ static const OUStringLiteral gsStartAt;
+ static const OUStringLiteral gsSuffix;
+ static const OUStringLiteral gsTextEndnoteService;
+ static const OUStringLiteral gsTextSection;
protected:
- const OUString sFrameStyleName;
+ static const OUStringLiteral gsFrameStyleName;
SinglePropertySetInfoCache aCharStyleNamesPropInfoCache;
SvXMLAutoStylePoolP& GetAutoStylePool() { return rAutoStylePool; }
diff --git a/include/xmloff/xmlnume.hxx b/include/xmloff/xmlnume.hxx
index 0a4b1b5836ea..f8d905e522f4 100644
--- a/include/xmloff/xmlnume.hxx
+++ b/include/xmloff/xmlnume.hxx
@@ -40,9 +40,6 @@ class XMLTextListAutoStylePool;
class XMLOFF_DLLPUBLIC SvxXMLNumRuleExport final
{
SvXMLExport& rExport;
- const OUString sNumberingRules;
- const OUString sIsPhysical;
- const OUString sIsContinuousNumbering;
// Boolean indicating, if properties for position-and-space-mode LABEL_ALIGNMENT
// are exported or not. (#i89178#)
// These properties have been introduced in ODF 1.2. Thus, its export have
diff --git a/include/xmloff/xmlnumi.hxx b/include/xmloff/xmlnumi.hxx
index 57898f76d254..877340d34df1 100644
--- a/include/xmloff/xmlnumi.hxx
+++ b/include/xmloff/xmlnumi.hxx
@@ -38,10 +38,6 @@ typedef std::vector<rtl::Reference<SvxXMLListLevelStyleContext_Impl>> SvxXMLList
class XMLOFF_DLLPUBLIC SvxXMLListStyleContext
: public SvXMLStyleContext
{
- const OUString sIsPhysical;
- const OUString sNumberingRules;
- const OUString sIsContinuousNumbering;
-
css::uno::Reference< css::container::XIndexReplace > xNumRules;
std::unique_ptr<SvxXMLListStyle_Impl> pLevelStyles;
diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx
index 1c06b1388aed..292af5128e3e 100644
--- a/include/xmloff/xmlstyle.hxx
+++ b/include/xmloff/xmlstyle.hxx
@@ -148,9 +148,6 @@ public:
class XMLOFF_DLLPUBLIC SvXMLStylesContext : public SvXMLImportContext
{
- const OUString msParaStyleServiceName;
- const OUString msTextStyleServiceName;
-
std::unique_ptr<SvXMLStylesContext_Impl> mpImpl;
std::unique_ptr<SvXMLTokenMap> mpStyleStylesElemTokenMap;
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 0a9ad85582e3..09d5dd63060d 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -176,7 +176,6 @@ struct XmlFilterBaseImpl
typedef RefMap< OUString, Relations > RelationsMap;
FastParser maFastParser;
- const OUString maBinSuffix;
RelationsMap maRelationsMap;
TextFieldStack maTextFieldStack;
const NamespaceMap& mrNamespaceMap;
@@ -185,8 +184,9 @@ struct XmlFilterBaseImpl
explicit XmlFilterBaseImpl();
};
+static const OUStringLiteral gaBinSuffix( ".bin" );
+
XmlFilterBaseImpl::XmlFilterBaseImpl() :
- maBinSuffix( ".bin" ),
mrNamespaceMap(StaticNamespaceMap::get())
{
// register XML namespaces
@@ -348,7 +348,7 @@ bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHan
return false;
// try to import binary streams (fragment extension must be '.bin')
- if (aFragmentPath.endsWith(mxImpl->maBinSuffix))
+ if (aFragmentPath.endsWith(gaBinSuffix))
{
try
{
@@ -420,7 +420,7 @@ Reference<XDocument> XmlFilterBase::importFragment( const OUString& aFragmentPat
return xRet;
// binary streams (fragment extension is '.bin') currently not supported
- if (aFragmentPath.endsWith(mxImpl->maBinSuffix))
+ if (aFragmentPath.endsWith(gaBinSuffix))
return xRet;
// try to import XML stream
diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx
index 4929dc26749f..32557dd8dc1c 100644
--- a/oox/source/helper/modelobjecthelper.cxx
+++ b/oox/source/helper/modelobjecthelper.cxx
@@ -88,16 +88,17 @@ void ObjectContainer::createContainer() const
OSL_ENSURE( mxContainer.is(), "ObjectContainer::createContainer - container not found" );
}
+static const OUStringLiteral gaDashNameBase( "msLineDash " ); ///< Base name for all named line dashes.
+static const OUStringLiteral gaGradientNameBase( "msFillGradient " ); ///< Base name for all named fill gradients.
+static const OUStringLiteral gaTransGradNameBase( "msTransGradient " ); ///< Base name for all named fill gradients.
+static const OUStringLiteral gaBitmapUrlNameBase( "msFillBitmap " ); ///< Base name for all named fill bitmap URLs.
+
ModelObjectHelper::ModelObjectHelper( const Reference< XMultiServiceFactory >& rxModelFactory ) :
maMarkerContainer( rxModelFactory, "com.sun.star.drawing.MarkerTable" ),
maDashContainer( rxModelFactory, "com.sun.star.drawing.DashTable" ),
maGradientContainer( rxModelFactory, "com.sun.star.drawing.GradientTable" ),
maTransGradContainer( rxModelFactory, "com.sun.star.drawing.TransparencyGradientTable" ),
- maBitmapUrlContainer( rxModelFactory, "com.sun.star.drawing.BitmapTable" ),
- maDashNameBase( "msLineDash " ),
- maGradientNameBase( "msFillGradient " ),
- maTransGradNameBase( "msTransGradient " ),
- maBitmapUrlNameBase( "msFillBitmap " )
+ maBitmapUrlContainer( rxModelFactory, "com.sun.star.drawing.BitmapTable" )
{
}
@@ -116,24 +117,24 @@ bool ModelObjectHelper::insertLineMarker( const OUString& rMarkerName, const Pol
OUString ModelObjectHelper::insertLineDash( const LineDash& rDash )
{
- return maDashContainer.insertObject( maDashNameBase, Any( rDash ), true );
+ return maDashContainer.insertObject( gaDashNameBase, Any( rDash ), true );
}
OUString ModelObjectHelper::insertFillGradient( const awt::Gradient& rGradient )
{
- return maGradientContainer.insertObject( maGradientNameBase, Any( rGradient ), true );
+ return maGradientContainer.insertObject( gaGradientNameBase, Any( rGradient ), true );
}
OUString ModelObjectHelper::insertTransGrandient( const awt::Gradient& rGradient )
{
- return maTransGradContainer.insertObject( maTransGradNameBase, Any( rGradient ), true );
+ return maTransGradContainer.insertObject( gaTransGradNameBase, Any( rGradient ), true );
}
OUString ModelObjectHelper::insertFillBitmapXGraphic(uno::Reference<graphic::XGraphic> const & rxGraphic)
{
uno::Reference<awt::XBitmap> xBitmap(rxGraphic, uno::UNO_QUERY);
if (xBitmap.is())
- return maBitmapUrlContainer.insertObject(maBitmapUrlNameBase, Any(xBitmap), true);
+ return maBitmapUrlContainer.insertObject(gaBitmapUrlNameBase, Any(xBitmap), true);
return OUString();
}
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index ada01ab5f022..6a6de0cbfe52 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -98,12 +98,12 @@ public:
private:
::std::set< OUString >
maCtrlNames;
- const OUString maDummyBaseName;
sal_Int32 mnIndex;
};
+static const OUStringLiteral gaDummyBaseName( "DummyGroupSep" );
+
VbaControlNamesSet::VbaControlNamesSet() :
- maDummyBaseName( "DummyGroupSep" ),
mnIndex( 0 )
{
}
@@ -120,7 +120,7 @@ OUString VbaControlNamesSet::generateDummyName()
OUString aCtrlName;
do
{
- aCtrlName = maDummyBaseName + OUString::number( ++mnIndex );
+ aCtrlName = gaDummyBaseName + OUString::number( ++mnIndex );
}
while( maCtrlNames.count( aCtrlName ) > 0 );
maCtrlNames.insert( aCtrlName );
diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx
index 4545b6924a41..0dcb588bf931 100644
--- a/oox/source/vml/vmlinputstream.cxx
+++ b/oox/source/vml/vmlinputstream.cxx
@@ -258,13 +258,14 @@ bool lclProcessCharacters( OStringBuffer& rBuffer, const OString& rChars )
} // namespace
+static const OString gaOpeningCData( "<![CDATA[" );
+static const OString gaClosingCData( "]]>" );
+
InputStream::InputStream( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm ) :
// use single-byte ISO-8859-1 encoding which maps all byte characters to the first 256 Unicode characters
mxTextStrm( TextInputStream::createXTextInputStream( rxContext, rxInStrm, RTL_TEXTENCODING_ISO_8859_1 ) ),
maOpeningBracket( 1 ),
maClosingBracket( 1 ),
- maOpeningCData( "<![CDATA[" ),
- maClosingCData( "]]>" ),
mnBufferPos( 0 )
{
if (!mxTextStrm.is())
@@ -352,10 +353,10 @@ void InputStream::updateBuffer()
// read the element text (add the leading opening bracket manually)
OString aElement = OString( '<' ) + readToElementEnd();
// check for CDATA part, starting with '<![CDATA['
- if( aElement.match( maOpeningCData ) )
+ if( aElement.match( gaOpeningCData ) )
{
// search the end tag ']]>'
- while( ((aElement.getLength() < maClosingCData.getLength()) || !aElement.endsWith( maClosingCData )) && !mxTextStrm->isEOF() )
+ while( ((aElement.getLength() < gaClosingCData.getLength()) || !aElement.endsWith( gaClosingCData )) && !mxTextStrm->isEOF() )
aElement += readToElementEnd();
// copy the entire CDATA part
aBuffer.append( aElement );
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index cd0034a2e1df..9982aae75209 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -33,83 +33,84 @@ using namespace com::sun::star::beans;
using namespace com::sun::star;
using namespace std;
+
+static const OUStringLiteral gsFileEntryElement ( ELEMENT_FILE_ENTRY );
+static const OUStringLiteral gsEncryptionDataElement( ELEMENT_ENCRYPTION_DATA );
+static const OUStringLiteral gsAlgorithmElement ( ELEMENT_ALGORITHM );
+static const OUStringLiteral gsStartKeyAlgElement ( ELEMENT_START_KEY_GENERATION );
+static const OUStringLiteral gsKeyDerivationElement( ELEMENT_KEY_DERIVATION );
+
+static const OUStringLiteral gsMediaTypeAttribute ( ATTRIBUTE_MEDIA_TYPE );
+static const OUStringLiteral gsVersionAttribute ( ATTRIBUTE_VERSION );
+static const OUStringLiteral gsFullPathAttribute ( ATTRIBUTE_FULL_PATH );
+static const OUStringLiteral gsSizeAttribute ( ATTRIBUTE_SIZE );
+static const OUStringLiteral gsSaltAttribute ( ATTRIBUTE_SALT );
+static const OUStringLiteral gsInitialisationVectorAttribute ( ATTRIBUTE_INITIALISATION_VECTOR );
+static const OUStringLiteral gsIterationCountAttribute ( ATTRIBUTE_ITERATION_COUNT );
+static const OUStringLiteral gsKeySizeAttribute ( ATTRIBUTE_KEY_SIZE );
+static const OUStringLiteral gsAlgorithmNameAttribute ( ATTRIBUTE_ALGORITHM_NAME );
+static const OUStringLiteral gsStartKeyAlgNameAttribute ( ATTRIBUTE_START_KEY_GENERATION_NAME );
+static const OUStringLiteral gsKeyDerivationNameAttribute ( ATTRIBUTE_KEY_DERIVATION_NAME );
+static const OUStringLiteral gsChecksumAttribute ( ATTRIBUTE_CHECKSUM );
+static const OUStringLiteral gsChecksumTypeAttribute ( ATTRIBUTE_CHECKSUM_TYPE );
+
+static const OUStringLiteral gsKeyInfoElement ( ELEMENT_ENCRYPTED_KEYINFO );
+static const OUStringLiteral gsManifestKeyInfoElement ( ELEMENT_MANIFEST_KEYINFO );
+static const OUStringLiteral gsEncryptedKeyElement ( ELEMENT_ENCRYPTEDKEY );
+static const OUStringLiteral gsEncryptionMethodElement ( ELEMENT_ENCRYPTIONMETHOD );
+static const OUStringLiteral gsPgpDataElement ( ELEMENT_PGPDATA );
+static const OUStringLiteral gsPgpKeyIDElement ( ELEMENT_PGPKEYID );
+static const OUStringLiteral gsPGPKeyPacketElement ( ELEMENT_PGPKEYPACKET );
+static const OUStringLiteral gsAlgorithmAttribute ( ATTRIBUTE_ALGORITHM );
+static const OUStringLiteral gsCipherDataElement ( ELEMENT_CIPHERDATA );
+static const OUStringLiteral gsCipherValueElement ( ELEMENT_CIPHERVALUE );
+
+static const OUStringLiteral gsManifestKeyInfoElement13 ( ELEMENT_MANIFEST13_KEYINFO );
+static const OUStringLiteral gsEncryptedKeyElement13 ( ELEMENT_ENCRYPTEDKEY13 );
+static const OUStringLiteral gsEncryptionMethodElement13 ( ELEMENT_ENCRYPTIONMETHOD13 );
+static const OUStringLiteral gsPgpDataElement13 ( ELEMENT_PGPDATA13 );
+static const OUStringLiteral gsPgpKeyIDElement13 ( ELEMENT_PGPKEYID13 );
+static const OUStringLiteral gsPGPKeyPacketElement13 ( ELEMENT_PGPKEYPACKET13 );
+static const OUStringLiteral gsAlgorithmAttribute13 ( ATTRIBUTE_ALGORITHM13 );
+static const OUStringLiteral gsCipherDataElement13 ( ELEMENT_CIPHERDATA13 );
+static const OUStringLiteral gsCipherValueElement13 ( ELEMENT_CIPHERVALUE13 );
+
+static const OUStringLiteral gsFullPathProperty ( "FullPath" );
+static const OUStringLiteral gsMediaTypeProperty ( "MediaType" );
+static const OUStringLiteral gsVersionProperty ( "Version" );
+static const OUStringLiteral gsIterationCountProperty ( "IterationCount" );
+static const OUStringLiteral gsDerivedKeySizeProperty ( "DerivedKeySize" );
+static const OUStringLiteral gsSaltProperty ( "Salt" );
+static const OUStringLiteral gsInitialisationVectorProperty ( "InitialisationVector" );
+static const OUStringLiteral gsSizeProperty ( "Size" );
+static const OUStringLiteral gsDigestProperty ( "Digest" );
+static const OUStringLiteral gsEncryptionAlgProperty ( "EncryptionAlgorithm" );
+static const OUStringLiteral gsStartKeyAlgProperty ( "StartKeyAlgorithm" );
+static const OUStringLiteral gsDigestAlgProperty ( "DigestAlgorithm" );
+
+static const OUStringLiteral gsSHA256_URL_ODF12 ( SHA256_URL_ODF12 );
+static const OUStringLiteral gsSHA256_URL ( SHA256_URL );
+static const OUStringLiteral gsSHA1_Name ( SHA1_NAME );
+static const OUStringLiteral gsSHA1_URL ( SHA1_URL );
+
+static const OUStringLiteral gsSHA256_1k_URL ( SHA256_1K_URL );
+static const OUStringLiteral gsSHA1_1k_Name ( SHA1_1K_NAME );
+static const OUStringLiteral gsSHA1_1k_URL ( SHA1_1K_URL );
+
+static const OUStringLiteral gsBlowfish_Name ( BLOWFISH_NAME );
+static const OUStringLiteral gsBlowfish_URL ( BLOWFISH_URL );
+static const OUStringLiteral gsAES128_URL ( AES128_URL );
+static const OUStringLiteral gsAES192_URL ( AES192_URL );
+static const OUStringLiteral gsAES256_URL ( AES256_URL );
+
+static const OUStringLiteral gsPBKDF2_Name ( PBKDF2_NAME );
+static const OUStringLiteral gsPBKDF2_URL ( PBKDF2_URL );
+
ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector )
: bIgnoreEncryptData ( false )
, bPgpEncryption ( false )
, nDerivedKeySize( 0 )
, rManVector ( rNewManVector )
-
- , sFileEntryElement ( ELEMENT_FILE_ENTRY )
- , sEncryptionDataElement( ELEMENT_ENCRYPTION_DATA )
- , sAlgorithmElement ( ELEMENT_ALGORITHM )
- , sStartKeyAlgElement ( ELEMENT_START_KEY_GENERATION )
- , sKeyDerivationElement( ELEMENT_KEY_DERIVATION )
-
- , sMediaTypeAttribute ( ATTRIBUTE_MEDIA_TYPE )
- , sVersionAttribute ( ATTRIBUTE_VERSION )
- , sFullPathAttribute ( ATTRIBUTE_FULL_PATH )
- , sSizeAttribute ( ATTRIBUTE_SIZE )
- , sSaltAttribute ( ATTRIBUTE_SALT )
- , sInitialisationVectorAttribute ( ATTRIBUTE_INITIALISATION_VECTOR )
- , sIterationCountAttribute ( ATTRIBUTE_ITERATION_COUNT )
- , sKeySizeAttribute ( ATTRIBUTE_KEY_SIZE )
- , sAlgorithmNameAttribute ( ATTRIBUTE_ALGORITHM_NAME )
- , sStartKeyAlgNameAttribute ( ATTRIBUTE_START_KEY_GENERATION_NAME )
- , sKeyDerivationNameAttribute ( ATTRIBUTE_KEY_DERIVATION_NAME )
- , sChecksumAttribute ( ATTRIBUTE_CHECKSUM )
- , sChecksumTypeAttribute ( ATTRIBUTE_CHECKSUM_TYPE )
-
- , sKeyInfoElement ( ELEMENT_ENCRYPTED_KEYINFO )
- , sManifestKeyInfoElement ( ELEMENT_MANIFEST_KEYINFO )
- , sEncryptedKeyElement ( ELEMENT_ENCRYPTEDKEY )
- , sEncryptionMethodElement ( ELEMENT_ENCRYPTIONMETHOD )
- , sPgpDataElement ( ELEMENT_PGPDATA )
- , sPgpKeyIDElement ( ELEMENT_PGPKEYID )
- , sPGPKeyPacketElement ( ELEMENT_PGPKEYPACKET )
- , sAlgorithmAttribute ( ATTRIBUTE_ALGORITHM )
- , sCipherDataElement ( ELEMENT_CIPHERDATA )
- , sCipherValueElement ( ELEMENT_CIPHERVALUE )
-
- , sManifestKeyInfoElement13 ( ELEMENT_MANIFEST13_KEYINFO )
- , sEncryptedKeyElement13 ( ELEMENT_ENCRYPTEDKEY13 )
- , sEncryptionMethodElement13 ( ELEMENT_ENCRYPTIONMETHOD13 )
- , sPgpDataElement13 ( ELEMENT_PGPDATA13 )
- , sPgpKeyIDElement13 ( ELEMENT_PGPKEYID13 )
- , sPGPKeyPacketElement13 ( ELEMENT_PGPKEYPACKET13 )
- , sAlgorithmAttribute13 ( ATTRIBUTE_ALGORITHM13 )
- , sCipherDataElement13 ( ELEMENT_CIPHERDATA13 )
- , sCipherValueElement13 ( ELEMENT_CIPHERVALUE13 )
-
- , sFullPathProperty ( "FullPath" )
- , sMediaTypeProperty ( "MediaType" )
- , sVersionProperty ( "Version" )
- , sIterationCountProperty ( "IterationCount" )
- , sDerivedKeySizeProperty ( "DerivedKeySize" )
- , sSaltProperty ( "Salt" )
- , sInitialisationVectorProperty ( "InitialisationVector" )
- , sSizeProperty ( "Size" )
- , sDigestProperty ( "Digest" )
- , sEncryptionAlgProperty ( "EncryptionAlgorithm" )
- , sStartKeyAlgProperty ( "StartKeyAlgorithm" )
- , sDigestAlgProperty ( "DigestAlgorithm" )
-
- , sSHA256_URL_ODF12 ( SHA256_URL_ODF12 )
- , sSHA256_URL ( SHA256_URL )
- , sSHA1_Name ( SHA1_NAME )
- , sSHA1_URL ( SHA1_URL )
-
- , sSHA256_1k_URL ( SHA256_1K_URL )
- , sSHA1_1k_Name ( SHA1_1K_NAME )
- , sSHA1_1k_URL ( SHA1_1K_URL )
-
- , sBlowfish_Name ( BLOWFISH_NAME )
- , sBlowfish_URL ( BLOWFISH_URL )
- , sAES128_URL ( AES128_URL )
- , sAES192_URL ( AES192_URL )
- , sAES256_URL ( AES256_URL )
-
- , sPBKDF2_Name ( PBKDF2_NAME )
- , sPBKDF2_URL ( PBKDF2_URL )
{
aStack.reserve( 10 );
}
@@ -130,21 +131,21 @@ void ManifestImport::doFileEntry(StringHashMap &rConvertedAttribs)
{
aSequence.resize(PKG_SIZE_ENCR_MNFST);
- aSequence[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
- aSequence[PKG_MNFST_FULLPATH].Value <<= rConvertedAttribs[sFullPathAttribute];
- aSequence[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
- aSequence[PKG_MNFST_MEDIATYPE].Value <<= rConvertedAttribs[sMediaTypeAttribute];
+ aSequence[PKG_MNFST_FULLPATH].Name = gsFullPathProperty;
+ aSequence[PKG_MNFST_FULLPATH].Value <<= rConvertedAttribs[gsFullPathAttribute];
+ aSequence[PKG_MNFST_MEDIATYPE].Name = gsMediaTypeProperty;
+ aSequence[PKG_MNFST_MEDIATYPE].Value <<= rConvertedAttribs[gsMediaTypeAttribute];
- OUString sVersion = rConvertedAttribs[sVersionAttribute];
+ OUString sVersion = rConvertedAttribs[gsVersionAttribute];
if ( sVersion.getLength() ) {
- aSequence[PKG_MNFST_VERSION].Name = sVersionProperty;
+ aSequence[PKG_MNFST_VERSION].Name = gsVersionProperty;
aSequence[PKG_MNFST_VERSION].Value <<= sVersion;
}
- OUString sSize = rConvertedAttribs[sSizeAttribute];
+ OUString sSize = rConvertedAttribs[gsSizeAttribute];
if ( sSize.getLength() ) {
sal_Int64 nSize = sSize.toInt64();
- aSequence[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty;
+ aSequence[PKG_MNFST_UCOMPSIZE].Name = gsSizeProperty;
aSequence[PKG_MNFST_UCOMPSIZE].Value <<= nSize;
}
}
@@ -229,22 +230,22 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs)
// If this element exists, then this stream is encrypted and we need
// to import the initialisation vector, salt and iteration count used
nDerivedKeySize = 0;
- OUString aString = rConvertedAttribs[sChecksumTypeAttribute];
+ OUString aString = rConvertedAttribs[gsChecksumTypeAttribute];
if ( !bIgnoreEncryptData ) {
- if ( aString == sSHA1_1k_Name || aString == sSHA1_1k_URL ) {
- aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ if ( aString == gsSHA1_1k_Name || aString == gsSHA1_1k_URL ) {
+ aSequence[PKG_MNFST_DIGESTALG].Name = gsDigestAlgProperty;
aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA1_1K;
- } else if ( aString == sSHA256_1k_URL ) {
- aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ } else if ( aString == gsSHA256_1k_URL ) {
+ aSequence[PKG_MNFST_DIGESTALG].Name = gsDigestAlgProperty;
aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA256_1K;
} else
bIgnoreEncryptData = true;
if ( !bIgnoreEncryptData ) {
- aString = rConvertedAttribs[sChecksumAttribute];
+ aString = rConvertedAttribs[gsChecksumAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aString);
- aSequence[PKG_MNFST_DIGEST].Name = sDigestProperty;
+ aSequence[PKG_MNFST_DIGEST].Name = gsDigestProperty;
aSequence[PKG_MNFST_DIGEST].Value <<= aDecodeBuffer;
}
}
@@ -253,22 +254,22 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs)
void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
{
if ( !bIgnoreEncryptData ) {
- OUString aString = rConvertedAttribs[sAlgorithmNameAttribute];
- if ( aString == sBlowfish_Name || aString == sBlowfish_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ OUString aString = rConvertedAttribs[gsAlgorithmNameAttribute];
+ if ( aString == gsBlowfish_Name || aString == gsBlowfish_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
- } else if ( aString == sAES256_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ } else if ( aString == gsAES256_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" );
nDerivedKeySize = 32;
- } else if ( aString == sAES192_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ } else if ( aString == gsAES192_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" );
nDerivedKeySize = 24;
- } else if ( aString == sAES128_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ } else if ( aString == gsAES128_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" );
nDerivedKeySize = 16;
@@ -276,10 +277,10 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
bIgnoreEncryptData = true;
if ( !bIgnoreEncryptData ) {
- aString = rConvertedAttribs[sInitialisationVectorAttribute];
+ aString = rConvertedAttribs[gsInitialisationVectorAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aString);
- aSequence[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
+ aSequence[PKG_MNFST_INIVECTOR].Name = gsInitialisationVectorProperty;
aSequence[PKG_MNFST_INIVECTOR].Value <<= aDecodeBuffer;
}
}
@@ -288,19 +289,19 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
{
if ( !bIgnoreEncryptData ) {
- OUString aString = rConvertedAttribs[sKeyDerivationNameAttribute];
- if ( aString == sPBKDF2_Name || aString == sPBKDF2_URL ) {
- aString = rConvertedAttribs[sSaltAttribute];
+ OUString aString = rConvertedAttribs[gsKeyDerivationNameAttribute];
+ if ( aString == gsPBKDF2_Name || aString == gsPBKDF2_URL ) {
+ aString = rConvertedAttribs[gsSaltAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aString);
- aSequence[PKG_MNFST_SALT].Name = sSaltProperty;
+ aSequence[PKG_MNFST_SALT].Name = gsSaltProperty;
aSequence[PKG_MNFST_SALT].Value <<= aDecodeBuffer;
- aString = rConvertedAttribs[sIterationCountAttribute];
- aSequence[PKG_MNFST_ITERATION].Name = sIterationCountProperty;
+ aString = rConvertedAttribs[gsIterationCountAttribute];
+ aSequence[PKG_MNFST_ITERATION].Name = gsIterationCountProperty;
aSequence[PKG_MNFST_ITERATION].Value <<= aString.toInt32();
- aString = rConvertedAttribs[sKeySizeAttribute];
+ aString = rConvertedAttribs[gsKeySizeAttribute];
if ( aString.getLength() ) {
sal_Int32 nKey = aString.toInt32();
OSL_ENSURE( !nDerivedKeySize || nKey == nDerivedKeySize , "Provided derived key length differs from the expected one!" );
@@ -310,7 +311,7 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
else if ( nDerivedKeySize != 16 )
OSL_ENSURE( false, "Default derived key length differs from the expected one!" );
- aSequence[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+ aSequence[PKG_MNFST_DERKEYSIZE].Name = gsDerivedKeySizeProperty;
aSequence[PKG_MNFST_DERKEYSIZE].Value <<= nDerivedKeySize;
} else if ( bPgpEncryption ) {
if ( aString != "PGP" )
@@ -322,12 +323,12 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
void ManifestImport::doStartKeyAlg(StringHashMap &rConvertedAttribs)
{
- OUString aString = rConvertedAttribs[sStartKeyAlgNameAttribute];
- if (aString == sSHA256_URL || aString == sSHA256_URL_ODF12) {
- aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ OUString aString = rConvertedAttribs[gsStartKeyAlgNameAttribute];
+ if (aString == gsSHA256_URL || aString == gsSHA256_URL_ODF12) {
+ aSequence[PKG_MNFST_STARTALG].Name = gsStartKeyAlgProperty;
aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA256;
- } else if ( aString == sSHA1_Name || aString == sSHA1_URL ) {
- aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ } else if ( aString == gsSHA1_Name || aString == gsSHA1_URL ) {
+ aSequence[PKG_MNFST_STARTALG].Name = gsStartKeyAlgProperty;
aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA1;
} else
bIgnoreEncryptData = true;
@@ -349,11 +350,11 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
break;
}
case 2: {
- if (aConvertedName == sFileEntryElement) //manifest:file-entry
+ if (aConvertedName == gsFileEntryElement) //manifest:file-entry
doFileEntry(aConvertedAttribs);
- else if (aConvertedName == sManifestKeyInfoElement) //loext:keyinfo
+ else if (aConvertedName == gsManifestKeyInfoElement) //loext:keyinfo
doKeyInfoEntry(aConvertedAttribs);
- else if (aConvertedName == sManifestKeyInfoElement13) //manifest:keyinfo
+ else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo
doKeyInfoEntry(aConvertedAttribs);
else
aStack.back().m_bValid = false;
@@ -365,11 +366,11 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sEncryptionDataElement) //manifest:encryption-data
+ else if (aConvertedName == gsEncryptionDataElement) //manifest:encryption-data
doEncryptionData(aConvertedAttribs);
- else if (aConvertedName == sEncryptedKeyElement) //loext:encrypted-key
+ else if (aConvertedName == gsEncryptedKeyElement) //loext:encrypted-key
doEncryptedKey(aConvertedAttribs);
- else if (aConvertedName == sEncryptedKeyElement13) //manifest:encrypted-key
+ else if (aConvertedName == gsEncryptedKeyElement13) //manifest:encrypted-key
doEncryptedKey(aConvertedAttribs);
else
aStack.back().m_bValid = false;
@@ -381,23 +382,23 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sAlgorithmElement) //manifest:algorithm,
+ else if (aConvertedName == gsAlgorithmElement) //manifest:algorithm,
doAlgorithm(aConvertedAttribs);
- else if (aConvertedName == sKeyDerivationElement) //manifest:key-derivation,
+ else if (aConvertedName == gsKeyDerivationElement) //manifest:key-derivation,
doKeyDerivation(aConvertedAttribs);
- else if (aConvertedName == sStartKeyAlgElement) //manifest:start-key-generation
+ else if (aConvertedName == gsStartKeyAlgElement) //manifest:start-key-generation
doStartKeyAlg(aConvertedAttribs);
- else if (aConvertedName == sEncryptionMethodElement) //loext:encryption-method
- doEncryptionMethod(aConvertedAttribs, sAlgorithmAttribute);
- else if (aConvertedName == sEncryptionMethodElement13) //manifest:encryption-method
- doEncryptionMethod(aConvertedAttribs, sAlgorithmAttribute13);
- else if (aConvertedName == sKeyInfoElement) //loext:KeyInfo
+ else if (aConvertedName == gsEncryptionMethodElement) //loext:encryption-method
+ doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute);
+ else if (aConvertedName == gsEncryptionMethodElement13) //manifest:encryption-method
+ doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13);
+ else if (aConvertedName == gsKeyInfoElement) //loext:KeyInfo
doEncryptedKeyInfo(aConvertedAttribs);
- else if (aConvertedName == sCipherDataElement) //loext:CipherData
+ else if (aConvertedName == gsCipherDataElement) //loext:CipherData
doEncryptedCipherData(aConvertedAttribs);
- else if (aConvertedName == sCipherDataElement13) //manifest:CipherData
+ else if (aConvertedName == gsCipherDataElement13) //manifest:CipherData
doEncryptedCipherData(aConvertedAttribs);
- else if (aConvertedName == sPgpDataElement13) //manifest:PGPData
+ else if (aConvertedName == gsPgpDataElement13) //manifest:PGPData
doEncryptedPgpData(aConvertedAttribs);
else
aStack.back().m_bValid = false;
@@ -409,18 +410,18 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sPgpDataElement) //loext:PGPData
+ else if (aConvertedName == gsPgpDataElement) //loext:PGPData
doEncryptedPgpData(aConvertedAttribs);
- else if (aConvertedName == sCipherValueElement) //loext:CipherValue
+ else if (aConvertedName == gsCipherValueElement) //loext:CipherValue
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sCipherValueElement13) //manifest:CipherValue
+ else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sPgpKeyIDElement13) //manifest:PGPKeyID
+ else if (aConvertedName == gsPgpKeyIDElement13) //manifest:PGPKeyID
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sPGPKeyPacketElement13) //manifest:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement13) //manifest:PGPKeyPacket
// ciphervalue action happens on endElement
aCurrentCharacters = "";
else
@@ -433,10 +434,10 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sPgpKeyIDElement) //loext:PGPKeyID
+ else if (aConvertedName == gsPgpKeyIDElement) //loext:PGPKeyID
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sPGPKeyPacketElement) //loext:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement) //loext:PGPKeyPacket
// ciphervalue action happens on endElement
aCurrentCharacters = "";
else
@@ -465,7 +466,7 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
OUString aConvertedName = ConvertName( aName );
if ( !aStack.empty() && aStack.rbegin()->m_aConvertedName == aConvertedName ) {
- if ( aConvertedName == sFileEntryElement && aStack.back().m_bValid ) {
+ if ( aConvertedName == gsFileEntryElement && aStack.back().m_bValid ) {
// root folder gets KeyInfo entry if any, for PGP encryption
if (!bIgnoreEncryptData && !aKeys.empty() && aSequence[PKG_MNFST_FULLPATH].Value.get<OUString>() == "/" )
{
@@ -481,8 +482,8 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
aSequence.clear();
}
- else if ( (aConvertedName == sEncryptedKeyElement
- || aConvertedName == sEncryptedKeyElement13)
+ else if ( (aConvertedName == gsEncryptedKeyElement
+ || aConvertedName == gsEncryptedKeyElement13)
&& aStack.back().m_bValid ) {
if ( !bIgnoreEncryptData )
{
@@ -495,22 +496,22 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
// end element handling for elements with cdata
switch (nLevel) {
case 5: {
- if (aConvertedName == sCipherValueElement) //loext:CipherValue
+ if (aConvertedName == gsCipherValueElement) //loext:CipherValue
doEncryptedCipherValue();
- else if (aConvertedName == sCipherValueElement13) //manifest:CipherValue
+ else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
doEncryptedCipherValue();
- else if (aConvertedName == sPgpKeyIDElement13) //manifest:PGPKeyID
+ else if (aConvertedName == gsPgpKeyIDElement13) //manifest:PGPKeyID
doEncryptedKeyId();
- else if (aConvertedName == sPGPKeyPacketElement13) //manifest:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement13) //manifest:PGPKeyPacket
doEncryptedKeyPacket();
else
aStack.back().m_bValid = false;
break;
}
case 6: {
- if (aConvertedName == sPgpKeyIDElement) //loext:PGPKeyID
+ if (aConvertedName == gsPgpKeyIDElement) //loext:PGPKeyID
doEncryptedKeyId();
- else if (aConvertedName == sPGPKeyPacketElement) //loext:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement) //loext:PGPKeyPacket
doEncryptedKeyPacket();
else
aStack.back().m_bValid = false;
diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx
index 6661dc70b4e6..19d426b14f25 100644
--- a/package/source/manifest/ManifestImport.hxx
+++ b/package/source/manifest/ManifestImport.hxx
@@ -61,77 +61,6 @@ class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocum
sal_Int32 nDerivedKeySize;
::std::vector < css::uno::Sequence < css::beans::PropertyValue > > & rManVector;
- const OUString sFileEntryElement;
- const OUString sEncryptionDataElement;
- const OUString sAlgorithmElement;
- const OUString sStartKeyAlgElement;
- const OUString sKeyDerivationElement;
-
- const OUString sMediaTypeAttribute;
- const OUString sVersionAttribute;
- const OUString sFullPathAttribute;
- const OUString sSizeAttribute;
- const OUString sSaltAttribute;
- const OUString sInitialisationVectorAttribute;
- const OUString sIterationCountAttribute;
- const OUString sKeySizeAttribute;
- const OUString sAlgorithmNameAttribute;
- const OUString sStartKeyAlgNameAttribute;
- const OUString sKeyDerivationNameAttribute;
- const OUString sChecksumAttribute;
- const OUString sChecksumTypeAttribute;
-
- const OUString sKeyInfoElement;
- const OUString sManifestKeyInfoElement;
- const OUString sEncryptedKeyElement;
- const OUString sEncryptionMethodElement;
- const OUString sPgpDataElement;
- const OUString sPgpKeyIDElement;
- const OUString sPGPKeyPacketElement;
- const OUString sAlgorithmAttribute;
- const OUString sCipherDataElement;
- const OUString sCipherValueElement;
-
- const OUString sManifestKeyInfoElement13;
- const OUString sEncryptedKeyElement13;
- const OUString sEncryptionMethodElement13;
- const OUString sPgpDataElement13;
- const OUString sPgpKeyIDElement13;
- const OUString sPGPKeyPacketElement13;
- const OUString sAlgorithmAttribute13;
- const OUString sCipherDataElement13;
- const OUString sCipherValueElement13;
-
- const OUString sFullPathProperty;
- const OUString sMediaTypeProperty;
- const OUString sVersionProperty;
- const OUString sIterationCountProperty;
- const OUString sDerivedKeySizeProperty;
- const OUString sSaltProperty;
- const OUString sInitialisationVectorProperty;
- const OUString sSizeProperty;
- const OUString sDigestProperty;
- const OUString sEncryptionAlgProperty;
- const OUString sStartKeyAlgProperty;
- const OUString sDigestAlgProperty;
-
- const OUString sSHA256_URL_ODF12;
- const OUString sSHA256_URL;
- const OUString sSHA1_Name;
- const OUString sSHA1_URL;
-
- const OUString sSHA256_1k_URL;
- const OUString sSHA1_1k_Name;
- const OUString sSHA1_1k_URL;
-
- const OUString sBlowfish_Name;
- const OUString sBlowfish_URL;
- const OUString sAES128_URL;
- const OUString sAES192_URL;
- const OUString sAES256_URL;
-
- const OUString sPBKDF2_Name;
- const OUString sPBKDF2_URL;
OUString PushNameAndNamespaces( const OUString& aName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs,
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index 82077d4f287c..75b1e7d7101d 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -177,7 +177,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
OUString sFullKeyName(pKey->getName());
if (sFullKeyName.getLength() > 1)
- sFullKeyName += m_pRegistry->ROOT;
+ sFullKeyName += ORegistry::ROOT;
sFullKeyName += sSubKeyName;
rtl_uString_newFromString(&pSubKeys[nSubKeys], sFullKeyName.pData);
@@ -231,7 +231,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(m_pRegistry->getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if ( rValue.create(m_pRegistry->getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
*pValueType = RegValueType::NOT_DEFINED;
*pValueSize = 0;
@@ -301,7 +301,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT , sImplValueName, storeAccessMode::Create) )
+ if ( rValue.create(getStoreFile(), m_name + ORegistry::ROOT , sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -371,7 +371,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const *
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, storeAccessMode::Create) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -430,7 +430,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, storeAccessMode::Create) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -498,7 +498,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, storeAccessMode::Create) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -569,7 +569,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
return RegError::VALUE_NOT_EXISTS;
}
@@ -663,7 +663,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
pValueList = nullptr;
*pLen = 0;
@@ -777,7 +777,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if ( rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
pValueList = nullptr;
*pLen = 0;
@@ -883,7 +883,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if ( rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
pValueList = nullptr;
*pLen = 0;
@@ -1011,7 +1011,7 @@ OStoreDirectory ORegKey::getStoreDir() const
OUString relativName;
storeAccessMode accessMode = storeAccessMode::ReadWrite;
- if ( m_name == m_pRegistry->ROOT )
+ if ( m_name == ORegistry::ROOT )
{
fullPath.clear();
relativName.clear();
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 1e24220f0ee9..43039fcddc29 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -420,11 +420,14 @@ void dumpType(typereg::Reader const & reader, OString const & indent) {
}
+#if __cplusplus <= 201402
+constexpr OUStringLiteral ORegistry::ROOT;
+#endif
+
ORegistry::ORegistry()
: m_refCount(1)
, m_readOnly(false)
, m_isOpen(false)
- , ROOT("/")
{
}
diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx
index 838456e4a061..7aaf3e5ac207 100644
--- a/registry/source/regimpl.hxx
+++ b/registry/source/regimpl.hxx
@@ -145,7 +145,7 @@ private:
store::OStoreFile m_file;
KeyMap m_openKeyTable;
- const OUString ROOT;
+ static constexpr OUStringLiteral ROOT { "/" };
};
#endif
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx
index fc644f1d749b..5d0f9b1383a7 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.cxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx
@@ -142,16 +142,17 @@ void OControlStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
}
+static const OUStringLiteral g_sTableStyleFamilyName( XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME );
+static const OUStringLiteral g_sColumnStyleFamilyName( XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME );
+static const OUStringLiteral g_sRowStyleFamilyName( XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME );
+static const OUStringLiteral g_sCellStyleFamilyName( XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME );
+
OReportStylesContext::OReportStylesContext( ORptFilter& rImport,
sal_uInt16 nPrfx ,
const OUString& rLName ,
const Reference< XAttributeList > & xAttrList,
const bool bTempAutoStyles ) :
SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList ),
- m_sTableStyleFamilyName( XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME ),
- m_sColumnStyleFamilyName( XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ),
- m_sRowStyleFamilyName( XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME ),
- m_sCellStyleFamilyName( XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME ),
m_rImport(rImport),
m_nNumberFormatIndex(-1),
bAutoStyles(bTempAutoStyles)
@@ -373,16 +374,16 @@ OUString OReportStylesContext::GetServiceName( sal_uInt16 nFamily ) const
switch( nFamily )
{
case XML_STYLE_FAMILY_TABLE_TABLE:
- sServiceName = m_sTableStyleFamilyName;
+ sServiceName = g_sTableStyleFamilyName;
break;
case XML_STYLE_FAMILY_TABLE_COLUMN:
- sServiceName = m_sColumnStyleFamilyName;
+ sServiceName = g_sColumnStyleFamilyName;
break;
case XML_STYLE_FAMILY_TABLE_ROW:
- sServiceName = m_sRowStyleFamilyName;
+ sServiceName = g_sRowStyleFamilyName;
break;
case XML_STYLE_FAMILY_TABLE_CELL:
- sServiceName = m_sCellStyleFamilyName;
+ sServiceName = g_sCellStyleFamilyName;
break;
default:
break;
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.hxx b/reportdesign/source/filter/xml/xmlStyleImport.hxx
index 6f8741457a85..28641a8b8f59 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.hxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.hxx
@@ -75,10 +75,6 @@ namespace rptxml
class OReportStylesContext : public SvXMLStylesContext
{
- const OUString m_sTableStyleFamilyName;
- const OUString m_sColumnStyleFamilyName;
- const OUString m_sRowStyleFamilyName;
- const OUString m_sCellStyleFamilyName;
ORptFilter& m_rImport;
sal_Int32 m_nNumberFormatIndex;
bool bAutoStyles : 1;
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 7dd616b7de93..a1d822c9d491 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -353,11 +353,7 @@ uno::Sequence< beans::NamedValue > XclExpRoot::GetEncryptionData() const
uno::Sequence< beans::NamedValue > XclExpRoot::GenerateDefaultEncryptionData() const
{
- uno::Sequence< beans::NamedValue > aEncryptionData;
- if ( !GetDefaultPassword().isEmpty() )
- aEncryptionData = GenerateEncryptionData( GetDefaultPassword() );
-
- return aEncryptionData;
+ return GenerateEncryptionData( GetDefaultPassword() );
}
XclExpRootData::XclExpLinkMgrRef const & XclExpRoot::GetLocalLinkMgrRef() const
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 6a914786565e..3ad8791d6101 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3266,10 +3266,11 @@ XclImpDffConverter::XclImpDffConvData::XclImpDffConvData(
{
}
+static const OUStringLiteral gaStdFormName( "Standard" ); /// Standard name of control forms.
+
XclImpDffConverter::XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm ) :
XclImpSimpleDffConverter( rRoot, rDffStrm ),
oox::ole::MSConvertOCXControls( rRoot.GetDocShell()->GetModel() ),
- maStdFormName( "Standard" ),
mnOleImpFlags( 0 )
{
const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
@@ -3842,14 +3843,14 @@ void XclImpDffConverter::InitControlForm()
Reference< XFormsSupplier > xFormsSupplier( rConvData.mrSdrPage.getUnoPage(), UNO_QUERY_THROW );
Reference< XNameContainer > xFormsNC( xFormsSupplier->getForms(), UNO_SET_THROW );
// find or create the Standard form used to insert the imported controls
- if( xFormsNC->hasByName( maStdFormName ) )
+ if( xFormsNC->hasByName( gaStdFormName ) )
{
- xFormsNC->getByName( maStdFormName ) >>= rConvData.mxCtrlForm;
+ xFormsNC->getByName( gaStdFormName ) >>= rConvData.mxCtrlForm;
}
else if( SfxObjectShell* pDocShell = GetDocShell() )
{
rConvData.mxCtrlForm.set( ScfApiHelper::CreateInstance( pDocShell, "com.sun.star.form.component.Form" ), UNO_QUERY_THROW );
- xFormsNC->insertByName( maStdFormName, Any( rConvData.mxCtrlForm ) );
+ xFormsNC->insertByName( gaStdFormName, Any( rConvData.mxCtrlForm ) );
}
}
catch( const Exception& )
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index e721e2e94c58..9e941bd67720 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -76,6 +76,8 @@ XclDebugObjCounter::~XclDebugObjCounter()
}
#endif
+const OUStringLiteral XclRootData::gaDefPassword( "VelvetSweatshop" );
+
XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
tools::SvRef<SotStorage> const & xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc, bool bExport ) :
meBiff( eBiff ),
@@ -83,7 +85,6 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
mrMedium( rMedium ),
mxRootStrg( xRootStrg ),
mrDoc( rDoc ),
- maDefPassword( "VelvetSweatshop" ),
meTextEnc( eTextEnc ),
meSysLang( Application::GetSettings().GetLanguageTag().getLanguageType() ),
meDocLang( Application::GetSettings().GetLanguageTag().getLanguageType() ),
@@ -237,7 +238,7 @@ sal_Int32 XclRoot::GetHmmFromPixelY( double fPixelY ) const
uno::Sequence< beans::NamedValue > XclRoot::RequestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const
{
::std::vector< OUString > aDefaultPasswords;
- aDefaultPasswords.push_back( mrData.maDefPassword );
+ aDefaultPasswords.push_back( XclRootData::gaDefPassword );
return ScfApiHelper::QueryEncryptionDataForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords );
}
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index 015b7c745242..58ac66867831 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -1024,7 +1024,6 @@ private:
typedef std::shared_ptr< XclImpDffConvData > XclImpDffConvDataRef;
typedef std::vector< XclImpDffConvDataRef > XclImpDffConvDataStack;
- const OUString maStdFormName; /// Standard name of control forms.
tools::SvRef<SotStorageStream> mxCtlsStrm; /// The 'Ctls' stream for OCX form controls.
ScfProgressBarRef mxProgress; /// The progress bar used in ProcessObj().
XclImpDffConvDataStack maDataStack; /// Stack for registered drawing managers.
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index f1b9a1085825..f5942a4b0808 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -84,7 +84,7 @@ struct XclRootData
OUString maDocUrl; /// Document URL of imported/exported file.
OUString maBasePath; /// Base path of imported/exported file (path of maDocUrl).
OUString maUserName; /// Current user name.
- const OUString maDefPassword; /// The default password used for stream encryption.
+ static const OUStringLiteral gaDefPassword; /// The default password used for stream encryption.
rtl_TextEncoding meTextEnc; /// Text encoding to import/export byte strings.
LanguageType meSysLang; /// System language.
LanguageType meDocLang; /// Document language (import: from file, export: from system).
@@ -178,7 +178,7 @@ public:
const OUString& GetUserName() const { return mrData.maUserName; }
/** Returns the default password used for stream encryption. */
- const OUString& GetDefaultPassword() const { return mrData.maDefPassword; }
+ static const OUStringLiteral& GetDefaultPassword() { return XclRootData::gaDefPassword; }
/** Requests and verifies a password from the medium or the user. */
css::uno::Sequence< css::beans::NamedValue >
RequestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const;
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index d822d9734a91..6ed7d463c1b1 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -428,11 +428,6 @@ private:
private:
typedef ::std::vector< HFPortionInfo > HFPortionInfoVec;
- const OUString maPageNumberService;
- const OUString maPageCountService;
- const OUString maSheetNameService;
- const OUString maFileNameService;
- const OUString maDateTimeService;
const std::set< OString > maBoldNames; /// All names for bold font style in lowercase UTF-8.
const std::set< OString > maItalicNames; /// All names for italic font style in lowercase UTF-8.
HFPortionInfoVec maPortions;
@@ -466,13 +461,14 @@ static const sal_Char* const sppcItalicNames[] =
} // namespace
+static const OUStringLiteral gaPageNumberService( "com.sun.star.text.TextField.PageNumber" );
+static const OUStringLiteral gaPageCountService( "com.sun.star.text.TextField.PageCount" );
+static const OUStringLiteral gaSheetNameService( "com.sun.star.text.TextField.SheetName" );
+static const OUStringLiteral gaFileNameService( "com.sun.star.text.TextField.FileName" );
+static const OUStringLiteral gaDateTimeService( "com.sun.star.text.TextField.DateTime" );
+
HeaderFooterParser::HeaderFooterParser( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
- maPageNumberService( "com.sun.star.text.TextField.PageNumber" ),
- maPageCountService( "com.sun.star.text.TextField.PageCount" ),
- maSheetNameService( "com.sun.star.text.TextField.SheetName" ),
- maFileNameService( "com.sun.star.text.TextField.FileName" ),
- maDateTimeService( "com.sun.star.text.TextField.DateTime" ),
maBoldNames( sppcBoldNames, sppcBoldNames + SAL_N_ELEMENTS(sppcBoldNames) ),
maItalicNames( sppcItalicNames, sppcItalicNames + SAL_N_ELEMENTS(sppcItalicNames) ),
maPortions( static_cast< size_t >( HF_COUNT ) ),
@@ -547,18 +543,18 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>&
case 'R': setNewPortion( HF_RIGHT ); break; // right portion
case 'P': // page number
- appendField( createField( maPageNumberService ) );
+ appendField( createField( gaPageNumberService ) );
break;
case 'N': // total page count
- appendField( createField( maPageCountService ) );
+ appendField( createField( gaPageCountService ) );
break;
case 'A': // current sheet name
- appendField( createField( maSheetNameService ) );
+ appendField( createField( gaSheetNameService ) );
break;
case 'F': // file name
{
- Reference<text::XTextContent> xContent = createField( maFileNameService );
+ Reference<text::XTextContent> xContent = createField( gaFileNameService );
PropertySet aPropSet( xContent );
aPropSet.setProperty( PROP_FileFormat, css::text::FilenameDisplayFormat::NAME_AND_EXT );
appendField( xContent );
@@ -566,7 +562,7 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>&
break;
case 'Z': // file path (without file name), OOXML, BIFF12, and BIFF8 only
{
- Reference<text::XTextContent> xContent = createField( maFileNameService );
+ Reference<text::XTextContent> xContent = createField( gaFileNameService );
PropertySet aPropSet( xContent );
// FilenameDisplayFormat::PATH not supported by Calc
aPropSet.setProperty( PROP_FileFormat, css::text::FilenameDisplayFormat::FULL );
@@ -579,7 +575,7 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>&
break;
case 'D': // date
{
- Reference<text::XTextContent> xContent = createField( maDateTimeService );
+ Reference<text::XTextContent> xContent = createField( gaDateTimeService );
PropertySet aPropSet( xContent );
aPropSet.setProperty( PROP_IsDate, true );
appendField( xContent );
@@ -587,7 +583,7 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>&
break;
case 'T': // time
{
- Reference<text::XTextContent> xContent = createField( maDateTimeService );
+ Reference<text::XTextContent> xContent = createField( gaDateTimeService );
PropertySet aPropSet( xContent );
aPropSet.setProperty( PROP_IsDate, false );
appendField( xContent );
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index f2f2d211030a..a4485f3ffc16 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -362,7 +362,6 @@ private:
private:
typedef ::std::unique_ptr< VmlDrawing > VmlDrawingPtr;
- const OUString maSheetCellRanges; /// Service name for a SheetCellRanges object.
const ScAddress& mrMaxApiPos; /// Reference to maximum Calc cell address from address converter.
ScRange maUsedArea; /// Used area of the sheet, and sheet index of the sheet.
ColumnModel maDefColModel; /// Default column formatting.
@@ -394,9 +393,10 @@ private:
bool mbHasDefWidth; /// True = default column width is set from defaultColWidth attribute.
};
+static const OUStringLiteral gaSheetCellRanges( "com.sun.star.sheet.SheetCellRanges" ); /// Service name for a SheetCellRanges object.
+
WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, SCTAB nSheet ) :
WorkbookHelper( rHelper ),
- maSheetCellRanges( "com.sun.star.sheet.SheetCellRanges" ),
mrMaxApiPos( rHelper.getAddressConverter().getMaxApiAddress() ),
maUsedArea( SCCOL_MAX, SCROW_MAX, nSheet, -1, -1, nSheet ), // Set start address to largest possible value, and end address to smallest
maSheetData( *this ),
@@ -475,7 +475,7 @@ Reference< XSheetCellRanges > WorksheetGlobals::getCellRangeList( const ScRangeL
Reference< XSheetCellRanges > xRanges;
if( mxSheet.is() && !rRanges.empty() ) try
{
- xRanges.set( getBaseFilter().getModelFactory()->createInstance( maSheetCellRanges ), UNO_QUERY_THROW );
+ xRanges.set( getBaseFilter().getModelFactory()->createInstance( gaSheetCellRanges ), UNO_QUERY_THROW );
Reference< XSheetCellRangeContainer > xRangeCont( xRanges, UNO_QUERY_THROW );
xRangeCont->addRangeAddresses( AddressConverter::toApiSequence(rRanges), false );
}
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 3ee8db545ea9..4a1c140d15a5 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -82,18 +82,19 @@ bool ScMyValidation::IsEqual(const ScMyValidation& aVal) const
aVal.sFormula2 == sFormula2;
}
+static const OUStringLiteral gsERRALSTY(SC_UNONAME_ERRALSTY);
+static const OUStringLiteral gsIGNOREBL(SC_UNONAME_IGNOREBL);
+static const OUStringLiteral gsSHOWLIST(SC_UNONAME_SHOWLIST);
+static const OUStringLiteral gsTYPE(SC_UNONAME_TYPE);
+static const OUStringLiteral gsSHOWINP(SC_UNONAME_SHOWINP);
+static const OUStringLiteral gsSHOWERR(SC_UNONAME_SHOWERR);
+static const OUStringLiteral gsINPTITLE(SC_UNONAME_INPTITLE);
+static const OUStringLiteral gsINPMESS(SC_UNONAME_INPMESS);
+static const OUStringLiteral gsERRTITLE(SC_UNONAME_ERRTITLE);
+static const OUStringLiteral gsERRMESS(SC_UNONAME_ERRMESS);
+
ScMyValidationsContainer::ScMyValidationsContainer()
- : aValidationVec(),
- sERRALSTY(SC_UNONAME_ERRALSTY),
- sIGNOREBL(SC_UNONAME_IGNOREBL),
- sSHOWLIST(SC_UNONAME_SHOWLIST),
- sTYPE(SC_UNONAME_TYPE),
- sSHOWINP(SC_UNONAME_SHOWINP),
- sSHOWERR(SC_UNONAME_SHOWERR),
- sINPTITLE(SC_UNONAME_INPTITLE),
- sINPMESS(SC_UNONAME_INPMESS),
- sERRTITLE(SC_UNONAME_ERRTITLE),
- sERRMESS(SC_UNONAME_ERRMESS)
+ : aValidationVec()
{
}
@@ -108,17 +109,17 @@ void ScMyValidationsContainer::AddValidation(const uno::Any& aTempAny,
if (xPropertySet.is())
{
OUString sErrorMessage;
- xPropertySet->getPropertyValue(sERRMESS) >>= sErrorMessage;
+ xPropertySet->getPropertyValue(gsERRMESS) >>= sErrorMessage;
OUString sErrorTitle;
- xPropertySet->getPropertyValue(sERRTITLE) >>= sErrorTitle;
+ xPropertySet->getPropertyValue(gsERRTITLE) >>= sErrorTitle;
OUString sImputMessage;
- xPropertySet->getPropertyValue(sINPMESS) >>= sImputMessage;
+ xPropertySet->getPropertyValue(gsINPMESS) >>= sImputMessage;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list