diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-02-22 19:39:04 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-02-25 09:48:14 +0100 |
commit | ec635b62af9424eddb32cc4646bc425559f4a622 (patch) | |
tree | d67108b25234233cb5fa7893c09bbcd3f8d32def /include/oox | |
parent | 56c871c247b84d7c2cddf685c13e8355db50da46 (diff) |
Advanced Diagram support: cleanup/consolidate with existing code
Reorganized and streamlined, use IDiagramHelper as main interface
now also for existing code.
Had to adapt oox::Shape && Diagram handling since there the
import gets handled very different. This ensures that a Diagram
is detected at export and that the same happens for now as before
Had to add a detection that resetting the GrabBag is meant to
disable the Diagam functionality. That is very indirect, but
has to stay for compaibility reasons for now
Change-Id: I620b7d61cd84b5f9dd8ae4dc890ebf70ce779cdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130389
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'include/oox')
-rw-r--r-- | include/oox/core/xmlfilterbase.hxx | 3 | ||||
-rw-r--r-- | include/oox/drawingml/diagram/diagram.hxx | 2 | ||||
-rw-r--r-- | include/oox/drawingml/shape.hxx | 12 | ||||
-rw-r--r-- | include/oox/export/drawingml.hxx | 1 | ||||
-rw-r--r-- | include/oox/ppt/pptimport.hxx | 2 | ||||
-rw-r--r-- | include/oox/shape/ShapeFilterBase.hxx | 3 |
6 files changed, 13 insertions, 10 deletions
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. */ |