[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa sc/source

2023-09-18 Thread Szymon Kłos (via logerrit)
 sc/inc/conditio.hxx |   20 
 sc/qa/unit/subsequent_filters_test2.cxx |3 +++
 sc/source/core/data/conditio.cxx|   15 ++-
 3 files changed, 33 insertions(+), 5 deletions(-)

New commits:
commit dcd369ceff53c77ba26b91f580d3be2ea105a132
Author: Szymon Kłos 
AuthorDate: Wed Sep 13 14:57:23 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Sep 18 22:28:49 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/+/156897
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit c838c24a7e1eee9709789aab99b242f0a0c8c419)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156969

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 08f188a7c5a9..4300c80ba190 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 
+class RepaintInIdle;
 class ScFormulaCell;
 class ScTokenArray;
 struct ScRefCellValue;
@@ -443,6 +444,8 @@ private:
 };
 
 mutable std::unique_ptr mpCache;
+
+std::unique_ptr mpRepaintTask;
 };
 
 //  single condition entry for conditional formatting
@@ -606,6 +609,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_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index ce84c891649f..df7f60aded32 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2319,6 +2320,8 @@ void ScFiltersTest2::testCondFormatFormulaListenerXLSX()
 rDoc.SetDocVisible(true);
 rDoc.SetValue(0, 0, 0, 2.0);
 
+Scheduler::ProcessEventsToIdle();
+
 CPPUNIT_ASSERT(aListener.mbCalled);
 
 xDocSh->DoClose();
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index dba0710f2448..6e2e53d32e90 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(ScFormatEntry::Type::Condition),
-pCondFormat(nullptr)
+pCondFormat(nu

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/source

2023-09-11 Thread Szymon Kłos (via logerrit)
 sc/inc/document.hxx   |2 +-
 sc/source/core/data/documen8.cxx  |4 ++--
 sc/source/filter/excel/xlroot.cxx |9 ++---
 sc/source/filter/inc/xlroot.hxx   |2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 202f4119632cb845d0ba5e5fff23c1fd94c18bed
Author: Szymon Kłos 
AuthorDate: Tue Sep 5 16:58:22 2023 +0200
Commit: Szymon Kłos 
CommitDate: Mon Sep 11 09:58:55 2023 +0200

lok: save to xlsx changes column size

When xlsx spreadsheet was opened in LOK on
every save default column width was decreased.
This doesn't happen in non-LOK case.

Column width in Excel are defined by double value
which specifies number of '0' characters which fit
into the column.

On export we use mnCharWidth from XclRootData to
convert Calc twips size to number of characters.
In LOK case it was 102 while in non-lok case 101.

It was caused by different Reference Device used in
ScDocument::GetRefDevice() because in LOK case we
are in WYSWIG mode as introduced in
ScModelObj::initializeForTiledRendering in commit c25062f:
sc tiled rendering: Don't adjust the text width according to printer.

Let's use for export purpose the GetVirtualDevice_100th_mm()

Change-Id: I6709194d7924e8c7e0aaa75ff3901afbcc1f8c11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156576
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156750
Reviewed-by: Szymon Kłos 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 1188bbd9da2c..829091553d10 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2173,7 +2173,7 @@ public:
 SfxPrinter* GetPrinter( bool bCreateIfNotExist = true );
 voidSetPrinter( VclPtr const & 
pNewPrinter );
 VirtualDevice*  GetVirtualDevice_100th_mm();
-SC_DLLPUBLIC OutputDevice*  GetRefDevice(); // WYSIWYG: Printer, otherwise 
VirtualDevice...
+SC_DLLPUBLIC OutputDevice*  GetRefDevice(bool bForceVirtDev = false); // 
WYSIWYG: Printer, otherwise VirtualDevice...
 
 boolGetNextSpellingCell( SCCOL& nCol, SCROW& nRow, SCTAB nTab,
  bool bInSel, const ScMarkData& rMark) 
const;
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 3354ead298f0..a7bcd9967b0d 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -197,11 +197,11 @@ VirtualDevice* ScDocument::GetVirtualDevice_100th_mm()
 return mpVirtualDevice_100th_mm;
 }
 
-OutputDevice* ScDocument::GetRefDevice()
+OutputDevice* ScDocument::GetRefDevice(bool bForceVirtDev)
 {
 // Create printer like ref device, see Writer...
 OutputDevice* pRefDevice = nullptr;
-if ( SC_MOD()->GetInputOptions().GetTextWysiwyg() )
+if ( !bForceVirtDev && SC_MOD()->GetInputOptions().GetTextWysiwyg() )
 pRefDevice = GetPrinter();
 else
 pRefDevice = GetVirtualDevice_100th_mm();
diff --git a/sc/source/filter/excel/xlroot.cxx 
b/sc/source/filter/excel/xlroot.cxx
index bac3ca1b3f59..2702e85f5c56 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -207,7 +209,8 @@ void XclRoot::SetTextEncoding( rtl_TextEncoding eTextEnc )
 void XclRoot::SetCharWidth( const XclFontData& rFontData )
 {
 mrData.mnCharWidth = 0;
-if( OutputDevice* pPrinter = GetPrinter() )
+bool bIsLOK = comphelper::LibreOfficeKit::isActive();
+if( OutputDevice* pPrinter = GetPrinter( bIsLOK ) )
 {
 vcl::Font aFont( rFontData.maName, Size( 0, rFontData.mnHeight ) );
 aFont.SetFamily( rFontData.GetScFamily( GetTextEncoding() ) );
@@ -298,9 +301,9 @@ ScModelObj* XclRoot::GetDocModelObj() const
 return pDocShell ? comphelper::getFromUnoTunnel( 
pDocShell->GetModel() ) : nullptr;
 }
 
-OutputDevice* XclRoot::GetPrinter() const
+OutputDevice* XclRoot::GetPrinter(bool bForceVirtDev) const
 {
-return GetDoc().GetRefDevice();
+return GetDoc().GetRefDevice(bForceVirtDev);
 }
 
 ScStyleSheetPool& XclRoot::GetStyleSheetPool() const
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 3e6db3701fd3..b1202ff7c194 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -204,7 +204,7 @@ public:
 /** Returns the object model of the Calc document. */
 ScModelObj* GetDocModelObj() const;
 /** Returns pointer to the printer of the Calc document. */
-OutputDevice*   GetPrinter() const;
+OutputDevice*   GetPrinter(bool bForceVirtDev = false) const;
 /** Returns the style sheet pool of the Calc do

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/source

2023-06-06 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/unonames.hxx |1 +
 sc/source/ui/unoobj/confuno.cxx |   14 --
 2 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit d19f877be396bb69e1ae0ee5535e193e3feb35e1
Author: Tomaž Vajngerl 
AuthorDate: Tue Jan 4 21:39:20 2022 +0900
Commit: Aron Budea 
CommitDate: Tue Jun 6 13:03:48 2023 +0200

sc: fix crash with document properties dialog

"ImagePreferredDPI" property was added for impress and writer,
but it was not handled in calc, so it document properties dialog
crashed (exception because of a non existent property).

Change-Id: I9eb3f6aa7cf6d8ab48930b3071b993e073117688
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127942
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 88d8c9af7140ec25dfbcd9323b870a2da7b6f7e0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152558
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 36ab650e918b..848053ba4542 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -574,6 +574,7 @@
 #define SC_UNO_UPDTEMPL "UpdateFromTemplate"
 #define SC_UNO_FILTERED_RANGE_SELECTION   "FilteredRangeSelection"
 #define SC_UNO_VISAREASCREEN"VisibleAreaOnScreen"
+#define SC_UNO_IMAGE_PREFERRED_DPI  "ImagePreferredDPI"
 
 /*Stampit enable/disable print cancel */
 #define SC_UNO_ALLOWPRINTJOBCANCEL  "AllowPrintJobCancel"
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index ba081d5e2433..95c6fe64c9e8 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -89,6 +89,7 @@ static const SfxItemPropertyMapEntry* 
lcl_GetConfigPropertyMap()
 {u"" SC_UNO_EMBED_FONT_SCRIPT_LATIN,   0,  cppu::UnoType::get(), 
0, 0},
 {u"" SC_UNO_EMBED_FONT_SCRIPT_ASIAN,   0,  cppu::UnoType::get(), 
0, 0},
 {u"" SC_UNO_EMBED_FONT_SCRIPT_COMPLEX, 0,  cppu::UnoType::get(), 
0, 0},
+{u"" SC_UNO_IMAGE_PREFERRED_DPI,   0,  
cppu::UnoType::get(), 0, 0},
 {u"" SC_UNO_SYNTAXSTRINGREF, 0,  cppu::UnoType::get(), 
0, 0},
 { u"", 0, css::uno::Type(), 0, 0 }
 };
@@ -396,7 +397,13 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
 rDoc.SetCalcConfig( aCalcConfig );
 }
 }
-
+else if (aPropertyName == SC_UNO_IMAGE_PREFERRED_DPI)
+{
+if (aValue.has())
+{
+rDoc.SetImagePreferredDPI(aValue.get());
+}
+}
 else
 {
 ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
@@ -599,7 +606,10 @@ uno::Any SAL_CALL 
ScDocumentConfiguration::getPropertyValue( const OUString& aPr
  }
 }
 }
