diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-09-30 14:35:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-09-30 17:52:37 +0200 |
commit | b1f085d66c1d354485edec527fda6abf539af325 (patch) | |
tree | b9d5df1dc2abb8406010835e3c421ce49aaa162a /vcl | |
parent | f3371e92d73b86246c23534dd3731feb251e699f (diff) |
Related: tdf#141633 drawing buttons to outputdevice affects later drawing
since...
commit 0b76e106b8054c91a7b7d793d9219f6ee9ae7d2c
Author: Oliver Bolte <obo@openoffice.org>
Date: Thu Sep 4 06:42:10 2003 +0000
INTEGRATION: CWS mt801 (1.21.132); FILE MERGED
2003/08/29 14:35:52 mt 1.21.132.1: #80064# Print button with color...
In the "sample db" example (Mockup.odb) there are two buttons with a
yellow background, when printed part of the table control is also
incorrectly painted with a yellow background.
Change-Id: I481b721801b5e1d1c78dc7a01cb20745702f5c01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122895
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/button.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 44151223aac1..07b06bb86dcd 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1365,6 +1365,9 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, pDev->Push(); pDev->SetMapMode(); pDev->SetFont( aFont ); + + std::optional<StyleSettings> oOrigDevStyleSettings; + if ( nFlags & SystemTextColorFlags::Mono ) { pDev->SetTextColor( COL_BLACK ); @@ -1372,10 +1375,10 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, else { pDev->SetTextColor( GetTextColor() ); - // DecoView uses the FaceColor... AllSettings aSettings = pDev->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); + oOrigDevStyleSettings = aStyleSettings; if ( IsControlBackground() ) aStyleSettings.SetFaceColor( GetControlBackground() ); else @@ -1394,6 +1397,16 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, aRect = aDecoView.DrawButton( aRect, nButtonStyle ); ImplDrawPushButtonContent( pDev, nFlags, aRect, true, nButtonStyle ); + + // restore original settings (which are not affected by Push/Pop) after + // finished drawing + if (oOrigDevStyleSettings) + { + AllSettings aSettings = pDev->GetSettings(); + aSettings.SetStyleSettings(*oOrigDevStyleSettings); + pDev->OutputDevice::SetSettings( aSettings ); + } + pDev->Pop(); } |