sc/inc/SparklineGroup.hxx                |   14 
 sc/inc/column.hxx                        |    2 
 sc/inc/document.hxx                      |    1 
 sc/inc/global.hxx                        |    7 
 sc/inc/mtvelements.hxx                   |    2 
 sc/inc/table.hxx                         |    1 
 sc/source/core/data/column2.cxx          |   18 +
 sc/source/core/data/column3.cxx          |    6 
 sc/source/core/data/document.cxx         |   14 
 sc/source/core/data/table2.cxx           |   10 
 sc/source/ui/dialogs/SparklineDialog.cxx |  113 ++++++
 sc/source/ui/inc/SparklineDialog.hxx     |   28 +
 sc/uiconfig/scalc/ui/sparklinedialog.ui  |  501 ++++++++++++++++++++++++++++++-
 13 files changed, 696 insertions(+), 21 deletions(-)

New commits:
commit 744722123a8ce3d3c30583ba1285a21e129b471f
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Tue Mar 15 15:18:16 2022 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Apr 3 09:07:19 2022 +0200

    sc: support deleting a Sparkline with 'Clear Content' function
    
    Change-Id: Ida61b402170238fb0505c777e49954c15d376cf0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132467
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 372aef84c24e..36ea217a481a 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -666,6 +666,8 @@ public:
     // Spaklines
     sc::SparklineCell* GetSparklineCell(SCROW nRow);
     void CreateSparklineCell(SCROW nRow, std::shared_ptr<sc::Sparkline> const& 
pSparkline);
+    void DeleteSparklineCells(sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, 
SCROW nRow2);
+    bool DeleteSparkline(SCROW nRow);
 
     // cell notes
     ScPostIt* GetCellNote( SCROW nRow );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 84199c00de4c..420c0eb06e35 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1252,6 +1252,7 @@ public:
     SC_DLLPUBLIC sc::Sparkline* GetSparkline(ScAddress const & rPosition);
     SC_DLLPUBLIC sc::Sparkline* CreateSparkline(ScAddress const & rPosition, 
std::shared_ptr<sc::SparklineGroup> const& pSparklineGroup);
     SC_DLLPUBLIC sc::SparklineList* GetSparklineList(SCTAB nTab);
+    SC_DLLPUBLIC bool DeleteSparkline(ScAddress const& rPosition);
 
     /** Notes **/
     SC_DLLPUBLIC ScPostIt*       GetNote(const ScAddress& rPos);
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 5c6293432b67..decf343154ae 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -157,19 +157,20 @@ enum class InsertDeleteFlags : sal_uInt16
     OBJECTS          = 0x0080,   /// Drawing objects.
     EDITATTR         = 0x0100,   /// Rich-text attributes.
     OUTLINE          = 0x0800,   /// Sheet / outlining (grouping) information
+    SPARKLINES       = 0x4000,   /// Sparklines in a cell.
     NOCAPTIONS       = 0x0200,   /// Internal use only (undo etc.): do not 
copy/delete caption objects of cell notes.
     ADDNOTES         = 0x0400,   /// Internal use only (copy from clip): do 
not delete existing cell contents when pasting notes.
     SPECIAL_BOOLEAN  = 0x1000,
     FORGETCAPTIONS   = 0x2000,   /// Internal use only (d&d undo): do not 
delete caption objects of cell notes.
     ATTRIB           = HARDATTR | STYLES,
-    CONTENTS         = VALUE | DATETIME | STRING | NOTE | FORMULA | OUTLINE,
-    ALL              = CONTENTS | ATTRIB | OBJECTS,
+    CONTENTS         = VALUE | DATETIME | STRING | NOTE | FORMULA | OUTLINE | 
SPARKLINES,
+    ALL              = CONTENTS | ATTRIB | OBJECTS | SPARKLINES,
     /// Copy flags for auto/series fill functions: do not touch notes and 
drawing objects.
     AUTOFILL         = ALL & ~(NOTE | OBJECTS)
 };
 namespace o3tl
 {
-    template<> struct typed_flags<InsertDeleteFlags> : 
is_typed_flags<InsertDeleteFlags, 0x3fff> {};
+    template<> struct typed_flags<InsertDeleteFlags> : 
is_typed_flags<InsertDeleteFlags, 0x7fff> {};
 }
 // This doesn't work at the moment, perhaps when we have constexpr we can 
