diff options
-rw-r--r-- | oox/inc/drawingml/textcharacterproperties.hxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterproperties.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterpropertiescontext.cxx | 7 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml3.cxx | 13 | ||||
-rw-r--r-- | sd/qa/unit/import-tests2.cxx | 4 |
5 files changed, 34 insertions, 5 deletions
diff --git a/oox/inc/drawingml/textcharacterproperties.hxx b/oox/inc/drawingml/textcharacterproperties.hxx index 2724af43051b..49d4125698a4 100644 --- a/oox/inc/drawingml/textcharacterproperties.hxx +++ b/oox/inc/drawingml/textcharacterproperties.hxx @@ -26,6 +26,7 @@ #include <drawingml/textfont.hxx> #include <drawingml/fillproperties.hxx> +#include <drawingml/lineproperties.hxx> namespace oox { class PropertySet; } @@ -57,6 +58,8 @@ struct TextCharacterProperties OptValue< bool > moItalic; OptValue< bool > moUnderlineLineFollowText; OptValue< bool > moUnderlineFillFollowText; + OptValue<LineProperties> moTextOutlineProperties; + FillProperties maFillProperties; /// Set if there was a property set that alters run visually during import bool mbHasVisualRunProperties; diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index bd4d051a490b..9200e9666cbf 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -65,6 +65,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource moItalic.assignIfUsed( rSourceProps.moItalic ); moUnderlineLineFollowText.assignIfUsed( rSourceProps.moUnderlineLineFollowText ); moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText ); + moTextOutlineProperties.assignIfUsed(rSourceProps.moTextOutlineProperties); maTextEffectsProperties = rSourceProps.maTextEffectsProperties; maFillProperties.assignUsed( rSourceProps.maFillProperties ); @@ -110,6 +111,17 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil if ( maFillProperties.moFillType.has() ) { Color aColor = maFillProperties.getBestSolidColor(); + // tdf#137438 Emulate text outline color/transparency. + // If the outline color dominates, then use it as the text color. + if (moTextOutlineProperties.has() + && moTextOutlineProperties.get().maLineFill.moFillType.has() + && moTextOutlineProperties.get().maLineFill.moFillType.get() != XML_noFill) + { + Color aLineColor = moTextOutlineProperties.get().maLineFill.getBestSolidColor(); + sal_Int16 nLineTransparency = aLineColor.getTransparency(); + if (nLineTransparency < aColor.getTransparency()) + aColor = aLineColor; + } rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper())); // set color theme index rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeColorIndex()); diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index ce2ac6a4a119..31ad3bee7c9f 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -21,6 +21,7 @@ #include <oox/helper/attributelist.hxx> #include <drawingml/colorchoicecontext.hxx> +#include <drawingml/linepropertiescontext.hxx> #include <drawingml/misccontexts.hxx> #include <drawingml/textcharacterproperties.hxx> #include <drawingml/texteffectscontext.hxx> @@ -113,9 +114,9 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl switch( aElementToken ) { -// TODO unsupported yet -// case A_TOKEN( ln ): // CT_LineProperties -// return new LinePropertiesContext( getHandler(), rAttribs, maTextOutlineProperties ); + case A_TOKEN(ln): // CT_LineProperties + // TODO still largely unsupported + return new LinePropertiesContext(*this, rAttribs, mrTextCharacterProperties.moTextOutlineProperties.use()); // EG_FillProperties case A_TOKEN( noFill ): case A_TOKEN( solidFill ): diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 4fc288f116c0..a9a740eb4588 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -1551,6 +1551,19 @@ void SdOOXMLExportTest3::testTdf119087() = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf119087.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), PPTX); // This would fail both on export validation, and reloading the saved pptx file. + + // Get first paragraph of the text + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); + 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); + + Color nColor = COL_AUTO; + xPropSet->getPropertyValue("CharColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(Color(0x00B050), nColor); + + xDocShRef->DoClose(); } void SdOOXMLExportTest3::testTdf131554() diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index c8f8c764aa71..9a5021f533b6 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -562,8 +562,8 @@ void SdImportTest2::testTdf129686() sal_Int16 nTransparency = 0; xPropSet->getPropertyValue("CharTransparence") >>= nTransparency; - // 100 = no transparency - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(100), nTransparency); + // 0 = no transparency, 100 (default) = completely transparent (unless COL_AUTO) + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), nTransparency); xDocShRef->DoClose(); } |