[Libreoffice-commits] core.git: cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk include/vcl officecfg/registry sd/inc sd/sdi sd/source

Grzegorz Araminowicz (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 23 07:54:02 UTC 2019


 cui/Library_cui.mk                                                   |    1 
 cui/UIConfig_cui.mk                                                  |    1 
 cui/source/dialogs/DiagramDialog.cxx                                 |   27 +++
 cui/source/factory/dlgfact.cxx                                       |   13 +
 cui/source/factory/dlgfact.hxx                                       |   21 ++
 cui/source/inc/DiagramDialog.hxx                                     |   34 ++++
 cui/uiconfig/ui/diagramdialog.ui                                     |   73 ++++++++++
 include/vcl/abstdlg.hxx                                              |   12 +
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |    5 
 sd/inc/app.hrc                                                       |    1 
 sd/sdi/_drvwsh.sdi                                                   |    5 
 sd/sdi/sdraw.sdi                                                     |   17 ++
 sd/source/ui/view/drviews3.cxx                                       |   21 ++
 13 files changed, 231 insertions(+)

New commits:
commit 5457ddf2f529daf5962abcba76dbaeccff0de826
Author:     Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Sun Aug 18 16:23:51 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Aug 23 09:53:09 2019 +0200

    SmartArt: add Edit Diagram dialog
    
    Currently it displays only text representation of diagram.
    
    Change-Id: I3ff12c4abf2ed32f68ea9d7437905afc13279e62
    Reviewed-on: https://gerrit.libreoffice.org/77873
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 1822dc311097..f770cb08158a 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -110,6 +110,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
     cui/source/dialogs/cuiimapwnd \
     cui/source/dialogs/cuitbxform \
     cui/source/dialogs/dlgname \
+    cui/source/dialogs/DiagramDialog \
     cui/source/dialogs/FontFeaturesDialog \
     cui/source/dialogs/hangulhanjadlg \
     cui/source/dialogs/hldocntp \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index e25d8fbe6a13..f953af64a954 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
 	cui/uiconfig/ui/croppage \
 	cui/uiconfig/ui/cuiimapdlg \
 	cui/uiconfig/ui/databaselinkdialog \
+	cui/uiconfig/ui/diagramdialog \
 	cui/uiconfig/ui/dimensionlinestabpage \
 	cui/uiconfig/ui/editdictionarydialog \
 	cui/uiconfig/ui/editmodulesdialog \
diff --git a/cui/source/dialogs/DiagramDialog.cxx b/cui/source/dialogs/DiagramDialog.cxx
new file mode 100644
index 000000000000..f93b3bbdf28b
--- /dev/null
+++ b/cui/source/dialogs/DiagramDialog.cxx
@@ -0,0 +1,27 @@
+/* -*- 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 <DiagramDialog.hxx>
+
+#include <svx/DiagramDataInterface.hxx>
+
+DiagramDialog::DiagramDialog(weld::Window* pWindow,
+                             std::shared_ptr<DiagramDataInterface> pDiagramData)
+    : GenericDialogController(pWindow, "cui/ui/diagramdialog.ui", "DiagramDialog")
+    , mpDiagramData(pDiagramData)
+    , mpBtnOk(m_xBuilder->weld_button("btnOk"))
+    , mpBtnCancel(m_xBuilder->weld_button("btnCancel"))
+    , mpTextDiagram(m_xBuilder->weld_text_view("textDiagram"))
+{
+    mpTextDiagram->set_text(mpDiagramData->getString());
+}
+
+DiagramDialog::~DiagramDialog() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 37460b879aa0..289c79ccf8be 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -87,6 +87,7 @@
 #include <thesdlg.hxx>
 #include <about.hxx>
 #include <tipofthedaydlg.hxx>
+#include <DiagramDialog.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::frame;
@@ -1384,6 +1385,11 @@ short AbstractTipOfTheDayDialog_Impl::Execute()
     return m_xDlg->run();
 }
 
+short AbstractDiagramDialog_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxMacroAssignDlg(
     weld::Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode,
     const Reference< XNameReplace >& _rxEvents, const sal_uInt16 _nInitiallySelectedEvent )
@@ -1641,4 +1647,11 @@ AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent)
     return VclPtr<AbstractTipOfTheDayDialog_Impl>::Create(std::make_unique<TipOfTheDayDialog>(pParent));
 }
 
+VclPtr<AbstractDiagramDialog>
+AbstractDialogFactory_Impl::CreateDiagramDialog(weld::Window* pParent, std::shared_ptr<DiagramDataInterface> pDiagramData)
+{
+    return VclPtr<AbstractDiagramDialog_Impl>::Create(
+        std::make_unique<DiagramDialog>(pParent, pDiagramData));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 9948e71fcf24..7d579b22ae20 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -37,6 +37,7 @@
 #include <cuitabarea.hxx>
 #include <cuitbxform.hxx>
 #include <dlgname.hxx>
+#include <DiagramDialog.hxx>
 #include <dstribut.hxx>
 #include <hangulhanjadlg.hxx>
 #include <hyphen.hxx>
@@ -740,6 +741,22 @@ public:
     virtual short Execute() override;
 };
 
+class DiagramDialog;
+
+/** Edit Diagram dialog */
+class AbstractDiagramDialog_Impl : public AbstractDiagramDialog
+{
+protected:
+    std::unique_ptr<DiagramDialog> m_xDlg;
+
+public:
+    explicit AbstractDiagramDialog_Impl(std::unique_ptr<DiagramDialog> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
+};
+
 //AbstractDialogFactory_Impl implementations
 class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory
 {
@@ -926,6 +943,10 @@ public:
                               const css::uno::Reference<css::frame::XModel> xModel, bool bEditExisting) override;
 
     virtual VclPtr<AbstractTipOfTheDayDialog> CreateTipOfTheDayDialog(weld::Window* pParent) override;
+
+    virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
+        weld::Window* pParent,
+        std::shared_ptr<DiagramDataInterface> pDiagramData) override;
 };
 
 #endif