-
+else if (aPropertyName == SC_UNO_IMAGE_PREFERRED_DPI)
+{
+aRet <<= rDoc.GetImagePreferredDPI();
+}
 else
 {
 const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/source

2023-05-12 Thread Henry Castro (via logerrit)
 sc/inc/colorscale.hxx  |2 ++
 sc/source/core/data/colorscale.cxx |   15 +++
 2 files changed, 17 insertions(+)

New commits:
commit 3fc2dce9d332268a93c854e9badf12b9076b1457
Author: Henry Castro 
AuthorDate: Thu May 11 16:23:03 2023 -0400
Commit: Henry Castro 
CommitDate: Fri May 12 22:25:16 2023 +0200

sc: copy cache values when clone color conditional format

When clone a conditional format list, also copy the cache
values that hold the min and max values, otherwise if clone
occurs when copying to the clipboard the values have wrong
data due to limiting range cells copied.

Signed-off-by: Henry Castro 
Change-Id: Id9085a1488a3bde24842e0d2e062c9b425074157
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151686
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 9923eac4c572..fc5c34dda287 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -224,6 +224,8 @@ public:
 virtual ~ScColorFormat() override;
 
 const ScRangeList& GetRange() const;
+void SetCache(const std::vector& aValues);
+std::vector GetCache() const;
 
 virtual void SetParent(ScConditionalFormat* pParent) override;
 
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 34cdb91511d2..c8f8d84f1873 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -379,6 +379,9 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, 
const ScColorScaleForma
 {
 maColorScales.emplace_back(new ScColorScaleEntry(pDoc, *rxEntry));
 }
+
+auto aCache = rFormat.GetCache();
+SetCache(aCache);
 }
 
 ScColorFormat* ScColorScaleFormat::Clone(ScDocument* pDoc) const
@@ -440,6 +443,18 @@ const ScRangeList& ScColorFormat::GetRange() const
 return mpParent->GetRange();
 }
 
+std::vector ScColorFormat::GetCache() const
+{
+std::vector empty;
+return mpCache ? mpCache->maValues : empty;
+}
+
+void ScColorFormat::SetCache(const std::vector& aValues)
+{
+mpCache.reset(new ScColorFormatCache);
+mpCache->maValues = aValues;
+}
+
 std::vector& ScColorFormat::getValues() const
 {
 if(!mpCache)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/source

2023-05-12 Thread Henry Castro (via logerrit)
 sc/inc/colorscale.hxx  |1 +
 sc/inc/conditio.hxx|5 +
 sc/source/core/data/colorscale.cxx |6 ++
 sc/source/core/data/conditio.cxx   |   20 
 sc/source/core/data/table2.cxx |3 +++
 5 files changed, 35 insertions(+)

New commits:
commit 7ba30bc3eb03d2e4be7190496e42291a599cc304
Author: Henry Castro 
AuthorDate: Thu May 11 16:07:10 2023 -0400
Commit: Henry Castro 
CommitDate: Fri May 12 20:02:05 2023 +0200

sc: add "updateValues" method to conditional format list

When copying a range cells to a clipboard, if exists a
color scale conditional format from different ranges,
it should update the min and max values, otherwise
the color scale conditional format could not calculate
min and max values due to limiting range cell copied.

Signed-off-by: Henry Castro 
Change-Id: I660e18090a60b99ddf2b55ce1f713fd41121290e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151685
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index de74030dbc85..9923eac4c572 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -229,6 +229,7 @@ public:
 
 virtual void startRendering() override;
 virtual void endRendering() override;
+virtual void updateValues() override;
 
 protected:
 std::vector& getValues() const;
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 5a131e5f6a10..08f188a7c5a9 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -252,6 +252,7 @@ public:
 
 virtual void startRendering();
 virtual void endRendering();
+virtual void updateValues();
 protected:
 ScDocument* mpDoc;
 
@@ -599,6 +600,8 @@ public:
 void startRendering();
 void endRendering();
 
+void updateValues();
+
 // Forced recalculation for formulas
 void CalcAll();
 };
@@ -684,6 +687,8 @@ public:
 void startRendering();
 void endRendering();
 
+void updateValues();
+
 sal_uInt32 getMaxKey() const;
 
 /// Forced recalculation of formulas
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 74b80ef2ecf3..34cdb91511d2 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -512,6 +512,12 @@ void ScColorFormat::endRendering()
 mpCache.reset();
 }
 
+void ScColorFormat::updateValues()
+{
+getMinValue();
+getMaxValue();
+}
+
 namespace {
 
 sal_uInt8 GetColorValue( double nVal, double nVal1, sal_uInt8 nColVal1, double 
nVal2, sal_uInt8 nColVal2 )
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 3634a5b07c0a..dba0710f2448 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -74,6 +74,10 @@ void ScFormatEntry::endRendering()
 {
 }
 
+void ScFormatEntry::updateValues()
+{
+}
+
 static bool lcl_HasRelRef( ScDocument* pDoc, const ScTokenArray* pFormula, 
sal_uInt16 nRecursion = 0 )
 {
 if (pFormula)
@@ -2063,6 +2067,14 @@ void ScConditionalFormat::endRendering()
 }
 }
 
+void ScConditionalFormat::updateValues()
+{
+for(auto& rxEntry : maEntries)
+{
+rxEntry->updateValues();
+}
+}
+
 void ScConditionalFormat::CalcAll()
 {
 for(const auto& rxEntry : maEntries)
@@ -2310,6 +2322,14 @@ void ScConditionalFormatList::endRendering()
 }
 }
 
+void ScConditionalFormatList::updateValues()
+{
+for (auto const& it : m_ConditionalFormats)
+{
+it->updateValues();
+}
+}
+
 void ScConditionalFormatList::clear()
 {
 m_ConditionalFormats.clear();
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 543944c18a25..a7d073c89966 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -529,7 +529,10 @@ void ScTable::CopyToClip(
 for (SCCOL i = nCol1; i <= nCol2; i++)
 pTable->aCol[i].RemoveProtected(nRow1, nRow2);
 
+mpCondFormatList->startRendering();
+mpCondFormatList->updateValues();
 pTable->mpCondFormatList.reset(new 
ScConditionalFormatList(pTable->rDocument, *mpCondFormatList));
+mpCondFormatList->endRendering();
 }
 
 void ScTable::CopyToClip(


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/source

2022-12-30 Thread Noel Grandin (via logerrit)
 sc/inc/scmatrix.hxx  |5 
 sc/source/core/tool/interpr5.cxx |  109 +++---
 sc/source/core/tool/scmatrix.cxx |  231 ---
 3 files changed, 243 insertions(+), 102 deletions(-)

New commits:
commit 2375300d34a57b389ddcf8eda844c846bf5fb419
Author: Noel Grandin 
AuthorDate: Thu Dec 22 18:41:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 31 06:34:43 2022 +

optimise SUMPRODUCT(IF..) a little

Move the AddSub calculation inside ScMatrix so we
can use an iterator to walk the matrix and avoid lookup
cost for each element.
Shaves 50% off the time spent here in my test sheet.

Change-Id: I171d7dd4ae86419a563342a4120d14106e8d71db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144826
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 96f162d02adee9b4edbb440896be90a64523c119)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144900
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 9026288c55cf..bae3f8e3f920 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -130,6 +130,7 @@ public:
 typedef std::function BoolOpFunction;
 typedef std::function 
StringOpFunction;
 typedef std::function EmptyOpFunction;
+typedef std::function CalculateOpFunction;
 
 /**
  * When adding all numerical matrix elements for a scalar result such as
@@ -422,6 +423,10 @@ public:
 void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, 
const ScMatrixRef& xMat2,
 SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) ;
 
+/** Apply binary operation to values from two input matrices, storing 
result into this matrix. */
+void ExecuteBinaryOp(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrix& 
rInputMat1, const ScMatrix& rInputMat2,
+ScInterpreter* pInterpreter, CalculateOpFunction op);
+
 #if DEBUG_MATRIX
 void Dump() const;
 #endif
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 74807696e055..ec03f981c294 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -46,45 +46,30 @@ using namespace formula;
 
 namespace {
 
-struct MatrixAdd
+double MatrixAdd(const double& lhs, const double& rhs)
 {
-double operator() (const double& lhs, const double& rhs) const
-{
-return ::rtl::math::approxAdd( lhs,rhs);
-}
-};
+return ::rtl::math::approxAdd( lhs,rhs);
+}
 
-struct MatrixSub
+double MatrixSub(const double& lhs, const double& rhs)
 {
-double operator() (const double& lhs, const double& rhs) const
-{
-return ::rtl::math::approxSub( lhs,rhs);
-}
-};
+return ::rtl::math::approxSub( lhs,rhs);
+}
 
-struct MatrixMul
+double MatrixMul(const double& lhs, const double& rhs)
 {
-double operator() (const double& lhs, const double& rhs) const
-{
-return lhs * rhs;
-}
-};
+return lhs * rhs;
+}
 
-struct MatrixDiv
+double MatrixDiv(const double& lhs, const double& rhs)
 {
-double operator() (const double& lhs, const double& rhs) const
-{
-return ScInterpreter::div( lhs,rhs);
-}
-};
+return ScInterpreter::div( lhs,rhs);
+}
 
