officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |   16 ++
 oox/source/core/xmlfilterbase.cxx                                 |    2 
 oox/source/token/namespaces-strict.txt                            |    1 
 oox/source/token/namespaces.hxx.tail                              |    1 
 oox/source/token/namespaces.txt                                   |    1 
 oox/source/token/tokens.txt                                       |    1 
 sc/inc/SparklineGroup.hxx                                         |    5 
 sc/inc/document.hxx                                               |    2 
 sc/inc/sc.hrc                                                     |    3 
 sc/qa/unit/SparklineImportExportTest.cxx                          |    3 
 sc/sdi/cellsh.sdi                                                 |    1 
 sc/sdi/scalc.sdi                                                  |   17 ++
 sc/source/core/data/document.cxx                                  |   28 ++++
 sc/source/filter/excel/excdoc.cxx                                 |    1 
 sc/source/filter/excel/export/SparklineExt.cxx                    |    6 
 sc/source/filter/oox/SparklineFragment.cxx                        |    3 
 sc/source/ui/dialogs/SparklineDialog.cxx                          |   61 
+++++++---
 sc/source/ui/inc/SparklineDialog.hxx                              |   12 +
 sc/source/ui/view/cellsh.cxx                                      |   35 -----
 sc/source/ui/view/cellsh1.cxx                                     |    2 
 sc/uiconfig/scalc/popupmenu/cell.xml                              |    9 +
 test/source/xmltesttools.cxx                                      |    2 
 22 files changed, 152 insertions(+), 60 deletions(-)

New commits:
commit 1d25d32b4dcfbc750b8344cd79279aad0d621edf
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sat Mar 26 01:33:29 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Mon Apr 4 14:27:12 2022 +0200

    sc: add support for xr2 namespace and read uid of sparkline group
    
    Change-Id: I470819a89338f4fb1d9b2486ffb4d93f8eb42844
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132504
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 7c5fe9188b81..73e6d90e1649 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -146,6 +146,8 @@ const Sequence< beans::Pair< OUString, sal_Int32 > >& 
NamespaceIds()
              NMSP_x12ac},
             {"http://schemas.microsoft.com/office/drawing/2012/chart";,
              NMSP_c15},
+            
{"http://schemas.microsoft.com/office/spreadsheetml/2015/revision2";,
+             NMSP_xr2},
         };
     return SINGLETON;
 };
diff --git a/oox/source/token/namespaces-strict.txt 
b/oox/source/token/namespaces-strict.txt
index 5024249bfacc..7449dca99a33 100644
--- a/oox/source/token/namespaces-strict.txt
+++ b/oox/source/token/namespaces-strict.txt
@@ -88,6 +88,7 @@ w15                     
http://schemas.microsoft.com/office/word/2012/wordml
 p15                     
http://schemas.microsoft.com/office/powerpoint/2012/main
 x12ac                   
http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac
 c15                     http://schemas.microsoft.com/office/drawing/2012/chart
+xr2                     
http://schemas.microsoft.com/office/spreadsheetml/2015/revision2
 
 # extlst namespaces
 
diff --git a/oox/source/token/namespaces.hxx.tail 
b/oox/source/token/namespaces.hxx.tail
index fdea5b96f1b4..382955683d7d 100644
--- a/oox/source/token/namespaces.hxx.tail
+++ b/oox/source/token/namespaces.hxx.tail
@@ -62,6 +62,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return 
nToken & NMSP_MASK; }
 #define W_TOKEN( token )        OOX_TOKEN( doc, token )
 #define LOEXT_TOKEN( token )    OOX_TOKEN( loext, token )
 #define M_TOKEN(token)          OOX_TOKEN(officeMath, token)
+#define XR2_TOKEN(token)        OOX_TOKEN(xr2, token)
 
 
 
diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt
index f18e0833f31d..849caa547695 100644
--- a/oox/source/token/namespaces.txt
+++ b/oox/source/token/namespaces.txt
@@ -88,6 +88,7 @@ w15                     
http://schemas.microsoft.com/office/word/2012/wordml
 p15                     
