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

yogesh.bharate001 yogesh.bharate at synerzip.com
Sat May 9 12:59:13 PDT 2015


 oox/source/export/shapes.cxx     |   10 +++++++++-
 sd/qa/unit/data/pptx/n90190.pptx |binary
 sd/qa/unit/export-tests.cxx      |    7 ++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 8d74795e6e777cef0b1df64a56ea886208c87bc0
Author: yogesh.bharate001 <yogesh.bharate at synerzip.com>
Date:   Fri Apr 17 17:37:00 2015 +0530

    tdf#90672: PPTX table cell border color is not exported.
    
    Problem Description :
    XML Difference :
    Original :
    <a:solidFill>
      <a:srgbClr val="00B0F0"/>
    </a:solidFill>
    
    After Roundtrip : tag is missing
    
    Solution : Added support for table cell border color.
    
    Change-Id: I2baf969d7a8e46a0c5825d9f57bf135ec479c9eb
    Reviewed-on: https://gerrit.libreoffice.org/15364
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index cdeefac..87c0190 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1059,10 +1059,10 @@ void ShapeExport::WriteTableCellProperties(Reference< XPropertySet> xCellPropSet
     FSEND );
 
     // Write background fill for table cell.
-    DrawingML::WriteFill(xCellPropSet);
     // TODO
     // tcW : Table cell width
     WriteTableCellBorders(xCellPropSet);
+    DrawingML::WriteFill(xCellPropSet);
     mpFS->endElementNS( XML_a, XML_tcPr );
 }
 
@@ -1073,6 +1073,7 @@ void ShapeExport::WriteTableCellBorders(Reference< XPropertySet> xCellPropSet)
 // lnL - Left Border Line Properties of table cell
     xCellPropSet->getPropertyValue("LeftBorder") >>= aBorderLine;
     sal_Int32 nLeftBorder = aBorderLine.LineWidth;
+    util::Color aLeftBorderColor = aBorderLine.Color;
 
 // While importing the table cell border line width, it converts EMU->Hmm then divided result by 2.
 // To get original value of LineWidth need to multiple by 2.
@@ -1082,42 +1083,49 @@ void ShapeExport::WriteTableCellBorders(Reference< XPropertySet> xCellPropSet)
     if(nLeftBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnL, XML_w, I32S(nLeftBorder), FSEND );
+        DrawingML::WriteSolidFill(aLeftBorderColor);
         mpFS->endElementNS( XML_a, XML_lnL );
     }
 
 // lnR - Right Border Line Properties of table cell
     xCellPropSet->getPropertyValue("RightBorder") >>= aBorderLine;
     sal_Int32 nRightBorder = aBorderLine.LineWidth;
+    util::Color aRightBorderColor = aBorderLine.Color;
     nRightBorder = nRightBorder * 2 ;
     nRightBorder = oox::drawingml::convertHmmToEmu( nRightBorder );
 
     if(nRightBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnR, XML_w, I32S(nRightBorder), FSEND);
+        DrawingML::WriteSolidFill(aRightBorderColor);
         mpFS->endElementNS( XML_a, XML_lnR);
     }
 
 // lnT - Top Border Line Properties of table cell
     xCellPropSet->getPropertyValue("TopBorder") >>= aBorderLine;
     sal_Int32 nTopBorder = aBorderLine.LineWidth;
+    util::Color aTopBorderColor = aBorderLine.Color;
     nTopBorder = nTopBorder * 2;
     nTopBorder = oox::drawingml::convertHmmToEmu( nTopBorder );
 
     if(nTopBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnT, XML_w, I32S(nTopBorder), FSEND);
+        DrawingML::WriteSolidFill(aTopBorderColor);
         mpFS->endElementNS( XML_a, XML_lnT);
     }
 
 // lnB - Bottom Border Line Properties of table cell
     xCellPropSet->getPropertyValue("BottomBorder") >>= aBorderLine;
     sal_Int32 nBottomBorder = aBorderLine.LineWidth;
+    util::Color aBottomBorderColor = aBorderLine.Color;
     nBottomBorder = nBottomBorder * 2;
     nBottomBorder = oox::drawingml::convertHmmToEmu( nBottomBorder );
 
     if(nBottomBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnB, XML_w, I32S(nBottomBorder), FSEND);
+        DrawingML::WriteSolidFill(aBottomBorderColor);
         mpFS->endElementNS( XML_a, XML_lnB);
     }
 }
diff --git a/sd/qa/unit/data/pptx/n90190.pptx b/sd/qa/unit/data/pptx/n90190.pptx
index ae83eb6..caeabe7 100644
Binary files a/sd/qa/unit/data/pptx/n90190.pptx and b/sd/qa/unit/data/pptx/n90190.pptx differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 78fce6b..bfb8913 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -983,27 +983,32 @@ void SdExportTest::testTableCellBorder()
     sal_Int32 nLeftBorder = aBorderLine.LineWidth ;
 // While importing the table cell border line width, it converts EMU->Hmm then divided result by 2.
 // To get original value of LineWidth need to multiple by 2.
-     nLeftBorder = nLeftBorder * 2 ;
+    nLeftBorder = nLeftBorder * 2 ;
     nLeftBorder = oox::drawingml::convertHmmToEmu( nLeftBorder );
     CPPUNIT_ASSERT(nLeftBorder);
+    CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
 
     xCellPropSet->getPropertyValue("RightBorder") >>= aBorderLine;
     sal_Int32 nRightBorder = aBorderLine.LineWidth ;
     nRightBorder = nRightBorder * 2 ;
     nRightBorder = oox::drawingml::convertHmmToEmu( nRightBorder );
     CPPUNIT_ASSERT(nRightBorder);
+    CPPUNIT_ASSERT_EQUAL(util::Color(16777215), aBorderLine.Color);
 
     xCellPropSet->getPropertyValue("TopBorder") >>= aBorderLine;
     sal_Int32 nTopBorder = aBorderLine.LineWidth ;
     nTopBorder = nTopBorder * 2 ;
     nTopBorder = oox::drawingml::convertHmmToEmu( nTopBorder );
     CPPUNIT_ASSERT(nTopBorder);
+    CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
+
 
     xCellPropSet->getPropertyValue("BottomBorder") >>= aBorderLine;
     sal_Int32 nBottomBorder = aBorderLine.LineWidth ;
     nBottomBorder = nBottomBorder * 2 ;
     nBottomBorder = oox::drawingml::convertHmmToEmu( nBottomBorder );
     CPPUNIT_ASSERT(nBottomBorder);
+    CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
 
     xDocShRef->DoClose();
 }


More information about the Libreoffice-commits mailing list