diff options
author | Ravindra_Vidhate <ravindra.vidhate@synerzip.com> | 2014-07-15 17:51:38 +0530 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-07-21 14:59:50 +0000 |
commit | 8ed122f34275f4b4afd1a84d3b5254e4a814ba43 (patch) | |
tree | 6106a67e4a87cf61798bf70f76c3873ccf35e1cf | |
parent | 6831ae4d0e0b69e4f06c2987c3be748c8f35c9d8 (diff) |
fdo#81381 Objects:Icon is not editable after LO Export
The Object's DrawAspect ="Icon" is not getting preserved.
Open the exported file in MS-Office and double click on the object Icon.
The object doesn't open the ppt associated with it.
Because DrawAspect="Icon" property of the OLEObject is not getting prserved.
The DrawAspect="Content" property is getting exported as "Content" is the hard code value.
Change-Id: I2f1cbdbb4931657115f6a657b43a1cab3c5369a6
Reviewed-on: https://gerrit.libreoffice.org/10356
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Tested-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo81381.docx | bin | 0 -> 51656 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 21 | ||||
-rw-r--r-- | writerfilter/source/dmapper/OLEHandler.cxx | 8 |
5 files changed, 31 insertions, 5 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 43e6d7ef6f0c..887fde83d368 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -653,6 +653,7 @@ protected: xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("lc"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("extended-properties"), BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/extended-properties")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a14"), BAD_CAST("http://schemas.microsoft.com/office/drawing/2010/main")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("o"), BAD_CAST("urn:schemas-microsoft-com:office:office")); } }; diff --git a/sw/qa/extras/ooxmlexport/data/fdo81381.docx b/sw/qa/extras/ooxmlexport/data/fdo81381.docx Binary files differnew file mode 100644 index 000000000000..bf4a860c78d7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo81381.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 02a4d4e98341..922301a8616e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3347,6 +3347,12 @@ DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-run.docx") assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/w:t", "third"); } +DECLARE_OOXMLEXPORT_TEST(testfdo81381, "fdo81381.docx") +{ + if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:object[1]/o:OLEObject[1]", "DrawAspect", "Icon"); +} + DECLARE_OOXMLEXPORT_TEST(testSdtAlias, "sdt-alias.docx") { xmlDocPtr pXmlDoc = parseExport(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 4f5a1a313760..8eb11f8b6a86 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4396,7 +4396,7 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S // get interoperability information about embedded objects uno::Reference< beans::XPropertySet > xPropSet( m_rExport.pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); OUString pName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; - uno::Sequence< beans::PropertyValue > aGrabBag, aObjectsInteropList; + uno::Sequence< beans::PropertyValue > aGrabBag, aObjectsInteropList,aObjectInteropAttributes; xPropSet->getPropertyValue( pName ) >>= aGrabBag; for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i ) if ( aGrabBag[i].Name == "EmbeddedObjects" ) @@ -4411,13 +4411,26 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S OUString sObjectName = aContainer->GetEmbeddedObjectName( xObj ); // set some attributes according to the type of the embedded object - OUString sProgID, sMediaType, sRelationType, sFileExtension; + OUString sProgID, sMediaType, sRelationType, sFileExtension, sDrawAspect="Content"; for( sal_Int32 i=0; i < aObjectsInteropList.getLength(); ++i ) if ( aObjectsInteropList[i].Name == sObjectName ) { - aObjectsInteropList[i].Value >>= sProgID; + aObjectsInteropList[i].Value >>= aObjectInteropAttributes; break; } + + for( sal_Int32 i=0; i < aObjectInteropAttributes.getLength(); ++i ) + { + if ( aObjectInteropAttributes[i].Name == "ProgID" ) + { + aObjectInteropAttributes[i].Value >>= sProgID; + } + else if ( aObjectInteropAttributes[i].Name == "DrawAspect" ) + { + aObjectInteropAttributes[i].Value >>= sDrawAspect; + } + } + if( sProgID == "Excel.Sheet.12" ) { sMediaType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; @@ -4541,7 +4554,7 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S XML_Type, "Embed", XML_ProgID, OUStringToOString( sProgID, RTL_TEXTENCODING_UTF8 ).getStr(), XML_ShapeID, sShapeId.getStr(), - XML_DrawAspect, "Content", + XML_DrawAspect, OUStringToOString( sDrawAspect, RTL_TEXTENCODING_UTF8 ).getStr(), XML_ObjectID, "_" + OString::number( rand() ), FSNS( XML_r, XML_id ), sId.getStr(), FSEND ); diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index a07b443d83d0..73b0c6dae8e5 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -198,11 +198,17 @@ void OLEHandler::saveInteropProperties( uno::Reference< text::XTextDocument > xT break; } + uno::Sequence< beans::PropertyValue > aGrabBagAttribute(2); + aGrabBagAttribute[0].Name = "ProgID"; + aGrabBagAttribute[0].Value = uno::Any( m_sProgId ); + aGrabBagAttribute[1].Name = "DrawAspect"; + aGrabBagAttribute[1].Value = uno::Any( m_sDrawAspect ); + // save ProgID of current object sal_Int32 length = objectsList.getLength(); objectsList.realloc( length + 1 ); objectsList[length].Name = sObjectName; - objectsList[length].Value = uno::Any( m_sProgId ); + objectsList[length].Value = uno::Any( aGrabBagAttribute ); // put objects list back into the grab bag if( i == nBagLength ) |