http://schemas.microsoft.com/office/powerpoint/2012/main
 x12ac                   
http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac
 c15                     http://schemas.microsoft.com/office/drawing/2012/chart
+xr2                     
http://schemas.microsoft.com/office/spreadsheetml/2015/revision2
 
 # extlst namespaces
 
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 593ef0b23a5d..d1a40140add9 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -5848,6 +5848,7 @@ xmlDataType
 xmlPr
 xmlns
 xpath
+xr2
 xrange
 xsc
 xscale
diff --git a/sc/inc/SparklineGroup.hxx b/sc/inc/SparklineGroup.hxx
index 9e2fd89ff9cf..051e45d9e95a 100644
--- a/sc/inc/SparklineGroup.hxx
+++ b/sc/inc/SparklineGroup.hxx
@@ -22,11 +22,14 @@ class SC_DLLPUBLIC SparklineGroup
 {
 private:
     SparklineAttributes m_aAttributes;
+    OUString m_sUID;
 
 public:
     SparklineAttributes& getAttributes() { return m_aAttributes; }
 
-    OUString m_sUID;
+    OUString getID() { return m_sUID; }
+
+    void setID(OUString const& rID) { m_sUID = rID; }
 
     SparklineGroup();
     SparklineGroup(SparklineGroup const& pOtherSparkline);
diff --git a/sc/qa/unit/SparklineImportExportTest.cxx 
b/sc/qa/unit/SparklineImportExportTest.cxx
index 8f36cf2f9adf..2c324121a337 100644
--- a/sc/qa/unit/SparklineImportExportTest.cxx
+++ b/sc/qa/unit/SparklineImportExportTest.cxx
@@ -59,6 +59,9 @@ void checkSparklines(ScDocument& rDocument)
     {
         auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2
         CPPUNIT_ASSERT(pSparkline);
+        
CPPUNIT_ASSERT_EQUAL(OUString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"),
+                             pSparkline->getSparklineGroup()->getID());
+
         auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes();
         CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Line, rAttributes.getType());
 
diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index 529e76971cbc..c01dde32981c 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -696,6 +696,7 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm )
         FSNS(XML_xmlns, XML_r), 
rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
         FSNS(XML_xmlns, XML_xdr), 
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing";, // 
rStrm.getNamespaceURL(OOX_NS(xm)).toUtf8() -> 
"http://schemas.microsoft.com/office/excel/2006/main";,
         FSNS(XML_xmlns, XML_x14), 
rStrm.getNamespaceURL(OOX_NS(xls14Lst)).toUtf8(),
+        FSNS(XML_xmlns, XML_xr2), rStrm.getNamespaceURL(OOX_NS(xr2)).toUtf8(),
         FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)).toUtf8());
 
     SetCurrScTab( mnScTab );