diff --git a/cui/source/inc/DiagramDialog.hxx b/cui/source/inc/DiagramDialog.hxx
new file mode 100644
index 000000000000..55a948c15cc4
--- /dev/null
+++ b/cui/source/inc/DiagramDialog.hxx
@@ -0,0 +1,34 @@
+/* -*- 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/.
+*/
+
+#ifndef INCLUDED_CUI_SOURCE_INC_DIAGRAMDIALOG_HXX
+#define INCLUDED_CUI_SOURCE_INC_DIAGRAMDIALOG_HXX
+
+#include <tools/link.hxx>
+#include <vcl/weld.hxx>
+
+class DiagramDataInterface;
+
+/** Edit Diagram dialog */
+class DiagramDialog : public weld::GenericDialogController
+{
+public:
+    DiagramDialog(weld::Window* pWindow, std::shared_ptr<DiagramDataInterface> pDiagramData);
+    virtual ~DiagramDialog() override;
+
+private:
+    std::shared_ptr<DiagramDataInterface> mpDiagramData;
+    std::unique_ptr<weld::Button> mpBtnOk;
+    std::unique_ptr<weld::Button> mpBtnCancel;
+    std::unique_ptr<weld::TextView> mpTextDiagram;
+};
+
+#endif // INCLUDED_CUI_SOURCE_INC_DIAGRAMDIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/diagramdialog.ui b/cui/uiconfig/ui/diagramdialog.ui
new file mode 100644
index 000000000000..6b6c888808df
--- /dev/null
+++ b/cui/uiconfig/ui/diagramdialog.ui
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="cui">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkDialog" id="DiagramDialog">
+    <property name="can_focus">False</property>
+    <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="btnOk">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="btnCancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkTextView" id="textDiagram">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-5">btnOk</action-widget>
+      <action-widget response="-6">btnCancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>
\ No newline at end of file
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
index 365a8f6e04ed..0870a72fed62 100644
--- a/include/vcl/abstdlg.hxx
+++ b/include/vcl/abstdlg.hxx
@@ -35,6 +35,7 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel;
 namespace vcl { class Window; }
 class Dialog;
 class BitmapEx;
+class DiagramDataInterface;
 namespace weld
 {
     class Dialog;
@@ -131,6 +132,13 @@ protected:
     virtual ~AbstractTipOfTheDayDialog() override = default;
 };
 
+/** Edit Diagram dialog */
+class VCL_DLLPUBLIC AbstractDiagramDialog : public VclAbstractDialog
+{
+protected:
+    virtual ~AbstractDiagramDialog() override = default;
+};
+
 class VCL_DLLPUBLIC VclAbstractDialogFactory
 {
 public:
@@ -170,6 +178,10 @@ public:
     // create info dialog to show tip-of-the-day
     virtual VclPtr<AbstractTipOfTheDayDialog>
     CreateTipOfTheDayDialog(weld::Window* pParent) = 0;
+
+    virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
+        weld::Window* pParent,
+        std::shared_ptr<DiagramDataInterface> pDiagramData) = 0;
 };
 
 #endif
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 6789d02698bd..e4e241771c94 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -7081,6 +7081,11 @@
           <value xml:lang="en-US">Regenerate Diagram</value>
         </prop>
       </node>
+      <node oor:name=".uno:EditDiagram" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Edit Diagram</value>
+        </prop>
+      </node>
       <node oor:name=".uno:RemoveHyperlink" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">~Remove Hyperlink</value>
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 40424d73097f..9c4f8f73a0a0 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -464,6 +464,7 @@
 #define SID_SHOW_NEXT_LEVEL                 (SID_SD_START+449)
 #define SID_PRESENTATION_MINIMIZER          (SID_SD_START+450)
 #define SID_REGENERATE_DIAGRAM              (SID_SD_START+451)
+#define SID_EDIT_DIAGRAM                    (SID_SD_START+452)
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index b96c1557546f..e746482960aa 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2809,6 +2809,11 @@ interface DrawView
         ExecMethod = ExecCtrl ;
         StateMethod = GetMenuState ;
     ]
+    SID_EDIT_DIAGRAM
+    [
+        ExecMethod = ExecCtrl ;
+        StateMethod = GetMenuState ;
+    ]
     SID_INSERT_QRCODE
     [
         ExecMethod = FuTemporary ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index ca7d5bed8ac1..bbaff36c3d1b 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -4683,3 +4683,20 @@ SfxVoidItem RegenerateDiagram SID_REGENERATE_DIAGRAM
     ToolBoxConfig = TRUE,
     GroupId = SfxGroupId::Modify;
 ]
+
+SfxVoidItem EditDiagram SID_EDIT_DIAGRAM
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Modify;
+]
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 851e8997055c..7057906dac0c 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -508,6 +508,27 @@ void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
         }
         break;
 
+        case SID_EDIT_DIAGRAM:
+        {
+            const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
+            if (rMarkList.GetMarkCount() == 1)
+            {
+                SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+                Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), UNO_QUERY);
+
+                if (oox::drawingml::DrawingML::IsDiagram(xShape))
+                {
+                    VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
+                    VclPtr<VclAbstractDialog> pDlg
+                        = pFact->CreateDiagramDialog(GetFrameWeld(), pObj->GetDiagramData());
+                    pDlg->Execute();
+                }
+            }
+
+            rReq.Done();
+        }
+        break;
+
         default:
         break;
     }


More information about the Libreoffice-commits mailing list