summaryrefslogtreecommitdiff
path: root/xmloff/source/script
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-16 16:57:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-22 13:31:57 +0200
commit60bc26354763fa3461db49a3e827da552484150d (patch)
tree5c66cee43f76f556f9a086a67fa8a6e88750c5d5 /xmloff/source/script
parent7867e1f1cdd726cb98a236245e3d08557cc3a313 (diff)
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@collabora.co.uk>
Diffstat (limited to 'xmloff/source/script')
-rw-r--r--xmloff/source/script/XMLEventExport.cxx4
-rw-r--r--xmloff/source/script/XMLScriptContextFactory.cxx15
-rw-r--r--xmloff/source/script/XMLScriptExportHandler.cxx6
-rw-r--r--xmloff/source/script/XMLStarBasicContextFactory.cxx19
-rw-r--r--xmloff/source/script/XMLStarBasicExportHandler.cxx23
5 files changed, 35 insertions, 32 deletions
diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx
index 34a6faadccfd..eb0fc075c584 100644
--- a/xmloff/source/script/XMLEventExport.cxx
+++ b/xmloff/source/script/XMLEventExport.cxx
@@ -41,9 +41,9 @@ using ::com::sun::star::container::XNameReplace;
using ::com::sun::star::container::XNameAccess;
using ::xmloff::token::XML_EVENT_LISTENERS;
+static const OUStringLiteral gsEventType("EventType");
XMLEventExport::XMLEventExport(SvXMLExport& rExp) :
- sEventType("EventType"),
rExport(rExp),
bExtNamespace(false)
{
@@ -205,7 +205,7 @@ void XMLEventExport::ExportEvent(
for(sal_Int32 nVal = 0; nVal < nValues; nVal++)
{
- if (sEventType == pValues[nVal].Name)
+ if (gsEventType == pValues[nVal].Name)
{
// found! Now find handler and delegate
OUString sType;
diff --git a/xmloff/source/script/XMLScriptContextFactory.cxx b/xmloff/source/script/XMLScriptContextFactory.cxx
index 690a19d7437f..6fbbf53a7ebf 100644
--- a/xmloff/source/script/XMLScriptContextFactory.cxx
+++ b/xmloff/source/script/XMLScriptContextFactory.cxx
@@ -32,10 +32,11 @@ using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-XMLScriptContextFactory::XMLScriptContextFactory() :
- sEventType("EventType"),
- sScript("Script"),
- sURL("Script")
+static const OUStringLiteral gsEventType("EventType");
+static const OUStringLiteral gsScript("Script");
+static const OUStringLiteral gsURL("Script");
+
+XMLScriptContextFactory::XMLScriptContextFactory()
{
}
@@ -73,11 +74,11 @@ SvXMLImportContext * XMLScriptContextFactory::CreateContext
Sequence<PropertyValue> aValues(2);
// EventType
- aValues[0].Name = sEventType;
- aValues[0].Value <<= sScript;
+ aValues[0].Name = gsEventType;
+ aValues[0].Value <<= OUString(gsScript);
// URL
- aValues[1].Name = sURL;
+ aValues[1].Name = gsURL;
aValues[1].Value <<= sURLVal;
// add values for event now
diff --git a/xmloff/source/script/XMLScriptExportHandler.cxx b/xmloff/source/script/XMLScriptExportHandler.cxx
index 4e3e17c48d93..6dde942c9907 100644
--- a/xmloff/source/script/XMLScriptExportHandler.cxx
+++ b/xmloff/source/script/XMLScriptExportHandler.cxx
@@ -31,9 +31,9 @@ using namespace ::xmloff::token;
using ::com::sun::star::beans::PropertyValue;
+static const OUStringLiteral gsURL("Script");
-XMLScriptExportHandler::XMLScriptExportHandler() :
- sURL("Script")
+XMLScriptExportHandler::XMLScriptExportHandler()
{
}
@@ -56,7 +56,7 @@ void XMLScriptExportHandler::Export(
sal_Int32 nCount = rValues.getLength();
for(sal_Int32 i = 0; i < nCount; i++)
{
- if (sURL == rValues[i].Name)
+ if (gsURL == rValues[i].Name)
{
OUString sTmp;
rValues[i].Value >>= sTmp;
diff --git a/xmloff/source/script/XMLStarBasicContextFactory.cxx b/xmloff/source/script/XMLStarBasicContextFactory.cxx
index f849db55758d..7dd340b00301 100644
--- a/xmloff/source/script/XMLStarBasicContextFactory.cxx
+++ b/xmloff/source/script/XMLStarBasicContextFactory.cxx
@@ -33,11 +33,12 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
-XMLStarBasicContextFactory::XMLStarBasicContextFactory() :
- sEventType("EventType"),
- sLibrary("Library"),
- sMacroName("MacroName"),
- sStarBasic("StarBasic")
+static const OUStringLiteral gsEventType("EventType");
+static const OUStringLiteral gsLibrary("Library");
+static const OUStringLiteral gsMacroName("MacroName");
+static const OUStringLiteral gsStarBasic("StarBasic");
+
+XMLStarBasicContextFactory::XMLStarBasicContextFactory()
{
}
@@ -95,15 +96,15 @@ SvXMLImportContext* XMLStarBasicContextFactory::CreateContext(
Sequence<PropertyValue> aValues(3);
// EventType
- aValues[0].Name = sEventType;
- aValues[0].Value <<= sStarBasic;
+ aValues[0].Name = gsEventType;
+ aValues[0].Value <<= OUString(gsStarBasic);
// library name
- aValues[1].Name = sLibrary;
+ aValues[1].Name = gsLibrary;
aValues[1].Value <<= sLibraryVal;
// macro name
- aValues[2].Name = sMacroName;
+ aValues[2].Name = gsMacroName;
aValues[2].Value <<= sMacroNameVal;
// add values for event now
diff --git a/xmloff/source/script/XMLStarBasicExportHandler.cxx b/xmloff/source/script/XMLStarBasicExportHandler.cxx
index b6bb28725067..398908e52454 100644
--- a/xmloff/source/script/XMLStarBasicExportHandler.cxx
+++ b/xmloff/source/script/XMLStarBasicExportHandler.cxx
@@ -32,12 +32,13 @@ using namespace ::xmloff::token;
using ::com::sun::star::beans::PropertyValue;
-XMLStarBasicExportHandler::XMLStarBasicExportHandler() :
- sStarBasic("StarBasic"),
- sLibrary("Library"),
- sMacroName("MacroName"),
- sStarOffice("StarOffice"),
- sApplication("application")
+static const OUStringLiteral gsStarBasic("StarBasic");
+static const OUStringLiteral gsLibrary("Library");
+static const OUStringLiteral gsMacroName("MacroName");
+static const OUStringLiteral gsStarOffice("StarOffice");
+static const OUStringLiteral gsApplication("application");
+
+XMLStarBasicExportHandler::XMLStarBasicExportHandler()
{
}
@@ -53,23 +54,23 @@ void XMLStarBasicExportHandler::Export(
{
rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
rExport.GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_OOO, sStarBasic ) );
+ XML_NAMESPACE_OOO, gsStarBasic ) );
rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, rEventQName);
OUString sLocation, sName;
sal_Int32 nCount = rValues.getLength();
for(sal_Int32 i = 0; i < nCount; i++)
{
- if (sLibrary == rValues[i].Name)
+ if (gsLibrary == rValues[i].Name)
{
OUString sTmp;
rValues[i].Value >>= sTmp;
sLocation = GetXMLToken(
- (sTmp.equalsIgnoreAsciiCase(sApplication) ||
- sTmp.equalsIgnoreAsciiCase(sStarOffice) ) ? XML_APPLICATION
+ (sTmp.equalsIgnoreAsciiCase(gsApplication) ||
+ sTmp.equalsIgnoreAsciiCase(gsStarOffice) ) ? XML_APPLICATION
: XML_DOCUMENT );
}
- else if (sMacroName == rValues[i].Name)
+ else if (gsMacroName == rValues[i].Name)
{
rValues[i].Value >>= sName;
}