summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-10-13 20:59:20 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-11-25 12:43:25 +0100
commite01df3488abe6d319c6874ca870afb82a3ad9b1e (patch)
tree06bff7e3e2064526e5a5349ab1a5296310670d3b
parent916746a5155a1a17225e85d2c30a1c2322aac589 (diff)
tdf#118776: pptx import: draw char noFill as transparent
The problem is that LibreOffice doesn't have the property fill=none for text Change-Id: I0c7c62be102e05729f0b2cf09d95e208694b1d2b Reviewed-on: https://gerrit.libreoffice.org/80743 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx7
-rw-r--r--sd/qa/unit/data/pptx/tdf118776.pptxbin0 -> 31591 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx22
3 files changed, 28 insertions, 1 deletions
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index de47058e60ca..54b939ac6827 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -113,7 +113,12 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
Color aColor = maFillProperties.getBestSolidColor();
rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper()));
- if (aColor.hasTransparency())
+ if( maFillProperties.moFillType.get() == XML_noFill )
+ {
+ // noFill doesn't exist for characters. Map noFill to 99% transparency
+ rPropMap.setProperty(PROP_CharTransparence, sal_Int16((MAX_PERCENT - 1) / PER_PERCENT) );
+ }
+ else if (aColor.hasTransparency())
{
rPropMap.setProperty(PROP_CharTransparence, aColor.getTransparency());
}
diff --git a/sd/qa/unit/data/pptx/tdf118776.pptx b/sd/qa/unit/data/pptx/tdf118776.pptx
new file mode 100644
index 000000000000..8df94522ab29
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf118776.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3b50bce311ad..779a6503577a 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -169,6 +169,7 @@ public:
void testAoo124143();
void testTdf103567();
void testTdf103792();
+ void testTdf118776();
void testTdf103876();
void testTdf79007();
void testTdf104015();
@@ -271,6 +272,7 @@ public:
CPPUNIT_TEST(testAoo124143);
CPPUNIT_TEST(testTdf103567);
CPPUNIT_TEST(testTdf103792);
+ CPPUNIT_TEST(testTdf118776);
CPPUNIT_TEST(testTdf103876);
CPPUNIT_TEST(testTdf79007);
CPPUNIT_TEST(testTdf104015);
@@ -1760,6 +1762,26 @@ void SdImportTest::testTdf103792()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf118776()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf118776.pptx"), PPTX);
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
+
+ // Get first paragraph of the text
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
+
+ // Get first run of the paragraph
+ uno::Reference<text::XTextRange> xRun( getRunFromParagraph (0, xParagraph ) );
+ uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
+ sal_Int16 nTransparency = 0;
+ xPropSet->getPropertyValue("CharTransparence") >>= nTransparency;
+
+ // Import noFill color as 99% transparency
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(99), nTransparency);
+
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testTdf103876()
{
// Title text shape's placeholder text did not inherit the corresponding text properties