[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/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