diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-20 09:14:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-20 10:38:02 +0200 |
commit | 8e4453c2117b6c3bb15be6b949a0a8a43df66647 (patch) | |
tree | 73cf2208d992c5406777be3edc4efe5fc28963ce | |
parent | 2ddf33f78fbc4ce0f49752e4adb9357c1fb69833 (diff) |
use more FastAttributeIter::toView
Change-Id: I8a8ad5456fea349a45fca0aa468313cb04aa02f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133198
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
28 files changed, 244 insertions, 80 deletions
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx index 6f330fa58400..f435244a9504 100644 --- a/include/sax/tools/converter.hxx +++ b/include/sax/tools/converter.hxx @@ -222,6 +222,10 @@ public: static bool convertDuration(css::util::Duration& rDuration, std::u16string_view rString); + /** convert XMLSchema-2 "duration" string to util::Duration */ + static bool convertDuration(css::util::Duration& rDuration, + std::string_view rString); + /** convert util::Date to XMLSchema-2 "date" string */ static void convertDate( OUStringBuffer& rBuffer, const css::util::Date& rDate, diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 6b6301bac0ff..b882ac076cd9 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1216,8 +1216,9 @@ readUnsignedNumberMaxDigits(int maxDigits, return bOverflow ? R_OVERFLOW : R_SUCCESS; } +template<typename V> static bool -readDurationT(std::u16string_view rString, size_t & io_rnPos) +readDurationT(V rString, size_t & io_rnPos) { if ((io_rnPos < rString.size()) && (rString[io_rnPos] == 'T' || rString[io_rnPos] == 't')) @@ -1228,8 +1229,9 @@ readDurationT(std::u16string_view rString, size_t & io_rnPos) return false; } +template<typename V> static bool -readDurationComponent(std::u16string_view rString, +readDurationComponent(V rString, size_t & io_rnPos, sal_Int32 & io_rnTemp, bool & io_rbTimePart, sal_Int32 & o_rnTarget, const sal_Unicode cLower, const sal_Unicode cUpper) { @@ -1418,6 +1420,165 @@ bool Converter::convertDuration(util::Duration& rDuration, return bSuccess; } +/** convert ISO8601 "duration" string to util::Duration */ +bool Converter::convertDuration(util::Duration& rDuration, + std::string_view rString) +{ + std::string_view string = trim(rString); + size_t nPos(0); + + bool bIsNegativeDuration(false); + if (!string.empty() && ('-' == string[0])) + { + bIsNegativeDuration = true; + ++nPos; + } + + if (nPos < string.size() + && string[nPos] != 'P' && string[nPos] != 'p') // duration must start with "P" + { + return false; + } + + ++nPos; + + /// last read number; -1 == no valid number! always reset after using! + sal_Int32 nTemp(-1); + bool bTimePart(false); // have we read 'T'? + bool bSuccess(false); + sal_Int32 nYears(0); + sal_Int32 nMonths(0); + sal_Int32 nDays(0); + sal_Int32 nHours(0); + sal_Int32 nMinutes(0); + sal_Int32 nSeconds(0); + sal_Int32 nNanoSeconds(0); + + bTimePart = readDurationT(string, nPos); + bSuccess = (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nYears, 'y', 'Y'); + } + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nMonths, 'm', 'M'); + } + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nDays, 'd', 'D'); + } + + if (bTimePart) + { + if (-1 == nTemp) // a 'T' must be followed by a component + { + bSuccess = false; + } + + if (bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nHours, 'h', 'H'); + } + + if (bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nMinutes, 'm', 'M'); + } + + // eeek! seconds are icky. + if ((nPos < string.size()) && bSuccess) + { + if (string[nPos] == '.' || + string[nPos] == ',') + { + ++nPos; + if (-1 != nTemp) + { + nSeconds = nTemp; + nTemp = -1; + const sal_Int32 nStart(nPos); + bSuccess = readUnsignedNumberMaxDigits(9, string, nPos, nTemp) == R_SUCCESS; + if ((nPos < string.size()) && bSuccess) + { + if (-1 != nTemp) + { + nNanoSeconds = nTemp; + sal_Int32 nDigits = nPos - nStart; + assert(nDigits >= 0); + for (; nDigits < 9; ++nDigits) + { + nNanoSeconds *= 10; + } + nTemp=-1; + if ('S' == string[nPos] || 's' == string[nPos]) + { + ++nPos; + } + else + { + bSuccess = false; + } + } + else + { + bSuccess = false; + } + } + } + else + { + bSuccess = false; + } + } + else if ('S' == string[nPos] || 's' == string[nPos]) + { + ++nPos; + if (-1 != nTemp) + { + nSeconds = nTemp; + nTemp = -1; + } + else + { + bSuccess = false; + } + } + } + } + + if (nPos != string.size()) // string not processed completely? + { + bSuccess = false; + } + + if (nTemp != -1) // unprocessed number? + { + bSuccess = false; + } + + if (bSuccess) + { + rDuration.Negative = bIsNegativeDuration; + rDuration.Years = static_cast<sal_Int16>(nYears); + rDuration.Months = static_cast<sal_Int16>(nMonths); + rDuration.Days = static_cast<sal_Int16>(nDays); + rDuration.Hours = static_cast<sal_Int16>(nHours); + rDuration.Minutes = static_cast<sal_Int16>(nMinutes); + rDuration.Seconds = static_cast<sal_Int16>(nSeconds); + rDuration.NanoSeconds = nNanoSeconds; + } + + return bSuccess; +} static void lcl_AppendTimezone(OUStringBuffer & i_rBuffer, int const nOffset) diff --git a/sc/source/filter/xml/SparklineGroupsImportContext.cxx b/sc/source/filter/xml/SparklineGroupsImportContext.cxx index 5720ca8f3382..b1164e3ef993 100644 --- a/sc/source/filter/xml/SparklineGroupsImportContext.cxx +++ b/sc/source/filter/xml/SparklineGroupsImportContext.cxx @@ -32,29 +32,29 @@ SparklineGroupsImportContext::SparklineGroupsImportContext(ScXMLImport& rImport) namespace { -sc::SparklineType parseSparklineType(std::u16string_view aString) +sc::SparklineType parseSparklineType(std::string_view aString) { - if (aString == u"column") + if (aString == "column") return sc::SparklineType::Column; - else if (aString == u"stacked") + else if (aString == "stacked") return sc::SparklineType::Stacked; return sc::SparklineType::Line; } -sc::DisplayEmptyCellsAs parseDisplayEmptyCellsAs(std::u16string_view aString) +sc::DisplayEmptyCellsAs parseDisplayEmptyCellsAs(std::string_view aString) { - if (aString == u"span") + if (aString == "span") return sc::DisplayEmptyCellsAs::Span; - else if (aString == u"gap") + else if (aString == "gap") return sc::DisplayEmptyCellsAs::Gap; return sc::DisplayEmptyCellsAs::Zero; } -sc::AxisType parseAxisType(std::u16string_view aString) +sc::AxisType parseAxisType(std::string_view aString) { - if (aString == u"group") + if (aString == "group") return sc::AxisType::Group; - else if (aString == u"custom") + else if (aString == "custom") return sc::AxisType::Custom; return sc::AxisType::Individual; } @@ -70,8 +70,7 @@ void SparklineGroupsImportContext::fillSparklineGroupID( { case XML_ELEMENT(CALC_EXT, XML_ID): { - OString aString = OUStringToOString(rIter.toString(), RTL_TEXTENCODING_ASCII_US); - tools::Guid aGuid(aString); + tools::Guid aGuid(rIter.toView()); m_pCurrentSparklineGroup->setID(aGuid); break; } @@ -90,7 +89,7 @@ void SparklineGroupsImportContext::fillSparklineGroupAttributes( { case XML_ELEMENT(CALC_EXT, XML_TYPE): { - rAttributes.setType(parseSparklineType(rIter.toString())); + rAttributes.setType(parseSparklineType(rIter.toView())); break; } case XML_ELEMENT(CALC_EXT, XML_LINE_WIDTH): @@ -111,7 +110,7 @@ void SparklineGroupsImportContext::fillSparklineGroupAttributes( } case XML_ELEMENT(CALC_EXT, XML_DISPLAY_EMPTY_CELLS_AS): { - auto eDisplayEmptyCellsAs = parseDisplayEmptyCellsAs(rIter.toString()); + auto eDisplayEmptyCellsAs = parseDisplayEmptyCellsAs(rIter.toView()); rAttributes.setDisplayEmptyCellsAs(eDisplayEmptyCellsAs); break; } @@ -157,12 +156,12 @@ void SparklineGroupsImportContext::fillSparklineGroupAttributes( } case XML_ELEMENT(CALC_EXT, XML_MIN_AXIS_TYPE): { - rAttributes.setMinAxisType(parseAxisType(rIter.toString())); + rAttributes.setMinAxisType(parseAxisType(rIter.toView())); break; } case XML_ELEMENT(CALC_EXT, XML_MAX_AXIS_TYPE): { - rAttributes.setMaxAxisType(parseAxisType(rIter.toString())); + rAttributes.setMaxAxisType(parseAxisType(rIter.toView())); break; } case XML_ELEMENT(CALC_EXT, XML_RIGHT_TO_LEFT): @@ -183,56 +182,56 @@ void SparklineGroupsImportContext::fillSparklineGroupAttributes( case XML_ELEMENT(CALC_EXT, XML_COLOR_SERIES): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorSeries(aColor); break; } case XML_ELEMENT(CALC_EXT, XML_COLOR_NEGATIVE): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorNegative(aColor); break; } case XML_ELEMENT(CALC_EXT, XML_COLOR_AXIS): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorAxis(aColor); break; } case XML_ELEMENT(CALC_EXT, XML_COLOR_MARKERS): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorMarkers(aColor); break; } case XML_ELEMENT(CALC_EXT, XML_COLOR_FIRST): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorFirst(aColor); break; } case XML_ELEMENT(CALC_EXT, XML_COLOR_LAST): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorLast(aColor); break; } case XML_ELEMENT(CALC_EXT, XML_COLOR_HIGH): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorHigh(aColor); break; } case XML_ELEMENT(CALC_EXT, XML_COLOR_LOW): { Color aColor; - sax::Converter::convertColor(aColor, rIter.toString()); + sax::Converter::convertColor(aColor, rIter.toView()); rAttributes.setColorLow(aColor); break; } diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx index 7867b740cc27..e02400bcd480 100644 --- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx +++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx @@ -73,7 +73,7 @@ ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& r break; case XML_ELEMENT( TABLE, XML_NULL_YEAR ): sal_Int32 nTemp; - ::sax::Converter::convertNumber( nTemp, aIter.toString() ); + ::sax::Converter::convertNumber( nTemp, aIter.toView() ); nYear2000 = static_cast<sal_uInt16>(nTemp); break; case XML_ELEMENT( TABLE, XML_USE_REGULAR_EXPRESSIONS ): @@ -150,7 +150,7 @@ ScXMLNullDateContext::ScXMLNullDateContext( ScXMLImport& rImport, if (aIter != rAttrList->end()) { util::DateTime aDateTime; - ::sax::Converter::parseDateTime(aDateTime, aIter.toString()); + ::sax::Converter::parseDateTime(aDateTime, aIter.toView()); util::Date aDate; aDate.Day = aDateTime.Day; aDate.Month = aDateTime.Month; diff --git a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx index 6453f81a5ddf..72bdc7b90677 100644 --- a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx +++ b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx @@ -63,7 +63,7 @@ ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext( case XML_ELEMENT( TABLE, XML_LAST_COLUMN_SPANNED ): { sal_Int32 nValue; - if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 )) + if (::sax::Converter::convertNumber( nValue, aIter.toView(), 1 )) pCellRangeSource->nColumns = nValue; else pCellRangeSource->nColumns = 1; @@ -72,7 +72,7 @@ ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext( case XML_ELEMENT( TABLE, XML_LAST_ROW_SPANNED ): { sal_Int32 nValue; - if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 )) + if (::sax::Converter::convertNumber( nValue, aIter.toView(), 1 )) pCellRangeSource->nRows = nValue; else pCellRangeSource->nRows = 1; @@ -81,7 +81,7 @@ ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext( case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ): { double fTime; - if (::sax::Converter::convertDuration( fTime, aIter.toString() )) + if (::sax::Converter::convertDuration( fTime, aIter.toView() )) pCellRangeSource->nRefresh = std::max( static_cast<sal_Int32>(fTime * 86400.0), sal_Int32(0) ); } break; diff --git a/sc/source/filter/xml/XMLDetectiveContext.cxx b/sc/source/filter/xml/XMLDetectiveContext.cxx index 9c6c7cbbec7b..b6e3af33ad9d 100644 --- a/sc/source/filter/xml/XMLDetectiveContext.cxx +++ b/sc/source/filter/xml/XMLDetectiveContext.cxx @@ -167,7 +167,7 @@ ScXMLDetectiveOperationContext::ScXMLDetectiveOperationContext( case XML_ELEMENT( TABLE, XML_INDEX ): { sal_Int32 nValue; - if (::sax::Converter::convertNumber( nValue, aIter.toString(), 0 )) + if (::sax::Converter::convertNumber( nValue, aIter.toView(), 0 )) aDetectiveOp.nIndex = nValue; } break; diff --git a/sc/source/filter/xml/XMLTableSourceContext.cxx b/sc/source/filter/xml/XMLTableSourceContext.cxx index bd09d266ad48..535f532dcaa3 100644 --- a/sc/source/filter/xml/XMLTableSourceContext.cxx +++ b/sc/source/filter/xml/XMLTableSourceContext.cxx @@ -62,7 +62,7 @@ ScXMLTableSourceContext::ScXMLTableSourceContext( ScXMLImport& rImport, break; case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ): double fTime; - if (::sax::Converter::convertDuration( fTime, aIter.toString() )) + if (::sax::Converter::convertDuration( fTime, aIter.toView() )) nRefresh = std::max( static_cast<sal_Int32>(fTime * 86400.0), sal_Int32(0) ); break; } diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx index 5ce9452ae0cb..9bc4a132da6b 100644 --- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx +++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx @@ -776,12 +776,12 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport, case XML_ELEMENT( OFFICE, XML_DATE_VALUE ): bEmpty = false; if (GetScImport().GetMM100UnitConverter().setNullDate(GetScImport().GetModel())) - GetScImport().GetMM100UnitConverter().convertDateTime(rDateTimeValue, aIter.toString()); + GetScImport().GetMM100UnitConverter().convertDateTime(rDateTimeValue, aIter.toView()); fValue = rDateTimeValue; break; case XML_ELEMENT( OFFICE, XML_TIME_VALUE ): bEmpty = false; - ::sax::Converter::convertDuration(rDateTimeValue, aIter.toString()); + ::sax::Converter::convertDuration(rDateTimeValue, aIter.toView()); fValue = rDateTimeValue; } } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 266a520e384a..8e2a7711ac3b 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -213,7 +213,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport, { if (!it.isEmpty() && rXMLImport.SetNullDateOnUnitConverter()) { - rXMLImport.GetMM100UnitConverter().convertDateTime(fValue, it.toString()); + rXMLImport.GetMM100UnitConverter().convertDateTime(fValue, it.toView()); bIsEmpty = false; } } @@ -222,7 +222,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport, { if (!it.isEmpty()) { - ::sax::Converter::convertDuration(fValue, it.toString()); + ::sax::Converter::convertDuration(fValue, it.toView()); bIsEmpty = false; } } diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index 99cbc69167b8..307d55f7f30e 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -1383,7 +1383,7 @@ ScXMLDataPilotGroupsContext::ScXMLDataPilotGroupsContext( ScXMLImport& rImport, bAutoStart = true; else { - GetScImport().GetMM100UnitConverter().convertDateTime(fStart, aIter.toString()); + GetScImport().GetMM100UnitConverter().convertDateTime(fStart, aIter.toView()); bAutoStart = false; } } @@ -1395,7 +1395,7 @@ ScXMLDataPilotGroupsContext::ScXMLDataPilotGroupsContext( ScXMLImport& rImport, bAutoEnd = true; else { - GetScImport().GetMM100UnitConverter().convertDateTime(fEnd, aIter.toString()); + GetScImport().GetMM100UnitConverter().convertDateTime(fEnd, aIter.toView()); bAutoEnd = false; } } diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index a44168aebe7b..ee728b1550a4 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -167,7 +167,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport, case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ): { double fTime; - if (::sax::Converter::convertDuration( fTime, aIter.toString() )) + if (::sax::Converter::convertDuration( fTime, aIter.toView() )) nRefresh = std::max( static_cast<sal_Int32>(fTime * 86400.0), sal_Int32(0) ); } break; diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx index a09d294f17ca..91bb218bb330 100644 --- a/sc/source/filter/xml/xmlexternaltabi.cxx +++ b/sc/source/filter/xml/xmlexternaltabi.cxx @@ -265,7 +265,7 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext( { if ( !it.isEmpty() && mrScImport.SetNullDateOnUnitConverter() ) { - mrScImport.GetMM100UnitConverter().convertDateTime( mfCellValue, it.toString() ); + mrScImport.GetMM100UnitConverter().convertDateTime( mfCellValue, it.toView() ); mbIsNumeric = true; mbIsEmpty = false; } @@ -275,7 +275,7 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext( { if ( !it.isEmpty() ) { - ::sax::Converter::convertDuration( mfCellValue, it.toString() ); + ::sax::Converter::convertDuration( mfCellValue, it.toView() ); mbIsNumeric = true; mbIsEmpty = false; } diff --git a/sc/source/filter/xml/xmlsceni.cxx b/sc/source/filter/xml/xmlsceni.cxx index 353cd9012ae2..7a1c1848ba87 100644 --- a/sc/source/filter/xml/xmlsceni.cxx +++ b/sc/source/filter/xml/xmlsceni.cxx @@ -56,7 +56,7 @@ ScXMLTableScenarioContext::ScXMLTableScenarioContext( bDisplayBorder = IsXMLToken(aIter, XML_TRUE); break; case XML_ELEMENT( TABLE, XML_BORDER_COLOR ): - ::sax::Converter::convertColor(aBorderColor, aIter.toString()); + ::sax::Converter::convertColor(aBorderColor, aIter.toView()); break; case XML_ELEMENT( TABLE, XML_COPY_BACK ): bCopyBack = IsXMLToken(aIter, XML_TRUE); diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 96c10b3546b4..34fd86f99959 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -440,7 +440,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( case XML_ELEMENT(OFFICE, XML_TIME_VALUE): { double fTmp; - if (::sax::Converter::convertDuration(fTmp, aIter.toString())) + if (::sax::Converter::convertDuration(fTmp, aIter.toView())) { m_fValue = fTmp; m_bHasValue = true; @@ -451,7 +451,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( { double fTmp; if (GetImport().GetMM100UnitConverter().convertDateTime(fTmp, - aIter.toString())) + aIter.toView())) { m_fValue = fTmp; m_bHasValue = true; @@ -461,7 +461,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( case XML_ELEMENT(OFFICE, XML_BOOLEAN_VALUE): { bool bTmp(false); - if (::sax::Converter::convertBool(bTmp, aIter.toString())) + if (::sax::Converter::convertBool(bTmp, aIter.toView())) { m_fValue = (bTmp ? 1.0 : 0.0); m_bHasValue = true; @@ -472,7 +472,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( case XML_ELEMENT(TABLE, XML_PROTECTED): { bool bTmp(false); - if (::sax::Converter::convertBool(bTmp, aIter.toString())) + if (::sax::Converter::convertBool(bTmp, aIter.toView())) { m_bProtect = bTmp; } @@ -486,7 +486,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( break; case XML_ELEMENT(OFFICE, XML_VALUE_TYPE): { - if ("string" == aIter.toString()) + if ("string" == aIter.toView()) { m_bValueTypeIsString = true; } diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx index 07d828c5de4c..9365a791c901 100644 --- a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx +++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx @@ -44,7 +44,7 @@ SchXMLCalculationSettingsContext::SchXMLCalculationSettingsContext( SvXMLImport& if ( aIter.getToken() == XML_ELEMENT(TABLE, XML_DATE_VALUE) ) { util::DateTime aNullDate; - ::sax::Converter::parseDateTime(aNullDate, aIter.toString()); + ::sax::Converter::parseDateTime(aNullDate, aIter.toView()); m_aNullDate <<= aNullDate; } else diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index e1ca44503506..7e0fe67602f8 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -1211,7 +1211,7 @@ void SchXMLStatisticsObjectContext::startFastElement (sal_Int32 /*Element*/, sAutoStyleName = aIter.toString(); break; case XML_ELEMENT(CHART, XML_DIMENSION): - bYError = aIter.toString() == "y"; + bYError = aIter.toView() == "y"; break; case XML_ELEMENT(CHART, XML_ERROR_UPPER_RANGE): aPosRange = aIter.toString(); diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 094dc94f52c5..8a4cd27d24b5 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -115,8 +115,8 @@ public: Any convertTarget( const OUString& rValue ); static Any convertPath( const OUString& rValue ); Any convertTiming( const OUString& rValue ); - static Sequence< double > convertKeyTimes( std::u16string_view rValue ); - static Sequence< TimeFilterPair > convertTimeFilter( std::u16string_view rValue ); + static Sequence< double > convertKeyTimes( std::string_view rValue ); + static Sequence< TimeFilterPair > convertTimeFilter( std::string_view rValue ); }; AnimationsImportHelperImpl::AnimationsImportHelperImpl( SvXMLImport& rImport ) @@ -378,7 +378,7 @@ Any AnimationsImportHelperImpl::convertTiming( const OUString& rValue ) return aAny; } -Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( std::u16string_view rValue ) +Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( std::string_view rValue ) { const sal_Int32 nElements { comphelper::string::getTokenCount(rValue, ';') }; @@ -394,7 +394,7 @@ Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( std::u16string_v return aKeyTimes; } -Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( std::u16string_view rValue ) +Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( std::string_view rValue ) { const sal_Int32 nElements { comphelper::string::getTokenCount(rValue, ';') }; @@ -405,14 +405,14 @@ Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( std::u TimeFilterPair* pValues = aTimeFilter.getArray(); for (sal_Int32 nIndex = 0; nIndex >= 0; ) { - const std::u16string_view aToken( o3tl::getToken(rValue, 0, ';', nIndex ) ); + const std::string_view aToken( o3tl::getToken(rValue, 0, ';', nIndex ) ); size_t nPos = aToken.find( ',' ); - if( nPos != std::u16string_view::npos ) + if( nPos != std::string_view::npos ) { - pValues->Time = rtl_math_uStringToDouble( + pValues->Time = rtl_math_stringToDouble( aToken.data(), aToken.data() + nPos, '.', 0, nullptr, nullptr); - pValues->Progress = rtl_math_uStringToDouble( + pValues->Progress = rtl_math_stringToDouble( aToken.data() + nPos + 1, aToken.data() + aToken.size(), '.', 0, nullptr, nullptr); } @@ -842,7 +842,7 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax: case XML_ELEMENT(SMIL_SO52, XML_KEYTIMES): { if( xAnimate.is() ) - xAnimate->setKeyTimes( AnimationsImportHelperImpl::convertKeyTimes( aIter.toString() ) ); + xAnimate->setKeyTimes( AnimationsImportHelperImpl::convertKeyTimes( aIter.toView() ) ); } break; @@ -908,7 +908,7 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax: case XML_ELEMENT(SMIL_SO52, XML_KEYSPLINES): { if( xAnimate.is() ) - xAnimate->setTimeFilter( AnimationsImportHelperImpl::convertTimeFilter( aIter.toString() ) ); + xAnimate->setTimeFilter( AnimationsImportHelperImpl::convertTimeFilter( aIter.toView() ) ); } break; diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx index de189cab7d22..94dff040c288 100644 --- a/xmloff/source/draw/animimp.cxx +++ b/xmloff/source/draw/animimp.cxx @@ -455,7 +455,7 @@ XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport, maShapeId = aIter.toString(); break; case XML_ELEMENT(DRAW, XML_COLOR): - ::sax::Converter::convertColor(maDimColor, aIter.toString()); + ::sax::Converter::convertColor(maDimColor, aIter.toView()); break; case XML_ELEMENT(PRESENTATION, XML_EFFECT): diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx index c1519346db88..31da3652e3b0 100644 --- a/xmloff/source/draw/ximp3dscene.cxx +++ b/xmloff/source/draw/ximp3dscene.cxx @@ -53,13 +53,13 @@ SdXML3DLightContext::SdXML3DLightContext( { case XML_ELEMENT(DR3D, XML_DIFFUSE_COLOR): { - ::sax::Converter::convertColor(maDiffuseColor, aIter.toString()); + ::sax::Converter::convertColor(maDiffuseColor, aIter.toView()); break; } case XML_ELEMENT(DR3D, XML_DIRECTION): { ::basegfx::B3DVector aVal; - SvXMLUnitConverter::convertB3DVector(aVal, aIter.toString()); + SvXMLUnitConverter::convertB3DVector(aVal, aIter.toView()); if (!std::isnan(aVal.getX()) && !std::isnan(aVal.getY()) && !std::isnan(aVal.getZ())) { maDirection = aVal; diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 5e32cdba6763..c8b90dcf26df 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -441,14 +441,14 @@ static void GetPosition3D( std::vector< css::beans::PropertyValue >& rDest, } static void GetDoubleSequence( std::vector< css::beans::PropertyValue >& rDest, // e.g. draw:glue-point-leaving-directions - std::u16string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) + std::string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { std::vector< double > vDirection; sal_Int32 nIndex = 0; do { double fAttrDouble; - std::u16string_view aToken( o3tl::getToken(rValue, 0, ',', nIndex ) ); + std::string_view aToken( o3tl::getToken(rValue, 0, ',', nIndex ) ); if (!::sax::Converter::convertDouble( fAttrDouble, aToken )) break; else @@ -466,14 +466,14 @@ static void GetDoubleSequence( std::vector< css::beans::PropertyValue >& rDest, } static void GetSizeSequence( std::vector< css::beans::PropertyValue >& rDest, - std::u16string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) + std::string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { std::vector< sal_Int32 > vNum; sal_Int32 nIndex = 0; do { sal_Int32 n; - std::u16string_view aToken( o3tl::getToken(rValue, 0, ' ', nIndex ) ); + std::string_view aToken( o3tl::getToken(rValue, 0, ' ', nIndex ) ); if (!::sax::Converter::convertNumber( n, aToken )) break; else @@ -892,7 +892,7 @@ void XMLEnhancedCustomShapeContext::startFastElement( } break; case EAS_sub_view_size: - GetSizeSequence( maPath, aIter.toString(), EAS_SubViewSize ); + GetSizeSequence( maPath, aIter.toView(), EAS_SubViewSize ); break; case EAS_text_rotate_angle : GetDouble( mrCustomShapeGeometry, aIter.toView(), EAS_TextRotateAngle ); @@ -1093,7 +1093,7 @@ void XMLEnhancedCustomShapeContext::startFastElement( GetEnum( maPath, aIter.toView(), EAS_GluePointType, *aXML_GluePointEnumMap ); break; case EAS_glue_point_leaving_directions : - GetDoubleSequence( maPath, aIter.toString(), EAS_GluePointLeavingDirections ); + GetDoubleSequence( maPath, aIter.toView(), EAS_GluePointLeavingDirections ); break; case EAS_text_path : GetBool( maTextPath, aIter.toView(), EAS_TextPath ); diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 27a90b9ddf3f..d0e400a8de33 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -274,12 +274,12 @@ void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XFastAttri case XML_ELEMENT(SVG, XML_X): case XML_ELEMENT(SVG_COMPAT, XML_X): GetImport().GetMM100UnitConverter().convertMeasureToCore( - aGluePoint.Position.X, aIter.toString()); + aGluePoint.Position.X, aIter.toView()); break; case XML_ELEMENT(SVG, XML_Y): case XML_ELEMENT(SVG_COMPAT, XML_Y): GetImport().GetMM100UnitConverter().convertMeasureToCore( - aGluePoint.Position.Y, aIter.toString()); + aGluePoint.Position.Y, aIter.toView()); break; case XML_ELEMENT(DRAW, XML_ID): nId = aIter.toInt32(); @@ -2884,7 +2884,7 @@ void SdXMLPluginShapeContext::startFastElement (sal_Int32 /*nElement*/, { if( aIter.getToken() == XML_ELEMENT(DRAW, XML_MIME_TYPE) ) { - if( aIter.toString() == "application/vnd.sun.star.media" ) + if( aIter.toView() == "application/vnd.sun.star.media" ) mbMedia = true; // leave this loop break; diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx index a59b68ab0fd1..f89d4d9fb71a 100644 --- a/xmloff/source/draw/ximpshow.cxx +++ b/xmloff/source/draw/ximpshow.cxx @@ -94,7 +94,7 @@ SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport, const Reference< XFa case XML_ELEMENT(PRESENTATION, XML_PAUSE): { Duration aDuration; - if (!::sax::Converter::convertDuration(aDuration, aIter.toString())) + if (!::sax::Converter::convertDuration(aDuration, aIter.toView())) continue; const sal_Int32 nMS = (aDuration.Hours * 60 + diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index f3fbfb01ec24..81ccd84d2b55 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -100,10 +100,10 @@ void XMLGradientStyleImport::importXML( aGradient.YOffset = static_cast< sal_Int16 >( nTmpValue ); break; case XML_ELEMENT(DRAW, XML_START_COLOR): - ::sax::Converter::convertColor(aGradient.StartColor, aIter.toString()); + ::sax::Converter::convertColor(aGradient.StartColor, aIter.toView()); break; case XML_ELEMENT(DRAW, XML_END_COLOR): - ::sax::Converter::convertColor(aGradient.EndColor, aIter.toString()); + ::sax::Converter::convertColor(aGradient.EndColor, aIter.toView()); break; case XML_ELEMENT(DRAW, XML_START_INTENSITY): ::sax::Converter::convertPercent( nTmpValue, aIter.toView() ); diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx index f49fc4a5af13..a70ee506ed3b 100644 --- a/xmloff/source/style/HatchStyle.cxx +++ b/xmloff/source/style/HatchStyle.cxx @@ -87,7 +87,7 @@ void XMLHatchStyleImport::importXML( break; case XML_ELEMENT(DRAW, XML_COLOR): case XML_ELEMENT(DRAW_OOO, XML_COLOR): - ::sax::Converter::convertColor(aHatch.Color, aIter.toString()); + ::sax::Converter::convertColor(aHatch.Color, aIter.toView()); break; case XML_ELEMENT(DRAW, XML_DISTANCE): case XML_ELEMENT(DRAW_OOO, XML_DISTANCE): diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index e4083d3517ba..9e40fada98fa 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -424,7 +424,7 @@ SvXMLNumFmtPropContext::SvXMLNumFmtPropContext( SvXMLImport& rImport, { case XML_ELEMENT(FO, XML_COLOR): case XML_ELEMENT(FO_COMPAT, XML_COLOR): - bColSet = ::sax::Converter::convertColor( m_nColor, aIter.toString() ); + bColSet = ::sax::Converter::convertColor( m_nColor, aIter.toView() ); break; default: XMLOFF_WARN_UNKNOWN("xmloff", aIter); diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx index 601c3f5fd191..0c470a4891c7 100644 --- a/xmloff/source/style/xmltabi.cxx +++ b/xmloff/source/style/xmltabi.cxx @@ -93,7 +93,7 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl( break; case XML_ELEMENT(STYLE, XML_CHAR): if( !aIter.isEmpty() ) - aTabStop.DecimalChar = aIter.toString()[0]; + aTabStop.DecimalChar = aIter.toView()[0]; break; case XML_ELEMENT(STYLE, XML_LEADER_STYLE): if( IsXMLToken( aIter, XML_NONE ) ) @@ -105,7 +105,7 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl( break; case XML_ELEMENT(STYLE, XML_LEADER_TEXT): if( !aIter.isEmpty() ) - cTextFillChar = aIter.toString()[0]; + cTextFillChar = aIter.toView()[0]; break; default: XMLOFF_WARN_UNKNOWN("xmloff", aIter); diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 354bda7c8ce7..27a803b42a0b 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1471,7 +1471,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::c { if( aIter.getToken() == XML_ELEMENT(DRAW, XML_MIME_TYPE) ) { - if( aIter.toString() == "application/vnd.sun.star.media" ) + if( aIter.toView() == "application/vnd.sun.star.media" ) bMedia = true; // leave this loop diff --git a/xmloff/source/text/XMLTextShapeImportHelper.cxx b/xmloff/source/text/XMLTextShapeImportHelper.cxx index f4a62f4ad9b7..21c6c3134c16 100644 --- a/xmloff/source/text/XMLTextShapeImportHelper.cxx +++ b/xmloff/source/text/XMLTextShapeImportHelper.cxx @@ -109,7 +109,7 @@ void XMLTextShapeImportHelper::addShape( break; case XML_ELEMENT(SVG, XML_Y): case XML_ELEMENT(SVG_COMPAT, XML_Y): - rImport.GetMM100UnitConverter().convertMeasureToCore( nY, aIter.toString() ); + rImport.GetMM100UnitConverter().convertMeasureToCore( nY, aIter.toView() ); break; } } |