summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-02-27 08:33:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-27 10:55:18 +0100
commitb623684c666ccf07b59a76fe58e10f34afbb41a4 (patch)
tree801b2a47c3fd055ed93a52fc721b9b653b0fb5c6 /xmloff
parentd55b26a093bdbced08985dbc7113190b52a8bc66 (diff)
loplugin:constantparam
Change-Id: I62a0b760e49e38a4565eebf272492159047dda5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89613 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/script/xmlbasicscript.cxx49
-rw-r--r--xmloff/source/script/xmlbasicscript.hxx11
-rw-r--r--xmloff/source/script/xmlscripti.cxx2
3 files changed, 29 insertions, 33 deletions
diff --git a/xmloff/source/script/xmlbasicscript.cxx b/xmloff/source/script/xmlbasicscript.cxx
index 2fc2e4e308bf..3c1ea97dbccb 100644
--- a/xmloff/source/script/xmlbasicscript.cxx
+++ b/xmloff/source/script/xmlbasicscript.cxx
@@ -40,9 +40,8 @@ namespace xmloff
{
// BasicElementBase
-BasicElementBase::BasicElementBase(SvXMLImport& rImport, sal_Int32 nExpectedXMLNS)
+BasicElementBase::BasicElementBase(SvXMLImport& rImport)
: SvXMLImportContext(rImport)
- , mnExpectedXMLNS(nExpectedXMLNS)
{
}
@@ -80,9 +79,8 @@ void BasicElementBase::startFastElement(sal_Int32 /*nElement*/,
// BasicLibrariesElement
BasicLibrariesElement::BasicLibrariesElement(SvXMLImport& rImport,
- const css::uno::Reference<css::frame::XModel>& rxModel,
- bool bOasis)
- : BasicElementBase(rImport, bOasis ? XML_NAMESPACE_OOO : XML_NAMESPACE_SCRIPT_OOO)
+ const css::uno::Reference<css::frame::XModel>& rxModel)
+ : BasicElementBase(rImport)
{
// try the XEmbeddedScripts interface
Reference<document::XEmbeddedScripts> xDocumentScripts(rxModel, UNO_QUERY_THROW);
@@ -111,18 +109,18 @@ Reference<XFastContextHandler>
BasicLibrariesElement::createFastChildContext(sal_Int32 nElement,
const Reference<XFastAttributeList>& xAttributes)
{
- if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(mnExpectedXMLNS))
+ if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(XML_NAMESPACE_OOO))
{
throw xml::sax::SAXException("illegal namespace!", Reference<XInterface>(), Any());
}
else if ((nElement & TOKEN_MASK) == XML_LIBRARY_LINKED)
{
- OUString aName = xAttributes->getValue(NAMESPACE_TOKEN(mnExpectedXMLNS) | XML_NAME);
+ OUString aName = xAttributes->getValue(NAMESPACE_TOKEN(XML_NAMESPACE_OOO) | XML_NAME);
OUString aStorageURL = xAttributes->getValue(XML_ELEMENT(XLINK, XML_HREF));
bool bReadOnly = false;
- getBoolAttr(&bReadOnly, NAMESPACE_TOKEN(mnExpectedXMLNS) | XML_READONLY, xAttributes);
+ getBoolAttr(&bReadOnly, NAMESPACE_TOKEN(XML_NAMESPACE_OOO) | XML_READONLY, xAttributes);
if (m_xLibContainer.is())
{
@@ -131,7 +129,7 @@ BasicLibrariesElement::createFastChildContext(sal_Int32 nElement,
Reference<container::XNameAccess> xLib(
m_xLibContainer->createLibraryLink(aName, aStorageURL, bReadOnly));
if (xLib.is())
- return new BasicElementBase(GetImport(), mnExpectedXMLNS);
+ return new BasicElementBase(GetImport());
}
catch (const container::ElementExistException&)
{
@@ -149,10 +147,10 @@ BasicLibrariesElement::createFastChildContext(sal_Int32 nElement,
{
// TODO: create password protected libraries
- OUString aName = xAttributes->getValue(NAMESPACE_TOKEN(mnExpectedXMLNS) | XML_NAME);
+ OUString aName = xAttributes->getValue(NAMESPACE_TOKEN(XML_NAMESPACE_OOO) | XML_NAME);
bool bReadOnly = false;
- getBoolAttr(&bReadOnly, NAMESPACE_TOKEN(mnExpectedXMLNS) | XML_READONLY, xAttributes);
+ getBoolAttr(&bReadOnly, NAMESPACE_TOKEN(XML_NAMESPACE_OOO) | XML_READONLY, xAttributes);
if (m_xLibContainer.is())
{
@@ -170,8 +168,8 @@ BasicLibrariesElement::createFastChildContext(sal_Int32 nElement,
}
if (xLib.is())
- return new BasicEmbeddedLibraryElement(GetImport(), mnExpectedXMLNS,
- m_xLibContainer, aName, bReadOnly);
+ return new BasicEmbeddedLibraryElement(GetImport(), m_xLibContainer, aName,
+ bReadOnly);
}
catch (const lang::IllegalArgumentException&)
{
@@ -192,10 +190,9 @@ BasicLibrariesElement::createFastChildContext(sal_Int32 nElement,
// BasicEmbeddedLibraryElement
BasicEmbeddedLibraryElement::BasicEmbeddedLibraryElement(
- SvXMLImport& rImport, sal_Int32 nExpectedXMLNS,
- const Reference<script::XLibraryContainer2>& rxLibContainer, const OUString& rLibName,
- bool bReadOnly)
- : BasicElementBase(rImport, nExpectedXMLNS)
+ SvXMLImport& rImport, const Reference<script::XLibraryContainer2>& rxLibContainer,
+ const OUString& rLibName, bool bReadOnly)
+ : BasicElementBase(rImport)
, m_xLibContainer(rxLibContainer)
, m_aLibName(rLibName)
, m_bReadOnly(bReadOnly)
@@ -214,16 +211,16 @@ BasicEmbeddedLibraryElement::BasicEmbeddedLibraryElement(
Reference<XFastContextHandler> BasicEmbeddedLibraryElement::createFastChildContext(
sal_Int32 nElement, const Reference<XFastAttributeList>& xAttributes)
{
- if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(mnExpectedXMLNS))
+ if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(XML_NAMESPACE_OOO))
{
throw xml::sax::SAXException("illegal namespace!", Reference<XInterface>(), Any());
}
else if ((nElement & TOKEN_MASK) == XML_MODULE)
{
- OUString aName = xAttributes->getValue(NAMESPACE_TOKEN(mnExpectedXMLNS) | XML_NAME);
+ OUString aName = xAttributes->getValue(NAMESPACE_TOKEN(XML_NAMESPACE_OOO) | XML_NAME);
if (m_xLib.is() && !aName.isEmpty())
- return new BasicModuleElement(GetImport(), mnExpectedXMLNS, m_xLib, aName);
+ return new BasicModuleElement(GetImport(), m_xLib, aName);
}
else
{
@@ -241,10 +238,10 @@ void BasicEmbeddedLibraryElement::endFastElement(sal_Int32)
// BasicModuleElement
-BasicModuleElement::BasicModuleElement(SvXMLImport& rImport, sal_Int32 nExpectedXMLNS,
+BasicModuleElement::BasicModuleElement(SvXMLImport& rImport,
const Reference<container::XNameContainer>& rxLib,
const OUString& rName)
- : BasicElementBase(rImport, nExpectedXMLNS)
+ : BasicElementBase(rImport)
, m_xLib(rxLib)
, m_aName(rName)
{
@@ -256,7 +253,7 @@ BasicModuleElement::createFastChildContext(sal_Int32 nElement,
{
// TODO: <byte-code>
- if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(mnExpectedXMLNS))
+ if ((nElement & NMSP_MASK) != NAMESPACE_TOKEN(XML_NAMESPACE_OOO))
{
throw xml::sax::SAXException("illegal namespace!", Reference<XInterface>(), Any());
}
@@ -267,7 +264,7 @@ BasicModuleElement::createFastChildContext(sal_Int32 nElement,
if (xAttributes.is())
{
if (m_xLib.is() && !m_aName.isEmpty())
- return new BasicSourceCodeElement(GetImport(), mnExpectedXMLNS, m_xLib, m_aName);
+ return new BasicSourceCodeElement(GetImport(), m_xLib, m_aName);
}
}
else
@@ -281,10 +278,10 @@ BasicModuleElement::createFastChildContext(sal_Int32 nElement,
// BasicSourceCodeElement
-BasicSourceCodeElement::BasicSourceCodeElement(SvXMLImport& rImport, sal_Int32 nExpectedXMLNS,
+BasicSourceCodeElement::BasicSourceCodeElement(SvXMLImport& rImport,
const Reference<container::XNameContainer>& rxLib,
const OUString& rName)
- : BasicElementBase(rImport, nExpectedXMLNS)
+ : BasicElementBase(rImport)
, m_xLib(rxLib)
, m_aName(rName)
{
diff --git a/xmloff/source/script/xmlbasicscript.hxx b/xmloff/source/script/xmlbasicscript.hxx
index 7bf5c2483422..b8a03a5b72a8 100644
--- a/xmloff/source/script/xmlbasicscript.hxx
+++ b/xmloff/source/script/xmlbasicscript.hxx
@@ -32,13 +32,12 @@ namespace xmloff
class BasicElementBase : public SvXMLImportContext
{
protected:
- sal_Int32 mnExpectedXMLNS;
static bool
getBoolAttr(bool* pRet, sal_Int32 nToken,
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttributes);
public:
- BasicElementBase(SvXMLImport& rImport, sal_Int32 nExpectedXMLNS);
+ BasicElementBase(SvXMLImport& rImport);
virtual void SAL_CALL startFastElement(
sal_Int32 nElement,
@@ -52,7 +51,7 @@ private:
public:
BasicLibrariesElement(SvXMLImport& rImport,
- const css::uno::Reference<css::frame::XModel>& rxModel, bool bOasis);
+ const css::uno::Reference<css::frame::XModel>& rxModel);
virtual css::uno::Reference<XFastContextHandler> SAL_CALL createFastChildContext(
sal_Int32 Element,
@@ -69,7 +68,7 @@ private:
public:
BasicEmbeddedLibraryElement(
- SvXMLImport& rImport, sal_Int32 nExpectedXMLNS,
+ SvXMLImport& rImport,
const css::uno::Reference<css::script::XLibraryContainer2>& rxLibContainer,
const OUString& rLibName, bool bReadOnly);
@@ -86,7 +85,7 @@ private:
OUString const m_aName;
public:
- BasicModuleElement(SvXMLImport& rImport, sal_Int32 nExpectedXMLNS,
+ BasicModuleElement(SvXMLImport& rImport,
const css::uno::Reference<css::container::XNameContainer>& rxLib,
const OUString& rName);
@@ -103,7 +102,7 @@ private:
OUStringBuffer m_aBuffer;
public:
- BasicSourceCodeElement(SvXMLImport& rImport, sal_Int32 nExpectedXMLNS,
+ BasicSourceCodeElement(SvXMLImport& rImport,
const css::uno::Reference<css::container::XNameContainer>& rxLib,
const OUString& rName);
diff --git a/xmloff/source/script/xmlscripti.cxx b/xmloff/source/script/xmlscripti.cxx
index d72eeeee1159..ea502ec94aba 100644
--- a/xmloff/source/script/xmlscripti.cxx
+++ b/xmloff/source/script/xmlscripti.cxx
@@ -79,7 +79,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLScriptChildContext:
if ( m_aLanguage == aBasic && nElement == XML_ELEMENT(OOO, XML_LIBRARIES) )
{
- return new xmloff::BasicLibrariesElement( GetImport(), m_xModel,/*bOasis*/ true );
+ return new xmloff::BasicLibrariesElement( GetImport(), m_xModel );
}
}