diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-10 17:02:46 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-06-24 08:37:38 +0200 |
commit | 02be0382798dc221d32c0a72d95b05b4562a1bde (patch) | |
tree | d5757d9ce2a846c6e292a5e1ee9caf1fd845e7cb | |
parent | 5f865b13d557c33537365c4b07e8c6cf69f5ec4d (diff) |
tdf#140934 update annotation menubutton bg when comment color changes
Change-Id: Ia4d10a8f19c039655dbe28c5f612061ce3755afa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112278
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 47ad7497f736b27c23667e0754cd686b78b60744)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117754
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | sw/inc/AnnotationWin.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin2.cxx | 49 |
2 files changed, 31 insertions, 20 deletions
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index a930ca0af940..a04068e758ea 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -223,6 +223,8 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public InterimItemWindow SvxLanguageItem GetLanguage() const; + void SetMenuButtonColors(); + SwPostItMgr& mrMgr; SwView& mrView; diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index c083ee8fa2e1..1eb8009127c0 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -443,6 +443,33 @@ static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFr sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0))); } +void SwAnnotationWin::SetMenuButtonColors() +{ + if (!mxMenuButton) + return; + + mxMenuButton->set_background(mColorDark); + + const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY(); + + ScopedVclPtrInstance<VirtualDevice> xVirDev; + Size aSize(tools::Long(METABUTTON_WIDTH * rFraction), + tools::Long(METABUTTON_HEIGHT * rFraction)); + tools::Rectangle aRect(Point(0, 0), aSize); + xVirDev->SetOutputSizePixel(aSize); + + Gradient aGradient(GradientStyle::Linear, + ColorFromAlphaColor(15, mColorAnchor, mColorDark), + ColorFromAlphaColor(80, mColorAnchor, mColorDark)); + xVirDev->DrawGradient(aRect, aGradient); + + DecorationView aDecoView(xVirDev.get()); + aDecoView.DrawSymbol(aRect, SymbolType::SPIN_DOWN, GetTextColor(), + DrawSymbolFlags::NONE); + mxMenuButton->set_image(xVirDev); + mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height()); +} + void SwAnnotationWin::Rescale() { // On Android, this method leads to invoke ImpEditEngine::UpdateViews @@ -470,25 +497,7 @@ void SwAnnotationWin::Rescale() mxMetadataDate->set_font(aFont); if (mxMetadataResolved) mxMetadataResolved->set_font(aFont); - if (mxMenuButton) - { - ScopedVclPtrInstance<VirtualDevice> xVirDev; - Size aSize(tools::Long(METABUTTON_WIDTH * rFraction), - tools::Long(METABUTTON_HEIGHT * rFraction)); - tools::Rectangle aRect(Point(0, 0), aSize); - xVirDev->SetOutputSizePixel(aSize); - - Gradient aGradient(GradientStyle::Linear, - ColorFromAlphaColor(15, mColorAnchor, mColorDark), - ColorFromAlphaColor(80, mColorAnchor, mColorDark)); - xVirDev->DrawGradient(aRect, aGradient); - - DecorationView aDecoView(xVirDev.get()); - aDecoView.DrawSymbol(aRect, SymbolType::SPIN_DOWN, GetTextColor(), - DrawSymbolFlags::NONE); - mxMenuButton->set_image(xVirDev); - mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height()); - } + SetMenuButtonColors(); if (mxVScrollbar) mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth()); } @@ -842,7 +851,7 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA return; m_xContainer->set_background(mColorDark); - mxMenuButton->set_background(mColorDark); + SetMenuButtonColors(); mxMetadataAuthor->set_font_color(aColorAnchor); |