summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-08-10 09:14:27 +0200
committerMichael Stahl <mstahl@redhat.com>2015-09-03 10:48:17 +0000
commit7fcedb1325887b9ca810b28769cc9083addc0033 (patch)
treee4f2c7bc53c5cc6b4826c30b562d732a45e811d2
parent1477e3a2229310a2c439c5f6d9c0d32b2191ec18 (diff)
tdf#87922 SwDrawTextInfo::ApplyAutoColor: handle fill attributes
With this, if page background is set to e.g. black, then automatic color of text is again white, not black. (cherry picked from commit d48d0e81971266ff4625721b0f069a62ec7014e2) Change-Id: I8246fa4b7834f60872b0737f03906ccc86948cc1 Reviewed-on: https://gerrit.libreoffice.org/18293 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/core/txtnode/fntcache.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 76d35001c166..8cb2188cc132 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -47,6 +47,7 @@
#include <swmodule.hxx>
#include <accessibilityoptions.hxx>
#include <svtools/accessibilityoptions.hxx>
+#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
#include <doc.hxx>
#include <editeng/fhgtitem.hxx>
#include <docsh.hxx>
@@ -2496,6 +2497,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
{
// check if current background has a user defined setting
const Color* pCol = GetFont() ? GetFont()->GetBackColor() : NULL;
+ Color aColor;
if( ! pCol || COL_TRANSPARENT == pCol->GetColor() )
{
const SvxBrushItem* pItem;
@@ -2512,6 +2514,14 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
/// is a background brush and its color is *not* "no fill"/"auto fill".
if( GetFrm()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false ) )
{
+ if (aFillAttributes.get() && aFillAttributes->isUsed())
+ {
+ // First see if fill atttributes provide a color.
+ aColor = Color(aFillAttributes->getAverageColor(aGlobalRetoucheColor.getBColor()));
+ pCol = &aColor;
+ }
+
+ // If not, then fall back to the old brush item.
if ( !pCol )
{
pCol = &pItem->GetColor();