writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 20 +++++++-------- 1 file changed, 10 insertions(+), 10 deletions(-)
New commits: commit fdd7304485ce00177e4b61e6632d14d89d438756 Author: Hossein <hoss...@libreoffice.org> AuthorDate: Sat May 6 15:18:43 2023 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Mon May 8 09:36:59 2023 +0200 Drop boost dependency for writerfilter The last usage of boost in writerfilter was <boost/lexical_cast.hpp>. This is now implemented using rtl::math::stringToDouble(). To avoid behavior change in case it does not find any suitable characters to convert, it is checked that the index of the last parsed character to be zero, as lexical_cast throwing bad_lexical_cast exception in this case but stringToDouble reports rtl_math_ConversionStatus_Ok. OUString::toDouble() is not enough here, as it does not provide suitable error handling mechanism beyond IEEE 754 special values and 0 as output. stringToDouble() should be able to handle 16-bit char strings, as it takes std::u16string_view type string as input, and also uses sal_Unicode as the data type for the separators. The boost library is no longer in use in writerfilter. But, right now it is not possible to remove the remainings from the makefiles and includes, because of the dependencies that still use boost. Change-Id: Iae4b83106fcbdded71e7d9e5f70376ab408e9b5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139279 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index c70615a49a9f..f2f09d8a22d4 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -51,7 +51,6 @@ #include <comphelper/propertyvalue.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/style/BreakType.hpp> -#include <boost/lexical_cast.hpp> #include <officecfg/Office/Writer.hxx> #ifdef DBG_UTIL @@ -1248,15 +1247,16 @@ static void lcl_convertFormulaRanges(const uno::Reference<text::XTextTable> & xT sLastCell = xCell->getPropertyValue("CellName").get<OUString>(); if (sNextCell.isEmpty()) sNextCell = sLastCell; - try - { - // accept numbers with comma and percent - OUString sCellText = xText->getString().replace(',', '.'); - if (sCellText.endsWith("%")) - sCellText = sCellText.copy(0, sCellText.getLength()-1); - boost::lexical_cast<double>(sCellText); - } - catch( boost::bad_lexical_cast const& ) + + // accept numbers with comma and percent + OUString sCellText = xText->getString().replace(',', '.'); + if (sCellText.endsWith("%")) + sCellText = sCellText.copy(0, sCellText.getLength()-1); + + rtl_math_ConversionStatus eConversionStatus; + sal_Int32 nParsedEnd; + rtl::math::stringToDouble(sCellText, '.', ',', &eConversionStatus, &nParsedEnd); + if ( eConversionStatus != rtl_math_ConversionStatus_Ok || nParsedEnd == 0 ) { if ( !bFoundFirst ) {