modify InsertDeleteFlags to make it work.
 //static_assert((InsertDeleteFlags::ATTRIB & InsertDeleteFlags::CONTENTS) == 
InsertDeleteFlags::NONE, "these must match");
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index ee669c0a6e6b..72f65d2b72ff 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -142,6 +142,7 @@ typedef mdds::mtv::soa::multi_type_vector<CellFunc, 
CellStoreTrait> CellStoreTyp
 struct ColumnBlockPosition
 {
     CellNoteStoreType::iterator miCellNotePos;
+    SparklineStoreType::iterator miSparklinePos;
     BroadcasterStoreType::iterator miBroadcasterPos;
     CellTextAttrStoreType::iterator miCellTextAttrPos;
     CellStoreType::iterator miCellPos;
@@ -152,6 +153,7 @@ struct ColumnBlockPosition
 struct ColumnBlockConstPosition
 {
     CellNoteStoreType::const_iterator miCellNotePos;
+    SparklineStoreType::const_iterator miSparklinePos;
     CellTextAttrStoreType::const_iterator miCellTextAttrPos;
     CellStoreType::const_iterator miCellPos;
 
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 996f9a579d70..00ae196f88ab 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -474,6 +474,7 @@ public:
 
     sc::Sparkline* GetSparkline(SCCOL nCol, SCROW nRow);
     sc::Sparkline* CreateSparkline(SCCOL nCol, SCROW nRow, 
std::shared_ptr<sc::SparklineGroup> const& pSparklineGroup);
+    bool DeleteSparkline(SCCOL nCol, SCROW nRow);
 
     sc::SparklineList& GetSparklineList();
 
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 1f0ca6aad9d2..b010cdb7aa73 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1971,6 +1971,8 @@ void ScColumn::PrepareBroadcastersForDestruction()
     }
 }
 
