[Libreoffice-commits] core.git: oox/source sd/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 7 16:30:11 UTC 2019


 oox/source/drawingml/diagram/diagramfragmenthandler.cxx |    2 +-
 sd/qa/unit/import-tests-smartart.cxx                    |   11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 5dfd5755c709e91d2903bd7be4582f7832e89780
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jan 7 16:32:18 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jan 7 17:29:44 2019 +0100

    oox smartart, org chart: fix font color when defined with quick styles
    
    createStyleMatrixContext() assumed that <dgm:style> contains
    <dgm:fontRef>, but it contains <a:fontRef> instead.
    
    This resulted in a 0 mnThemedIdx, which meant that since commit
    89206c472ecf18bfde6824cea8004921cd404365 (bnc#862510: PPTX import: Wrong
    text color inside shape, 2014-12-21) we ignored the theme color in
    oox::drawingml::Shape::createAndInsert().
    
    Change-Id: I81045fa58df5cb9e31a4ed3f1b1625224bcd06ad
    Reviewed-on: https://gerrit.libreoffice.org/65938
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
index 402c6cccea7b..c30aee51eaae 100644
--- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
+++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
@@ -111,7 +111,7 @@ DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFi
     const AttributeList& rAttribs,
     ShapeStyleRef& o_rStyle )
 {
-    o_rStyle.mnThemedIdx = (nElement == DGM_TOKEN(fontRef)) ?
+    o_rStyle.mnThemedIdx = (nElement == A_TOKEN(fontRef)) ?
         rAttribs.getToken( XML_idx, XML_none ) : rAttribs.getInteger( XML_idx, 0 );
     return new ColorContext( *this, o_rStyle.maPhClr );
 }
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 98df02de2fc9..1cde30c4e140 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -700,6 +700,17 @@ void SdImportTestSmartArt::testOrgChart()
     CPPUNIT_ASSERT(xManager.is());
     CPPUNIT_ASSERT_EQUAL(OUString("Manager"), xManager->getString());
 
+    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xManager, uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+    uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xPara, uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+    uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
+    sal_Int32 nActualColor = xRun->getPropertyValue("CharColor").get<sal_Int32>();
+    // Without the accompanying fix in place, this test would have failed: the
+    // "Manager" font color was black, not white.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffff), nActualColor);
+
     uno::Reference<drawing::XShape> xManagerShape(xManager, uno::UNO_QUERY);
     CPPUNIT_ASSERT(xManagerShape.is());
 


More information about the Libreoffice-commits mailing list