summaryrefslogtreecommitdiffstats
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 14:39:02 +0200
commitc22ab1cba13d59d7982d8972ece7e8a64e9a74fa (patch)
treefea69aef87ac5ba7b88aaa155a440adee7a6961d /include
parentsvx UNO API for shapes: allow setting a max factor for autofit text scale (diff)
downloadcore-c22ab1cba13d59d7982d8972ece7e8a64e9a74fa.tar.gz
core-c22ab1cba13d59d7982d8972ece7e8a64e9a74fa.zip
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 Change-Id: I6c591eadc7166c7c42752650afdb7ee1e416cff6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102711 Tested-by: Jenkins Reviewed-by: Gülşah Köse <gulsah.kose@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 4264e54fb3e4..4907a4c9ddf4 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 b1f15e5b6ece..fea94105b65d 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;
};
}