summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authoryogesh.bharate001 <yogesh.bharate@synerzip.com>2015-04-16 19:24:37 +0530
committerCaolán McNamara <caolanm@redhat.com>2015-05-09 19:55:31 +0000
commit3e4d2043e99201ec542186039e3be34d3c226111 (patch)
treef0d9070c2fd0ae282ad118a05d2c7be737ae79d4 /oox
parent3acb1d4b28944de908ffb3d0b756725ae015214f (diff)
tdf#90190 PPTX table cell border width is not exported.
Problem: - Table cell border width is not exported. i.e lnL, lnR, lnT, LnB are not exported inside the tcPr. XML Difference: Original : <a:lnT w = "76200"> After RT : tag is missing. Solution : Added solution for Table cell border width. Change-Id: I19185f2ad176325bf7990c9da6becc66557c717b Reviewed-on: https://gerrit.libreoffice.org/15350 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/table/tablecell.cxx11
-rw-r--r--oox/source/export/shapes.cxx59
2 files changed, 68 insertions, 2 deletions
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index d753326aa4a5..135e5b256658 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -70,7 +70,7 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
sal_Int32 nPropId )
{
BorderLine2 aBorderLine;
- if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ) )
+ if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ))
{
Color aColor = rLineProperties.maLineFill.getBestSolidColor();
aBorderLine.Color = aColor.getColor( rFilterBase.getGraphicHelper() );
@@ -79,6 +79,15 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 );
aBorderLine.LineDistance = 0;
}
+ else if ( rLineProperties.moLineWidth.get(0)!=0 )
+ {
+ // Default color of Line is black.
+ rLineProperties.maLineFill.maFillColor.setSrgbClr( 0 );
+ aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
+ aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
+ aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 );
+ aBorderLine.LineDistance = 0;
+ }
PropertySet aPropSet( rxPropSet );
aPropSet.setProperty( nPropId, aBorderLine );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 349f39824639..cdeefac339c0 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -66,6 +66,7 @@
#include <com/sun/star/table/XMergeableCell.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <tools/stream.hxx>
#include <vcl/cvtgrf.hxx>
#include <unotools/fontcvt.hxx>
@@ -1061,10 +1062,66 @@ void ShapeExport::WriteTableCellProperties(Reference< XPropertySet> xCellPropSet
DrawingML::WriteFill(xCellPropSet);
// TODO
// tcW : Table cell width
- // tcBorders : Table cell border values.
+ WriteTableCellBorders(xCellPropSet);
mpFS->endElementNS( XML_a, XML_tcPr );
}
+void ShapeExport::WriteTableCellBorders(Reference< XPropertySet> xCellPropSet)
+{
+ BorderLine2 aBorderLine;
+
+// lnL - Left Border Line Properties of table cell
+ xCellPropSet->getPropertyValue("LeftBorder") >>= aBorderLine;
+ 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 = oox::drawingml::convertHmmToEmu( nLeftBorder );
+
+ if(nLeftBorder > 0)
+ {
+ mpFS->startElementNS( XML_a, XML_lnL, XML_w, I32S(nLeftBorder), FSEND );
+ mpFS->endElementNS( XML_a, XML_lnL );
+ }
+
+// lnR - Right Border Line Properties of table cell
+ xCellPropSet->getPropertyValue("RightBorder") >>= aBorderLine;
+ sal_Int32 nRightBorder = aBorderLine.LineWidth;
+ nRightBorder = nRightBorder * 2 ;
+ nRightBorder = oox::drawingml::convertHmmToEmu( nRightBorder );
+
+ if(nRightBorder > 0)
+ {
+ mpFS->startElementNS( XML_a, XML_lnR, XML_w, I32S(nRightBorder), FSEND);
+ mpFS->endElementNS( XML_a, XML_lnR);
+ }
+
+// lnT - Top Border Line Properties of table cell
+ xCellPropSet->getPropertyValue("TopBorder") >>= aBorderLine;
+ sal_Int32 nTopBorder = aBorderLine.LineWidth;
+ nTopBorder = nTopBorder * 2;
+ nTopBorder = oox::drawingml::convertHmmToEmu( nTopBorder );
+
+ if(nTopBorder > 0)
+ {
+ mpFS->startElementNS( XML_a, XML_lnT, XML_w, I32S(nTopBorder), FSEND);
+ mpFS->endElementNS( XML_a, XML_lnT);
+ }
+
+// lnB - Bottom Border Line Properties of table cell
+ xCellPropSet->getPropertyValue("BottomBorder") >>= aBorderLine;
+ sal_Int32 nBottomBorder = aBorderLine.LineWidth;
+ nBottomBorder = nBottomBorder * 2;
+ nBottomBorder = oox::drawingml::convertHmmToEmu( nBottomBorder );
+
+ if(nBottomBorder > 0)
+ {
+ mpFS->startElementNS( XML_a, XML_lnB, XML_w, I32S(nBottomBorder), FSEND);
+ mpFS->endElementNS( XML_a, XML_lnB);
+ }
+}
+
ShapeExport& ShapeExport::WriteTableShape( Reference< XShape > xShape )
{
FSHelperPtr pFS = GetFS();