+// Sparklines
+
 sc::SparklineCell* ScColumn::GetSparklineCell(SCROW nRow)
 {
     return maSparklines.get<sc::SparklineCell*>(nRow);
@@ -1981,6 +1983,20 @@ void ScColumn::CreateSparklineCell(SCROW nRow, 
std::shared_ptr<sc::Sparkline> co
     maSparklines.set(nRow, new sc::SparklineCell(pSparkline));
 }
 
+void ScColumn::DeleteSparklineCells(sc::ColumnBlockPosition& rBlockPos, SCROW 
nRow1, SCROW nRow2)
+{
+    rBlockPos.miSparklinePos = 
maSparklines.set_empty(rBlockPos.miSparklinePos, nRow1, nRow2);
+}
+
+bool ScColumn::DeleteSparkline(SCROW nRow)
+{
+    if (!GetDoc().ValidRow(nRow))
+        return false;
+
+    maSparklines.set_empty(nRow, nRow);
+    return true;
+}
+
 namespace
 {
 struct BroadcasterNoListenersPredicate
@@ -2003,6 +2019,8 @@ void ScColumn::DeleteEmptyBroadcasters()
     mbEmptyBroadcastersPending = false;
 }
 
+// Notes
+
 ScPostIt* ScColumn::GetCellNote(SCROW nRow)
 {
     return maCellNotes.get<ScPostIt*>(nRow);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 4aa91b89d919..19d731c8b0c3 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -980,6 +980,11 @@ void ScColumn::DeleteArea(
         DeleteCellNotes(aBlockPos, nStartRow, nEndRow, 
bForgetCaptionOwnership);
     }
 
+    if (nDelFlag & InsertDeleteFlags::SPARKLINES)
+    {
+        DeleteSparklineCells(aBlockPos, nStartRow, nEndRow);
+    }
+
     if ( nDelFlag & InsertDeleteFlags::EDITATTR )
     {
         OSL_ENSURE( nContFlag == InsertDeleteFlags::NONE, "DeleteArea: Wrong 
Flags" );
@@ -1008,6 +1013,7 @@ void ScColumn::InitBlockPosition( 
sc::ColumnBlockPosition& rBlockPos )
     rBlockPos.miCellNotePos = maCellNotes.begin();
     rBlockPos.miCellTextAttrPos = maCellTextAttrs.begin();
     rBlockPos.miCellPos = maCells.begin();
+    rBlockPos.miSparklinePos = maSparklines.begin();
 }
 
 void ScColumn::InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) 
const
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 59d05432ae5c..512d82a02081 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6589,9 +6589,21 @@ sc::Sparkline* ScDocument::CreateSparkline(ScAddress 
const& rPosition, std::shar
     return nullptr;
 }
 
+bool ScDocument::DeleteSparkline(ScAddress const & rPosition)
+{
+    SCTAB nTab = rPosition.Tab();
+
+    if (TableExists(nTab))
+    {
+        return maTabs[nTab]->DeleteSparkline(rPosition.Col(), rPosition.Row());
+    }
+
+    return false;
+}
+
 sc::SparklineList* ScDocument::GetSparklineList(SCTAB nTab)
 {
-    if (ValidTab(nTab) && nTab < SCTAB(maTabs.size()))
+    if (TableExists(nTab))
     {
         return &maTabs[nTab]->GetSparklineList();
     }
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 2027ded8b430..99e2af025baf 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1839,6 +1839,16 @@ sc::Sparkline* ScTable::CreateSparkline(SCCOL nCol, 
SCROW nRow, std::shared_ptr<
     return pSparkline.get();
 }
 
+bool ScTable::DeleteSparkline(SCCOL nCol, SCROW nRow)
+{
+    if (!ValidCol(nCol) || nCol >= GetAllocatedColumnsCount())
+        return false;
+
+    aCol[nCol].DeleteSparkline(nRow);
+
+    return true;
+}
+
 sc::SparklineList& ScTable::GetSparklineList()
 {
     return maSparklineList;
commit 602f653a65f432e5f75acef8fef21189392a05e1
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Mar 12 23:30:40 2022 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Apr 3 09:06:59 2022 +0200

    sc: SparklineDialog add type, colors and properties
    
    Change-Id: Ie8243985d61cc719fd0444b0e1aaf18f43489d5c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132466
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/inc/SparklineGroup.hxx b/sc/inc/SparklineGroup.hxx
index c6df94e1bdc5..0d3935492d04 100644
--- a/sc/inc/SparklineGroup.hxx
+++ b/sc/inc/SparklineGroup.hxx
@@ -80,13 +80,13 @@ public:
 
     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_aColorNegative(COL_RED)
+        , m_aColorAxis(COL_RED)
+        , m_aColorMarkers(COL_RED)
+        , m_aColorFirst(COL_RED)
+        , m_aColorLast(COL_RED)
+        , m_aColorHigh(COL_RED)
+        , m_aColorLow(COL_RED)
         , m_eMinAxisType(AxisType::Individual)
         , m_eMaxAxisType(AxisType::Individual)
         , m_fLineWeight(0.75)
diff --git a/sc/source/ui/dialogs/SparklineDialog.cxx 
b/sc/source/ui/dialogs/SparklineDialog.cxx
index 5a167fe8b7c1..fac1d8274be5 100644
--- a/sc/source/ui/dialogs/SparklineDialog.cxx
+++ b/sc/source/ui/dialogs/SparklineDialog.cxx
@@ -12,6 +12,8 @@
 #include <Sparkline.hxx>
 #include <reffact.hxx>
 
+#include <svx/colorbox.hxx>
+
 namespace sc
 {
 SparklineDialog::SparklineDialog(SfxBindings* pBindings, SfxChildWindow* 
pChildWindow,
@@ -30,6 +32,30 @@ SparklineDialog::SparklineDialog(SfxBindings* pBindings, 
SfxChildWindow* pChildW
     , mxOutputRangeLabel(m_xBuilder->weld_label("output-range-label"))
     , mxOutputRangeEdit(new 
formula::RefEdit(m_xBuilder->weld_entry("output-range-edit")))
     , mxOutputRangeButton(new 
formula::RefButton(m_xBuilder->weld_button("output-range-button")))
+    , mxColorSeries(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-series"),
+                                     [pWindow] { return pWindow; }))
+    , mxColorNegative(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-negative"),
+                                       [pWindow] { return pWindow; }))
+    , mxColorMarker(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-marker"),
+                                     [pWindow] { return pWindow; }))
+    , mxColorHigh(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-high"),
+                                   [pWindow] { return pWindow; }))
+    , mxColorLow(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-low"),
+                                  [pWindow] { return pWindow; }))
+    , mxColorFirst(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-first"),
+                                    [pWindow] { return pWindow; }))
+    , mxColorLast(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-last"),
+                                   [pWindow] { return pWindow; }))
+    , mxCheckButtonNegative(m_xBuilder->weld_check_button("check-negative"))
+    , mxCheckButtonMarker(m_xBuilder->weld_check_button("check-marker"))
+    , mxCheckButtonHigh(m_xBuilder->weld_check_button("check-high"))
+    , mxCheckButtonLow(m_xBuilder->weld_check_button("check-low"))
+    , mxCheckButtonFirst(m_xBuilder->weld_check_button("check-first"))
+    , mxCheckButtonLast(m_xBuilder->weld_check_button("check-last"))
+    , mxRadioLine(m_xBuilder->weld_radio_button("line-radiobutton"))
+    , mxRadioColumn(m_xBuilder->weld_radio_button("column-radiobutton"))
+    , mxRadioStacked(m_xBuilder->weld_radio_button("stacked-radiobutton"))
+    , mpLocalSparklineGroup(new sc::SparklineGroup())
 {
     mxInputRangeEdit->SetReferences(this, mxInputRangeText.get());
     mxInputRangeButton->SetReferences(this, mxInputRangeEdit.get());
@@ -59,13 +85,60 @@ SparklineDialog::SparklineDialog(SfxBindings* pBindings, 
SfxChildWindow* pChildW
     mxInputRangeEdit->SetModifyHdl(aModifyLink);
     mxOutputRangeEdit->SetModifyHdl(aModifyLink);
 
-    mxOutputRangeEdit->GrabFocus();
+    Link<weld::Toggleable&, void> aRadioButtonLink
+        = LINK(this, SparklineDialog, SelectSparklineType);
+    mxRadioLine->connect_toggled(aRadioButtonLink);
+    mxRadioColumn->connect_toggled(aRadioButtonLink);
+    mxRadioStacked->connect_toggled(aRadioButtonLink);
+
+    Link<weld::Toggleable&, void> aLink = LINK(this, SparklineDialog, 
ToggleHandler);
+    mxCheckButtonNegative->connect_toggled(aLink);
+    mxCheckButtonMarker->connect_toggled(aLink);
+    mxCheckButtonHigh->connect_toggled(aLink);
+    mxCheckButtonLow->connect_toggled(aLink);
+    mxCheckButtonFirst->connect_toggled(aLink);
+    mxCheckButtonLast->connect_toggled(aLink);
+
+    setupValues(mpLocalSparklineGroup);
 
     GetRangeFromSelection();
+
+    mxOutputRangeEdit->GrabFocus();
 }
 
 SparklineDialog::~SparklineDialog() {}
 
+void SparklineDialog::setupValues(std::shared_ptr<sc::SparklineGroup> const& 
pSparklineGroup)
+{
+    switch (pSparklineGroup->m_eType)
+    {
+        case sc::SparklineType::Line:
+            mxRadioLine->set_active(true);
+            break;
+        case sc::SparklineType::Column:
+            mxRadioColumn->set_active(true);
+            break;
+        case sc::SparklineType::Stacked:
+            mxRadioStacked->set_active(true);
+            break;
+    }
+
+    mxColorSeries->SelectEntry(pSparklineGroup->m_aColorSeries);
+    mxColorNegative->SelectEntry(pSparklineGroup->m_aColorNegative);
+    mxColorMarker->SelectEntry(pSparklineGroup->m_aColorMarkers);
+    mxColorHigh->SelectEntry(pSparklineGroup->m_aColorHigh);
+    mxColorLow->SelectEntry(pSparklineGroup->m_aColorLow);
+    mxColorFirst->SelectEntry(pSparklineGroup->m_aColorFirst);
+    mxColorLast->SelectEntry(pSparklineGroup->m_aColorLast);
+
+    mxCheckButtonNegative->set_active(pSparklineGroup->m_bNegative);
+    mxCheckButtonMarker->set_active(pSparklineGroup->m_bMarkers);
+    mxCheckButtonHigh->set_active(pSparklineGroup->m_bHigh);
+    mxCheckButtonLow->set_active(pSparklineGroup->m_bLow);
+    mxCheckButtonFirst->set_active(pSparklineGroup->m_bFirst);
+    mxCheckButtonLast->set_active(pSparklineGroup->m_bLast);
+}
+
 void SparklineDialog::Close() { 
DoClose(sc::SparklineDialogWrapper::GetChildWindowId()); }
 
 void SparklineDialog::SetActive()
@@ -211,6 +284,32 @@ IMPL_LINK(SparklineDialog, ButtonClicked, weld::Button&, 
rButton, void)
     }
 }
 
