[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/columniterator.hxx |1 + sc/source/core/data/columniterator.cxx | 10 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) New commits: commit 4a8ecfd9fdb6d8460bc7eee8773580d4ae550b18 Author: Michael Meeks AuthorDate: Thu Jul 12 19:06:03 2018 +0100 Commit: Eike Rathke CommitDate: Fri Jul 13 19:53:57 2018 +0200 tdf#118620 - avoid out of bounds iterator for end of sheet pivots. Change-Id: I2ddcf56dc94175718739611f0791558fda87b1ba Reviewed-on: https://gerrit.libreoffice.org/57358 Tested-by: Jenkins Reviewed-by: Kohei Yoshida Reviewed-by: Michael Meeks (cherry picked from commit d3387b38fe0eea3fb7ac630c026f02986e8dafc4) Reviewed-on: https://gerrit.libreoffice.org/57385 Reviewed-by: Eike Rathke diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx index c6a87b4e6b39..799d437b33e0 100644 --- a/sc/inc/columniterator.hxx +++ b/sc/inc/columniterator.hxx @@ -60,6 +60,7 @@ class ColumnIterator { CellStoreType::const_position_type maPos; CellStoreType::const_position_type maPosEnd; +bool mbComplete; public: ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 ); diff --git a/sc/source/core/data/columniterator.cxx b/sc/source/core/data/columniterator.cxx index f7367193d9cb..ad96639ca9d4 100644 --- a/sc/source/core/data/columniterator.cxx +++ b/sc/source/core/data/columniterator.cxx @@ -172,7 +172,8 @@ namespace sc { ColumnIterator::ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 ) : maPos(rCells.position(nRow1)), -maPosEnd(rCells.position(maPos.first, nRow2+1)) +maPosEnd(rCells.position(maPos.first, nRow2)), +mbComplete(false) { } @@ -180,7 +181,10 @@ ColumnIterator::~ColumnIterator() {} void ColumnIterator::next() { -maPos = CellStoreType::next_position(maPos); +if ( maPos == maPosEnd) +mbComplete = true; +else +maPos = CellStoreType::next_position(maPos); } SCROW ColumnIterator::getRow() const @@ -190,7 +194,7 @@ SCROW ColumnIterator::getRow() const bool ColumnIterator::hasCell() const { -return maPos != maPosEnd; +return !mbComplete; } mdds::mtv::element_t ColumnIterator::getType() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/column.hxx |6 -- sc/source/core/data/column3.cxx | 14 +- sc/source/core/data/formulacell.cxx |2 +- 3 files changed, 14 insertions(+), 8 deletions(-) New commits: commit 5ddeed368855eb1bde1d9e972896bb774c71f277 Author: Dennis Francis Date: Sun Jun 10 15:23:39 2018 +0530 tdf#114710 : Fixes crash when pasting as GDI metafile The bug document has a formula cell (at O7) that depends on cells with non-default number formats, but this cell's number format was force set by the user to the default. So the mbNeedsNumberFormat for this ScFormulaCell object is now false. But when a copy to clip and paste as GDI metafile is made, this subtle information about the "user forced default number format" is lost. ScColumn::SetFormulaCell() is used while making the copies of the original formula cell to clipdoc and then to another document, where it sets the field mbNeedsNumberFormat of the formulacell to true if the number-format of the target cell is default. Note that the number-formats along with all attributes of the target cells are copied from the source before copying the actual cell contents. As a result, after copy pasting, the formulacell at O7 of the new document will have mbNeedsNumberFormat = true. This causes the attribute modification (in ScAttrArray of corresponding column) while Interpret()'ing the cell. Unfortunately this Interpret() happens while in a call to ScRefCellValue::hasNumeric() while in the middle of rendering the cell of the new document (in ScOutputData::LayoutStrings()), and naturally this messes up the ScPatternAttr references the view has been caching, hence the crash. The steps involved in the fix are :- 1. Carry around the state of mbNeedsNumberFormat in the copy-constructor of ScFormulaCell, in case the src formula-cell is not yet Interpret()'ed. Note that after Interpret() is done, the mbNeedsNumberFormat is set back to false and inherited numfmt is applied to attributes data structure. 2. In ScColumn::SetFormulaCell(), allow an optional param bInheritNumFormatIfNeeded (default = true). In that method, the mbNeedNumberFormat is set to true only if this flag is true and the cell format is default. So when the copy/paste operation is going on, we pass the mbNeedNumberFormat of the source formula-cell for the new parameter to SetFormulaCell(). Reviewed-on: https://gerrit.libreoffice.org/5 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit 37f6e5de1e72d209b0892734f4de5c4d8a849885) Change-Id: I535e413d4bde4c33a5f6ad3ce01536d0e94e7074 Reviewed-on: https://gerrit.libreoffice.org/55693 Tested-by: Jenkins Reviewed-by: Dennis Francis diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 3e8ccee3cee2..7eeefd6e96b7 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -340,10 +340,12 @@ public: */ ScFormulaCell* SetFormulaCell( SCROW nRow, ScFormulaCell* pCell, -sc::StartListeningType eListenType = sc::SingleCellListening ); +sc::StartListeningType eListenType = sc::SingleCellListening, +bool bInheritNumFormatIfNeeded = true); void SetFormulaCell( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell, -sc::StartListeningType eListenType = sc::SingleCellListening ); +sc::StartListeningType eListenType = sc::SingleCellListening, +bool bInheritNumFormatIfNeeded = true); bool SetFormulaCells( SCROW nRow, std::vector& rCells ); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 855f82c39423..63fd08498d59 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -998,7 +998,9 @@ public: { mrDestCol.SetFormulaCell( maDestBlockPos, nSrcRow + mnRowOffset, -new ScFormulaCell(rSrcCell, mrDestCol.GetDoc(), aDestPos)); +new ScFormulaCell(rSrcCell, mrDestCol.GetDoc(), aDestPos), +sc::SingleCellListening, +rSrcCell.NeedsNumberFormat()); } } else if (bNumeric || bDateTime || bString) @@ -1963,11 +1965,12 @@ void ScColumn::SetFormula( SCROW nRow, const OUString& rFormula, formula::Formul } ScFormulaCell* ScColumn::SetFormulaCell( -SCROW nRow, ScFormulaCell* pCell, sc::StartListeningType eListenType ) +SCROW nRow, ScFormulaCell* pCell, sc::StartListeningType eListenType, +bool bInheritNumFormatIfNeeded ) { sc::CellStoreType::iterator it = GetPositionToInsert(nRow); sal_uInt32 nCellFormat = GetNumberFormat(pDocument->GetNonThreadedConte
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/column.hxx |2 +- sc/source/core/data/column2.cxx |3 ++- sc/source/core/data/column3.cxx |6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) New commits: commit 3638dc92ce9b251327302fc903f17d6939fb334e Author: Noel Grandin Date: Tue Mar 27 16:05:38 2018 +0200 tdf#106667 Hang when trying to open a dialog and the whole sheet is selected regression from commit 8d54796bf152499ecbe61788be64c9035f725dfa (patch) enhance pass-by-ref plugin to detect large arguments which converted this peice of code into an O(n^2) loop Change-Id: I0473a084518c0d10411615e1b3901b9b90144bc9 Reviewed-on: https://gerrit.libreoffice.org/51956 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit f4f1654c07ec58bc36d824e9434ab851b7900e9f) Reviewed-on: https://gerrit.libreoffice.org/51970 Reviewed-by: Noel Grandin diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index acd899e7658a..3e8ccee3cee2 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -703,7 +703,7 @@ private: void AttachNewFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength ); void BroadcastNewCell( SCROW nRow ); -bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr ); +bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr ); const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const; diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index b0d69b8c4bb8..0434cc9f39a1 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1978,7 +1978,7 @@ SvtScriptType ScColumn::GetScriptType( SCROW nRow ) const } SvtScriptType ScColumn::GetRangeScriptType( -sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, const sc::CellStoreType::iterator& itrCells ) +sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, const sc::CellStoreType::iterator& itrCells_ ) { if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2) return SvtScriptType::NONE; @@ -1988,6 +1988,7 @@ SvtScriptType ScColumn::GetRangeScriptType( maCellTextAttrs.position(itPos, nRow1); itPos = aRet.first; // Track the position of cell text attribute array. +sc::CellStoreType::iterator itrCells = itrCells_; SvtScriptType nScriptType = SvtScriptType::NONE; bool bUpdated = false; diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 730003196151..961bf244df60 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -499,7 +499,7 @@ void ScColumn::BroadcastNewCell( SCROW nRow ) Broadcast(nRow); } -bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr ) +bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr ) { if (rAttr.mnScriptType != SvtScriptType::UNKNOWN) // Already updated. Nothing to do. @@ -512,9 +512,9 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc:: return false; sc::CellStoreType::position_type pos = maCells.position(itr, nRow); -sc::CellStoreType::iterator itr2 = pos.first; +itr = pos.first; size_t nOffset = pos.second; -ScRefCellValue aCell = GetCellValue( itr2, nOffset ); +ScRefCellValue aCell = GetCellValue( itr, nOffset ); ScAddress aPos(nCol, nRow, nTab); const SfxItemSet* pCondSet = nullptr; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/qa sc/source
sc/inc/dbdata.hxx |9 +++-- sc/qa/unit/ucalc_sharedformula.cxx |4 sc/source/filter/xml/xmldrani.cxx |5 + sc/source/ui/docshell/dbdocfun.cxx |1 - 4 files changed, 8 insertions(+), 11 deletions(-) New commits: commit 28632f5c575e1ddc0920041f72686758bf521103 Author: Eike Rathke Date: Fri Dec 8 15:59:53 2017 +0100 ofz#7121 NamedDBs::insert takes ownership of its argument at one point this was based on std::auto_ptr and didn't free its arg on failure Adapt description to reality Change-Id: I24133fb6c52bd7500037364120cb11d1b1f099c2 (cherry picked from commit f161cdc979587488df83e63002bee7ee15152d42) Change-Id: I8aeed6876d80b7ebe4ebb5e2cfd12e00420bd207 Reviewed-on: https://gerrit.libreoffice.org/51933 Reviewed-by: Stephan Bergmann Tested-by: Jenkins diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index e3aac010d433..7752693765a1 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -257,8 +257,13 @@ public: ScDBData* findByIndex(sal_uInt16 nIndex); ScDBData* findByUpperName(const OUString& rName); iterator findByUpperName2(const OUString& rName); -// Takes ownership of p iff it returns true: -SAL_WARN_UNUSED_RESULT bool insert(ScDBData* p); + +/** Takes ownership of p and attempts to insert it into the collection. +Deletes p if it could not be inserted, i.e. duplicate name. +@return if inserted, else . + */ +bool insert(ScDBData* p); + void erase(const iterator& itr); bool empty() const; size_t size() const; diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index e46cb5f68c44..b0de3278653c 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1558,8 +1558,6 @@ void Test::testSharedFormulaUpdateOnDBChange() // Define database range 'MyRange' for A1:A2. ScDBData* pData = new ScDBData("MyRange", 0, 0, 0, 0, 1); bool bInserted = pDBs->getNamedDBs().insert(pData); -if (!bInserted) -delete pData; CPPUNIT_ASSERT_MESSAGE("Failed to insert a new database range.", bInserted); // Insert in C2:C4 a group of formula cells that reference MyRange. @@ -1583,8 +1581,6 @@ void Test::testSharedFormulaUpdateOnDBChange() ScDBCollection aNewDBs(m_pDoc); ScDBData* pNewData = new ScDBData("MyRange", 0, 0, 0, 0, 3); bInserted = aNewDBs.getNamedDBs().insert(pNewData); -if (!bInserted) -delete pNewData; CPPUNIT_ASSERT_MESSAGE("Failed to insert a new database range.", bInserted); std::vector aDeleted; diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index c6d1dde218e3..1496c91bfa83 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -444,10 +444,7 @@ void SAL_CALL ScXMLDatabaseRangeContext::endFastElement( sal_Int32 /*nElement*/ if (pData.get()) { setAutoFilterFlags(*pDoc, *pData); -if (pDoc->GetDBCollection()->getNamedDBs().insert(pData.get())) -{ -pData.release(); -} +pDoc->GetDBCollection()->getNamedDBs().insert(pData.release()); } } } diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 02090556c614..d518ff17c03a 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -170,7 +170,6 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew ) bool bInserted = rDBs.insert(pNewData); if (!bInserted) // error -> restore old state { -delete pNewData; rDoc.SetDBCollection(pUndoColl); // belongs to the document then } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc
sc/inc/bitmaps.hlst |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9c014d51832cd86be1fb2267da62b8bd58985d94 Author: Markus Mohrhard Date: Fri Feb 23 02:19:47 2018 +0100 fix crash while trying to access icon set image file Change-Id: Iaad9b5aeb4163a5262bcaf0a414ee30fd9279a49 Reviewed-on: https://gerrit.libreoffice.org/50219 Reviewed-by: Markus Mohrhard Tested-by: Markus Mohrhard (cherry picked from commit fecc5d4a4423938de6d07dd57e6a98160bf91f3e) Reviewed-on: https://gerrit.libreoffice.org/50222 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/inc/bitmaps.hlst b/sc/inc/bitmaps.hlst index c87a47b000e7..254cd2db2d8e 100644 --- a/sc/inc/bitmaps.hlst +++ b/sc/inc/bitmaps.hlst @@ -96,7 +96,7 @@ #define BMP_ICON_SET_PIES_THREE_QUARTER "sc/res/icon-set-pies-three-quarters.png" #define BMP_ICON_SET_PIES_FULL "sc/res/icon-set-pies-full.png" #define BMP_ICON_SET_SHAPES_CIRCLE "sc/res/icon-set-shapes-circle.png" -#define BMP_ICON_SET_SHAPES_TRIANGLE "sc/res/icon-set-shapes-triangle" +#define BMP_ICON_SET_SHAPES_TRIANGLE "sc/res/icon-set-shapes-triangle.png" #define BMP_ICON_SET_SHAPES_DIAMOND "sc/res/icon-set-shapes-diamond.png" #define BMP_ICON_SET_SQUARES_EMPTY "sc/res/icon-set-squares-empty.png" #define BMP_ICON_SET_SQUARES_ONE_QUARTER "sc/res/icon-set-squares-one-quarter.png" ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc
sc/inc/table.hxx | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 2110c7260ef8f536e2d8517145b91a62b6c52b68 Author: Eike Rathke Date: Wed Feb 21 15:13:11 2018 +0100 Pass ScColumnsRange::Iterator as const& and use pre-increment/decrement This is a combination of 2 commits. Pass ScColumnsRange::Iterator as const& Specifically for each operator==() call two temporaries were copied, for operator!=() even twice as much.. in for(...:GetColumnsRange()) (cherry picked from commit 581b845509d20fa864b00088ed649f30fe4e1109) Conflicts: sc/inc/table.hxx Use iterator pre-increment/decrement (cherry picked from commit f599ff99ecb405e2934c8d4d472e54fd4064a26a) 079850116648dc69b8c92fa23b30233f63d9b6e7 Change-Id: I4b426ae855454544e50efca35aa73303138f7ba7 Reviewed-on: https://gerrit.libreoffice.org/50113 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 2ec2cd87e892..d6af98d394f0 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -130,17 +130,17 @@ class ScColumnsRange final { std::vector::const_iterator maColIter; public: -explicit Iterator(std::vector::const_iterator colIter) : maColIter(colIter) {} +explicit Iterator(const std::vector::const_iterator& colIter) : maColIter(colIter) {} -Iterator& operator++() { maColIter++; return *this;} -Iterator& operator--() { maColIter--; return *this;} +Iterator& operator++() { ++maColIter; return *this;} +Iterator& operator--() { --maColIter; return *this;} -bool operator==(Iterator other) const {return maColIter == other.maColIter;} -bool operator!=(Iterator other) const {return !(*this == other);} +bool operator==(const Iterator & rOther) const {return maColIter == rOther.maColIter;} +bool operator!=(const Iterator & rOther) const {return !(*this == rOther);} reference operator*() const {return (*maColIter)->GetCol();} }; -ScColumnsRange(Iterator nBegin, Iterator nEnd) : maBegin(nBegin), maEnd(nEnd) {} +ScColumnsRange(const Iterator & rBegin, const Iterator & rEnd) : maBegin(rBegin), maEnd(rEnd) {} const Iterator & begin() { return maBegin; } const Iterator & end() { return maEnd; } std::reverse_iterator rbegin() { return std::reverse_iterator(maEnd); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/document.hxx |5 - sc/source/core/data/documen2.cxx |7 +-- sc/source/core/tool/interpr7.cxx | 28 +++- sc/source/ui/unoobj/funcuno.cxx |2 +- 4 files changed, 37 insertions(+), 5 deletions(-) New commits: commit ac36e5b90787338c5ebdbd942ad3b12b6831af3f Author: Eike Rathke Date: Mon Feb 19 23:43:51 2018 +0100 Resolves: tdf#115710 let css::sheet::FunctionAccess execute WEBSERVICE ... independent of a LinkManager that is not present in the interim FunctionAccess document. FunctionAccess is executed by extensions, Add-Ons and macros that the user gave permission already. Change-Id: I9349a59ee24089c3657de7786b49e5e81946f175 (cherry picked from commit 121fda77b0cc16d54607a1f5f7b26c0f1050284f) Reviewed-on: https://gerrit.libreoffice.org/50019 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index d6cd6fd79987..9264a53292bc 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -242,7 +242,8 @@ enum ScDocumentMode { SCDOCMODE_DOCUMENT, SCDOCMODE_CLIP, -SCDOCMODE_UNDO +SCDOCMODE_UNDO, +SCDOCMODE_FUNCTIONACCESS }; enum CommentCaptionState @@ -474,6 +475,7 @@ private: boolbCalculatingFormulaTree; boolbIsClip; boolbIsUndo; +boolbIsFunctionAccess; boolbIsVisible; // set from view ctor boolbIsEmbedded;// display/adjust Embedded area? @@ -1423,6 +1425,7 @@ public: bool IsClipboard() const { return bIsClip; } bool IsUndoEnabled() const { return mbUndoEnabled; } SC_DLLPUBLIC void EnableUndo( bool bVal ); +boolIsFunctionAccess() const{ return bIsFunctionAccess; } bool IsAdjustHeightLocked() const { return nAdjustHeightLock != 0; } void LockAdjustHeight() { ++nAdjustHeightLock; } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index b52ca55ed836..49b3b0f4ab1e 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -183,12 +183,13 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : eHardRecalcState(HardRecalcState::OFF), nVisibleTab( 0 ), eLinkMode(LM_UNKNOWN), -bAutoCalc( eMode == SCDOCMODE_DOCUMENT ), +bAutoCalc( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS ), bAutoCalcShellDisabled( false ), bForcedFormulaPending( false ), bCalculatingFormulaTree( false ), bIsClip( eMode == SCDOCMODE_CLIP ), bIsUndo( eMode == SCDOCMODE_UNDO ), +bIsFunctionAccess( eMode == SCDOCMODE_FUNCTIONACCESS ), bIsVisible( false ), bIsEmbedded( false ), bInsertingFromOtherDoc( false ), @@ -228,7 +229,9 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : eSrcSet = osl_getThreadTextEncoding(); -if ( eMode == SCDOCMODE_DOCUMENT ) +/* TODO: for SCDOCMODE_FUNCTIONACCESS it might not even be necessary to + * have all of these available. */ +if ( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS ) { mxPoolHelper = new ScPoolHelper( this ); diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index 9bb77db8b577..274bb69e5243 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -256,6 +256,21 @@ static ScWebServiceLink* lcl_GetWebServiceLink(const sfx2::LinkManager* pLinkMgr return nullptr; } +static bool lcl_FunctionAccessLoadWebServiceLink( OUString& rResult, ScDocument* pDoc, const OUString& rURI ) +{ +// For FunctionAccess service always force a changed data update. +ScWebServiceLink aLink( pDoc, rURI); +if (aLink.DataChanged( OUString(), css::uno::Any()) != sfx2::SvBaseLink::UpdateResult::SUCCESS) +return false; + +if (!aLink.HasResult()) +return false; + +rResult = aLink.GetResult(); + +return true; +} + void ScInterpreter::ScWebservice() { sal_uInt8 nParamCount = GetByte(); @@ -279,7 +294,18 @@ void ScInterpreter::ScWebservice() if (!mpLinkManager) { -PushError(FormulaError::NoValue); +if (!pDok->IsFunctionAccess() || pDok->HasLinkFormulaNeedingCheck()) +{ +PushError( FormulaError::NoValue); +} +else +{ +OUString aResult; +if (lcl_FunctionAccessLoadWebServiceLink( aResult, pDok, aURI)) +PushString( aResult); +else +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/dbdata.hxx|1 + sc/source/ui/docshell/docsh5.cxx | 21 ++--- 2 files changed, 19 insertions(+), 3 deletions(-) New commits: commit 805f5d5b4ab022c531709d46b5dad10a1d772309 Author: Eike Rathke Date: Thu Feb 15 12:50:40 2018 +0100 Resolves: tdf#115046 don't restore a sheet-local DBData from temporary And don't clear AutoFilter button flags in the new temporary range. Change-Id: I273de1e04632ac99c267523b2843665d257fd361 (cherry picked from commit 74d30155c5067271fb98bacbcb895c215e61678d) Reviewed-on: https://gerrit.libreoffice.org/49809 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index 79fe9e82d428..e3aac010d433 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -122,6 +122,7 @@ public: const OUString& GetName() const { return aName; } const OUString& GetUpperName() const { return aUpper; } +SCTAB GetTab() const { return nTable; } voidGetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const; SC_DLLPUBLIC void GetArea(ScRange& rRange) const; voidSetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index dd39f53522d8..3f0ca7cd4576 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -222,8 +222,10 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe // other ranges, use the document global temporary anonymous range // instead. But, if AutoFilter is to be toggled then do use the // sheet-local DB range. +bool bSheetLocal = true; if (eMode != SC_DB_AUTOFILTER && pNoNameData->HasAutoFilter()) { +bSheetLocal = false; pNoNameData = aDocument.GetAnonymousDBData(); if (!pNoNameData) { @@ -231,14 +233,24 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe nTab, nStartCol, nStartRow, nEndCol, nEndRow, true, bHasHeader); aDocument.SetAnonymousDBData( pNoNameData); } +// ScDocShell::CancelAutoDBRange() would restore the +// sheet-local anonymous DBData from pOldAutoDBRange, unset so +// that won't happen with data of a previous sheet-local +// DBData. +delete pOldAutoDBRange; +pOldAutoDBRange = nullptr; } - -if ( !pOldAutoDBRange ) +else if (!pOldAutoDBRange) { // store the old unnamed database range with its settings for undo // (store at the first change, get the state before all changes) pOldAutoDBRange = new ScDBData( *pNoNameData ); } +else if (pOldAutoDBRange->GetTab() != pNoNameData->GetTab()) +{ +// Different sheet-local unnamed DB range than the previous one. +*pOldAutoDBRange = *pNoNameData; +} SCCOL nOldX1; // take old range away cleanly SCROW nOldY1; //! (UNDO ???) @@ -255,7 +267,10 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe nStartCol <= nOldY2 && nOldY1 <= nEndCol) bHasHeader = true; -DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2 ); +// Remove AutoFilter button flags only for sheet-local DB range, +// not if a temporary is used. +if (bSheetLocal) +DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2 ); pNoNameData->SetSortParam( ScSortParam() ); // reset parameter pNoNameData->SetQueryParam( ScQueryParam() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/stringutil.hxx |7 +++ sc/source/core/data/column3.cxx| 10 +++--- sc/source/core/tool/stringutil.cxx |3 ++- sc/source/filter/rtf/eeimpars.cxx |1 + 4 files changed, 17 insertions(+), 4 deletions(-) New commits: commit df72c65fdaf5f1276d1759ba3e7eec83eaaa2d20 Author: Eike Rathke Date: Tue Feb 13 17:10:21 2018 +0100 ScSetStringParam::mbCheckLinkFormula for HTML and RTF import This is a combination of 3 commits. Introduce ScSetStringParam::mbCheckLinkFormula (cherry picked from commit 5a93c51e3b7f455ff5d4cfc9e8b6e510fc126b75) Handle ScSetStringParam::mbCheckLinkFormula in ScColumn::ParseString() (cherry picked from commit 271d9ebfe0c4fc57ea6f01a9c048021e5429dd15) Conflicts: sc/source/core/data/column3.cxx ScSetStringParam::mbCheckLinkFormula for HTML and RTF import (cherry picked from commit 98c0bd7ffd008015623b2c5eb8630649394d76f6) d6b0705140baacdb872560f7031efaf0c03f0e00 7cf7cf12142322cbffd5160e9a8dce55efd36be5 Change-Id: I2028fc53f9778606778cd8629611752acd3f1a1c Reviewed-on: https://gerrit.libreoffice.org/49708 Tested-by: Jenkins Reviewed-by: Markus Mohrhard diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx index 005a99713f2f..a1ecbdd85c82 100644 --- a/sc/inc/stringutil.hxx +++ b/sc/inc/stringutil.hxx @@ -92,6 +92,13 @@ struct SAL_WARN_UNUSED SC_DLLPUBLIC ScSetStringParam sc::StartListeningType meStartListening; +/** When true and the string results in a compiled formula, check the +formula tokens for presence of functions that could trigger access to +external resources. This is to be set to true in import filter code, +but not for user input. + */ +bool mbCheckLinkFormula; + ScSetStringParam(); /** diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 397fe3310087..730003196151 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1722,11 +1722,15 @@ bool ScColumn::ParseString( rCell.set(rPool.intern(rString)); } else // = Formula -rCell.set( -new ScFormulaCell( +{ +ScFormulaCell* pFormulaCell = new ScFormulaCell( pDocument, ScAddress(nCol, nRow, nTabP), rString, formula::FormulaGrammar::mergeToGrammar(formula::FormulaGrammar::GRAM_DEFAULT, eConv), -ScMatrixMode::NONE)); +ScMatrixMode::NONE); +if (aParam.mbCheckLinkFormula) +pDocument->CheckLinkFormulaNeedingCheck( *pFormulaCell->GetCode()); +rCell.set( pFormulaCell); +} } else if ( cFirstChar == '\'') // 'Text { diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index 8ac5a3a6a0d0..8ba3fd0a94ff 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -30,7 +30,8 @@ ScSetStringParam::ScSetStringParam() : mbDetectNumberFormat(true), meSetTextNumFormat(Never), mbHandleApostrophe(true), -meStartListening(sc::SingleCellListening) +meStartListening(sc::SingleCellListening), +mbCheckLinkFormula(false) { } diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 0214a78240d6..a3af0cb868b7 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -341,6 +341,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu aParam.mbDetectNumberFormat = true; aParam.meSetTextNumFormat = ScSetStringParam::SpecialNumberOnly; aParam.mbHandleApostrophe = false; +aParam.mbCheckLinkFormula = true; if (!aValStr.isEmpty()) mpDoc->SetValue( nCol, nRow, nTab, fVal ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/document.hxx|2 ++ sc/source/core/data/documen8.cxx | 10 ++ sc/source/core/data/formulacell.cxx|3 +-- sc/source/filter/excel/excform.cxx |1 + sc/source/filter/excel/excform8.cxx|1 + sc/source/filter/excel/impop.cxx |1 + sc/source/filter/oox/formulabuffer.cxx |4 7 files changed, 20 insertions(+), 2 deletions(-) New commits: commit 540135c4aea282b441f6f3d41770d5f9d00c8245 Author: Eike Rathke Date: Wed Jan 17 22:22:55 2018 +0100 CheckLinkFormulaNeedingCheck() for .xls and .xlsx formula cells This is a combination of 3 commits. Move implementation to CheckLinkFormulaNeedingCheck() for further reuse (cherry picked from commit 55e484c7bcd3ef218e08d3fd93f97bf98fd8cb7f) CheckLinkFormulaNeedingCheck() for .xlsx cell formulas (cherry picked from commit f96dbc3dd9c33202f75e29ef49d962386595995d) CheckLinkFormulaNeedingCheck() for .xls cell formulas (cherry picked from commit 6bc48275558c3f76c4da25eb8af3c48583ac5599) a6dd195f7eb4d43483e87eeca59f651e7bf2dcb8 2587fbc4fec39b6f2c8e71815a2953dee308 Change-Id: I541d2b6e12a88371c064b901b00e71206ee0c18e Reviewed-on: https://gerrit.libreoffice.org/48137 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6bce61522184..d6cd6fd79987 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1994,6 +1994,8 @@ public: boolHasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck; } voidSetLinkFormulaNeedingCheck(bool bSet) { bLinkFormulaNeedingCheck = bSet; } +/** Check token array and set link check if ocDde/ocWebservice is contained. */ +SC_DLLPUBLIC void CheckLinkFormulaNeedingCheck( const ScTokenArray& rCode ); voidSetRangeOverflowType(ErrCode nType) { nRangeOverflowType = nType; } boolHasRangeOverflow() const { return nRangeOverflowType != ERRCODE_NONE; } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 9f637eb53046..4a2b7b5a9f99 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -87,6 +87,7 @@ #include #include #include +#include #include #include @@ -1175,6 +1176,15 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, } } +void ScDocument::CheckLinkFormulaNeedingCheck( const ScTokenArray& rCode ) +{ +if (HasLinkFormulaNeedingCheck()) +return; + +if (rCode.HasOpCodeRPN(ocDde) || rCode.HasOpCodeRPN(ocWebservice)) +SetLinkFormulaNeedingCheck(true); +} + // TimerDelays etc. void ScDocument::KeyInput() { diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index e7e4d09f5a47..5b8e6d1d36e9 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1360,8 +1360,7 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr // After loading, it must be known if ocDde/ocWebservice is in any formula // (for external links warning, CompileXML is called at the end of loading XML file) -if (!pDocument->HasLinkFormulaNeedingCheck() && (pCode->HasOpCodeRPN(ocDde) || pCode->HasOpCodeRPN(ocWebservice))) -pDocument->SetLinkFormulaNeedingCheck(true); +pDocument->CheckLinkFormulaNeedingCheck(*pCode); //volatile cells must be added here for import if( pCode->IsRecalcModeAlways() || pCode->IsRecalcModeForced() || diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 2a74af0c7463..8ef1555660f5 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -157,6 +157,7 @@ void ImportExcel::Formula( { pCell = new ScFormulaCell(&rDoc.getDoc(), aScPos, *pResult); pCell->GetCode()->WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8); +rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode()); rDoc.getDoc().EnsureTable(aScPos.Tab()); rDoc.setFormulaCell(aScPos, pCell); SetLastFormula(aScPos.Col(), aScPos.Row(), fCurVal, nXF, pCell); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index b441f729c4c1..1a95d3f01b16 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -730,6 +730,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, << nMerk0 << ocClose; aPool >> aStack; pExtName->CreateDdeData( GetDoc(), aApplic, aTopic ); +GetDoc().SetLinkFormulaNeedingCheck(true); } }
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/Library_sc.mk sc/source
sc/Library_sc.mk |1 sc/inc/document.hxx |2 sc/inc/documentlinkmgr.hxx|6 - sc/source/core/data/formulacell.cxx |4 - sc/source/core/inc/webservicelink.hxx | 49 + sc/source/core/tool/interpr7.cxx | 105 - sc/source/core/tool/webservicelink.cxx| 106 ++ sc/source/ui/docshell/docsh4.cxx |2 sc/source/ui/docshell/documentlinkmgr.cxx | 20 - sc/source/ui/view/tabvwsh4.cxx|2 10 files changed, 252 insertions(+), 45 deletions(-) New commits: commit 462113d4f712c5acf18ecfb0be6a86aa891d7b97 Author: Caolán McNamara Date: Thu Jan 11 20:43:28 2018 + handle ocWebservice similarly to ocDde might have too much in here seeing as we don't need to worry about ocWebservice calling into itself Change-Id: I0145f38cc1c1f9ff514a496f7101d81cde9e7c67 Reviewed-on: https://gerrit.libreoffice.org/47816 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 890cafe689c2..9e1432c0a8c3 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -277,6 +277,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/core/tool/unitconv \ sc/source/core/tool/userlist \ sc/source/core/tool/viewopti \ +sc/source/core/tool/webservicelink \ sc/source/core/tool/zforauto \ sc/source/filter/xml/datastreamimport \ sc/source/filter/xml/XMLCalculationSettingsContext \ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 4b419fa9f4ef..6bce61522184 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -501,7 +501,7 @@ private: // for detective update, is set for each change of a formula boolbDetectiveDirty; -boolbLinkFormulaNeedingCheck; // valid only after loading, for ocDde +boolbLinkFormulaNeedingCheck; // valid only after loading, for ocDde and ocWebservice CharCompressTypenAsianCompression; sal_uInt8 nAsianKerning; diff --git a/sc/inc/documentlinkmgr.hxx b/sc/inc/documentlinkmgr.hxx index d5d801a4aeb2..86dba66f2d3d 100644 --- a/sc/inc/documentlinkmgr.hxx +++ b/sc/inc/documentlinkmgr.hxx @@ -55,9 +55,9 @@ public: bool idleCheckLinks(); bool hasDdeLinks() const; -bool hasDdeOrOleLinks() const; +bool hasDdeOrOleOrWebServiceLinks() const; -bool updateDdeOrOleLinks(vcl::Window* pWin); +bool updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin); void updateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem ); @@ -65,7 +65,7 @@ public: void disconnectDdeLinks(); private: -bool hasDdeOrOleLinks(bool bDde, bool bOle) const; +bool hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, bool bWebService) const; }; } diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 8af5c6bc4028..e7e4d09f5a47 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1358,9 +1358,9 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr bChanged = true; } -// After loading, it must be known if ocDde is in any formula +// After loading, it must be known if ocDde/ocWebservice is in any formula // (for external links warning, CompileXML is called at the end of loading XML file) -if (!pDocument->HasLinkFormulaNeedingCheck() && pCode->HasOpCodeRPN(ocDde)) +if (!pDocument->HasLinkFormulaNeedingCheck() && (pCode->HasOpCodeRPN(ocDde) || pCode->HasOpCodeRPN(ocWebservice))) pDocument->SetLinkFormulaNeedingCheck(true); //volatile cells must be added here for import diff --git a/sc/source/core/inc/webservicelink.hxx b/sc/source/core/inc/webservicelink.hxx new file mode 100644 index ..e61ebfdb4347 --- /dev/null +++ b/sc/source/core/inc/webservicelink.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SC_SOURCE_CORE_INC_WEBSERVICE_HXX +#define INCLUDED_SC_SOURCE_CORE_INC_WEBSERVICE_HXX + +#include +#include +#include +#include + +class ScDocument; + +class ScWebServiceLink : public ::sfx2::SvBaseLink, public SvtBroadcaster +{ +private: +ScDocument* pDoc; +OUString aURL; // connection/ link data +bool bHasResult; // is set aResult is useful +OUString aResult; + +public: +ScWebServiceLink(ScDocument* pD, const OUString& rURL); +virtual ~ScWebServiceLink() override; + +// SvBaseLink override: +v
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/qa sc/source
sc/inc/document.hxx |6 +++--- sc/qa/unit/ucalc.cxx|2 +- sc/source/core/data/documen2.cxx|2 +- sc/source/core/data/formulacell.cxx |8 sc/source/core/tool/interpr2.cxx|8 +++- sc/source/ui/docshell/docsh4.cxx|2 ++ sc/source/ui/view/tabvwsh4.cxx |2 +- 7 files changed, 19 insertions(+), 11 deletions(-) New commits: commit 8c2361ec6815e8ab37858c347405b96cd5771b12 Author: Caolán McNamara Date: Thu Jan 11 14:16:15 2018 + Better handle ScDde formulas with missing dde-link entries typically each ScDde formula has a matching table:dde-link which results in a ScDdeLink getting inserted during the load. If that dde-link is missing then no ScDdeLink exists and ScDde() will create a new one without cached content. So detect that ScDde is used in the freshing loaded ods and defer fetching new content until the right time. only call GetHasMacroFunc to set SetHasMacroFunc and bHasMacroFunc is not accessed any other way, so this is an oxbow Change-Id: I016b53288076d83dd49e92e245346a5f7f560522 Reviewed-on: https://gerrit.libreoffice.org/47757 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit b0597ba5d745974fce752e1b677451a19350d351) Reviewed-on: https://gerrit.libreoffice.org/47815 Reviewed-by: Eike Rathke diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 321f4ebbc8e3..4b419fa9f4ef 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -501,7 +501,7 @@ private: // for detective update, is set for each change of a formula boolbDetectiveDirty; -boolbHasMacroFunc; // valid only after loading +boolbLinkFormulaNeedingCheck; // valid only after loading, for ocDde CharCompressTypenAsianCompression; sal_uInt8 nAsianKerning; @@ -1992,8 +1992,8 @@ public: boolIsDetectiveDirty() const { return bDetectiveDirty; } voidSetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; } -boolGetHasMacroFunc() const { return bHasMacroFunc; } -voidSetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; } +boolHasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck; } +voidSetLinkFormulaNeedingCheck(bool bSet) { bLinkFormulaNeedingCheck = bSet; } voidSetRangeOverflowType(ErrCode nType) { nRangeOverflowType = nType; } boolHasRangeOverflow() const { return nRangeOverflowType != ERRCODE_NONE; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f03bb90fd470..6318ab6c71b8 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -6548,7 +6548,7 @@ void Test::testEmptyCalcDocDefaults() CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IdleCalcTextWidth() ); CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsIdleEnabled() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsDetectiveDirty() ); -CPPUNIT_ASSERT_EQUAL( false, m_pDoc->GetHasMacroFunc() ); +CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasLinkFormulaNeedingCheck() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsChartListenerCollectionNeedsUpdate() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasRangeOverflow() ); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index f2e0c7d35b67..b52ca55ed836 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -203,7 +203,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : bInDtorClear( false ), bExpandRefs( false ), bDetectiveDirty( false ), -bHasMacroFunc( false ), +bLinkFormulaNeedingCheck( false ), nAsianCompression(CharCompressType::Invalid), nAsianKerning(SC_ASIANKERNING_INVALID), bPastingDrawFromOtherDoc( false ), diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 1068f25ff5b2..8af5c6bc4028 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1358,10 +1358,10 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr bChanged = true; } -// Same as in Load: after loading, it must be known if ocMacro is in any formula -// (for macro warning, CompileXML is called at the end of loading XML file) -if ( !pDocument->GetHasMacroFunc() && pCode->HasOpCodeRPN( ocMacro ) ) -pDocument->SetHasMacroFunc( true ); +// After loading, it must be known if ocDde is in any formula +// (for external links warning, CompileXML is called at the end of loading XML file) +if (!pDocument->HasLinkFormulaNeedingCheck() && pCode->HasOpCodeRPN(ocDde)) +pDocument->SetLinkFormulaNeedingCheck(true); //volatile ce
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/table.hxx|2 +- sc/source/core/data/dociter.cxx |3 ++- sc/source/core/data/table3.cxx | 25 - 3 files changed, 19 insertions(+), 11 deletions(-) New commits: commit 7a4bbce22fff8155825447eb0e28c5b09d659fcc Author: Dennis Francis Date: Fri Dec 15 13:04:18 2017 +0530 tdf#114479 : Use the SvNumberFormatter from ScInterpreterContext This fixes one of the crash mentioned in the bug report, during loading of the bug document. The crash being the assert failure in ScDocument::GetFormatTable(). Change-Id: Iffb8ede1416f34f0cd9852fa3f8d1f199406c013 Reviewed-on: https://gerrit.libreoffice.org/46549 Tested-by: Jenkins Reviewed-by: Michael Meeks (cherry picked from commit ced2f083483e2d60c077177b8a359d310e0976c3) Reviewed-on: https://gerrit.libreoffice.org/46792 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 3721e2226a5a..2ec2cd87e892 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -924,7 +924,7 @@ public: bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, const ScRefCellValue* pCell = nullptr, -bool* pbTestEqualCondition = nullptr); +bool* pbTestEqualCondition = nullptr, const ScInterpreterContext* pContext = nullptr); voidTopTenQuery( ScQueryParam& ); SCSIZE Query(const ScQueryParam& rQueryParam, bool bKeepSub); boolCreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 02e7b776ceef..13abb17a9fc4 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1184,7 +1184,8 @@ bool ScQueryCellIterator::GetThis() bool bTestEqualCondition = false; if ( pDoc->maTabs[nTab]->ValidQuery( nRow, *mpParam, (nCol == static_cast(nFirstQueryField) ? &aCell : nullptr), -(nTestEqualCondition ? &bTestEqualCondition : nullptr) ) ) +(nTestEqualCondition ? &bTestEqualCondition : nullptr), +&mrContext) ) { if ( nTestEqualCondition && bTestEqualCondition ) nTestEqualCondition |= nTestEqualConditionMatched; diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index a562093cfdd6..b973dd8fd6bc 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2362,7 +2362,8 @@ public: std::pair compareByValue( const ScRefCellValue& rCell, SCCOL nCol, SCROW nRow, -const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem) +const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, +const ScInterpreterContext* pContext = nullptr) { bool bOk = false; bool bTestEqual = false; @@ -2393,8 +2394,10 @@ public: * stripped here. */ if (rItem.meType == ScQueryEntry::ByDate) { -sal_uInt32 nNumFmt = mrTab.GetNumberFormat(nCol, nRow); -const SvNumberformat* pEntry = mrDoc.GetFormatTable()->GetEntry(nNumFmt); +sal_uInt32 nNumFmt = pContext ? mrTab.GetNumberFormat(*pContext, ScAddress(nCol, nRow, mrTab.GetTab())) : +mrTab.GetNumberFormat(nCol, nRow); +SvNumberFormatter* pFormatter = pContext ? pContext->mpFormatter : mrDoc.GetFormatTable(); +const SvNumberformat* pEntry = pFormatter->GetEntry(nNumFmt); if (pEntry) { short nNumFmtType = pEntry->GetType(); @@ -2447,7 +2450,8 @@ public: } std::pair compareByString( -ScRefCellValue& rCell, SCROW nRow, const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem) +ScRefCellValue& rCell, SCROW nRow, const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, +const ScInterpreterContext* pContext = nullptr) { bool bOk = false; bool bTestEqual = false; @@ -2468,9 +2472,11 @@ public: aCellStr = *rCell.mpString; else { -sal_uInt32 nFormat = mrTab.GetNumberFormat( static_cast(rEntry.nField), nRow ); +sal_uInt32 nFormat = pContext ? mrTab.GetNumberFormat( *pContext, ScAddress(static_cast(rEntry.nField), nRow, mrTab.GetTab()) ) : +mrTab.GetNumberFormat( static_cast(rEntry.nField), nRow ); OUString aStr; -ScCellFormat::GetInputString(rCell, nFormat, aStr, *mrDoc.GetFormatTable(), &mrDoc); +SvNumberFormatter* pFormatter = pContext ? pContext->mpFormatter : mrDoc.GetFormatTable(); +ScCellFormat::GetInputString(rCell, nFormat, aStr, *pFormatter, &mrDoc); aCellStr = mrStrPool.intern(aStr); } } @@ -2678,7 +2684,8 @@ public: } bool ScTable::ValidQuery( -SCROW nRow, const ScQueryParam& r
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/formulacell.hxx |1 + sc/source/core/data/formulacell.cxx | 12 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) New commits: commit 14ce530d467a21d2d7fdae5272c5cc4b83104bdc Author: Eike Rathke Date: Sat Dec 16 15:04:19 2017 +0100 Do not recalculate the same weight over and over again, tdf#114251 related Remember it at the group so if for some reason the group is not calculated as group then the individual cells of the group don't iterate over the RPN again to calculate the same value. This does not solve tdf#114251 in any way, just side-cars. Change-Id: Ia26d4a7fe608d8aaa30686ce95c1caa25da02469 Reviewed-on: https://gerrit.libreoffice.org/46601 Reviewed-by: Eike Rathke Tested-by: Eike Rathke (cherry picked from commit da81ec6862490a87bc240edb81c0a9b5fd04a1b3) Reviewed-on: https://gerrit.libreoffice.org/46612 Tested-by: Jenkins diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index e75416de8e56..09d26b232950 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -65,6 +65,7 @@ public: ScTokenArray* mpCode; ScFormulaCell *mpTopCell; SCROW mnLength; // How many of these do we have ? +sal_Int32 mnWeight; short mnFormatType; bool mbInvariant:1; bool mbSubTotal:1; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 989919b2886b..1068f25ff5b2 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -523,6 +523,7 @@ ScFormulaCellGroup::ScFormulaCellGroup() : mpCode(nullptr), mpTopCell(nullptr), mnLength(0), +mnWeight(0), mnFormatType(css::util::NumberFormat::NUMBER), mbInvariant(false), mbSubTotal(false), @@ -3875,6 +3876,7 @@ void ScFormulaCell::SetCellGroup( const ScFormulaCellGroupRef &xRef ) mxGroup = xRef; pCode = mxGroup->mpCode; +mxGroup->mnWeight = 0; // invalidate } ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( const ScFormulaCell& rOther ) const @@ -4919,12 +4921,18 @@ sal_Int32 ScFormulaCell::GetWeight() const { if (!mxGroup) return 1; + +if (mxGroup->mnWeight > 0) +return mxGroup->mnWeight; + double nSharedCodeWeight = GetSharedCode()->GetWeight(); double nResult = nSharedCodeWeight * GetSharedLength(); if (nResult < SAL_MAX_INT32) -return nResult; +mxGroup->mnWeight = nResult; else -return SAL_MAX_INT32; +mxGroup->mnWeight = SAL_MAX_INT32; + +return mxGroup->mnWeight; } ScTokenArray* ScFormulaCell::GetSharedCode() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source
sc/inc/rangelst.hxx |2 +- sc/source/core/tool/rangelst.cxx | 12 +++- sc/source/filter/excel/xecontent.cxx |2 +- 3 files changed, 9 insertions(+), 7 deletions(-) New commits: commit 9e0ab4e19dc47953fe5ddff4b0af83b652d4f09b Author: Markus Mohrhard Date: Fri Dec 15 00:14:45 2017 +0100 tdf#113621: don't write whole column refs for conditional format ranges Change-Id: I6b21345fb08cc7b7cf0cdc40532d480a8d5f72ae Reviewed-on: https://gerrit.libreoffice.org/46493 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit 2194105a38631e1c5c074634bc5b084cd2f8661f) Reviewed-on: https://gerrit.libreoffice.org/46496 Reviewed-by: Eike Rathke diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index 932a5ed52d6d..01e67ee49e55 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -45,7 +45,7 @@ public: voidFormat( OUString&, ScRefFlags nFlags, ScDocument* = nullptr, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, -sal_Unicode cDelimiter = 0 ) const; +sal_Unicode cDelimiter = 0, bool bFullAddressNotation = false ) const; voidJoin( const ScRange&, bool bIsInList = false ); diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 8f976819bd5b..ae9ebd2b5d67 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -110,17 +110,18 @@ private: class FormatString { public: -FormatString(OUString& rStr, ScRefFlags nFlags, ScDocument* pDoc, FormulaGrammar::AddressConvention eConv, sal_Unicode cDelim) : +FormatString(OUString& rStr, ScRefFlags nFlags, ScDocument* pDoc, FormulaGrammar::AddressConvention eConv, sal_Unicode cDelim, bool bFullAddressNotation) : mrStr(rStr), mnFlags(nFlags), mpDoc(pDoc), meConv(eConv), mcDelim(cDelim), -mbFirst(true) {} +mbFirst(true), +mbFullAddressNotation(bFullAddressNotation) {} void operator() (const ScRange* p) { -OUString aStr(p->Format(mnFlags, mpDoc, meConv)); +OUString aStr(p->Format(mnFlags, mpDoc, meConv, mbFullAddressNotation)); if (mbFirst) mbFirst = false; else @@ -134,6 +135,7 @@ private: FormulaGrammar::AddressConvention meConv; sal_Unicode mcDelim; bool mbFirst; +bool mbFullAddressNotation; }; } @@ -186,14 +188,14 @@ ScRefFlags ScRangeList::Parse( const OUString& rStr, const ScDocument* pDoc, void ScRangeList::Format( OUString& rStr, ScRefFlags nFlags, ScDocument* pDoc, formula::FormulaGrammar::AddressConvention eConv, - sal_Unicode cDelimiter ) const + sal_Unicode cDelimiter, bool bFullAddressNotation ) const { if (!cDelimiter) cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep); OUString aStr; -FormatString func(aStr, nFlags, pDoc, eConv, cDelimiter); +FormatString func(aStr, nFlags, pDoc, eConv, cDelimiter, bFullAddressNotation); for_each(maRanges.begin(), maRanges.end(), func); rStr = aStr; } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 3164164c2cef..d8584e908bd1 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1269,7 +1269,7 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat else if(pFormatEntry->GetType() == condformat::DATE) maCFList.AppendNewRecord( new XclExpDateFormat( GetRoot(), static_cast(*pFormatEntry), ++rIndex ) ); } -aScRanges.Format( msSeqRef, ScRefFlags::VALID, nullptr, formula::FormulaGrammar::CONV_XL_OOX, ' ' ); +aScRanges.Format( msSeqRef, ScRefFlags::VALID, nullptr, formula::FormulaGrammar::CONV_XL_OOX, ' ', true ); if(!aExtEntries.empty() && xExtLst.get()) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/qa sc/source
sc/inc/calcconfig.hxx|1 sc/inc/tokenarray.hxx|9 +-- sc/inc/types.hxx |1 sc/qa/unit/parallelism.cxx | 34 ++ sc/source/core/data/formulacell.cxx | 10 ++- sc/source/core/tool/calcconfig.cxx | 16 sc/source/core/tool/formulagroup.cxx |2 - sc/source/core/tool/token.cxx| 45 +-- 8 files changed, 100 insertions(+), 18 deletions(-) New commits: commit 8807e568326679831869329aabf4f941be39f2ab Author: Dennis Francis Date: Thu Nov 30 14:36:24 2017 +0530 Do not use threading for formula group if... ...there is at least one opcode in the token array that is in the blacklist set of opcodes for threading. Cleaned up the logic by removing FormulaVectorEnabledForThreading from ScFormulaVectorState enum and created two separate boolean fields in ScTokenArray to keep track of whether OpenCL or threading could be used. Change-Id: Ieca0004b33a3cfea6ca5c0ff90bc8cea8746d102 Reviewed-on: https://gerrit.libreoffice.org/45564 Reviewed-by: Michael Meeks Tested-by: Michael Meeks Tested-by: Jenkins (cherry picked from commit 330b1b5bcec06e3a8d35413ff921fa219bc0a8dc) Reviewed-on: https://gerrit.libreoffice.org/46318 diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx index eaf4f36f143b..77b16ab92162 100644 --- a/sc/inc/calcconfig.hxx +++ b/sc/inc/calcconfig.hxx @@ -49,6 +49,7 @@ struct SC_DLLPUBLIC ScCalcConfig bool mbHasStringRefSyntax:1; static bool isOpenCLEnabled(); +static bool isThreadingEnabled(); static bool isSwInterpreterEnabled(); bool mbOpenCLSubsetOnly:1; diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index 8b352b447f09..c054f11d0964 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -51,7 +51,9 @@ class SC_DLLPUBLIC ScTokenArray : public formula::FormulaTokenArray bool ImplGetReference( ScRange& rRange, const ScAddress& rPos, bool bValidOnly ) const; size_t mnHashValue; -ScFormulaVectorState meVectorState; +ScFormulaVectorState meVectorState : 4; // Only 4 bits +bool mbOpenCLEnabled : 1; +bool mbThreadingEnabled : 1; public: ScTokenArray(); @@ -66,7 +68,7 @@ public: size_t GetHash() const { return mnHashValue;} ScFormulaVectorState GetVectorState() const { return meVectorState;} -void ResetVectorState() { meVectorState = FormulaVectorEnabled; } +void ResetVectorState(); bool IsFormulaVectorDisabled() const; /** @@ -259,6 +261,9 @@ public: sal_Int32 GetWeight() const; +bool IsEnabledForOpenCL() const { return mbOpenCLEnabled; } +bool IsEnabledForThreading() const { return !mbOpenCLEnabled && mbThreadingEnabled; } + #if DEBUG_FORMULA_COMPILER void Dump() const; #endif diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx index cc82e363765d..51898c291fde 100644 --- a/sc/inc/types.hxx +++ b/sc/inc/types.hxx @@ -59,7 +59,6 @@ enum ScFormulaVectorState FormulaVectorEnabled, FormulaVectorCheckReference, -FormulaVectorEnabledForThreading, FormulaVectorUnknown }; diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx index e3bb00502ea8..428d65a20bec 100644 --- a/sc/qa/unit/parallelism.cxx +++ b/sc/qa/unit/parallelism.cxx @@ -45,11 +45,13 @@ public: void testSUMIFS(); void testDivision(); void testVLOOKUP(); +void testVLOOKUPSUM(); CPPUNIT_TEST_SUITE(ScParallelismTest); CPPUNIT_TEST(testSUMIFS); CPPUNIT_TEST(testDivision); CPPUNIT_TEST(testVLOOKUP); +CPPUNIT_TEST(testVLOOKUPSUM); CPPUNIT_TEST_SUITE_END(); private: @@ -262,6 +264,38 @@ void ScParallelismTest::testVLOOKUP() m_pDoc->DeleteTab(0); } +void ScParallelismTest::testVLOOKUPSUM() +{ +m_pDoc->InsertTab(0, "1"); + +const size_t nNumRows = 4096*4; +OUString aTableRef = "$A$1:$B$" + OUString::number(nNumRows); +for (size_t i = 0; i < nNumRows; ++i) +{ +m_pDoc->SetValue(0, i, 0, static_cast(i)); +m_pDoc->SetValue(1, i, 0, static_cast(5*i + 100)); +m_pDoc->SetValue(2, i, 0, static_cast(nNumRows - i - 1)); +} +for (size_t i = 0; i < nNumRows; ++i) +{ +OUString aArgNum = "C" + OUString::number(i+1); +m_pDoc->SetFormula(ScAddress(3, i, 0), + "=SUM(" + aArgNum + ";VLOOKUP(" + aArgNum + ";" + aTableRef + "; 2; 0)) + SUM($A1:$A2)", + formula::FormulaGrammar::GRAM_NATIVE_UI); +} + +m_xDocShell->DoHardRecalc(); + +size_t nArg; +for (size_t i = 0; i < nNumRows; ++i) +{ +OString aMsg = "At row " + OString::number(i); +nArg = nNumRows - i - 1; +CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), 6*nArg + 101, static_cast(m_pDoc->GetValue(3, i, 0))); +} +m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScParall
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc sc/source sc/uiconfig
sc/inc/strings.hrc |2 + sc/source/ui/dialogs/searchresults.cxx | 45 + sc/source/ui/inc/searchresults.hxx |4 ++ sc/uiconfig/scalc/ui/searchresults.ui | 25 +- 4 files changed, 42 insertions(+), 34 deletions(-) New commits: commit ad4abd949de51cd66288bdb4f884cc5ab2b6a59a Author: heiko tietze Date: Sat Nov 25 12:35:59 2017 +0100 tdf#113831 Show number of search results Skipped label used to show the number via resource strings Change-Id: I6f57799565126c202041d0bf6a9f361d4e64cdfd Reviewed-on: https://gerrit.libreoffice.org/45269 Tested-by: Jenkins Reviewed-by: Michael Meeks (cherry picked from commit 470682b3abf0622f5e9663d62d8641f63ceb6f30) Reviewed-on: https://gerrit.libreoffice.org/45320 Reviewed-by: Heiko Tietze Tested-by: Heiko Tietze diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index e82b9d1f5362..a29c93b54a7c 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -47,6 +47,8 @@ #define SCSTR_NO_TAB_BG_COLOR NC_("SCSTR_NO_TAB_BG_COLOR", "Default") #define SCSTR_RENAMEOBJECT NC_("SCSTR_RENAMEOBJECT", "Name Object") #define STR_INSERTGRAPHIC NC_("STR_INSERTGRAPHIC", "Insert Image") +#define SCSTR_TOTAL NC_("SCSTR_TOTAL", "%1 results found") +#define SCSTR_SKIPPED NC_("SCSTR_SKIPPED", "(only %1 are listed)") // Attribute #define SCSTR_PROTECTDOCNC_("SCSTR_PROTECTDOC", "Protect Document") #define SCSTR_UNPROTECTDOC NC_("SCSTR_UNPROTECTDOC", "Unprotect document") diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx index d9cf33f1a4be..f72bb7423388 100644 --- a/sc/source/ui/dialogs/searchresults.cxx +++ b/sc/source/ui/dialogs/searchresults.cxx @@ -25,9 +25,11 @@ namespace sc { SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, vcl::Window* pParent ) : ModelessDialog(pParent, "SearchResultsDialog", "modules/scalc/ui/searchresults.ui"), +aSkipped( ScResId( SCSTR_SKIPPED ) ), +aTotal( ScResId( SCSTR_TOTAL ) ), mpBindings(_pBindings), mpDoc(nullptr) { -get(mpLabel, "skipped"); +get(mpSearchResults, "lbSearchResults"); SvSimpleTableContainer *pContainer = get("results"); Size aControlSize(150, 120); @@ -50,23 +52,19 @@ SearchResultsDlg::~SearchResultsDlg() void SearchResultsDlg::dispose() { mpList.disposeAndClear(); -mpLabel.disposeAndClear(); +mpSearchResults.disposeAndClear(); ModelessDialog::dispose(); } namespace { class ListWrapper { -size_t mnCount; -static const size_t mnMaximum = 1000; OUStringBuffer maName; -VclPtr mpLabel; VclPtr mpList; public: -ListWrapper(const VclPtr &pList, -const VclPtr &pLabel) : -mnCount(0), -mpLabel(pLabel), +size_t mnCount = 0; +static const size_t mnMaximum = 1000; +ListWrapper(const VclPtr &pList) : mpList(pList) { mpList->Clear(); @@ -88,33 +86,19 @@ namespace mpList->InsertEntry(maName.makeStringAndClear()); } } -void Update() -{ -if (mnCount > mnMaximum) -{ -if (mpLabel) -{ -size_t nSkipped = mnCount - mnMaximum; -OUString aSkipped(mpLabel->GetText()); -mpList->InsertEntry( -aSkipped.replaceFirst("$1", OUString::number(nSkipped))); -} -} -mpList->SetUpdateMode(true); -} }; } void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatchedRanges, bool bCellNotes ) { -ListWrapper aList(mpList, mpLabel); +ListWrapper aList(mpList); std::vector aTabNames = pDoc->GetAllTableNames(); SCTAB nTabCount = aTabNames.size(); // tdf#92160 - too many results blow the widget's mind size_t nMatchMax = rMatchedRanges.size(); -if (nMatchMax > 1000) -nMatchMax = 1000; +if (nMatchMax > ListWrapper::mnMaximum) +nMatchMax = ListWrapper::mnMaximum; if (bCellNotes) { @@ -163,7 +147,14 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche } } } -aList.Update(); + +OUString aSearchResults = ScGlobal::ReplaceOrAppend( aTotal, "%1", OUString::number( aList.mnCount ) ); +if (aList.mnCount > ListWrapper::mnMaximum) +aSearchResults += " " + ScGlobal::ReplaceOrAppend( aSkipped, "%1", OUString::number( ListWrapper::mnMaximum ) ); +mpSearchResults->SetText(aSearchResults); + +mpList->SetUpdateMode(true); + mpDoc = pDoc; } diff --git a/sc/source/ui
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc
sc/inc/scfuncs.hrc |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 18c0623c6c5526f8d7cba164b34dec7af870412d Author: Eike Rathke Date: Tue Nov 28 10:47:55 2017 +0100 Fix typos Change-Id: I01f0ca82f1350b74ea2d3205948c032918049c02 (cherry picked from commit e0b60b182394dbe075185e9c07843d2beacaa6b1) Reviewed-on: https://gerrit.libreoffice.org/45397 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/sc/inc/scfuncs.hrc b/sc/inc/scfuncs.hrc index 0d3999899ee8..c0cd8abb3a3e 100644 --- a/sc/inc/scfuncs.hrc +++ b/sc/inc/scfuncs.hrc @@ -3415,13 +3415,13 @@ const char* SC_OPCODE_LOOKUP_ARY[] = // -=*# Resource for function MATCH #*=- const char* SC_OPCODE_MATCH_ARY[] = { -NC_("SC_OPCODE_MATCH", "Defines a position in a array after comparing values."), +NC_("SC_OPCODE_MATCH", "Defines a position in an array after comparing values."), NC_("SC_OPCODE_MATCH", "Search criterion"), NC_("SC_OPCODE_MATCH", "The value to be used for comparison."), NC_("SC_OPCODE_MATCH", "Lookup array"), NC_("SC_OPCODE_MATCH", "The array (range) in which the search is made."), NC_("SC_OPCODE_MATCH", "Type"), -NC_("SC_OPCODE_MATCH", "Type can take the value 1, 0 or -1 and determines the criteria are to be used for comparison purposes.") +NC_("SC_OPCODE_MATCH", "Type can take the value 1, 0 or -1 and determines the criteria to be used for comparison purposes.") }; // -=*# Resource for function OFFSET #*=- ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits