[Libreoffice-commits] core.git: oox/inc oox/source sd/qa
nd101 (via logerrit)
logerrit at kemper.freedesktop.org
Fri Dec 6 14:03:20 UTC 2019
oox/inc/drawingml/table/tableproperties.hxx | 2 ++
oox/source/drawingml/table/tablecell.cxx | 6 ++++++
oox/source/drawingml/table/tablecontext.cxx | 2 ++
oox/source/drawingml/table/tableproperties.cxx | 1 +
sd/qa/unit/data/pptx/tdf127237.pptx |binary
sd/qa/unit/export-tests-ooxml1.cxx | 22 ++++++++++++++++++++++
6 files changed, 33 insertions(+)
New commits:
commit 4c2254cbebca53c34fa48a1dd90cebe434f24274
Author: nd101 <Fong at nd.com.cn>
AuthorDate: Mon Sep 2 10:29:12 2019 +0800
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Dec 6 15:01:48 2019 +0100
tdf#127237 fix table background color in Impress import
When the background color is set at the table level in PPTX,
instead of at cell level, the background color fails to
show up in Impress.
Change-Id: I2838e5b56e4a2414494ee99c0f8975b7256ac6dc
Reviewed-on: https://gerrit.libreoffice.org/78377
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/oox/inc/drawingml/table/tableproperties.hxx b/oox/inc/drawingml/table/tableproperties.hxx
index dd50cd7a694d..010fc67df416 100644
--- a/oox/inc/drawingml/table/tableproperties.hxx
+++ b/oox/inc/drawingml/table/tableproperties.hxx
@@ -54,6 +54,7 @@ public:
void setBandRow(bool b) { mbBandRow = b; };
bool isBandCol() const { return mbBandCol; };
void setBandCol(bool b) { mbBandCol = b; };
+ Color& getBgColor(){ return maBgColor; };
void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase,
const css::uno::Reference < css::beans::XPropertySet > & xPropSet,
@@ -70,6 +71,7 @@ private:
std::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle
std::vector< sal_Int32 > mvTableGrid;
std::vector< TableRow > mvTableRows;
+ Color maBgColor;
bool mbFirstRow;
bool mbFirstCol;
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 48f73b269e6a..24e1a5f89c1c 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -424,6 +424,12 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
+ if (rProperties.getBgColor().isUsed() && !maFillProperties.maFillColor.isUsed() && maFillProperties.moFillType.get() == XML_noFill)
+ {
+ maFillProperties.moFillType = XML_solidFill;
+ maFillProperties.maFillColor = rProperties.getBgColor();
+ }
+
aFillProperties.assignUsed( maFillProperties );
ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() );
diff --git a/oox/source/drawingml/table/tablecontext.cxx b/oox/source/drawingml/table/tablecontext.cxx
index 3371e105f691..90191f615d4d 100644
--- a/oox/source/drawingml/table/tablecontext.cxx
+++ b/oox/source/drawingml/table/tablecontext.cxx
@@ -57,6 +57,8 @@ TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& r
mrTableProperties.setBandCol( rAttribs.getBool( XML_bandCol, false ) );
}
break;
+ case A_TOKEN(solidFill):
+ return new ColorContext(*this, mrTableProperties.getBgColor());
case A_TOKEN( tableStyle ): // CT_TableStyle
{
std::shared_ptr< TableStyle >& rTableStyle = mrTableProperties.getTableStyle();
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index b6d8bf378127..b58439e5d714 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -49,6 +49,7 @@ TableProperties::TableProperties()
, mbBandRow( false )
, mbBandCol( false )
{
+ maBgColor.setUnused();
}
static void CreateTableRows( const uno::Reference< XTableRows >& xTableRows, const std::vector< TableRow >& rvTableRows )
diff --git a/sd/qa/unit/data/pptx/tdf127237.pptx b/sd/qa/unit/data/pptx/tdf127237.pptx
new file mode 100644
index 000000000000..f63423cd47e8
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf127237.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 79b18b7cb914..769bf6e52456 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -55,6 +55,7 @@ class SdOOXMLExportTest1 : public SdModelTestBaseXML
{
public:
void testFdo90607();
+ void testTdf127237();
void testBnc870233_1();
void testBnc870233_2();
void testN828390_4();
@@ -93,6 +94,7 @@ public:
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
CPPUNIT_TEST(testFdo90607);
+ CPPUNIT_TEST(testTdf127237);
CPPUNIT_TEST(testBnc870233_1);
CPPUNIT_TEST(testBnc870233_2);
CPPUNIT_TEST(testN828390_4);
@@ -180,6 +182,26 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal)
}
+void SdOOXMLExportTest1::testTdf127237()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf127237.pptx"), PPTX );
+ xDocShRef = saveAndReload(xDocShRef.get(), ODP);
+
+ const SdrPage* pPage = GetPage(1, xDocShRef);
+ CPPUNIT_ASSERT(pPage != nullptr);
+
+ sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT(pTableObj != nullptr);
+ uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+
+ sal_Int32 nFillColor = 0;
+ uno::Reference< beans::XPropertySet > xCell(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillColor") >>= nFillColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x0070C0), nFillColor);
+
+ xDocShRef->DoClose();
+}
+
void SdOOXMLExportTest1::testBnc870233_1()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX);
More information about the Libreoffice-commits
mailing list