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@collabora.com>
This commit is contained in:
Grzegorz Araminowicz
2019-08-18 16:23:51 +02:00
committed by Miklos Vajna
parent 1aed241deb
commit 5457ddf2f5
13 changed files with 231 additions and 0 deletions

View File

@@ -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 \

View File

@@ -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 \

View File

@@ -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: */

View File

@@ -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: */

View File

@@ -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

View File

@@ -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: */

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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: */

View File

@@ -2809,6 +2809,11 @@ interface DrawView
ExecMethod = ExecCtrl ;
StateMethod = GetMenuState ;
]
SID_EDIT_DIAGRAM
[
ExecMethod = ExecCtrl ;
StateMethod = GetMenuState ;
]
SID_INSERT_QRCODE
[
ExecMethod = FuTemporary ;

View File

@@ -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;
]

View File

@@ -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;
}