+IMPL_LINK(SparklineDialog, ToggleHandler, weld::Toggleable&, rToggle, void)
+{
+    if (mxCheckButtonNegative.get() == &rToggle)
+        mpLocalSparklineGroup->m_bNegative = 
mxCheckButtonNegative->get_active();
+    if (mxCheckButtonMarker.get() == &rToggle)
+        mpLocalSparklineGroup->m_bMarkers = mxCheckButtonMarker->get_active();
+    if (mxCheckButtonHigh.get() == &rToggle)
+        mpLocalSparklineGroup->m_bHigh = mxCheckButtonHigh->get_active();
+    if (mxCheckButtonLow.get() == &rToggle)
+        mpLocalSparklineGroup->m_bLow = mxCheckButtonLow->get_active();
+    if (mxCheckButtonFirst.get() == &rToggle)
+        mpLocalSparklineGroup->m_bFirst = mxCheckButtonFirst->get_active();
+    if (mxCheckButtonLast.get() == &rToggle)
+        mpLocalSparklineGroup->m_bLast = mxCheckButtonLast->get_active();
+}
+
+IMPL_LINK_NOARG(SparklineDialog, SelectSparklineType, weld::Toggleable&, void)
+{
+    if (mxRadioLine->get_active())
+        mpLocalSparklineGroup->m_eType = sc::SparklineType::Line;
+    else if (mxRadioColumn->get_active())
+        mpLocalSparklineGroup->m_eType = sc::SparklineType::Column;
+    else if (mxRadioStacked->get_active())
+        mpLocalSparklineGroup->m_eType = sc::SparklineType::Stacked;
+}
+
 namespace
 {
 enum class RangeOrientation
@@ -257,7 +356,13 @@ bool SparklineDialog::checkValidInputOutput()
 
 void SparklineDialog::perform()
 {
-    auto pSparklineGroup = std::make_shared<sc::SparklineGroup>();
+    mpLocalSparklineGroup->m_aColorSeries = 
mxColorSeries->GetSelectEntryColor();
+    mpLocalSparklineGroup->m_aColorNegative = 
mxColorNegative->GetSelectEntryColor();
+    mpLocalSparklineGroup->m_aColorMarkers = 
mxColorMarker->GetSelectEntryColor();
+    mpLocalSparklineGroup->m_aColorHigh = mxColorHigh->GetSelectEntryColor();
+    mpLocalSparklineGroup->m_aColorLow = mxColorLow->GetSelectEntryColor();
+    mpLocalSparklineGroup->m_aColorFirst = mxColorFirst->GetSelectEntryColor();
+    mpLocalSparklineGroup->m_aColorLast = mxColorLast->GetSelectEntryColor();
 
     if (maOutputRange.aStart.Col() == maOutputRange.aEnd.Col())
     {
@@ -283,7 +388,7 @@ void SparklineDialog::perform()
                 aInputRangeSlice.aStart.SetCol(maInputRange.aStart.Col() + 
nIndex);
                 aInputRangeSlice.aEnd.SetCol(maInputRange.aStart.Col() + 
nIndex);
             }
-            auto* pCreated = mrDocument.CreateSparkline(aAddress, 
pSparklineGroup);
+            auto* pCreated = mrDocument.CreateSparkline(aAddress, 
mpLocalSparklineGroup);
             pCreated->setInputRange(aInputRangeSlice);
             nIndex++;
         }
@@ -313,7 +418,7 @@ void SparklineDialog::perform()
                 aInputRangeSlice.aStart.SetCol(maInputRange.aStart.Col() + 
nIndex);
                 aInputRangeSlice.aEnd.SetCol(maInputRange.aStart.Col() + 
nIndex);
             }