diff --git a/sc/source/filter/excel/export/SparklineExt.cxx 
b/sc/source/filter/excel/export/SparklineExt.cxx
index 1a82dbec46da..549365dcb003 100644
--- a/sc/source/filter/excel/export/SparklineExt.cxx
+++ b/sc/source/filter/excel/export/SparklineExt.cxx
@@ -187,6 +187,12 @@ void SparklineExt::addSparklineGroup(XclExpXmlStream& 
rStream, sc::SparklineGrou
 
     // Sparkline Group Attributes
     auto pAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
+
+    // Write ID
+    OString sUID = OUStringToOString(rSparklineGroup.getID(), 
RTL_TEXTENCODING_UTF8);
+    pAttrList->addNS(XML_xr2, XML_uid, sUID);
+
+    // Write attributes
     addSparklineGroupAttributes(pAttrList, rSparklineGroup.getAttributes());
 
     rWorksheet->startElementNS(XML_x14, XML_sparklineGroup, pAttrList);
diff --git a/sc/source/filter/oox/SparklineFragment.cxx 
b/sc/source/filter/oox/SparklineFragment.cxx
index 451b7b2a70e1..94fefc37949f 100644
--- a/sc/source/filter/oox/SparklineFragment.cxx
+++ b/sc/source/filter/oox/SparklineFragment.cxx
@@ -173,7 +173,8 @@ ContextHandlerRef 
SparklineGroupsContext::onCreateContext(sal_Int32 nElement,
             auto& rLastGroup = m_aSparklineGroups.emplace_back();
             auto& rSparklineAttributes = 
rLastGroup.getSparklineGroup()->getAttributes();
             addAttributesToSparklineAttributes(rSparklineAttributes, rAttribs);
-            rLastGroup.getSparklineGroup()->m_sUID = 
rAttribs.getString(XML_uid, OUString());
+            OUString sUID = rAttribs.getString(XR2_TOKEN(uid), OUString());
+            rLastGroup.getSparklineGroup()->setID(sUID);
             return this;
         }
         case XLS14_TOKEN(colorSeries):
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index f92c380d9bf8..ab9e5dcff8b8 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -440,6 +440,8 @@ void 
XmlTestTools::registerOOXMLNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
                        
BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/diagram";));
     xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("c15"),
                        
BAD_CAST("http://schemas.microsoft.com/office/drawing/2012/chart";));
+    xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("xr2"),
+                       
BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2015/revision2";));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 486fb3494c8b339f4251e4211f1419a0ffac760c
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Tue Mar 22 23:24:05 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Mon Apr 4 14:26:57 2022 +0200

    sc: add "Edit Sparkline Group" context menu action
    
    This adds a context menu to edit the sparkline group for the
    current selected range (if it contains a sparkline group). This
    reuses the SparklineDialog that is used for inserting a new
    sparkline.
    
    The context menu was rearranged so that all actions for the
    sparklines are in a "Sparklines" submenu.
    
    Change-Id: Ia1a025b7c0bf1849c72fdca77ea2f8dc8860c6ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132503
    Tested-by: Tomaž Vajngerl <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 51cd21e0d33a..98f4c9695acd 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1074,6 +1074,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:FormatSparklineMenu" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Sparklines</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:InsertSparkline" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Insert Sparkline...</value>
@@ -1090,6 +1098,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:EditSparklineGroup" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Edit Sparkline Group...</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:EditHeaderAndFooter" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">~Headers and Footers...</value>
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 3ae441f895e3..e31900dee7cd 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1254,7 +1254,7 @@ public:
     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);
-
+    SC_DLLPUBLIC bool HasOneSparklineGroup(ScRange const& rRange);
     /** Notes **/
     SC_DLLPUBLIC ScPostIt*       GetNote(const ScAddress& rPos);
     SC_DLLPUBLIC ScPostIt*       GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index a0acd3f9c94a..8555e34ae0b3 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -310,7 +310,8 @@ class SvxZoomSliderItem;
 #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 INSERT_MENU_END         (INSERT_MENU_START + 27)
+#define SID_EDIT_SPARKLINE_GROUP    (INSERT_MENU_START + 27)
+#define INSERT_MENU_END         (INSERT_MENU_START + 28)
 
 #define FORMAT_MENU_START       (INSERT_MENU_END)
 #define FID_CELL_FORMAT         (FORMAT_MENU_START)
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 5ad7926b24c6..c330aeed2fd8 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -237,6 +237,7 @@ interface CellSelection
     SID_CURRENT_FORMULA_RANGE           [ ExecMethod = ExecuteEdit;]
     SID_INSERT_SPARKLINE                [ ExecMethod = ExecuteEdit; 
StateMethod = GetBlockState; ]
     SID_DELETE_SPARKLINE                [ ExecMethod = ExecuteEdit; 
StateMethod = GetBlockState; ]
+    SID_EDIT_SPARKLINE_GROUP            [ ExecMethod = ExecuteEdit; 
StateMethod = GetBlockState; ]
 
     SID_THESAURUS   [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
     SID_SPELL_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index c95aa01a7e2c..a83578ea9693 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -2321,6 +2321,23 @@ SfxVoidItem DeleteSparkline SID_DELETE_SPARKLINE
     GroupId = SfxGroupId::Edit;
 ]
 