-struct MatrixPow
+double MatrixPow(const double& lhs, const double& rhs)
 {
-double operator() (const double& lhs, const double& rhs) const
-{
-return ::pow( lhs,rhs);
-}
-};
+return ::pow( lhs,rhs);
+}
 
 // Multiply n x m Mat A with m x l Mat B to n x l Mat R
 void lcl_MFastMult(const ScMatrixRef& pA, const ScMatrixRef& pB, const 
ScMatrixRef& pR,
@@ -1163,66 +1148,18 @@ static SCSIZE lcl_GetMinExtent( SCSIZE n1, SCSIZE n2 )
 return n2;
 }
 
-template
 static ScMatrixRef lcl_MatrixCalculation(
-const ScMatrix& rMat1, const ScMatrix& rMat2, ScInterpreter* pInterpreter)
+const ScMatrix& rMat1, const ScMatrix& rMat2, ScInterpreter* pInterpreter, 
ScMatrix::CalculateOpFunction Op)
 {
-static const Function Op;
-
 SCSIZE nC1, nC2, nMinC;
 SCSIZE nR1, nR2, nMinR;
-SCSIZE i, j;
 rMat1.GetDimensions(nC1, nR1);
 rMat2.GetDimensions(nC2, nR2);
 nMinC = lcl_GetMinExtent( nC1, nC2);
 nMinR = lcl_GetMinExtent( nR1, nR2);
 ScMatrixRef xResMat = pInterpreter->GetNewMat(nMinC, nMinR, 
/*bEmpty*/true);
 if (xResMat)
-{
-for (i = 0; i < nMinC; i++)
-{
-for (j = 0; j < nMinR; j++)
-{
-bool bVal1 = rMat1.IsValueOrEmpty(i,j);
-bool bVal2 = rMat2.IsValueOrEmpty(i,j);
-FormulaError nErr;
-if (bVal1 && bVal2)
-{
-double d = Op(rMat1.GetDouble(i,j), rMat2.GetDouble(i,j));
-xResMat->PutDouble( d, i, j);
-}
-else if (((nErr = rMat1.GetErrorIfNotString(i,j)) != 
FormulaError::NONE) ||
- ((nErr = rMat2.Get

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa sc/source

2022-11-10 Thread Szymon Kłos (via logerrit)
 sc/inc/table.hxx |9 +++
 sc/qa/unit/ucalc.cxx |2 
 sc/source/core/data/document.cxx |9 +++
 sc/source/core/data/table1.cxx   |   19 ++--
 sc/source/ui/docshell/docsh.cxx  |1 
 sc/source/ui/inc/docsh.hxx   |   44 ++
 sc/source/ui/undo/undoblk3.cxx   |4 -
 sc/source/ui/undo/undocell.cxx   |   17 +--
 sc/source/ui/unoobj/docuno.cxx   |   92 +--
 sc/source/ui/view/viewfun2.cxx   |   10 ++--
 sc/source/ui/view/viewfun3.cxx   |   10 ++--
 sc/source/ui/view/viewfunc.cxx   |   46 +--
 12 files changed, 198 insertions(+), 65 deletions(-)

New commits:
commit ae460d8b75e1c68356d2dca8e5f6cb51067adc27
Author: Szymon Kłos 
AuthorDate: Fri Nov 4 15:19:13 2022 +0100
Commit: Szymon Kłos 
CommitDate: Thu Nov 10 11:45:40 2022 +0100

calc: cache GetCellArea results

This will avoid repeated lookup in the ScTable::GetCellArea.
Which is used for vcl::ITiledRenderable::getDataArea().

Tested in CppunitTest_sc_ucalc

Change-Id: Ied58cfe447e1b924af9b401e95e127c784b80355
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142279
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Dennis Francis 

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 6511c3405429..dca46ed44f40 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -178,6 +178,12 @@ private:
 SCROW   nRepeatStartY;
 SCROW   nRepeatEndY;
 
+// last used col and row
+boolmbCellAreaDirty;
+boolmbCellAreaEmpty;
+SCCOL   mnEndCol;
+SCROW   mnEndRow;
+
 std::unique_ptr pTabProtection;
 
 std::unique_ptr> mpColWidth;
@@ -593,7 +599,8 @@ public:
 voidInvalidateTableArea();
 voidInvalidatePageBreaks();
 
-boolGetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const;   
 // FALSE = empty
+voidInvalidateCellArea() { mbCellAreaDirty = true; }
+boolGetCellArea( SCCOL& rEndCol, SCROW& rEndRow );// 
FALSE = empty
 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,
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index fa58e0f743f5..c718415be069 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -64,6 +64,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -5374,6 +5375,7 @@ void Test::testAreasWithNotes()
 
 m_pDoc->SetString(0, 3, 0, "Some Text");
 m_pDoc->SetString(3, 3, 0, "Some Text");
+m_pDoc->FetchTable(0)->InvalidateCellArea();
 
 dataFound = m_pDoc->GetDataStart(0,col,row);
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index a8525fe71085..3622b7fc49da 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -41,6 +41,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -6723,7 +6724,15 @@ void ScDocument::SetNote(const ScAddress& rPos, 
std::unique_ptr pNote)
 void ScDocument::SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, 
std::unique_ptr pNote)
 {
 if (ValidTab(nTab) && nTab < static_cast(maTabs.size()))
+{
 maTabs[nTab]->SetNote(nCol, nRow, std::move(pNote));
+
+if (ScDocShell* pDocSh = dynamic_cast(GetDocumentShell()))
+{
+HelperNotifyChanges::NotifyIfChangesListeners(
+*pDocSh, ScRange(nCol, nRow, nTab), "note");
+}
+}
 }
 
 bool ScDocument::HasNote(const ScAddress& rPos) const
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 43dcd6abee20..96025b640856 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -244,6 +244,10 @@ ScTable::ScTable( ScDocument& rDoc, SCTAB nNewTab, const 
OUString& rNewName,
 nRepeatEndX( SCCOL_REPEAT_NONE ),
 nRepeatStartY( SCROW_REPEAT_NONE ),
 nRepeatEndY( SCROW_REPEAT_NONE ),
+mbCellAreaDirty( true ),
+mbCellAreaEmpty( true ),
+mnEndCol( -1 ),
+mnEndRow( -1 ),
 mpRowHeights( static_cast(nullptr) ),
 mpHiddenCols(new ScFlatBoolColSegments(rDoc.MaxCol())),
 mpHiddenRows(new ScFlatBoolRowSegments(rDoc.MaxRow())),
@@ -510,8 +514,15 @@ void ScTable::SetOptimalHeightOnly(
 delete pProgress;
 }
 
-bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const
+bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow )
 {
+if (!mbCellAreaDirty)
+{
+rEndCol = mnEndCol;
+rEndRow = mnEndRow;
+return !mbCellAreaEmpty;
+}
+
 bool bFound = false;
 SCCOL nMaxX = 0;
 SCROW nMaxY = 0;
@@ -555,8 +566,10 @@ bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow 
) const
 }
 }
 
-rEndCol = 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc

2022-09-25 Thread Luboš Luňák (via logerrit)
 sc/inc/document.hxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 2a0ea9c49084e31e5ef01bd824be53882e97f4a7
Author: Luboš Luňák 
AuthorDate: Mon May 9 11:10:43 2022 +0200
Commit: Szymon Kłos 
CommitDate: Sun Sep 25 21:18:30 2022 +0200

make ScDocument::FetchTable() public

I don't see why it should be private, it's range checked,
so there should be no harm. Especially when a number of classes get
declared as friends to get access to it anyway.

Change-Id: I333d749aa9d09aaf9dcbabf43d67a67d1257a132
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134051
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139471
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 1c26604a4fb5..4f06b4b6473b 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2655,9 +2655,6 @@ private:
 ScDocument& mrDoc;
 };
 
-ScTable* FetchTable( SCTAB nTab );
-const ScTable* FetchTable( SCTAB nTab ) const;
-
 voidMergeNumberFormatter(const ScDocument& rSrcDoc);
 
 voidImplCreateOptions(); // Suggestion: switch to on-demand?
@@ -2682,6 +2679,9 @@ private:
 boolHasPartOfMerged( const ScRange& rRange );
 
 public:
+ScTable* FetchTable( SCTAB nTab );
+const ScTable* FetchTable( SCTAB nTab ) const;
+
 ScRefCellValue GetRefCellValue( const ScAddress& rPos );
 private:
 ScRefCellValue GetRefCellValue( const ScAddress& rPos, 
sc::ColumnBlockPosition& rBlockPos );


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc

2022-09-20 Thread Noel Grandin (via logerrit)
 sc/inc/compiler.hxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a68ad22fbef20542284354732ee561efd40f41fa
Author: Noel Grandin 
AuthorDate: Fri Sep 16 15:29:20 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Sep 20 15:49:59 2022 +0200

speed up large sheet with lots of conditions

shaves 10% off view load time

Change-Id: I51078ef81613faa2f8c37530fb7dc77b73192525
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140070
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 7e829725105897da822fe4b0d09c4a04a2666132)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139987
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 5f3b6354c967..585a3c86a9ae 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -323,7 +324,7 @@ private:
 formula::FormulaTokenRef operation;
 };
 std::vector< PendingImplicitIntersectionOptimization > 
mPendingImplicitIntersectionOptimizations;
-std::set mUnhandledPossibleImplicitIntersections;
+std::unordered_set 
mUnhandledPossibleImplicitIntersections;
 #ifdef DBG_UTIL
 std::set mUnhandledPossibleImplicitIntersectionsOpCodes;
 #endif


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc

2022-08-20 Thread Caolán McNamara (via logerrit)
 sc/inc/sc.hrc |   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit f40143cae28e99426414f484929e25d28ec2c9d2
Author: Caolán McNamara 
AuthorDate: Fri Aug 19 08:57:21 2022 +0100
Commit: Aron Budea 
CommitDate: Sat Aug 20 21:32:35 2022 +0200

Resolves: tdf#150336 overlapping slot ids

Change-Id: I54fc92d1d7afd61fe057868b038864f29ec2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138432
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit d3492e15dce1dc8448c6444a92e3e2f7ec19571c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138566
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 24a6fefa19bf..4c34bb149340 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -306,14 +306,7 @@
 #define FID_INS_ROWS_BEFORE (INSERT_MENU_START + 22)
 #define FID_INS_COLUMNS_BEFORE  (INSERT_MENU_START + 23)
 #define FID_DEFINE_CURRENT_NAME (INSERT_MENU_START + 24)
-#define SID_INSERT_SPARKLINE(INSERT_MENU_START + 25)
-#define SID_DELETE_SPARKLINE(INSERT_MENU_START + 26)
-#define SID_EDIT_SPARKLINE_GROUP (INSERT_MENU_START + 27)
-#define SID_DELETE_SPARKLINE_GROUP   (INSERT_MENU_START + 28)
-#define SID_GROUP_SPARKLINES(INSERT_MENU_START + 29)
-#define SID_UNGROUP_SPARKLINES  (INSERT_MENU_START + 30)
-#define SID_EDIT_SPARKLINE  (INSERT_MENU_START + 31)
-#define INSERT_MENU_END (INSERT_MENU_START + 32)
+#define INSERT_MENU_END (INSERT_MENU_START + 25)
 
 #define FORMAT_MENU_START   (INSERT_MENU_END)
 #define FID_CELL_FORMAT (FORMAT_MENU_START)
@@ -611,6 +604,15 @@
 #define SID_SELECT_VISIBLE_ROWS  (SID_NEW_SLOTS+107)
 #define SID_SELECT_VISIBLE_COLUMNS   (SID_NEW_SLOTS+108)
 #define SID_CURRENT_FORMULA_RANGE(SID_NEW_SLOTS+109)
+
+#define SID_INSERT_SPARKLINE(SID_NEW_SLOTS+110)
+#define SID_DELETE_SPARKLINE(SID_NEW_SLOTS+111)
+#define SID_EDIT_SPARKLINE_GROUP(SID_NEW_SLOTS+112)
+#define SID_DELETE_SPARKLINE_GROUP  (SID_NEW_SLOTS+113)
+#define SID_GROUP_SPARKLINES(SID_NEW_SLOTS+114)
+#define SID_UNGROUP_SPARKLINES  (SID_NEW_SLOTS+115)
+#define SID_EDIT_SPARKLINE  (SID_NEW_SLOTS+116)
+
 // idl parameter
 
 #define SID_SORT_BYROW  (SC_PARAM_START)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa sc/source

2022-07-30 Thread Noel Grandin (via logerrit)
 sc/inc/document.hxx  |8 +--
 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, 220 insertions(+), 13 deletions(-)

New commits:
commit 51075345dbfee560a81043ccb3cda942a3bddb46
Author: Noel Grandin 
AuthorDate: Thu Jul 28 19:06:59 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 30 21:00:58 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 
(cherry picked from commit a2e1754dc96955a8c6da0e25896f645cf2f09f74)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137596
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index eeeb98440b08..bfa235581bd0 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -180,7 +180,9 @@ class ScAutoNameCache;
 class ScTemporaryChartLock;
 class ScLookupCache;
 struct ScLookupCacheMap;
-class SfxUndoManager;
+class ScSortedRangeCache;
+struct ScSortedRangeCacheMap;
+class ScUndoManager;
 class ScFormulaParserPool;
 struct ScClipParam;
 class ScRowBreakIterator;
@@ -366,7 +368,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;
@@ -2523,7 +2525,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 736d84621288..fda104368fd1 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 
 #include 
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 81d84520fff5..c1aea797880a 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 7329482bdf30..0f4923716490 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -72,6 +72,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 38f1affe2ebc..56330f2154bd 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace cs

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa sc/source

2022-07-25 Thread Tomaž Vajngerl (via logerrit)
 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 ee4946764d434d381b97b77078a2736e2c73e83b
Author: Tomaž Vajngerl 
AuthorDate: Fri May 20 14:56:45 2022 +0900
Commit: Miklos Vajna 
CommitDate: Tue Jul 26 08:17:19 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 
(cherry picked from commit 0874486b348f1477d59e161a4d73c5cb56e238f9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137434
Tested-by: Jenkins CollaboraOffice 

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 19765bd67016..572b8ed8b83f 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 de1f9ae7ebda..94ce5d9a91b3 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 1

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa

2022-05-31 Thread Luboš Luňák (via logerrit)
 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 373aa1961201a2d00c9886c21ee678a244960b24
Author: Luboš Luňák 
AuthorDate: Wed Mar 30 11:58:04 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue May 31 09:21:32 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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133800
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 68bbe7dad075..8cf39ccfdf64 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 fbfa84fb0450..ff36fa0542ef 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1413,48 +1413,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 );
+CPPUN

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa

2022-05-20 Thread Luboš Luňák (via logerrit)
 sc/inc/address.hxx   |2 +-
 sc/qa/unit/tiledrendering/tiledrendering.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit fbd1eccd710c8cb135dd2c9a904f236d18f5fec0
Author: Luboš Luňák 
AuthorDate: Fri May 13 14:46:33 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri May 20 10:52: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/+/134282
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index ea197c5b95aa..68bbe7dad075 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 8c42ff99fa45..4d947cb4f600 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -2150,7 +2150,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: Branch 'distro/collabora/co-22.05' - sc/inc sc/sdi sc/source

2022-04-27 Thread Szymon Kłos (via logerrit)
 sc/inc/sc.hrc |3 +
 sc/sdi/cellsh.sdi |2 
 sc/sdi/scalc.sdi  |   37 +
 sc/source/ui/app/inputwin.cxx |   87 ++
 sc/source/ui/inc/inputwin.hxx |1 
 sc/source/ui/view/cellsh1.cxx |   17 +++-
 sc/source/ui/view/cellsh3.cxx |   17 
 7 files changed, 123 insertions(+), 41 deletions(-)

New commits:
commit b974bb3a19f2146218981e614349de3674142fa6
Author: Szymon Kłos 
AuthorDate: Tue Apr 26 18:15:22 2022 +0200
Commit: Szymon Kłos 
CommitDate: Thu Apr 28 08:20:16 2022 +0200

lok: Introduce uno commands for formulabar actions

thanks to that we can reach them using LOK as formulabar
is not fully welded yet

Change-Id: Icc1963ab11c1e6e3c407222d76b2a87fdaffa652
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133496
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 1392cd6f20b4..24a6fefa19bf 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -506,6 +506,9 @@
 #define SID_NEXT_TABLE_SEL  (SID_KEYFUNC_START + 40)
 #define SID_PREV_TABLE_SEL  (SID_KEYFUNC_START + 41)
 
+#define SID_ACCEPT_FORMULA  (SID_KEYFUNC_START + 42)
+#define SID_START_FORMULA   (SID_KEYFUNC_START + 43)
+
 #define SID_KEYFUNC_END (SID_KEYFUNC_START + 50)
 
 #define SID_NEW_SLOTS   (SID_KEYFUNC_END)
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 38eb86cb27b9..d61f9cb863f8 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -209,6 +209,8 @@ interface CellSelection
 FID_INSERT_NAME [ ExecMethod = ExecuteEdit; 
StateMethod = GetState; ]
 FID_USE_NAME[ ExecMethod = ExecuteEdit; 
StateMethod = GetState; ]
 SID_CANCEL  [ ExecMethod = Execute; ]
+SID_ACCEPT_FORMULA  [ ExecMethod = Execute; ]
+SID_START_FORMULA   [ ExecMethod = Execute; ]
 SID_TOGGLE_REL  [ ExecMethod = ExecuteEdit; 
StateMethod = GetState; ]
 SID_POPUP_CONDFRMT  []
 SID_COLUMN_OPERATIONS   [ ExecMethod = ExecuteEdit; 
StateMethod = GetBlockState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index bb438041a892..d7087be5c056 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -483,6 +483,42 @@ SfxVoidItem Cancel SID_CANCEL
 GroupId = SfxGroupId::Edit;
 ]
 
+SfxVoidItem AcceptFormula SID_ACCEPT_FORMULA
+()
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = TRUE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+Asynchron;
+
+AccelConfig = TRUE,
+MenuConfig = FALSE,
+ToolBoxConfig = TRUE,
+GroupId = SfxGroupId::Edit;
+]
+
+SfxVoidItem StartFormula SID_START_FORMULA
+()
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = TRUE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+Asynchron;
+
+AccelConfig = TRUE,
+MenuConfig = FALSE,
+ToolBoxConfig = TRUE,
+GroupId = SfxGroupId::Edit;
+]
+
 
 SfxVoidItem ChangeChartData SID_CHART_SOURCE
 (SfxStringItem Name SID_CHART_NAME,SfxStringItem Range 
SID_CHART_SOURCE,SfxBoolItem ColHeaders FN_PARAM_1,SfxBoolItem RowHeaders 
FN_PARAM_2)
@@ -6550,6 +6586,7 @@ SfxUInt16Item NumberFormatType SID_NUMBER_TYPE_FORMAT
 
 
 SfxVoidItem AutoSum SID_AUTO_SUM
