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

Miklos Vajna vmiklos at collabora.co.uk
Wed Dec 10 08:42:37 PST 2014


 sw/qa/extras/ooxmlexport/data/image-noborder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx         |    6 +++
 sw/source/filter/ww8/docxattributeoutput.cxx      |   37 +++++++++++++---------
 3 files changed, 28 insertions(+), 15 deletions(-)

New commits:
commit dbbfad3dfbee89c13956d3a9b4757c74a4a64cd2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Dec 10 17:06:28 2014 +0100

    DocxAttributeOutput::FlyFrameGraphic: avoid <a:ln> when there is no border
    
    Change-Id: Ia94f490c0ad8c392bd8bbfbe889f5333c13e0022

diff --git a/sw/qa/extras/ooxmlexport/data/image-noborder.docx b/sw/qa/extras/ooxmlexport/data/image-noborder.docx
new file mode 100644
index 0000000..7e0fc90
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/image-noborder.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 7d4f988..89ead20 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -721,6 +721,12 @@ DECLARE_OOXMLEXPORT_TEST(testTblpprShape, "tblppr-shape.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2540), getProperty<sal_Int32>(xPageStyle, "LeftMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testImageNoborder, "image-noborder.docx")
+{
+    // This was 26; we exported border for an image that had no border.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 862d754..c8a80c5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4215,21 +4215,28 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
     m_pSerializer->singleElementNS( XML_a, XML_avLst,
             FSEND );
     m_pSerializer->endElementNS( XML_a, XML_prstGeom );
-    m_pSerializer->singleElementNS( XML_a, XML_noFill,
-            FSEND );
-    m_pSerializer->startElementNS( XML_a, XML_ln,
-            XML_w, "9525",
-            FSEND );
-    m_pSerializer->singleElementNS( XML_a, XML_noFill,
-            FSEND );
-    m_pSerializer->singleElementNS( XML_a, XML_miter,
-            XML_lim, "800000",
-            FSEND );
-    m_pSerializer->singleElementNS( XML_a, XML_headEnd,
-            FSEND );
-    m_pSerializer->singleElementNS( XML_a, XML_tailEnd,
-            FSEND );
-    m_pSerializer->endElementNS( XML_a, XML_ln );
+
+    const SvxBoxItem& rBoxItem = pFrmFmt->GetBox();
+    const SvxBorderLine* pLeft = rBoxItem.GetLine(BOX_LINE_LEFT);
+    const SvxBorderLine* pRight = rBoxItem.GetLine(BOX_LINE_RIGHT);
+    const SvxBorderLine* pTop = rBoxItem.GetLine(BOX_LINE_TOP);
+    const SvxBorderLine* pBottom = rBoxItem.GetLine(BOX_LINE_BOTTOM);
+    if (pLeft || pRight || pTop || pBottom)
+    {
+        m_pSerializer->startElementNS( XML_a, XML_ln,
+                                       XML_w, "9525",
+                                       FSEND );
+        m_pSerializer->singleElementNS( XML_a, XML_noFill,
+                                        FSEND );
+        m_pSerializer->singleElementNS( XML_a, XML_miter,
+                                        XML_lim, "800000",
+                                        FSEND );
+        m_pSerializer->singleElementNS( XML_a, XML_headEnd,
+                                        FSEND );
+        m_pSerializer->singleElementNS( XML_a, XML_tailEnd,
+                                        FSEND );
+        m_pSerializer->endElementNS( XML_a, XML_ln );
+    }
 
     m_rExport.SdrExporter().writeDMLEffectLst(*pFrmFmt);
 


More information about the Libreoffice-commits mailing list