Kaydet (Commit) 294f43d7 authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Caolán McNamara

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.

Change-Id: I8246fa4b7834f60872b0737f03906ccc86948cc1
(cherry picked from commit d48d0e81)
Reviewed-on: https://gerrit.libreoffice.org/17814Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst ace88a7d
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <swmodule.hxx> #include <swmodule.hxx>
#include <accessibilityoptions.hxx> #include <accessibilityoptions.hxx>
#include <svtools/accessibilityoptions.hxx> #include <svtools/accessibilityoptions.hxx>
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
#include <doc.hxx> #include <doc.hxx>
#include <editeng/fhgtitem.hxx> #include <editeng/fhgtitem.hxx>
#include <docsh.hxx> #include <docsh.hxx>
...@@ -2521,6 +2522,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont ) ...@@ -2521,6 +2522,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
{ {
// check if current background has a user defined setting // check if current background has a user defined setting
const Color* pCol = GetFont() ? GetFont()->GetBackColor() : NULL; const Color* pCol = GetFont() ? GetFont()->GetBackColor() : NULL;
Color aColor;
if( ! pCol || COL_TRANSPARENT == pCol->GetColor() ) if( ! pCol || COL_TRANSPARENT == pCol->GetColor() )
{ {
const SvxBrushItem* pItem; const SvxBrushItem* pItem;
...@@ -2537,6 +2539,14 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont ) ...@@ -2537,6 +2539,14 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
/// is a background brush and its color is *not* "no fill"/"auto fill". /// is a background brush and its color is *not* "no fill"/"auto fill".
if( GetFrm()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false ) ) 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 ) if ( !pCol )
{ {
pCol = &pItem->GetColor(); pCol = &pItem->GetColor();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment