[Libreoffice-commits] core.git: vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 30 15:53:13 UTC 2021
vcl/source/control/button.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit b1f085d66c1d354485edec527fda6abf539af325
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 30 14:35:14 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 30 17:52:37 2021 +0200
Related: tdf#141633 drawing buttons to outputdevice affects later drawing
since...
commit 0b76e106b8054c91a7b7d793d9219f6ee9ae7d2c
Author: Oliver Bolte <obo at 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 at redhat.com>
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();
}
More information about the Libreoffice-commits
mailing list