summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTibor Nagy <tibor.nagy.extern@allotropia.de>2024-01-22 11:24:51 +0100
committerAndras Timar <andras.timar@collabora.com>2024-01-23 15:42:26 +0100
commita727b254fcfdcb5ecc075093a277a11e223faee3 (patch)
tree7e4d61bd0c6fd00fb93b47bdfef75225305d0f46 /oox
parentcbe50ba762b13a12652673a87106c571177a8036 (diff)
tdf#156718 PPTX import: fix the different formatting in table style
when the PPTX file only has table style id, but no table style content. Change-Id: Ia3416478716a50beb6837988e98697fd88e916d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162368 Tested-by: Jenkins Reviewed-by: Nagy Tibor <tibor.nagy.extern@allotropia.de> (cherry picked from commit 27a1eccae1763b8efa17c909820f57f84361d308) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162378 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/table/predefined-table-styles.cxx20
-rw-r--r--oox/source/drawingml/table/tablecell.cxx12
2 files changed, 28 insertions, 4 deletions
diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx b/oox/source/drawingml/table/predefined-table-styles.cxx
index 451759036835..90fb22e48de7 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -231,6 +231,12 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
std::unique_ptr<TableStyle> pTableStyle;
pTableStyle.reset(new TableStyle());
+ // Text Style definitions for table parts
+
+ bool bFirstRowTextBoldStyle = false;
+ bool bFirstColTextBoldStyle = false;
+ bool bLastColTextBoldStyle = false;
+
// Text Color definitions for table parts
::oox::drawingml::Color wholeTblTextColor;
@@ -410,6 +416,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
pWholeTblBottomBorder->moLineWidth = 12700;
pWholeTblInsideHBorder->moLineWidth = 12700;
pWholeTblInsideVBorder->moLineWidth = 12700;
+ pFirstRowBottomBorder->moLineWidth = 12700;
pWholeTblLeftBorder->moPresetDash = XML_solid;
pWholeTblRightBorder->moPresetDash = XML_solid;
@@ -417,6 +424,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
pWholeTblBottomBorder->moPresetDash = XML_solid;
pWholeTblInsideHBorder->moPresetDash = XML_solid;
pWholeTblInsideVBorder->moPresetDash = XML_solid;
+ pFirstRowBottomBorder->moPresetDash = XML_solid;
// Start to handle all style groups.
@@ -557,7 +565,13 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
setBorderLineType(pLastRowTopBorder, XML_solidFill);
+ bFirstRowTextBoldStyle = true;
+ bFirstColTextBoldStyle = true;
+ bLastColTextBoldStyle = true;
+
wholeTblTextColor.setSchemeClr(XML_tx1);
+ firstRowTextColor.setSchemeClr(XML_tx1);
+ lastColTextColor.setSchemeClr(XML_tx1);
sal_Int32 accent_val;
@@ -571,8 +585,6 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
- firstRowTextColor.setSchemeClr(accent_val);
-
pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
@@ -895,6 +907,10 @@ std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
pTableStyle->getStyleId() = styleId;
pTableStyle->getStyleName() = style_name;
+ pTableStyle->getFirstRow().getTextBoldStyle() = bFirstRowTextBoldStyle;
+ pTableStyle->getFirstCol().getTextBoldStyle() = bFirstColTextBoldStyle;
+ pTableStyle->getLastCol().getTextBoldStyle() = bLastColTextBoldStyle;
+
pTableStyle->getWholeTbl().getTextColor() = wholeTblTextColor;
pTableStyle->getFirstRow().getTextColor() = firstRowTextColor;
pTableStyle->getFirstCol().getTextColor() = firstColTextColor;
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 687c987fe242..78ec4f61feeb 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -358,10 +358,18 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
}
if ( rProperties.isBandRow() )
{
+ bool bHasFirstColFillColor
+ = (rProperties.isFirstCol() && rTable.getFirstCol().getFillProperties()
+ && rTable.getFirstCol().getFillProperties()->maFillColor.isUsed());
+
+ bool bHasLastColFillColor
+ = (rProperties.isLastCol() && rTable.getLastCol().getFillProperties()
+ && rTable.getLastCol().getFillProperties()->maFillColor.isUsed());
+
if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) &&
- ( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
- ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
+ ( !rProperties.isFirstCol() || ( nColumn != 0 ) || !bHasFirstColFillColor ) &&
+ ( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) || !bHasLastColFillColor ) )
{
sal_Int32 nBand = nRow;
if ( rProperties.isFirstRow() )