summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRavindra Vidhate <ravindra.vidhate@synerzip.com>2014-03-05 11:38:22 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-11 10:57:46 +0100
commitff2f55d6f0a515c8c6e4186e124db28cc4056f5b (patch)
treecf53a7880d6cc179a489e2818e38a98295945a70 /oox
parente895da0420253c7d3e1b9bff3abb339bb9dc1218 (diff)
fdo#35324: Text and picture water are not imported and not preserved in RT.
Problem : Open docx file which has Text/Picture as water mark. 1. The text is not imported properly also picture water mark is also considered as shape. 2. It writes the watermarks in Document.xml, while it should write in only Header.xml. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/8457 Change-Id: Ic988858da25a4cba3ae16e614d920e2e16053a5f
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/vmlexport.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 35eeae73eb3a..fe82ea02a662 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -175,7 +175,28 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uIn
{
m_nShapeType = nShapeType;
m_nShapeFlags = nShapeFlags;
- m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) );
+ // If shape is a watermark object - should keep the original shape's name
+ // because Microsoft detects if it is a watermark by the actual name
+ if (!IsWaterMarkShape(m_pSdrObject->GetName()))
+ {
+ // Not a watermark object
+ m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) );
+ }
+ else
+ {
+ // A watermark object - store the optional shape ID also ('o:spid')
+ m_pShapeAttrList->add( XML_id, OUStringToOString(m_pSdrObject->GetName(), RTL_TEXTENCODING_UTF8) );
+ }
+}
+
+bool VMLExport::IsWaterMarkShape(const OUString& rStr)
+{
+ if (rStr.isEmpty() ) return false;
+
+ if (rStr.match(OUString("PowerPlusWaterMarkObject")) || rStr.match(OUString("WordPictureWatermark")))
+ return true;
+ else
+ return false;
}
static void impl_AddArrowHead( sax_fastparser::FastAttributeList *pAttrList, sal_Int32 nElement, sal_uInt32 nValue )
@@ -787,7 +808,9 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
aStream.Seek(0);
OUString idStr = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true);
aStream.Seek(0);
- m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8));
+ if (!IsWaterMarkShape(m_pSdrObject->GetName()))
+ m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8));
+
bAlreadyWritten[ESCHER_Prop_wzName] = true;
}
break;