[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sw/inc sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 24 06:38:17 UTC 2021


 sw/inc/AnnotationWin.hxx                  |    2 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |   49 +++++++++++++++++-------------
 2 files changed, 31 insertions(+), 20 deletions(-)

New commits:
commit 02be0382798dc221d32c0a72d95b05b4562a1bde
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Mar 10 17:02:46 2021 +0000
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Jun 24 08:37:38 2021 +0200

    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 at redhat.com>
    (cherry picked from commit 47ad7497f736b27c23667e0754cd686b78b60744)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117754
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

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);
 


More information about the Libreoffice-commits mailing list