[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/arraysumfunctor.hxx | 17 - sc/inc/kahan.hxx | 66 +-- sc/qa/unit/ucalc_formula2.cxx|3 + sc/source/core/tool/arraysum.hxx | 36 --- sc/source/core/tool/arraysumSSE2.cxx |6 +-- 5 files changed, 52 insertions(+), 76 deletions(-) New commits: commit 361c4f008e48b08df635839d2e5dcad7389df44a Author: Eike Rathke AuthorDate: Sun Oct 15 17:29:01 2023 +0200 Commit: Eike Rathke CommitDate: Sun Oct 15 18:46:01 2023 +0200 Follow-up: tdf#156985 Use SC_USE_SSE2 to determine which KahanSum::add() to use Also, the CPU identifier for MSVC WIN32 is not X86 but INTEL, so actually use SSE2 there as well, which was the cause of things failing on that platform. For other platforms than Intel x86/x86_64 SSE2 is not defined, so exclude the new unit test based on that and live on with the old slightly off value. Experiments did not yield any solution that works, even using plain sumNeumaierNormal() (similar to SSE2) in the executeUnrolled() case instead of KahanSum with its m_fMem did not help, nor trying to add the internal values in different orders or with long double, au contraire the error was slightly larger. Change-Id: Ica0b2963f76c01f248799e9a809ef06eb099e722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156899 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index c261c120addf..c1eabb220e27 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,29 +12,12 @@ #include #include "kahan.hxx" -#include "arraysumfunctor.hxx" #include namespace sc::op { -// Checkout available optimization options. -// Note that it turned out to be problematic to support CPU-specific code -// that's not guaranteed to be available on that specific platform (see -// git history). SSE2 is guaranteed on x86_64 and it is our baseline requirement -// for x86 on Windows, so SSE2 use is hardcoded on those platforms. -// Whenever we raise baseline to e.g. AVX, this may get -// replaced with AVX code (get it from git history). -// Do it similarly with other platforms. -#if defined(X86_64) || (defined(X86) && defined(_WIN32)) -#define SC_USE_SSE2 1 -KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); -#else -#define SC_USE_SSE2 0 -#endif - /** * If no boosts available, Unrolled KahanSum. - * Most likely to use on android. */ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pCurrent) { diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index ac97ae4394fa..03b05c25aa6b 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -12,6 +12,26 @@ #include #include +class KahanSum; +namespace sc::op +{ +// Checkout available optimization options. +// Note that it turned out to be problematic to support CPU-specific code +// that's not guaranteed to be available on that specific platform (see +// git commit 2d36e7f5186ba5215f2b228b98c24520bd4f2882). SSE2 is guaranteed on +// x86_64 and it is our baseline requirement for x86 on Windows, so SSE2 use is +// hardcoded on those platforms. +// Whenever we raise baseline to e.g. AVX, this may get +// replaced with AVX code (get it from mentioned git commit). +// Do it similarly with other platforms. +#if defined(X86_64) || (defined(INTEL) && defined(_WIN32)) +#define SC_USE_SSE2 1 +KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); +#else +#define SC_USE_SSE2 0 +#endif +} + /** * This class provides LO with Kahan summation algorithm * About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm @@ -41,6 +61,21 @@ public: constexpr KahanSum(const KahanSum& fSum) = default; public: +/** + * Performs one step of the Neumaier sum of doubles. + * Overwrites the summand and error. + * T could be double or long double. + */ +template static inline void sumNeumaierNormal(T& sum, T& err, const double& value) +{ +T t = sum + value; +if (std::abs(sum) >= std::abs(value)) +err += (sum - t) + value; +else +err += (value - t) + sum; +sum = t; +} + /** * Adds a value to the sum using Kahan summation. * @param x_i @@ -71,32 +106,27 @@ public: */ inline void add(const KahanSum& fSum) { -#ifdef _WIN32 -// For some odd unknown reason WIN32 fails badly with the -// sum+compensation value. Continue keeping the old though slightly off -// (see tdf#156985) explicit addition of the compensation value. -add(fSum.m_fSum); -add(fSum.m_fError); -#else +#if SC_USE_SSE2 add(fSum.m_fSum + fSum.m_fError); -#endif add(fSum.m_fMem); +#else +// Without SSE2 the sum+compensation value fails badly. Continue +// keeping the old tho
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/table.hxx |4 sc/qa/unit/data/ods/tdf156815.ods |binary sc/qa/unit/ucalc_solver.cxx | 33 + sc/source/core/data/document.cxx |5 + sc/source/ui/inc/docfunc.hxx |2 +- 5 files changed, 43 insertions(+), 1 deletion(-) New commits: commit cb46ad4c4602fbb6aeab482e9370e31495e12cfe Author: Rafael Lima AuthorDate: Tue Sep 12 19:17:47 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Oct 11 00:05:52 2023 +0200 tdf#156815 Reset solver settings when a sheet is renamed When a sheet is renamed, the SolverSettings object needs to be reset so that the updated references of the named ranges are reloaded the next time the Solver dialog is opened. Change-Id: I8d501bb5b52f6a69bc899a62863893744d80dc69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156872 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 34e0f9d27784..68b4c614c68b 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -451,6 +451,10 @@ public: SC_DLLPUBLIC std::shared_ptr GetSolverSettings(); +// tdf#156815 Sets the solver settings object to nullptr to force reloading Solver settings the +// next time the dialog is opened. This is required when sheets are renamed +void ResetSolverSettings() { m_pSolverSettings.reset(); } + /** * Takes ownership of pCell * diff --git a/sc/qa/unit/data/ods/tdf156815.ods b/sc/qa/unit/data/ods/tdf156815.ods new file mode 100644 index ..cc797ee8619b Binary files /dev/null and b/sc/qa/unit/data/ods/tdf156815.ods differ diff --git a/sc/qa/unit/ucalc_solver.cxx b/sc/qa/unit/ucalc_solver.cxx index 7a8d76cc7534..47770ec0c0e5 100644 --- a/sc/qa/unit/ucalc_solver.cxx +++ b/sc/qa/unit/ucalc_solver.cxx @@ -10,6 +10,7 @@ #include #include "helper/qahelper.hxx" #include +#include #include #include @@ -130,4 +131,36 @@ CPPUNIT_TEST_FIXTURE(SolverTest, testSingleModel) TestConstraintsModelA(pSettings.get()); } +// Tests if references remain valid after a sheet is renamed +CPPUNIT_TEST_FIXTURE(SolverTest, tdf156815) +{ +createScDoc("ods/tdf156815.ods"); +ScDocument* pDoc = getScDoc(); +ScTable* pTable = pDoc->FetchTable(0); +std::shared_ptr pSettings = pTable->GetSolverSettings(); +CPPUNIT_ASSERT(pSettings); + +// Check current values in the solver model +CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$A$1"), pSettings->GetParameter(SP_OBJ_CELL)); +CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$A$3:$B$3"), pSettings->GetParameter(SP_VAR_CELLS)); + +std::vector aConstraints = pSettings->GetConstraints(); +CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$A$2"), aConstraints[0].aLeftStr); +CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$B$2"), aConstraints[0].aRightStr); + +// Rename Sheet2 to NewName +ScDocFunc& rDocFunc = getScDocShell()->GetDocFunc(); +rDocFunc.RenameTable(1, "NewName", false, true); + +// Check whether the ranges where updated +pSettings = pTable->GetSolverSettings(); +CPPUNIT_ASSERT(pSettings); +CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$A$1"), pSettings->GetParameter(SP_OBJ_CELL)); +CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$A$3:$B$3"), pSettings->GetParameter(SP_VAR_CELLS)); + +aConstraints = pSettings->GetConstraints(); +CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$A$2"), aConstraints[0].aLeftStr); +CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$B$2"), aConstraints[0].aRightStr); +} + CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 0880fdf8a857..8996577b588e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -865,7 +865,12 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc for (const auto& pTable : maTabs) { if (pTable) +{ pTable->SetStreamValid( false ); +// tdf#156815 Reset solver settings so next time they're loaded they come with +// the updated sheet name +pTable->ResetSolverSettings(); +} } if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer()) diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 6419e285d5b7..aa9755566ef3 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -147,7 +147,7 @@ public: bool bCut, bool bRecord, bool bPaint, bool bApi ); SC_DLLPUBLIC bool InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bool bApi ); -boolRenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bool bApi ); +SC_DLLPUBLIC bool RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bool bApi ); boolDeleteTable( SCTAB nTab,
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx|2 ++ sc/inc/table.hxx |4 sc/qa/unit/data/ods/tdf157318.ods |binary sc/qa/unit/subsequent_export_test4.cxx | 23 +-- sc/source/core/data/document.cxx |6 ++ sc/source/core/data/table1.cxx | 20 sc/source/filter/excel/xename.cxx |5 - sc/source/ui/view/viewfun2.cxx |3 +++ 8 files changed, 56 insertions(+), 7 deletions(-) New commits: commit 2705c53c9d444eb5a8126d97b3e1fc4ff010b9c0 Author: Rafael Lima AuthorDate: Mon Oct 2 00:13:57 2023 +0200 Commit: László Németh CommitDate: Mon Oct 9 16:06:32 2023 +0200 tdf#100034 tdf#157318 XLSX export: fix lost named ranges associated to sheets The original fix for tdf#100034 (see commit [1]) consisted of explicitly not exporting to XLSX named ranges that are not built-in. This has a side-effect that user-defined named ranges associated with sheets are also not exported to XLSX. Hence, if the user creates a named range linked to a sheet and saves the file to XLSX, the named range is not exported (which is the issue reported in tdf#157318). This patch implements a new fix for tdf#100034, reverting the previous fix. When the Print Ranges are cleared by the user, the associated named ranges are also cleared, thus fixing the original problem. This new fix has the advantage that user-defined named ranges linked to sheets are again exported to XLSX files. Regression from commit 639519dc2bad058197b6ff73c9e3df622f979f97 "tdf#100034: Fix to persistently remove print-range". References: [1] 639519dc2bad058197b6ff73c9e3df622f979f97 Change-Id: Ic3b84365a6086e96f60b222cd6337991ac90f483 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157455 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f473034ea039..70a4827ce87f 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2118,6 +2118,8 @@ public: SC_DLLPUBLIC voidClearPrintRanges( SCTAB nTab ); /** Adds a new print ranges. */ SC_DLLPUBLIC voidAddPrintRange( SCTAB nTab, const ScRange& rNew ); +// Removes all named ranges used for print ranges in a given tab +SC_DLLPUBLIC voidClearPrintNamedRanges( SCTAB nTab ); /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */ SC_DLLPUBLIC voidSetPrintEntireSheet( SCTAB nTab ); SC_DLLPUBLIC voidSetRepeatColRange( SCTAB nTab, std::optional oNew ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 615a2f03e5cd..34e0f9d27784 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -833,6 +833,10 @@ public: voidClearPrintRanges(); /** Adds a new print ranges. */ voidAddPrintRange( const ScRange& rNew ); + +// Removes all named ranges used for print ranges +voidClearPrintNamedRanges(); + /** Marks the specified sheet to be printed completely. Deletes old print ranges! */ voidSetPrintEntireSheet(); diff --git a/sc/qa/unit/data/ods/tdf157318.ods b/sc/qa/unit/data/ods/tdf157318.ods new file mode 100644 index ..6d17dc1ceb48 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf157318.ods differ diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 357ac567575f..77750a206622 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1725,8 +1725,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf100034) createScDoc("xlsx/tdf100034.xlsx"); ScDocument* pDoc = getScDoc(); -// Clear print ranges -pDoc->ClearPrintRanges(0); +// Clear print ranges (Format - Print Ranges - Clear) +dispatchCommand(mxComponent, ".uno:DeletePrintArea", {}); // Save and load back saveAndReload("Calc Office Open XML"); @@ -1736,6 +1736,25 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf100034) CPPUNIT_ASSERT_EQUAL(static_cast(0), pDoc->GetPrintRangeCount(0)); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf157318) +{ +// This document has 2 named ranges; Test1 is global; Test2 is linked to Sheet1) +createScDoc("ods/tdf157318.ods"); +ScDocument* pDoc = getScDoc(); + +// Save as XLSX and load back +saveAndReload("Calc Office Open XML"); +pDoc = getScDoc(); + +// Check if there is one global named range +CPPUNIT_ASSERT_EQUAL(static_cast(1), + static_cast(pDoc->GetRangeName()->size())); + +// Check if there is one named range in the first sheet +CPPUNIT_ASSERT_EQUAL(static_cast(1), + static_cast(pDoc->GetRangeName(0)->size())); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/s
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/conditio.hxx | 20 sc/qa/unit/subsequent_filters_test3.cxx |5 + sc/source/core/data/conditio.cxx| 15 ++- 3 files changed, 35 insertions(+), 5 deletions(-) New commits: commit cea900fe9864bbc5314415cb369fc7b6111cd050 Author: Szymon Kłos AuthorDate: Wed Sep 13 14:57:23 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Sep 18 17:45:47 2023 +0200 Schedule conditional formating repaint after filtering is completed When we have sheet with lots of data with applied conditional formatting and that data is used with autofilter feature - filtering is very slow. That was caused by repaints synchronously called on every row show/hide. ScConditionalFormat::DoRepaint() called by ScFormulaListener callback ... ScDocument::Broadcast ScColumn::BroadcastRows ScTable::SetRowHidden ScTable::DBShowRows This patch schedules repaint in the Idle so we do that after all changes are already applied. Change-Id: If0876ada0f336a41b69560db6a581d6e24d7ac16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157016 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 47f5fdb3addb..8e5af1dd3c3c 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -40,6 +40,7 @@ #include #include +class RepaintInIdle; class ScFormulaCell; class ScTokenArray; struct ScRefCellValue; @@ -442,6 +443,8 @@ private: }; mutable std::unique_ptr mpCache; + +std::unique_ptr mpRepaintTask; }; // single condition entry for conditional formatting @@ -605,6 +608,23 @@ public: void CalcAll(); }; +class RepaintInIdle final : public Idle +{ +ScConditionalFormat* mpCondFormat; + +public: +RepaintInIdle(ScConditionalFormat* pCondFormat) +: Idle("Contitional Format Repaint Idle") +, mpCondFormat(pCondFormat) +{} + +void Invoke() override +{ +if (mpCondFormat) +mpCondFormat->DoRepaint(); +} +}; + struct CompareScConditionalFormat { using is_transparent = void; diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx index ff19d3d55c3c..3a46b9926bf6 100644 --- a/sc/qa/unit/subsequent_filters_test3.cxx +++ b/sc/qa/unit/subsequent_filters_test3.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -419,6 +420,8 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testCondFormatFormulaListenerXLSX) pDoc->SetDocVisible(true); pDoc->SetValue(0, 0, 0, 2.0); +Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aListener.mbCalled); } @@ -439,6 +442,8 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471) pDoc->SetDocVisible(true); pDoc->SetValue(0, 0, 0, 1.0); +Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aListener.mbCalled); } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index b70f9579d0e8..93094e929bf4 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -160,12 +160,13 @@ void ScConditionEntry::StartListening() if (!pCondFormat) return; +mpRepaintTask = std::make_unique(pCondFormat); const ScRangeList& rRanges = pCondFormat->GetRange(); mpListener->stopListening(); start_listen_to(*mpListener, pFormula1.get(), rRanges); start_listen_to(*mpListener, pFormula2.get(), rRanges); -mpListener->setCallback([&]() { pCondFormat->DoRepaint();}); +mpListener->setCallback([&]() { mpRepaintTask->Start();}); } void ScConditionEntry::SetParent(ScConditionalFormat* pParent) @@ -195,7 +196,8 @@ ScConditionEntry::ScConditionEntry( const ScConditionEntry& r ) : bFirstRun(true), mpListener(new ScFormulaListener(*r.mpDoc)), eConditionType( r.eConditionType ), -pCondFormat(r.pCondFormat) +pCondFormat(r.pCondFormat), +mpRepaintTask() { // ScTokenArray copy ctor creates a flat copy if (r.pFormula1) @@ -228,7 +230,8 @@ ScConditionEntry::ScConditionEntry( ScDocument& rDocument, const ScConditionEntr bFirstRun(true), mpListener(new ScFormulaListener(rDocument)), eConditionType( r.eConditionType), -pCondFormat(r.pCondFormat) +pCondFormat(r.pCondFormat), +mpRepaintTask() { // Real copy of the formulas (for Ref Undo) if (r.pFormula1) @@ -262,7 +265,8 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper, bFirstRun(true), mpListener(new ScFormulaListener(rDocument)), eConditionType(eType), -pCondFormat(nullptr) +pCondFormat(nullptr), +mpRepaintTask() { Compile( rExpr1, rExpr2, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2, false ); @@ -287,7 +291,8 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper, bFirstRun(true), mpListener(new ScFormulaListener(rDocument)), eConditionType(ScForma
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/dociter.hxx |4 ++-- sc/qa/unit/subsequent_filters_test2.cxx |7 --- sc/source/core/data/dociter.cxx | 11 +++ sc/source/filter/oox/workbookhelper.cxx |1 + sc/source/ui/docshell/docsh5.cxx| 10 ++ sc/source/ui/inc/docsh.hxx |1 + 6 files changed, 21 insertions(+), 13 deletions(-) New commits: commit d15c4caabaa21e0efe3a08ffbe145390e802bab9 Author: Justin Luth AuthorDate: Tue Sep 20 08:14:41 2022 -0400 Commit: Justin Luth CommitDate: Tue Jul 11 19:38:07 2023 +0200 tdf#123026 xlsx import: recalc optimal row height on import This patch depends on the previous patch for this bug report, which allows each sheet to hold its own default row height. The given height for the row might not be enough to fit the content. If the row is set to use optimal height, that will be corrected as soon as the row is edited. Obviously, it should not require an edit to be correct on FILEOPEN, so this patch recalculates after loading the document. This might have a very negative effect on the time needed to open a file. I couldn't duplicate the XLS method because Library_scfilt.mk doesn't link to ScSizeDeviceProvider. The existing UpdateAllRowHeights wasn't designed to allow any performance improvements, so I made a new one. The new one is based on the newer ScDocRowHeightUpdater class - so perhaps the older method can be phased out. This new UpdateAllRowHeights could replace the XLS bSetRowHeights clause - with hopefully some performance benefit. I'm not sure I'm ready for the regression hate that would come from the inevitable performance implications. Testing however doesn't suggest a huge slowdown. I tested with time make sc.check before the fix I was getting 16m 4s +- 10s after the fix I was getting 16m 25s +- 10s Specific test showing the need for these patches: make CppunitTest_sc_subsequent_filters_test2 \ CPPUNIT_TEST_NAME=testTdf123026_optimalRowHeight Impacted unit tests (without the previous patch) are documented in earlier patchsets. make CppunitTest_sc_subsequent_export_test \ CPPUNIT_TEST_NAME=testMiscRowHeightExport make CppunitTest_sc_subsequent_export_test2 make CppunitTest_sc_jumbosheets_test CPPUNIT_TEST_NAME=testTdf134553 Change-Id: I6d020c1a5137dd4f05e20e82b1764a102b7f56d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140260 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index b73d175a000f..6be5a77e5e5b 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -457,10 +457,10 @@ public: ScDocument& rDoc, OutputDevice* pOutDev, double fPPTX, double fPPTY, const ::std::vector* pTabRangesArray); -void update(); +void update(const bool bOnlyUsedRows = false); private: -void updateAll(); +void updateAll(const bool bOnlyUsedRows); private: ScDocument& mrDoc; diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index d5ce977b3a4e..790ab5c99057 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -148,13 +148,6 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testOptimalHeightReset) CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testTdf123026_optimalRowHeight) { createScDoc("xlsx/tdf123026_optimalRowHeight.xlsx"); - -dispatchCommand(mxComponent, ".uno:SelectColumn", {}); -dispatchCommand( -mxComponent, ".uno:SetOptimalRowHeight", -comphelper::InitPropertySequence({ { "aExtraHeight", uno::Any(sal_uInt16(0)) } })); -Scheduler::ProcessEventsToIdle(); - SCTAB nTab = 0; SCROW nRow = 4; int nHeight = convertTwipToMm100(getScDoc()->GetRowHeight(nRow, nTab, false)); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index fd4fa7afe42f..267d814daf76 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1615,12 +1615,12 @@ ScDocRowHeightUpdater::ScDocRowHeightUpdater(ScDocument& rDoc, OutputDevice* pOu { } -void ScDocRowHeightUpdater::update() +void ScDocRowHeightUpdater::update(const bool bOnlyUsedRows) { if (!mpTabRangesArray || mpTabRangesArray->empty()) { // No ranges defined. Update all rows in all tables. -updateAll(); +updateAll(bOnlyUsedRows); return; } @@ -1668,7 +1668,7 @@ void ScDocRowHeightUpdater::update() } } -void ScDocRowHeightUpdater::updateAll() +void ScDocRowHeightUpdater::updateAll(const bool bOnlyUsedRows) { sal_uInt64 nCellCount = 0; for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab) @@ -1689,7 +1689,10 @@ void ScDocRowHeightUpdater::updateAll() if (!ValidTab(nTab) || !mrDoc
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/CommonProperties.hxx | 14 sc/inc/unonames.hxx |5 +++ sc/qa/extras/scstyleobj.cxx |4 ++ sc/qa/extras/sctablecolumnobj.cxx |4 ++ sc/qa/extras/sctablerowobj.cxx|4 ++ sc/source/filter/inc/stylesbuffer.hxx |4 ++ sc/source/filter/oox/stylesbuffer.cxx | 11 ++ sc/source/ui/unoobj/cellsuno.cxx | 54 +++--- sc/source/ui/unoobj/styleuno.cxx |9 - 9 files changed, 52 insertions(+), 57 deletions(-) New commits: commit 28e9f2bc390e10339859306ad5f733d377134ca8 Author: Tomaž Vajngerl AuthorDate: Fri Jun 23 20:03:27 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Jun 27 11:07:49 2023 +0200 sc: import and prop. theme color support for cell borders Adds import for theme colors for cell borders and UNO properties for the cell border theme (complex) colors. Change-Id: I9d8dd7e71f74a623f916e19d59964058f43440bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153502 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/CommonProperties.hxx b/sc/inc/CommonProperties.hxx index 2c7d1e0a080b..4a2931753c79 100644 --- a/sc/inc/CommonProperties.hxx +++ b/sc/inc/CommonProperties.hxx @@ -17,4 +17,18 @@ { SC_UNONAME_CCOLOR, ATTR_FONT_COLOR, cppu::UnoType::get(), 0, MID_COLOR_RGB }, \ { SC_UNONAME_CHAR_COMPLEX_COLOR, ATTR_FONT_COLOR, cppu::UnoType::get(), 0, MID_COMPLEX_COLOR }, \ +#define CELL_BORDER_PROPERTIES \ +{ SC_UNONAME_BOTTBORDER, ATTR_BORDER, cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_BOTTBORDER2, ATTR_BORDER, cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_LEFTBORDER, ATTR_BORDER, cppu::UnoType::get(), 0, LEFT_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_LEFTBORDER2, ATTR_BORDER, cppu::UnoType::get(), 0, LEFT_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_RIGHTBORDER, ATTR_BORDER, cppu::UnoType::get(), 0, RIGHT_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_RIGHTBORDER2, ATTR_BORDER, cppu::UnoType::get(), 0, RIGHT_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_TOPBORDER, ATTR_BORDER, cppu::UnoType::get(), 0, TOP_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_TOPBORDER2, ATTR_BORDER, cppu::UnoType::get(), 0, TOP_BORDER | CONVERT_TWIPS }, \ +{ SC_UNONAME_BOTTOM_BORDER_COMPLEX_COLOR, ATTR_BORDER, cppu::UnoType::get(), 0, MID_BORDER_BOTTOM_COLOR }, \ +{ SC_UNONAME_LEFT_BORDER_COMPLEX_COLOR, ATTR_BORDER, cppu::UnoType::get(), 0, MID_BORDER_LEFT_COLOR }, \ +{ SC_UNONAME_RIGHT_BORDER_COMPLEX_COLOR, ATTR_BORDER, cppu::UnoType::get(), 0, MID_BORDER_RIGHT_COLOR }, \ +{ SC_UNONAME_TOP_BORDER_COMPLEX_COLOR, ATTR_BORDER, cppu::UnoType::get(), 0, MID_BORDER_TOP_COLOR }, \ + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 7a7396a358e4..522582a36fb5 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -133,6 +133,11 @@ inline constexpr OUStringLiteral SC_UNONAME_LEFTBORDER2 = u"LeftBorder2"; inline constexpr OUStringLiteral SC_UNONAME_RIGHTBORDER2 = u"RightBorder2"; inline constexpr OUStringLiteral SC_UNONAME_TOPBORDER2 = u"TopBorder2"; +inline constexpr OUStringLiteral SC_UNONAME_BOTTOM_BORDER_COMPLEX_COLOR = u"BottomBorderComplexColor"; +inline constexpr OUStringLiteral SC_UNONAME_LEFT_BORDER_COMPLEX_COLOR = u"LeftBorderComplexColor"; +inline constexpr OUStringLiteral SC_UNONAME_RIGHT_BORDER_COMPLEX_COLOR = u"RightBorderComplexColor"; +inline constexpr OUStringLiteral SC_UNONAME_TOP_BORDER_COMPLEX_COLOR = u"TopBorderComplexColor"; + inline constexpr OUStringLiteral SC_UNONAME_DIAGONAL_TLBR= u"DiagonalTLBR"; inline constexpr OUStringLiteral SC_UNONAME_DIAGONAL_BLTR= u"DiagonalBLTR"; diff --git a/sc/qa/extras/scstyleobj.cxx b/sc/qa/extras/scstyleobj.cxx index 813a59db944b..12b3b0ebde8d 100644 --- a/sc/qa/extras/scstyleobj.cxx +++ b/sc/qa/extras/scstyleobj.cxx @@ -61,6 +61,7 @@ ScStyleObj::ScStyleObj() , XNamed("ScStyleObj") , XPropertySet({ "BottomBorder", "BottomBorder2", + "BottomBorderComplexColor", "CellProtection", "CharLocale", "CharLocaleAsian", @@ -75,14 +76,17 @@ ScStyleObj::ScStyleObj() "HoriJustify", "LeftBorder", "LeftBorder2", + "LeftBorderComplexColor", "NumberFormat", "Orientation", "RightBorder", "RightBorder2", + "RightBorderComplexColor", "ShadowFormat", "TableBorder", "TopBorder", "TopBorder2", + "TopBorderComplexColor", "UserDefinedAttributes",
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |1 sc/inc/table.hxx | 11 +++ sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 20 + sc/source/core/data/column2.cxx | 28 --- sc/source/core/data/document.cxx |9 ++ sc/source/core/data/fillinfo.cxx |4 +- sc/source/core/data/table1.cxx |6 ++-- sc/source/core/data/table2.cxx | 16 +- sc/source/core/data/table7.cxx |2 - sc/source/filter/oox/worksheethelper.cxx |6 sc/source/ui/view/cellsh3.cxx|4 +- sc/source/ui/view/viewdata.cxx |3 +- sc/source/ui/view/viewfunc.cxx | 10 +++--- 14 files changed, 90 insertions(+), 30 deletions(-) New commits: commit b0f55a04f081ff7f566c3ba5b6d6d6be3675e0f7 Author: Justin Luth AuthorDate: Mon Jun 12 11:15:09 2023 -0400 Commit: Justin Luth CommitDate: Tue Jun 27 02:27:58 2023 +0200 tdf#123026 sc xlsx: provide per-sheet optimal row height setting This patch is a pre-requisite for a follow-up patch which will run SetOptimalRowHeight on all un-sized rows on FILEOPEN. XLSX sheets can provide a default height for all rows on that sheet. That imported/round-tripped well. However, if Calc optimizes these rows, the undefined rows likely will change height - since the default XLSX row height tends to be 300 twips, while Calc uses 256 (in ScGlobal::nStdRowHeight). This patch allows a sheet to define its optimal row height, so that running .uno:SetOptimalRowHeight doesn't change any row heights, and doesn't cause all kinds of new row definitions. make CppunitTest_sc_subsequent_filters_test2 \ CPPUNIT_TEST_NAME=testTdf123026_optimalRowHeight Change-Id: I35008107d71f66375c7e9469e559f3836cf14df5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152909 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Dennis Francis diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 300d6f7817e0..27499ca9f105 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -990,6 +990,7 @@ public: boolIsStreamValidLocked() const { return mbStreamValidLocked; } boolIsPendingRowHeights( SCTAB nTab ) const; voidSetPendingRowHeights( SCTAB nTab, bool bSet ); +sal_uInt16 GetSheetOptimalMinRowHeight(SCTAB nTab) const; SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, bool bRTL, ScObjectHandling eObjectHandling = ScObjectHandling::RecalcPosMode); SC_DLLPUBLIC bool IsLayoutRTL( SCTAB nTab ) const; SC_DLLPUBLIC bool IsNegativePage( SCTAB nTab ) const; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0662053cb89c..1a62a7e56321 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -186,6 +186,9 @@ private: SCCOL mnEndCol; SCROW mnEndRow; +// Standard row height for this sheet - benefits XLSX because default height defined per sheet +sal_uInt16 mnOptimalMinRowHeight; // in Twips + std::unique_ptr pTabProtection; std::unique_ptr> mpColWidth; @@ -873,6 +876,14 @@ public: // nPPT to test for modification voidSetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual ); +sal_uInt16 GetOptimalMinRowHeight() const +{ +if (!mnOptimalMinRowHeight) +return ScGlobal::nStdRowHeight; +return mnOptimalMinRowHeight; +}; +void SetOptimalMinRowHeight(sal_uInt16 nSet) { mnOptimalMinRowHeight = nSet; } + sal_uInt16 GetColWidth( SCCOL nCol, bool bHiddenAsZero = true ) const; tools::Long GetColWidth( SCCOL nStartCol, SCCOL nEndCol ) const; sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const; diff --git a/sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx b/sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx new file mode 100644 index ..d4ea71e1a663 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index a0a4a92d299b..d5ce977b3a4e 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -44,8 +44,10 @@ #include #include +#include #include #include +#include #include "helper/qahelper.hxx" using namespace ::com::sun::star; @@ -143,6 +145,24 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testOptimalHeightReset) CPPUNIT_ASSERT_EQUAL(nOptimalHeight, nHeight); } +CPPUNIT_TEST_FIXTURE(ScFiltersT
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/patattr.hxx | 16 sc/qa/unit/helper/qahelper.cxx |4 ++-- sc/source/core/data/patattr.cxx | 18 +- sc/source/filter/excel/xecontent.cxx |2 +- sc/source/filter/excel/xehelper.cxx |6 +++--- sc/source/filter/excel/xestyle.cxx |2 +- sc/source/ui/view/output2.cxx|6 +++--- sc/source/ui/view/printfun.cxx |4 ++-- 8 files changed, 29 insertions(+), 29 deletions(-) New commits: commit f55792eed4d2e0f6891a2bdd8639f8e962d95c5b Author: Noel Grandin AuthorDate: Sun Jun 25 15:41:37 2023 +0200 Commit: Noel Grandin CommitDate: Mon Jun 26 07:53:06 2023 +0200 convert ScAutoFontColorMode to scoped enum Change-Id: Id34bac78719943bd4c4cbfa60e0cb86b4ca570f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153562 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 4d7df0c6ac23..1df3a31d6fac 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -39,15 +39,15 @@ enum class ScRotateDir : sal_uInt8; /// how to treat COL_AUTO in GetFont: -enum ScAutoFontColorMode +enum class ScAutoFontColorMode { -SC_AUTOCOL_RAW, ///< COL_AUTO is returned -SC_AUTOCOL_BLACK, ///< always use black -SC_AUTOCOL_PRINT, ///< black or white, depending on background -SC_AUTOCOL_DISPLAY, ///< from style settings, or black/white if needed -SC_AUTOCOL_IGNOREFONT, ///< like DISPLAY, but ignore stored font color (assume COL_AUTO) -SC_AUTOCOL_IGNOREBACK, ///< like DISPLAY, but ignore stored background color (use configured color) -SC_AUTOCOL_IGNOREALL///< like DISPLAY, but ignore stored font and background colors +Raw, ///< COL_AUTO is returned +Black, ///< always use black +Print, ///< black or white, depending on background +Display, ///< from style settings, or black/white if needed +IgnoreFont, ///< like DISPLAY, but ignore stored font color (assume COL_AUTO) +IgnoreBack, ///< like DISPLAY, but ignore stored background color (use configured color) +IgnoreAll///< like DISPLAY, but ignore stored font and background colors }; class SC_DLLPUBLIC ScPatternAttr final : public SfxSetItem diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index efb2e68c4fbc..890a330f147d 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -179,7 +179,7 @@ void ScModelTestBase::testFormats(ScDocument* pDoc,std::u16string_view sFormat) Color aColor; pPattern->fillFontOnly(aFont); -pPattern->fillColor(aColor, SC_AUTOCOL_RAW); +pPattern->fillColor(aColor, ScAutoFontColorMode::Raw); CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", tools::Long(200), aFont.GetFontSize().getHeight()); CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, aColor); pPattern = pDoc->GetPattern(0,1,1); @@ -193,7 +193,7 @@ void ScModelTestBase::testFormats(ScDocument* pDoc,std::u16string_view sFormat) CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); pPattern = pDoc->GetPattern(1,0,1); pPattern->fillFontOnly(aFont); -pPattern->fillColor(aColor, SC_AUTOCOL_RAW); +pPattern->fillColor(aColor, ScAutoFontColorMode::Raw); CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aColor); pPattern = pDoc->GetPattern(1,1,1); pPattern->fillFontOnly(aFont); diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 199d41ab25f1..1bb2e50daf4d 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -448,11 +448,11 @@ void ScPatternAttr::fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoF aColor = pColorItem->GetValue(); -if ((aColor == COL_AUTO && eAutoMode != SC_AUTOCOL_RAW) -|| eAutoMode == SC_AUTOCOL_IGNOREFONT -|| eAutoMode == SC_AUTOCOL_IGNOREALL) +if ((aColor == COL_AUTO && eAutoMode != ScAutoFontColorMode::Raw) +|| eAutoMode == ScAutoFontColorMode::IgnoreFont +|| eAutoMode == ScAutoFontColorMode::IgnoreAll) { -if ( eAutoMode == SC_AUTOCOL_BLACK ) +if ( eAutoMode == ScAutoFontColorMode::Black ) aColor = COL_BLACK; else { @@ -472,12 +472,12 @@ void ScPatternAttr::fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoF // if background color attribute is transparent, use window color for brightness comparisons if (aBackColor == COL_TRANSPARENT -|| eAutoMode == SC_AUTOCOL_IGNOREBACK -|| eAutoMode == SC_AUTOCOL_IGNOREALL) +|| eAutoMode == ScAutoFontColorMode::IgnoreBack +|| eAutoMode == ScAutoFontColorMode::IgnoreAll) { if (!comphelper::LibreOfficeKit::isActive()) { -
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/patattr.hxx | 50 +--- sc/qa/unit/helper/qahelper.cxx | 26 sc/qa/unit/subsequent_export_test4.cxx |4 - sc/qa/unit/ucalc.cxx |2 sc/qa/unit/uicalc/uicalc.cxx | 10 +-- sc/qa/unit/uicalc/uicalc2.cxx | 10 +-- sc/source/core/data/column2.cxx|6 - sc/source/core/data/global.cxx |2 sc/source/core/data/patattr.cxx| 103 +++-- sc/source/core/tool/editutil.cxx |2 sc/source/core/tool/interpr1.cxx |4 - sc/source/filter/excel/xecontent.cxx |8 +- sc/source/filter/excel/xehelper.cxx| 23 --- sc/source/filter/excel/xestyle.cxx | 16 ++--- sc/source/filter/excel/xlstyle.cxx | 18 ++--- sc/source/filter/inc/xestyle.hxx | 18 ++--- sc/source/filter/inc/xlstyle.hxx |8 +- sc/source/ui/cctrl/dpcontrol.cxx |5 - sc/source/ui/docshell/docsh3.cxx |4 - sc/source/ui/vba/vbarange.cxx |4 - sc/source/ui/view/cellsh1.cxx |8 +- sc/source/ui/view/gridwin4.cxx |6 - sc/source/ui/view/output2.cxx | 12 +-- sc/source/ui/view/printfun.cxx |8 +- 24 files changed, 210 insertions(+), 147 deletions(-) New commits: commit 3537cef02c25c2c2459d7900eed13eeec533b7ae Author: Tomaž Vajngerl AuthorDate: Tue May 16 22:10:10 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Thu Jun 22 02:21:15 2023 +0200 sc: factor out color from setting vcl::Font from a ItemSet vcl::Font color parameter is deprecated so we need to handle the color separately from font data. This refactors GetFont into 2 separate functions - fillFontOnly and fillColor, where fillFont now does the same as previously GetFont function did. All GetFont calls have been changed depending on if we need only the font data or also color - where the color is now treated in a different call. There are a couple of calls where fillFont was used, because to change that needs a more complex refactoring. Change-Id: I0a2ce50a0cb28d196fcff87e1e80099a2bb60a9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151858 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 49cae62994b4..ba15cfb1dd27 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -92,23 +92,55 @@ public: SvxCellOrientation GetCellOrientation( const SfxItemSet* pCondSet = nullptr ) const; /** Static helper function to fill a font object from the passed item set. */ -static void GetFont( vcl::Font& rFont, const SfxItemSet& rItemSet, +static void fillFontOnly(vcl::Font& rFont, const SfxItemSet& rItemSet, +const OutputDevice* pOutDev = nullptr, +const Fraction* pScale = nullptr, +const SfxItemSet* pCondSet = nullptr, +SvtScriptType nScript = SvtScriptType::NONE); + +static void fillFont( vcl::Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const OutputDevice* pOutDev = nullptr, const Fraction* pScale = nullptr, const SfxItemSet* pCondSet = nullptr, SvtScriptType nScript = SvtScriptType::NONE, const Color* pBackConfigColor = nullptr, -const Color* pTextConfigColor = nullptr ); +const Color* pTextConfigColor = nullptr); + +static void fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet = nullptr, +const Color* pBackConfigColor = nullptr, const Color* pTextConfigColor = nullptr); + static ScDxfFontGetDxfFont(const SfxItemSet& rSet, SvtScriptType nScript); + +void fillColor(Color& rColor, +ScAutoFontColorMode eAutoMode, +const SfxItemSet* pCondSet = nullptr, +const Color* pBackConfigColor = nullptr, +const Color* pTextConfigColor = nullptr) const +{ +fillColor(rColor, GetItemSet(), eAutoMode, pCondSet, pBackConfigColor, pTextConfigColor); +} + +void fillFontOnly(vcl::Font& rFont, +const OutputDevice* pOutDev = nullptr, +const Fraction* pScale = nullptr, +const SfxItemSet* pCondSet = nullptr, +SvtScriptType nScript = SvtScriptType::NONE) const +{ +fillFontOnly(rFont, GetItemSet(), pOutDev, pScale, pCondSet, nScript); +} + /** Fills a font object from the own item set. */ -
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source test/Library_subsequenttest.mk test/source
sc/inc/unonames.hxx|2 ++ sc/qa/extras/scstyleobj.cxx| 35 ++- sc/source/ui/unoobj/cellsuno.cxx | 13 + sc/source/ui/unoobj/styleuno.cxx |2 ++ test/Library_subsequenttest.mk |1 + test/source/beans/xpropertyset.cxx |9 + 6 files changed, 53 insertions(+), 9 deletions(-) New commits: commit 56e58e6a1280d9bdd23550ba998f14aef4980244 Author: Tomaž Vajngerl AuthorDate: Thu May 11 19:40:06 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Wed Jun 21 10:58:13 2023 +0200 sc: add CharComplexColor and CellBackgroundComplexColor properties Change-Id: I30153796a39b2aa3648cb107905974ed6f0f3851 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151668 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 4617bcf46700..7a7396a358e4 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -50,6 +50,7 @@ inline constexpr OUStringLiteral SC_UNO_HASDRAWPAGES = u"HasDrawPages"; // CharacterProperties inline constexpr OUStringLiteral SC_UNONAME_CCOLOR = u"CharColor"; +inline constexpr OUStringLiteral SC_UNONAME_CHAR_COMPLEX_COLOR = u"CharComplexColor"; inline constexpr OUStringLiteral SC_UNONAME_CHEIGHT = u"CharHeight"; inline constexpr OUStringLiteral SC_UNONAME_CUNDER = u"CharUnderline"; inline constexpr OUStringLiteral SC_UNONAME_CUNDLCOL = u"CharUnderlineColor"; @@ -97,6 +98,7 @@ inline constexpr OUStringLiteral SC_UNO_CTL_CLOCAL = u"CharLocaleCompl // CellProperties inline constexpr OUStringLiteral SC_UNONAME_CELLSTYL = u"CellStyle"; inline constexpr OUStringLiteral SC_UNONAME_CELLBACK = u"CellBackColor"; +inline constexpr OUStringLiteral SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR = u"CellBackgroundComplexColor"; inline constexpr OUStringLiteral SC_UNONAME_CELLTRAN = u"IsCellBackgroundTransparent"; inline constexpr OUStringLiteral SC_UNONAME_CELLPRO = u"CellProtection"; inline constexpr OUStringLiteral SC_UNONAME_CELLHJUS = u"HoriJustify"; diff --git a/sc/qa/extras/scstyleobj.cxx b/sc/qa/extras/scstyleobj.cxx index 7b8ca77c03ab..813a59db944b 100644 --- a/sc/qa/extras/scstyleobj.cxx +++ b/sc/qa/extras/scstyleobj.cxx @@ -59,15 +59,32 @@ public: ScStyleObj::ScStyleObj() : UnoApiTest("/sc/qa/extras/testdocuments") , XNamed("ScStyleObj") -, XPropertySet({ - "BottomBorder", "BottomBorder2", "CellProtection", "CharLocale", - "CharLocaleAsian", "CharLocaleComplex", "CharPosture", "CharPostureAsian", - "CharPostureComplex","DiagonalBLTR", "DiagonalBLTR2", "DiagonalTLBR", - "DiagonalTLBR2", "HoriJustify", "LeftBorder", "LeftBorder2", - "NumberFormat", "Orientation", "RightBorder", "RightBorder2", - "ShadowFormat", "TableBorder", "TopBorder", "TopBorder2", - "UserDefinedAttributes", - }) +, XPropertySet({ "BottomBorder", + "BottomBorder2", + "CellProtection", + "CharLocale", + "CharLocaleAsian", + "CharLocaleComplex", + "CharPosture", + "CharPostureAsian", + "CharPostureComplex", + "DiagonalBLTR", + "DiagonalBLTR2", + "DiagonalTLBR", + "DiagonalTLBR2", + "HoriJustify", + "LeftBorder", + "LeftBorder2", + "NumberFormat", + "Orientation", + "RightBorder", + "RightBorder2", + "ShadowFormat", + "TableBorder", + "TopBorder", + "TopBorder2", + "UserDefinedAttributes", + "CellBackgroundComplexColor" }) { } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 55f72d3dce09..371ea346d364 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -156,9 +157,11 @@ static const SfxItemPropertySet* lcl_GetCellsPropertySet() { SC_UNONAME_BOTTBORDER,ATTR_BORDER, ::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS }, { SC_UNONAME_BOTTBORDER2,ATTR_BORDER, ::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS }, { SC_UNONAME_CELLBACK, ATTR_BACKGROUND, cppu::UnoType::get(),0, MID_BACK_COLOR }, +{ SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, cppu::UnoType::get(), 0, MID_BACKGROUND_COMPLEX_COLOR }, { SC_UNONAME_CELLPRO, ATTR_P
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/userlist.hxx | 37 ++--- sc/qa/unit/copy_paste_test.cxx|3 - sc/source/core/tool/appoptio.cxx |3 - sc/source/core/tool/userlist.cxx | 80 +- sc/source/filter/oox/autofilterbuffer.cxx |2 sc/source/ui/optdlg/tpusrlst.cxx |8 --- sc/source/ui/unoobj/appluno.cxx |3 - 7 files changed, 38 insertions(+), 98 deletions(-) New commits: commit 1fa085f223761b8dcd7e7ac592eb70450a774543 Author: Mike Kaganski AuthorDate: Sun Jun 4 12:48:50 2023 +0300 Commit: Mike Kaganski CommitDate: Sun Jun 4 14:13:24 2023 +0200 Simplify ScUserList, don't use unique_ptr. Change-Id: Idd0ce7bfff115a3b762e963dd6cea7927c78e295 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152586 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx index e91fbcc0164e..7625ad15f5ee 100644 --- a/sc/inc/userlist.hxx +++ b/sc/inc/userlist.hxx @@ -23,13 +23,12 @@ #include -#include #include /** * Stores individual user-defined sort list. */ -class SC_DLLPUBLIC ScUserListData +class SC_DLLPUBLIC ScUserListData final { public: struct SAL_DLLPRIVATE SubStr @@ -48,8 +47,9 @@ private: public: ScUserListData(OUString aStr); +// Copy ctor and assignment operator re-initialize tokens. Is this intended on copy? ScUserListData(const ScUserListData& rData); -~ScUserListData(); +ScUserListData& operator=(const ScUserListData& rData); const OUString& GetString() const { return aStr; } void SetString(const OUString& rStr); @@ -65,32 +65,31 @@ public: */ class SC_DLLPUBLIC ScUserList { -typedef std::vector> DataType; +typedef std::vector DataType; DataType maData; public: -typedef DataType::iterator iterator; -typedef DataType::const_iterator const_iterator; - ScUserList(); -ScUserList(const ScUserList& r); +ScUserList(const ScUserList& r) = default; + +void EraseData(size_t nIndex) { maData.erase(maData.cbegin() + nIndex); } const ScUserListData* GetData(const OUString& rSubStr) const; /// If the list in rStr is already inserted bool HasEntry(std::u16string_view rStr) const; -const ScUserListData& operator[](size_t nIndex) const; -ScUserListData& operator[](size_t nIndex); -ScUserList& operator=(const ScUserList& r); +const ScUserListData& operator[](size_t nIndex) const { return maData[nIndex]; } +ScUserListData& operator[](size_t nIndex) { return maData[nIndex]; } +ScUserList& operator=(const ScUserList& r) = default; bool operator==(const ScUserList& r) const; -bool operator!=(const ScUserList& r) const; - -iterator begin(); -const_iterator begin() const; -void clear(); -size_t size() const; -void push_back(ScUserListData* p); -void erase(const iterator& itr); +bool operator!=(const ScUserList& r) const { return !operator==(r); } + +void clear() { maData.clear(); } +size_t size() const { return maData.size(); } +template void emplace_back(Args&&... args) +{ +maData.emplace_back(std::forward(args)...); +} }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index b91dee89dea2..879c01844ba3 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -613,8 +613,7 @@ void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells() void ScCopyPasteTest::addToUserList(const OUString& rStr) { -ScUserListData* aListData = new ScUserListData(rStr); -ScGlobal::GetUserList()->push_back(aListData); +ScGlobal::GetUserList()->emplace_back(rStr); } void ScCopyPasteTest::tdf137653_137654_autofillUserlist() diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx index 3b19fbed2204..16a0c4cb9174 100644 --- a/sc/source/core/tool/appoptio.cxx +++ b/sc/source/core/tool/appoptio.cxx @@ -419,8 +419,7 @@ void ScAppCfg::ReadSortListCfg() for (const OUString& rStr : std::as_const(aSeq)) { -ScUserListData* pNew = new ScUserListData(rStr); -aList.push_back(pNew); +aList.emplace_back(rStr); } } diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx index 6e0a4647a094..4540ad3ea0f6 100644 --- a/sc/source/core/tool/userlist.cxx +++ b/sc/source/core/tool/userlist.cxx @@ -97,8 +97,10 @@ ScUserListData::ScUserListData(const ScUserListData& rData) : InitTokens(); } -ScUserListData::~ScUserListData() +ScUserListData& ScUserListData::operator=(const ScUserListData& rData) { +SetString(rData.aStr); +return *this; } void ScUserListData::SetString( const OUString& rStr ) @@ -237,9 +239,9 @@ ScUserList::ScUserList() OUString aDayLong = aDayLongBuf.makeStringAndClear(
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/conditio.hxx|2 +- sc/qa/unit/data/xlsx/tdf155321.xlsx|binary sc/qa/unit/subsequent_filters_test.cxx | 11 +++ sc/source/core/data/colorscale.cxx |8 ++-- 4 files changed, 18 insertions(+), 3 deletions(-) New commits: commit 6a059f8d1b0a7a5b64bd272e1e7b8291979bcd56 Author: Tibor Nagy AuthorDate: Mon May 22 14:20:59 2023 +0200 Commit: László Németh CommitDate: Wed May 31 20:17:16 2023 +0200 tdf#155321 sc: fix color of the highest value on percentile color scale if the highest value occurs multiple times in the data set. Also for coloring based on the percentile, use always the end of the color scale for the highest values, like other spreadsheets do, i.e. not the first possible color in the case of repeating values. For example, the corner case in the test document is not a red and two yellow cells any more, but a red and two green cells. Note: color of the other repeating values still differs from MSO, but the same as in Google Sheets. Change-Id: I1d7eacec6e442c1112a9568e64dd6461e2ff2fbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152117 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 51786d3dc712..47f5fdb3addb 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -208,7 +208,7 @@ class ScConditionalFormat; struct ScDataBarInfo; struct ScIconSetInfo; -struct ScCondFormatData +struct SC_DLLPUBLIC ScCondFormatData { ScCondFormatData(); ScCondFormatData(ScCondFormatData&&); diff --git a/sc/qa/unit/data/xlsx/tdf155321.xlsx b/sc/qa/unit/data/xlsx/tdf155321.xlsx new file mode 100644 index ..42299ff746cb Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf155321.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index 535afe72d818..d206ce2cbf69 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -123,6 +123,17 @@ void testContentImpl(ScDocument& rDoc, bool bCheckMergedCells) } } +CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf155321_CondFormatColor_XLSX) +{ +createScDoc("xlsx/tdf155321.xlsx"); + +ScDocument* pDoc = getScDoc(); +ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0); +ScRefCellValue aCellB1(*pDoc, ScAddress(1, 0, 0)); +Color aColor = pCondFormat->GetData(aCellB1, ScAddress(1, 0, 0)).mxColorScale.value(); +CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor); +} + CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf138601_CondFormatXLSX) { createScDoc("xlsx/tdf138601.xlsx"); diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 1d713c447c5b..4e61dbdbc228 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -657,11 +657,15 @@ std::optional ScColorScaleFormat::GetColor( const ScAddress& rAddr ) cons double nValMax = CalcValue(nMin, nMax, itr); Color rColMax = (*itr)->GetColor(); +// tdf#155321 for the last percentile value, use always the end of the color scale, +// i.e. not the first possible color in the case of repeating values +bool bEqual = COLORSCALE_PERCENTILE == (*itr)->GetType() && nVal == nMax && nVal == nValMax; + ++itr; -while(itr != end() && nVal > nValMax) +while(itr != end() && (nVal > nValMax || bEqual)) { rColMin = rColMax; -nValMin = nValMax; +nValMin = !bEqual ? nValMax : nValMax - 1; rColMax = (*itr)->GetColor(); nValMax = CalcValue(nMin, nMax, itr); ++itr;
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/colorscale.hxx |2 + sc/qa/unit/ucalc_condformat.cxx| 51 + sc/source/core/data/colorscale.cxx | 35 + 3 files changed, 88 insertions(+) New commits: commit 8af6c46a9c0e86bbbd908e96ff236ad1d6c4ddab Author: Tibor Nagy AuthorDate: Wed May 17 08:40:43 2023 +0200 Commit: László Németh CommitDate: Mon May 22 13:32:56 2023 +0200 tdf#155319 sc: fix conditional format data bar after copying This is a follow up to commit I064fb3fe0443705553c6bbfcc34f2d717e0f6bd6 (tdf#154906 tdf#129813 tdf#129814 sc: fix conditional format color scale) Change-Id: Iacc1f5af762e1f6a40ecd13c33384e4a3340822a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151860 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 90a973391995..6652e224fe67 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -313,6 +313,8 @@ public: const ScDataBarFormatData* GetDataBarData() const; ScDataBarFormatData* GetDataBarData(); +bool IsEqual(const ScFormatEntry& r, bool bIgnoreSrcPos) const override; + virtual void UpdateReference( sc::RefUpdateContext& rCxt ) override; virtual void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) override; virtual void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) override; diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index bfece1515a89..78978daec33a 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -268,6 +268,57 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondFormatInsertDeleteSheets) m_pDoc->DeleteTab(0); } +CPPUNIT_TEST_FIXTURE(TestCondformat, testDataBarCondCopyPaste) +{ +m_pDoc->InsertTab(0, "Test"); + +auto pFormat = std::make_unique(1, m_pDoc); +ScRange aCondFormatRange(0, 0, 0, 2, 0, 0); +ScRangeList aRangeList(aCondFormatRange); +pFormat->SetRange(aRangeList); + +ScDataBarFormat* pDatabar = new ScDataBarFormat(m_pDoc); +ScDataBarFormatData* pFormatData = new ScDataBarFormatData(); +pFormatData->meAxisPosition = databar::AUTOMATIC; +pFormatData->maPositiveColor = COL_BLUE; +pFormatData->mxNegativeColor = COL_GREEN; +pFormatData->mbGradient = true; + +pDatabar->SetDataBarData(pFormatData); +pFormat->AddEntry(pDatabar); + +sal_uLong nIndex = m_pDoc->AddCondFormat(std::move(pFormat), 0); + +ScDocument aClipDoc(SCDOCMODE_CLIP); +copyToClip(m_pDoc, aCondFormatRange, &aClipDoc); + +ScRange aTargetRange(0, 3, 0, 2, 3, 0); +pasteFromClip(m_pDoc, aTargetRange, &aClipDoc); + +// Pasting the same conditional format must modify existing format, making its range +// combined of previous range and newly pasted range having the conditional format. +// No new conditional formats must be created. +CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size()); +aRangeList.Join(aTargetRange); +for (SCCOL nCol = 0; nCol < 3; ++nCol) +{ +ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(nCol, 3, 0); +CPPUNIT_ASSERT(pPastedFormat); +CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange()); + +sal_uLong nPastedKey = pPastedFormat->GetKey(); +CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey); + +const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, ATTR_CONDITIONAL); +const ScCondFormatItem* pCondFormatItem = static_cast(pItem); +CPPUNIT_ASSERT(pCondFormatItem); +CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(nIndex), pCondFormatItem->GetCondFormatData().front()); +} + +m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste) { m_pDoc->InsertTab(0, "Test"); diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 7fd48f47305d..1d713c447c5b 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -802,6 +802,41 @@ ScFormatEntry::Type ScDataBarFormat::GetType() const return Type::Databar; } +bool ScDataBarFormat::IsEqual(const ScFormatEntry& rOther, bool /*bIgnoreSrcPos*/) const +{ +if (GetType() != rOther.GetType()) +return false; + +const ScDataBarFormat& r = static_cast(rOther); + +bool bEq = (mpFormatData->maAxisColor.IsRGBEqual(r.mpFormatData->maAxisColor) +&& mpFormatData->maPositiveColor.IsRGBEqual(r.mpFormatData->maPositiveColor) +&& mpFormatData->mxNegativeColor == r.mpFormatData->mxNegativeColor +&& mpFormatData->meAxisPosition == r.mpFormatData->meAxisPosition +&& mpFormatData->mbGradient == r.mpFormatData->mbGradient +&& mpFormatData->mbOnlyBar == r.mpFormatData->mbOnlyB
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/sortparam.hxx |9 +++ sc/inc/strings.hrc|1 sc/inc/table.hxx |3 + sc/qa/uitest/autofilter/autofilter.py |1 sc/qa/uitest/autofilter2/tdf126306.py |3 + sc/qa/uitest/autofilter2/tdf141559.py |4 + sc/qa/uitest/autofilter2/tdf46184.py |1 sc/qa/uitest/autofilter2/tdf68113.py |2 sc/qa/unit/ucalc_sort.cxx | 21 +++ sc/source/core/data/column3.cxx | 63 + sc/source/core/data/table3.cxx| 31 ++ sc/source/core/data/table5.cxx| 63 + sc/source/ui/dbgui/tpsort.cxx |2 sc/source/ui/view/gridwin.cxx | 102 +++--- 14 files changed, 238 insertions(+), 68 deletions(-) New commits: commit bb5e03681c576bc108c1e5c819957f1b34f80ca7 Author: Samuel Mehrbrodt AuthorDate: Wed Apr 26 15:46:26 2023 +0200 Commit: Samuel Mehrbrodt CommitDate: Mon May 8 08:14:42 2023 +0200 tdf#95520 Autofilter: Sort by color Change-Id: I2c1455cc2c741d16f09eccee0bf489f8990684f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151064 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx index 63d83e2c0595..94817b862b3e 100644 --- a/sc/inc/sortparam.hxx +++ b/sc/inc/sortparam.hxx @@ -24,17 +24,26 @@ #include #include "address.hxx" +#include #include #include "scdllapi.h" struct ScSubTotalParam; struct ScQueryParam; +enum class ScColorSortMode { +None, +TextColor, +BackgroundColor +}; + struct ScSortKeyState { SCCOLROW nField; bool bDoSort; bool bAscending; +ScColorSortMode aColorSortMode; +ColoraColorSortColor; }; /** Struct to hold non-data extended area, used with diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 6c85b3d617da..cfc1eae6f7c2 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -43,6 +43,7 @@ #define SCSTR_FILTER_BACKGROUND_COLOR_COND NC_("STANDARDFILTERDIALOG_COND", "Background color") #define SCSTR_FILTER_NO_FILL NC_("SCSTR_FILTER_NO_FILL", "No Fill") #define SCSTR_FILTER_AUTOMATIC_COLOR NC_("SCSTR_FILTER_AUTOMATIC_COLOR", "Automatic") +#define SCSTR_SORT_COLORNC_("SCSTR_SORT_COLOR", "Sort by Color") #define SCSTR_NONAMENC_("SCSTR_NONAME", "unnamed") #define SCSTR_INSERT_RTLNC_("SCSTR_INSERT_RTL", "Shift cells left") // "%1 is replaced to column letter, such as 'Column A'" diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index cbce92da3998..a2cc60f9d70e 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -990,6 +990,9 @@ public: SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const; SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const; +Color GetCellBackgroundColor(ScAddress aPos) const; +Color GetCellTextColor(ScAddress aPos) const; + bool IsManualRowHeight(SCROW nRow) const; bool HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const; diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 8ffba26539a5..fbf46cc5d397 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -476,6 +476,7 @@ class AutofilterTest(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") diff --git a/sc/qa/uitest/autofilter2/tdf126306.py b/sc/qa/uitest/autofilter2/tdf126306.py index 51c099a3f3c2..2ebb3789bf8f 100644 --- a/sc/qa/uitest/autofilter2/tdf126306.py +++ b/sc/qa/uitest/autofilter2/tdf126306.py @@ -81,6 +81,7 @@ class tdf126306(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") @@ -107,6 +108,7 @@ class tdf126306(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.exec
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/drwlayer.hxx |5 sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods |binary sc/qa/unit/data/ods/tdf155093_double_names.ods|binary sc/qa/unit/scshapetest.cxx| 47 + sc/source/core/data/document.cxx | 23 sc/source/core/data/drwlayer.cxx | 444 -- sc/source/core/data/table7.cxx|8 7 files changed, 378 insertions(+), 149 deletions(-) New commits: commit dfb0d118f6b23730bc632885eb4703a37eeaec16 Author: Regina Henschel AuthorDate: Sat Apr 8 18:38:04 2023 +0200 Commit: Regina Henschel CommitDate: Sun May 7 10:57:04 2023 +0200 tdf#139083 Only resize if 'resize with cell' is set The copy&paste of ranges with shapes had the following further bugs: * For cell anchored shapes the position was taken from the source rectangle instead of the anchor. * Resizing was calculated from source and destination rectangle, but should only depend on size of object range. * tdf#125938 Shapes were moved without adapting the anchor. * tdf#155091 Source with filtered rows produced doubled objects in paste. * The CopyToClip method has a useless NbcMove(size(0,0)). NbcMove is a move 'by', not a move 'to'. * tdf#155093 Pasted object has same name as source object and thus is not accessible via Navigator. * tdf#155094 Transposed pasted objects have wrong position * tdf#155095 Objects over collapsed group are incorrectly resized * tdf#141437, tdf#141436 transposed objects have wrong size Only objects, which can really resize, are now resized. In case of transposing no objects are resized. Transposing would need to transpose the object geometry, but that is missing. The offset inside the start anchor cell is adapted to the size of the destination cell to keep the anchor in this cell. Object resizing considers that filtered rows are removed whereas collapsed or hidden rows are shown in pasted area. Object resizing does no longer use global factors but calculate the desired snap rectangle and fits the object into it. Change-Id: I42924b28a2d652d8b70cb8e1a1d7ca4324b09cf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150161 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index c127f597bab2..eea0b118b521 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -156,8 +156,9 @@ public: voidCopyToClip( ScDocument* pClipDoc, SCTAB nTab, const tools::Rectangle& rRange ); voidCopyFromClip( ScDrawLayer* pClipModel, -SCTAB nSourceTab, const tools::Rectangle& rSourceRange, -const ScAddress& rDestPos, const tools::Rectangle& rDestRange ); +SCTAB nSourceTab, const ScRange& rSourceRange, +const ScAddress& rDestPos, const ScRange& rDestRange, +bool bTransposing = false); voidSetPageSize(sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos, const ScObjectHandling eObjectHandling = ScObjectHandling::RecalcPosMode); diff --git a/sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods b/sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods new file mode 100644 index ..ea3b8908ede2 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods differ diff --git a/sc/qa/unit/data/ods/tdf155093_double_names.ods b/sc/qa/unit/data/ods/tdf155093_double_names.ods new file mode 100644 index ..6dd7a69554c4 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf155093_double_names.ods differ diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 814384effe83..6f9a39c8eafa 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -999,6 +999,53 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testLargeAnchorOffset) CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(aOldPos, aNewPos, 1); } +CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf139083_copy_without_resize) +{ +// Load a document, which has a shape anchored to cell B2, but without 'resize with cell'. +// When the range B2:B3 is copied and pasted to D5, then the copied shape should keep its size. +createScDoc("ods/tdf139083_copy_without_resize.ods"); + +// Get document +ScDocument* pDoc = getScDoc(); + +// Copy cells B2:B3. They have row height 2cm and column width 3cm. +goToCell("$B$2:$B$3"); +dispatchCommand(mxComponent, ".uno:Copy", {}); + +// Paste to D5. There are row height 0.5cm and column width 1cm. +goToCell("$D$5"); +dispatchCommand(mxComponent, ".uno:Paste", {}); + +// Make sure original and pasted shape have the same size. +
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/colorscale.hxx |2 + sc/qa/unit/ucalc_condformat.cxx| 50 + sc/source/core/data/colorscale.cxx | 18 + 3 files changed, 70 insertions(+) New commits: commit 3fa15dd614bd72ddb36dbe033abeef5609d31f38 Author: Tibor Nagy AuthorDate: Mon Apr 24 09:08:14 2023 +0200 Commit: Nagy Tibor CommitDate: Wed Apr 26 11:39:44 2023 +0200 tdf#154906 tdf#129813 tdf#129814 sc: fix conditional format color scale This is a follow up to commit 3f614f431475e1bf3bb3bbeac59b0681309628b7 (tdf#95295: don't add duplicate conditional formats) The above commit clearly describes how this fix works. Change-Id: I064fb3fe0443705553c6bbfcc34f2d717e0f6bd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150899 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index de74030dbc85..513eb11cf2f4 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -270,6 +270,8 @@ public: std::optional GetColor(const ScAddress& rAddr) const; void AddEntry(ScColorScaleEntry* pEntry); +bool IsEqual(const ScFormatEntry& r, bool bIgnoreSrcPos) const override; + virtual void UpdateReference( sc::RefUpdateContext& rCxt ) override; virtual void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) override; virtual void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) override; diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 811cd0d540d8..bfece1515a89 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -268,6 +268,56 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondFormatInsertDeleteSheets) m_pDoc->DeleteTab(0); } +CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste) +{ +m_pDoc->InsertTab(0, "Test"); + +auto pFormat = std::make_unique(1, m_pDoc); +ScRange aCondFormatRange(0, 0, 0, 2, 0, 0); +ScRangeList aRangeList(aCondFormatRange); +pFormat->SetRange(aRangeList); + +ScColorScaleFormat* pColorScaleFormat = new ScColorScaleFormat(m_pDoc); +ScColorScaleEntry* pEntryBlue = new ScColorScaleEntry(0, COL_BLUE); +ScColorScaleEntry* pEntryGreen = new ScColorScaleEntry(1, COL_GREEN); +ScColorScaleEntry* pEntryRed = new ScColorScaleEntry(2, COL_RED); +pColorScaleFormat->AddEntry(pEntryBlue); +pColorScaleFormat->AddEntry(pEntryGreen); +pColorScaleFormat->AddEntry(pEntryRed); + +pFormat->AddEntry(pColorScaleFormat); +sal_uLong nIndex = m_pDoc->AddCondFormat(std::move(pFormat), 0); + +ScDocument aClipDoc(SCDOCMODE_CLIP); +copyToClip(m_pDoc, aCondFormatRange, &aClipDoc); + +ScRange aTargetRange(0, 3, 0, 2, 3, 0); +pasteFromClip(m_pDoc, aTargetRange, &aClipDoc); + +// Pasting the same conditional format must modify existing format, making its range +// combined of previous range and newly pasted range having the conditional format. +// No new conditional formats must be created. +CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size()); +aRangeList.Join(aTargetRange); +for (SCCOL nCol = 0; nCol < 3; ++nCol) +{ +ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(nCol, 3, 0); +CPPUNIT_ASSERT(pPastedFormat); +CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange()); + +sal_uLong nPastedKey = pPastedFormat->GetKey(); +CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey); + +const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, ATTR_CONDITIONAL); +const ScCondFormatItem* pCondFormatItem = static_cast(pItem); +CPPUNIT_ASSERT(pCondFormatItem); +CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(nIndex), pCondFormatItem->GetCondFormatData().front()); +} + +m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPaste) { m_pDoc->InsertTab(0, "Test"); diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 0a357828c61e..192dd1cea78c 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -404,6 +404,24 @@ void ScColorScaleFormat::AddEntry( ScColorScaleEntry* pEntry ) maColorScales.back()->SetRepaintCallback(mpParent); } +bool ScColorScaleFormat::IsEqual(const ScFormatEntry& rOther, bool /*bIgnoreSrcPos*/) const +{ +if (GetType() != rOther.GetType()) +return false; + +const ScColorScaleFormat& r = static_cast(rOther); + +for (size_t i = 0; i < maColorScales.size(); ++i) +{ +if (!maColorScales[i]->GetColor().IsRGBEqual(r.maColorScales[i]->GetColor().GetRGBColor()) +|| maColorScales[i]->GetType() != r.maColorScales[i]->GetType() +|| maColorScales[i]->GetValue() != r.maColorScales[i]->GetValue()) +retu
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/postit.hxx |4 +++- sc/qa/unit/subsequent_filters_test4.cxx |8 +++- sc/source/core/data/postit.cxx | 14 ++ sc/source/filter/xml/xmlcelli.cxx |2 +- 4 files changed, 21 insertions(+), 7 deletions(-) New commits: commit 0ee9501c0b7dc1a291715fff9c1934b1c08cb654 Author: Maxim Monastirsky AuthorDate: Thu Apr 13 18:57:26 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Apr 18 01:57:24 2023 +0200 sc drawstyles: Assign the Note style to imported comments ... that don't have a style assignment. Typically in ods files created by older versions or by 3rd party. - For hidden comments this should make no difference, as we used to apply the default comment formatting as DF underneath their defined DF, just now we do that as a style assignment instead. - Same for comments from xlsx and xls files. - For visible comments from ods files created by OOo/LO, there should be no difference either, as such files typically include the shape formatting in them. - For visible comments from ods files created by Excel, there will be a difference, as Excel used to not include the full shape formatting (known to be the case with Excel 2007 and 2016; can't test any other version). This resulted with a weird look, e.g. a line instead of an arrow, a default blue fill color and too distant shadow, which clearly not how comments supposed to look. Moreover, the comment will turn to transparent after hiding or copying the cell, and will revert to the default look anyway with resaving. Given that we were already enforcing the default formatting for hidden comments and for foreign formats, I think it's reasonable to do that for visible comments too (and in general it's unclear to me why the ODF import treats visible comments differently than hidden ones). The main motivation of this change is to aid solving the shadow issue - see the next commits. Regarding the comment height change in the testCommentSize test: This does *not* mean there is a change in that comment's import. What this test does is to replace the existing comment with a new comment, and that use the default formatting instead of inheriting the formatting of the old one. But while the current default formatting is whatever defined in the Note style, the old default formatting was actually the draw pool defaults. This is because we used to apply the comment formatting as DF, and the relevant svx code (in SdrTextObj::NbcSetText) wasn't aware of the fact that part of the DF was considered as default in this case. Which means that this test was actually asserting a buggy behavior. Change-Id: I37723cce3c719ecaa9c57bef25bcb168e353c55c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150489 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 7da83a9ebea0..6b458ad41763 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -193,6 +193,8 @@ public: The underlying ScPostIt::ScNoteData::ScCaptionPtr takes managing ownership of the pointer. +@param bHasStyle Is there a drawing style set for the note. + @return Pointer to the new cell note object if insertion was successful (i.e. the passed cell position was valid), null otherwise. The Calc document is the owner of the note object. The @@ -201,7 +203,7 @@ public: */ static ScPostIt*CreateNoteFromCaption( ScDocument& rDoc, const ScAddress& rPos, -SdrCaptionObj* pCaption ); +SdrCaptionObj* pCaption, bool bHasStyle ); /** Creates a cell note based on the passed caption object data. diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index 06af93de19d9..c439a02c6582 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include #include @@ -1580,6 +1582,10 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCommentSize) SdrCaptionObj* pCaption = pNote->GetCaption(); CPPUNIT_ASSERT(pCaption); +// The values below depend on particular font and char size. +// At least assert that the corresponding style was set: +CPPUNIT_ASSERT_EQUAL(ScResId(STR_STYLENAME_NOTE), pCaption->GetStyleSheet()->GetName()); + const tools::Rectangle& rOldRect = pCaption->GetLogicRect(); CPPUNIT_ASSERT_EQUAL(tools::Long(2899), rOldRect.getOpenWidth()); CPPUNIT_ASSERT_EQUAL(tools::Long(939), rOldRect.getOpenHeight()); @@ -1588,7 +1594,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCommentSize) const tools::Rectangle& rNewRect = pCaption->GetLogic
[Libreoffice-commits] core.git: sc/inc sc/qa
sc/inc/global.hxx|3 ++- sc/qa/extras/macros-test.cxx | 37 + 2 files changed, 39 insertions(+), 1 deletion(-) New commits: commit e8de03a18ed8684ed94d93b09aa1662ba799e877 Author: Andreas Heinisch AuthorDate: Mon Apr 10 19:44:38 2023 +0200 Commit: Andreas Heinisch CommitDate: Wed Apr 12 11:36:39 2023 +0200 tdf#116127 - Add EDITATTR to ALL flags to check for valid function inputs Otherwise, the function clearcontents does not accept the EDITATTR flag as a valid input. Change-Id: I8381014da7110d060167a814d9ea02e347d5a92b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150191 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 1e42e6060d0e..fb5af9e3e451 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -165,7 +165,8 @@ enum class InsertDeleteFlags : sal_uInt16 FORGETCAPTIONS = 0x2000, /// Internal use only (d&d undo): do not delete caption objects of cell notes. ATTRIB = HARDATTR | STYLES, CONTENTS = VALUE | DATETIME | STRING | NOTE | FORMULA | OUTLINE | SPARKLINES, -ALL = CONTENTS | ATTRIB | OBJECTS | SPARKLINES, +// tdf#116127 - add EDITATTR to ALL flags in order to check for valid function inputs +ALL = CONTENTS | ATTRIB | OBJECTS | SPARKLINES | EDITATTR, /// Copy flags for auto/series fill functions: do not touch notes and drawing objects. AUTOFILL = ALL & ~(NOTE | OBJECTS) }; diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index ec41a2fbe4a9..caa788e7a1f6 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -911,6 +911,43 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf147122) CPPUNIT_ASSERT_EQUAL(Any(OUString("This is a test")), aRet); } +CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf116127) +{ +mxComponent = loadFromDesktop("private:factory/scalc"); + +css::uno::Reference xDocScr(mxComponent, UNO_QUERY_THROW); +auto xLibs = xDocScr->getBasicLibraries(); +auto xLibrary = xLibs->createLibrary("TestLibrary"); +xLibrary->insertByName( +"TestModule", +uno::Any(OUString( +"Function TestClearContents\n" +// Insert test string into cell A1 +" oActiveSheet = ThisComponent.CurrentController.ActiveSheet\n" +" oActiveCell = oActiveSheet.getCellRangeByName(\"A1\")\n" +" oActiveCell.setString(\"Italic Test\")\n" +// Create a text cursor and and change the first letter to italic +" oCursor = oActiveCell.Text.createTextCursor()\n" +" oCursor.gotoStart(False)\n" +" oCursor.goRight(1, True)\n" +" oCursor.CharPosture = com.sun.star.awt.FontSlant.ITALIC\n" +// Clear contents using EDITATTR cell flag to clear the italic char posture +" oActiveCell.clearContents(com.sun.star.sheet.CellFlags.EDITATTR)\n" +// Check the char posture of the first letter +" oCursor.gotoStart(False)\n" +" oCursor.goRight(1, True)\n" +" TestClearContents = oCursor.CharPosture <> com.sun.star.awt.FontSlant.ITALIC\n" +"End Function\n"))); + +Any aRet = executeMacro("vnd.sun.Star.script:TestLibrary.TestModule.TestClearContents?" +"language=Basic&location=document"); +// Without the fix in place, this test would have failed with +// - Expected : true +// - Actual : false +// i.e. the formatting within parts of the cell contents (EDITATTR) were not deleted +CPPUNIT_ASSERT_EQUAL(Any(true), aRet); +} + ScMacrosTest::ScMacrosTest() : UnoApiXmlTest("/sc/qa/extras/testdocuments") {
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source svx/source
sc/inc/postit.hxx |4 +- sc/qa/unit/subsequent_export_test4.cxx | 44 sc/source/core/data/postit.cxx | 23 +++- sc/source/filter/excel/xiescher.cxx |2 - sc/source/filter/xml/xmlcelli.cxx | 14 ++- svx/source/sdr/properties/captionproperties.cxx |5 ++ 6 files changed, 86 insertions(+), 6 deletions(-) New commits: commit 1e442e2c6800cf38e42749ac6644502cb3717bc3 Author: Maxim Monastirsky AuthorDate: Fri Mar 31 16:38:32 2023 +0300 Commit: Maxim Monastirsky CommitDate: Fri Apr 7 15:59:04 2023 +0200 sc drawstyles: Keep style assignment for comments Need to handle 3 cases: - Import of hidden comments (not too much useful by itself, as we still force the default comment formatting as DF). - Copying cells with comments. - The comment popup that is shown when hovering over a comment marker. Change-Id: Ibf2e22f1432745fe46f89da624ed3586b5d9fb55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149943 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 36473542e1df..7da83a9ebea0 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -216,6 +216,8 @@ public: formatting attributes of the caption object. This function takes ownership of the passed item set. +@param rStyleName Drawing style associated with the caption object. + @param rOutlinerObj An outliner object containing (formatted) text for the caption object. @@ -229,7 +231,7 @@ public: */ static ScPostIt*CreateNoteFromObjectData( ScDocument& rDoc, const ScAddress& rPos, -SfxItemSet&& oItemSet, +SfxItemSet&& oItemSet, const OUString& rStyleName, const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& rCaptionRect, bool bShown ); diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 275493f61387..9d6e38ef8a09 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #include #include @@ -1540,6 +1542,48 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles) } } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) +{ +createScDoc("ods/comment.ods"); + +{ +ScDocument* pDoc = getScDoc(); + +ScAddress aPos(0, 0, 0); +ScPostIt* pNote = pDoc->GetNote(aPos); +CPPUNIT_ASSERT(pNote); + +pNote->ShowCaption(aPos, true); +auto pCaption = pNote->GetCaption(); +CPPUNIT_ASSERT(pCaption); + +auto pStyleSheet = &pDoc->GetStyleSheetPool()->Make("MyStyle1", SfxStyleFamily::Frame); +pCaption->SetStyleSheet(static_cast(pStyleSheet), true); + +// Hidden comments use different code path on import +pNote->ShowCaption(aPos, false); +} + +saveAndReload("calc8"); + +{ +ScDocument aDoc; +aDoc.InitDrawLayer(); +aDoc.TransferTab(*getScDoc(), 0, 0); + +ScAddress aPos(0, 0, 0); +ScPostIt* pNote = aDoc.GetNote(aPos); +CPPUNIT_ASSERT(pNote); + +pNote->ShowCaption(aPos, true); +auto pCaption = pNote->GetCaption(); +CPPUNIT_ASSERT(pCaption); + +// Check that the style was imported, and survived copying +CPPUNIT_ASSERT_EQUAL(OUString("MyStyle1"), pCaption->GetStyleSheet()->GetName()); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 00aab1d52030..6da509043c12 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -89,9 +90,9 @@ void ScCaptionUtil::SetCaptionLayer( SdrCaptionObj& rCaption, bool bShown ) void ScCaptionUtil::SetBasicCaptionSettings( SdrCaptionObj& rCaption, bool bShown ) { -SetCaptionLayer( rCaption, bShown ); rCaption.SetFixedTail(); rCaption.SetSpecialTextBoxShadow(); +SetCaptionLayer( rCaption, bShown ); } void ScCaptionUtil::SetCaptionUserData( SdrCaptionObj& rCaption, const ScAddress& rPos ) @@ -458,6 +459,7 @@ struct ScCaptionInitData { std::optional< SfxItemSet > moItemSet; /// Caption object formatting. std::optional< OutlinerParaObject > mxOutlinerObj; /// Text object with all text portion formatting. +OUStringmaStyleName;/// Drawing style associated with the caption object. OUStringmaSimpleText;
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/chgtrack.hxx|1 + sc/inc/strings.hrc |1 + sc/qa/uitest/calc_tests4/trackedChanges.py | 28 ++-- sc/source/core/tool/chgtrack.cxx | 24 +++- 4 files changed, 35 insertions(+), 19 deletions(-) New commits: commit 7131530929d3670b8c2db7dc0c1a86c822e05660 Author: Xisco Fauli AuthorDate: Tue Mar 21 11:04:32 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Mar 22 07:26:40 2023 + tdf#154274: show "Unknown Author" when no name is set Same as in Writer Change-Id: I830ba9f34dc39424202110538ba4a7dbada1b06c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149206 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx index 24e4f653b165..9e3aed17aa55 100644 --- a/sc/inc/chgtrack.hxx +++ b/sc/inc/chgtrack.hxx @@ -966,6 +966,7 @@ public: bool IsInDeleteTop() const { return bInDeleteTop; } bool IsInDeleteUndo() const { return bInDeleteUndo; } bool IsInPasteCut() const { return bInPasteCut; } +void CreateAuthorName(); SC_DLLPUBLIC void SetUser( const OUString& rUser ); const OUString& GetUser() const { return maUser;} const std::set& GetUserCollection() const { return maUserCollection;} diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 24a40a41ef57..f7d33399faa2 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -202,6 +202,7 @@ #define STR_CHG_REJECTEDNC_("STR_CHG_REJECTED", "Rejected") #define STR_CHG_NO_ENTRYNC_("STR_CHG_NO_ENTRY", "No Entry") #define STR_CHG_EMPTY NC_("STR_CHG_EMPTY", "") +#define STR_CHG_UNKNOWN_AUTHOR NC_("STR_CHG_UNKNOWN_AUTHOR", "Unknown Author") #define STR_NOT_PROTECTED NC_("STR_NOT_PROTECTED", "Not protected") #define STR_NOT_PASS_PROTECTED NC_("STR_NOT_PASS_PROTECTED", "Not password-protected") diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py index 53306de0c88b..0f38f9f3042c 100644 --- a/sc/qa/uitest/calc_tests4/trackedChanges.py +++ b/sc/qa/uitest/calc_tests4/trackedChanges.py @@ -70,7 +70,7 @@ class CalcTrackedChanges(UITestCase): xChangesList = xTrackDlg.getChild("calcchanges") self.assertEqual(1, len(xChangesList.getChildren())) -textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") +textStart = "Changed contents\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") xChild = xChangesList.getChild('0') self.assertTrue(get_state_as_dict(xChild)["Text"].startswith(textStart)) @@ -78,11 +78,11 @@ class CalcTrackedChanges(UITestCase): xChild.executeAction("EXPAND", tuple()) self.assertEqual(3, len(xChild.getChildren())) -textStartChild1 = "\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") +textStartChild1 = "\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") textEndChild1 = "(Original: )" -textStartChild2 = "'Hello'\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") +textStartChild2 = "'Hello'\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") textEndChild2 = "(Changed to 'Hello')" -textStartChild3 = "'There'\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") +textStartChild3 = "'There'\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") textEndChild3 = "(Changed to 'There')" self.assertTrue(get_state_as_dict(xChild.getChild('0'))["Text"].startswith(textStartChild1)) @@ -113,7 +113,7 @@ class CalcTrackedChanges(UITestCase): xChangesList = xTrackDlg.getChild("calcchanges") self.assertEqual(1, len(xChangesList.getChildren())) -textStart = "Row deleted\t(Sheet1.1:1)\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") +textStart = "Row deleted\t(Sheet1.1:1)\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") textEnd = "(Row 1:1 deleted)" xChild = xChangesList.getChild('0') @@ -125,7 +125,7 @@ class CalcTrackedChanges(UITestCase): xChild.executeAction("EXPAND", tuple()) self.assertEqual(1, len(xChild.getChildren())) -textStartChild1 = "Changed contents\t(Sheet1.A1)\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") +textStartChild1 = "Changed contents\t(Sheet1.A1)\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y")
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |1 + sc/qa/unit/data/ods/tdf154005.ods |binary sc/qa/unit/scshapetest.cxx| 30 ++ sc/source/core/data/document.cxx |8 sc/source/core/data/drwlayer.cxx | 16 ++-- 5 files changed, 53 insertions(+), 2 deletions(-) New commits: commit 97a38dbfa998967c45efaf3303fedfa1a709a2bb Author: Balazs Varga AuthorDate: Sun Mar 12 17:49:53 2023 +0100 Commit: Thorsten Behrens CommitDate: Tue Mar 14 02:04:50 2023 + tdf#154005 sc ods fileopen: fix dropdown form control size Dropdown form control size was increased by the size of hidden rows or columns. Regression from commit: 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca (Improve 'resize with cell' handling) Change-Id: Ic903a488cab22286f95cfdf4ee559013fd7bfa02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148738 Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 09fcc126ed06..137b786e8c8b 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2036,6 +2036,7 @@ public: SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const; SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const; SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const; +SCCOL CountVisibleCols(SCROW nStartCol, SCROW nEndCol, SCTAB nTab) const; SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const; boolHasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const; diff --git a/sc/qa/unit/data/ods/tdf154005.ods b/sc/qa/unit/data/ods/tdf154005.ods new file mode 100644 index ..1349ec725869 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf154005.ods differ diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index dc60439a536f..c89189d892a9 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -57,6 +57,7 @@ public: void testTdf137576_LogicRectInNewMeasureline(); void testMeasurelineHideColSave(); void testHideColsShow(); +void testFormSizeWithHiddenCol(); void testTdf138138_MoveCellWithRotatedShape(); void testLoadVerticalFlip(); void testTdf117948_CollapseBeforeShape(); @@ -85,6 +86,7 @@ public: CPPUNIT_TEST(testTdf137576_LogicRectInNewMeasureline); CPPUNIT_TEST(testMeasurelineHideColSave); CPPUNIT_TEST(testHideColsShow); +CPPUNIT_TEST(testFormSizeWithHiddenCol); CPPUNIT_TEST(testTdf138138_MoveCellWithRotatedShape); CPPUNIT_TEST(testLoadVerticalFlip); CPPUNIT_TEST(testTdf117948_CollapseBeforeShape); @@ -759,6 +761,34 @@ void ScShapeTest::testHideColsShow() CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aSnapRectOrig, aSnapRectShow, 1); } +void ScShapeTest::testFormSizeWithHiddenCol() +{ +// The document contains a form (Listbox) shape anchored "To Cell (resize with cell)" with starts in cell B5 and +// ends in cell D5. The error was the form shape was resized if there was hidden col/row. + +createScDoc("tdf154005.ods"); + +// Get document and shape +ScDocument* pDoc = getScDoc(); +SdrUnoObj* pObj = static_cast(lcl_getSdrObjectWithAssert(*pDoc, 0)); + +// Check Position and Size +pDoc->SetDrawPageSize(0); // trigger recalcpos +tools::Rectangle aRect(2432, 3981, 4932, 4631); // expected snap rect from values in file +const tools::Rectangle& rShapeRect(pObj->GetSnapRect()); +CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aRect, rShapeRect, 1); + +// Check anchor +ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj); +CPPUNIT_ASSERT_MESSAGE("expected object meta data", pData); + +const OUString sActual("start col " + OUString::number(pData->maStart.Col()) + " row " + + OUString::number(pData->maStart.Row()) + " end col " + + OUString::number(pData->maEnd.Col()) + " row " + + OUString::number(pData->maEnd.Row())); +CPPUNIT_ASSERT_EQUAL(OUString("start col 1 row 4 end col 3 row 4"), sActual); +} + void ScShapeTest::testTdf138138_MoveCellWithRotatedShape() { // The document contains a 90deg rotated, cell-anchored rectangle in column D. Insert 2 columns diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index b53de471e776..eac0117f6994 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4563,6 +4563,14 @@ SCROW ScDocument::CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) c return maTabs[nTab]->CountVisibleRows(nStartRow, nEndRow); } +SCCOL ScDocument::CountVisibleCols(SCROW nStartCol, SCROW nEndCol, SCTAB nTab) const +{ +if (!Val
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/globstr.hrc |8 ++- sc/qa/uitest/calc_tests/calcSheetDelete.py |9 +-- sc/qa/uitest/calc_tests2/tdf114992.py |3 - sc/qa/uitest/range_name/tdf150307.py |3 - sc/source/ui/view/tabvwshf.cxx | 71 ++--- 5 files changed, 66 insertions(+), 28 deletions(-) New commits: commit 41b991ea0cf3f8ce36cbdbf16b9c2c6d2bb16b5d Author: Laurent Balland AuthorDate: Mon Feb 20 08:46:23 2023 +0100 Commit: Laurent Balland CommitDate: Mon Feb 27 09:43:03 2023 + tdf#153709 Adapt message for Delete Sheet When deleting sheets, the message is adapted to the count of selected sheets (singular or plural). The confirmation message is skipped if selected sheets are empty The message for pivot table data losing is replaced by regular confirmation message if both pivot table and data are selected Update UItests when there is no more confirmation Change-Id: I5cbd6d7cbe271ad86c5c68820b23df5a2307f3bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147309 Reviewed-by: Eike Rathke Tested-by: Jenkins Reviewed-by: Laurent Balland diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 19e99d1c47d0..95f7138c81c9 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -268,7 +268,9 @@ #define STR_OPTIONALNC_("STR_OPTIONAL", "(optional)") #define STR_REQUIREDNC_("STR_REQUIRED", "(required)") #define STR_NOTES NC_("STR_NOTES", "Comments") -#define STR_QUERY_DELTABNC_("STR_QUERY_DELTAB", "Are you sure you want to delete the selected sheet(s)?") +/* %d will be replaced by the number of selected sheets + e.g. Are you sure you want to delete the 3 selected sheets? */ +#define STR_QUERY_DELTABNNC_("STR_QUERY_DELTAB", "Are you sure you want to delete the selected sheet?", "Are you sure you want to delete the %d selected sheets?") #define STR_QUERY_DELSCENARIO NC_("STR_QUERY_DELSCENARIO", "Are you sure you want to delete the selected scenario?") #define STR_EXPORT_ASCIINC_("STR_EXPORT_ASCII", "Export Text File") #define STR_IMPORT_LOTUSNC_("STR_IMPORT_LOTUS", "Import Lotus files") @@ -533,7 +535,9 @@ #define STR_FRACTIONNC_("STR_FRACTION", "Fraction") #define STR_BOOLEAN_VALUE NC_("STR_BOOLEAN_VALUE", "Boolean Value") #define STR_TEXTNC_("STR_TEXT", "Text") -#define STR_QUERY_PIVOTTABLE_DELTAB NC_("STR_QUERY_PIVOTTABLE_DELTAB", "The selected sheet(s) contain source data of related pivot tables that will be lost. Are you sure you want to delete the selected sheet(s)?") +/* %d will be replaced by the number of selected sheets +e.g. The 3 selected sheets contain source data of related pivot tables that will be lost. */ +#define STR_QUERY_PIVOTTABLE_DELTAB NNC_("STR_QUERY_PIVOTTABLE_DELTAB", "The selected sheet contains source data of related pivot tables that will be lost.", "The %d selected sheets contain source data of related pivot tables that will be lost.") #define STR_ERR_NAME_INVALID_CELL_REF NC_("STR_ERR_NAME_INVALID_CELL_REF", "Invalid name. Reference to a cell, or a range of cells not allowed.") #define STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK NC_("STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK", "External content disabled.") #define STR_TEXTORIENTANGLE NC_("STR_TEXTORIENTANGLE", "Text orientation angle") diff --git a/sc/qa/uitest/calc_tests/calcSheetDelete.py b/sc/qa/uitest/calc_tests/calcSheetDelete.py index 3e9da3f516d4..380d6766943e 100644 --- a/sc/qa/uitest/calc_tests/calcSheetDelete.py +++ b/sc/qa/uitest/calc_tests/calcSheetDelete.py @@ -28,8 +28,7 @@ class calcSheetDelete(UITestCase): self.assertEqual(document.Sheets.getCount(), nrSheets + 1) -with self.ui_test.execute_dialog_through_command(".uno:Remove", close_button="yes"): -pass +self.xUITest.executeCommand(".uno:Remove") xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') xToolkit.processEventsToIdle() @@ -85,8 +84,7 @@ class calcSheetDelete(UITestCase): self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet i = i + 1 -with self.ui_test.execute_dialog_through_command(".uno:Remove", close_button="yes"): -pass +self.xUITest.executeCommand(".uno:Remove") xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') xToolkit.processEventsToIdle() @@ -115,8 +113,7 @@ class calcSheetDelete(UITestCase): self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select
[Libreoffice-commits] core.git: sc/inc sc/qa sc/uiconfig
sc/inc/globstr.hrc |4 ++-- sc/qa/uitest/pageFormat/tdf123508.py |6 +++--- sc/uiconfig/scalc/ui/sheetprintpage.ui |4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) New commits: commit c4f5d456e5801843f00a43afd9c0fa43c412d265 Author: Bogdan B AuthorDate: Tue Nov 1 21:50:57 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Wed Nov 2 11:13:22 2022 +0100 tdf#134882 Change label in the dialog: 'fit' is replaced with 'shrink' ...because shrink is the only effect of this option to the text. Change-Id: I63783c05ac92803a6de6581d858590904a9e8275 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142138 Reviewed-by: Adolfo Jayme Barrientos Tested-by: Adolfo Jayme Barrientos diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index edabc014d7bf..9aaf84c8af7a 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -330,8 +330,8 @@ #define STR_SCATTR_PAGE_PRINTDIR NC_("STR_SCATTR_PAGE_PRINTDIR", "Print direction") #define STR_SCATTR_PAGE_FIRSTPAGENO NC_("STR_SCATTR_PAGE_FIRSTPAGENO", "First page number") #define STR_SCATTR_PAGE_SCALE NC_("STR_SCATTR_PAGE_SCALE", "Reduce/enlarge printout") -#define STR_SCATTR_PAGE_SCALETOPAGES NC_("STR_SCATTR_PAGE_SCALETOPAGES", "Fit print range(s) on number of pages") -#define STR_SCATTR_PAGE_SCALETO NC_("STR_SCATTR_PAGE_SCALETO", "Fit print range(s) to width/height") +#define STR_SCATTR_PAGE_SCALETOPAGES NC_("STR_SCATTR_PAGE_SCALETOPAGES", "Shrink print range(s) on number of pages") +#define STR_SCATTR_PAGE_SCALETO NC_("STR_SCATTR_PAGE_SCALETO", "Shrink print range(s) to width/height") #define STR_SCATTR_PAGE_SCALE_WIDTH NC_("STR_SCATTR_PAGE_SCALE_WIDTH", "Width") #define STR_SCATTR_PAGE_SCALE_HEIGHT NC_("STR_SCATTR_PAGE_SCALE_HEIGHT", "Height") #define STR_SCATTR_PAGE_SCALE_PAGES NNC_("STR_SCATTR_PAGE_SCALE_PAGES", "One page", "%1 pages") diff --git a/sc/qa/uitest/pageFormat/tdf123508.py b/sc/qa/uitest/pageFormat/tdf123508.py index 041e375a7478..7e1f7e987b45 100644 --- a/sc/qa/uitest/pageFormat/tdf123508.py +++ b/sc/qa/uitest/pageFormat/tdf123508.py @@ -23,8 +23,8 @@ class tdf123508(UITestCase): scalingMode = xDialog.getChild("comboLB_SCALEMODE") spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") -#select "Fit print range(s) to width/height" from the scale mode drop-down list -select_by_text(scalingMode, "Fit print range(s) to width/height") +#select "Shrink print range(s) to width/height" from the scale mode drop-down list +select_by_text(scalingMode, "Shrink print range(s) to width/height") #define a value for the page, e.g.: width 2; height 2 spinEDSCALEPAGEWIDTH.executeAction("UP", tuple()) spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple()) @@ -38,7 +38,7 @@ class tdf123508(UITestCase): spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") - self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Fit print range(s) to width/height") + self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Shrink print range(s) to width/height") self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2") self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2") diff --git a/sc/uiconfig/scalc/ui/sheetprintpage.ui b/sc/uiconfig/scalc/ui/sheetprintpage.ui index 41ee7c089d2d..082457ba5747 100644 --- a/sc/uiconfig/scalc/ui/sheetprintpage.ui +++ b/sc/uiconfig/scalc/ui/sheetprintpage.ui @@ -642,8 +642,8 @@ False Reduce/enlarge printout - Fit print range(s) to width/height - Fit print range(s) on number of pages + Shrink print range(s) to width/height + Shrink print range(s) on number of pages
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/address.hxx |2 sc/inc/docuno.hxx |2 sc/inc/global.hxx |2 sc/inc/rangeutl.hxx| 20 ++--- sc/inc/scmod.hxx |2 sc/inc/validat.hxx |2 sc/qa/unit/uicalc/uicalc.cxx | 84 - sc/source/core/data/dpobject.cxx | 26 +++ sc/source/core/data/dptabres.cxx |4 - sc/source/core/data/global.cxx |4 - sc/source/core/data/validat.cxx|4 - sc/source/core/opencl/formulagroupcl.cxx |8 +- sc/source/core/tool/address.cxx|4 - sc/source/core/tool/compiler.cxx | 10 +- sc/source/core/tool/interpr1.cxx |6 - sc/source/core/tool/rangeutl.cxx | 30 sc/source/filter/excel/excel.cxx |6 - sc/source/filter/excel/xepivot.cxx |4 - sc/source/filter/excel/xeroot.cxx |6 - sc/source/filter/excel/xihelper.cxx| 10 +- sc/source/filter/inc/addressconverter.hxx | 12 +-- sc/source/filter/inc/drawingfragment.hxx |2 sc/source/filter/inc/formulaparser.hxx |4 - sc/source/filter/inc/numberformatsbuffer.hxx |4 - sc/source/filter/inc/richstring.hxx|4 - sc/source/filter/inc/stylesbuffer.hxx |2 sc/source/filter/inc/xeroot.hxx|2 sc/source/filter/inc/xihelper.hxx |2 sc/source/filter/oox/addressconverter.cxx | 45 ++--- sc/source/filter/oox/defnamesbuffer.cxx|7 +- sc/source/filter/oox/drawingfragment.cxx | 24 +++ sc/source/filter/oox/formulaparser.cxx | 20 ++--- sc/source/filter/oox/numberformatsbuffer.cxx | 35 +- sc/source/filter/oox/pagesettings.cxx | 18 ++--- sc/source/filter/oox/richstring.cxx| 16 ++-- sc/source/filter/oox/stylesbuffer.cxx |4 - sc/source/filter/oox/worksheetfragment.cxx |6 - sc/source/filter/xml/XMLStylesExportHelper.cxx |8 +- sc/source/filter/xml/XMLStylesExportHelper.hxx |4 - sc/source/filter/xml/XMLTableShapeResizer.cxx |4 - sc/source/filter/xml/XMLTableShapeResizer.hxx |2 sc/source/filter/xml/celltextparacontext.cxx |6 - sc/source/filter/xml/celltextparacontext.hxx |2 sc/source/filter/xml/xmlcelli.cxx |4 - sc/source/filter/xml/xmlcelli.hxx |2 sc/source/filter/xml/xmlimprt.cxx | 14 ++-- sc/source/filter/xml/xmlimprt.hxx |4 - sc/source/filter/xml/xmlsorti.cxx |8 +- sc/source/filter/xml/xmlsorti.hxx |2 sc/source/ui/app/inputhdl.cxx | 18 ++--- sc/source/ui/app/scmod.cxx |4 - sc/source/ui/inc/inputhdl.hxx |2 sc/source/ui/inc/tpformula.hxx |2 sc/source/ui/optdlg/tpformula.cxx |6 - sc/source/ui/pagedlg/areasdlg.cxx | 19 ++--- sc/source/ui/uitest/uiobject.cxx |8 +- sc/source/ui/unoobj/docuno.cxx |2 57 files changed, 286 insertions(+), 278 deletions(-) New commits: commit ce6babf777882d78dbf322de74f321354ac7b351 Author: Noel Grandin AuthorDate: Thu Oct 6 08:57:27 2022 +0200 Commit: Noel Grandin CommitDate: Thu Oct 6 13:03:03 2022 +0200 use more string_view in sc Change-Id: Ic7126ac57f8cc06b37f3098603f0710602f0ab28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140998 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index c3171c8f8a84..85a581f5c765 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -973,6 +973,6 @@ inline OUString ScColToAlpha( SCCOL nCol ) } /// get column number of A..IV... string -bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, const OUString& rStr); +bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, std::u16string_view rStr); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 420975ace5d7..cb1fd2049bb5 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -519,7 +519,7 @@ private: SCCOL nEndCol; rtl::Reference GetObjectByIndex_Impl(sal_Int32 nIndex) const; -rtl::Reference GetObjectByName_Impl(const OUString& aName) const; +rtl::Reference GetObjectByName_Impl(std::u16string_view aName) const; public: ScTableColumnsObj(ScDocShell* pDocSh, SCTAB nT, diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 3be19f89dcc1..1e42e6060d0e 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -642,7 +642,7 @@ public: bool bForceSep = false
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/stringutil.hxx |2 +- sc/qa/unit/ucalc.cxx|4 ++-- sc/source/core/data/column3.cxx | 22 +- sc/source/ui/view/tabvwsha.cxx | 17 + 4 files changed, 17 insertions(+), 28 deletions(-) New commits: commit 939724fe6abd16015dbef6c476f7f57a2dc466d8 Author: Eike Rathke AuthorDate: Wed Sep 14 15:01:47 2022 +0200 Commit: Eike Rathke CommitDate: Wed Sep 14 21:44:32 2022 +0200 Related: tdf#149665 Unify input of a leading ' apostrophe in non-Text cell If a cell is not formatted as Text and ScSetStringParam::mbHandleApostrophe is true, all input (except one single apostrophe that otherwise would lead to an empty cell string) now is treated the same and the leading apostrophe is removed and the remainder is set as text content. The Input Line and editing a cell get an apostrophe prepended for the cases needed to generate such escaped string again. This made it necessary to adapt a unit test that exactly checked the old behaviour. Change-Id: I07b35d33f3704970784dc6de1322bda28903bb97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139934 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx index 150a3ede269e..b2b58f60fc5a 100644 --- a/sc/inc/stringutil.hxx +++ b/sc/inc/stringutil.hxx @@ -84,7 +84,7 @@ struct SAL_WARN_UNUSED SC_DLLPUBLIC ScSetStringParam /** * When true, treat input with a leading apostrophe as an escape character - * for a numeric value content, to treat the numeric value as a text. When + * for all content, to treat also numeric value as a text. When * false, the whole string input including the leading apostrophe will be * entered literally as string. */ diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 87ab1c55155e..a63519f41224 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -626,8 +626,8 @@ void Test::testInput() CPPUNIT_ASSERT_MESSAGE("String number should have the first apostrophe stripped.", bTest); m_pDoc->SetString(0, 0, 0, "'apple'"); test = m_pDoc->GetString(0, 0, 0); -bTest = test == "'apple'"; -CPPUNIT_ASSERT_MESSAGE("Text content should have retained the first apostrophe.", bTest); +bTest = test == "apple'"; +CPPUNIT_ASSERT_MESSAGE("Text content should have the first apostrophe stripped.", bTest); // Customized string handling policy. ScSetStringParam aParam; diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index e144a0334036..d92318134098 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2125,32 +2125,20 @@ bool ScColumn::ParseString( } else if ( cFirstChar == '\'') // 'Text { -bool bNumeric = false; if (aParam.mbHandleApostrophe) { // Cell format is not 'Text', and the first char is an apostrophe. -// Check if the input is considered a number with all leading -// apostrophes removed. All because ''1 should produce '1 not ''1, -// thus '''1 be ''1 and so on. +// Strip it and set text content. // NOTE: this corresponds with sc/source/ui/view/tabvwsha.cxx // ScTabViewShell::UpdateInputHandler() prepending an apostrophe if // necessary. -sal_Int32 i = 1; -while (i < rString.getLength() && rString[i] == '\'') -++i; -if (i < rString.getLength()) -{ -OUString aTest = rString.copy(i); -double fTest; -bNumeric = aParam.mpNumFormatter->IsNumberFormat(aTest, nIndex, fTest); -if (bNumeric) -// This is a number. Strip out the first apostrophe. -rCell.set(rPool.intern(rString.copy(1))); -} +rCell.set(rPool.intern(rString.copy(1))); } -if (!bNumeric) +else +{ // This is normal text. Take it as-is. rCell.set(rPool.intern(rString)); +} } else { diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index dc389eb70723..9e86e5319de9 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -722,19 +722,20 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt aString = ScCellFormat::GetInputString( rCell, nNumFmt, *pFormatter, rDoc ); if (rCell.getType() == CELLTYPE_STRING) { -sal_Int32 i = 0; -while (i < aString.getLength() && aString[i] == '\'') -++i; -OUString aTest((i && i < aString.getLength()) ? aString.copy(i) : aString); // Put a ' in front if necessary, so that the s
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/dociter.hxx |4 ++-- sc/qa/unit/ucalc.cxx |2 +- sc/source/core/data/dociter.cxx | 18 +- sc/source/core/tool/interpr1.cxx | 14 +++--- sc/source/core/tool/interpr2.cxx |4 ++-- sc/source/core/tool/interpr3.cxx | 16 sc/source/core/tool/interpr5.cxx |4 ++-- sc/source/core/tool/interpr6.cxx |2 +- 8 files changed, 32 insertions(+), 32 deletions(-) New commits: commit 5f5f2f8107b6176654bfb9a30c21b7d5e0c62c6f Author: Eike Rathke AuthorDate: Sun Sep 11 00:46:58 2022 +0200 Commit: Eike Rathke CommitDate: Sun Sep 11 11:31:30 2022 +0200 ScValueIterator ScDocument& parameter is now superfluous Since commit 3be1cdce9d92cbadca1b276b3193c727032ea717 ScInterpreterContext is passed that has it. Just a minor change for a const ScDocument&. Change-Id: I388ff55393056c52f85d7543fcfb6c549fc2a346 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139759 Tested-by: Eike Rathke Reviewed-by: Eike Rathke diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index c8b51b9e24ff..b73d175a000f 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -52,7 +52,7 @@ class ScValueIterator// walk through all values in an area { typedef sc::CellStoreType::const_position_type PositionType; -ScDocument& mrDoc; +const ScDocument& mrDoc; ScInterpreterContext& mrContext; const ScAttrArray* pAttrArray; sal_uInt32 nNumFormat; // for CalcAsShown @@ -84,7 +84,7 @@ class ScValueIterator// walk through all values in an area public: ScValueIterator(ScInterpreterContext& rContext, -ScDocument& rDocument, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE, +const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE, bool bTextAsZero = false ); void GetCurNumFmtInfo( SvNumFormatType& nType, sal_uInt32& nIndex ); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 0b21003a56c8..87ab1c55155e 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1345,7 +1345,7 @@ void Test::testValueIterator() { const double aChecks[] = { 1.0, 2.0, 3.0 }; size_t const nCheckLen = SAL_N_ELEMENTS(aChecks); -ScValueIterator aIter(aContext, *m_pDoc, ScRange(1,2,0,3,2,0)); +ScValueIterator aIter(aContext, ScRange(1,2,0,3,2,0)); bool bHas = false; size_t nCheckPos = 0; double fVal; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 0fb2fec32673..123d96d91b8c 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -82,9 +82,9 @@ static void ScAttrArray_IterGetNumberFormat( sal_uInt32& nFormat, const ScAttrAr nAttrEndRow = nRowEnd; } -ScValueIterator::ScValueIterator(ScInterpreterContext& rContext, ScDocument& rDocument, const ScRange& rRange, +ScValueIterator::ScValueIterator(ScInterpreterContext& rContext, const ScRange& rRange, SubtotalFlags nSubTotalFlags, bool bTextZero ) -: mrDoc(rDocument) +: mrDoc(*rContext.mpDoc) , mrContext(rContext) , pAttrArray(nullptr) , nNumFormat(0) // Initialized in GetNumberFormat @@ -97,16 +97,16 @@ ScValueIterator::ScValueIterator(ScInterpreterContext& rContext, ScDocument& rDo , mnSubTotalFlags(nSubTotalFlags) , nNumFmtType(SvNumFormatType::UNDEFINED) , bNumValid(false) -, bCalcAsShown(rDocument.GetDocOptions().IsCalcAsShown()) +, bCalcAsShown((*rContext.mpDoc).GetDocOptions().IsCalcAsShown()) , bTextAsZero(bTextZero) , mpCells(nullptr) { -SCTAB nDocMaxTab = rDocument.GetTableCount() - 1; +SCTAB nDocMaxTab = mrDoc.GetTableCount() - 1; -if (!rDocument.ValidCol(maStartPos.Col())) maStartPos.SetCol(mrDoc.MaxCol()); -if (!rDocument.ValidCol(maEndPos.Col())) maEndPos.SetCol(mrDoc.MaxCol()); -if (!rDocument.ValidRow(maStartPos.Row())) maStartPos.SetRow(mrDoc.MaxRow()); -if (!rDocument.ValidRow(maEndPos.Row())) maEndPos.SetRow(mrDoc.MaxRow()); +if (!mrDoc.ValidCol(maStartPos.Col())) maStartPos.SetCol(mrDoc.MaxCol()); +if (!mrDoc.ValidCol(maEndPos.Col())) maEndPos.SetCol(mrDoc.MaxCol()); +if (!mrDoc.ValidRow(maStartPos.Row())) maStartPos.SetRow(mrDoc.MaxRow()); +if (!mrDoc.ValidRow(maEndPos.Row())) maEndPos.SetRow(mrDoc.MaxRow()); if (!ValidTab(maStartPos.Tab()) || maStartPos.Tab() > nDocMaxTab) maStartPos.SetTab(nDocMaxTab); if (!ValidTab(maEndPos.Tab()) || maEndPos.Tab() > nDocMaxTab) maEndPos.SetTab(nDocMaxTab); } @@ -272,7 +272,7 @@ bool ScValueIterator::GetFirst(double& rValue, FormulaError& rErr) mnCol = maStartPos.Col(); mnTab = maStartPos.Tab(); -ScTable* pTab = mrDoc.FetchTable(mnTab); +const ScTable* pTab = mrDoc.FetchTable(mnTab); if (!pTab) return false; diff --git a/sc/source/core/tool/interpr1.cxx b/sc/sour
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/dociter.hxx |6 ++ sc/qa/unit/ucalc.cxx |4 +++- sc/source/core/data/dociter.cxx |8 sc/source/core/tool/interpr1.cxx | 16 +++- sc/source/core/tool/interpr2.cxx |4 ++-- sc/source/core/tool/interpr3.cxx | 17 - sc/source/core/tool/interpr5.cxx |4 ++-- sc/source/core/tool/interpr6.cxx |3 +-- 8 files changed, 29 insertions(+), 33 deletions(-) New commits: commit 3be1cdce9d92cbadca1b276b3193c727032ea717 Author: Caolán McNamara AuthorDate: Thu Sep 8 10:26:01 2022 +0100 Commit: Caolán McNamara CommitDate: Fri Sep 9 20:55:43 2022 +0200 always pass ScInterpreterContext to ScValueIterator its available at every call site Change-Id: I764962d1d2330c414e02ed215b4a0c5be2979145 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139637 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index ff58a4181e12..55a2040f1d1b 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -53,7 +53,7 @@ class ScValueIterator// walk through all values in an area typedef sc::CellStoreType::const_position_type PositionType; ScDocument& mrDoc; -ScInterpreterContext* pContext; +ScInterpreterContext& mrContext; const ScAttrArray* pAttrArray; sal_uInt32 nNumFormat; // for CalcAsShown sal_uInt32 nNumFmtIndex; @@ -83,7 +83,7 @@ class ScValueIterator// walk through all values in an area public: -ScValueIterator( +ScValueIterator(ScInterpreterContext& rContext, ScDocument& rDocument, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE, bool bTextAsZero = false ); @@ -94,8 +94,6 @@ public: /// Does NOT reset rValue if no value found! bool GetNext( double& rValue, FormulaError& rErr ); - -void SetInterpreterContext( ScInterpreterContext* context ) { pContext = context; } }; class ScDBQueryDataIterator diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 03cd8adfdbc8..0b21003a56c8 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1336,6 +1336,8 @@ void Test::testValueIterator() aOpt.SetCalcAsShown(true); m_pDoc->SetDocOptions(aOpt); +ScInterpreterContext aContext(*m_pDoc, m_pDoc->GetFormatTable()); + // Purely horizontal data layout with numeric data. for (SCCOL i = 1; i <= 3; ++i) m_pDoc->SetValue(ScAddress(i,2,0), i); @@ -1343,7 +1345,7 @@ void Test::testValueIterator() { const double aChecks[] = { 1.0, 2.0, 3.0 }; size_t const nCheckLen = SAL_N_ELEMENTS(aChecks); -ScValueIterator aIter(*m_pDoc, ScRange(1,2,0,3,2,0)); +ScValueIterator aIter(aContext, *m_pDoc, ScRange(1,2,0,3,2,0)); bool bHas = false; size_t nCheckPos = 0; double fVal; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 2c64a22e9011..97d40d82fd98 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -82,10 +82,10 @@ static void ScAttrArray_IterGetNumberFormat( sal_uInt32& nFormat, const ScAttrAr nAttrEndRow = nRowEnd; } -ScValueIterator::ScValueIterator( ScDocument& rDocument, const ScRange& rRange, +ScValueIterator::ScValueIterator(ScInterpreterContext& rContext, ScDocument& rDocument, const ScRange& rRange, SubtotalFlags nSubTotalFlags, bool bTextZero ) : mrDoc(rDocument) -, pContext(nullptr) +, mrContext(rContext) , pAttrArray(nullptr) , nNumFormat(0) // Initialized in GetNumberFormat , nNumFmtIndex(0) @@ -194,8 +194,8 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr) if (bCalcAsShown) { ScAttrArray_IterGetNumberFormat(nNumFormat, pAttrArray, -nAttrEndRow, pCol->pAttrArray.get(), nCurRow, mrDoc, pContext); -rValue = mrDoc.RoundValueAsShown(rValue, nNumFormat, pContext); +nAttrEndRow, pCol->pAttrArray.get(), nCurRow, mrDoc, &mrContext); +rValue = mrDoc.RoundValueAsShown(rValue, nNumFormat, &mrContext); } return true; // Found it! } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 9eb660386e97..8a7a0ac0093b 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1314,7 +1314,7 @@ void ScInterpreter::ScAnd() { double fVal; FormulaError nErr = FormulaError::NONE; -ScValueIterator aValIter( mrDoc, aRange ); +ScValueIterator aValIter( mrContext, mrDoc, aRange ); if ( aValIter.GetFirst( fVal, nErr ) && nErr == FormulaError::NONE ) {
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |4 ++-- sc/inc/undorangename.hxx |8 sc/qa/unit/ucalc_sharedformula.cxx|4 ++-- sc/source/core/data/documen3.cxx | 14 ++ sc/source/core/data/document10.cxx|8 +++- sc/source/ui/docshell/docfunc.cxx |2 +- sc/source/ui/inc/docfunc.hxx |2 +- sc/source/ui/inc/namedlg.hxx |7 +++ sc/source/ui/inc/namemgrtable.hxx |4 ++-- sc/source/ui/inc/namepast.hxx |2 +- sc/source/ui/inc/tabvwsh.hxx |2 +- sc/source/ui/namedlg/namedlg.cxx | 10 +- sc/source/ui/namedlg/namemgrtable.cxx | 14 +++--- sc/source/ui/namedlg/namepast.cxx |2 +- sc/source/ui/undo/undorangename.cxx |8 sc/source/ui/view/tabvwshc.cxx|4 ++-- 16 files changed, 45 insertions(+), 50 deletions(-) New commits: commit 70cab065b4bfc2e68838b0056c52741eab8e32de Author: Noel Grandin AuthorDate: Thu Sep 1 20:51:22 2022 +0200 Commit: Noel Grandin CommitDate: Fri Sep 2 11:23:51 2022 +0200 no need to use unique_ptr for this map in sc::ScRangeName map is already a node based data structure, so the values will stay in the same place in memory Change-Id: I774368091ace3775d9d63b3ed561e323ad3adb9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139236 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 41b7d71a63e7..1767f8c4e5f0 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -662,7 +662,7 @@ public: * non-empty range name set. */ SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const; -SC_DLLPUBLIC void SetAllRangeNames(const std::map>& rRangeMap); +SC_DLLPUBLIC void SetAllRangeNames(const std::map& rRangeMap); SC_DLLPUBLIC void GetRangeNameMap(std::map& rRangeName); SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const; SC_DLLPUBLIC ScRangeName* GetRangeName() const; @@ -774,7 +774,7 @@ public: /** * Call this immediately before updating all named ranges. */ -SC_DLLPUBLIC void PreprocessAllRangeNamesUpdate( const std::map>& rRangeMap ); +SC_DLLPUBLIC void PreprocessAllRangeNamesUpdate( const std::map& rRangeMap ); SC_DLLPUBLIC void PreprocessRangeNameUpdate(); SC_DLLPUBLIC void PreprocessDBDataUpdate(); /** diff --git a/sc/inc/undorangename.hxx b/sc/inc/undorangename.hxx index f09ced1417af..cbe1a2a1e544 100644 --- a/sc/inc/undorangename.hxx +++ b/sc/inc/undorangename.hxx @@ -23,7 +23,7 @@ class ScUndoAllRangeNames final : public ScSimpleUndo { public: ScUndoAllRangeNames(ScDocShell* pDocSh, const std::map& rOldNames, -const std::map>& rNewNames); +const std::map& rNewNames); virtual ~ScUndoAllRangeNames() override; @@ -34,11 +34,11 @@ public: virtual OUString GetComment() const override; private: -void DoChange(const std::map>& rNames); +void DoChange(const std::map& rNames); private: -std::map> m_OldNames; -std::map> m_NewNames; +std::map m_OldNames; +std::map m_NewNames; }; class ScUndoAddRangeData final : public ScSimpleUndo diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index e670af33f1fc..254269bf9716 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1685,10 +1685,10 @@ void TestSharedFormula::testSharedFormulaUpdateOnNamedRangeChange() CPPUNIT_ASSERT_EQUAL(static_cast(1), pNames->size()); ScDocFunc& rFunc = m_xDocShell->GetDocFunc(); -typedef std::map> NameMapType; +typedef std::map NameMapType; NameMapType aNewNames; OUString aScope(STR_GLOBAL_RANGE_NAME); -aNewNames.insert(std::make_pair(aScope, std::move(pNames))); +aNewNames.insert(std::make_pair(aScope, std::move(*pNames))); rFunc.ModifyAllRangeNames(aNewNames); // Check to make sure all displayed formulas are still good. diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index ecc93881c0bf..c0b6984008b7 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -126,27 +126,25 @@ void ScDocument::GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rNames) const rNames.swap(aNames); } -void ScDocument::SetAllRangeNames(const std::map>& rRangeMap) +void ScDocument::SetAllRangeNames(const std::map& rRangeMap) { -for (const auto& [rName, rxRangeName] : rRangeMap) +for (const auto& [rName, rRangeName] : rRangeMap) { if (rName == STR_GLOBAL_RANGE_NAME) { pRangeName.reset(); -const ScRangeName *const pName = rxRangeName.get(); -if (!pName->empty()) -pRangeName.reset( new ScRangeName( *pName ) ); +if (!rRangeN
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |2 +- sc/inc/fmtuno.hxx |2 +- sc/qa/unit/subsequent_filters_test.cxx |4 ++-- sc/qa/unit/subsequent_filters_test2.cxx |2 +- sc/qa/unit/ucalc_formula.cxx|2 +- sc/source/core/data/documen4.cxx|2 +- sc/source/core/data/patattr.cxx |4 ++-- sc/source/core/tool/detfunc.cxx |2 +- sc/source/filter/excel/xicontent.cxx|2 +- sc/source/filter/xml/xmlcelli.cxx |2 +- sc/source/ui/unoobj/cellsuno.cxx|2 +- sc/source/ui/unoobj/fmtuno.cxx |2 +- sc/source/ui/view/cellsh2.cxx |2 +- sc/source/ui/view/gridwin.cxx |2 +- sc/source/ui/view/viewfun2.cxx |2 +- 15 files changed, 17 insertions(+), 17 deletions(-) New commits: commit e3e49d07e2feebcec631eed98bea5e3f6f6ab572 Author: Noel Grandin AuthorDate: Sat Aug 27 08:46:31 2022 +0200 Commit: Noel Grandin CommitDate: Sat Aug 27 13:09:24 2022 +0200 sal_uLong->sal_uInt32 in ValidationEntry we are already using sal_uInt32 in various places, and passing this through SfxUInt32Item Change-Id: Iea06b59edc56632b823729462516a6b5fb74e28a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138917 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 4dab1da8158b..41b7d71a63e7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1867,7 +1867,7 @@ public: voidSetCondFormList( ScConditionalFormatList* pList, SCTAB nTab ); SC_DLLPUBLIC sal_uLong AddValidationEntry( const ScValidationData& rNew ); -SC_DLLPUBLIC const ScValidationData*GetValidationEntry( sal_uLong nIndex ) const; +SC_DLLPUBLIC const ScValidationData*GetValidationEntry( sal_uInt32 nIndex ) const; SC_DLLPUBLIC ScConditionalFormatList* GetCondFormList( SCTAB nTab ) const; diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx index 75d4c099ca55..81d1532381ea 100644 --- a/sc/inc/fmtuno.hxx +++ b/sc/inc/fmtuno.hxx @@ -189,7 +189,7 @@ private: public: ScTableValidationObj() = delete; -ScTableValidationObj(const ScDocument& rDoc, sal_uLong nKey, +ScTableValidationObj(const ScDocument& rDoc, sal_uInt32 nKey, const formula::FormulaGrammar::Grammar eGrammar); virtual ~ScTableValidationObj() override; diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index 62c0cfb98c8a..9149d4379db4 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -1413,12 +1413,12 @@ struct ValDataTestParams OUString aErrorTitle; OUString aErrorMessage; ScValidErrorStyle eErrorStyle; -sal_uLong nExpectedIndex; +sal_uInt32 nExpectedIndex; ValDataTestParams( ScValidationMode eMode, ScConditionMode eOp, const OUString& aExpr1, const OUString& aExpr2, ScDocument& rDoc, const ScAddress& aPos, const OUString& aETitle, const OUString& aEMsg, - ScValidErrorStyle eEStyle, sal_uLong nIndex ): + ScValidErrorStyle eEStyle, sal_uInt32 nIndex ): eValMode(eMode), eCondOp(eOp), aStrVal1(aExpr1), aStrVal2(aExpr2), rDocument(rDoc), aPosition(aPos), aErrorTitle(aETitle), aErrorMessage(aEMsg), diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 8f747f5aff03..782b3a2c497e 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -1252,7 +1252,7 @@ void checkValidationFormula(const ScAddress& rPos, const ScDocument& rDoc, { const SfxUInt32Item* pItem = rDoc.GetAttr(rPos, ATTR_VALIDDATA); CPPUNIT_ASSERT(pItem); -sal_uLong nKey = pItem->GetValue(); +sal_uInt32 nKey = pItem->GetValue(); const ScValidationData* pData = rDoc.GetValidationEntry(nKey); CPPUNIT_ASSERT(pData); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 480c009b13dc..7463f1a23f57 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -4626,7 +4626,7 @@ void TestFormula::testFormulaRefUpdateValidity() SC_VALID_LIST, ScConditionMode::Equal, "C2:C4", "", *m_pDoc, ScAddress(0,1,0), "", "", m_pDoc->GetGrammar(), m_pDoc->GetGrammar()); -sal_uLong nIndex = m_pDoc->AddValidationEntry(aData); +sal_uInt32 nIndex = m_pDoc->AddValidationEntry(aData); SfxUInt32Item aItem(ATTR_VALIDDATA, nIndex); ScPatternAttr aNewAttrs( diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 9aa39d66ca94..e7945b773d9d 100644 --
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |6 +- sc/qa/extras/anchor.cxx |1 sc/qa/unit/SparklineTest.cxx |1 sc/qa/unit/copy_paste_test.cxx |1 sc/qa/unit/filters-test.cxx |1 sc/qa/unit/subsequent_filters_test.cxx |1 sc/qa/unit/tiledrendering/tiledrendering.cxx | 70 +-- sc/qa/unit/ucalc.cxx |1 sc/qa/unit/ucalc_condformat.cxx |1 sc/qa/unit/ucalc_formula.cxx |1 sc/qa/unit/ucalc_sharedformula.cxx |1 sc/qa/unit/ucalc_sort.cxx|1 sc/source/core/data/document.cxx |5 + sc/source/ui/docshell/docsh.cxx |1 sc/source/ui/inc/undocell.hxx|2 sc/source/ui/inc/undomanager.hxx | 45 + sc/source/ui/undo/undobase.cxx | 66 + sc/source/ui/view/tabvwshb.cxx | 26 -- 18 files changed, 218 insertions(+), 13 deletions(-) New commits: commit 640a6488a32e8f682788feb6cab01acfffca7fa7 Author: Noel Grandin AuthorDate: Thu Jul 28 19:06:59 2022 +0200 Commit: Noel Grandin CommitDate: Sat Jul 30 09:02:07 2022 +0200 sc: allow undo of typing in 2 views independent from each other This commit follows the same pattern as commit c72e500ccaf0ce2261c5233b80fba9342778f810 sw: allow undo of typing in 2 views independent from each other with some changes since calc and writer have different undo/redo infrastructure on top of SfxUndoManager. Change-Id: Ib6e7e21caccb94752c01c529b5013553dba8b4f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137579 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 959960e15e03..7866b5a3cf9c 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -184,7 +184,7 @@ class ScLookupCache; struct ScLookupCacheMap; class ScSortedRangeCache; struct ScSortedRangeCacheMap; -class SfxUndoManager; +class ScUndoManager; class ScFormulaParserPool; struct ScClipParam; class ScRowBreakIterator; @@ -364,7 +364,7 @@ private: ScCalcConfigmaCalcConfig; -SfxUndoManager* mpUndoManager; +ScUndoManager* mpUndoManager; std::unique_ptr mpEditEngine; // uses pEditPool from xPoolHelper std::unique_ptr mpNoteEngine; // uses pEditPool from xPoolHelper SfxObjectShell* mpShell; @@ -2531,7 +2531,7 @@ public: void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar ); formula::FormulaGrammar::Grammar GetStorageGrammar() const { return eStorageGrammar; } -SC_DLLPUBLIC SfxUndoManager* GetUndoManager(); +SC_DLLPUBLIC ScUndoManager* GetUndoManager(); bool IsInVBAMode() const; ScRowBreakIterator* GetRowBreakIterator(SCTAB nTab) const; diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx index 347da5ec950f..1e9aa498c67d 100644 --- a/sc/qa/extras/anchor.cxx +++ b/sc/qa/extras/anchor.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include diff --git a/sc/qa/unit/SparklineTest.cxx b/sc/qa/unit/SparklineTest.cxx index ee104ef56356..f22dfa84b76f 100644 --- a/sc/qa/unit/SparklineTest.cxx +++ b/sc/qa/unit/SparklineTest.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index bcdce8eaa5f8..456622c3db9c 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 44aadbbba7b7..55e845417d07 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index 1dea49286b1a..a8adde706f0a 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 73288fd565bc..f8498fae1b95 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -52,6 +52,7 @@ #include #include #include +#include using namespace css; @@ -127,6 +128,7 @@ public: void testTextBoxInsert(); void testCommentCellCopyPaste(); void testInvalidEntrySave(); +void testUndoReordering(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testR
[Libreoffice-commits] core.git: sc/inc sc/qa sc/uiconfig
sc/inc/strings.hrc |4 +--- sc/qa/uitest/autofilter/colorfilter.py |4 ++-- sc/uiconfig/scalc/ui/filtersubdropdown.ui|2 +- sc/uiconfig/scalc/ui/standardfilterdialog.ui |8 4 files changed, 8 insertions(+), 10 deletions(-) New commits: commit 126067992d7a2b3edc5dd6ce5e896343da537589 Author: Gabor Kelemen AuthorDate: Thu Jul 14 19:05:34 2022 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 15 10:29:38 2022 +0200 tdf#148248 Text Color -> Font Color in AutoFilter/Standard Filter Consistently with other places such as Formatting toolbar and Format Cells -> Font Effects tab page Change-Id: I7ec5733f01182b25b5d823a43a3639b21ee874e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137087 Tested-by: Jenkins Reviewed-by: Gabor Kelemen diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 5e9c82592e68..9f9dfb454502 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -38,10 +38,8 @@ #define SCSTR_FILTER_NOTEMPTY NC_("SCSTR_FILTER_NOTEMPTY", "Not Empty") #define SCSTR_FILTER_COLOR NC_("SCSTR_FILTER_COLOR", "Filter by Color") #define SCSTR_FILTER_CONDITION NC_("SCSTR_FILTER_CONDITION", "Filter by Condition") -#define SCSTR_FILTER_TEXT_COLOR NC_("SCSTR_FILTER_TEXT_COLOR", "Text Color") -#define SCSTR_FILTER_BACKGROUND_COLOR NC_("SCSTR_FILTER_BACKGROUND_COLOR", "Background Color") // This must match the translation of the same strings of standardfilterdialog|cond -#define SCSTR_FILTER_TEXT_COLOR_COND NC_("STANDARDFILTERDIALOG_COND", "Text color") +#define SCSTR_FILTER_TEXT_COLOR_COND NC_("STANDARDFILTERDIALOG_COND", "Font color") #define SCSTR_FILTER_BACKGROUND_COLOR_COND NC_("STANDARDFILTERDIALOG_COND", "Background color") #define SCSTR_FILTER_NO_FILL NC_("SCSTR_FILTER_NO_FILL", "No Fill") #define SCSTR_FILTER_AUTOMATIC_COLOR NC_("SCSTR_FILTER_AUTOMATIC_COLOR", "Automatic") diff --git a/sc/qa/uitest/autofilter/colorfilter.py b/sc/qa/uitest/autofilter/colorfilter.py index 58f39227ee3d..967b17e36d6a 100644 --- a/sc/qa/uitest/autofilter/colorfilter.py +++ b/sc/qa/uitest/autofilter/colorfilter.py @@ -36,9 +36,9 @@ class ColorFilterTest(UITestCase): xCond1 = xDialog.getChild("cond1") # tdf#143103: Without the fix in place, this test would have failed with -# AssertionError: 'Text color' != '' +# AssertionError: 'Font color' != '' self.assertEqual("Text color", get_state_as_dict(xField1)['DisplayText']) -self.assertEqual("Text color", get_state_as_dict(xCond1)['DisplayText']) +self.assertEqual("Font color", get_state_as_dict(xCond1)['DisplayText']) xColor1 = xDialog.getChild("color1") diff --git a/sc/uiconfig/scalc/ui/filtersubdropdown.ui b/sc/uiconfig/scalc/ui/filtersubdropdown.ui index d2e3c4a01dd9..e76388f95124 100644 --- a/sc/uiconfig/scalc/ui/filtersubdropdown.ui +++ b/sc/uiconfig/scalc/ui/filtersubdropdown.ui @@ -202,7 +202,7 @@ -Text Color +Font Color diff --git a/sc/uiconfig/scalc/ui/standardfilterdialog.ui b/sc/uiconfig/scalc/ui/standardfilterdialog.ui index 359273e11ff7..bfa9c1e668c7 100644 --- a/sc/uiconfig/scalc/ui/standardfilterdialog.ui +++ b/sc/uiconfig/scalc/ui/standardfilterdialog.ui @@ -430,7 +430,7 @@ Does not begin with Ends with Does not end with - Text color + Font color Background color @@ -469,7 +469,7 @@ Does not begin with Ends with Does not end with - Text color + Font color Background color @@ -508,7 +508,7 @@ Does not begin with Ends with Does not end with - Text color + Font color Background color @@ -547,7 +547,7 @@ Does not begin with Ends with Does not end wi
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/queryevaluator.hxx| 16 sc/inc/queryiter.hxx | 10 sc/inc/rangecache.hxx| 26 sc/qa/unit/data/functions/statistical/fods/countif.fods | 191 sc/qa/unit/data/functions/statistical/fods/countif2.fods | 3157 +++ sc/source/core/data/queryevaluator.cxx | 57 sc/source/core/data/queryiter.cxx| 37 sc/source/core/tool/interpr1.cxx |8 sc/source/core/tool/rangecache.cxx | 69 9 files changed, 3411 insertions(+), 160 deletions(-) New commits: commit 423f277cc0c185ff7eaf79aa9237585c52e0c652 Author: Luboš Luňák AuthorDate: Fri Jun 24 13:52:46 2022 +0200 Commit: Luboš Luňák CommitDate: Sun Jun 26 20:27:19 2022 +0200 fix ByValue lookups with ScSortedRangeCache My fix for tdf#149071 actually disabled the optimization for all ByValue lookups, because in fact all such lookups have maString set. So lookups where the cells are a mix of numeric and string values need different handling. A simple solution is detecting such a mix when collecting the values for ScSortedRangeCache and disabling the optimization in such a case. But it turns out that queries containing such a mix are not that rare, as documents may e.g. do COUNTIF($C:$C) where the given column has numeric values that start with a textual header. So bail out only if the string cell actually could affect the numeric query. Also fix ScSortedRangeCache usage depending on query parameters, different instances are needed for e.g. different ScQueryOp, because the ScQueryEvaluator functions may return different results (isQueryByString() is automatically true for SC_EQUAL). Change-Id: Ib4565cbf6194e7c525c4d10d00b1c31707952a79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136403 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/queryevaluator.hxx b/sc/inc/queryevaluator.hxx index 13e3f6ae93c8..f5724083444d 100644 --- a/sc/inc/queryevaluator.hxx +++ b/sc/inc/queryevaluator.hxx @@ -72,10 +72,10 @@ class ScQueryEvaluator std::vector> mCachedSortedItemValues; std::vector> mCachedSortedItemStrings; -static bool isPartialTextMatchOp(const ScQueryEntry& rEntry); -static bool isTextMatchOp(const ScQueryEntry& rEntry); -static bool isMatchWholeCellHelper(bool docMatchWholeCell, const ScQueryEntry& rEntry); -bool isMatchWholeCell(const ScQueryEntry& rEntry) const; +static bool isPartialTextMatchOp(ScQueryOp eOp); +static bool isTextMatchOp(ScQueryOp eOp); +static bool isMatchWholeCellHelper(bool docMatchWholeCell, ScQueryOp eOp); +bool isMatchWholeCell(ScQueryOp eOp) const; void setupTransliteratorIfNeeded(); void setupCollatorIfNeeded(); @@ -114,13 +114,13 @@ public: bool ValidQuery(SCROW nRow, const ScRefCellValue* pCell = nullptr, sc::TableColumnBlockPositionSet* pBlockPos = nullptr); -static bool isQueryByValue(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, +static bool isQueryByValue(ScQueryOp eOp, ScQueryEntry::QueryType eType, const ScRefCellValue& rCell); -static bool isQueryByString(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, +static bool isQueryByString(ScQueryOp eOp, ScQueryEntry::QueryType eType, const ScRefCellValue& rCell); -OUString getCellString(const ScRefCellValue& rCell, SCROW nRow, const ScQueryEntry& rEntry, +OUString getCellString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol, const svl::SharedString** sharedString); -static bool isMatchWholeCell(const ScDocument& rDoc, const ScQueryEntry& rEntry); +static bool isMatchWholeCell(const ScDocument& rDoc, ScQueryOp eOp); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/queryiter.hxx b/sc/inc/queryiter.hxx index fa8f08083981..1d0066de7fb8 100644 --- a/sc/inc/queryiter.hxx +++ b/sc/inc/queryiter.hxx @@ -323,8 +323,9 @@ public: SCTAB nTable, const ScQueryParam& aParam, bool bMod) : Base( rDocument, rContext, nTable, aParam, bMod ) {} // Returns true if this iterator can be used for the given query. -static bool CanBeUsed(const ScDocument& rDoc, const ScQueryParam& aParam, -const ScFormulaCell* cell, const ScComplexRefData* refData); +static bool CanBeUsed(ScDocument& rDoc, const ScQueryParam& aParam, +SCTAB nTab, const ScFormulaCell* cell, const ScComplexRefData* refData, +ScInterpreterContext& context); }; @@ -372,8 +373,9 @@ public: SCTAB nTable, const ScQueryParam& aParam, bool bMod) : Base( rDocument, rContext, nTable, aParam, bMod ) {} // Returns true if this iterator can be used for the given query. -stati
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/cellvalue.hxx |2 ++ sc/qa/unit/ucalc_sharedformula.cxx |2 +- sc/source/core/data/column3.cxx|2 +- sc/source/core/data/column4.cxx|4 ++-- sc/source/core/data/conditio.cxx |2 +- sc/source/core/data/dociter.cxx|2 +- sc/source/core/data/documen8.cxx |4 ++-- sc/source/core/data/documentimport.cxx |4 ++-- sc/source/core/data/table3.cxx |6 +++--- sc/source/core/data/table4.cxx |4 ++-- sc/source/core/data/validat.cxx|2 +- sc/source/core/tool/cellform.cxx |2 +- sc/source/core/tool/chgtrack.cxx |4 ++-- sc/source/filter/excel/xetable.cxx |2 +- sc/source/filter/xcl97/XclExpChangeTrack.cxx |2 +- sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |4 ++-- sc/source/ui/docshell/docsh.cxx|4 ++-- sc/source/ui/undo/undocell.cxx |2 +- sc/source/ui/view/spellcheckcontext.cxx|6 +++--- sc/source/ui/view/tabvwsh5.cxx |2 +- 20 files changed, 32 insertions(+), 30 deletions(-) New commits: commit 12b817140641a94ebb3ef8271c5e955eb80e56f2 Author: Noel Grandin AuthorDate: Thu Jun 16 17:57:37 2022 +0200 Commit: Noel Grandin CommitDate: Fri Jun 17 15:59:42 2022 +0200 create getter for ScCellValue::mpString so we can assert that it has the correct tag type Change-Id: I8933919aefc2bb22694a283b54dc3de11d16e5a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136002 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 9513fcfc99d5..643889e2c154 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -63,6 +63,7 @@ public: CellType getType() const { return meType; } double getDouble() const { assert(meType == CELLTYPE_VALUE); return mfValue1; } +svl::SharedString* getSharedString() const { assert(meType == CELLTYPE_STRING); return mpString; } /** * Take cell value from specified position in specified document. @@ -134,6 +135,7 @@ public: CellType getType() const { return meType; } double getDouble() const { assert(meType == CELLTYPE_VALUE); return mfValue1; } +const svl::SharedString* getSharedString() const { assert(meType == CELLTYPE_STRING); return mpString; } /** * Take cell value from specified position in specified document. diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 64f248c91cf8..69f3e3be3d42 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -284,7 +284,7 @@ void TestSharedFormula::testSharedFormulas() ScCellValue aCell(svl::SharedString("Test")); CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a string value.", CELLTYPE_STRING, aCell.getType()); aCell.commit(*m_pDoc, aPos); -CPPUNIT_ASSERT_EQUAL(aCell.mpString->getString(), m_pDoc->GetString(aPos)); +CPPUNIT_ASSERT_EQUAL(aCell.getSharedString()->getString(), m_pDoc->GetString(aPos)); aPos.SetRow(16); pFC = m_pDoc->GetFormulaCell(aPos); CPPUNIT_ASSERT(pFC); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index e8a14b75b498..7586b000768d 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2885,7 +2885,7 @@ public: rColumn.SetValue(aBlockPos, r.mnRow, r.maValue.getDouble(), false); break; case CELLTYPE_STRING: -rColumn.SetRawString(aBlockPos, r.mnRow, *r.maValue.mpString, false); +rColumn.SetRawString(aBlockPos, r.mnRow, *r.maValue.getSharedString(), false); break; default: ; diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 7861ed5ce55e..6c710d9ed22e 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -291,8 +291,8 @@ void ScColumn::CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1, // same document. If not, re-intern shared strings. svl::SharedStringPool* pSharedStringPool = (bSameDocPool ? nullptr : &rDocument.GetSharedStringPool()); svl::SharedString aStr = (pSharedStringPool ? -pSharedStringPool->intern( rSrcCell.mpString->getString()) : -*rSrcCell.mpString); +pSharedStringPool->intern( rSrcCell.getSharedString()-> getString()) : +*rSrcCell.getSharedString()); std::vector aStrs(nDestSize, aStr);
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/cellvalue.hxx |6 + sc/qa/unit/subsequent_filters_test.cxx |4 - sc/source/core/data/cellvalue.cxx | 52 - sc/source/core/data/column3.cxx|4 - sc/source/core/data/column4.cxx|2 sc/source/core/data/conditio.cxx |2 sc/source/core/data/dociter.cxx|6 - sc/source/core/data/document.cxx |2 sc/source/core/data/documentimport.cxx |4 - sc/source/core/data/queryevaluator.cxx |4 - sc/source/core/data/queryiter.cxx |2 sc/source/core/data/table3.cxx |2 sc/source/core/data/table4.cxx | 36 +-- sc/source/core/data/validat.cxx|2 sc/source/core/tool/cellform.cxx |4 - sc/source/core/tool/chgtrack.cxx |6 - sc/source/core/tool/interpr4.cxx | 10 +-- sc/source/filter/excel/xetable.cxx |2 sc/source/filter/html/htmlexp.cxx |2 sc/source/filter/xcl97/XclExpChangeTrack.cxx |2 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |2 sc/source/filter/xml/xmlexprt.cxx |6 - sc/source/ui/docshell/externalrefmgr.cxx |4 - sc/source/ui/undo/undocell.cxx |2 sc/source/ui/view/output2.cxx |2 sc/source/ui/view/tabvwsh5.cxx |2 26 files changed, 87 insertions(+), 85 deletions(-) New commits: commit c2518134a55658218c924b43b5c87e4fbdaed1d4 Author: Noel Grandin AuthorDate: Thu Jun 16 16:29:18 2022 +0200 Commit: Noel Grandin CommitDate: Thu Jun 16 20:39:23 2022 +0200 create getter for ScCellValue::mfValue so we can assert that has the correct tag type Change-Id: I0d626130cb014e19239e88a6988018c83d061f68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136001 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 942cf006cab5..9513fcfc99d5 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -38,7 +38,7 @@ private: CellType meType; public: union { -double mfValue; +double mfValue1; svl::SharedString* mpString; EditTextObject* mpEditText; ScFormulaCell* mpFormula; @@ -62,6 +62,7 @@ public: void set( ScFormulaCell* pFormula ); CellType getType() const { return meType; } +double getDouble() const { assert(meType == CELLTYPE_VALUE); return mfValue1; } /** * Take cell value from specified position in specified document. @@ -111,7 +112,7 @@ private: CellType meType; public: union { -double mfValue; +double mfValue1; const svl::SharedString* mpString; const EditTextObject* mpEditText; ScFormulaCell* mpFormula; @@ -132,6 +133,7 @@ public: void clear(); CellType getType() const { return meType; } +double getDouble() const { assert(meType == CELLTYPE_VALUE); return mfValue1; } /** * Take cell value from specified position in specified document. diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index c1dd83f791a2..cb61bdd5a08a 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -552,7 +552,7 @@ void ScFiltersTest::testDeleteCircleInMergedCellODS() aMergedCell.assign(rDoc, aPosMergedCell); // The value of merged cell change to 6. -aMergedCell.mfValue = 6; +aMergedCell = ScRefCellValue(6); // Check that the data is valid.(True if the value = 6) const ScValidationData* pData = rDoc.GetValidationEntry(1); @@ -584,7 +584,7 @@ void ScFiltersTest::testBasicCellContentODS() aCell.assign(rDoc, ScAddress(1,4,0)); // B5 CPPUNIT_ASSERT_EQUAL_MESSAGE( "This cell must be numeric.", CELLTYPE_VALUE, aCell.getType()); -CPPUNIT_ASSERT_EQUAL(0.0, aCell.mfValue); +CPPUNIT_ASSERT_EQUAL(0.0, aCell.getDouble()); xDocSh->DoClose(); } diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index c565e0a488d6..cfc879802446 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -92,7 +92,7 @@ bool equalsWithoutFormatImpl( const T& left, const T& right ) case CELLTYPE_NONE: return true; case CELLTYPE_VALUE: -return left.mfValue == right.mfValue; +return left.getDouble() == right.getDouble(); case CELLTYPE_STRING: { OUString aStr1 = getString(left); @@ -118,7 +118,7 @@ void commitToColumn( const ScCellValue& rCell, ScCo
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/cellvalue.hxx |9 +++ sc/inc/dociter.hxx |2 sc/qa/unit/subsequent_export_test.cxx |6 +- sc/qa/unit/subsequent_filters_test.cxx |2 sc/qa/unit/ucalc.cxx |8 +-- sc/qa/unit/ucalc_sharedformula.cxx |2 sc/source/core/data/attarray.cxx |2 sc/source/core/data/cellvalue.cxx | 22 sc/source/core/data/clipcontext.cxx|2 sc/source/core/data/column.cxx | 17 +- sc/source/core/data/column2.cxx| 14 ++--- sc/source/core/data/column3.cxx| 12 ++-- sc/source/core/data/column4.cxx|4 - sc/source/core/data/conditio.cxx |6 +- sc/source/core/data/dociter.cxx| 21 +++- sc/source/core/data/documen8.cxx |8 +-- sc/source/core/data/document.cxx |2 sc/source/core/data/documentimport.cxx |4 - sc/source/core/data/fillinfo.cxx |2 sc/source/core/data/queryevaluator.cxx | 17 +++--- sc/source/core/data/queryiter.cxx |4 - sc/source/core/data/table2.cxx |4 - sc/source/core/data/table3.cxx |6 +- sc/source/core/data/table4.cxx | 44 - sc/source/core/data/table5.cxx |4 - sc/source/core/data/table6.cxx |2 sc/source/core/data/validat.cxx|8 +-- sc/source/core/tool/cellform.cxx |6 +- sc/source/core/tool/chartarr.cxx |2 sc/source/core/tool/chgtrack.cxx | 29 +-- sc/source/core/tool/detfunc.cxx|6 +- sc/source/core/tool/interpr1.cxx | 26 +- sc/source/core/tool/interpr4.cxx | 26 +- sc/source/core/tool/interpr5.cxx |6 +- sc/source/core/tool/interpr6.cxx |2 sc/source/core/tool/rangeseq.cxx |2 sc/source/filter/dif/difexp.cxx|2 sc/source/filter/excel/xetable.cxx |2 sc/source/filter/excel/xicontent.cxx |4 - sc/source/filter/html/htmlexp.cxx |6 +- sc/source/filter/oox/worksheethelper.cxx |2 sc/source/filter/rtf/rtfexp.cxx|2 sc/source/filter/xcl97/XclExpChangeTrack.cxx |4 - sc/source/filter/xcl97/XclImpChangeTrack.cxx | 15 + sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 12 ++-- sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |8 +-- sc/source/filter/xml/XMLExportIterator.cxx |4 - sc/source/filter/xml/XMLTrackedChangesContext.cxx |9 +-- sc/source/filter/xml/xmlcelli.cxx |6 +- sc/source/filter/xml/xmlexprt.cxx | 10 +-- sc/source/ui/Accessibility/AccessibleCell.cxx |2 sc/source/ui/app/transobj.cxx |2 sc/source/ui/docshell/docsh.cxx|4 - sc/source/ui/docshell/docsh3.cxx |2 sc/source/ui/docshell/docsh8.cxx |4 - sc/source/ui/docshell/externalrefmgr.cxx |6 +- sc/source/ui/docshell/impex.cxx|4 - sc/source/ui/undo/undocell.cxx |2 sc/source/ui/unoobj/cellsuno.cxx | 14 ++--- sc/source/ui/unoobj/chart2uno.cxx |2 sc/source/ui/unoobj/textuno.cxx|2 sc/source/ui/view/cellsh1.cxx |2 sc/source/ui/view/gridwin.cxx | 16 +++--- sc/source/ui/view/output.cxx |4 - sc/source/ui/view/output2.cxx | 30 +-- sc/source/ui/view/spellcheckcontext.cxx|8 +-- sc/source/ui/view/spelleng.cxx |2 sc/source/ui/view/tabvwsh.cxx |2 sc/source/ui/view/tabvwsh5.cxx |2 sc/source/ui/view/tabvwsha.cxx |6 +- sc/source/ui/view/viewfun2.cxx |2 sc/source/ui/view/viewfun4.cxx |6 +- sc/source/ui/view/viewfunc.cxx |2 73 files changed, 269 insertions(+), 282 deletions(-) New commits: commit 3d2e26d8b7a99d0a622741ef4327e8cbc93bbe02 Author: Noel Grandin AuthorDate
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |8 +- sc/inc/prnsave.hxx | 13 ++- sc/inc/table.hxx | 12 +-- sc/qa/unit/subsequent_filters_test2.cxx |2 sc/source/core/data/document.cxx | 16 ++-- sc/source/core/data/table1.cxx | 64 +-- sc/source/core/tool/prnsave.cxx | 17 + sc/source/filter/excel/impop.cxx |4 - sc/source/filter/excel/xename.cxx| 12 +-- sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 12 +-- sc/source/ui/docshell/docsh4.cxx | 22 +++--- sc/source/ui/pagedlg/areasdlg.cxx| 24 +++ sc/source/ui/unoobj/cellsuno.cxx | 37 +- sc/source/ui/view/printfun.cxx | 16 ++-- sc/source/ui/view/viewfun2.cxx |8 +- 15 files changed, 129 insertions(+), 138 deletions(-) New commits: commit dabd26614ddf73a2fb382e7a105c8c11c88741d9 Author: Noel Grandin AuthorDate: Tue May 31 15:47:38 2022 +0200 Commit: Noel Grandin CommitDate: Wed Jun 1 18:12:09 2022 +0200 pass ScRange around by value it's a very small object, and trivially movable. No need to allocate it separately Change-Id: I0adf947433e73a425f39004297c450a93ac4e5f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135216 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index a2bacddee3a3..7bd27c6b95fa 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2102,8 +2102,8 @@ public: SC_DLLPUBLIC bool HasPrintRange(); SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount( SCTAB nTab ); SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, sal_uInt16 nPos ); -SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab ); -SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab ); +SC_DLLPUBLIC std::optional GetRepeatColRange( SCTAB nTab ); +SC_DLLPUBLIC std::optional GetRepeatRowRange( SCTAB nTab ); /** Returns true, if the specified sheet is always printed. */ boolIsPrintEntireSheet( SCTAB nTab ) const; @@ -2113,8 +2113,8 @@ public: SC_DLLPUBLIC voidAddPrintRange( SCTAB nTab, const ScRange& rNew ); /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */ SC_DLLPUBLIC voidSetPrintEntireSheet( SCTAB nTab ); -SC_DLLPUBLIC voidSetRepeatColRange( SCTAB nTab, std::unique_ptr pNew ); -SC_DLLPUBLIC voidSetRepeatRowRange( SCTAB nTab, std::unique_ptr pNew ); +SC_DLLPUBLIC voidSetRepeatColRange( SCTAB nTab, std::optional oNew ); +SC_DLLPUBLIC voidSetRepeatRowRange( SCTAB nTab, std::optional oNew ); std::unique_ptr CreatePrintRangeSaver() const; void RestorePrintRanges( const ScPrintRangeSaver& rSaver ); diff --git a/sc/inc/prnsave.hxx b/sc/inc/prnsave.hxx index af2824b40cf8..9d10b430d4c6 100644 --- a/sc/inc/prnsave.hxx +++ b/sc/inc/prnsave.hxx @@ -20,8 +20,9 @@ #pragma once #include "address.hxx" -#include +#include #include +#include namespace tools { class JsonWriter; } @@ -30,8 +31,8 @@ class ScPrintSaverTab typedef ::std::vector< ScRange > ScRangeVec; ScRangeVec maPrintRanges; ///< Array -std::unique_ptr mpRepeatCol;///< single -std::unique_ptr mpRepeatRow;///< single +std::optional moRepeatCol;///< single +std::optional moRepeatRow;///< single boolmbEntireSheet; public: @@ -39,12 +40,12 @@ public: ~ScPrintSaverTab(); voidSetAreas( ScRangeVec&& rRanges, bool bEntireSheet ); -voidSetRepeat( const ScRange* pCol, const ScRange* pRow ); +voidSetRepeat( std::optional oCol, std::optional oRow ); const ScRangeVec& GetPrintRanges() const { return maPrintRanges; } boolIsEntireSheet() const { return mbEntireSheet; } -const ScRange* GetRepeatCol() const{ return mpRepeatCol.get(); } -const ScRange* GetRepeatRow() const{ return mpRepeatRow.get(); } +const std::optional& GetRepeatCol() const { return moRepeatCol; } +const std::optional& GetRepeatRow() const { return moRepeatRow; } booloperator==( const ScPrintSaverTab& rCmp ) const; }; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 6c083e064add..1a0a0e477758 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -216,8 +216,8 @@ private: ScRangeVec aPrintRanges; -std::unique_ptr pRepeatColRange; -std::unique_ptr pRepeatRowRange; +std::optional moRepeatColRange; +std::optional moRepeatRowRange; sal_uInt16
[Libreoffice-commits] core.git: sc/inc sc/qa
sc/inc/address.hxx |2 +- sc/qa/unit/tiledrendering/tiledrendering.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit d37e5bc08742de4ea9b0916a799e32540e74cdd1 Author: Luboš Luňák AuthorDate: Fri May 13 14:46:33 2022 +0200 Commit: Luboš Luňák CommitDate: Fri May 20 15:11:23 2022 +0200 bump up Calc MAXTILEDROW to MAXROW I.e. no restriction on number of rows for LOK. Change-Id: I248a70bafe18c68e59f604e33b9456474ab785c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134620 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index a1fb7e34d74f..c3171c8f8a84 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -74,7 +74,7 @@ const SCCOL MAXCOLCOUNT_JUMBO = 16384; const SCROW MAXROW_JUMBO = MAXROWCOUNT_JUMBO - 1; const SCCOL MAXCOL_JUMBO = MAXCOLCOUNT_JUMBO - 1; // Maximum tiled rendering values -const SCROW MAXTILEDROW= 50; +const SCROW MAXTILEDROW= MAXROW; // Limit the initial tab count to prevent users to set the count too high, // which could cause the memory usage of blank documents to exceed the // available system memory. diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 36c180efb15b..3fa368d423b1 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -2079,7 +2079,7 @@ void ScTiledRenderingTest::testJumpToLastRowInvalidation() Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 127500255), aView1.m_aInvalidations[0]); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 267386880), aView1.m_aInvalidations[0]); } // We need to ensure that views are not perterbed by rendering (!?) hmm ...
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/SparklineCell.hxx |1 + sc/inc/SparklineData.hxx |2 ++ sc/qa/unit/SparklineImportExportTest.cxx |1 + sc/qa/unit/SparklineTest.cxx |1 + sc/source/filter/inc/SparklineFragment.hxx|3 +++ sc/source/filter/inc/export/SparklineExt.hxx |2 ++ sc/source/filter/xml/SparklineGroupsExport.hxx|1 + sc/source/filter/xml/SparklineGroupsImportContext.hxx |2 ++ sc/source/ui/inc/SparklineDataRangeDialog.hxx |1 + sc/source/ui/inc/SparklineDialog.hxx |1 + sc/source/ui/inc/SparklineShell.hxx |1 + sc/source/ui/inc/reffact.hxx |3 ++- sc/source/ui/inc/undo/UndoGroupSparklines.hxx |3 ++- sc/source/ui/inc/undo/UndoUngroupSparklines.hxx |1 + sc/source/ui/sparklines/SparklineAttributes.cxx |1 + 15 files changed, 22 insertions(+), 2 deletions(-) New commits: commit 0874486b348f1477d59e161a4d73c5cb56e238f9 Author: Tomaž Vajngerl AuthorDate: Fri May 20 14:56:45 2022 +0900 Commit: Miklos Vajna CommitDate: Fri May 20 09:02:55 2022 +0200 Document sparkline related classes, functions and structs No functional change. Change-Id: I822c6a9d270dc582aaae2900f833843a0d6f8ddc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134651 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sc/inc/SparklineCell.hxx b/sc/inc/SparklineCell.hxx index 0588646866c4..f048148ce4a0 100644 --- a/sc/inc/SparklineCell.hxx +++ b/sc/inc/SparklineCell.hxx @@ -16,6 +16,7 @@ namespace sc { +/** Hodler of a sparkline, that is connected to a cell specific */ class SC_DLLPUBLIC SparklineCell { private: diff --git a/sc/inc/SparklineData.hxx b/sc/inc/SparklineData.hxx index 80cc8a0329c2..c004abbd73dc 100644 --- a/sc/inc/SparklineData.hxx +++ b/sc/inc/SparklineData.hxx @@ -15,6 +15,7 @@ namespace sc { +/** Data defining a sparkline - input data and output position */ struct SC_DLLPUBLIC SparklineData { ScAddress maPosition; @@ -34,6 +35,7 @@ enum class RangeOrientation Col }; +/** Determine the sparkline group orientation for the input data the output size */ SC_DLLPUBLIC RangeOrientation calculateOrientation(sal_Int32 nOutputSize, ScRange const& rInputRange); diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index d5d2c38b58c6..6d3f8a73931a 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -17,6 +17,7 @@ using namespace css; +/** Test import, export or roundtrip of sparklines for ODF and OOXML */ class SparklineImportExportTest : public ScBootstrapFixture, public XmlTestTools { private: diff --git a/sc/qa/unit/SparklineTest.cxx b/sc/qa/unit/SparklineTest.cxx index 9c52ab1d1c65..ee104ef56356 100644 --- a/sc/qa/unit/SparklineTest.cxx +++ b/sc/qa/unit/SparklineTest.cxx @@ -19,6 +19,7 @@ using namespace css; +/** Test operation for sparklines, sparkline groups and attributes */ class SparklineTest : public ScBootstrapFixture { private: diff --git a/sc/source/filter/inc/SparklineFragment.hxx b/sc/source/filter/inc/SparklineFragment.hxx index 6ed4bad49bc5..0d4e76e6b9a9 100644 --- a/sc/source/filter/inc/SparklineFragment.hxx +++ b/sc/source/filter/inc/SparklineFragment.hxx @@ -23,6 +23,7 @@ class AttributeList; namespace oox::xls { +/** Transitional sparkline data */ class Sparkline { public: @@ -31,6 +32,7 @@ public: Sparkline() {} }; +/** Transitional sparkline group data */ class SparklineGroup { private: @@ -49,6 +51,7 @@ public: std::vector& getSparklines() { return m_aSparklines; } }; +/** Handle import of the sparkline, sparkline group and attributes */ class SparklineGroupsContext : public WorksheetContextBase { private: diff --git a/sc/source/filter/inc/export/SparklineExt.hxx b/sc/source/filter/inc/export/SparklineExt.hxx index 554fe9c7ec34..f2bff1c7d377 100644 --- a/sc/source/filter/inc/export/SparklineExt.hxx +++ b/sc/source/filter/inc/export/SparklineExt.hxx @@ -24,6 +24,7 @@ namespace xcl::exp { +/** Export for sparkline type of element - top sparkline element. */ class SparklineExt : public XclExpExt { public: @@ -42,6 +43,7 @@ public: XclExpExtType GetType() override { return XclExpExtSparklineType; } }; +/** Determines if sparklines needs to be exported and initiates the export. */ class SparklineBuffer : public XclExpRecordBase, protected XclExpRoot { public: diff --git a/sc/source/filter/xml/SparklineGroupsExport.hxx b/sc/source/filter/xml/SparklineGroupsExport.hxx index b20fd8529574..9359413735dc 100644 --- a/sc/source/filter/xml/SparklineGroupsExport.hxx +++ b/sc/source/filter/xml/SparklineGroupsExport.hxx @@ -22,6 +22,7 @@ class ScXMLExport; namespace sc { +/** Hand
[Libreoffice-commits] core.git: sc/inc sc/qa
sc/inc/document.hxx |2 +- sc/qa/unit/functions_test.cxx | 24 2 files changed, 25 insertions(+), 1 deletion(-) New commits: commit bf9b032a08070633b0d7c9bd6554fe08b661b901 Author: Luboš Luňák AuthorDate: Tue May 17 10:18:16 2022 +0200 Commit: Luboš Luňák CommitDate: Tue May 17 17:23:30 2022 +0200 provide more details about failures in Calc 'functions' tests Instead of simply asserting that something failed, say which part of the .fods test document failed. Change-Id: Idd901186f27d2395b9e3561fbac6bfc1340b7e72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134460 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 59606dd6db38..a2bacddee3a3 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1484,7 +1484,7 @@ public: * non-empty row position in the upward direction if the start row * position is empty. */ -SCROW GetLastDataRow( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const; +SC_DLLPUBLIC SCROW GetLastDataRow( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const; /** * Return the smallest area containing at least all contiguous cells diff --git a/sc/qa/unit/functions_test.cxx b/sc/qa/unit/functions_test.cxx index 16e0a530a5e5..da0290a468ca 100644 --- a/sc/qa/unit/functions_test.cxx +++ b/sc/qa/unit/functions_test.cxx @@ -11,6 +11,8 @@ #include "functions_test.hxx" #include +#include + FunctionsTest::FunctionsTest(const OUString& rPath): ScBootstrapFixture(rPath) { @@ -40,6 +42,28 @@ bool FunctionsTest::load(const OUString& rFilter, const OUString& rURL, ScDocument& rDoc = xDocShRef->GetDocument(); +if(!rtl::math::approxEqual(1.0, rDoc.GetValue(1, 2, 0))) +{ +// Cell B3 in Sheet1 has the cumulative success/failure result. +// Try to find the actual failure. +for(SCTAB tab = 1; tab <= rDoc.GetMaxTableNumber(); ++tab) +{ +SCROW maxRow = rDoc.GetLastDataRow(tab, 2, 2, rDoc.MaxRow()); +for(SCROW row = 0; row <= maxRow; ++row) +{ +// Column C has the check result, column D has the formula text. +if(rDoc.HasStringData(2, row, tab)) +continue; +if(!rtl::math::approxEqual(1.0, rDoc.GetValue(2, row, 1))) +CPPUNIT_FAIL( OUString( "Testing " + rURL + " failed, " ++ rDoc.GetAllTableNames()[tab] + ".A" + OUString::number(row+1) ++ " \'" + rDoc.GetString(3, row, 1) + "\'" + " result: " + OUString::number(rDoc.GetValue(0, row, 1)) ++ ", expected: " + OUString::number(rDoc.GetValue(1, row, 1))) +.toUtf8().getStr()); +} +} +} CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, rDoc.GetValue(1, 2, 0), 1e-14); xDocShRef->DoClose();
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |5 + sc/qa/extras/scpdfexport.cxx | 14 ++ sc/qa/extras/testdocuments/forcepoint97.xlsx |binary sc/source/core/data/documen2.cxx |1 + sc/source/core/data/formulacell.cxx |3 ++- sc/source/ui/view/output2.cxx|7 +++ 6 files changed, 29 insertions(+), 1 deletion(-) New commits: commit 0181f557b35eab1a96beb86736e5f76dbb0182e7 Author: Caolán McNamara AuthorDate: Fri Apr 1 15:08:09 2022 +0100 Commit: Eike Rathke CommitDate: Mon May 16 15:40:27 2022 +0200 forcepoint#97 avoid Invalid read of size 2 ==143282== Invalid read of size 2 ==143282==at 0x190CDBFC: SfxItemSet::Count() const (itemset.hxx:96) ==143282==by 0x1910F33E: SfxItemSet::Get(unsigned short, bool) const (itemset.cxx:748) ==143282==by 0x1F14D76C: ScPatternAttr::GetItem(unsigned short, SfxItemSet const&, SfxItemSet const*) (patattr.cxx:1347) ==143282==by 0x1F14D7DA: ScPatternAttr::GetItem(unsigned short, SfxItemSet const*) const (patattr.cxx:1352) ==143282==by 0x202A3E44: ScLineBreakCell const& ScPatternAttr::GetItem(TypedWhichId, SfxItemSet const*) const (patattr.hxx:83) ==143282==by 0x2028E8BC: ScOutputData::LayoutStrings(bool, bool, ScAddress const&) (output2.cxx:1677) ==143282==by 0x2028D4A8: ScOutputData::DrawStrings(bool) (output2.cxx:1473) ==143282==by 0x202D9879: ScPrintFunc::PrintArea(short, int, short, int, long, long, bool, bool, bool, bool) (printfun.cxx:1675) ==143282==by 0x202DD459: ScPrintFunc::PrintPage(long, short, int, short, int, bool, ScPreviewLocationData*) (printfun.cxx:2301) ==143282==by 0x202DF491: ScPrintFunc::DoPrint(MultiSelection const&, long, long, bool, ScPreviewLocationData*) (printfun.cxx:2713) ==143282==by 0x20031888: ScModelObj::render(int, com::sun::star::uno::Any const&, com::sun::star::uno::Sequence const&) (docuno.cxx:2259) ==143282==by 0x30C1A485: PDFExport::ExportSelection(vcl::PDFWriter&, com::sun::star::uno::Reference const&, com::sun::star::uno::Any const&, StringRangeEnumerator const&, com::sun::star::uno::Sequence&, int) (pdfexport.cxx:219) ==143282==by 0x30C1F879: PDFExport::Export(rtl::OUString const&, com::sun::star::uno::Sequence const&) (pdfexport.cxx:987) ==143282==by 0x30C33BA2: PDFFilter::implExport(com::sun::star::uno::Sequence const&) (pdffilter.cxx:174) ==143282==by 0x30C33F2A: PDFFilter::filter(com::sun::star::uno::Sequence const&) (pdffilter.cxx:237) ==143282==by 0x21AC6986: SfxObjectShell::ExportTo(SfxMedium&) (objstor.cxx:2488) ==143282==by 0x21AC2363: SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) (objstor.cxx:1553) ==143282==by 0x21ACE816: SfxObjectShell::PreDoSaveAs_Impl(rtl::OUString const&, rtl::OUString const&, SfxItemSet const&, com::sun::star::uno::Sequence const&) (objstor.cxx:2966) ==143282==by 0x21ACCA87: SfxObjectShell::CommonSaveAs_Impl(INetURLObject const&, rtl::OUString const&, SfxItemSet&, com::sun::star::uno::Sequence const&) (objstor.cxx:2756) ==143282==by 0x21AA8CDB: SfxObjectShell::APISaveAs_Impl(rtl::OUString const&, SfxItemSet&, com::sun::star::uno::Sequence const&) (objserv.cxx:317) ==143282==by 0x21B2B4AD: SfxBaseModel::impl_store(rtl::OUString const&, com::sun::star::uno::Sequence const&, bool) (sfxbasemodel.cxx:3132) ==143282==by 0x21B2CB12: SfxBaseModel::storeToURL(rtl::OUString const&, com::sun::star::uno::Sequence const&) (sfxbasemodel.cxx:1768) ==143282==by 0x1C507AFE: ScPDFExportTest::exportToPDF(com::sun::star::uno::Reference const&, ScRange const&) (scpdfexport.cxx:192) ==143282==by 0x1C511A33: ScPDFExportTest::testForcepoint97() (scpdfexport.cxx:571) ==143282==by 0x1C52778D: void std::__invoke_impl(std::__invoke_memfun_deref, void (ScPDFExportTest::*&)(), ScPDFExportTest*&) (invoke.h:74) ==143282==by 0x1C5276C1: std::__invoke_result::type std::__invoke(void (ScPDFExportTest::*&)(), ScPDFExportTest*&) (invoke.h:96) ==143282==by 0x1C527659: void std::_Bind::__call(std::tuple<>&&, std::_Index_tuple<0ul>) (functional:420) ==143282==by 0x1C5275E2: void std::_Bind::operator()<, void>() (functional:503) ==143282==by 0x1C52758C: void std::__invoke_impl&>(std::__invoke_other, std::_Bind&) (invoke.h:61) ==143282==by 0x1C52753C: std::enable_if&>, void>::type std::__invoke_r&>(std::_Bind&) (invoke.h:111) ==143282==by 0x1C52731C: std::_Function_handler >::_M_invoke(std::_Any_data const&) (std_function.h:290) ==143282==by 0x1C527A34: std::function::operator()() const (std_function.h:590) ==143282==by 0x1C527078: CppUnit::TestCaller::runTest() (TestCaller.h:175) ==143282==by 0x49326F2: CppUnit::TestCaseMethodFunctor::operator()() const (TestCase.cpp
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/column.hxx |2 +- sc/inc/document.hxx|7 --- sc/inc/table.hxx |5 +++-- sc/qa/unit/ucalc.cxx |6 ++ sc/source/core/data/column2.cxx|2 +- sc/source/core/data/document.cxx |8 sc/source/core/data/table1.cxx | 28 ++-- sc/source/core/data/table2.cxx |6 +++--- sc/source/filter/html/htmlexp2.cxx |2 +- sc/source/ui/docshell/docfunc.cxx |6 +++--- sc/source/ui/view/tabview3.cxx |2 +- sc/source/ui/view/viewfun2.cxx |2 +- 12 files changed, 38 insertions(+), 38 deletions(-) New commits: commit 818eeaa3ae7146190c71b7e8901bd7f67aa672b8 Author: Luboš Luňák AuthorDate: Thu May 12 09:02:07 2022 +0200 Commit: Luboš Luňák CommitDate: Thu May 12 16:39:06 2022 +0200 IsEmptyBlock() -> IsEmptyData() It's unclear what "block" is supposed to mean, as that may mean "cells with no value", but a cell also may have a note, or since recently apparently also a sparkline. To make it even more confusing, there is IsBlockEmpty(), which may explicitly take bIgnoreNotes set to true, in which case it presumably should check only data, but then the recent sparklines addition still counts sparklines even in that case, which is presumably a mistake. Rename the data-only function to make it clear, and remove the extra argument from the empty-in-all-ways function. Change-Id: I8e3f75407d243b733d61640e2f54954762601ab1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134217 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index feba105169e6..01dc4e8611fa 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -285,7 +285,7 @@ public: boolIsEmptyAttr() const; // data only: -boolIsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; +boolIsEmptyData(SCROW nStartRow, SCROW nEndRow) const; SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; boolHasDataAt( SCROW nRow, ScDataAreaExtras* pDataAreaExtras = nullptr ) const; boolHasDataAt( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow, diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 7f32bb7bc6bd..0a483cfeb9a1 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1334,8 +1334,9 @@ public: SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bDeleteCaptions = true ); void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab ); +// This also includes e.g. notes. Use IsEmptyData() for cell data only. bool IsBlockEmpty( SCCOL nStartCol, SCROW nStartRow, -SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bIgnoreNotes = false ) const; +SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const; bool IsPrintEmpty( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bLeftIsEmpty = false, @@ -1541,8 +1542,8 @@ public: voidExtendPrintArea( OutputDevice* pDev, SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow ) const; -SC_DLLPUBLIC bool IsEmptyBlock(SCCOL nStartCol, SCROW nStartRow, - SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const; +SC_DLLPUBLIC bool IsEmptyData(SCCOL nStartCol, SCROW nStartRow, +SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const; // I think this returns the number of empty cells starting from the given direction. SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 290dfcf74f3d..e89dbd34dbc8 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -411,7 +411,8 @@ public: bool bNoMatrixAtAll = false ) const; boolHasSelectionMatrixFragment( const ScMarkData& rMark ) const; -boolIsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes ) const; +// This also includes e.g. notes. Use IsEmptyData() for cell data only. +boolIsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; boolSetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString, const ScSetStringParam * pParam = nullptr ); @@ -621,7 +622,7 @@ public: SCROW GetL
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx | 20 ++-- sc/qa/unit/ucalc.cxx | 18 +- sc/qa/unit/ucalc_copypaste.cxx |8 sc/source/core/data/documen3.cxx | 12 ++-- sc/source/core/data/documen9.cxx |7 --- sc/source/core/data/document.cxx |4 ++-- sc/source/core/data/dpobject.cxx |2 +- sc/source/filter/excel/xistyle.cxx |2 +- sc/source/filter/lotus/lotimpop.cxx |6 +++--- sc/source/filter/oox/sheetdatabuffer.cxx |2 +- sc/source/filter/xml/xmlcelli.cxx|4 ++-- sc/source/ui/docshell/dbdocfun.cxx |4 ++-- sc/source/ui/docshell/docfunc.cxx| 12 ++-- sc/source/ui/docshell/impex.cxx |2 +- sc/source/ui/undo/undoblk3.cxx | 12 ++-- sc/source/ui/view/cellsh1.cxx| 10 ++ sc/source/ui/view/cellsh2.cxx|6 +++--- sc/source/ui/view/dbfunc.cxx |5 ++--- sc/source/ui/view/printfun.cxx |6 +++--- sc/source/ui/view/tabview3.cxx |4 ++-- sc/source/ui/view/tabvwshc.cxx |5 ++--- sc/source/ui/view/viewfun2.cxx | 16 sc/source/ui/view/viewfun3.cxx |4 ++-- 23 files changed, 86 insertions(+), 85 deletions(-) New commits: commit 1e990a5ab399a1bb15d4002ca30f13611ba6edbc Author: Luboš Luňák AuthorDate: Thu May 12 12:05:44 2022 +0200 Commit: Luboš Luňák CommitDate: Thu May 12 16:38:38 2022 +0200 fix up order of some ScDocument functions For better or worse the usual order of arguments in Calc is SCCOL, SCROW, SCTAB, so make this consistent. Change-Id: Ie63c75f5ae92f82cb757c0873f7ff569f331e0df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134229 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f61650e5a256..7f32bb7bc6bd 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1325,19 +1325,19 @@ public: bool RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); -SC_DLLPUBLIC void DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, - SCCOL nEndCol, SCROW nEndRow ); -SC_DLLPUBLIC void DoEmptyBlock( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, -SCCOL nEndCol, SCROW nEndRow ); +SC_DLLPUBLIC void DoMergeContents( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); +SC_DLLPUBLIC void DoEmptyBlock( SCCOL nStartCol, SCROW nStartRow, +SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); // without checking: -SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, - SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true ); +SC_DLLPUBLIC void DoMerge( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bDeleteCaptions = true ); void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab ); -bool IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, -SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const; -bool IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, -SCCOL nEndCol, SCROW nEndRow, +bool IsBlockEmpty( SCCOL nStartCol, SCROW nStartRow, +SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bIgnoreNotes = false ) const; +bool IsPrintEmpty( SCCOL nStartCol, SCROW nStartRow, +SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bLeftIsEmpty = false, ScRange* pLastRange = nullptr, tools::Rectangle* pLastMM = nullptr ) const; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index b35d88e3b3a9..1019cf44a879 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2602,8 +2602,8 @@ void Test::testDataArea() m_pDoc->InsertTab(0, "Data"); // Totally empty sheet should be rightfully considered empty in all accounts. -CPPUNIT_ASSERT_MESSAGE("Sheet is expected to be empty.", m_pDoc->IsPrintEmpty(0, 0, 0, 100, 100)); -CPPUNIT_ASSERT_MESSAGE("Sheet is expected to be empty.", m_pDoc->IsBlockEmpty(0, 0, 0, 100, 100)); +CPPUNIT_ASSERT_MESSAGE("Sheet is expected to be empty.", m_pDoc->IsPrintEmpty(0, 0, 100, 100, 0)); +CPPUNIT_ASSERT_MESSAGE("Sheet is expected to be empty.", m_pDoc->IsBlockEmpty(0, 0, 100, 100, 0)); // Now, set bor
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/queryiter.hxx | 10 +-- sc/qa/unit/ucalc_sort.cxx | 32 - sc/source/core/data/queryiter.cxx | 48 +- 3 files changed, 55 insertions(+), 35 deletions(-) New commits: commit 1d8c31ea2555b339d5a4bc5449d40d546045435b Author: Luboš Luňák AuthorDate: Fri May 6 11:53:09 2022 +0200 Commit: Luboš Luňák CommitDate: Tue May 10 16:25:21 2022 +0200 sort out query iterator's BinarySearch() corner cases handling If the code detects the range is not actually properly sorted, set position to the first row and return false to force linear search. If the searched for value belongs before the first item, do the same, in which case the linear search should see that it is this case (before this case nRow was set to the first row regardless of where the searched for value belonged). Change-Id: I8ff346783d93d74ff409b19aea394e202885647d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134100 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/queryiter.hxx b/sc/inc/queryiter.hxx index 847241124a2e..f151bba90ab6 100644 --- a/sc/inc/queryiter.hxx +++ b/sc/inc/queryiter.hxx @@ -141,9 +141,13 @@ protected: /* Only works if no regular expression is involved, only searches for rows in one column, and only the first query entry is considered with simple conditions SC_LESS,SC_LESS_EQUAL, - SC_EQUAL (sorted ascending) or SC_GREATER,SC_GREATER_EQUAL (sorted descending). Delivers - a starting point, continue with e.g. GetThis() and GetNext() afterwards. Introduced - for FindEqualOrSortedLastInRange(). */ + SC_EQUAL (sorted ascending) or SC_GREATER,SC_GREATER_EQUAL (sorted descending). It + delivers a starting point set to nRow, i.e. the last row that either matches the searched + for value, or the last row that matches the condition. Continue with e.g. GetThis() and + GetNext() afterwards. Returns false if the searched for value is not in the search range + or if the range is not properly sorted, with nRow in that case set to the first row or after + the last row. In that case use GetFirst(). +*/ bool BinarySearch(); public: diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx index e99b0a38cec3..b381d6195b04 100644 --- a/sc/qa/unit/ucalc_sort.cxx +++ b/sc/qa/unit/ucalc_sort.cxx @@ -2176,26 +2176,26 @@ void TestSort::testQueryBinarySearch() } { -// All values are larger than 0, so this should be an error. +// All values are larger than 0, so there should be no match. m_pDoc->SetFormula( formulaAddress, "=MATCH(0;" + ascendingRangeName + ";1)", formula::FormulaGrammar::GRAM_NATIVE_UI); CPPUNIT_ASSERT_EQUAL( FormulaError::NotAvailable, m_pDoc->GetErrCode( formulaAddress )); ScQueryParam param = makeSearchParam( range, ascendingCol, SC_LESS_EQUAL, 0 ); TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); -CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT(!it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(0), it.GetRow()); } { ScQueryParam param = makeSearchParam( range, ascendingCol, SC_LESS, 0 ); TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); -CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT(!it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(0), it.GetRow()); } { ScQueryParam param = makeSearchParam( range, ascendingCol, SC_EQUAL, 0 ); TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); -CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT(!it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(0), it.GetRow()); } @@ -2242,45 +2242,45 @@ void TestSort::testQueryBinarySearch() } { -// Descending, all values are smaller than 10, so this should be an error. +// Descending, all values are smaller than 10, so there should be no match. m_pDoc->SetFormula( formulaAddress, "=MATCH(10;" + descendingRangeName + ";-1)", formula::FormulaGrammar::GRAM_NATIVE_UI); CPPUNIT_ASSERT_EQUAL( FormulaError::NotAvailable, m_pDoc->GetErrCode( formulaAddress )); ScQueryParam param = makeSearchParam( range, descendingCol, SC_GREATER_EQUAL, 10 ); TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); -CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT(!it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(0), it.GetRow()); } { ScQueryParam param = makeSearchParam( range, descendingCol, SC_GREATER, 10 ); TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); -CPPUNIT_ASSERT(it.BinarySearch());
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/queryiter.hxx |6 +- sc/qa/unit/ucalc_sort.cxx | 80 ++ sc/source/core/data/queryiter.cxx | 54 ++--- 3 files changed, 121 insertions(+), 19 deletions(-) New commits: commit e2f8e5cf7cf9c7b2812ffbcd48ec21dc994339d6 Author: Luboš Luňák AuthorDate: Fri May 6 10:22:50 2022 +0200 Commit: Luboš Luňák CommitDate: Tue May 10 16:24:55 2022 +0200 make BinarySearch() work for SC_EQUAL, SC_LESS, SC_GREATER Change-Id: I296686709688a9e3f2cda0864d73c79a17e33f49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134099 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/queryiter.hxx b/sc/inc/queryiter.hxx index e247a471db65..847241124a2e 100644 --- a/sc/inc/queryiter.hxx +++ b/sc/inc/queryiter.hxx @@ -140,9 +140,9 @@ protected: void PerformQuery(); /* Only works if no regular expression is involved, only searches for rows in one column, - and only the first query entry is considered with simple conditions SC_LESS_EQUAL - (sorted ascending) or SC_GREATER_EQUAL (sorted descending). Delivers a starting point, - continue with e.g. GetThis() and GetNext() afterwards. Introduced + and only the first query entry is considered with simple conditions SC_LESS,SC_LESS_EQUAL, + SC_EQUAL (sorted ascending) or SC_GREATER,SC_GREATER_EQUAL (sorted descending). Delivers + a starting point, continue with e.g. GetThis() and GetNext() afterwards. Introduced for FindEqualOrSortedLastInRange(). */ bool BinarySearch(); diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx index 698cbb1bde97..e99b0a38cec3 100644 --- a/sc/qa/unit/ucalc_sort.cxx +++ b/sc/qa/unit/ucalc_sort.cxx @@ -2102,6 +2102,18 @@ void TestSort::testQueryBinarySearch() CPPUNIT_ASSERT(it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(8), it.GetRow()); } +{ +ScQueryParam param = makeSearchParam( range, ascendingCol, SC_LESS, 5 ); +TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); +CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT_EQUAL(SCROW(2), it.GetRow()); +} +{ +ScQueryParam param = makeSearchParam( range, ascendingCol, SC_EQUAL, 5 ); +TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); +CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT_EQUAL(SCROW(8), it.GetRow()); +} { // Descending, this should return the last 5. @@ -2114,6 +2126,12 @@ void TestSort::testQueryBinarySearch() CPPUNIT_ASSERT(it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(6), it.GetRow()); } +{ +ScQueryParam param = makeSearchParam( range, descendingCol, SC_GREATER, 5 ); +TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); +CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT_EQUAL(SCROW(1), it.GetRow()); +} { // There's no 6, so this should return the last 5. @@ -2126,6 +2144,18 @@ void TestSort::testQueryBinarySearch() CPPUNIT_ASSERT(it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(8), it.GetRow()); } +{ +ScQueryParam param = makeSearchParam( range, ascendingCol, SC_LESS, 6 ); +TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); +CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT_EQUAL(SCROW(8), it.GetRow()); +} +{ +ScQueryParam param = makeSearchParam( range, ascendingCol, SC_EQUAL, 6 ); +TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); +CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT_EQUAL(SCROW(8), it.GetRow()); +} { // Descending, there's no 6, so this should return the last 9. @@ -2138,6 +2168,12 @@ void TestSort::testQueryBinarySearch() CPPUNIT_ASSERT(it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(1), it.GetRow()); } +{ +ScQueryParam param = makeSearchParam( range, descendingCol, SC_GREATER, 6 ); +TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); +CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT_EQUAL(SCROW(1), it.GetRow()); +} { // All values are larger than 0, so this should be an error. @@ -2150,6 +2186,18 @@ void TestSort::testQueryBinarySearch() CPPUNIT_ASSERT(it.BinarySearch()); CPPUNIT_ASSERT_EQUAL(SCROW(0), it.GetRow()); } +{ +ScQueryParam param = makeSearchParam( range, ascendingCol, SC_LESS, 0 ); +TestQueryIterator it( *m_pDoc, m_pDoc->GetNonThreadedContext(), 0, param, false ); +CPPUNIT_ASSERT(it.BinarySearch()); +CPPUNIT_ASSERT_EQUAL(SCROW(0), it.GetRow()); +} +{ +ScQueryParam param = makeSearchParam(
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/miscuno.hxx |2 sc/qa/extras/scautoformatsobj.cxx |7 sc/qa/extras/scdatapilotfieldgroupitemobj.cxx | 10 - sc/qa/extras/scdatapilotfieldgroupobj.cxx | 10 - sc/qa/extras/scdatapilotfieldgroupsobj.cxx | 10 - sc/qa/extras/scdatapilotitemobj.cxx|4 sc/qa/extras/scdatapilotitemsobj.cxx |5 sc/qa/extras/sceditfieldobj-cell.cxx |4 sc/qa/extras/sceditfieldobj-header.cxx |2 sc/qa/extras/scheaderfieldsobj.cxx |2 sc/qa/extras/scpdfexport.cxx |2 sc/qa/extras/scstylefamilyobj.cxx |6 sc/qa/extras/scstyleobj.cxx|4 sc/qa/extras/sctablesheetsobj.cxx |5 sc/qa/unit/helper/qahelper.cxx |2 sc/qa/unit/uicalc/uicalc.cxx | 12 - sc/source/core/data/documen5.cxx |8 sc/source/core/tool/charthelper.cxx|4 sc/source/core/tool/interpr4.cxx |2 sc/source/filter/excel/excel.cxx |8 sc/source/filter/excel/excimp8.cxx |2 sc/source/filter/excel/xiescher.cxx|6 sc/source/filter/excel/xistyle.cxx |4 sc/source/filter/excel/xlchart.cxx |2 sc/source/filter/excel/xltoolbar.cxx |6 sc/source/filter/ftools/fapihelper.cxx |2 sc/source/filter/inc/fapihelper.hxx|2 sc/source/filter/xml/XMLCalculationSettingsContext.cxx | 20 +- sc/source/filter/xml/XMLTableHeaderFooterContext.cxx | 10 - sc/source/filter/xml/XMLTableShapeImportHelper.cxx |2 sc/source/filter/xml/xmlcoli.cxx |2 sc/source/filter/xml/xmlexprt.cxx |6 sc/source/filter/xml/xmlimprt.cxx | 12 - sc/source/filter/xml/xmlrowi.cxx |2 sc/source/filter/xml/xmlstyli.cxx |8 sc/source/filter/xml/xmlwrap.cxx | 80 sc/source/ui/Accessibility/AccessibleDocument.cxx |6 sc/source/ui/docshell/dbdocimp.cxx |2 sc/source/ui/docshell/docsh.cxx|2 sc/source/ui/docshell/docsh8.cxx |2 sc/source/ui/docshell/tablink.cxx |2 sc/source/ui/drawfunc/fuins2.cxx | 12 - sc/source/ui/formdlg/formula.cxx |2 sc/source/ui/unoobj/TablePivotCharts.cxx | 10 - sc/source/ui/unoobj/afmtuno.cxx|6 sc/source/ui/unoobj/appluno.cxx|4 sc/source/ui/unoobj/cellsuno.cxx | 14 - sc/source/ui/unoobj/cellvaluebinding.cxx |2 sc/source/ui/unoobj/chart2uno.cxx | 12 - sc/source/ui/unoobj/chartuno.cxx | 12 - sc/source/ui/unoobj/datauno.cxx|8 sc/source/ui/unoobj/docuno.cxx | 20 +- sc/source/ui/unoobj/fielduno.cxx | 40 ++-- sc/source/ui/unoobj/fmtuno.cxx |4 sc/source/ui/unoobj/linkuno.cxx| 10 - sc/source/ui/unoobj/nameuno.cxx|6 sc/source/ui/unoobj/styleuno.cxx |8 sc/source/ui/unoobj/targuno.cxx|4 sc/source/ui/unoobj/viewuno.cxx|6 sc/source/ui/vba/excelvbahelper.cxx|4 sc/source/ui/vba/vbaapplication.cxx| 44 ++-- sc/source/ui/vba/vbaaxes.cxx |4 sc/source/ui/vba/vbaaxis.cxx | 32 +-- sc/source/ui/vba/vbaborders.cxx| 30 +-- sc/source/ui/vba/vbachart.cxx | 56 ++--- sc/source/ui/vba/vbachartobject.cxx|2 sc/source/ui/vba/vbachartobjects.cxx |4 sc/source/ui/vba/vbacomment.cxx|2 sc/source/ui/vba/vbacomments.cxx |2 sc/source/ui/vba/vbafiledialog.cxx |6 sc/source/ui/vba/vbafiledialogitems.cxx|6 sc/source/ui/vba/vbafont.cxx | 12 - sc/source/ui/vba/vbaformat.cxx | 18 - sc/source/ui/vba/vbaformat.hxx |2 sc/source/ui/vba/vbaformatcondition.cxx|2 sc/source/ui/vba/vbaformatconditions.cxx | 10 - sc/source/ui/vba/vbainterior.cxx | 32 +-- sc/source/ui/vba/vbam
[Libreoffice-commits] core.git: sc/inc sc/qa
sc/inc/address.hxx |2 +- sc/qa/unit/ucalc.cxx | 36 ++-- sc/qa/unit/uicalc/uicalc.cxx | 10 +- 3 files changed, 28 insertions(+), 20 deletions(-) New commits: commit 9e2d48b9e04f7ea895fb095699c32ed8a44eb129 Author: Luboš Luňák AuthorDate: Wed Mar 30 11:58:04 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Apr 28 05:51:53 2022 +0200 reduce Calc's INITIALCOLCOUNT to 1 Columns should be dynamically allocated on demand, so there should be theoretically no good reason to allocate 64 initially. In practice doing so hides all places that do not allocate columns as needed. Change-Id: I8b46ecc97852ed23369e720f50f3266c48440435 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133311 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 13cfd9c408c2..a1fb7e34d74f 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -61,7 +61,7 @@ const SCSIZE SCSIZE_MAX = ::std::numeric_limits::max(); // Count values const SCROW MAXROWCOUNT= 1048576; const SCCOL MAXCOLCOUNT= 16384; -const SCCOL INITIALCOLCOUNT = 64; // initial number of columns we allocate memory for +const SCCOL INITIALCOLCOUNT = 1; // initial number of columns we allocate memory for /// limiting to 1 for now, problem with 32 bit builds for now const SCTAB MAXTABCOUNT= 1; // Maximum values diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 8da0c6132aee..b35d88e3b3a9 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1415,48 +1415,55 @@ void Test::testIteratorsUnallocatedColumnsAttributes() { m_pDoc->InsertTab(0, "Tab1"); +// Set values in first two columns, to ensure allocation of those columns. +m_pDoc->SetValue(ScAddress(0,1,0), 1); +m_pDoc->SetValue(ScAddress(1,1,0), 2); +constexpr SCCOL allocatedColsCount = 2; +assert( allocatedColsCount >= INITIALCOLCOUNT ); +CPPUNIT_ASSERT_EQUAL(allocatedColsCount, m_pDoc->GetAllocatedColumnsCount(0)); + // Make entire second row and third row bold. ScPatternAttr boldAttr(m_pDoc->GetPool()); boldAttr.GetItemSet().Put(SvxWeightItem(WEIGHT_BOLD, ATTR_FONT_WEIGHT)); m_pDoc->ApplyPatternAreaTab(0, 1, m_pDoc->MaxCol(), 2, 0, boldAttr); // That shouldn't need allocating more columns, just changing the default attribute. -CPPUNIT_ASSERT_EQUAL(SCCOL(INITIALCOLCOUNT), m_pDoc->GetAllocatedColumnsCount(0)); +CPPUNIT_ASSERT_EQUAL(allocatedColsCount, m_pDoc->GetAllocatedColumnsCount(0)); vcl::Font aFont; const ScPatternAttr* pattern = m_pDoc->GetPattern(m_pDoc->MaxCol(), 1, 0); pattern->GetFont(aFont, SC_AUTOCOL_RAW); CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); // Test iterators. -ScDocAttrIterator docit( *m_pDoc, 0, INITIALCOLCOUNT - 1, 1, INITIALCOLCOUNT, 2 ); +ScDocAttrIterator docit( *m_pDoc, 0, allocatedColsCount - 1, 1, allocatedColsCount, 2 ); SCCOL col1, col2; SCROW row1, row2; CPPUNIT_ASSERT_EQUAL( pattern, docit.GetNext( col1, row1, row2 )); -CPPUNIT_ASSERT_EQUAL( SCCOL(INITIALCOLCOUNT - 1), col1 ); +CPPUNIT_ASSERT_EQUAL( SCCOL(allocatedColsCount - 1), col1 ); CPPUNIT_ASSERT_EQUAL( SCROW(1), row1 ); CPPUNIT_ASSERT_EQUAL( SCROW(2), row2 ); CPPUNIT_ASSERT_EQUAL( pattern, docit.GetNext( col1, row1, row2 )); -CPPUNIT_ASSERT_EQUAL( INITIALCOLCOUNT, col1 ); +CPPUNIT_ASSERT_EQUAL( allocatedColsCount, col1 ); CPPUNIT_ASSERT_EQUAL( SCROW(1), row1 ); CPPUNIT_ASSERT_EQUAL( SCROW(2), row2 ); CPPUNIT_ASSERT( docit.GetNext( col1, row1, row2 ) == nullptr ); -ScAttrRectIterator rectit( *m_pDoc, 0, INITIALCOLCOUNT - 1, 1, INITIALCOLCOUNT, 2 ); +ScAttrRectIterator rectit( *m_pDoc, 0, allocatedColsCount - 1, 1, allocatedColsCount, 2 ); CPPUNIT_ASSERT_EQUAL( pattern, rectit.GetNext( col1, col2, row1, row2 )); -CPPUNIT_ASSERT_EQUAL( SCCOL(INITIALCOLCOUNT - 1), col1 ); -CPPUNIT_ASSERT_EQUAL( INITIALCOLCOUNT, col2 ); +CPPUNIT_ASSERT_EQUAL( SCCOL(allocatedColsCount - 1), col1 ); +CPPUNIT_ASSERT_EQUAL( allocatedColsCount, col2 ); CPPUNIT_ASSERT_EQUAL( SCROW(1), row1 ); CPPUNIT_ASSERT_EQUAL( SCROW(2), row2 ); CPPUNIT_ASSERT( rectit.GetNext( col1, col2, row1, row2 ) == nullptr ); -ScHorizontalAttrIterator horit( *m_pDoc, 0, INITIALCOLCOUNT - 1, 1, INITIALCOLCOUNT, 2 ); +ScHorizontalAttrIterator horit( *m_pDoc, 0, allocatedColsCount - 1, 1, allocatedColsCount, 2 ); CPPUNIT_ASSERT_EQUAL( pattern, horit.GetNext( col1, col2, row1 )); -CPPUNIT_ASSERT_EQUAL( SCCOL(INITIALCOLCOUNT - 1), col1 ); -CPPUNIT_ASSERT_EQUAL( INITIALCOLCOUNT, col2 ); +CPPUNIT_ASSERT_EQUAL( SCCOL(allocatedColsCount - 1), col1 ); +CPPUNIT_ASSERT_EQUAL( allocatedColsCount, col2 ); CPPUNIT_ASSERT_EQUAL( SCROW(1), row1 ); CPPUNIT_A
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/Sparkline.hxx | 36 sc/inc/SparklineList.hxx | 101 + sc/inc/table.hxx |1 sc/qa/unit/SparklineTest.cxx | 68 sc/source/core/data/document.cxx | 10 +- sc/source/filter/excel/export/SparklineExt.cxx | 41 +++--- sc/source/filter/inc/export/SparklineExt.hxx |5 - sc/source/filter/xml/SparklineGroupsExport.cxx | 49 +--- sc/source/filter/xml/SparklineGroupsExport.hxx |9 -- sc/source/filter/xml/xmlexprt.cxx | 12 -- 10 files changed, 218 insertions(+), 114 deletions(-) New commits: commit a2bcac670ef0254d8b2e8632cfe07bb855b28d1c Author: Tomaž Vajngerl AuthorDate: Fri Apr 1 17:06:18 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Apr 5 13:43:17 2022 +0200 sc: improve SparklineList to track added SparklineGroups SparklineList used to only track added Sparklines for a sheet, but usually (in an export) we want to start with SparklineGroups and then search for all sparklines belonging to a group. This changes to use that. Now there is a method getSparklineGroups() and then another method getSparklineFor(), which returns all sparklines for the input group. Also added SparklineListTest, and refactored the export code for OOXML and ODF. Change-Id: I975e30f649788d41aab92a9a3220e38998e39670 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132543 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/Sparkline.hxx b/sc/inc/Sparkline.hxx index e0fbbe125bc7..77f249428288 100644 --- a/sc/inc/Sparkline.hxx +++ b/sc/inc/Sparkline.hxx @@ -54,42 +54,6 @@ public: SCROW getRow() const { return m_nRow; } }; -/** Contains a list of all created sparklines */ -class SC_DLLPUBLIC SparklineList -{ -private: -std::vector> m_pSparklines; - -public: -SparklineList() {} - -void addSparkline(std::shared_ptr const& pSparkline) -{ -m_pSparklines.push_back(pSparkline); -} - -std::vector> getSparklines() -{ -std::vector> toReturn; - -std::vector>::iterator aIter; -for (aIter = m_pSparklines.begin(); aIter != m_pSparklines.end();) -{ -if (auto aSparkline = aIter->lock()) -{ -toReturn.push_back(aSparkline); -aIter++; -} -else -{ -aIter = m_pSparklines.erase(aIter); -} -} - -return toReturn; -} -}; - } // end sc /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/SparklineList.hxx b/sc/inc/SparklineList.hxx new file mode 100644 index ..1abfbd6df019 --- /dev/null +++ b/sc/inc/SparklineList.hxx @@ -0,0 +1,101 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include "scdllapi.h" +#include +#include + +#include "rangelst.hxx" +#include "Sparkline.hxx" +#include "SparklineGroup.hxx" + +namespace sc +{ +/** Tracks and gathers all created sparklines and sparkline groups. + * + * All the collections of sparkline groups and sparklines don't take + * the ownership of the pointers. + */ +class SC_DLLPUBLIC SparklineList +{ +private: +std::vector> m_aSparklineGroups; +std::map, std::vector>, + std::owner_less<>> +m_aSparklineGroupMap; + +public: +SparklineList() {} + +void addSparkline(std::shared_ptr const& pSparkline) +{ +auto pWeakGroup = std::weak_ptr(pSparkline->getSparklineGroup()); + +auto[iterator, bInserted] += m_aSparklineGroupMap.try_emplace(pWeakGroup, std::vector>()); +iterator->second.push_back(std::weak_ptr(pSparkline)); +if (bInserted) +m_aSparklineGroups.push_back(pWeakGroup); +} + +std::vector> getSparklineGroups() +{ +std::vector> toReturn; + +for (auto iterator = m_aSparklineGroups.begin(); iterator != m_aSparklineGroups.end();) +{ +if (auto pSparklineGroup = iterator->lock()) +{ +toReturn.push_back(pSparklineGroup); +iterator++; +} +else +{ +iterator = m_aSparklineGroups.erase(iterator); +} +} +return toReturn; +} + +std::vector> +getSparklinesFor(std::shared_ptr const& pSparklineGroup) +{ +std::vector> toReturn; + +std::weak_ptr pWeakGroup(pSparklineGroup); +auto iteratorGroup = m_aSparklineGroupMap.find(pWeakGroup); + +if (iteratorGroup
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/SparklineGroup.hxx |7 --- sc/inc/document.hxx |7 +-- sc/qa/unit/SparklineImportExportTest.cxx |4 ++-- sc/qa/unit/SparklineTest.cxx | 11 +++ sc/source/core/data/column2.cxx |7 --- sc/source/core/data/column4.cxx |7 +-- sc/source/core/data/document.cxx | 16 sc/source/filter/excel/export/SparklineExt.cxx|2 +- sc/source/filter/oox/SparklineFragment.cxx|5 +++-- sc/source/filter/xml/SparklineGroupsExport.cxx|7 ++- sc/source/filter/xml/SparklineGroupsImportContext.cxx |4 +++- sc/source/ui/sparklines/SparklineGroup.cxx|7 +-- 12 files changed, 61 insertions(+), 23 deletions(-) New commits: commit 5ff13a0866fe5c408f9e9c7441a9d052b383d99c Author: Tomaž Vajngerl AuthorDate: Mon Mar 28 22:51:08 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Apr 5 05:16:59 2022 +0200 sc: use GUID for the SparklineGroup ID and use that This adds tools::Guid as the SparklineGroup ID. At import the Guid is parsed by tools::Guid and later it is used to identify the SparklineGroup. This is useful when copying sparklines so we can preserve to which group it belongs, when that is desired. Change-Id: I4f2b560d5ea74552e8add57bb05469be57cf4a69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132515 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/SparklineGroup.hxx b/sc/inc/SparklineGroup.hxx index 5a3bda62b6ab..c5e917f059f3 100644 --- a/sc/inc/SparklineGroup.hxx +++ b/sc/inc/SparklineGroup.hxx @@ -13,6 +13,7 @@ #include "scdllapi.h" #include "SparklineAttributes.hxx" #include +#include #include namespace sc @@ -22,15 +23,15 @@ class SC_DLLPUBLIC SparklineGroup { private: SparklineAttributes m_aAttributes; -OUString m_sUID; +tools::Guid m_aGUID; public: SparklineAttributes& getAttributes() { return m_aAttributes; } SparklineAttributes const& getAttributes() const { return m_aAttributes; } -OUString getID() { return m_sUID; } +tools::Guid& getID() { return m_aGUID; } -void setID(OUString const& rID) { m_sUID = rID; } +void setID(tools::Guid const& rGuid) { m_aGUID = rGuid; } SparklineGroup(); SparklineGroup(SparklineGroup const& pOtherSparkline); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index e31900dee7cd..1cde9b95fe4c 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -69,12 +69,12 @@ enum class EEHorizontalTextDirection; namespace editeng { class SvxBorderLine; } namespace formula { struct VectorRefArray; } namespace svl { - class SharedString; class SharedStringPool; - } +namespace tools { class Guid; } + namespace sc { struct FormulaGroupContext; @@ -208,6 +208,7 @@ typedef o3tl::sorted_vector ScCondFormatIndexes; struct ScSheetLimits; struct ScDataAreaExtras; + namespace sc { typedef std::map IconSetBitmapMap; @@ -1255,6 +1256,8 @@ public: SC_DLLPUBLIC sc::SparklineList* GetSparklineList(SCTAB nTab); SC_DLLPUBLIC bool DeleteSparkline(ScAddress const& rPosition); SC_DLLPUBLIC bool HasOneSparklineGroup(ScRange const& rRange); +SC_DLLPUBLIC std::shared_ptr SearchSparklineGroup(tools::Guid const& rGuid); + /** Notes **/ SC_DLLPUBLIC ScPostIt* GetNote(const ScAddress& rPos); SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab); diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index 6da76fb2dcfb..7060a120c49a 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -69,8 +69,8 @@ void checkSparklines(ScDocument& rDocument) { auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 CPPUNIT_ASSERT(pSparkline); - CPPUNIT_ASSERT_EQUAL(OUString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"), - pSparkline->getSparklineGroup()->getID()); +CPPUNIT_ASSERT_EQUAL(OString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"), + pSparkline->getSparklineGroup()->getID().getString()); auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes(); CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Line, rAttributes.getType()); diff --git a/sc/qa/unit/SparklineTest.cxx b/sc/qa/unit/SparklineTest.cxx index ac9c0996ac59..6e203131e9c5 100644 --- a/sc/qa/unit/SparklineTest.cxx +++ b/sc/qa/unit/SparklineTest.cxx @@ -153,6 +153,7 @@ void SparklineTest::testCopyPasteSparkline() ScRange aSourceRange(0, 6, 0, 0, 6, 0); auto pSparkline = rDocument.GetSparkline(aSourceRange.aStart); +auto const& pOriginalGroup = pSparkline->getSparklineGroup(); CPPUNIT_ASSERT(pSparkline);
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/column.hxx |2 - sc/inc/table.hxx |1 sc/qa/unit/SparklineTest.cxx | 65 + sc/source/core/data/table2.cxx | 17 ++ sc/source/ui/undo/undoblk3.cxx |2 + 5 files changed, 86 insertions(+), 1 deletion(-) New commits: commit af38d84380ee78f61822e8e080a56e955842b71e Author: Tomaž Vajngerl AuthorDate: Tue Mar 22 11:03:24 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Apr 4 09:53:21 2022 +0200 sc: undo/redo for sparklines when deleting the cell content This adds support for undo/redo when clearing the content of a cell, which includes a sparkline. Change-Id: I79d9ef965e21cf5b35de84aa3b5cb93b644777ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132476 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 3afda2acd885..f60ea22cbc30 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -674,7 +674,7 @@ public: void DeleteSparklineCells(sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2); bool DeleteSparkline(SCROW nRow); bool IsSparklinesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; -void CopyCellSparklinesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, SCROW nRowOffsetDest) const; +void CopyCellSparklinesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, SCROW nRowOffsetDest = 0) const; void DuplicateSparklines(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol, sc::ColumnBlockPosition& rDestBlockPos, SCROW nRowOffsetDest = 0) const; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 14eb33fa50f7..7a3ce91a43a0 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -477,6 +477,7 @@ public: bool DeleteSparkline(SCCOL nCol, SCROW nRow); sc::SparklineList& GetSparklineList(); +void CopySparklinesToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab); // Notes / Comments std::unique_ptr ReleaseNote( SCCOL nCol, SCROW nRow ); diff --git a/sc/qa/unit/SparklineTest.cxx b/sc/qa/unit/SparklineTest.cxx index 6173cea5f297..ac9c0996ac59 100644 --- a/sc/qa/unit/SparklineTest.cxx +++ b/sc/qa/unit/SparklineTest.cxx @@ -52,6 +52,7 @@ public: void testCutPasteSparkline(); void testUndoRedoInsertSparkline(); void testUndoRedoDeleteSparkline(); +void testUndoRedoClearContentForSparkline(); CPPUNIT_TEST_SUITE(SparklineTest); CPPUNIT_TEST(testAddSparkline); @@ -60,6 +61,7 @@ public: CPPUNIT_TEST(testCutPasteSparkline); CPPUNIT_TEST(testUndoRedoInsertSparkline); CPPUNIT_TEST(testUndoRedoDeleteSparkline); +CPPUNIT_TEST(testUndoRedoClearContentForSparkline); CPPUNIT_TEST_SUITE_END(); }; @@ -351,6 +353,69 @@ void SparklineTest::testUndoRedoDeleteSparkline() xDocSh->DoClose(); } +void SparklineTest::testUndoRedoClearContentForSparkline() +{ +ScDocShellRef xDocSh = loadEmptyDocument(); +CPPUNIT_ASSERT(xDocSh); + +ScDocument& rDocument = xDocSh->GetDocument(); +ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pViewShell); + +auto& rDocFunc = xDocSh->GetDocFunc(); + +// Try to delete sparkline that doesn't exist - returns false +CPPUNIT_ASSERT(!rDocFunc.DeleteSparkline(ScAddress(0, 6, 0))); + +// insert test data - A1:A6 +insertTestData(rDocument); + +// Sparkline range +ScRange aRange(0, 6, 0, 0, 6, 0); + +// Check Sparkline at cell A7 doesn't exists +auto pSparkline = rDocument.GetSparkline(aRange.aStart); +CPPUNIT_ASSERT(!pSparkline); + +auto pSparklineGroup = std::make_shared(); +CPPUNIT_ASSERT(rDocFunc.InsertSparklines(ScRange(0, 0, 0, 0, 5, 0), aRange, pSparklineGroup)); + +// Check Sparkline at cell A7 exists +pSparkline = rDocument.GetSparkline(aRange.aStart); +CPPUNIT_ASSERT(pSparkline); +CPPUNIT_ASSERT_EQUAL(SCCOL(0), pSparkline->getColumn()); +CPPUNIT_ASSERT_EQUAL(SCROW(6), pSparkline->getRow()); + +// Clear content - including sparkline +ScMarkData aMark(rDocument.GetSheetLimits()); +aMark.SetMarkArea(aRange.aStart); +rDocFunc.DeleteContents(aMark, InsertDeleteFlags::CONTENTS, true, true); + +// Check Sparkline at cell A7 doesn't exists +pSparkline = rDocument.GetSparkline(aRange.aStart); +CPPUNIT_ASSERT(!pSparkline); + +// Undo +rDocument.GetUndoManager()->Undo(); + +// Check Sparkline at cell A7 exists +pSparkline = rDocument.GetSparkline(aRange.aStart); +CPPUNIT_ASSERT(pSparkline); +CPPUNIT_ASSERT_EQUAL(SCCOL(0), pSparkline->getColumn()); +CPPUNIT_ASSERT_EQUAL(SCROW(6), pSparkline->getRow()); + +// Redo +rDocument.GetUndoManager()->Redo(); + +// Check Sparkline at cell A7 doesn't exists +pSparkline = rDocument.GetSparkline(aRange.aStart); +CPPUNIT_ASSERT(!pSparkline); + +CPPUNIT_ASSERT(!rDocument.HasSpar
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/SparklineGroup.hxx | 31 +- sc/inc/clipcontext.hxx |7 +- sc/inc/column.hxx | 11 +++ sc/inc/mtvcellfunc.hxx |8 ++ sc/qa/unit/SparklineTest.cxx| 110 sc/source/core/data/clipcontext.cxx | 21 ++ sc/source/core/data/column.cxx |1 sc/source/core/data/column2.cxx | 87 +--- sc/source/core/data/column3.cxx | 14 sc/source/core/data/column4.cxx | 50 ++-- sc/source/core/data/document10.cxx |3 sc/source/ui/inc/cliputil.hxx |6 + 12 files changed, 327 insertions(+), 22 deletions(-) New commits: commit b8cf500ed8ac7bd01a351e2815ce8251e506d79c Author: Tomaž Vajngerl AuthorDate: Sat Mar 19 12:52:21 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Apr 4 09:51:36 2022 +0200 sc: add support for copy/cut and paste of Sparklines Currently cut,copy and paste will copy the Sparkline and create a new SparklineGroup for each cell in the new cell range. This probably need to be adjusted so the SparklineGroup is shared. Change-Id: I6f86bb026753b2b4b5bfa46aca4ca9794721f311 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132473 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/SparklineGroup.hxx b/sc/inc/SparklineGroup.hxx index 0d3935492d04..9f00985e9f61 100644 --- a/sc/inc/SparklineGroup.hxx +++ b/sc/inc/SparklineGroup.hxx @@ -105,7 +105,36 @@ public: { } -SparklineGroup(const SparklineGroup&) = delete; +SparklineGroup(SparklineGroup const& pOtherSparkline) +: m_aColorSeries(pOtherSparkline.m_aColorSeries) +, m_aColorNegative(pOtherSparkline.m_aColorNegative) +, m_aColorAxis(pOtherSparkline.m_aColorAxis) +, m_aColorMarkers(pOtherSparkline.m_aColorMarkers) +, m_aColorFirst(pOtherSparkline.m_aColorFirst) +, m_aColorLast(pOtherSparkline.m_aColorLast) +, m_aColorHigh(pOtherSparkline.m_aColorHigh) +, m_aColorLow(pOtherSparkline.m_aColorLow) +, m_eMinAxisType(pOtherSparkline.m_eMinAxisType) +, m_eMaxAxisType(pOtherSparkline.m_eMaxAxisType) +, m_fLineWeight(pOtherSparkline.m_fLineWeight) +, m_eType(pOtherSparkline.m_eType) +, m_bDateAxis(pOtherSparkline.m_bDateAxis) +, m_eDisplayEmptyCellsAs(pOtherSparkline.m_eDisplayEmptyCellsAs) +, m_bMarkers(pOtherSparkline.m_bMarkers) +, m_bHigh(pOtherSparkline.m_bHigh) +, m_bLow(pOtherSparkline.m_bLow) +, m_bFirst(pOtherSparkline.m_bFirst) +, m_bLast(pOtherSparkline.m_bLast) +, m_bNegative(pOtherSparkline.m_bNegative) +, m_bDisplayXAxis(pOtherSparkline.m_bDisplayXAxis) +, m_bDisplayHidden(pOtherSparkline.m_bDisplayHidden) +, m_bRightToLeft(pOtherSparkline.m_bRightToLeft) +, m_aManualMax(pOtherSparkline.m_aManualMax) +, m_aManualMin(pOtherSparkline.m_aManualMin) +, m_sUID(pOtherSparkline.m_sUID) +{ +} + SparklineGroup& operator=(const SparklineGroup&) = delete; }; diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx index 32e2dd97767a..b09e1be78761 100644 --- a/sc/inc/clipcontext.hxx +++ b/sc/inc/clipcontext.hxx @@ -12,6 +12,7 @@ #include "address.hxx" #include "cellvalue.hxx" #include "celltextattr.hxx" +#include "Sparkline.hxx" #include #include @@ -60,11 +61,11 @@ class SC_DLLPUBLIC CopyFromClipContext final : public ClipContextBase std::vector maSingleCellAttrs; std::vector maSinglePatterns; std::vector maSingleNotes; +std::vector> maSingleSparkline; ScConditionalFormatList* mpCondFormatList; bool mbAsLink:1; bool mbSkipEmptyCells:1; -bool mbCloneNotes:1; bool mbTableProtected:1; public: @@ -119,6 +120,9 @@ public: const ScPostIt* getSingleCellNote( size_t nColOffset ) const; void setSingleCellNote( size_t nColOffset, const ScPostIt* pNote ); +std::shared_ptr const& getSingleSparkline(size_t nColOffset) const; +void setSingleSparkline(size_t nColOffset, std::shared_ptr const& pSparkline); + void setCondFormatList( ScConditionalFormatList* pCondFormatList ); ScConditionalFormatList* getCondFormatList(); @@ -135,6 +139,7 @@ public: */ bool isSkipEmptyCells() const; bool isCloneNotes() const; +bool isCloneSparklines() const; bool isDateCell( const ScColumn& rCol, SCROW nRow ) const; }; diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 36ea217a481a..3afda2acd885 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -229,6 +229,9 @@ friend class sc::CellStoreEvent; SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv, const ScSetStringParam* pParam ); +void duplicateSparkline(sc::CopyFromClipContext& rContext, sc::ColumnBlockPosition* pBlockPos, +
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |2 +- sc/inc/table.hxx |2 +- sc/qa/unit/SparklineImportExportTest.cxx | 12 ++-- sc/qa/unit/SparklineTest.cxx | 10 +- sc/source/core/data/document.cxx |4 ++-- sc/source/core/data/table2.cxx | 11 --- sc/source/ui/view/cellsh.cxx |4 ++-- sc/source/ui/view/output.cxx |4 ++-- 8 files changed, 23 insertions(+), 26 deletions(-) New commits: commit 413f144e84629fe8f3bae5d984b40228fdeec5c1 Author: Tomaž Vajngerl AuthorDate: Sat Mar 19 10:56:27 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Apr 4 04:20:21 2022 +0200 sc: change GetSparkline to return a shared_ptr instead of raw ptr Change-Id: If3d7b3ad4b96eb7d3b126ee8b130f8d5e684cd3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132472 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 420c0eb06e35..979f6d6985f1 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1249,7 +1249,7 @@ public: sc::MultiDataCellState HasMultipleDataCells( const ScRange& rRange ) const; /** Spaklines */ -SC_DLLPUBLIC sc::Sparkline* GetSparkline(ScAddress const & rPosition); +SC_DLLPUBLIC std::shared_ptr GetSparkline(ScAddress const & rPosition); SC_DLLPUBLIC sc::Sparkline* CreateSparkline(ScAddress const & rPosition, std::shared_ptr const& pSparklineGroup); SC_DLLPUBLIC sc::SparklineList* GetSparklineList(SCTAB nTab); SC_DLLPUBLIC bool DeleteSparkline(ScAddress const& rPosition); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 00ae196f88ab..14eb33fa50f7 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -472,7 +472,7 @@ public: // Sparklines -sc::Sparkline* GetSparkline(SCCOL nCol, SCROW nRow); +std::shared_ptr GetSparkline(SCCOL nCol, SCROW nRow); sc::Sparkline* CreateSparkline(SCCOL nCol, SCROW nRow, std::shared_ptr const& pSparklineGroup); bool DeleteSparkline(SCCOL nCol, SCROW nRow); diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index fe15d783b58e..25af95c8770e 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -57,7 +57,7 @@ void checkSparklines(ScDocument& rDocument) { // Sparkline at Sheet1:A2 { -sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 +auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 CPPUNIT_ASSERT(pSparkline); auto pSparklineGroup = pSparkline->getSparklineGroup(); CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Line, pSparklineGroup->m_eType); @@ -90,7 +90,7 @@ void checkSparklines(ScDocument& rDocument) } // Sparkline at Sheet1:A3 { -sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(0, 2, 0)); // A3 +auto pSparkline = rDocument.GetSparkline(ScAddress(0, 2, 0)); // A3 CPPUNIT_ASSERT(pSparkline); auto pSparklineGroup = pSparkline->getSparklineGroup(); CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Column, pSparklineGroup->m_eType); @@ -123,28 +123,28 @@ void checkSparklines(ScDocument& rDocument) } // Sparkline at Sheet2:B1 { -sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(1, 0, 1)); //B1 +auto pSparkline = rDocument.GetSparkline(ScAddress(1, 0, 1)); //B1 CPPUNIT_ASSERT(pSparkline); auto pSparklineGroup = pSparkline->getSparklineGroup(); CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Column, pSparklineGroup->m_eType); } // Sparkline at Sheet2:B2 { -sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(1, 1, 1)); //B2 +auto pSparkline = rDocument.GetSparkline(ScAddress(1, 1, 1)); //B2 CPPUNIT_ASSERT(pSparkline); auto pSparklineGroup = pSparkline->getSparklineGroup(); CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Line, pSparklineGroup->m_eType); } // Sparkline at Sheet2:B2 { -sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(1, 1, 1)); //B2 +auto pSparkline = rDocument.GetSparkline(ScAddress(1, 1, 1)); //B2 CPPUNIT_ASSERT(pSparkline); auto pSparklineGroup = pSparkline->getSparklineGroup(); CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Line, pSparklineGroup->m_eType); } // Sparkline doesn't exists at A4 { -sc::Sparkline* pSparkline = rDocument.GetSparkline(ScAddress(0, 3, 0)); //A4 +auto pSparkline = rDocument.GetSparkline(ScAddress(0, 3, 0)); //A4 CPPUNIT_ASSERT(!pSparkline); } } diff --git a/sc/qa/unit/SparklineTest.cxx b/sc/qa/unit/SparklineTest.cxx index 74f40579d99f..2a2dfde71b5b 100644 --- a/sc/qa/unit/SparklineTest.cxx +++ b/sc/qa/unit/SparklineTest.cxx @@ -82,13 +82,13 @@ void SparklineTest::testAddSparkli
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/Sparkline.hxx |3 ++- sc/qa/unit/SparklineImportExportTest.cxx |1 + sc/source/filter/excel/export/SparklineExt.cxx |1 + sc/source/ui/view/output.cxx |1 + 4 files changed, 5 insertions(+), 1 deletion(-) New commits: commit e60726891761ca29dcb72e27f075fef75a990c24 Author: Tomaž Vajngerl AuthorDate: Thu Mar 10 14:05:41 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Fri Apr 1 12:44:31 2022 +0200 sc: use forward decl. instead of include for SparklineGroup Shouldn't trigger large rebuilding when SparklineGroup.hxx is changed. Change-Id: I9c5d265e94dd92d9f23e86e3fc75ca0644991339 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132250 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/inc/Sparkline.hxx b/sc/inc/Sparkline.hxx index 5ba9d397d083..9a6109e96e79 100644 --- a/sc/inc/Sparkline.hxx +++ b/sc/inc/Sparkline.hxx @@ -11,12 +11,13 @@ #pragma once #include "scdllapi.h" -#include "SparklineGroup.hxx" #include "rangelst.hxx" #include namespace sc { +class SparklineGroup; + /** Sparkline data, used for rendering the content of a cell * * Contains the input range of the data that is being drawn and a reference diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index f1af8f9d5eb1..fe15d783b58e 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -12,6 +12,7 @@ #include #include #include +#include using namespace css; diff --git a/sc/source/filter/excel/export/SparklineExt.cxx b/sc/source/filter/excel/export/SparklineExt.cxx index f0f3cd9e1d98..9f41d9197b6a 100644 --- a/sc/source/filter/excel/export/SparklineExt.cxx +++ b/sc/source/filter/excel/export/SparklineExt.cxx @@ -12,6 +12,7 @@ #include #include #include +#include using namespace oox; diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index bb83c2a2f54e..2d7e097a4a08 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -64,6 +64,7 @@ #include #include +#include #include #include
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx | 14 +++--- sc/inc/table.hxx |8 sc/qa/unit/ucalc.cxx | 19 +++ sc/source/core/data/document.cxx | 12 ++-- sc/source/core/data/table2.cxx|7 +++ sc/source/filter/xml/xmlexprt.cxx |8 6 files changed, 43 insertions(+), 25 deletions(-) New commits: commit b8720d1e1f0842d52f1830c48ef7551b1868ae6f Author: Luboš Luňák AuthorDate: Fri Mar 25 12:42:58 2022 +0100 Commit: Luboš Luňák CommitDate: Fri Mar 25 15:20:58 2022 +0100 fix ScTable::GetLastChangedCol() for unallocated columns Column flags and widths are stored separately from ScColumn data, and so don't depend on allocated columns count. Also rename the functions from the misleading generic name to what they actually do. Change-Id: If85ae80efda1d8b382fa3b559aa65be0292e25ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132114 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index cd7138b3e945..639166319366 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2025,17 +2025,17 @@ public: */ voidSyncColRowFlags(); -/// @return the index of the last row with any set flags (auto-pagebreak is ignored). +/// @return the index of the last row with any set flags (auto-pagebreak is ignored). SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const; -/// @return the index of the last changed column (flags and column width, auto pagebreak is ignored). -SCCOL GetLastChangedCol( SCTAB nTab ) const; -/// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). -SCROW GetLastChangedRow( SCTAB nTab ) const; +/// @return the index of the last changed column (flags and column width, auto pagebreak is ignored). +SCCOL GetLastChangedColFlagsWidth( SCTAB nTab ) const; +/// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). +SCROW GetLastChangedRowFlagsWidth( SCTAB nTab ) const; -SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const; +SCCOL GetNextDifferentChangedColFlagsWidth( SCTAB nTab, SCCOL nStart) const; -SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart) const; +SCROW GetNextDifferentChangedRowFlagsWidth( SCTAB nTab, SCROW nStart) const; // returns whether to export a Default style for this col or not // nDefault is set to one position in the current row where the Default style is diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 58fb6c4a45ad..a885067f5649 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -870,10 +870,10 @@ public: /// @return the index of the last row with any set flags (auto-pagebreak is ignored). SCROW GetLastFlaggedRow() const; -/// @return the index of the last changed column (flags and column width, auto pagebreak is ignored). -SCCOL GetLastChangedCol() const; -/// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). -SCROW GetLastChangedRow() const; +/// @return the index of the last changed column (flags and column width, auto pagebreak is ignored). +SCCOL GetLastChangedColFlagsWidth() const; +/// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). +SCROW GetLastChangedRowFlagsWidth() const; bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const; bool IsDataFiltered(const ScRange& rRange) const; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 895d5a96bf89..020e43c6dbde 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -117,6 +117,7 @@ public: void testValueIterator(); void testHorizontalAttrIterator(); void testIteratorsUnallocatedColumnsAttributes(); +void testLastChangedColFlagsWidth(); /** * More direct test for cell broadcaster management, used to track formula @@ -250,6 +251,7 @@ public: CPPUNIT_TEST(testValueIterator); CPPUNIT_TEST(testHorizontalAttrIterator); CPPUNIT_TEST(testIteratorsUnallocatedColumnsAttributes); +CPPUNIT_TEST(testLastChangedColFlagsWidth); CPPUNIT_TEST(testCellBroadcaster); CPPUNIT_TEST(testFuncParam); CPPUNIT_TEST(testNamedRange); @@ -1456,6 +1458,23 @@ void Test::testIteratorsUnallocatedColumnsAttributes() m_pDoc->DeleteTab(0); } +void Test::testLastChangedColFlagsWidth() +{ +m_pDoc->InsertTab(0, "Tab1"); + +constexpr SCCOL firstChangedCol = 100; +assert( firstChangedCol > INITIALCOLCOUNT ); +for( SCCOL col = fi
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/attarray.hxx|1 sc/inc/column.hxx | 16 ++-- sc/inc/document.hxx|9 + sc/inc/table.hxx |9 +++-- sc/qa/unit/subsequent_export_test2.cxx | 33 ++ sc/qa/unit/ucalc.cxx | 54 ++ sc/source/core/data/attarray.cxx | 20 +++ sc/source/core/data/column3.cxx|2 - sc/source/core/data/dociter.cxx| 59 + sc/source/core/data/table1.cxx | 15 10 files changed, 181 insertions(+), 37 deletions(-) New commits: commit 7a9e60c4b7d6c28f5b3e084e3db9ab2445c94bfd Author: Luboš Luňák AuthorDate: Wed Mar 9 15:12:43 2022 +0100 Commit: Luboš Luňák CommitDate: Thu Mar 10 08:34:58 2022 +0100 fix attr iterators to walk even unallocated columns if needed Things like applying bold to an entire row no longer allocates all rows after my recent changes, but the attribute change is done in ScTable to the default attribute of unallocated columns. That means that clamping column positions to the end of allocated columns is no longer valid when handling attributes. Add functions that clamp depending on whether unallocated columns have a non-default attribute set. Change-Id: I879d0a034c0b336064361d0f8cb12e5a8da22b9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131265 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 34d1403bcc91..c08da494c142 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -221,6 +221,7 @@ public: boolReserve( SCSIZE nReserve ); SCSIZE Count() const { return mvData.size(); } SCSIZE Count( SCROW nRow1, SCROW nRow2 ) const; +boolHasNonDefPattern( SCROW nStartRow, SCROW nEndRow ) const; private: const ScPatternAttr* SetPatternAreaImpl( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern, diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 0b5fb0aa8ff2..2cf4bdd66573 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -161,6 +161,11 @@ public: boolHasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const; boolHasAttrib( SCROW nRow, HasAttrFlags nMask, SCROW* nStartRow = nullptr, SCROW* nEndRow = nullptr ) const; +std::unique_ptr CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const; + +boolIsAllAttrEqual( const ScColumnData& rCol, SCROW nStartRow, SCROW nEndRow ) const; +boolHasNonDefPattern( SCROW nStartRow, SCROW nEndRow ) const; + voidClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark, SCCOL nCol ); voidChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark, SCCOL nCol ); }; @@ -207,7 +212,6 @@ friend class ScCountIfCellIterator; friend class ScFormulaGroupIterator; friend class ScCellIterator; friend class ScHorizontalCellIterator; -friend class ScHorizontalAttrIterator; friend class ScColumnTextWidthIterator; friend class ScDocumentImport; friend class sc::DocumentStreamAccess; @@ -299,7 +303,6 @@ public: boolGetLastVisibleAttr( SCROW& rLastRow ) const; boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const; boolIsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const; -boolIsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const; boolTestInsertCol( SCROW nStartRow, SCROW nEndRow) const; bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const; @@ -348,8 +351,6 @@ public: sc::MixDocContext& rCxt, SCROW nRow1, SCROW nRow2, ScPasteFunc nFunction, bool bSkipEmpty, const ScColumn& rSrcCol ); -std::unique_ptr CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const; - void UpdateSelectionFunction( const ScRangeList& rRanges, ScFunctionData& rData, const ScFlatBoolRowSegments& rHiddenRows ); @@ -835,11 +836,16 @@ inline bool ScColumn::IsEmptyAttr() const return pAttrArray->IsEmpty(); } -inline bool ScColumn::IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const +inline bool ScColumnData::IsAllAttrEqual( const ScColumnData& rCol, SCROW nStartRow, SCROW nEndRow ) const { return pAttrArray->IsAllEqual( *rCol.pAttrArray, nStartRow, nEndRow ); } +inline bool ScColumnData::HasNonDefPattern( SCROW nStartRow, SCROW nEndRow ) const +{ +return pAttrArray->HasNonDefPattern( nStartRow, nEndRow ); +} + inline bool ScColumn::IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const { return pAttrArray->IsVisibleEqual( *rCol.pAttrArray, nStartRow, nEndRow ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f9640ab74c6d..734e2d0dcd75 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -821,6 +821,15 @@ pub
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/compiler.hxx |2 +- sc/qa/unit/data/ods/named-range-conflict.ods |binary sc/qa/unit/jumbosheets-test.cxx | 26 ++ sc/source/core/tool/compiler.cxx | 20 +--- 4 files changed, 44 insertions(+), 4 deletions(-) New commits: commit 582fc887f1faafe8ff5f16a13a0208483a93353f Author: Luboš Luňák AuthorDate: Wed Mar 2 17:30:30 2022 +0100 Commit: Luboš Luňák CommitDate: Fri Mar 4 18:16:43 2022 +0100 keep conflicting named ranges working with 16k columns Named ranges named e.g. 'num1' are actually valid cell addresses when using 16k columns. We prevent naming ranges in a way that would make them conflict, but it's possible to read them from a saved file that was created with fewer columns, and in such cases formulas using them would silently refer to those cells instead of to the named range. I don't see anything in the ODF spec, but OOXML in 18.2.5 recommends this in case there are conflicts (only outside of the normal Excel range of A1-XFD1048576, inside they are always meant to be references, but our normal range currently is only 1k columns, and it's simpler and probably harmless to always resolve a conflict this way). I can optimize performance of this in another commit if needed. Change-Id: I46aef54b069700e7bf268b50fdc1a88989f3ee29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130891 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index c2bdb29b478d..15b3823f649d 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -357,7 +357,7 @@ private: bool ParsePredetectedReference( const OUString& rSymbol ); bool ParsePredetectedErrRefReference( const OUString& rName, const OUString* pErrRef ); bool ParseMacro( const OUString& ); -bool ParseNamedRange( const OUString& ); +bool ParseNamedRange( const OUString&, bool onlyCheck = false ); bool ParseExternalNamedRange( const OUString& rSymbol, bool& rbInvalidExternalNameRange ); bool ParseDBRange( const OUString& ); bool ParseColRowName( const OUString& ); diff --git a/sc/qa/unit/data/ods/named-range-conflict.ods b/sc/qa/unit/data/ods/named-range-conflict.ods new file mode 100644 index ..b014cad532ec Binary files /dev/null and b/sc/qa/unit/data/ods/named-range-conflict.ods differ diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 76f223564b9a..deb516ae5b91 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -45,6 +45,7 @@ public: void testRoundtripColumn2000Xlsx(); void testRoundtripColumnRange(); void testRoundtripNamedRanges(); +void testNamedRangeNameConflict(); void testTdf134553(); void testTdf134392(); void testTdf147509(); @@ -57,6 +58,7 @@ public: CPPUNIT_TEST(testRoundtripColumn2000Xlsx); CPPUNIT_TEST(testRoundtripColumnRange); CPPUNIT_TEST(testRoundtripNamedRanges); +CPPUNIT_TEST(testNamedRangeNameConflict); CPPUNIT_TEST(testTdf134553); CPPUNIT_TEST(testTdf134392); CPPUNIT_TEST(testTdf147509); @@ -222,6 +224,30 @@ void ScJumboSheetsTest::testRoundtripNamedRanges() xDocSh3->DoClose(); } +void ScJumboSheetsTest::testNamedRangeNameConflict() +{ +// The document contains named ranges named 'num1' and 'num2', that should be still treated +// as named references even though with 16k columns those are normally NUM1 and NUM2 cells. +ScDocShellRef xDocSh = loadDoc(u"named-range-conflict.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); +ScDocument& rDoc = xDocSh->GetDocument(); +rDoc.CalcAll(); +CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(10022, 0, 0)); // NUM1 +CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(10022, 1, 0)); // NUM2 +CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(0, 0, 0)); // = num1 +CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(0, 1, 0)); // = sheet2.num2 +CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(0, 2, 0)); // = SUM(NUM1:NUM2) (not named ranges) +rDoc.SetValue(10022, 0, 0, 100); // NUM1 +rDoc.SetValue(10022, 1, 0, 200); // NUM2 +rDoc.CalcAll(); +// First two are the same, the sum changes. +CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(0, 0, 0)); +CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(0, 1, 0)); +CPPUNIT_ASSERT_EQUAL(300.0, rDoc.GetValue(0, 2, 0)); + +xDocSh->DoClose(); +} + void ScJumboSheetsTest::testTdf134553() { ScDocShellRef xDocSh = loadDocAndSetupModelViewController(u"tdf134553.", FORMAT_XLSX); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 0b0dce39134f..fca54da17f9c 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3344,6 +3344,18 @@ bool ScCompiler::ParseSingleReference( const OUString& rName, const OUString* pE return false; } +//
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/markmulti.hxx |3 ++ sc/qa/unit/uicalc/uicalc.cxx | 41 sc/source/core/data/markmulti.cxx | 19 sc/source/core/data/table2.cxx| 43 +++--- 4 files changed, 99 insertions(+), 7 deletions(-) New commits: commit 3db91487e57277f75d64d95d06d4ddcc29f1c4e0 Author: Luboš Luňák AuthorDate: Fri Mar 4 14:18:02 2022 +0100 Commit: Luboš Luňák CommitDate: Fri Mar 4 16:41:58 2022 +0100 set properly attributes for cells in unallocated Calc columns ScTable::ApplySelectionCache() was setting attributes only for allocated columns, so e.g. selecting a whole column and making it bold didn't actually set all of it bold. Make sure it set it for all columns, and make use of the default attribute for unallocated columns to avoid allocating columns just to set them the same attribute. Change-Id: Ie9886317d7a91c6a43951af69b717f9ba32a1c9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130984 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/markmulti.hxx b/sc/inc/markmulti.hxx index bb028e14a7a8..9861342dc49b 100644 --- a/sc/inc/markmulti.hxx +++ b/sc/inc/markmulti.hxx @@ -52,6 +52,9 @@ public: bool IsAllMarked( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const; bool HasEqualRowsMarked( SCCOL nCol1, SCCOL nCol2 ) const; SCROW GetNextMarked( SCCOL nCol, SCROW nRow, bool bUp ) const; +// Returns the first column of the range [column,nLastCol] for which +// all those columns have equal marks. Value returned is not less than nMinCol. +SCCOL GetStartOfEqualColumns( SCCOL nLastCol, SCCOL nMinCol = 0 ) const; void SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow, bool bMark ); void Set( ScRangeList const & ); bool IsRowMarked( SCROW nRow ) const; diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 0861d04fc4a6..00f966e2685d 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2273,6 +2273,47 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126926) CPPUNIT_ASSERT(pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testUnallocatedColumnsAttributes) +{ +mxComponent = loadFromDesktop("private:factory/scalc"); +ScModelObj* pModelObj = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pModelObj); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +// If this check fails, this entire test needs adjusting. +CPPUNIT_ASSERT_EQUAL(SCCOL(64), pDoc->GetAllocatedColumnsCount(0)); + +// Except for first 10 cells make the entire first row bold. +goToCell("K1:" + pDoc->MaxColAsString() + "1"); +dispatchCommand(mxComponent, ".uno:Bold", {}); + +// That shouldn't need allocating more columns, just changing the default attribute. +CPPUNIT_ASSERT_EQUAL(SCCOL(64), pDoc->GetAllocatedColumnsCount(0)); +vcl::Font aFont; +pDoc->GetPattern(pDoc->MaxCol(), 0, 0)->GetFont(aFont, SC_AUTOCOL_RAW); +CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); + +goToCell("A2:CV2"); // first 100 cells in row 2 +dispatchCommand(mxComponent, ".uno:Bold", {}); +// These need to be explicitly allocated. +CPPUNIT_ASSERT_EQUAL(SCCOL(100), pDoc->GetAllocatedColumnsCount(0)); +pDoc->GetPattern(99, 1, 0)->GetFont(aFont, SC_AUTOCOL_RAW); +CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); +pDoc->GetPattern(100, 1, 0)->GetFont(aFont, SC_AUTOCOL_RAW); +CPPUNIT_ASSERT_EQUAL_MESSAGE("font should not be bold", WEIGHT_NORMAL, aFont.GetWeight()); + +goToCell("CW3:" + pDoc->MaxColAsString() + "3"); // All but first 100 cells in row 3. +dispatchCommand(mxComponent, ".uno:Bold", {}); +// First 100 columns need to be allocated to not be bold, the rest should be handled +// by the default attribute. +CPPUNIT_ASSERT_EQUAL(SCCOL(100), pDoc->GetAllocatedColumnsCount(0)); +pDoc->GetPattern(99, 2, 0)->GetFont(aFont, SC_AUTOCOL_RAW); +CPPUNIT_ASSERT_EQUAL_MESSAGE("font should not be bold", WEIGHT_NORMAL, aFont.GetWeight()); +pDoc->GetPattern(100, 2, 0)->GetFont(aFont, SC_AUTOCOL_RAW); +CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx index dc0ebc528b06..3f1d4cbf0e6a 100644 --- a/sc/source/core/data/markmulti.cxx +++ b/sc/source/core/data/markmulti.cxx @@ -152,6 +152,25 @@ bool ScMultiSel::HasEqualRowsMarked( SCCOL nCol1, SCCOL nCol2 ) const return true; } +SCCOL ScMultiSel::GetStartOfEqualColumns( SCCOL nLastCol, SCCOL nMinCol ) const +{ +if( nMinCol > nLastCol ) +return nMinCol; +if( nLastCol >= static_cast(aMultiSelCont
[Libreoffice-commits] core.git: sc/inc sc/qa
sc/inc/address.hxx |5 + sc/inc/document.hxx |2 ++ sc/inc/sheetlimits.hxx | 10 ++ sc/qa/unit/ucalc_formula.cxx |4 +--- 4 files changed, 18 insertions(+), 3 deletions(-) New commits: commit fbb0b0a203f19d7a4dc64c47abd6d4b1d8c17340 Author: Luboš Luňák AuthorDate: Thu Mar 3 17:45:52 2022 +0100 Commit: Luboš Luňák CommitDate: Fri Mar 4 08:08:42 2022 +0100 provide MAXCOL/MAXROW also as strings Primarily for use in tests. Change-Id: Icb962cbdfa63a3b50115314e9afd46f3fa1a928a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130939 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index ce910f42cf49..18bd11049e92 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -81,6 +81,11 @@ const SCROW MAXTILEDROW= 50; const SCTAB MAXINITTAB = 1024; const SCTAB MININITTAB = 1; +inline constexpr OUStringLiteral MAXROW_STRING(u"1048575"); +inline constexpr OUStringLiteral MAXCOL_STRING(u"AMJ"); +inline constexpr OUStringLiteral MAXROW_JUMBO_STRING(u"16777215"); +inline constexpr OUStringLiteral MAXCOL_JUMBO_STRING(u"XFD"); + // Special values const SCTAB SC_TAB_APPEND = SCTAB_MAX; const SCTAB TABLEID_DOC = SCTAB_MAX; // entire document, e.g. protect diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 344e99e130f8..4e8eab09ed5d 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -879,6 +879,8 @@ public: SC_DLLPUBLIC SCROW MaxRow() const { return mxSheetLimits->mnMaxRow; } SC_DLLPUBLIC SCCOL GetMaxColCount() const { return mxSheetLimits->GetMaxColCount(); } SC_DLLPUBLIC SCROW GetMaxRowCount() const { return mxSheetLimits->GetMaxRowCount(); } +SC_DLLPUBLIC OUString MaxRowAsString() const { return mxSheetLimits->MaxRowAsString(); } +SC_DLLPUBLIC OUString MaxColAsString() const { return mxSheetLimits->MaxColAsString(); } ScSheetLimits& GetSheetLimits() const { return *mxSheetLimits; } [[nodiscard]] bool ValidCol(SCCOL nCol) const { return ::ValidCol(nCol, mxSheetLimits->mnMaxCol); } [[nodiscard]] bool ValidRow(SCROW nRow) const { return ::ValidRow(nRow, mxSheetLimits->mnMaxRow); } diff --git a/sc/inc/sheetlimits.hxx b/sc/inc/sheetlimits.hxx index c8dbc1165216..cbc017c9d10e 100644 --- a/sc/inc/sheetlimits.hxx +++ b/sc/inc/sheetlimits.hxx @@ -65,6 +65,16 @@ struct ScSheetLimits final : public salhelper::SimpleReferenceObject SCROW GetMaxRowCount() const { return mnMaxRow + 1; } // equivalent of MAXCOLCOUNT in address.hxx SCCOL GetMaxColCount() const { return mnMaxCol + 1; } +// max row number as string +OUString MaxRowAsString() const +{ +return mnMaxRow == MAXROW ? OUString(MAXROW_STRING) : OUString(MAXROW_JUMBO_STRING); +} +// mac col as string ("AMJ" or "XFD") +OUString MaxColAsString() const +{ +return mnMaxCol == MAXCOL ? OUString(MAXCOL_STRING) : OUString(MAXCOL_JUMBO_STRING); +} }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 4d31fbf9ea0f..a1790bb930c9 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -2501,9 +2501,7 @@ void TestFormula::testFormulaRefUpdateRange() // C3 with sticky reference including last column. m_pDoc->SetString( 2,2,1, "=SUM(23:23)"); // C4 with reference to last column. -CPPUNIT_ASSERT_MESSAGE("m_pDoc->MaxCol() changed, adapt unit test.", -m_pDoc->MaxCol() == 1023 || m_pDoc->MaxCol() == 16383); -m_pDoc->SetString( 2,3,1, m_pDoc->MaxCol() == 1023 ? "=SUM(AMJ22:AMJ23)" : "=SUM(XFD22:XFD23)"); +m_pDoc->SetString( 2,3,1, "=SUM(" + m_pDoc->MaxColAsString() + "22:" + m_pDoc->MaxColAsString() + "23)"); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result in C3.", 3.0, m_pDoc->GetValue(2,2,1)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result in C4.", 2.0, m_pDoc->GetValue(2,3,1)); // Delete last column.
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/markarr.hxx |2 sc/inc/markdata.hxx | 17 +++ sc/inc/markmulti.hxx |4 - sc/qa/extras/vba-macro-test.cxx | 30 ++-- sc/qa/unit/mark_test.cxx |4 - sc/source/core/data/column.cxx |3 - sc/source/core/data/documen3.cxx |3 - sc/source/core/data/document.cxx | 24 +++--- sc/source/core/data/drwlayer.cxx |3 - sc/source/core/data/markarr.cxx |8 --- sc/source/core/data/markdata.cxx | 45 --- sc/source/core/data/markmulti.cxx| 13 - sc/source/core/data/table1.cxx |4 - sc/source/core/data/table3.cxx |4 - sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |3 - sc/source/ui/app/seltrans.cxx|3 - sc/source/ui/docshell/docfunc.cxx| 21 +++- sc/source/ui/docshell/docsh5.cxx |3 - sc/source/ui/navipi/navipi.cxx |9 +-- sc/source/ui/undo/undoblk.cxx|5 -- sc/source/ui/unoobj/docuno.cxx | 10 +--- sc/source/ui/view/cellsh.cxx |3 - sc/source/ui/view/cellsh1.cxx|8 +-- sc/source/ui/view/cellsh2.cxx|2 sc/source/ui/view/dbfunc3.cxx|2 sc/source/ui/view/formatsh.cxx |4 - sc/source/ui/view/gridwin.cxx|3 - sc/source/ui/view/gridwin4.cxx |6 -- sc/source/ui/view/gridwin_dbgutil.cxx|4 - sc/source/ui/view/pfuncache.cxx |4 - sc/source/ui/view/tabview2.cxx | 13 ++--- sc/source/ui/view/tabview3.cxx | 13 + sc/source/ui/view/tabvwsh3.cxx |3 - sc/source/ui/view/viewdata.cxx |2 sc/source/ui/view/viewfun2.cxx | 15 ++ sc/source/ui/view/viewfun3.cxx |3 - sc/source/ui/view/viewfun4.cxx |4 - sc/source/ui/view/viewfunc.cxx | 14 ++--- sc/source/ui/view/viewutil.cxx |3 - 39 files changed, 90 insertions(+), 234 deletions(-) New commits: commit f92e15bc09def64a718b52812a9cb39e43fb8b5b Author: Luboš Luňák AuthorDate: Thu Mar 3 10:57:21 2022 +0100 Commit: Luboš Luňák CommitDate: Thu Mar 3 22:37:35 2022 +0100 improve ScMark* classes a bit Bin pointless empty destructors, make trivial functions inline, return value by simply returning it. Change-Id: Ia71e73262802bbe6b022ca4bafb2b958ffdf39f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130915 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx index de0b3361cfab..03e94b7d302b 100644 --- a/sc/inc/markarr.hxx +++ b/sc/inc/markarr.hxx @@ -52,7 +52,6 @@ public: ScMarkArray( const ScSheetLimits& rLimits ); ScMarkArray( ScMarkArray&& rArray ) noexcept; ScMarkArray( const ScMarkArray& rArray ); -~ScMarkArray(); voidReset( bool bMarked = false, SCSIZE nNeeded = 1 ); boolGetMark( SCROW nRow ) const; voidSetMarkArea( SCROW nStartRow, SCROW nEndRow, bool bMarked ); @@ -82,7 +81,6 @@ class SC_DLLPUBLIC ScMarkArrayIter // iterate over selected range SCSIZE nPos; public: ScMarkArrayIter( const ScMarkArray* pNewArray ); -~ScMarkArrayIter(); boolNext( SCROW& rTop, SCROW& rBottom ); voidreset( const ScMarkArray* pNewArray ); diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx index 69a7acfde8ab..6c2969e6e50a 100644 --- a/sc/inc/markdata.hxx +++ b/sc/inc/markdata.hxx @@ -67,7 +67,6 @@ public: ScMarkData(ScMarkData&& rData) = default; ScMarkData& operator=(const ScMarkData& rData); ScMarkData& operator=(ScMarkData&& rData); -~ScMarkData(); voidResetMark(); voidSetMarkArea( const ScRange& rRange ); @@ -81,8 +80,8 @@ public: boolIsMarked() const{ return bMarked; } boolIsMultiMarked() const { return bMultiMarked; } -voidGetMarkArea( ScRange& rRange ) const; -voidGetMultiMarkArea( ScRange& rRange ) const; +const ScRange& GetMarkArea() const { return aMarkRange; } +const ScRange& GetMultiMarkArea() const { return aMultiRange; } voidSetAreaTab( SCTAB nTab ); @@ -104,7 +103,7 @@ public: // for FillInfo / Document etc. const ScMultiSel& GetMultiSe
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/column.hxx |2 + sc/inc/document.hxx | 10 +++ sc/inc/mtvelements.hxx |2 + sc/inc/table.hxx|4 +++ sc/qa/unit/helper/qahelper.hxx |1 sc/qa/unit/ucalc.cxx| 46 sc/source/core/data/column4.cxx | 15 +++ sc/source/core/data/document10.cxx | 18 ++ sc/source/core/data/mtvelements.cxx |5 +++ sc/source/core/data/table7.cxx | 19 ++ 10 files changed, 122 insertions(+) New commits: commit 974bf22680b702b9474d4a91dbf1d06a785ff774 Author: Kohei Yoshida AuthorDate: Thu Feb 24 23:17:09 2022 -0500 Commit: Kohei Yoshida CommitDate: Sat Feb 26 01:43:32 2022 +0100 tdf#147298: Add a simple test case for formula cell tracking by column. Change-Id: Ibdd72c08f8660ade511fdce8b3fb7cd3ed97f4b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130511 Tested-by: Jenkins Reviewed-by: Kohei Yoshida diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 2e1f0df49bdb..e23eac0fdab1 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -719,6 +719,8 @@ public: SCSIZE GetPatternCount( SCROW nRow1, SCROW nRow2 ) const; boolReservePatternCount( SCSIZE nReserve ); +void CheckIntegrity() const; + private: sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow, std::vector& rNewSharedRows, diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index b0557751ae22..344e99e130f8 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2229,6 +2229,16 @@ public: std::set GetDocColors(); sc::IconSetBitmapMap& GetIconSetBitmapMap(); +std::set QueryColumnsWithFormulaCells( SCTAB nTab ) const; + +/** + * Check the integrity of the internal table state. Useful from testing + * code. It throws an exception upon first failure. + * + * Feel free to add more checks as needed. + */ +void CheckIntegrity( SCTAB nTab ) const; + private: ScDocument(const ScDocument& r) = delete; diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx index 75cdea9483bd..c74e1bc7d91b 100644 --- a/sc/inc/mtvelements.hxx +++ b/sc/inc/mtvelements.hxx @@ -100,6 +100,8 @@ public: void stop(); void swap(CellStoreEvent& other); + +const ScColumn* getColumn() const; }; struct CellStoreTrait diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 08624a937172..4a8654a67344 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1108,6 +1108,10 @@ public: */ OString dumpSheetGeomData(bool bColumns, SheetGeomType eGeomType); +std::set QueryColumnsWithFormulaCells() const; + +void CheckIntegrity() const; + private: void FillFormulaVertical( diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index eb400e68acba..e1b1ee6c65f9 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -29,6 +29,7 @@ #include #include +#include namespace utl { class TempFile; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ffb8d2fbe4eb..1d02913dab9c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -222,6 +222,8 @@ public: void testProtectedSheetEditByRow(); void testProtectedSheetEditByColumn(); +void testInsertColumnsWithFormulaCells(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); CPPUNIT_TEST(testSharedStringPool); @@ -311,6 +313,7 @@ public: CPPUNIT_TEST(testPrecisionAsShown); CPPUNIT_TEST(testProtectedSheetEditByRow); CPPUNIT_TEST(testProtectedSheetEditByColumn); +CPPUNIT_TEST(testInsertColumnsWithFormulaCells); CPPUNIT_TEST_SUITE_END(); private: @@ -6645,6 +6648,49 @@ void Test::testProtectedSheetEditByColumn() m_pDoc->DeleteTab(0); } +void Test::testInsertColumnsWithFormulaCells() +{ +m_pDoc->InsertTab(0, "Tab1"); + +std::set aCols = m_pDoc->QueryColumnsWithFormulaCells(0); +CPPUNIT_ASSERT_MESSAGE("empty sheet should contain no formula cells.", aCols.empty()); + +auto equals = [](const std::set& left, const std::set& right) +{ +return left == right; +}; + +// insert formula cells in columns 2, 4 and 6. +m_pDoc->SetFormula(ScAddress(2, 2, 0), "=1", m_pDoc->GetGrammar()); +m_pDoc->SetFormula(ScAddress(4, 2, 0), "=1", m_pDoc->GetGrammar()); +m_pDoc->SetFormula(ScAddress(6, 2, 0), "=1", m_pDoc->GetGrammar()); + +aCols = m_pDoc->QueryColumnsWithFormulaCells(0); + +std::set aExpected = { 2, 4, 6 }; +CPPUNIT_ASSERT_MESSAGE("Columns 2, 4 and 6 should contain formula cells.", equals(aExpected, aCols)); + +// Insert 2 columns at column A to shift everything to right by 2. +m_pDoc->InsertCol(0, 0, MAXROW, 0, 0, 2); + +aExpected = { 4, 6, 8 }; +aCols = m_pDoc->QueryColumnsWithFormulaCells(0); +CPPUNIT_ASSERT_MESSAGE("Columns 4, 6 and 8 should contain f
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source sc/uiconfig
sc/inc/strings.hrc|2 ++ sc/qa/uitest/sort/tdf105301.py| 14 +++--- sc/qa/uitest/sort/tdf49531.py |2 +- sc/qa/uitest/sort/tdf57465.py |2 +- sc/source/ui/dbgui/sortkeydlg.cxx |1 + sc/source/ui/dbgui/tpsort.cxx | 13 + sc/source/ui/inc/sortkeydlg.hxx |1 + sc/uiconfig/scalc/ui/sortkey.ui | 20 8 files changed, 34 insertions(+), 21 deletions(-) New commits: commit 35b9e7f90ca3751d474efff7745582b4bff3e2df Author: Heiko Tietze AuthorDate: Wed Feb 2 14:49:14 2022 +0100 Commit: Eike Rathke CommitDate: Fri Feb 11 00:09:29 2022 +0100 Resolves tdf#140290 - Make sort keys accessible Inline string is plain now in favor of the caption Column/Row before the dopdown control Change-Id: I7f012d38c360113b7207f19fa32437d28d90d049 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129366 Tested-by: Jenkins Reviewed-by: Heiko Tietze Reviewed-by: Eike Rathke diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 9a461a40d4ff..dd55baba8563 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -51,6 +51,8 @@ #define SCSTR_COLUMNNC_("SCSTR_COLUMN", "Column %1") // "%1 is replaced to row number, such as 'Row 1'" #define SCSTR_ROW NC_("SCSTR_ROW", "Row %1") +#define SCSTR_COLUMN_NAME NC_("SCSTR_COLUMN_NAME", "Column") +#define SCSTR_ROW_NAME NC_("SCSTR_ROW_NAME", "Row") #define SCSTR_TABLE NC_("SCSTR_TABLE", "Sheet") #define SCSTR_NAME NC_("SCSTR_NAME", "Name") #define SCSTR_APDTABLE NC_("SCSTR_APDTABLE", "Append Sheet") diff --git a/sc/qa/uitest/sort/tdf105301.py b/sc/qa/uitest/sort/tdf105301.py index da8730368023..ab4889d89e18 100644 --- a/sc/qa/uitest/sort/tdf105301.py +++ b/sc/qa/uitest/sort/tdf105301.py @@ -23,15 +23,15 @@ class tdf105301(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "0") -self.assertEqual("Column B", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText']) -self.assertEqual("Column C", get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText']) -self.assertEqual("Column D", get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText']) +self.assertEqual("B", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText']) +self.assertEqual("C", get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText']) +self.assertEqual("D", get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText']) # Without the fix in place, this test would have failed with -# AssertionError: 'Column E' != '- undefined -' -self.assertEqual("Column E", get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText']) -self.assertEqual("Column F", get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText']) -self.assertEqual("Column G", get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText']) +# AssertionError: 'E' != '- undefined -' +self.assertEqual("E", get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText']) +self.assertEqual("F", get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText']) +self.assertEqual("G", get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText']) # tdf#51828: Without the fix in place, this test would have failed here self.assertEqual("- undefined -", get_state_as_dict(xDialog.getChild("sortlb7"))['DisplayText']) diff --git a/sc/qa/uitest/sort/tdf49531.py b/sc/qa/uitest/sort/tdf49531.py index c84b67cb040a..08f94cd1a275 100644 --- a/sc/qa/uitest/sort/tdf49531.py +++ b/sc/qa/uitest/sort/tdf49531.py @@ -41,7 +41,7 @@ class tdf49531(UITestCase): select_pos(xTabs, "0") xSortKey1 = xDialog.getChild("sortlb") xAsc = xDialog.getChild("up") -select_by_text(xSortKey1, "Column B") +select_by_text(xSortKey1, "B") xAsc.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "x") diff --git a/sc/qa/uitest/sort/tdf57465.py b/sc/qa/uitest/sort/tdf57465.py index 85be19d5e9b0..eefb3fdd4be8 100644 --- a/sc/qa/uitest/sort/tdf57465.py +++ b/sc/qa/uitest/sort/tdf57465.py @@ -34,7 +34,7 @@ class tdf57465(UITestCase): select_pos(xTabs, "0") -self.assertEqual("Row 1", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText']) +self.assertEqual("1",
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/chartpos.hxx|8 +++--- sc/inc/column.hxx |6 ++-- sc/inc/document.hxx| 39 +++--- sc/inc/progress.hxx| 20 +++ sc/inc/rangelst.hxx|2 - sc/inc/table.hxx | 40 +++ sc/qa/unit/rangelst_test.cxx | 10 +++ sc/qa/unit/subsequent_export_test2.cxx |6 ++-- sc/qa/unit/ucalc.cxx | 26 ++-- sc/source/core/data/column2.cxx| 10 +++ sc/source/core/data/dociter.cxx|8 +++--- sc/source/core/data/documen3.cxx |2 - sc/source/core/data/documen4.cxx |6 ++-- sc/source/core/data/document.cxx | 32 - sc/source/core/data/table1.cxx |6 ++-- sc/source/core/data/table2.cxx | 38 ++--- sc/source/core/data/table3.cxx | 16 ++-- sc/source/core/data/table4.cxx | 42 - sc/source/core/data/table5.cxx |8 +++--- sc/source/core/tool/editutil.cxx |2 - sc/source/core/tool/progress.cxx |8 +++--- sc/source/core/tool/rangelst.cxx | 12 - sc/source/filter/html/htmlexp.cxx |2 - sc/source/filter/xml/xmlimprt.cxx |2 - sc/source/ui/unoobj/cellsuno.cxx |2 - sc/source/ui/view/output.cxx |8 +++--- sc/source/ui/view/output2.cxx |8 +++--- sc/source/ui/view/printfun.cxx |2 - sc/source/ui/view/select.cxx |2 - sc/source/ui/view/tabview.cxx |2 - sc/source/ui/view/viewdata.cxx |8 +++--- sc/source/ui/view/viewfun5.cxx |2 - 32 files changed, 193 insertions(+), 192 deletions(-) New commits: commit 8232965cfb5f50bb2e01f7749d04c227a9622860 Author: Luboš Luňák AuthorDate: Mon Feb 7 18:15:20 2022 +0100 Commit: Luboš Luňák CommitDate: Thu Feb 10 17:31:36 2022 +0100 replace various sal_uLong that might overflow with huge sheets 16Mx16k cells is more than 32bit, so things like cell counts or progress -> sal_uInt64. Height/widths of complete rows/columns -> tools::Long. Change-Id: I8077ec0c97782310db024c20c335cfcbc3833227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129634 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx index efc1a94e7c6d..882810d900a8 100644 --- a/sc/inc/chartpos.hxx +++ b/sc/inc/chartpos.hxx @@ -36,7 +36,7 @@ class ScChartPositionMap std::unique_ptr[]> ppData; std::unique_ptr[]> ppColHeader; std::unique_ptr[]> ppRowHeader; -sal_uLong nCount; +sal_uInt64 nCount; SCCOL nColCount; SCROW nRowCount; @@ -58,10 +58,10 @@ public: boolIsValid( SCCOL nCol, SCROW nRow ) const { return nCol < nColCount && nRow < nRowCount; } // data column by column -sal_uLong GetIndex( SCCOL nCol, SCROW nRow ) const -{ return static_cast(nCol) * nRowCount + nRow; } +sal_uInt64 GetIndex( SCCOL nCol, SCROW nRow ) const +{ return static_cast(nCol) * nRowCount + nRow; } -const ScAddress*GetPosition( sal_uLong nIndex ) const +const ScAddress*GetPosition( sal_uInt64 nIndex ) const { if ( nIndex < nCount ) return ppData[ nIndex ].get(); diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 480e691366c2..49fd2dc9b612 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -383,9 +383,9 @@ public: ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow, size_t& rBlockSize ) const; CellTypeGetCellType( SCROW nRow ) const; SCSIZE GetCellCount() const; -sal_uLong GetWeightedCount() const; -sal_uLong GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const; -sal_uInt32 GetCodeCount() const; // RPN-Code in formulas +sal_uInt64 GetWeightedCount() const; +sal_uInt64 GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const; +sal_uInt64 GetCodeCount() const; // RPN-Code in formulas FormulaError GetErrCode( SCROW nRow ) const; boolHasStringData( SCROW nRow ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 33e529d0b426..158b9f3844c6 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -277,8 +277,8 @@ struct ScDocStat { OUString aDocName; SCTAB nTableCount; -sal_uLong nCellCount; -sal_uLong nFormulaCount; +sal_u
[Libreoffice-commits] core.git: sc/inc sc/qa
sc/inc/address.hxx |2 +- sc/qa/unit/jumbosheets-test.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit cf8408bfcbaca2998d47a56df9f1dc6f3cb98b0e Author: Luboš Luňák AuthorDate: Fri Feb 4 21:59:05 2022 +0100 Commit: Luboš Luňák CommitDate: Tue Feb 8 16:21:41 2022 +0100 make the large-sheet maxrow value pow2-based and not pow10-based All the other limits are powers of 2, I see no good reason why this one should be 1600 and not 16777216. Also at least ScBroadcastAreaSlotMachine actually requires the values to be powers of 2, otherwise the logarithmic algorithm in its ctor will miss some rows at the end. Change-Id: Iee30a271e9e67d092c34d2e4175cb672e6f737a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129588 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 40ac5e8b590e..a5f25f2bd87c 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -69,7 +69,7 @@ const SCROW MAXROW = MAXROWCOUNT - 1; const SCCOL MAXCOL = MAXCOLCOUNT - 1; const SCTAB MAXTAB = MAXTABCOUNT - 1; const SCCOLROWMAXCOLROW = MAXROW; -const SCROW MAXROW_JUMBO = 16 * 1000 * 1000 - 1; +const SCROW MAXROW_JUMBO = 16 * 1024 * 1024 - 1; const SCCOL MAXCOL_JUMBO = 16384 - 1; // Maximum tiled rendering values const SCROW MAXTILEDROW= 50; diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 6f94332ab149..3f3f1320472e 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -110,7 +110,7 @@ void ScFiltersTest::testTdf133033() ScViewData& rViewData = pViewShell->GetViewData(); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), rViewData.GetCurX()); -CPPUNIT_ASSERT_EQUAL(sal_Int32(1599), rViewData.GetCurY()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(16777215), rViewData.GetCurY()); } ScFiltersTest::ScFiltersTest()
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/clipcontext.hxx |4 +-- sc/inc/document.hxx | 28 -- sc/qa/unit/ucalc_copypaste.cxx |2 - sc/source/core/data/clipcontext.cxx |8 +++ sc/source/core/data/column3.cxx |4 +-- sc/source/core/data/column4.cxx |2 - sc/source/core/data/document.cxx| 14 ++--- sc/source/ui/inc/undoblk.hxx|4 +-- sc/source/ui/inc/viewfunc.hxx | 30 sc/source/ui/undo/undoblk.cxx |2 - sc/source/ui/view/viewfun3.cxx | 38 ++-- 11 files changed, 73 insertions(+), 63 deletions(-) New commits: commit e8032897b4a012d8e236211ee6e5ce89fb90492e Author: Kohei Yoshida AuthorDate: Fri Jan 28 22:51:52 2022 -0500 Commit: Kohei Yoshida CommitDate: Sat Jan 29 05:48:34 2022 +0100 Standardize the flag name on bSkipEmptyCells. And document what the flag does. This corresponds with the "Skip empty cells" check box in the Paste Special dialog. Change-Id: Ic6cf9099efbee43f737a1472a4e275839e3d2c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129130 Tested-by: Jenkins Reviewed-by: Kohei Yoshida diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx index ccce671eea65..5754feaaac59 100644 --- a/sc/inc/clipcontext.hxx +++ b/sc/inc/clipcontext.hxx @@ -63,7 +63,7 @@ class SC_DLLPUBLIC CopyFromClipContext final : public ClipContextBase ScConditionalFormatList* mpCondFormatList; bool mbAsLink:1; -bool mbSkipAttrForEmptyCells:1; +bool mbSkipEmptyCells:1; bool mbCloneNotes:1; bool mbTableProtected:1; @@ -126,7 +126,7 @@ public: bool isTableProtected() const; bool isAsLink() const; -bool isSkipAttrForEmptyCells() const; +bool isSkipEmptyCells() const; bool isCloneNotes() const; bool isDateCell( const ScColumn& rCol, SCROW nRow ) const; }; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 85c6829b4a54..87fb59e8980d 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1628,17 +1628,23 @@ public: const ScMarkData& rMark, InsertDeleteFlags nInsFlag, sc::ColumnSpanSet& rBroadcastSpans ); -/** If pDestRanges is given it overrides rDestRange, rDestRange in this -case is the overall encompassing range. */ -SC_DLLPUBLIC void CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMark, -InsertDeleteFlags nInsFlag, -ScDocument* pRefUndoDoc, -ScDocument* pClipDoc, -bool bResetCut = true, -bool bAsLink = false, -bool bIncludeFiltered = true, -bool bSkipAttrForEmpty = false, -const ScRangeList * pDestRanges = nullptr ); +/** + * Paste data from a clipboard document into this document. + * + * @param rDestRange destination range. + * @param pClipDoc pointer to the clipboard document to copy data from. + * @param bSkipEmptyCells if this flag is set, empty cells in the source + *range in the clipboard document will not overwrite + *the target destination cells. + * @param pDestRanges If pDestRanges is given it overrides rDestRange, where + *rDestRange becomes the overall encompassing range. + */ +SC_DLLPUBLIC void CopyFromClip( +const ScRange& rDestRange, const ScMarkData& rMark, InsertDeleteFlags nInsFlag, +ScDocument* pRefUndoDoc, ScDocument* pClipDoc, +bool bResetCut = true, bool bAsLink = false, +bool bIncludeFiltered = true, bool bSkipEmptyCells = false, +const ScRangeList* pDestRanges = nullptr ); voidCopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark, InsertDeleteFlags nInsFlag, ScDocument* pClipDoc, diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 61ecdd651d70..50850c59fc2b 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -457,7 +457,7 @@ void TestCopyPaste::prepareUndoAfterPaste(ScDocumentUniquePtr& pPasteUndoDoc, ScUndoPasteOptions aOptions; // store options for repeat aOptions.nFunction = nFunction; -aOptions.bSkipEmpty = bSkipEmpty; +aOptions.bSkipEmptyCells = bSkipEmpty; aOptions.bTranspose = bTranspose; aOptions.bAsLink = bAsLink; aOptions.eMoveMode = eMoveMode; diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx index 0d336940fece..02e2bcc86652 100644 --- a/sc/source/core/data/clipcontext.cxx +++ b/sc/source/core/data/cli
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/dbdata.hxx |2 + sc/inc/document.hxx |2 - sc/qa/unit/data/xlsx/tdf145054.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 18 sc/source/core/data/documen2.cxx|1 sc/source/core/tool/dbdata.cxx | 47 6 files changed, 69 insertions(+), 1 deletion(-) New commits: commit d9472a5284fde7bb96823655efcb6eb31f405493 Author: Samuel Mehrbrodt AuthorDate: Thu Dec 16 11:50:01 2021 +0100 Commit: Samuel Mehrbrodt CommitDate: Thu Jan 27 07:32:39 2022 +0100 tdf#145054 Copy named DBs too when copying sheet Change-Id: I5bf75a7188532776e70c7af64e88371638d76335 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126916 Tested-by: Jenkins Reviewed-by: Kohei Yoshida Reviewed-by: Samuel Mehrbrodt diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index f12ba3fb976d..0e8d53830e53 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -256,6 +256,7 @@ public: ScDBData* findByIndex(sal_uInt16 nIndex); ScDBData* findByUpperName(const OUString& rName); iterator findByUpperName2(const OUString& rName); +ScDBData* findByName(const OUString& rName); /** Takes ownership of p and attempts to insert it into the collection. Deletes p if it could not be inserted, i.e. duplicate name. @@ -333,6 +334,7 @@ public: SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz); voidUpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); +voidCopyToTable(SCTAB nOldPos, SCTAB nNewPos); voidSetRefreshHandler( const Link& rLink ) { aRefreshHandler = rLink; } diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index fa13b7b890e4..85c6829b4a54 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -957,7 +957,7 @@ public: SC_DLLPUBLIC bool RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDocument = false ); boolMoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress = nullptr ); -boolCopyTab( SCTAB nOldPos, SCTAB nNewPos, +SC_DLLPUBLIC bool CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyMarked = nullptr ); SC_DLLPUBLIC sal_uLong TransferTab(ScDocument& rSrcDoc, SCTAB nSrcPos, SCTAB nDestPos, bool bInsertNew = true, diff --git a/sc/qa/unit/data/xlsx/tdf145054.xlsx b/sc/qa/unit/data/xlsx/tdf145054.xlsx new file mode 100644 index ..8360ec7e92be Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf145054.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 4852c1006b13..90a6a11d36d8 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -131,6 +131,7 @@ public: void testVBAUserFunctionXLSM(); void testEmbeddedImageXLS(); void testErrorOnExternalReferences(); +void testTdf145054(); void testTdf84762(); void testTdf44076(); void testEditEngStrikeThroughXLSX(); @@ -239,6 +240,7 @@ public: CPPUNIT_TEST(testVBAUserFunctionXLSM); CPPUNIT_TEST(testEmbeddedImageXLS); CPPUNIT_TEST(testErrorOnExternalReferences); +CPPUNIT_TEST(testTdf145054); CPPUNIT_TEST(testTdf84762); CPPUNIT_TEST(testTdf44076); CPPUNIT_TEST(testEditEngStrikeThroughXLSX); @@ -1047,6 +1049,22 @@ void ScFiltersTest2::testErrorOnExternalReferences() xDocSh->DoClose(); } +void ScFiltersTest2::testTdf145054() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf145054.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +// Copy sheet +rDoc.CopyTab(0, 1); +CPPUNIT_ASSERT_EQUAL(SCTAB(2), rDoc.GetTableCount()); + +// Make sure named DB was copied +ScDBData* pDBData = rDoc.GetDBCollection()->getNamedDBs().findByName("__Anonymous_Sheet_DB__1"); +CPPUNIT_ASSERT(pDBData); +} + void ScFiltersTest2::testTdf84762() { ScDocShellRef xDocSh = loadDoc(u"blank.", FORMAT_ODS); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 67f6e9d7ca41..dc23b2c3209e 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -855,6 +855,7 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM GetRangeName()->CopyUsedNames( -1, nRealOldPos, nNewPos, *this, *this, bGlobalNamesToLocal); sc::CopyToDocContext aCopyDocCxt(*this); +pDBCollection->CopyToTable(nOldPos, nNewPos); maTabs[nOldPos]->CopyToTable(aCopyDocCxt, 0, 0, MaxCol(), MaxRow(), InsertDeleteFlags::ALL, (pOnlyMarked != nullptr)
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/dbdata.hxx |1 + sc/qa/unit/data/xlsx/tdf145057.xlsx|binary sc/qa/unit/subsequent_export_test2.cxx | 15 +++ sc/source/core/tool/dbdata.cxx | 14 ++ sc/source/filter/excel/xestyle.cxx |4 ++-- 5 files changed, 32 insertions(+), 2 deletions(-) New commits: commit b85e99950dc4584160512cffec303827c02f2d15 Author: Samuel Mehrbrodt AuthorDate: Wed Dec 22 16:44:08 2021 +0100 Commit: Samuel Mehrbrodt CommitDate: Wed Dec 22 20:34:13 2021 +0100 tdf#145057 Fix saving color filter when multiple data ranges in sheet When mutliple data ranges existed in one sheet, only the first one was considered when exporting color filters. Consider all of them, as any could hold a color filter. Change-Id: I13ae2018057eef7ef24fc8298c814a93df24f74b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127328 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index 3eda3e00898b..f12ba3fb976d 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -323,6 +323,7 @@ public: const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab ); +std::vector GetAllDBsFromTab(SCTAB nTab); void RefreshDirtyTableColumnNames(); diff --git a/sc/qa/unit/data/xlsx/tdf145057.xlsx b/sc/qa/unit/data/xlsx/tdf145057.xlsx new file mode 100644 index ..4a2e259c119d Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf145057.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 1dc763f96631..59fa0bf21d9b 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -147,6 +147,7 @@ public: void testTdf133595(); void testTdf134769(); void testTdf106181(); +void testTdf145057(); void testTdf105272(); void testTdf118990(); void testTdf121612(); @@ -261,6 +262,7 @@ public: CPPUNIT_TEST(testTdf133595); CPPUNIT_TEST(testTdf134769); CPPUNIT_TEST(testTdf106181); +CPPUNIT_TEST(testTdf145057); CPPUNIT_TEST(testTdf105272); CPPUNIT_TEST(testTdf118990); CPPUNIT_TEST(testTdf121612); @@ -1222,6 +1224,19 @@ void ScExportTest2::testTdf106181() xDocSh->DoClose(); } +void ScExportTest2::testTdf145057() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf145057.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + "xl/tables/table1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "//x:colorFilter", "dxfId", "1"); +} + void ScExportTest2::testTdf105272() { ScDocShellRef xDocSh = loadDoc(u"tdf105272.", FORMAT_XLSX); diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 8ea877502087..e59cc295c7b5 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -1509,6 +1509,20 @@ ScDBData* ScDBCollection::GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab ) return rDoc.GetAnonymousDBData(nTab); // "unbenannt"/"unnamed" only if nothing else } +std::vector ScDBCollection::GetAllDBsFromTab(SCTAB nTab) +{ +std::vector pTabData; +for (const auto& rxNamedDB : maNamedDBs) +{ +if (rxNamedDB->GetTab() == nTab) +pTabData.emplace_back(rxNamedDB.get()); +} +auto pAnonDBData = rDoc.GetAnonymousDBData(nTab); +if (pAnonDBData) +pTabData.emplace_back(pAnonDBData); +return pTabData; +} + bool ScDBCollection::empty() const { return maNamedDBs.empty() && maAnonDBs.empty(); diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 4f50144a335b..3898c5cad9b6 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3059,8 +3059,8 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) for(SCTAB nTab = 0; nTab < nTables; ++nTab) { // Color filters -const ScDBData* pData = rRoot.GetDoc().GetDBCollection()->GetDBNearCursor(0, 0, 0); -if (pData) +std::vector pDBData = rRoot.GetDoc().GetDBCollection()->GetAllDBsFromTab(nTab); +for (auto& pData : pDBData) { ScRange aRange; pData->GetArea(aRange);
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/queryevaluator.hxx |3 + sc/qa/unit/ucalc.cxx | 56 + sc/source/core/data/dociter.cxx|3 + sc/source/core/data/queryevaluator.cxx | 27 +++ 4 files changed, 73 insertions(+), 16 deletions(-) New commits: commit 0d1971a8dc1f7ce24f67abcab4d6af9cf2b7b823 Author: Luboš Luňák AuthorDate: Mon Dec 13 21:35:01 2021 +0100 Commit: Eike Rathke CommitDate: Tue Dec 14 17:04:39 2021 +0100 make sure text operations are not queried by (numeric) value E.g. SC_CONTAINS is, according to isPartialTextMatchOp(), a text-only operation, so query it as such and not as a numeric value. This fixes/allows e.g. substring queries on dates. Change-Id: I6c612d9934193828b7a7eabed92f2bfeb385e5a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126767 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/inc/queryevaluator.hxx b/sc/inc/queryevaluator.hxx index 44bf52ec3685..a1fd20111071 100644 --- a/sc/inc/queryevaluator.hxx +++ b/sc/inc/queryevaluator.hxx @@ -79,7 +79,8 @@ class ScQueryEvaluator bool isRealWildOrRegExp(const ScQueryEntry& rEntry) const; bool isTestWildOrRegExp(const ScQueryEntry& rEntry) const; -static bool isQueryByValue(const ScQueryEntry::Item& rItem, const ScRefCellValue& rCell); +static bool isQueryByValue(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, + const ScRefCellValue& rCell); static bool isQueryByValueForCell(const ScRefCellValue& rCell); static bool isQueryByString(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, const ScRefCellValue& rCell); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5d32bee3223b..402f3b4388d5 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -176,6 +176,7 @@ public: void testTdf137063(); void testTdf126342(); void testAdvancedFilter(); +void testDateFilterContains(); void testTdf98642(); void testMergedCells(); void testUpdateReference(); @@ -301,6 +302,7 @@ public: CPPUNIT_TEST(testTdf137063); CPPUNIT_TEST(testTdf126342); CPPUNIT_TEST(testAdvancedFilter); +CPPUNIT_TEST(testDateFilterContains); CPPUNIT_TEST(testTdf98642); CPPUNIT_TEST(testMergedCells); CPPUNIT_TEST(testUpdateReference); @@ -3902,6 +3904,60 @@ void Test::testAdvancedFilter() m_pDoc->DeleteTab(0); } +void Test::testDateFilterContains() +{ +m_pDoc->InsertTab(0, "Test"); + +constexpr SCCOL nCols = 1; +constexpr SCROW nRows = 5; +m_pDoc->SetString(0, 0, 0, "Date"); +m_pDoc->SetString(0, 1, 0, "1/2/2021"); +m_pDoc->SetString(0, 2, 0, "2/1/1999"); +m_pDoc->SetString(0, 3, 0, "2/1/1997"); +m_pDoc->SetString(0, 4, 0, "3/3/2001"); +m_pDoc->SetString(0, 5, 0, "3/3/1996"); + +// Set the fields as dates. +SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); +sal_uInt32 nFormat = pFormatter->GetFormatIndex(NF_DATE_DIN_YYMMDD, LANGUAGE_ENGLISH_US); +ScPatternAttr aNewAttrs(m_pDoc->GetPool()); +SfxItemSet& rSet = aNewAttrs.GetItemSet(); +rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat)); +m_pDoc->ApplyPatternAreaTab(0, 1, 0, 5, 0, aNewAttrs); // apply it to A1:A6 + +ScDBData* pDBData = new ScDBData("NONAME", 0, 0, 0, nCols, nRows); +m_pDoc->SetAnonymousDBData(0, std::unique_ptr(pDBData)); + +pDBData->SetAutoFilter(true); +ScRange aRange; +pDBData->GetArea(aRange); +m_pDoc->ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), + aRange.aEnd.Col(), aRange.aStart.Row(), + aRange.aStart.Tab(), ScMF::Auto); + +//create the query param +ScQueryParam aParam; +pDBData->GetQueryParam(aParam); +ScQueryEntry& rEntry = aParam.GetEntry(0); +rEntry.bDoQuery = true; +rEntry.nField = 0; +rEntry.eOp = SC_CONTAINS; +rEntry.GetQueryItem().maString = m_pDoc->GetSharedStringPool().intern("2"); +pDBData->SetQueryParam(aParam); + +// perform the query. +m_pDoc->Query(0, aParam, true); + +// Dates in rows 2-4 contain '2', row 5 shows 2001 only as 01, and row 6 doesn't contain it at all. +CPPUNIT_ASSERT_MESSAGE("row 2 should be visible", !m_pDoc->RowHidden(1, 0)); +CPPUNIT_ASSERT_MESSAGE("row 3 should be visible", !m_pDoc->RowHidden(2, 0)); +CPPUNIT_ASSERT_MESSAGE("row 4 should be visible", !m_pDoc->RowHidden(3, 0)); +CPPUNIT_ASSERT_MESSAGE("row 5 should be hidden", m_pDoc->RowHidden(4, 0)); +CPPUNIT_ASSERT_MESSAGE("row 6 should be hidden", m_pDoc->RowHidden(5, 0)); + +m_pDoc->DeleteTab(0); +} + void Test::testTdf98642() { m_pDoc->InsertTab(0, "Sheet1"); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index cafbbc9c0a1b..a50b6f00550e 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/docite
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/strings.hrc|1 + sc/qa/uitest/autofilter/autofilter.py |2 ++ sc/qa/uitest/autofilter2/tdf126306.py |4 ++-- sc/qa/uitest/autofilter2/tdf141559.py |3 ++- sc/qa/uitest/autofilter2/tdf46184.py |1 + sc/qa/uitest/autofilter2/tdf68113.py |2 -- sc/source/ui/inc/gridwin.hxx |5 +++-- sc/source/ui/view/gridwin.cxx | 11 +-- 8 files changed, 20 insertions(+), 9 deletions(-) New commits: commit d8aae8057d76743cfc1591cbffda2f54c338a213 Author: Caolán McNamara AuthorDate: Thu Dec 9 16:27:43 2021 + Commit: Caolán McNamara CommitDate: Fri Dec 10 10:56:18 2021 +0100 Related: tdf#146018 move Top10 below empty/not-empty add add Bottom10 Change-Id: Ic44b84dea8f8b1e61872606b50e9a384d8c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126621 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index ed39473c4637..96f4e8c3e0b2 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -33,6 +33,7 @@ #define SCSTR_STDFILTER NC_("SCSTR_STDFILTER", "Standard Filter...") #define SCSTR_CLEAR_FILTER NC_("SCSTR_CLEAR_FILTER", "Clear Filter") #define SCSTR_TOP10FILTER NC_("SCSTR_TOP10FILTER", "Top 10") +#define SCSTR_BOTTOM10FILTER NC_("SCSTR_BOTTOM10FILTER", "Bottom 10") #define SCSTR_FILTER_EMPTY NC_("SCSTR_FILTER_EMPTY", "Empty") #define SCSTR_FILTER_NOTEMPTY NC_("SCSTR_FILTER_NOTEMPTY", "Not Empty") #define SCSTR_FILTER_COLOR NC_("SCSTR_FILTER_COLOR", "Filter by Color") diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 21e6e4eed20b..bbfbbaab7118 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -431,6 +431,8 @@ class AutofilterTest(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) self.assertFalse(is_row_hidden(doc, 0)) diff --git a/sc/qa/uitest/autofilter2/tdf126306.py b/sc/qa/uitest/autofilter2/tdf126306.py index cf8dcd1f3f0a..51c099a3f3c2 100644 --- a/sc/qa/uitest/autofilter2/tdf126306.py +++ b/sc/qa/uitest/autofilter2/tdf126306.py @@ -84,6 +84,8 @@ class tdf126306(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) top10_hidden_values = [True, True, True, False, True, False, True, @@ -108,7 +110,6 @@ class tdf126306(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") -xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) empty_values = [False] * 14 @@ -132,7 +133,6 @@ class tdf126306(UITestCase): xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) -xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) #Nothing should change diff --git a/sc/qa/uitest/autofilter2/tdf141559.py b/sc/qa/uitest/autofilter2/tdf141559.py index 5f027a10ed43..e4eba12056b0 100644 --- a/sc/qa/uitest/autofilter2/tdf141559.py +++ b/sc/qa/uitest/autofilter2/tdf141559.py @@ -43,7 +43,7 @@ class tdf141559(UITestCase): xSubMenu = xSubFloatWindow.getChild("menu") nLastIdx = int(get_state_as_dict(xSubMenu)['Children']) - 1 -self.assertEqual(4, nLastIdx) +self.assertEqual(5, nLastIdx) # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional) self.assertEqual('Standard Filter...', get_state_as_dict(xSubMenu.getChild(str(nLastIdx)))['Text']) @@ -51,6 +51,7 @@ class tdf141559(UITestCase): xSub
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/strings.hrc|3 ++- sc/qa/uitest/autofilter/autofilter.py |6 +- sc/qa/uitest/autofilter2/tdf126306.py | 14 +- sc/qa/uitest/autofilter2/tdf141559.py | 30 +++--- sc/qa/uitest/autofilter2/tdf46184.py | 12 +++- sc/qa/uitest/autofilter2/tdf68113.py | 10 +- sc/source/ui/cctrl/checklistmenu.cxx | 26 ++ sc/source/ui/inc/checklistmenu.hxx|1 + sc/source/ui/inc/gridwin.hxx |1 - sc/source/ui/view/gridwin.cxx | 24 ++-- 10 files changed, 88 insertions(+), 39 deletions(-) New commits: commit e2d498b778a3dac70a7faee4d1bbabb50cdcc103 Author: Caolán McNamara AuthorDate: Wed Dec 8 10:32:31 2021 + Commit: Caolán McNamara CommitDate: Fri Dec 10 10:55:25 2021 +0100 tdf#146018 group filtering options under a single dropdown Change-Id: I91afb746485654ed8e1418d17d4b172332b3f1f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126532 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 006f1aadf85a..ed39473c4637 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -35,7 +35,8 @@ #define SCSTR_TOP10FILTER NC_("SCSTR_TOP10FILTER", "Top 10") #define SCSTR_FILTER_EMPTY NC_("SCSTR_FILTER_EMPTY", "Empty") #define SCSTR_FILTER_NOTEMPTY NC_("SCSTR_FILTER_NOTEMPTY", "Not Empty") -#define SCSTR_FILTER_COLOR NC_("SCSTR_FILTER_COLOR", "Color Filter") +#define SCSTR_FILTER_COLOR NC_("SCSTR_FILTER_COLOR", "Filter by Color") +#define SCSTR_FILTER_CONDITION NC_("SCSTR_FILTER_CONDITION", "Filter by Condition") #define SCSTR_FILTER_TEXT_COLOR NC_("SCSTR_FILTER_TEXT_COLOR", "Text Color") #define SCSTR_FILTER_BACKGROUND_COLOR NC_("SCSTR_FILTER_BACKGROUND_COLOR", "Background Color") // This must match the translation of the same strings of standardfilterdialog|cond diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 6a0018afa187..21e6e4eed20b 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -421,13 +421,17 @@ class AutofilterTest(UITestCase): xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") -# Top 10 filer +# Top 10 filter xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) xFloatWindow = self.xUITest.getFloatWindow() xMenu = xFloatWindow.getChild("menu") xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) +xSubFloatWindow = self.xUITest.getFloatWindow() +xSubMenu = xSubFloatWindow.getChild("menu") +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) self.assertFalse(is_row_hidden(doc, 0)) self.assertTrue(is_row_hidden(doc, 1)) diff --git a/sc/qa/uitest/autofilter2/tdf126306.py b/sc/qa/uitest/autofilter2/tdf126306.py index 79525402dc6b..cf8dcd1f3f0a 100644 --- a/sc/qa/uitest/autofilter2/tdf126306.py +++ b/sc/qa/uitest/autofilter2/tdf126306.py @@ -80,7 +80,11 @@ class tdf126306(UITestCase): xMenu = xFloatWindow.getChild("menu") xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) +xSubFloatWindow = self.xUITest.getFloatWindow() +xSubMenu = xSubFloatWindow.getChild("menu") +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) top10_hidden_values = [True, True, True, False, True, False, True, True, False, True, True, False, True, True] @@ -102,6 +106,10 @@ class tdf126306(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) +xSubFloatWindow = self.xUITest.getFloatWindow() +xSubMenu = xSubFloatWindow.getChild("menu") +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) empty_values = [False]
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source sc/uiconfig
sc/inc/strings.hrc|1 sc/qa/uitest/autofilter2/tdf141559.py |4 sc/source/ui/cctrl/checklistmenu.cxx | 152 +++--- sc/source/ui/inc/checklistmenu.hxx| 19 ++- sc/source/ui/inc/gridwin.hxx |1 sc/source/ui/view/gridwin.cxx | 135 +- sc/uiconfig/scalc/ui/filtersubdropdown.ui | 151 - 7 files changed, 346 insertions(+), 117 deletions(-) New commits: commit 8d3107f16d32fd0b582a0a5557691296791327f3 Author: Caolán McNamara AuthorDate: Tue Dec 7 09:40:35 2021 + Commit: Caolán McNamara CommitDate: Wed Dec 8 10:58:41 2021 +0100 tdf#146018 merge autofilter color dropdowns into a single dropdown Change-Id: Ie900ed2ebade82198928b3dc2e90ab7aa7f0edd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126475 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 0cdbf7f1e540..006f1aadf85a 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -35,6 +35,7 @@ #define SCSTR_TOP10FILTER NC_("SCSTR_TOP10FILTER", "Top 10") #define SCSTR_FILTER_EMPTY NC_("SCSTR_FILTER_EMPTY", "Empty") #define SCSTR_FILTER_NOTEMPTY NC_("SCSTR_FILTER_NOTEMPTY", "Not Empty") +#define SCSTR_FILTER_COLOR NC_("SCSTR_FILTER_COLOR", "Color Filter") #define SCSTR_FILTER_TEXT_COLOR NC_("SCSTR_FILTER_TEXT_COLOR", "Text Color") #define SCSTR_FILTER_BACKGROUND_COLOR NC_("SCSTR_FILTER_BACKGROUND_COLOR", "Background Color") // This must match the translation of the same strings of standardfilterdialog|cond diff --git a/sc/qa/uitest/autofilter2/tdf141559.py b/sc/qa/uitest/autofilter2/tdf141559.py index 376720a2bd82..8ea7dbe6f3ee 100644 --- a/sc/qa/uitest/autofilter2/tdf141559.py +++ b/sc/qa/uitest/autofilter2/tdf141559.py @@ -37,7 +37,7 @@ class tdf141559(UITestCase): # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional) nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 -self.assertEqual(10, nLastIdx) +self.assertEqual(8, nLastIdx) self.assertEqual('Standard Filter...', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) @@ -71,7 +71,7 @@ class tdf141559(UITestCase): # check last item: 'Clear Filter' nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 -self.assertEqual(11, nLastIdx) +self.assertEqual(9, nLastIdx) self.assertEqual('Clear Filter', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 83544df61145..a27fb53c09a4 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -179,12 +179,12 @@ void ScCheckListMenuControl::CreateDropDown() DrawSymbolFlags::NONE); } -ScListSubMenuControl* ScCheckListMenuControl::addSubMenuItem(const OUString& rText, bool bEnabled, bool bCheckList) +ScListSubMenuControl* ScCheckListMenuControl::addSubMenuItem(const OUString& rText, bool bEnabled, bool bColorMenu) { MenuItemData aItem; aItem.mbEnabled = bEnabled; -aItem.mxSubMenuWin.reset(new ScListSubMenuControl(mxMenu.get(), *this, bCheckList, mpNotifier)); +aItem.mxSubMenuWin.reset(new ScListSubMenuControl(mxMenu.get(), *this, bColorMenu, mpNotifier)); maMenuItems.emplace_back(std::move(aItem)); mxMenu->show(); @@ -1437,24 +1437,46 @@ int ScCheckListMenuControl::IncreaseWindowWidthToFitText(int nMaxTextWidth) return mnCheckWidthReq + nBorder; } -ScListSubMenuControl::ScListSubMenuControl(weld::Widget* pParent, ScCheckListMenuControl& rParentControl, bool bCheckList, vcl::ILibreOfficeKitNotifier* pNotifier) +ScListSubMenuControl::ScListSubMenuControl(weld::Widget* pParent, ScCheckListMenuControl& rParentControl, bool bColorMenu, vcl::ILibreOfficeKitNotifier* pNotifier) : mxBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/filtersubdropdown.ui")) , mxPopover(mxBuilder->weld_popover("FilterSubDropDown")) , mxContainer(mxBuilder->weld_container("container")) , mxMenu(mxBuilder->weld_tree_view("menu")) +, mxBackColorMenu(mxBuilder->weld_tree_view("background")) +, mxTextColorMenu(mxBuilder->weld_tree_view("textcolor")) , mxScratchIter(mxMenu->make_iterator()) , mrParentControl(rParentControl) , mpNotifier(pNotifier) +, mnBackColorMenuPrefHeight(-1) +, mnTextColorMenuPrefHeight(-1) +, mbColorMenu(bColorMenu) { -if (bCheckList) +mxMenu->hide(); +m
[Libreoffice-commits] core.git: sc/inc sc/qa
sc/inc/address.hxx |9 - sc/inc/bigrange.hxx |9 - sc/qa/unit/range.cxx | 21 + 3 files changed, 29 insertions(+), 10 deletions(-) New commits: commit 8b0287ae7275681c28cc278ecdb448d80c223d89 Author: Luboš Luňák AuthorDate: Mon Dec 6 01:28:38 2021 +0100 Commit: Luboš Luňák CommitDate: Mon Dec 6 12:21:31 2021 +0100 slightly simpler Intersects() check For two ranges to intersect, both start points must not be larger than the end points. Change-Id: I69d1c548ff1bac90baea0767e92ca86458808c9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126393 Tested-by: Luboš Luňák Reviewed-by: Luboš Luňák diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 725e696059db..40ac5e8b590e 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -747,11 +747,10 @@ inline bool ScRange::Contains( const ScRange& rRange ) const inline bool ScRange::Intersects( const ScRange& rRange ) const { -return !( -std::min( aEnd.Col(), rRange.aEnd.Col() ) < std::max( aStart.Col(), rRange.aStart.Col() ) - || std::min( aEnd.Row(), rRange.aEnd.Row() ) < std::max( aStart.Row(), rRange.aStart.Row() ) - || std::min( aEnd.Tab(), rRange.aEnd.Tab() ) < std::max( aStart.Tab(), rRange.aStart.Tab() ) -); +return +aStart.Col() <= rRange.aEnd.Col() && rRange.aStart.Col() <= aEnd.Col() && +aStart.Row() <= rRange.aEnd.Row() && rRange.aStart.Row() <= aEnd.Row() && +aStart.Tab() <= rRange.aEnd.Tab() && rRange.aStart.Tab() <= aEnd.Tab(); } inline size_t ScRange::hashArea() const diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx index 979c861ba07f..33d12b98724c 100644 --- a/sc/inc/bigrange.hxx +++ b/sc/inc/bigrange.hxx @@ -168,11 +168,10 @@ inline bool ScBigRange::Contains( const ScBigRange& r ) const inline bool ScBigRange::Intersects( const ScBigRange& r ) const { -return !( -std::min( aEnd.Col(), r.aEnd.Col() ) < std::max( aStart.Col(), r.aStart.Col() ) - || std::min( aEnd.Row(), r.aEnd.Row() ) < std::max( aStart.Row(), r.aStart.Row() ) - || std::min( aEnd.Tab(), r.aEnd.Tab() ) < std::max( aStart.Tab(), r.aStart.Tab() ) -); +return +aStart.Col() <= r.aEnd.Col() && r.aStart.Col() <= aEnd.Col() && +aStart.Row() <= r.aEnd.Row() && r.aStart.Row() <= aEnd.Row() && +aStart.Tab() <= r.aEnd.Tab() && r.aStart.Tab() <= aEnd.Tab(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/range.cxx b/sc/qa/unit/range.cxx index 4935165bd7cc..d704eb2dc4e2 100644 --- a/sc/qa/unit/range.cxx +++ b/sc/qa/unit/range.cxx @@ -69,15 +69,36 @@ public: virtual void tearDown() override; CPPUNIT_TEST_SUITE(ScRangeTest); +CPPUNIT_TEST(testOverlap); CPPUNIT_TEST(testRangeParsing); CPPUNIT_TEST_SUITE_END(); +void testOverlap(); void testRangeParsing(); private: ScDocShellRef m_xDocShRef; }; +void ScRangeTest::testOverlap() +{ +ScRange aRange1( ScAddress( 0, 0, 0 ), ScAddress( 1, 1, 1 )); +CPPUNIT_ASSERT(aRange1.Contains( ScAddress( 0, 0, 0 ))); +CPPUNIT_ASSERT(aRange1.Contains( ScAddress( 1, 1, 1 ))); +CPPUNIT_ASSERT(!aRange1.Contains( ScAddress( 2, 1, 1 ))); +CPPUNIT_ASSERT(!aRange1.Contains( ScAddress( 1, 2, 1 ))); +CPPUNIT_ASSERT(!aRange1.Contains( ScAddress( 1, 1, 2 ))); + +ScRange aRange2( ScAddress( 0, 0, 0 ), ScAddress( 10, 10, 10 )); +ScRange aRange3( ScAddress( 5, 5, 5 ), ScAddress( 15, 15, 15 )); +CPPUNIT_ASSERT(!aRange2.Contains( aRange3 )); +CPPUNIT_ASSERT(!aRange3.Contains( aRange2 )); +CPPUNIT_ASSERT(aRange2.Intersects( aRange3 )); +CPPUNIT_ASSERT(aRange3.Intersects( aRange2 )); +CPPUNIT_ASSERT(!aRange3.Intersects( aRange1 )); +CPPUNIT_ASSERT(!aRange1.Intersects( aRange3 )); +} + void ScRangeTest::testRangeParsing() { ScRange aRange;
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/address.hxx | 19 - sc/inc/bigrange.hxx |8 +- sc/inc/rangelst.hxx |2 sc/qa/unit/rangelst_test.cxx | 66 +-- sc/qa/unit/subsequent_export_test.cxx|8 +- sc/qa/unit/subsequent_filters_test.cxx |6 - sc/qa/unit/ucalc.cxx |6 - sc/source/core/data/bcaslot.cxx | 10 +- sc/source/core/data/column.cxx |2 sc/source/core/data/conditio.cxx |2 sc/source/core/data/documen2.cxx |8 +- sc/source/core/data/documen3.cxx |6 - sc/source/core/data/document10.cxx |2 sc/source/core/data/drwlayer.cxx | 16 ++-- sc/source/core/data/formulacell.cxx | 12 +-- sc/source/core/data/tabprotection.cxx|2 sc/source/core/tool/address.cxx |9 -- sc/source/core/tool/chgtrack.cxx | 40 +-- sc/source/core/tool/compiler.cxx |2 sc/source/core/tool/dbdata.cxx |2 sc/source/core/tool/interpr4.cxx |4 - sc/source/core/tool/listenerquery.cxx|2 sc/source/core/tool/rangelst.cxx | 16 ++-- sc/source/core/tool/reftokenhelper.cxx |2 sc/source/core/tool/refupdat.cxx |4 - sc/source/core/tool/token.cxx| 42 ++-- sc/source/filter/excel/xecontent.cxx |2 sc/source/filter/html/htmlexp.cxx|2 sc/source/filter/html/htmlimp.cxx|2 sc/source/filter/xml/xmlsubti.cxx|2 sc/source/ui/Accessibility/AccessibleCell.cxx|2 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |8 +- sc/source/ui/dbgui/PivotLayoutDialog.cxx |2 sc/source/ui/docshell/dbdocfun.cxx |2 sc/source/ui/docshell/docfunc.cxx|8 +- sc/source/ui/docshell/docsh3.cxx |4 - sc/source/ui/docshell/externalrefmgr.cxx |4 - sc/source/ui/unoobj/cellsuno.cxx |2 sc/source/ui/vba/vbaapplication.cxx |4 - sc/source/ui/vba/vbahyperlinks.cxx |2 sc/source/ui/view/dbfunc4.cxx|2 sc/source/ui/view/gridwin.cxx|2 sc/source/ui/view/gridwin5.cxx |4 - sc/source/ui/view/pfuncache.cxx |2 sc/source/ui/view/prevloc.cxx|2 sc/source/ui/view/spellcheckcontext.cxx |2 sc/source/ui/view/tabview3.cxx |4 - 47 files changed, 182 insertions(+), 180 deletions(-) New commits: commit 9809441f05e4dbac8e12b042fd4391f1a7580643 Author: Luboš Luňák AuthorDate: Mon Dec 6 01:03:50 2021 +0100 Commit: Luboš Luňák CommitDate: Mon Dec 6 12:21:00 2021 +0100 rename In() to Contains() Similarly to b22d4785310eac35696d, 'A.In(B)' makes it unclear whether the check is for A in B or B in A, as it's actually the latter. Change-Id: Iaccc41d40f4bb105a44c1bb8d9211c06d1a3c127 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126392 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index dca071604627..725e696059db 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -547,8 +547,9 @@ public: { return aStart.IsValid() && aEnd.IsValid(); } -inline bool In( const ScAddress& ) const; ///< is Address& in Range? -inline bool In( const ScRange& ) const; ///< is Range& in Range? +inline bool Contains( const ScAddress& ) const; ///< is Address& fully in Range? +inline bool Contains( const ScRange& ) const; ///< is Range& fully in Range? +inline bool Intersects( const ScRange& rRange ) const;// do two ranges intersect? ScRefFlags Parse( const OUString&, const ScDocument&, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, @@ -640,7 +641,6 @@ public: void IncRowIfNotLessThan(const ScDocument& rDoc, SCROW nStartRow, SCROW nOffset); void ExtendTo( const ScRange& rRange ); -bool Intersects( const ScRange& rRange ) const;// do two ranges intersect? ScRange Intersection( const ScRange& rOther ) const; @@ -729,7 +729,7 @@ inline bool ScRange::operator<=( const ScRange& rRange ) const return operator<( rRange ) || operator==( rRange ); } -inline bool ScRange::In( const ScAddress& rAddress ) const +inline bool ScRange::Contains( const ScAddress& rAddress )
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/arraysumfunctor.hxx | 25 --- sc/inc/arraysumfunctorinternal.hxx | 34 + sc/inc/kahan.hxx |8 + sc/qa/unit/functions_statistical.cxx |6 +-- sc/source/core/tool/arraysum.hxx | 52 + sc/source/core/tool/arraysumAVX.cxx| 22 - sc/source/core/tool/arraysumAVX512.cxx | 33 sc/source/core/tool/arraysumSSE2.cxx | 23 -- 8 files changed, 144 insertions(+), 59 deletions(-) New commits: commit 26072b8db7ba53f00c83197cb064229a76001989 Author: Luboš Luňák AuthorDate: Fri Sep 10 23:43:33 2021 +0200 Commit: Luboš Luňák CommitDate: Mon Sep 13 11:08:20 2021 +0200 properly separate code built with different CPU settings Trying to write smart code and mixing different CPU flags doesn't play nice together. Those global variables are not runtime-protected by a CPU check, and so may crash with illegal instruction error. And those inline functions may not get inlined and the compiler is free to choose just one copy, any of them, so it may be the one requiring the most demanding CPU settings. So use only dumb code in files compiled with CPU intrinsics. Change-Id: I8200fd4d9f991fab6fdc741120e7aa96ff9b470d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121929 Tested-by: Jenkins Reviewed-by: Dante DM Reviewed-by: Luboš Luňák diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index ecd428e9f037..d251b4a6f9fb 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,34 +12,16 @@ #include #include "kahan.hxx" -#include "scdllapi.h" +#include "arraysumfunctorinternal.hxx" #include #include namespace sc::op { /* Checkout available optimization options */ -SC_DLLPUBLIC extern const bool hasAVX512F; const bool hasAVX = cpuid::hasAVX(); const bool hasSSE2 = cpuid::hasSSE2(); -/** - * Performs one step of the Neumanier sum between doubles - * Overwrites the summand and error - * @parma sum - * @param err - * @param value - */ -inline void sumNeumanierNormal(double& sum, double& err, const double& value) -{ -double t = sum + value; -if (std::abs(sum) >= std::abs(value)) -err += (sum - t) + value; -else -err += (value - t) + sum; -sum = t; -} - /** * If no boosts available, Unrolled KahanSum. * Most likely to use on android. @@ -69,11 +51,6 @@ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pC return 0.0; } -/* Available methods */ -SC_DLLPUBLIC KahanSum executeAVX512F(size_t& i, size_t nSize, const double* pCurrent); -SC_DLLPUBLIC KahanSum executeAVX(size_t& i, size_t nSize, const double* pCurrent); -SC_DLLPUBLIC KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); - /** * This function task is to choose the fastest method available to perform the sum. * @param i diff --git a/sc/inc/arraysumfunctorinternal.hxx b/sc/inc/arraysumfunctorinternal.hxx new file mode 100644 index ..a06e3fc17439 --- /dev/null +++ b/sc/inc/arraysumfunctorinternal.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "scdllapi.h" + +namespace sc::op +{ +SC_DLLPUBLIC extern const bool hasAVX512F; + +// Plain old data structure, to be used by code compiled with CPU intrinsics without generating any +// code for it (so that code requiring intrinsics doesn't get accidentally selected as the one copy +// when merging duplicates). +struct KahanSumSimple +{ +double m_fSum; +double m_fError; +}; + +/* Available methods */ +SC_DLLPUBLIC KahanSumSimple executeAVX512F(size_t& i, size_t nSize, const double* pCurrent); +SC_DLLPUBLIC KahanSumSimple executeAVX(size_t& i, size_t nSize, const double* pCurrent); +SC_DLLPUBLIC KahanSumSimple executeSSE2(size_t& i, size_t nSize, const double* pCurrent); + +} // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index 3404fb6d14a6..ded7bd78d70e 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -11,6 +11,8 @@ #include +#include "arraysumfunctorinternal.hxx" + /** * This class provides LO with Kahan summation algorithm * About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm @@ -34,6 +36,12 @@ public: { } +constexpr KahanSum(const sc::op::KahanSumSimple& sum) +: m_fSum(sum.m_fSum) +, m_fError(sum.m_fError) +{ +} + constexpr KahanSum(
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/column.hxx| 17 - sc/inc/document.hxx | 23 - sc/inc/sortparam.hxx | 69 sc/inc/table.hxx | 24 + sc/qa/unit/ucalc_sort.cxx|8 sc/source/core/data/column2.cxx | 81 ++--- sc/source/core/data/document.cxx |5 sc/source/core/data/sortparam.cxx| 41 +- sc/source/core/data/table1.cxx | 56 ++- sc/source/core/data/table3.cxx | 338 +++ sc/source/filter/xml/XMLExportDatabaseRanges.cxx |2 sc/source/ui/app/transobj.cxx| 22 + sc/source/ui/dbgui/tpsort.cxx| 12 sc/source/ui/docshell/dbdocfun.cxx | 64 +++- sc/source/ui/undo/undosort.cxx | 15 - sc/source/ui/unoobj/datauno.cxx |4 sc/source/ui/view/cellsh2.cxx| 12 sc/source/ui/view/gridwin.cxx|6 18 files changed, 518 insertions(+), 281 deletions(-) New commits: commit 0a9b68c9f9880655576e3220d8b70064b367dbee Author: Eike Rathke AuthorDate: Sun Sep 12 20:15:01 2021 +0200 Commit: Eike Rathke CommitDate: Mon Sep 13 00:39:14 2021 +0200 Resolves: tdf#144135 Rework Sort with area extras Since commit 774a61afa9fc281290e7bfad4e28c05978b82d73 CommitDate: Wed Apr 14 08:46:03 2021 +0200 tdf#126678 - Consider "Include formats" option during sort a sheet formatted with visible attributes like cell background colour up to the end if for Sort all columns and/or rows are selected lead to an excessive memory allocation and slow execution time if it didn't get killed by the operating system before due to memory exhaustion. The same could had happened already before if graphics or comments were to be included that could had resulted in a similar large range. However, cell formats across sheets are more likely. This changes the strategy how the to be sorted data range is determined (range only with data) and additional area extras ranges without data that are only to be rearranged. Those are then processed in chunks (limited to ~512MB per chunk). Cell formats that are identical within one column's rows range do not even need to be covered as they are not rearranged, in the best case leading to all trailing formats' ranges being excluded from the sort. Additionally optimize the cell gathering of formats, graphics and comments such that for the area extras they are only collected if actually requested. The overall performance gain is in an order of magnitudes even if some extras are to be collected. Change-Id: If3abbaeaa615aaff7d88a82a5b3fc7ac633d770d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122013 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 01cf0da1f404..6300fe70bca1 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -219,19 +219,16 @@ public: // data only: boolIsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; -boolHasDataAt(SCROW nRow, bool bConsiderCellNotes = false, - bool bConsiderCellDrawObjects = false, bool bConsiderCellFormats = false) const; -boolHasDataAt(sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow, - bool bConsiderCellNotes = false, bool bConsiderCellDrawObjects = false, - bool bConsiderCellFormats = false) const; -boolHasDataAt(sc::ColumnBlockPosition& rBlockPos, SCROW nRow, bool bConsiderCellNotes = false, - bool bConsiderCellDrawObjects = false, bool bConsiderCellFormats = false); +boolHasDataAt( SCROW nRow, ScDataAreaExtras* pDataAreaExtras = nullptr ) const; +boolHasDataAt( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow, + ScDataAreaExtras* pDataAreaExtras = nullptr ) const; +boolHasDataAt( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, + ScDataAreaExtras* pDataAreaExtras = nullptr ); +voidGetDataExtrasAt( SCROW nRow, ScDataAreaExtras& rDataAreaExtras ) const; boolHasVisibleDataAt(SCROW nRow) const; SCROW GetFirstDataPos() const; SCROW GetLastDataPos() const; -SCROW GetLastDataPos(SCROW nLastRow, bool bConsiderCellNotes = false, - bool bConsiderCellDrawObjects = false, - bool bConsiderCellFormats = false) const; +SCROW GetLastDataPos( SCROW nLastRow, ScDataAreaExtras* pDataAreaExtras = nullptr ) const; b
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source sfx2/source
sc/inc/unonames.hxx |1 sc/qa/uitest/calc_tests9/tdf118938.py | 49 ++ sc/qa/uitest/data/tdf118938.xlsx |binary sc/source/filter/excel/excdoc.cxx | 11 ++ sc/source/filter/oox/workbooksettings.cxx | 11 +- sc/source/ui/unoobj/confuno.cxx | 13 +++ sfx2/source/view/viewfrm.cxx |7 +++- 7 files changed, 81 insertions(+), 11 deletions(-) New commits: commit c082158018148be01476d5bc82c1cd71ea6541df Author: Tünde Tóth AuthorDate: Tue Aug 31 12:08:39 2021 +0200 Commit: László Németh CommitDate: Wed Sep 1 11:29:08 2021 +0200 tdf#118938 XLSX import/export: fix permission for editing The password for editing wasn't asked, also wasn't exported in XLSX documents. Now it's exported in Calc using the following steps, also verified before editing: - In File->Save As, choose Excel 2007–365 (.xlsx) format; - enable checkbox "Save with password" and click Save; - in the dialog "Set password", click on "Options" and enable checkbox "Open file read-only", and enter a password for editing (i.e. skip the password for opening). Note: Excel 2016 doesn't ask password for editing, but Office 365 does. Passwords created in Excel haven't been supported, yet. Also passwords with diacritics aren't interoperable. Note: saving the file under a different path is still allowed both in Calc and Excel without asking the password for editing. Change-Id: Ic00d7c5a785e04d270a182a4087ea922d7d92979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121371 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 56936063f74c..36ab650e918b 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -666,6 +666,7 @@ // Security options #define SC_UNO_LOADREADONLY "LoadReadonly" #define SC_UNO_MODIFYPASSWORDINFO "ModifyPasswordInfo" +#define SC_UNO_MODIFYPASSWORDHASH "ModifyPasswordHash" // FormulaParser #define SC_UNO_COMPILEENGLISH "CompileEnglish" diff --git a/sc/qa/uitest/calc_tests9/tdf118938.py b/sc/qa/uitest/calc_tests9/tdf118938.py new file mode 100644 index ..7444f65780ea --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf118938.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 118938 - FILESAVE to Microsoft Excel 2007-2013 XML (.xlsx) files as read-only +# with additional password protection for editing not working (Calc) + +class tdf118938(UITestCase): +def test_tdf118938(self): +with self.ui_test.load_file(get_url_for_data_file("tdf118938.xlsx")): +#The document was created in Calc after this fix. +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") + +incorrectPass = False; + +try: +self.xUITest.executeDialog(".uno:EditDoc") +xDialog = self.xUITest.getTopFocusWindow(); +xPassword = xDialog.getChild("newpassEntry") +xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) +xOKBtn = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOKBtn) + +try: +xWarnDialog = self.xUITest.getTopFocusWindow() +xOK = xWarnDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOK) + +xDialog2 = self.xUITest.getTopFocusWindow(); +xCancelBtn = xDialog2.getChild("cancel") +self.ui_test.close_dialog_through_button(xCancelBtn) + +incorrectPass = True; +except: +pass +except: +assert False, "The password dialog hasn't appeared." + +if incorrectPass: +assert False, "Incorrect password." + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf118938.xlsx b/sc/qa/uitest/data/tdf118938.xlsx new file mode 100644 index ..5e571f9f2475 Binary files /dev/null and b/sc/qa/uitest/data/tdf118938.xlsx differ diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index ebc5a69f937a..1f43caaf73f9 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -806,7 +806,11 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) uno::R
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source vcl/backendtest wizards/source writerfilter/source
sc/inc/arraysumfunctor.hxx|2 +- sc/qa/unit/functions_statistical.cxx |2 +- sc/source/core/tool/arraysumAVX.cxx |4 ++-- sc/source/core/tool/arraysumAVX512.cxx|4 ++-- sc/source/core/tool/arraysumSSE2.cxx |4 ++-- vcl/backendtest/outputdevice/polypolygon.cxx |4 ++-- vcl/backendtest/outputdevice/polypolygon_b2d.cxx |4 ++-- wizards/source/sfdialogs/SF_DialogControl.xba |6 +++--- writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +- 9 files changed, 16 insertions(+), 16 deletions(-) New commits: commit 05ff3d67d0e2e436406786c949eb7cfca107ba33 Author: Andrea Gelmini AuthorDate: Fri Aug 27 19:45:16 2021 +0200 Commit: Julien Nabet CommitDate: Sat Aug 28 00:00:35 2021 +0200 Fix typos Change-Id: Ie4e2ef5a884b51250863d3384d5e703232f31258 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121179 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index ee6d4c0fca5c..ecd428e9f037 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -69,7 +69,7 @@ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pC return 0.0; } -/* Available methos */ +/* Available methods */ SC_DLLPUBLIC KahanSum executeAVX512F(size_t& i, size_t nSize, const double* pCurrent); SC_DLLPUBLIC KahanSum executeAVX(size_t& i, size_t nSize, const double* pCurrent); SC_DLLPUBLIC KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); diff --git a/sc/qa/unit/functions_statistical.cxx b/sc/qa/unit/functions_statistical.cxx index e82d762d88ee..2e489d26dd0d 100644 --- a/sc/qa/unit/functions_statistical.cxx +++ b/sc/qa/unit/functions_statistical.cxx @@ -31,7 +31,7 @@ StatisticalFunctionsTest::StatisticalFunctionsTest(): void StatisticalFunctionsTest::testIntrinsicSums() { -// Checkout SSE2, AVX and AVX512 opperations +// Checkout SSE2, AVX and AVX512 operations // Needs exactly 9 terms double summands[9] = { 0, 1, 2, 3, 4, 10, 20, 2, -1 }; double* pCurrent = summands; diff --git a/sc/source/core/tool/arraysumAVX.cxx b/sc/source/core/tool/arraysumAVX.cxx index af12a08a8cf5..49407b95dfb6 100644 --- a/sc/source/core/tool/arraysumAVX.cxx +++ b/sc/source/core/tool/arraysumAVX.cxx @@ -29,7 +29,7 @@ static inline void sumAVX(__m256d& sum, __m256d& err, const __m256d& value) __m256d asum = _mm256_and_pd(sum, ANNULATE_SIGN_BIT); // Absolute value of the value to add __m256d avalue = _mm256_and_pd(value, ANNULATE_SIGN_BIT); -// Comaprate the absolute values sum >= value +// Compare the absolute values sum >= value __m256d mask = _mm256_cmp_pd(asum, avalue, _CMP_GE_OQ); // The following code has this form ( a - t + b) // Case 1: a = sum b = value @@ -51,7 +51,7 @@ KahanSum executeAVX(size_t& i, size_t nSize, const double* pCurrent) // Make sure we don't fall out of bounds. // This works by sums of 8 terms. // So the 8'th term is i+7 -// If we iterate untill nSize won't fall out of bounds +// If we iterate until nSize won't fall out of bounds if (nSize > i + 7) { // Setup sums and errors as 0 diff --git a/sc/source/core/tool/arraysumAVX512.cxx b/sc/source/core/tool/arraysumAVX512.cxx index 55764849edfb..0fa49c6bccc8 100644 --- a/sc/source/core/tool/arraysumAVX512.cxx +++ b/sc/source/core/tool/arraysumAVX512.cxx @@ -43,7 +43,7 @@ static inline void sumAVX512(__m512d& sum, __m512d& err, const __m512d& value) __m512d asum = _mm512_abs_pd(sum); // Absolute value of the value to add __m512d avalue = _mm512_abs_pd(value); -// Comaprate the absolute values sum >= value +// Compare the absolute values sum >= value __mmask8 mask = _mm512_cmp_pd_mask(avalue, asum, _CMP_GE_OQ); // The following code has this form ( a - t + b) // Case 1: a = sum b = value @@ -65,7 +65,7 @@ KahanSum executeAVX512F(size_t& i, size_t nSize, const double* pCurrent) // Make sure we don't fall out of bounds. // This works by sums of 8 terms. // So the 8'th term is i+7 -// If we iterate untill nSize won't fall out of bounds +// If we iterate until nSize won't fall out of bounds if (nSize > i + 7) { // Setup sums and errors as 0 diff --git a/sc/source/core/tool/arraysumSSE2.cxx b/sc/source/core/tool/arraysumSSE2.cxx index 4f6a4b47a11d..e2ab945acc4a 100644 --- a/sc/source/core/tool/arraysumSSE2.cxx +++ b/sc/source/core/tool/arraysumSSE2.cxx @@ -31,7 +31,7 @@ static inline void sumSSE2(__m128d& sum, __m128d& err, const __m128d& value) __m128d asum = _mm_and_pd(sum, ANNULATE_SIGN_BIT); // Absolute value of the value to add __m128d avalue = _mm_and_pd(value, ANNULATE_SIGN_BIT); -// Comaprate the absolute values sum >= value +// Compare the absolute values sum >= value __m128d mask
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/dbdata.hxx|8 ++-- sc/qa/unit/uicalc/uicalc.cxx | 26 + sc/source/core/tool/dbdata.cxx | 77 ++- sc/source/core/tool/refupdat.cxx | 10 - 4 files changed, 74 insertions(+), 47 deletions(-) New commits: commit 0c0444c44107f1a18f23dd0833d462d8dbf56569 Author: Tünde Tóth AuthorDate: Wed Jul 21 16:04:37 2021 +0200 Commit: Eike Rathke CommitDate: Fri Jul 30 17:57:10 2021 +0200 tdf#126926 sc DBData: delete the database range if some part of the reference became invalid. Change-Id: I4b10af46e92a0a1ba9b6eb5e49df1d3f9a4be6a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119354 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index c1e714fc3e9f..8ecd2faf602f 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -208,10 +208,9 @@ public: voidSetModified(bool bMod) { bModified = bMod; } voidUpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); -voidUpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefMode, -SCCOL nCol1, SCROW nRow1, SCTAB nTab1, -SCCOL nCol2, SCROW nRow2, SCTAB nTab2, -SCCOL nDx, SCROW nDy, SCTAB nDz); +boolUpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefMode, SCCOL nCol1, +SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, +SCCOL nDx, SCROW nDy, SCTAB nDz); void ExtendDataArea(const ScDocument& rDoc); void CalcSaveFilteredCount(SCSIZE nNonFilteredRowCount); @@ -296,6 +295,7 @@ public: void deleteOnTab(SCTAB nTab); ScDBData* getByRange(const ScRange& rRange); void insert(ScDBData* p); +void erase(const iterator& itr); bool empty() const; bool has( const ScDBData* p ) const; bool operator== (const AnonDBs& r) const; diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index c0825914e3fc..5ddf2165a29b 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1717,6 +1717,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126540_GridToggleModifiesTheDocument) CPPUNIT_ASSERT(pDocSh->IsModified()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126926) +{ +mxComponent = loadFromDesktop("private:factory/scalc"); +ScModelObj* pModelObj = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pModelObj); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +insertStringToCell(*pModelObj, "A1", "1"); +insertStringToCell(*pModelObj, "A2", "2"); +insertStringToCell(*pModelObj, "B1", "3"); +insertStringToCell(*pModelObj, "B2", "4"); + +ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1); +bool bInserted += pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData)); +CPPUNIT_ASSERT(bInserted); + +goToCell("A1:B1"); + +dispatchCommand(mxComponent, ".uno:DeleteColumns", {}); + +ScDBCollection* pDBs = pDoc->GetDBCollection(); +CPPUNIT_ASSERT(pDBs->empty()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index ba68d1aa0d8a..4e38b2aaa676 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -586,7 +586,7 @@ void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos) } -void ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefMode, +bool ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz) @@ -601,10 +601,13 @@ void ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefM theTab2 = theTab1; SCCOL nOldCol1 = theCol1, nOldCol2 = theCol2; -bool bDoUpdate = ScRefUpdate::Update( pDoc, eUpdateRefMode, -nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz, -theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 ) != UR_NOTHING; -if (bDoUpdate) +ScRefUpdateRes eRet += ScRefUpdate::Update(pDoc, eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, + nDy, nDz, theCol1, theRow1, theTab1, theCol2, theRow2, theTab2); + +bool bDoUpdate = eRet != UR_NOTHING; + +if (bDoUpdate && eRet != UR_INVALID) { // MoveTo() invalidates column names via SetArea(); adjust, remember and set new. AdjustTableColumnNames( eUpdateRefMode, nDx, nCol1, nOldCol1, nOldCol2, theCol1, theCol2); @@ -639,6 +642,8 @@ void ScDBData::Upd
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/column.hxx |3 ++- sc/inc/columniterator.hxx |1 - sc/inc/document.hxx|3 ++- sc/inc/table.hxx |3 ++- sc/qa/unit/ucalc.cxx |2 +- sc/source/core/data/column4.cxx|6 +++--- sc/source/core/data/columniterator.cxx |2 -- sc/source/core/data/document10.cxx |4 ++-- sc/source/core/data/dpcache.cxx|2 +- sc/source/core/data/table7.cxx |4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) New commits: commit 697e9f3cc9cb3309bf7e22bc39057ff720f1d1b3 Author: Noel Grandin AuthorDate: Wed Jul 21 11:40:27 2021 +0200 Commit: Noel Grandin CommitDate: Wed Jul 21 21:48:25 2021 +0200 pass sc::ColumnIterator by value no need to allocate on heap Change-Id: Ie0f3fa39092083b9c30f3e769bb65fa975150021 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119312 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 20ae065c1613..01cf0da1f404 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -30,6 +30,7 @@ #include #include "attarray.hxx" +#include #include #include @@ -704,7 +705,7 @@ public: void SwapNonEmpty( sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt ); -std::unique_ptr GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const; +std::optional GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const; bool EnsureFormulaCellResults( SCROW nRow1, SCROW nRow2, bool bSkipRunning = false ); diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx index 5cf57e0f438b..64ea55e31325 100644 --- a/sc/inc/columniterator.hxx +++ b/sc/inc/columniterator.hxx @@ -71,7 +71,6 @@ class ColumnIterator public: ColumnIterator(const CellStoreType& rCells, SCROW nRow1, SCROW nRow2); -~ColumnIterator(); void next(); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 63aec33a5161..84be212a2045 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -2512,7 +2513,7 @@ public: const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const; voidDeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength ); -std::unique_ptr GetColumnIterator( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; +std::optional GetColumnIterator( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; void CreateColumnIfNotExists( SCTAB nTab, SCCOL nCol ); SC_DLLPUBLIC void StoreTabToCache(SCTAB nTab, SvStream& rStrm) const; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 1f68937f87d2..6ecc0746d7b5 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -35,6 +35,7 @@ #include "document.hxx" #include "drwlayer.hxx" +#include #include #include @@ -1061,7 +1062,7 @@ public: void TransferCellValuesTo( const SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues& rDest ); void CopyCellValuesFrom( const SCCOL nCol, SCROW nRow, const sc::CellValues& rSrc ); -std::unique_ptr GetColumnIterator( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; +std::optional GetColumnIterator( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; bool EnsureFormulaCellResults( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2, bool bSkipRunning = false ); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 75e96eba3c70..5f2145714e3a 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -667,7 +667,7 @@ void Test::testColumnIterator() // tdf#118620 m_pDoc->SetString(0, 0, 0, "'10.5"); m_pDoc->SetString(0, MAXROW-5, 0, "42.0"); -std::unique_ptr it = m_pDoc->GetColumnIterator(0, 0, MAXROW - 10, MAXROW); +std::optional it = m_pDoc->GetColumnIterator(0, 0, MAXROW - 10, MAXROW); while (it->hasCell()) { it->getCell(); diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 54213f2cd582..b490c557dfe0 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -1663,12 +1663,12 @@ void ScColumn::SetNeedsListeningGroup( SCROW nRow ) (*pp)->SetNeedsListening(true); } -std::unique_ptr ScColumn::GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const +std::optional ScColumn::GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const { if (!GetDoc().ValidRow(nRow1) || !GetDoc().ValidRow(nRow2) || nRow1 > nRow2) -return std::unique_ptr(); +return {}; -return std::make_unique(maCells, nRow1, nRow2); +return sc::ColumnIterator(maCells, nRow1, nRow2); } static bool lcl_InterpretSpan(sc::formula_block::const_iterator& rSpanIter, SCROW nStartOffset, SCROW nEndOffset, diff --git a/sc/source/core/data/columnite
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source sc/uiconfig sc/UIConfig_scalc.mk svx/source
sc/UIConfig_scalc.mk|4 sc/inc/scres.hrc|8 sc/qa/uitest/calc_tests9/tdf142763.py | 69 +++ sc/source/ui/attrdlg/scdlgfact.cxx | 12 + sc/source/ui/inc/hfedtdlg.hxx | 42 sc/source/ui/inc/scuitphfedit.hxx | 14 + sc/source/ui/pagedlg/hfedtdlg.cxx | 90 +- sc/source/ui/pagedlg/scuitphfedit.cxx | 26 ++ sc/source/ui/pagedlg/tphf.cxx | 28 ++- sc/uiconfig/scalc/ui/footerdialog.ui| 46 + sc/uiconfig/scalc/ui/headerdialog.ui| 46 + sc/uiconfig/scalc/ui/sharedfirstfooterdialog.ui | 209 sc/uiconfig/scalc/ui/sharedfirstheaderdialog.ui | 209 sc/uiconfig/scalc/ui/sharedleftfooterdialog.ui | 205 +++ sc/uiconfig/scalc/ui/sharedleftheaderdialog.ui | 205 +++ svx/source/dialog/hdft.cxx | 16 - 16 files changed, 1202 insertions(+), 27 deletions(-) New commits: commit 6128e2d55f0d0c68d3c7f6fb69539ec800637947 Author: Daniel Arato (NISZ) AuthorDate: Wed Jun 16 10:39:29 2021 +0200 Commit: László Németh CommitDate: Tue Jul 20 16:19:37 2021 +0200 tdf#142763 sc UI: add first page header/footer options Add checkbox "Same content on first page" checkbox (similar to the existing "Same content on left and right pages) to the Page Style dialog window, on the Header and Footer panes. Follow-up to commit 19fa853ce12136b5c14e0c5a0aa906c296b75388 (tdf#121715 XLSX: support custom first page header/footer) and commit 52beb3907dd3c7e6ae112e263def1005272cecd8 (tdf#142764 sc: import "Same content on first/left page"). Note: to set different header or footer on the first page of the spreadsheet, disable "Same content on first page" on Format->Page Style...->Header (or Footer), and choose the "Edit..." button. Change-Id: I3348fde216424b8d2c662956eab27cbe5880fc1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117316 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index e19172e49bd3..c7ddfa38f88f 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -217,6 +217,10 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/selectsource \ sc/uiconfig/scalc/ui/sheetprintpage \ sc/uiconfig/scalc/ui/sharedocumentdlg \ + sc/uiconfig/scalc/ui/sharedfirstfooterdialog \ + sc/uiconfig/scalc/ui/sharedfirstheaderdialog \ + sc/uiconfig/scalc/ui/sharedleftfooterdialog \ + sc/uiconfig/scalc/ui/sharedleftheaderdialog \ sc/uiconfig/scalc/ui/sharedfooterdialog \ sc/uiconfig/scalc/ui/sharedheaderdialog \ sc/uiconfig/scalc/ui/sharedwarningdialog \ diff --git a/sc/inc/scres.hrc b/sc/inc/scres.hrc index 57ac75843530..8089d41258f0 100644 --- a/sc/inc/scres.hrc +++ b/sc/inc/scres.hrc @@ -39,8 +39,12 @@ #define RID_SCDLG_HFEDIT_RIGHTHEADER(SC_DIALOGS_START + 65) #define RID_SCDLG_HFEDIT_LEFTFOOTER (SC_DIALOGS_START + 66) #define RID_SCDLG_HFEDIT_RIGHTFOOTER(SC_DIALOGS_START + 67) -#define RID_SCDLG_HFEDIT_HEADER (SC_DIALOGS_START + 68) -#define RID_SCDLG_HFEDIT_FOOTER (SC_DIALOGS_START + 69) +#define RID_SCDLG_HFEDIT_SHAREDFIRSTHEADER (SC_DIALOGS_START + 68) +#define RID_SCDLG_HFEDIT_SHAREDLEFTHEADER (SC_DIALOGS_START + 69) +#define RID_SCDLG_HFEDIT_SHAREDFIRSTFOOTER (SC_DIALOGS_START + 70) +#define RID_SCDLG_HFEDIT_SHAREDLEFTFOOTER (SC_DIALOGS_START + 71) +#define RID_SCDLG_HFEDIT_HEADER (SC_DIALOGS_START + 72) +#define RID_SCDLG_HFEDIT_FOOTER (SC_DIALOGS_START + 73) #define WID_CONDFRMT_REF(SC_DIALOGS_START + 163) diff --git a/sc/qa/uitest/calc_tests9/tdf142763.py b/sc/qa/uitest/calc_tests9/tdf142763.py new file mode 100644 index ..5808dd1df624 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf142763.py @@ -0,0 +1,69 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +import time + +class Tdf142763(UITestCase): + +def test_tdf142763_header(self): +with self.ui_test.create_doc_in_start_center("calc"): +xCalcDoc = self.xUITest.getTopFocusWindow() +gridwin = xCalcDoc.getChild("grid_window") +gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) +
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/queryentry.hxx|3 sc/inc/typedstrdata.hxx |9 +- sc/qa/uitest/autofilter/autofilter.py| 70 ++- sc/source/core/data/column3.cxx |9 +- sc/source/core/data/table3.cxx | 32 +- sc/source/core/tool/queryentry.cxx |2 sc/source/core/tool/typedstrdata.cxx | 37 +++- sc/source/filter/xml/XMLExportDatabaseRanges.cxx | 34 +-- sc/source/filter/xml/xmlfilti.cxx| 21 +- sc/source/ui/cctrl/checklistmenu.cxx |4 - sc/source/ui/dbgui/filtdlg.cxx |1 sc/source/ui/inc/checklistmenu.hxx |6 - sc/source/ui/unoobj/datauno.cxx |6 - sc/source/ui/view/gridwin.cxx| 20 -- 14 files changed, 119 insertions(+), 135 deletions(-) New commits: commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d Author: Balazs Varga AuthorDate: Fri Jul 2 09:40:32 2021 +0200 Commit: László Németh CommitDate: Wed Jul 7 17:44:46 2021 +0200 tdf#142910 sc filter: fix "greater than" or "smaller than" etc Filter "greater than" or "smaller than" (>, <, >=, <=) conditions according to the cell number format. Regression from commit: d5c2584bf36d21580db677b231c57f99f49aa2cb (Related: tdf#140968 avoid duplicated filter values) Follow-up to commit: 1f755525189884e4b2824889a6b9dea8933402db (tdf#142402 sc UI: store formatted values in standard filter) Clean-up for commit: d5c2584bf36d21580db677b231c57f99f49aa2cb (Related: tdf#140968 avoid duplicated filter values) Change-Id: I1284892398c9964ca5407b4d617a617f20341107 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118272 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/queryentry.hxx b/sc/inc/queryentry.hxx index 1855744f78f7..94ea761c1239 100644 --- a/sc/inc/queryentry.hxx +++ b/sc/inc/queryentry.hxx @@ -48,10 +48,9 @@ struct SC_DLLPUBLIC ScQueryEntry doublemfVal; svl::SharedString maString; bool mbMatchEmpty; -bool mbFormattedValue; Color maColor; -Item() : meType(ByValue), mfVal(0.0), mbMatchEmpty(false), mbFormattedValue(false) {} +Item() : meType(ByValue), mfVal(0.0), mbMatchEmpty(false) {} bool operator== (const Item& r) const; }; diff --git a/sc/inc/typedstrdata.hxx b/sc/inc/typedstrdata.hxx index 50a7effea87e..7c7b1c7e45d4 100644 --- a/sc/inc/typedstrdata.hxx +++ b/sc/inc/typedstrdata.hxx @@ -24,14 +24,14 @@ public: Header = 4 }; -ScTypedStrData( const OUString& rStr, double nVal = 0.0, StringType eType = Standard, -bool bDate = false, bool mbIsFormatted = false, bool bDuplicated = false ); +ScTypedStrData( const OUString& rStr, double fVal = 0.0, double fRVal = 0.0, StringType eType = Standard, +bool bDate = false ); bool IsDate() const { return mbIsDate;} const OUString& GetString() const { return maStrValue;} StringType GetStringType() const { return meStrType;} double GetValue() const { return mfValue; } -bool IsDuplicated() const { return mbIsDuplicated; } +double GetRoundedValue() const { return mfRoundedValue; } struct LessCaseSensitive { @@ -58,10 +58,9 @@ public: private: OUString maStrValue; double mfValue; +double mfRoundedValue; // rounded value by format code StringType meStrType; bool mbIsDate; -bool mbIsFormatted; // true if the cell value is a formatted filter value -bool mbIsDuplicated; // true if the cell has a formatted filter value and has at least one duplicate formatted value. }; class FindTypedStrData diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 129add2703ec..4c1b8194fb06 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -442,20 +442,8 @@ class AutofilterTest(UITestCase): xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") -xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) -xFloatWindow = self.xUITest.getFloatWindow() -#Choose Standard Filter... button -xMenu = xFloatWindow.getChild("menu") - -xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) -xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) -xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) -xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) -xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) -xMenu.executeAction("TYPE", mkPropertyValues({"
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/address.hxx| 26 +- sc/qa/unit/data/xlsx/invalid-named-range.xlsx |binary sc/qa/unit/subsequent_export-test2.cxx| 19 +++ sc/source/filter/inc/defnamesbuffer.hxx |1 + sc/source/filter/oox/defnamesbuffer.cxx | 22 ++ 5 files changed, 55 insertions(+), 13 deletions(-) New commits: commit db1c8df98a23d687d6806f371bdd416dd1b84589 Author: Miklos Vajna AuthorDate: Mon Jul 5 12:29:18 2021 +0200 Commit: Miklos Vajna CommitDate: Mon Jul 5 14:04:11 2021 +0200 XLSX import: fix handling of named ranges referring to PathMissing sheets In case xl/externalLinks/externalLink1.xml refers to a sheet where type is PathMissing, then both and gets ignored on import. Make sure to also ignore named ranges referring to such external documents. The resulting named range was just a string anyway, and exporting this back to XLSX results in Excel marking the whole file as corrupted. Change-Id: Ifde07b5e59fba371f1f8ab3e82861c6997c6dbf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118401 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index f7e928b88b6a..2f3a987b45bc 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -493,7 +493,7 @@ struct ScAddressHashFunctor } // ScRange -class SAL_WARN_UNUSED ScRange final +class SAL_WARN_UNUSED SC_DLLPUBLIC ScRange final { public: ScAddress aStart; @@ -550,18 +550,18 @@ public: inline bool In( const ScAddress& ) const; ///< is Address& in Range? inline bool In( const ScRange& ) const; ///< is Range& in Range? -SC_DLLPUBLIC ScRefFlags Parse( const OUString&, const ScDocument&, +ScRefFlags Parse( const OUString&, const ScDocument&, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, ScAddress::ExternalInfo* pExtInfo = nullptr, const css::uno::Sequence* pExternalLinks = nullptr, const OUString* pErrRef = nullptr ); -SC_DLLPUBLIC ScRefFlags ParseAny( const OUString&, const ScDocument&, +ScRefFlags ParseAny( const OUString&, const ScDocument&, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); -SC_DLLPUBLIC ScRefFlags ParseCols( const ScDocument& rDoc, +ScRefFlags ParseCols( const ScDocument& rDoc, const OUString&, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); -SC_DLLPUBLIC void ParseRows( const ScDocument& rDoc, +void ParseRows( const ScDocument& rDoc, const OUString&, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); @@ -613,14 +613,14 @@ public: @returns String contains formatted cell range in address convention */ -SC_DLLPUBLIC OUString Format( const ScDocument& rDocument, +OUString Format( const ScDocument& rDocument, ScRefFlags nFlags = ScRefFlags::ZERO, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, bool bFullAddressNotation = false ) const; inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1, SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const; -SC_DLLPUBLIC void PutInOrder(); +void PutInOrder(); /** @param rErrorRange @@ -629,18 +629,18 @@ public: @param pDocument The document for the maximum defined sheet number. */ -[[nodiscard]] SC_DLLPUBLIC bool Move( SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, +[[nodiscard]] bool Move( SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, ScRange& rErrorRange, const ScDocument* pDocument = nullptr ); /** Same as Move() but with sticky end col/row anchors. */ -[[nodiscard]] SC_DLLPUBLIC bool MoveSticky( const ScDocument& rDoc, SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, +[[nodiscard]] bool MoveSticky( const ScDocument& rDoc, SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, ScRange& rErrorRange ); -SC_DLLPUBLIC void IncColIfNotLessThan(const ScDocument& rDoc, SCCOL nStartCol, SCCOL nOffset); -SC_DLLPUBLIC void IncRowIfNotLessThan(const ScDocument& rDoc, SCROW nStartRow, SCROW nOffset); +void IncColIfNotLessThan(const ScDocument& rDoc, SCCOL nStartCol, SCCOL nOffset); +void IncRowIfNotLessThan(const ScDocument& rDoc, SCROW nStartRow, SCROW nOffset); -SC_DLLPUBLIC void ExtendTo( const ScRange& rRange ); -SC_DLLPUBLIC bool Intersects( const ScRange& rRange ) const;// do two ranges intersect? +void ExtendT
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/table.hxx | 10 sc/qa/unit/ucalc_copypaste.cxx | 1909 - sc/source/core/data/table2.cxx | 39 3 files changed, 985 insertions(+), 973 deletions(-) New commits: commit c82d96da1c9a03e1742f2f5a7a93b9993c96a0a0 Author: scito AuthorDate: Mon May 31 22:26:21 2021 +0200 Commit: Eike Rathke CommitDate: Fri Jun 4 12:21:29 2021 +0200 tdf#68976 fix paste transposed regression for notes/patterns Starting position was not correctly taken into account for notes/patterns in the initial fix. It worked only for source range starting in A1 (0/0), i.e. a special case. The unit tests tested only this special case. The unit tests are generalized: Starting in B2 instead of A1, i.e. the source range was shifted. The paste destination results remain the same, except absolute references. Change-Id: I2f7bfa9e559d99b173ff833fed3cff21658e0e31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116501 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 4a538428c163..1f68937f87d2 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1253,20 +1253,26 @@ private: /** * Transpose clipboard patterns + * @param nCombinedStartRow start row of the combined range; + * used for transposed multi range selection with row direction; + * for other cases than multi range row selection this it equal to nRow1 * @param nRowDestOffset adjustment of destination row position; * used for transposed multi range row selections, otherwise 0 */ void TransposeColPatterns(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1, - SCROW nRow2, bool bIncludeFiltered, + SCROW nRow2, SCROW nCombinedStartRow, bool bIncludeFiltered, const std::vector& rFilteredRows, SCROW nRowDestOffset); /** * Transpose clipboard notes + * @param nCombinedStartRow start row of the combined range; + * used for transposed multi range selection with row direction; + * for other cases than multi range row selection this it equal to nRow1 * @param nRowDestOffset adjustment of destination row position; * used for transposed multi range row selections, otherwise 0 */ void TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1, SCROW nRow2, - bool bIncludeFiltered, SCROW nRowDestOffset); + SCROW nCombinedStartRow, bool bIncludeFiltered, SCROW nRowDestOffset); ScColumn* FetchColumn( SCCOL nCol ); const ScColumn* FetchColumn( SCCOL nCol ) const; diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index f38f59afd74b..b9ec61590a01 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -1680,23 +1680,23 @@ void TestCopyPaste::executeCopyPasteSpecial(const SCTAB srcSheet, const SCTAB de ScFieldEditEngine& rEditEngine = m_pDoc->GetEditEngine(); /* - | A |B | C| D | E |F| + | B |C | D| E | F |G| -1r | 1 B*| =A1+10 *| a| R1 *| =A1+A3+60 | =SUMIF(A1:A4;"<4") | -2r | 2 B*| =A2+20 b | b *| R2 *||*| <- filtered row -3r | 3 B*| =D3+30 b*| c *| 5 *| B*| | -4| 4 | =A2+40 b*| d *| R4 *| =A1+A3+70 *|=B$1+$A$3+80*| - (5r | 6 |q | r bB*| s bB| t | u |) optional, for row range - (6| -1 |-2| -3 | -4 | -5 | -6 |) optional, for row range - (7r | -11 |-12 | -13 | -14 | -15| -16|) optional, for row range - (8| -21 |-22 | -23 | -24 | -25| -26|) optional, for row range +3r | 1 B*| =B3+10 *| a| R1 *| =B3+B5+60 | =SUMIF(B3:B6;"<4") | +4r | 2 B*| =B4+20 b | b *| R2 *||*| <- filtered row +5r | 3 B*| =E5+30 b*| c *| 5 *| B*| | +6| 4 | =B4+40 b*| d *| R4 *| =B3+B5+70 *|=C$3+$B$5+80*| + (7r | 6 |q | r bB*| s bB| t | u |) optional, for row range + (8| -1 |-2| -3 | -4 | -5 | -6 |) optional, for row range + (9r | -11 |-12 | -13 | -14 | -15| -16|) optional, for row range + (10 | -21 |-22 | -23 | -24 | -25| -26|) optional, for row range \__/ \/ col range 1 col range 2 refs to cells (used for cut/paste tests) -15 | =B3 | =$B$3| =$B3 | =B$3| =S
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/table.hxx |2 - sc/qa/uitest/autofilter/autofilter.py | 39 +- sc/source/core/data/documen3.cxx |2 - sc/source/core/data/table3.cxx|4 +-- sc/source/ui/dbgui/filtdlg.cxx|7 +- 5 files changed, 44 insertions(+), 10 deletions(-) New commits: commit 1f755525189884e4b2824889a6b9dea8933402db Author: Balazs Varga AuthorDate: Tue May 25 18:23:16 2021 +0200 Commit: László Németh CommitDate: Mon May 31 12:15:41 2021 +0200 tdf#142402 sc UI: store formatted values in standard filter value list and filter by formatted values later, just like we do in the autofilter. Follow-up to commit 4fd1333ba4bb4f2311e9098291154772bd310429 "tdf#140968 tdf#140978 XLSX import: fix lost rounded filters". Change-Id: If26f4c0abd54de05b497861f2c278972bd8072de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116115 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index cbf97d7dbd36..4a538428c163 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -961,7 +961,7 @@ public: SCSIZE Query(const ScQueryParam& rQueryParam, bool bKeepSub); boolCreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); -void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries ); +void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries, bool bFiltering = false); void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, ScFilterEntries& rFilterEntries, bool bFiltering ); [[nodiscard]] bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set& rStrings); diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 334f7a90b3dd..70c6b3c3b89d 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -6,7 +6,7 @@ # from uitest.framework import UITestCase -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_by_text from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.calc.document import is_row_hidden from uitest.uihelper.calc import enter_text_to_cell @@ -455,5 +455,42 @@ class AutofilterTest(UITestCase): self.assertTrue(is_row_hidden(doc, 7)) self.assertFalse(is_row_hidden(doc, 8)) +self.ui_test.close_doc() + +def test_tdf142402(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +#Choose Standard Filter... button +xMenu = xFloatWindow.getChild("menu") + +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + +xDialog = self.xUITest.getTopFocusWindow() +xval1 = xDialog.getChild("val1") + +select_by_text(xval1, "0.365") + +xOKBtn = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOKBtn) + +self.assertFalse(is_row_hidden(doc, 0)) +self.assertFalse(is_row_hidden(doc, 1)) +self.assertTrue(is_row_hidden(doc, 2)) +self.assertTrue(is_row_hidden(doc, 3)) +self.assertTrue(is_row_hidden(doc, 4)) +self.assertTrue(is_row_hidden(doc, 5)) +self.assertTrue(is_row_hidden(doc, 6)) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 5db63b6e7815..8d6f6a2baadf 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1606,7 +1606,7 @@ void ScDocument::GetFilterEntriesArea( { if ( ValidTab(nTab) && nTab < static_cast(maTabs.size()) && maTabs[nTab] ) { -maTabs[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rFilterEntries ); +maTabs[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rFilterEntries, true ); sortAndRemoveDuplicates( rFilterEntries.maStrData, bCaseSens); } } diff --git a/sc/source/core
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/clipparam.hxx |7 sc/inc/document.hxx |5 sc/inc/refupdatecontext.hxx |5 sc/qa/unit/helper/qahelper.cxx | 44 sc/qa/unit/helper/qahelper.hxx |9 sc/qa/unit/ucalc_copypaste.cxx | 4810 +-- sc/source/core/data/clipparam.cxx|2 sc/source/core/data/document.cxx |2 sc/source/core/data/formulacell.cxx | 15 sc/source/core/data/refupdatecontext.cxx | 15 sc/source/core/tool/rangenam.cxx |2 sc/source/core/tool/refupdat.cxx |6 sc/source/core/tool/token.cxx| 30 13 files changed, 4657 insertions(+), 295 deletions(-) New commits: commit bda9929821de620f1f85528abd1c4bba46d937d6 Author: scito AuthorDate: Wed May 26 21:00:33 2021 +0200 Commit: Eike Rathke CommitDate: Sat May 29 22:46:11 2021 +0200 tdf#142201 tdf#142065 fix cut paste transpose references, incl. undo For cut paste transposed, references are not anymore updated during UpdateReference(), but all these references will be updated during UpdateTranspose(). In previous implementation, some references were moved (i.e. updated). This caused problems in UpdateTranspose(). A transposed flag is added to the clipparam. This flag is checked during UpdateReference(). UpdateTranspose() must only operate on (i.e. transpose) references pointing to the source area. That's why updates must not be made during UpdateReference(). Otherwise references pointing to the destination range will be transposed wrongly during UpdateTranspose(). References in formulas as well as in named ranges are fixed and tested. I've added unit tests for all these cases and I've enhanced my previous copy/paste test framework (6491c205acb3c166d93ef6a41199d344e21d98ac) for cut/paste tests, incl. undo. Before LibreOffice 7.2, adjusting of references in cut paste transposed was completely broken (tdf#71058, tdf#68976, tdf#142065 and tdf#142201). Change-Id: I8a8d295f1cc683572905ae9633e16d010cfb8792 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116073 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx index 55f37fe1d89e..4487e77093ff 100644 --- a/sc/inc/clipparam.hxx +++ b/sc/inc/clipparam.hxx @@ -36,6 +36,8 @@ struct SC_DLLPUBLIC ScClipParam boolmbCutMode; sal_uInt32 mnSourceDocID; ScRangeListVector maProtectedChartRangesVector; +/** Was this clip transposed? */ +bool mbTransposed = false; ScClipParam(); ScClipParam(const ScRange& rRange, bool bCutMode); @@ -69,6 +71,11 @@ struct SC_DLLPUBLIC ScClipParam sal_uInt32 getSourceDocID() const { return mnSourceDocID; } void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; } + +/** + * Was this clip transposed? + */ +bool isTransposed() const { return mbTransposed; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index e4127d426d25..63aec33a5161 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1706,7 +1706,10 @@ public: void UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr, bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true ); - +/** + * @param pClipDoc original clipboard doc, i.e. non-transposed + * This clip doc is used to check references pointing to cut cells. + */ SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc, const ScMarkData& rMark, ScDocument* pUndoDoc ); diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx index 7e1a4d9e8dd6..1c50c7a2c0d1 100644 --- a/sc/inc/refupdatecontext.hxx +++ b/sc/inc/refupdatecontext.hxx @@ -68,6 +68,9 @@ struct RefUpdateContext */ ScRange maRange; +/** Are the data transposed? */ +bool mbTransposed; + /** Amount and direction of movement in the column direction. */ SCCOL mnColDelta; /** Amount and direction of movement in the row direction. */ @@ -80,7 +83,7 @@ struct RefUpdateContext ColumnBlockPositionSet* mpBlockPos; // not owning -RefUpdateContext(ScDocument& rDoc); +RefUpdateContext(ScDocument& rDoc, ScDocument* pClipdoc = nullptr); bool isInserted() const; bool isDeleted() const; diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 8502cf6caf52..590250847d95 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -1027,7 +1027,38 @@ bool insertRangeNames( return true; } -void printRange(ScDocument* pDoc, const ScRange& rRange, const
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/strings.hrc |1 sc/qa/uitest/autofilter/tdf141559.py | 93 +++ sc/source/ui/inc/gridwin.hxx |1 sc/source/ui/view/gridwin.cxx|6 +- 4 files changed, 100 insertions(+), 1 deletion(-) New commits: commit 451b9802dd708e646273839829845800e13db47e Author: Tünde Tóth AuthorDate: Fri May 14 14:44:48 2021 +0200 Commit: László Németh CommitDate: Sat May 22 12:29:04 2021 +0200 tdf#141559 sc UI: add Clear Filter to Autofilter widget Implement Clear Filter menu item in the Autofilter dropdown that can remove standard filter conditions and autofilter conditions too. Change-Id: I7521379955d3f38076c3129273629222412d9ed4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115609 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index d2463ad39306..2da196f51776 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -31,6 +31,7 @@ #define SCSTR_ALL NC_("SCSTR_ALL", "- all -") #define SCSTR_MULTIPLE NC_("SCSTR_MULTIPLE", "- multiple -") #define SCSTR_STDFILTER NC_("SCSTR_STDFILTER", "Standard Filter...") +#define SCSTR_CLEAR_FILTER NC_("SCSTR_CLEAR_FILTER", "Clear Filter") #define SCSTR_TOP10FILTER NC_("SCSTR_TOP10FILTER", "Top 10") #define SCSTR_FILTER_EMPTY NC_("SCSTR_FILTER_EMPTY", "Empty") #define SCSTR_FILTER_NOTEMPTY NC_("SCSTR_FILTER_NOTEMPTY", "Not Empty") diff --git a/sc/qa/uitest/autofilter/tdf141559.py b/sc/qa/uitest/autofilter/tdf141559.py new file mode 100644 index ..6bce18852ff3 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf141559.py @@ -0,0 +1,93 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row +from uitest.uihelper.common import get_state_as_dict + +#Bug 141559 - Add Clear Standard Filter to Autofilter widget + +class tdf141559(UITestCase): +def test_tdf141559_clear_filter(self): +self.ui_test.create_doc_in_start_center("calc") +document = self.ui_test.get_component() +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +enter_text_to_cell(gridwin, "A1", "A") +enter_text_to_cell(gridwin, "A2", "1") +enter_text_to_cell(gridwin, "A3", "2") +enter_text_to_cell(gridwin, "A4", "3") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +#Choose Standard Filter... button +xMenu = xFloatWindow.getChild("menu") + +# check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional) +nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 +self.assertEqual(10, nLastIdx) +self.assertEqual('Standard Filter...', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) + +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +self.assertEqual("Standard Filter...", get_state_as_dict(xMenu)['SelectEntryText']) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + +xDialog = self.xUITest.getTopFocusWindow() +xfield1 = xDialog.getChild("field1") +xcond1 = xDialog.getChild("cond1") +xval1 = xDialog.getChild("val1") + +select_by_text(xfield1, "A") +select_by_text(xcond1, ">") +xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) +xOKBtn = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOKBtn) + +row = get_row(document, 1) +self.assertFalse(row.getPropertyValue("IsVisible")) + +
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/table.hxx |9 +-- sc/qa/unit/ucalc_copypaste.cxx| 44 ++ sc/source/core/data/clipparam.cxx | 10 ++-- sc/source/core/data/document.cxx | 11 - sc/source/core/data/table2.cxx| 36 +-- 5 files changed, 82 insertions(+), 28 deletions(-) New commits: commit de4c23fb38a7848e1030075b9c15cbb5c558694c Author: scito AuthorDate: Fri May 21 13:11:51 2021 +0200 Commit: Mike Kaganski CommitDate: Fri May 21 17:01:24 2021 +0200 tdf#68976 cut paste transposed: fix wrong position in clipdoc The transposed cells were written always in A1 of the transposed clip. This is no problem for copy paste transposed. However, this is an issue for cut paste transposed as references of formulas pointing to cut cells are adjusted according to position changes. The solution is to write the transposed cells in the same top left corner of the transposed clipdoc as in the original non-transposed clipdoc. There are still issues with cut paste transposed: Formula references are not updated correctly in some cases (tdf#142065, tdf#142201). Comprehensive unit tests will follow with fixes for tdf#142065 and tdf#142201. Change-Id: Id691fabf89d7f25e05182b20bd379299fc18fbb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115535 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 8d938e6e5ce1..cbf97d7dbd36 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -541,12 +541,15 @@ public: voidCopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, const ScTable* pTable); /** + * @param nCombinedStartRow start row of the combined range; + * used for transposed multi range selection with row direction; + * for other cases than multi range row selection this it equal to nRow1 * @param nRowDestOffset adjustment of destination row position; * used for transposed multi range selection with row direction, otherwise 0 */ -void TransposeClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCROW nRowDestOffset, - ScTable* pTransClip, InsertDeleteFlags nFlags, bool bAsLink, - bool bIncludeFiltered); +void TransposeClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCROW nCombinedStartRow, + SCROW nRowDestOffset, ScTable* pTransClip, InsertDeleteFlags nFlags, + bool bAsLink, bool bIncludeFiltered); // mark of this document void MixMarked( diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 0bbd326eb128..35c1bb72f276 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -114,6 +114,7 @@ public: void testCopyPasteFormulas(); void testCopyPasteFormulasExternalDoc(); void testCopyPasteReferencesExternalDoc(); // tdf#106456 +void testTdf68976(); void testTdf71058(); CPPUNIT_TEST_SUITE(TestCopyPaste); @@ -189,6 +190,7 @@ public: CPPUNIT_TEST(testCopyPasteFormulasExternalDoc); CPPUNIT_TEST(testCopyPasteReferencesExternalDoc); +CPPUNIT_TEST(testTdf68976); CPPUNIT_TEST(testTdf71058); CPPUNIT_TEST_SUITE_END(); @@ -6820,6 +6822,48 @@ void TestCopyPaste::testCopyPasteReferencesExternalDoc() xExtDocSh->DoClose(); } +void TestCopyPaste::testTdf68976() +{ +const SCTAB nTab = 0; +m_pDoc->InsertTab(nTab, "Test"); + +m_pDoc->SetValue(0, 0, nTab, 1.0); // A1 +m_pDoc->SetString(0, 1, nTab, "=$A$1"); // A2 +m_pDoc->SetValue(0, 2, nTab, 1000.0); // A3 + +// Cut A3 to the clip document. +ScDocument aClipDoc(SCDOCMODE_CLIP); +ScRange aSrcRange(0, 2, nTab, 0, 2, nTab); +cutToClip(*m_xDocShell, aSrcRange, &aClipDoc, false); // A3 + +ScRange aDestRange(1, 3, nTab, 1, 3, nTab); // B4 +ScMarkData aDestMark(m_pDoc->GetSheetLimits()); + +// Transpose +ScDocument* pOrigClipDoc = &aClipDoc; +ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP)); +aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::ALL, false, true); +aDestMark.SetMarkArea(aDestRange); +// Paste +m_pDoc->CopyFromClip(aDestRange, aDestMark, InsertDeleteFlags::ALL, nullptr, pTransClip.get(), + true, false, true, false); +m_pDoc->UpdateTranspose(aDestRange.aStart, pOrigClipDoc, aDestMark, nullptr); +pTransClip.reset(); + +// Check results +CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(0, 0, nTab)); // A1 +// Without the fix in place, this would have failed with +// - Expected: =$A$1 +// - Actual : =$B$4 +ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 1, nTab), "$A$1", "Wrong formula"); +// Without the fix in place, this would have failed with +// - Expected:
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/column.hxx |7 sc/qa/unit/ucalc.cxx| 366 sc/source/core/data/column3.cxx |6 3 files changed, 376 insertions(+), 3 deletions(-) New commits: commit 2eb95408912f2292e2c7e8634c628a29f6c241b7 Author: scito AuthorDate: Fri May 21 12:43:52 2021 +0200 Commit: Mike Kaganski CommitDate: Fri May 21 16:59:30 2021 +0200 tdf#116413 after Paste Special with ADD and As Link attach dest cells Change-Id: Icc039a4ea1c02d81d282cb43e7cf40279bea3342 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114641 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index c68110795311..560fb1d33b96 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -718,6 +718,10 @@ public: SCSIZE GetPatternCount() const; SCSIZE GetPatternCount( SCROW nRow1, SCROW nRow2 ) const; boolReservePatternCount( SCSIZE nReserve ); + +void AttachNewFormulaCells(const sc::CellStoreType::position_type& aPos, size_t nLength, + std::vector& rNewSharedRows); + private: sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow, std::vector& rNewSharedRows, @@ -735,9 +739,6 @@ private: const std::vector& rNewSharedRows, bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening ); -void AttachNewFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength, -std::vector& rNewSharedRows ); - void BroadcastNewCell( SCROW nRow ); bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr ); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 222e3c055358..76ffd606bbe9 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -178,6 +178,8 @@ public: void testFormulaWizardSubformula(); void testMixData(); +void testMixDataAsLinkTdf116413(); +void testMixDataWithFormulaTdf116413(); /** * Make sure the sheet streams are invalidated properly. @@ -302,6 +304,8 @@ public: CPPUNIT_TEST(testFormulaPosition); CPPUNIT_TEST(testFormulaWizardSubformula); CPPUNIT_TEST(testMixData); +CPPUNIT_TEST(testMixDataAsLinkTdf116413); +CPPUNIT_TEST(testMixDataWithFormulaTdf116413); CPPUNIT_TEST(testJumpToPrecedentsDependents); CPPUNIT_TEST(testSetBackgroundColor); CPPUNIT_TEST(testRenameTable); @@ -5937,6 +5941,368 @@ void Test::testMixData() m_pDoc->DeleteTab(0); } +void Test::testMixDataAsLinkTdf116413() +{ +sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calculation. + +const SCTAB nTab = 0; +m_pDoc->InsertTab(nTab, "Test"); + +// Scenario 1: Past "As Link" and "Add" operation (as described in tdf#116413) +m_pDoc->SetValue(0, 0, nTab, 1.0); // A1 +m_pDoc->SetValue(0, 1, nTab, 1000.0); // A2 + +// Copy A1 to the clip document. +ScDocument aClipDoc(SCDOCMODE_CLIP); +copyToClip(m_pDoc, ScRange(0, 0, nTab, 0, 0, nTab), &aClipDoc); // A1 + +ScRange aDestRange(0, 1, nTab, 0, 1, nTab); +// Copy A2 to the mix document (for arithmetic paste). +ScDocument aMixDoc(SCDOCMODE_CLIP); +copyToClip(m_pDoc, aDestRange, &aMixDoc); // A2 + +// Paste A1 to A2 "As Link" and perform addition. +ScMarkData aMark(m_pDoc->GetSheetLimits()); +aMark.SetMarkArea(aDestRange); +m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc, true, true); + +m_pDoc->MixDocument(aDestRange, ScPasteFunc::ADD, false, aMixDoc); + +OUString aFormula; + +// Test precondition +CPPUNIT_ASSERT_EQUAL(1001.0, m_pDoc->GetValue(0, 1, nTab)); // A2 +m_pDoc->GetFormula(0, 1, nTab, aFormula); +CPPUNIT_ASSERT_EQUAL(OUString("=1000+($Test.$A$1)"), aFormula); + +// Change A1 from 1.0 to 2.0 (auto calculation is triggered) +m_pDoc->SetValue(0, 0, nTab, 2.0); // A1 + +// Without the fix in place, this would have failed with +// - Expected: =1002 +// - Actual : =1001 +CPPUNIT_ASSERT_EQUAL(1002.0, m_pDoc->GetValue(0, 1, nTab)); // A2 +m_pDoc->GetFormula(0, 1, nTab, aFormula); +CPPUNIT_ASSERT_EQUAL(OUString("=1000+($Test.$A$1)"), aFormula); + +// Clear everything and start over. +clearSheet(m_pDoc, nTab); +clearSheet(&aClipDoc, nTab); +clearSheet(&aMixDoc, nTab); + +// Scenario 2: Like Scenario 1, but with a range (3 columns) +m_pDoc->InsertTab(nTab, "Test"); + +m_pDoc->SetValue(0, 0, nTab, 1.0); // A1 +m_pDoc->SetValue(0, 1, nTab, 1000.0); // A2 +m_pDoc->SetValue(1, 0, nTab, 1.0); // B1 +m_pDoc->SetValue(1, 1, nTab, 1000.0); // B2 +m_pDoc->SetValue(2, 0, nTab, 1.0); // C1 +m_pDoc->SetValue(2, 1, nTab, 1000.0); // C2 + +// Copy A1:C1 to the clip document. +copyToClip(m_pDoc, ScRange(0, 0, nTab, 2, 0, nTab), &aClipDoc); // A1:C1 + +aDestRange = ScRa
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/kahan.hxx | 16 ++ sc/qa/unit/data/functions/statistical/fods/chisq.test.fods | 16 +- sc/qa/unit/data/functions/statistical/fods/chitest.fods| 16 +- sc/source/core/tool/interpr3.cxx | 80 ++--- 4 files changed, 72 insertions(+), 56 deletions(-) New commits: commit 5545d8f515a2f7af45f0d2ab3ee40dfbde7fa20f Author: dante AuthorDate: Sat May 1 14:32:14 2021 +0200 Commit: Mike Kaganski CommitDate: Sat May 8 09:00:31 2021 +0200 tdf#137679 Use Kahan summation for interpr3.cxx (2/2) Change-Id: I64113449f70d300feace6663c670db3448f43acf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114970 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index 23a29f6ee13f..dffd74d13f0f 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -133,6 +133,15 @@ public: m_fError /= fDivides; } +inline KahanSum operator*(const KahanSum& fTimes) const +{ +KahanSum fSum(m_fSum * fTimes.m_fSum); +fSum += m_fSum * fTimes.m_fError; +fSum += m_fError * fTimes.m_fSum; +fSum += m_fError * fTimes.m_fError; +return fSum; +} + constexpr KahanSum operator*(double fTimes) const { KahanSum fSum(*this); @@ -140,6 +149,13 @@ public: return fSum; } +inline KahanSum operator/(const KahanSum& fDivides) const +{ +KahanSum fSum(m_fSum / fDivides.get()); +fSum += m_fError / fDivides.get(); +return fSum; +} + constexpr KahanSum operator/(double fTimes) const { KahanSum fSum(*this); diff --git a/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods b/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods index 648f8b864679..aaffa4a02a5e 100644 --- a/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods +++ b/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods @@ -3797,11 +3797,11 @@ - - 1.16440189336067E-29 + + 1.16440189336065E-29 - - 1.16440189336067E-29 + + 1.16440189336065E-29 TRUE @@ -3860,11 +3860,11 @@ - - 9.03490480352966E-010 + + 9.03490480352969E-010 - - 9.03490480352966E-10 + + 9.03490480352969E-10 TRUE diff --git a/sc/qa/unit/data/functions/statistical/fods/chitest.fods b/sc/qa/unit/data/functions/statistical/fods/chitest.fods index 67f803af72ee..f72361ae35f8 100644 --- a/sc/qa/unit/data/functions/statistical/fods/chitest.fods +++ b/sc/qa/unit/data/functions/statistical/fods/chitest.fods @@ -3797,11 +3797,11 @@ - - 1.16440189336067E-29 + + 1.16440189336065E-29 - - 1.16440189336067E-29 + + 1.16440189336065E-29 TRUE @@ -3860,11 +3860,11 @@ - - 9.03490480352966E-010 + + 9.03490480352969E-010 - - 9.03490480352966E-10 + + 9.03490480352969E-10 TRUE diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index c339a68dd80f..bc4265be0b67 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -1263,19 +1263,18 @@ static double lcl_GetBinomDistRange(double n, double xs,double xe, //preconditions: 0.0 <= xs < xe <= n; xs,xe,n integral although double { sal_uInt32 i; -double fSum; // skip summands index 0 to xs-1, start sum with index xs sal_uInt32 nXs = static_cast( xs ); for (i = 1; i <= nXs && fFactor > 0.0; i++) fFactor *= (n-i+1)/i * p/q; -fSum = fFactor; // Summand xs +KahanSum fSum = fFactor; // Summand xs sal_uInt32 nXe = static_cast(xe); for (i = nXs+1; i <= nXe && fFactor > 0.0; i++) { fFactor *= (n-i+1)/i * p/q; fSum += fFactor; } -return std::min(fSum,1.0); +return std::min(fSum.get(), 1.0); } void ScInterpreter::ScB() @@ -1433,7 +1432,7 @@ void ScInterpreter::ScCritBinom() fFactor = pow(q,n); if (fFactor > ::std::numeric_limits::min()) { -double fSum = fFactor; +KahanSum fSum = fFactor; sal_uInt32 max = static_cast (n), i; for (i = 0; i < max && fSum < alpha; i++) { @@ -1445,15 +1444,13 @@ void ScInterpreter::ScCritBinom() else { // accumulate BinomDist until accumulated BinomDist reaches alpha -double fSum = 0.0; +KahanSum fSum = 0.0; sal_uInt32 max = static_cast (n), i; for (i = 0; i < max && fSum < alpha; i++) { const double x = GetBetaDistPDF( p, ( i + 1 ), ( n - i + 1 ) )/( n + 1 ); if ( nGlobalError ==
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/typedstrdata.hxx |7 ++-- sc/qa/uitest/autofilter/autofilter.py| 33 +++ sc/qa/uitest/data/autofilter/tdf140968.xlsx |binary sc/source/core/data/column3.cxx |6 ++- sc/source/core/tool/typedstrdata.cxx | 34 +++- sc/source/filter/xml/XMLExportDatabaseRanges.cxx | 39 --- sc/source/filter/xml/xmlfilti.cxx| 21 ++-- sc/source/ui/cctrl/checklistmenu.cxx | 10 + sc/source/ui/inc/checklistmenu.hxx | 14 +++- sc/source/ui/unoobj/datauno.cxx | 11 -- sc/source/ui/view/gridwin.cxx|8 ++-- sc/source/ui/view/gridwin2.cxx |4 +- 12 files changed, 156 insertions(+), 31 deletions(-) New commits: commit d5c2584bf36d21580db677b231c57f99f49aa2cb Author: Balazs Varga AuthorDate: Thu Apr 22 10:23:41 2021 +0200 Commit: László Németh CommitDate: Tue May 4 10:13:27 2021 +0200 Related: tdf#140968 avoid duplicated filter values Group and filter based on the actual cell format, like MSO does, to simplify filtering of values rounded by the cell format (e.g. selecting the single AutoFilter condition "1.0" to filter both 1.01 and 0.99). Followed up of 4fd1333ba4bb4f2311e9098291154772bd310429 (tdf#140968 tdf#140978 XLSX import: fix lost rounded filters) tdf#141916: odf export: Indicating the formatted filter values, by export the XML_DATA_TYPE with XML_TEXT, to avoid bad filtering of formatted filter values. tdf#141775: fix regression of 4fd1333ba4bb4f2311e9098291154772bd310429 (tdf#140968 tdf#140978 XLSX import: fix lost rounded filters) tdf#141915: fix OOXML import of 0.0 filter values of filter conditions by setting it byValue filtering in datauno.cxx. Change-Id: I1c840249ee1ef95aff33a4740b8bf2ebc47f2325 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113314 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/typedstrdata.hxx b/sc/inc/typedstrdata.hxx index 944a13bdad0a..50a7effea87e 100644 --- a/sc/inc/typedstrdata.hxx +++ b/sc/inc/typedstrdata.hxx @@ -24,13 +24,14 @@ public: Header = 4 }; -ScTypedStrData( const OUString& rStr, double nVal = 0.0, -StringType eType = Standard, bool bDate = false ); +ScTypedStrData( const OUString& rStr, double nVal = 0.0, StringType eType = Standard, +bool bDate = false, bool mbIsFormatted = false, bool bDuplicated = false ); bool IsDate() const { return mbIsDate;} const OUString& GetString() const { return maStrValue;} StringType GetStringType() const { return meStrType;} double GetValue() const { return mfValue; } +bool IsDuplicated() const { return mbIsDuplicated; } struct LessCaseSensitive { @@ -59,6 +60,8 @@ private: double mfValue; StringType meStrType; bool mbIsDate; +bool mbIsFormatted; // true if the cell value is a formatted filter value +bool mbIsDuplicated; // true if the cell has a formatted filter value and has at least one duplicate formatted value. }; class FindTypedStrData diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index ccfd23a9d295..7b1c043c67e2 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -333,5 +333,38 @@ class AutofilterTest(UITestCase): xOkBtn = xFloatWindow.getChild("cancel") xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_doc() + +def test_tdf140968(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(4, len(xTreeList.getChildren())) +self.assertEqual("0.000", get_state_as_dict(xTreeList.getChild('0'))['Text']) +self.assertEqual("0.046", get_state_as_dict(xTreeList.getChild('1'))['Text']) +self.assertEqual("0.365", get_state_as_dict(xTreeList.getChild('2'))['Text']) +self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('3'))['Text']) + +xFirstEntry = xTreeList.getChild("0") +xFirstEntry.executeAction("CLICK", tuple()) +xFirstEntry = xTreeList.getChild("1") +xFirstEntry.executeAction("CLICK", tuple()) + +xOkBtn = xFloatWindow.getChild("ok") +xOkBtn.executeAction("CLICK", tuple()) + +self.assertFalse(is_row_hidden(doc, 0)) +self.as
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/dbdata.hxx |3 + sc/qa/uitest/autofilter/tdf48025.py | 72 sc/source/core/tool/dbdata.cxx | 24 +++- 3 files changed, 96 insertions(+), 3 deletions(-) New commits: commit edb64cc363e782470870089041c48993d7c34de5 Author: Tünde Tóth AuthorDate: Thu Apr 22 14:19:41 2021 +0200 Commit: László Németh CommitDate: Thu Apr 29 12:58:52 2021 +0200 tdf#48025 sc: fix broken filter criteria when deleting columns The autofilter criteria weren't remain with the filtered column when we deleted a column left of the filtered column or the filtered column itself. Change-Id: I0eb103ea5569d82eac4d81bce1b31b0c3bbcbf41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114483 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index 39ae2835e0f8..c1e714fc3e9f 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -124,7 +124,8 @@ public: voidGetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const; SC_DLLPUBLIC void GetArea(ScRange& rRange) const; voidSetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); -voidMoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); +voidMoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SCCOL nUpdateCol = -1); voidSetByRow(bool bByR) { bByRow = bByR; } boolHasHeader() const { return bHasHeader; } voidSetHeader(bool bHasH) { bHasHeader = bHasH; } diff --git a/sc/qa/uitest/autofilter/tdf48025.py b/sc/qa/uitest/autofilter/tdf48025.py new file mode 100644 index ..c5d5c711da5f --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf48025.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 48025 - EDITING AUTOFILTER: Autofilter settings stay with the column number when deleting columns + +class tdf48025(UITestCase): +def test_tdf48025_deleted_columns(self): +self.ui_test.create_doc_in_start_center("calc") +document = self.ui_test.get_component() +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +enter_text_to_cell(gridwin, "A1", "A") +enter_text_to_cell(gridwin, "A2", "1") +enter_text_to_cell(gridwin, "A3", "2") +enter_text_to_cell(gridwin, "A4", "3") + +enter_text_to_cell(gridwin, "B1", "B") +enter_text_to_cell(gridwin, "B2", "4") +enter_text_to_cell(gridwin, "B3", "5") +enter_text_to_cell(gridwin, "B4", "6") + +enter_text_to_cell(gridwin, "C1", "C") +enter_text_to_cell(gridwin, "C2", "7") +enter_text_to_cell(gridwin, "C3", "8") +enter_text_to_cell(gridwin, "C4", "9") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +xEntry = xList.getChild("1") +xEntry.executeAction("CLICK", tuple()) + +xOkButton = xFloatWindow.getChild("ok") +xOkButton.executeAction("CLICK", tuple()) + +gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + +self.xUITest.executeCommand(".uno:DeleteColumns") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(3, len(xList.getChildren())) +xCloseBtn = xFloatWindow.getChild("cancel") +xCloseBtn.executeAction("CLICK", tuple()) + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(2, len(xList.getChildren())) +xCloseBtn = xFloatWindow.getChild("cancel") +xCloseBtn.
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/kahan.hxx | 14 sc/qa/unit/data/functions/financial/fods/vdb.fods | 40 ++-- sc/source/core/tool/interpr2.cxx | 68 +- 3 files changed, 64 insertions(+), 58 deletions(-) New commits: commit bd944fe3812fd9fa5a90e98cdac4a77f1a4e6865 Author: dante AuthorDate: Tue Apr 27 13:20:59 2021 +0200 Commit: Mike Kaganski CommitDate: Thu Apr 29 07:47:22 2021 +0200 tdf#137679 Use Kahan summation for interpr2.cxx The changes in the text files are in the latest decimals. Those should be more accurate now. Change-Id: I3814e1939f71debd5ddde9408a025af7a0a2cac5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114737 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index 968da16594e8..ffeeab0867df 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -79,6 +79,20 @@ public: inline void operator-=(double fSum) { add(-fSum); } +inline KahanSum operator+(double fSum) const +{ +KahanSum fNSum(*this); +fNSum.add(fSum); +return fNSum; +} + +inline KahanSum operator-(double fSum) const +{ +KahanSum fNSum(*this); +fNSum.add(-fSum); +return fNSum; +} + /** * In some parts of the code of interpr_.cxx this may be used for * product instead of sum. This operator shall be used for that task. diff --git a/sc/qa/unit/data/functions/financial/fods/vdb.fods b/sc/qa/unit/data/functions/financial/fods/vdb.fods index aee00996327e..38ace9085ec7 100644 --- a/sc/qa/unit/data/functions/financial/fods/vdb.fods +++ b/sc/qa/unit/data/functions/financial/fods/vdb.fods @@ -2535,11 +2535,11 @@ - + $971.52 - - 971.5189 + + 971.5204 TRUE @@ -2948,11 +2948,11 @@ - - 485.7595 + + $485.76 - - 485.7595 + + 485.7602 TRUE @@ -3118,11 +3118,11 @@ - - 971.5189 + + $971.52 - - 971.5189 + + 971.5204 TRUE @@ -3536,10 +3536,10 @@ - - 242.8797 + + $242.88 - + 242.88 @@ -3551,10 +3551,10 @@ - - 485.7595 + + $485.76 - + 485.76 @@ -3566,10 +3566,10 @@ - - 728.6392 + + $728.64 - + 728.64 diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 62bdbc2021a8..cac57fe88514 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -1308,7 +1308,7 @@ void ScInterpreter::ScNPV() if ( !MustHaveParamCountMin( nParamCount, 2) ) return; -double fVal = 0.0; +KahanSum fVal = 0.0; // We turn the stack upside down! ReverseStack( nParamCount); if (nGlobalError == FormulaError::NONE) @@ -1324,7 +1324,7 @@ void ScInterpreter::ScNPV() { case svDouble : { -fVal += (GetDouble() / pow(1.0 + fRate, fCount)); +fVal += GetDouble() / pow(1.0 + fRate, fCount); fCount++; } break; @@ -1336,7 +1336,7 @@ void ScInterpreter::ScNPV() if (!aCell.hasEmptyValue() && aCell.hasNumeric()) { double fCellVal = GetCellValue(aAdr, aCell); -fVal += (fCellVal / pow(1.0 + fRate, fCount)); +fVal += fCellVal / pow(1.0 + fRate, fCount); fCount++; } } @@ -1350,7 +1350,7 @@ void ScInterpreter::ScNPV() ScHorizontalValueIterator aValIter( mrDoc, aRange ); while ((nErr == FormulaError::NONE) && aValIter.GetNext(fCellVal, nErr)) { -fVal += (fCellVal / pow(1.0 + fRate, fCount)); +fVal += fCellVal / pow(1.0 + fRate, fCount); fCount++; } if ( nErr != FormulaError::NONE ) @@ -1384,7 +1384,7 @@ void ScInterpreter::ScNPV() return; } fx = pMat->GetDouble(j,k); -fVal += (fx / pow(1.0 + fRate, fCount)); +fVal += fx / pow(1.0 + fRate, fCount); fCount++; } } @@ -1396,7 +1396,7 @@ void ScInterpreter:
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source solenv/clang-format
sc/inc/columnspanset.hxx|2 sc/inc/matrixoperators.hxx |7 - sc/inc/scmatrix.hxx | 21 +++- sc/qa/uitest/calc_tests6/tdf118638.py |4 sc/source/core/data/columnspanset.cxx | 21 sc/source/core/tool/interpr5.cxx|4 sc/source/core/tool/interpr6.cxx| 160 sc/source/core/tool/matrixoperators.cxx | 19 --- sc/source/core/tool/scmatrix.cxx| 48 +++-- solenv/clang-format/excludelist |1 10 files changed, 86 insertions(+), 201 deletions(-) New commits: commit fd4df675dfe1012448285134082f61a0c03a7d15 Author: dante AuthorDate: Sun Apr 25 12:20:58 2021 +0200 Commit: Mike Kaganski CommitDate: Wed Apr 28 16:31:45 2021 +0200 tdf#137679 Use Kahan summation for scmatrix operations May also want implement Kahan sum in there: sc/source/core/tool/arraysumSSE2.cxx sc/source/core/inc/arraysumfunctor.hxx Under some conditions the sum of a pointer type vector may be perforemed by arraysumfunctor on NumericCellAccumulator. arraysumSSE2 implements part of it. This code has been left unmodified. Why the test has been modified: The error was: 238.890001 != 238.89 | 17 th digit IEEE 754 double-precision has 53 log10(2) ≈ 15.955 digits. So it's just noise. Change-Id: I6f84826bf3875be4f444f5eb61854bc1f95769bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114627 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx index 570f99c10fb8..d889a4da67e4 100644 --- a/sc/inc/columnspanset.hxx +++ b/sc/inc/columnspanset.hxx @@ -80,7 +80,6 @@ public: virtual ~ColumnAction() = 0; virtual void startColumn(ScColumn* pCol) = 0; virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal) = 0; -virtual void executeSum(SCROW, SCROW, bool, double& ) { return; } ; }; ColumnSpanSet(); @@ -162,7 +161,6 @@ public: RangeColumnSpanSet( const ScRange& spanRange ) : range( spanRange ) {} void executeColumnAction(ScDocument& rDoc, sc::ColumnSpanSet::ColumnAction& ac) const; -void executeColumnAction(ScDocument& rDoc, sc::ColumnSpanSet::ColumnAction& ac, double& fMem) const; private: ScRange range; }; diff --git a/sc/inc/matrixoperators.hxx b/sc/inc/matrixoperators.hxx index 540a38e93370..36fa1cabe3d6 100644 --- a/sc/inc/matrixoperators.hxx +++ b/sc/inc/matrixoperators.hxx @@ -11,6 +11,7 @@ #include +#include "math.hxx" namespace sc::op { @@ -35,19 +36,19 @@ using Op = Op_>; struct Sum { static const double InitVal; -void operator()(double& rAccum, double fVal) const; +void operator()(KahanSum& rAccum, double fVal) const; }; struct SumSquare { static const double InitVal; -void operator()(double& rAccum, double fVal) const; +void operator()(KahanSum& rAccum, double fVal) const; }; struct Product { static const double InitVal; -void operator()(double& rAccum, double fVal) const; +void operator()(KahanSum& rAccum, double fVal) const; }; } diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 60587b23a5d1..2a1d9342499f 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -150,6 +150,21 @@ public: mfFirst(fFirst), mfRest(fRest), mnCount(nCount) {} }; +/** + * Version of IterateResult for using Kahan sum. + */ +struct KahanIterateResult +{ +KahanSum maAccumulator; +size_t mnCount; + +KahanIterateResult(double fAccumulator, size_t nCount) +: maAccumulator(fAccumulator), mnCount(nCount) {} + +double get() { return maAccumulator.get(); } +}; + + /** Checks nC or nR for zero and uses GetElementsMax() whether a matrix of the size of nC*nR could be allocated. A zero size (both nC and nR zero) matrix is allowed for later resize. @@ -361,9 +376,9 @@ public: double Or() const ;// logical OR of all matrix values, or NAN double Xor() const ; // logical XOR of all matrix values, or NAN -IterateResult Sum( bool bTextAsZero, bool bIgnoreErrorValues = false ) const ; -IterateResult SumSquare( bool bTextAsZero, bool bIgnoreErrorValues = false ) const ; -IterateResult Product( bool bTextAsZero, bool bIgnoreErrorValues = false ) const ; +KahanIterateResult Sum( bool bTextAsZero, bool bIgnoreErrorValues = false ) const ; +KahanIterateResult SumSquare( bool bTextAsZero, bool bIgnoreErrorValues = false ) const ; +KahanIterateResult Product( bool bTextAsZero, bool bIgnoreErrorValues = false ) const ; size_t Count(bool bCountStrings, bool bCountErrors, bool bIgnoreEmptyStrings = false) const ; size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) co
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
0 files changed New commits: commit 9e0c99760a4711a58524ec0d12e7038b2e119c5e Author: Andrea Gelmini AuthorDate: Fri Apr 23 22:26:18 2021 +0200 Commit: Andrea Gelmini CommitDate: Sat Apr 24 07:59:25 2021 +0200 Removed executable bits on source files Change-Id: Ic52623ac8ca6e0758578b7ae57332f0e9c184b5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114573 Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx old mode 100755 new mode 100644 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx old mode 100755 new mode 100644 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx old mode 100755 new mode 100644 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx old mode 100755 new mode 100644 diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx old mode 100755 new mode 100644 diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx old mode 100755 new mode 100644 diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx old mode 100755 new mode 100644 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx old mode 100755 new mode 100644 diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx old mode 100755 new mode 100644 diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx old mode 100755 new mode 100644 diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx old mode 100755 new mode 100644 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/clipparam.hxx| 10 sc/inc/document.hxx | 12 sc/inc/table.hxx| 29 sc/qa/unit/ucalc.cxx| 5361 +++- sc/qa/unit/ucalc.hxx| 122 sc/qa/unit/uicalc/uicalc.cxx| 45 sc/source/core/data/clipparam.cxx | 50 sc/source/core/data/document.cxx| 124 sc/source/core/data/formulacell.cxx | 22 sc/source/core/data/table2.cxx | 258 + sc/source/ui/inc/viewfunc.hxx |7 sc/source/ui/view/viewfun3.cxx | 30 12 files changed, 5919 insertions(+), 151 deletions(-) New commits: commit 6491c205acb3c166d93ef6a41199d344e21d98ac Author: scito AuthorDate: Wed Apr 21 07:36:43 2021 +0200 Commit: Jan Holesovsky CommitDate: Thu Apr 22 15:11:17 2021 +0200 tdf#107348 tdf#45958 tdf#141215 tdf#141683 fix filtered/transpose paste Row filtering, Special Paste transposing and multi range selections had various issues. Since the same methods are used in different code paths, I made a unified fix for these issues. Moreover, Special Paste dialog allows the combination of options. There are about 50 test cases for these various combinations of filtering, selection, transposing and pasting options. The following cases are supported and checked in test combinations: * Transposing * Filtering * Multi range column and row selection * All cell types: number, string, formula, rich text, empty * Notes * Formatting patterns (e.g. cell backgrounds and borders) * Empty cell skipping * Special Paste as link * Merged cells * Formula references: * Relative and absolute references * References to rows before and after filtered row * References to filtered row * Double references (e.g. A1:A3) Notably the following cases are fixed and tested: * Transposing of filtered data (tdf#107348) * Copy/Paste of filtered multi range selections (tdf#45958) * Transposing of filtered multi range selections (tdf#107348, tdf#45958) * Notes at different position (tdf#141215 ^) * Transposed multi range selection pasted as link (tdf#141683 ^) ^ = discovered during tests Due to the unit tests, I refactored some code. Mainly, I extracted methods to improve the readability and to avoid code duplication. Change-Id: Id17d3b4deee29ac5fc7c11e17244da0d4054 Change-Id: I43cf630890e0081e55fd04cf2f8e5afdb6d9bebe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114450 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Jan Holesovsky diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx old mode 100644 new mode 100755 index 7a4513ffb502..55f37fe1d89e --- a/sc/inc/clipparam.hxx +++ b/sc/inc/clipparam.hxx @@ -21,6 +21,7 @@ #include "rangelst.hxx" #include "charthelper.hxx" +#include "document.hxx" /** * This struct stores general clipboard parameters associated with a @@ -52,14 +53,19 @@ struct SC_DLLPUBLIC ScClipParam * Same as the above method, but returns the row size of the compressed * range. */ -SCROW getPasteRowSize(); +SCROW getPasteRowSize(const ScDocument& rSrcDoc, bool bIncludeFiltered); /** * Return a single range that encompasses all individual ranges. */ ScRange getWholeRange() const; -void transpose(); +/** + * Transpose the clip parameters. + * Filtered rows are removed from parameters. + */ +void transpose(const ScDocument& rSrcDoc, bool bIncludeFiltered, + bool bIsMultiRangeRowFilteredTranspose); sal_uInt32 getSourceDocID() const { return mnSourceDocID; } void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; } diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx old mode 100644 new mode 100755 index 96d7ec940059..f90e74e9c030 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1605,9 +1605,12 @@ public: void CopyBlockFromClip( sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark, SCCOL nDx, SCROW nDy ); -void CopyNonFilteredFromClip( sc::CopyFromClipContext& rCxt, SCCOL nCol1, - SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const ScMarkData& rMark, SCCOL nDx, SCROW & rClipStartRow ); +/** + * @return the number of non-filtered rows. + */ +SCROW CopyNonFilteredFromClip(sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark, SCCOL nDx, + SCROW& rClipStartRow, SCROW nClipEndRow); void StartListeningFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, @@ -1642,7 +1645,8 @@ pub
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/column.hxx | 18 sc/inc/document.hxx|5 +- sc/inc/table.hxx |7 +-- sc/qa/uitest/sort/tdf126678.py | 75 + sc/source/core/data/column2.cxx| 22 -- sc/source/core/data/document.cxx |7 +-- sc/source/core/data/table1.cxx | 24 +++ sc/source/ui/docshell/dbdocfun.cxx |7 +-- 8 files changed, 135 insertions(+), 30 deletions(-) New commits: commit 774a61afa9fc281290e7bfad4e28c05978b82d73 Author: Andreas Heinisch AuthorDate: Fri Feb 19 16:55:31 2021 +0100 Commit: Andreas Heinisch CommitDate: Wed Apr 14 08:46:03 2021 +0200 tdf#126678 - Consider "Include formats" option during sort Change-Id: Ib972ad6c5042bde6b0c79bf10bace6baab1e935e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111234 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 4f88f556e9eb..56791cfd5f61 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -218,17 +218,19 @@ public: // data only: boolIsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; -boolHasDataAt(SCROW nRow, bool bConsiderCellNotes=false, - bool bConsiderCellDrawObjects=false) const; -boolHasDataAt(sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow, bool bConsiderCellNotes=false, - bool bConsiderCellDrawObjects=false) const; -boolHasDataAt(sc::ColumnBlockPosition& rBlockPos, SCROW nRow, bool bConsiderCellNotes=false, - bool bConsiderCellDrawObjects=false); +boolHasDataAt(SCROW nRow, bool bConsiderCellNotes = false, + bool bConsiderCellDrawObjects = false, bool bConsiderCellFormats = false) const; +boolHasDataAt(sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow, + bool bConsiderCellNotes = false, bool bConsiderCellDrawObjects = false, + bool bConsiderCellFormats = false) const; +boolHasDataAt(sc::ColumnBlockPosition& rBlockPos, SCROW nRow, bool bConsiderCellNotes = false, + bool bConsiderCellDrawObjects = false, bool bConsiderCellFormats = false); boolHasVisibleDataAt(SCROW nRow) const; SCROW GetFirstDataPos() const; SCROW GetLastDataPos() const; -SCROW GetLastDataPos( SCROW nLastRow, bool bConsiderCellNotes=false, -bool bConsiderCellDrawObjects=false ) const; +SCROW GetLastDataPos(SCROW nLastRow, bool bConsiderCellNotes = false, + bool bConsiderCellDrawObjects = false, + bool bConsiderCellFormats = false) const; boolGetPrevDataPos(SCROW& rRow) const; boolGetNextDataPos(SCROW& rRow) const; boolTrimEmptyBlocks(SCROW& rRowStart, SCROW& rRowEnd) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f9582dc4837b..96d7ec940059 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1407,6 +1407,8 @@ public: If TRUE, consider the presence of cell notes besides data. @param bConsiderCellDrawObjects If TRUE, consider the presence of draw objects anchored to the cell. +@param bConsiderCellFormats +If TRUE, consider the presence of cell formats. @returns true if there is any data, false if not. */ @@ -1415,7 +1417,8 @@ public: SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly, bool bStickyTopRow = false, bool bStickyLeftCol = false, bool bConsiderCellNotes = false, - bool bConsiderCellDrawObjects = false ) const; + bool bConsiderCellDrawObjects = false, + bool bConsiderCellFormats = false ) const; /** * Return the last non-empty row position in given columns that's no diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index ddc859715b8e..211e317cb06d 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -589,10 +589,11 @@ public: boolShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly, bool bStickyTopRow, bool bStickyLeftCol, bool bConsiderCellNotes, - bool bConsiderCellDrawObjects ) const; + bool bCons
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |3 ++- sc/qa/uitest/range_name/create_range_name.py |3 ++- sc/source/core/data/documen3.cxx | 13 ++--- sc/source/ui/app/inputhdl.cxx|9 - sc/source/ui/app/inputwin.cxx|7 ++- sc/source/ui/inc/inputwin.hxx|2 ++ 6 files changed, 26 insertions(+), 11 deletions(-) New commits: commit 65cba409936d133aa05f9934db28bd2555a38676 Author: Eike Rathke AuthorDate: Tue Mar 30 01:50:38 2021 +0200 Commit: Eike Rathke CommitDate: Tue Mar 30 14:02:12 2021 +0200 Related: tdf#137577 Display (sheetname) with sheet-local names in Name Box ... if current cell selection matches a sheet-local name, so it can be differentiated from an identically named global name. Which is already the case when listing and picking a name from the list. Made it necessary to adapt an UI test checking for Name Box content. Change-Id: Ia90b8961c3ae213cf7bb53f3b610a65805bba6b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113330 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 72f84cd9ba9b..0d3078327390 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -820,7 +820,8 @@ public: void RefreshDirtyTableColumnNames(); SC_DLLPUBLIC sc::ExternalDataMapper& GetExternalDataMapper(); -SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString* pName ) const; +SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString* pName, + bool* pSheetLocal = nullptr ) const; SC_DLLPUBLIC bool HasPivotTable() const; SC_DLLPUBLIC ScDPCollection* GetDPCollection(); diff --git a/sc/qa/uitest/range_name/create_range_name.py b/sc/qa/uitest/range_name/create_range_name.py index e4fab4e4329d..989532bf5643 100644 --- a/sc/qa/uitest/range_name/create_range_name.py +++ b/sc/qa/uitest/range_name/create_range_name.py @@ -114,7 +114,8 @@ class CreateRangeNameTest(UITestCase): # tdf#67007: Without the fix in place, this test would have failed with # AssertionError: 'localRangeName' != 'A1' -self.assertEqual('localRangeName', get_state_as_dict(xPosWindow)['Text']) +# Additionally, newly check a sheet-local scoped name has " (sheetname)" appended. +self.assertEqual('localRangeName (Sheet1)', get_state_as_dict(xPosWindow)['Text']) gridwin = calcDoc.getChild("grid_window") enter_text_to_cell(gridwin, "A1", "1") diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 798fa467948b..6f6a9a6f27d6 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -234,7 +234,7 @@ bool ScDocument::InsertNewRangeName( SCTAB nTab, const OUString& rName, const Sc return pLocalNames->insert(pName); } -const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString* pName ) const +const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString* pName, bool* pSheetLocal ) const { const ScRangeData* pData = nullptr; if (rBlock.aStart.Tab() == rBlock.aEnd.Tab()) @@ -247,6 +247,8 @@ const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString* { if (pName) *pName = pData->GetName(); +if (pSheetLocal) +*pSheetLocal = true; return pData; } } @@ -254,8 +256,13 @@ const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString* if ( pRangeName ) { pData = pRangeName->findByRange( rBlock ); -if (pData && pName) -*pName = pData->GetName(); +if (pData) +{ +if (pName) +*pName = pData->GetName(); +if (pSheetLocal) +*pSheetLocal = false; +} } return pData; } diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 540d342728ac..109035c62a82 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -4103,13 +4103,14 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, if ( pInputWin || comphelper::LibreOfficeKit::isActive()) // Named range input { OUString aPosStr; +bool bSheetLocal = false; const ScAddress::Details aAddrDetails( rDoc, aCursorPos ); // Is the range a name? //! Find by Timer? if ( pActiveViewSh ) pActiveViewSh->GetViewData().GetDocument(). -GetRangeAtBlock( ScRange( rSPos, rEPos ),
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx|1 sc/inc/table.hxx |1 sc/qa/uitest/autofilter/autofilter.py | 31 + sc/qa/uitest/data/autofilter/tdf140462.ods |binary sc/source/core/data/documen3.cxx | 11 ++ sc/source/core/data/table3.cxx | 24 +- sc/source/filter/xml/xmldrani.cxx |2 + 7 files changed, 65 insertions(+), 5 deletions(-) New commits: commit f37f159f2e0c7abe45ac7a3eec447f1234ad1662 Author: Balazs Varga AuthorDate: Wed Feb 17 15:20:34 2021 +0100 Commit: László Németh CommitDate: Mon Mar 1 16:39:10 2021 +0100 tdf#140462 sc ODF import: fix empty autofilter columns (followed a date type autofilter column) by setting QueryType to ByDate at ODF import. Change-Id: Ie78cb15885dfb1e40c9e8ac993ff79b19fe17993 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111070 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index ae66e0a0fb8e..111956304334 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2063,6 +2063,7 @@ public: void Reorder( const sc::ReorderParam& rParam ); +void PrepareQuery( SCTAB nTab, ScQueryParam& rQueryParam ); SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub ); SC_DLLPUBLIC bool CreateQueryParam( const ScRange& rRange, ScQueryParam& rQueryParam ); void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rStr); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index fed4d4b12388..9e8e6233295a 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -949,6 +949,7 @@ public: bool* pbTestEqualCondition = nullptr, const ScInterpreterContext* pContext = nullptr, sc::TableColumnBlockPositionSet* pBlockPos = nullptr ); voidTopTenQuery( ScQueryParam& ); +voidPrepareQuery( ScQueryParam& rQueryParam ); SCSIZE Query(const ScQueryParam& rQueryParam, bool bKeepSub); boolCreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 1eedfe4b22a7..ca1871ee933c 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -277,5 +277,36 @@ class AutofilterTest(UITestCase): xOkBtn = xFloatWindow.getChild("cancel") xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_doc() + +def test_tdf140462(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf140462.ods")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_tree_box") +self.assertEqual(3, len(xTreeList.getChildren())) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(3, len(xTreeList.getChildren())) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(4, len(xTreeList.getChildren())) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf140462.ods b/sc/qa/uitest/data/autofilter/tdf140462.ods new file mode 100644 index ..8fe7ed8a9705 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf140462.ods differ diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index b7ece0dfbc0a..f7dfad201bd2 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1442,6 +1442,17 @@ void ScDocument::Reorder( const sc::ReorderParam& rParam ) EnableIdle(bOldEnableIdle); } +void ScDocument::PrepareQuery( SCTAB nTab, ScQueryParam& rQueryParam ) +{ +if( ValidTab(nTab) && nTab < static_cast(maTabs.size()) && maTabs[nTab] ) +
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx|5 - sc/inc/table.hxx |7 + sc/qa/unit/bugfix-test.cxx | 19 sc/qa/unit/data/ods/tdf104502_hiddenColsCountedInPageCount.ods |binary sc/source/core/data/documen2.cxx |4 sc/source/core/data/document.cxx |4 sc/source/core/data/table1.cxx | 47 +++--- sc/source/ui/unoobj/cursuno.cxx|2 8 files changed, 66 insertions(+), 22 deletions(-) New commits: commit 2bf3e0d00e3bccb5b250642ee0d3fdbe6cae8ecc Author: Attila Szűcs AuthorDate: Wed Jan 27 17:43:43 2021 +0100 Commit: László Németh CommitDate: Tue Feb 9 16:37:51 2021 +0100 tdf#104502 sc: skip hidden columns at printing pages Page calculation counted the hidden columns, resulted printing blank pages by accident. Extend GetPrintArea() and GetTableArea() to count pages without the hidden columns, too. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I4817965a675e059cdc8f81ca3bb6e128af874f2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110028 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 79091e89504c..6d012c9b01ec 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1456,9 +1456,10 @@ public: boolGetDataAreaSubrange(ScRange& rRange) const; SC_DLLPUBLIC bool GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; -SC_DLLPUBLIC bool GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; +SC_DLLPUBLIC bool GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, + bool bCalcHiddens = false) const; SC_DLLPUBLIC bool GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, - bool bNotes = true ) const; + bool bNotes = true, bool bCalcHiddens = false) const; SC_DLLPUBLIC bool GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, SCCOL& rEndCol ) const; SC_DLLPUBLIC bool GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 309d49d4f140..fed4d4b12388 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -198,6 +198,8 @@ private: mutable SCCOL nTableAreaX; mutable SCROW nTableAreaY; +mutable SCCOL nTableAreaVisibleX; +mutable SCROW nTableAreaVisibleY; SCTAB nTab; ScDocument& rDocument; @@ -232,6 +234,7 @@ private: boolbLoadingRTL:1; boolbPageSizeValid:1; mutable boolbTableAreaValid:1; +mutable boolbTableAreaVisibleValid:1; boolbVisible:1; boolbStreamValid:1; boolbPendingRowHeights:1; @@ -567,8 +570,8 @@ public: voidInvalidatePageBreaks(); boolGetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = empty -boolGetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const; -boolGetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const; +boolGetTableArea( SCCOL& rEndCol, SCROW& rEndRow, bool bCalcHiddens = false) const; +boolGetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bCalcHiddens = false) const; boolGetPrintAreaHor( SCROW nStartRow, SCROW nEndRow, SCCOL& rEndCol ) const; boolGetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol, diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx index 874069ade2f5..384591fe1a10 100644 --- a/sc/qa/unit/bugfix-test.cxx +++ b/sc/qa/unit/bugfix-test.cxx @@ -59,6 +59,7 @@ public: void testTdf128951(); void testTdf129789(); void testTdf130725(); +void testTdf104502_hiddenColsCountedInPageCount(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testTdf137576_Measureline); @@ -81,6 +82,7 @@ public: CPPUNIT_TEST(testTdf128951); CPPUNIT_TEST(testTdf129789); CPPUNIT_TEST(testTdf130725); +CPPUNIT_TEST(testTdf104502_hiddenColsCountedInPageCount); CPPUNIT_TEST_SUITE_END(); private: @@ -721,6 +723,23 @@ void ScFiltersTest::testTdf130725() 0.0042, xCell->getValue()); // strict equality } +void ScFiltersTest::testTdf104502_hiddenColsCountedInPageCount() +{ +ScDocShellRef xShell = loadDoc(u"tdf104502_hiddenColsCountedInPageCount.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +ScDocument& rDoc = xShell->GetDocument(); + +//Check that hidden columns are not calculated into Print Area +SCC
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |3 sc/inc/drwlayer.hxx | 14 + sc/inc/table.hxx|4 sc/qa/unit/data/ods/tdf137081_RTL_page_anchored.ods |binary sc/qa/unit/data/ods/tdf137082_LTR_arrow_image.ods |binary sc/qa/unit/data/ods/tdf137082_RTL_cell_anchored.ods |binary sc/qa/unit/scshapetest.cxx | 155 +++ sc/source/core/data/documen9.cxx|4 sc/source/core/data/document.cxx| 14 - sc/source/core/data/drwlayer.cxx| 162 +--- sc/source/core/data/table2.cxx |6 sc/source/filter/xml/xmlexprt.cxx | 78 ++--- sc/source/ui/docshell/docfunc.cxx |2 sc/source/ui/undo/undotab.cxx |2 14 files changed, 375 insertions(+), 69 deletions(-) New commits: commit 65129e0bc5abfe7afc612eb46f1434e627265a7d Author: Regina Henschel AuthorDate: Tue Jan 26 14:28:40 2021 +0100 Commit: Regina Henschel CommitDate: Tue Feb 2 22:06:18 2021 +0100 tdf#137081, tdf137082 fixes shape handling in RTL sheets The patch introduces an enum ScObjectHandling as parameter of ScDrawLayer::SetPageSize to distinguish page size changes from show or hide col/row from changes because of sheet flip for RTL. RTL is now handled this way: On save/reload objects are not mirrored but only shifted between positive and negative part of draw page. When a user flips sheet to RTL or back, the objects are mirrored. The 'noRotate' anchor is set to this meaning: maShapeRect contains the logic rectangle of the object at time the anchor was created. It is used to detect position relevant object changes in ScDrawView::Notify(). maStart contains the address of that cell, which is parent element of the object in xml. The logic rectangle need not be in that cell. Handling of DetectiveArrow and CellNote is not changed. Validation circles were not drawn, when switching to RTL mode (no bug report). That is fixed. SetVisualCellAnchored handles 'noRotate' anchor. That anchor is not visible on screen. I have changed the misleading name to SetNonRotatedAnchor. Change-Id: I3dd2d3e37c138c8418369c760293a1f19dddb753 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109959 Reviewed-by: Regina Henschel Tested-by: Regina Henschel diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index a8bfba521437..79091e89504c 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -53,6 +53,7 @@ #include #include "markdata.hxx" +#include "drwlayer.hxx" namespace com::sun::star::chart2 { class XChartDocument; } @@ -963,7 +964,7 @@ public: boolIsStreamValidLocked() const { return mbStreamValidLocked; } boolIsPendingRowHeights( SCTAB nTab ) const; voidSetPendingRowHeights( SCTAB nTab, bool bSet ); -SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, bool bRTL ); +SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, bool bRTL, ScObjectHandling eObjectHandling = ScObjectHandling::RecalcPosMode); SC_DLLPUBLIC bool IsLayoutRTL( SCTAB nTab ) const; SC_DLLPUBLIC bool IsNegativePage( SCTAB nTab ) const; SC_DLLPUBLIC void SetScenario( SCTAB nTab, bool bFlag ); diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index 030fd3855ec8..008e56f8b8c6 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -86,6 +86,14 @@ public: virtual void Redo() override; }; +// for ScDrawLayer::SetPageSize +enum class ScObjectHandling +{ +RecalcPosMode, // used for row height or col width changes +MoveRTLMode, // used for switch to RTL during import of right-to-left sheet +MirrorRTLMode // used for switch between RTL and LTR by .uno:SheetRightToLeft +}; + class SC_DLLPUBLIC ScDrawLayer final : public FmFormModel { private: @@ -150,10 +158,12 @@ public: SCTAB nSourceTab, const tools::Rectangle& rSourceRange, const ScAddress& rDestPos, const tools::Rectangle& rDestRange ); -voidSetPageSize( sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos ); +voidSetPageSize(sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos, +const ScObjectHandling eObjectHandling = ScObjectHandling::RecalcPosMode); // mirror or move between positive and negative positions for RTL voidMirrorRTL( SdrObject* pObj ); +voidMoveRTL(SdrObject* pObj); static void MirrorRectRTL( tools::Rectangle& rRect ); // for bounding rectangles etc. /** Returns the rectangle for the pa
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/document.hxx |2 +- sc/inc/table.hxx |2 +- sc/qa/unit/subsequent_export-test.cxx | 12 ++-- sc/source/core/data/documen3.cxx |2 +- sc/source/core/data/table5.cxx|2 +- sc/source/filter/xcl97/xcl97rec.cxx |2 +- sc/source/filter/xml/xmlexprt.cxx |2 +- sc/source/ui/docshell/docfunc.cxx |4 ++-- sc/source/ui/vba/vbaworksheet.cxx | 12 +++- sc/source/ui/view/gridwin.cxx |2 +- sc/source/ui/view/select.cxx |2 +- sc/source/ui/view/tabview2.cxx| 10 +- sc/source/ui/view/tabview3.cxx|2 +- sc/source/ui/view/tabvwsh3.cxx|4 ++-- 14 files changed, 31 insertions(+), 29 deletions(-) New commits: commit 85b400482dee5c9da2cf83a755ec37ab149b5b20 Author: Mike Kaganski AuthorDate: Wed Jan 6 15:02:17 2021 +0300 Commit: Mike Kaganski CommitDate: Thu Jan 7 08:55:55 2021 +0100 ScTable::GetProtection and ScDocument::GetTabProtection can be const Change-Id: Ic30a3fe10ae6206e876a05bed5dc189a9516b452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108851 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 1dd00f732cbf..e7ebb3653138 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -900,7 +900,7 @@ public: SC_DLLPUBLIC bool IsDocProtected() const; bool IsDocEditable() const; SC_DLLPUBLIC bool IsTabProtected( SCTAB nTab ) const; -SC_DLLPUBLICScTableProtection* GetTabProtection( SCTAB nTab ) const; +SC_DLLPUBLIC const ScTableProtection* GetTabProtection(SCTAB nTab) const; SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect); void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 9edf642f6f46..1962290cb862 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -381,7 +381,7 @@ public: boolIsProtected() const; voidSetProtection(const ScTableProtection* pProtect); -ScTableProtection* GetProtection(); +const ScTableProtection* GetProtection() const; voidGetUnprotectedCells( ScRangeList& rRangeList ) const; bool IsEditActionAllowed( sc::ColRowEditAction eAction, SCCOLROW nStart, SCCOLROW nEnd ) const; diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 8f471b175148..1f8b648d81c6 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -770,7 +770,7 @@ void ScExportTest::testProtectionKeyODS_UTF16LErtlSHA1() ScDocument& rDoc = xShell->GetDocument(); ScDocProtection *const pDocProt(rDoc.GetDocProtection()); CPPUNIT_ASSERT(pDocProt->verifyPassword(password)); -ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); +const ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); CPPUNIT_ASSERT(pTabProt->verifyPassword(password)); // we can't assume that the user entered the password; check that we @@ -793,7 +793,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA1() ScDocument& rDoc = xShell->GetDocument(); ScDocProtection *const pDocProt(rDoc.GetDocProtection()); CPPUNIT_ASSERT(pDocProt->verifyPassword(password)); -ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); +const ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); CPPUNIT_ASSERT(pTabProt->verifyPassword(password)); // we can't assume that the user entered the password; check that we @@ -816,7 +816,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256ODF12() ScDocument& rDoc = xShell->GetDocument(); ScDocProtection *const pDocProt(rDoc.GetDocProtection()); CPPUNIT_ASSERT(pDocProt->verifyPassword(password)); -ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); +const ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); CPPUNIT_ASSERT(pTabProt->verifyPassword(password)); // we can't assume that the user entered the password; check that we @@ -839,7 +839,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256W3C() ScDocument& rDoc = xShell->GetDocument(); ScDocProtection *const pDocProt(rDoc.GetDocProtection()); CPPUNIT_ASSERT(pDocProt->verifyPassword(password)); -ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); +const ScTableProtection *const pTabProt(rDoc.GetTabProtection(0)); CPPUNIT_ASSERT(pTabProt->verifyPassword(password)); // we can't assume that the user entered the password; check that we @@ -862,7 +862,7 @@ void ScExportTest::testProtectionKeyODS_XL_SHA1() ScDocument& rDoc = xShell->GetDocument(); ScDocProtection *const pDocProt(rDoc.GetDocProtection()); CPPUNIT_ASSERT(pDocProt->ver
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/externalrefmgr.hxx| 10 +++ sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods |binary sc/qa/unit/data/ods/tdf87973_externalSource.ods |binary sc/qa/unit/subsequent_export-test.cxx| 42 +++ sc/source/core/tool/compiler.cxx |3 - sc/source/filter/excel/xelink.cxx| 19 +- sc/source/filter/excel/xestream.cxx |3 + sc/source/ui/docshell/externalrefmgr.cxx | 25 8 files changed, 98 insertions(+), 4 deletions(-) New commits: commit f85d860ccbebd99bc128218148e2992c9415f221 Author: Attila Szűcs AuthorDate: Mon Nov 30 15:18:09 2020 +0100 Commit: László Németh CommitDate: Thu Dec 3 14:00:27 2020 +0100 tdf#87973 XLSX export: fix lost file names in modified links Calculate new indexes for external reference files to export it to xlsx. These indexes are calculated only temporary, only for exporting. Much better solution would be to change the indexes permanently, but the original indexes are stored so many places in the code (for example it is stored in cells formula tokens converted to string). So it would be a much bigger refactoring to be able to delete an external reference permanently... even just to reorder the indexes, require to modify a lot of code. Co-authored-by: Tibor Nagy (NISZ) Change-Id: If9254f6e62ec739e2b159a066ada7efdbceb3ad8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106895 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index fd07fa0e657a..2669781e9caa 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -597,6 +597,13 @@ public: */ const OUString* getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal = false); +/** + * Reindex external file references to skip unused files, if skipping is enabled. + */ +sal_uInt16 convertFileIdToUsedFileId(sal_uInt16 nFileId); +void setSkipUnusedFileIds(std::vector& pExternFileIds); +void disableSkipUnusedFileIds(); + /** * Get all cached external file names as an array. Array indices of the * returned name array correspond with external file ID's. @@ -845,6 +852,9 @@ private: */ bool mbUserInteractionEnabled:1; +bool mbSkipUnusedFileIds = false; +std::vector maConvertFileIdToUsedFileId; + bool mbDocTimerEnabled:1; AutoTimer maSrcDocTimer; diff --git a/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods new file mode 100644 index ..cdaf9d4e7007 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods differ diff --git a/sc/qa/unit/data/ods/tdf87973_externalSource.ods b/sc/qa/unit/data/ods/tdf87973_externalSource.ods new file mode 100644 index ..59228e390e4d Binary files /dev/null and b/sc/qa/unit/data/ods/tdf87973_externalSource.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 54918a017797..e46d356d677b 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -267,6 +267,7 @@ public: void testTdf137000_handle_upright(); void testTdf126305_DataValidatyErrorAlert(); void testTdf76047_externalLink(); +void testTdf87973_externalLinkSkipUnuseds(); void testTdf129969(); void testTdf84874(); void testTdf136721_paper_size(); @@ -438,6 +439,7 @@ public: CPPUNIT_TEST(testTdf137000_handle_upright); CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert); CPPUNIT_TEST(testTdf76047_externalLink); +CPPUNIT_TEST(testTdf87973_externalLinkSkipUnuseds); CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); CPPUNIT_TEST(testTdf136721_paper_size); @@ -5536,6 +5538,46 @@ void ScExportTest::testTdf76047_externalLink() } } +void ScExportTest::testTdf87973_externalLinkSkipUnuseds() +{ +ScDocShellRef pShell = loadDoc("tdf87973_externalLinkSkipUnuseds.", FORMAT_ODS); +CPPUNIT_ASSERT(pShell.is()); + +// try to load data from external link: tdf132105_external.ods +// that file has to be in the same directory as tdf87973_externalLinkSkipUnuseds.ods +pShell->ReloadAllLinks(); +ScDocument& rDoc = pShell->GetDocument(); + +// change external link to: 87973_externalSource.ods +OUString aFormula, bFormula; +rDoc.GetFormula(3, 1, 0, aFormula); +auto nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods"); +aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods"); +auto nIdxOfFile = aFormula.indexOf("file"); + +// saveAndReload save the file to a temporary directory +// the link must be changed to point to that directory +utl::TempFile aTempFi