summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-10-02 10:49:28 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-10-02 12:34:16 +0200
commit800bf1071a30955ff70373b2fb5886eadce59dee (patch)
tree18b19588dc41a64ed8444114e6364365d8f1c476
parentdbd4d6963280da4c3465532da8778e67ed3271c5 (diff)
Related: tdf#120028 PPTX import: fix font color of multi-col shape text
Not just font color, anything defined via list styles were not imported. Change-Id: I95e6fc52e30a09ff93fb55d0836e45e177a7b099 Reviewed-on: https://gerrit.libreoffice.org/61230 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
-rw-r--r--oox/source/drawingml/table/tableproperties.cxx4
-rw-r--r--sd/qa/unit/data/pptx/tdf120028b.pptxbin0 -> 29838 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx39
3 files changed, 43 insertions, 0 deletions
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index 39ab4cd19eac..e0afeb7c8246 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -331,6 +331,10 @@ void TableProperties::pullFromTextBody(oox::drawingml::TextBodyPtr pTextBody, sa
oox::drawingml::table::TableCell& rTableCell = rTableCells.back();
TextBodyPtr pCellTextBody(new TextBody);
rTableCell.setTextBody(pCellTextBody);
+
+ // Copy properties provided by <a:lstStyle>.
+ pCellTextBody->getTextListStyle() = pTextBody->getTextListStyle();
+
for (sal_Int32 nParaInCol = 0; nParaInCol < nParaPerCol; ++nParaInCol)
{
if (nPara < pTextBody->getParagraphs().size())
diff --git a/sd/qa/unit/data/pptx/tdf120028b.pptx b/sd/qa/unit/data/pptx/tdf120028b.pptx
new file mode 100644
index 000000000000..7d50da36c120
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf120028b.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 37e50f3ef931..cff2292aaca0 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -190,6 +190,7 @@ public:
void testPptCrop();
void testTdf119015();
void testTdf120028();
+ void testTdf120028b();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -273,6 +274,7 @@ public:
CPPUNIT_TEST(testPptCrop);
CPPUNIT_TEST(testTdf119015);
CPPUNIT_TEST(testTdf120028);
+ CPPUNIT_TEST(testTdf120028b);
CPPUNIT_TEST_SUITE_END();
};
@@ -2595,6 +2597,43 @@ void SdImportTest::testTdf120028()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf120028b()
+{
+ // Check that the table shape has 4 columns.
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf120028b.pptx"), PPTX);
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xDoc.is());
+
+ uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xPage.is());
+
+ uno::Reference<beans::XPropertySet> xShape(getShape(0, xPage));
+ CPPUNIT_ASSERT(xShape.is());
+
+ uno::Reference<table::XColumnRowRange> xModel(xShape->getPropertyValue("Model"),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xModel.is());
+
+ uno::Reference<table::XTableColumns> xColumns = xModel->getColumns();
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), xColumns->getCount());
+
+ // Check font color in the A1 cell.
+ uno::Reference<table::XCellRange> xCells(xModel, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xCell(xCells->getCellByPosition(0, 0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, xCell));
+ uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph));
+ uno::Reference<beans::XPropertySet> xPropSet(xRun, uno::UNO_QUERY);
+ sal_Int32 nCharColor = 0;
+ xPropSet->getPropertyValue("CharColor") >>= nCharColor;
+ // This was 0x1f497d, not white: text list style from placeholder shape
+ // from slide layout was ignored.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffff), nCharColor);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();