-            auto* pCreated = mrDocument.CreateSparkline(aAddress, 
pSparklineGroup);
+            auto* pCreated = mrDocument.CreateSparkline(aAddress, 
mpLocalSparklineGroup);
             pCreated->setInputRange(aInputRangeSlice);
             nIndex++;
         }
diff --git a/sc/source/ui/inc/SparklineDialog.hxx 
b/sc/source/ui/inc/SparklineDialog.hxx
index a4a03f33491d..2cd4f258d484 100644
--- a/sc/source/ui/inc/SparklineDialog.hxx
+++ b/sc/source/ui/inc/SparklineDialog.hxx
@@ -11,7 +11,9 @@
 
 #include <address.hxx>
 #include "anyrefdg.hxx"
-#include <viewdata.hxx>
+#include "viewdata.hxx"
+
+class ColorListBox;
 
 namespace sc
 {
@@ -38,6 +40,25 @@ private:
     std::unique_ptr<formula::RefEdit> mxOutputRangeEdit;
     std::unique_ptr<formula::RefButton> mxOutputRangeButton;
 
+    std::unique_ptr<ColorListBox> mxColorSeries;
+    std::unique_ptr<ColorListBox> mxColorNegative;
+    std::unique_ptr<ColorListBox> mxColorMarker;
+    std::unique_ptr<ColorListBox> mxColorHigh;
+    std::unique_ptr<ColorListBox> mxColorLow;
+    std::unique_ptr<ColorListBox> mxColorFirst;
+    std::unique_ptr<ColorListBox> mxColorLast;
+
+    std::unique_ptr<weld::CheckButton> mxCheckButtonNegative;
+    std::unique_ptr<weld::CheckButton> mxCheckButtonMarker;
+    std::unique_ptr<weld::CheckButton> mxCheckButtonHigh;
+    std::unique_ptr<weld::CheckButton> mxCheckButtonLow;
+    std::unique_ptr<weld::CheckButton> mxCheckButtonFirst;
+    std::unique_ptr<weld::CheckButton> mxCheckButtonLast;
+
+    std::unique_ptr<weld::RadioButton> mxRadioLine;
+    std::unique_ptr<weld::RadioButton> mxRadioColumn;
+    std::unique_ptr<weld::RadioButton> mxRadioStacked;
+
     void GetRangeFromSelection();
 
     DECL_LINK(ButtonClicked, weld::Button&, void);
@@ -46,7 +67,12 @@ private:
     DECL_LINK(LoseEditFocusHandler, formula::RefEdit&, void);
     DECL_LINK(LoseButtonFocusHandler, formula::RefButton&, void);
     DECL_LINK(RefInputModifyHandler, formula::RefEdit&, void);
+    DECL_LINK(ToggleHandler, weld::Toggleable&, void);
+    DECL_LINK(SelectSparklineType, weld::Toggleable&, void);
+
+    std::shared_ptr<sc::SparklineGroup> mpLocalSparklineGroup;
 
+    void setupValues(std::shared_ptr<sc::SparklineGroup> const& 
pSparklineGroup);
     void perform();
     bool checkValidInputOutput();
 
diff --git a/sc/uiconfig/scalc/ui/sparklinedialog.ui 
b/sc/uiconfig/scalc/ui/sparklinedialog.ui
index 85515462c323..f295023877bf 100644
--- a/sc/uiconfig/scalc/ui/sparklinedialog.ui
+++ b/sc/uiconfig/scalc/ui/sparklinedialog.ui
@@ -70,7 +70,7 @@
             <property name="expand">False</property>
             <property name="fill">True</property>
             <property name="pack-type">end</property>
-            <property name="position">0</property>
+            <property name="position">2</property>
           </packing>
         </child>
         <child>
@@ -84,10 +84,10 @@
               <object class="GtkGrid">
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
-                <property name="margin-start">6</property>
+                <property name="margin-start">12</property>
                 <property name="margin-end">6</property>
                 <property name="margin-top">6</property>
-                <property name="margin-bottom">7</property>
+                <property name="margin-bottom">6</property>
                 <property name="row-spacing">6</property>
                 <property name="column-spacing">6</property>
                 <child>
@@ -191,10 +191,501 @@
               </object>
             </child>
             <child type="label">
-              <object class="GtkLabel" id="label1">
+              <object class="GtkLabel" id="label-data">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="label" translatable="yes" 
context="SparklineDialog|label-data">Data</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame-properties">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="label-xalign">0</property>
+            <property name="shadow-type">none</property>
+            <child>
+              <!-- n-columns=6 n-rows=5 -->
+              <object class="GtkGrid">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="margin-start">12</property>
+                <property name="margin-end">6</property>
+                <property name="margin-top">6</property>
+                <property name="margin-bottom">6</property>
+                <property name="row-spacing">6</property>
+                <property name="column-spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label-series">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-series">Series:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="color-button-series"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label-negative">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-negative">Negative Points:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" 
target="color-button-negative"/>
+                      <relation type="label-for" target="check-negative"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="color-button-series">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-series"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">2</property>
+                    <property name="top-attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="color-button-negative">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-negative"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">2</property>
+                    <property name="top-attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="check-negative">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="image-position">right</property>
+                    <property name="always-show-image">True</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-negative"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label-low">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-low">Low Points:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="color-button-low"/>
+                      <relation type="label-for" target="check-low"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="color-button-high">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-high"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">2</property>
+                    <property name="top-attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="color-button-low">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-low"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">2</property>
+                    <property name="top-attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="check-low">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="image-position">right</property>
+                    <property name="always-show-image">True</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-low"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label-high">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-high">High Points:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="color-button-high"/>
+                      <relation type="label-for" target="check-high"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="check-high">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="image-position">right</property>
+                    <property name="always-show-image">True</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-high"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label-marker">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-marker">Marker:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="check-marker"/>
+                      <relation type="label-for" target="color-button-marker"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">3</property>
+                    <property name="top-attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="check-marker">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="image-position">right</property>
+                    <property name="always-show-image">True</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-marker"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">4</property>
+                    <property name="top-attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="color-button-marker">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-marker"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">5</property>
+                    <property name="top-attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="color-button-first">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-first"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">5</property>
+                    <property name="top-attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="color-button-last">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-last"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">5</property>
+                    <property name="top-attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="check-first">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="image-position">right</property>
+                    <property name="always-show-image">True</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-first"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">4</property>
+                    <property name="top-attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="check-last">
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="image-position">right</property>
+                    <property name="always-show-image">True</property>
+                    <property name="draw-indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <accessibility>
+                      <relation type="labelled-by" target="label-last"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">4</property>
+                    <property name="top-attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label-first">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-first">First Points:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="color-button-first"/>
+                      <relation type="label-for" target="check-first"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">3</property>
+                    <property name="top-attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label-last">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-last">Last Points:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="color-button-last"/>
+                      <relation type="label-for" target="check-last"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">3</property>
+                    <property name="top-attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label-type">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="SparklineDialog|label-type">Type:</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="line-radiobutton"/>
+                      <relation type="label-for" target="column-radiobutton"/>
+                      <relation type="label-for" target="stacked-radiobutton"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkRadioButton" id="line-radiobutton">
+                        <property name="label" translatable="yes" 
context="SparklineDialog|line-radiobutton">Line</property>
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="active">True</property>
+                        <property name="draw-indicator">True</property>
+                        <accessibility>
+                          <relation type="labelled-by" target="label-type"/>
+                        </accessibility>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="column-radiobutton">
+                        <property name="label" translatable="yes" 
context="SparklineDialog|column-radiobutton">Column</property>
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="draw-indicator">True</property>
+                        <property name="group">line-radiobutton</property>
+                        <accessibility>
+                          <relation type="labelled-by" target="label-type"/>
+                        </accessibility>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="stacked-radiobutton">
+                        <property name="label" translatable="yes" 
context="SparklineDialog|stacked-radiobutton">Stacked</property>
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="draw-indicator">True</property>
+                        <property name="group">line-radiobutton</property>
+                        <accessibility>
+                          <relation type="labelled-by" target="label-type"/>
+                        </accessibility>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">0</property>
+                    <property name="width">5</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label-properties">
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
-                <property name="label" translatable="yes" 
context="SparklineDialog|label1">Data</property>
+                <property name="label" translatable="yes" 
context="SparklineDialog|label-properties">Properties</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>

Reply via email to