summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-11 22:24:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-12 12:42:15 +0200
commitcbaf1fbaa6e707d939f815eda360fad68a492aca (patch)
tree20b3dfeac257130afb01572b2c117b7840d07007 /xmloff
parentf751417b77e6573a0c639778e76ec943449f4573 (diff)
loplugin:stringview more o3tl conversion
look for call sequences that can use string_view and the new o3tl functions in o3tl/string_view.hxx Also add a few more wrappers to said #include file Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/animationimport.cxx7
-rw-r--r--xmloff/source/draw/eventimp.cxx5
-rw-r--r--xmloff/source/script/XMLStarBasicContextFactory.cxx5
-rw-r--r--xmloff/source/style/xmlbahdl.cxx7
-rw-r--r--xmloff/source/transform/EventOASISTContext.cxx7
5 files changed, 17 insertions, 14 deletions
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index cba8355785c5..236131ac8bb9 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -53,6 +53,7 @@
#include <rtl/math.h>
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
+#include <o3tl/string_view.hxx>
#include <sax/tools/converter.hxx>
#include <vector>
@@ -114,7 +115,7 @@ public:
Any convertTarget( const OUString& rValue );
static Any convertPath( const OUString& rValue );
Any convertTiming( const OUString& rValue );
- static Sequence< double > convertKeyTimes( const OUString& rValue );
+ static Sequence< double > convertKeyTimes( std::u16string_view rValue );
static Sequence< TimeFilterPair > convertTimeFilter( const OUString& rValue );
};
@@ -377,7 +378,7 @@ Any AnimationsImportHelperImpl::convertTiming( const OUString& rValue )
return aAny;
}
-Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( const OUString& rValue )
+Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( std::u16string_view rValue )
{
const sal_Int32 nElements { comphelper::string::getTokenCount(rValue, ';') };
@@ -387,7 +388,7 @@ Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( const OUString&
{
double* pValues = aKeyTimes.getArray();
for (sal_Int32 nIndex = 0; nIndex >= 0; )
- *pValues++ = rValue.getToken( 0, ';', nIndex ).toDouble();
+ *pValues++ = o3tl::toDouble(o3tl::getToken(rValue, 0, ';', nIndex ));
}
return aKeyTimes;
diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
index 41f9cf69a2e6..29fc94fda272 100644
--- a/xmloff/source/draw/eventimp.cxx
+++ b/xmloff/source/draw/eventimp.cxx
@@ -24,6 +24,7 @@
#include <tools/urlobj.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include <sax/tools/converter.hxx>
@@ -296,14 +297,14 @@ void SdXMLEventContextData::ApplyProperties()
const OUString& rApp = GetXMLToken( XML_APPLICATION );
const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
if( msMacroName.getLength() > rApp.getLength()+1 &&
- msMacroName.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
+ o3tl::equalsIgnoreAsciiCase(msMacroName.subView(0,rApp.getLength()), rApp) &&
':' == msMacroName[rApp.getLength()] )
{
sLibrary = "StarOffice";
msMacroName = msMacroName.copy( rApp.getLength()+1 );
}
else if( msMacroName.getLength() > rDoc.getLength()+1 &&
- msMacroName.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
+ o3tl::equalsIgnoreAsciiCase(msMacroName.subView(0,rDoc.getLength()), rDoc) &&
':' == msMacroName[rDoc.getLength()] )
{
sLibrary = rDoc;
diff --git a/xmloff/source/script/XMLStarBasicContextFactory.cxx b/xmloff/source/script/XMLStarBasicContextFactory.cxx
index eec6ded9f207..e26198978596 100644
--- a/xmloff/source/script/XMLStarBasicContextFactory.cxx
+++ b/xmloff/source/script/XMLStarBasicContextFactory.cxx
@@ -24,6 +24,7 @@
#include <xmloff/namespacemap.hxx>
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmltoken.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::xmloff::token;
@@ -66,14 +67,14 @@ SvXMLImportContext* XMLStarBasicContextFactory::CreateContext(
const OUString& rApp = GetXMLToken( XML_APPLICATION );
const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
if( sMacroNameVal.getLength() > rApp.getLength()+1 &&
- sMacroNameVal.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
+ o3tl::equalsIgnoreAsciiCase(sMacroNameVal.subView(0,rApp.getLength()), rApp ) &&
':' == sMacroNameVal[rApp.getLength()] )
{
sLibraryVal = "StarOffice";
sMacroNameVal = sMacroNameVal.copy( rApp.getLength()+1 );
}
else if( sMacroNameVal.getLength() > rDoc.getLength()+1 &&
- sMacroNameVal.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
+ o3tl::equalsIgnoreAsciiCase(sMacroNameVal.subView(0,rDoc.getLength()), rDoc ) &&
':' == sMacroNameVal[rDoc.getLength()] )
{
sLibraryVal = rDoc;
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index bc24a16ceb03..06ac88fe8fa9 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -23,6 +23,7 @@
#include <sal/log.hxx>
#include <o3tl/any.hxx>
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmluconv.hxx>
#include <com/sun/star/uno/Any.hxx>
@@ -478,9 +479,9 @@ bool XMLColorPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, cons
Sequence< double > aHSL
{
- aTmp.getToken( 0, ',', nIndex ).toDouble(),
- aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0,
- aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0
+ o3tl::toDouble(o3tl::getToken(aTmp, 0, ',', nIndex )),
+ o3tl::toDouble(o3tl::getToken(aTmp, 0, ',', nIndex )) / 100.0,
+ o3tl::toDouble(o3tl::getToken(aTmp, 0, ',', nIndex )) / 100.0
};
rValue <<= aHSL;
bRet = true;
diff --git a/xmloff/source/transform/EventOASISTContext.cxx b/xmloff/source/transform/EventOASISTContext.cxx
index 21e3476ef8da..ea922b7ff074 100644
--- a/xmloff/source/transform/EventOASISTContext.cxx
+++ b/xmloff/source/transform/EventOASISTContext.cxx
@@ -27,6 +27,7 @@
#include "TransformerBase.hxx"
#include <osl/diagnose.h>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
// Used to parse Scripting Framework URLs
#include <com/sun/star/uri/UriReferenceFactory.hpp>
@@ -287,16 +288,14 @@ void XMLEventOASISTransformerContext::StartElement(
const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
OUString aAttrValue;
if( rAttrValue.getLength() > rApp.getLength()+1 &&
- rAttrValue.copy(0,rApp.getLength()).
- equalsIgnoreAsciiCase( rApp ) &&
+ o3tl::equalsIgnoreAsciiCase(rAttrValue.subView(0,rApp.getLength()), rApp) &&
':' == rAttrValue[rApp.getLength()] )
{
aLocation = rApp;
aAttrValue = rAttrValue.copy( rApp.getLength()+1 );
}
else if( rAttrValue.getLength() > rDoc.getLength()+1 &&
- rAttrValue.copy(0,rDoc.getLength()).
- equalsIgnoreAsciiCase( rDoc ) &&
+ o3tl::equalsIgnoreAsciiCase(rAttrValue.subView(0,rDoc.getLength()), rDoc) &&
':' == rAttrValue[rDoc.getLength()] )
{
aLocation= rDoc;