From c184cd984865a0406940b9f39ac1cd538b922e8f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 20 Dec 2025 22:25:15 +0100 Subject: [PATCH] tdf#168594 tdf#119931 a11y special chars: Use IconView for recent/favorites For the recently used and favorite characters in the special characters toolbar popup (triggered by the "Insert Special Characters" toolbar button) and the special characters dialog (triggered via "Insert" -> "Special Character..."), SfxCharmapContainer was so far using grids of the custom SvxCharView, with each SvxCharView displaying one character. Switch from those grids of custom controls to weld::IconView, one for the recent characters and one for the favorites. This ensures more standard/consistent interaction behavior, like being able to navigate between the characters in the IconView using the arrow keys (tdf#168594) and allows dropping quite some custom logic. Previous commits already reworked the logic/refactored involved code to make the port to weld::IconView easier. Some notes: 1) As described in more detail in previous commit commit 176f8acd7a993fc45ac7f027123270f80e4924ea Author: Michael Weghorn Date: Fri Dec 19 19:52:45 2025 +0100 tdf#168594 Rework SvxCharView activation logic , the toolbar popup activates characters on single click while the dialog does not. The GtkIconView:activate-on-single-click [1] property is set accordingly in the .ui file for the popup, but not for the dialog. 2) The logic to draw the "icon" of a single character, now located in SfxCharmapContainer::CreateIcon, is based on the existing/previous logic from SvxCharView, previously spread across multiple methods there (SvxCharView::SetDrawingArea, SvxCharView::UpdateFont, SvxCharView::Paint, logic pretty much in that order still). 3) When an item view loses focus, selection is cleared, and it is restored when it receives focus again - see ItemViewFocusInHdl and ItemViewFocusOutHdl. This is because it is irrelevant what character was previously selected in one of those icon views while interacting with the other icon view or the bigger table of icons in the special characters dialog. (Still showing selection might be considered misleading.) 4) The switch to weld::IconView also addresses various of the gla11y warnings in the special characters dialog (related ticket: tdf#119931). 5) The previously used SvxCharView class is now unused, and therefore dropped. [1] https://docs.gtk.org/gtk3/property.IconView.activate-on-single-click.html Change-Id: Id6407b1c4b154bc7004723a0534141107a6939d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196035 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- cui/uiconfig/ui/specialcharacters.ui | 423 +++----------------- include/sfx2/charmapcontainer.hxx | 48 ++- include/sfx2/charwin.hxx | 47 +-- sfx2/Library_sfx.mk | 1 - sfx2/source/control/charmapcontainer.cxx | 361 ++++++++++------- sfx2/source/control/charmapcontrol.cxx | 4 +- sfx2/source/control/charwin.cxx | 253 ------------ sfx2/uiconfig/ui/charmapcontrol.ui | 486 ++--------------------- solenv/clang-format/excludelist | 1 - solenv/sanitizers/ui/cui.suppr | 32 -- svx/source/dialog/cuicharmap.cxx | 5 +- 11 files changed, 338 insertions(+), 1323 deletions(-) delete mode 100644 sfx2/source/control/charwin.cxx diff --git a/cui/uiconfig/ui/specialcharacters.ui b/cui/uiconfig/ui/specialcharacters.ui index bb0a05caefd6..9e6361eab17e 100644 --- a/cui/uiconfig/ui/specialcharacters.ui +++ b/cui/uiconfig/ui/specialcharacters.ui @@ -2,6 +2,26 @@ + + + + + + + + + + + + + + + + + + + + False 6 @@ -373,7 +393,7 @@ start Recent Characters: True - viewchar1 + recentchars_iconview False @@ -382,202 +402,19 @@ - + True - False - 2 - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 1 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 2 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 3 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 4 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 5 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 6 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 7 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 8 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 9 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 10 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 11 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 12 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 13 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 14 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - False - True - 15 - - + True + start + start + 6 + recentchars_treestore + 0 + 16 + 0 + 0 + 2 + 2 False @@ -607,7 +444,7 @@ start Favorite Characters: True - favchar1 + favchars_iconview False @@ -616,187 +453,19 @@ - - + True - False - 2 - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 0 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 1 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 3 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 2 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 4 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 5 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 6 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 7 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 15 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 14 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 13 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 12 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 11 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 10 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 9 - 0 - - - - - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 8 - 0 - - + True + start + start + 6 + favchars_treestore + 0 + 16 + 0 + 0 + 2 + 2 False diff --git a/include/sfx2/charmapcontainer.hxx b/include/sfx2/charmapcontainer.hxx index 0c6ba5069f44..02a9e6104492 100644 --- a/include/sfx2/charmapcontainer.hxx +++ b/include/sfx2/charmapcontainer.hxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -32,43 +32,47 @@ class SFX2_DLLPUBLIC SfxCharmapContainer std::deque m_aRecentChars; std::deque m_aFavChars; - SvxCharView m_aRecentCharView[16]; - SvxCharView m_aFavCharView[16]; - std::unique_ptr m_xRecentCharView[16]; - std::unique_ptr m_xFavCharView[16]; + std::unique_ptr m_xRecentIconView; + std::unique_ptr m_xFavIconView; - std::unique_ptr m_xRecentGrid; - std::unique_ptr m_xFavGrid; + Link m_aCharActivateHdl; + Link m_aCharSelectedHdl; Link m_aUpdateFavHdl; Link m_aUpdateRecentHdl; - DECL_DLLPRIVATE_LINK(RecentContextMenuHdl, const CommandEvent&, void); - DECL_DLLPRIVATE_LINK(FavContextMenuHdl, const CommandEvent&, void); + DECL_DLLPRIVATE_LINK(IconViewSelectionChangedHdl, weld::IconView&, void); + DECL_DLLPRIVATE_LINK(ItemActivatedHdl, weld::IconView&, bool); + DECL_DLLPRIVATE_LINK(ItemViewFocusInHdl, weld::Widget&, void); + DECL_DLLPRIVATE_STATIC_LINK(SfxCharmapContainer, ItemViewFocusOutHdl, weld::Widget&, void); - DECL_DLLPRIVATE_LINK(RecentClearClickHdl, SvxCharView&, void); - DECL_DLLPRIVATE_LINK(FavClearClickHdl, SvxCharView&, void); - DECL_DLLPRIVATE_LINK(RecentClearAllClickHdl, SvxCharView&, void); - DECL_DLLPRIVATE_LINK(FavClearAllClickHdl, SvxCharView&, void); + DECL_DLLPRIVATE_LINK(RecentContextMenuHdl, const CommandEvent&, bool); + DECL_DLLPRIVATE_LINK(FavContextMenuHdl, const CommandEvent&, bool); - static void HandleContextMenu(std::span aCharViews, - const Link& rClearHdl, - const Link& rClearAllHdl, + DECL_DLLPRIVATE_LINK(RecentClearClickHdl, const CharAndFont&, void); + DECL_DLLPRIVATE_LINK(FavClearClickHdl, const CharAndFont&, void); + DECL_DLLPRIVATE_LINK(RecentClearAllClickHdl, weld::IconView&, void); + DECL_DLLPRIVATE_LINK(FavClearAllClickHdl, weld::IconView&, void); + + static bool HandleContextMenu(weld::IconView& rIconView, std::deque& rChars, + const Link& rClearHdl, + const Link& rClearAllHdl, const CommandEvent& rCmdEvent); - static void updateCharControl(std::span aCharViews, - const std::deque& rChars); + static void updateCharControl(weld::IconView& rIconView, const std::deque& rChars); static bool GetDecimalValueAndCharName(std::u16string_view sCharText, sal_UCS4& rDecimalValue, OUString& rCharName); public: - SfxCharmapContainer(weld::Builder& rBuilder, const VclPtr& rVirDev, - bool bLockGridSizes); + SfxCharmapContainer(weld::Builder& rBuilder); - void init(bool bActivateOnSingleClick, const Link& rActivateHdl, + void init(const Link& rActivateHdl, const Link& rUpdateFavHdl, const Link& rUpdateRecentHdl, - const Link& rFocusInHdl = Link()); + const Link& rCharSelectedHdl); + + static VclPtr CreateIcon(weld::IconView& rIconView, const OUString& rFont, + const OUString& rText); void getFavCharacterList(); void updateFavCharControl(); diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx index d5956a795f6d..60daa52940e9 100644 --- a/include/sfx2/charwin.hxx +++ b/include/sfx2/charwin.hxx @@ -19,10 +19,7 @@ #pragma once -#include -#include -#include -#include +#include struct CharAndFont { @@ -38,46 +35,4 @@ struct CharAndFont bool operator==(const CharAndFont& rOther) const = default; }; -class SAL_DLLPUBLIC_RTTI SvxCharView final : public weld::CustomWidgetController -{ -private: - VclPtr mxVirDev; - vcl::Font maFont; - bool m_bActivateOnSingleClick; - OUString m_sText; - OUString m_sToolTip; - - Link maFocusInHdl; - Link maActivateHdl; - Link maContextMenuHdl; - - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; - virtual void Resize() override; - virtual bool MouseButtonDown(const MouseEvent&) override; - virtual void GetFocus() override; - virtual void LoseFocus() override; - virtual OUString RequestHelp(tools::Rectangle&rHelpRect) override; - virtual bool KeyInput(const KeyEvent&) override; - virtual bool Command(const CommandEvent&) override; - virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; - -public: - SvxCharView(const VclPtr& rVirDev); - SFX2_DLLPUBLIC virtual ~SvxCharView() override; - - void UpdateFont(const OUString& rFontFamilyName); - OUString GetFontFamilyName() const { return maFont.GetFamilyName(); } - void SetText( const OUString& rText ); - OUString const & GetText() const { return m_sText; } - CharAndFont GetCharAndFont() const; - void SetToolTip(const OUString& rToolTip) { m_sToolTip = rToolTip; }; - void SetActivateOnSingleClick(bool bActivate); - - Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); } - - void setFocusInHdl(const Link& rLink); - void setActivateHdl(const Link& rLink); - void setContextMenuHdl(const Link& rLink); -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index eb8617c7fc54..8357dec83af8 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -167,7 +167,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/control/thumbnailview \ sfx2/source/control/charmapcontainer \ sfx2/source/control/charmapcontrol \ - sfx2/source/control/charwin \ sfx2/source/control/unoctitm \ sfx2/source/devtools/DevelopmentToolChildWindow \ sfx2/source/devtools/DevelopmentToolDockingWindow \ diff --git a/sfx2/source/control/charmapcontainer.cxx b/sfx2/source/control/charmapcontainer.cxx index 7a521a5abc0a..7ae42a55dde5 100644 --- a/sfx2/source/control/charmapcontainer.cxx +++ b/sfx2/source/control/charmapcontainer.cxx @@ -28,94 +28,26 @@ #include #include #include +#include #include #include using namespace css; -SfxCharmapContainer::SfxCharmapContainer(weld::Builder& rBuilder, const VclPtr& rVirDev, bool bLockGridSizes) - : m_aRecentCharView{SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev)} - , m_aFavCharView{SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev), - SvxCharView(rVirDev)} - , m_xRecentCharView{std::make_unique(rBuilder, "viewchar1", m_aRecentCharView[0]), - std::make_unique(rBuilder, "viewchar2", m_aRecentCharView[1]), - std::make_unique(rBuilder, "viewchar3", m_aRecentCharView[2]), - std::make_unique(rBuilder, "viewchar4", m_aRecentCharView[3]), - std::make_unique(rBuilder, "viewchar5", m_aRecentCharView[4]), - std::make_unique(rBuilder, "viewchar6", m_aRecentCharView[5]), - std::make_unique(rBuilder, "viewchar7", m_aRecentCharView[6]), - std::make_unique(rBuilder, "viewchar8", m_aRecentCharView[7]), - std::make_unique(rBuilder, "viewchar9", m_aRecentCharView[8]), - std::make_unique(rBuilder, "viewchar10", m_aRecentCharView[9]), - std::make_unique(rBuilder, "viewchar11", m_aRecentCharView[10]), - std::make_unique(rBuilder, "viewchar12", m_aRecentCharView[11]), - std::make_unique(rBuilder, "viewchar13", m_aRecentCharView[12]), - std::make_unique(rBuilder, "viewchar14", m_aRecentCharView[13]), - std::make_unique(rBuilder, "viewchar15", m_aRecentCharView[14]), - std::make_unique(rBuilder, "viewchar16", m_aRecentCharView[15])} - , m_xFavCharView{std::make_unique(rBuilder, "favchar1", m_aFavCharView[0]), - std::make_unique(rBuilder, "favchar2", m_aFavCharView[1]), - std::make_unique(rBuilder, "favchar3", m_aFavCharView[2]), - std::make_unique(rBuilder, "favchar4", m_aFavCharView[3]), - std::make_unique(rBuilder, "favchar5", m_aFavCharView[4]), - std::make_unique(rBuilder, "favchar6", m_aFavCharView[5]), - std::make_unique(rBuilder, "favchar7", m_aFavCharView[6]), - std::make_unique(rBuilder, "favchar8", m_aFavCharView[7]), - std::make_unique(rBuilder, "favchar9", m_aFavCharView[8]), - std::make_unique(rBuilder, "favchar10", m_aFavCharView[9]), - std::make_unique(rBuilder, "favchar11", m_aFavCharView[10]), - std::make_unique(rBuilder, "favchar12", m_aFavCharView[11]), - std::make_unique(rBuilder, "favchar13", m_aFavCharView[12]), - std::make_unique(rBuilder, "favchar14", m_aFavCharView[13]), - std::make_unique(rBuilder, "favchar15", m_aFavCharView[14]), - std::make_unique(rBuilder, "favchar16", m_aFavCharView[15])} - , m_xRecentGrid(rBuilder.weld_widget(u"viewgrid"_ustr)) - , m_xFavGrid(rBuilder.weld_widget(u"favgrid"_ustr)) +SfxCharmapContainer::SfxCharmapContainer(weld::Builder& rBuilder) + : m_xRecentIconView(rBuilder.weld_icon_view(u"recentchars_iconview"_ustr)) + , m_xFavIconView(rBuilder.weld_icon_view(u"favchars_iconview"_ustr)) { - if (bLockGridSizes) - { - //so things don't jump around if all the children are hidden - m_xRecentGrid->set_size_request(-1, m_aRecentCharView[0].get_preferred_size().Height()); - m_xFavGrid->set_size_request(-1, m_aFavCharView[0].get_preferred_size().Height()); - } } -void SfxCharmapContainer::init(bool bActivateOnSingleClick, - const Link& rActivateHdl, +void SfxCharmapContainer::init(const Link& rActivateHdl, const Link& rUpdateFavHdl, const Link& rUpdateRecentHdl, - const Link& rFocusInHdl) + const Link& rCharSelectedHdl) { + m_aCharActivateHdl = rActivateHdl; + m_aCharSelectedHdl = rCharSelectedHdl; m_aUpdateFavHdl = rUpdateFavHdl; m_aUpdateRecentHdl = rUpdateRecentHdl; @@ -124,18 +56,106 @@ void SfxCharmapContainer::init(bool bActivateOnSingleClick, getFavCharacterList(); updateFavCharControl(); - for(int i = 0; i < 16; i++) + m_xRecentIconView->connect_selection_changed(LINK(this, SfxCharmapContainer, IconViewSelectionChangedHdl)); + m_xRecentIconView->connect_item_activated(LINK(this, SfxCharmapContainer, ItemActivatedHdl)); + m_xRecentIconView->connect_focus_in(LINK(this, SfxCharmapContainer, ItemViewFocusInHdl)); + m_xRecentIconView->connect_focus_out(LINK(this, SfxCharmapContainer, ItemViewFocusOutHdl)); + m_xRecentIconView->connect_command(LINK(this, SfxCharmapContainer, RecentContextMenuHdl)); + + m_xFavIconView->connect_selection_changed(LINK(this, SfxCharmapContainer, IconViewSelectionChangedHdl)); + m_xFavIconView->connect_item_activated(LINK(this, SfxCharmapContainer, ItemActivatedHdl)); + m_xFavIconView->connect_focus_in(LINK(this, SfxCharmapContainer, ItemViewFocusInHdl)); + m_xFavIconView->connect_focus_out(LINK(this, SfxCharmapContainer, ItemViewFocusOutHdl)); + m_xFavIconView->connect_command(LINK(this, SfxCharmapContainer, FavContextMenuHdl)); +} + +VclPtr SfxCharmapContainer::CreateIcon(weld::IconView& rIconView, + const OUString& rFont, const OUString& rText) +{ + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + vcl::Font aFont = rStyleSettings.GetLabelFont(); + Size aFontSize = aFont.GetFontSize(); + aFont.SetFontSize(Size(aFontSize.Width() * 2, aFontSize.Height() * 2)); + + VclPtr pDev = rIconView.create_virtual_device(); + + Size aSize; { - m_aRecentCharView[i].SetActivateOnSingleClick(bActivateOnSingleClick); - m_aRecentCharView[i].setFocusInHdl(rFocusInHdl); - m_aRecentCharView[i].setActivateHdl(rActivateHdl); - m_aRecentCharView[i].setContextMenuHdl( - LINK(this, SfxCharmapContainer, RecentContextMenuHdl)); - m_aFavCharView[i].SetActivateOnSingleClick(bActivateOnSingleClick); - m_aFavCharView[i].setFocusInHdl(rFocusInHdl); - m_aFavCharView[i].setActivateHdl(rActivateHdl); - m_aFavCharView[i].setContextMenuHdl(LINK(this, SfxCharmapContainer, FavContextMenuHdl)); + auto popIt = pDev->ScopedPush(PUSH_ALLFONT); + weld::SetPointFont(*pDev, aFont); + aSize = Size(pDev->approximate_digit_width() * 2, pDev->GetTextHeight()); } + + tools::Long nWinHeight = aSize.Height(); + aFont.SetFamilyName(rFont); + aFont.SetWeight(WEIGHT_NORMAL); + aFont.SetAlignment(ALIGN_TOP); + aFont.SetFontSize(pDev->PixelToLogic(Size(0, nWinHeight / 2))); + aFont.SetTransparent(true); + + pDev->SetOutputSize(aSize); + pDev->SetFont(aFont); + + const Color aWindowTextColor(rStyleSettings.GetFieldTextColor()); + Color aFillColor(rStyleSettings.GetWindowColor()); + Color aTextColor(rStyleSettings.GetWindowTextColor()); + Color aShadowColor(rStyleSettings.GetShadowColor()); + + bool bGotBoundary = true; + tools::Rectangle aBoundRect; + + tools::Long nY = (nWinHeight - pDev->GetTextHeight()) / 2; + + for (tools::Long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 1) + { + if (!pDev->GetTextBoundRect(aBoundRect, rText) || aBoundRect.IsEmpty()) + { + bGotBoundary = false; + break; + } + + tools::Long nTextWidth = aBoundRect.GetWidth(); + if (aSize.Width() > nTextWidth) + break; + vcl::Font aFont2(aFont); + aFontSize.setHeight(nFontHeight); + aFont2.SetFontSize(aFontSize); + pDev->SetFont(aFont2); + nY = (nWinHeight - pDev->GetTextHeight()) / 2; + } + + Point aPoint(2, nY); + + if (!bGotBoundary) + aPoint.setX((aSize.Width() - pDev->GetTextWidth(rText)) / 2); + else + { + // adjust position + aBoundRect += aPoint; + + // vertical adjustment + int nYLDelta = aBoundRect.Top(); + int nYHDelta = aSize.Height() - aBoundRect.Bottom(); + if (nYLDelta <= 0) + aPoint.AdjustY(-(nYLDelta - 1)); + else if (nYHDelta <= 0) + aPoint.AdjustY(nYHDelta - 1); + + // centrally align glyph + aPoint.setX(-aBoundRect.Left() + (aSize.Width() - aBoundRect.GetWidth()) / 2); + } + + pDev->SetFillColor(aFillColor); + pDev->SetLineColor(aShadowColor); + pDev->DrawRect(tools::Rectangle(Point(0, 0), aSize)); + + pDev->SetTextColor(aWindowTextColor); + pDev->DrawText(aPoint, rText); + + pDev->SetFillColor(aFillColor); + pDev->SetTextColor(aTextColor); + + return pDev; } void SfxCharmapContainer::getFavCharacterList() @@ -155,7 +175,7 @@ void SfxCharmapContainer::getFavCharacterList() void SfxCharmapContainer::updateFavCharControl() { - updateCharControl(m_aFavCharView, m_aFavChars); + updateCharControl(*m_xFavIconView, m_aFavChars); m_aUpdateFavHdl.Call(nullptr); } @@ -177,12 +197,17 @@ void SfxCharmapContainer::getRecentCharacterList() void SfxCharmapContainer::GrabFocusToFirstFavorite() { - m_aFavCharView[0].GrabFocus(); + std::unique_ptr pIter = m_xFavIconView->make_iterator(); + if (m_xFavIconView->get_iter_first(*pIter)) + { + m_xFavIconView->select(*pIter); + m_xFavIconView->grab_focus(); + } } void SfxCharmapContainer::updateRecentCharControl() { - updateCharControl(m_aRecentCharView, m_aRecentChars); + updateCharControl(*m_xRecentIconView, m_aRecentChars); m_aUpdateRecentHdl.Call(nullptr); } @@ -276,84 +301,132 @@ bool SfxCharmapContainer::isFavChar(const OUString& rTitle, const OUString& rFon return std::ranges::find(m_aFavChars, CharAndFont(rTitle, rFont)) != m_aFavChars.end(); } -void SfxCharmapContainer::HandleContextMenu(std::span aCharViews, - const Link& rClearHdl, - const Link& rClearAllHdl, +bool SfxCharmapContainer::HandleContextMenu(weld::IconView& rIconView, + std::deque& rChars, + const Link& rClearHdl, + const Link& rClearAllHdl, const CommandEvent& rCmdEvent) { - assert(rCmdEvent.GetCommand() == CommandEventId::ContextMenu); + if (rCmdEvent.GetCommand() != CommandEventId::ContextMenu) + return false; - for (SvxCharView& rView : aCharViews) + Point aPos; + std::unique_ptr pItem; + if (rCmdEvent.IsMouseEvent()) { - // the context menu is opened for the currently focused view - if (!rView.HasFocus()) - continue; - - weld::DrawingArea* pDrawingArea = rView.GetDrawingArea(); - std::unique_ptr xBuilder( - Application::CreateBuilder(pDrawingArea, u"sfx/ui/charviewmenu.ui"_ustr)); - std::unique_ptr xItemMenu(xBuilder->weld_menu(u"charviewmenu"_ustr)); - const OUString sMenuId = xItemMenu->popup_at_rect( - pDrawingArea, tools::Rectangle(rCmdEvent.GetMousePosPixel(), Size(1, 1))); - if (sMenuId == u"clearchar") - rClearHdl.Call(rView); - else if (sMenuId == u"clearallchar") - rClearAllHdl.Call(rView); - - rView.Invalidate(); - return; + aPos = rCmdEvent.GetMousePosPixel(); + pItem = rIconView.get_item_at_pos(aPos); + if (!pItem) + return false; + rIconView.select(*pItem); } + else + { + pItem = rIconView.make_iterator(); + if (!rIconView.get_selected(pItem.get())) + return false; + aPos = rIconView.get_rect(*pItem).Center(); + } + + std::unique_ptr xBuilder( + Application::CreateBuilder(&rIconView, u"sfx/ui/charviewmenu.ui"_ustr)); + std::unique_ptr xItemMenu(xBuilder->weld_menu(u"charviewmenu"_ustr)); + const OUString sMenuId + = xItemMenu->popup_at_rect(&rIconView, tools::Rectangle(aPos, Size(1, 1))); + if (sMenuId == u"clearchar") + rClearHdl.Call(rChars.at(rIconView.get_iter_index_in_parent(*pItem))); + else if (sMenuId == u"clearallchar") + rClearAllHdl.Call(rIconView); + + return true; } -void SfxCharmapContainer::updateCharControl(std::span aCharViews, +void SfxCharmapContainer::updateCharControl(weld::IconView& rIconView, const std::deque& rChars) { - assert(rChars.size() <= aCharViews.size()); + rIconView.clear(); int i = 0; for (auto it = rChars.begin(); it != rChars.end(); ++it, i++) { - aCharViews[i].SetText(it->sChar); - + const int nIndex = rIconView.n_children(); + const OUString* pNullIconName = nullptr; + rIconView.insert(nIndex, nullptr, nullptr, pNullIconName, nullptr); + ScopedVclPtr pDev = CreateIcon(rIconView, it->sFont, it->sChar); + rIconView.set_image(nIndex, *pDev); OUString sAccName; if (GetDecimalValueAndCharName(it->sChar, o3tl::temporary(sal_UCS4()), sAccName)) - aCharViews[i].SetAccessibleName(sAccName); - else - aCharViews[i].SetAccessibleName(OUString()); - aCharViews[i].SetToolTip(GetCharInfoText(it->sChar)); - - aCharViews[i].UpdateFont(it->sFont); - aCharViews[i].Show(); - } - - for (; i < 16; i++) - { - aCharViews[i].SetText(OUString()); - aCharViews[i].SetAccessibleName(OUString()); - aCharViews[i].SetToolTip(OUString()); - aCharViews[i].Hide(); + rIconView.set_item_accessible_name(nIndex, sAccName); + rIconView.set_item_tooltip_text(nIndex, GetCharInfoText(it->sChar)); } } -IMPL_LINK(SfxCharmapContainer, RecentContextMenuHdl, const CommandEvent&, rCmdEvent, void) +IMPL_LINK(SfxCharmapContainer, IconViewSelectionChangedHdl, weld::IconView&, rIconView, void) { - HandleContextMenu(m_aRecentCharView, (LINK(this, SfxCharmapContainer, RecentClearClickHdl)), - LINK(this, SfxCharmapContainer, RecentClearAllClickHdl), rCmdEvent); + std::unique_ptr pIter = rIconView.make_iterator(); + if (!rIconView.get_selected(pIter.get())) + return; + + const int nIndex = rIconView.get_iter_index_in_parent(*pIter); + if (&rIconView == m_xRecentIconView.get()) + m_aCharSelectedHdl.Call(m_aRecentChars.at(nIndex)); + else if (&rIconView == m_xFavIconView.get()) + m_aCharSelectedHdl.Call(m_aFavChars.at(nIndex)); } -IMPL_LINK(SfxCharmapContainer, FavContextMenuHdl, const CommandEvent&, rCmdEvent, void) +IMPL_LINK(SfxCharmapContainer, ItemViewFocusInHdl, weld::Widget&, rWidget, void) { - HandleContextMenu(m_aFavCharView, LINK(this, SfxCharmapContainer, FavClearClickHdl), - LINK(this, SfxCharmapContainer, FavClearAllClickHdl), rCmdEvent); + weld::IconView& rIconView = dynamic_cast(rWidget); + std::unique_ptr pIter = rIconView.make_iterator(); + if (rIconView.get_cursor(pIter.get())) + rIconView.select(*pIter); + else if (rIconView.get_iter_first(*pIter)) + rIconView.select(*pIter); + else + return; + + IconViewSelectionChangedHdl(rIconView); } -IMPL_LINK(SfxCharmapContainer, RecentClearClickHdl, SvxCharView&, rView, void) +IMPL_STATIC_LINK(SfxCharmapContainer, ItemViewFocusOutHdl, weld::Widget&, rWidget, void) { - const OUString& sTitle = rView.GetText(); - OUString sFont = rView.GetFontFamilyName(); + weld::IconView& rIconView = dynamic_cast(rWidget); + rIconView.unselect_all(); +} +IMPL_LINK(SfxCharmapContainer, ItemActivatedHdl, weld::IconView&, rIconView, bool) +{ + std::unique_ptr pIter = rIconView.make_iterator(); + if (!rIconView.get_selected(pIter.get())) + return false; + + const int nIndex = rIconView.get_iter_index_in_parent(*pIter); + if (&rIconView == m_xRecentIconView.get()) + m_aCharActivateHdl.Call(m_aRecentChars.at(nIndex)); + else if (&rIconView == m_xFavIconView.get()) + m_aCharActivateHdl.Call(m_aFavChars.at(nIndex)); + + return true; +} + +IMPL_LINK(SfxCharmapContainer, RecentContextMenuHdl, const CommandEvent&, rCmdEvent, bool) +{ + return HandleContextMenu(*m_xRecentIconView, m_aRecentChars, + LINK(this, SfxCharmapContainer, RecentClearClickHdl), + LINK(this, SfxCharmapContainer, RecentClearAllClickHdl), rCmdEvent); +} + +IMPL_LINK(SfxCharmapContainer, FavContextMenuHdl, const CommandEvent&, rCmdEvent, bool) +{ + return HandleContextMenu(*m_xFavIconView, m_aFavChars, + LINK(this, SfxCharmapContainer, FavClearClickHdl), + LINK(this, SfxCharmapContainer, FavClearAllClickHdl), rCmdEvent); +} + +IMPL_LINK(SfxCharmapContainer, RecentClearClickHdl, const CharAndFont&, rCharAndFont, void) +{ // if recent char to be added is already in list, remove it - auto itChar = std::ranges::find(m_aRecentChars, CharAndFont(sTitle, sFont)); + auto itChar = std::ranges::find(m_aRecentChars, rCharAndFont); if (itChar != m_aRecentChars.end()) m_aRecentChars.erase(itChar); @@ -376,7 +449,7 @@ IMPL_LINK(SfxCharmapContainer, RecentClearClickHdl, SvxCharView&, rView, void) updateRecentCharControl(); } -IMPL_LINK_NOARG(SfxCharmapContainer, RecentClearAllClickHdl, SvxCharView&, void) +IMPL_LINK_NOARG(SfxCharmapContainer, RecentClearAllClickHdl, weld::IconView&, void) { m_aRecentChars.clear(); @@ -388,13 +461,13 @@ IMPL_LINK_NOARG(SfxCharmapContainer, RecentClearAllClickHdl, SvxCharView&, void) updateRecentCharControl(); } -IMPL_LINK(SfxCharmapContainer, FavClearClickHdl, SvxCharView&, rView, void) +IMPL_LINK(SfxCharmapContainer, FavClearClickHdl, const CharAndFont&, rChar, void) { - deleteFavCharacterFromList(rView.GetText(), rView.GetFontFamilyName()); + deleteFavCharacterFromList(rChar.sChar, rChar.sFont); updateFavCharControl(); } -IMPL_LINK_NOARG(SfxCharmapContainer, FavClearAllClickHdl, SvxCharView&, void) +IMPL_LINK_NOARG(SfxCharmapContainer, FavClearAllClickHdl, weld::IconView&, void) { m_aFavChars.clear(); diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx index d4997ee55d54..35bf8e14a272 100644 --- a/sfx2/source/control/charmapcontrol.cxx +++ b/sfx2/source/control/charmapcontrol.cxx @@ -31,14 +31,14 @@ SfxCharmapCtrl::SfxCharmapCtrl(CharmapPopup* pControl, weld::Widget* pParent) : WeldToolbarPopup(pControl->getFrameInterface(), pParent, u"sfx/ui/charmapcontrol.ui"_ustr, u"charmapctrl"_ustr) , m_xControl(pControl) , m_xVirDev(VclPtr::Create()) - , m_aCharmapContents(*m_xBuilder, m_xVirDev, false) + , m_aCharmapContents(*m_xBuilder) , m_xRecentLabel(m_xBuilder->weld_label(u"label2"_ustr)) , m_xDlgBtn(m_xBuilder->weld_button(u"specialchardlg"_ustr)) , m_xCharInfoLabel(m_xBuilder->weld_label(u"charinfolabel"_ustr)) { m_xCharInfoLabel->set_size_request(-1, m_xCharInfoLabel->get_text_height() * 2); - m_aCharmapContents.init(true, LINK(this, SfxCharmapCtrl, CharActivateHdl), + m_aCharmapContents.init(LINK(this, SfxCharmapCtrl, CharActivateHdl), Link(), LINK(this, SfxCharmapCtrl, UpdateRecentHdl), LINK(this, SfxCharmapCtrl, CharFocusInHdl)); diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx deleted file mode 100644 index d4693f9e7e58..000000000000 --- a/sfx2/source/control/charwin.cxx +++ /dev/null @@ -1,253 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace com::sun::star; - -SvxCharView::SvxCharView(const VclPtr& rVirDev) - : mxVirDev(rVirDev) - , m_bActivateOnSingleClick(false) -{ -} - -SvxCharView::~SvxCharView() {} - -void SvxCharView::SetDrawingArea(weld::DrawingArea* pDrawingArea) -{ - CustomWidgetController::SetDrawingArea(pDrawingArea); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - vcl::Font aFont = rStyleSettings.GetLabelFont(); - const Size aFontSize = aFont.GetFontSize(); - aFont.SetFontSize(Size(aFontSize.Width() * 2, aFontSize.Height() * 2)); - auto popIt = mxVirDev->ScopedPush(PUSH_ALLFONT); - weld::SetPointFont(*mxVirDev, aFont); - pDrawingArea->set_size_request(mxVirDev->approximate_digit_width() * 2, - mxVirDev->GetTextHeight()); -} - -void SvxCharView::GetFocus() -{ - Invalidate(); - if (maFocusInHdl.IsSet()) - maFocusInHdl.Call(CharAndFont(GetText(), GetFontFamilyName())); -} - -void SvxCharView::LoseFocus() { Invalidate(); } - -OUString SvxCharView::RequestHelp(tools::Rectangle& rHelpRect) -{ - // Gtk3 requires a rectangle be specified for the tooltip to display, X11 does not. - rHelpRect = tools::Rectangle(Point(), GetOutputSizePixel()); - return m_sToolTip; -} - -bool SvxCharView::MouseButtonDown(const MouseEvent& rMEvt) -{ - if (rMEvt.IsLeft()) - { - GrabFocus(); - Invalidate(); - if (rMEvt.GetClicks() == 2 || m_bActivateOnSingleClick) - maActivateHdl.Call(GetCharAndFont()); - return true; - } - - return CustomWidgetController::MouseButtonDown(rMEvt); -} - -bool SvxCharView::KeyInput(const KeyEvent& rKEvt) -{ - bool bRet = false; - vcl::KeyCode aCode = rKEvt.GetKeyCode(); - switch (aCode.GetCode()) - { - case KEY_SPACE: - case KEY_RETURN: - maActivateHdl.Call(GetCharAndFont()); - bRet = true; - break; - } - return bRet; -} - -bool SvxCharView::Command(const CommandEvent& rCommandEvent) -{ - if (rCommandEvent.GetCommand() == CommandEventId::ContextMenu) - { - GrabFocus(); - Invalidate(); - maContextMenuHdl.Call(rCommandEvent); - return true; - } - - return weld::CustomWidgetController::Command(rCommandEvent); -} - -void SvxCharView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) -{ - rRenderContext.SetFont(maFont); - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - const Color aWindowTextColor(rStyleSettings.GetFieldTextColor()); - Color aHighlightColor(rStyleSettings.GetHighlightColor()); - Color aHighlightTextColor(rStyleSettings.GetHighlightTextColor()); - Color aFillColor(rStyleSettings.GetWindowColor()); - Color aTextColor(rStyleSettings.GetWindowTextColor()); - Color aShadowColor(rStyleSettings.GetShadowColor()); - - const OUString aText = GetText(); - - Size aSize(GetOutputSizePixel()); - tools::Long nAvailWidth = aSize.Width(); - tools::Long nWinHeight = aSize.Height(); - - bool bGotBoundary = true; - bool bShrankFont = false; - vcl::Font aOrigFont(rRenderContext.GetFont()); - Size aFontSize(aOrigFont.GetFontSize()); - ::tools::Rectangle aBoundRect; - - mxVirDev->Push(PUSH_ALLFONT); - mxVirDev->SetFont(maFont); - tools::Long nY = (nWinHeight - mxVirDev->GetTextHeight()) / 2; - mxVirDev->Pop(); - - for (tools::Long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 1) - { - if (!rRenderContext.GetTextBoundRect(aBoundRect, aText) || aBoundRect.IsEmpty()) - { - bGotBoundary = false; - break; - } - - //only shrink in the single glyph large view mode - tools::Long nTextWidth = aBoundRect.GetWidth(); - if (nAvailWidth > nTextWidth) - break; - vcl::Font aFont(aOrigFont); - aFontSize.setHeight(nFontHeight); - aFont.SetFontSize(aFontSize); - rRenderContext.SetFont(aFont); - nY = (nWinHeight - rRenderContext.GetTextHeight()) / 2; - bShrankFont = true; - } - - Point aPoint(2, nY); - - if (!bGotBoundary) - aPoint.setX((aSize.Width() - rRenderContext.GetTextWidth(aText)) / 2); - else - { - // adjust position - aBoundRect += aPoint; - - // vertical adjustment - int nYLDelta = aBoundRect.Top(); - int nYHDelta = aSize.Height() - aBoundRect.Bottom(); - if (nYLDelta <= 0) - aPoint.AdjustY(-(nYLDelta - 1)); - else if (nYHDelta <= 0) - aPoint.AdjustY(nYHDelta - 1); - - // centrally align glyph - aPoint.setX(-aBoundRect.Left() + (aSize.Width() - aBoundRect.GetWidth()) / 2); - } - - // tdf#111924 - don't lose focus on context menu - if (HasFocus() || HasChildFocus()) - { - rRenderContext.SetFillColor(aHighlightColor); - rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), aSize)); - - rRenderContext.SetTextColor(aHighlightTextColor); - rRenderContext.DrawText(aPoint, aText); - } - else - { - rRenderContext.SetFillColor(aFillColor); - rRenderContext.SetLineColor(aShadowColor); - rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), aSize)); - - rRenderContext.SetTextColor(aWindowTextColor); - rRenderContext.DrawText(aPoint, aText); - } - rRenderContext.SetFillColor(aFillColor); - rRenderContext.SetTextColor(aTextColor); - - if (bShrankFont) - rRenderContext.SetFont(aOrigFont); -} - -void SvxCharView::setFocusInHdl(const Link& rLink) -{ - maFocusInHdl = rLink; -} - -void SvxCharView::setActivateHdl(const Link& rLink) -{ - maActivateHdl = rLink; -} - -void SvxCharView::setContextMenuHdl(const Link& rLink) -{ - maContextMenuHdl = rLink; -} - -void SvxCharView::UpdateFont(const OUString& rFontFamilyName) -{ - tools::Long nWinHeight = GetOutputSizePixel().Height(); - maFont.SetFamilyName(rFontFamilyName); - maFont.SetWeight(WEIGHT_NORMAL); - maFont.SetAlignment(ALIGN_TOP); - maFont.SetFontSize(mxVirDev->PixelToLogic(Size(0, nWinHeight / 2))); - maFont.SetTransparent(true); - - Invalidate(); -} - -void SvxCharView::Resize() -{ - // force recalculation of size - UpdateFont(maFont.GetFamilyName()); -} - -void SvxCharView::SetText(const OUString& rText) -{ - m_sText = rText; - Invalidate(); -} - -CharAndFont SvxCharView::GetCharAndFont() const -{ - return CharAndFont(GetText(), GetFontFamilyName()); -} - -void SvxCharView::SetActivateOnSingleClick(bool bActivate) { m_bActivateOnSingleClick = bActivate; } - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sfx2/uiconfig/ui/charmapcontrol.ui b/sfx2/uiconfig/ui/charmapcontrol.ui index ad4b79441721..e5022de6f070 100644 --- a/sfx2/uiconfig/ui/charmapcontrol.ui +++ b/sfx2/uiconfig/ui/charmapcontrol.ui @@ -2,6 +2,26 @@ + + + + + + + + + + + + + + + + + + + + False True @@ -26,227 +46,18 @@ - - + True - False - start - 3 - 3 - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 0 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 1 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 3 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 2 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 4 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 5 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 0 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 1 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 2 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 3 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 4 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 5 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 0 - 2 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 1 - 2 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 2 - 2 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 3 - 2 - - - - - - - - + True + 6 + favchars_treestore + 0 + 6 + 0 + 0 + 2 + 2 + True False @@ -267,227 +78,18 @@ - - + True - False - start - 3 - 3 - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 0 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 1 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 3 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 2 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 4 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 5 - 0 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 3 - 2 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 2 - 2 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 1 - 2 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 0 - 2 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 5 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 4 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 3 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 2 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 1 - 1 - - - - - 35 - 35 - True - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - - - 0 - 1 - - - - - - - - + True + 6 + recentchars_treestore + 0 + 6 + 0 + 0 + 2 + 2 + True False @@ -506,7 +108,7 @@ False True - 4 + 6 @@ -519,7 +121,7 @@ False True - 5 + 7 diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 60254fc0f7a2..63ee192570a5 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -5328,7 +5328,6 @@ include/sfx2/app.hxx include/sfx2/basedlgs.hxx include/sfx2/bindings.hxx include/sfx2/chalign.hxx -include/sfx2/charwin.hxx include/sfx2/childwin.hxx include/sfx2/ctrlitem.hxx include/sfx2/dinfdlg.hxx diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index 5e3e204ac174..e5d902c68c90 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -148,38 +148,6 @@ cui/uiconfig/ui/securityoptionsdialog.ui://GtkLabel[@id='label3'] orphan-label cui/uiconfig/ui/signsignatureline.ui://GtkTextView[@id='edit_comment'] duplicate-mnemonic cui/uiconfig/ui/signsignatureline.ui://GtkLabel[@id='label_or'] orphan-label cui/uiconfig/ui/specialcharacters.ui://GtkLabel[@id='hexulabel'] orphan-label -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar2'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar3'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar4'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar5'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar6'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar7'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar8'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar9'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar10'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar11'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar12'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar13'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar14'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar15'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar16'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar2'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar4'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar3'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar5'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar6'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar7'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar8'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar16'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar15'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar14'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar13'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar12'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar11'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar10'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='favchar9'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='showcharset'] no-labelled-by -cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='searchcharset'] no-labelled-by cui/uiconfig/ui/spellingdialog.ui://GtkLabel[@id='explain'] orphan-label cui/uiconfig/ui/spellingdialog.ui://GtkLabel[@id='resumeft'] orphan-label cui/uiconfig/ui/spellingdialog.ui://GtkLabel[@id='nosuggestionsft'] orphan-label diff --git a/svx/source/dialog/cuicharmap.cxx b/svx/source/dialog/cuicharmap.cxx index 7120eea29112..0b661d32a6b7 100644 --- a/svx/source/dialog/cuicharmap.cxx +++ b/svx/source/dialog/cuicharmap.cxx @@ -57,7 +57,7 @@ SvxCharacterMap::SvxCharacterMap(weld::Widget* pParent, const SfxItemSet* pSet, , m_xVirDev(VclPtr::Create()) , m_isSearchMode(true) , m_xFrame(std::move(xFrame)) - , m_aCharmapContents(*m_xBuilder, m_xVirDev, true) + , m_aCharmapContents(*m_xBuilder) , m_aShowChar(m_xVirDev) , m_xOKBtn(m_xFrame.is() ? m_xBuilder->weld_button(u"insert"_ustr) : m_xBuilder->weld_button(u"ok"_ustr)) , m_xFontText(m_xBuilder->weld_label(u"fontft"_ustr)) @@ -261,8 +261,7 @@ void SvxCharacterMap::init() m_xOKBtn->set_sensitive(true); } - m_aCharmapContents.init(false, - LINK(this, SvxCharacterMap, CharActivateHdl), + m_aCharmapContents.init(LINK(this, SvxCharacterMap, CharActivateHdl), LINK(this, SvxCharacterMap, UpdateFavHdl), Link(), LINK(this, SvxCharacterMap, CharFocusHdl));