summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-08-22 02:02:07 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-08-22 07:53:36 +0200
commit2d1fe7fb67ec1ff1b96912c0945d17d54aecb12e (patch)
tree6d783d7a89d3613544b6de64245f7e9ae147bc75 /oox
parent508957dbf49be577188fb4c112405717957b2734 (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')
-rw-r--r--oox/source/export/vmlexport.cxx27
-rw-r--r--oox/source/vml/vmlshape.cxx2
2 files changed, 28 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 )
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index b51a9020393f..e1d0cf6d9a41 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -616,6 +616,8 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel,
else // static (is the default) means anchored inline
{
rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AS_CHARACTER);
+ // Use top orientation, this one seems similar to what MSO uses as inline
+ rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::TOP));
}
lcl_setSurround( rPropSet, rTypeModel, rGraphicHelper );
}