include/svx/charmap.hxx             |    2 -
 svx/source/dialog/charmap.cxx       |   41 ++++++++++++------------------------
 svx/source/dialog/searchcharmap.cxx |    7 ------
 3 files changed, 15 insertions(+), 35 deletions(-)

New commits:
commit 965349a3fb59a0d521027b2d84de86e1ed34b108
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Dec 11 11:51:59 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Dec 12 13:27:00 2025 +0100

    svx: Merge SvxShowCharSet::init into ctor
    
    This also moves SvxShowCharSet::mnSelectedIndex
    into the init list, addressing the
    
        // TODO: move into init list when it is no longer static
    
    as it is no longer static by now.
    
    Change-Id: I0431111bf86d17eb11e52c860cff8a1e49856d6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195495
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index b732eca38a89..fe78135ebaf3 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -153,7 +153,6 @@ protected:
     Point           MapIndexToPixel( int) const;
     DECL_LINK(VscrollHdl, weld::ScrolledWindow&, void);
 
-    void            init();
     tools::Rectangle       getGridRectangle(const Point &rPointUL, const Size 
&rOutputSize) const;
 };
 
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 8e6a566c9844..402b66465d29 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -69,12 +69,18 @@ 
SvxShowCharSet::SvxShowCharSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWi
     , mxScrollArea(std::move(pScrolledWindow))
     , mnX(0)
     , mnY(0)
+    , m_nXGap(0)
+    , m_nYGap(0)
+    , mbDrag(false)
+    , mnSelectedIndex(-1)
     , maFontSize(0, 0)
     , mbRecalculateFont(true)
     , mbUpdateForeground(true)
     , mbUpdateBackground(true)
 {
-    init();
+    mxScrollArea->connect_vadjustment_value_changed(LINK(this, SvxShowCharSet, 
VscrollHdl));
+    getFavCharacterList();
+    // other settings depend on selected font => see RecalculateFont
 }
 
 void SvxShowCharSet::SetDrawingArea(weld::DrawingArea* pDrawingArea)
@@ -92,19 +98,6 @@ void SvxShowCharSet::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
                                    ROW_COUNT * mnY);
 }
 
-void SvxShowCharSet::init()
-{
-    mnSelectedIndex = -1;    // TODO: move into init list when it is no longer 
static
-    m_nXGap = 0;
-    m_nYGap = 0;
-
-    mxScrollArea->connect_vadjustment_value_changed(LINK(this, SvxShowCharSet, 
VscrollHdl));
-    getFavCharacterList();
-    // other settings depend on selected font => see RecalculateFont
-
-    mbDrag = false;
-}
-
 void SvxShowCharSet::Resize()
 {
     mbRecalculateFont = true;
commit 3e098f5176edf9b612ef404abb38b2bb175c8206
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Dec 11 11:18:11 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Dec 12 13:26:53 2025 +0100

    svx: Merge SvxShowCharSet::ContextMenuSelect into only caller
    
    This also allows to drop 2 duplicate lines of code
    as SvxShowCharSet::createContextMenu already gets
    the selected character and its string representation.
    
    Change-Id: Ia8dff9ccb5b54b28ed379ab66a73f808bc087e22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195494
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index b8529fca4474..b732eca38a89 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -152,7 +152,6 @@ protected:
     // abstraction layers are: Unicode<->MapIndex<->Pixel
     Point           MapIndexToPixel( int) const;
     DECL_LINK(VscrollHdl, weld::ScrolledWindow&, void);
-    void ContextMenuSelect(std::u16string_view rIdent);
 
     void            init();
     tools::Rectangle       getGridRectangle(const Point &rPointUL, const Size 
&rOutputSize) const;
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index ce2435ca3219..8e6a566c9844 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -252,25 +252,19 @@ void SvxShowCharSet::createContextMenu(const Point& 
rPosition)
     else
         xItemMenu->set_visible(u"remove"_ustr, false);
 
-    ContextMenuSelect(xItemMenu->popup_at_rect(GetDrawingArea(), 
tools::Rectangle(rPosition, Size(1,1))));
-    GrabFocus();
-    Invalidate();
-}
-
-void SvxShowCharSet::ContextMenuSelect(std::u16string_view rIdent)
-{
-    sal_UCS4 cChar = GetSelectCharacter();
-    OUString aOUStr(&cChar, 1);
-
-    if (rIdent == u"insert")
+    const OUString sIdent = xItemMenu->popup_at_rect(GetDrawingArea(), 
tools::Rectangle(rPosition, Size(1,1)));
+    if (sIdent == u"insert")
         maDoubleClkHdl.Call(*this);
-    else if (rIdent == u"add" || rIdent == u"remove")
+    else if (sIdent == u"add" || sIdent == u"remove")
     {
         updateFavCharacterList(aOUStr, mxVirDev->GetFont().GetFamilyName());
         maFavClickHdl.Call(*this);
     }
-    else if (rIdent == u"copy")
+    else if (sIdent == u"copy")
         CopyToClipboard(aOUStr);
+
+    GrabFocus();
+    Invalidate();
 }
 
 void SvxShowCharSet::CopyToClipboard(const OUString& rOUStr)
commit ed6635a7ec91434f44456113fcc24513f4d6c000
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Dec 11 11:06:16 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Dec 12 13:26:46 2025 +0100

    svx: Simplify SvxSearchCharSet::KeyInput further
    
    The base class implementation already returns
    false in case of modifiers, so there's no need
    to explicitly check that here as well.
    
    Change-Id: Ie2ae481d54e4d082fe5a0ddf3929018252e5ff12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195493
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/svx/source/dialog/searchcharmap.cxx 
b/svx/source/dialog/searchcharmap.cxx
index 3de2ad4e3fe2..9b236b741dc2 100644
--- a/svx/source/dialog/searchcharmap.cxx
+++ b/svx/source/dialog/searchcharmap.cxx
@@ -48,12 +48,7 @@ int SvxSearchCharSet::LastInView() const
 
 bool SvxSearchCharSet::KeyInput(const KeyEvent& rKEvt)
 {
-    vcl::KeyCode aCode = rKEvt.GetKeyCode();
-
-    if (aCode.GetModifier())
-        return false;
-
-    switch (aCode.GetCode())
+    switch (rKEvt.GetKeyCode().GetCode())
     {
         case KEY_RETURN:
         case KEY_SPACE:

Reply via email to