summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-04-29 13:30:42 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-14 16:02:26 +0200
commitc61b75eede5ffd6e18a44130eba25e50dccfb1d4 (patch)
treea14562ebae980bdf75cc7c67ec80a310629bd5e6 /sd
parentafb566b6d3b15b013007a71efe0949800aa22666 (diff)
SmartArt: regenerate diagram command
It removes diagram content and rebuilds shape tree from diagram markup. Diagram should appear unchanged - editing will be added in future commits. Change-Id: I6bfc21956a1a23e55d3c7a74384db71d957d690d Reviewed-on: https://gerrit.libreoffice.org/71584 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/CppunitTest_sd_uimpress.mk1
-rw-r--r--sd/Library_sd.mk1
-rw-r--r--sd/inc/app.hrc1
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/sdi/sdraw.sdi17
-rw-r--r--sd/source/ui/view/drviews3.cxx34
6 files changed, 59 insertions, 0 deletions
diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk
index e483fb59a59c..3adb271e0907 100644
--- a/sd/CppunitTest_sd_uimpress.mk
+++ b/sd/CppunitTest_sd_uimpress.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\
i18nlangtag \
i18nutil \
msfilter \
+ oox \
sal \
sax \
salhelper \
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index cf181c303a95..a38184c07673 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -61,6 +61,7 @@ endif
$(eval $(call gb_Library_use_custom_headers,sd,\
officecfg/registry \
+ oox/generated \
))
$(eval $(call gb_Library_use_sdk_api,sd))
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 8da621f7596f..73a974a5f93c 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -460,6 +460,7 @@
#define SID_HIDE_LAST_LEVEL (SID_SD_START+448)
#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)
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index e4793664eb82..93a30e6757dc 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2789,5 +2789,10 @@ interface DrawView
[
ExecMethod = FuTemporary ;
]
+ SID_REGENERATE_DIAGRAM
+ [
+ ExecMethod = ExecCtrl ;
+ StateMethod = GetMenuState ;
+ ]
}
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index c9427f3f94fa..800081533fc0 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -4631,3 +4631,20 @@ SfxVoidItem MovePageLast SID_MOVE_PAGE_LAST
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Modify;
]
+
+SfxVoidItem RegenerateDiagram SID_REGENERATE_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 9c2e7d5f5c11..ba88762b4221 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -82,10 +82,15 @@
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <editeng/lspcitem.hxx>
#include <editeng/ulspitem.hxx>
#include <memory>
+#include <comphelper/processfactory.hxx>
+#include <oox/drawingml/diagram/diagram.hxx>
+#include <oox/export/drawingml.hxx>
+#include <oox/shape/ShapeFilterBase.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::drawing::framework;
@@ -472,6 +477,35 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
}
break;
+ case SID_REGENERATE_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))
+ {
+ mpDrawView->UnmarkAll();
+ pObj->getChildrenOfSdrObject()->ClearSdrObjList();
+
+ css::uno::Reference<css::uno::XComponentContext> xContext
+ = comphelper::getProcessComponentContext();
+ rtl::Reference<oox::shape::ShapeFilterBase> xFilter(
+ new oox::shape::ShapeFilterBase(xContext));
+ xFilter->setTargetDocument(GetDocSh()->GetModel());
+ xFilter->importTheme();
+ oox::drawingml::reloadDiagram(xShape, *xFilter);
+
+ mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView());
+ }
+ }
+
+ rReq.Done();
+ }
+ break;
+
default:
break;
}