+(SfxStringItem Function SID_AUTO_SUM)
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index cfad09bd4484..2874ec280f84 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -364,55 +364,61 @@ void ScInputWindow::Select()
 mxTextWindow->Invalidate(); // Or else the Selection remains
 }
 else if (curItemId == SID_INPUT_EQUAL)
+{
+StartFormula();
+}
+}
+
+void ScInputWindow::StartFormula()
+{
+ScModule* pScMod = SC_MOD();
+mxTextWindow->StartEditEngine();
+if ( pScMod->IsEditMode() ) // Isn't if e.g. protected
 {
 mxTextWindow->StartEditEngine();
-if ( pScMod->IsEditMode() ) // Isn't if e.g. protected
-{
-mxTextWindow->StartEditEngine();
 
-sal_Int32 nStartPos = 1;
-sal_Int32 nEndPos = 1;
+sal_Int32 nStartPos = 1;
+sal_Int32 nEndPos = 1;
 
-ScTabViewShell* pViewSh = dynamic_cast( 
SfxViewShell::Current()  );
-if ( pViewSh )
-{
-const OUString& rString = mxTextWindow->GetTextString();
-const sal_Int32 nLen = rString.getLength();
+ScTabViewShell* pViewSh = dynamic_cast( 
SfxViewShell::Current()  );
+if ( pViewSh )
+{
+const OUString& rString = mxTextWindow->GetTextString();
+const sal_Int32 nLen = rString.getLength();
 
-ScDocument& rDoc 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa sc/source

2022-04-12 Thread Tomaž Vajngerl (via logerrit)
 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 7ea1799f6bd95ab75133c22fd6597b9262fcf73a
Author: Tomaž Vajngerl 
AuthorDate: Fri Apr 1 17:06:18 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Apr 12 17:06:29 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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132878
Tested-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);
+ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/Library_sc.mk sc/qa sc/source

2022-04-11 Thread Tomaž Vajngerl (via logerrit)
 sc/Library_sc.mk|2 
 sc/inc/SparklineAttributes.hxx  |  145 
 sc/inc/SparklineGroup.hxx   |  118 --
 sc/qa/unit/SparklineImportExportTest.cxx|  124 +-
 sc/source/filter/excel/export/SparklineExt.cxx  |   94 
 sc/source/filter/inc/export/SparklineExt.hxx|6 
 sc/source/filter/oox/SparklineFragment.cxx  |   80 +++
 sc/source/ui/dialogs/SparklineDialog.cxx|   70 +++---
 sc/source/ui/sparklines/SparklineAttributes.cxx |  273 
 sc/source/ui/sparklines/SparklineGroup.cxx  |   25 ++
 sc/source/ui/view/output.cxx|   79 +++---
 11 files changed, 684 insertions(+), 332 deletions(-)

New commits:
commit 03ae32de9474dedb209b79f6866fa64e9e51c49e
Author: Tomaž Vajngerl 
AuthorDate: Tue Mar 22 15:12:55 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Apr 12 05:01:52 2022 +0200

sc: split attrs out of SparklineGroup into a COW class

The attributes can be independent of the actual SparklineGroup,
so they can be shared through multiple SparklineGroups and with
the attributes being COW, they can be safely changed without the
fear that it will impact a different SparklineGroup insstance.

Change-Id: I274b1243d014288ea34a213326ef765ceff86a58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132502
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 634399594cfd1672caaf412ed4bc945f12aa4913)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132832
Tested-by: Tomaž Vajngerl 

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 5e4da178dacf..f523ee899254 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -510,7 +510,9 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/sidebar/NumberFormatControl \
 sc/source/ui/sidebar/NumberFormatPropertyPanel \
 sc/source/ui/sidebar/ScPanelFactory \
+sc/source/ui/sparklines/SparklineAttributes \
 sc/source/ui/sparklines/SparklineData \
+sc/source/ui/sparklines/SparklineGroup \
 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog \
 sc/source/ui/StatisticsDialogs/CorrelationDialog \
 sc/source/ui/StatisticsDialogs/CovarianceDialog \
diff --git a/sc/inc/SparklineAttributes.hxx b/sc/inc/SparklineAttributes.hxx
new file mode 100644
index ..e89e15bc1a1b
--- /dev/null
+++ b/sc/inc/SparklineAttributes.hxx
@@ -0,0 +1,145 @@
+/* -*- 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 
+#include 
+
+namespace sc
+{
+/** Supported sparkline types */
+enum class SparklineType
+{
+Line,
+Column,
+Stacked
+};
+
+/** The method of calculating the axis min or max value */
+enum class AxisType
+{
+Individual, // calculate the min/max of a sparkline
+Group, // calculate the min or max of the whole sparkline group
+Custom // user defined
+};
+
+/** Determines how to display the empty cells */
+enum class DisplayEmptyCellsAs
+{
+Span,
+Gap,
+Zero // empty cell equals zero
+};
+
+/** Common properties for a group of sparklines */
+class SC_DLLPUBLIC SparklineAttributes
+{
+private:
+class Implementation;
+o3tl::cow_wrapper m_aImplementation;
+
+public:
+SparklineAttributes();
+~SparklineAttributes();
+SparklineAttributes(const SparklineAttributes& rOther);
+SparklineAttributes(SparklineAttributes&& rOther);
+SparklineAttributes& operator=(const SparklineAttributes& rOther);
+SparklineAttributes& operator=(SparklineAttributes&& rOther);
+
+bool operator==(const SparklineAttributes& rOther) const;
+bool operator!=(const SparklineAttributes& rOther) const
+{
+return !(SparklineAttributes::operator==(rOther));
+}
+
+Color getColorSeries() const;
+void setColorSeries(Color aColorSeries);
+
+Color getColorNegative() const;
+void setColorNegative(Color aColorSeries);
+
+Color getColorAxis() const;
+void setColorAxis(Color aColorSeries);
+
+Color getColorMarkers() const;
+void setColorMarkers(Color aColorSeries);
+
+Color getColorFirst() const;
+void setColorFirst(Color aColorSeries);
+
+Color getColorLast() const;
+void setColorLast(Color aColorSeries);
+
+Color getColorHigh() const;
+void setColorHigh(Color aColorSeries);
+
+Color getColorLow() const;
+void setColorLow(Color aColorSeries);
+
+AxisType getMinAxisType() const;
+void setMinAxisType(AxisType eAxisType);
+
+AxisType getMaxAxisType() const;
+void setMaxAxisType(AxisType eAxisTyp

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/qa sc/source

2022-04-11 Thread Tomaž Vajngerl (via logerrit)
 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 c814a480842ccc47c5bb3ec00a1ca7cb0306be04
Author: Tomaž Vajngerl 
AuthorDate: Tue Mar 22 11:03:24 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Apr 12 01:25:00 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 
(cherry picked from commit af38d84380ee78f61822e8e080a56e955842b71e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132831
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 962e6cc1f2ea..ce01082c7294 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -666,7 +666,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 3fde00a7b414..ca9826750a19 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -480,6 +480,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();
+
+  

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/Library_sc.mk sc/qa sc/source

2022-04-11 Thread Tomaž Vajngerl (via logerrit)
 sc/Library_sc.mk  |1 
 sc/inc/document.hxx   |1 
 sc/inc/globstr.hrc|2 
 sc/qa/unit/SparklineTest.cxx  |   69 ++-
 sc/source/core/data/document.cxx  |5 +
 sc/source/ui/docshell/docfunc.cxx |   16 +
 sc/source/ui/inc/docfunc.hxx  |2 
 sc/source/ui/inc/undo/UndoDeleteSparkline.hxx |   43 ++
 sc/source/ui/undo/UndoDeleteSparkline.cxx |   76 ++
 9 files changed, 212 insertions(+), 3 deletions(-)

New commits:
commit f8a8cb5a752a10dba24adfb2b8387971a9b97003
Author: Tomaž Vajngerl 
AuthorDate: Mon Mar 21 17:26:30 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Apr 12 01:24:39 2022 +0200

sc: add Undo/Redo for deleting a Sparkline

Adds the code to delete the Sparkline via DocFunc + test.

Change-Id: I710a1ee59a5fe5f2bfb91f8bf487501ef39ce949
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132475
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 20ed714f87dd22e5f11a65c4208045037dc20017)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132830
Tested-by: Tomaž Vajngerl 

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 55dafe7fa85c..5e4da178dacf 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -549,6 +549,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/undo/undotab \
 sc/source/ui/undo/undoutil \
 sc/source/ui/undo/UndoInsertSparkline \
+sc/source/ui/undo/UndoDeleteSparkline \
 sc/source/ui/unoobj/ChartRangeSelectionListener \
 sc/source/ui/unoobj/addruno \
 sc/source/ui/unoobj/afmtuno \
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a79584f3e7a6..f301105881e2 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1242,6 +1242,7 @@ public:
 
 /** Spaklines */
 SC_DLLPUBLIC std::shared_ptr GetSparkline(ScAddress const & 
rPosition);
+SC_DLLPUBLIC bool HasSparkline(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/globstr.hrc b/sc/inc/globstr.hrc
index e305b7c037f9..abb896a33bcf 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -540,6 +540,8 @@
 #define STR_HYPHENATECELL_OFF   NC_("STR_HYPHENATECELL_OFF", 
"Hyphenate: Off")
 #define STR_INDENTCELL  NC_("STR_INDENTCELL", "Indent: 
")
 #define STR_UNDO_INSERT_SPARKLINE_GROUP 
NC_("STR_UNDO_INSERT_SPARKLINE", "Insert Sparkline Group")
+#define STR_UNDO_DELETE_SPARKLINE   
NC_("STR_UNDO_DELETE_SPARKLINE", "Delete Sparkline")
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/SparklineTest.cxx b/sc/qa/unit/SparklineTest.cxx
index 7fafeef861ef..6173cea5f297 100644
--- a/sc/qa/unit/SparklineTest.cxx
+++ b/sc/qa/unit/SparklineTest.cxx
@@ -47,17 +47,19 @@ public:
 }
 
 void testAddSparkline();
-void testDeleteSprkline();
+void testClearContentSprkline();
 void testCopyPasteSparkline();
 void testCutPasteSparkline();
 void testUndoRedoInsertSparkline();
+void testUndoRedoDeleteSparkline();
 
 CPPUNIT_TEST_SUITE(SparklineTest);
 CPPUNIT_TEST(testAddSparkline);
-CPPUNIT_TEST(testDeleteSprkline);
+CPPUNIT_TEST(testClearContentSprkline);
 CPPUNIT_TEST(testCopyPasteSparkline);
 CPPUNIT_TEST(testCutPasteSparkline);
 CPPUNIT_TEST(testUndoRedoInsertSparkline);
+CPPUNIT_TEST(testUndoRedoDeleteSparkline);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -117,7 +119,7 @@ void SparklineTest::testAddSparkline()
 xDocSh->DoClose();
 }
 
-void SparklineTest::testDeleteSprkline()
+void SparklineTest::testClearContentSprkline()
 {
 ScDocShellRef xDocSh = loadEmptyDocument();
 CPPUNIT_ASSERT(xDocSh);
@@ -288,6 +290,67 @@ void SparklineTest::testUndoRedoInsertSparkline()
 xDocSh->DoClose();
 }
 
+void SparklineTest::testUndoRedoDeleteSparkline()
+{
+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_s

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/Library_sc.mk sc/qa sc/source

2022-04-11 Thread Tomaž Vajngerl (via logerrit)
 sc/Library_sc.mk  |2 
 sc/inc/SparklineData.hxx  |   42 +++
 sc/inc/globstr.hrc|2 
 sc/qa/unit/SparklineTest.cxx  |   78 ++---
 sc/source/ui/dialogs/SparklineDialog.cxx  |   95 ++
 sc/source/ui/docshell/docfunc.cxx |   82 ++
 sc/source/ui/inc/docfunc.hxx  |7 +
 sc/source/ui/inc/undo/UndoInsertSparkline.hxx |   45 
 sc/source/ui/sparklines/SparklineData.cxx |   30 
 sc/source/ui/undo/UndoInsertSparkline.cxx |   78 +
 10 files changed, 364 insertions(+), 97 deletions(-)

New commits:
commit a0f78cd698601f01761ce664e2dbba5a9fb37e1a
Author: Tomaž Vajngerl 
AuthorDate: Sun Mar 20 20:49:18 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Apr 12 01:24:18 2022 +0200

sc: add Undo/Redo for inserting Sparklines

Move the code to insert a sparkline from the SparklineDialog to
DocFunc and inside the UndoInsertSparkline, so there is no code
duplication and the code can be tested.

Change-Id: I85f4020190ae835b33e706ec9cb2cda9fd6fc752
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132474
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 54536bca332651051dc8a5ba02995c069cb75fd2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132829
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 8f301a537f85..55dafe7fa85c 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -510,6 +510,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/sidebar/NumberFormatControl \
 sc/source/ui/sidebar/NumberFormatPropertyPanel \
 sc/source/ui/sidebar/ScPanelFactory \
+sc/source/ui/sparklines/SparklineData \
 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog \
 sc/source/ui/StatisticsDialogs/CorrelationDialog \
 sc/source/ui/StatisticsDialogs/CovarianceDialog \
@@ -547,6 +548,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/undo/undostyl \
 sc/source/ui/undo/undotab \
 sc/source/ui/undo/undoutil \
+sc/source/ui/undo/UndoInsertSparkline \
 sc/source/ui/unoobj/ChartRangeSelectionListener \
 sc/source/ui/unoobj/addruno \
 sc/source/ui/unoobj/afmtuno \
diff --git a/sc/inc/SparklineData.hxx b/sc/inc/SparklineData.hxx
new file mode 100644
index ..80cc8a0329c2
--- /dev/null
+++ b/sc/inc/SparklineData.hxx
@@ -0,0 +1,42 @@
+/* -*- 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 "address.hxx"
+#include "scdllapi.h"
+
+namespace sc
+{
+struct SC_DLLPUBLIC SparklineData
+{
+ScAddress maPosition;
+ScRange maData;
+
+SparklineData(ScAddress const& rPosition, ScRange const& rData)
+: maPosition(rPosition)
+, maData(rData)
+{
+}
+};
+
+enum class RangeOrientation
+{
+Unknown,
+Row,
+Col
+};
+
+SC_DLLPUBLIC RangeOrientation calculateOrientation(sal_Int32 nOutputSize,
+   ScRange const& rInputRange);
+
+} // end sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 44776504b47e..e305b7c037f9 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -539,7 +539,7 @@
 #define STR_HYPHENATECELL_ONNC_("STR_HYPHENATECELL_ON", 
"Hyphenate: On")
 #define STR_HYPHENATECELL_OFF   NC_("STR_HYPHENATECELL_OFF", 
"Hyphenate: Off")
 #define STR_INDENTCELL  NC_("STR_INDENTCELL", "Indent: 
")
-
+#define STR_UNDO_INSERT_SPARKLINE_GROUP 
NC_("STR_UNDO_INSERT_SPARKLINE", "Insert Sparkline Group")
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/SparklineTest.cxx b/sc/qa/unit/SparklineTest.cxx
index 167c4e4d9e3d..7fafeef861ef 100644
--- a/sc/qa/unit/SparklineTest.cxx
+++ b/sc/qa/unit/SparklineTest.cxx
@@ -11,6 +11,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 
@@ -21,8 +23,6 @@ class SparklineTest : public ScBootstrapFixture
 private:
 uno::Reference m_xCalcComponent;
 
-sc::Sparkline* createTestSparkline(ScDocument& rDocument);
-
 public:
 SparklineTest()
 : ScBootstrapFixture("sc/qa/unit/data")
@@ -50,29 +50,38 @@ public:
 void testDeleteSprkline();
 void testCopyPasteSparkline();
 void testCutPasteSparkline();
+void testUndoRedoInsertSparkline();
 
 CPPUNIT_TEST_SUITE(SparklineTest);
 CPPUNIT_TEST(testAddSparkline);
 CPPUNIT_TES

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc

2022-04-11 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/Sparkline.hxx |8 
 sc/inc/SparklineCell.hxx |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit da69d021d8b0d20ae35ddc9cad82bc77558e4bd5
Author: Tomaž Vajngerl 
AuthorDate: Sat Mar 19 10:39:20 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Apr 12 01:23:01 2022 +0200

sc: make getters const in SparklineCell and Sparkline classes

Change-Id: Ia0bc1d4bd7da834da3640f34bfdb744dd2ddeba2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132471
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 05032132786b8dfc5cfda6b782acf85cb4d39be9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132794
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/Sparkline.hxx b/sc/inc/Sparkline.hxx
index 9a6109e96e79..e0fbbe125bc7 100644
--- a/sc/inc/Sparkline.hxx
+++ b/sc/inc/Sparkline.hxx
@@ -45,13 +45,13 @@ public:
 
 void setInputRange(ScRangeList const& rInputRange) { m_aInputRange = 
rInputRange; }
 
-ScRangeList const& getInputRange() { return m_aInputRange; }
+ScRangeList const& getInputRange() const { return m_aInputRange; }
 
-std::shared_ptr const& getSparklineGroup() { return 
m_pSparklineGroup; }
+std::shared_ptr const& getSparklineGroup() const { return 
m_pSparklineGroup; }
 
-SCCOL getColumn() { return m_nColumn; }
+SCCOL getColumn() const { return m_nColumn; }
 
-SCROW getRow() { return m_nRow; }
+SCROW getRow() const { return m_nRow; }
 };
 
 /** Contains a list of all created sparklines */
diff --git a/sc/inc/SparklineCell.hxx b/sc/inc/SparklineCell.hxx
index 0aca857170c9..0588646866c4 100644
--- a/sc/inc/SparklineCell.hxx
+++ b/sc/inc/SparklineCell.hxx
@@ -34,12 +34,12 @@ public:
 
 ScRangeList const& getInputRange() { return m_pSparkline->getInputRange(); 
}
 
-std::shared_ptr const& getSparklineGroup()
+std::shared_ptr const& getSparklineGroup() const
 {
 return m_pSparkline->getSparklineGroup();
 }
 
-std::shared_ptr const& getSparkline() { return m_pSparkline; }
+std::shared_ptr const& getSparkline() const { return 
m_pSparkline; }
 };
 
 } // end sc


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc

2022-04-10 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/SparklineGroup.hxx |   27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

New commits:
commit d076da9d3d9a66ad3f1c28ee2688b9040e8a6ade
Author: Tomaž Vajngerl 
AuthorDate: Fri Mar 4 17:26:34 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 11 01:58:54 2022 +0200

sc: set default parameters in SparklineGroup

The colors are set to COL_TRANSPARENT except for the series color,
which is set to COL_BLUE by default. Other parameters are set to
their default values according to OOXML specs.

Change-Id: I67ceab2ffd723511fbf0616cca661992f0a8cf69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131920
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit a6a0b8cde3fa8673ea5ded216f9e007a496c9a88)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132775
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/SparklineGroup.hxx b/sc/inc/SparklineGroup.hxx
index b06dd3e7a8d5..c6df94e1bdc5 100644
--- a/sc/inc/SparklineGroup.hxx
+++ b/sc/inc/SparklineGroup.hxx
@@ -78,7 +78,32 @@ public:
 std::optional m_aManualMin; // if m_sMaxAxisType is "custom"
 OUString m_sUID;
 
-SparklineGroup() {}
+SparklineGroup()
+: m_aColorSeries(COL_BLUE)
+, m_aColorNegative(COL_TRANSPARENT)
+, m_aColorAxis(COL_TRANSPARENT)
+, m_aColorMarkers(COL_TRANSPARENT)
+, m_aColorFirst(COL_TRANSPARENT)
+, m_aColorLast(COL_TRANSPARENT)
+, m_aColorHigh(COL_TRANSPARENT)
+, m_aColorLow(COL_TRANSPARENT)
+, m_eMinAxisType(AxisType::Individual)
+, m_eMaxAxisType(AxisType::Individual)
+, m_fLineWeight(0.75)
+, m_eType(SparklineType::Line)
+, m_bDateAxis(false)
+, m_eDisplayEmptyCellsAs(DisplayEmptyCellAs::Zero)
+, m_bMarkers(false)
+, m_bHigh(false)
+, m_bLow(false)
+, m_bFirst(false)
+, m_bLast(false)
+, m_bNegative(false)
+, m_bDisplayXAxis(false)
+, m_bDisplayHidden(false)
+, m_bRightToLeft(false)
+{
+}
 
 SparklineGroup(const SparklineGroup&) = delete;
 SparklineGroup& operator=(const SparklineGroup&) = delete;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/Library_sc.mk sc/source

2022-04-10 Thread Tomaž Vajngerl (via logerrit)
 sc/Library_sc.mk  |1 
 sc/inc/Sparkline.hxx  |   52 --
 sc/inc/SparklineCell.hxx  |   47 ++
 sc/inc/column.hxx |4 +-
 sc/inc/document.hxx   |4 ++
 sc/inc/mtvelements.hxx|6 ++--
 sc/inc/table.hxx  |9 ++
 sc/source/core/data/Sparkline.cxx |   22 
 sc/source/core/data/column2.cxx   |8 ++---
 sc/source/core/data/document.cxx  |   34 +++-
 sc/source/core/data/table2.cxx|   37 +++
 11 files changed, 176 insertions(+), 48 deletions(-)

New commits:
commit d5cbeb9e471e3c3e060b3c1f12d88b921a12083e
Author: Tomaž Vajngerl 
AuthorDate: Wed Mar 2 17:44:08 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 11 01:58:43 2022 +0200

sc: refactor sparkline struture to store a list of sparklines

We need to access a list of sparklines and sparkline groups for
a sheet. To preven going through all the columns of a sheet, we
need to store all the created sparklines in a list. For this it
is necessary to change the model structrue a bit. A cell now has
a container that stores a shared_ptr to the sparkline instead of
storing the sparkline directly. With this we can store a list
of weak_ptr to the sparklines in a list (vector), which can be
accessed at any time and is quite fast.

This is needed by the OOXML export.

Change-Id: Iaca0a41e20912775f072ea6e8cab9c44367d6f30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131919
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 4e37bb2e7b7c84457e2f44e3a9a0d47b96a603af)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132774
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index af6d75c93a8f..3c8dcb3e5085 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -184,7 +184,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/sheetevents \
 sc/source/core/data/simpleformulacalc \
 sc/source/core/data/sortparam \
