summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2022-10-20 14:28:07 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-10-24 15:09:37 +0200
commit9ad7df41572d67687221cb43d53cde27a45fff0f (patch)
treeb2c81fe59972afd4c478abe36161c8875939cad4 /include
parentdba424efc15aa2915c38721c27edf0cc1d716bd1 (diff)
tdf#83671 make SmartArt visible in import of xlsx
Problem is, that Excel writes a zero size in xdr:xfrm for the SmartArt. With that the import generates a background size with zero width and height and no shapes at all in the SmartArt group. The diagram DOM is imported correctly. The actual size is not known until the row and column values of the anchor are evaluated. The idea of this patch is to correct the background size directly and to repeat the import of drawing.xml when the actual size is known. I noticed that in import of SmartArt in docx there is a similar problem that the SmartArt shapes are missing at some point, as can be seen in ShapeContextHandler::getShape(), about line 428. It uses ShapeDrawingFragmentHandler to import the shapes. To be able to use that handler too, I have moved its header file to include. The solution for docx uses a loop over the vector getExtDrawings(). But I have not seen a SmartArt case, where more then one element exists in it. Whether the shape is a diagram, is indirectly tested currently. The shape has yet no direct method for it. Change-Id: I9d705ed5bfb2894e9ce740ebf8589e06b4870bed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141571 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/oox/shape/ShapeDrawingFragmentHandler.hxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/oox/shape/ShapeDrawingFragmentHandler.hxx b/include/oox/shape/ShapeDrawingFragmentHandler.hxx
new file mode 100644
index 000000000000..340edca5e1d1
--- /dev/null
+++ b/include/oox/shape/ShapeDrawingFragmentHandler.hxx
@@ -0,0 +1,35 @@
+/* -*- 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_OOX_SOURCE_SHAPE_SHAPEDRAWINGFRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_SOURCE_SHAPE_SHAPEDRAWINGFRAGMENTHANDLER_HXX
+
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+
+namespace oox::shape {
+
+/// Generic (i.e. not specific to PPTX) handler for the prerendered diagram parsing.
+class OOX_DLLPUBLIC ShapeDrawingFragmentHandler : public oox::core::FragmentHandler2
+{
+public:
+ ShapeDrawingFragmentHandler(oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, oox::drawingml::ShapePtr pGroupShapePtr);
+ virtual ~ShapeDrawingFragmentHandler() noexcept override;
+ virtual void SAL_CALL endDocument() override;
+ virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 Element, const AttributeList& rAttribs ) override;
+
+private:
+ oox::drawingml::ShapePtr mpGroupShapePtr;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */