summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--solenv/sanitizers/ui/modules/swriter.suppr1
-rw-r--r--sw/inc/AnnotationWin.hxx1
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx41
-rw-r--r--sw/uiconfig/swriter/ui/annotation.ui23
4 files changed, 45 insertions, 21 deletions
diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr
index 19d33c2133a4..55fc178a6213 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -1,6 +1,7 @@
sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label4'] orphan-label
sw/uiconfig/swriter/ui/addentrydialog.ui://GtkEntry[@id='entry'] no-labelled-by
sw/uiconfig/swriter/ui/annotation.ui://GtkDrawingArea[@id='editview'] no-labelled-by
+sw/uiconfig/swriter/ui/annotation.ui://GtkMenuButton[@id='menubutton'] button-no-label
sw/uiconfig/swriter/ui/asciifilterdialog.ui://GtkLabel[@id='label5'] orphan-label
sw/uiconfig/swriter/ui/authenticationsettingsdialog.ui://GtkLabel[@id='label1'] orphan-label
sw/uiconfig/swriter/ui/authenticationsettingsdialog.ui://GtkLabel[@id='label2'] orphan-label
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 706531ec4137..a930ca0af940 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -153,7 +153,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public InterimItemWindow
sal_Int32 GetMetaHeight() const;
sal_Int32 GetMinimumSizeWithMeta() const;
sal_Int32 GetMinimumSizeWithoutMeta() const;
- sal_Int32 GetMetaButtonAreaWidth() const;
int GetPrefScrollbarWidth() const;
sal_Int32 GetNumFields() const;
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 12126e35829a..c083ee8fa2e1 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -51,8 +51,10 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
+#include <vcl/decoview.hxx>
#include <vcl/fixed.hxx>
#include <vcl/event.hxx>
+#include <vcl/gradient.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -100,7 +102,6 @@ namespace sw::annotation {
#define METABUTTON_WIDTH 16
#define METABUTTON_HEIGHT 18
-#define METABUTTON_AREA_WIDTH 30
#define POSTIT_META_FIELD_HEIGHT sal_Int32(15)
#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
@@ -435,6 +436,13 @@ void SwAnnotationWin::CheckMetaText()
SwPostItMgr::GetColorAnchor(aIndex));
}
+static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
+{
+ return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)),
+ sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)),
+ sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0)));
+}
+
void SwAnnotationWin::Rescale()
{
// On Android, this method leads to invoke ImpEditEngine::UpdateViews
@@ -462,9 +470,27 @@ 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());
+ }
if (mxVScrollbar)
mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
-
}
void SwAnnotationWin::SetPosAndSize()
@@ -1163,20 +1189,15 @@ void SwAnnotationWin::ResetAttributes()
int SwAnnotationWin::GetPrefScrollbarWidth() const
{
- return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
-}
-
-sal_Int32 SwAnnotationWin::GetMetaButtonAreaWidth() const
-{
- const Fraction& f( GetMapMode().GetScaleX() );
- return tools::Long(METABUTTON_AREA_WIDTH * f);
+ const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
+ return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize() * f);
}
sal_Int32 SwAnnotationWin::GetMetaHeight() const
{
const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
const int fields = GetNumFields();
- return tools::Long(fields*POSTIT_META_FIELD_HEIGHT*f);
+ return tools::Long(fields*POSTIT_META_FIELD_HEIGHT * f);
}
sal_Int32 SwAnnotationWin::GetNumFields() const
diff --git a/sw/uiconfig/swriter/ui/annotation.ui b/sw/uiconfig/swriter/ui/annotation.ui
index 753f373136af..c0d937d00245 100644
--- a/sw/uiconfig/swriter/ui/annotation.ui
+++ b/sw/uiconfig/swriter/ui/annotation.ui
@@ -2,6 +2,12 @@
<!-- Generated with glade 3.38.2 -->
<interface domain="sw">
<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">sfx2/res/menu.png</property>
+ <property name="icon_size">2</property>
+ </object>
<object class="GtkMenu" id="menu">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -206,19 +212,16 @@
<child>
<object class="GtkMenuButton" id="menubutton">
<property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="focus-on-click">False</property>
- <property name="label" translatable="no"></property>
- <property name="receives-default">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="popup">menu</property>
+ <property name="image">image7</property>
+ <property name="always_show_image">True</property>
+ <property name="relief">none</property>
<property name="valign">start</property>
<property name="margin-end">10</property>
<property name="margin-top">5</property>
- <property name="relief">none</property>
- <property name="draw-indicator">True</property>
- <property name="popup">menu</property>
- <child>
- <placeholder/>
- </child>
+ <property name="use_popover">False</property>
<style>
<class name="small-button"/>
</style>