-sc/source/core/data/Sparkline \
 sc/source/core/data/stlpool \
 sc/source/core/data/stlsheet \
 sc/source/core/data/subtotalparam \
diff --git a/sc/inc/Sparkline.hxx b/sc/inc/Sparkline.hxx
index 0c5a9deeb774..5ba9d397d083 100644
--- a/sc/inc/Sparkline.hxx
+++ b/sc/inc/Sparkline.hxx
@@ -25,20 +25,68 @@ namespace sc
  */
 class SC_DLLPUBLIC Sparkline
 {
-private:
+SCCOL m_nColumn;
+SCROW m_nRow;
+
 ScRangeList m_aInputRange;
 std::shared_ptr m_pSparklineGroup;
 
 public:
-Sparkline(std::shared_ptr& pSparklineGroup);
+Sparkline(SCCOL nColumn, SCROW nRow, std::shared_ptr 
const& pSparklineGroup)
+: m_nColumn(nColumn)
+, m_nRow(nRow)
+, m_pSparklineGroup(pSparklineGroup)
+{
+}
 
 Sparkline(const Sparkline&) = delete;
 Sparkline& operator=(const Sparkline&) = delete;
 
 void setInputRange(ScRangeList const& rInputRange) { m_aInputRange = 
rInputRange; }
+
 ScRangeList const& getInputRange() { return m_aInputRange; }
 
 std::shared_ptr const& getSparklineGroup() { return 
m_pSparklineGroup; }
+
+SCCOL getColumn() { return m_nColumn; }
+
+SCROW getRow() { 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
diff --git a/sc/inc/SparklineCell.hxx b/sc/inc/SparklineCell.hxx
new file mode 100644
index ..0aca857170c9
--- /dev/null
+++ b/sc/inc/SparklineCell.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 "Sparkline.hxx"
+#include 
+
+namespace sc
+{
+class SC_DLLPUBLIC SparklineCell
+{
+private:
+std::shared_ptr m_pSparkline;
+
+public:
+SparklineCell(std::shared_ptr const& pSparkline)
+   

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/source

2022-04-10 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/SparklineGroup.hxx  |   35 +++
 sc/source/filter/inc/SparklineFragment.hxx |   43 +++---
 sc/source/filter/oox/SparklineFragment.cxx |   88 ++---
 3 files changed, 114 insertions(+), 52 deletions(-)

New commits:
commit 38e241141426dac71093dac0dad36742b79adda5
Author: Tomaž Vajngerl 
AuthorDate: Wed Feb 23 10:06:20 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Apr 10 15:31:50 2022 +0200

sc: write the OOXML Sparkline props. to the model

This moves the properties read during the OOXML import into the
SparlineGroup class (the document model), so a sparkline can
be connected with the properties.

Change-Id: I09ecf560f1870624cb984722bdb8ee306d839dfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131163
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit c4e0fd8dd682820c7daed1b7043e0612696ed513)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132548
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/inc/SparklineGroup.hxx b/sc/inc/SparklineGroup.hxx
index 6d98e1b2dcbf..d130084fd121 100644
--- a/sc/inc/SparklineGroup.hxx
+++ b/sc/inc/SparklineGroup.hxx
@@ -11,6 +11,7 @@
 #pragma once
 
 #include "scdllapi.h"
+#include 
 #include 
 
 namespace sc
@@ -19,6 +20,40 @@ namespace sc
 class SC_DLLPUBLIC SparklineGroup
 {
 public:
+Color m_aColorSeries;
+Color m_aColorNegative;
+Color m_aColorAxis;
+Color m_aColorMarkers;
+Color m_aColorFirst;
+Color m_aColorLast;
+Color m_aColorHigh;
+Color m_aColorLow;
+
+OUString m_sMinAxisType; // individual, group, custom
+OUString m_sMaxAxisType; // individual, group, custom
+
+double m_fLineWeight; // In pt
+
+OUString m_sType; // line, column, stacked
+
+bool m_bDateAxis;
+
+OUString m_sDisplayEmptyCellsAs; // span, gap, zero
+
+bool m_bMarkers;
+bool m_bHigh;
+bool m_bLow;
+bool m_bFirst;
+bool m_bLast;
+bool m_bNegative;
+bool m_bDisplayXAxis;
+bool m_bDisplayHidden;
+bool m_bRightToLeft;
+
+std::optional m_aManualMax; // if m_sMinAxisType is "custom"
+std::optional m_aManualMin; // if m_sMaxAxisType is "custom"
+OUString m_sUID;
+
 SparklineGroup() {}
 
 SparklineGroup(const SparklineGroup&) = delete;
diff --git a/sc/source/filter/inc/SparklineFragment.hxx 
b/sc/source/filter/inc/SparklineFragment.hxx
index 36a7b5ca9f05..de1f9ae7ebda 100644
--- a/sc/source/filter/inc/SparklineFragment.hxx
+++ b/sc/source/filter/inc/SparklineFragment.hxx
@@ -11,10 +11,10 @@
 
 #include "excelhandlers.hxx"
 #include 
+#include 
 
 #include 
 #include 
-#include 
 
 namespace oox
 {
@@ -36,40 +36,15 @@ class SparklineGroup
 private:
 std::vector m_aSparklines;
 
-public:
-Color m_aColorSeries;
-Color m_aColorNegative;
-Color m_aColorAxis;
-Color m_aColorMarkers;
-Color m_aColorFirst;
-Color m_aColorLast;
-Color m_aColorHigh;
-Color m_aColorLow;
-
-OUString m_sMinAxisType; // individual, group, custom
-OUString m_sMaxAxisType;
-
-double m_fLineWeight; // In pt
-
-OUString m_sType; // line, column, stacked
+std::shared_ptr m_pSparklineGroup;
 
-bool m_bDateAxis;
-
-OUString m_sDisplayEmptyCellsAs; // span, gap, zero
-
-bool m_bMarkers;
-bool m_bHigh;
-bool m_bLow;
-bool m_bFirst;
-bool m_bLast;
-bool m_bNegative;
-bool m_bDisplayXAxis;
-bool m_bDisplayHidden;
-bool m_bRightToLeft;
+public:
+SparklineGroup()
+: m_pSparklineGroup(new sc::SparklineGroup())
+{
+}
 
-std::optional m_aManualMax;
-std::optional m_aManualMin;
-OUString m_sUID;
+std::shared_ptr getSparklineGroup() { return 
m_pSparklineGroup; }
 
 std::vector& getSparklines() { return m_aSparklines; }
 };
@@ -87,6 +62,8 @@ public:
 void onStartElement(const AttributeList& rAttribs) override;
 void onCharacters(const OUString& rCharacters) override;
 void onEndElement() override;
+
+void insertSparkline(SparklineGroup& rSparklineGroup, Sparkline& 
rSparkline);
 };
 
 } //namespace oox::xls
diff --git a/sc/source/filter/oox/SparklineFragment.cxx 
b/sc/source/filter/oox/SparklineFragment.cxx
index a743b886b7db..bfc5a259a883 100644
--- a/sc/source/filter/oox/SparklineFragment.cxx
+++ b/sc/source/filter/oox/SparklineFragment.cxx
@@ -15,6 +15,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 using ::oox::core::ContextHandlerRef;
 
@@ -22,51 +24,74 @@ namespace oox::xls
 {
 namespace
 {
-Color getColor(const AttributeList& rAttribs)
+// TODO: deduplicate with importOOXColor
+::Color getColor(const AttributeList& rAttribs, ThemeBuffer const& 
rThemeBuffer)
 {
 if (rAttribs.hasAttribute(XML_rgb))
 {
-return Color(ColorTransparency,
- rAttribs.getIntegerHex(XML_rgb, 
sal_Int32(API_RGB_TRANSPARENT)));
+return ::Color(ColorAlpha, rAttribs.getIntegerHex(XML_rgb, 
sal_Int

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc sc/Library_sc.mk sc/source

2022-04-10 Thread Tomaž Vajngerl (via logerrit)
 sc/Library_sc.mk  |1 
 sc/inc/Sparkline.hxx  |   46 ++
 sc/inc/SparklineGroup.hxx |   30 
 sc/inc/column.hxx |   10 +++-
 sc/inc/document.hxx   |7 +
 sc/inc/mtvelements.hxx|   16 ++---
 sc/source/core/data/Sparkline.cxx |   22 ++
 sc/source/core/data/column.cxx|5 
 sc/source/core/data/column2.cxx   |   10 
 sc/source/core/data/column3.cxx   |3 ++
 sc/source/core/data/document.cxx  |   27 ++
 11 files changed, 173 insertions(+), 4 deletions(-)

New commits:
commit 7f9955054a33a78c595a5b0634aa3514fc1c0787
Author: Tomaž Vajngerl 
AuthorDate: Wed Feb 23 09:52:50 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Apr 10 15:31:30 2022 +0200

sc: add Sparkline to the model as a column multi_type_vector

This adds a Sparkline class and a SparklineGroup class. The
Sparkline class is added to a cell, and the SparklineGroup
is referenced by the Sparkline, so multiple Sparklines can
share the same properties.

Change-Id: Id309ded34bfa7a35c1be43f7c0543d88594e66ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131162
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit e51784458bc46411d739877707f7952dd6808fa2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132547

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 3c8dcb3e5085..af6d75c93a8f 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -184,6 +184,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/sheetevents \
 sc/source/core/data/simpleformulacalc \
 sc/source/core/data/sortparam \
+sc/source/core/data/Sparkline \
 sc/source/core/data/stlpool \
 sc/source/core/data/stlsheet \
 sc/source/core/data/subtotalparam \
diff --git a/sc/inc/Sparkline.hxx b/sc/inc/Sparkline.hxx
new file mode 100644
index ..c8bb4d1baa22
--- /dev/null
+++ b/sc/inc/Sparkline.hxx
@@ -0,0 +1,46 @@
+/* -*- 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 "SparklineGroup.hxx"
+#include "rangelst.hxx"
+#include 
+
+namespace sc
+{
+/** Sparkline data, used for rendering the content of a cell
+ *
+ * Contains the input range of the data that is being drawn and a reference
+ * to the SparklineGroup, which inclues common properties of multiple
+ * sparklines.
+ */
+class SC_DLLPUBLIC Sparkline
+{
+private:
+ScRangeList m_aInputRange;
+std::shared_ptr m_pSparklineGroup;
+
+public:
+Sparkline(std::shared_ptr& pSparklineGroup);
+
+Sparkline(const Sparkline&) = delete;
+Sparkline& operator=(const Sparkline&) = delete;
+
+void setInputRange(ScRangeList const& rInputRange) { m_aInputRange = 
rInputRange; }
+ScRangeList const& getInputRange() { return m_aInputRange; }
+
+std::shared_ptr const& getSparklineGroup() { return 
m_pSparklineGroup; }
+};
+
+} // end sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/SparklineGroup.hxx b/sc/inc/SparklineGroup.hxx
new file mode 100644
index ..6d98e1b2dcbf
--- /dev/null
+++ b/sc/inc/SparklineGroup.hxx
@@ -0,0 +1,30 @@
+/* -*- 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 
+
+namespace sc
+{
+/** Common properties for a group of sparklines */
+class SC_DLLPUBLIC SparklineGroup
+{
+public:
+SparklineGroup() {}
+
+SparklineGroup(const SparklineGroup&) = delete;
+SparklineGroup& operator=(const SparklineGroup&) = delete;
+};
+
+} // end sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 6cb2311de112..40b5f71ee3d4 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -65,6 +65,7 @@ class CompileFormulaContext;
 struct SetFormulaDirtyContext;
 enum class MatrixEdge;
 class ColumnIterator;
+class Sparkline;
 
 }
 
@@ -99,7 +100,7 @@ struct ScInterpreterContext;
 
 struct ScNeededSizeOptions
 {
-const ScPatternAttr*pPattern;
+const ScPatternAttr* pPattern;
 boolbFormula;
 boolbSkipMerged;
 boolbGetFont;
@@ -185,6 +186,9 @@ class ScColumn : protected ScColumnData
 // Cell values

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc

2022-02-17 Thread Stephan Bergmann (via logerrit)
 sc/inc/arraysumfunctor.hxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5f3789235fa90fa2e3e2f67620dcf28ff902aafa
Author: Stephan Bergmann 
AuthorDate: Fri Feb 11 11:20:50 2022 +0100
Commit: Tor Lillqvist 
CommitDate: Thu Feb 17 12:59:39 2022 +0200

Avoid warning C4702: unreachable code

> 
C:\cygwin\home\tdf\lode\jenkins\workspace\lo_tb_master_win64_dbg\sc\inc\arraysumfunctor.hxx(75)
 : error C2220: the following warning is treated as an error
> 
C:\cygwin\home\tdf\lode\jenkins\workspace\lo_tb_master_win64_dbg\sc\inc\arraysumfunctor.hxx(75)
 : warning C4702: unreachable code

()

Change-Id: I27a66176717b293d60f98f82f06ec5ce7a28e6c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129812
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx
index eecfa59c3f65..c261c120addf 100644
--- a/sc/inc/arraysumfunctor.hxx
+++ b/sc/inc/arraysumfunctor.hxx
@@ -71,8 +71,9 @@ static inline KahanSum executeFast(size_t& i, size_t nSize, 
const double* pCurre
 {
 #if SC_USE_SSE2
 return executeSSE2(i, nSize, pCurrent);
-#endif
+#else
 return executeUnrolled(i, nSize, pCurrent);
+#endif
 }
 
 /**