summaryrefslogtreecommitdiff
path: root/sw/source/core/text/inftxt.cxx
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2021-08-31 10:46:11 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-09-01 09:21:04 +0200
commitd66ab0c7e8b0330c5c82e37e256557b1a7a6ae03 (patch)
treea81ec6f9d0f8406a1fa9c6cccdd63435509408e3 /sw/source/core/text/inftxt.cxx
parent9d8324524bdcd1244cd6e9d93b063b981d47c9be (diff)
Resolves tdf#142116 - Respect field shading color on dark background
This reverts #100366# commit ce057f404b7b39df4a9259eecd90e28cf9a75fbd Change-Id: I50872e38a154f5d24bcfaafd11488508e3c52356 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121359 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core/text/inftxt.cxx')
-rw-r--r--sw/source/core/text/inftxt.cxx49
1 files changed, 4 insertions, 45 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 4f5df3eb8f17..82f065561a3e 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -521,39 +521,6 @@ SwTextPaintInfo::SwTextPaintInfo( SwTextFrame *pFrame, const SwRect &rPaint )
CtorInitTextPaintInfo( pFrame->getRootFrame()->GetCurrShell()->GetOut(), pFrame, rPaint );
}
-/// Returns if the current background color is dark.
-static bool lcl_IsDarkBackground( const SwTextPaintInfo& rInf )
-{
- std::optional<Color> pCol = rInf.GetFont()->GetBackColor();
- if( ! pCol || COL_TRANSPARENT == *pCol )
- {
- const SvxBrushItem* pItem;
- SwRect aOrigBackRect;
- drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
-
- // Consider, that [GetBackgroundBrush(...)] can set <pCol>
- // See implementation in /core/layout/paintfrm.cxx
- // There is a background color, if there is a background brush and
- // its color is *not* "no fill"/"auto fill".
- if( rInf.GetTextFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false, /*bConsiderTextBox=*/false ) )
- {
- if ( !pCol )
- pCol = pItem->GetColor();
-
- // Determined color <pCol> can be <COL_TRANSPARENT>. Thus, check it.
- if ( *pCol == COL_TRANSPARENT)
- pCol.reset();
- }
- else
- pCol.reset();
- }
-
- if( !pCol )
- pCol = aGlobalRetoucheColor;
-
- return pCol->IsDark();
-}
-
namespace
{
/**
@@ -1137,20 +1104,12 @@ void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pC
OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- // For dark background we do not want to have a filled rectangle
- if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) )
- {
- pOut->SetLineColor( SwViewOption::GetFontColor() );
- }
+ if ( pColor )
+ pOut->SetFillColor( *pColor );
else
- {
- if ( pColor )
- pOut->SetFillColor( *pColor );
- else
- pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
- pOut->SetLineColor();
- }
+ pOut->SetLineColor();
DrawRect( aIntersect, true );
pOut->Pop();