+SfxVoidItem EditSparklineGroup SID_EDIT_SPARKLINE_GROUP
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Edit;
+]
+
 SfxVoidItem SearchResultsDialog SID_SEARCH_RESULTS_DIALOG
 (SfxBoolItem Visible SID_SEARCH_RESULTS_DIALOG)
 [
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e45729e5432c..be5037d4ec74 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6615,6 +6615,34 @@ sc::SparklineList* ScDocument::GetSparklineList(SCTAB 
nTab)
     return nullptr;
 }
 
+
+bool ScDocument::HasOneSparklineGroup(ScRange const& rRange)
+{
+    sc::SparklineGroup* pGroup = nullptr;
+    SCTAB nTab = rRange.aStart.Tab();
+
+    for (SCCOL nX = rRange.aStart.Col(); nX <= rRange.aEnd.Col(); nX++)
+    {
+        for (SCROW nY = rRange.aStart.Row(); nY <= rRange.aEnd.Row(); nY++)
+        {
+            auto pSparkline = GetSparkline(ScAddress(nX, nY, nTab));
+            if (!pSparkline)
+            {
+                return false;
+            }
+            else if (!pGroup)
+            {
+               pGroup = pSparkline->getSparklineGroup().get();
+            }
+            else if (pGroup != pSparkline->getSparklineGroup().get())
+            {
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
 // Notes
 
 ScPostIt* ScDocument::GetNote(const ScAddress& rPos)
diff --git a/sc/source/ui/dialogs/SparklineDialog.cxx 
b/sc/source/ui/dialogs/SparklineDialog.cxx
index b285108bca6d..ba01a64912c6 100644
--- a/sc/source/ui/dialogs/SparklineDialog.cxx
+++ b/sc/source/ui/dialogs/SparklineDialog.cxx
@@ -29,7 +29,8 @@ SparklineDialog::SparklineDialog(SfxBindings* pBindings, 
SfxChildWindow* pChildW
     , mbDialogLostFocus(false)
     , mxButtonOk(m_xBuilder->weld_button("ok"))
     , mxButtonCancel(m_xBuilder->weld_button("cancel"))
-    , mxInputRangeText(m_xBuilder->weld_label("cell-range-label"))
+    , mxFrameData(m_xBuilder->weld_frame("frame-data"))
+    , mxInputRangeLabel(m_xBuilder->weld_label("cell-range-label"))
     , mxInputRangeEdit(new 
formula::RefEdit(m_xBuilder->weld_entry("cell-range-edit")))
     , mxInputRangeButton(new 
formula::RefButton(m_xBuilder->weld_button("cell-range-button")))
     , mxOutputRangeLabel(m_xBuilder->weld_label("output-range-label"))
@@ -58,9 +59,9 @@ SparklineDialog::SparklineDialog(SfxBindings* pBindings, 
SfxChildWindow* pChildW
     , 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())
+    , mbEditMode(false)
 {
-    mxInputRangeEdit->SetReferences(this, mxInputRangeText.get());
+    mxInputRangeEdit->SetReferences(this, mxInputRangeLabel.get());
     mxInputRangeButton->SetReferences(this, mxInputRangeEdit.get());
 
     mxOutputRangeEdit->SetReferences(this, mxOutputRangeLabel.get());
@@ -102,18 +103,49 @@ SparklineDialog::SparklineDialog(SfxBindings* pBindings, 
SfxChildWindow* pChildW
     mxCheckButtonFirst->connect_toggled(aLink);
     mxCheckButtonLast->connect_toggled(aLink);
 
-    setupValues(mpLocalSparklineGroup);
-
-    GetRangeFromSelection();
+    setupValues();
 
     mxOutputRangeEdit->GrabFocus();
+    mxButtonOk->set_sensitive(checkValidInputOutput());
 }
 
-SparklineDialog::~SparklineDialog() {}
+SparklineDialog::~SparklineDialog() = default;
+
+void SparklineDialog::setInputSelection()
+{
+    mrViewData.GetSimpleArea(maInputRange);
+    OUString aString = maInputRange.Format(mrDocument, ScRefFlags::VALID | 
ScRefFlags::TAB_3D,
+                                           mrDocument.GetAddressConvention());
+    mxInputRangeEdit->SetRefString(aString);
+}
 
-void SparklineDialog::setupValues(std::shared_ptr<sc::SparklineGroup> const& 
pSparklineGroup)
+void SparklineDialog::setupValues()
 {
-    auto& rAttribute = pSparklineGroup->getAttributes();
+    ScRange aSelectionRange;
+    mrViewData.GetSimpleArea(aSelectionRange);
+
+    if (mrDocument.HasOneSparklineGroup(aSelectionRange))
+    {
+        if (auto pSparkline = mrDocument.GetSparkline(aSelectionRange.aStart))
+        {
+            mpLocalSparklineGroup = pSparkline->getSparklineGroup();
+            mxFrameData->set_visible(false);
+            mbEditMode = true;
+        }
+    }
+    else
+    {
+        maInputRange = aSelectionRange;
+    }
+
+    if (!mpLocalSparklineGroup)
+    {
+        mpLocalSparklineGroup = std::make_shared<sc::SparklineGroup>();
+    }
+
+    setInputSelection();
+
+    auto& rAttribute = mpLocalSparklineGroup->getAttributes();
 
     switch (rAttribute.getType())
     {
@@ -161,14 +193,6 @@ void SparklineDialog::SetActive()
     RefInputDone();
 }
 
-void SparklineDialog::GetRangeFromSelection()
-{
-    mrViewData.GetSimpleArea(maInputRange);
-    OUString aString = maInputRange.Format(mrDocument, ScRefFlags::VALID | 
ScRefFlags::TAB_3D,
-                                           mrDocument.GetAddressConvention());
-    mxInputRangeEdit->SetRefString(aString);
-}
-
 void SparklineDialog::SetReference(const ScRange& rReferenceRange, ScDocument& 
rDocument)
 {
     if (mpActiveEdit)
@@ -321,6 +345,9 @@ IMPL_LINK_NOARG(SparklineDialog, SelectSparklineType, 
weld::Toggleable&, void)
 
 bool SparklineDialog::checkValidInputOutput()
 {
+    if (mbEditMode)
+        return true;
+
     if (!maInputRange.IsValid() || !maOutputRange.IsValid())
         return false;
 
diff --git a/sc/source/ui/inc/SparklineDialog.hxx 
b/sc/source/ui/inc/SparklineDialog.hxx
index 2cd4f258d484..4af25a861df5 100644
--- a/sc/source/ui/inc/SparklineDialog.hxx
+++ b/sc/source/ui/inc/SparklineDialog.hxx
@@ -32,7 +32,9 @@ private:
     std::unique_ptr<weld::Button> mxButtonOk;
     std::unique_ptr<weld::Button> mxButtonCancel;
 
-    std::unique_ptr<weld::Label> mxInputRangeText;
+    std::unique_ptr<weld::Frame> mxFrameData;
+
+    std::unique_ptr<weld::Label> mxInputRangeLabel;
     std::unique_ptr<formula::RefEdit> mxInputRangeEdit;
     std::unique_ptr<formula::RefButton> mxInputRangeButton;
 
@@ -59,8 +61,6 @@ private:
     std::unique_ptr<weld::RadioButton> mxRadioColumn;
     std::unique_ptr<weld::RadioButton> mxRadioStacked;
 
-    void GetRangeFromSelection();
-
     DECL_LINK(ButtonClicked, weld::Button&, void);
     DECL_LINK(EditFocusHandler, formula::RefEdit&, void);
     DECL_LINK(ButtonFocusHandler, formula::RefButton&, void);
@@ -72,7 +72,11 @@ private:
 
     std::shared_ptr<sc::SparklineGroup> mpLocalSparklineGroup;
 
-    void setupValues(std::shared_ptr<sc::SparklineGroup> const& 
pSparklineGroup);
+    bool mbEditMode;
+
+    void setupValues();
+    void setInputSelection();
+
     void perform();
     bool checkValidInputOutput();
 
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index f1df448a1288..de2a40da3daf 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -98,38 +98,6 @@ ScCellShell::~ScCellShell()
     delete pImpl->m_pRequest;
 }
 
-namespace
-{
-
-bool canShowDeleteSparkline(ScDocument& rDocument, ScRange const& rRange)
-{
-    sc::SparklineGroup* pGroup = nullptr;
-    SCTAB nTab = rRange.aStart.Tab();
-
-    for (SCCOL nX = rRange.aStart.Col(); nX <= rRange.aEnd.Col(); nX++)
-    {
-        for (SCROW nY = rRange.aStart.Row(); nY <= rRange.aEnd.Row(); nY++)
-        {
-            auto pSparkline = rDocument.GetSparkline(ScAddress(nX, nY, nTab));
-            if (!pSparkline)
-            {
-                return false;
-            }
-            else if (!pGroup)
-            {
-               pGroup = pSparkline->getSparklineGroup().get();
-            }
-            else if (pGroup != pSparkline->getSparklineGroup().get())
-            {
-                return false;
-            }
-        }
-    }
-    return true;
-}
-
-} // end anonymous namespace
-
 void ScCellShell::GetBlockState( SfxItemSet& rSet )
 {
     ScTabViewShell* pTabViewShell   = GetViewData().GetViewShell();
@@ -221,8 +189,9 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
             break;
 
             case SID_DELETE_SPARKLINE:
+            case SID_EDIT_SPARKLINE_GROUP:
             {
-                bDisable = !canShowDeleteSparkline(rDoc, ScRange(nCol1, nRow1, 
nTab, nCol2, nRow2, nTab));
+                bDisable = !rDoc.HasOneSparklineGroup(ScRange(nCol1, nRow1, 
nTab, nCol2, nRow2, nTab));
             }
             break;
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 04757e04e1b1..86e028b5396c 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1052,11 +1052,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         break;
 
         case SID_INSERT_SPARKLINE:
+        case SID_EDIT_SPARKLINE_GROUP:
         {
             sal_uInt16 nId  = sc::SparklineDialogWrapper::GetChildWindowId();
             SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
             SfxChildWindow* pWindow = pViewFrame->GetChildWindow(nId);
             pScMod->SetRefDialog(nId, pWindow == nullptr);
+            rReq.Done();
         }
         break;
 
diff --git a/sc/uiconfig/scalc/popupmenu/cell.xml 
b/sc/uiconfig/scalc/popupmenu/cell.xml
index 719de09ae8bc..55e33f7e09b2 100644
--- a/sc/uiconfig/scalc/popupmenu/cell.xml
+++ b/sc/uiconfig/scalc/popupmenu/cell.xml
@@ -63,8 +63,13 @@
   <menu:menuitem menu:id=".uno:ShowNote"/>
   <menu:menuitem menu:id=".uno:HideNote"/>
   <menu:menuseparator/>
-  <menu:menuitem menu:id=".uno:InsertSparkline"/>
-  <menu:menuitem menu:id=".uno:DeleteSparkline"/>
+  <menu:menu menu:id=".uno:FormatSparklineMenu">
+    <menu:menupopup>
+      <menu:menuitem menu:id=".uno:InsertSparkline"/>
+      <menu:menuitem menu:id=".uno:DeleteSparkline"/>
+      <menu:menuitem menu:id=".uno:EditSparklineGroup"/>
+    </menu:menupopup>
+  </menu:menu>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:CurrentConditionalFormatDialog"/>
   <menu:menuitem menu:id=".uno:CurrentConditionalFormatManagerDialog"/>

Reply via email to