[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/inc sc/source
sc/inc/compiler.hxx |1 + sc/source/core/tool/compiler.cxx | 37 ++--- 2 files changed, 31 insertions(+), 7 deletions(-) New commits: commit c5dbe94eb71acd9ab19cd9a8d561dd75da82d3d7 Author: Eike Rathke AuthorDate: Wed Aug 11 20:03:36 2021 +0200 Commit: Xisco Fauli CommitDate: Sun Aug 15 18:25:52 2021 +0200 Resolves: tdf#143809 "INF" may be a named expression or DB area name ... to not be caught by rtl::math::stringToDouble() handling XMLSchema-2 "INF" and "NaN" and set as error. Change-Id: I9bf7aad416a69d4c3c0d49d6c80168097040a3e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120337 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit b37fd7f38165dadc5b1a674b73f4b18824e4789e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120435 Reviewed-by: Xisco Fauli diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index b051f3ad4b4e..8ff420001d2b 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -344,6 +344,7 @@ private: bool IsColRowName( const OUString& ); bool IsBoolean( const OUString& ); void AutoCorrectParsedSymbol(); +const ScRangeData* GetRangeData( SCTAB& rSheet, const OUString& rUpperName ) const; void AdjustSheetLocalNameRelReferences( SCTAB nDelta ); void SetRelNameReference(); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 274205f5734b..b2b008b13d55 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3093,7 +3093,24 @@ bool ScCompiler::IsValue( const OUString& rSym ) return false; } if (eStatus == rtl_math_ConversionStatus_OutOfRange) +{ +// rtl::math::stringToDouble() recognizes XMLSchema-2 "INF" and +// "NaN" (case sensitive) that could be named expressions or DB +// areas as well. +// rSym is already upper so "NaN" is not possible here. +if (!std::isfinite(fVal) && rSym == "INF") +{ +SCTAB nSheet = -1; +if (GetRangeData( nSheet, rSym)) +return false; +if (rDoc.GetDBCollection()->getNamedDBs().findByUpperName(rSym)) +return false; +} +/* TODO: is there a specific reason why we don't accept an infinity + * value that would raise an error in the interpreter, instead of + * setting the hard error at the token array already? */ SetError( FormulaError::IllegalArgument ); +} maRawToken.SetDouble( fVal ); return true; } @@ -3511,13 +3528,11 @@ bool ScCompiler::IsMacro( const OUString& rName ) #endif } -bool ScCompiler::IsNamedRange( const OUString& rUpperName ) +const ScRangeData* ScCompiler::GetRangeData( SCTAB& rSheet, const OUString& rUpperName ) const { -// IsNamedRange is called only from NextNewToken, with an upper-case string - // try local names first -sal_Int16 nSheet = aPos.Tab(); -ScRangeName* pRangeName = rDoc.GetRangeName(nSheet); +rSheet = aPos.Tab(); +const ScRangeName* pRangeName = rDoc.GetRangeName(rSheet); const ScRangeData* pData = nullptr; if (pRangeName) pData = pRangeName->findByUpperName(rUpperName); @@ -3527,9 +3542,17 @@ bool ScCompiler::IsNamedRange( const OUString& rUpperName ) if (pRangeName) pData = pRangeName->findByUpperName(rUpperName); if (pData) -nSheet = -1; +rSheet = -1; } +return pData; +} + +bool ScCompiler::IsNamedRange( const OUString& rUpperName ) +{ +// IsNamedRange is called only from NextNewToken, with an upper-case string +SCTAB nSheet = -1; +const ScRangeData* pData = GetRangeData( nSheet, rUpperName); if (pData) { maRawToken.SetName( nSheet, pData->GetIndex()); @@ -3540,7 +3563,7 @@ bool ScCompiler::IsNamedRange( const OUString& rUpperName ) if (mnCurrentSheetEndPos > 0 && mnCurrentSheetTab >= 0) { OUString aName( rUpperName.copy( mnCurrentSheetEndPos)); -pRangeName = rDoc.GetRangeName( mnCurrentSheetTab); +const ScRangeName* pRangeName = rDoc.GetRangeName( mnCurrentSheetTab); if (pRangeName) { pData = pRangeName->findByUpperName(aName);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/inc sc/source
sc/inc/queryentry.hxx |6 -- sc/source/core/tool/queryentry.cxx | 12 ++-- sc/source/ui/dbgui/filtdlg.cxx |2 +- 3 files changed, 7 insertions(+), 13 deletions(-) New commits: commit 7ba4eeb2e9b8153eb17779c93492ab80a5cd4644 Author: Mike Kaganski AuthorDate: Thu Apr 8 10:12:16 2021 +0300 Commit: Xisco Fauli CommitDate: Thu Apr 8 14:27:26 2021 +0200 tdf#141547: maQueryItems can be 0 E.g., fillQueryParam (sc/source/ui/unoobj/datauno.cxx) may clear it and leave empty if relevant input item is empty. Note how commit e4b924df8f9ad02c66549751cb8e123e420e8508 had changed the same checks in ScQueryEntry::IsQueryBy[Non]Empty. Change-Id: I552462c72e69ddce43711bcff645dc6c7b133db7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113783 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit a0d2fb3217094aa7158310f0bcf16093bcc4984f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113757 Reviewed-by: Xisco Fauli diff --git a/sc/inc/queryentry.hxx b/sc/inc/queryentry.hxx index 46a65b957658..f1282e21a5a0 100644 --- a/sc/inc/queryentry.hxx +++ b/sc/inc/queryentry.hxx @@ -68,13 +68,15 @@ struct SC_DLLPUBLIC ScQueryEntry bool IsQueryByEmpty() const; void SetQueryByNonEmpty(); bool IsQueryByNonEmpty() const; -const Item& GetQueryItem() const; -Item& GetQueryItem(); +const Item& GetQueryItem() const { return GetQueryItemImpl(); } +Item& GetQueryItem() { return GetQueryItemImpl(); } voidClear(); ScQueryEntry& operator=( const ScQueryEntry& r ); booloperator==( const ScQueryEntry& r ) const; private: +Item& GetQueryItemImpl() const; + /** * Stores all query items. It must contain at least one item at all times * (for single equality match queries or comparative queries). It may diff --git a/sc/source/core/tool/queryentry.cxx b/sc/source/core/tool/queryentry.cxx index 6ebcf0003e9b..1c4326c47b29 100644 --- a/sc/source/core/tool/queryentry.cxx +++ b/sc/source/core/tool/queryentry.cxx @@ -115,17 +115,9 @@ bool ScQueryEntry::IsQueryByNonEmpty() const rItem.mfVal == SC_NONEMPTYFIELDS; } -const ScQueryEntry::Item& ScQueryEntry::GetQueryItem() const +ScQueryEntry::Item& ScQueryEntry::GetQueryItemImpl() const { -if (maQueryItems.size() > 1) -// Reset to a single query mode. -maQueryItems.resize(1); -return maQueryItems[0]; -} - -ScQueryEntry::Item& ScQueryEntry::GetQueryItem() -{ -if (maQueryItems.size() > 1) +if (maQueryItems.size() != 1) // Reset to a single query mode. maQueryItems.resize(1); return maQueryItems[0]; diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 13f9fff9381a..322c617aa2f9 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -221,7 +221,6 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) ScQueryEntry& rEntry = theQueryData.GetEntry(i); if ( rEntry.bDoQuery ) { -const ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); nCondPos = static_cast(rEntry.eOp); nFieldSelPos = GetFieldSelPos( static_cast(rEntry.nField) ); if (rEntry.IsQueryByEmpty()) @@ -236,6 +235,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) } else { +const ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); OUString aQueryStr = rItem.maString.getString(); SetValString(aQueryStr, rItem, aValStr); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/inc sc/source
sc/inc/segmenttree.hxx |9 + sc/source/core/data/segmenttree.cxx | 32 sc/source/core/data/table1.cxx |5 + 3 files changed, 46 insertions(+) New commits: commit fb232a8d8ff143410e17bfe9672207479697e3ef Author: Luboš Luňák AuthorDate: Mon Mar 8 22:50:58 2021 +0100 Commit: Xisco Fauli CommitDate: Tue Mar 9 22:25:39 2021 +0100 fix ScFlatBoolSegmentsImpl delayed setup with threads (tdf#140754) Change-Id: I258263f6a15e7098a2292ba7f3336fcaaf5224ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112184 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 2fb274950e5207ca55f4f52325fb522bd44024e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112212 Reviewed-by: Xisco Fauli diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx index 58e59e60cd84..7e25d232a03f 100644 --- a/sc/inc/segmenttree.hxx +++ b/sc/inc/segmenttree.hxx @@ -77,6 +77,9 @@ public: SCROW findLastTrue() const; +// Builds internal data (so that it doesn't build them while used in threads). +void makeReady(); + OString dumpAsString(); private: @@ -102,6 +105,9 @@ public: void removeSegment(SCCOL nCol1, SCCOL nCol2); void insertSegment(SCCOL nCol, SCCOL nSize); +// Builds internal data (so that it doesn't build them while used in threads). +void makeReady(); + OString dumpAsString(); private: @@ -153,6 +159,9 @@ public: void enableTreeSearch(bool bEnable); +// Builds internal data (so that it doesn't build them while used in threads). +void makeReady(); + OString dumpAsString(); private: diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx index 00033438e0f8..d6d57f0982c5 100644 --- a/sc/source/core/data/segmenttree.cxx +++ b/sc/source/core/data/segmenttree.cxx @@ -24,6 +24,7 @@ #include #include #include +#include using ::std::numeric_limits; @@ -66,6 +67,8 @@ public: mbTreeSearchEnabled = b; } +void makeReady(); + private: typedef ::mdds::flat_segment_tree fst_type; fst_type maSegments; @@ -131,7 +134,10 @@ typename ScFlatSegmentsImpl::ValueType ScFlatSegments } if (!maSegments.is_tree_valid()) +{ +assert(!ScGlobal::bThreadedGroupCalcInProgress); maSegments.build_tree(); +} maSegments.search_tree(nPos, nValue); return nValue; @@ -185,7 +191,10 @@ bool ScFlatSegmentsImpl::getRangeData(SCCOLROW nPos, return getRangeDataLeaf(nPos, rData); if (!maSegments.is_tree_valid()) +{ +assert(!ScGlobal::bThreadedGroupCalcInProgress); maSegments.build_tree(); +} if (!maSegments.search_tree(nPos, rData.mnValue, , ).second) return false; @@ -267,6 +276,14 @@ bool ScFlatSegmentsImpl::getNext(RangeData& rData) return true; } +template +void ScFlatSegmentsImpl::makeReady() +{ +assert(!ScGlobal::bThreadedGroupCalcInProgress); +if (!maSegments.is_tree_valid()) +maSegments.build_tree(); +} + class ScFlatUInt16SegmentsImpl : public ScFlatSegmentsImpl { public: @@ -416,6 +433,11 @@ SCROW ScFlatBoolRowSegments::findLastTrue() const return mpImpl->findLastTrue(false); } +void ScFlatBoolRowSegments::makeReady() +{ +mpImpl->makeReady(); +} + OString ScFlatBoolRowSegments::dumpAsString() { OString aOutput; @@ -483,6 +505,11 @@ void ScFlatBoolColSegments::insertSegment(SCCOL nCol, SCCOL nSize) mpImpl->insertSegment(static_cast(nCol), static_cast(nSize), true/*bSkipStartBoundary*/); } +void ScFlatBoolColSegments::makeReady() +{ +mpImpl->makeReady(); +} + OString ScFlatBoolColSegments::dumpAsString() { OString aOutput; @@ -596,6 +623,11 @@ void ScFlatUInt16RowSegments::setValueIf(SCROW nRow1, SCROW nRow2, sal_uInt16 nV mpImpl->setValueIf(static_cast(nRow1), static_cast(nRow2), nValue, rPredicate); } +void ScFlatUInt16RowSegments::makeReady() +{ +mpImpl->makeReady(); +} + OString ScFlatUInt16RowSegments::dumpAsString() { OString aOutput; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 19ddf61770de..11ac1f1d3e83 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2460,6 +2460,11 @@ bool ScTable::HandleRefArrayForParallelism( SCCOL nCol, SCROW nRow1, SCROW nRow2 if ( !IsColValid( nCol ) || !ValidRow( nRow1 ) || !ValidRow( nRow2 ) ) return false; +mpHiddenCols->makeReady(); +mpHiddenRows->makeReady(); +mpFilteredCols->makeReady(); +mpFilteredRows->makeReady(); + return aCol[nCol].HandleRefArrayForParallelism(nRow1, nRow2, mxGroup); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits