summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-11 17:30:27 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-15 17:21:51 +0200
commit6a6a8f25f8c75f1220b66c4071d1739ced7c80b4 (patch)
tree70b76d0d42d0de7eac26c8180914f0c00ec5889c /include
parent3e8cce134c92690da1955953da118d45f1c5ddde (diff)
oox smartart: add support for syncing font heights of multiple shapes
When 2 or more shapes have their text set to autofit and they have a constraint like: <dgm:constr type="primFontSz" for="des" forName="node" op="equ"/> Then make sure that the automatic font size is the same for all shapes and all content fits, by using the smallest scaling factor from all relevant shapes. Some rework is needed, because normally oox::drawingml::Shapes don't have access to their parents, at the same time there can be multiple SmartArts on a single slide, so storing the grouping info in the filter is problematic, too. Solve this by storing the grouping in the toplevel oox::drawingml::Shape and exposing them in XmlFilterBase just during the time the children of the toplevel shape of the SmartArt are added. This works, because we know SmartArts can't be nested. (cherry picked from commit 1bd3474c7c7945e1182dfbaca89be05ea98dd3e8) Conflicts: include/oox/core/xmlfilterbase.hxx oox/source/drawingml/diagram/diagram.cxx Change-Id: I6c591eadc7166c7c42752650afdb7ee1e416cff6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102726 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/oox/core/xmlfilterbase.hxx8
-rw-r--r--include/oox/drawingml/shape.hxx8
2 files changed, 16 insertions, 0 deletions
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
index 68bd801eaefd..cb8be7117fdf 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -65,6 +65,7 @@ namespace sax_fastparser {
namespace utl { class MediaDescriptor; }
namespace oox {
+namespace drawingml { class Shape; }
namespace core {
class FragmentHandler;
@@ -79,6 +80,10 @@ typedef std::vector< TextField > TextFieldStack;
struct XmlFilterBaseImpl;
+using ShapePairs
+ = std::map<std::shared_ptr<drawingml::Shape>, css::uno::Reference<css::drawing::XShape>>;
+using NamedShapePairs = std::map<OUString, ShapePairs>;
+
class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
{
public:
@@ -242,6 +247,9 @@ public:
/// user about it.
void setMissingExtDrawing();
+ void setDiagramFontHeights(NamedShapePairs* pDiagramFontHeights);
+ NamedShapePairs* getDiagramFontHeights();
+
void checkDocumentProperties(
const css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 1895c2f2aad6..5b6fd21ce00d 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -29,6 +29,8 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+
+#include <oox/core/xmlfilterbase.hxx>
#include <oox/dllapi.h>
#include <oox/drawingml/color.hxx>
#include <oox/drawingml/drawingmltypes.hxx>
@@ -239,6 +241,8 @@ public:
void keepDiagramDrawing(::oox::core::XmlFilterBase& rFilterBase, const OUString& rFragmentPath);
+ oox::core::NamedShapePairs& getDiagramFontHeights() { return maDiagramFontHeights; }
+
protected:
enum FrameType
@@ -272,6 +276,7 @@ protected:
const basegfx::B2DHomMatrix& aTransformation );
void keepDiagramCompatibilityInfo();
+ void syncDiagramFontHeights();
void convertSmartArtToMetafile( ::oox::core::XmlFilterBase const& rFilterBase );
css::uno::Reference< css::drawing::XShape >
@@ -377,6 +382,9 @@ private:
/// The shape fill should be set to that of the slide background surface.
bool mbUseBgFill = false;
+
+ /// For SmartArt, this contains groups of shapes: automatic font size is the same in each group.
+ oox::core::NamedShapePairs maDiagramFontHeights;
};
} }