summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/inc/pch/precompiled_basctl.hxx1
-rw-r--r--chart2/inc/pch/precompiled_chartcontroller.hxx1
-rw-r--r--chart2/inc/pch/precompiled_chartcore.hxx1
-rw-r--r--cui/inc/pch/precompiled_cui.hxx1
-rw-r--r--cui/source/dialogs/DiagramDialog.cxx18
-rw-r--r--cui/source/factory/dlgfact.cxx4
-rw-r--r--cui/source/factory/dlgfact.hxx2
-rw-r--r--cui/source/inc/DiagramDialog.hxx6
-rw-r--r--include/oox/core/xmlfilterbase.hxx3
-rw-r--r--include/oox/drawingml/diagram/diagram.hxx2
-rw-r--r--include/oox/drawingml/shape.hxx12
-rw-r--r--include/oox/export/drawingml.hxx1
-rw-r--r--include/oox/ppt/pptimport.hxx2
-rw-r--r--include/oox/shape/ShapeFilterBase.hxx3
-rw-r--r--include/svx/DiagramDataInterface.hxx52
-rw-r--r--include/svx/svdobj.hxx6
-rw-r--r--include/svx/svdogrp.hxx27
-rw-r--r--include/vcl/abstdlg.hxx4
-rw-r--r--oox/source/core/xmlfilterbase.cxx6
-rw-r--r--oox/source/drawingml/diagram/datamodel.hxx13
-rw-r--r--oox/source/drawingml/diagram/diagram.cxx59
-rw-r--r--oox/source/drawingml/diagram/diagram.hxx1
-rw-r--r--oox/source/drawingml/diagram/diagramhelper.cxx211
-rw-r--r--oox/source/drawingml/diagram/diagramhelper.hxx21
-rw-r--r--oox/source/drawingml/shape.cxx39
-rw-r--r--oox/source/export/drawingml.cxx23
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx4
-rw-r--r--oox/source/shape/ShapeFilterBase.cxx5
-rw-r--r--reportdesign/inc/pch/precompiled_rpt.hxx1
-rw-r--r--reportdesign/inc/pch/precompiled_rptui.hxx1
-rw-r--r--sd/inc/pch/precompiled_sdui.hxx1
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx3
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx6
-rw-r--r--sd/source/ui/view/drviews3.cxx30
-rw-r--r--slideshow/inc/pch/precompiled_slideshow.hxx1
-rw-r--r--svx/source/svdraw/svdobj.cxx11
-rw-r--r--svx/source/svdraw/svdogrp.cxx38
-rw-r--r--sw/inc/pch/precompiled_msword.hxx1
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx7
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx4
40 files changed, 326 insertions, 306 deletions
diff --git a/basctl/inc/pch/precompiled_basctl.hxx b/basctl/inc/pch/precompiled_basctl.hxx
index ede9aaa5bbe8..30f9f2560029 100644
--- a/basctl/inc/pch/precompiled_basctl.hxx
+++ b/basctl/inc/pch/precompiled_basctl.hxx
@@ -452,7 +452,6 @@
#include <svtools/statusbarcontroller.hxx>
#include <svtools/svtdllapi.h>
#include <svtools/toolboxcontroller.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/XPropertyEntry.hxx>
#include <svx/ipolypolygoneditorcontroller.hxx>
#include <svx/itextprovider.hxx>
diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx b/chart2/inc/pch/precompiled_chartcontroller.hxx
index b2559c3f9769..2debda6b0836 100644
--- a/chart2/inc/pch/precompiled_chartcontroller.hxx
+++ b/chart2/inc/pch/precompiled_chartcontroller.hxx
@@ -369,7 +369,6 @@
#include <svtools/colorcfg.hxx>
#include <svtools/svtdllapi.h>
#include <svx/ActionDescriptionProvider.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/XPropertyEntry.hxx>
#include <svx/chrtitem.hxx>
#include <svx/ipolypolygoneditorcontroller.hxx>
diff --git a/chart2/inc/pch/precompiled_chartcore.hxx b/chart2/inc/pch/precompiled_chartcore.hxx
index f64e26fa63a7..da4bedf01de3 100644
--- a/chart2/inc/pch/precompiled_chartcore.hxx
+++ b/chart2/inc/pch/precompiled_chartcore.hxx
@@ -240,7 +240,6 @@
#include <svl/svldllapi.h>
#include <svl/typedwhich.hxx>
#include <svl/zforlist.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdobjkind.hxx>
#include <svx/svdtypes.hxx>
diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx
index ccdae65d1562..c784c49a2c1b 100644
--- a/cui/inc/pch/precompiled_cui.hxx
+++ b/cui/inc/pch/precompiled_cui.hxx
@@ -351,7 +351,6 @@
#include <svtools/svtdllapi.h>
#include <svtools/unitconv.hxx>
#include <svtools/valueset.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/dialmgr.hxx>
#include <svx/dlgutil.hxx>
#include <svx/ipolypolygoneditorcontroller.hxx>
diff --git a/cui/source/dialogs/DiagramDialog.cxx b/cui/source/dialogs/DiagramDialog.cxx
index eceaaed0c666..9c5816cf4b2b 100644
--- a/cui/source/dialogs/DiagramDialog.cxx
+++ b/cui/source/dialogs/DiagramDialog.cxx
@@ -10,13 +10,13 @@
#include <DiagramDialog.hxx>
#include <comphelper/dispatchcommand.hxx>
-#include <svx/DiagramDataInterface.hxx>
+#include <svx/svdogrp.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
DiagramDialog::DiagramDialog(weld::Window* pWindow,
- std::shared_ptr<DiagramDataInterface> pDiagramData)
+ const std::shared_ptr<IDiagramHelper>& pDiagramHelper)
: GenericDialogController(pWindow, "cui/ui/diagramdialog.ui", "DiagramDialog")
- , mpDiagramData(pDiagramData)
+ , mpDiagramHelper(pDiagramHelper)
, mpBtnOk(m_xBuilder->weld_button("btnOk"))
, mpBtnCancel(m_xBuilder->weld_button("btnCancel"))
, mpBtnAdd(m_xBuilder->weld_button("btnAdd"))
@@ -40,21 +40,15 @@ DiagramDialog::DiagramDialog(weld::Window* pWindow,
IMPL_LINK_NOARG(DiagramDialog, OnAddClick, weld::Button&, void)
{
OUString sText = mpTextAdd->get_text();
- static bool bAdvancedSmartArt(nullptr != getenv("SAL_ENABLE_ADVANCED_SMART_ART"));
if (!sText.isEmpty())
{
- OUString sNodeId = mpDiagramData->addNode(sText);
+ OUString sNodeId = mpDiagramHelper->addNode(sText);
std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator());
mpTreeDiagram->insert(nullptr, -1, &sText, &sNodeId, nullptr, nullptr, false, pEntry.get());
mpTreeDiagram->select(*pEntry);
comphelper::dispatchCommand(".uno:RegenerateDiagram", {});
}
- else if (bAdvancedSmartArt)
- {
- // For test purposes re-layout without change
- comphelper::dispatchCommand(".uno:RegenerateDiagram", {});
- }
}
IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void)
@@ -62,7 +56,7 @@ IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void)
std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator());
if (mpTreeDiagram->get_selected(pEntry.get()))
{
- if (mpDiagramData->removeNode(mpTreeDiagram->get_id(*pEntry)))
+ if (mpDiagramHelper->removeNode(mpTreeDiagram->get_id(*pEntry)))
{
mpTreeDiagram->remove(*pEntry);
comphelper::dispatchCommand(".uno:RegenerateDiagram", {});
@@ -72,7 +66,7 @@ IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void)
void DiagramDialog::populateTree(const weld::TreeIter* pParent, const OUString& rParentId)
{
- auto aItems = mpDiagramData->getChildren(rParentId);
+ auto aItems = mpDiagramHelper->getChildren(rParentId);
for (auto& aItem : aItems)
{
std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator());
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 7b0a1971d1fe..c7a8a204e075 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1524,10 +1524,10 @@ AbstractDialogFactory_Impl::CreateToolbarmodeDialog(weld::Window* pParent)
}
VclPtr<AbstractDiagramDialog>
-AbstractDialogFactory_Impl::CreateDiagramDialog(weld::Window* pParent, std::shared_ptr<DiagramDataInterface> pDiagramData)
+AbstractDialogFactory_Impl::CreateDiagramDialog(weld::Window* pParent, const std::shared_ptr<IDiagramHelper>& pDiagramHelper)
{
return VclPtr<AbstractDiagramDialog_Impl>::Create(
- std::make_unique<DiagramDialog>(pParent, pDiagramData));
+ std::make_unique<DiagramDialog>(pParent, pDiagramHelper));
}
#ifdef _WIN32
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index bc5b22f205e1..3ce135927f14 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -608,7 +608,7 @@ public:
virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
weld::Window* pParent,
- std::shared_ptr<DiagramDataInterface> pDiagramData) override;
+ const std::shared_ptr<IDiagramHelper>& pDiagramHelper) override;
#ifdef _WIN32
virtual VclPtr<VclAbstractDialog> CreateFileExtCheckDialog(weld::Window* pParent,
diff --git a/cui/source/inc/DiagramDialog.hxx b/cui/source/inc/DiagramDialog.hxx
index adc8328969a8..397aab44f50f 100644
--- a/cui/source/inc/DiagramDialog.hxx
+++ b/cui/source/inc/DiagramDialog.hxx
@@ -12,17 +12,17 @@
#include <tools/link.hxx>
#include <vcl/weld.hxx>
-class DiagramDataInterface;
+class IDiagramHelper;
/** Edit Diagram dialog */
class DiagramDialog : public weld::GenericDialogController
{
public:
- DiagramDialog(weld::Window* pWindow, std::shared_ptr<DiagramDataInterface> pDiagramData);
+ DiagramDialog(weld::Window* pWindow, const std::shared_ptr<IDiagramHelper>& pDiagramHelper);
virtual ~DiagramDialog() override;
private:
- std::shared_ptr<DiagramDataInterface> mpDiagramData;
+ const std::shared_ptr<IDiagramHelper> mpDiagramHelper;
std::unique_ptr<weld::Button> mpBtnOk;
std::unique_ptr<weld::Button> mpBtnCancel;
std::unique_ptr<weld::Button> mpBtnAdd;
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
index 15de6ce680c9..35312fda53ab 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -100,6 +100,9 @@ public:
/** Has to be implemented by each filter, returns the current theme. */
virtual const ::oox::drawingml::Theme* getCurrentTheme() const = 0;
+ /** May be implemented by filters which handle Diagrams, default returns empty ptr */
+ virtual std::shared_ptr<::oox::drawingml::Theme> getCurrentThemePtr() const;
+
/** Has to be implemented by each filter to return the collection of VML shapes. */
virtual ::oox::vml::Drawing* getVmlDrawing() = 0;
diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx
index 77cef9a88323..51d9ae5583db 100644
--- a/include/oox/drawingml/diagram/diagram.hxx
+++ b/include/oox/drawingml/diagram/diagram.hxx
@@ -54,7 +54,7 @@ void loadDiagram(ShapePtr const& pShape,
const css::uno::Reference<css::xml::dom::XDocument>& colorDom,
core::XmlFilterBase& rFilter);
-OOX_DLLPUBLIC void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& rFilter);
+// OOX_DLLPUBLIC void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& rFilter);
}
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 59ed231378fe..6bd875656632 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -57,7 +57,7 @@ namespace oox::vml {
struct OleObjectInfo;
}
-class DiagramHelper;
+class IDiagramHelper;
namespace oox::drawingml {
@@ -82,9 +82,6 @@ struct ShapeStyleRef
typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
-class DiagramData;
-typedef std::shared_ptr<DiagramData> DiagramDataPtr;
-
/** Additional information for a chart embedded in a drawing shape. */
struct ChartShapeInfo
{
@@ -217,7 +214,6 @@ public:
const css::uno::Sequence<css::beans::PropertyValue> &
getDiagramDoms() const { return maDiagramDoms; }
void setDiagramDoms(const css::uno::Sequence<css::beans::PropertyValue>& rDiagramDoms) { maDiagramDoms = rDiagramDoms; }
- void setDiagramData(const DiagramDataPtr& pDiagramData) { mpDiagramData = pDiagramData; }
css::uno::Sequence< css::uno::Sequence< css::uno::Any > >resolveRelationshipsOfTypeFromOfficeDoc(
core::XmlFilterBase& rFilter, const OUString& sFragment, std::u16string_view sType );
void setLinkedTxbxAttributes(const LinkedTxbxAttr& rhs){ maLinkedTxbxAttr = rhs; };
@@ -258,6 +254,9 @@ public:
void prepareDiagramHelper(const std::shared_ptr< Diagram >& rDiagramPtr, const std::shared_ptr<::oox::drawingml::Theme>& rTheme);
void propagateDiagramHelper();
+ // for Writer it is necessary to migrate an existing helper to a new Shape
+ void migrateDiagramHelperToNewShape(ShapePtr& pTarget);
+
protected:
enum FrameType
@@ -379,7 +378,6 @@ private:
bool mbHasLinkedTxbx; // this text box has linked text box ?
css::uno::Sequence<css::beans::PropertyValue> maDiagramDoms;
- DiagramDataPtr mpDiagramData;
/// Z-Order.
sal_Int32 mnZOrder = 0;
@@ -404,7 +402,7 @@ private:
// temporary space for DiagramHelper in preparation for collecting data
// Note: I tried to use a unique_ptr here, but existing constuctor func does not allow that
- DiagramHelper* mpDiagramHelper;
+ IDiagramHelper* mpDiagramHelper;
};
}
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 2a65818b15f6..774881022901 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -338,7 +338,6 @@ public:
const sax_fastparser::FSHelperPtr& pDrawing);
static bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape );
- static bool IsDiagram(const css::uno::Reference<css::drawing::XShape>& rXShape);
sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName);
static void ResetCounters();
diff --git a/include/oox/ppt/pptimport.hxx b/include/oox/ppt/pptimport.hxx
index b7b9e059e828..2d7367c4c63e 100644
--- a/include/oox/ppt/pptimport.hxx
+++ b/include/oox/ppt/pptimport.hxx
@@ -75,7 +75,7 @@ public:
virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& rDescriptor ) override;
::Color getSchemeColor( sal_Int32 nToken ) const;
- std::shared_ptr<::oox::drawingml::Theme> getCurrentThemePtr() const;
+ virtual std::shared_ptr<::oox::drawingml::Theme> getCurrentThemePtr() const override;
#if OSL_DEBUG_LEVEL > 0
static XmlFilterBase* mpDebugFilterBase;
diff --git a/include/oox/shape/ShapeFilterBase.hxx b/include/oox/shape/ShapeFilterBase.hxx
index 4b6153a58d2f..200bc92ee492 100644
--- a/include/oox/shape/ShapeFilterBase.hxx
+++ b/include/oox/shape/ShapeFilterBase.hxx
@@ -52,6 +52,9 @@ public:
/** Has to be implemented by each filter, returns the current theme. */
virtual const ::oox::drawingml::Theme* getCurrentTheme() const override;
+ /** May be implemented by filters which handle Diagrams, default returns empty ptr */
+ virtual std::shared_ptr<::oox::drawingml::Theme> getCurrentThemePtr() const override;
+
void setCurrentTheme(const ::oox::drawingml::ThemePtr& pTheme);
/** Has to be implemented by each filter to return the collection of VML shapes. */
diff --git a/include/svx/DiagramDataInterface.hxx b/include/svx/DiagramDataInterface.hxx
deleted file mode 100644
index f2c7d1df7c66..000000000000
--- a/include/svx/DiagramDataInterface.hxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SVX_DIAGRAMDATAINTERFACE_HXX
-#define INCLUDED_SVX_DIAGRAMDATAINTERFACE_HXX
-
-#include <rtl/ustring.hxx>
-#include <sal/types.h>
-
-#include <utility>
-#include <vector>
-
-/// Interface class to access diagram data for UI
-class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI DiagramDataInterface
-{
-public:
- // get text representation of data tree
- virtual OUString getString() const = 0;
-
- // get children of provided data node
- // use empty string for top-level nodes
- // returns vector of (id, text)
- virtual std::vector<std::pair<OUString, OUString>>
- getChildren(const OUString& rParentId) const = 0;
-
- // add new top-level node to data model, returns its id
- virtual OUString addNode(const OUString& rText) = 0;
-
- virtual bool removeNode(const OUString& rNodeId) = 0;
-
-protected:
- ~DiagramDataInterface() noexcept {}
-};
-
-#endif // INCLUDED_SVX_DIAGRAMDATAINTERFACE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index c6e394d7b539..5ee18b292deb 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -27,7 +27,6 @@
#include <svl/poolitem.hxx>
#include <svl/typedwhich.hxx>
#include <tools/degree.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/svdtypes.hxx>
#include <svx/svdobjkind.hxx>
#include <svx/svxdllapi.h>
@@ -333,9 +332,6 @@ public:
const double* GetRelativeHeight() const;
sal_Int16 GetRelativeHeightRelation() const;
- void SetDiagramData(std::shared_ptr<DiagramDataInterface> pDiagramData);
- const std::shared_ptr<DiagramDataInterface> & GetDiagramData() const;
-
/// @param bNotMyself = true: set only ObjList to dirty, don't mark this object as dirty.
///
/// This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect
@@ -401,7 +397,7 @@ public:
// GrabBagItem for interim interop purposes
void GetGrabBagItem(css::uno::Any& rVal) const;
- void SetGrabBagItem(const css::uno::Any& rVal);
+ virtual void SetGrabBagItem(const css::uno::Any& rVal);
// Return the position in the navigation order for the called object.
// Note that this method may update the navigation position of the
diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx
index 1616355c81ce..d4ea77746019 100644
--- a/include/svx/svdogrp.hxx
+++ b/include/svx/svdogrp.hxx
@@ -30,16 +30,30 @@ class SdrObjGroup;
// Helper class to allow administer advanced Diagram related
// data and functionality
-class SVXCORE_DLLPUBLIC DiagramHelper
+class SVXCORE_DLLPUBLIC IDiagramHelper
{
protected:
void anchorToSdrObjGroup(SdrObjGroup& rTarget);
public:
- DiagramHelper();
- virtual ~DiagramHelper();
+ IDiagramHelper();
+ virtual ~IDiagramHelper();
+ // re-create XShapes
virtual void reLayout() = 0;
+
+ // get text representation of data tree
+ virtual OUString getString() const = 0;
+
+ // get children of provided data node
+ // use empty string for top-level nodes
+ // returns vector of (id, text)
+ virtual std::vector<std::pair<OUString, OUString>>
+ getChildren(const OUString& rParentId) const = 0;
+
+ // add/remove new top-level node to data model, returns its id
+ virtual OUString addNode(const OUString& rText) = 0;
+ virtual bool removeNode(const OUString& rNodeId) = 0;
};
// SdrObjGroup
@@ -54,12 +68,12 @@ private:
// Allow *only* DiagramHelper itself to set this internal reference to
// tightly control usage
- friend class DiagramHelper;
- std::unique_ptr<DiagramHelper> mp_DiagramHelper;
+ friend class IDiagramHelper;
+ std::shared_ptr<IDiagramHelper> mp_DiagramHelper;
public:
bool isDiagram() const { return bool(mp_DiagramHelper); }
- DiagramHelper* getDiagramHelper() { return mp_DiagramHelper.get(); }
+ const std::shared_ptr<IDiagramHelper>& getDiagramHelper() { return mp_DiagramHelper; }
private:
// protected destructor - due to final, make private
@@ -87,6 +101,7 @@ public:
virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
virtual SdrObjList* GetSubList() const override;
+ virtual void SetGrabBagItem(const css::uno::Any& rVal) override;
virtual const tools::Rectangle& GetCurrentBoundRect() const override;
virtual const tools::Rectangle& GetSnapRect() const override;
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
index 52212f482253..f6097f940655 100644
--- a/include/vcl/abstdlg.hxx
+++ b/include/vcl/abstdlg.hxx
@@ -34,7 +34,7 @@ namespace com::sun::star::frame { class XModel; }
class Dialog;
class BitmapEx;
-class DiagramDataInterface;
+class IDiagramHelper;
namespace weld
{
class Dialog;
@@ -179,7 +179,7 @@ public:
virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
weld::Window* pParent,
- std::shared_ptr<DiagramDataInterface> pDiagramData) = 0;
+ const std::shared_ptr<IDiagramHelper>& pDiagramHelper) = 0;
#ifdef _WIN32
virtual VclPtr<VclAbstractDialog>
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 9625f0f509ba..fa9811f4e7fa 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -213,6 +213,12 @@ XmlFilterBase::~XmlFilterBase()
mxImpl->maFastParser.clearDocumentHandler();
}
+std::shared_ptr<::oox::drawingml::Theme> XmlFilterBase::getCurrentThemePtr() const
+{
+ // default returns empty ptr
+ return std::shared_ptr<::oox::drawingml::Theme>();
+}
+
void XmlFilterBase::checkDocumentProperties(const Reference<XDocumentProperties>& xDocProps)
{
mbMSO2007 = mbMSO = false;
diff --git a/oox/source/drawingml/diagram/datamodel.hxx b/oox/source/drawingml/diagram/datamodel.hxx
index a3d71718a74d..b10287904c65 100644
--- a/oox/source/drawingml/diagram/datamodel.hxx
+++ b/oox/source/drawingml/diagram/datamodel.hxx
@@ -29,7 +29,6 @@
#include <oox/drawingml/drawingmltypes.hxx>
#include <oox/helper/helper.hxx>
#include <oox/token/tokens.hxx>
-#include <svx/DiagramDataInterface.hxx>
namespace oox::drawingml {
@@ -143,7 +142,8 @@ typedef std::vector< Point > Points;
}
-class DiagramData : public DiagramDataInterface
+// class DiagramData : public DiagramDataInterface
+class DiagramData
{
public:
typedef std::map< OUString, dgm::Point* > PointNameMap;
@@ -178,10 +178,11 @@ public:
{ return maExtDrawings; }
const dgm::Point* getRootPoint() const;
void dump() const;
- OUString getString() const override;
- std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const override;
- OUString addNode(const OUString& rText) override;
- bool removeNode(const OUString& rNodeId) override;
+
+ OUString getString() const;
+ std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const;
+ OUString addNode(const OUString& rText);
+ bool removeNode(const OUString& rNodeId);
private:
void getChildrenString(OUStringBuffer& rBuf, const dgm::Point* pPoint, sal_Int32 nLevel) const;
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index e23ce68a14a8..6c6578ae4067 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -168,6 +168,11 @@ uno::Sequence<beans::PropertyValue> Diagram::getDomsAsPropertyValues() const
return aValue;
}
+void Diagram::newTargetShape(ShapePtr& pTarget)
+{
+ mpShape = pTarget;
+}
+
static uno::Reference<xml::dom::XDocument> loadFragment(
core::XmlFilterBase& rFilter,
const OUString& rFragmentPath )
@@ -361,16 +366,10 @@ void loadDiagram( ShapePtr const & pShape,
// diagram loaded. now lump together & attach to shape
pDiagram->addTo(pShape);
- pShape->setDiagramData(pData);
pShape->setDiagramDoms(pDiagram->getDomsAsPropertyValues());
- // We need the shared_ptr to oox::Theme here, so do something direct when
- // we can identify the expected type of the used import filter
- oox::ppt::PowerPointImport* pFilter(dynamic_cast<oox::ppt::PowerPointImport*>(&rFilter));
- const std::shared_ptr<::oox::drawingml::Theme> aThemePtr(pFilter ? pFilter->getCurrentThemePtr() : nullptr);
-
// Prepare support for the advanced DiagramHelper using Diagram & Theme data
- pShape->prepareDiagramHelper(pDiagram, aThemePtr);
+ pShape->prepareDiagramHelper(pDiagram, rFilter.getCurrentThemePtr());
}
void loadDiagram(ShapePtr const& pShape,
@@ -418,52 +417,6 @@ void loadDiagram(ShapePtr const& pShape,
pDiagram->addTo(pShape);
}
-void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& rFilter)
-{
- DiagramDataPtr pDiagramData = std::dynamic_pointer_cast<DiagramData>(pObj->GetDiagramData());
- if (!pDiagramData)
- return;
-
- pObj->getChildrenOfSdrObject()->ClearSdrObjList();
-
- uno::Reference<css::drawing::XShape> xShape(pObj->getUnoShape());
- uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY_THROW);
-
- uno::Reference<xml::dom::XDocument> layoutDom;
- uno::Reference<xml::dom::XDocument> styleDom;
- uno::Reference<xml::dom::XDocument> colorDom;
-
- // retrieve the doms from the GrabBag
- uno::Sequence<beans::PropertyValue> propList;
- xPropSet->getPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG) >>= propList;
- for (const auto& rProp : std::as_const(propList))
- {
- OUString propName = rProp.Name;
- if (propName == "OOXLayout")
- rProp.Value >>= layoutDom;
- else if (propName == "OOXStyle")
- rProp.Value >>= styleDom;
- else if (propName == "OOXColor")
- rProp.Value >>= colorDom;
- }
-
- ShapePtr pShape = std::make_shared<Shape>();
- pShape->setDiagramType();
- pShape->setSize(
- awt::Size(o3tl::convert(xShape->getSize().Width, o3tl::Length::mm100, o3tl::Length::emu),
- o3tl::convert(xShape->getSize().Height, o3tl::Length::mm100, o3tl::Length::emu)));
-
- loadDiagram(pShape, pDiagramData, layoutDom, styleDom, colorDom, rFilter);
-
- uno::Reference<drawing::XShapes> xShapes(xShape, uno::UNO_QUERY_THROW);
- basegfx::B2DHomMatrix aTransformation;
- aTransformation.translate(
- o3tl::convert(xShape->getPosition().X, o3tl::Length::mm100, o3tl::Length::emu),
- o3tl::convert(xShape->getPosition().Y, o3tl::Length::mm100, o3tl::Length::emu));
- for (auto const& child : pShape->getChildren())
- child->addShape(rFilter, rFilter.getCurrentTheme(), xShapes, aTransformation, pShape->getFillProperties());
-}
-
const oox::drawingml::Color&
DiagramColor::getColorByIndex(const std::vector<oox::drawingml::Color>& rColors, sal_Int32 nIndex)
{
diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx
index f9f2b7d8a05a..3b42a834951a 100644
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -150,6 +150,7 @@ public:
css::uno::Sequence<css::beans::PropertyValue> getDomsAsPropertyValues() const;
ShapePtr getShape() const { return mpShape.lock(); }
+ void newTargetShape(ShapePtr& pTarget);
private:
WeakShapePtr mpShape;
diff --git a/oox/source/drawingml/diagram/diagramhelper.cxx b/oox/source/drawingml/diagram/diagramhelper.cxx
index 61179993461d..268c7bb43f71 100644
--- a/oox/source/drawingml/diagram/diagramhelper.cxx
+++ b/oox/source/drawingml/diagram/diagramhelper.cxx
@@ -30,10 +30,15 @@ using namespace ::com::sun::star;
namespace oox::drawingml {
+bool AdvancedDiagramHelper::hasDiagramData() const
+{
+ return mpDiagramPtr && mpDiagramPtr->getData();
+}
+
AdvancedDiagramHelper::AdvancedDiagramHelper(
const std::shared_ptr< Diagram >& rDiagramPtr,
const std::shared_ptr<::oox::drawingml::Theme>& rTheme)
-: DiagramHelper()
+: IDiagramHelper()
, mpDiagramPtr(rDiagramPtr)
, mpThemePtr(rTheme)
{
@@ -45,85 +50,137 @@ AdvancedDiagramHelper::~AdvancedDiagramHelper()
void AdvancedDiagramHelper::reLayout()
{
- if(mpDiagramPtr)
+ if(!mpDiagramPtr)
{
- // Get the oox::Shape that represents the Diagram GraphicObject
- const ShapePtr & pParentShape = mpDiagramPtr->getShape();
+ return;
+ }
- // Remove it's children which represent the oox::Shapes created by
- // the layout process as preparation to re-creation. These should
- // already be cleared, but make sure.
- pParentShape->getChildren().clear();
+ // Get the oox::Shape that represents the Diagram GraphicObject
+ const ShapePtr & pParentShape = mpDiagramPtr->getShape();
- // Re-create the oox::Shapes for the diagram content
- mpDiagramPtr->addTo(pParentShape);
-
- // Access the GroupObject representing the SmartArt in DrawingLayer
- SdrObjGroup* pAnchorObj(dynamic_cast<SdrObjGroup*>(SdrObject::getSdrObjectFromXShape(pParentShape->getXShape())));
-
- // Rescue/remember geometric transformation of existing Diagram
- basegfx::B2DHomMatrix aTransformation;
- basegfx::B2DPolyPolygon aPolyPolygon;
- pAnchorObj->TRGetBaseGeometry(aTransformation, aPolyPolygon);
-
- // Delete all existing shapes in that group to prepare re-creation
- pAnchorObj->getChildrenOfSdrObject()->ClearSdrObjList();
-
- // For re-creation we need to use ::addShape functionality from the
- // oox import filter since currently Shape import is very tightly
- // coupled to Shape creation. It converts a oox::Shape representation
- // combined with an oox::Theme to incarrnated XShapes representing the
- // Diagram.
- // To use that functionality, we have to create a temporary filter
- // (based on ShapeFilterBase). Problems are that this needs to know
- // the oox:Theme and a ComponentModel from TargetDocument.
- // The DiagramHelper holds/delivers the oox::Theme to use, so
- // it does not need to be re-imported from oox repeatedly.
- // The ComponentModel can be derived from the existing XShape/GroupShape
- // when knowing where to get it from, making it independent from app.
- //
- // NOTE: Using another (buffered) oox::Theme would allow to re-create
- // using another theming in the future.
- // NOTE: The incarnation of import filter (ShapeFilterBase) is only
- // used for XShape creation, no xml snippets/data gets imported
- // here. XShape creation may be isolated in the future.
- SdrModel& rModel(pAnchorObj->getSdrModelFromSdrObject());
- uno::Reference< uno::XInterface > const & rUnoModel(rModel.getUnoModel());
- css::uno::Reference<css::uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
- rtl::Reference<oox::shape::ShapeFilterBase> xFilter(new oox::shape::ShapeFilterBase(xContext));
- xFilter->setCurrentTheme(mpThemePtr);
- css::uno::Reference< css::lang::XComponent > aComponentModel( rUnoModel, uno::UNO_QUERY );
- xFilter->setTargetDocument(aComponentModel);
-
- // Prepare the target for the to-be-created XShapes
- uno::Reference<drawing::XShapes> xShapes(pParentShape->getXShape(), uno::UNO_QUERY_THROW);
-
- for (auto const& child : pParentShape->getChildren())
- {
- // Create all sub-shapes. This will recursively create needed geometry using
- // filter-internal ::createShapes
- child->addShape(
- *xFilter,
- xFilter->getCurrentTheme(),
- xShapes,
- aTransformation,
- pParentShape->getFillProperties());
- }
-
- // Re-apply remembered geometry
- pAnchorObj->TRSetBaseGeometry(aTransformation, aPolyPolygon);
-
- // Delete oox::Shapes that represented the content of the
- // diagram. These were needed for creating the XShapes/SdrObjects
- // (created by ::addTo above) but are no longer needed, so free
- // the memory
- pParentShape->getChildren().clear();
+ if(!pParentShape)
+ {
+ return;
+ }
+
+ // Remove it's children which represent the oox::Shapes created by
+ // the layout process as preparation to re-creation. These should
+ // already be cleared, but make sure.
+ pParentShape->getChildren().clear();
+
+ // Re-create the oox::Shapes for the diagram content
+ mpDiagramPtr->addTo(pParentShape);
+
+ // Access the GroupObject representing the SmartArt in DrawingLayer
+ SdrObjGroup* pAnchorObj(dynamic_cast<SdrObjGroup*>(SdrObject::getSdrObjectFromXShape(pParentShape->getXShape())));
+
+ // Rescue/remember geometric transformation of existing Diagram
+ basegfx::B2DHomMatrix aTransformation;
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ pAnchorObj->TRGetBaseGeometry(aTransformation, aPolyPolygon);
+
+ // Delete all existing shapes in that group to prepare re-creation
+ pAnchorObj->getChildrenOfSdrObject()->ClearSdrObjList();
+
+ // For re-creation we need to use ::addShape functionality from the
+ // oox import filter since currently Shape import is very tightly
+ // coupled to Shape creation. It converts a oox::Shape representation
+ // combined with an oox::Theme to incarrnated XShapes representing the
+ // Diagram.
+ // To use that functionality, we have to create a temporary filter
+ // (based on ShapeFilterBase). Problems are that this needs to know
+ // the oox:Theme and a ComponentModel from TargetDocument.
+ // The DiagramHelper holds/delivers the oox::Theme to use, so
+ // it does not need to be re-imported from oox repeatedly.
+ // The ComponentModel can be derived from the existing XShape/GroupShape
+ // when knowing where to get it from, making it independent from app.
+ //
+ // NOTE: Using another (buffered) oox::Theme would allow to re-create
+ // using another theming in the future.
+ // NOTE: The incarnation of import filter (ShapeFilterBase) is only
+ // used for XShape creation, no xml snippets/data gets imported
+ // here. XShape creation may be isolated in the future.
+ SdrModel& rModel(pAnchorObj->getSdrModelFromSdrObject());
+ uno::Reference< uno::XInterface > const & rUnoModel(rModel.getUnoModel());
+ css::uno::Reference<css::uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
+ rtl::Reference<oox::shape::ShapeFilterBase> xFilter(new oox::shape::ShapeFilterBase(xContext));
+ xFilter->setCurrentTheme(mpThemePtr);
+ css::uno::Reference< css::lang::XComponent > aComponentModel( rUnoModel, uno::UNO_QUERY );
+ xFilter->setTargetDocument(aComponentModel);
+
+ // Prepare the target for the to-be-created XShapes
+ uno::Reference<drawing::XShapes> xShapes(pParentShape->getXShape(), uno::UNO_QUERY_THROW);
+
+ for (auto const& child : pParentShape->getChildren())
+ {
+ // Create all sub-shapes. This will recursively create needed geometry using
+ // filter-internal ::createShapes
+ child->addShape(
+ *xFilter,
+ xFilter->getCurrentTheme(),
+ xShapes,
+ aTransformation,
+ pParentShape->getFillProperties());
+ }
+
+ // Re-apply remembered geometry
+ pAnchorObj->TRSetBaseGeometry(aTransformation, aPolyPolygon);
+
+ // Delete oox::Shapes that represented the content of the
+ // diagram. These were needed for creating the XShapes/SdrObjects
+ // (created by ::addTo above) but are no longer needed, so free
+ // the memory
+ pParentShape->getChildren().clear();
+}
+
+OUString AdvancedDiagramHelper::getString() const
+{
+ if(hasDiagramData())
+ {
+ return mpDiagramPtr->getData()->getString();
}
+
+ return OUString();
+}
+
+std::vector<std::pair<OUString, OUString>> AdvancedDiagramHelper::getChildren(const OUString& rParentId) const
+{
+ if(hasDiagramData())
+ {
+ return mpDiagramPtr->getData()->getChildren(rParentId);
+ }
+
+ return std::vector<std::pair<OUString, OUString>>();
+}
+
+OUString AdvancedDiagramHelper::addNode(const OUString& rText)
+{
+ if(hasDiagramData())
+ {
+ return mpDiagramPtr->getData()->addNode(rText);
+ }
+
+ return OUString();
+}
+
+bool AdvancedDiagramHelper::removeNode(const OUString& rNodeId)
+{
+ if(hasDiagramData())
+ {
+ return mpDiagramPtr->getData()->removeNode(rNodeId);
+ }
+
+ return false;
}
void AdvancedDiagramHelper::doAnchor(SdrObjGroup& rTarget)
{
- const ShapePtr & pParentShape = mpDiagramPtr->getShape();
+ if(!mpDiagramPtr)
+ {
+ return;
+ }
+
+ const ShapePtr& pParentShape(mpDiagramPtr->getShape());
if(pParentShape)
{
@@ -135,6 +192,16 @@ void AdvancedDiagramHelper::doAnchor(SdrObjGroup& rTarget)
anchorToSdrObjGroup(rTarget);
}
+void AdvancedDiagramHelper::newTargetShape(ShapePtr& pTarget)
+{
+ if(!mpDiagramPtr)
+ {
+ return;
+ }
+
+ mpDiagramPtr->newTargetShape(pTarget);
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/diagram/diagramhelper.hxx b/oox/source/drawingml/diagram/diagramhelper.hxx
index c6bd507f32e6..9c4d4cfadb37 100644
--- a/oox/source/drawingml/diagram/diagramhelper.hxx
+++ b/oox/source/drawingml/diagram/diagramhelper.hxx
@@ -41,19 +41,36 @@ class Diagram;
// - deliver representative data from the Diagram-Model
// - modify it eventually
// - im/export Diagram model to other representations
-class AdvancedDiagramHelper final : public DiagramHelper
+class AdvancedDiagramHelper final : public IDiagramHelper
{
const std::shared_ptr< Diagram > mpDiagramPtr;
const std::shared_ptr<::oox::drawingml::Theme> mpThemePtr;
+ bool hasDiagramData() const;
+
public:
AdvancedDiagramHelper(
const std::shared_ptr< Diagram >& rDiagramPtr,
const std::shared_ptr<::oox::drawingml::Theme>& rTheme);
virtual ~AdvancedDiagramHelper();
- virtual void reLayout();
+ // re-create XShapes
+ virtual void reLayout() override;
+
+ // get text representation of data tree
+ virtual OUString getString() const override;
+
+ // get children of provided data node
+ // use empty string for top-level nodes
+ // returns vector of (id, text)
+ virtual std::vector<std::pair<OUString, OUString>> getChildren(const OUString& rParentId) const override;
+
+ // add/remove new top-level node to data model, returns its id
+ virtual OUString addNode(const OUString& rText) override;
+ virtual bool removeNode(const OUString& rNodeId) override;
+
void doAnchor(SdrObjGroup& rTarget);
+ void newTargetShape(ShapePtr& pTarget);
};
}
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 97f87a2683ab..bd69137003ec 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -237,6 +237,36 @@ void Shape::propagateDiagramHelper()
}
}
+void Shape::migrateDiagramHelperToNewShape(ShapePtr& pTarget)
+{
+ if(!mpDiagramHelper)
+ {
+ return;
+ }
+
+ if(!pTarget)
+ {
+ // no migrate target, but cleanup helper
+ delete mpDiagramHelper;
+ mpDiagramHelper = nullptr;
+ return;
+ }
+
+ if(pTarget->mpDiagramHelper)
+ {
+ // this should no happen, bu if there is already a helper, clean it up
+ delete pTarget->mpDiagramHelper;
+ pTarget->mpDiagramHelper = nullptr;
+ }
+
+ // DiagramHelper has references to this, these need to be replaced
+ static_cast<AdvancedDiagramHelper*>(mpDiagramHelper)->newTargetShape(pTarget);
+
+ // exchange and reset to nullptr
+ pTarget->mpDiagramHelper = mpDiagramHelper;
+ mpDiagramHelper = nullptr;
+}
+
table::TablePropertiesPtr const & Shape::getTableProperties()
{
if ( !mpTablePropertiesPtr )
@@ -375,6 +405,9 @@ void Shape::addShape(
{
keepDiagramCompatibilityInfo();
+ // set DiagramHelper at SdrObjGroup
+ propagateDiagramHelper();
+
// Check if this is the PPTX import, so far converting SmartArt to a non-editable
// metafile is only implemented for DOCX.
bool bPowerPoint = dynamic_cast<oox::ppt::PowerPointImport*>(&rFilterBase) != nullptr;
@@ -1805,12 +1838,6 @@ void Shape::keepDiagramCompatibilityInfo()
if ( !xSetInfo.is() )
return;
- if (mpDiagramData)
- {
- if (SdrObject* pObj = SdrObject::getSdrObjectFromXShape(mxShape))
- pObj->SetDiagramData(mpDiagramData);
- }
-
const OUString aGrabBagPropName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
if( !xSetInfo->hasPropertyByName( aGrabBagPropName ) )
return;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index cb5383104a61..6e4197fa69c3 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2865,29 +2865,6 @@ bool DrawingML::IsGroupShape( const Reference< XShape >& rXShape )
return bRet;
}
-bool DrawingML::IsDiagram(const Reference<XShape>& rXShape)
-{
- uno::Reference<beans::XPropertySet> xPropSet(rXShape, uno::UNO_QUERY);
- if (!xPropSet.is())
- return false;
-
- // if the shape doesn't have the InteropGrabBag property, it's not a diagram
- uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
- OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
- if (!xPropSetInfo->hasPropertyByName(aName))
- return false;
-
- uno::Sequence<beans::PropertyValue> propList;
- xPropSet->getPropertyValue(aName) >>= propList;
- return std::any_of(std::cbegin(propList), std::cend(propList),
- [](const beans::PropertyValue& rProp) {
- // if we find any of the diagram components, it's a diagram
- OUString propName = rProp.Name;
- return propName == "OOXData" || propName == "OOXLayout" || propName == "OOXStyle"
- || propName == "OOXColor" || propName == "OOXDrawing";
- });
-}
-
sal_Int32 DrawingML::getBulletMarginIndentation (const Reference< XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName)
{
if (nLevel < 0 || !GetProperty(rXPropSet, "NumberingRules"))
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index cacd46d82d14..e88637fc4714 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -427,6 +427,10 @@ ShapeContextHandler::getShape()
pShapePtr->setDiagramDoms(mpShape->getDiagramDoms());
pShapePtr->keepDiagramDrawing(*mxShapeFilterBase, aFragmentPath);
+ // migrate IDiagramHelper to new oox::Shape (from mpShape which was loaded
+ // to pShapePtr where the geometry is now constructed)
+ mpShape->migrateDiagramHelperToNewShape(pShapePtr);
+
if (!mpShape->getChildren().empty())
{
// first child is diagram background - we want to keep it, as drawingML fallback doesn't contain it
diff --git a/oox/source/shape/ShapeFilterBase.cxx b/oox/source/shape/ShapeFilterBase.cxx
index 38c310b47663..ebd47d83e9d5 100644
--- a/oox/source/shape/ShapeFilterBase.cxx
+++ b/oox/source/shape/ShapeFilterBase.cxx
@@ -54,6 +54,11 @@ const ::oox::drawingml::Theme* ShapeFilterBase::getCurrentTheme() const
return mpTheme.get();
}
+std::shared_ptr<::oox::drawingml::Theme> ShapeFilterBase::getCurrentThemePtr() const
+{
+ return mpTheme;
+}
+
void ShapeFilterBase::setCurrentTheme(const ::oox::drawingml::ThemePtr& pTheme)
{
mpTheme = pTheme;
diff --git a/reportdesign/inc/pch/precompiled_rpt.hxx b/reportdesign/inc/pch/precompiled_rpt.hxx
index 6f744ed1e3e4..002da98ac10e 100644
--- a/reportdesign/inc/pch/precompiled_rpt.hxx
+++ b/reportdesign/inc/pch/precompiled_rpt.hxx
@@ -245,7 +245,6 @@
#include <svl/svldllapi.h>
#include <svl/typedwhich.hxx>
#include <svl/whichranges.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/itextprovider.hxx>
#include <svx/sdr/properties/defaultproperties.hxx>
#include <svx/sdr/properties/properties.hxx>
diff --git a/reportdesign/inc/pch/precompiled_rptui.hxx b/reportdesign/inc/pch/precompiled_rptui.hxx
index 4fef73243d89..d67a85cf3164 100644
--- a/reportdesign/inc/pch/precompiled_rptui.hxx
+++ b/reportdesign/inc/pch/precompiled_rptui.hxx
@@ -365,7 +365,6 @@
#include <svtools/extcolorcfg.hxx>
#include <svtools/statusbarcontroller.hxx>
#include <svtools/svtdllapi.h>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/XPropertyEntry.hxx>
#include <svx/ipolypolygoneditorcontroller.hxx>
#include <svx/itextprovider.hxx>
diff --git a/sd/inc/pch/precompiled_sdui.hxx b/sd/inc/pch/precompiled_sdui.hxx
index 2eed698130b6..237dd892c4dc 100644
--- a/sd/inc/pch/precompiled_sdui.hxx
+++ b/sd/inc/pch/precompiled_sdui.hxx
@@ -391,7 +391,6 @@
#include <svtools/svtdllapi.h>
#include <svtools/unitconv.hxx>
#include <svtools/valueset.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/XPropertyEntry.hxx>
#include <svx/drawitem.hxx>
#include <svx/flagsdef.hxx>
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index f69938ab1326..df29ef09c2d8 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1497,6 +1497,9 @@ void SdOOXMLExportTest2::testSmartartRotation2()
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/smartart-rotation2.pptx"), PPTX);
// clear SmartArt data to check how group shapes with double-rotated children are exported, not smartart
+ // NOTE: Resetting the GrabBag data is a *very* indirect way to reset the SmartArt functionality.
+ // Since this worked before and there is not (yet?) a better way do do it using UNO API, I added
+ // code to support this for now
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
uno::Sequence<beans::PropertyValue> aInteropGrabBag;
xShape->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag));
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index c96db47eb3cc..07be6521d678 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -62,6 +62,7 @@
#include <i18nlangtag/languagetag.hxx>
#include <svx/svdpage.hxx>
#include <svx/unoapi.hxx>
+#include <svx/svdogrp.hxx>
#include <sdmod.hxx>
#include <sdpage.hxx>
@@ -1646,7 +1647,10 @@ void PowerPointExport::WriteShapeTree(const FSHelperPtr& pFS, PageType ePageType
if (GetShapeByIndex(GetCurrentGroupIndex(), true))
{
SAL_INFO("sd.eppt", "mType: " << mType);
- if (DrawingML::IsDiagram(mXShape))
+ const SdrObjGroup* pDiagramCandidate(dynamic_cast<const SdrObjGroup*>(SdrObject::getSdrObjectFromXShape(mXShape)));
+ const bool bIsDiagram(nullptr != pDiagramCandidate && pDiagramCandidate->isDiagram());
+
+ if (bIsDiagram)
WriteDiagram(pFS, aDML, mXShape, mnDiagramId++);
else
aDML.WriteShape(mXShape);
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 8e06b9327def..0d2b32fb7a33 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -487,27 +487,9 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
if (rMarkList.GetMarkCount() == 1)
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), UNO_QUERY);
- static bool bAdvancedSmartArt(nullptr != getenv("SAL_ENABLE_ADVANCED_SMART_ART"));
-
- if (!bAdvancedSmartArt && oox::drawingml::DrawingML::IsDiagram(xShape))
- {
- mpDrawView->UnmarkAll();
-
- 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(pObj, *xFilter);
-
- mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView());
- }
-
// Support advanced DiagramHelper
SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj);
- if(bAdvancedSmartArt && pAnchorObj && pAnchorObj->isDiagram())
+ if(pAnchorObj && pAnchorObj->isDiagram())
{
mpDrawView->UnmarkAll();
pAnchorObj->getDiagramHelper()->reLayout();
@@ -525,13 +507,15 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
if (rMarkList.GetMarkCount() == 1)
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), UNO_QUERY);
+ // Support advanced DiagramHelper
+ SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj);
- if (oox::drawingml::DrawingML::IsDiagram(xShape))
+ if(pAnchorObj && pAnchorObj->isDiagram())
{
VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
- ScopedVclPtr<VclAbstractDialog> pDlg
- = pFact->CreateDiagramDialog(GetFrameWeld(), pObj->GetDiagramData());
+ ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog(
+ GetFrameWeld(),
+ pAnchorObj->getDiagramHelper());
pDlg->Execute();
}
}
diff --git a/slideshow/inc/pch/precompiled_slideshow.hxx b/slideshow/inc/pch/precompiled_slideshow.hxx
index 7670b0c95443..4f3615457469 100644
--- a/slideshow/inc/pch/precompiled_slideshow.hxx
+++ b/slideshow/inc/pch/precompiled_slideshow.hxx
@@ -276,7 +276,6 @@
#include <svl/svldllapi.h>
#include <svl/typedwhich.hxx>
#include <svl/whichranges.hxx>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/itextprovider.hxx>
#include <svx/sdr/animation/scheduler.hxx>
#include <svx/sdr/overlay/overlayobject.hxx>
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index cb89a2fc5555..f4068748d512 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -189,7 +189,6 @@ SdrObjTransformInfoRec::SdrObjTransformInfoRec() :
struct SdrObject::Impl
{
sdr::ObjectUserVector maObjectUsers;
- std::shared_ptr<DiagramDataInterface> mpDiagramData;
std::optional<double> mnRelativeWidth;
std::optional<double> mnRelativeHeight;
sal_Int16 meRelativeWidthRelation;
@@ -637,16 +636,6 @@ sal_Int16 SdrObject::GetRelativeHeightRelation() const
return mpImpl->meRelativeHeightRelation;
}
-void SdrObject::SetDiagramData(std::shared_ptr<DiagramDataInterface> pDiagramData)
-{
- mpImpl->mpDiagramData = pDiagramData;
-}
-
-const std::shared_ptr<DiagramDataInterface> & SdrObject::GetDiagramData() const
-{
- return mpImpl->mpDiagramData;
-}
-
SfxItemPool& SdrObject::GetObjectItemPool() const
{
return getSdrModelFromSdrObject().GetItemPool();
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 47e9f0f83901..dae41c92b2e8 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -35,10 +35,10 @@
#include <rtl/ustrbuf.hxx>
#include <vcl/canvastools.hxx>
-DiagramHelper::DiagramHelper() {}
-DiagramHelper::~DiagramHelper() {}
+IDiagramHelper::IDiagramHelper() {}
+IDiagramHelper::~IDiagramHelper() {}
-void DiagramHelper::anchorToSdrObjGroup(SdrObjGroup& rTarget)
+void IDiagramHelper::anchorToSdrObjGroup(SdrObjGroup& rTarget)
{
rTarget.mp_DiagramHelper.reset(this);
}
@@ -205,6 +205,38 @@ SdrObjList* SdrObjGroup::GetSubList() const
return const_cast< SdrObjGroup* >(this);
}
+static bool containsOOXData(const css::uno::Any& rVal)
+{
+ const css::uno::Sequence<css::beans::PropertyValue>& propList(rVal.get< css::uno::Sequence<css::beans::PropertyValue> >());
+ for (const auto& rProp : std::as_const(propList))
+ {
+ if(rProp.Name.startsWith("OOX"))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void SdrObjGroup::SetGrabBagItem(const css::uno::Any& rVal)
+{
+ // detect if the intention is to disable Diagram functionality
+ if(isDiagram() && !containsOOXData(rVal))
+ {
+ css::uno::Any aOld;
+ GetGrabBagItem(aOld);
+
+ if(containsOOXData(aOld))
+ {
+ mp_DiagramHelper.reset();
+ }
+ }
+
+ // call parent
+ SdrObject::SetGrabBagItem(rVal);
+}
+
const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
{
// <aOutRect> has to contain the bounding rectangle
diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx
index 035af3ef0359..4cef754130eb 100644
--- a/sw/inc/pch/precompiled_msword.hxx
+++ b/sw/inc/pch/precompiled_msword.hxx
@@ -429,7 +429,6 @@
#include <svl/zforlist.hxx>
#include <svtools/colorcfg.hxx>
#include <svtools/svtdllapi.h>
-#include <svx/DiagramDataInterface.hxx>
#include <svx/XPropertyEntry.hxx>
#include <svx/flagsdef.hxx>
#include <svx/ipolypolygoneditorcontroller.hxx>
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 959e391e3e37..9bb849bce6aa 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -98,6 +98,7 @@
#include <svx/xflgrit.hxx>
#include <svx/svdouno.hxx>
#include <svx/unobrushitemhelper.hxx>
+#include <svx/svdogrp.hxx>
#include <svl/grabbagitem.hxx>
#include <sfx2/sfxbasemodel.hxx>
#include <tools/date.hxx>
@@ -6426,10 +6427,10 @@ void DocxAttributeOutput::WriteFlyFrame(const ww8::Frame& rFrame)
const SdrObject* pSdrObj = rFrame.GetFrameFormat().FindRealSdrObject();
if ( pSdrObj )
{
- uno::Reference<drawing::XShape> xShape(
- const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY);
+ const SdrObjGroup* pDiagramCandidate(dynamic_cast<const SdrObjGroup*>(pSdrObj));
+ const bool bIsDiagram(nullptr != pDiagramCandidate && pDiagramCandidate->isDiagram());
- if (xShape.is() && oox::drawingml::DrawingML::IsDiagram(xShape))
+ if (bIsDiagram)
{
if ( !m_pPostponedDiagrams )
{
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 4fe5712b591f..f1762cbfdd04 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -45,6 +45,7 @@
#include <svx/svditer.hxx>
#include <svx/svdobj.hxx>
+#include <svx/svdogrp.hxx>
#include <svx/svdtrans.hxx>
#include <svx/unoapi.hxx>
#include <cppuhelper/implbase.hxx>
@@ -918,7 +919,8 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
// tdf#143455: A diagram is imported as group, but has no valid object list
// and contour wrap is different to Word. As workaround diagrams are excluded
// here in various places.
- const bool bIsDiagram = oox::drawingml::DrawingML::IsDiagram(m_xShape);
+ const SdrObjGroup* pDiagramCandidate(dynamic_cast<const SdrObjGroup*>(SdrObject::getSdrObjectFromXShape(m_xShape)));
+ const bool bIsDiagram(nullptr != pDiagramCandidate && pDiagramCandidate->isDiagram());
// tdf#143476: A lockedCanvas (Word2007) is imported as group, but has not
// got size and position. Values from m_Impl has to be used.
bool bIsLockedCanvas(false);