[Libreoffice-commits] core.git: dbaccess/source include/sax include/xmloff reportdesign/source sax/source sc/source starmath/source sw/source xmloff/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 15 09:51:17 UTC 2020
dbaccess/source/filter/xml/xmlColumn.cxx | 22
dbaccess/source/filter/xml/xmlComponent.cxx | 11
dbaccess/source/filter/xml/xmlConnectionResource.cxx | 7
dbaccess/source/filter/xml/xmlDataSource.cxx | 37
dbaccess/source/filter/xml/xmlDataSourceInfo.cxx | 4
dbaccess/source/filter/xml/xmlDataSourceSetting.cxx | 10
dbaccess/source/filter/xml/xmlHierarchyCollection.cxx | 4
dbaccess/source/filter/xml/xmlLogin.cxx | 11
dbaccess/source/filter/xml/xmlQuery.cxx | 6
include/sax/fastattribs.hxx | 11
include/sax/tools/converter.hxx | 43
include/xmloff/xmluconv.hxx | 13
reportdesign/source/filter/xml/xmlColumn.cxx | 4
reportdesign/source/filter/xml/xmlComponent.cxx | 4
reportdesign/source/filter/xml/xmlCondPrtExpr.cxx | 4
reportdesign/source/filter/xml/xmlControlProperty.cxx | 8
reportdesign/source/filter/xml/xmlFormatCondition.cxx | 9
reportdesign/source/filter/xml/xmlFormattedField.cxx | 4
reportdesign/source/filter/xml/xmlFunction.cxx | 15
reportdesign/source/filter/xml/xmlGroup.cxx | 12
reportdesign/source/filter/xml/xmlImage.cxx | 12
reportdesign/source/filter/xml/xmlReport.cxx | 17
reportdesign/source/filter/xml/xmlReportElement.cxx | 7
reportdesign/source/filter/xml/xmlSection.cxx | 9
reportdesign/source/filter/xml/xmlTable.cxx | 15
sax/source/tools/converter.cxx | 442 ++++++++++
sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 8
sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx | 2
sc/source/filter/xml/XMLTableHeaderFooterContext.cxx | 2
sc/source/filter/xml/XMLTableShapeImportHelper.cxx | 14
sc/source/filter/xml/XMLTrackedChangesContext.cxx | 44
sc/source/filter/xml/xmlannoi.cxx | 12
starmath/source/mathmlimport.cxx | 38
sw/source/filter/xml/xmltbli.cxx | 15
xmloff/source/chart/SchXMLAxisContext.cxx | 24
xmloff/source/chart/SchXMLChartContext.cxx | 23
xmloff/source/chart/SchXMLLegendContext.cxx | 17
xmloff/source/chart/SchXMLPlotAreaContext.cxx | 27
xmloff/source/chart/SchXMLPlotAreaContext.hxx | 2
xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx | 11
xmloff/source/chart/SchXMLTableContext.cxx | 8
xmloff/source/core/xmluconv.cxx | 72 +
xmloff/source/draw/QRCodeContext.cxx | 2
xmloff/source/draw/XMLNumberStyles.cxx | 11
xmloff/source/draw/animationimport.cxx | 127 +-
xmloff/source/draw/animimp.cxx | 20
xmloff/source/draw/eventimp.cxx | 30
xmloff/source/draw/ximp3dobject.cxx | 12
xmloff/source/draw/ximp3dscene.cxx | 11
xmloff/source/draw/ximpcustomshape.cxx | 130 +-
xmloff/source/draw/ximppage.cxx | 10
xmloff/source/draw/ximpshap.cxx | 2
xmloff/source/draw/ximpshow.cxx | 28
xmloff/source/draw/ximpstyl.cxx | 27
xmloff/source/style/DashStyle.cxx | 30
xmloff/source/style/GradientStyle.cxx | 24
xmloff/source/style/HatchStyle.cxx | 13
xmloff/source/style/TransGradientStyle.cxx | 20
xmloff/source/style/XMLFootnoteSeparatorImport.cxx | 15
xmloff/source/style/xmlnumfi.cxx | 86 -
xmloff/source/style/xmlnumi.cxx | 78 -
xmloff/source/style/xmltabi.cxx | 26
xmloff/source/text/XMLCalculationSettingsContext.cxx | 4
xmloff/source/text/XMLChangedRegionImportContext.cxx | 7
xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx | 2
xmloff/source/text/XMLFootnoteImportContext.cxx | 2
xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx | 2
xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx | 2
xmloff/source/text/XMLIndexTOCContext.cxx | 2
xmloff/source/text/XMLIndexTOCStylesContext.cxx | 2
xmloff/source/text/XMLIndexTabStopEntryContext.cxx | 11
xmloff/source/text/XMLLineNumberingSeparatorImportContext.cxx | 2
xmloff/source/text/XMLSectionFootnoteConfigImport.cxx | 14
xmloff/source/text/XMLSectionImportContext.cxx | 21
xmloff/source/text/XMLSectionSourceDDEImportContext.cxx | 2
xmloff/source/text/XMLTextColumnsContext.cxx | 28
xmloff/source/text/XMLTextFrameContext.cxx | 96 +-
xmloff/source/text/XMLTextFrameHyperlinkContext.cxx | 11
xmloff/source/text/XMLTextListBlockContext.cxx | 9
xmloff/source/text/XMLTextShapeImportHelper.cxx | 7
xmloff/source/text/XMLTrackedChangesImportContext.cxx | 2
xmloff/source/text/txtdropi.cxx | 12
xmloff/source/text/txtfldi.cxx | 7
xmloff/source/text/txtparai.cxx | 37
xmloff/source/text/txtvfldi.cxx | 2
85 files changed, 1244 insertions(+), 802 deletions(-)
New commits:
commit a79e6a7cf1ce3be46e4339a54b013ddaa534dd39
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Tue Dec 15 09:38:19 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 15 10:50:28 2020 +0100
use views to parse rather than allocating OUString
Change-Id: If0a848c64ce8077d1681661873629c83307cf8b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107736
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/dbaccess/source/filter/xml/xmlColumn.cxx b/dbaccess/source/filter/xml/xmlColumn.cxx
index 9d8560cf1364..198a92f76fa4 100644
--- a/dbaccess/source/filter/xml/xmlColumn.cxx
+++ b/dbaccess/source/filter/xml/xmlColumn.cxx
@@ -48,38 +48,36 @@ OXMLColumn::OXMLColumn( ODBFilter& rImport
OUString sType;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_NAME:
- m_sName = sValue;
+ m_sName = aIter.toString();
break;
case XML_STYLE_NAME:
- m_sStyleName = sValue;
+ m_sStyleName = aIter.toString();
break;
case XML_HELP_MESSAGE:
- m_sHelpMessage = sValue;
+ m_sHelpMessage = aIter.toString();
break;
case XML_VISIBILITY:
- m_bHidden = sValue != "visible";
+ m_bHidden = aIter.toView() != "visible";
break;
case XML_TYPE_NAME:
- sType = sValue;
+ sType = aIter.toString();
OSL_ENSURE(!sType.isEmpty(),"No type name set");
break;
case XML_DEFAULT_VALUE:
- if ( !(sValue.isEmpty() || sType.isEmpty()) )
- m_aDefaultValue <<= sValue;
+ if ( !(aIter.isEmpty() || sType.isEmpty()) )
+ m_aDefaultValue <<= aIter.toString();
break;
case XML_VISIBLE:
- m_bHidden = sValue == "false";
+ m_bHidden = aIter.toView() == "false";
break;
case XML_DEFAULT_CELL_STYLE_NAME:
- m_sCellStyleName = sValue;
+ m_sCellStyleName = aIter.toString();
break;
default:
- XMLOFF_WARN_UNKNOWN_ATTR("dbaccess", aIter.getToken(), aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
}
diff --git a/dbaccess/source/filter/xml/xmlComponent.cxx b/dbaccess/source/filter/xml/xmlComponent.cxx
index 144eb4ec9234..a9ba7a708842 100644
--- a/dbaccess/source/filter/xml/xmlComponent.cxx
+++ b/dbaccess/source/filter/xml/xmlComponent.cxx
@@ -44,19 +44,16 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
OUString sName;
OUString sHREF;
bool bAsTemplate(false);
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(XLINK, XML_HREF):
- sHREF = sValue;
+ sHREF = aIter.toString();
break;
case XML_ELEMENT(DB, XML_NAME):
case XML_ELEMENT(DB_OASIS, XML_NAME):
- sName = sValue;
+ sName = aIter.toString();
// sanitize the name. Previously, we allowed to create forms/reports/queries which contain
// a / in their name, which nowadays is forbidden. To not lose such objects if they're contained
// in older files, we replace the slash with something less offending.
@@ -64,10 +61,10 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
break;
case XML_ELEMENT(DB, XML_AS_TEMPLATE):
case XML_ELEMENT(DB_OASIS, XML_AS_TEMPLATE):
- bAsTemplate = sValue == s_sTRUE;
+ bAsTemplate = IsXMLToken(aIter, XML_TRUE);
break;
default:
- XMLOFF_WARN_UNKNOWN_ATTR("dbaccess", aIter.getToken(), aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
if ( !(!sHREF.isEmpty() && !sName.isEmpty() && _xParentContainer.is()) )
diff --git a/dbaccess/source/filter/xml/xmlConnectionResource.cxx b/dbaccess/source/filter/xml/xmlConnectionResource.cxx
index 70f7fe210415..e5d92a8d0a8e 100644
--- a/dbaccess/source/filter/xml/xmlConnectionResource.cxx
+++ b/dbaccess/source/filter/xml/xmlConnectionResource.cxx
@@ -42,7 +42,6 @@ OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
aProperty.Name.clear();
aProperty.Value = Any();
@@ -51,7 +50,7 @@ OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
case XML_ELEMENT(XLINK, XML_HREF):
try
{
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sValue));
+ xDataSource->setPropertyValue(PROPERTY_URL,makeAny(aIter.toString()));
}
catch(const Exception&)
{
@@ -68,12 +67,12 @@ OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
aProperty.Name = "Actuate";
break;
default:
- XMLOFF_WARN_UNKNOWN_ATTR("dbaccess", aIter.getToken(), aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
if ( !aProperty.Name.isEmpty() )
{
if ( !aProperty.Value.hasValue() )
- aProperty.Value <<= sValue;
+ aProperty.Value <<= aIter.toString();
rImport.addInfo(aProperty);
}
}
diff --git a/dbaccess/source/filter/xml/xmlDataSource.cxx b/dbaccess/source/filter/xml/xmlDataSource.cxx
index c179cb23ded9..e133d09cbc29 100644
--- a/dbaccess/source/filter/xml/xmlDataSource.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSource.cxx
@@ -49,13 +49,10 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
bool bFoundAppendTableAliasName = false;
bool bFoundSuppressVersionColumns = false;
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
if (xDataSource.is())
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
aProperty.Name.clear();
aProperty.Value = Any();
@@ -64,7 +61,7 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
case XML_CONNECTION_RESOURCE:
try
{
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sValue));
+ xDataSource->setPropertyValue(PROPERTY_URL,makeAny(aIter.toString()));
}
catch(const Exception&)
{
@@ -74,7 +71,7 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
case XML_SUPPRESS_VERSION_COLUMNS:
try
{
- xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,makeAny(sValue == s_sTRUE));
+ xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,makeAny(IsXMLToken(aIter, XML_TRUE)));
bFoundSuppressVersionColumns = true;
}
catch(const Exception&)
@@ -90,15 +87,15 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
break;
case XML_IS_FIRST_ROW_HEADER_LINE:
aProperty.Name = INFO_TEXTFILEHEADER;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_SHOW_DELETED:
aProperty.Name = INFO_SHOWDELETEDROWS;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_IS_TABLE_NAME_LENGTH_LIMITED:
aProperty.Name = INFO_ALLOWLONGTABLENAMES;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
bFoundTableNameLengthLimited = true;
break;
case XML_SYSTEM_DRIVER_SETTINGS:
@@ -106,54 +103,54 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
break;
case XML_ENABLE_SQL92_CHECK:
aProperty.Name = PROPERTY_ENABLESQL92CHECK;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_APPEND_TABLE_ALIAS_NAME:
aProperty.Name = INFO_APPEND_TABLE_ALIAS;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
bFoundAppendTableAliasName = true;
break;
case XML_PARAMETER_NAME_SUBSTITUTION:
aProperty.Name = INFO_PARAMETERNAMESUBST;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
bFoundParamNameSubstitution = true;
break;
case XML_IGNORE_DRIVER_PRIVILEGES:
aProperty.Name = INFO_IGNOREDRIVER_PRIV;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_BOOLEAN_COMPARISON_MODE:
aProperty.Name = PROPERTY_BOOLEANCOMPARISONMODE;
- if ( sValue == "equal-integer" )
+ if ( aIter.toView() == "equal-integer" )
aProperty.Value <<= sal_Int32(0);
- else if ( sValue == "is-boolean" )
+ else if ( aIter.toView() == "is-boolean" )
aProperty.Value <<= sal_Int32(1);
- else if ( sValue == "equal-boolean" )
+ else if ( aIter.toView() == "equal-boolean" )
aProperty.Value <<= sal_Int32(2);
- else if ( sValue == "equal-use-only-zero" )
+ else if ( aIter.toView() == "equal-use-only-zero" )
aProperty.Value <<= sal_Int32(3);
break;
case XML_USE_CATALOG:
aProperty.Name = INFO_USECATALOG;
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
break;
case XML_BASE_DN:
aProperty.Name = INFO_CONN_LDAP_BASEDN;
break;
case XML_MAX_ROW_COUNT:
aProperty.Name = INFO_CONN_LDAP_ROWCOUNT;
- aProperty.Value <<= sValue.toInt32();
+ aProperty.Value <<= aIter.toInt32();
break;
case XML_JAVA_CLASSPATH:
aProperty.Name = "JavaDriverClassPath";
break;
default:
- XMLOFF_WARN_UNKNOWN_ATTR("dbaccess", aIter.getToken(), aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
if ( !aProperty.Name.isEmpty() )
{
if ( !aProperty.Value.hasValue() )
- aProperty.Value <<= sValue;
+ aProperty.Value <<= aIter.toString();
rImport.addInfo(aProperty);
}
}
diff --git a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
index ec1a42d6e9af..e7362ca5ba77 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
@@ -39,8 +39,6 @@ OXMLDataSourceInfo::OXMLDataSourceInfo( ODBFilter& rImport
bool bFoundField = false,bFoundThousand = false, bFoundCharset = false;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
aProperty.Name.clear();
switch( aIter.getToken() & TOKEN_MASK )
@@ -76,7 +74,7 @@ OXMLDataSourceInfo::OXMLDataSourceInfo( ODBFilter& rImport
}
if ( !aProperty.Name.isEmpty() )
{
- aProperty.Value <<= sValue;
+ aProperty.Value <<= aIter.toString();
rImport.addInfo(aProperty);
}
}
diff --git a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
index f709757a5f7d..525162664865 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
@@ -47,12 +47,10 @@ OXMLDataSourceSetting::OXMLDataSourceSetting( ODBFilter& rImport
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_DATA_SOURCE_SETTING_IS_LIST:
- m_bIsList = sValue == "true";
+ m_bIsList = aIter.toView() == "true";
break;
case XML_DATA_SOURCE_SETTING_TYPE:
{
@@ -71,17 +69,17 @@ OXMLDataSourceSetting::OXMLDataSourceSetting( ODBFilter& rImport
return tmp;
}();
- const std::map< OUString, css::uno::Type >::const_iterator aTypePos = s_aTypeNameMap.find(sValue);
+ const std::map< OUString, css::uno::Type >::const_iterator aTypePos = s_aTypeNameMap.find(aIter.toString());
OSL_ENSURE(s_aTypeNameMap.end() != aTypePos, "OXMLDataSourceSetting::OXMLDataSourceSetting: invalid type!");
if (s_aTypeNameMap.end() != aTypePos)
m_aPropType = aTypePos->second;
}
break;
case XML_DATA_SOURCE_SETTING_NAME:
- m_aSetting.Name = sValue;
+ m_aSetting.Name = aIter.toString();
break;
default:
- XMLOFF_WARN_UNKNOWN_ATTR("dbaccess", aIter.getToken(), aIter.toString());
+ XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
}
}
diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
index 7b2a8cc54e6b..879575482b54 100644
--- a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
+++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
@@ -50,12 +50,10 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
OUString sName;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_NAME:
- sName = sValue;
+ sName = aIter.toString();
break;
default:
XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
diff --git a/dbaccess/source/filter/xml/xmlLogin.cxx b/dbaccess/source/filter/xml/xmlLogin.cxx
index a30988098595..cc7502301233 100644
--- a/dbaccess/source/filter/xml/xmlLogin.cxx
+++ b/dbaccess/source/filter/xml/xmlLogin.cxx
@@ -36,15 +36,12 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
{
Reference<XPropertySet> xDataSource(rImport.getDataSource());
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
bool bUserFound = false;
if (!xDataSource.is())
return;
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
try
{
switch( aIter.getToken() & TOKEN_MASK )
@@ -55,7 +52,7 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
bUserFound = true;
try
{
- xDataSource->setPropertyValue(PROPERTY_USER,makeAny(sValue));
+ xDataSource->setPropertyValue(PROPERTY_USER,makeAny(aIter.toString()));
}
catch(const Exception&)
{
@@ -66,7 +63,7 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
case XML_IS_PASSWORD_REQUIRED:
try
{
- xDataSource->setPropertyValue(PROPERTY_ISPASSWORDREQUIRED,makeAny(sValue == s_sTRUE));
+ xDataSource->setPropertyValue(PROPERTY_ISPASSWORDREQUIRED,makeAny(IsXMLToken(aIter, XML_TRUE)));
}
catch(const Exception&)
{
@@ -79,14 +76,14 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
bUserFound = true;
PropertyValue aProperty;
aProperty.Name = "UseSystemUser";
- aProperty.Value <<= (sValue == s_sTRUE);
+ aProperty.Value <<= IsXMLToken(aIter, XML_TRUE);
rImport.addInfo(aProperty);
}
break;
case XML_LOGIN_TIMEOUT:
try
{
- Reference< XDataSource>(xDataSource,UNO_QUERY_THROW)->setLoginTimeout(sValue.toInt32());
+ Reference< XDataSource>(xDataSource,UNO_QUERY_THROW)->setLoginTimeout(aIter.toInt32());
}
catch(const Exception&)
{
diff --git a/dbaccess/source/filter/xml/xmlQuery.cxx b/dbaccess/source/filter/xml/xmlQuery.cxx
index 722e650c3b58..8f91145d72e9 100644
--- a/dbaccess/source/filter/xml/xmlQuery.cxx
+++ b/dbaccess/source/filter/xml/xmlQuery.cxx
@@ -44,15 +44,13 @@ OXMLQuery::OXMLQuery( ODBFilter& rImport
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() & TOKEN_MASK )
{
case XML_COMMAND:
- m_sCommand = sValue;
+ m_sCommand = aIter.toString();
break;
case XML_ESCAPE_PROCESSING:
- m_bEscapeProcessing = sValue == "true";
+ m_bEscapeProcessing = aIter.toView() == "true";
break;
default:
XMLOFF_WARN_UNKNOWN("dbaccess", aIter);
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index e00452b0aa14..452280782067 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -27,6 +27,7 @@
#include <cppuhelper/implbase.hxx>
#include <sax/saxdllapi.h>
+#include <string_view>
#include <vector>
namespace com::sun::star::xml::sax { class XFastTokenHandler; }
@@ -171,6 +172,11 @@ public:
assert(mnIdx < mrList.maAttributeTokens.size());
return rtl_str_toDouble(mrList.getFastAttributeValue(mnIdx));
}
+ bool toBoolean() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return rtl_str_toBoolean(mrList.getFastAttributeValue(mnIdx));
+ }
OUString toString() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
@@ -188,6 +194,11 @@ public:
assert(mnIdx < mrList.maAttributeTokens.size());
return mrList.AttributeValueLength(mnIdx);
}
+ std::string_view toView() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return std::string_view(mrList.getFastAttributeValue(mnIdx), mrList.AttributeValueLength(mnIdx));
+ }
bool isString(const char *str) const
{
assert(mnIdx < mrList.maAttributeTokens.size());
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 6d2347ef289d..07c2fb3207b1 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -64,6 +64,13 @@ public:
sal_Int32 nMin = SAL_MIN_INT32,
sal_Int32 nMax = SAL_MAX_INT32 );
+ /** convert string to measure using optional min and max values*/
+ static bool convertMeasure( sal_Int32& rValue,
+ std::string_view rString,
+ sal_Int16 nTargetUnit = css::util::MeasureUnit::MM_100TH,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
/** convert measure to string */
static void convertMeasure( OUStringBuffer& rBuffer,
sal_Int32 nMeasure,
@@ -74,6 +81,10 @@ public:
static bool convertBool( bool& rBool,
std::u16string_view rString );
+ /** convert string to boolean */
+ static bool convertBool( bool& rBool,
+ std::string_view rString );
+
/** convert boolean to string */
static void convertBool( OUStringBuffer& rBuffer,
bool bValue );
@@ -82,14 +93,22 @@ public:
static bool convertPercent( sal_Int32& rValue,
std::u16string_view rString );
+ /** convert string to percent */
+ static bool convertPercent( sal_Int32& rValue,
+ std::string_view rString );
+
/** convert percent to string */
static void convertPercent( OUStringBuffer& rBuffer,
sal_Int32 nValue );
- /** convert string to pixel measure unite */
+ /** convert string to pixel measure unit */
static bool convertMeasurePx( sal_Int32& rValue,
std::u16string_view rString );
+ /** convert string to pixel measure unit */
+ static bool convertMeasurePx( sal_Int32& rValue,
+ std::string_view rString );
+
/** convert pixel measure unit to string */
static void convertMeasurePx( OUStringBuffer& rBuffer,
sal_Int32 nValue );
@@ -97,6 +116,8 @@ public:
/** convert string to rgb color */
static bool convertColor( sal_Int32& rColor,
std::u16string_view rValue );
+ static bool convertColor( sal_Int32& rColor,
+ std::string_view rValue );
static bool convertColor( ::Color& rColor,
std::u16string_view rValue )
{
@@ -119,12 +140,24 @@ public:
sal_Int32 nMin = SAL_MIN_INT32,
sal_Int32 nMax = SAL_MAX_INT32 );
+ /** convert string to number with optional min and max values */
+ static bool convertNumber( sal_Int32& rValue,
+ std::string_view aString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
/** convert string to number with optional min and max values */
static bool convertNumber64(sal_Int64& rValue,
std::u16string_view aString,
sal_Int64 nMin = SAL_MIN_INT64,
sal_Int64 nMax = SAL_MAX_INT64);
+ /** convert string to number with optional min and max values */
+ static bool convertNumber64(sal_Int64& rValue,
+ std::string_view aString,
+ sal_Int64 nMin = SAL_MIN_INT64,
+ sal_Int64 nMax = SAL_MAX_INT64);
+
/** convert double number to string (using ::rtl::math) and
DO convert from source unit to target unit */
static void convertDouble( OUStringBuffer& rBuffer,
@@ -146,6 +179,9 @@ public:
/** convert string to double number (using ::rtl::math) without unit conversion */
static bool convertDouble(double& rValue, std::u16string_view rString);
+ /** convert string to double number (using ::rtl::math) without unit conversion */
+ static bool convertDouble(double& rValue, std::string_view rString);
+
/** convert number, 10th of degrees with range [0..3600] to SVG angle */
static void convertAngle(OUStringBuffer& rBuffer, sal_Int16 nAngle,
SvtSaveOptions::ODFSaneDefaultVersion nVersion);
@@ -154,6 +190,10 @@ public:
static bool convertAngle(sal_Int16& rAngle, std::u16string_view rString,
bool isWrongOOo10thDegAngle);
+ /** convert SVG angle to number, 10th of degrees with range [0..3600] */
+ static bool convertAngle(sal_Int16& rAngle, std::string_view rString,
+ bool isWrongOOo10thDegAngle);
+
/** convert double to XMLSchema-2 "duration" string; negative durations allowed */
static void convertDuration(OUStringBuffer& rBuffer,
const double fTime);
@@ -209,6 +249,7 @@ public:
static double GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit);
static sal_Int16 GetUnitFromString(std::u16string_view rString, sal_Int16 nDefaultUnit);
+ static sal_Int16 GetUnitFromString(std::string_view rString, sal_Int16 nDefaultUnit);
/** convert an Any to string (typesafe) */
static bool convertAny(OUStringBuffer& rsValue,
diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx
index d4796bb82d94..06e047648832 100644
--- a/include/xmloff/xmluconv.hxx
+++ b/include/xmloff/xmluconv.hxx
@@ -115,6 +115,13 @@ public:
sal_Int32 nMin = SAL_MIN_INT32,
sal_Int32 nMax = SAL_MAX_INT32) const;
+ /** convert string to measure with meCoreMeasureUnit,
+ using optional min and max values*/
+ bool convertMeasureToCore( sal_Int32& rValue,
+ std::string_view rString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32) const;
+
/** convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit */
void convertMeasureToXML( OUStringBuffer& rBuffer,
sal_Int32 nMeasure ) const;
@@ -205,13 +212,17 @@ public:
static bool convertB3DVector( ::basegfx::B3DVector& rVector,
const OUString& rValue );
+ /** convert string to ::basegfx::B3DVector */
+ static bool convertB3DVector( ::basegfx::B3DVector& rVector,
+ std::string_view rValue );
+
/** convert B3DVector to string */
static void convertB3DVector( OUStringBuffer &rBuffer,
const ::basegfx::B3DVector& rVector );
/** convert string to Position3D */
bool convertPosition3D( css::drawing::Position3D& rPosition,
- const OUString& rValue );
+ std::string_view rValue );
/** convert Position3D to string */
void convertPosition3D( OUStringBuffer &rBuffer,
diff --git a/reportdesign/source/filter/xml/xmlColumn.cxx b/reportdesign/source/filter/xml/xmlColumn.cxx
index f98f6507ffc5..9693ee3ceb0d 100644
--- a/reportdesign/source/filter/xml/xmlColumn.cxx
+++ b/reportdesign/source/filter/xml/xmlColumn.cxx
@@ -55,12 +55,10 @@ OXMLRowColumn::OXMLRowColumn( ORptFilter& rImport
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(TABLE, XML_STYLE_NAME):
- fillStyle(sValue);
+ fillStyle(aIter.toString());
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlComponent.cxx b/reportdesign/source/filter/xml/xmlComponent.cxx
index ab55e9215bf3..fc87f8da56e6 100644
--- a/reportdesign/source/filter/xml/xmlComponent.cxx
+++ b/reportdesign/source/filter/xml/xmlComponent.cxx
@@ -42,14 +42,12 @@ OXMLComponent::OXMLComponent( ORptFilter& _rImport
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
try
{
switch( aIter.getToken() )
{
case XML_ELEMENT(DRAW, XML_NAME):
- m_xComponent->setName(sValue);
+ m_xComponent->setName(aIter.toString());
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlCondPrtExpr.cxx b/reportdesign/source/filter/xml/xmlCondPrtExpr.cxx
index 35167e338095..0ef9c8d98f61 100644
--- a/reportdesign/source/filter/xml/xmlCondPrtExpr.cxx
+++ b/reportdesign/source/filter/xml/xmlCondPrtExpr.cxx
@@ -43,12 +43,10 @@ OXMLCondPrtExpr::OXMLCondPrtExpr( ORptFilter& _rImport
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_FORMULA):
- m_xComponent->setPropertyValue(PROPERTY_CONDITIONALPRINTEXPRESSION,uno::makeAny(ORptFilter::convertFormula(sValue)));
+ m_xComponent->setPropertyValue(PROPERTY_CONDITIONALPRINTEXPRESSION,uno::makeAny(ORptFilter::convertFormula(aIter.toString())));
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlControlProperty.cxx b/reportdesign/source/filter/xml/xmlControlProperty.cxx
index fce0ef4cba11..1bc323d466c1 100644
--- a/reportdesign/source/filter/xml/xmlControlProperty.cxx
+++ b/reportdesign/source/filter/xml/xmlControlProperty.cxx
@@ -64,12 +64,10 @@ OXMLControlProperty::OXMLControlProperty( ORptFilter& rImport
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(FORM, XML_LIST_PROPERTY):
- m_bIsList = sValue == "true";
+ m_bIsList = aIter.toView() == "true";
break;
case XML_ELEMENT(OOO, XML_VALUE_TYPE):
{
@@ -88,14 +86,14 @@ OXMLControlProperty::OXMLControlProperty( ORptFilter& rImport
{ GetXMLToken( XML_VOID) , cppu::UnoType<void>::get() },
};
- const std::map< OUString, css::uno::Type >::const_iterator aTypePos = s_aTypeNameMap.find(sValue);
+ const std::map< OUString, css::uno::Type >::const_iterator aTypePos = s_aTypeNameMap.find(aIter.toString());
OSL_ENSURE(s_aTypeNameMap.end() != aTypePos, "OXMLControlProperty::OXMLControlProperty: invalid type!");
if (s_aTypeNameMap.end() != aTypePos)
m_aPropType = aTypePos->second;
}
break;
case XML_ELEMENT(FORM, XML_PROPERTY_NAME):
- m_aSetting.Name = sValue;
+ m_aSetting.Name = aIter.toString();
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlFormatCondition.cxx b/reportdesign/source/filter/xml/xmlFormatCondition.cxx
index 235f6931778f..63aae9301105 100644
--- a/reportdesign/source/filter/xml/xmlFormatCondition.cxx
+++ b/reportdesign/source/filter/xml/xmlFormatCondition.cxx
@@ -42,23 +42,20 @@ OXMLFormatCondition::OXMLFormatCondition( ORptFilter& rImport,
{
OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
try
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_ENABLED):
- m_xComponent->setEnabled(sValue == s_sTRUE);
+ m_xComponent->setEnabled(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_FORMULA):
- m_xComponent->setFormula(ORptFilter::convertFormula(sValue));
+ m_xComponent->setFormula(ORptFilter::convertFormula(aIter.toString()));
break;
case XML_ELEMENT(REPORT, XML_STYLE_NAME):
- m_sStyleName = sValue;
+ m_sStyleName = aIter.toString();
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlFormattedField.cxx b/reportdesign/source/filter/xml/xmlFormattedField.cxx
index c34f8adf2414..b453dbc4da79 100644
--- a/reportdesign/source/filter/xml/xmlFormattedField.cxx
+++ b/reportdesign/source/filter/xml/xmlFormattedField.cxx
@@ -43,12 +43,10 @@ OXMLFormattedField::OXMLFormattedField( ORptFilter& rImport
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_FORMULA):
- _xComponent->setDataField(ORptFilter::convertFormula(sValue));
+ _xComponent->setDataField(ORptFilter::convertFormula(aIter.toString()));
break;
case XML_ELEMENT(REPORT, XML_SELECT_PAGE):
_xComponent->setDataField("rpt:PageNumber()");
diff --git a/reportdesign/source/filter/xml/xmlFunction.cxx b/reportdesign/source/filter/xml/xmlFunction.cxx
index 62dcaa9256f7..cd6d072d24ac 100644
--- a/reportdesign/source/filter/xml/xmlFunction.cxx
+++ b/reportdesign/source/filter/xml/xmlFunction.cxx
@@ -45,30 +45,27 @@ OXMLFunction::OXMLFunction( ORptFilter& _rImport
OSL_ENSURE(m_xFunctions.is(),"Functions is NULL!");
m_xFunction = m_xFunctions->createFunction();
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
try
{
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_NAME):
- m_xFunction->setName(sValue);
+ m_xFunction->setName(aIter.toString());
break;
case XML_ELEMENT(REPORT, XML_FORMULA):
- m_xFunction->setFormula(ORptFilter::convertFormula(sValue));
+ m_xFunction->setFormula(ORptFilter::convertFormula(aIter.toString()));
break;
case XML_ELEMENT(REPORT, XML_PRE_EVALUATED):
- m_xFunction->setPreEvaluated(sValue == s_sTRUE);
+ m_xFunction->setPreEvaluated(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_INITIAL_FORMULA):
- if ( !sValue.isEmpty() )
- m_xFunction->setInitialFormula(beans::Optional< OUString>(true,ORptFilter::convertFormula(sValue)));
+ if ( !aIter.isEmpty() )
+ m_xFunction->setInitialFormula(beans::Optional< OUString>(true,ORptFilter::convertFormula(aIter.toString())));
break;
case XML_ELEMENT(REPORT, XML_DEEP_TRAVERSING):
- m_xFunction->setDeepTraversing(sValue == s_sTRUE);
+ m_xFunction->setDeepTraversing(IsXMLToken(aIter, XML_TRUE));
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx
index 94f6028494ce..b8a8e10abc10 100644
--- a/reportdesign/source/filter/xml/xmlGroup.cxx
+++ b/reportdesign/source/filter/xml/xmlGroup.cxx
@@ -58,26 +58,24 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport
m_xGroup = m_xGroups->createGroup();
m_xGroup->setSortAscending(false);// the default value has to be set
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
try
{
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_START_NEW_COLUMN):
- m_xGroup->setStartNewColumn(sValue == s_sTRUE);
+ m_xGroup->setStartNewColumn(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_RESET_PAGE_NUMBER):
- m_xGroup->setResetPageNumber(sValue == s_sTRUE);
+ m_xGroup->setResetPageNumber(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_SORT_ASCENDING):
- m_xGroup->setSortAscending(sValue == s_sTRUE);
+ m_xGroup->setSortAscending(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_GROUP_EXPRESSION):
{
+ OUString sValue = aIter.toString();
sal_Int32 nLen = sValue.getLength();
if ( nLen )
{
@@ -156,7 +154,7 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport
}
break;
case XML_ELEMENT(REPORT, XML_KEEP_TOGETHER):
- m_xGroup->setKeepTogether(lcl_getKeepTogetherOption(sValue));
+ m_xGroup->setKeepTogether(lcl_getKeepTogetherOption(aIter.toString()));
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlImage.cxx b/reportdesign/source/filter/xml/xmlImage.cxx
index 9f27b6151e82..d8736f5ca032 100644
--- a/reportdesign/source/filter/xml/xmlImage.cxx
+++ b/reportdesign/source/filter/xml/xmlImage.cxx
@@ -44,44 +44,42 @@ OXMLImage::OXMLImage( ORptFilter& rImport,
{
OSL_ENSURE(m_xReportComponent.is(),"Component is NULL!");
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
try
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(FORM, XML_IMAGE_DATA):
{
SvtPathOptions aPathOptions;
+ OUString sValue = aIter.toString();
sValue = aPathOptions.SubstituteVariable(sValue);
_xComponent->setImageURL(rImport.GetAbsoluteReference( sValue ));
break;
}
case XML_ELEMENT(REPORT, XML_PRESERVE_IRI):
- _xComponent->setPreserveIRI(s_sTRUE == sValue);
+ _xComponent->setPreserveIRI(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_SCALE):
{
sal_Int16 nRet = awt::ImageScaleMode::NONE;
- if ( s_sTRUE == sValue )
+ if ( IsXMLToken(aIter, XML_TRUE) )
{
nRet = awt::ImageScaleMode::ANISOTROPIC;
}
else
{
const SvXMLEnumMapEntry<sal_Int16>* aXML_EnumMap = OXMLHelper::GetImageScaleOptions();
- bool bConvertOk = SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
+ bool bConvertOk = SvXMLUnitConverter::convertEnum( nRet, aIter.toString(), aXML_EnumMap );
SAL_WARN_IF(!bConvertOk, "reportdesign", "convertEnum failed");
}
_xComponent->setScaleMode( nRet );
break;
}
case XML_ELEMENT(REPORT, XML_FORMULA):
- _xComponent->setDataField(ORptFilter::convertFormula(sValue));
+ _xComponent->setDataField(ORptFilter::convertFormula(aIter.toString()));
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlReport.cxx b/reportdesign/source/filter/xml/xmlReport.cxx
index a559946fc848..01a0a2a76765 100644
--- a/reportdesign/source/filter/xml/xmlReport.cxx
+++ b/reportdesign/source/filter/xml/xmlReport.cxx
@@ -49,42 +49,39 @@ OXMLReport::OXMLReport( ORptFilter& rImport,
impl_initRuntimeDefaults();
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
try
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_COMMAND_TYPE):
{
sal_Int32 nRet = sdb::CommandType::COMMAND;
const SvXMLEnumMapEntry<sal_Int32>* aXML_EnumMap = OXMLHelper::GetCommandTypeOptions();
- bool bConvertOk = SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
+ bool bConvertOk = SvXMLUnitConverter::convertEnum( nRet, aIter.toString(), aXML_EnumMap );
SAL_WARN_IF(!bConvertOk, "reportdesign", "convertEnum failed");
m_xReportDefinition->setCommandType(nRet);
}
break;
case XML_ELEMENT(REPORT, XML_COMMAND):
- m_xReportDefinition->setCommand(sValue);
+ m_xReportDefinition->setCommand(aIter.toString());
break;
case XML_ELEMENT(REPORT, XML_FILTER):
- m_xReportDefinition->setFilter(sValue);
+ m_xReportDefinition->setFilter(aIter.toString());
break;
case XML_ELEMENT(REPORT, XML_CAPTION):
case XML_ELEMENT(OFFICE, XML_CAPTION):
- m_xReportDefinition->setCaption(sValue);
+ m_xReportDefinition->setCaption(aIter.toString());
break;
case XML_ELEMENT(REPORT, XML_ESCAPE_PROCESSING):
- m_xReportDefinition->setEscapeProcessing(sValue == s_sTRUE);
+ m_xReportDefinition->setEscapeProcessing(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(OFFICE, XML_MIMETYPE):
- m_xReportDefinition->setMimeType(sValue);
+ m_xReportDefinition->setMimeType(aIter.toString());
break;
case XML_ELEMENT(DRAW, XML_NAME):
- m_xReportDefinition->setName(sValue);
+ m_xReportDefinition->setName(aIter.toString());
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlReportElement.cxx b/reportdesign/source/filter/xml/xmlReportElement.cxx
index 0c49c9fb47e3..e488fb50a41c 100644
--- a/reportdesign/source/filter/xml/xmlReportElement.cxx
+++ b/reportdesign/source/filter/xml/xmlReportElement.cxx
@@ -45,20 +45,17 @@ OXMLReportElement::OXMLReportElement( ORptFilter& rImport,
OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
try
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_PRINT_WHEN_GROUP_CHANGE):
- m_xComponent->setPrintWhenGroupChange(s_sTRUE == sValue);
+ m_xComponent->setPrintWhenGroupChange(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_PRINT_REPEATED_VALUES):
- m_xComponent->setPrintRepeatedValues(sValue == s_sTRUE);
+ m_xComponent->setPrintRepeatedValues(IsXMLToken(aIter, XML_TRUE));
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlSection.cxx b/reportdesign/source/filter/xml/xmlSection.cxx
index 6e1954ab0456..71a458947fdd 100644
--- a/reportdesign/source/filter/xml/xmlSection.cxx
+++ b/reportdesign/source/filter/xml/xmlSection.cxx
@@ -55,23 +55,20 @@ OXMLSection::OXMLSection( ORptFilter& rImport,
if (!m_xSection.is())
return;
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
try
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_PAGE_PRINT_OPTION):
if ( _bPageHeader )
- m_xSection->getReportDefinition()->setPageHeaderOption(lcl_getReportPrintOption(sValue));
+ m_xSection->getReportDefinition()->setPageHeaderOption(lcl_getReportPrintOption(aIter.toString()));
else
- m_xSection->getReportDefinition()->setPageFooterOption(lcl_getReportPrintOption(sValue));
+ m_xSection->getReportDefinition()->setPageFooterOption(lcl_getReportPrintOption(aIter.toString()));
break;
case XML_ELEMENT(REPORT, XML_REPEAT_SECTION):
- m_xSection->setRepeatSection(sValue == s_sTRUE );
+ m_xSection->setRepeatSection(IsXMLToken(aIter, XML_TRUE));
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/reportdesign/source/filter/xml/xmlTable.cxx b/reportdesign/source/filter/xml/xmlTable.cxx
index 2c3bc48cbdda..f6934e2a3ae6 100644
--- a/reportdesign/source/filter/xml/xmlTable.cxx
+++ b/reportdesign/source/filter/xml/xmlTable.cxx
@@ -72,32 +72,29 @@ OXMLTable::OXMLTable( ORptFilter& rImport
if (!m_xSection.is())
return;
- static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
try
{
for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
{
- OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(REPORT, XML_VISIBLE):
- m_xSection->setVisible(sValue == s_sTRUE);
+ m_xSection->setVisible(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(REPORT, XML_FORCE_NEW_PAGE):
- m_xSection->setForceNewPage(lcl_getForceNewPageOption(sValue));
+ m_xSection->setForceNewPage(lcl_getForceNewPageOption(aIter.toString()));
break;
case XML_ELEMENT(REPORT, XML_FORCE_NEW_COLUMN):
- m_xSection->setNewRowOrCol(lcl_getForceNewPageOption(sValue));
+ m_xSection->setNewRowOrCol(lcl_getForceNewPageOption(aIter.toString()));
break;
case XML_ELEMENT(REPORT, XML_KEEP_TOGETHER):
- m_xSection->setKeepTogether(sValue == s_sTRUE);
+ m_xSection->setKeepTogether(IsXMLToken(aIter, XML_TRUE));
break;
case XML_ELEMENT(TABLE, XML_NAME):
- m_xSection->setName(sValue);
+ m_xSection->setName(aIter.toString());
break;
case XML_ELEMENT(TABLE, XML_STYLE_NAME):
- m_sStyleName = sValue;
+ m_sStyleName = aIter.toString();
break;
default:
XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 07223cb01fb2..5caeb3161b8a 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -264,6 +264,219 @@ bool Converter::convertMeasure( sal_Int32& rValue,
return true;
}
+/** convert string to measure using optional min and max values*/
+bool Converter::convertMeasure( sal_Int32& rValue,
+ std::string_view rString,
+ sal_Int16 nTargetUnit /* = MeasureUnit::MM_100TH */,
+ sal_Int32 nMin /* = SAL_MIN_INT32 */,
+ sal_Int32 nMax /* = SAL_MAX_INT32 */ )
+{
+ bool bNeg = false;
+ double nVal = 0;
+
+ sal_Int32 nPos = 0;
+ sal_Int32 const nLen = rString.size();
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= ' ') )
+ nPos++;
+
+ if( nPos < nLen && '-' == rString[nPos] )
+ {
+ bNeg = true;
+ nPos++;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ '0' <= rString[nPos] &&
+ '9' >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ nVal *= 10;
+ nVal += (rString[nPos] - '0');
+ nPos++;
+ }
+ if( nPos < nLen && '.' == rString[nPos] )
+ {
+ nPos++;
+ double nDiv = 1.;
+
+ while( nPos < nLen &&
+ '0' <= rString[nPos] &&
+ '9' >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ nDiv *= 10;
+ nVal += ( static_cast<double>(rString[nPos] - '0') / nDiv );
+ nPos++;
+ }
+ }
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= ' ') )
+ nPos++;
+
+ if( nPos < nLen )
+ {
+
+ if( MeasureUnit::PERCENT == nTargetUnit )
+ {
+ if( '%' != rString[nPos] )
+ return false;
+ }
+ else if( MeasureUnit::PIXEL == nTargetUnit )
+ {
+ if( nPos + 1 >= nLen ||
+ ('p' != rString[nPos] &&
+ 'P' != rString[nPos])||
+ ('x' != rString[nPos+1] &&
+ 'X' != rString[nPos+1]) )
+ return false;
+ }
+ else
+ {
+ OSL_ENSURE( MeasureUnit::TWIP == nTargetUnit || MeasureUnit::POINT == nTargetUnit ||
+ MeasureUnit::MM_100TH == nTargetUnit || MeasureUnit::MM_10TH == nTargetUnit ||
+ MeasureUnit::PIXEL == nTargetUnit, "unit is not supported");
+ const char *aCmpsL[3] = { nullptr, nullptr, nullptr };
+ const char *aCmpsU[3] = { nullptr, nullptr, nullptr };
+ double aScales[3] = { 1., 1., 1. };
+
+ if( MeasureUnit::TWIP == nTargetUnit )
+ {
+ switch( rString[nPos] )
+ {
+ case u'c':
+ case u'C':
+ aCmpsL[0] = "cm";
+ aCmpsU[0] = "CM";
+ aScales[0] = (72.*20.)/2.54; // twip
+ break;
+ case u'i':
+ case u'I':
+ aCmpsL[0] = "in";
+ aCmpsU[0] = "IN";
+ aScales[0] = 72.*20.; // twip
+ break;
+ case u'm':
+ case u'M':
+ aCmpsL[0] = "mm";
+ aCmpsU[0] = "MM";
+ aScales[0] = (72.*20.)/25.4; // twip
+ break;
+ case u'p':
+ case u'P':
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = 20.; // twip
+
+ aCmpsL[1] = "pc";
+ aCmpsU[1] = "PC";
+ aScales[1] = 12.*20.; // twip
+ break;
+ }
+ }
+ else if( MeasureUnit::MM_100TH == nTargetUnit || MeasureUnit::MM_10TH == nTargetUnit )
+ {
+ double nScaleFactor = (MeasureUnit::MM_100TH == nTargetUnit) ? 100.0 : 10.0;
+ switch( rString[nPos] )
+ {
+ case u'c':
+ case u'C':
+ aCmpsL[0] = "cm";
+ aCmpsU[0] = "CM";
+ aScales[0] = 10.0 * nScaleFactor; // mm/100
+ break;
+ case u'i':
+ case u'I':
+ aCmpsL[0] = "in";
+ aCmpsU[0] = "IN";
+ aScales[0] = 1000.*2.54; // mm/100
+ break;
+ case u'm':
+ case u'M':
+ aCmpsL[0] = "mm";
+ aCmpsU[0] = "MM";
+ aScales[0] = 1.0 * nScaleFactor; // mm/100
+ break;
+ case u'p':
+ case u'P':
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = (10.0 * nScaleFactor*2.54)/72.; // mm/100
+
+ aCmpsL[1] = "pc";
+ aCmpsU[1] = "PC";
+ aScales[1] = (10.0 * nScaleFactor*2.54)/12.; // mm/100
+
+ aCmpsL[2] = "px";
+ aCmpsU[2] = "PX";
+ aScales[2] = 0.28 * nScaleFactor; // mm/100
+ break;
+ }
+ }
+ else if( MeasureUnit::POINT == nTargetUnit )
+ {
+ if( rString[nPos] == 'p' || rString[nPos] == 'P' )
+ {
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = 1;
+ }
+ }
+
+ if( aCmpsL[0] == nullptr )
+ return false;
+
+ double nScale = 0.;
+ for( sal_uInt16 i= 0; i < 3; i++ )
+ {
+ sal_Int32 nTmp = nPos; // come back to the initial position before each iteration
+ const char *pL = aCmpsL[i];
+ if( pL )
+ {
+ const char *pU = aCmpsU[i];
+ while( nTmp < nLen && *pL )
+ {
+ sal_Unicode c = rString[nTmp];
+ if( c != *pL && c != *pU )
+ break;
+ pL++;
+ pU++;
+ nTmp++;
+ }
+ if( !*pL && (nTmp == nLen || ' ' == rString[nTmp]) )
+ {
+ nScale = aScales[i];
+ break;
+ }
+ }
+ }
+
+ if( 0. == nScale )
+ return false;
+
+ // TODO: check overflow
+ if( nScale != 1. )
+ nVal *= nScale;
+ }
+ }
+
+ nVal += .5;
+ if( bNeg )
+ nVal = -nVal;
+
+ if( nVal <= static_cast<double>(nMin) )
+ rValue = nMin;
+ else if( nVal >= static_cast<double>(nMax) )
+ rValue = nMax;
+ else
+ rValue = static_cast<sal_Int32>(nVal);
+
+ return true;
+}
+
/** convert measure in given unit to string with given unit */
void Converter::convertMeasure( OUStringBuffer& rBuffer,
sal_Int32 nMeasure,
@@ -431,6 +644,14 @@ bool Converter::convertBool( bool& rBool, std::u16string_view rString )
return rBool || (rString == u"false");
}
+/** convert string to boolean */
+bool Converter::convertBool( bool& rBool, std::string_view rString )
+{
+ rBool = rString == "true";
+
+ return rBool || (rString == "false");
+}
+
/** convert boolean to string */
void Converter::convertBool( OUStringBuffer& rBuffer, bool bValue )
{
@@ -443,6 +664,12 @@ bool Converter::convertPercent( sal_Int32& rPercent, std::u16string_view rString
return convertMeasure( rPercent, rString, MeasureUnit::PERCENT );
}
+/** convert string to percent */
+bool Converter::convertPercent( sal_Int32& rPercent, std::string_view rString )
+{
+ return convertMeasure( rPercent, rString, MeasureUnit::PERCENT );
+}
+
/** convert percent to string */
void Converter::convertPercent( OUStringBuffer& rBuffer, sal_Int32 nValue )
{
@@ -456,6 +683,12 @@ bool Converter::convertMeasurePx( sal_Int32& rPixel, std::u16string_view rString
return convertMeasure( rPixel, rString, MeasureUnit::PIXEL );
}
+/** convert string to pixel measure */
+bool Converter::convertMeasurePx( sal_Int32& rPixel, std::string_view rString )
+{
+ return convertMeasure( rPixel, rString, MeasureUnit::PIXEL );
+}
+
/** convert pixel measure to string */
void Converter::convertMeasurePx( OUStringBuffer& rBuffer, sal_Int32 nValue )
{
@@ -493,6 +726,23 @@ bool Converter::convertColor( sal_Int32& rColor, std::u16string_view rValue )
return true;
}
+/** convert string to rgb color */
+bool Converter::convertColor( sal_Int32& rColor, std::string_view rValue )
+{
+ if( rValue.size() != 7 || rValue[0] != '#' )
+ return false;
+
+ rColor = lcl_gethex( rValue[1] ) * 16 + lcl_gethex( rValue[2] );
+ rColor <<= 8;
+
+ rColor |= ( lcl_gethex( rValue[3] ) * 16 + lcl_gethex( rValue[4] ) );
+ rColor <<= 8;
+
+ rColor |= ( lcl_gethex( rValue[5] ) * 16 + lcl_gethex( rValue[6] ) );
+
+ return true;
+}
+
const char aHexTab[] = "0123456789abcdef";
/** convert color to string */
@@ -526,6 +776,19 @@ bool Converter::convertNumber( sal_Int32& rValue,
return bRet;
}
+/** convert string to number with optional min and max values */
+bool Converter::convertNumber( sal_Int32& rValue,
+ std::string_view aString,
+ sal_Int32 nMin, sal_Int32 nMax )
+{
+ rValue = 0;
+ sal_Int64 nNumber = 0;
+ bool bRet = convertNumber64(nNumber,aString,nMin,nMax);
+ if ( bRet )
+ rValue = static_cast<sal_Int32>(nNumber);
+ return bRet;
+}
+
/** convert string to 64-bit number with optional min and max values */
bool Converter::convertNumber64( sal_Int64& rValue,
std::u16string_view aString,
@@ -563,6 +826,43 @@ bool Converter::convertNumber64( sal_Int64& rValue,
return ( nPos == nLen && rValue >= nMin && rValue <= nMax );
}
+/** convert string to 64-bit number with optional min and max values */
+bool Converter::convertNumber64( sal_Int64& rValue,
+ std::string_view aString,
+ sal_Int64 nMin, sal_Int64 nMax )
+{
+ sal_Int32 nPos = 0;
+ sal_Int32 const nLen = aString.size();
+
+ // skip white space
+ while( (nPos < nLen) && (aString[nPos] <= ' ') )
+ nPos++;
+
+ sal_Int32 nNumberStartPos = nPos;
+
+ if( nPos < nLen && '-' == aString[nPos] )
+ {
+ nPos++;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ '0' <= aString[nPos] &&
+ '9' >= aString[nPos] )
+ {
+ nPos++;
+ }
+
+ rValue = rtl_str_toInt64_WithLength(aString.data() + nNumberStartPos, 10, nPos - nNumberStartPos);
+
+ if( rValue < nMin )
+ rValue = nMin;
+ else if( rValue > nMax )
+ rValue = nMax;
+
+ return ( nPos == nLen && rValue >= nMin && rValue <= nMax );
+}
+
/** convert double number to string (using ::rtl::math) */
void Converter::convertDouble( OUStringBuffer& rBuffer,
double fNumber,
@@ -623,6 +923,14 @@ bool Converter::convertDouble(double& rValue, std::u16string_view rString)
return ( eStatus == rtl_math_ConversionStatus_Ok );
}
+/** convert string to double number (using ::rtl::math) */
+bool Converter::convertDouble(double& rValue, std::string_view rString)
+{
+ rtl_math_ConversionStatus eStatus;
+ rValue = ::rtl::math::stringToDouble( rString, '.', ',', &eStatus );
+ return ( eStatus == rtl_math_ConversionStatus_Ok );
+}
+
/** convert number, 10th of degrees with range [0..3600] to SVG angle */
void Converter::convertAngle(OUStringBuffer& rBuffer, sal_Int16 const nAngle,
SvtSaveOptions::ODFSaneDefaultVersion const nVersion)
@@ -690,6 +998,56 @@ bool Converter::convertAngle(sal_Int16& rAngle, std::u16string_view rString,
return bRet;
}
+/** convert SVG angle to number, 10th of degrees with range [0..3600] */
+bool Converter::convertAngle(sal_Int16& rAngle, std::string_view rString,
+ bool const isWrongOOo10thDegAngle)
+{
+ // ODF 1.1 leaves it undefined what the number means, but ODF 1.2 says it's
+ // degrees, while OOo has historically used 10th of degrees :(
+ // So import degrees when we see the "deg" suffix but continue with 10th of
+ // degrees for now for the sake of existing OOo/LO documents, until the
+ // new versions that can read "deg" suffix are widely deployed and we can
+ // start to write the "deg" suffix.
+ sal_Int32 nValue(0);
+ double fValue(0.0);
+ bool bRet = ::sax::Converter::convertDouble(fValue, rString);
+ if (std::string_view::npos != rString.find("deg"))
+ {
+ nValue = fValue * 10.0;
+ }
+ else if (std::string_view::npos != rString.find("grad"))
+ {
+ nValue = (fValue * 9.0 / 10.0) * 10.0;
+ }
+ else if (std::string_view::npos != rString.find("rad"))
+ {
+ nValue = basegfx::rad2deg(fValue) * 10.0;
+ }
+ else // no explicit unit
+ {
+ if (isWrongOOo10thDegAngle)
+ {
+ nValue = fValue; // wrong, but backward compatible with OOo/LO < 7.0
+ }
+ else
+ {
+ nValue = fValue * 10.0; // ODF 1.2
+ }
+ }
+ // limit to valid range [0..3600]
+ nValue = nValue % 3600;
+ if (nValue < 0)
+ {
+ nValue += 3600;
+ }
+ assert(0 <= nValue && nValue <= 3600);
+ if (bRet)
+ {
+ rAngle = sal::static_int_cast<sal_Int16>(nValue);
+ }
+ return bRet;
+}
+
/** convert double to ISO "duration" string; negative durations allowed */
void Converter::convertDuration(OUStringBuffer& rBuffer,
const double fTime)
@@ -2342,6 +2700,90 @@ sal_Int16 Converter::GetUnitFromString(std::u16string_view rString, sal_Int16 nD
return nRetUnit;
}
+sal_Int16 Converter::GetUnitFromString(std::string_view rString, sal_Int16 nDefaultUnit)
+{
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rString.size();
+ sal_Int16 nRetUnit = nDefaultUnit;
+
+ // skip white space
+ while( nPos < nLen && ' ' == rString[nPos] )
+ nPos++;
+
+ // skip negative
+ if( nPos < nLen && '-' == rString[nPos] )
+ nPos++;
+
+ // skip number
+ while( nPos < nLen && '0' <= rString[nPos] && '9' >= rString[nPos] )
+ nPos++;
+
+ if( nPos < nLen && '.' == rString[nPos] )
+ {
+ nPos++;
+ while( nPos < nLen && '0' <= rString[nPos] && '9' >= rString[nPos] )
+ nPos++;
+ }
+
+ // skip white space
+ while( nPos < nLen && ' ' == rString[nPos] )
+ nPos++;
+
+ if( nPos < nLen )
+ {
+ switch(rString[nPos])
+ {
+ case u'%' :
+ {
+ nRetUnit = MeasureUnit::PERCENT;
+ break;
+ }
+ case u'c':
+ case u'C':
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == 'm'
+ || rString[nPos+1] == 'M'))
+ nRetUnit = MeasureUnit::CM;
+ break;
+ }
+ case u'e':
+ case u'E':
+ {
+ // CSS1_EMS or CSS1_EMX later
+ break;
+ }
+ case u'i':
+ case u'I':
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == 'n'
+ || rString[nPos+1] == 'N'))
+ nRetUnit = MeasureUnit::INCH;
+ break;
+ }
+ case u'm':
+ case u'M':
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == 'm'
+ || rString[nPos+1] == 'M'))
+ nRetUnit = MeasureUnit::MM;
+ break;
+ }
+ case u'p':
+ case u'P':
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == 't'
+ || rString[nPos+1] == 'T'))
+ nRetUnit = MeasureUnit::POINT;
+ if(nPos+1 < nLen && (rString[nPos+1] == 'c'
+ || rString[nPos+1] == 'C'))
+ nRetUnit = MeasureUnit::TWIP;
+ break;
+ }
+ }
+ }
+
+ return nRetUnit;
+}
bool Converter::convertAny(OUStringBuffer& rsValue,
OUStringBuffer& rsType ,
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index d2d00b35df44..80bf77187c0a 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -193,15 +193,15 @@ void ScXMLChangeTrackingImportHelper::StartChangeAction(const ScChangeActionType
}
}
-sal_uInt32 ScXMLChangeTrackingImportHelper::GetIDFromString(const OUString& sID)
+sal_uInt32 ScXMLChangeTrackingImportHelper::GetIDFromString(std::string_view sID)
{
sal_uInt32 nResult(0);
- if (!sID.isEmpty())
+ if (!sID.empty())
{
- if (sID.startsWith(SC_CHANGE_ID_PREFIX))
+ if (sID.substr(0, strlen(SC_CHANGE_ID_PREFIX)) == SC_CHANGE_ID_PREFIX)
{
sal_Int32 nValue;
- ::sax::Converter::convertNumber(nValue, std::u16string_view(sID).substr(strlen(SC_CHANGE_ID_PREFIX)));
+ ::sax::Converter::convertNumber(nValue, sID.substr(strlen(SC_CHANGE_ID_PREFIX)));
OSL_ENSURE(nValue > 0, "wrong change action ID");
nResult = nValue;
}
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
index 4c318df17919..36529dfa47b0 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
@@ -187,7 +187,7 @@ public:
void SetProtection(const css::uno::Sequence<sal_Int8>& rProtect) { aProtect = rProtect; }
void StartChangeAction(const ScChangeActionType nActionType);
- static sal_uInt32 GetIDFromString(const OUString& sID);
+ static sal_uInt32 GetIDFromString(std::string_view sID);
void SetActionNumber(const sal_uInt32 nActionNumber) { pCurrentAction->nActionNumber = nActionNumber; }
void SetActionState(const ScChangeActionState nActionState) { pCurrentAction->nActionState = nActionState; }
diff --git a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx
index 3d2fc8c9ec72..62d3a217bbce 100644
--- a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx
+++ b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx
@@ -56,7 +56,7 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport,
for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
{
if( aIter.getToken() == XML_ELEMENT(STYLE, XML_DISPLAY) )
- bDisplay = IsXMLToken(aIter.toString(), XML_TRUE);
+ bDisplay = IsXMLToken(aIter, XML_TRUE);
else
XMLOFF_WARN_UNKNOWN("sc", aIter);
}
diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
index 443f23d611d2..966204506256 100644
--- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
+++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
@@ -97,8 +97,6 @@ void XMLTableShapeImportHelper::finishShape(
SdrLayerID nLayerID = SDRLAYER_NOTFOUND;
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- const OUString sValue = aIter.toString();
-
switch(aIter.getToken())
{
case XML_ELEMENT(TABLE, XML_END_CELL_ADDRESS):
@@ -106,7 +104,7 @@ void XMLTableShapeImportHelper::finishShape(
sal_Int32 nOffset(0);
ScDocument* pDoc = static_cast<ScXMLImport&>(mrImporter).GetDocument();
assert(pDoc);
- ScRangeStringConverter::GetAddressFromString(aAnchor.maEnd, sValue, *pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset);
+ ScRangeStringConverter::GetAddressFromString(aAnchor.maEnd, aIter.toString(), *pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset);
// When the cell end address is set, we let the shape resize with the cell
aAnchor.mbResizeWithCell = true;
break;
@@ -115,7 +113,7 @@ void XMLTableShapeImportHelper::finishShape(
{
static_cast<ScXMLImport&>(mrImporter).
GetMM100UnitConverter().convertMeasureToCore(
- nEndX, sValue);
+ nEndX, aIter.toView());
aAnchor.maEndOffset.setX( nEndX );
break;
}
@@ -123,16 +121,16 @@ void XMLTableShapeImportHelper::finishShape(
{
static_cast<ScXMLImport&>(mrImporter).
GetMM100UnitConverter().convertMeasureToCore(
- nEndY, sValue);
+ nEndY, aIter.toView());
aAnchor.maEndOffset.setY( nEndY );
break;
}
case XML_ELEMENT(TABLE, XML_TABLE_BACKGROUND):
- if (IsXMLToken(sValue, XML_TRUE))
+ if (IsXMLToken(aIter, XML_TRUE))
nLayerID = SC_LAYER_BACK;
break;
case XML_ELEMENT(DRAW, XML_NOTIFY_ON_UPDATE_OF_RANGES):
- xRangeList = sValue;
+ xRangeList = aIter.toString();
break;
default: ;
}
@@ -216,7 +214,7 @@ void XMLTableShapeImportHelper::finishShape(
{
if (aIter.getToken() == XML_ELEMENT(TABLE, XML_TABLE_BACKGROUND))
{
- if (IsXMLToken(aIter.toString(), XML_TRUE))
+ if (IsXMLToken(aIter, XML_TRUE))
nLayerID = SC_LAYER_BACK;
break;
}
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index d8292c5feecd..3f8870ea32c2 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -522,7 +522,7 @@ ScXMLCellContentDeletionContext::ScXMLCellContentDeletionContext( ScXMLImport&
{
auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_ID ) ) );
if (aIter != rAttrList->end())
- nID = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nID = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
}
}
@@ -568,7 +568,7 @@ ScXMLDependenceContext::ScXMLDependenceContext( ScXMLImport& rImport,
{
auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_ID ) ) );
if (aIter != rAttrList->end())
- nID = ScXMLChangeTrackingImportHelper::GetIDFromString(aIter.toString());
+ nID = ScXMLChangeTrackingImportHelper::GetIDFromString(aIter.toView());
}
pChangeTrackingImportHelper->AddDependence(nID);
}
@@ -608,7 +608,7 @@ ScXMLChangeDeletionContext::ScXMLChangeDeletionContext( ScXMLImport& rImport,
{
auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_ID ) ) );
if (aIter != rAttrList->end())
- nID = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nID = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
}
pChangeTrackingImportHelper->AddDeleted(nID);
}
@@ -907,7 +907,7 @@ ScXMLPreviousContext::ScXMLPreviousContext( ScXMLImport& rImport,
{
auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_ID ) ) );
if (aIter != rAttrList->end())
- nID = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nID = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
}
}
@@ -948,7 +948,7 @@ ScXMLContentChangeContext::ScXMLContentChangeContext( ScXMLImport& rImport,
switch (aIter.getToken())
{
case XML_ELEMENT( TABLE, XML_ID ):
- nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
case XML_ELEMENT( TABLE, XML_ACCEPTANCE_STATE ):
if (IsXMLToken( aIter, XML_ACCEPTED ))
@@ -957,7 +957,7 @@ ScXMLContentChangeContext::ScXMLContentChangeContext( ScXMLImport& rImport,
nActionState = SC_CAS_REJECTED;
break;
case XML_ELEMENT( TABLE, XML_REJECTING_CHANGE_ID ):
- nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
}
}
}
@@ -1024,7 +1024,7 @@ ScXMLInsertionContext::ScXMLInsertionContext( ScXMLImport& rImport,
switch (aIter.getToken())
{
case XML_ELEMENT( TABLE, XML_ID ):
- nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
case XML_ELEMENT( TABLE, XML_ACCEPTANCE_STATE ):
if (IsXMLToken( aIter, XML_ACCEPTED ))
@@ -1033,7 +1033,7 @@ ScXMLInsertionContext::ScXMLInsertionContext( ScXMLImport& rImport,
nActionState = SC_CAS_REJECTED;
break;
case XML_ELEMENT( TABLE, XML_REJECTING_CHANGE_ID ):
- nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
case XML_ELEMENT( TABLE, XML_TYPE ):
if (IsXMLToken( aIter, XML_ROW ))
@@ -1098,15 +1098,13 @@ ScXMLInsertionCutOffContext::ScXMLInsertionCutOffContext( ScXMLImport& rImport,
sal_Int32 nPosition(0);
for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
- const OUString sValue = aIter.toString();
-
switch (aIter.getToken())
{
case XML_ELEMENT(TABLE, XML_ID):
- nID = ScXMLChangeTrackingImportHelper::GetIDFromString(sValue);
+ nID = ScXMLChangeTrackingImportHelper::GetIDFromString(aIter.toView());
break;
case XML_ELEMENT(TABLE, XML_POSITION):
- ::sax::Converter::convertNumber(nPosition, sValue);
+ ::sax::Converter::convertNumber(nPosition, aIter.toView());
break;
}
}
@@ -1126,22 +1124,20 @@ ScXMLMovementCutOffContext::ScXMLMovementCutOffContext( ScXMLImport& rImport,
bool bPosition(false);
for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
- const OUString sValue = aIter.toString();
-
switch (aIter.getToken())
{
case XML_ELEMENT(TABLE, XML_ID):
- nID = ScXMLChangeTrackingImportHelper::GetIDFromString(sValue);
+ nID = ScXMLChangeTrackingImportHelper::GetIDFromString(aIter.toView());
break;
case XML_ELEMENT(TABLE, XML_POSITION):
bPosition = true;
- ::sax::Converter::convertNumber(nPosition, sValue);
+ ::sax::Converter::convertNumber(nPosition, aIter.toView());
break;
case XML_ELEMENT(TABLE, XML_START_POSITION):
- ::sax::Converter::convertNumber(nStartPosition, sValue);
+ ::sax::Converter::convertNumber(nStartPosition, aIter.toView());
break;
case XML_ELEMENT(TABLE, XML_END_POSITION):
- ::sax::Converter::convertNumber(nEndPosition, sValue);
+ ::sax::Converter::convertNumber(nEndPosition, aIter.toView());
break;
}
}
@@ -1193,7 +1189,7 @@ ScXMLDeletionContext::ScXMLDeletionContext( ScXMLImport& rImport,
switch (nToken)
{
case XML_ELEMENT( TABLE, XML_ID ):
- nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
case XML_ELEMENT( TABLE, XML_ACCEPTANCE_STATE ):
if (IsXMLToken( aIter, XML_ACCEPTED ))
@@ -1202,7 +1198,7 @@ ScXMLDeletionContext::ScXMLDeletionContext( ScXMLImport& rImport,
nActionState = SC_CAS_REJECTED;
break;
case XML_ELEMENT( TABLE, XML_REJECTING_CHANGE_ID ):
- nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
case XML_ELEMENT( TABLE, XML_TYPE ):
if (IsXMLToken( aIter, XML_ROW ))
@@ -1279,7 +1275,7 @@ ScXMLMovementContext::ScXMLMovementContext( ScXMLImport& rImport,
switch (aIter.getToken())
{
case XML_ELEMENT( TABLE, XML_ID ):
- nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
case XML_ELEMENT( TABLE, XML_ACCEPTANCE_STATE ):
if (IsXMLToken( aIter, XML_ACCEPTED ))
@@ -1288,7 +1284,7 @@ ScXMLMovementContext::ScXMLMovementContext( ScXMLImport& rImport,
nActionState = SC_CAS_REJECTED;
break;
case XML_ELEMENT( TABLE, XML_REJECTING_CHANGE_ID ):
- nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
}
}
@@ -1352,7 +1348,7 @@ ScXMLRejectionContext::ScXMLRejectionContext( ScXMLImport& rImport,
switch (aIter.getToken())
{
case XML_ELEMENT( TABLE, XML_ID ):
- nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nActionNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
case XML_ELEMENT( TABLE, XML_ACCEPTANCE_STATE ):
if (IsXMLToken( aIter, XML_ACCEPTED ))
@@ -1361,7 +1357,7 @@ ScXMLRejectionContext::ScXMLRejectionContext( ScXMLImport& rImport,
nActionState = SC_CAS_REJECTED;
break;
case XML_ELEMENT( TABLE, XML_REJECTING_CHANGE_ID ):
- nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toString() );
+ nRejectingNumber = ScXMLChangeTrackingImportHelper::GetIDFromString( aIter.toView() );
break;
}
}
diff --git a/sc/source/filter/xml/xmlannoi.cxx b/sc/source/filter/xml/xmlannoi.cxx
index 143d60a414c1..5ce2980fbeaf 100644
--- a/sc/source/filter/xml/xmlannoi.cxx
+++ b/sc/source/filter/xml/xmlannoi.cxx
@@ -58,28 +58,26 @@ ScXMLAnnotationContext::ScXMLAnnotationContext( ScXMLImport& rImport,
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- const OUString sValue = aIter.toString();
-
switch( aIter.getToken() )
{
case XML_ELEMENT(OFFICE, XML_AUTHOR):
{
- maAuthorBuffer = sValue;
+ maAuthorBuffer = aIter.toString();
}
break;
case XML_ELEMENT(OFFICE, XML_CREATE_DATE):
{
- maCreateDateBuffer = sValue;
+ maCreateDateBuffer = aIter.toString();
}
break;
case XML_ELEMENT(OFFICE, XML_CREATE_DATE_STRING):
{
- maCreateDateStringBuffer = sValue;
+ maCreateDateStringBuffer = aIter.toString();
}
break;
case XML_ELEMENT(OFFICE, XML_DISPLAY):
{
- mrAnnotationData.mbShown = IsXMLToken(sValue, XML_TRUE);
+ mrAnnotationData.mbShown = IsXMLToken(aIter, XML_TRUE);
}
break;
case XML_ELEMENT(SVG, XML_X):
@@ -95,7 +93,7 @@ ScXMLAnnotationContext::ScXMLAnnotationContext( ScXMLImport& rImport,
}
break;
default:
- SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
}
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index e68184660850..04c4bc6b8837 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -565,18 +565,19 @@ void SmXMLContext_Helper::RetrieveAttrs(
bool bMvFound = false;
for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sValue = aIter.toString();
// sometimes they have namespace, sometimes not?
switch (aIter.getToken() & TOKEN_MASK)
{
case XML_FONTWEIGHT:
- nIsBold = sal_Int8(sValue == GetXMLToken(XML_BOLD));
+ nIsBold = sal_Int8(IsXMLToken(aIter, XML_BOLD));
break;
case XML_FONTSTYLE:
- nIsItalic = sal_Int8(sValue == GetXMLToken(XML_ITALIC));
+ nIsItalic = sal_Int8(IsXMLToken(aIter, XML_ITALIC));
break;
case XML_FONTSIZE:
case XML_MATHSIZE:
+ {
+ OUString sValue = aIter.toString();
::sax::Converter::convertDouble(nFontSize, sValue);
rContext.GetSmImport().GetMM100UnitConverter().SetXMLMeasureUnit(
util::MeasureUnit::POINT);
@@ -591,14 +592,15 @@ void SmXMLContext_Helper::RetrieveAttrs(
}
}
break;
+ }
case XML_FONTFAMILY:
- sFontFamily = sValue;
+ sFontFamily = aIter.toString();
break;
case XML_COLOR:
- sColor = sValue;
+ sColor = aIter.toString();
break;
case XML_MATHCOLOR:
- sColor = sValue;
+ sColor = aIter.toString();
break;
case XML_MATHVARIANT:
bMvFound = true;
@@ -1053,18 +1055,17 @@ void SmXMLFencedContext_Impl::startFastElement(
{
for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sValue = aIter.toString();
switch (aIter.getToken())
{
//temp, starmath cannot handle multichar brackets (I think)
case XML_OPEN:
- cBegin = sValue[0];
+ cBegin = aIter.toString()[0];
break;
case XML_CLOSE:
- cEnd = sValue[0];
+ cEnd = aIter.toString()[0];
break;
case XML_STRETCHY:
- bIsStretchy = sValue == GetXMLToken(XML_TRUE);
+ bIsStretchy = IsXMLToken(aIter, XML_TRUE);
break;
default:
XMLOFF_WARN_UNKNOWN("starmath", aIter);
@@ -1210,12 +1211,11 @@ void SmXMLAnnotationContext_Impl::startFastElement(
{
for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sValue = aIter.toString();
// sometimes they have namespace, sometimes not?
switch (aIter.getToken() & TOKEN_MASK)
{
case XML_ENCODING:
- bIsStarMath = sValue == "StarMath 5.0";
+ bIsStarMath = aIter.toView() == "StarMath 5.0";
break;
default:
XMLOFF_WARN_UNKNOWN("starmath", aIter);
@@ -1441,19 +1441,18 @@ void SmXMLOperatorContext_Impl::startFastElement(
for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sValue = aIter.toString();
switch (aIter.getToken())
{
case XML_STRETCHY:
- bIsStretchy = sValue == GetXMLToken(XML_TRUE);
+ bIsStretchy = IsXMLToken(aIter, XML_TRUE);
break;
case XML_FENCE:
- bIsFenced = sValue == GetXMLToken(XML_TRUE);
+ bIsFenced = IsXMLToken(aIter, XML_TRUE);
break;
case XML_FORM:
- isPrefix = sValue == GetXMLToken(XML_PREFIX); // <
- isInfix = sValue == GetXMLToken(XML_INFIX); // |
- isPostfix = sValue == GetXMLToken(XML_POSTFIX); // >
+ isPrefix = IsXMLToken(aIter, XML_PREFIX); // <
+ isInfix = IsXMLToken(aIter, XML_INFIX); // |
+ isPostfix = IsXMLToken(aIter, XML_POSTFIX); // >
break;
default:
XMLOFF_WARN_UNKNOWN("starmath", aIter);
@@ -2494,12 +2493,11 @@ void SmXMLActionContext_Impl::startFastElement(
{
for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sValue = aIter.toString();
switch (aIter.getToken())
{
case XML_SELECTION:
{
- sal_uInt32 n = sValue.toUInt32();
+ sal_Int32 n = aIter.toInt32();
if (n > 0)
mnSelection = static_cast<size_t>(n);
}
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index be694b483d00..263fe55c188c 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -397,7 +397,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
case XML_ELEMENT(OFFICE, XML_VALUE):
{
double fTmp;
- if (::sax::Converter::convertDouble(fTmp, aIter.toString()))
+ if (::sax::Converter::convertDouble(fTmp, aIter.toView()))
{
m_fValue = fTmp;
m_bHasValue = true;
@@ -506,7 +506,7 @@ css::uno::Reference<css::xml::sax::XFastContextHandler> SwXMLTableCellContext_Im
{
if( aIter.getToken() == XML_ELEMENT(TABLE, XML_IS_SUB_TABLE) )
{
- if ( IsXMLToken( aIter.toString(), XML_TRUE ) )
+ if ( IsXMLToken( aIter, XML_TRUE ) )
bSubTable = true;
}
else
@@ -925,25 +925,24 @@ void SwXMLDDETableContext_Impl::startFastElement(
{
for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
{
- OUString aValue = aIter.toString();
switch (aIter.getToken())
{
case XML_ELEMENT(OFFICE, XML_DDE_APPLICATION):
- sDDEApplication = aValue;
+ sDDEApplication = aIter.toString();
break;
case XML_ELEMENT(OFFICE, XML_DDE_TOPIC):
- sDDETopic = aValue;
+ sDDETopic = aIter.toString();
break;
case XML_ELEMENT(OFFICE, XML_DDE_ITEM):
- sDDEItem = aValue;
+ sDDEItem = aIter.toString();
break;
case XML_ELEMENT(OFFICE, XML_NAME):
- sConnectionName = aValue;
+ sConnectionName = aIter.toString();
break;
case XML_ELEMENT(OFFICE, XML_AUTOMATIC_UPDATE):
{
bool bTmp(false);
- if (::sax::Converter::convertBool(bTmp, aValue))
+ if (::sax::Converter::convertBool(bTmp, aIter.toView()))
{
bIsAutomaticUpdate = bTmp;
}
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx
index 17ba48af5c9e..dd6c1fd62596 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -235,30 +235,29 @@ void SchXMLAxisContext::startFastElement( sal_Int32 /*nElement*/,
// parse attributes
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString aValue = aIter.toString();
switch(aIter.getToken())
{
case XML_ELEMENT(CHART, XML_DIMENSION):
{
SchXMLAxisDimension nEnumVal;
- if( SvXMLUnitConverter::convertEnum( nEnumVal, aValue, aXMLAxisDimensionMap ))
+ if( SvXMLUnitConverter::convertEnum( nEnumVal, aIter.toString(), aXMLAxisDimensionMap ))
m_aCurrentAxis.eDimension = nEnumVal;
}
break;
case XML_ELEMENT(CHART, XML_NAME):
- m_aCurrentAxis.aName = aValue;
+ m_aCurrentAxis.aName = aIter.toString();
break;
case XML_ELEMENT(CHART, XML_AXIS_TYPE):
case XML_ELEMENT(CHART_EXT, XML_AXIS_TYPE):
sal_uInt16 nEnumVal;
- if( SvXMLUnitConverter::convertEnum( nEnumVal, aValue, aXMLAxisTypeMap ))
+ if( SvXMLUnitConverter::convertEnum( nEnumVal, aIter.toString(), aXMLAxisTypeMap ))
{
m_nAxisType = nEnumVal;
m_bAxisTypeImported = true;
}
break;
case XML_ELEMENT(CHART, XML_STYLE_NAME):
- m_aAutoStyleName = aValue;
+ m_aAutoStyleName = aIter.toString();
break;
default:
XMLOFF_WARN_UNKNOWN("xmloff", aIter);
@@ -611,7 +610,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLAxisContext::cre
switch (aIter.getToken())
{
case XML_ELEMENT(CHART, XML_CLASS):
- if( IsXMLToken( aIter.toString(), XML_MINOR ) )
+ if( IsXMLToken( aIter, XML_MINOR ) )
bIsMajor = false;
break;
case XML_ELEMENT(CHART, XML_STYLE_NAME):
@@ -819,7 +818,7 @@ DateScaleContext::DateScaleContext(
namespace
{
-sal_Int32 lcl_getTimeUnit( const OUString& rValue )
+sal_Int32 lcl_getTimeUnit( const sax_fastparser::FastAttributeList::FastAttributeIter& rValue )
{
sal_Int32 nTimeUnit = css::chart::TimeUnit::DAY;
if( IsXMLToken( rValue, XML_DAYS ) )
@@ -846,12 +845,11 @@ void DateScaleContext::startFastElement( sal_Int32 /*nElement*/,
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString aValue = aIter.toString();
switch( aIter.getToken() )
{
case XML_ELEMENT(CHART, XML_BASE_TIME_UNIT):
{
- aIncrement.TimeResolution <<= lcl_getTimeUnit(aValue);
+ aIncrement.TimeResolution <<= lcl_getTimeUnit(aIter);
bSetNewIncrement = true;
}
break;
@@ -859,7 +857,7 @@ void DateScaleContext::startFastElement( sal_Int32 /*nElement*/,
{
chart::TimeInterval aInterval(1,0);
aIncrement.MajorTimeInterval >>= aInterval;
- ::sax::Converter::convertNumber( aInterval.Number, aValue );
+ ::sax::Converter::convertNumber( aInterval.Number, aIter.toView() );
aIncrement.MajorTimeInterval <<= aInterval;
bSetNewIncrement = true;
}
@@ -868,7 +866,7 @@ void DateScaleContext::startFastElement( sal_Int32 /*nElement*/,
{
chart::TimeInterval aInterval(1,0);
aIncrement.MajorTimeInterval >>= aInterval;
- aInterval.TimeUnit = lcl_getTimeUnit(aValue);
+ aInterval.TimeUnit = lcl_getTimeUnit(aIter);
aIncrement.MajorTimeInterval <<= aInterval;
bSetNewIncrement = true;
}
@@ -877,7 +875,7 @@ void DateScaleContext::startFastElement( sal_Int32 /*nElement*/,
{
chart::TimeInterval aInterval(1,0);
aIncrement.MinorTimeInterval >>= aInterval;
- ::sax::Converter::convertNumber( aInterval.Number, aValue );
+ ::sax::Converter::convertNumber( aInterval.Number, aIter.toView() );
aIncrement.MinorTimeInterval <<= aInterval;
bSetNewIncrement = true;
}
@@ -886,7 +884,7 @@ void DateScaleContext::startFastElement( sal_Int32 /*nElement*/,
{
chart::TimeInterval aInterval(1,0);
aIncrement.MinorTimeInterval >>= aInterval;
- aInterval.TimeUnit = lcl_getTimeUnit(aValue);
+ aInterval.TimeUnit = lcl_getTimeUnit(aIter);
aIncrement.MinorTimeInterval <<= aInterval;
bSetNewIncrement = true;
}
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 8b4f79582138..9c97c64a5a29 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -319,17 +319,17 @@ void SchXMLChartContext::startFastElement( sal_Int32 /*nElement*/,
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString aValue = aIter.toString();
switch( aIter.getToken() )
{
case XML_ELEMENT(LO_EXT, XML_DATA_PILOT_SOURCE):
- msDataPilotSource = aValue;
+ msDataPilotSource = aIter.toString();
break;
case XML_ELEMENT(XLINK, XML_HREF):
- m_aXLinkHRefAttributeToIndicateDataProvider = aValue;
+ m_aXLinkHRefAttributeToIndicateDataProvider = aIter.toString();
break;
case XML_ELEMENT(CHART, XML_CLASS):
{
+ OUString aValue = aIter.toString();
OUString sClassName;
sal_uInt16 nClassPrefix =
GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
@@ -365,24 +365,24 @@ void SchXMLChartContext::startFastElement( sal_Int32 /*nElement*/,
case XML_ELEMENT(SVG, XML_WIDTH):
case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
- maChartSize.Width, aValue );
+ maChartSize.Width, aIter.toView() );
break;
case XML_ELEMENT(SVG, XML_HEIGHT):
case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
- maChartSize.Height, aValue );
+ maChartSize.Height, aIter.toView() );
break;
case XML_ELEMENT(CHART, XML_STYLE_NAME):
- sAutoStyleName = aValue;
+ sAutoStyleName = aIter.toString();
break;
case XML_ELEMENT(CHART, XML_COLUMN_MAPPING):
- msColTrans = aValue;
+ msColTrans = aIter.toString();
break;
case XML_ELEMENT(CHART, XML_ROW_MAPPING):
- msRowTrans = aValue;
+ msRowTrans = aIter.toString();
break;
default:
XMLOFF_WARN_UNKNOWN("xmloff", aIter);
@@ -1176,14 +1176,13 @@ void SchXMLTitleContext::startFastElement( sal_Int32 /*nElement*/,
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString aValue = aIter.toString();
switch (aIter.getToken())
{
case XML_ELEMENT(SVG, XML_X):
case XML_ELEMENT(SVG_COMPAT, XML_X):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
- aPosition.X, aValue );
+ aPosition.X, aIter.toView() );
bHasXPosition = true;
break;
}
@@ -1191,12 +1190,12 @@ void SchXMLTitleContext::startFastElement( sal_Int32 /*nElement*/,
case XML_ELEMENT(SVG_COMPAT, XML_Y):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
- aPosition.Y, aValue );
+ aPosition.Y, aIter.toView() );
bHasYPosition = true;
break;
}
case XML_ELEMENT(CHART, XML_STYLE_NAME):
- msAutoStyleName = aValue;
+ msAutoStyleName = aIter.toString();
break;
default:
XMLOFF_WARN_UNKNOWN("xmloff", aIter);
diff --git a/xmloff/source/chart/SchXMLLegendContext.cxx b/xmloff/source/chart/SchXMLLegendContext.cxx
index 758863a688c6..4cc10dfe7a9e 100644
--- a/xmloff/source/chart/SchXMLLegendContext.cxx
+++ b/xmloff/source/chart/SchXMLLegendContext.cxx
@@ -85,13 +85,12 @@ void SchXMLLegendContext::startFastElement( sal_Int32 /*nElement*/,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list