[Libreoffice-commits] core.git: oox/source sd/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Oct 2 10:34:39 UTC 2018
oox/source/drawingml/table/tableproperties.cxx | 4 ++
sd/qa/unit/data/pptx/tdf120028b.pptx |binary
sd/qa/unit/import-tests.cxx | 39 +++++++++++++++++++++++++
3 files changed, 43 insertions(+)
New commits:
commit 800bf1071a30955ff70373b2fb5886eadce59dee
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Tue Oct 2 10:49:28 2018 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Tue Oct 2 12:34:16 2018 +0200
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 at collabora.co.uk>
Tested-by: Jenkins
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
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf120028b.pptx 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();
More information about the Libreoffice-commits
mailing list