oox/source/export/vmlexport.cxx |4 +++-
oox/source/vml/vmlshapecontext.cxx| 11 +--
sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |4
sw/qa/extras/uiwriter/data/watermark.docx |binary
sw/qa/extras/uiwriter/uiwriter.cxx| 23 +++
sw/source/core/edit/edfcol.cxx| 17 +++--
6 files changed, 50 insertions(+), 9 deletions(-)
New commits:
commit a406d5c22793fd2d43a0876f897a16b11a367ec7
Author: Szymon KÅos
Date: Wed May 24 00:15:15 2017 +0200
Watermark: docx interoperability
Before patch:
Document created in MS Word:
Imported to LO and exported:
Then again imported to MS Word and exported:
In this moment LO after import had shape in the navigator but it wasn't
visible.
Patch:
* vmshapecontext.cxx is changed to read ShapeType from id instead of o:spt
when o:spid is present.
* vmlexport.cxx added o:spid for Word to identify inserted watermark
* edfxol.cxx changed name of shape to "PowerPlusWaterMarkObject" for Word
* tests
Change-Id: I25322628838a98c45cbeed64144d04977b2ea9ba
Reviewed-on: https://gerrit.libreoffice.org/37969
Tested-by: Jenkins
Reviewed-by: Miklos Vajna
(cherry picked from commit 271094ad8f9e334d17176744b90b35e80528bcb2)
Reviewed-on: https://gerrit.libreoffice.org/38381
Reviewed-by: Szymon KÅos
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index ef400be64f7c..623beaaa88ec 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -190,8 +190,10 @@ void VMLExport::AddShape( sal_uInt32 nShapeType,
sal_uInt32 nShapeFlags, sal_uIn
}
else
{
-// A watermark object - store the optional shape ID also ('o:spid')
+// A watermark object - store the optional shape ID
m_pShapeAttrList->add( XML_id,
OUStringToOString(m_pSdrObject->GetName(), RTL_TEXTENCODING_UTF8) );
+// also ('o:spid')
+m_pShapeAttrList->addNS( XML_o, XML_spid, ShapeIdString( nShapeId ) );
}
}
diff --git a/oox/source/vml/vmlshapecontext.cxx
b/oox/source/vml/vmlshapecontext.cxx
index dc654223aca6..ed369ae1c7d9 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -275,11 +275,18 @@ ShapeTypeContext::ShapeTypeContext(
ContextHandler2Helper& rParent, ShapeType& r
mrTypeModel.maShapeId = rAttribs.getXString( bHasOspid ? O_TOKEN( spid ) :
XML_id, OUString() );
mrTypeModel.maLegacyId = rAttribs.getString( XML_id, OUString() );
OSL_ENSURE( !mrTypeModel.maShapeId.isEmpty(),
"ShapeTypeContext::ShapeTypeContext - missing shape identifier" );
+// builtin shape type identifier
+mrTypeModel.moShapeType = rAttribs.getInteger( O_TOKEN( spt ) );
// if the o:spid attribute exists, the id attribute contains the
user-defined shape name
if( bHasOspid )
+{
mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
-// builtin shape type identifier
-mrTypeModel.moShapeType = rAttribs.getInteger( O_TOKEN( spt ) );
+// get ShapeType and ShapeId from name for compatibility
+mrTypeModel.maShapeId = mrTypeModel.maShapeName;
+static const OUString sShapeTypePrefix = "shapetype_";
+if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
+mrTypeModel.moShapeType =
mrTypeModel.maShapeName.copy(sShapeTypePrefix.getLength()).toInt32();
+}
// coordinate system position/size, CSS style
mrTypeModel.moCoordPos = lclDecodeInt32Pair( rAttribs, XML_coordorigin );
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index b538e9f990da..e7f24005cd92 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -106,6 +106,10 @@ DECLARE_OOXMLEXPORT_TEST(testTextWatermark,
"textWatermark.docx")
return;
assertXPath(pXmlHeader1,
"/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","id","PowerPlusWaterMarkObject93701316");
+
+//The second problem was that Word uses also "o:spid"
+const OUString& sSpid = getXPath(pXmlHeader1,
"/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","spid");
+CPPUNIT_ASSERT(!sSpid.isEmpty());
}
DECLARE_OOXMLEXPORT_TEST(testPictureWatermark, "pictureWatermark.docx")
diff --git a/sw/qa/extras/uiwriter/data/watermark.docx
b/sw/qa/extras/uiwriter/data/watermark.docx
new file mode 100644
index ..0b26d4442e98
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/watermark.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 30ce2e4c442d..7eccab668c7d 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx