[Libreoffice-commits] core.git: sc/source
sc/source/core/data/documen2.cxx |1 + sc/source/core/data/document.cxx |9 + 2 files changed, 10 insertions(+) New commits: commit 52f24a3a1e2ff7f0a599df7bb9caefc8543f7dc4 Author: Luboš Luňák AuthorDate: Sat Mar 5 22:43:31 2022 +0100 Commit: Luboš Luňák CommitDate: Sun Mar 6 08:20:19 2022 +0100 don't destroy and recreate broadcasters on large changes (tdf#131894) Change-Id: If5377687e7bcfab00af37887d3aaf302fa615690 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131070 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 9c2bbc7c9970..60dd807cdfd0 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -726,6 +726,7 @@ bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress ) if (maTabs[nOldPos]) { sc::AutoCalcSwitch aACSwitch(*this, false); +sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); SetNoListening( true ); if (nNewPos == SC_TAB_APPEND || nNewPos >= nTabCount) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index a7fabf46d1df..5973bf913366 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -682,6 +682,7 @@ bool ScDocument::DeleteTab( SCTAB nTab ) { sc::AutoCalcSwitch aACSwitch(*this, false); sc::RefUpdateDeleteTabContext aCxt( *this, nTab, 1); +sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); ScRange aRange( 0, 0, nTab, MaxCol(), MaxRow(), nTab ); DelBroadcastAreasInRange( aRange ); @@ -770,6 +771,7 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) { sc::AutoCalcSwitch aACSwitch(*this, false); sc::RefUpdateDeleteTabContext aCxt( *this, nTab, nSheets); +sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); for (SCTAB aTab = 0; aTab < nSheets; ++aTab) { @@ -1256,6 +1258,8 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab, bool bRet = false; bool bOldAutoCalc = GetAutoCalc(); SetAutoCalc( false ); // avoid multiple calculations +bool oldDelayedDeleteBroadcasters = IsDelayedDeletingBroadcasters(); +EnableDelayDeletingBroadcasters( true ); for ( i = nStartTab; i <= nEndTab && bTest && i < static_cast(maTabs.size()); i++) if (maTabs[i] && (!pTabMark || pTabMark->GetTableSelect(i))) bTest &= maTabs[i]->TestInsertRow(nStartCol, nEndCol, nStartRow, nSize); @@ -1343,6 +1347,7 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab, } bRet = true; } +EnableDelayDeletingBroadcasters( oldDelayedDeleteBroadcasters ); SetAutoCalc( bOldAutoCalc ); if ( bRet && pChartListenerCollection ) pChartListenerCollection->UpdateDirtyCharts(); @@ -1507,6 +1512,8 @@ bool ScDocument::InsertCol( SCROW nStartRow, SCTAB nStartTab, bool bRet = false; bool bOldAutoCalc = GetAutoCalc(); SetAutoCalc( false ); // avoid multiple calculations +bool oldDelayedDeleteBroadcasters = IsDelayedDeletingBroadcasters(); +EnableDelayDeletingBroadcasters( true ); for ( i = nStartTab; i <= nEndTab && bTest && i < static_cast(maTabs.size()); i++) if (maTabs[i] && (!pTabMark || pTabMark->GetTableSelect(i))) bTest &= maTabs[i]->TestInsertCol( nStartRow, nEndRow, nSize ); @@ -1565,6 +1572,7 @@ bool ScDocument::InsertCol( SCROW nStartRow, SCTAB nStartTab, } bRet = true; } +EnableDelayDeletingBroadcasters( oldDelayedDeleteBroadcasters ); SetAutoCalc( bOldAutoCalc ); if ( bRet && pChartListenerCollection ) pChartListenerCollection->UpdateDirtyCharts(); @@ -2103,6 +2111,7 @@ void ScDocument::CopyToDocument(const ScRange& rRange, sc::AutoCalcSwitch aACSwitch(rDestDoc, false); // avoid multiple calculations ScBulkBroadcast aBulkBroadcast(rDestDoc.GetBASM(), SfxHintId::ScDataChanged); +sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); sc::CopyToDocContext aCxt(rDestDoc); aCxt.setStartListening(false);
[Libreoffice-commits] core.git: include/svl sc/inc sc/source svl/source
include/svl/broadcast.hxx |2 - sc/inc/column.hxx |4 ++- sc/inc/document.hxx|6 + sc/inc/mtvfunctions.hxx| 40 + sc/inc/scopetools.hxx | 11 ++ sc/inc/table.hxx |1 sc/source/core/data/column.cxx |3 +- sc/source/core/data/column2.cxx| 30 +-- sc/source/core/data/documen2.cxx |1 sc/source/core/data/document10.cxx | 13 sc/source/core/data/table1.cxx |6 + sc/source/core/data/table3.cxx |2 + sc/source/core/tool/scopetools.cxx | 12 +++ svl/source/notify/broadcast.cxx|7 -- 14 files changed, 127 insertions(+), 11 deletions(-) New commits: commit 648a4b30b33569052847b797c38e52ba2fd2d500 Author: Luboš Luňák AuthorDate: Sat Mar 5 22:11:30 2022 +0100 Commit: Luboš Luňák CommitDate: Sun Mar 6 08:19:51 2022 +0100 do not destroy broadcasters and then recreate again (tdf#134268) Sorting ends tells all listeners on all the sorted cells to end listening to stop updates, then sorts the cells and starts listening again. This will cause all broadcasters for the sorted cells to temporarily stop having any listeners, so they'll be deleted and removed from the mdds vector (which may additionally cause moving large parts of the mdds vector repeatedly). And since all listeners will want to listen again after the sort, this will all need to be reconstructed. To avoid this, temporarily block this removal and then later just checks and remove any possibly left-over broadcasters that ended up with no listeners. Change-Id: Ie2d41d9acd7b657cf31a445870ce7f18d28d5ebb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131069 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/include/svl/broadcast.hxx b/include/svl/broadcast.hxx index c1996ccfeda7..eaf4de8ba448 100644 --- a/include/svl/broadcast.hxx +++ b/include/svl/broadcast.hxx @@ -59,7 +59,7 @@ public: ListenersType& GetAllListeners(); const ListenersType& GetAllListeners() const; -bool HasListeners() const; +bool HasListeners() const { return (maListeners.size() - mnEmptySlots) > 0; } /** * Listeners and broadcasters are M:N relationship. If you want to diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 1ec4aac4204b..1b1ae1e6ab93 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -178,7 +178,8 @@ class ScColumn : protected ScColumnData SCCOL nCol; SCTAB nTab; -bool mbFiltering; // it is true if there is a filtering in the column +bool mbFiltering : 1; // it is true if there is a filtering in the column +bool mbEmptyBroadcastersPending : 1; // a broadcaster not removed during EnableDelayDeletingBroadcasters() friend class ScDocument;// for FillInfo friend class ScTable; @@ -633,6 +634,7 @@ public: void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 ); void PrepareBroadcastersForDestruction(); +void DeleteEmptyBroadcasters(); void Broadcast( SCROW nRow ); void BroadcastCells( const std::vector& rRows, SfxHintId nHint ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f78afc46a3da..ddd59d16f3d3 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -525,6 +525,8 @@ private: // avoiding repeated calling for the same cells in the given range. The function will be called once // later for all the cells in the range. std::unordered_map< ScColumn*, std::pair> pDelayedStartListeningFormulaCells; +// Cells will not delete their broadcasters if delayed, avoiding possible extensive mdds vector changes. +boolbDelayedDeletingBroadcasters; boolbLinkFormulaNeedingCheck; // valid only after loading, for ocDde and ocWebservice @@ -1391,6 +1393,10 @@ public: /// If true is returned, ScColumn::StartListeningFormulaCells() for the given cells will be performed /// later. If false is returned, it needs to be done explicitly. boolCanDelayStartListeningFormulaCells( ScColumn* column, SCROW row1, SCROW row2 ); +/// If set, cells will not delete their empty broadcasters, avoiding possible extensive mdds +/// vector changes. Disabling delay will collect and delete all empty broadcasters. +voidEnableDelayDeletingBroadcasters(bool set); +boolIsDelayedDeletingBroadcasters() const { return bDelayedDeletingBroadcasters; } FormulaErrorGetErrCode( const ScAddress& ) const; diff --git a/sc/inc/mtvfunctions.hxx b/sc/inc/mtvfunctions.hxx index 8f69c05c39fd..9fe394faff57 100644 --- a/sc/inc/mtvfunctions.hxx +++ b/sc/inc/mtvfunctions.hxx @@ -23,6 +23,17 @@ struct FuncElseNoOp } }; +template +struct FuncNotElem +{ +
New Defects reported by Coverity Scan for LibreOffice
Hi, Please find the latest report on new defect(s) introduced to LibreOffice found with Coverity Scan. 1 new defect(s) introduced to LibreOffice found with Coverity Scan. 262 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 1 of 1 defect(s) ** CID 1502882: Null pointer dereferences (FORWARD_NULL) *** CID 1502882: Null pointer dereferences (FORWARD_NULL) /vcl/jsdialog/jsdialogbuilder.cxx: 721 in JSInstanceBuilder::RememberWidget(rtl::OString, weld::Widget *)() 715 if (aWidgetIt != aWindowIt->second.end()) 716 { 717 unsigned long long int nIndex = nNotRepeatIndex++; 718 // found duplicated it -> add some number to the id and apply to the widget 719 sId = sId + OString::number(nIndex); 720 SalInstanceWidget* pSalWidget = dynamic_cast(pWidget); >>> CID 1502882: Null pointer dereferences (FORWARD_NULL) >>> Passing null pointer "pSalWidget" to "getWidget", which dereferences it. 721 vcl::Window* pVclWidget = pSalWidget->getWidget(); 722 pVclWidget->set_id(pVclWidget->get_id() + OUString::number(nIndex)); 723 } 724 } 725 } 726 To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3DYvYr_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJi7-2B-2BNxcCkBVT-2Bqh-2BVThl9lLGOGlV8NZwa2xgxyhJbOCSmQ-2FkNZ-2FGkoxffsZTfBbyq0EYPSHHFnaLSRPVGhVTUelcAMl1jmipLu5AKvKa59RPLK0eYeDe6iTrcOmJ1SMwEddGtMKpl-2Be00Mf-2BjdpDSEKuSIfiBjuQHxFa40u7ahMc-3D
[Libreoffice-commits] core.git: dbaccess/qa
dbaccess/qa/extras/dialog-save.cxx |6 -- dbaccess/qa/extras/empty-stdlib-save.cxx |6 -- dbaccess/qa/extras/nolib-save.cxx|6 -- 3 files changed, 18 deletions(-) New commits: commit 7ac19fbce8a35f559eebb879cd0f232bfc95e703 Author: Luboš Luňák AuthorDate: Sat Mar 5 10:16:10 2022 +0100 Commit: Luboš Luňák CommitDate: Sat Mar 5 23:53:53 2022 +0100 remove a workaround that appears to be no longer necessary Presumably whatever the locking problem was, it's got fixed meanwhile. Change-Id: I7bbd6299a501396f53ed2e8ccaf7d5893744512b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131047 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/dbaccess/qa/extras/dialog-save.cxx b/dbaccess/qa/extras/dialog-save.cxx index ff4f612dc869..212127d48ea9 100644 --- a/dbaccess/qa/extras/dialog-save.cxx +++ b/dbaccess/qa/extras/dialog-save.cxx @@ -49,12 +49,6 @@ DialogSaveTest::DialogSaveTest() void DialogSaveTest::test() { -// UnoApiTest::setUp (via InitVCL) puts each test under a locked SolarMutex, -// but at least the below xDocCloseable->close call could lead to a deadlock -// then, and it looks like none of the code here requires the SolarMutex to -// be locked anyway: -SolarMutexReleaser rel; - const OUString aFileName(m_directories.getURLFromWorkdir(u"CppunitTest/testDialogSave.odb")); { uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName); diff --git a/dbaccess/qa/extras/empty-stdlib-save.cxx b/dbaccess/qa/extras/empty-stdlib-save.cxx index 2ffbccaa6131..440fc19d4945 100644 --- a/dbaccess/qa/extras/empty-stdlib-save.cxx +++ b/dbaccess/qa/extras/empty-stdlib-save.cxx @@ -47,12 +47,6 @@ DialogSaveTest::DialogSaveTest() void DialogSaveTest::test() { -// UnoApiTest::setUp (via InitVCL) puts each test under a locked SolarMutex, -// but at least the below xDocCloseable->close call could lead to a deadlock -// then, and it looks like none of the code here requires the SolarMutex to -// be locked anyway: -SolarMutexReleaser rel; - const OUString aFileName(m_directories.getURLFromWorkdir(u"CppunitTest/testEmptyStdlibSave.odb")); { uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName); diff --git a/dbaccess/qa/extras/nolib-save.cxx b/dbaccess/qa/extras/nolib-save.cxx index f64e0fbece10..59fee844fd78 100644 --- a/dbaccess/qa/extras/nolib-save.cxx +++ b/dbaccess/qa/extras/nolib-save.cxx @@ -47,12 +47,6 @@ DialogSaveTest::DialogSaveTest() void DialogSaveTest::test() { -// UnoApiTest::setUp (via InitVCL) puts each test under a locked SolarMutex, -// but at least the below xDocCloseable->close call could lead to a deadlock -// then, and it looks like none of the code here requires the SolarMutex to -// be locked anyway: -SolarMutexReleaser rel; - const OUString aFileName(m_directories.getURLFromWorkdir(u"CppunitTest/testNolibSave.odb")); { uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
[Libreoffice-commits] core.git: hwpfilter/source
hwpfilter/source/hwpreader.cxx | 36 1 file changed, 20 insertions(+), 16 deletions(-) New commits: commit 94e8b4b6a5ca957e1426f47cda898f175932183c Author: Caolán McNamara AuthorDate: Sat Mar 5 14:05:54 2022 + Commit: Caolán McNamara CommitDate: Sat Mar 5 21:42:20 2022 +0100 ofz#45167 Integer-overflow Change-Id: Ib112686b192558421419a8695db9c3f35c5312da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131058 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index ff551174219f..a20d71b5c5c3 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -4054,22 +4054,26 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox) mxList->addAttribute("svg:height", sXML_CDATA, OUString::number (WTMM( drawobj->extent.h )) + "mm"); if( drawobj->type == HWPDO_ADVANCED_ELLIPSE ){ -if( drawobj->u.arc.radial[0].x != drawobj->u.arc.radial[1].x -|| drawobj->u.arc.radial[0].y != drawobj->u.arc.radial[1].y ){ -int Cx,Cy; -Cx = ( drawobj->offset2.x + drawobj->extent.w ) / 2; -Cy = ( drawobj->offset2.y + drawobj->extent.h ) / 2; - -double start_angle, end_angle; -start_angle = calcAngle( Cx, Cy, drawobj->u.arc.radial[0].x, drawobj->u.arc.radial[0].y ); -end_angle = calcAngle( Cx, Cy, drawobj->u.arc.radial[1].x, drawobj->u.arc.radial[1].y ); -if( drawobj->property.fill_color < 0xff ) -mxList->addAttribute("draw:kind", sXML_CDATA, "section"); -else -mxList->addAttribute("draw:kind", sXML_CDATA, "arc"); -mxList->addAttribute("draw:start-angle", sXML_CDATA, OUString::number(start_angle )); -mxList->addAttribute("draw:end-angle", sXML_CDATA, OUString::number(end_angle)); -} +if (drawobj->u.arc.radial[0].x != drawobj->u.arc.radial[1].x || +drawobj->u.arc.radial[0].y != drawobj->u.arc.radial[1].y) { + +int Cx, Cy; +if (!o3tl::checked_add(drawobj->offset2.x, drawobj->extent.w, Cx) && +!o3tl::checked_add(drawobj->offset2.y, drawobj->extent.h, Cy)) +{ +Cx /= 2; +Cy /= 2; + +double start_angle = calcAngle( Cx, Cy, drawobj->u.arc.radial[0].x, drawobj->u.arc.radial[0].y ); +double end_angle = calcAngle( Cx, Cy, drawobj->u.arc.radial[1].x, drawobj->u.arc.radial[1].y ); +if( drawobj->property.fill_color < 0xff ) +mxList->addAttribute("draw:kind", sXML_CDATA, "section"); +else +mxList->addAttribute("draw:kind", sXML_CDATA, "arc"); +mxList->addAttribute("draw:start-angle", sXML_CDATA, OUString::number(start_angle )); +mxList->addAttribute("draw:end-angle", sXML_CDATA, OUString::number(end_angle)); +} +} } startEl("draw:ellipse"); mxList->clear();
[Libreoffice-commits] core.git: sc/inc sc/source
sc/inc/document.hxx|2 +- sc/source/core/data/document.cxx |4 ++-- sc/source/filter/excel/xetable.cxx | 11 +-- 3 files changed, 12 insertions(+), 5 deletions(-) New commits: commit 8030b9cf1c55cbbf9be8bf0cee0a408ff0a14710 Author: Luboš Luňák AuthorDate: Sat Mar 5 17:12:39 2022 +0100 Commit: Luboš Luňák CommitDate: Sat Mar 5 18:34:39 2022 +0100 compress RowHidden()/GetRowHeight() use in excel export (tdf#126326) Change-Id: Idc6a704cfc8202b51eff8db8159c251ea9ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131062 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 4e8eab09ed5d..f78afc46a3da 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1910,7 +1910,7 @@ public: SC_DLLPUBLIC sal_uInt16 GetColWidth( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const; SC_DLLPUBLIC tools::LongGetColWidth( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab ) const; SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const; -SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow ) const; +SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const; SC_DLLPUBLIC tools::LongGetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const; /** diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index ae57d12033a9..a7fabf46d1df 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4177,10 +4177,10 @@ sal_uInt16 ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero return 0; } -sal_uInt16 ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow ) const +sal_uInt16 ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero ) const { if ( ValidTab(nTab) && nTab < static_cast(maTabs.size()) && maTabs[nTab] ) -return maTabs[nTab]->GetRowHeight( nRow, pStartRow, pEndRow ); +return maTabs[nTab]->GetRowHeight( nRow, pStartRow, pEndRow, bHiddenAsZero ); OSL_FAIL("Wrong sheet number"); return 0; } diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index cf46590cebfc..c527d525adba 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2479,16 +2479,23 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE const ScDocument& rDoc = GetRoot().GetDoc(); const SCTAB nScTab = GetRoot().GetCurrScTab(); +// Do not repeatedly call RowHidden() / GetRowHeight() for same values. +bool bHidden = false; +SCROW lastSameHiddenRow = -1; +sal_uInt16 nHeight = 0; +SCROW lastSameHeightRow = -1; // create the missing rows first while( nFrom <= nXclRow ) { // only create RowMap entries if it is first row in spreadsheet, // if it is the desired row, or for rows that differ from previous. -const bool bHidden = rDoc.RowHidden(nFrom, nScTab); +if( static_cast(nFrom) > lastSameHiddenRow ) +bHidden = rDoc.RowHidden(nFrom, nScTab, nullptr, &lastSameHiddenRow); // Always get the actual row height even if the manual size flag is // not set, to correctly export the heights of rows with wrapped // texts. -const sal_uInt16 nHeight = rDoc.GetRowHeight(nFrom, nScTab, false); +if( static_cast(nFrom) > lastSameHeightRow ) +nHeight = rDoc.GetRowHeight(nFrom, nScTab, nullptr, &lastSameHeightRow, false); if ( !pPrevEntry || ( nFrom == nXclRow ) || ( maOutlineBfr.IsCollapsed() ) || ( maOutlineBfr.GetLevel() != 0 ) ||
[Libreoffice-commits] core.git: sal/rtl
sal/rtl/strtmpl.hxx |9 + 1 file changed, 9 insertions(+) New commits: commit 713c83c0fc4a0d9950cfa0b598d7c5f4bae15755 Author: Mike Kaganski AuthorDate: Sat Mar 5 19:26:38 2022 +0300 Commit: Mike Kaganski CommitDate: Sat Mar 5 18:17:55 2022 +0100 Add checks to avoid finding empty substring / zero character ... which changed in commit 281989007fd7dea997ed9a65f513f80b1aff67dd Author Noel Grandin Date Tue Jul 01 13:17:01 2014 +0200 Use standard library optimised routines for OUString/OString for optimized cases: strchr/wcschr/strrchr/wcsrchr find trailing zero character, and strstr/wcsstr find empty string; previous/unoptimized code does not find these. This introduced inconsistency between char and sal_Unicode functions on non-Windows, and for sal_Unicode between Windows and non-Windows (because on Windows, optimized code is used for sal_Unicode, while on other platforms, unoptimized code is used). Change-Id: I68529c91b26f4113d9bdfc5ac4809349864b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131064 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx index 6fa400c0164f..37f274a69cf2 100644 --- a/sal/rtl/strtmpl.hxx +++ b/sal/rtl/strtmpl.hxx @@ -307,6 +307,9 @@ sal_Int32 indexOfChar ( const IMPL_RTL_STRCODE* pStr IMPL_RTL_STRCODE c ) { assert(pStr); +if (!c) +return -1; // Unifies behavior of strchr/wcschr and unoptimized algorithm wrt '\0' + if constexpr (sizeof(IMPL_RTL_STRCODE) == sizeof(char)) { // take advantage of builtin optimisations @@ -361,6 +364,9 @@ sal_Int32 lastIndexOfChar ( const IMPL_RTL_STRCODE* IMPL_RTL_STRCODE c ) { assert(pStr); +if (!c) +return -1; // Unifies behavior of strrchr/wcsrchr and lastIndexOfChar_WithLength wrt '\0' + if constexpr (sizeof(IMPL_RTL_STRCODE) == sizeof(char)) { // take advantage of builtin optimisations @@ -406,6 +412,9 @@ sal_Int32 indexOfStr ( const IMPL_RTL_STRCODE* pStr, { assert(pStr); assert(pSubStr); +/* an empty SubString is always not findable */ +if (*pSubStr == 0) +return -1; if constexpr (sizeof(IMPL_RTL_STRCODE) == sizeof(char)) { // take advantage of builtin optimisations
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/chgtrack.cxx |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) New commits: commit 805e73b555df277e7fb35825a0c48d244a2691a9 Author: Luboš Luňák AuthorDate: Sat Mar 5 15:47:28 2022 +0100 Commit: Luboš Luňák CommitDate: Sat Mar 5 18:06:31 2022 +0100 don't bother tracking changes if both cells are empty (tdf#141174) AppendContent() does something only if the cells differ, which can't be the case if they're both empty, so skip unallocated cells. Change-Id: I367801bac30a8ee641b4ce608392124bac6ef47a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131060 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index ab0cd2ae6199..55530e494fb0 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2689,10 +2689,15 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange, for ( SCTAB nTab = nTab1; nTab <= nTab2; nTab++ ) { aPos.SetTab( nTab ); -for ( SCCOL nCol = nCol1; nCol <= nCol2; nCol++ ) +// AppendContent() is a no-op if both cells are empty. +SCCOL lastCol = std::max( pRefDoc->ClampToAllocatedColumns( nTab, nCol2 ), + rDoc.ClampToAllocatedColumns( nTab, nCol2 )); +for ( SCCOL nCol = nCol1; nCol <= lastCol; nCol++ ) { aPos.SetCol( nCol ); -for ( SCROW nRow = nRow1; nRow <= nRow2; nRow++ ) +SCROW lastRow = std::max( pRefDoc->GetLastDataRow( nTab, nCol, nCol, nRow2 ), + rDoc.GetLastDataRow( nTab, nCol, nCol, nRow2 )); +for ( SCROW nRow = nRow1; nRow <= lastRow; nRow++ ) { aPos.SetRow( nRow ); AppendContent( aPos, pRefDoc );
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/column3.cxx |2 ++ sc/source/core/data/columnspanset.cxx | 21 ++--- 2 files changed, 16 insertions(+), 7 deletions(-) New commits: commit be99b23809687ca1143c8fe8d4ec3cfe6703c363 Author: Luboš Luňák AuthorDate: Sat Mar 5 15:25:19 2022 +0100 Commit: Luboš Luňák CommitDate: Sat Mar 5 17:25:00 2022 +0100 don't bother scanning nonexistent data (tdf#141182) There's no point scanning for non-empty cells after the last data cell, and this avoids processing mdds structures (such as repeated creating of flat_segment_tree). Change-Id: Ibec324aa2de457e8439c38a561f55ced9f478899 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131059 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 618e56e46626..31903287cd48 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -92,6 +92,8 @@ void ScColumn::BroadcastCells( const std::vector& rRows, SfxHintId nHint void ScColumn::BroadcastRows( SCROW nStartRow, SCROW nEndRow, SfxHintId nHint ) { +if( nStartRow > GetLastDataPos()) +return; sc::SingleColumnSpanSet aSpanSet(GetDoc().GetSheetLimits()); aSpanSet.scan(*this, nStartRow, nEndRow); std::vector aRows; diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx index 7a4d90f65652..eb09ea26be98 100644 --- a/sc/source/core/data/columnspanset.cxx +++ b/sc/source/core/data/columnspanset.cxx @@ -25,12 +25,12 @@ namespace sc { namespace { -class ColumnScanner +class ColumnNonEmptyRangesScanner { ColumnSpanSet::ColumnSpansType& mrRanges; bool mbVal; public: -ColumnScanner(ColumnSpanSet::ColumnSpansType& rRanges, bool bVal) : +ColumnNonEmptyRangesScanner(ColumnSpanSet::ColumnSpansType& rRanges, bool bVal) : mrRanges(rRanges), mbVal(bVal) {} void operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize) @@ -137,7 +137,10 @@ void ColumnSpanSet::scan( const CellStoreType& rSrcCells = pTab->aCol[nCol].maCells; -ColumnScanner aScanner(rCol.maSpans, bVal); +if( nRow1 > pTab->aCol[nCol].GetLastDataPos()) +continue; + +ColumnNonEmptyRangesScanner aScanner(rCol.maSpans, bVal); ParseBlock(rSrcCells.begin(), rSrcCells, aScanner, nRow1, nRow2); } } @@ -219,11 +222,11 @@ void ColumnSpanSet::executeColumnAction(ScDocument& rDoc, ColumnAction& ac) cons namespace { -class Scanner +class NonEmptyRangesScanner { SingleColumnSpanSet::ColumnSpansType& mrRanges; public: -explicit Scanner(SingleColumnSpanSet::ColumnSpansType& rRanges) : mrRanges(rRanges) {} +explicit NonEmptyRangesScanner(SingleColumnSpanSet::ColumnSpansType& rRanges) : mrRanges(rRanges) {} void operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize) { @@ -258,16 +261,20 @@ void SingleColumnSpanSet::scan(const ScColumn& rColumn) void SingleColumnSpanSet::scan(const ScColumn& rColumn, SCROW nStart, SCROW nEnd) { +if( nStart > rColumn.GetLastDataPos()) +return; const CellStoreType& rCells = rColumn.maCells; -Scanner aScanner(maSpans); +NonEmptyRangesScanner aScanner(maSpans); sc::ParseBlock(rCells.begin(), rCells, aScanner, nStart, nEnd); } void SingleColumnSpanSet::scan( ColumnBlockConstPosition& rBlockPos, const ScColumn& rColumn, SCROW nStart, SCROW nEnd) { +if( nStart > rColumn.GetLastDataPos()) +return; const CellStoreType& rCells = rColumn.maCells; -Scanner aScanner(maSpans); +NonEmptyRangesScanner aScanner(maSpans); rBlockPos.miCellPos = sc::ParseBlock(rBlockPos.miCellPos, rCells, aScanner, nStart, nEnd); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa sw/source
sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf |binary sw/qa/extras/layout/layout.cxx|9 +++ sw/source/core/layout/objectformattertxtfrm.cxx | 52 -- 3 files changed, 47 insertions(+), 14 deletions(-) New commits: commit 94bd64906bed96b57d73644c1a84c49491bfceb2 Author: Michael Stahl AuthorDate: Wed Feb 23 16:45:31 2022 +0100 Commit: Caolán McNamara CommitDate: Sat Mar 5 17:01:50 2022 +0100 sw: really prevent footnote frame against delete while it's moved This reverts commit fe5d3fbfe63fe8b433776bd3a0508dd712b868b0 (on master only) It turns out that checking a single column's IsMovingFootnotes() is not enough - as frames can move both forwards and backwards the entire chain of columns would need to be checked. (Most callers of MoveLowerFootnotes() move forwards, but one place in tabfrm.cxx moves from a follow to master.) But it turns out that this is probably the wrong way in any case: most likely the intention in FormatAnchorFrameAndItsPrevs() is to format previous frames in the same layout environment, so if there is a section or column inside a footnote then this upper should be formatted, while if the footnote is inside a section or column this upper should not be formatted; this should make calls during MoveFootnotes_() safe as it should prevent the formatting of frames in the footnote boss moving a footnote that is already being moved. So tweak the fix in commit fa1bcc22921941b2cd8a0b32fe0d15655d12d607 a little to make it more general. Also it was previously possible that for a section with columns, both the section branch and the column branch was taken, which seems supperfluous. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130544 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 3f569ffc9238e6bf2915e78bf21c844ca5f1270d) add a layout test to exercise UXTSOREL Change-Id: I57b29dd7d73c08bdbf227676c4ce9034aabf418a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130493 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 10d46c0498b89350645cf45e744a528d3d8f1ac1) Change-Id: I39487640322339fe4d511e845d9c6bced2ba9dad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130831 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit b845927ed4e3987a578b0c8ded46ddbc7833e7ff) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130847 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf b/sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf new file mode 100644 index ..1020269ae119 Binary files /dev/null and b/sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index ac700f8b4749..00d565d648ca 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2325,6 +2325,15 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint75) createSwDoc(DATA_DIRECTORY, "forcepoint75-1.rtf"); } +// FIXME: apparently infinite loop on Mac +#ifndef MACOSX +//just care it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testUXTSOREL) +{ +createSwDoc(DATA_DIRECTORY, "LIBREOFFICE-UXTSOREL.rtf"); +} +#endif + //just care it doesn't crash/assert CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepointFootnoteFrame) { diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index 630ce1883bed..8197076e7d34 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -829,21 +829,46 @@ void SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( SwTextFrame& _rAn // for follow text frames. if ( !_rAnchorTextFrame.IsFollow() ) { +// In case the anchor frame is in a column or section, format its +// previous frames first - but don't jump out of the current layout +// environment, e.g. from footnotes into the footnote boss. +SwFrame * pSectFrame(nullptr); +SwFrame * pColFrameOfAnchor(nullptr); +for (SwFrame* pUpper = _rAnchorTextFrame.GetUpper(); + pUpper != nullptr; pUpper = pUpper->GetUpper()) +{ +if (pUpper->IsCellFrame()) +{ +break; // apparently nothing to be done? +} +if (pUpper->IsFootnoteFrame()) +{ +SAL_INFO_IF(pColFrameOfAnchor == nullptr && pUpper->FindColFrame(), +"sw.layout", "tdf#122894 skipping column for footnote in column"); +break; // stop: prevent crash in case footnotes are being moved +} +if (pUpper->IsSctFrame()) +{ +pColFrameOfAnchor =
[Libreoffice-commits] core.git: sd/qa vcl/source
sd/qa/unit/PNGExportTests.cxx |2 +- vcl/source/filter/png/pngwrite.cxx | 10 +- 2 files changed, 10 insertions(+), 2 deletions(-) New commits: commit eed83764088bfdfcc6513778f7dc83d649f550a3 Author: Julien Nabet AuthorDate: Sat Mar 5 12:37:40 2022 +0100 Commit: Julien Nabet CommitDate: Sat Mar 5 16:40:14 2022 +0100 tdf#136632: Use 'Save transparency' when exporting selected objects for PNG To avoid some regression, consider that transparency should be enabled by default. So only remove transparency if it's required explicitely. + change QA test since "Translucent" property isn't a bool but a sal_Int32 In officecfg/registry/schema/org/openoffice/Office/Common.xcs: Change-Id: I9bfb6aae8e2e8a31dee82f73a9165989129f222a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131057 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index f80d2e6af384..f3ab40228953 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -240,7 +240,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119) uno::Sequence aFilterData{ comphelper::makePropertyValue("PixelWidth", sal_Int32(100)), comphelper::makePropertyValue("PixelHeight", sal_Int32(100)), -comphelper::makePropertyValue("Translucent", true), +comphelper::makePropertyValue("Translucent", sal_Int32(1)), }; utl::TempFile aTempFile; diff --git a/vcl/source/filter/png/pngwrite.cxx b/vcl/source/filter/png/pngwrite.cxx index b4bc3fa8b60b..865fe38ebee7 100644 --- a/vcl/source/filter/png/pngwrite.cxx +++ b/vcl/source/filter/png/pngwrite.cxx @@ -124,6 +124,7 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx, Bitmap aBmp(aBitmapEx.GetBitmap()); mnMaxChunkSize = std::numeric_limits::max(); +bool bTranslucent = true; if (pFilterData) { @@ -133,6 +134,13 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx, rPropVal.Value >>= mnCompLevel; else if (rPropVal.Name == "Interlaced") rPropVal.Value >>= mnInterlaced; +else if (rPropVal.Name == "Translucent") +{ +tools::Long nTmp = 0; +rPropVal.Value >>= nTmp; +if (!nTmp) +bTranslucent = false; +} else if (rPropVal.Name == "MaxChunkSize") { sal_Int32 nVal = 0; @@ -143,7 +151,7 @@ PNGWriterImpl::PNGWriterImpl(const BitmapEx& rBitmapEx, } mnBitsPerPixel = sal_uInt8(vcl::pixelFormatBitCount(aBmp.getPixelFormat())); -if (aBitmapEx.IsAlpha()) +if (aBitmapEx.IsAlpha() && bTranslucent) { if (mnBitsPerPixel <= 8) {
[Libreoffice-commits] core.git: dbaccess/source forms/source include/svx include/toolkit svx/source toolkit/inc toolkit/source
dbaccess/source/ui/uno/ColumnControl.cxx |2 - dbaccess/source/ui/uno/ColumnControl.hxx |2 - forms/source/component/Filter.cxx|2 - forms/source/component/Filter.hxx|2 - include/svx/fmgridif.hxx |2 - include/toolkit/controls/unocontrol.hxx |2 - include/toolkit/controls/unocontrolbase.hxx |2 - include/toolkit/controls/unocontrols.hxx | 36 +-- svx/source/fmcomp/fmgridif.cxx |2 - svx/source/form/formcontroller.cxx |2 - toolkit/inc/controls/dialogcontrol.hxx |8 +++--- toolkit/inc/controls/formattedcontrol.hxx|2 - toolkit/inc/controls/roadmapcontrol.hxx |2 - toolkit/inc/controls/tabpagecontainer.hxx|2 - toolkit/inc/controls/tabpagemodel.hxx|2 - toolkit/inc/controls/tkscrollbar.hxx |2 - toolkit/source/controls/animatedimages.cxx |4 +-- toolkit/source/controls/dialogcontrol.cxx|8 +++--- toolkit/source/controls/formattedcontrol.cxx |2 - toolkit/source/controls/grid/gridcontrol.cxx |2 - toolkit/source/controls/grid/gridcontrol.hxx |2 - toolkit/source/controls/roadmapcontrol.cxx |2 - toolkit/source/controls/tabpagecontainer.cxx |2 - toolkit/source/controls/tabpagemodel.cxx |2 - toolkit/source/controls/tkscrollbar.cxx |2 - toolkit/source/controls/tkspinbutton.cxx |4 +-- toolkit/source/controls/tree/treecontrol.cxx |4 +-- toolkit/source/controls/unocontrol.cxx |2 - toolkit/source/controls/unocontrolbase.cxx |2 - toolkit/source/controls/unocontrols.cxx | 36 +-- 30 files changed, 73 insertions(+), 73 deletions(-) New commits: commit 492098417a590521506e41c05d3ab0f09628d39a Author: Noel Grandin AuthorDate: Sat Mar 5 09:16:53 2022 +0200 Commit: Noel Grandin CommitDate: Sat Mar 5 15:19:15 2022 +0100 GetComponentServiceName can be const Change-Id: Iac61eec0b27660dd2ff45f70c92de5a8cdc2c301 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131044 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx index 0d26048f8e32..9295b9954333 100644 --- a/dbaccess/source/ui/uno/ColumnControl.cxx +++ b/dbaccess/source/ui/uno/ColumnControl.cxx @@ -61,7 +61,7 @@ css::uno::Sequence< OUString > SAL_CALL OColumnControl::getSupportedServiceNames return { "com.sun.star.awt.UnoControl","com.sun.star.sdb.ColumnDescriptorControl" }; } -OUString OColumnControl::GetComponentServiceName() +OUString OColumnControl::GetComponentServiceName() const { return "com.sun.star.sdb.ColumnDescriptorControl"; } diff --git a/dbaccess/source/ui/uno/ColumnControl.hxx b/dbaccess/source/ui/uno/ColumnControl.hxx index 9c6054d623e2..63f06651284c 100644 --- a/dbaccess/source/ui/uno/ColumnControl.hxx +++ b/dbaccess/source/ui/uno/ColumnControl.hxx @@ -33,7 +33,7 @@ namespace dbaui explicit OColumnControl(const css::uno::Reference< css::uno::XComponentContext>& rxContext); // UnoControl -virtual OUString GetComponentServiceName() override; +virtual OUString GetComponentServiceName() const override; // XServiceInfo DECLARE_SERVICE_INFO(); diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index cc57cecf027a..4713f6b4 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -135,7 +135,7 @@ namespace frm } -OUString OFilterControl::GetComponentServiceName() +OUString OFilterControl::GetComponentServiceName() const { OUString aServiceName; switch (m_nControlClass) diff --git a/forms/source/component/Filter.hxx b/forms/source/component/Filter.hxx index 8561d2f5d5af..8815f5f11a02 100644 --- a/forms/source/component/Filter.hxx +++ b/forms/source/component/Filter.hxx @@ -80,7 +80,7 @@ namespace frm DECLARE_UNO3_AGG_DEFAULTS(OFilterControl,OWeakAggObject) css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; -virtual OUString GetComponentServiceName() override; +virtual OUString GetComponentServiceName() const override; virtual void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit > & rxToolkit, const css::uno::Reference< css::awt::XWindowPeer > & rParentPeer ) override; // css::lang::XComponent diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx index e0f43fcf069c..668eb13350fe 100644 --- a/include/svx/fmgridif.hxx +++ b/include/svx/fmgridif.hxx @@ -277,7 +277,7 @@ public: virtual css::uno::Sequence< css::uno::Any > SAL_CALL queryFieldData( sal_Int32 nRow, const css::uno::Type& xType ) override; // UnoControl -virtual OUString GetComponentServiceName() override; +virtual OUString GetComponentSer
[Libreoffice-commits] core.git: vcl/source
vcl/source/outdev/hatch.cxx | 30 +- 1 file changed, 25 insertions(+), 5 deletions(-) New commits: commit eaeb8b56a4e450917001919be0848bad115293a1 Author: Caolán McNamara AuthorDate: Sat Mar 5 10:53:39 2022 + Commit: Caolán McNamara CommitDate: Sat Mar 5 14:51:50 2022 +0100 ofz#45231 Timeout Change-Id: Id761d0aeaffe869c7ce3ea048bdee09b55ae60a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131055 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 160aa904ffd6..31bcf6e71ba1 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -24,6 +24,8 @@ #include #include +#include + #include #include #include @@ -156,13 +158,31 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& // Single hatch aRect.AdjustLeft( -nLogPixelWidth ); aRect.AdjustTop( -nLogPixelWidth ); aRect.AdjustRight(nLogPixelWidth ); aRect.AdjustBottom(nLogPixelWidth ); CalcHatchValues( aRect, nWidth, rHatch.GetAngle(), aPt1, aPt2, aInc, aEndPt1 ); -do + +if (aInc.Width() <= 0 && aInc.Height() <= 0) +SAL_WARN("vcl.gdi", "invalid increment"); +else { -DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf ); -aPt1.AdjustX(aInc.Width() ); aPt1.AdjustY(aInc.Height() ); -aPt2.AdjustX(aInc.Width() ); aPt2.AdjustY(aInc.Height() ); +if (utl::ConfigManager::IsFuzzing()) +{ +tools::Long nVertSteps = aInc.Height() ? ((aEndPt1.Y() - aPt1.Y()) / aInc.Height()) : -1; +tools::Long nHorzSteps = aInc.Width() ? ((aEndPt1.X() - aPt1.X()) / aInc.Width()) : -1; +auto nSteps = std::max(nVertSteps, nHorzSteps); +if (nSteps > 1024) +{ +SAL_WARN("vcl.gdi", "skipping slow hatch with " << nSteps << " steps"); +return; +} +} + +do +{ +DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf ); +aPt1.AdjustX(aInc.Width() ); aPt1.AdjustY(aInc.Height() ); +aPt2.AdjustX(aInc.Width() ); aPt2.AdjustY(aInc.Height() ); +} +while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) ); } -while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) ); if( ( rHatch.GetStyle() == HatchStyle::Double ) || ( rHatch.GetStyle() == HatchStyle::Triple ) ) {
[Libreoffice-commits] core.git: tools/source
tools/source/generic/poly.cxx |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) New commits: commit 80d99a387fa0d5b8764dab720c20e2d3754e610b Author: Caolán McNamara AuthorDate: Sat Mar 5 10:29:15 2022 + Commit: Caolán McNamara CommitDate: Sat Mar 5 14:51:31 2022 +0100 ofz: Use-of-uninitialized-value Change-Id: If75e11dc26aae51d658464135dd8a4f965ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131054 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 13d2df0e47ef..6e5b2d778fa7 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1663,7 +1663,12 @@ void Polygon::ImplRead( SvStream& rIStream ) if ( bHasPolyFlags ) { mpImplPolygon->mxFlagAry.reset(new PolyFlags[mpImplPolygon->mnPoints]); -rIStream.ReadBytes(mpImplPolygon->mxFlagAry.get(), mpImplPolygon->mnPoints); +auto nRead = rIStream.ReadBytes(mpImplPolygon->mxFlagAry.get(), mpImplPolygon->mnPoints); +if (nRead != mpImplPolygon->mnPoints) +{ +SAL_WARN("tools", "Short read"); +memset(mpImplPolygon->mxFlagAry.get() + nRead, 0, mpImplPolygon->mnPoints - nRead); +} } }
[Libreoffice-commits] core.git: vcl/workben
vcl/workben/fftester.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 2fbf7dadf6255b7072c5a8bb7c6c071a22b726ea Author: Caolán McNamara AuthorDate: Sat Mar 5 10:23:33 2022 + Commit: Caolán McNamara CommitDate: Sat Mar 5 14:51:17 2022 +0100 add svm playback to local testing Change-Id: Ie69f628ee3f37b5cdab206c0c1c201a94841bf03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131053 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx index 3c6645dbb89f..7938f0011b38 100644 --- a/vcl/workben/fftester.cxx +++ b/vcl/workben/fftester.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -187,6 +188,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) SvFileStream aFileStream(out, StreamMode::READ); SvmReader aReader(aFileStream); aReader.Read(aGDIMetaFile); +ScopedVclPtrInstance aVDev; +aGDIMetaFile.Play(*aVDev); } else if (strcmp(argv[2], "pcd") == 0) {
[Libreoffice-commits] core.git: vcl/source
vcl/source/gdi/hatch.cxx | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) New commits: commit c53570e524cff058d893ea950ce1e538ba925b5e Author: Caolán McNamara AuthorDate: Sat Mar 5 10:15:45 2022 + Commit: Caolán McNamara CommitDate: Sat Mar 5 14:51:02 2022 +0100 ofz: Use-of-uninitialized-value Change-Id: I695b5721ec848845adff0a5c37b931b4cee5370d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131050 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx index cfb273367742..c7665f610a92 100644 --- a/vcl/source/gdi/hatch.cxx +++ b/vcl/source/gdi/hatch.cxx @@ -79,18 +79,21 @@ void Hatch::SetAngle( Degree10 nAngle10 ) SvStream& ReadHatch( SvStream& rIStm, Hatch& rHatch ) { VersionCompatRead aCompat(rIStm); -sal_uInt16 nTmp16; -sal_Int32 nTmp32(0); -rIStm.ReadUInt16(nTmp16); -rHatch.mpImplHatch->meStyle = static_cast(nTmp16); +sal_uInt16 nTmpStyle(0); +rIStm.ReadUInt16(nTmpStyle); +rHatch.mpImplHatch->meStyle = static_cast(nTmpStyle); tools::GenericTypeSerializer aSerializer(rIStm); aSerializer.readColor(rHatch.mpImplHatch->maColor); + +sal_Int32 nTmp32(0); rIStm.ReadInt32(nTmp32); rHatch.mpImplHatch->mnDistance = nTmp32; -rIStm.ReadUInt16(nTmp16); -rHatch.mpImplHatch->mnAngle = Degree10(nTmp16); + +sal_uInt16 nTmpAngle(0); +rIStm.ReadUInt16(nTmpAngle); +rHatch.mpImplHatch->mnAngle = Degree10(nTmpAngle); return rIStm; }
[Libreoffice-commits] core.git: vcl/workben
vcl/workben/svmfuzzer.cxx | 10 ++ 1 file changed, 10 insertions(+) New commits: commit 19c631692bcdb21d9d5324c63431a8bdfca5a72d Author: Caolán McNamara AuthorDate: Sat Mar 5 10:11:53 2022 + Commit: Caolán McNamara CommitDate: Sat Mar 5 14:50:30 2022 +0100 ofz#45233 need some more services to play back metafile Change-Id: Iafda9d9ad919a4a1a80131962c50a4a24b4b9b83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131049 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/vcl/workben/svmfuzzer.cxx b/vcl/workben/svmfuzzer.cxx index a4074f465cc5..06188ece3004 100644 --- a/vcl/workben/svmfuzzer.cxx +++ b/vcl/workben/svmfuzzer.cxx @@ -24,6 +24,11 @@ void * com_sun_star_i18n_NativeNumberSupplier_get_implementation( void *, void * void * com_sun_star_i18n_NumberFormatCodeMapper_get_implementation( void *, void * ); void * com_sun_star_comp_rendering_CanvasFactory_get_implementation( void *, void * ); void * com_sun_star_comp_rendering_Canvas_VCL_get_implementation( void *, void * ); +void * linguistic_ConvDicList_get_implementation( void *, void * ); +void * linguistic_DicList_get_implementation( void *, void * ); +void * linguistic_LinguProps_get_implementation( void *, void * ); +void * linguistic_LngSvcMgr_get_implementation( void *, void * ); +void * linguistic_GrammarCheckingIterator_get_implementation( void *, void * ); } const lib_to_factory_mapping * @@ -47,6 +52,11 @@ lo_get_constructor_map(void) { "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation", com_sun_star_i18n_NumberFormatCodeMapper_get_implementation }, { "com_sun_star_comp_rendering_CanvasFactory_get_implementation", com_sun_star_comp_rendering_CanvasFactory_get_implementation }, { "com_sun_star_comp_rendering_Canvas_VCL_get_implementation", com_sun_star_comp_rendering_Canvas_VCL_get_implementation }, +{ "linguistic_ConvDicList_get_implementation", linguistic_ConvDicList_get_implementation }, +{ "linguistic_DicList_get_implementation", linguistic_DicList_get_implementation }, +{ "linguistic_LinguProps_get_implementation", linguistic_LinguProps_get_implementation }, +{ "linguistic_LngSvcMgr_get_implementation", linguistic_LngSvcMgr_get_implementation }, +{ "linguistic_GrammarCheckingIterator_get_implementation", linguistic_GrammarCheckingIterator_get_implementation }, { 0, 0 } };
[Libreoffice-commits] core.git: vcl/source
vcl/source/fontsubset/sft.cxx | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) New commits: commit 9cec15391b7dd9556a6fb78875ad7b3421b93ab1 Author: Caolán McNamara AuthorDate: Sat Mar 5 10:03:43 2022 + Commit: Caolán McNamara CommitDate: Sat Mar 5 14:50:09 2022 +0100 ofz: record less than 10 bytes is invalid Change-Id: Ie6b88efbc12b4c7fddb7459e50cba28fcbcf35fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131048 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 794cdd59d7f8..875eeb96730e 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -354,11 +354,18 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI const sal_uInt8* ptr = table + nGlyphOffset; const sal_uInt32 nMaxGlyphSize = nTableSize - nGlyphOffset; +constexpr sal_uInt32 nContourOffset = 10; +if (nMaxGlyphSize < nContourOffset) +return 0; const sal_Int16 numberOfContours = GetInt16(ptr, GLYF_numberOfContours_offset); if( numberOfContours <= 0 ) /*- glyph is not simple */ return 0; +const sal_Int32 nMaxContours = (nMaxGlyphSize - nContourOffset)/2; +if (numberOfContours > nMaxContours) +return 0; + if (metrics) {/*- GetCompoundTTOutline() calls this function with NULL metrics -*/ metrics->xMin = GetInt16(ptr, GLYF_xMin_offset); metrics->yMin = GetInt16(ptr, GLYF_yMin_offset); @@ -369,22 +376,19 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI /* determine the last point and be extra safe about it. But probably this code is not needed */ sal_uInt16 lastPoint=0; -const sal_Int32 nMaxContours = (nMaxGlyphSize - 10)/2; -if (numberOfContours > nMaxContours) -return 0; for (i=0; i lastPoint) lastPoint = t; } -sal_uInt32 nInstLenOffset = 10 + numberOfContours * 2; +sal_uInt32 nInstLenOffset = nContourOffset + numberOfContours * 2; if (nInstLenOffset + 2 > nMaxGlyphSize) return 0; sal_uInt16 instLen = GetUInt16(ptr, nInstLenOffset); -sal_uInt32 nOffset = 10 + 2 * numberOfContours + 2 + instLen; +sal_uInt32 nOffset = nContourOffset + 2 * numberOfContours + 2 + instLen; if (nOffset > nMaxGlyphSize) return 0; const sal_uInt8* p = ptr + nOffset;
[Libreoffice-commits] core.git: oox/source sal/osl
oox/source/drawingml/diagram/diagramhelper.cxx |2 +- oox/source/ppt/pptshape.cxx|2 +- sal/osl/w32/file_dirvol.cxx|4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 23257525df31a57bbf1a8935001ded2842a18b13 Author: Andrea Gelmini AuthorDate: Sat Mar 5 11:26:44 2022 +0100 Commit: Julien Nabet CommitDate: Sat Mar 5 13:49:13 2022 +0100 Fix typos Change-Id: I87f35153bbf53f58d6c8ca7b14a7fd09fec4372f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131052 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/oox/source/drawingml/diagram/diagramhelper.cxx b/oox/source/drawingml/diagram/diagramhelper.cxx index 8b54ff4e8a0f..50ea44c4aeb6 100644 --- a/oox/source/drawingml/diagram/diagramhelper.cxx +++ b/oox/source/drawingml/diagram/diagramhelper.cxx @@ -65,7 +65,7 @@ void AdvancedDiagramHelper::reLayout(SdrObjGroup& rTarget) rTarget.TRGetBaseGeometry(aTransformation, aPolyPolygon); // create temporary oox::Shape as target. No longer needed is to keep/remember -// the original oox::Shape to do that. Use original Size and Pos frrom initial import +// the original oox::Shape to do that. Use original Size and Pos from initial import // to get the same layout(s) oox::drawingml::ShapePtr pShapePtr = std::make_shared( "com.sun.star.drawing.GroupShape" ); pShapePtr->setDiagramType(); diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 581b85db0e0a..6c12e1f3dd64 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -538,7 +538,7 @@ void PPTShape::addShape( Reference xShapes(xShape, UNO_QUERY); if (xShapes.is()) { -// tempoarily remember setting +// temporarily remember setting NamedShapePairs* pDiagramFontHeights(rFilterBase.getDiagramFontHeights()); // for shapes unequal to FRAMETYPE_DIAGRAM do diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index dc90f474dcfe..793a5ed52d21 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -1595,9 +1595,9 @@ oslFileError SAL_CALL osl_getFileStatus( { /* Capitalizes drive name (single letter). Windows file paths are processed case-sensitively. While parsing a path, function osl_DirectoryItem has case -PATHTYPE_VOLUME for drives, and capatalizes them. That can be overwritten by +PATHTYPE_VOLUME for drives, and capitalizes them. That can be overwritten by function osl_getFileStatus, in it win32 api GetLongPathNameW does no -capatilization. Thus it needs to be postprocessed.*/ +capitalization. Thus it needs to be postprocessed.*/ sal_Int32 nIndex = rtl_ustr_indexOfChar(aBuffer, ':'); if (nIndex > 0) { aBuffer[nIndex - 1] = rtl::toAsciiUpperCase(aBuffer[nIndex - 1]);
[Libreoffice-commits] core.git: sd/qa sd/source
sd/qa/unit/uiimpress.cxx | 31 +++ sd/source/ui/view/drviewse.cxx |4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) New commits: commit 9d25f86236885c40662bcd24517f231688361e8c Author: Andreas Heinisch AuthorDate: Mon Feb 28 18:40:30 2022 +0100 Commit: Andreas Heinisch CommitDate: Sat Mar 5 13:08:53 2022 +0100 tdf#38669 - Create the key event using a Unicode character Instead of using a plain char, create a key event using a Unicode character, otherwise the key event creates texts including rectangles or wrong characters. Change-Id: I9ec0d64998927d54eb3ae90a192c3b28e235f56d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130721 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 52210ca995f7..f56a0444c351 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -782,6 +782,37 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testSpellOnlineParameter) CPPUNIT_ASSERT_EQUAL(!bSet, pImpressDocument->GetDoc()->GetOnlineSpell()); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf38669) +{ +mxComponent = loadFromDesktop("private:factory/simpress", + "com.sun.star.presentation.PresentationDocument"); +auto pImpressDocument = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pImpressDocument); + +// Insert shape with ctrl key +uno::Sequence aArgs( +comphelper::InitPropertySequence({ { "KeyModifier", uno::makeAny(KEY_MOD1) } })); +dispatchCommand(mxComponent, ".uno:BasicShapes.rectangle", aArgs); +Scheduler::ProcessEventsToIdle(); + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDraws = xDrawPagesSupplier->getDrawPages(); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); + +// Insert an UTF-8 character (176 is the code of the degree sign, i.e., '°') +pImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 176, 0); +pImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 176, 0); +Scheduler::ProcessEventsToIdle(); + +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(2), uno::UNO_QUERY); +// Without the fix in place, this test would have failed with: +// - Expected: ° +// - Actual : ㅀ +CPPUNIT_ASSERT_EQUAL(OUString(u"°"), xShape->getString()); +} + CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf123841) { // To check if selecting unfilled rectangle produces unfilled rectangle diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 0b7be81d1845..64e9e88b5396 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -127,9 +127,9 @@ static void ImpAddPrintableCharactersToTextEdit(SfxRequest const & rReq, ::sd::V { for(sal_Int32 a(0); a < aInputString.getLength(); a++) { -char aChar = static_cast(aInputString[a]); vcl::KeyCode aKeyCode; -KeyEvent aKeyEvent(aChar, aKeyCode); +// tdf#38669 - create the key event using a Unicode character +KeyEvent aKeyEvent(aInputString[a], aKeyCode); // add actual character pOLV->PostKeyEvent(aKeyEvent);
MacUpdate - your app listing has been updated
Title: Untitled Document App Listing Updated Hi The Document Foundation, We have updated your application listing for LibreOffice 7.3.1.3 on MacUpdate.com. Please take a moment to review your application's information to make sure that everything is correct. View your updated app listing You can login to your Developer Account to reply to comments and view stats, or submit new updates and changes to your app listing. Desktop Install Compatibility MacUpdate Desktop 6 is helping developers make it easier for users to fully install and use their apps. Download Desktop 6 and to ensure your app works with the “Install” link on our download pages. Advertise With MacUpdate The best Mac devs advertise their apps on MacUpdate.com because it’s the most targeted, highly performing Mac app advertising you can find on the web. Contact a...@macupdate.com to guarantee your annual ad campaigns get booked and expand your app’s audience. Learn more Questions? Contact our Content Update Team upda...@macupdate.com. You are receiving this offer because you have an app listed on MacUpdate.com. Add us to your address book or white list to ensure reliable delivery. © 2018 MacUpdate - All Rights Reserved 526 W. 14th St. #100 • Traverse City, MI 49684
[Libreoffice-commits] core.git: Branch 'feature/sparklines' - 5 commits - sc/CppunitTest_sc_sparkline_test.mk sc/inc sc/Library_scfilt.mk sc/Library_sc.mk sc/Module_sc.mk sc/qa sc/source
Rebased ref, commits from common ancestor: commit daeb48ef12d81253752aa3e933647b0ee7786630 Author: Tomaž Vajngerl AuthorDate: Fri Mar 4 20:40:14 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Sat Mar 5 20:25:40 2022 +0900 sc: Sparkline export for OOXML documents + roundtrip test Change-Id: I4ab93d7ad33867ae817aa98d13ea9bc724b7d710 diff --git a/sc/CppunitTest_sc_sparkline_test.mk b/sc/CppunitTest_sc_sparkline_test.mk index 5dcd9a9921b5..30513b273791 100644 --- a/sc/CppunitTest_sc_sparkline_test.mk +++ b/sc/CppunitTest_sc_sparkline_test.mk @@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_sparkline_test, \ test \ tl \ unotest \ +utl \ vcl \ )) diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk index 8e23db6662fa..84b6e5fd5edd 100644 --- a/sc/Library_scfilt.mk +++ b/sc/Library_scfilt.mk @@ -130,6 +130,7 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\ sc/source/filter/excel/xltools \ sc/source/filter/excel/xltracer \ sc/source/filter/excel/xlview \ + sc/source/filter/excel/export/SparklineExt \ sc/source/filter/ftools/fapihelper \ sc/source/filter/ftools/fprogressbar \ sc/source/filter/ftools/ftools \ diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index cf970ae8995c..2b8de3e34c29 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -50,12 +50,11 @@ public: CPPUNIT_TEST_SUITE_END(); }; -void SparklineImportExportTest::testSparklines() +namespace { -ScDocShellRef xDocSh = loadDoc(u"Sparklines.", FORMAT_XLSX); -CPPUNIT_ASSERT(xDocSh); -ScDocument& rDocument = xDocSh->GetDocument(); +void checkSparklines(ScDocument& rDocument) +{ // Sparkline at Sheet1:A2 { sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 @@ -148,6 +147,20 @@ void SparklineImportExportTest::testSparklines() sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(0, 3, 0)); //A4 CPPUNIT_ASSERT(!pSparkline); } +} + +} // end anonymous namespace + +void SparklineImportExportTest::testSparklines() +{ +ScDocShellRef xDocSh = loadDoc(u"Sparklines.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh); + +checkSparklines(xDocSh->GetDocument()); + +xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX); + +checkSparklines(xDocSh->GetDocument()); xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 6b02457f70f6..529e76971cbc 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -611,6 +612,8 @@ void ExcTable::FillAsTableXml() // conditional formats Add( new XclExpCondFormatBuffer( GetRoot(), xExtLst ) ); +Add(new xcl::exp::SparklineBuffer(GetRoot(), xExtLst)); + // data validation (DVAL and list of DV records), generated by the cell table aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_DVAL ) ); diff --git a/sc/source/filter/excel/export/SparklineExt.cxx b/sc/source/filter/excel/export/SparklineExt.cxx new file mode 100644 index ..f1e97b2c62ed --- /dev/null +++ b/sc/source/filter/excel/export/SparklineExt.cxx @@ -0,0 +1,246 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "export/SparklineExt.hxx" + +#include +#include +#include + +using namespace oox; + +namespace xcl::exp +{ +SparklineExt::SparklineExt(const XclExpRoot& rRoot, + std::vector> const& pSparklines) +: XclExpExt(rRoot) +{ +maURI = "{05C60535-1F16-4fd2-B633-F4F36F0B64E0}"; + +for (auto const& pSparkline : pSparklines) +{ +auto* pGroupPointer = pSparkline->getSparklineGroup().get(); + +auto aIterator = m_aSparklineGroupMap.find(pGroupPointer); +if (aIterator == m_aSparklineGroupMap.end()) +{ +std::vector> aSparklineVector; +aSparklineVector.push_back(pSparkline); +m_aSparklineGroupMap.emplace(pGroupPointer, aSparklineVector); +} +else +{ +aIterator->second.push_back(pSparkline); +} +} +} + +void SparklineExt::SaveXml(XclExpXmlStream& rStream) +{ +sax_fastparser::FSHelperPtr& rWorksheet = rStream.GetCurrentStream(); +rWorksheet->startElement(XML_ext, FSNS(XML_xmlns, XML_x14), + rStream.getNamespaceURL(OOX_NS(xls14Lst)), XML_uri, maURI); + +rWorksheet->startElementNS(XML_x14, XML_sparklineGroups, FSNS(XML_xmlns, X
[Libreoffice-commits] core.git: include/svx sd/source svx/source
include/svx/AccessibleShape.hxx|2 +- sd/source/ui/accessibility/AccessiblePresentationShape.cxx |2 +- sd/source/ui/inc/AccessiblePresentationShape.hxx |2 +- svx/source/accessibility/AccessibleShape.cxx |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 34e347db726a415f3f6df0c1f2112aff6d67bdeb Author: Noel Grandin AuthorDate: Sat Mar 5 09:40:41 2022 +0200 Commit: Noel Grandin CommitDate: Sat Mar 5 11:59:21 2022 +0100 AccessibleShape::GetStyle can be const Change-Id: Ic71ae0645c85ec27cc6a172d379070fe88a9f452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131045 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/svx/AccessibleShape.hxx b/include/svx/AccessibleShape.hxx index 509bee235298..082bb72c4616 100644 --- a/include/svx/AccessibleShape.hxx +++ b/include/svx/AccessibleShape.hxx @@ -413,7 +413,7 @@ protected: /// @throws css::uno::RuntimeException OUString GetFullAccessibleName(AccessibleShape *shape); -virtual OUString GetStyle(); +virtual OUString GetStyle() const; /** Update the OPAQUE and SELECTED state. */ void UpdateStates(); diff --git a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx index 3dacf6e73e8e..e4afe7e9a243 100644 --- a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx @@ -96,7 +96,7 @@ OUString AccessiblePresentationShape::CreateAccessibleBaseName() return sName; } -OUString AccessiblePresentationShape::GetStyle() +OUString AccessiblePresentationShape::GetStyle() const { OUString sName; diff --git a/sd/source/ui/inc/AccessiblePresentationShape.hxx b/sd/source/ui/inc/AccessiblePresentationShape.hxx index 1fd7d86b064f..4a6447ae974c 100644 --- a/sd/source/ui/inc/AccessiblePresentationShape.hxx +++ b/sd/source/ui/inc/AccessiblePresentationShape.hxx @@ -48,7 +48,7 @@ public: virtual OUString CreateAccessibleBaseName () override; -OUString GetStyle() override; +OUString GetStyle() const override; private: AccessiblePresentationShape (const AccessiblePresentationShape&) = delete; diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 8985e9cba6de..ee36cf297028 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -225,7 +225,7 @@ void AccessibleShape::UpdateStates() pStateSet->RemoveState (AccessibleStateType::SELECTED); } -OUString AccessibleShape::GetStyle() +OUString AccessibleShape::GetStyle() const { return ShapeTypeHandler::CreateAccessibleBaseName( mxShape ); }
[Libreoffice-commits] core.git: chart2/source include/svx svx/source
chart2/source/controller/main/DragMethod_PieSegment.cxx |2 +- chart2/source/controller/main/DragMethod_PieSegment.hxx |2 +- include/svx/sdr/table/tablecontroller.hxx |2 +- include/svx/svddrgmt.hxx|6 +++--- svx/source/svdraw/svddrgm1.hxx |6 +++--- svx/source/svdraw/svddrgmt.cxx | 12 ++-- svx/source/table/tablecontroller.cxx|2 +- 7 files changed, 16 insertions(+), 16 deletions(-) New commits: commit 6f652725fcbb068b8b482a74ef021396d4d0f133 Author: Noel Grandin AuthorDate: Fri Mar 4 21:34:21 2022 +0200 Commit: Noel Grandin CommitDate: Sat Mar 5 11:59:04 2022 +0100 make some svx methods const Change-Id: If04a160c46b8dbf641ca9d115d1560f17e87ce4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131043 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx index c2c5db234bd7..3adc6103e6ab 100644 --- a/chart2/source/controller/main/DragMethod_PieSegment.cxx +++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx @@ -128,7 +128,7 @@ bool DragMethod_PieSegment::EndSdrDrag(bool /*bCopy*/) return true; } -basegfx::B2DHomMatrix DragMethod_PieSegment::getCurrentTransformation() +basegfx::B2DHomMatrix DragMethod_PieSegment::getCurrentTransformation() const { basegfx::B2DHomMatrix aRetval; diff --git a/chart2/source/controller/main/DragMethod_PieSegment.hxx b/chart2/source/controller/main/DragMethod_PieSegment.hxx index 8a36dbd4c876..8cb498373f33 100644 --- a/chart2/source/controller/main/DragMethod_PieSegment.hxx +++ b/chart2/source/controller/main/DragMethod_PieSegment.hxx @@ -36,7 +36,7 @@ public: virtual void MoveSdrDrag(const Point& rPnt) override; virtual bool EndSdrDrag(bool bCopy) override; -virtual basegfx::B2DHomMatrix getCurrentTransformation() override; +virtual basegfx::B2DHomMatrix getCurrentTransformation() const override; protected: virtual void createSdrDragEntries() override; diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx index 997cea48b69a..ab9f1d28f0c6 100644 --- a/include/svx/sdr/table/tablecontroller.hxx +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -152,7 +152,7 @@ private: SVX_DLLPRIVATE const CellPos& getSelectionStart(); SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos ); SVX_DLLPRIVATE const CellPos& getSelectionEnd(); -SVX_DLLPRIVATE void checkCell( CellPos& rPos ); +SVX_DLLPRIVATE void checkCell( CellPos& rPos ) const; SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow ); diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx index bb2ee6188b7c..fe71ad5d60cd 100644 --- a/include/svx/svddrgmt.hxx +++ b/include/svx/svddrgmt.hxx @@ -206,7 +206,7 @@ public: const sdr::contact::ObjectContact& rObjectContact); void destroyOverlayGeometry(); -virtual basegfx::B2DHomMatrix getCurrentTransformation(); +virtual basegfx::B2DHomMatrix getCurrentTransformation() const; virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget); virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget); @@ -247,7 +247,7 @@ public: virtual bool EndSdrDrag(bool bCopy) override; virtual PointerStyle GetSdrDragPointer() const override; -virtual basegfx::B2DHomMatrix getCurrentTransformation() override; +virtual basegfx::B2DHomMatrix getCurrentTransformation() const override; virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override; }; @@ -269,7 +269,7 @@ public: virtual bool EndSdrDrag(bool bCopy) override; virtual PointerStyle GetSdrDragPointer() const override; -virtual basegfx::B2DHomMatrix getCurrentTransformation() override; +virtual basegfx::B2DHomMatrix getCurrentTransformation() const override; virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override; }; diff --git a/svx/source/svdraw/svddrgm1.hxx b/svx/source/svdraw/svddrgm1.hxx index b8aa2280964b..54214b9563e8 100644 --- a/svx/source/svdraw/svddrgm1.hxx +++ b/svx/source/svdraw/svddrgm1.hxx @@ -62,7 +62,7 @@ public: virtual bool EndSdrDrag(bool bCopy) override; virtual PointerStyle GetSdrDragPointer() const override; -virtual basegfx::B2DHomMatrix getCurrentTransformation() override; +virtual basegfx::B2DHomMatrix getCurrentTransformation() const override; virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget) override; }; @@ -87,7 +87,7 @@ public: virtual bool EndSdrDrag(bool bCopy) override; virtual PointerStyle GetSdrDragPointer() const override; -virtual basegfx::B2DHomMatrix getCurrentTransfor
[Libreoffice-commits] core.git: Branch 'feature/sparklines' - 7 commits - sc/CppunitTest_sc_sparkline_test.mk sc/inc sc/Library_scfilt.mk sc/Library_sc.mk sc/Module_sc.mk sc/qa sc/source
Rebased ref, commits from common ancestor: commit 51d0731a9fffcaadffe4441697391cd1d82a2254 Author: Tomaž Vajngerl AuthorDate: Fri Mar 4 20:40:14 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Sat Mar 5 19:34:41 2022 +0900 sc: Sparkline export for OOXML documents + roundtrip test Change-Id: I4ab93d7ad33867ae817aa98d13ea9bc724b7d710 diff --git a/sc/CppunitTest_sc_sparkline_test.mk b/sc/CppunitTest_sc_sparkline_test.mk index edf7a3cac7da..00db7396cdb0 100644 --- a/sc/CppunitTest_sc_sparkline_test.mk +++ b/sc/CppunitTest_sc_sparkline_test.mk @@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_sparkline_test, \ test \ tl \ unotest \ +utl \ vcl \ )) diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk index 8e23db6662fa..84b6e5fd5edd 100644 --- a/sc/Library_scfilt.mk +++ b/sc/Library_scfilt.mk @@ -130,6 +130,7 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\ sc/source/filter/excel/xltools \ sc/source/filter/excel/xltracer \ sc/source/filter/excel/xlview \ + sc/source/filter/excel/export/SparklineExt \ sc/source/filter/ftools/fapihelper \ sc/source/filter/ftools/fprogressbar \ sc/source/filter/ftools/ftools \ diff --git a/sc/qa/extras/SparklineTest.cxx b/sc/qa/extras/SparklineTest.cxx index 122a6b23f5be..36bfc0304b45 100644 --- a/sc/qa/extras/SparklineTest.cxx +++ b/sc/qa/extras/SparklineTest.cxx @@ -10,20 +10,38 @@ #include #include +#include +#include #include #include using namespace css; -namespace sc_apitest -{ class SparklineTest : public CalcUnoApiTest { uno::Reference mxComponent; public: -SparklineTest(); +SparklineTest() +: CalcUnoApiTest("sc/qa/extras/testdocuments") +{ +} +void saveAndReload(uno::Reference& xComponent, const OUString& rFilter) +{ +utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); +// "calc8", "Calc Office Open XML", ... +uno::Sequence aArgs{ comphelper::makePropertyValue("FilterName", rFilter) }; +uno::Reference xStorable(xComponent, uno::UNO_QUERY_THROW); +xStorable->storeAsURL(aTempFile.GetURL(), aArgs); +uno::Reference xCloseable(xComponent, uno::UNO_QUERY_THROW); +xCloseable->close(true); + +xComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.sheet.SpreadsheetDocument"); +} + +void checkSparklines(); void testSparklines(); CPPUNIT_TEST_SUITE(SparklineTest); @@ -31,17 +49,8 @@ public: CPPUNIT_TEST_SUITE_END(); }; -SparklineTest::SparklineTest() -: CalcUnoApiTest("sc/qa/extras/testdocuments") +void SparklineTest::checkSparklines() { -} - -void SparklineTest::testSparklines() -{ -OUString aFileURL; -createFileURL(u"Sparklines.xlsx", aFileURL); -mxComponent = loadFromDesktop(aFileURL); - SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent); CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShellRef xDocSh = dynamic_cast(pFoundShell); @@ -140,12 +149,24 @@ void SparklineTest::testSparklines() sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(0, 3, 0)); //A4 CPPUNIT_ASSERT(!pSparkline); } +} + +void SparklineTest::testSparklines() +{ +OUString aFileURL; +createFileURL(u"Sparklines.xlsx", aFileURL); +mxComponent = loadFromDesktop(aFileURL); + +checkSparklines(); + +saveAndReload(mxComponent, "Calc Office Open XML"); + +checkSparklines(); closeDocument(mxComponent); } CPPUNIT_TEST_SUITE_REGISTRATION(SparklineTest); -} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 6b02457f70f6..529e76971cbc 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -611,6 +612,8 @@ void ExcTable::FillAsTableXml() // conditional formats Add( new XclExpCondFormatBuffer( GetRoot(), xExtLst ) ); +Add(new xcl::exp::SparklineBuffer(GetRoot(), xExtLst)); + // data validation (DVAL and list of DV records), generated by the cell table aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_DVAL ) ); diff --git a/sc/source/filter/excel/export/SparklineExt.cxx b/sc/source/filter/excel/export/SparklineExt.cxx new file mode 100644 index ..f1e97b2c62ed --- /dev/null +++ b/sc/source/filter/excel/export/SparklineExt.cxx @@ -0,0 +1,246 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "export/SparklineExt.hx
[Libreoffice-commits] core.git: sc/qa
sc/qa/extras/testdocuments/ScNamedRangeObj.ods |binary 1 file changed New commits: commit 0d2b5efdea72ba640169ba7dc9e6c1b87be1d68b Author: Luboš Luňák AuthorDate: Sat Mar 5 08:47:44 2022 +0100 Commit: Luboš Luňák CommitDate: Sat Mar 5 10:14:18 2022 +0100 make sc_namedrangesobj test work with 16k columns 'row1' is not a valid named range with 16k columns, it's a cell address. Since the named range is constructed by the test, not even 582fc887f1faafe8ff5f16a13a0208483a93353f can take care of it, so rename such ranges. Change-Id: I6643953d41e391c8c3cfc55768b06d61d9fcb0a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131046 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/extras/testdocuments/ScNamedRangeObj.ods b/sc/qa/extras/testdocuments/ScNamedRangeObj.ods index 39a53b27925f..6bd563623f77 100644 Binary files a/sc/qa/extras/testdocuments/ScNamedRangeObj.ods and b/sc/qa/extras/testdocuments/ScNamedRangeObj.ods differ