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 /oox/source/export | |
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 'oox/source/export')
-rw-r--r-- | oox/source/export/vmlexport.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index a401c3c44465..f45edde6cc86 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -68,6 +68,8 @@ VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLText , m_aShapeTypeWritten( ESCHER_ShpInst_COUNT ) , m_bSkipwzName( false ) , m_bUseHashMarkForType( false ) + , m_bOverrideShapeIdGeneration( false ) + , m_nShapeIDCounter( 0 ) { mnGroupLevel = 1; } @@ -208,6 +210,18 @@ bool VMLExport::IsWaterMarkShape(const OUString& rStr) return rStr.match("PowerPlusWaterMarkObject") || rStr.match("WordPictureWatermark"); } +void VMLExport::OverrideShapeIDGen(bool bOverrideShapeIdGen, const OString sShapeIDPrefix) +{ + m_bOverrideShapeIdGeneration = bOverrideShapeIdGen; + if(bOverrideShapeIdGen) + { + assert(!sShapeIDPrefix.isEmpty()); + m_sShapeIDPrefix = sShapeIDPrefix; + } + else + m_sShapeIDPrefix.clear(); +} + static void impl_AddArrowHead( sax_fastparser::FastAttributeList *pAttrList, sal_Int32 nElement, sal_uInt32 nValue ) { if ( !pAttrList ) @@ -884,7 +898,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& OString VMLExport::ShapeIdString( sal_uInt32 nId ) { - return "shape_" + OString::number( nId ); + if(m_bOverrideShapeIdGeneration) + return m_sShapeIDPrefix + OString::number( nId ); + else + return "shape_" + OString::number( nId ); } void VMLExport::AddFlipXY( ) @@ -1025,6 +1042,14 @@ OUString lcl_getAnchorIdFromGrabBag(const SdrObject* pSdrObject) return aResult; } +sal_uInt32 VMLExport::GenerateShapeId() +{ + if(!m_bOverrideShapeIdGeneration) + return EscherEx::GenerateShapeId(); + else + return m_nShapeIDCounter++; +} + sal_Int32 VMLExport::StartShape() { if ( m_nShapeType == ESCHER_ShpInst_Nil ) |