summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-11-13 09:40:09 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-11-19 13:49:01 +0100
commit894a01640a838c9affed7cccccc7378a452139b5 (patch)
tree2cc9982a9cc53d77285a5bc74fe085571f5aa1d3 /oox
parent31ed4c70b027848710a3dc911ff5a7ac18a97047 (diff)
tdf#137438 drawingml: separate outline from text import
By ignoring the a:ln group, the contents in that group (like transparency) were being applied to the text. Well, it should only apply to a line around the text, which LO isn't doing. [Well, LO can do this as Fontwork, but perhaps that doesn't match so well with text in shapes generally?] At any rate, don't allow one group's settings to override the others. Keep them separate and then apply a bit of merging logic to try to achieve the best look. So emulate a little bit. If the outline is not very transparent (less transparent than the main text) then it may (if thick or opaque enough) dominate the text. For simplicity (and because there is no right answer overall) I just compared transparency and used the more opaque colour. Unit tests potentially affected: -export-tests-ooxml1.cxx: tdf100348_FontworkBitmapFill.odp -> PPTX -now imports black instead of yellow (MSO sees gradient colors) -so previously completely wrong, and now perhaps even more wrong? -export-tests-ooxml3.cxx: tdf114848.pptx -shows blue text regardless - defined by area. -can't see where this is set in MSO2016. Perhaps illegal? - : tdf125573_FontWorkScaleX.pptx -no visual difference. Same as tdf100348, but with black outline. - : tdf119087.pptx -should be green, not purple. [Added test for that.] - : tdf143315-WordartWithoutBullet.ppt -no visual difference (COL_AUTO outline?) -import-tests2.cxx: tdf129686.pptx -poor test usage (but also weird transparent default). -no visual change. -ooxmlimport2.cx: tdf143476_lockedCanvas_position.docx -no visual difference. Irrelevant since we can't RT Change-Id: Iff0d95506dd64825444a99e62a6c2bd5e1dc122f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125300 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/textcharacterproperties.hxx3
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx12
-rw-r--r--oox/source/drawingml/textcharacterpropertiescontext.cxx7
3 files changed, 19 insertions, 3 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 ):