summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/drawingml/shape.cxx13
-rw-r--r--sd/qa/unit/data/pptx/bnc862510_6.pptxbin0 -> 48707 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx40
3 files changed, 48 insertions, 5 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 28b93b12eec9..871043521c0c 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -647,11 +647,14 @@ Reference< XShape > Shape::createAndInsert(
TextCharacterProperties aCharStyleProperties;
if( const ShapeStyleRef* pFontRef = getShapeStyleRef( XML_fontRef ) )
{
- if( pTheme )
- if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) )
- aCharStyleProperties.assignUsed( *pCharProps );
- SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "use font color");
- aCharStyleProperties.maCharColor.assignIfUsed( pFontRef->maPhClr );
+ if( pFontRef->mnThemedIdx != 0 )
+ {
+ if( pTheme )
+ if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) )
+ aCharStyleProperties.assignUsed( *pCharProps );
+ SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "use font color");
+ aCharStyleProperties.maCharColor.assignIfUsed( pFontRef->maPhClr );
+ }
}
Reference < XTextCursor > xAt = xText->createTextCursor();
diff --git a/sd/qa/unit/data/pptx/bnc862510_6.pptx b/sd/qa/unit/data/pptx/bnc862510_6.pptx
new file mode 100644
index 000000000000..fc5f008c5c32
--- /dev/null
+++ b/sd/qa/unit/data/pptx/bnc862510_6.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 70be8e54ad22..d652a1f8f10d 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -74,6 +74,7 @@ public:
void testBnc584721_4();
void testBnc904423();
void testShapeLineStyle();
+ void testBnc862510_6();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -95,6 +96,7 @@ public:
CPPUNIT_TEST(testBnc584721_4);
CPPUNIT_TEST(testBnc904423);
CPPUNIT_TEST(testShapeLineStyle);
+ CPPUNIT_TEST(testBnc862510_6);
CPPUNIT_TEST_SUITE_END();
};
@@ -860,6 +862,44 @@ void SdFiltersTest::testShapeLineStyle()
xDocShRef->DoClose();
}
+void SdFiltersTest::testBnc862510_6()
+{
+ // Black text was imported instead of gray
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_6.pptx"));
+
+ uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< drawing::XDrawPage > xPage(
+ xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+
+ uno::Reference< beans::XPropertySet > xShape(
+ xPage->getByIndex(0), uno::UNO_QUERY );
+ CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
+
+ // Get first paragraph of the text
+ uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+ CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
+ uno::Reference<container::XEnumerationAccess> paraEnumAccess;
+ paraEnumAccess.set(xText, uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
+ uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
+ uno::UNO_QUERY_THROW);
+
+ // Get first run of the paragraph
+ uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+ uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
+ sal_Int32 nCharColor;
+ xPropSet->getPropertyValue( "CharColor" ) >>= nCharColor;
+
+ // Color should be gray
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(0x8B8B8B), nCharColor );
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();