sd/source/ui/annotations/annotationwindow.cxx |   31 +++++++++++++++++++++++---
 sd/uiconfig/simpress/ui/annotation.ui         |    9 ++++++-
 2 files changed, 36 insertions(+), 4 deletions(-)

New commits:
commit 2f5c7550f2eb117fb890d94bf0ed492ad5c7989a
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Jun 16 21:21:45 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jun 17 12:34:08 2024 +0200

    Resolves: tdf#160681 draw impress comment similarly to how writer does it
    
    so we get the same filled MenuButton in both applications
    
    Change-Id: Iea41a17285287ec2794e4cdce6eaae0906fff291
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168969
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168989

diff --git a/sd/source/ui/annotations/annotationwindow.cxx 
b/sd/source/ui/annotations/annotationwindow.cxx
index a2f17a1a53cb..ec9a2118eac1 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -40,11 +40,13 @@
 
 #include <vcl/commandevent.hxx>
 #include <vcl/commandinfoprovider.hxx>
+#include <vcl/decoview.hxx>
 #include <vcl/vclenum.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/gradient.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/ptrstyle.hxx>
+#include <vcl/virdev.hxx>
 
 #include <strings.hrc>
 #include "annotationwindow.hxx"
@@ -278,10 +280,7 @@ void AnnotationWindow::InitControls()
     if (mbReadonly)
         mxMenuButton->hide();
     else
-    {
-        mxMenuButton->set_size_request(METABUTTON_WIDTH, METABUTTON_HEIGHT);
         mxMenuButton->connect_selected(LINK(this, AnnotationWindow, 
MenuItemSelectedHdl));
-    }
 
     EEControlBits nCntrl = mpOutliner->GetControlWord();
     nCntrl |= EEControlBits::PASTESPECIAL | EEControlBits::AUTOCORRECT | 
EEControlBits::USECHARATTRIBS | EEControlBits::NOCOLORS;
@@ -557,6 +556,32 @@ void AnnotationWindow::SetColor()
     mxPopover->set_background(maColor);
     mxMenuButton->set_background(maColor);
 
+    ScopedVclPtrInstance<VirtualDevice> xVirDev;
+    xVirDev->SetLineColor();
+    xVirDev->SetFillColor(maColor);
+
+    Size aSize(METABUTTON_WIDTH, METABUTTON_HEIGHT);
+    ::tools::Rectangle aRect(Point(0, 0), aSize);
+    xVirDev->SetOutputSizePixel(aSize);
+    xVirDev->DrawRect(aRect);
+
+    ::tools::Rectangle aSymbolRect(aRect);
+    // 25% distance to the left and right button border
+    const ::tools::Long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() 
* 250) + 500) / 1000;
+    aSymbolRect.AdjustLeft(nBorderDistanceLeftAndRight );
+    aSymbolRect.AdjustRight( -nBorderDistanceLeftAndRight );
+    // 40% distance to the top button border
+    const ::tools::Long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) 
+ 500) / 1000;
+    aSymbolRect.AdjustTop(nBorderDistanceTop );
+    // 15% distance to the bottom button border
+    const ::tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 
150) + 500) / 1000;
+    aSymbolRect.AdjustBottom( -nBorderDistanceBottom );
+    DecorationView aDecoView(xVirDev.get());
+    aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, COL_BLACK,
+                         DrawSymbolFlags::NONE);
+    mxMenuButton->set_image(xVirDev);
+    mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height() + 4);
+
     mxMeta->set_font_color(bHighContrast ? maColorLight : maColorDark);
 
     mxVScrollbar->customize_scrollbars(maColorLight,
diff --git a/sd/uiconfig/simpress/ui/annotation.ui 
b/sd/uiconfig/simpress/ui/annotation.ui
index 49a8a300e335..dcebff0f95d6 100644
--- a/sd/uiconfig/simpress/ui/annotation.ui
+++ b/sd/uiconfig/simpress/ui/annotation.ui
@@ -2,6 +2,12 @@
 <!-- Generated with glade 3.38.2 -->
 <interface domain="sd">
   <requires lib="gtk+" version="3.20"/>
+  <object class="GtkImage" id="image7">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="icon-name">open-menu-symbolic</property>
+    <property name="icon_size">2</property>
+  </object>
   <object class="GtkMenu" id="menu">
     <property name="visible">True</property>
     <property name="can-focus">False</property>
@@ -140,8 +146,9 @@
                 <property name="valign">start</property>
                 <property name="margin-end">10</property>
                 <property name="margin-top">5</property>
+                <property name="image">image7</property>
                 <property name="relief">none</property>
-                <property name="draw-indicator">True</property>
+                <property name="always-show-image">True</property>
                 <property name="popup">menu</property>
                 <child>
                   <placeholder/>

Reply via email to