diff options
author | yogesh.bharate001 <yogesh.bharate@synerzip.com> | 2015-04-16 19:24:37 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-05-09 19:55:31 +0000 |
commit | 3e4d2043e99201ec542186039e3be34d3c226111 (patch) | |
tree | f0d9070c2fd0ae282ad118a05d2c7be737ae79d4 /oox/source/export | |
parent | 3acb1d4b28944de908ffb3d0b756725ae015214f (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/source/export')
-rw-r--r-- | oox/source/export/shapes.cxx | 59 |
1 files changed, 58 insertions, 1 deletions
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(); |