From 4dbb33a1c21948bebcf890c2f8ceb56b15a87936 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 21 Nov 2019 11:50:54 +0100 Subject: xmloff: add ODF import/export for semi-transparent shape text Test this from sd, so that SdModelTestBase::saveAndReload() calls BootstrapFixture::validate() for us. Change-Id: I6c90a3a71a5603604e69f9b45137bc8e4388dc0f Reviewed-on: https://gerrit.libreoffice.org/83371 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- .../OpenDocument-schema-v1.3+libreoffice.rng | 6 ++ sd/qa/unit/data/transparent-text.fodg | 64 ++++++++++++++++++++++ sd/qa/unit/export-tests.cxx | 22 ++++++++ xmloff/source/text/txtprmap.cxx | 4 ++ 4 files changed, 96 insertions(+) create mode 100644 sd/qa/unit/data/transparent-text.fodg diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng index 47c1ef790dbd..330364b77827 100644 --- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng +++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng @@ -2029,6 +2029,12 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. + + + + + + diff --git a/sd/qa/unit/data/transparent-text.fodg b/sd/qa/unit/data/transparent-text.fodg new file mode 100644 index 000000000000..697f2a22b8c1 --- /dev/null +++ b/sd/qa/unit/data/transparent-text.fodg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + asdf + + + + + + diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 57fe771339f1..9f15a20e47c4 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -57,6 +57,7 @@ public: void testTransparentBackground(); void testEmbeddedPdf(); void testEmbeddedText(); + void testTransparenText(); void testTdf98477(); void testAuthorField(); void testTdf50499(); @@ -88,6 +89,7 @@ public: CPPUNIT_TEST(testTransparentBackground); CPPUNIT_TEST(testEmbeddedPdf); CPPUNIT_TEST(testEmbeddedText); + CPPUNIT_TEST(testTransparenText); CPPUNIT_TEST(testTdf98477); CPPUNIT_TEST(testAuthorField); CPPUNIT_TEST(testTdf50499); @@ -824,6 +826,26 @@ void SdExportTest::testEmbeddedText() xShell->DoClose(); } +void SdExportTest::testTransparenText() +{ + sd::DrawDocShellRef xShell + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/transparent-text.fodg"), FODG); + xShell = saveAndReload(xShell.get(), ODG); + + uno::Reference xPage = getPage(0, xShell); + uno::Reference xShape(xPage->getByIndex(0), uno::UNO_QUERY); + sal_Int16 nCharTransparence = 0; + xShape->getPropertyValue("CharTransparence") >>= nCharTransparence; + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 75 + // - Actual : 0 + // i.e. the 75% transparent text was turned into a "not transparent at all" text. + CPPUNIT_ASSERT_EQUAL(static_cast(75), nCharTransparence); + + xShell->DoClose(); +} + void SdExportTest::testTdf98477() { utl::TempFile tempFile; diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 0136cfee7fce..cecdcd2c89b0 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -135,6 +135,8 @@ XMLPropertyMapEntry const aXMLParaPropMap[] = // RES_CHRATR_COLOR MT_ED( "CharColor", FO, COLOR, XML_TYPE_COLORAUTO|MID_FLAG_MERGE_PROPERTY, 0 ), MT_ED( "CharColor", STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ), + MAP_EXT_I("CharTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), + MAP_EXT("CharTransparence", XML_NAMESPACE_LO_EXT, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), // RES_CHRATR_CONTOUR MT_E( "CharContoured", STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ), // RES_CHRATR_CROSSEDOUT @@ -475,6 +477,8 @@ XMLPropertyMapEntry const aXMLTextPropMap[] = // RES_CHRATR_COLOR MT_ED( "CharColor", FO, COLOR, XML_TYPE_COLORAUTO|MID_FLAG_MERGE_PROPERTY, 0 ), MT_ED( "CharColor", STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ), + MAP_EXT_I("CharTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), + MAP_EXT("CharTransparence", XML_NAMESPACE_LO_EXT, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), // RES_CHRATR_CONTOUR MT_E( "CharContoured", STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ), // RES_CHRATR_CROSSEDOUT -- cgit