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

Miklos Vajna vmiklos at collabora.co.uk
Tue Jan 14 03:06:43 PST 2014


 sw/qa/extras/ooxmlexport/data/dml-shape-title.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx           |    6 ++++++
 sw/source/filter/ww8/docxsdrexport.cxx             |    6 +++++-
 writerfilter/source/dmapper/GraphicImport.cxx      |    9 +++++----
 4 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit 28c89909a456b9b6673d367f864661cb7f3b7179
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jan 14 11:47:12 2014 +0100

    DOCX drawingML shape filter: export title and description
    
    Change-Id: I6c740c8b2634785e794704ce0f2d89878e01ac51

diff --git a/sw/qa/extras/ooxmlexport/data/dml-shape-title.docx b/sw/qa/extras/ooxmlexport/data/dml-shape-title.docx
new file mode 100644
index 0000000..d354806
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-shape-title.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index dea8293..f9ef75e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2258,6 +2258,12 @@ DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx")
     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "FrameIsAutomaticHeight")));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx")
+{
+    CPPUNIT_ASSERT_EQUAL(OUString("Title"), getProperty<OUString>(getShape(1), "Title"));
+    CPPUNIT_ASSERT_EQUAL(OUString("Description"), getProperty<OUString>(getShape(1), "Description"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 4c4ab8d..b340083 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -447,7 +447,11 @@ void DocxSdrExport::Impl::writeDMLDrawing(const SdrObject* pSdrObject, const SwF
 
     sax_fastparser::FastAttributeList* pDocPrAttrList = pFS->createAttrList();
     pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr());
-    pDocPrAttrList->add(XML_name, OUStringToOString(pSdrObject->GetName(), RTL_TEXTENCODING_UTF8).getStr());
+    pDocPrAttrList->add(XML_name, OUStringToOString(pSdrObject->GetName(), RTL_TEXTENCODING_UTF8));
+    if (!pSdrObject->GetTitle().isEmpty())
+        pDocPrAttrList->add(XML_title, OUStringToOString(pSdrObject->GetTitle(), RTL_TEXTENCODING_UTF8));
+    if (!pSdrObject->GetDescription().isEmpty())
+        pDocPrAttrList->add(XML_descr, OUStringToOString(pSdrObject->GetDescription(), RTL_TEXTENCODING_UTF8));
     sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList);
     pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
 
commit 3e5d5437d2f941496e6f4dbbaad92104de6bdb3f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jan 14 11:39:44 2014 +0100

    DOCX drawingML shape filter: import title and description
    
    Change-Id: Ica71b7c2bc31a211cccbb473071d1c4c82f4a4f4

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index d3594d9..ba0a67f 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -390,6 +390,7 @@ public:
 
     void applyName(uno::Reference<beans::XPropertySet>& xGraphicObjectProperties) const
     {
+        PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
         try
         {
             if( !sName.isEmpty() )
@@ -397,6 +398,10 @@ public:
                 uno::Reference< container::XNamed > xNamed( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
                 xNamed->setName( sName );
             }
+            xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_DESCRIPTION ),
+                uno::makeAny( sAlternativeText ));
+            xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_TITLE ),
+                uno::makeAny( title ));
         }
         catch( const uno::Exception& e )
         {
@@ -1239,10 +1244,6 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
             }
 
             // setting properties for all types
-            xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_DESCRIPTION ),
-                uno::makeAny( m_pImpl->sAlternativeText ));
-            xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_TITLE ),
-                uno::makeAny( m_pImpl->title ));
             if( m_pImpl->bPositionProtected )
                 xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_POSITION_PROTECTED ),
                     uno::makeAny(true));


More information about the Libreoffice-commits mailing list