core.git: sc/source
sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |4 1 file changed, 4 insertions(+) New commits: commit 4d2c41e8171139e210d94b0c3c2b6b3d6392665a Author: Michael Weghorn AuthorDate: Thu May 23 12:57:46 2024 +0200 Commit: Michael Weghorn CommitDate: Sat May 25 09:02:38 2024 +0200 related tdf#158914 sc a11y: Release references when disposing sheet Clear all `ScAccessibleCell` references that are owned by `ScAccessibleSpreadsheet` when disposing the sheet instead of when the sheet is deleted. While `ScAccessibleSpreadsheet::disposing` is always called, `ScAccessibleSpreadsheet::~ScAccessibleSpreadsheet` is not called until all of the sheet's `ScAccessibleCell` instances have been deleted. So make sure that `ScAccessibleSpreadsheet::disposing` releases all `ScAccessibleCell` references. This might possibly reduce some of the leaks mentioned in [1]. [1] https://gerrit.libreoffice.org/c/core/+/167961/comments/15a6a4e4_91a77291 Change-Id: Iaf14338945c1899d54c8e7f8a16f38a48316ac98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167985 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index fdeea8d7579a..7296863d0cee 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -310,7 +310,11 @@ void SAL_CALL ScAccessibleSpreadsheet::disposing() mpViewShell->RemoveAccessibilityObject(*this); mpViewShell = nullptr; } + mpAccCell.clear(); +m_mapSelectionSend.clear(); +m_mapFormulaSelectionSend.clear(); +m_pAccFormulaCell.clear(); ScAccessibleTableBase::disposing(); }
core.git: sc/source
sc/source/filter/excel/xlroot.cxx |5 - sc/source/filter/inc/xlroot.hxx |2 +- 2 files changed, 1 insertion(+), 6 deletions(-) New commits: commit 137f423cc18e23f64b3b2bc6075c5f1581ac6537 Author: Noel Grandin AuthorDate: Wed May 22 16:40:31 2024 +0200 Commit: Noel Grandin CommitDate: Fri May 24 20:11:12 2024 +0200 tdf#161210 speedup loading large XLS (2) shave 2% off time by inlining GetDoc which is quite hot Change-Id: I20ede177e6032761598b1b977e90ff969bd2162a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168012 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 836c08b3f5e4..593a4d1583da 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -286,11 +286,6 @@ rtl::Reference XclRoot::OpenStream(const OUString& rStrmName) return OpenStream( GetRootStorage(), rStrmName ); } -ScDocument& XclRoot::GetDoc() const -{ -return mrData.mrDoc; -} - ScDocShell* XclRoot::GetDocShell() const { return GetDoc().GetDocumentShell(); diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index aa86378416b4..603307fb3476 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -198,7 +198,7 @@ public: rtl::Reference OpenStream(const OUString& rStrmName) const; /** Returns reference to the destination document (import) or source document (export). */ -ScDocument& GetDoc() const; +ScDocument& GetDoc() const { return mrData.mrDoc; } /** Returns the object shell of the Calc document. May be 0 (i.e. import from clipboard). */ ScDocShell* GetDocShell() const;
core.git: sc/source
sc/source/filter/excel/xistyle.cxx | 33 - sc/source/filter/inc/xistyle.hxx |4 ++-- 2 files changed, 18 insertions(+), 19 deletions(-) New commits: commit 397d7af2cbb1f2786ba857d350fb4641525e3bb2 Author: Noel Grandin AuthorDate: Wed May 22 15:03:40 2024 +0200 Commit: Noel Grandin CommitDate: Fri May 24 18:29:02 2024 +0200 tdf#161210 speedup loading large XLS takes the time from 22s to 20s for me Change-Id: Ib401c03ba13f82047c8376741e3547aadf5b18df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168011 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 23db22d23ed8..00bc34c744bd 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1724,7 +1724,7 @@ void XclImpXFRangeColumn::SetDefaultXF( const XclImpXFIndex& rXFIndex, const Xcl OSL_ENSURE( maIndexList.empty(), "XclImpXFRangeColumn::SetDefaultXF - Setting Default Column XF is not empty" ); // insert a complete row range with one insert. -maIndexList.push_back( std::make_unique( 0, rRoot.GetDoc().MaxRow(), rXFIndex ) ); +maIndexList.push_back( XclImpXFRange( 0, rRoot.GetDoc().MaxRow(), rXFIndex ) ); } void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex ) @@ -1748,7 +1748,7 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex ) SCROW nLastScRow = pPrevRange->mnScRow2; sal_uLong nIndex = nNextIndex - 1; XclImpXFRange* pThisRange = pPrevRange; -pPrevRange = (nIndex > 0 && nIndex <= maIndexList.size()) ? maIndexList[ nIndex - 1 ].get() : nullptr; +pPrevRange = (nIndex > 0 && nIndex <= maIndexList.size()) ? [ nIndex - 1 ] : nullptr; if( nFirstScRow == nLastScRow ) // replace solely XF { @@ -1761,20 +1761,20 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex ) ++(pThisRange->mnScRow1); // try to concatenate with previous of this if( !pPrevRange || !pPrevRange->Expand( nScRow, rXFIndex ) ) -Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex ); +Insert( XclImpXFRange( nScRow, rXFIndex ), nIndex ); } else if( nLastScRow == nScRow ) // replace last XF { --(pThisRange->mnScRow2); if( !pNextRange || !pNextRange->Expand( nScRow, rXFIndex ) ) -Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex ); +Insert( XclImpXFRange( nScRow, rXFIndex ), nNextIndex ); } else// insert in the middle of the range { pThisRange->mnScRow1 = nScRow + 1; // List::Insert() moves entries towards end of list, so insert twice at nIndex -Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex ); -Insert( new XclImpXFRange( nFirstScRow, nScRow - 1, pThisRange->maXFIndex ), nIndex ); +Insert( XclImpXFRange( nScRow, rXFIndex ), nIndex ); +Insert( XclImpXFRange( nFirstScRow, nScRow - 1, pThisRange->maXFIndex ), nIndex ); } return; } @@ -1790,12 +1790,12 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex ) return; // create new range -Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex ); +Insert( XclImpXFRange( nScRow, rXFIndex ), nNextIndex ); } -void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, sal_uLong nIndex) +void XclImpXFRangeColumn::Insert(XclImpXFRange aXFRange, sal_uLong nIndex) { -maIndexList.insert( maIndexList.begin() + nIndex, std::unique_ptr(pXFRange) ); +maIndexList.insert( maIndexList.begin() + nIndex, std::move(aXFRange) ); } void XclImpXFRangeColumn::Find( @@ -1811,8 +1811,8 @@ void XclImpXFRangeColumn::Find( return; } -rpPrevRange = maIndexList.front().get(); -rpNextRange = maIndexList.back().get(); +rpPrevRange = (); +rpNextRange = (); // test whether row is at end of list (contained in or behind last range) // rpPrevRange will contain a possible existing row @@ -1843,7 +1843,7 @@ void XclImpXFRangeColumn::Find( while( ((rnNextIndex - nPrevIndex) > 1) && (rpPrevRange->mnScRow2 < nScRow) ) { nMidIndex = (nPrevIndex + rnNextIndex) / 2; -pMidRange = maIndexList[nMidIndex].get(); +pMidRange = [nMidIndex]; assert(pMidRange && "XclImpXFRangeColumn::Find - missing XF index range"); if( nScRow < pMidRange->mnScRow1 ) // row is really before pMidRange { @@ -1861,7 +1861,7 @@ void XclImpXFRangeColumn::Find( if( nScRow <= rpPrevRange->mnScRow2
core.git: sc/source
sc/source/core/data/column2.cxx | 51 1 file changed, 31 insertions(+), 20 deletions(-) New commits: commit 98dd23286a09e10830c1103039dca5609e8c73a9 Author: Mike Kaganski AuthorDate: Fri May 24 14:46:05 2024 +0500 Commit: Mike Kaganski CommitDate: Fri May 24 15:58:37 2024 +0200 Avoid more cases of unneeded GetTextWidth Change-Id: I45ccf6e3c84f22d46b42c36179cb380ca803d08b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168014 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index e62ac56a1e14..2b0a88aef220 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -307,26 +307,33 @@ tools::Long ScColumn::GetNeededSize( { // SetFont is moved up -Size aSize; +tools::Long nWidth = 0; if ( eOrient != SvxCellOrientation::Standard ) { -aSize = Size( pDev->GetTextWidth( aValStr ), pDev->GetTextHeight() ); -tools::Long nTemp = aSize.Width(); -aSize.setWidth( aSize.Height() ); -aSize.setHeight( nTemp ); +nWidth = pDev->GetTextHeight(); } else if ( nRotate ) { //TODO: take different X/Y scaling into consideration -aSize = Size( pDev->GetTextWidth( aValStr ), pDev->GetTextHeight() ); +// avoid calling the expensive GetTextWidth when not needed +auto TextWidth = [&, w = std::optional()]() mutable +{ +if (!w) +w = pDev->GetTextWidth(aValStr); +return *w; +}; +auto TextHeight = [&, h = std::optional()]() mutable +{ +if (!h) +h = pDev->GetTextHeight(); +return *h; +}; double nRealOrient = toRadians(nRotate); double nCosAbs = fabs( cos( nRealOrient ) ); double nSinAbs = fabs( sin( nRealOrient ) ); -tools::Long nHeight = static_cast( aSize.Height() * nCosAbs + aSize.Width() * nSinAbs ); -tools::Long nWidth; if ( eRotMode == SVX_ROTATE_MODE_STANDARD ) -nWidth = static_cast( aSize.Width() * nCosAbs + aSize.Height() * nSinAbs ); +nWidth = static_cast( TextWidth() * nCosAbs + TextHeight() * nSinAbs ); else if ( rOptions.bTotalSize ) { nWidth = conditionalScaleFunc(rDocument.GetColWidth( nCol,nTab ), nPPT); @@ -338,21 +345,25 @@ tools::Long ScColumn::GetNeededSize( (bInPrintTwips ? 1.0 : nPPT) * nCosAbs / nSinAbs ); } else -nWidth = static_cast( aSize.Height() / nSinAbs ); //TODO: limit? +nWidth = static_cast( TextHeight() / nSinAbs ); //TODO: limit? -if ( bBreak && !rOptions.bTotalSize ) +if (bWidth) +nValue = nWidth; +else { -// limit size for line break -tools::Long nCmp = pDev->GetFont().GetFontSize().Height() * SC_ROT_BREAK_FACTOR; -if ( nHeight > nCmp ) -nHeight = nCmp; +tools::Long nHeight = static_cast( TextHeight() * nCosAbs + TextWidth() * nSinAbs ); +if ( bBreak && !rOptions.bTotalSize ) +{ +// limit size for line break +tools::Long nCmp = pDev->GetFont().GetFontSize().Height() * SC_ROT_BREAK_FACTOR; +if ( nHeight > nCmp ) +nHeight = nCmp; +} +nValue = nHeight; } - -aSize = Size( nWidth, nHeight ); -nValue = bWidth ? aSize.Width() : aSize.Height(); } else if (bBreak && !bWidth) -aSize = Size( pDev->GetTextWidth( aValStr ), pDev->GetTextHeight() ); +nWidth = pDev->GetTextWidth(aValStr); else // in the common case (height), avoid calling the expensive GetTextWidth nValue = bWidth ? pDev->GetTextWidth( aValStr ) : pDev->GetTextHeight(); @@ -382,7 +393,7 @@ tools::Long ScColumn::GetNeededSize( pMargin->GetLeftMargin() - pMargin->GetRightMargin() - nIndent), nPPTX); nDocSize = (nDocSize * 9) / 10; // for safety -if ( aSize.Width() > nDocSize ) +if (nWidth > nDocSize)
core.git: sc/source
sc/source/core/data/patattr.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 7cd07676dfb6a27957d60fb968fd2d3b8abc873c Author: Henry Castro AuthorDate: Tue May 21 17:32:54 2024 -0400 Commit: Caolán McNamara CommitDate: Fri May 24 12:31:29 2024 +0200 lok: sc: fix print mode document back color Signed-off-by: Henry Castro Change-Id: I334ff51230ef01d7a87790409a6d76541c57ba54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167911 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice (cherry picked from commit 11eaf501798cec2c5758cd7fd447998e202ae1f9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167944 Tested-by: Jenkins diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 4e0ab28a07c3..162e46d5de4a 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -829,7 +829,8 @@ void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemS if (pViewShell) { const ScViewRenderingOptions& rViewRenderingOptions = pViewShell->GetViewRenderingData(); -aBackColor = rViewRenderingOptions.GetDocColor(); +aBackColor = eAutoMode == ScAutoFontColorMode::Print ? COL_WHITE : +rViewRenderingOptions.GetDocColor(); } } }
core.git: sc/source
sc/source/ui/inc/docsh.hxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit b46b0e92e54d871af8c2f2471c991c5d243a089d Author: Xisco Fauli AuthorDate: Thu May 23 15:44:39 2024 +0200 Commit: Xisco Fauli CommitDate: Thu May 23 20:28:22 2024 +0200 use SAL_RET_MAYBENULL in GetViewBindings(), GetBestViewShell()... ... GetViewData() and GetShellByNum() Change-Id: I9a53e2d4cf1241195985cf095d274f596abd6427 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167993 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 4cc4ceacfb11..0b82b85ea3e9 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -378,9 +378,9 @@ public: const OUString& GetDdeTextFmt() const { return m_aDdeTextFmt; } -SfxBindings*GetViewBindings(); +SAL_RET_MAYBENULL SfxBindings* GetViewBindings(); -SC_DLLPUBLIC ScTabViewShell* GetBestViewShell( bool bOnlyVisible = true ); +SAL_RET_MAYBENULL SC_DLLPUBLIC ScTabViewShell* GetBestViewShell( bool bOnlyVisible = true ); voidSetDocumentModifiedPending( bool bVal ) { m_bDocumentModifiedPending = bVal; } @@ -397,10 +397,10 @@ public: OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice... -SC_DLLPUBLIC static ScViewData* GetViewData(); +SAL_RET_MAYBENULL SC_DLLPUBLIC static ScViewData* GetViewData(); SC_DLLPUBLIC static SCTAB GetCurTab(); -static ScDocShell* GetShellByNum( sal_uInt16 nDocNo ); +SAL_RET_MAYBENULL static ScDocShell* GetShellByNum( sal_uInt16 nDocNo ); static OUString GetOwnFilterName(); static OUString GetHtmlFilterName(); static OUString GetWebQueryFilterName();
core.git: sc/source
sc/source/ui/docshell/dbdocfun.cxx |2 +- sc/source/ui/docshell/docfunc.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 64b14cc6ab688abbea2f87bc25ba42159b5dc904 Author: Xisco Fauli AuthorDate: Thu May 23 15:41:43 2024 +0200 Commit: Xisco Fauli CommitDate: Thu May 23 20:27:24 2024 +0200 sc: warning C6011: Dereferencing NULL pointer Change-Id: Ib6535d167ec741ea0641208d01f01bee334c0e79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167992 Reviewed-by: Xisco Fauli Tested-by: Jenkins diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index ee59f36232ae..204854b09764 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -630,7 +630,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, while (pViewShell) { ScTabViewShell* pTabViewShell = dynamic_cast(pViewShell); -if (pTabViewShell && pTabViewShell->GetDocId() == pSomeViewForThisDoc->GetDocId()) +if (pTabViewShell && pSomeViewForThisDoc && pTabViewShell->GetDocId() == pSomeViewForThisDoc->GetDocId()) { if (ScPositionHelper* pPosHelper = pTabViewShell->GetViewData().GetLOKHeightHelper(nTab)) pPosHelper->invalidateByIndex(nStartRow); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index d47f6f0bde40..6e3e050b8366 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -180,7 +180,7 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint, bool bApi ) while (pViewShell) { ScTabViewShell* pTabViewShell = dynamic_cast(pViewShell); -if (pTabViewShell && pTabViewShell->GetDocId() == pSomeViewForThisDoc->GetDocId()) +if (pTabViewShell && pSomeViewForThisDoc && pTabViewShell->GetDocId() == pSomeViewForThisDoc->GetDocId()) { if (ScPositionHelper* pPosHelper = pTabViewShell->GetViewData().GetLOKHeightHelper(nTab)) pPosHelper->invalidateByIndex(nStartRow);
core.git: sc/source
sc/source/core/data/column2.cxx | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) New commits: commit f91a411340ae204ce1e6997f22e0352a4c6a8355 Author: Noel Grandin AuthorDate: Thu May 23 15:09:52 2024 +0200 Commit: Noel Grandin CommitDate: Thu May 23 19:46:32 2024 +0200 reduce cost of calc column height calculation avoid calling GetTextWidth unless we really need to Change-Id: Ibb0f378e632fa3fce68b4819028630759baf4eb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167988 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index c4ac17ffe358..e62ac56a1e14 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -307,9 +307,10 @@ tools::Long ScColumn::GetNeededSize( { // SetFont is moved up -Size aSize( pDev->GetTextWidth( aValStr ), pDev->GetTextHeight() ); +Size aSize; if ( eOrient != SvxCellOrientation::Standard ) { +aSize = Size( pDev->GetTextWidth( aValStr ), pDev->GetTextHeight() ); tools::Long nTemp = aSize.Width(); aSize.setWidth( aSize.Height() ); aSize.setHeight( nTemp ); @@ -318,6 +319,7 @@ tools::Long ScColumn::GetNeededSize( { //TODO: take different X/Y scaling into consideration +aSize = Size( pDev->GetTextWidth( aValStr ), pDev->GetTextHeight() ); double nRealOrient = toRadians(nRotate); double nCosAbs = fabs( cos( nRealOrient ) ); double nSinAbs = fabs( sin( nRealOrient ) ); @@ -347,8 +349,13 @@ tools::Long ScColumn::GetNeededSize( } aSize = Size( nWidth, nHeight ); +nValue = bWidth ? aSize.Width() : aSize.Height(); } -nValue = bWidth ? aSize.Width() : aSize.Height(); +else if (bBreak && !bWidth) +aSize = Size( pDev->GetTextWidth( aValStr ), pDev->GetTextHeight() ); +else +// in the common case (height), avoid calling the expensive GetTextWidth +nValue = bWidth ? pDev->GetTextWidth( aValStr ) : pDev->GetTextHeight(); if ( bAddMargin ) {
core.git: sc/source
sc/source/ui/app/inputwin.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4ee802917bd37665df3fe4116eb31b2a9f6be494 Author: Xisco Fauli AuthorDate: Wed May 22 12:40:25 2024 +0200 Commit: Xisco Fauli CommitDate: Wed May 22 15:40:50 2024 +0200 Partially revert 860d11230d6 "sc: check GetActiveViewShell()" See https://gerrit.libreoffice.org/c/core/+/167923/comment/3b02cf2c_feea2a9f/ Change-Id: I54f9609c934c5d56528fc4175462ff1d4deffaae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167951 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index f39139b7b6e7..e447045e4b51 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1722,6 +1722,7 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) if (m_xEditView) { ScModule* pScMod = SC_MOD(); +ScTabViewShell* pStartViewSh = ScTabViewShell::GetActiveViewShell(); // don't modify the font defaults here - the right defaults are // already set in StartEditEngine when the EditEngine is created @@ -1739,7 +1740,6 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) { // Is dragged onto another View? ScTabViewShell* pEndViewSh = ScTabViewShell::GetActiveViewShell(); -ScTabViewShell* pStartViewSh = ScTabViewShell::GetActiveViewShell(); if ( pEndViewSh != pStartViewSh && pStartViewSh != nullptr ) { ScViewData& rViewData = pStartViewSh->GetViewData();
core.git: sc/source
sc/source/ui/Accessibility/AccessibleCell.cxx|4 +-- sc/source/ui/Accessibility/AccessibleCellBase.cxx| 12 - sc/source/ui/Accessibility/AccessibleContextBase.cxx |6 ++-- sc/source/ui/Accessibility/AccessibleCsvControl.cxx | 14 +-- sc/source/ui/Accessibility/AccessibleDocument.cxx|6 ++-- sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |4 +-- sc/source/ui/Accessibility/AccessibleEditObject.cxx |2 - sc/source/ui/Accessibility/AccessiblePageHeader.cxx |4 +-- sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx |4 +-- sc/source/ui/Accessibility/AccessiblePreviewCell.cxx |4 +-- sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx |4 +-- sc/source/ui/Accessibility/AccessiblePreviewTable.cxx|2 - sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |4 +-- sc/source/ui/Accessibility/AccessibleTableBase.cxx |2 - 14 files changed, 36 insertions(+), 36 deletions(-) New commits: commit c2a2eb189c45b4eaf53bd2b5656185fa72512322 Author: Noel Grandin AuthorDate: Wed May 22 09:34:38 2024 +0200 Commit: Noel Grandin CommitDate: Wed May 22 12:42:07 2024 +0200 loplugin:ostr in sc/../Accessibility Change-Id: Ibf9981ee800054c10b663d9fc91602d326175a68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167919 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index b27fbb90671a..3d1fb315965c 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -300,13 +300,13 @@ uno::Reference SAL_CALL OUString SAL_CALL ScAccessibleCell::getImplementationName() { -return "ScAccessibleCell"; +return u"ScAccessibleCell"_ustr; } uno::Sequence< OUString> SAL_CALL ScAccessibleCell::getSupportedServiceNames() { -const css::uno::Sequence vals { "com.sun.star.sheet.AccessibleCell" }; +const css::uno::Sequence vals { u"com.sun.star.sheet.AccessibleCell"_ustr }; return comphelper::concatSequences(ScAccessibleContextBase::getSupportedServiceNames(), vals); } diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx index d8b84fabafc1..ebff91c101e2 100644 --- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx @@ -269,7 +269,7 @@ uno::Any SAL_CALL OUString SAL_CALL ScAccessibleCellBase::getImplementationName() { -return "ScAccessibleCellBase"; +return u"ScAccessibleCellBase"_ustr; } //= XTypeProvider === @@ -374,9 +374,9 @@ OUString ScAccessibleCellBase::getShadowAttrs() const } } //construct shadow attributes string -OUString sShadowAttrs("Shadow:"); -OUString sInnerSplit(","); -OUString sOuterSplit(";"); +OUString sShadowAttrs(u"Shadow:"_ustr); +OUString sInnerSplit(u","_ustr); +OUString sOuterSplit(u";"_ustr); sal_Int32 nLocationVal = 0; switch( aShadowFmt.Location ) { @@ -479,8 +479,8 @@ OUString ScAccessibleCellBase::getBorderAttrs() //construct border attributes string OUString sBorderAttrs; -OUString sInnerSplit(","); -OUString sOuterSplit(";"); +OUString sInnerSplit(u","_ustr); +OUString sOuterSplit(u";"_ustr); //top border //if top of the cell has no border if ( aTopBorder.InnerLineWidth == 0 && aTopBorder.OuterLineWidth == 0 ) diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx index 59f2f399032e..34826eb80e9d 100644 --- a/sc/source/ui/Accessibility/AccessibleContextBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx @@ -416,7 +416,7 @@ void SAL_CALL // XServiceInfo OUString SAL_CALL ScAccessibleContextBase::getImplementationName() { -return "ScAccessibleContextBase"; +return u"ScAccessibleContextBase"_ustr; } sal_Bool SAL_CALL ScAccessibleContextBase::supportsService(const OUString& sServiceName) @@ -427,8 +427,8 @@ sal_Bool SAL_CALL ScAccessibleContextBase::supportsService(const OUString& sServ uno::Sequence< OUString> SAL_CALL ScAccessibleContextBase::getSupportedServiceNames() { -return {"com.sun.star.accessibility.Accessible", -"com.sun.star.accessibility.AccessibleContext"}; +return {u"com.sun.star.accessibility.Accessible"_ustr, +u"com.sun.star.accessibility.AccessibleContext"_ustr}; } //= internal diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx index c6dc50dc011a..166e1482b057 100644 ---
core.git: sc/source
sc/source/core/data/table1.cxx | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) New commits: commit 66f968242ecb17ea82d72ca6198aeec4aa865f05 Author: Pranam Lashkari AuthorDate: Tue May 21 05:56:18 2024 +0300 Commit: Pranam Lashkari CommitDate: Tue May 21 22:43:38 2024 +0200 sc: LOK: invalidate sheet geometry on row height changes sometimes if undo/redeo affected row heights (i.e: undo an autofill) sheet geometry was not updated in LOK Change-Id: I995d23752712f6baf3c348f6fe5fb292f7c9043b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167878 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara (cherry picked from commit bb605f31f92eeeca292824931ef0e8d1db750702) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167828 Reviewed-by: Pranam Lashkari Tested-by: Jenkins diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index c7539a154204..f90c4a73e011 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -489,6 +490,18 @@ bool ScTable::SetOptimalHeight( mpRowHeights->enableTreeSearch(true); +if (bChanged) +{ +if (ScViewData* pViewData = ScDocShell::GetViewData()) +{ +ScTabViewShell::notifyAllViewsSheetGeomInvalidation( +pViewData->GetViewShell(), +false /* bColsAffected */, true /* bRowsAffected */, +true /* bSizes*/, false /* bHidden */, false /* bFiltered */, +false /* bGroups */, nTab); +} +} + return bChanged; } @@ -510,10 +523,22 @@ void ScTable::SetOptimalHeightOnly( SetRowHeightOnlyFunc aFunc(this); -SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow, true); +bool bChanged = SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow, true); if ( pProgress != pOuterProgress ) delete pProgress; + +if (bChanged) +{ +if (ScViewData* pViewData = ScDocShell::GetViewData()) +{ +ScTabViewShell::notifyAllViewsSheetGeomInvalidation( +pViewData->GetViewShell(), +false /* bColsAffected */, true /* bRowsAffected */, +true /* bSizes*/, false /* bHidden */, false /* bFiltered */, +false /* bGroups */, nTab); +} +} } bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const
core.git: sc/source
sc/source/ui/inc/tabvwsh.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1ff9bc004e5df7d0dfbd7e58c0cbaadf225fb68d Author: Xisco Fauli AuthorDate: Tue May 21 14:23:16 2024 +0200 Commit: Xisco Fauli CommitDate: Tue May 21 21:36:07 2024 +0200 use SAL_RET_MAYBENULL in GetActiveViewShell() Change-Id: I739a9be7486978b19f34939c7d6d7bb2d1adbf77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167899 Reviewed-by: Xisco Fauli Tested-by: Jenkins diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index e05e5370d84f..a3c0d728f90f 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -367,7 +367,7 @@ public: voidDeactivateOle(); -SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell(); +SAL_RET_MAYBENULL SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell(); std::shared_ptr CreateRefDialogController(SfxBindings* pB, SfxChildWindow* pCW, SfxChildWinInfo* pInfo,
core.git: sc/source
sc/source/ui/app/inputwin.cxx | 21 ++-- sc/source/ui/condformat/condformatdlgentry.cxx | 68 ++--- sc/source/ui/dialogs/searchresults.cxx | 20 ++- sc/source/ui/miscdlgs/mvtabdlg.cxx | 16 +-- sc/source/ui/namedlg/namedefdlg.cxx|8 - sc/source/ui/namedlg/namedlg.cxx |4 sc/source/ui/undo/undoblk.cxx | 55 +- sc/source/ui/undo/undodat.cxx | 129 - sc/source/ui/undo/undotab.cxx | 33 +- sc/source/ui/view/tabvwsh4.cxx |2 10 files changed, 219 insertions(+), 137 deletions(-) New commits: commit 860d11230d67900238f97a06fd2ebd0262c16ae4 Author: Xisco Fauli AuthorDate: Tue May 21 17:22:53 2024 +0200 Commit: Xisco Fauli CommitDate: Tue May 21 21:35:50 2024 +0200 sc: check GetActiveViewShell() See the recently introduced https://crashreport.libreoffice.org/stats/crash_details/3da2dcd1-ca3e-409a-a665-dcb09d2a3ba0 Change-Id: If6ddc71bc2946232d57d5fd8fd6029b45b19495f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167903 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 3aa9a36c5af0..f39139b7b6e7 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -799,9 +799,11 @@ void ScInputWindow::MouseButtonDown( const MouseEvent& rMEvt ) // I'd prefer to leave at least a single column header and a // row but I don't know how to get that value in pixels. // Use TOOLBOX_WINDOW_HEIGHT for the moment -ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); -mnMaxY = GetOutputSizePixel().Height() + (pViewSh->GetGridHeight(SC_SPLIT_TOP) - + pViewSh->GetGridHeight(SC_SPLIT_BOTTOM)) - TOOLBOX_WINDOW_HEIGHT; +if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell()) +{ +mnMaxY = GetOutputSizePixel().Height() + (pViewSh->GetGridHeight(SC_SPLIT_TOP) + + pViewSh->GetGridHeight(SC_SPLIT_BOTTOM)) - TOOLBOX_WINDOW_HEIGHT; +} } } @@ -1720,7 +1722,6 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) if (m_xEditView) { ScModule* pScMod = SC_MOD(); -ScTabViewShell* pStartViewSh = ScTabViewShell::GetActiveViewShell(); // don't modify the font defaults here - the right defaults are // already set in StartEditEngine when the EditEngine is created @@ -1738,6 +1739,7 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt ) { // Is dragged onto another View? ScTabViewShell* pEndViewSh = ScTabViewShell::GetActiveViewShell(); +ScTabViewShell* pStartViewSh = ScTabViewShell::GetActiveViewShell(); if ( pEndViewSh != pStartViewSh && pStartViewSh != nullptr ) { ScViewData& rViewData = pStartViewSh->GetViewData(); @@ -2663,11 +2665,12 @@ void ScPosWnd::DoEnter() if (bOpenManageNamesDialog) { const sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId(); -ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); -assert(pViewSh); -SfxViewFrame& rViewFrm = pViewSh->GetViewFrame(); -SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId ); -SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); +if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell()) +{ +SfxViewFrame& rViewFrm = pViewSh->GetViewFrame(); +SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId ); +SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); +} } } diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 88de0f73a606..01d13c821981 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -446,43 +446,45 @@ void StyleSelect(weld::Window* pDialogParent, weld::ComboBox& rLbStyle, const Sc // unlock the dispatcher so SID_STYLE_NEW can be executed // (SetDispatcherLock would affect all Calc documents) -ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); -SfxDispatcher* pDisp = pViewShell->GetDispatcher(); -bool bLocked = pDisp->IsLocked(); -if (bLocked) -pDisp->Lock(false); - -// Execute the "new style" slot, complete with undo and all necessary updates. -// The return value (SfxUInt16Item) is ignored, look for new styles instead. -pDisp->ExecuteList(SID_STYLE_NEW, -SfxCallMode::SYNCHRON | SfxCallMode::RECORD, -{ , }, { }); - -if (bLocked) -pDisp->Lock(true); - -// Find the new style and add it into the style
core.git: sc/source
sc/source/ui/unoobj/docuno.cxx | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) New commits: commit 7da5bb1ff4a691fb5b55a4bccc0f6c87c9e17692 Author: Julien Nabet AuthorDate: Tue May 21 10:59:29 2024 +0200 Commit: Julien Nabet CommitDate: Tue May 21 14:06:48 2024 +0200 tdf#161190: fix crash when exporting spreadsheet as PDF... with "whole sheet export" option' See bt here: https://bug-attachments.documentfoundation.org/attachment.cgi?id=194240 Change-Id: I453882be5c8bb761a722482f9c94a2b2bb5c7dd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167890 Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 9a6d01a43ed1..13682da51960 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2384,7 +2384,7 @@ static void lcl_SetMediaScreen(const uno::Reference& xMediaShap pPDF->SetScreenURL(nScreenId, sMediaURL); } -static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const ScPrintState& rState, +static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const std::unique_ptr& rState, ScDocument& rDoc, SCTAB nTab, tools::Long nStartPage, bool bSinglePageSheets) { @@ -2434,12 +2434,12 @@ static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const ScPrin if (bTopDown) // top-bottom page order { nX1 = 0; -for (size_t i = 0; i < rState.m_aRanges.m_nPagesX; ++i) +for (size_t i = 0; i < rState->m_aRanges.m_nPagesX; ++i) { -nX2 = (*rState.m_aRanges.m_xPageEndX)[i]; -for (size_t j = 0; j < rState.m_aRanges.m_nPagesY; ++j) +nX2 = (*rState->m_aRanges.m_xPageEndX)[i]; +for (size_t j = 0; j < rState->m_aRanges.m_nPagesY; ++j) { -auto& rPageRow = (*rState.m_aRanges.m_xPageRows)[j]; +auto& rPageRow = (*rState->m_aRanges.m_xPageRows)[j]; nY1 = rPageRow.GetStartRow(); nY2 = rPageRow.GetEndRow(); @@ -2459,15 +2459,15 @@ static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const ScPrin } else // left to right page order { -for (size_t i = 0; i < rState.m_aRanges.m_nPagesY; ++i) +for (size_t i = 0; i < rState->m_aRanges.m_nPagesY; ++i) { -auto& rPageRow = (*rState.m_aRanges.m_xPageRows)[i]; +auto& rPageRow = (*rState->m_aRanges.m_xPageRows)[i]; nY1 = rPageRow.GetStartRow(); nY2 = rPageRow.GetEndRow(); nX1 = 0; -for (size_t j = 0; j < rState.m_aRanges.m_nPagesX; ++j) +for (size_t j = 0; j < rState->m_aRanges.m_nPagesX; ++j) { -nX2 = (*rState.m_aRanges.m_xPageEndX)[j]; +nX2 = (*rState->m_aRanges.m_xPageEndX)[j]; tools::Rectangle aPageRect(rDoc.GetMMRect(nX1, nY1, nX2, nY2, nTab)); tools::Rectangle aTmpRect(aPageRect.GetIntersection(pObj->GetCurrentBoundRect())); @@ -2590,7 +2590,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec tools::Long nTabStart = pPrintFuncCache->GetTabStart(nTab); if (nRenderer == nTabStart) -lcl_PDFExportMediaShapeScreen(pDev, *m_pPrintState, rDoc, nTab, nTabStart, bSinglePageSheets); +lcl_PDFExportMediaShapeScreen(pDev, m_pPrintState, rDoc, nTab, nTabStart, bSinglePageSheets); ScRange aRange; const ScRange* pSelRange = nullptr;
core.git: sc/source
sc/source/ui/vba/excelvbahelper.cxx | 32 ++--- sc/source/ui/vba/excelvbahelper.hxx |2 sc/source/ui/vba/vbaapplication.cxx | 60 +- sc/source/ui/vba/vbaassistant.cxx|4 sc/source/ui/vba/vbaaxes.cxx | 18 +-- sc/source/ui/vba/vbaaxis.cxx | 56 +- sc/source/ui/vba/vbaaxistitle.cxx|4 sc/source/ui/vba/vbaborders.cxx | 22 ++-- sc/source/ui/vba/vbacharacters.cxx |6 - sc/source/ui/vba/vbachart.cxx| 22 ++-- sc/source/ui/vba/vbachartobject.cxx |8 - sc/source/ui/vba/vbachartobjects.cxx | 12 +- sc/source/ui/vba/vbacharttitle.cxx |4 sc/source/ui/vba/vbacomment.cxx |8 - sc/source/ui/vba/vbacomments.cxx |4 sc/source/ui/vba/vbadialog.cxx |4 sc/source/ui/vba/vbadialogs.cxx |4 sc/source/ui/vba/vbaeventshelper.cxx |8 - sc/source/ui/vba/vbafiledialog.cxx |6 - sc/source/ui/vba/vbafiledialogitems.cxx |8 - sc/source/ui/vba/vbafont.cxx | 26 ++-- sc/source/ui/vba/vbaformat.cxx |4 sc/source/ui/vba/vbaformatcondition.cxx |4 sc/source/ui/vba/vbaformatconditions.cxx | 12 +- sc/source/ui/vba/vbaglobals.cxx | 20 +-- sc/source/ui/vba/vbahyperlink.cxx| 14 +- sc/source/ui/vba/vbahyperlinks.cxx |4 sc/source/ui/vba/vbainterior.cxx | 16 +- sc/source/ui/vba/vbamenu.cxx |4 sc/source/ui/vba/vbamenubar.cxx |4 sc/source/ui/vba/vbamenubars.cxx |8 - sc/source/ui/vba/vbamenuitem.cxx |4 sc/source/ui/vba/vbamenuitems.cxx|4 sc/source/ui/vba/vbamenus.cxx|4 sc/source/ui/vba/vbaname.cxx |4 sc/source/ui/vba/vbanames.cxx|8 - sc/source/ui/vba/vbaoleobject.cxx|6 - sc/source/ui/vba/vbaoleobjects.cxx |4 sc/source/ui/vba/vbaoutline.cxx |4 sc/source/ui/vba/vbapagebreak.cxx| 16 +- sc/source/ui/vba/vbapagebreaks.cxx | 10 - sc/source/ui/vba/vbapagesetup.cxx| 88 sc/source/ui/vba/vbapalette.cxx |4 sc/source/ui/vba/vbapane.cxx |4 sc/source/ui/vba/vbapivotcache.cxx |4 sc/source/ui/vba/vbapivottable.cxx |4 sc/source/ui/vba/vbapivottables.cxx |4 sc/source/ui/vba/vbarange.cxx| 170 +++ sc/source/ui/vba/vbarange.hxx|2 sc/source/ui/vba/vbasheetobject.cxx | 42 +++ sc/source/ui/vba/vbasheetobjects.cxx | 18 +-- sc/source/ui/vba/vbastyle.cxx|8 - sc/source/ui/vba/vbastyles.cxx |8 - sc/source/ui/vba/vbatextboxshape.cxx |2 sc/source/ui/vba/vbatextframe.cxx|4 sc/source/ui/vba/vbatitle.hxx| 12 +- sc/source/ui/vba/vbavalidation.cxx | 14 +- sc/source/ui/vba/vbawindow.cxx | 12 +- sc/source/ui/vba/vbawindows.cxx |6 - sc/source/ui/vba/vbaworkbook.cxx | 28 ++--- sc/source/ui/vba/vbaworkbooks.cxx| 22 ++-- sc/source/ui/vba/vbaworksheet.cxx| 30 ++--- sc/source/ui/vba/vbaworksheets.cxx | 12 +- sc/source/ui/vba/vbawsfunction.cxx |8 - 64 files changed, 489 insertions(+), 489 deletions(-) New commits: commit 5a602ed852b872f87893169062ec47041e013fb9 Author: Noel Grandin AuthorDate: Mon May 20 09:13:38 2024 +0200 Commit: Noel Grandin CommitDate: Mon May 20 14:40:36 2024 +0200 loplugin:ostr in sc/.../vba Change-Id: Ifdf0ebba617432f49e2c14c8a52c495dc1c6a36a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167853 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 3224171677e9..0f00dae66ed7 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -64,7 +64,7 @@ GetUnnamedDataBaseRanges( const ScDocShell* pShell ) if ( pShell ) xModel.set( pShell->GetModel(), uno::UNO_SET_THROW ); uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW ); -uno::Reference< sheet::XUnnamedDatabaseRanges > xUnnamedDBRanges( xModelProps->getPropertyValue("UnnamedDatabaseRanges"), uno::UNO_QUERY_THROW ); +uno::Reference< sheet::XUnnamedDatabaseRanges > xUnnamedDBRanges( xModelProps->getPropertyValue(u"UnnamedDatabaseRanges"_ustr), uno::UNO_QUERY_THROW ); return xUnnamedDBRanges; } @@ -80,7 +80,7 @@ GetAutoFiltRange( const ScDocShell* pShell, sal_Int16 nSheet ) uno::Reference< sheet::XDatabaseRange > xDBRange( xUnnamedDBRanges->getByTable( nSheet ) , uno::UNO_QUERY_THROW ); bool bHasAuto = false; uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW ); -xProps->getPropertyValue("AutoFilter") >>=
core.git: sc/source
sc/source/filter/excel/excform.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit e3bd3c7e3178dc091fd002628f052666b4db3be6 Author: Andrea Gelmini AuthorDate: Fri May 17 13:37:25 2024 +0200 Commit: Taichi Haradaguchi <20001...@ymail.ne.jp> CommitDate: Mon May 20 08:56:49 2024 +0200 Fix typo Change-Id: I10d05b41028df776713db37d60e688d4f04bb739 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167774 Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp> Tested-by: Taichi Haradaguchi <20001...@ymail.ne.jp> diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 10119bb1d338..ee7b4a65e542 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -927,7 +927,7 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std: case 0x04: // Subtraction [313 264] case 0x05: // Multiplication[313 264] case 0x06: // Division [313 264] -case 0x07: // Exponetiation [313 265] +case 0x07: // Exponentiation [313 265] case 0x08: // Concatenation [313 265] case 0x09: // Less Than [313 265] case 0x0A: // Less Than or Equal[313 265] @@ -1410,7 +1410,7 @@ void ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, std::s case 0x04: // Subtraction [313 264] case 0x05: // Multiplication[313 264] case 0x06: // Division [313 264] -case 0x07: // Exponetiation [313 265] +case 0x07: // Exponentiation [313 265] case 0x08: // Concatenation [313 265] case 0x09: // Less Than [313 265] case 0x0A: // Less Than or Equal[313 265]
core.git: sc/source
sc/source/filter/excel/excform8.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit eadcbef8b30da2704a8bdc9dc0c11b8db258b13e Author: Andrea Gelmini AuthorDate: Fri May 17 14:07:11 2024 +0200 Commit: <20001...@ymail.ne.jp> CommitDate: Mon May 20 08:54:48 2024 +0200 Fix typo Change-Id: I22cd12c51d91bd7620bca29227871b3081813a36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167776 Reviewed-by: <20001...@ymail.ne.jp> Tested-by: Jenkins diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index ebd868aeb7d2..6f053373d193 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -987,7 +987,7 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std case 0x04: // Subtraction [313 264] case 0x05: // Multiplication[313 264] case 0x06: // Division [313 264] -case 0x07: // Exponetiation [313 265] +case 0x07: // Exponentiation [313 265] case 0x08: // Concatenation [313 265] case 0x09: // Less Than [313 265] case 0x0A: // Less Than or Equal[313 265]
core.git: sc/source
sc/source/ui/docshell/docfunc.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit d4ae5abb4d00cc8adb3c45a9410fc71e56211c46 Author: Eike Rathke AuthorDate: Sun May 19 15:21:19 2024 +0200 Commit: Eike Rathke CommitDate: Sun May 19 19:26:05 2024 +0200 Resolves: tdf#160804 sc: ResizeMatrix: Use document grammar API grammar (old GRAM_PODF_A1) here was always wrong and could never had matched the formula string obtained from the document, but in earlier days array separators weren't configurable so this may have worked accidentally.. Likely GRAM_PODF_A1 was introduced being confused by existance of older bApi parameter that never was true though and got eliminated later. Change-Id: Ie77ad4047c21d999bea1ff97c7c2b451f01121eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167844 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 556cd6e6c940..d47f6f0bde40 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5521,11 +5521,11 @@ void ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd if ( DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, false/*bApi*/ ) ) { -// GRAM_API for API compatibility. -if (!EnterMatrix( aNewRange, , nullptr, aFormula, false/*bApi*/, false, OUString(), formula::FormulaGrammar::GRAM_API )) +// Formula string was obtained in document grammar. +if (!EnterMatrix( aNewRange, , nullptr, aFormula, false/*bApi*/, false, OUString(), rDoc.GetGrammar() )) { // try to restore the previous state -EnterMatrix( rOldRange, , nullptr, aFormula, false/*bApi*/, false, OUString(), formula::FormulaGrammar::GRAM_API ); +EnterMatrix( rOldRange, , nullptr, aFormula, false/*bApi*/, false, OUString(), rDoc.GetGrammar() ); } }
core.git: sc/source
sc/source/ui/cctrl/checklistmenu.cxx |4 1 file changed, 4 insertions(+) New commits: commit b2dc515e2a3c8420c7f39c0b4396632c2086126a Author: Caolán McNamara AuthorDate: Fri May 17 21:05:56 2024 +0100 Commit: Caolán McNamara CommitDate: Sat May 18 14:02:35 2024 +0200 Related: tdf#146326 restore correct focus when on submenu launched we still "cancel" a submenu if it never gets around to getting launched so at least set the restore focus wiget to where we initially grab focus. Change-Id: Ida157823a282d08ca908c20f0135db61881adb7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167798 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 1d720cb3b0dd..45202de94fb4 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -686,11 +686,15 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData void ScCheckListMenuControl::GrabFocus() { if (mxEdSearch->get_visible()) +{ mxEdSearch->grab_focus(); +meRestoreFocus = RestoreFocus::EdSearch; +} else { mxMenu->set_cursor(0); mxMenu->grab_focus(); +meRestoreFocus = RestoreFocus::Menu; } }
core.git: sc/source
sc/source/core/tool/addincol.cxx |4 - sc/source/core/tool/addinlis.cxx |2 sc/source/core/tool/appoptio.cxx | 42 +-- sc/source/core/tool/calcconfig.cxx|8 +-- sc/source/core/tool/cellform.cxx |2 sc/source/core/tool/cellkeytranslator.cxx |2 sc/source/core/tool/cellkeywords.inl |6 +- sc/source/core/tool/charthelper.cxx | 14 +++--- sc/source/core/tool/compiler.cxx |2 sc/source/core/tool/defaultsoptions.cxx |6 +- sc/source/core/tool/docoptio.cxx | 30 ++--- sc/source/core/tool/editutil.cxx |4 - sc/source/core/tool/filtopt.cxx |6 +- sc/source/core/tool/formulalogger.cxx |2 sc/source/core/tool/formulaopt.cxx| 32 +++--- sc/source/core/tool/formulaparserpool.cxx |2 sc/source/core/tool/grouparealistener.cxx |4 - sc/source/core/tool/inputopt.cxx | 24 +- sc/source/core/tool/interpr1.cxx |4 - sc/source/core/tool/interpr4.cxx |6 +- sc/source/core/tool/interpr5.cxx |2 sc/source/core/tool/printopt.cxx |6 +- sc/source/core/tool/stylehelper.cxx | 38 - sc/source/core/tool/unitconv.cxx |2 sc/source/core/tool/viewopti.cxx | 66 +++--- sc/source/core/tool/zforauto.cxx |2 26 files changed, 159 insertions(+), 159 deletions(-) New commits: commit cb4e9a7bf2231716d4809c682ae4b6b8b91b09b4 Author: Noel Grandin AuthorDate: Fri May 17 12:40:23 2024 +0200 Commit: Noel Grandin CommitDate: Fri May 17 14:15:20 2024 +0200 loplugin:ostr in sc/../tool Change-Id: I04c41c79613397745a2e97c2e8a247e11f114c7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167767 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 66d8902de5f1..f66ff2da554c 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -260,7 +260,7 @@ void ScUnoAddInCollection::Initialize() if ( xEnAc.is() ) { uno::Reference xEnum = -xEnAc->createContentEnumeration( "com.sun.star.sheet.AddIn" ); +xEnAc->createContentEnumeration( u"com.sun.star.sheet.AddIn"_ustr ); if ( xEnum.is() ) { // loop through all AddIns @@ -368,7 +368,7 @@ void ScUnoAddInCollection::ReadConfiguration() const OUString sSlash('/'); // get the list of add-ins (services) -const uno::Sequence aServiceNames = rAddInConfig.GetNodeNames( "" ); +const uno::Sequence aServiceNames = rAddInConfig.GetNodeNames( u""_ustr ); for ( const OUString& aServiceName : aServiceNames ) { diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx index f8a236780e07..b7548a78dec7 100644 --- a/sc/source/core/tool/addinlis.cxx +++ b/sc/source/core/tool/addinlis.cxx @@ -31,7 +31,7 @@ using namespace com::sun::star; -SC_SIMPLE_SERVICE_INFO( ScAddInListener, "ScAddInListener", "stardiv.one.sheet.AddInListener" ) +SC_SIMPLE_SERVICE_INFO( ScAddInListener, u"ScAddInListener"_ustr, u"stardiv.one.sheet.AddInListener"_ustr ) ::std::vector> ScAddInListener::aAllListeners; diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx index c35524f9588f..7b44ca39fe4f 100644 --- a/sc/source/core/tool/appoptio.cxx +++ b/sc/source/core/tool/appoptio.cxx @@ -213,51 +213,51 @@ Sequence ScAppCfg::GetLayoutPropertyNames() { const bool bIsMetric = ScOptionsUtil::IsMetricSystem(); -return {(bIsMetric ? OUString("Other/MeasureUnit/Metric") - : OUString("Other/MeasureUnit/NonMetric")), // SCLAYOUTOPT_MEASURE - "Other/StatusbarFunction", // SCLAYOUTOPT_STATUSBAR - "Zoom/Value", // SCLAYOUTOPT_ZOOMVAL - "Zoom/Type", // SCLAYOUTOPT_ZOOMTYPE - "Zoom/Synchronize",// SCLAYOUTOPT_SYNCZOOM - "Other/StatusbarMultiFunction"}; // SCLAYOUTOPT_STATUSBARMULTI +return {(bIsMetric ? u"Other/MeasureUnit/Metric"_ustr + : u"Other/MeasureUnit/NonMetric"_ustr), // SCLAYOUTOPT_MEASURE + u"Other/StatusbarFunction"_ustr, // SCLAYOUTOPT_STATUSBAR + u"Zoom/Value"_ustr, // SCLAYOUTOPT_ZOOMVAL + u"Zoom/Type"_ustr, // SCLAYOUTOPT_ZOOMTYPE + u"Zoom/Synchronize"_ustr,// SCLAYOUTOPT_SYNCZOOM + u"Other/StatusbarMultiFunction"_ustr}; //
core.git: sc/source
sc/source/filter/excel/excdoc.cxx|2 sc/source/filter/excel/excel.cxx | 12 - sc/source/filter/excel/excform.cxx |6 sc/source/filter/excel/excform8.cxx |6 sc/source/filter/excel/excimp8.cxx |4 sc/source/filter/excel/expop2.cxx|2 sc/source/filter/excel/xechart.cxx |2 sc/source/filter/excel/xecontent.cxx |4 sc/source/filter/excel/xeescher.cxx | 72 - sc/source/filter/excel/xelink.cxx|4 sc/source/filter/excel/xepivotxml.cxx|2 sc/source/filter/excel/xeroot.cxx|2 sc/source/filter/excel/xestream.cxx |6 sc/source/filter/excel/xestyle.cxx |2 sc/source/filter/excel/xichart.cxx |4 sc/source/filter/excel/xiescher.cxx | 132 - sc/source/filter/excel/xistyle.cxx |2 sc/source/filter/excel/xlchart.cxx | 12 - sc/source/filter/excel/xltoolbar.cxx |6 sc/source/filter/html/htmlexp.cxx|2 sc/source/filter/html/htmlexp2.cxx |2 sc/source/filter/html/htmlpars.cxx |6 sc/source/filter/lotus/lotimpop.cxx |4 sc/source/filter/oox/SparklineFragment.cxx |8 - sc/source/filter/oox/commentsbuffer.cxx |2 sc/source/filter/oox/condformatbuffer.cxx|4 sc/source/filter/oox/drawingfragment.cxx | 32 ++-- sc/source/filter/oox/excelchartconverter.cxx |2 sc/source/filter/oox/excelfilter.cxx |2 sc/source/filter/oox/extlstcontext.cxx |4 sc/source/filter/oox/formulabase.cxx |4 sc/source/filter/oox/numberformatsbuffer.cxx |4 sc/source/filter/oox/ooxformulaparser.cxx|6 sc/source/filter/oox/pivottablefragment.cxx |2 sc/source/filter/oox/querytablebuffer.cxx|6 sc/source/filter/oox/sheetdatabuffer.cxx |2 sc/source/filter/oox/stylesbuffer.cxx|2 sc/source/filter/oox/unitconverter.cxx | 14 - sc/source/filter/oox/viewsettings.cxx|2 sc/source/filter/oox/workbookfragment.cxx|6 sc/source/filter/oox/workbookhelper.cxx |6 sc/source/filter/oox/workbooksettings.cxx| 12 - sc/source/filter/orcus/filterdetect.cxx | 10 - sc/source/filter/xcl97/XclExpChangeTrack.cxx |4 sc/source/filter/xcl97/xcl97esc.cxx |4 sc/source/filter/xcl97/xcl97rec.cxx |2 sc/source/filter/xml/SparklineGroupsExport.cxx |2 sc/source/filter/xml/XMLCodeNameProvider.cxx |2 sc/source/filter/xml/XMLExportDataPilot.cxx | 16 +- sc/source/filter/xml/XMLExportDatabaseRanges.cxx | 16 +- sc/source/filter/xml/XMLStylesExportHelper.cxx |6 sc/source/filter/xml/XMLTableHeaderFooterContext.cxx | 14 - sc/source/filter/xml/XMLTableShapeResizer.cxx|2 sc/source/filter/xml/XMLTrackedChangesContext.cxx|2 sc/source/filter/xml/xmlcondformat.cxx |2 sc/source/filter/xml/xmlcvali.cxx|2 sc/source/filter/xml/xmlexprt.cxx| 98 ++--- sc/source/filter/xml/xmlimprt.cxx| 68 - sc/source/filter/xml/xmlstyli.cxx|8 - sc/source/filter/xml/xmlwrap.cxx | 140 +-- 60 files changed, 407 insertions(+), 407 deletions(-) New commits: commit 000aaf1f8c6b3520a604327445a41ca6b8f568dc Author: Noel Grandin AuthorDate: Fri May 17 08:50:01 2024 +0200 Commit: Noel Grandin CommitDate: Fri May 17 12:15:12 2024 +0200 loplugin:ostr in sc/../filter Change-Id: I3c986d9e7f9780f08653131205626471ac75896f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167759 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 00b1ab0a3d72..9b2a29ff62ca 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -872,7 +872,7 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) std::shared_ptr pTheme = pDrawLayer->getTheme(); if (pTheme) { -OUString sThemeRelationshipPath = "theme/theme1.xml"; +OUString sThemeRelationshipPath = u"theme/theme1.xml"_ustr; OUString sThemeDocumentPath = "xl/" + sThemeRelationshipPath; oox::ThemeExport aThemeExport(, oox::drawingml::DOCUMENT_XLSX); diff --git
core.git: sc/source
sc/source/core/data/SolverSettings.cxx |2 +- sc/source/core/data/attrib.cxx |2 +- sc/source/core/data/docpool.cxx|4 ++-- sc/source/core/data/documen2.cxx |6 +++--- sc/source/core/data/documen3.cxx |4 ++-- sc/source/core/data/documen5.cxx |8 sc/source/core/data/document.cxx |4 ++-- sc/source/core/data/dptabres.cxx | 14 +++--- sc/source/core/data/dptabsrc.cxx | 24 sc/source/core/data/dputil.cxx |2 +- sc/source/core/data/drwlayer.cxx |8 sc/source/core/data/formulacell.cxx| 30 +++--- sc/source/core/data/funcdesc.cxx | 24 sc/source/core/data/global.cxx |2 +- sc/source/core/data/postit.cxx |4 ++-- sc/source/core/data/table3.cxx |2 +- sc/source/core/data/validat.cxx|6 +++--- 17 files changed, 73 insertions(+), 73 deletions(-) New commits: commit 239641a4df8c137dc59eb4040608e5d7d9f79320 Author: Noel Grandin AuthorDate: Thu May 16 13:33:45 2024 +0200 Commit: Noel Grandin CommitDate: Thu May 16 16:06:22 2024 +0200 loplugin:ostr in sc/../data Change-Id: I5fef1585ccc9492961328affd284f2c60a004e14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167738 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sc/source/core/data/SolverSettings.cxx b/sc/source/core/data/SolverSettings.cxx index 1320d470efcf..333751d26734 100644 --- a/sc/source/core/data/SolverSettings.cxx +++ b/sc/source/core/data/SolverSettings.cxx @@ -202,7 +202,7 @@ OUString SolverSettings::GetParameter(SolverParameter eParam) return m_sLibrarySize; break; default: -return ""; +return u""_ustr; } } diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 1a587d2b6572..35e6e991dd53 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -540,7 +540,7 @@ bool ScViewObjectModeItem::GetPresentation const IntlWrapper& /* rIntl */ ) const { -OUString aDel(": "); +OUString aDel(u": "_ustr); rText.clear(); switch ( ePres ) diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 5ef4c4a4091f..2add110bc0f2 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -257,7 +257,7 @@ static ItemInfoPackage& getItemInfoPackageScDocument() } ScDocumentPool::ScDocumentPool() -: SfxItemPool("ScDocumentPool") +: SfxItemPool(u"ScDocumentPool"_ustr) { registerItemInfoPackage(getItemInfoPackageScDocument()); } @@ -373,7 +373,7 @@ bool ScDocumentPool::GetPresentation( sal_uInt16 nW = rItem.Which(); OUString aStrYes ( ScResId(STR_YES) ); OUString aStrNo ( ScResId(STR_NO) ); -OUString aStrSep(": "); +OUString aStrSep(u": "_ustr); bool ePresentationRet = true; switch( nW ) diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index a551bf014c42..ca7fbcc938c4 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -578,7 +578,7 @@ void ScDocument::ResetClip( ScDocument* pSourceDoc, SCTAB nTab ) { maTabs.resize(nTab+1); } -maTabs[nTab].reset( new ScTable(*this, nTab, "baeh") ); +maTabs[nTab].reset( new ScTable(*this, nTab, u"baeh"_ustr) ); if (nTab < pSourceDoc->GetTableCount() && pSourceDoc->maTabs[nTab]) maTabs[nTab]->SetLayoutRTL( pSourceDoc->maTabs[nTab]->IsLayoutRTL() ); } @@ -595,7 +595,7 @@ void ScDocument::EnsureTable( SCTAB nTab ) maTabs.resize(nTab+1); if (!maTabs[nTab]) -maTabs[nTab].reset( new ScTable(*this, nTab, "temp", bExtras, bExtras) ); +maTabs[nTab].reset( new ScTable(*this, nTab, u"temp"_ustr, bExtras, bExtras) ); } ScRefCellValue ScDocument::GetRefCellValue( const ScAddress& rPos ) @@ -1107,7 +1107,7 @@ bool ScDocument::TransferTab( ScDocument& rSrcDoc, SCTAB nSrcPos, ScDocShell* pSrcShell = rSrcDoc.GetDocumentShell(); if ( pSrcShell ) { -OUString aLibName("Standard"); +OUString aLibName(u"Standard"_ustr); #if HAVE_FEATURE_SCRIPTING const BasicManager *pBasicManager = pSrcShell->GetBasicManager(); if (pBasicManager && !pBasicManager->GetName().isEmpty()) diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index e31c111a3786..db8a9972e43f 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -2048,7 +2048,7 @@ void ScDocument::DoMergeContents( SCCOL nStartCol, SCROW nStartRow, aCell = ScRefCellValue(*this, aPos); } if (nCol != nStartCol || nRow != nStartRow) -SetString(nCol,nRow,nTab,""); +
core.git: sc/source
sc/source/ui/cctrl/checklistmenu.cxx | 63 +-- sc/source/ui/inc/checklistmenu.hxx | 22 2 files changed, 83 insertions(+), 2 deletions(-) New commits: commit a525895a5f820350dc307969b1e8fd5d218a1ddd Author: Caolán McNamara AuthorDate: Mon May 13 10:43:20 2024 +0100 Commit: Caolán McNamara CommitDate: Tue May 14 17:34:23 2024 +0200 Resolves: tdf#146326 restore focus on autofilter submenu popdown to where it was before the submenu popup, unless the keyboard was used in the submenu, in which case restore focus to the menu instead. Change-Id: Iaa24b4eadf206b877a093529678667927488de8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167580 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 60078c335437..1d720cb3b0dd 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -77,6 +77,10 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, RowActivatedHdl, weld::TreeView&, bool) IMPL_LINK(ScCheckListMenuControl, MenuKeyInputHdl, const KeyEvent&, rKEvt, bool) { +// Assume that once the keyboard is used that focus should restore to this menu +// on dismissing a submenu +SetRestoreFocus(ScCheckListMenuControl::RestoreFocus::Menu); + const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode(); switch (rKeyCode.GetCode()) @@ -328,17 +332,65 @@ void ScCheckListMenuControl::launchSubMenu() if (!mxMenu->get_selected(mxScratchIter.get())) return; +meRestoreFocus = DetermineRestoreFocus(); + tools::Rectangle aRect = GetSubMenuParentRect(); pSubMenu->StartPopupMode(mxMenu.get(), aRect); mxMenu->select(*mxScratchIter); + pSubMenu->GrabFocus(); } +ScCheckListMenuControl::RestoreFocus ScCheckListMenuControl::DetermineRestoreFocus() const +{ +if (mxEdSearch->has_focus()) +return RestoreFocus::EdSearch; +if (mpChecks->has_focus()) +return RestoreFocus::Checks; +if (mxChkToggleAll->has_focus()) +return RestoreFocus::ChkToggleAll; +if (mxChkLockChecked->has_focus()) +return RestoreFocus::ChkLockChecked; +if (mxBtnSelectSingle->has_focus()) +return RestoreFocus::BtnSelectSingle; +if (mxBtnUnselectSingle->has_focus()) +return RestoreFocus::BtnUnselectSingle; +return RestoreFocus::Menu; +} + +void ScCheckListMenuControl::RestorePreviousFocus() +{ +switch (meRestoreFocus) +{ +case RestoreFocus::EdSearch: +mxEdSearch->grab_focus(); +break; +case RestoreFocus::Checks: +mpChecks->grab_focus(); +break; +case RestoreFocus::ChkToggleAll: +mxChkToggleAll->grab_focus(); +break; +case RestoreFocus::ChkLockChecked: +mxChkLockChecked->grab_focus(); +break; +case RestoreFocus::BtnSelectSingle: +mxBtnSelectSingle->grab_focus(); +break; +case RestoreFocus::BtnUnselectSingle: +mxBtnUnselectSingle->grab_focus(); +break; +default: +mxMenu->grab_focus(); +break; +} +} + IMPL_LINK_NOARG(ScCheckListMenuControl, PostPopdownHdl, void*, void) { mnAsyncPostPopdownId = nullptr; -mxMenu->grab_focus(); +RestorePreviousFocus(); } IMPL_LINK(ScCheckListMenuControl, MouseEnterHdl, const MouseEvent&, rMEvt, bool) @@ -522,6 +574,7 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData , mrViewData(rViewData) , mnAsyncPostPopdownId(nullptr) , mnAsyncSetDropdownPosId(nullptr) +, meRestoreFocus(RestoreFocus::Menu) , mbHasDates(bHasDates) , mbIsPoppedUp(false) , maOpenTimer(this) @@ -1815,8 +1868,14 @@ IMPL_LINK(ScListSubMenuControl, MenuKeyInputHdl, const KeyEvent&, rKEvt, bool) { bool bConsumed = false; const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode(); +const sal_uInt16 eKeyCode = rKeyCode.GetCode(); -switch (rKeyCode.GetCode()) +// Assume that once the keyboard is used that focus should restore to the +// parent menu +if (eKeyCode != KEY_ESCAPE) + mrParentControl.SetRestoreFocus(ScCheckListMenuControl::RestoreFocus::Menu); + +switch (eKeyCode) { case KEY_ESCAPE: case KEY_LEFT: diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index 8e24baef433b..558ef9f47e37 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -96,6 +96,18 @@ public: }; typedef std::set ResultType; + +enum RestoreFocus +{ +Menu, +EdSearch, +Checks, +ChkToggleAll, +ChkLockChecked, +BtnSelectSingle, +BtnUnselectSingle +}; + struct MenuItemData { bool mbEnabled:1; @@ -190,6 +202,11
core.git: sc/source
sc/source/ui/view/prevwsh.cxx | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) New commits: commit 78e0626bc7bf37d1eda2e3151dd1a44056f92032 Author: Rafał Dobrakowski AuthorDate: Thu May 9 18:18:43 2024 +0200 Commit: Ilmari Lauhakangas CommitDate: Mon May 13 10:41:43 2024 +0200 tdf#45705 Integrate zoom UI commands into Calc This patch uses basegfx::zoomtools to zoom in and out, making it smoother. Similar to commit c96e1ec61835bc01e2969ec97fce9a1674fbf6d7 done for Writer view shell, this patch makes zoom in and zoom out commands functional for Calc the preview shell. Change-Id: I1612f51d39c507d192237bf2361b91e6e5723c4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167389 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 9d33bdaf626a..a0dd401b97b2 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -668,19 +668,16 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) } break; case SID_ZOOM_IN: -{ -sal_uInt16 nNew = pPreview->GetZoom() + 20 ; -nNew -= nNew % 20; -pPreview->SetZoom( nNew ); -eZoom = SvxZoomType::PERCENT; -rReq.Done(); -} -break; case SID_ZOOM_OUT: { -sal_uInt16 nNew = pPreview->GetZoom() - 1; -nNew -= nNew % 20; -pPreview->SetZoom( nNew ); +sal_uInt16 nNewZoom; +const sal_uInt16 nOldZoom {pPreview->GetZoom()}; +if(SID_ZOOM_OUT == nSlot) +nNewZoom = basegfx::zoomtools::zoomOut(nOldZoom); +else +nNewZoom = basegfx::zoomtools::zoomIn(nOldZoom); + +pPreview->SetZoom(nNewZoom); eZoom = SvxZoomType::PERCENT; rReq.Done(); }
core.git: sc/source
sc/source/ui/undo/undobase.cxx | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) New commits: commit 2b85bceca88ab119fff5cbdc41fe913435a479ca Author: Pranam Lashkari AuthorDate: Fri May 10 02:02:18 2024 +0300 Commit: Pranam Lashkari CommitDate: Sat May 11 01:48:33 2024 +0200 sc: undo: unify height adjust logic in undo with regular logic in ScBlockUndo::AdjustHeight now we use device like ScViewFunc::SetWidthOrHeight This provides unified behavior with user adjusting height or triggered it by undo problem: in online sometimes undoing would cause wrong selection due to incorrect height set steps to reproduce(happened in certain files only): 1. autofill down a couple of cells 2. undo it 3. try to select the same cell again cell selection will act like auto filled cells are merged cells Change-Id: I81b798c4150284792ac3953caf822fefab0ccee2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167424 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara (cherry picked from commit 726b133fd8c823c7f05a30c1995de26db372174d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167454 Tested-by: Jenkins Reviewed-by: Pranam Lashkari diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index 8ce66d95d0c4..a99dec962d89 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ScSimpleUndo::ScSimpleUndo( ScDocShell* pDocSh ) : @@ -285,18 +286,26 @@ bool ScBlockUndo::AdjustHeight() { ScDocument& rDoc = pDocShell->GetDocument(); -ScopedVclPtrInstance< VirtualDevice > pVirtDev; +ScSizeDeviceProvider aProv(pDocShell); Fraction aZoomX( 1, 1 ); Fraction aZoomY = aZoomX; double nPPTX, nPPTY; ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { -ScViewData& rData = pViewShell->GetViewData(); -nPPTX = rData.GetPPTX(); -nPPTY = rData.GetPPTY(); -aZoomX = rData.GetZoomX(); -aZoomY = rData.GetZoomY(); +if (aProv.IsPrinter()) +{ +nPPTX = aProv.GetPPTX(); +nPPTY = aProv.GetPPTY(); +} +else +{ +ScViewData& rData = pViewShell->GetViewData(); +nPPTX = rData.GetPPTX(); +nPPTY = rData.GetPPTY(); +aZoomX = rData.GetZoomX(); +aZoomY = rData.GetZoomY(); +} } else { @@ -305,7 +314,7 @@ bool ScBlockUndo::AdjustHeight() nPPTY = ScGlobal::nScreenPPTY; } -sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev); +sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice()); bool bRet = rDoc.SetOptimalHeight( aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab(), true);
core.git: sc/source
sc/source/core/tool/address.cxx | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) New commits: commit be7813b880def3aaea9ae00664067b9946235b59 Author: Caolán McNamara AuthorDate: Fri May 10 11:02:21 2024 +0100 Commit: Caolán McNamara CommitDate: Fri May 10 14:48:37 2024 +0200 ofz#68874 avoid Integer-overflow rather than detect it after the fact to keep ubsan happy Change-Id: I1336f7a23fa7170b754b818c1ec42ca85f5c27d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167445 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index b976443fc649..c419d9f3a312 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -136,7 +136,7 @@ const sal_Unicode* parseQuotedName( const sal_Unicode* p, OUString& rName ) static sal_Int64 sal_Unicode_strtol ( const sal_Unicode* p, const sal_Unicode** pEnd ) { -sal_Int64 accum = 0, prev = 0; +sal_Int64 accum = 0; bool is_neg = false; if( *p == '-' ) @@ -147,15 +147,20 @@ static sal_Int64 sal_Unicode_strtol ( const sal_Unicode* p, const sal_Unicode** else if( *p == '+' ) p++; +const sal_Int64 cutoff = is_neg ? -(std::numeric_limits::min() / 10) +: std::numeric_limits::max() / 10; +const sal_Int64 cutlim = is_neg ? -(std::numeric_limits::min() % 10) +: std::numeric_limits::max() % 10; + while (rtl::isAsciiDigit( *p )) { -accum = accum * 10 + *p - '0'; -if( accum < prev ) +int val = *p - '0'; +if (accum > cutoff || (accum == cutoff && val > cutlim)) { *pEnd = nullptr; return 0; } -prev = accum; +accum = accum * 10 + val; p++; }
core.git: sc/source
sc/source/filter/excel/xicontent.cxx |2 +- sc/source/filter/ftools/ftools.cxx|9 ++--- sc/source/filter/inc/ftools.hxx |7 --- sc/source/filter/oox/stylesbuffer.cxx |4 ++-- 4 files changed, 9 insertions(+), 13 deletions(-) New commits: commit 5cc3d3a4433f538394c4c65b1a80a9ea7e4d7ce6 Author: Noel Grandin AuthorDate: Thu May 9 12:44:13 2024 +0200 Commit: Noel Grandin CommitDate: Thu May 9 17:58:53 2024 +0200 Revert "tdf#160706 speed up loading conditional formatting rule in XLS (3)" This reverts commit e1268721d4266ed1254da99581a7c2c3dfb72ba6. caolanm: With the old "bForceName" of true then previously if the style name existed it was renamed to something else and then a fresh style with the requested name created. While now we just reuse it. I'm not very clued in to what calc does, but in writer we might do something like this if we are inserting into an existing document and don't want to clobber existing styles. Except here we sort of did clobber existing styles by renaming them. So I'm unsure of what on earth the original idea was. So I wonder about a "insert into existing calc document" scenario? noelg: Caolan, I was operating under the assumption that this comment here is the desired behaviour. But now that I read it again, I am not so sure. This commit should probably be backed out. Change-Id: If503efa9fa1a7886eb57bb62d1327f81e4410981 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167318 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 8701b3c69204..a2862f7b6988 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -576,7 +576,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) // *** create style sheet *** OUString aStyleName( XclTools::GetCondFormatStyleName( GetCurrScTab(), mnFormatIndex, mnCondIndex ) ); -SfxItemSet& rStyleItemSet = ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), aStyleName ).GetItemSet(); +SfxItemSet& rStyleItemSet = ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), aStyleName, true ).GetItemSet(); const XclImpPalette& rPalette = GetPalette(); diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 1ce82e5dd1d8..bf2b784a994b 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -254,14 +254,9 @@ ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyle } // namespace -ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName ) +ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName ) { -SfxStyleSheetBase* pOldStyleSheet = rPool.Find( rStyleName, SfxStyleFamily::Para ); -if( pOldStyleSheet ) -return static_cast< ScStyleSheet& >(*pOldStyleSheet); - -// create new style sheet -return static_cast< ScStyleSheet& >( rPool.Make( rStyleName, SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined ) ); +return lclMakeStyleSheet( rPool, rStyleName, SfxStyleFamily::Para, bForceName ); } ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName ) diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index 0fdb90cc26ae..7e8a07bce8c8 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -193,11 +193,12 @@ public: // *** style sheet handling *** --- /** Creates and returns a cell style sheet and inserts it into the pool. -@descr If the style sheet is already in the pool, return the existing style. -*/ +@descr If the style sheet is already in the pool, another unused style name is used. +@param bForceName Controls behaviour, if the style already exists: +true = Old existing style will be renamed; false = New style gets another name. */ static ScStyleSheet& MakeCellStyleSheet( ScStyleSheetPool& rPool, -const OUString& rStyleName ); +const OUString& rStyleName, bool bForceName ); /** Creates and returns a page style sheet and inserts it into the pool. @descr If the style sheet is already in the pool, another unused style name is used. @param bForceName Controls behaviour, if the style already exists: diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 76245a6980a3..234d0365bdec 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -3005,7 +3005,7 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const // Create
core.git: sc/source
sc/source/ui/view/hdrcont.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit f1d69a84ac82034d7f98877780c549f06d93792d Author: Heiko Tietze AuthorDate: Fri May 3 11:16:40 2024 +0200 Commit: Heiko Tietze CommitDate: Tue May 7 15:49:22 2024 +0200 Resolves tdf#160324 - Larger hit area for col/row resize actions Tentative solution made optional depending on experimental settings Change-Id: I6d527d2b0d0de3b48f123b626ebf0b6ce60299a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167041 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 98ebabb702c3..bf97dbb01f95 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #define SC_DRAG_MIN 2 @@ -627,6 +628,9 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools SCCOLROW ScHeaderControl::GetMousePos(const Point& rPos, bool& rBorder) const { +// #define nHitArea 5 +const int nHitArea( officecfg::Office::Common::Misc::ExperimentalMode::get() ? 5 : 2 ); + boolbFound = false; SCCOLROWnPos = GetPos(); SCCOLROWnHitNo = nPos; @@ -650,7 +654,7 @@ SCCOLROW ScHeaderControl::GetMousePos(const Point& rPos, bool& rBorder) const nScrPos += GetEntrySize( nEntryNo - 1 ) * nLayoutSign; //! GetHiddenCount() ?? nDif = nMousePos - nScrPos; -if (nDif >= -2 && nDif <= 2) +if (nDif >= -nHitArea && nDif <= +nHitArea) { bFound = true; nHitNo=nEntryNo-1;
core.git: sc/source
sc/source/ui/app/transobj.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 11dcaad533553999dc643807f6f21f8f98bc9e20 Author: Andrea Gelmini AuthorDate: Tue May 7 11:33:06 2024 +0200 Commit: Julien Nabet CommitDate: Tue May 7 15:32:50 2024 +0200 Fix typo Change-Id: I8772d0e12b169559a3bf99347097939ede5db582 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167266 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index f242abc497b0..0d926b980fc2 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -418,7 +418,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt // memory limits, lower the resolution of the bitmap by keeping // the VirtualDevice pixel size within an arbitrary number of // pixels. -// Note: the artibrary "maximum number of pixels" limit that +// Note: the arbitrary "maximum number of pixels" limit that // that Skia can handle may need to be raised or lowered for // platforms other than macOS. static constexpr tools::Long nCopyToImageMaxPixels = 8192 * 8192;
core.git: sc/source
sc/source/ui/app/scmod.cxx |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) New commits: commit e0b87bf9a34a06d344f4b803c31442c2f723a8ee Author: Caolán McNamara AuthorDate: Mon May 6 20:38:54 2024 +0100 Commit: Caolán McNamara CommitDate: Tue May 7 10:21:05 2024 +0200 cid#1596888 Explicit null dereferenced Change-Id: I8b6b99a66913a1a6f30046d1cba9fce87d469415 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167249 Reviewed-by: Caolán McNamara Tested-by: Jenkins diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index f541ca27b679..50d71a589182 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -217,8 +217,9 @@ void ScModule::ConfigurationChanged(utl::ConfigurationBroadcaster* p, Configurat { SfxViewShell* pSfxViewShell = SfxViewShell::Current(); ScTabViewShell* pViewShell = dynamic_cast(pSfxViewShell); +SfxObjectShell* pCurrentSh = SfxObjectShell::Current(); -if (pViewShell) +if (pViewShell && pCurrentSh) { ScViewRenderingOptions aViewRenderingOptions(pViewShell->GetViewRenderingData()); Color aFillColor(m_pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor); @@ -227,9 +228,7 @@ void ScModule::ConfigurationChanged(utl::ConfigurationBroadcaster* p, Configurat const bool bUnchanged(aViewRenderingOptions == pViewShell->GetViewRenderingData()); if (!bUnchanged) pViewShell->SetViewRenderingData(aViewRenderingOptions); -ScModelObj* pScModelObj = nullptr; -if (SfxObjectShell* pCurrentSh = SfxObjectShell::Current()) -pScModelObj = comphelper::getFromUnoTunnel(pCurrentSh->GetModel()); +ScModelObj* pScModelObj = comphelper::getFromUnoTunnel(pCurrentSh->GetModel()); SfxLokHelper::notifyViewRenderState(pViewShell, pScModelObj); // In Online, the document color is the one used for the background, contrary to // Writer and Draw that use the application background color.
core.git: sc/source
sc/source/ui/app/transobj.cxx | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) New commits: commit 8d9f54165d28d83092667b7bfcd0ee48ade54c87 Author: Patrick Luby AuthorDate: Sat May 4 19:58:03 2024 -0400 Commit: Patrick Luby CommitDate: Mon May 6 19:15:21 2024 +0200 tdf#160855 fix crash due to Skia's internal maximum pixel limit Somewhere in the tens of thousands of selected fill cells, the size of the VirtualDevice exceeds 1 GB of pixels. But Skia, at least on macOS, will fail to create a surface. Even if there is ample free memory, Skia/Raster will fail. The second problem is that even if you disable Skia, the crash is just delayed when a BitmapEx is created from the VirtualDevice and malloc() fails. Since this data flavor really triggers one or more system memory limits, lower the resolution of the bitmap by keeping the VirtualDevice pixel size within an arbitrary number of pixels. Note: the artibrary "maximum number of pixels" limit that that Skia can handle may need to be raised or lowered for platforms other than macOS. Change-Id: Ie087f2db152470aa70521fbe5fe6c7cedd8504af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167145 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Patrick Luby diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index b42154945e89..f242abc497b0 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -405,11 +405,38 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt aReducedBlock.aEnd.Col(), aReducedBlock.aEnd.Row(), aReducedBlock.aStart.Tab() ); ScopedVclPtrInstance< VirtualDevice > pVirtDev; - pVirtDev->SetOutputSizePixel(pVirtDev->LogicToPixel(aMMRect.GetSize(), MapMode(MapUnit::Map100thMM))); + +// tdf#160855 fix crash due to Skia's internal maximum pixel limit +// Somewhere in the tens of thousands of selected fill cells, +// the size of the VirtualDevice exceeds 1 GB of pixels. But +// Skia, at least on macOS, will fail to create a surface. +// Even if there is ample free memory, Skia/Raster will fail. +// The second problem is that even if you disable Skia, the +// crash is just delayed when a BitmapEx is created from the +// VirtualDevice and malloc() fails. +// Since this data flavor really triggers one or more system +// memory limits, lower the resolution of the bitmap by keeping +// the VirtualDevice pixel size within an arbitrary number of +// pixels. +// Note: the artibrary "maximum number of pixels" limit that +// that Skia can handle may need to be raised or lowered for +// platforms other than macOS. +static constexpr tools::Long nCopyToImageMaxPixels = 8192 * 8192; +Fraction aScale(1.0); +Size aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), MapMode(MapUnit::Map100thMM)); +tools::Long nPixels(aPixelSize.Width() * aPixelSize.Height()); +if (nPixels < 0 || nPixels > nCopyToImageMaxPixels) +{ +aScale = Fraction(nCopyToImageMaxPixels, nPixels); +aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), MapMode(MapUnit::Map100thMM, Point(), aScale, aScale)); +nPixels = aPixelSize.Width() * aPixelSize.Height(); +} + +pVirtDev->SetOutputSizePixel(aPixelSize); PaintToDev( pVirtDev, *m_pDoc, 1.0, aReducedBlock ); -pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) ); +pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel, Point(), aScale, aScale ) ); BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), pVirtDev->GetOutputSize() ); bOK = SetBitmapEx( aBmp, rFlavor ); }
core.git: sc/source
sc/source/ui/app/inputhdl.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 864d0f0d8da33f6f5c0a99ae54a52c0172449901 Author: Caolán McNamara AuthorDate: Sat May 4 21:20:04 2024 +0100 Commit: Caolán McNamara CommitDate: Sun May 5 12:38:48 2024 +0200 always check return of SfxViewShell::Current() Change-Id: If8f50536295a44a4a8cf692d758ca03e726902e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167143 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index d04d7fdab547..6dd8315e7b4e 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1277,7 +1277,7 @@ void ScInputHandler::ShowArgumentsTip( OUString& rSelText ) } const SfxViewShell* pViewShell = SfxViewShell::Current(); -if (comphelper::LibreOfficeKit::isActive() && pViewShell->isLOKDesktop()) +if (comphelper::LibreOfficeKit::isActive() && pViewShell && pViewShell->isLOKDesktop()) { tools::JsonWriter writer; writer.put("type", "formulausage");
core.git: sc/source
sc/source/core/data/patattr.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 8a348300094dcf9d59f94caa75d32453c45c8ee0 Author: Caolán McNamara AuthorDate: Fri May 3 20:19:15 2024 +0100 Commit: Caolán McNamara CommitDate: Sat May 4 12:01:08 2024 +0200 cid#1596522 Inequality comparison against NULL Change-Id: Ib489137e8fa2a5745a41703a6d25f9c950223ab8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167102 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 42bb54937a45..c9cad8641bce 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -274,7 +274,7 @@ bool CellAttributeHelper::RegisteredAttrSetLess::operator()(const ScPatternAttr* return true; if (cmp > 0) return false; -return lhs < static_cast(nullptr); +return false; } bool CellAttributeHelper::RegisteredAttrSetLess::operator()(const OUString* lhs, const ScPatternAttr* rhs) const { @@ -283,7 +283,7 @@ bool CellAttributeHelper::RegisteredAttrSetLess::operator()(const OUString* lhs, return true; if (cmp > 0) return false; -return static_cast(nullptr) < rhs; +return true; }
core.git: sc/source
sc/source/ui/inc/gridwin.hxx |2 + sc/source/ui/view/gridwin4.cxx | 74 + sc/source/ui/view/tabview.cxx | 21 +++ 3 files changed, 62 insertions(+), 35 deletions(-) New commits: commit 09e135ab80fffc10950a16716111d66d9ed99f5f Author: Printf Debugging AuthorDate: Wed May 1 02:06:48 2024 +0530 Commit: Heiko Tietze CommitDate: Thu May 2 09:32:39 2024 +0200 tdf#160780 Overlays should not cover EditView. ScGridWindow::DrawContent(...) draws the spreadsheet elements. ScTabView::SetNewVisArea() is called after DrawContent(...) which calls UpdateAllOverlays(), and the overlays hide the EditView. Redrawing EditView in SetNewVisArea() fixes the issue. Change-Id: I768c8b7a1c9306fb94e82bca74ce0dcb2ced2782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166784 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 5c548e5af824..ac5c81700f20 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -206,6 +206,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::DocWindow, public DropTarget sal_uInt16 nPaintCount; tools::Rectangle aRepaintPixel; +tools::Rectangle aEditRectangle; ScAddress aAutoMarkPos; ScAddress aListValPos; @@ -441,6 +442,7 @@ public: /// Draw content of the gridwindow; shared between the desktop and the tiled rendering. void DrawContent(OutputDevice , const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText); +void DrawEditView(OutputDevice , EditView *pEditView); voidCreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 896d44f5898b..4b03921e1287 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -659,6 +659,43 @@ Fraction GetZoom(const ScViewData& rViewData, int i) } } + +void ScGridWindow::DrawEditView(OutputDevice , EditView *pEditView) +{ +SCCOL nCol1 = mrViewData.GetEditStartCol(); +SCROW nRow1 = mrViewData.GetEditStartRow(); +SCCOL nCol2 = mrViewData.GetEditEndCol(); +SCROW nRow2 = mrViewData.GetEditEndRow(); + +rDevice.SetLineColor(); +rDevice.SetFillColor(pEditView->GetBackgroundColor()); +Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich ); +Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich ); + +// don't overwrite grid +bool bLayoutRTL = mrViewData.GetDocument().IsLayoutRTL(mrViewData.GetTabNo()); +tools::Long nLayoutSign = bLayoutRTL ? -1 : 1; +aEnd.AdjustX( -(2 * nLayoutSign) ); +aEnd.AdjustY( -2 ); + +// set the correct mapmode +tools::Rectangle aBackground(aStart, aEnd); + +// paint the background +rDevice.SetMapMode(mrViewData.GetLogicMode()); + +tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground)); +//tdf#100925, rhbz#1283420, Draw some text here, to get +//X11CairoTextRender::getCairoContext called, so that the forced read +//from the underlying X Drawable gets it to sync. +rDevice.DrawText(aLogicRect.BottomLeft(), " "); +rDevice.DrawRect(aLogicRect); + +// paint the editeng text +pEditView->Paint(rDevice.PixelToLogic(aEditRectangle), ); +rDevice.SetMapMode(MapMode(MapUnit::MapPixel)); +} + void ScGridWindow::DrawContent(OutputDevice , const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText) { @@ -1290,42 +1327,9 @@ void ScGridWindow::DrawContent(OutputDevice , const ScTableInfo& rTableI // buffer and on top of everything. if (bInPlaceEditing && !bIsTiledRendering) { -// get the coordinates of the area we need to clear (overpaint by -// the background) -SCCOL nCol1 = mrViewData.GetEditStartCol(); -SCROW nRow1 = mrViewData.GetEditStartRow(); -SCCOL nCol2 = mrViewData.GetEditEndCol(); -SCROW nRow2 = mrViewData.GetEditEndRow(); -rDevice.SetLineColor(); -rDevice.SetFillColor(pEditView->GetBackgroundColor()); -Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich ); -Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich ); - -// don't overwrite grid -tools::Long nLayoutSign = bLayoutRTL ? -1 : 1; -aEnd.AdjustX( -(2 * nLayoutSign) ); -aEnd.AdjustY( -2 ); - -// set the correct mapmode -tools::Rectangle aBackground(aStart, aEnd); - -// paint the background -rDevice.SetMapMode(mrViewData.GetLogicMode()); - -tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground)); -//tdf#100925, rhbz#1283420, Draw some text here, to get -//X11CairoTextRender::getCairoContext called, so that the forced read -//from the underlying X Drawable gets it
core.git: sc/source
sc/source/ui/dbgui/scuiasciiopt.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 312740f1ef96ef6fe7e83d5fb1f5d2d4b2d2471c Author: Pranam Lashkari AuthorDate: Fri Apr 26 23:51:14 2024 +0100 Commit: Caolán McNamara CommitDate: Wed May 1 11:03:48 2024 +0200 LOK: hide cancel button in csv import dialog it did not make any sense to have cancel button in this dialog because it would not load file at all. user can still use close button in title bar to close dialog Change-Id: Id3ba3e4030553db18bdbd068d92b3395f4fb8c3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166764 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos (cherry picked from commit 290d70a476bab7d100baa3568ec547633109033e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166835 (cherry picked from commit 7171c9e8f6fecedac29e89deaeb2afa4d67a2a17) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166844 Reviewed-by: Caolán McNamara Tested-by: Jenkins diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 6cb73c803c39..22f2867c3545 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -628,6 +628,9 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, std::u16string_view aD mxCkbSkipEmptyCells->set_active(false); mxCkbSkipEmptyCells->hide(); } + +if (comphelper::LibreOfficeKit::isActive()) +m_xBuilder->weld_button("cancel")->hide(); m_xDialog->SetInstallLOKNotifierHdl(LINK(this, ScImportAsciiDlg, InstallLOKNotifierHdl)); }
core.git: sc/source
sc/source/ui/miscdlgs/inscldlg.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 54404c2c20399a7349ad1abb9f37df3048c7aad1 Author: Caolán McNamara AuthorDate: Tue Apr 30 08:35:48 2024 +0100 Commit: Caolán McNamara CommitDate: Tue Apr 30 12:16:38 2024 +0200 cid#1596697 Dereference after null check Change-Id: I93c9401144fbe5a83ee461ff3fe4334326f6f05b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166886 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/miscdlgs/inscldlg.cxx b/sc/source/ui/miscdlgs/inscldlg.cxx index bfbfc0462936..cc9d60472e5c 100644 --- a/sc/source/ui/miscdlgs/inscldlg.cxx +++ b/sc/source/ui/miscdlgs/inscldlg.cxx @@ -95,8 +95,9 @@ ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove) } // if some cells are selected, then disable the SpinButtons -m_xNumberOfCols->set_sensitive(bColCount && !pViewData->GetMarkData().IsMarked()); -m_xNumberOfRows->set_sensitive(bRowsCount && !pViewData->GetMarkData().IsMarked()); +const bool bMarked = pViewData && pViewData->GetMarkData().IsMarked(); +m_xNumberOfCols->set_sensitive(bColCount && !bMarked); +m_xNumberOfRows->set_sensitive(bRowsCount && !bMarked); } ScInsertCellDlg::~ScInsertCellDlg() {}
core.git: sc/source
sc/source/ui/view/gridwin.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 9e7d70230212ab95cda957a0fe51e37f7ca95021 Author: Heiko Tietze AuthorDate: Mon Apr 29 16:29:57 2024 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Tue Apr 30 09:21:45 2024 +0200 Related tdf#143733 - Cell focus must not cover content This patch moves the cell focus rectangle outside the active cell, relative to the zoom factor Change-Id: I9df98125d5c0e571af841442d4db8f02d3c05487 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166870 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 1b7c16f1884b..2762929ccb9b 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -6589,11 +6589,15 @@ void ScGridWindow::UpdateCursorOverlay() tools::Long nSizeYPix; mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); +const double nAdjustBorder(mrViewData.GetZoomX() * 3); +aScrPos.AdjustX(-nAdjustBorder); +aScrPos.AdjustY(-nAdjustBorder); + if (bLayoutRTL) aScrPos.AdjustX( -(nSizeXPix - 2) ); // move instead of mirroring // show the cursor as 4 (thin) rectangles -tools::Rectangle aRect(aScrPos, Size(nSizeXPix - 1, nSizeYPix - 1)); +tools::Rectangle aRect(aScrPos, Size(nSizeXPix + 2*nAdjustBorder, nSizeYPix + 2*nAdjustBorder)); float fScaleFactor = GetDPIScaleFactor();
core.git: sc/source
sc/source/filter/inc/addressconverter.hxx | 37 --- sc/source/filter/oox/addressconverter.cxx | 156 +- sc/source/filter/oox/scenariobuffer.cxx |3 sc/source/filter/oox/sheetdatacontext.cxx |3 4 files changed, 14 insertions(+), 185 deletions(-) New commits: commit a50b2d11ed6066a655278305f1fc880d3a5fe911 Author: Justin Luth AuthorDate: Wed Apr 24 14:23:22 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Apr 30 08:48:11 2024 +0200 xlsx import: parse short-hand version of address Since I did this for the range, I might as well try to entirely remove parseOoxAddress2d. This allows me to remove parseOoxAddress2d. No point in having duplicate functions to turn a string into an ScAddress. [I assume this was a left-over from when this code was in /oox and didn't have access to sc methods.] Earlier patchsets checked that the new method and the old method returned the same values for all existing unit tests. Change-Id: Ic45eaf53417b0d8afad7b49959014162549653ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166606 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx index 034bcbacaf39..41fe38cd0efd 100644 --- a/sc/source/filter/inc/addressconverter.hxx +++ b/sc/source/filter/inc/addressconverter.hxx @@ -97,34 +97,6 @@ class AddressConverter final : public WorkbookHelper public: explicitAddressConverter( const WorkbookHelper& rHelper ); -/** Tries to parse the passed string for a 2d cell address in A1 notation. - -This function accepts all strings that match the regular expression -"[a-zA-Z]{1,6}0*[1-9][0-9]{0,8}" (without quotes), i.e. 1 to 6 letters -for the column index (translated to 0-based column indexes from 0 to -321,272,405), and 1 to 9 digits for the 1-based row index (translated -to 0-based row indexes from 0 to 999,999,998). The row number part may -contain leading zeros, they will be ignored. It is up to the caller to -handle cell addresses outside of a specific valid range (e.g. the -entire spreadsheet). - -@param ornColumn (out-parameter) Returns the converted column index. -@param ornRow (out-parameter) returns the converted row index. -@param rString The string containing the cell address. -@param nStart Start index of string part in rString to be parsed. -@param nLength Length of string part in rString to be parsed. - -@return true = Parsed string was valid, returned values can be used. - */ -static bool parseOoxAddress2d( -sal_Int32& ornColumn, sal_Int32& ornRow, -std::u16string_view aString, -sal_Int32 nStart = 0, -sal_Int32 nLength = SAL_MAX_INT32 ); - -static bool parseOoxAddress2d( -sal_Int32& ornColumn, sal_Int32& ornRow, std::string_view pStr ); - /** Returns the biggest valid cell address in the own Calc document. */ const ScAddress& getMaxApiAddress() const { return maMaxApiPos; } @@ -188,10 +160,7 @@ public: static boolconvertToCellAddressUnchecked( ScAddress& orAddress, const OUString& rString, -sal_Int16 nSheet ); - -static bool convertToCellAddressUnchecked( -ScAddress& orAddress, std::string_view pStr, sal_Int16 nSheet ); +sal_Int16 nSheet, const ScDocument& rDoc); /** Tries to convert the passed string to a single cell address. @@ -208,10 +177,6 @@ public: sal_Int16 nSheet, bool bTrackOverflow ); -bool convertToCellAddress( -ScAddress& rAddress, -std::string_view pStr, sal_Int16 nSheet, bool bTrackOverflow ); - /** Returns a valid cell address by moving it into allowed dimensions. @param rString Cell address string in A1 notation. diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index 4109ef3c8833..98a8dae3b625 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -80,123 +80,6 @@ AddressConverter::AddressConverter( const WorkbookHelper& rHelper ) : initializeMaxPos( OOX_MAXTAB, OOX_MAXCOL, OOX_MAXROW ); } -bool AddressConverter::parseOoxAddress2d( -sal_Int32& ornColumn, sal_Int32& ornRow, -std::u16string_view aString, sal_Int32 nStart, sal_Int32 nLength ) -{ -ornColumn = ornRow = 0; -if( (nStart < 0) || (nStart >= sal_Int32(aString.size())) || (nLength < 2) ) -return false; - -const sal_Unicode* pcChar = aString.data() +
core.git: sc/source
sc/source/core/data/column3.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit e3ce4aad47c052dcd67107f7c91336f4ecc949be Author: Miklos Vajna AuthorDate: Wed Apr 24 09:37:35 2024 +0200 Commit: Miklos Vajna CommitDate: Thu Apr 25 12:19:32 2024 +0200 sc: fix crash in ScColumn::SetEditText() Crashreport: > SIG Fatal signal received: SIGSEGV code: 128 for address: 0x0 > program/libsclo.so > ScColumn::SetEditText(int, std::unique_ptr >) > sc/source/core/data/column3.cxx:2362 > program/libsclo.so > ScTable::SetEditText(short, int, std::unique_ptr >) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > ScDocument::SetEditText(ScAddress const&, std::unique_ptr >) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > ScDocFunc::SetEditCell(ScAddress const&, EditTextObject const&, bool) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > (anonymous namespace)::finalizeFormulaProcessing(std::shared_ptr<(anonymous namespace)::FormulaProcessingContext>) > sc/source/ui/view/viewfunc.cxx:565 Change-Id: I331ca8784702fdcb0ebad6a0a73390dbe2615ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166612 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index e7a971e8c613..26fcd36de0ba 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2356,6 +2356,11 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const OUString& rString, void ScColumn::SetEditText( SCROW nRow, std::unique_ptr pEditText ) { +if (!pEditText) +{ +return; +} + pEditText->NormalizeString(GetDoc().GetSharedStringPool()); std::vector aNewSharedRows; sc::CellStoreType::iterator it = GetPositionToInsert(nRow, aNewSharedRows, false);
core.git: sc/source
sc/source/filter/html/htmlpars.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d5823f417248663d78072e2a0be162175def2235 Author: Caolán McNamara AuthorDate: Wed Apr 24 20:10:38 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Apr 25 09:28:05 2024 +0200 ofz#68269 more fixes to sc html parser Change-Id: I2fd889c438d4707a4e174a5a4300e742cd895d3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166607 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index cba641f5136f..6e87e67fe2af 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -689,7 +689,7 @@ void ScHTMLLayoutParser::Adjust() if ( pE->nCol != nColBeforeSkip ) { size_t nCount = maColOffset.size(); -if ( nCount <= o3tl::make_unsigned(pE->nCol) ) +if (pE->nCol < 0 || nCount <= o3tl::make_unsigned(pE->nCol)) { pE->nOffset = static_cast(maColOffset[nCount-1]); MakeCol( , pE->nOffset, pE->nWidth, nOffsetTolerance, nOffsetTolerance );
core.git: sc/source
sc/source/core/tool/token.cxx | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) New commits: commit 4ed26399e2c9a0d35a1f7e6f19f68a5bb0303109 Author: Justin Luth AuthorDate: Tue Apr 23 13:38:08 2024 -0400 Commit: Justin Luth CommitDate: Tue Apr 23 23:00:56 2024 +0200 NFC ScRawToken::CreateToken: ocPush uses the same function Ever since commit 87307aba9e8dbca16672e6df701d9f905b9e1786 Author: Jens-Heiner Rechtien on Thu Jan 8 10:47:13 2009 + CWS-TOOLING: integrate CWS frmdlg case svSingleRef : if (eOp == ocPush) return new ScSingleRefToken( aRef.Ref1 ); else -return new ScSingleRefOpToken( eOp, aRef.Ref1 ); +return new ScSingleRefToken( aRef.Ref1, eOp ); case svDoubleRef : if (eOp == ocPush) return new ScDoubleRefToken( aRef ); else -return new ScDoubleRefOpToken( eOp, aRef ); +return new ScDoubleRefToken( aRef, eOp ); Instead of using different functions, they now use the same function where optional eOp = ocPush [sc/inc/token.hxx]. Change-Id: I3ee0f308bd983c3edd54fdd064b957b63ca4c0d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166564 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 33e520723213..364913e4fa99 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -370,15 +370,9 @@ FormulaToken* ScRawToken::CreateToken(ScSheetLimits& rLimits) const return new FormulaStringOpToken(eOp, std::move(aSS)); } case svSingleRef : -if (eOp == ocPush) -return new ScSingleRefToken(rLimits, aRef.Ref1 ); -else -return new ScSingleRefToken(rLimits, aRef.Ref1, eOp ); +return new ScSingleRefToken(rLimits, aRef.Ref1, eOp); case svDoubleRef : -if (eOp == ocPush) -return new ScDoubleRefToken(rLimits, aRef ); -else -return new ScDoubleRefToken(rLimits, aRef, eOp ); +return new ScDoubleRefToken(rLimits, aRef, eOp); case svMatrix : IF_NOT_OPCODE_ERROR( ocPush, ScMatrixToken); return new ScMatrixToken( pMat );
core.git: sc/source
sc/source/ui/view/cellsh1.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 695e8742da850bbb15c2e6d2b5d4c99a0daf4925 Author: Sahil Gautam AuthorDate: Sun Apr 21 23:24:50 2024 +0530 Commit: Stephan Bergmann CommitDate: Sun Apr 21 23:15:17 2024 +0200 tdf#80390 Use local copy in anonymous function. The nCount object might go out of scope, as it's used by an async function. https://gerrit.libreoffice.org/c/core/+/164316/comments/507b830b_001a71eb Change-Id: I4218f6e35b61704115047481cb97a193c593a072 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154750 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 69fbd1ead083..ae55a3312d25 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -352,7 +352,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case FID_INS_CELL: { InsCellCmd eCmd=INS_NONE; -size_t nCount = 0; if ( pReqArgs ) { @@ -386,20 +385,21 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); VclPtr pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag)); -pDlg->StartExecuteAsync([pDlg, pTabViewShell, ](sal_Int32 nResult){ +pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){ if (nResult == RET_OK) { SfxRequest aRequest(pTabViewShell->GetViewFrame(), FID_INS_CELL); InsCellCmd eTmpCmd = pDlg->GetInsCellCmd(); -nCount = pDlg->GetCount(); -InsertCells(pTabViewShell, aRequest, eTmpCmd, nCount); +size_t nInsCount = pDlg->GetCount(); +InsertCells(pTabViewShell, aRequest, eTmpCmd, nInsCount); } pDlg->disposeOnce(); }); +break; } } -InsertCells(pTabViewShell, rReq, eCmd, nCount); +InsertCells(pTabViewShell, rReq, eCmd); } break;
core.git: sc/source
sc/source/core/data/PivotTableFormatOutput.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c81fe7f7e4b416f818d7dfd8e141bccebce37a16 Author: Caolán McNamara AuthorDate: Sat Apr 20 21:25:27 2024 +0100 Commit: Caolán McNamara CommitDate: Sun Apr 21 14:51:28 2024 +0200 crashtesting: crash seen on import of forum-mso-en4-602306.xlsx Change-Id: Ib8bd453483c72382330b4c960cdbe735bdb97eac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166374 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/data/PivotTableFormatOutput.cxx b/sc/source/core/data/PivotTableFormatOutput.cxx index 575fd5e77508..83bf865573a4 100644 --- a/sc/source/core/data/PivotTableFormatOutput.cxx +++ b/sc/source/core/data/PivotTableFormatOutput.cxx @@ -98,7 +98,7 @@ void initFormatOutputField(size_t nSelectionIndex, std::vector 1) +if (rSelection.nIndices.size() > nSelectionIndex) rOutputField.nIndex = rSelection.nIndices[nSelectionIndex]; else rOutputField.nIndex = rSelection.nIndices[0];
core.git: sc/source
sc/source/filter/html/htmlpars.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 57f4581e326453ebed8fe688ade924804aae46dd Author: Caolán McNamara AuthorDate: Fri Apr 19 17:20:25 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Apr 20 17:09:51 2024 +0200 ofz#68081 Use-of-uninitialized-value Change-Id: If632bd8d503f5e8c9acdab912ac0bc8a00dfd534 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166308 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index a09adb8c46eb..cba641f5136f 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -437,7 +437,9 @@ bool ScHTMLLayoutParser::SeekOffset( const ScHTMLColOffset* pOffset, sal_uInt16 OSL_ENSURE( pOffset, "ScHTMLLayoutParser::SeekOffset - illegal call" ); ScHTMLColOffset::const_iterator it = pOffset->find( nOffset ); bool bFound = it != pOffset->end(); -sal_uInt16 nPos = it - pOffset->begin(); +size_t nPos = it - pOffset->begin(); +if (nPos > o3tl::make_unsigned(std::numeric_limits::max())) +return false; *pCol = static_cast(nPos); if ( bFound ) return true;
core.git: sc/source
sc/source/filter/excel/excrecds.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 78bd5e2523d077a67468b752d4788a2c3b43fb5f Author: Justin Luth AuthorDate: Thu Apr 18 14:46:30 2024 -0400 Commit: Miklos Vajna CommitDate: Fri Apr 19 14:21:13 2024 +0200 xlsx export: fix corrupt file for Excel: protectedRange must have sqref Excel refuses to open a file if there is no sqref specified In this case, import failed to import sqref="10:131". A follow-up commit avoids exporting these shorthand ranges. I don't see much point in trying to create a unit test for this. (I assume protectedRange is simply round-tripped because I doubt LO has working support for protectedRanges.) commit 9cee6a45632623d3d7e5a574128940f96d8c926b Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100 added ScEnhancedProtection to ScTableProtection Change-Id: I97ef1ee801898bdcace067d62890c4ce0e7cf1d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166265 Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Tested-by: Justin Luth diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 86afa5a6c163..f18e9f829bbe 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement(XML_protectedRanges); for (const auto& rProt : rProts) { +if (!rProt.maRangeList.is()) +continue; // Excel refuses to open if sqref is missing from a protectedRange + SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(), "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor"); rWorksheet->singleElement( XML_protectedRange, @@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) XML_hashValue, sax_fastparser::UseIf(rProt.maPasswordHash.maHashValue, !rProt.maPasswordHash.maHashValue.isEmpty()), XML_saltValue, sax_fastparser::UseIf(rProt.maPasswordHash.maSaltValue, !rProt.maPasswordHash.maSaltValue.isEmpty()), XML_spinCount, sax_fastparser::UseIf(OString::number(rProt.maPasswordHash.mnSpinCount), rProt.maPasswordHash.mnSpinCount != 0), -XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr); +XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr()); } rWorksheet->endElement( XML_protectedRanges); }
core.git: sc/source
sc/source/filter/inc/extlstcontext.hxx|2 +- sc/source/filter/oox/condformatbuffer.cxx |2 +- sc/source/filter/oox/extlstcontext.cxx|8 3 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 2f3b47ec80235318c4d9f843b2ef52e01611fa5c Author: Noel Grandin AuthorDate: Thu Apr 18 10:52:21 2024 +0200 Commit: Noel Grandin CommitDate: Fri Apr 19 10:16:19 2024 +0200 rename rStyleIdx -> gnStyleIdx to make it obvious we are dealing with nasty global state here Change-Id: I7f2193600a6459c3a5cd51fece8151ac46aebe7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166242 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx index 077ebdbebf8e..c8c3f5ddb355 100644 --- a/sc/source/filter/inc/extlstcontext.hxx +++ b/sc/source/filter/inc/extlstcontext.hxx @@ -16,7 +16,7 @@ #include #include -extern sal_Int32 rStyleIdx; // Holds index of the style (Will be reset by finalize import) +extern sal_Int32 gnStyleIdx; // Holds index of the style (Will be reset by finalize import) struct ScDataBarFormatData; namespace oox { class AttributeList; } diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index d1ee97ca70ac..2b212352eaa7 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1354,7 +1354,7 @@ void CondFormatBuffer::finalizeImport() ++nExtCFIndex; } -rStyleIdx = 0; // Resets style index. +gnStyleIdx = 0; // Resets style index. } CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm ) diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index d6af04240572..9e542b744b7f 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -30,7 +30,7 @@ using ::oox::core::ContextHandlerRef; using ::oox::xls::CondFormatBuffer; -sal_Int32 rStyleIdx = 0; +sal_Int32 gnStyleIdx = 0; // Holds index of the style (Will be reset by finalize import) namespace oox::xls { @@ -292,10 +292,10 @@ void ExtConditionalFormattingContext::onEndElement() maModel.eOperator = ScConditionMode::Direct; } -if (Dxf* pDxf = getStyles().getExtDxfs().get(rStyleIdx).get()) +if (Dxf* pDxf = getStyles().getExtDxfs().get(gnStyleIdx).get()) pDxf->finalizeImport(); -maModel.aStyle = getStyles().createExtDxfStyle(rStyleIdx); -rStyleIdx++; +maModel.aStyle = getStyles().createExtDxfStyle(gnStyleIdx); +gnStyleIdx++; nFormulaCount = 0; maModels.push_back(maModel); }
core.git: sc/source
sc/source/core/data/PivotTableFormatOutput.cxx | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) New commits: commit fba7ac09846099932c14fe78fb01a1b762b7 Author: Caolán McNamara AuthorDate: Thu Apr 18 09:38:07 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Apr 18 20:24:51 2024 +0200 crashtesting: crash on export of forum-mso-en4-470772.xlsx to xlsx similar fix as: commit 1d5630c5deeec5dca724c29ec8c886bfa71a2099 Date: Tue Apr 16 15:21:49 2024 +0900 pivot: add checks that prevent reading out of vector bounds Change-Id: I190da7586cff9c7e8dd4011ad61e68abba6ecd53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166240 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/data/PivotTableFormatOutput.cxx b/sc/source/core/data/PivotTableFormatOutput.cxx index cdd2ac90914f..575fd5e77508 100644 --- a/sc/source/core/data/PivotTableFormatOutput.cxx +++ b/sc/source/core/data/PivotTableFormatOutput.cxx @@ -58,16 +58,13 @@ public: { std::vector aNames; fillNamesForDimension(aNames, nDimension); -maNameCache.emplace(nDimension, aNames); -return aNames[nIndex]; -} -else -{ -std::vector& rNames = iterator->second; -if (nIndex >= rNames.size()) -return OUString(); -return rNames[nIndex]; +iterator = maNameCache.emplace(nDimension, aNames).first; } + +const std::vector& rNames = iterator->second; +if (nIndex >= rNames.size()) +return OUString(); +return rNames[nIndex]; } };
core.git: sc/source
sc/source/filter/excel/xicontent.cxx |2 +- sc/source/filter/ftools/ftools.cxx|9 +++-- sc/source/filter/inc/ftools.hxx |7 +++ sc/source/filter/oox/stylesbuffer.cxx |4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) New commits: commit e1268721d4266ed1254da99581a7c2c3dfb72ba6 Author: Noel Grandin AuthorDate: Thu Apr 18 10:50:38 2024 +0200 Commit: Noel Grandin CommitDate: Thu Apr 18 15:42:01 2024 +0200 tdf#160706 speed up loading conditional formatting rule in XLS (3) the comment when calling MakeCellStyleSheet does not match the implementation, so make the implementation match the comment. i.e. if there is an existing stylesheet with that name, just return it. Reduces load time for me from 47s to 33s Change-Id: If1bd08baf8515933b87c075d9eef04bc0a125357 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166241 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index a2862f7b6988..8701b3c69204 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -576,7 +576,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) // *** create style sheet *** OUString aStyleName( XclTools::GetCondFormatStyleName( GetCurrScTab(), mnFormatIndex, mnCondIndex ) ); -SfxItemSet& rStyleItemSet = ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), aStyleName, true ).GetItemSet(); +SfxItemSet& rStyleItemSet = ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), aStyleName ).GetItemSet(); const XclImpPalette& rPalette = GetPalette(); diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index bf2b784a994b..1ce82e5dd1d8 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -254,9 +254,14 @@ ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyle } // namespace -ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName ) +ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName ) { -return lclMakeStyleSheet( rPool, rStyleName, SfxStyleFamily::Para, bForceName ); +SfxStyleSheetBase* pOldStyleSheet = rPool.Find( rStyleName, SfxStyleFamily::Para ); +if( pOldStyleSheet ) +return static_cast< ScStyleSheet& >(*pOldStyleSheet); + +// create new style sheet +return static_cast< ScStyleSheet& >( rPool.Make( rStyleName, SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined ) ); } ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName ) diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index 7e8a07bce8c8..0fdb90cc26ae 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -193,12 +193,11 @@ public: // *** style sheet handling *** --- /** Creates and returns a cell style sheet and inserts it into the pool. -@descr If the style sheet is already in the pool, another unused style name is used. -@param bForceName Controls behaviour, if the style already exists: -true = Old existing style will be renamed; false = New style gets another name. */ +@descr If the style sheet is already in the pool, return the existing style. +*/ static ScStyleSheet& MakeCellStyleSheet( ScStyleSheetPool& rPool, -const OUString& rStyleName, bool bForceName ); +const OUString& rStyleName ); /** Creates and returns a page style sheet and inserts it into the pool. @descr If the style sheet is already in the pool, another unused style name is used. @param bForceName Controls behaviour, if the style already exists: diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 234d0365bdec..76245a6980a3 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -3005,7 +3005,7 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const // Create a cell style. This may overwrite an existing style if // one with the same name exists. ScStyleSheet& rStyleSheet = ScfTools::MakeCellStyleSheet( -*getScDocument().GetStyleSheetPool(), rStyleName, true); +*getScDocument().GetStyleSheetPool(), rStyleName); rStyleSheet.ResetParent(); SfxItemSet& rStyleItemSet = @@ -3033,7 +3033,7 @@ OUString StylesBuffer::createExtDxfStyle( sal_Int32 nDxfId ) const // Create a cell style. This may overwrite an existing style if // one with the same name exists. ScStyleSheet& rStyleSheet =
core.git: sc/source
sc/source/core/tool/formularesult.cxx |7 +++ sc/source/core/tool/interpr4.cxx |1 + 2 files changed, 8 insertions(+) New commits: commit 42c235fe8a616afea4c838901f73c52a262b1337 Author: Caolán McNamara AuthorDate: Thu Apr 18 09:23:39 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Apr 18 14:40:21 2024 +0200 Related: tdf#160056 use simple ref count for temp double tokens Change-Id: I268a20fb4f87c62f2344f1b518a3a79ac3e8b55e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166232 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/formularesult.cxx b/sc/source/core/tool/formularesult.cxx index 08ef363ff68f..234c17780b4e 100644 --- a/sc/source/core/tool/formularesult.cxx +++ b/sc/source/core/tool/formularesult.cxx @@ -661,6 +661,13 @@ void ScFormulaResult::HandleStuffAfterParallelCalculation() mpToken->IncRef(); mbNoneRefCnt = false; } +// If ScInterpreter::CreateFormulaDoubleToken tokens make it into a result +if (mbToken && mpToken) +{ +// temp check to look for this +assert(mpToken->GetRefCntPolicy() == formula::RefCntPolicy::ThreadSafe); + const_cast(mpToken)->SetRefCntPolicy(formula::RefCntPolicy::ThreadSafe); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 27f2211b9f30..782d1a952b8c 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1783,6 +1783,7 @@ formula::FormulaToken* ScInterpreter::CreateFormulaDoubleToken( double fVal, SvN // Allocate a new token auto p = new FormulaTypedDoubleToken( fVal, static_cast(nFmt) ); +p->SetRefCntPolicy(RefCntPolicy::UnsafeRef); if ( mrContext.maTokens[mrContext.mnTokenCachePos] ) mrContext.maTokens[mrContext.mnTokenCachePos]->DecRef(); mrContext.maTokens[mrContext.mnTokenCachePos] = p;
core.git: sc/source
sc/source/filter/oox/extlstcontext.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit dac30c44c606232ce23d52a423d0bf8010f25d4f Author: Noel Grandin AuthorDate: Wed Apr 17 14:06:57 2024 +0200 Commit: Noel Grandin CommitDate: Wed Apr 17 19:40:22 2024 +0200 tdf#160706 speed up loading conditional formatting rule in XLS we only need to finalizeImport on the last ExtDxf we loaded, otherwise we end up with an O(n^2) performance problem Change-Id: I566ef43189a1bb7ac7c55e1bccf9445c9cea19b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166179 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index 58e4c7931729..d6af04240572 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -292,7 +292,8 @@ void ExtConditionalFormattingContext::onEndElement() maModel.eOperator = ScConditionMode::Direct; } -getStyles().getExtDxfs().forEachMem( ::finalizeImport ); +if (Dxf* pDxf = getStyles().getExtDxfs().get(rStyleIdx).get()) +pDxf->finalizeImport(); maModel.aStyle = getStyles().createExtDxfStyle(rStyleIdx); rStyleIdx++; nFormulaCount = 0;
core.git: sc/source
sc/source/ui/docshell/impex.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 47187acee758680cda8086b6e295ef7beea3491b Author: Laurent Balland AuthorDate: Mon Apr 15 18:43:35 2024 +0200 Commit: Eike Rathke CommitDate: Wed Apr 17 13:05:52 2024 +0200 tdf#129701 Follow-up of previous change According to comments in https://gerrit.libreoffice.org/c/core/+/163536 Follow-up of previous change Change-Id: Icd7b6798d6ef35ca9574125cd3d4c4d89044569c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166133 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 248c837b6dd1..80b4a2b96701 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1592,7 +1592,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) ScDocumentImport aDocImport(rDoc); do { -SCCOL nLastCol = nEndCol; // tdf#129701 preserve value of nEndCol +const SCCOL nLastCol = nEndCol; // tdf#129701 preserve value of nEndCol for( ;; ) { aLine = ReadCsvLine(rStrm, !bFixed, aSeps, cStr, cDetectSep); @@ -1714,15 +1714,15 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) aTransliteration, aCalendar, pEnglishTransliteration.get(), pEnglishCalendar.get()); } +++nCol; if (bIsLastColEmpty) { bIsLastColEmpty = false; // toggle to stop } else { -++nCol; // tdf#129701 detect if there is a last empty column when we need it -bIsLastColEmpty = !(*p) && !bSkipEmptyCells && !bDetermineRange && nCol == nLastCol; +bIsLastColEmpty = (nCol == nLastCol) && !(*p) && !bSkipEmptyCells && !bDetermineRange; } }
core.git: sc/source
sc/source/ui/view/output3.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 0340a52ef0b9da9861f912c56550e685621a59f1 Author: Andrea Gelmini AuthorDate: Tue Apr 16 23:08:33 2024 +0200 Commit: Taichi Haradaguchi <20001...@ymail.ne.jp> CommitDate: Wed Apr 17 06:11:36 2024 +0200 Fix typo Change-Id: Idee34a2b522f69a0fcea9595c62b68f74628c299 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166164 Tested-by: Jenkins Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp> diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx index 760a62a12d1d..a54718076857 100644 --- a/sc/source/ui/view/output3.cxx +++ b/sc/source/ui/view/output3.cxx @@ -207,7 +207,7 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer) if(pPageView) { // tdf#160589 need to check for registered PaintWindow using the -// 'original' TragetDevice, mpDev might have been changed by a +// 'original' TargetDevice, mpDev might have been changed by a // call to ::SetContentDevice. That again might patch in a // pre-render device fetched from SdrPaintWindow::GetTargetOutputDevice // and thus the test if target is aregistered PageWindow would fail
core.git: sc/source
sc/source/ui/inc/output.hxx |1 + sc/source/ui/view/output.cxx |1 + sc/source/ui/view/output3.cxx |8 +++- 3 files changed, 9 insertions(+), 1 deletion(-) New commits: commit 1e1a3825d76ed8071424e8e21bbda23464c10fff Author: Armin Le Grand (allotropia) AuthorDate: Tue Apr 16 16:26:07 2024 +0200 Commit: Armin Le Grand CommitDate: Tue Apr 16 18:12:25 2024 +0200 tdf#160589: compare the correct OutDev with PageWindows Change-Id: I29d9c60cac04536bb2d5ad2ed1c086c8e67a9f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166151 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index b94fbb1ec7ac..e19bc6f58100 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -187,6 +187,7 @@ private: void adjustForHyperlinkInPDF(Point aURLStart, const OutputDevice* pDev); }; +VclPtr mpOriginalTargetDevice; // 'unpatched' TargetDevice VclPtr mpDev;// Device VclPtr mpRefDevice; // printer if used for preview VclPtr pFmtDevice; // reference for text formatting diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index bf02db1fd32f..797f58ba4712 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -142,6 +142,7 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2, double nPixelPerTwipsX, double nPixelPerTwipsY, const Fraction* pZoomX, const Fraction* pZoomY ) : +mpOriginalTargetDevice( pNewDev ), mpDev( pNewDev ), mpRefDevice( pNewDev ), // default is output device pFmtDevice( pNewDev ), // default is output device diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx index bc6efec65400..760a62a12d1d 100644 --- a/sc/source/ui/view/output3.cxx +++ b/sc/source/ui/view/output3.cxx @@ -206,7 +206,13 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer) if(pPageView) { -if (nullptr != pPageView->FindPageWindow(*mpDev)) +// tdf#160589 need to check for registered PaintWindow using the +// 'original' TragetDevice, mpDev might have been changed by a +// call to ::SetContentDevice. That again might patch in a +// pre-render device fetched from SdrPaintWindow::GetTargetOutputDevice +// and thus the test if target is aregistered PageWindow would fail +assert(nullptr != mpOriginalTargetDevice && "mpOriginalTargetDevice *must* be set when constructing ScOutputData (!)"); +if (nullptr != pPageView->FindPageWindow(*mpOriginalTargetDevice)) { // Target OutputDevice is registered for this view // (as it should be), we can just render
core.git: sc/source
sc/source/core/data/PivotTableFormatOutput.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit 1d5630c5deeec5dca724c29ec8c886bfa71a2099 Author: Tomaž Vajngerl AuthorDate: Tue Apr 16 15:21:49 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Apr 16 14:37:43 2024 +0200 pivot: add checks that prevent reading out of vector bounds MSO likes to keep formats in the document even when the pivot table has been changed, so there might be references that contain indices values that are pointing out of bounds for the current pivot table result data. To prevent crashing the checks are added to prevent using an index that is out of vector bounds. Change-Id: I3824c787659d4e3817a5eb64fe2c8761ef00b610 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166138 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/source/core/data/PivotTableFormatOutput.cxx b/sc/source/core/data/PivotTableFormatOutput.cxx index fbef219b513b..cdd2ac90914f 100644 --- a/sc/source/core/data/PivotTableFormatOutput.cxx +++ b/sc/source/core/data/PivotTableFormatOutput.cxx @@ -64,6 +64,8 @@ public: else { std::vector& rNames = iterator->second; +if (nIndex >= rNames.size()) +return OUString(); return rNames[nIndex]; } } @@ -97,7 +99,7 @@ void initFormatOutputField(size_t nSelectionIndex, std::vector 1) rOutputField.nIndex = rSelection.nIndices[nSelectionIndex]; @@ -107,8 +109,8 @@ void initFormatOutputField(size_t nSelectionIndex, std::vector
core.git: sc/source
sc/source/ui/unoobj/cellvaluebinding.cxx | 96 --- sc/source/ui/unoobj/cellvaluebinding.hxx | 28 - 2 files changed, 66 insertions(+), 58 deletions(-) New commits: commit a4d6700423aeb3f7cbcb3f23352dd05033353fe3 Author: Noel Grandin AuthorDate: Fri Apr 5 11:35:48 2024 +0200 Commit: Noel Grandin CommitDate: Mon Apr 15 10:35:28 2024 +0200 convert OCellValueBinding to comphelper::WeakComponentImplHelper (II) second attempt at landing this Change-Id: I1dd3597b0047131c99b3ec81a3cb5eabf9bf8a12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165865 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx index fd8b43f9578e..d1fa61175557 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.cxx +++ b/sc/source/ui/unoobj/cellvaluebinding.cxx @@ -54,10 +54,7 @@ namespace calc using namespace ::com::sun::star::form::binding; OCellValueBinding::OCellValueBinding( const Reference< XSpreadsheetDocument >& _rxDocument, bool _bListPos ) -:OCellValueBinding_Base( m_aMutex ) -,OCellValueBinding_PBase( OCellValueBinding_Base::rBHelper ) -,m_xDocument( _rxDocument ) -,m_aModifyListeners( m_aMutex ) +:m_xDocument( _rxDocument ) ,m_bInitialized( false ) ,m_bListPos( _bListPos ) { @@ -76,7 +73,7 @@ namespace calc OCellValueBinding::~OCellValueBinding( ) { -if ( !OCellValueBinding_Base::rBHelper.bDisposed ) +if ( !m_bDisposed ) { acquire(); // prevent duplicate dtor dispose(); @@ -87,7 +84,7 @@ namespace calc IMPLEMENT_FORWARD_XTYPEPROVIDER2( OCellValueBinding, OCellValueBinding_Base, OCellValueBinding_PBase ) -void SAL_CALL OCellValueBinding::disposing() +void OCellValueBinding::disposing( std::unique_lock& rGuard ) { Reference xBroadcaster( m_xCell, UNO_QUERY ); if ( xBroadcaster.is() ) @@ -95,7 +92,7 @@ namespace calc xBroadcaster->removeModifyListener( this ); } -WeakComponentImplHelperBase::disposing(); +WeakComponentImplHelperBase::disposing(rGuard); // TODO: clean up here whatever you need to clean up (e.g. deregister as XEventListener // for the cell) @@ -106,7 +103,7 @@ namespace calc return createPropertySetInfo( getInfoHelper() ) ; } -::cppu::IPropertyArrayHelper& SAL_CALL OCellValueBinding::getInfoHelper() +::cppu::IPropertyArrayHelper& OCellValueBinding::getInfoHelper() { return *OCellValueBinding_PABase::getArrayHelper(); } @@ -118,7 +115,7 @@ namespace calc return new ::cppu::OPropertyArrayHelper(aProps); } -void SAL_CALL OCellValueBinding::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const +void OCellValueBinding::getFastPropertyValue( std::unique_lock& /*rGuard*/, Any& _rValue, sal_Int32 _nHandle ) const { OSL_ENSURE( _nHandle == PROP_HANDLE_BOUND_CELL, "OCellValueBinding::getFastPropertyValue: invalid handle!" ); // we only have this one property... @@ -131,9 +128,14 @@ namespace calc Sequence< Type > SAL_CALL OCellValueBinding::getSupportedValueTypes( ) { -checkDisposed( ); +std::unique_lock aGuard(m_aMutex); +throwIfDisposed(aGuard); checkInitialized( ); +return getSupportedValueTypes(aGuard); +} +Sequence< Type > OCellValueBinding::getSupportedValueTypes( std::unique_lock& /*rGuard*/ ) const +{ sal_Int32 nCount = m_xCellText.is() ? 3 : m_xCell.is() ? 1 : 0; if ( m_bListPos ) ++nCount; @@ -163,11 +165,16 @@ namespace calc sal_Bool SAL_CALL OCellValueBinding::supportsType( const Type& aType ) { -checkDisposed( ); +std::unique_lock aGuard(m_aMutex); +throwIfDisposed(aGuard); checkInitialized( ); +return supportsType(aGuard, aType); +} +bool OCellValueBinding::supportsType( std::unique_lock& rGuard, const Type& aType ) const +{ // look up in our sequence -const Sequence< Type > aSupportedTypes( getSupportedValueTypes() ); +const Sequence< Type > aSupportedTypes( getSupportedValueTypes(rGuard) ); for ( auto const & i : aSupportedTypes ) if ( aType == i ) return true; @@ -177,9 +184,10 @@ namespace calc Any SAL_CALL OCellValueBinding::getValue( const Type& aType ) { -checkDisposed( ); +std::unique_lock aGuard(m_aMutex); +throwIfDisposed(aGuard); checkInitialized( ); -checkValueType( aType ); +checkValueType( aGuard, aType ); Any aReturn; switch ( aType.getTypeClass() ) @@ -263,10 +271,11 @@ namespace calc void SAL_CALL OCellValueBinding::setValue( const Any& aValue ) { -
core.git: sc/source
sc/source/filter/oox/PivotTableFormat.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1dc92b9e9951ef118d2d823d54f9a022c2e41a27 Author: Caolán McNamara AuthorDate: Sun Apr 14 17:38:05 2024 +0100 Commit: Caolán McNamara CommitDate: Sun Apr 14 20:29:50 2024 +0200 ofz#68019 Null-dereference READ Change-Id: Ie0c9c5a74e6ae87a0bd4c35320a687458d1d9902 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166074 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/oox/PivotTableFormat.cxx b/sc/source/filter/oox/PivotTableFormat.cxx index 2fc0cfa78371..870a6c99fad9 100644 --- a/sc/source/filter/oox/PivotTableFormat.cxx +++ b/sc/source/filter/oox/PivotTableFormat.cxx @@ -105,7 +105,7 @@ void PivotTableFormat::finalizeImport() aFormat.pPattern = pPattern; for (auto& rReference : maReferences) { -if (rReference->mnField) +if (rReference->mnField && !rReference->maFieldItemsIndices.empty()) { aFormat.aSelections.push_back( sc::Selection{ .bSelected = rReference->mbSelected,
core.git: sc/source
sc/source/filter/orcus/interface.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit 0a687d1eeffcb21b947b181ceb2424680d1cce46 Author: Mike Kaganski AuthorDate: Sat Apr 13 23:39:24 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 06:52:28 2024 +0200 Use more o3tl::convert Change-Id: I5a6a1c05083fbaef71e94799a61c6f918a5134f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166064 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index af425079708d..1f5ac13f358a 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -750,13 +751,15 @@ double translateToInternal(double nVal, orcus::length_unit_t unit) switch(unit) { case orcus::length_unit_t::inch: -return nVal * 72.0 * 20.0; +return o3tl::convert(nVal, o3tl::Length::in, o3tl::Length::twip); case orcus::length_unit_t::twip: return nVal; case orcus::length_unit_t::point: -return nVal * 20.0; +return o3tl::convert(nVal, o3tl::Length::pt, o3tl::Length::twip); case orcus::length_unit_t::centimeter: -return nVal * 20.0 * 72.0 / 2.54; +return o3tl::convert(nVal, o3tl::Length::cm, o3tl::Length::twip); +case orcus::length_unit_t::millimeter: +return o3tl::convert(nVal, o3tl::Length::mm, o3tl::Length::twip); case orcus::length_unit_t::unknown: if (nVal != 0) SAL_WARN("sc.orcus", "unknown unit");
core.git: sc/source
sc/source/core/tool/interpr4.cxx | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) New commits: commit 63b237e1e8147f54e6d4db4671f612a656200e2f Author: Caolán McNamara AuthorDate: Sat Apr 13 16:35:28 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Apr 13 21:28:44 2024 +0200 Related: tdf#160056 don't set nVal twice Change-Id: I0da3e0c7f18271f6104d52b50d65e96564650b8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166054 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 77dbd7d52014..27f2211b9f30 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2099,7 +2099,7 @@ double ScInterpreter::GetDoubleFromMatrix(const ScMatrixRef& pMat) double ScInterpreter::GetDouble() { -double nVal(0.0); +double nVal; switch( GetRawStackType() ) { case svDouble: @@ -2134,13 +2134,16 @@ double ScInterpreter::GetDouble() { ScExternalRefCache::TokenRef pToken; PopExternalSingleRef(pToken); -if (nGlobalError == FormulaError::NONE) +if (nGlobalError != FormulaError::NONE) { -if (pToken->GetType() == svDouble || pToken->GetType() == svEmptyCell) -nVal = pToken->GetDouble(); -else -nVal = ConvertStringToValue( pToken->GetString().getString()); +nVal = 0.0; +break; } + +if (pToken->GetType() == svDouble || pToken->GetType() == svEmptyCell) +nVal = pToken->GetDouble(); +else +nVal = ConvertStringToValue( pToken->GetString().getString()); } break; case svExternalDoubleRef: @@ -2148,7 +2151,10 @@ double ScInterpreter::GetDouble() ScMatrixRef pMat; PopExternalDoubleRef(pMat); if (nGlobalError != FormulaError::NONE) +{ +nVal = 0.0; break; +} nVal = GetDoubleFromMatrix(pMat); }
core.git: sc/source
sc/source/filter/oox/PivotTableFormat.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 91ad46fc2a50b1084bf8c28093ad8286674cbd28 Author: Caolán McNamara AuthorDate: Sat Apr 13 16:00:25 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Apr 13 21:27:12 2024 +0200 ofz#68019 Null-dereference READ Change-Id: I9ad5d907c4739877d51b74ef0f2e275d94119f09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166052 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/oox/PivotTableFormat.cxx b/sc/source/filter/oox/PivotTableFormat.cxx index 156fe9983a6e..2fc0cfa78371 100644 --- a/sc/source/filter/oox/PivotTableFormat.cxx +++ b/sc/source/filter/oox/PivotTableFormat.cxx @@ -76,9 +76,10 @@ void PivotTableFormat::importPivotArea(const oox::AttributeList& rAttribs) void PivotTableFormat::finalizeImport() { -DxfRef pDxf = getStyles().getDxf(mnDxfId); auto pPattern = std::make_shared(getScDocument().getCellAttributeHelper()); -pDxf->fillToItemSet(pPattern->GetItemSet()); + +if (DxfRef pDxf = getStyles().getDxf(mnDxfId)) +pDxf->fillToItemSet(pPattern->GetItemSet()); ScDPObject* pDPObj = mrPivotTable.getDPObject(); ScDPSaveData* pSaveData = pDPObj->GetSaveData();
core.git: sc/source
sc/source/core/tool/interpr4.cxx | 1036 +++ 1 file changed, 520 insertions(+), 516 deletions(-) New commits: commit d490efe410a54f1860578728027d1ec0439f0ba9 Author: Caolán McNamara AuthorDate: Fri Apr 12 17:37:30 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Apr 13 00:52:40 2024 +0200 Related: tdf#160056 call FormulaCompiler::IsOpCodeJumpCommand just once rearrange to reuse previous calculation Change-Id: Ibda0388e020dac995e5667af09767b0314720935 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166039 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index dc0bd397707f..4408b04aa695 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -4030,540 +4030,544 @@ StackVar ScInterpreter::Interpret() PushWithoutError( *pCur ); nCurFmtType = SvNumFormatType::UNDEFINED; } -else if (!FormulaCompiler::IsOpCodeJumpCommand( eOp ) && -((aTokenMatrixMapIter = maTokenMatrixMap.find( pCur)) != - maTokenMatrixMap.end()) && -(*aTokenMatrixMapIter).second->GetType() != svJumpMatrix) -{ -// Path already calculated, reuse result. -const sal_uInt8 nParamCount = pCur->GetParamCount(); -if (sp >= nParamCount) -nStackBase = sp - nParamCount; -else -{ -SAL_WARN("sc.core", "Stack anomaly with calculated path at " -<< aPos.Tab() << "," << aPos.Col() << "," << aPos.Row() -<< " " << aPos.Format( -ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, ) -<< " eOp: " << static_cast(eOp) -<< " params: " << static_cast(nParamCount) -<< " nStackBase: " << nStackBase << " sp: " << sp); -nStackBase = sp; -assert(!"underflow"); -} -sp = nStackBase; -PushTokenRef( (*aTokenMatrixMapIter).second); -} else { -// previous expression determines the current number format -nCurFmtType = nRetTypeExpr; -nCurFmtIndex = nRetIndexExpr; -// default function's format, others are set if needed -nFuncFmtType = SvNumFormatType::NUMBER; -nFuncFmtIndex = 0; - -if (FormulaCompiler::IsOpCodeJumpCommand( eOp )) -nStackBase = sp;// don't mess around with the jumps -else +const bool bIsOpCodeJumpCommand = FormulaCompiler::IsOpCodeJumpCommand(eOp); +if (!bIsOpCodeJumpCommand && + ((aTokenMatrixMapIter = maTokenMatrixMap.find( pCur)) != +maTokenMatrixMap.end()) && + (*aTokenMatrixMapIter).second->GetType() != svJumpMatrix) { -// Convert parameters to matrix if in array/matrix formula and -// parameters of function indicate doing so. Create JumpMatrix -// if necessary. -if ( MatrixParameterConversion() ) +// Path already calculated, reuse result. +const sal_uInt8 nParamCount = pCur->GetParamCount(); +if (sp >= nParamCount) +nStackBase = sp - nParamCount; +else { -eOp = ocNone; // JumpMatrix created +SAL_WARN("sc.core", "Stack anomaly with calculated path at " +<< aPos.Tab() << "," << aPos.Col() << "," << aPos.Row() +<< " " << aPos.Format( +ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, ) +<< " eOp: " << static_cast(eOp) +<< " params: " << static_cast(nParamCount) +<< " nStackBase: " << nStackBase << " sp: " << sp); nStackBase = sp; +assert(!"underflow"); } +sp = nStackBase; +PushTokenRef( (*aTokenMatrixMapIter).second); +} +else +{ +// previous expression determines the current number format +nCurFmtType = nRetTypeExpr; +nCurFmtIndex = nRetIndexExpr; +// default function's format, others are set if needed +nFuncFmtType = SvNumFormatType::NUMBER; +nFuncFmtIndex = 0; + +if (bIsOpCodeJumpCommand) +nStackBase = sp;// don't mess around with the jumps else { -const sal_uInt8 nParamCount = pCur->GetParamCount(); -
core.git: sc/source
sc/source/core/tool/interpr4.cxx | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) New commits: commit 030b655963c182693c7b657dc6aa4d2fe85c17c6 Author: Caolán McNamara AuthorDate: Fri Apr 12 12:24:06 2024 +0100 Commit: Caolán McNamara CommitDate: Sat Apr 13 00:51:29 2024 +0200 Related: tdf#160056 don't call GetParamCount twice GetParamCount: 290ms -> 175ms Change-Id: Ic3a26b1e8035744dcab2da69a8ebd3b29dd2160a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166031 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 5e5d513289d0..dc0bd397707f 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -4036,8 +4036,9 @@ StackVar ScInterpreter::Interpret() (*aTokenMatrixMapIter).second->GetType() != svJumpMatrix) { // Path already calculated, reuse result. -if (sp >= pCur->GetParamCount()) -nStackBase = sp - pCur->GetParamCount(); +const sal_uInt8 nParamCount = pCur->GetParamCount(); +if (sp >= nParamCount) +nStackBase = sp - nParamCount; else { SAL_WARN("sc.core", "Stack anomaly with calculated path at " @@ -4045,7 +4046,7 @@ StackVar ScInterpreter::Interpret() << " " << aPos.Format( ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, ) << " eOp: " << static_cast(eOp) -<< " params: " << static_cast(pCur->GetParamCount()) +<< " params: " << static_cast(nParamCount) << " nStackBase: " << nStackBase << " sp: " << sp); nStackBase = sp; assert(!"underflow"); @@ -4074,18 +4075,22 @@ StackVar ScInterpreter::Interpret() eOp = ocNone; // JumpMatrix created nStackBase = sp; } -else if (sp >= pCur->GetParamCount()) -nStackBase = sp - pCur->GetParamCount(); else { -SAL_WARN("sc.core", "Stack anomaly at " << aPos.Tab() << "," << aPos.Col() << "," << aPos.Row() -<< " " << aPos.Format( -ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, ) -<< " eOp: " << static_cast(eOp) -<< " params: " << static_cast(pCur->GetParamCount()) -<< " nStackBase: " << nStackBase << " sp: " << sp); -nStackBase = sp; -assert(!"underflow"); +const sal_uInt8 nParamCount = pCur->GetParamCount(); +if (sp >= nParamCount) +nStackBase = sp - nParamCount; +else +{ +SAL_WARN("sc.core", "Stack anomaly at " << aPos.Tab() << "," << aPos.Col() << "," << aPos.Row() +<< " " << aPos.Format( +ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, ) +<< " eOp: " << static_cast(eOp) +<< " params: " << static_cast(nParamCount) +<< " nStackBase: " << nStackBase << " sp: " << sp); +nStackBase = sp; +assert(!"underflow"); +} } }
core.git: sc/source
sc/source/filter/html/htmlpars.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 54d577ed22fd4bae093639be3056a722f5a40bb2 Author: Caolán McNamara AuthorDate: Fri Apr 12 15:24:53 2024 +0100 Commit: Caolán McNamara CommitDate: Fri Apr 12 21:40:09 2024 +0200 ofz#68004 Unknown Read Change-Id: Id3e50e3a8522523d2b665e394d8f4a65b7f4df5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166034 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 83d9c01fbf7e..5d27f751ab6c 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -778,7 +778,7 @@ void ScHTMLLayoutParser::SetWidths() if ( pE->nTab == nTable && pE->nWidth ) { SCCOL nCol = pE->nCol - nColCntStart; -if ( nCol < nColsPerRow ) +if (nCol >= 0 && nCol < nColsPerRow) { if ( pE->nColOverlap == 1 ) {
core.git: sc/source
sc/source/core/data/PivotTableFormatOutput.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit f017fe99f7e7a1beb2c7809b04e069831e706afb Author: Miklos Vajna AuthorDate: Fri Apr 12 09:13:53 2024 +0200 Commit: Caolán McNamara CommitDate: Fri Apr 12 18:05:48 2024 +0200 sc: fix -Werror,-Wunused-but-set-variable Pointed out by clang-15: sc/source/core/data/PivotTableFormatOutput.cxx:256:12: error: variable 'nEntryIndex' set but not used [-Werror,-Wunused-but-set-variable] size_t nEntryIndex = 0; ^ Change-Id: I3abf7fe6d4ed330cd713472ce4102eeef6aea4dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166022 Reviewed-by: Miklos Vajna Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sc/source/core/data/PivotTableFormatOutput.cxx b/sc/source/core/data/PivotTableFormatOutput.cxx index 350aef597ebd..c3732a888ae7 100644 --- a/sc/source/core/data/PivotTableFormatOutput.cxx +++ b/sc/source/core/data/PivotTableFormatOutput.cxx @@ -253,7 +253,6 @@ void FormatOutput::apply(ScDocument& rDocument) if (!mpFormats) return; -size_t nEntryIndex = 0; for (auto const& rOutputEntry : maFormatOutputEntries) { if (!rOutputEntry.onTab || !rOutputEntry.pPattern) @@ -339,7 +338,6 @@ void FormatOutput::apply(ScDocument& rDocument) { rDocument.ApplyPattern(*oColumn, *oRow, *rOutputEntry.onTab, *rOutputEntry.pPattern); } -nEntryIndex++; } }
core.git: sc/source
sc/source/core/tool/interpr1.cxx |9 + 1 file changed, 1 insertion(+), 8 deletions(-) New commits: commit 51abf44808c6793a184e986b62c0786753e11ded Author: Balazs Varga AuthorDate: Thu Apr 11 21:49:21 2024 +0200 Commit: Balazs Varga CommitDate: Fri Apr 12 10:22:59 2024 +0200 Related: tdf#127293 Fix regex search mode in XLOOKUP wildcards mode If relevant Option in Calc was set for regex, xlookup still used the wildcard search mode. Change-Id: I318c3f368b6f59644c43ec518542910be72a5e0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166015 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 8ea81b336641..6f3c3304e627 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -11455,14 +11455,7 @@ bool ScInterpreter::SearchVectorForValue( VectorSearchArguments& vsa ) if ( mrDoc.IsInVBAMode() ) rParam.eSearchType = utl::SearchParam::SearchType::Wildcard; else -{ -// set searchtype hard to wildcard or regexp if applicable, the XLOOKUP -// argument prevails over the configuration setting -if ( MayBeWildcard( vsa.sSearchStr.getString() ) ) -rParam.eSearchType = utl::SearchParam::SearchType::Wildcard; -else if ( MayBeRegExp( vsa.sSearchStr.getString() ) ) -rParam.eSearchType = utl::SearchParam::SearchType::Regexp; -} +rParam.eSearchType = DetectSearchType(vsa.sSearchStr.getString(), mrDoc); } } else
core.git: sc/source
sc/source/core/tool/compiler.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 83d04e5a59b762d7edce0fcfaabbba1e26129a27 Author: Andrea Gelmini AuthorDate: Thu Apr 11 22:54:21 2024 +0200 Commit: Julien Nabet CommitDate: Fri Apr 12 09:23:07 2024 +0200 Fix typo Change-Id: I6e5c31a0d3577c40acd62b4c9dd6d4c084865c0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166016 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index a0529fbe0f4e..6c847cfac501 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -6616,7 +6616,7 @@ void ScCompiler::AnnotateTrimOnDoubleRefs() case ocRange: { // tdf#160616: Double refs with these operators only -// trimmable in case of one paramater +// trimmable in case of one parameter if (!pTok->IsInForceArray() || nRootParam > 1) break; FormulaToken* pLHS = *(ppTok - 1);
core.git: sc/source
sc/source/ui/view/viewdata.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit e20cbd4bd7b1def2926ad48ecb3564597225d3b9 Author: Marco Cecchetti AuthorDate: Mon Mar 11 22:21:13 2024 +0100 Commit: Tomaž Vajngerl CommitDate: Fri Apr 12 05:25:55 2024 +0200 lok: calc: not possible to select the cell adjacent to the edited one In the LOK case using the paper size for the printer case (wysiwyg) can make the cell background and visible area larger than needed which makes selecting the adjacent right cell impossible in some cases. Change-Id: I20edd62645692f30e432b1064bb9c85b3396dc32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164702 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl (cherry picked from commit a6bc0272607590d1692db385be7f6fbfeb1a8fb4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164999 Tested-by: Jenkins diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 07a16aaa590a..f6684f0d201a 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1753,7 +1753,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, Size aPaperSize = pView->GetActiveWin()->PixelToLogic( Size( nSizeXPix, nSizeYPix ), GetLogicMode() ); Size aPaperSizePTwips(nSizeXPTwips, nSizeYPTwips); -if ( bBreak && !bAsianVertical && SC_MOD()->GetInputOptions().GetTextWysiwyg() ) +// In the LOK case the following code can make the cell background and visible area larger +// than needed which makes selecting the adjacent right cell impossible in some cases. +if ( bBreak && !bAsianVertical && SC_MOD()->GetInputOptions().GetTextWysiwyg() && !bLOKActive ) { // if text is formatted for printer, use the exact same paper width // (and same line breaks) as for output.
core.git: sc/source
sc/source/core/data/dpsave.cxx | 16 1 file changed, 8 insertions(+), 8 deletions(-) New commits: commit a9504d55782fb6ce1e64d154b4a3197062277425 Author: Tomaž Vajngerl AuthorDate: Thu Apr 11 16:27:21 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Fri Apr 12 02:28:12 2024 +0200 pivot: remove duplication in ScDPSaveDimension::GetMemberByName Change-Id: I036e83307615a8c1f875ffc66a54027e1ec31a92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165991 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index ed888eebd737..6e1d5c56f085 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -458,14 +458,14 @@ ScDPSaveMember* ScDPSaveDimension::GetExistingMemberByName(const OUString& rName ScDPSaveMember* ScDPSaveDimension::GetMemberByName(const OUString& rName) { -auto res = maMemberHash.find (rName); -if (res != maMemberHash.end()) -return res->second.get(); - -ScDPSaveMember* pNew = new ScDPSaveMember( rName ); -maMemberHash[rName] = std::unique_ptr(pNew); -maMemberList.push_back( pNew ); -return pNew; +ScDPSaveMember* pResult = GetExistingMemberByName(rName); +if (pResult) +return pResult; + +pResult = new ScDPSaveMember(rName); +maMemberHash[rName] = std::unique_ptr(pResult); +maMemberList.push_back(pResult); +return pResult; } void ScDPSaveDimension::SetMemberPosition( const OUString& rName, sal_Int32 nNewPos )
core.git: sc/source
sc/source/core/data/dpoutput.cxx | 76 ++- 1 file changed, 44 insertions(+), 32 deletions(-) New commits: commit 3146d6759869fca4753edefddc503a5a89a42b91 Author: Tomaž Vajngerl AuthorDate: Mon Apr 1 22:08:50 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Apr 11 17:13:29 2024 +0200 pivot: un-abbreviate vars. in ScDPOutput::Output Change-Id: If480afbdcb2a350907a1cac734ebf76424825371 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165683 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index d88a320aeac0..dd5d9d1577bc 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1020,11 +1020,11 @@ void ScDPOutput::Output() for (size_t nField = 0; nField < mpPageFields.size(); ++nField) { -SCCOL nHdrCol = maStartPos.Col(); -SCROW nHdrRow = maStartPos.Row() + nField + (mbDoFilter ? 1 : 0); +SCCOL nHeaderCol = maStartPos.Col(); +SCROW nHeaderRow = maStartPos.Row() + nField + (mbDoFilter ? 1 : 0); // draw without frame for consistency with filter button: -FieldCell(nHdrCol, nHdrRow, nTab, mpPageFields[nField], false); -SCCOL nFldCol = nHdrCol + 1; +FieldCell(nHeaderCol, nHeaderRow, nTab, mpPageFields[nField], false); +SCCOL nFieldCol = nHeaderCol + 1; OUString aPageValue = ScResId(SCSTR_ALL); const uno::Sequence& rRes = mpPageFields[nField].maResult; @@ -1037,13 +1037,15 @@ void ScDPOutput::Output() aPageValue = rRes[0].Caption; } else if (n > 1) +{ aPageValue = ScResId(SCSTR_MULTIPLE); +} ScSetStringParam aParam; aParam.setTextInput(); -mpDocument->SetString(nFldCol, nHdrRow, nTab, aPageValue, ); +mpDocument->SetString(nFieldCol, nHeaderRow, nTab, aPageValue, ); -lcl_SetFrame(mpDocument, nTab, nFldCol,nHdrRow, nFldCol,nHdrRow, 20); +lcl_SetFrame(mpDocument, nTab, nFieldCol, nHeaderRow, nFieldCol, nHeaderRow, 20); } // data description @@ -1066,52 +1068,62 @@ void ScDPOutput::Output() mnTabStartCol, mnTabStartRow, mnDataStartCol, mnDataStartRow, mnTabEndCol, mnTabEndRow); size_t nNumColFields = mpColFields.size(); -for (size_t nField=0; nField(nField); //TODO: check for overflow +SCCOL nHeaderCol = mnDataStartCol + SCCOL(nField); //TODO: check for overflow + if (!mbHasCompactRowField || nNumColFields == 1) -FieldCell(nHdrCol, mnTabStartRow, nTab, mpColFields[nField], true); +FieldCell(nHeaderCol, mnTabStartRow, nTab, mpColFields[nField], true); else if (!nField) -MultiFieldCell(nHdrCol, mnTabStartRow, nTab, false /* bRowField */); +MultiFieldCell(nHeaderCol, mnTabStartRow, nTab, false /* bRowField */); -SCROW nRowPos = mnMemberStartRow + static_cast(nField); //TODO: check for overflow +SCROW nRowPos = mnMemberStartRow + SCROW(nField); //TODO: check for overflow tools::Long nDimension = mpColFields[nField].mnDim; const uno::Sequence rSequence = mpColFields[nField].maResult; -const sheet::MemberResult* pArray = rSequence.getConstArray(); +const sheet::MemberResult* pMemberArray = rSequence.getConstArray(); tools::Long nThisColCount = rSequence.getLength(); -OSL_ENSURE(nThisColCount == mnColCount, "count mismatch"); //TODO: ??? +OSL_ENSURE(nThisColCount == mnColCount, "count mismatch"); //TODO: ??? + tools::Long nColumnIndex = -1; -for (tools::Long nCol=0; nCol(nCol); //TODO: check for overflow -HeaderCell( nColPos, nRowPos, nTab, pArray[nCol], true, nField ); -if ( ( pArray[nCol].Flags & sheet::MemberResultFlags::HASMEMBER ) && -!( pArray[nCol].Flags & sheet::MemberResultFlags::SUBTOTAL ) ) + +SCCOL nColPos = mnDataStartCol + SCCOL(nColumn); //TODO: check for overflow +HeaderCell(nColPos, nRowPos, nTab, pMemberArray[nColumn], true, nField); +if ((pMemberArray[nColumn].Flags & sheet::MemberResultFlags::HASMEMBER) && + !(pMemberArray[nColumn].Flags & sheet::MemberResultFlags::SUBTOTAL)) { -tools::Long nEnd = nCol; -while ( nEnd+1 < nThisColCount && ( pArray[nEnd+1].Flags & sheet::MemberResultFlags::CONTINUE ) ) +// Check the number of columns this spreads +tools::Long nEnd = nColumn; +while (nEnd + 1 < nThisColCount && (pMemberArray[nEnd + 1].Flags & sheet::MemberResultFlags::CONTINUE)) ++nEnd; -SCCOL nEndColPos = mnDataStartCol + static_cast(nEnd); //TODO: check for overflow -if ( nField+1 <
core.git: sc/source
sc/source/core/inc/interpre.hxx | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) New commits: commit 7f9a35e6efc4118ecc46fa6f76fc5a812259eea1 Author: Noel Grandin AuthorDate: Wed Apr 10 12:14:32 2024 +0100 Commit: Noel Grandin CommitDate: Wed Apr 10 14:50:57 2024 +0200 use unordered_map for ScTokenMatrixMap which is considerably faster Change-Id: Ic44d88d8ef222edd91de8ae0e79d77a99c5c2e95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165924 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 31ff2ecb7a9c..81240095fd98 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -34,7 +34,7 @@ #include #include "parclass.hxx" -#include +#include #include #include #include @@ -179,18 +179,16 @@ enum ScETSType etsStatMult }; -struct FormulaTokenRef_less +struct FormulaTokenRef_hash { -bool operator () ( const formula::FormulaConstTokenRef& r1, const formula::FormulaConstTokenRef& r2 ) const -{ return r1.get() < r2.get(); } +bool operator () ( const formula::FormulaConstTokenRef& r1 ) const +{ return std::hash()(static_cast(r1.get())); } // So we don't have to create a FormulaConstTokenRef to search by formula::FormulaToken* using is_transparent = void; -bool operator () ( const formula::FormulaToken* p1, const formula::FormulaConstTokenRef& r2 ) const -{ return p1 < r2.get(); } -bool operator () ( const formula::FormulaConstTokenRef& r1, const formula::FormulaToken* p2 ) const -{ return r1.get() < p2; } +bool operator () ( const formula::FormulaToken* p1 ) const +{ return std::hash()(static_cast(p1)); } }; -typedef ::std::map< const formula::FormulaConstTokenRef, formula::FormulaConstTokenRef, FormulaTokenRef_less> ScTokenMatrixMap; +typedef ::std::unordered_map< const formula::FormulaConstTokenRef, formula::FormulaConstTokenRef, FormulaTokenRef_hash> ScTokenMatrixMap; class ScInterpreter {
core.git: sc/source
sc/source/ui/app/transobj.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 164bde27bab3c4a4166230d60d591b54efe703c0 Author: Caolán McNamara AuthorDate: Mon Apr 8 22:18:32 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Apr 10 09:47:34 2024 +0200 cid#1596245 Explicit null dereferenced Change-Id: I3912517648f76cd7a0fd651cf592bce427dc69f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165900 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 1a97a01d049b..b42154945e89 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -499,7 +499,8 @@ bool ScTransferObj::WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 std::unique_ptr xStrm = aEditHelper.GetSotStorageStream( rFlavor ); bRet = bool(xStrm); -rOStm.WriteStream(*xStrm); +if (bRet) +rOStm.WriteStream(*xStrm); } } break;
core.git: sc/source
sc/source/ui/view/select.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 3d83f91b9ba249fcfa93fc24a1b427840b7b2c61 Author: Gökay Şatır AuthorDate: Fri Mar 15 17:24:53 2024 +0300 Commit: Caolán McNamara CommitDate: Sat Apr 6 22:10:47 2024 +0200 Disable dragging in readonly view mode. Signed-off-by: Gökay Şatır Change-Id: I962d68b85897c156bba6d1898cf78b5fcd85540a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164866 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks (cherry picked from commit 0cdafeb746196f9f1e9ad271a77f5911694ff07d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165726 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index d972c9b4eb8d..7d744f32246c 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -145,6 +145,9 @@ void ScViewFunctionSet::SetSelectionEngine( ScViewSelectionEngine* pSelEngine ) // Drag & Drop void ScViewFunctionSet::BeginDrag() { +if (m_pViewData->GetViewShell()->IsLokReadOnlyView()) +return; + SCTAB nTab = m_pViewData->GetTabNo(); SCCOL nPosX;
core.git: sc/source
sc/source/filter/rtf/eeimpars.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8379aaee531e469687aaceba27f5afd697a0d86d Author: Caolán McNamara AuthorDate: Fri Apr 5 10:46:40 2024 +0100 Commit: Caolán McNamara CommitDate: Fri Apr 5 15:39:23 2024 +0200 ofz#67765 Integer-overflow Change-Id: I49b1a5024352575a3867500c15f542863c273e93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165814 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 38f3f73e89aa..e6f1072f3fbe 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -309,7 +309,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu ScMF::Hor ); if ( pE->nRowOverlap > 1 ) { -nRO = nRow + (pE->nRowOverlap - 1); +nRO = o3tl::saturating_add(nRow, pE->nRowOverlap - 1); mpDoc->ApplyFlagsTab( nCol, nRow+1, nCol, nRO , nTab, ScMF::Ver );
core.git: sc/source
sc/source/ui/unoobj/cellvaluebinding.cxx | 98 +-- sc/source/ui/unoobj/cellvaluebinding.hxx | 28 2 files changed, 58 insertions(+), 68 deletions(-) New commits: commit daa6df4633d67af025ea1000aaac20763da1a683 Author: Noel Grandin AuthorDate: Fri Apr 5 08:01:54 2024 +0200 Commit: Noel Grandin CommitDate: Fri Apr 5 11:07:30 2024 +0200 Revert "convert OCellValueBinding to comphelper::WeakComponentImplHelper" This reverts commit 7510cca63690ea97eb02a43f698fc183c3d0434a. Reason for revert: deadlocking Change-Id: Id50926e401871be259fa955b68b1767fd7f6b9de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165723 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx index 7c4865726bef..fd8b43f9578e 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.cxx +++ b/sc/source/ui/unoobj/cellvaluebinding.cxx @@ -54,7 +54,10 @@ namespace calc using namespace ::com::sun::star::form::binding; OCellValueBinding::OCellValueBinding( const Reference< XSpreadsheetDocument >& _rxDocument, bool _bListPos ) -:m_xDocument( _rxDocument ) +:OCellValueBinding_Base( m_aMutex ) +,OCellValueBinding_PBase( OCellValueBinding_Base::rBHelper ) +,m_xDocument( _rxDocument ) +,m_aModifyListeners( m_aMutex ) ,m_bInitialized( false ) ,m_bListPos( _bListPos ) { @@ -73,7 +76,7 @@ namespace calc OCellValueBinding::~OCellValueBinding( ) { -if ( !m_bDisposed ) +if ( !OCellValueBinding_Base::rBHelper.bDisposed ) { acquire(); // prevent duplicate dtor dispose(); @@ -84,7 +87,7 @@ namespace calc IMPLEMENT_FORWARD_XTYPEPROVIDER2( OCellValueBinding, OCellValueBinding_Base, OCellValueBinding_PBase ) -void OCellValueBinding::disposing( std::unique_lock& rGuard ) +void SAL_CALL OCellValueBinding::disposing() { Reference xBroadcaster( m_xCell, UNO_QUERY ); if ( xBroadcaster.is() ) @@ -92,7 +95,7 @@ namespace calc xBroadcaster->removeModifyListener( this ); } -WeakComponentImplHelperBase::disposing(rGuard); +WeakComponentImplHelperBase::disposing(); // TODO: clean up here whatever you need to clean up (e.g. deregister as XEventListener // for the cell) @@ -103,7 +106,7 @@ namespace calc return createPropertySetInfo( getInfoHelper() ) ; } -::cppu::IPropertyArrayHelper& OCellValueBinding::getInfoHelper() +::cppu::IPropertyArrayHelper& SAL_CALL OCellValueBinding::getInfoHelper() { return *OCellValueBinding_PABase::getArrayHelper(); } @@ -115,7 +118,7 @@ namespace calc return new ::cppu::OPropertyArrayHelper(aProps); } -void OCellValueBinding::getFastPropertyValue( std::unique_lock& /*rGuard*/, Any& _rValue, sal_Int32 _nHandle ) const +void SAL_CALL OCellValueBinding::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const { OSL_ENSURE( _nHandle == PROP_HANDLE_BOUND_CELL, "OCellValueBinding::getFastPropertyValue: invalid handle!" ); // we only have this one property... @@ -128,14 +131,9 @@ namespace calc Sequence< Type > SAL_CALL OCellValueBinding::getSupportedValueTypes( ) { -std::unique_lock aGuard(m_aMutex); -throwIfDisposed(aGuard); +checkDisposed( ); checkInitialized( ); -return getSupportedValueTypes(aGuard); -} -Sequence< Type > OCellValueBinding::getSupportedValueTypes( std::unique_lock& /*rGuard*/ ) const -{ sal_Int32 nCount = m_xCellText.is() ? 3 : m_xCell.is() ? 1 : 0; if ( m_bListPos ) ++nCount; @@ -165,16 +163,11 @@ namespace calc sal_Bool SAL_CALL OCellValueBinding::supportsType( const Type& aType ) { -std::unique_lock aGuard(m_aMutex); -throwIfDisposed(aGuard); +checkDisposed( ); checkInitialized( ); -return supportsType(aGuard, aType); -} -bool OCellValueBinding::supportsType( std::unique_lock& rGuard, const Type& aType ) const -{ // look up in our sequence -const Sequence< Type > aSupportedTypes( getSupportedValueTypes(rGuard) ); +const Sequence< Type > aSupportedTypes( getSupportedValueTypes() ); for ( auto const & i : aSupportedTypes ) if ( aType == i ) return true; @@ -184,10 +177,9 @@ namespace calc Any SAL_CALL OCellValueBinding::getValue( const Type& aType ) { -std::unique_lock aGuard(m_aMutex); -throwIfDisposed(aGuard); +checkDisposed( ); checkInitialized( ); -checkValueType( aGuard, aType ); +checkValueType( aType ); Any aReturn; switch ( aType.getTypeClass() ) @@ -271,11 +263,10 @@ namespace calc
core.git: sc/source
sc/source/ui/view/preview.cxx |1 - sc/source/ui/view/printfun.cxx |2 -- 2 files changed, 3 deletions(-) New commits: commit 4be23d7701d43af34f218545a863f5c96b4298eb Author: Noel Grandin AuthorDate: Thu Apr 4 09:06:05 2024 +0200 Commit: Noel Grandin CommitDate: Thu Apr 4 10:33:30 2024 +0200 remove leftovers from commit e1e48bba55ff68397d514ab3771850678312f348 Author: Noel Grandin Date: Mon Apr 1 18:40:26 2024 +0200 tdf#160399 speed up print preview Change-Id: I399752d473a4f6f782cdfcc53b4625dcdf7cb460 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165778 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index c438425cfc4b..c8b3ed2a7ae0 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -729,7 +729,6 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom) pViewShell->UpdateNeededScrollBars(true); bInSetZoom = false; -//bStateValid = false; InvalidateLocationData( SfxHintId::ScAccVisAreaChanged ); DoInvalidate(); Invalidate(); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 2653b3d0766b..465827174b76 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -253,8 +253,6 @@ ScPrintFunc::ScPrintFunc(ScDocShell* pShell, SfxPrinter* pNewPrinter, const ScPr nEndRow = rState.nEndRow; bPrintAreaValid = rState.bPrintAreaValid; nZoom = rState.nZoom; -//m_aRanges.m_nPagesX = rState.nPagesX; -//m_aRanges.m_nPagesY = rState.nPagesY; m_aRanges = rState.m_aRanges; nTabPages = rState.nTabPages; nTotalPages = rState.nTotalPages;
core.git: sc/source
sc/source/filter/html/htmlpars.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit c4f2a85bc5fa319a84474191275a2434dda1830b Author: Caolán McNamara AuthorDate: Wed Apr 3 14:09:53 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Apr 3 16:49:33 2024 +0200 ofz#67815 overflowed short Change-Id: Iee9a5caee53b522ed16d234c2bc06987264e23db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165751 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 8786b55fcce2..45d21cea1720 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -832,12 +832,12 @@ void ScHTMLLayoutParser::SetWidths() pWidths[nCol] = nW; } } -for (SCCOL nCol = 1; nCol <= nColsPerRow; nCol++) +for (int nCol = 1; nCol <= nColsPerRow; nCol++) { pOffsets[nCol] = pOffsets[nCol-1] + pWidths[nCol-1]; } xLocalColOffset->clear(); -for (SCCOL nCol = 0; nCol <= nColsPerRow; nCol++) +for (int nCol = 0; nCol <= nColsPerRow; nCol++) { MakeColNoRef( xLocalColOffset.get(), pOffsets[nCol], 0, 0, 0 ); }
core.git: sc/source
sc/source/ui/view/cellsh1.cxx |3 --- sc/source/ui/view/tabvwshc.cxx |2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) New commits: commit 387a9c445793e8377f85e508d935dc070fd8ab74 Author: Armin Le Grand (allotropia) AuthorDate: Fri Mar 29 16:28:04 2024 +0100 Commit: Armin Le Grand CommitDate: Wed Apr 3 15:49:06 2024 +0200 tdf#160252 ITEM remove unnecessary cleanups of shared_ptr Change-Id: I5654d65097bf88b70cb85937de3ce111fa7e4345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165552 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index ac70ef49ae14..a8297303ee8f 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2919,9 +2919,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) else pCondFormatList.reset(); -if (rDlgItem) -pTabViewShell->setScCondFormatDlgItem(nullptr); - pDlg->disposeOnce(); }); } diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index caa21c084c3f..7904290b6d5b 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -436,6 +436,8 @@ std::shared_ptr ScTabViewShell::CreateRefDialogCont xResult = std::make_shared(pB, pCW, pParent, , rDlgItem); // Remove the pool item stored by Conditional Format Manager Dialog. +// tdf#160252 still needed *after* change to ScCondFormatDlgData due to +// UnitTest UITest_conditional_format setScCondFormatDlgItem(nullptr); }
core.git: sc/source
sc/source/ui/unoobj/celllistsource.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit 3976c94feecb00ee80a48009086d0850e32891f1 Author: Noel Grandin AuthorDate: Tue Apr 2 11:30:31 2024 +0200 Commit: Noel Grandin CommitDate: Tue Apr 2 14:37:44 2024 +0200 fix assert in loading forum-de3-11775.ods regression from commit a95bff116e1da140b9abe9742ceeb9a3caed43d5 Author: Noel Grandin Date: Tue Mar 26 15:42:52 2024 +0200 convert OCellListSource to comphelper::WeakComponentImplHelper Change-Id: Ib8af6627c641c73d9e4e6aaa43d694084a2854ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165671 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/ui/unoobj/celllistsource.cxx b/sc/source/ui/unoobj/celllistsource.cxx index 21c98d72f894..446330dd832d 100644 --- a/sc/source/ui/unoobj/celllistsource.cxx +++ b/sc/source/ui/unoobj/celllistsource.cxx @@ -309,9 +309,8 @@ namespace calc aEvent.Source.set(*this); m_aListEntryListeners.forEach(aGuard, -[, ] (const css::uno::Reference& l) +[] (const css::uno::Reference& l) { -aGuard.unlock(); try { l->allEntriesChanged( aEvent ); @@ -324,7 +323,6 @@ namespace calc { TOOLS_WARN_EXCEPTION( "sc", "OCellListSource::notifyModified: caught a (non-runtime) exception!" ); } -aGuard.lock(); }); }
core.git: sc/source
sc/source/ui/StatisticsDialogs/RegressionDialog.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 069bf61cea5e3aea07ffd5a1bb9f55324651cb35 Author: Andrea Gelmini AuthorDate: Sun Mar 31 11:25:36 2024 +0200 Commit: Taichi Haradaguchi <20001...@ymail.ne.jp> CommitDate: Mon Apr 1 01:00:01 2024 +0200 Fix abbr. Change-Id: Ia1f8f1527e76f2a721d42f6de11122f8c167bc96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165589 Tested-by: Jenkins Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp> diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx index 547866cf010c..2031bae10ff5 100644 --- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx @@ -368,7 +368,7 @@ void ScRegressionDialog::WriteRawRegressionResults(AddressWalkerWriter& rOutput, mbCalcIntercept ? std::u16string_view(u"TRUE") : std::u16string_view(u"FALSE"))); rOutput.writeMatrixFormula(rTemplate.getTemplate(), 1 + mnNumIndependentVars, 5); // Add LINEST result components to template -// 1. Add ranges for coefficients and standard errors for indep. vars and the intercept. +// 1. Add ranges for coefficients and standard errors for independent vars and the intercept. // Note that these two are in the reverse order(m_n, m_n-1, ..., m_1, b) w.r.t what we expect. rTemplate.autoReplaceRange("%COEFFICIENTS_REV_RANGE%", ScRange(rOutput.current(), rOutput.current(mnNumIndependentVars))); rTemplate.autoReplaceRange("%SERRORSX_REV_RANGE%", ScRange(rOutput.current(0, 1), rOutput.current(mnNumIndependentVars, 1)));
core.git: sc/source
sc/source/filter/rtf/eeimpars.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 454da7750db671c1f82fec4706de9a44c29b3e2e Author: Caolán McNamara AuthorDate: Fri Mar 29 13:21:33 2024 + Commit: Caolán McNamara CommitDate: Fri Mar 29 15:23:06 2024 +0100 cid#67704 Integer-overflow Change-Id: I42aa4b3e43636bf6f0c0f77c5028501229badee2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165545 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 6e588ffdc30d..38f3f73e89aa 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -309,7 +309,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu ScMF::Hor ); if ( pE->nRowOverlap > 1 ) { -nRO = nRow + pE->nRowOverlap - 1; +nRO = nRow + (pE->nRowOverlap - 1); mpDoc->ApplyFlagsTab( nCol, nRow+1, nCol, nRO , nTab, ScMF::Ver );
core.git: sc/source
sc/source/ui/view/gridwin.cxx | 62 +++--- 1 file changed, 34 insertions(+), 28 deletions(-) New commits: commit dbb0892ad1f576de4b4910c4b1683f3c88a7c0e7 Author: sahil AuthorDate: Fri Oct 27 02:27:03 2023 +0530 Commit: Michael Weghorn CommitDate: Thu Mar 28 21:40:56 2024 +0100 Refactor ScGridWindow::GetEditUrl() To avoid code copy/pasting, common code is refactored to `lcl_SetEngineTextKeepingDefaults` to be used later in tdf#123159 Change-Id: I1889c8eee931ef8950e95af8aec73a1884b07302 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158516 Reviewed-by: Michael Weghorn Tested-by: Jenkins diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 013a994500df..07d2d3a71b63 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5765,6 +5765,39 @@ bool extractURLInfo( const SvxFieldItem* pFieldItem, OUString* pName, OUString* } +static void lcl_SetEngineTextKeepingDefaults(const std::shared_ptr& pEngine, + ScDocument& rDoc, ScRefCellValue& rCell, const OUString& rURL) +{ +std::unique_ptr pTextObj; +if (rCell.getType() == CELLTYPE_EDIT) +{ +if (rCell.getEditText()) +pEngine->SetTextCurrentDefaults(*rCell.getEditText()); +} +else // Not an Edit cell and is a formula cell with 'Hyperlink' + // function if we have no URL, otherwise it could be a formula + // cell ( or other type ? ) with a hyperlink associated with it. +{ +if (rURL.isEmpty()) +pTextObj = rCell.getFormula()->CreateURLObject(); +else +{ +OUString aRepres = rURL; + +// TODO: text content of formatted numbers can be different +if (rCell.hasNumeric()) +aRepres = OUString::number(rCell.getValue()); +else if (rCell.getType() == CELLTYPE_FORMULA) +aRepres = rCell.getFormula()->GetString().getString(); + +pTextObj = ScEditUtil::CreateURLObjectFromURL(rDoc, rURL, aRepres); +} + +if (pTextObj) +pEngine->SetTextCurrentDefaults(*pTextObj); +} +} + bool ScGridWindow::GetEditUrl( const Point& rPos, OUString* pName, OUString* pUrl, OUString* pTarget ) { @@ -5826,34 +5859,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, aPaperSize.setWidth( nThisColLogic ); pEngine->SetPaperSize( aPaperSize ); -std::unique_ptr pTextObj; -if (aCell.getType() == CELLTYPE_EDIT) -{ -if (aCell.getEditText()) -pEngine->SetTextCurrentDefaults(*aCell.getEditText()); -} -else // Not an Edit cell and is a formula cell with 'Hyperlink' - // function if we have no URL, otherwise it could be a formula - // cell ( or other type ? ) with a hyperlink associated with it. -{ -if (sURL.isEmpty()) -pTextObj = aCell.getFormula()->CreateURLObject(); -else -{ -OUString aRepres = sURL; - -// TODO: text content of formatted numbers can be different -if (aCell.hasNumeric()) -aRepres = OUString::number(aCell.getValue()); -else if (aCell.getType() == CELLTYPE_FORMULA) -aRepres = aCell.getFormula()->GetString().getString(); - -pTextObj = ScEditUtil::CreateURLObjectFromURL(rDoc, sURL, aRepres); -} - -if (pTextObj) -pEngine->SetTextCurrentDefaults(*pTextObj); -} +lcl_SetEngineTextKeepingDefaults(pEngine, rDoc, aCell, sURL); tools::Long nStartX = aLogicEdit.Left();
core.git: sc/source
sc/source/core/data/documen9.cxx |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) New commits: commit 3819e4f6f70ee60fc5c805f0d33c0062a396918c Author: Noel Grandin AuthorDate: Thu Mar 28 13:25:10 2024 +0200 Commit: Noel Grandin CommitDate: Thu Mar 28 17:17:55 2024 +0100 tdf#160399 speed up print preview takes time from 5s to 2.5s for me Change-Id: I7e62e4a47d5b2aae982273cc3ea38c5c9b04256d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165461 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 2b6685bd0ee6..59e4984db7fa 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -440,13 +440,8 @@ bool ScDocument::IsPrintEmpty( SCCOL nStartCol, SCROW nStartRow, // keep vertical part of aMMRect, only update horizontal position aMMRect = *pLastMM; -tools::Long nLeft = 0; -SCCOL i; -for (i=0; i
core.git: sc/source
sc/source/filter/html/htmlpars.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 86837b3d67cfe48a9983a13c5794147e192491a0 Author: Caolán McNamara AuthorDate: Thu Mar 28 09:09:00 2024 + Commit: Caolán McNamara CommitDate: Thu Mar 28 16:51:55 2024 +0100 ofz: negative column offset Change-Id: Ieeb06e5c5d28f1c457db369a732bc37a7d5f2be8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165447 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 5bf4c4c07a83..5ea4c4a5997a 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -852,6 +852,11 @@ void ScHTMLLayoutParser::SetWidths() OSL_ENSURE( nCol < nColsPerRow, "ScHTMLLayoutParser::SetWidths: column overflow" ); if (nCol >= nColsPerRow) continue; +if (nCol < 0) +{ +SAL_WARN("sc", "negative offset: " << nCol); +continue; +} pE->nOffset = pOffsets[nCol]; nCol = nCol + pE->nColOverlap; if ( nCol > nColsPerRow )
core.git: sc/source
sc/source/ui/unoobj/cellvaluebinding.cxx | 98 +-- sc/source/ui/unoobj/cellvaluebinding.hxx | 28 2 files changed, 68 insertions(+), 58 deletions(-) New commits: commit 7510cca63690ea97eb02a43f698fc183c3d0434a Author: Noel Grandin AuthorDate: Tue Mar 26 15:56:02 2024 +0200 Commit: Noel Grandin CommitDate: Thu Mar 28 06:42:46 2024 +0100 convert OCellValueBinding to comphelper::WeakComponentImplHelper Change-Id: I007d0c44bed1ab9e00cadcdbd126bc6bf3d99ea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165364 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx index fd8b43f9578e..7c4865726bef 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.cxx +++ b/sc/source/ui/unoobj/cellvaluebinding.cxx @@ -54,10 +54,7 @@ namespace calc using namespace ::com::sun::star::form::binding; OCellValueBinding::OCellValueBinding( const Reference< XSpreadsheetDocument >& _rxDocument, bool _bListPos ) -:OCellValueBinding_Base( m_aMutex ) -,OCellValueBinding_PBase( OCellValueBinding_Base::rBHelper ) -,m_xDocument( _rxDocument ) -,m_aModifyListeners( m_aMutex ) +:m_xDocument( _rxDocument ) ,m_bInitialized( false ) ,m_bListPos( _bListPos ) { @@ -76,7 +73,7 @@ namespace calc OCellValueBinding::~OCellValueBinding( ) { -if ( !OCellValueBinding_Base::rBHelper.bDisposed ) +if ( !m_bDisposed ) { acquire(); // prevent duplicate dtor dispose(); @@ -87,7 +84,7 @@ namespace calc IMPLEMENT_FORWARD_XTYPEPROVIDER2( OCellValueBinding, OCellValueBinding_Base, OCellValueBinding_PBase ) -void SAL_CALL OCellValueBinding::disposing() +void OCellValueBinding::disposing( std::unique_lock& rGuard ) { Reference xBroadcaster( m_xCell, UNO_QUERY ); if ( xBroadcaster.is() ) @@ -95,7 +92,7 @@ namespace calc xBroadcaster->removeModifyListener( this ); } -WeakComponentImplHelperBase::disposing(); +WeakComponentImplHelperBase::disposing(rGuard); // TODO: clean up here whatever you need to clean up (e.g. deregister as XEventListener // for the cell) @@ -106,7 +103,7 @@ namespace calc return createPropertySetInfo( getInfoHelper() ) ; } -::cppu::IPropertyArrayHelper& SAL_CALL OCellValueBinding::getInfoHelper() +::cppu::IPropertyArrayHelper& OCellValueBinding::getInfoHelper() { return *OCellValueBinding_PABase::getArrayHelper(); } @@ -118,7 +115,7 @@ namespace calc return new ::cppu::OPropertyArrayHelper(aProps); } -void SAL_CALL OCellValueBinding::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const +void OCellValueBinding::getFastPropertyValue( std::unique_lock& /*rGuard*/, Any& _rValue, sal_Int32 _nHandle ) const { OSL_ENSURE( _nHandle == PROP_HANDLE_BOUND_CELL, "OCellValueBinding::getFastPropertyValue: invalid handle!" ); // we only have this one property... @@ -131,9 +128,14 @@ namespace calc Sequence< Type > SAL_CALL OCellValueBinding::getSupportedValueTypes( ) { -checkDisposed( ); +std::unique_lock aGuard(m_aMutex); +throwIfDisposed(aGuard); checkInitialized( ); +return getSupportedValueTypes(aGuard); +} +Sequence< Type > OCellValueBinding::getSupportedValueTypes( std::unique_lock& /*rGuard*/ ) const +{ sal_Int32 nCount = m_xCellText.is() ? 3 : m_xCell.is() ? 1 : 0; if ( m_bListPos ) ++nCount; @@ -163,11 +165,16 @@ namespace calc sal_Bool SAL_CALL OCellValueBinding::supportsType( const Type& aType ) { -checkDisposed( ); +std::unique_lock aGuard(m_aMutex); +throwIfDisposed(aGuard); checkInitialized( ); +return supportsType(aGuard, aType); +} +bool OCellValueBinding::supportsType( std::unique_lock& rGuard, const Type& aType ) const +{ // look up in our sequence -const Sequence< Type > aSupportedTypes( getSupportedValueTypes() ); +const Sequence< Type > aSupportedTypes( getSupportedValueTypes(rGuard) ); for ( auto const & i : aSupportedTypes ) if ( aType == i ) return true; @@ -177,9 +184,10 @@ namespace calc Any SAL_CALL OCellValueBinding::getValue( const Type& aType ) { -checkDisposed( ); +std::unique_lock aGuard(m_aMutex); +throwIfDisposed(aGuard); checkInitialized( ); -checkValueType( aType ); +checkValueType( aGuard, aType ); Any aReturn; switch ( aType.getTypeClass() ) @@ -263,10 +271,11 @@ namespace calc void SAL_CALL OCellValueBinding::setValue( const Any& aValue ) { -checkDisposed( ); +
core.git: sc/source
sc/source/core/data/document.cxx | 45 +-- 1 file changed, 16 insertions(+), 29 deletions(-) New commits: commit 703dab1603af044e9b519e33aa1aa13b74d12c9a Author: Noel Grandin AuthorDate: Tue Mar 26 15:16:07 2024 +0200 Commit: Noel Grandin CommitDate: Tue Mar 26 19:02:58 2024 +0100 cool#8570 speed up ScDocument::GetColDefault we can used an unordered_map here, we are sorting by pointer value. Also reduce the number of erase/insert Change-Id: Idb68f76e04248a0c808399bf9881afb5a8e01451 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165346 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 17a3b72d96b6..04370b62117f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -95,6 +95,7 @@ #include #include #include +#include #include #include @@ -150,23 +151,13 @@ void collectUIInformation(std::map&& aParameters, const OUSt struct ScDefaultAttr { -const ScPatternAttr*pAttr; -SCROW nFirst; -SCSIZE nCount; -explicit ScDefaultAttr(const ScPatternAttr* pPatAttr) : pAttr(pPatAttr), nFirst(0), nCount(0) {} -}; - -struct ScLessDefaultAttr -{ -bool operator() (const ScDefaultAttr& rValue1, const ScDefaultAttr& rValue2) const -{ -return rValue1.pAttr < rValue2.pAttr; -} +SCROW nFirst { 0 }; +SCSIZE nCount { 0 }; }; } -typedef std::set ScDefaultAttrSet; +typedef std::unordered_map ScDefaultAttrMap; void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck ) { @@ -4676,40 +4667,36 @@ void ScDocument::GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& n if (nEndRow >= nLastRow) return; -ScDefaultAttrSet aSet; -ScDefaultAttrSet::iterator aItr = aSet.end(); +ScDefaultAttrMap aMap; while (pAttr) { -ScDefaultAttr aAttr(pAttr); -aItr = aSet.find(aAttr); -if (aItr == aSet.end()) +auto aItr = aMap.find(pAttr); +if (aItr == aMap.end()) { +ScDefaultAttr aAttr; aAttr.nCount = static_cast(nEndRow - nStartRow + 1); aAttr.nFirst = nStartRow; -aSet.insert(aAttr); +aMap.insert({ pAttr, aAttr}); } else { -aAttr.nCount = aItr->nCount + static_cast(nEndRow - nStartRow + 1); -aAttr.nFirst = aItr->nFirst; -aSet.erase(aItr); -aSet.insert(aAttr); +aItr->second.nCount += static_cast(nEndRow - nStartRow + 1); } pAttr = aDocAttrItr.GetNext(nColumn, nStartRow, nEndRow); } -ScDefaultAttrSet::iterator aDefaultItr = aSet.begin(); -aItr = aDefaultItr; +auto aDefaultItr = aMap.begin(); +auto aItr = aDefaultItr; ++aItr; -while (aItr != aSet.end()) +while (aItr != aMap.end()) { // for entries with equal count, use the one with the lowest start row, // don't use the random order of pointer comparisons -if ( aItr->nCount > aDefaultItr->nCount || - ( aItr->nCount == aDefaultItr->nCount && aItr->nFirst < aDefaultItr->nFirst ) ) +if ( aItr->second.nCount > aDefaultItr->second.nCount || + ( aItr->second.nCount == aDefaultItr->second.nCount && aItr->second.nFirst < aDefaultItr->second.nFirst ) ) aDefaultItr = aItr; ++aItr; } -nDefault = aDefaultItr->nFirst; +nDefault = aDefaultItr->second.nFirst; } void ScDocument::StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab )
core.git: sc/source
sc/source/ui/attrdlg/scdlgfact.cxx | 35 --- sc/source/ui/attrdlg/scdlgfact.hxx | 39 - sc/source/ui/docshell/arealink.cxx | 30 ++-- sc/source/ui/docshell/docsh4.cxx | 23 +++- sc/source/ui/drawfunc/drawsh.cxx | 57 --- sc/source/ui/pagedlg/tphfedit.cxx | 27 ++ sc/source/ui/view/cellsh1.cxx | 67 - sc/source/ui/view/cellsh2.cxx | 10 + sc/source/ui/view/gridwin2.cxx | 42 +-- sc/source/ui/view/pivotsh.cxx | 42 +-- sc/source/ui/view/tabvwshb.cxx |9 +--- 11 files changed, 133 insertions(+), 248 deletions(-) New commits: commit fc1b2a0ab2ecddaeead680aee80a49109082a47b Author: Noel Grandin AuthorDate: Tue Mar 26 10:59:48 2024 +0200 Commit: Noel Grandin CommitDate: Tue Mar 26 17:16:08 2024 +0100 tdf#160338 Calc freeze on Text Attribute dialog This reverts commit 76e9023c8abc823447b1128056e55238f90da8d6 Author: Noel Grandin Date: Mon Jan 22 08:36:28 2024 +0200 convert more calc dialogs to async I fixed some lifetime issues, but even once that was happy, the Text Attributes dialog was not receiving mouse events properly, something else is unhappy when we mix async and modal dialogs. Change-Id: I4a35d886895c65af2085b606ff5c7a7c02fb5671 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165305 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index bd8a77b523e8..4fe36f303c57 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -153,11 +153,6 @@ short AbstractScDataFormDlg_Impl::Execute() return m_xDlg->run(); } -bool AbstractScDataFormDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) -{ -return ScDataFormDlg::runAsync(m_xDlg, rCtx.maEndDialogFn); -} - BitmapEx AbstractScDataFormDlg_Impl::createScreenshot() const { VclPtr xDialogSurface(m_xDlg->getDialog()->screenshot()); @@ -260,11 +255,6 @@ short AbstractScPivotFilterDlg_Impl::Execute() return m_xDlg->run(); } -bool AbstractScPivotFilterDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext ) -{ -return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); -} - short AbstractScDPFunctionDlg_Impl::Execute() { return m_xDlg->run(); @@ -290,41 +280,21 @@ short AbstractScDPNumGroupDlg_Impl::Execute() return m_xDlg->run(); } -bool AbstractScDPNumGroupDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext ) -{ -return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); -} - short AbstractScDPDateGroupDlg_Impl::Execute() { return m_xDlg->run(); } -bool AbstractScDPDateGroupDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext ) -{ -return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); -} - short AbstractScDPShowDetailDlg_Impl::Execute() { return m_xDlg->run(); } -bool AbstractScDPShowDetailDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) -{ -return ScDPShowDetailDlg::runAsync(m_xDlg, rCtx.maEndDialogFn); -} - short AbstractScNewScenarioDlg_Impl::Execute() { return m_xDlg->run(); } -bool AbstractScNewScenarioDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) -{ -return ScNewScenarioDlg::runAsync(m_xDlg, rCtx.maEndDialogFn); -} - short AbstractScShowTabDlg_Impl::Execute() { return m_xDlg->run(); @@ -379,11 +349,6 @@ short AbstractScLinkedAreaDlg_Impl::Execute() return m_xDlg->run(); } -bool AbstractScLinkedAreaDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) -{ -return ScLinkedAreaDlg::runAsync(m_xDlg, rCtx.maEndDialogFn); -} - void AbstractScImportAsciiDlg_Impl::GetOptions( ScAsciiOptions& rOpt ) { m_xDlg->GetOptions( rOpt ); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index aab8cf1cc107..276bffd63195 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -177,7 +177,7 @@ class AbstractScDeleteCellDlg_Impl : public AbstractScDeleteCellDlg { std::shared_ptr m_xDlg; public: -explicit AbstractScDeleteCellDlg_Impl(std::shared_ptr p) +explicit AbstractScDeleteCellDlg_Impl(std::unique_ptr p) : m_xDlg(std::move(p)) { } @@ -193,14 +193,13 @@ public: //for dataform class AbstractScDataFormDlg_Impl : public AbstractScDataFormDlg { -std::shared_ptr m_xDlg; +std::unique_ptr m_xDlg; public: -explicit AbstractScDataFormDlg_Impl(std::shared_ptr p) +explicit AbstractScDataFormDlg_Impl(std::unique_ptr p) : m_xDlg(std::move(p)) { } virtual short Execute() override; -virtual bool StartExecuteAsync(AsyncContext& rCtx) override; // screenshotting virtual BitmapEx createScreenshot() const override; @@ -260,7
core.git: sc/source
sc/source/filter/html/htmlpars.cxx |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) New commits: commit 9d1275974d23c520a706129807443ff909719e23 Author: Caolán McNamara AuthorDate: Tue Mar 26 09:22:56 2024 + Commit: Caolán McNamara CommitDate: Tue Mar 26 15:38:45 2024 +0100 ofz#67635 Integer-overflow Change-Id: Ia764276d6b35ea84d7415484eaeb9da77e55092a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165307 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index db8256d9e851..5bf4c4c07a83 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -705,13 +705,12 @@ void ScHTMLLayoutParser::Adjust() //FIXME: This may not be correct, but works anyway ... pE->nColOverlap = 1; } -xLockedList->Join( ScRange( pE->nCol, pE->nRow, 0, -pE->nCol + pE->nColOverlap - 1, pE->nRow + pE->nRowOverlap - 1, 0 ) ); +SCCOL nColTmp = o3tl::saturating_add(pE->nCol, pE->nColOverlap); +SCROW nRowTmp = o3tl::saturating_add(pE->nRow ,pE->nRowOverlap); +xLockedList->Join( ScRange( pE->nCol, pE->nRow, 0, nColTmp - 1, nRowTmp - 1, 0 ) ); // Take over MaxDimensions -SCCOL nColTmp = pE->nCol + pE->nColOverlap; if ( nColMax < nColTmp ) nColMax = nColTmp; -SCROW nRowTmp = pE->nRow + pE->nRowOverlap; if ( nRowMax < nRowTmp ) nRowMax = nRowTmp; }
core.git: sc/source sw/source
sc/source/core/tool/chgtrack.cxx |2 +- sc/source/filter/oox/condformatbuffer.cxx|2 +- sw/source/core/layout/paintfrm.cxx |2 +- sw/source/core/unocore/unotextmarkup.cxx |2 +- sw/source/filter/ww8/docxattributeoutput.cxx |2 +- 5 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 74299624ec810f9683326608ad398211cf51787b Author: RMZeroFour AuthorDate: Sun Mar 24 10:09:49 2024 +0530 Commit: Michael Weghorn CommitDate: Tue Mar 26 08:20:02 2024 +0100 tdf#158237 Use contains instead of find-end As part of the efforts in #158237 to replace older parts of the codebase using find() and end() methods, with contains(), this commit does the needed changes for a few files in the sc and sw modulues. Change-Id: Ibf0a432c537879f5bec8e8912d11150733366689 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165223 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 53fe660f103d..6d9a401caa64 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -3988,7 +3988,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct, { ScChangeAction* p = GetAction( static_cast(pCur)->GetRejectAction() ); -if (p != pAct && rMap.find( p->GetActionNumber() ) == rMap.end()) +if (p != pAct && !rMap.contains( p->GetActionNumber() )) cStack.push( p ); } } diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 2626735023dd..d1ee97ca70ac 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1253,7 +1253,7 @@ void CondFormatBuffer::finalizeImport() RangeMap aRangeMap; for (auto& rxCondFormat : maCondFormats) { -if (aRangeMap.find(rxCondFormat->getRanges()) != aRangeMap.end()) +if (aRangeMap.contains(rxCondFormat->getRanges())) continue; aRangeMap[rxCondFormat->getRanges()] = rxCondFormat.get(); } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 88175ddc250a..042c4f3be4a7 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -4577,7 +4577,7 @@ void SwTextFrame::PaintParagraphStylesHighlighting() const // draw styles highlighter OUString sStyleName = GetTextNodeFirst()->GetTextColl()->GetName(); -if (rParaStylesColorMap.find(sStyleName) != rParaStylesColorMap.end()) +if (rParaStylesColorMap.contains(sStyleName)) { SwRect aFrameAreaRect(getFrameArea()); diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index 4bbc8601608d..6c49044f4911 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -478,7 +478,7 @@ uno::Any SAL_CALL SwXStringKeyMap::getValue(const OUString & aKey) sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const OUString & aKey) { -return maMap.find( aKey ) != maMap.end(); +return maMap.contains(aKey); } void SAL_CALL SwXStringKeyMap::insertValue(const OUString & aKey, const uno::Any & aValue) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 47ffb332bf21..31711eb4e887 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -577,7 +577,7 @@ sal_Int32 DocxAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t p { const SfxGrabBagItem& rParaGrabBag = static_cast(*pItem); const std::map& rMap = rParaGrabBag.GetGrabBag(); -bEndParaSdt = m_aParagraphSdt.m_bStartedSdt && rMap.find("ParaSdtEndBefore") != rMap.end(); +bEndParaSdt = m_aParagraphSdt.m_bStartedSdt && rMap.contains("ParaSdtEndBefore"); } } }
core.git: sc/source
sc/source/ui/view/tabview.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 0581190bc4e5502d93aa695365e7bf82b23d1ecf Author: Caolán McNamara AuthorDate: Mon Mar 25 10:20:12 2024 + Commit: Caolán McNamara CommitDate: Mon Mar 25 21:35:30 2024 +0100 cid#1594675 Logically dead code Change-Id: Icaf621e7a2e163f969ac7b6a1d6d04bf9251ea56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165277 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index e809ceb11249..79bd6d1e67ff 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1154,10 +1154,12 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) aHelpStr = ScResId(STR_ROW) + " " + OUString::number(nScrollPos + 1); +// note that bLayoutRTL is always false here, because bLayoutRTL depends on bHoriz + // show quicktext always inside sheet area -aRect.SetLeft( bLayoutRTL ? (aPos.X() + aSize.Width() + 8) : (aPos.X() - 8) ); +aRect.SetLeft(aPos.X() - 8); aRect.SetTop( aMousePos.Y() ); -nAlign = (bLayoutRTL ? QuickHelpFlags::Left : QuickHelpFlags::Right) | QuickHelpFlags::VCenter; +nAlign = QuickHelpFlags::Right | QuickHelpFlags::VCenter; } aRect.SetRight( aRect.Left() ); aRect.SetBottom( aRect.Top() );
core.git: sc/source
sc/source/core/data/SolverSettings.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 32c6a482fc058c4f3d064b08660607d2919d6617 Author: Caolán McNamara AuthorDate: Mon Mar 25 10:17:19 2024 + Commit: Caolán McNamara CommitDate: Mon Mar 25 18:10:03 2024 +0100 add missing mode lines Change-Id: Iafcda5fb4d639d35ea35bab2b8b015208a8397fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165276 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/data/SolverSettings.cxx b/sc/source/core/data/SolverSettings.cxx index 806ca85bbd6e..64735722568f 100644 --- a/sc/source/core/data/SolverSettings.cxx +++ b/sc/source/core/data/SolverSettings.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -795,3 +795,5 @@ bool SolverSettings::TabHasSolverModel() } } // namespace sc + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
core.git: sc/source
sc/source/filter/html/htmlpars.cxx | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) New commits: commit 035f87f7ed8775c30c6f84d7d02bc72a66182c63 Author: Caolán McNamara AuthorDate: Sat Mar 23 15:19:04 2024 + Commit: Caolán McNamara CommitDate: Sun Mar 24 21:41:36 2024 +0100 ofz#67577 Integer-overflow Change-Id: I3828bb76ab7808ac0717b33c231927730216b42b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165216 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index e5b25bb42bd1..db8256d9e851 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -535,8 +535,20 @@ void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, bool bJoin ) // Or else this would create a wrong value at ScAddress (chance for an infinite loop)! bool bBadCol = false; bool bAgain; -ScRange aRange( pE->nCol, pE->nRow, 0, -pE->nCol + pE->nColOverlap - 1, pE->nRow + pE->nRowOverlap - 1, 0 ); + +SCCOL nEndCol(0); +SCROW nEndRow(0); +bool bFail = o3tl::checked_add(pE->nCol, pE->nColOverlap - 1, nEndCol) || + o3tl::checked_add(pE->nRow, pE->nRowOverlap - 1, nEndRow); + +if (bFail) +{ +SAL_WARN("sc", "invalid range: " << pE->nCol << " " << pE->nColOverlap << + " " << pE->nRow << " " << pE->nRowOverlap); +return; +} + +ScRange aRange(pE->nCol, pE->nRow, 0, nEndCol, nEndRow, 0); do { bAgain = false;
core.git: sc/source
sc/source/ui/app/rfindlst.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit 9c8b240e7cad6ef74e16ad83d45957737389aa90 Author: Heiko Tietze AuthorDate: Thu Mar 21 11:50:40 2024 +0100 Commit: Heiko Tietze CommitDate: Fri Mar 22 13:06:37 2024 +0100 Resolves tdf#160282 - Ranges references text colors for dark backgrounds Change-Id: I3d3bb22302ad5016c962d606e80c2e9942301fbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165095 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/sc/source/ui/app/rfindlst.cxx b/sc/source/ui/app/rfindlst.cxx index ba17bf006ea1..be521f65dea8 100644 --- a/sc/source/ui/app/rfindlst.cxx +++ b/sc/source/ui/app/rfindlst.cxx @@ -20,18 +20,25 @@ #include #include #include +#include +#include #define SC_RANGECOLORS 8 const Color aColNames[SC_RANGECOLORS] = { COL_LIGHTBLUE, COL_LIGHTRED, COL_LIGHTMAGENTA, COL_GREEN, COL_BLUE, COL_RED, COL_MAGENTA, COL_BROWN }; +const Color aDarkColNames[SC_RANGECOLORS] = +{ COL_LIGHTBLUE, COL_LIGHTRED, COL_LIGHTMAGENTA, COL_GREEN, +Color(0xb4c7dc), Color(0xffa6a6), Color(0xffb66c), Color(0xafd095) }; //light blue/red/orange/green 3 +static bool bIsDark; ScRangeFindList::ScRangeFindList(OUString aName) : aDocName(std::move( aName )), bHidden( false ), nIndexColor( 0 ) { +bIsDark = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor.IsDark(); } Color ScRangeFindList::Insert( const ScRangeFindData ) @@ -48,7 +55,8 @@ Color ScRangeFindList::Insert( const ScRangeFindData ) Color ScRangeFindList::GetColorName( const size_t nIndex ) { -return aColNames[nIndex % SC_RANGECOLORS]; +return bIsDark ? aDarkColNames[nIndex % SC_RANGECOLORS] + : aColNames[nIndex % SC_RANGECOLORS]; } Color ScRangeFindList::FindColor( const ScRange& rRef, const size_t nIndex )
core.git: sc/source
sc/source/core/data/documen6.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit de148aa512e02457e43c6db966472a37059fbb14 Author: Caolán McNamara AuthorDate: Thu Mar 21 15:24:24 2024 + Commit: Caolán McNamara CommitDate: Thu Mar 21 20:35:01 2024 +0100 Related: tdf#160056 replace with wrapper GetFormatTable() GetFormatTable calls mxPoolHelper->GetFormTable() but asserts if this happens during threaded calculation so replace the first with the latter Change-Id: I7027f66a929159525842bfabbf8cf4ab0e55ed23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165107 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx index 931cb9002bee..96c625eaf9af 100644 --- a/sc/source/core/data/documen6.cxx +++ b/sc/source/core/data/documen6.cxx @@ -118,9 +118,9 @@ SvtScriptType ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uInt32 n const Color* pColor; OUString aStr; if( pCell ) -aStr = ScCellFormat::GetString(*pCell, nNumberFormat, , *mxPoolHelper->GetFormTable(), *this); +aStr = ScCellFormat::GetString(*pCell, nNumberFormat, , *GetFormatTable(), *this); else -aStr = ScCellFormat::GetString(*this, rPos, nNumberFormat, , *mxPoolHelper->GetFormTable()); +aStr = ScCellFormat::GetString(*this, rPos, nNumberFormat, , *GetFormatTable()); SvtScriptType nRet = GetStringScriptType( aStr ); @@ -146,7 +146,7 @@ SvtScriptType ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, con if ( !pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty() ) pCondSet = GetCondResult( nCol, nRow, nTab ); -sal_uInt32 nFormat = pPattern->GetNumberFormat( mxPoolHelper->GetFormTable(), pCondSet ); +sal_uInt32 nFormat = pPattern->GetNumberFormat( GetFormatTable(), pCondSet ); return GetCellScriptType(aPos, nFormat, pCell); }
core.git: sc/source
sc/source/ui/view/tabview4.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ed0c9511dbda2b2bc457030171bec2f655f34c4c Author: Andrea Gelmini AuthorDate: Thu Mar 21 14:42:37 2024 +0100 Commit: Julien Nabet CommitDate: Thu Mar 21 15:46:24 2024 +0100 Fix typo Change-Id: I229126f1fc52e85026dd75fb6ce3851653a8e250 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165102 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 5c19b6cf0794..2c7a5e1bdbed 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -375,7 +375,7 @@ void ScTabView::SetScrollBar( ScrollAdaptor& rScroll, tools::Long nRangeMax, too // drag in unexpected locations to move the scrollbar thumb // in the desired direction // - Repeatedly dragging the scrollbar thumb leftward can only -// move no highter than the R, S, or T columns +// move no higher than the R, S, or T columns rScroll.EnableRTL( false ); // Related: tdf#93352 swap arrows if layout is RTL
core.git: sc/source
sc/source/ui/view/gridwin.cxx |2 ++ sc/source/ui/view/viewdata.cxx | 26 ++ 2 files changed, 28 insertions(+) New commits: commit 99bd13feb386587262c40d6c474d4fa817da31bd Author: Marco Cecchetti AuthorDate: Fri Feb 9 19:04:33 2024 +0100 Commit: Tomaž Vajngerl CommitDate: Wed Mar 20 11:17:09 2024 +0100 lok calc: show cell cursor on in place editing On in place editing cell cursor overlay matches the output area. In this way the user has a better guess about the edited area. Change-Id: Iba3370d942a9deaedeed23298a7cb7a6c6c0f5f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164701 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl (cherry picked from commit cc88ad715f80b13efb29744673d044df9c16550c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164992 Tested-by: Jenkins diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 71364aaf172a..c24435aaa903 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -6179,6 +6179,8 @@ void ScGridWindow::UpdateAllOverlays() void ScGridWindow::DeleteCursorOverlay() { +if (comphelper::LibreOfficeKit::isActive() && mrViewData.HasEditView(eWhich)) +return; ScTabViewShell* pViewShell = mrViewData.GetViewShell(); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"_ostr); SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"_ostr); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 83975c6b0ee9..aa691ddfebde 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -71,6 +71,7 @@ #include #include +#include using namespace com::sun::star; @@ -1520,6 +1521,22 @@ tools::Rectangle ScViewData::GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW GetEditArea( pPattern, bForceToTop ); } +namespace { + +void notifyCellCursorAt(const ScTabViewShell* pViewShell, SCCOL nCol, SCROW nRow, +const tools::Rectangle& rCursor) +{ +std::stringstream ss; +ss << rCursor.getX() << ", " << rCursor.getY() << ", " << rCursor.GetWidth() << ", " + << rCursor.GetHeight() << ", " << nCol << ", " << nRow; + +pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, ss.str().c_str()); +SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", + ss.str().c_str()); +} + +} + void ScViewData::SetEditEngine( ScSplitPos eWhich, ScEditEngineDefaulter* pNewEngine, vcl::Window* pWin, SCCOL nNewX, SCROW nNewY ) @@ -1635,6 +1652,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, tools::Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, GetLogicMode() ); pEditView[eWhich]->SetOutputArea( aOutputArea ); +if (bLOKPrintTwips) +notifyCellCursorAt(GetViewShell(), nNewX, nNewY, aPTwipsRect); + if ( bActive && eWhich == GetActivePart() ) { // keep the part that has the active edit view available after @@ -2120,6 +2140,9 @@ void ScViewData::EditGrowX() pCurView->SetOutputArea(aArea); +if (bLOKPrintTwips) +notifyCellCursorAt(GetViewShell(), nEditCol, nEditRow, aAreaPTwips); + // In vertical mode, the whole text is moved to the next cell (right-aligned), // so everything must be repainted. Otherwise, paint only the new area. // If growing in centered alignment, if the cells left and right have different sizes, @@ -2233,6 +2256,9 @@ void ScViewData::EditGrowY( bool bInitial ) pCurView->SetOutputArea(aArea); +if (bLOKPrintTwips) +notifyCellCursorAt(GetViewShell(), nEditCol, nEditRow, aAreaPTwips); + if (nEditEndRow >= nBottom || bMaxReached) { if (!(nControl & EVControlBits::AUTOSCROLL))
core.git: sc/source
sc/source/filter/html/htmlpars.cxx | 16 sc/source/filter/inc/htmlpars.hxx |2 +- 2 files changed, 9 insertions(+), 9 deletions(-) New commits: commit 5e87504307c078a027ad12c66a340579d15c6fb8 Author: Caolán McNamara AuthorDate: Tue Mar 19 10:11:43 2024 + Commit: Caolán McNamara CommitDate: Wed Mar 20 09:21:32 2024 +0100 leaks in initial corpus for sc html import fuzzing Change-Id: If5bfc9fb557fd449de8173790712f622a1c925ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165020 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index c969fa11a205..232a3d9c84fa 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -331,8 +331,8 @@ ScHTMLLayoutParser::~ScHTMLLayoutParser() xLocalColOffset.reset(); if ( pTables ) { -for( const auto& rEntry : *pTables) -delete rEntry.second; +for( auto& rEntry : *pTables) +rEntry.second.reset(); pTables.reset(); } } @@ -592,7 +592,7 @@ void ScHTMLLayoutParser::Adjust() { OuterMap::const_iterator it = pTables->find( nTab ); if ( it != pTables->end() ) -pTab = it->second; +pTab = it->second.get(); } } @@ -627,7 +627,7 @@ void ScHTMLLayoutParser::Adjust() { OuterMap::const_iterator it = pTables->find( nTab ); if ( it != pTables->end() ) -pTab = it->second; +pTab = it->second.get(); } // New line spacing SCROW nR = 0; @@ -1272,10 +1272,10 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo ) if ( it == pTables->end() ) { pTab1 = new InnerMap; -(*pTables)[ nTab ] = pTab1; +(*pTables)[ nTab ].reset(pTab1); } else -pTab1 = it->second; +pTab1 = it->second.get(); SCROW nRowSpan = pE->nRowOverlap; SCROW nRowKGV; SCROW nRowsPerRow1; // Outer table @@ -1295,7 +1295,7 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo ) if ( nRowsPerRow2 > 1 ) { // Height of the inner table pTab2 = new InnerMap; -(*pTables)[ nTable ] = pTab2; +(*pTables)[ nTable ].reset(pTab2); } // Abuse void* Data entry of the Table class for height mapping if ( nRowKGV > 1 ) @@ -1334,7 +1334,7 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo ) if ( !pTab2 ) { // nRowsPerRow2 could be've been incremented pTab2 = new InnerMap; -(*pTables)[ nTable ] = pTab2; +(*pTables)[ nTable ].reset(pTab2); } for ( SCROW j=0; j < nRows; j++ ) { diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index 7043c9176182..a03d1c4d5fca 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -148,7 +148,7 @@ class HTMLOption; // TODO these need better names typedef ::std::map InnerMap; -typedef ::std::map OuterMap; +typedef ::std::map> OuterMap; /// HTML parser used during paste into Calc. class ScHTMLLayoutParser : public ScHTMLParser
core.git: sc/source
sc/source/filter/html/htmlpars.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 85c40af4e9d4c679f66e7f7e004c018dd28994ee Author: Caolán McNamara AuthorDate: Tue Mar 19 08:46:45 2024 + Commit: Caolán McNamara CommitDate: Wed Mar 20 09:21:16 2024 +0100 null deref in initial sc html fuzzing Change-Id: I368db8fec4cfd9409197d17f2892153aca2ba502 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165019 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 1e70163ddd82..c969fa11a205 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -916,7 +916,8 @@ void ScHTMLLayoutParser::CloseEntry( const HtmlImportInfo* pInfo ) if ( bTabInTabCell ) { // From the stack in TableOff bTabInTabCell = false; -NewActEntry(maList.back().get()); // New free flying mxActEntry +SAL_WARN_IF(maList.empty(), "sc", "unexpected close entry without open"); +NewActEntry(maList.empty() ? nullptr : maList.back().get()); // New free flying mxActEntry return ; } if (mxActEntry->nTab == 0)
core.git: sc/source
sc/source/filter/html/htmlpars.cxx | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) New commits: commit 1dc579ae9cd7fcf504016ef510a9484173c9392d Author: Caolán McNamara AuthorDate: Mon Mar 18 17:06:33 2024 + Commit: Caolán McNamara CommitDate: Mon Mar 18 20:30:03 2024 +0100 calc html filter ScDocShell* deref for document properties ScDocShell is optional in other parts of this filter Change-Id: If219cfa6ef737a9695b85bf6db5d45e9750a7ed9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164974 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 830dac6f6615..846feda1ca85 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1605,13 +1605,14 @@ void ScHTMLLayoutParser::ProcToken( HtmlImportInfo* pInfo ) switch ( pInfo->nToken ) { case HtmlTokenId::META: +if (ScDocShell* pDocSh = mpDoc->GetDocumentShell()) { HTMLParser* pParser = static_cast(pInfo->pParser); uno::Reference xDPS( - static_cast(mpDoc->GetDocumentShell()->GetModel()), uno::UNO_QUERY_THROW); +static_cast(pDocSh->GetModel()), uno::UNO_QUERY_THROW); pParser->ParseMetaOptions( xDPS->getDocumentProperties(), -mpDoc->GetDocumentShell()->GetHeaderAttributes() ); +pDocSh->GetHeaderAttributes() ); } break; case HtmlTokenId::TITLE_ON: @@ -1622,12 +1623,13 @@ void ScHTMLLayoutParser::ProcToken( HtmlImportInfo* pInfo ) break; case HtmlTokenId::TITLE_OFF: { -if ( bInTitle && !aString.isEmpty() ) +ScDocShell* pDocSh = mpDoc->GetDocumentShell(); +if ( bInTitle && !aString.isEmpty() && pDocSh ) { // Remove blanks from line breaks aString = aString.trim(); uno::Reference xDPS( - static_cast(mpDoc->GetDocumentShell()->GetModel()), +static_cast(pDocSh->GetModel()), uno::UNO_QUERY_THROW); xDPS->getDocumentProperties()->setTitle(aString); }
core.git: sc/source
sc/source/ui/docshell/docfunc.cxx | 22 ++ sc/source/ui/inc/undoblk.hxx |8 +--- sc/source/ui/undo/undoblk.cxx | 18 +- 3 files changed, 24 insertions(+), 24 deletions(-) New commits: commit 8cce20756857cc3c42a2f9393afe6886c4abc1ea Author: Mike Kaganski AuthorDate: Sun Mar 17 17:49:25 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Mar 17 19:28:52 2024 +0100 Move undo info creation logic into ScUndoConditionalFormat So it is near the code that applies the undo data. This makes it easier to synchronize the logic. Change-Id: If3d41ae6b0afafc81e149756cb327f1fca6f2bb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164943 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 153182419306..ec174d9c1248 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5629,16 +5629,10 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr< if(rDoc.IsTabProtected(nTab)) return; -bool bUndo = rDoc.IsUndoEnabled(); -ScDocumentUniquePtr pUndoDoc; ScRange aCombinedRange = rRanges.Combine(); -if(bUndo) -{ -pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); -pUndoDoc->InitUndo( rDoc, nTab, nTab ); -if (const auto* pList = rDoc.GetCondFormList(nTab)) -pUndoDoc->SetCondFormList(new ScConditionalFormatList(*pUndoDoc, *pList), nTab); -} +std::unique_ptr pUndo; +if (rDoc.IsUndoEnabled()) +pUndo.reset(new ScUndoConditionalFormat(, nTab)); std::unique_ptr pRepaintRange; if(nOldFormat) @@ -5666,14 +5660,10 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr< rDoc.SetStreamValid(nTab, false); } -if(bUndo) +if (pUndo) { -ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO)); -pRedoDoc->InitUndo( rDoc, nTab, nTab ); -if (const auto* pList = rDoc.GetCondFormList(nTab)) -pRedoDoc->SetCondFormList(new ScConditionalFormatList(*pRedoDoc, *pList), nTab); -rDocShell.GetUndoManager()->AddUndoAction( -std::make_unique(, std::move(pUndoDoc), std::move(pRedoDoc), nTab)); +pUndo->setRedoData(); +rDocShell.GetUndoManager()->AddUndoAction(std::move(pUndo)); } if(pRepaintRange) diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx index d002b248d7ce..6a52ef059b0c 100644 --- a/sc/source/ui/inc/undoblk.hxx +++ b/sc/source/ui/inc/undoblk.hxx @@ -619,10 +619,11 @@ private: class ScUndoConditionalFormat : public ScSimpleUndo { public: -ScUndoConditionalFormat( ScDocShell* pNewDocShell, -ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab); +ScUndoConditionalFormat( ScDocShell* pNewDocShell, SCTAB nTab); virtual ~ScUndoConditionalFormat() override; +void setRedoData() { mpRedoDoc = createUndoRedoData(); } + virtual voidUndo() override; virtual voidRedo() override; virtual voidRepeat(SfxRepeatTarget& rTarget) override; @@ -631,10 +632,11 @@ public: virtual OUString GetComment() const override; private: +ScDocumentUniquePtr createUndoRedoData(); void DoChange(ScDocument* pDoc); +SCTAB mnTab; ScDocumentUniquePtr mpUndoDoc; ScDocumentUniquePtr mpRedoDoc; -SCTAB mnTab; }; class ScUndoConditionalFormatList : public ScSimpleUndo diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index f07cfd88c46b..33fe76b5baaa 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1605,12 +1605,10 @@ bool ScUndoListNames::CanRepeat(SfxRepeatTarget& rTarget) const return dynamic_cast( ) != nullptr; } -ScUndoConditionalFormat::ScUndoConditionalFormat(ScDocShell* pNewDocShell, -ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab): +ScUndoConditionalFormat::ScUndoConditionalFormat(ScDocShell* pNewDocShell, SCTAB nTab): ScSimpleUndo( pNewDocShell ), -mpUndoDoc(std::move(pUndoDoc)), -mpRedoDoc(std::move(pRedoDoc)), -mnTab(nTab) +mnTab(nTab), +mpUndoDoc(createUndoRedoData()) { } @@ -1618,6 +1616,16 @@ ScUndoConditionalFormat::~ScUndoConditionalFormat() { } +ScDocumentUniquePtr ScUndoConditionalFormat::createUndoRedoData() +{ +ScDocument& rDoc = pDocShell->GetDocument(); +ScDocumentUniquePtr pUndoRedoDoc(new ScDocument(SCDOCMODE_UNDO)); +pUndoRedoDoc->InitUndo(rDoc, mnTab, mnTab); +if (const auto* pList = rDoc.GetCondFormList(mnTab)) +pUndoRedoDoc->SetCondFormList(new ScConditionalFormatList(*pUndoRedoDoc, *pList), mnTab); +return pUndoRedoDoc; +} + OUString ScUndoConditionalFormat::GetComment() const { return ScResId( STR_UNDO_CONDFORMAT );
core.git: sc/source
sc/source/ui/docshell/docfunc.cxx | 25 + sc/source/ui/inc/undoblk.hxx |6 -- sc/source/ui/undo/undoblk.cxx | 26 +- 3 files changed, 30 insertions(+), 27 deletions(-) New commits: commit c492de66a077f3a2a960209b0b8b278b3901f361 Author: Mike Kaganski AuthorDate: Sun Mar 17 13:31:42 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Mar 17 11:27:59 2024 +0100 tdf#160149: save and restore the whole set of tab's conditional formats ... instead of restoring it only for a range, and then have troubles deciding how to join the range's formatting with the rest of tab's formatting. Change-Id: Ie422893c7847b1473a86c0cd8fc3916144eb24ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164937 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 37f0f2209848..153182419306 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5632,26 +5632,12 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr< bool bUndo = rDoc.IsUndoEnabled(); ScDocumentUniquePtr pUndoDoc; ScRange aCombinedRange = rRanges.Combine(); -ScRange aCompleteRange; if(bUndo) { pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); pUndoDoc->InitUndo( rDoc, nTab, nTab ); - -if(pFormat) -{ -aCompleteRange = aCombinedRange; -} -if(nOldFormat) -{ -ScConditionalFormat* pOldFormat = rDoc.GetCondFormList(nTab)->GetFormat(nOldFormat); -if(pOldFormat) -aCompleteRange.ExtendTo(pOldFormat->GetRange().Combine()); -} - - rDoc.CopyToDocument(aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab, - aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab, -InsertDeleteFlags::ALL, false, *pUndoDoc); +if (const auto* pList = rDoc.GetCondFormList(nTab)) +pUndoDoc->SetCondFormList(new ScConditionalFormatList(*pUndoDoc, *pList), nTab); } std::unique_ptr pRepaintRange; @@ -5684,11 +5670,10 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr< { ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO)); pRedoDoc->InitUndo( rDoc, nTab, nTab ); - rDoc.CopyToDocument(aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab, - aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab, -InsertDeleteFlags::ALL, false, *pRedoDoc); +if (const auto* pList = rDoc.GetCondFormList(nTab)) +pRedoDoc->SetCondFormList(new ScConditionalFormatList(*pRedoDoc, *pList), nTab); rDocShell.GetUndoManager()->AddUndoAction( -std::make_unique(, std::move(pUndoDoc), std::move(pRedoDoc), aCompleteRange)); +std::make_unique(, std::move(pUndoDoc), std::move(pRedoDoc), nTab)); } if(pRepaintRange) diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx index 523b48963a25..d002b248d7ce 100644 --- a/sc/source/ui/inc/undoblk.hxx +++ b/sc/source/ui/inc/undoblk.hxx @@ -614,11 +614,13 @@ private: voidDoChange( ScDocument* pSrcDoc ) const; }; +// This class only uses conditional format lists in the undo/redo documents; +// no other tab data is needed in the documents class ScUndoConditionalFormat : public ScSimpleUndo { public: ScUndoConditionalFormat( ScDocShell* pNewDocShell, -ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange& rRange); +ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab); virtual ~ScUndoConditionalFormat() override; virtual voidUndo() override; @@ -632,7 +634,7 @@ private: void DoChange(ScDocument* pDoc); ScDocumentUniquePtr mpUndoDoc; ScDocumentUniquePtr mpRedoDoc; -ScRange maRange; +SCTAB mnTab; }; class ScUndoConditionalFormatList : public ScSimpleUndo diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 8577e058ca17..f07cfd88c46b 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1606,11 +1606,11 @@ bool ScUndoListNames::CanRepeat(SfxRepeatTarget& rTarget) const } ScUndoConditionalFormat::ScUndoConditionalFormat(ScDocShell* pNewDocShell, -ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange& rRange): +ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab): ScSimpleUndo( pNewDocShell ), mpUndoDoc(std::move(pUndoDoc)), mpRedoDoc(std::move(pRedoDoc)), -maRange(rRange) +mnTab(nTab) { } @@ -1637,9 +1637,25 @@ void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc) {
core.git: sc/source
sc/source/ui/miscdlgs/solveroptions.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f58b9659067de7fd8fcd8391b4bf1a2513cedaf7 Author: Rafael Lima AuthorDate: Wed Mar 13 23:30:17 2024 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Sat Mar 16 22:48:50 2024 +0100 tdf#160122 Increase height of the Solver Options dialog Currently the Solver Options dialog (Tools - Solver and then click the Options button) has a height of 6 rows, which is good for the Linear and Swarm non-linear solvers, since they have 4-5 options. However, the SCO and DEPS engines have 12 and 19 options, respectively, so it is very unconfortable to view and scroll through these options with such a small dialog. This patch raises the height of the dialog to 12, so that scrolling is minimized, making it more confortable to navigate through the solver options. Change-Id: I51c1c6880613818dd91c6bb8494775c863e8b406 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164749 Tested-by: Jenkins Reviewed-by: Heiko Tietze Reviewed-by: Adolfo Jayme Barrientos diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 3d5b2b47c178..81f5c8b7b4ce 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -69,7 +69,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, , m_xBtnEdit(m_xBuilder->weld_button("edit")) { m_xLbSettings->set_size_request(m_xLbSettings->get_approximate_digit_width() * 32, -m_xLbSettings->get_height_rows(6)); +m_xLbSettings->get_height_rows(12)); m_xLbSettings->enable_toggle_buttons(weld::ColumnToggleType::Check);