diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-08-22 02:02:07 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-08-22 07:53:36 +0200 |
commit | 2d1fe7fb67ec1ff1b96912c0945d17d54aecb12e (patch) | |
tree | 6d783d7a89d3613544b6de64245f7e9ae147bc75 /include/oox | |
parent | 508957dbf49be577188fb4c112405717957b2734 (diff) |
Fix two issues in ActiveX DOCX import / export code
* Inline anchored VML shape had wrong vertical position
** In MSO inline shapes are positioned to the top of the baseline
* During export all shape ids were the same (shape_0)
** VML shapes used to be exported only as fallback,
I guess that's why it did not cause any issue before.
** Override the shapeid generator with a new one, which
actually generates unique shapeids.
Change-Id: I752f39d092d0b61d91824141655dae662dbeafbc
Reviewed-on: https://gerrit.libreoffice.org/41319
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'include/oox')
-rw-r--r-- | include/oox/export/vmlexport.hxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index c098ace13cb7..ee40b933deaa 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -111,6 +111,17 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx /// Use '#' mark for type attribute (check Type Attribute of VML shape in OOXML documentation) bool m_bUseHashMarkForType; + /** There is a shapeid generation mechanism in EscherEx, but it does not seem to work + * so override the existing behavior to get actually unique ids. + */ + bool m_bOverrideShapeIdGeneration; + + /// Prefix for overriden shape id generation (used if m_bOverrideShapeIdGeneration is true) + OString m_sShapeIDPrefix; + + /// Counter for generating shape ids (used if m_bOverrideShapeIdGeneration is true) + sal_uInt64 m_nShapeIDCounter; + public: VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLTextExport* pTextExport = nullptr); virtual ~VMLExport() override; @@ -130,8 +141,9 @@ public: virtual void AddSdrObjectVMLObject( const SdrObject& rObj) override; static bool IsWaterMarkShape(const OUString& rStr); - void SetSkipwzName() { m_bSkipwzName = true; } - void SetHashMarkForType() { m_bUseHashMarkForType = true; } + void SetSkipwzName(bool bSkipwzName) { m_bSkipwzName = bSkipwzName; } + void SetHashMarkForType(bool bUseHashMarkForType) { m_bUseHashMarkForType = bUseHashMarkForType; } + void OverrideShapeIDGen(bool bOverrideShapeIdGeneration, const OString sShapeIDPrefix = OString()); protected: /// Add an attribute to the generated <v:shape/> element. /// @@ -142,6 +154,9 @@ protected: using EscherEx::StartShape; using EscherEx::EndShape; + /// Override shape ID generation when m_bOverrideShapeIdGeneration is set to true + virtual sal_uInt32 GenerateShapeId() override; + /// Start the shape for which we just collected the information. /// /// Returns the element's tag number, -1 means we wrote nothing. @@ -165,7 +180,7 @@ private: private: /// Create an OString representing the id from a numerical id. - static OString ShapeIdString( sal_uInt32 nId ); + OString ShapeIdString( sal_uInt32 nId ); /// Add flip X and\or flip Y void AddFlipXY( ); |