summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/UIConfig_scalc.mk1
-rw-r--r--sc/inc/document.hxx8
-rw-r--r--sc/inc/shellids.hxx1
-rw-r--r--sc/sdi/SparklineShell.sdi17
-rw-r--r--sc/sdi/scslots.sdi1
-rw-r--r--sc/source/ui/app/scdll.cxx2
-rw-r--r--sc/source/ui/inc/SparklineShell.hxx40
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx6
-rw-r--r--sc/source/ui/view/SparklineShell.cxx54
-rw-r--r--sc/source/ui/view/tabview3.cxx13
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx42
-rw-r--r--sc/uiconfig/scalc/popupmenu/sparkline.xml81
13 files changed, 260 insertions, 7 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index eb81a6817ab2..7933dbb739b3 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -658,6 +658,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/view/scextopt \
sc/source/ui/view/select \
sc/source/ui/view/selectionstate \
+ sc/source/ui/view/SparklineShell \
sc/source/ui/view/spelldialog \
sc/source/ui/view/spelleng \
sc/source/ui/view/spellcheckcontext \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 643645ee7432..cf5f7e0951bf 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/scalc,\
sc/uiconfig/scalc/popupmenu/rowheader \
sc/uiconfig/scalc/popupmenu/row_operations \
sc/uiconfig/scalc/popupmenu/sheettab \
+ sc/uiconfig/scalc/popupmenu/sparkline \
))
$(eval $(call gb_UIConfig_add_statusbarfiles,modules/scalc,\
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 9bf190571f56..c2c597983cea 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -837,6 +837,14 @@ public:
SC_DLLPUBLIC ScDPCollection* GetDPCollection();
SC_DLLPUBLIC const ScDPCollection* GetDPCollection() const;
SC_DLLPUBLIC ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
+ SC_DLLPUBLIC ScDPObject* GetDPAtCursor(ScAddress const& rAddress) const
+ {
+ return GetDPAtCursor(rAddress.Col(), rAddress.Row(), rAddress.Tab());
+ }
+ SC_DLLPUBLIC bool HasDataPilotAtPosition(ScAddress const& rAddress) const
+ {
+ return GetDPAtCursor(rAddress) != nullptr;
+ }
ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
void StopTemporaryChartLock();
diff --git a/sc/inc/shellids.hxx b/sc/inc/shellids.hxx
index 9f4fbf7a991c..ecef989d87bb 100644
--- a/sc/inc/shellids.hxx
+++ b/sc/inc/shellids.hxx
@@ -39,5 +39,6 @@
#define SCID_GRAPHIC_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(15))
#define SCID_PAGEBREAK_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(16))
#define SCID_MEDIA_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(17))
+#define SCID_SPARKLINE_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(18))
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/sdi/SparklineShell.sdi b/sc/sdi/SparklineShell.sdi
new file mode 100644
index 000000000000..24e939e04ea0
--- /dev/null
+++ b/sc/sdi/SparklineShell.sdi
@@ -0,0 +1,17 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+interface Sparkline
+{
+}
+
+shell SparklineShell
+{
+ import Sparkline;
+}
diff --git a/sc/sdi/scslots.sdi b/sc/sdi/scslots.sdi
index 8cf0aaddc0fe..f6ccd7113d5b 100644
--- a/sc/sdi/scslots.sdi
+++ b/sc/sdi/scslots.sdi
@@ -58,6 +58,7 @@ module StarCalc
include "graphsh.sdi"
include "pgbrksh.sdi"
include "mediash.sdi"
+ include "SparklineShell.sdi"
}
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 58efb29ecb9a..2256ee2e125b 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -51,6 +51,7 @@
#include <mediash.hxx>
#include <pgbrksh.hxx>
#include <scdll.hxx>
+#include <SparklineShell.hxx>
#include <appoptio.hxx>
#include <searchresults.hxx>
@@ -125,6 +126,7 @@ void ScDLL::Init()
ScDrawTextObjectBar ::RegisterInterface(pMod);
ScEditShell ::RegisterInterface(pMod);
ScPivotShell ::RegisterInterface(pMod);
+ sc::SparklineShell ::RegisterInterface(pMod);
ScAuditingShell ::RegisterInterface(pMod);
ScFormatShell ::RegisterInterface(pMod);
ScCellShell ::RegisterInterface(pMod);
diff --git a/sc/source/ui/inc/SparklineShell.hxx b/sc/source/ui/inc/SparklineShell.hxx
new file mode 100644
index 000000000000..11028dd8a461
--- /dev/null
+++ b/sc/source/ui/inc/SparklineShell.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sfx2/shell.hxx>
+
+#include <shellids.hxx>
+
+class ScTabViewShell;
+class SfxModule;
+
+namespace sc
+{
+class SparklineShell final : public SfxShell
+{
+public:
+ SFX_DECL_INTERFACE(SCID_SPARKLINE_SHELL)
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ SparklineShell(ScTabViewShell* pView);
+ virtual ~SparklineShell() override;
+
+private:
+ ScTabViewShell* m_pViewShell;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 957dab0efcda..2aba65effefa 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -60,6 +60,7 @@ class ScDPObject;
class ScNavigatorSettings;
class ScRangeName;
class ScDrawTransferObj;
+namespace sc { class SparklineShell; }
struct ScHeaderFieldData;
@@ -85,7 +86,8 @@ enum ObjectSelectionType
OST_OleObject,
OST_Chart,
OST_Graphic,
- OST_Media
+ OST_Media,
+ OST_Sparkline,
};
class ScFormEditData;
@@ -100,6 +102,7 @@ private:
std::unique_ptr<ScDrawTextObjectBar> pDrawTextShell;
std::unique_ptr<ScEditShell> pEditShell;
std::unique_ptr<ScPivotShell> pPivotShell;
+ std::unique_ptr<sc::SparklineShell> m_pSparklineShell;
std::unique_ptr<ScAuditingShell> pAuditingShell;
std::unique_ptr<ScDrawFormShell> pDrawFormShell;
std::unique_ptr<ScCellShell> pCellShell;
@@ -280,6 +283,7 @@ public:
void SetDrawTextShell( bool bActive );
void SetPivotShell( bool bActive );
+ void SetSparklineShell(bool bActive);
void SetDialogDPObject( std::unique_ptr<ScDPObject> pObj );
const ScDPObject* GetDialogDPObject() const { return pDialogDPObject.get(); }
diff --git a/sc/source/ui/view/SparklineShell.cxx b/sc/source/ui/view/SparklineShell.cxx
new file mode 100644
index 000000000000..3b3c4f8399ed
--- /dev/null
+++ b/sc/source/ui/view/SparklineShell.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <scitems.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <svl/whiter.hxx>
+#include <vcl/EnumContext.hxx>
+
+#include <sc.hrc>
+#include <SparklineShell.hxx>
+#include <tabvwsh.hxx>
+#include <docsh.hxx>
+#include <document.hxx>
+
+#define ShellClass_SparklineShell
+#include <scslots.hxx>
+
+namespace sc
+{
+SFX_IMPL_INTERFACE(SparklineShell, SfxShell)
+
+void SparklineShell::InitInterface_Impl() { GetStaticInterface()->RegisterPopupMenu("sparkline"); }
+
+SparklineShell::SparklineShell(ScTabViewShell* pViewShell)
+ : SfxShell(pViewShell)
+ , m_pViewShell(pViewShell)
+{
+ SetPool(&m_pViewShell->GetPool());
+ ScViewData& rViewData = m_pViewShell->GetViewData();
+ SfxUndoManager* pUndoManager = rViewData.GetSfxDocShell()->GetUndoManager();
+ SetUndoManager(pUndoManager);
+ if (!rViewData.GetDocument().IsUndoEnabled())
+ {
+ pUndoManager->SetMaxUndoActionCount(0);
+ }
+ SetName("Sparkline");
+ SfxShell::SetContextName(
+ vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Sparkline));
+}
+
+SparklineShell::~SparklineShell() = default;
+
+} // end sc namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index d62f3c2817a0..20954d8711cc 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -634,10 +634,15 @@ void ScTabView::CursorPosChanged()
// Broadcast, so that other Views of the document also switch
- ScDocument& rDoc = aViewData.GetDocument();
- bool bDP = nullptr != rDoc.GetDPAtCursor(
- aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
- aViewData.GetViewShell()->SetPivotShell(bDP);
+ ScDocument& rDocument = aViewData.GetDocument();
+ bool bDataPilot = rDocument.HasDataPilotAtPosition(aViewData.GetCurPos());
+ aViewData.GetViewShell()->SetPivotShell(bDataPilot);
+
+ if (!bDataPilot)
+ {
+ bool bSparkline = rDocument.HasSparkline(aViewData.GetCurPos());
+ aViewData.GetViewShell()->SetSparklineShell(bSparkline);
+ }
// UpdateInputHandler now in CellContentChanged
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index e50484525fdb..10c80a66e31f 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -46,6 +46,7 @@
#include <drformsh.hxx>
#include <editsh.hxx>
#include <pivotsh.hxx>
+#include <SparklineShell.hxx>
#include <auditsh.hxx>
#include <drtxtob.hxx>
#include <inputhdl.hxx>
@@ -690,6 +691,25 @@ void ScTabViewShell::SetPivotShell( bool bActive )
SetCurSubShell(OST_Cell);
}
+void ScTabViewShell::SetSparklineShell(bool bActive)
+{
+ if (eCurOST != OST_Sparkline && eCurOST != OST_Cell)
+ return;
+
+ if (bActive)
+ {
+ bActiveDrawTextSh = bActiveDrawSh = false;
+ bActiveDrawFormSh=false;
+ bActiveGraphicSh=false;
+ bActiveMediaSh=false;
+ bActiveOleObjectSh=false;
+ bActiveChartSh=false;
+ SetCurSubShell(OST_Sparkline);
+ }
+ else
+ SetCurSubShell(OST_Cell);
+}
+
void ScTabViewShell::SetAuditShell( bool bActive )
{
if ( bActive )
@@ -948,6 +968,20 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce)
bCellBrush = true;
}
break;
+ case OST_Sparkline:
+ {
+ AddSubShell(*pCellShell);
+ if(bPgBrk) AddSubShell(*pPageBreakShell);
+
+ if (!m_pSparklineShell)
+ {
+ m_pSparklineShell.reset(new sc::SparklineShell(this));
+ m_pSparklineShell->SetRepeatTarget(&aTarget);
+ }
+ AddSubShell(*m_pSparklineShell);
+ bCellBrush = true;
+ }
+ break;
default:
OSL_FAIL("wrong shell requested");
break;
@@ -992,11 +1026,14 @@ SfxShell* ScTabViewShell::GetMySubShell() const
SfxShell* pSub = const_cast<ScTabViewShell*>(this)->GetSubShell(nPos);
while (pSub)
{
- if ( pSub == pDrawShell.get() || pSub == pDrawTextShell.get() || pSub == pEditShell.get() ||
+ if (pSub == pDrawShell.get() || pSub == pDrawTextShell.get() || pSub == pEditShell.get() ||
pSub == pPivotShell.get() || pSub == pAuditingShell.get() || pSub == pDrawFormShell.get() ||
pSub == pCellShell.get() || pSub == pOleObjectShell.get() || pSub == pChartShell.get() ||
- pSub == pGraphicShell.get() || pSub == pMediaShell.get() || pSub == pPageBreakShell.get())
+ pSub == pGraphicShell.get() || pSub == pMediaShell.get() || pSub == pPageBreakShell.get() ||
+ pSub == m_pSparklineShell.get())
+ {
return pSub; // found
+ }
pSub = const_cast<ScTabViewShell*>(this)->GetSubShell(++nPos);
}
@@ -1812,6 +1849,7 @@ ScTabViewShell::~ScTabViewShell()
pDrawTextShell.reset();
pEditShell.reset();
pPivotShell.reset();
+ m_pSparklineShell.reset();
pAuditingShell.reset();
pCurFrameLine.reset();
mpFormEditData.reset();
diff --git a/sc/uiconfig/scalc/popupmenu/sparkline.xml b/sc/uiconfig/scalc/popupmenu/sparkline.xml
new file mode 100644
index 000000000000..fb7f4ff9ecd8
--- /dev/null
+++ b/sc/uiconfig/scalc/popupmenu/sparkline.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+ <menu:menuitem menu:id=".uno:Cut"/>
+ <menu:menuitem menu:id=".uno:Copy"/>
+ <menu:menuitem menu:id=".uno:Paste"/>
+ <menu:menu menu:id=".uno:PasteSpecialMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:PasteUnformatted"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:PasteOnlyText"/>
+ <menu:menuitem menu:id=".uno:PasteOnlyValue"/>
+ <menu:menuitem menu:id=".uno:PasteOnlyFormula"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:PasteTransposed"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:PasteSpecial"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DataSelect"/>
+ <menu:menuitem menu:id=".uno:CurrentValidation"/>
+ <menu:menuitem menu:id=".uno:DefineCurrentName"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:InsertCell"/>
+ <menu:menuitem menu:id=".uno:DeleteCell"/>
+ <menu:menuitem menu:id=".uno:Delete"/>
+ <menu:menuitem menu:id=".uno:MergeCells"/>
+ <menu:menuitem menu:id=".uno:SplitCell"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:FormatPaintbrush"/>
+ <menu:menuitem menu:id=".uno:ResetAttributes"/>
+ <menu:menu menu:id=".uno:FormatStylesMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:EditStyle"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DefaultCellStylesmenu" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:Accent1CellStyles" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:Accent2CellStyles" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:Accent3CellStyles" menu:style="radio"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:BadCellStyles" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:ErrorCellStyles" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:GoodCellStyles" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:NeutralCellStyles" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:WarningCellStyles" menu:style="radio"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:FootnoteCellStyles" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:NoteCellStyles" menu:style="radio"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+ <menu:menuitem menu:id=".uno:EditAnnotation"/>
+ <menu:menuitem menu:id=".uno:DeleteNote"/>
+ <menu:menuitem menu:id=".uno:ShowNote"/>
+ <menu:menuitem menu:id=".uno:HideNote"/>
+ <menu:menuseparator/>
+ <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:DeleteSparklineGroup"/>
+ <menu:menuitem menu:id=".uno:EditSparklineGroup"/>
+ <menu:menuitem menu:id=".uno:EditSparkline"/>
+ <menu:menuitem menu:id=".uno:GroupSparklines"/>
+ <menu:menuitem menu:id=".uno:UngroupSparklines"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:CurrentConditionalFormatDialog"/>
+ <menu:menuitem menu:id=".uno:CurrentConditionalFormatManagerDialog"/>
+ <menu:menuitem menu:id=".uno:FormatCellDialog"/>
+</menu:menupopup>