Support table border color and cellpadding in ODF writer

Change-Id: I1d57baa6820ee1322ac461c0db860990ff8f940d
Fixes: QTBUG-67622
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2018-11-08 10:35:22 +01:00
parent e8e8fb5154
commit dbffff0116

View File

@ -886,26 +886,30 @@ void QTextOdfWriter::tableCellStyleElement(QXmlStreamWriter &writer, const int &
if (hasBorder) { if (hasBorder) {
writer.writeAttribute(foNS, QString::fromLatin1("border"), writer.writeAttribute(foNS, QString::fromLatin1("border"),
pixelToPoint(tableFormatTmp.border()) + QLatin1String(" ") pixelToPoint(tableFormatTmp.border()) + QLatin1String(" ")
+ borderStyleName(tableFormatTmp.borderStyle()) + borderStyleName(tableFormatTmp.borderStyle()) + QLatin1String(" ")
+ QLatin1String(" #000000")); //!! HARD-CODING color black + tableFormatTmp.borderBrush().color().name(QColor::HexRgb));
} }
qreal padding = format.topPadding(); qreal topPadding = format.topPadding();
if (padding > 0 && padding == format.bottomPadding() qreal padding = topPadding + tableFormatTmp.cellPadding();
&& padding == format.leftPadding() && padding == format.rightPadding()) { if (padding > 0 && topPadding == format.bottomPadding()
&& topPadding == format.leftPadding() && topPadding == format.rightPadding()) {
writer.writeAttribute(foNS, QString::fromLatin1("padding"), pixelToPoint(padding)); writer.writeAttribute(foNS, QString::fromLatin1("padding"), pixelToPoint(padding));
} }
else { else {
if (padding > 0) if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-top"), pixelToPoint(padding)); writer.writeAttribute(foNS, QString::fromLatin1("padding-top"), pixelToPoint(padding));
if (format.bottomPadding() > 0) padding = format.bottomPadding() + tableFormatTmp.cellPadding();
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-bottom"), writer.writeAttribute(foNS, QString::fromLatin1("padding-bottom"),
pixelToPoint(format.bottomPadding())); pixelToPoint(padding));
if (format.leftPadding() > 0) padding = format.leftPadding() + tableFormatTmp.cellPadding();
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-left"), writer.writeAttribute(foNS, QString::fromLatin1("padding-left"),
pixelToPoint(format.leftPadding())); pixelToPoint(padding));
if (format.rightPadding() > 0) padding = format.rightPadding() + tableFormatTmp.cellPadding();
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-right"), writer.writeAttribute(foNS, QString::fromLatin1("padding-right"),
pixelToPoint(format.rightPadding())); pixelToPoint(padding));
} }
if (format.hasProperty(QTextFormat::TextVerticalAlignment)) { if (format.hasProperty(QTextFormat::TextVerticalAlignment)) {