[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

Ravindra_Vidhate ravindra.vidhate at synerzip.com
Mon Jul 21 08:00:22 PDT 2014


 sw/qa/extras/inc/swmodeltestbase.hxx         |    1 +
 sw/qa/extras/ooxmlexport/data/fdo81381.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    6 ++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   21 +++++++++++++++++----
 writerfilter/source/dmapper/OLEHandler.cxx   |    8 +++++++-
 5 files changed, 31 insertions(+), 5 deletions(-)

New commits:
commit 8ed122f34275f4b4afd1a84d3b5254e4a814ba43
Author: Ravindra_Vidhate <ravindra.vidhate at synerzip.com>
Date:   Tue Jul 15 17:51:38 2014 +0530

    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 at collabora.com>
    Tested-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 43e6d7e..887fde8 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
new file mode 100644
index 0000000..bf4a860
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo81381.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 02a4d4e..922301a 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 4f5a1a3..8eb11f8 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 a07b443..73b0c6d 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 )


More information about the Libreoffice-commits mailing list