[Libreoffice-commits] core.git: cui/source cui/uiconfig extras/source include/vcl solenv/bin solenv/sanitizers vcl/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Dec 1 21:37:45 UTC 2018


 cui/source/inc/autocdlg.hxx                    |   54 ++----
 cui/source/tabpages/autocdlg.cxx               |  223 ++++++++++---------------
 cui/uiconfig/ui/acorexceptpage.ui              |    1 
 cui/uiconfig/ui/wordcompletionpage.ui          |   56 +++++-
 extras/source/glade/libreoffice-catalog.xml.in |    3 
 include/vcl/weld.hxx                           |   22 +-
 solenv/bin/native-code.py                      |    1 
 solenv/sanitizers/ui/cui.suppr                 |    3 
 vcl/source/app/salvtables.cxx                  |   89 +++++++--
 vcl/source/control/button.cxx                  |    3 
 vcl/unx/gtk3/gtk3gtkinst.cxx                   |   93 +++++-----
 11 files changed, 289 insertions(+), 259 deletions(-)

New commits:
commit 9c5d20105f0b123fca724cb4845f0e7227c217d8
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Nov 29 20:11:34 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Dec 1 22:37:22 2018 +0100

    weld OfaAutoCompleteTabPage
    
    Change-Id: I84f051fd1dc127663fd510c81addb0fd0cdc2c26
    Reviewed-on: https://gerrit.libreoffice.org/64278
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index b396ad89e762..81044a633eab 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -382,55 +382,39 @@ public:
 class OfaAutoCompleteTabPage : public SfxTabPage
 {
     friend class VclPtr<OfaAutoCompleteTabPage>;
-public:
-    class AutoCompleteMultiListBox : public MultiListBox
-    {
-        VclPtr<OfaAutoCompleteTabPage> m_pPage;
-    public:
-        AutoCompleteMultiListBox(vcl::Window *pParent, WinBits nBits)
-            : MultiListBox(pParent, nBits)
-            , m_pPage(nullptr)
-        {
-        }
-        virtual ~AutoCompleteMultiListBox() override;
-        virtual void dispose() override;
-        void SetPage(OfaAutoCompleteTabPage *pPage) { m_pPage = pPage; }
-        virtual bool PreNotify( NotifyEvent& rNEvt ) override;
-    };
-
 private:
     using TabPage::ActivatePage;
-    VclPtr<CheckBox>       m_pCBActiv; ///<Enable word completion
-    VclPtr<CheckBox>       m_pCBAppendSpace;///<Append space
-    VclPtr<CheckBox>       m_pCBAsTip; ///<Show as tip
-
-    VclPtr<CheckBox>       m_pCBCollect;///<Collect words
-    VclPtr<CheckBox>       m_pCBRemoveList;///<...save the list for later use...
-
-    VclPtr<ListBox>        m_pDCBExpandKey;
-    VclPtr<NumericField>   m_pNFMinWordlen;
-    VclPtr<NumericField>   m_pNFMaxEntries;
-    VclPtr<AutoCompleteMultiListBox> m_pLBEntries;
-    VclPtr<PushButton>     m_pPBEntries;
     editeng::SortedAutoCompleteStrings* m_pAutoCompleteList;
     sal_uInt16      m_nAutoCmpltListCnt;
 
-    DECL_LINK( CheckHdl, CheckBox&, void );
+    std::unique_ptr<weld::CheckButton> m_xCBActiv; ///<Enable word completion
+    std::unique_ptr<weld::CheckButton> m_xCBAppendSpace;///<Append space
+    std::unique_ptr<weld::CheckButton> m_xCBAsTip; ///<Show as tip
+
+    std::unique_ptr<weld::CheckButton> m_xCBCollect;///<Collect words
+    std::unique_ptr<weld::CheckButton> m_xCBRemoveList;///<...save the list for later use...
 
-                        OfaAutoCompleteTabPage( vcl::Window* pParent,
-                                                const SfxItemSet& rSet );
+    std::unique_ptr<weld::ComboBox> m_xDCBExpandKey;
+    std::unique_ptr<weld::SpinButton> m_xNFMinWordlen;
+    std::unique_ptr<weld::SpinButton> m_xNFMaxEntries;
+    std::unique_ptr<weld::TreeView> m_xLBEntries;
+    std::unique_ptr<weld::Button> m_xPBEntries;
+
+    DECL_LINK(CheckHdl, weld::ToggleButton&, void);
+    DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
+
+    OfaAutoCompleteTabPage(TabPageParent pParent, const SfxItemSet& rSet);
 public:
     virtual ~OfaAutoCompleteTabPage() override;
-    virtual void dispose() override;
-    static VclPtr<SfxTabPage>  Create( TabPageParent pParent,
-                                const SfxItemSet* rAttrSet);
+    static VclPtr<SfxTabPage> Create(TabPageParent pParent,
+                                     const SfxItemSet* rAttrSet);
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
     virtual void        ActivatePage( const SfxItemSet& ) override;
 
     void CopyToClipboard() const;
-    DECL_LINK(DeleteHdl, Button*, void);
+    DECL_LINK(DeleteHdl, weld::Button&, void);
 };
 
 // class OfaSmartTagOptionsTabPage ---------------------------------------------
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 59aa8353b10d..e39a9cba42d1 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -2109,38 +2109,36 @@ OUString OfaQuoteTabPage::ChangeStringExt_Impl( sal_UCS4 cChar )
     return aOUStr;
 }
 
-OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(vcl::Window* pParent,
+OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(TabPageParent pParent,
     const SfxItemSet& rSet)
-    : SfxTabPage(pParent, "WordCompletionPage",
-        "cui/ui/wordcompletionpage.ui", &rSet)
+    : SfxTabPage(pParent, "cui/ui/wordcompletionpage.ui",
+                 "WordCompletionPage", &rSet)
     , m_pAutoCompleteList(nullptr)
     , m_nAutoCmpltListCnt(0)
+    , m_xCBActiv(m_xBuilder->weld_check_button("enablewordcomplete"))
+    , m_xCBAppendSpace(m_xBuilder->weld_check_button("appendspace"))
+    , m_xCBAsTip(m_xBuilder->weld_check_button("showastip"))
+    , m_xCBCollect(m_xBuilder->weld_check_button("collectwords"))
+    , m_xCBRemoveList(m_xBuilder->weld_check_button("whenclosing"))
+    , m_xDCBExpandKey(m_xBuilder->weld_combo_box("acceptwith"))
+    , m_xNFMinWordlen(m_xBuilder->weld_spin_button("minwordlen"))
+    , m_xNFMaxEntries(m_xBuilder->weld_spin_button("maxentries"))
+    , m_xLBEntries(m_xBuilder->weld_tree_view("entries"))
+    , m_xPBEntries(m_xBuilder->weld_button("delete"))
 {
-    get(m_pCBActiv, "enablewordcomplete");
-    get(m_pCBAppendSpace, "appendspace");
-    get(m_pCBAsTip, "showastip");
-    get(m_pCBCollect, "collectwords");
-    get(m_pCBRemoveList, "whenclosing");
-
     //fdo#65595, we need height-for-width support here, but for now we can
     //bodge it
-    Size aPrefSize(m_pCBRemoveList->get_preferred_size());
-    Size aSize(m_pCBRemoveList->CalcMinimumSize(32*approximate_char_width()));
-    if (aPrefSize.Width() > aSize.Width())
+    Size aPrefSize(m_xCBRemoveList->get_preferred_size());
+    int nMaxWidth = m_xCBRemoveList->get_approximate_digit_width() * 40;
+    if (aPrefSize.Width() > nMaxWidth)
     {
-        m_pCBRemoveList->set_width_request(aSize.Width());
-        m_pCBRemoveList->set_height_request(aSize.Height());
+        m_xCBRemoveList->set_label_line_wrap(true);
+        m_xCBRemoveList->set_size_request(nMaxWidth, -1);
+        aPrefSize = m_xCBRemoveList->get_preferred_size();
     }
 
-    get(m_pDCBExpandKey, "acceptwith");
-    get(m_pNFMinWordlen, "minwordlen");
-    get(m_pNFMaxEntries, "maxentries");
-    get(m_pLBEntries, "entries");
-    m_pLBEntries->SetPage(this);
-    aSize = LogicToPixel(Size(121, 158), MapMode(MapUnit::MapAppFont));
-    m_pLBEntries->set_width_request(aSize.Width());
-    m_pLBEntries->set_height_request(aSize.Height());
-    get(m_pPBEntries, "delete");
+    m_xLBEntries->set_size_request(m_xLBEntries->get_approximate_digit_width() * 30,
+                                   m_xLBEntries->get_height_rows(20));
 
     // the defined KEYs
     static const sal_uInt16 aKeyCodes[] = {
@@ -2154,16 +2152,16 @@ OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(vcl::Window* pParent,
 
     for( const sal_uInt16* pKeys = aKeyCodes; *pKeys; ++pKeys )
     {
-        vcl::KeyCode aKCode( *pKeys );
-        sal_Int32 nPos = m_pDCBExpandKey->InsertEntry( aKCode.GetName() );
-        m_pDCBExpandKey->SetEntryData( nPos, reinterpret_cast<void*>(*pKeys) );
-        if( KEY_RETURN == *pKeys )      // default to RETURN
-            m_pDCBExpandKey->SelectEntryPos( nPos );
+        vcl::KeyCode aKCode(*pKeys);
+        m_xDCBExpandKey->append(OUString::number(static_cast<sal_Int32>(*pKeys)), aKCode.GetName());
+        if (KEY_RETURN == *pKeys)      // default to RETURN
+            m_xDCBExpandKey->set_active(std::distance(aKeyCodes, pKeys));
     }
 
-    m_pPBEntries->SetClickHdl(LINK(this, OfaAutoCompleteTabPage, DeleteHdl));
-    m_pCBActiv->SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
-    m_pCBCollect->SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
+    m_xPBEntries->connect_clicked(LINK(this, OfaAutoCompleteTabPage, DeleteHdl));
+    m_xCBActiv->connect_toggled(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
+    m_xCBCollect->connect_toggled(LINK(this, OfaAutoCompleteTabPage, CheckHdl));
+    m_xLBEntries->connect_key_release(LINK(this, OfaAutoCompleteTabPage, KeyReleaseHdl));
 }
 
 OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage()
@@ -2171,25 +2169,10 @@ OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage()
     disposeOnce();
 }
 
-void OfaAutoCompleteTabPage::dispose()
-{
-    m_pCBActiv.clear();
-    m_pCBAppendSpace.clear();
-    m_pCBAsTip.clear();
-    m_pCBCollect.clear();
-    m_pCBRemoveList.clear();
-    m_pDCBExpandKey.clear();
-    m_pNFMinWordlen.clear();
-    m_pNFMaxEntries.clear();
-    m_pLBEntries.clear();
-    m_pPBEntries.clear();
-    SfxTabPage::dispose();
-}
-
-VclPtr<SfxTabPage> OfaAutoCompleteTabPage::Create( TabPageParent pParent,
-                                                   const SfxItemSet* rSet)
+VclPtr<SfxTabPage> OfaAutoCompleteTabPage::Create(TabPageParent pParent,
+                                                  const SfxItemSet* rSet)
 {
-    return VclPtr<OfaAutoCompleteTabPage>::Create( pParent.pParent, *rSet );
+    return VclPtr<OfaAutoCompleteTabPage>::Create(pParent, *rSet);
 }
 
 bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* )
@@ -2199,39 +2182,39 @@ bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* )
     SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
     sal_uInt16 nVal;
 
-    bCheck = m_pCBActiv->IsChecked();
+    bCheck = m_xCBActiv->get_active();
     bModified |= pOpt->bAutoCompleteWords != bCheck;
     pOpt->bAutoCompleteWords = bCheck;
-    bCheck = m_pCBCollect->IsChecked();
+    bCheck = m_xCBCollect->get_active();
     bModified |= pOpt->bAutoCmpltCollectWords != bCheck;
     pOpt->bAutoCmpltCollectWords = bCheck;
-    bCheck = !m_pCBRemoveList->IsChecked(); // inverted value!
+    bCheck = !m_xCBRemoveList->get_active(); // inverted value!
     bModified |= pOpt->bAutoCmpltKeepList != bCheck;
     pOpt->bAutoCmpltKeepList = bCheck;
-    bCheck = m_pCBAppendSpace->IsChecked();
+    bCheck = m_xCBAppendSpace->get_active();
     bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck;
     pOpt->bAutoCmpltAppendBlanc = bCheck;
-    bCheck = m_pCBAsTip->IsChecked();
+    bCheck = m_xCBAsTip->get_active();
     bModified |= pOpt->bAutoCmpltShowAsTip != bCheck;
     pOpt->bAutoCmpltShowAsTip = bCheck;
 
-    nVal = static_cast<sal_uInt16>(m_pNFMinWordlen->GetValue());
+    nVal = static_cast<sal_uInt16>(m_xNFMinWordlen->get_value());
     bModified |= nVal != pOpt->nAutoCmpltWordLen;
     pOpt->nAutoCmpltWordLen = nVal;
 
-    nVal = static_cast<sal_uInt16>(m_pNFMaxEntries->GetValue());
+    nVal = static_cast<sal_uInt16>(m_xNFMaxEntries->get_value());
     bModified |= nVal != pOpt->nAutoCmpltListLen;
     pOpt->nAutoCmpltListLen = nVal;
 
-    const sal_Int32 nPos = m_pDCBExpandKey->GetSelectedEntryPos();
-    if( nPos < m_pDCBExpandKey->GetEntryCount() )
+    const int nPos = m_xDCBExpandKey->get_active();
+    if (nPos != -1)
     {
-        sal_uLong nKey = reinterpret_cast<sal_uLong>(m_pDCBExpandKey->GetEntryData( nPos ));
+        sal_Int32 nKey = m_xDCBExpandKey->get_id(nPos).toInt32();
         bModified |= nKey != pOpt->nAutoCmpltExpandKey;
         pOpt->nAutoCmpltExpandKey = static_cast<sal_uInt16>(nKey);
     }
 
-    if (m_pAutoCompleteList && m_nAutoCmpltListCnt != m_pLBEntries->GetEntryCount())
+    if (m_pAutoCompleteList && m_nAutoCmpltListCnt != m_xLBEntries->n_children())
     {
         bModified = true;
         pOpt->m_pAutoCompleteList = m_pAutoCompleteList;
@@ -2250,24 +2233,26 @@ void OfaAutoCompleteTabPage::Reset( const SfxItemSet*  )
     SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
     SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
 
-    m_pCBActiv->Check( pOpt->bAutoCompleteWords );
-    m_pCBCollect->Check( pOpt->bAutoCmpltCollectWords );
-    m_pCBRemoveList->Check( !pOpt->bAutoCmpltKeepList ); //inverted value!
-    m_pCBAppendSpace->Check( pOpt->bAutoCmpltAppendBlanc );
-    m_pCBAsTip->Check( pOpt->bAutoCmpltShowAsTip );
+    m_xCBActiv->set_active( pOpt->bAutoCompleteWords );
+    m_xCBCollect->set_active( pOpt->bAutoCmpltCollectWords );
+    m_xCBRemoveList->set_active( !pOpt->bAutoCmpltKeepList ); //inverted value!
+    m_xCBAppendSpace->set_active( pOpt->bAutoCmpltAppendBlanc );
+    m_xCBAsTip->set_active( pOpt->bAutoCmpltShowAsTip );
 
-    m_pNFMinWordlen->SetValue( pOpt->nAutoCmpltWordLen );
-    m_pNFMaxEntries->SetValue( pOpt->nAutoCmpltListLen );
+    m_xNFMinWordlen->set_value( pOpt->nAutoCmpltWordLen );
+    m_xNFMaxEntries->set_value( pOpt->nAutoCmpltListLen );
 
     // select the specific KeyCode:
     {
-        sal_uLong nKey = pOpt->nAutoCmpltExpandKey;
-        for( sal_Int32 n = 0, nCnt = m_pDCBExpandKey->GetEntryCount(); n < nCnt; ++n )
-            if( nKey == reinterpret_cast<sal_uLong>(m_pDCBExpandKey->GetEntryData( n )))
+        sal_Int32 nKey = pOpt->nAutoCmpltExpandKey;
+        for (int n = 0, nCnt = m_xDCBExpandKey->get_count(); n < nCnt; ++n)
+        {
+            if (nKey == m_xDCBExpandKey->get_id(n).toInt32())
             {
-                m_pDCBExpandKey->SelectEntryPos( n );
+                m_xDCBExpandKey->set_active(n);
                 break;
             }
+        }
     }
 
     if (pOpt->m_pAutoCompleteList && !pOpt->m_pAutoCompleteList->empty())
@@ -2280,18 +2265,18 @@ void OfaAutoCompleteTabPage::Reset( const SfxItemSet*  )
         {
             const OUString* pStr =
                 &(*m_pAutoCompleteList)[n]->GetAutoCompleteString();
-            sal_Int32 nPos = m_pLBEntries->InsertEntry( *pStr );
-            m_pLBEntries->SetEntryData( nPos, const_cast<OUString *>(pStr) );
+            OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pStr)));
+            m_xLBEntries->append(sId, *pStr);
         }
     }
     else
     {
-        m_pLBEntries->Disable();
-        m_pPBEntries->Disable();
+        m_xLBEntries->set_sensitive(false);
+        m_xPBEntries->set_sensitive(false);
     }
 
-    CheckHdl(*m_pCBActiv);
-    CheckHdl(*m_pCBCollect);
+    CheckHdl(*m_xCBActiv);
+    CheckHdl(*m_xCBCollect);
 }
 
 void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& )
@@ -2299,38 +2284,39 @@ void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& )
     static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage( false );
 }
 
-IMPL_LINK_NOARG(OfaAutoCompleteTabPage, DeleteHdl, Button*, void)
+IMPL_LINK_NOARG(OfaAutoCompleteTabPage, DeleteHdl, weld::Button&, void)
 {
-    sal_Int32 nSelCnt =
-        (m_pAutoCompleteList) ? m_pLBEntries->GetSelectedEntryCount() : 0;
-    while( nSelCnt )
+    auto rows = m_xLBEntries->get_selected_rows();
+    std::sort(rows.begin(), rows.end());
+    while (!rows.empty())
     {
-        sal_Int32 nPos = m_pLBEntries->GetSelectedEntryPos( --nSelCnt );
-        OUString* pStr = static_cast<OUString*>(m_pLBEntries->GetEntryData(nPos));
-        m_pLBEntries->RemoveEntry( nPos );
+        sal_Int32 nPos = rows.back();
+        OUString* pStr = reinterpret_cast<OUString*>(m_xLBEntries->get_id(nPos).toInt64());
+        m_xLBEntries->remove(nPos);
         editeng::IAutoCompleteString hack(*pStr); // UGLY
         m_pAutoCompleteList->erase(&hack);
+        rows.pop_back();
     }
 }
 
-IMPL_LINK( OfaAutoCompleteTabPage, CheckHdl, CheckBox&, rBox, void )
+IMPL_LINK(OfaAutoCompleteTabPage, CheckHdl, weld::ToggleButton&, rBox, void)
 {
-    bool bEnable = rBox.IsChecked();
-    if (&rBox == m_pCBActiv)
+    bool bEnable = rBox.get_active();
+    if (&rBox == m_xCBActiv.get())
     {
-        m_pCBAppendSpace->Enable( bEnable );
-        m_pCBAppendSpace->Enable( bEnable );
-        m_pCBAsTip->Enable( bEnable );
-        m_pDCBExpandKey->Enable( bEnable );
+        m_xCBAppendSpace->set_sensitive(bEnable);
+        m_xCBAppendSpace->set_sensitive(bEnable);
+        m_xCBAsTip->set_sensitive(bEnable);
+        m_xDCBExpandKey->set_sensitive(bEnable);
     }
-    else if (m_pCBCollect == &rBox)
-        m_pCBRemoveList->Enable( bEnable );
+    else if (&rBox == m_xCBCollect.get())
+        m_xCBRemoveList->set_sensitive(bEnable);
 }
 
 void OfaAutoCompleteTabPage::CopyToClipboard() const
 {
-    sal_Int32 nSelCnt = m_pLBEntries->GetSelectedEntryCount();
-    if (m_pAutoCompleteList && nSelCnt)
+    auto rows = m_xLBEntries->get_selected_rows();
+    if (m_pAutoCompleteList && !rows.empty())
     {
         rtl::Reference<TransferDataContainer> pCntnr = new TransferDataContainer;
 
@@ -2338,10 +2324,9 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const
 
         rtl_TextEncoding nEncode = osl_getThreadTextEncoding();
 
-        for( sal_Int32 n = 0; n < nSelCnt; ++n )
+        for (auto a : rows)
         {
-            sData.append(OUStringToOString(m_pLBEntries->GetSelectedEntry(n),
-                nEncode));
+            sData.append(OUStringToOString(m_xLBEntries->get_text(a), nEncode));
 #if defined(_WIN32)
             sData.append("\015\012");
 #else
@@ -2353,55 +2338,27 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const
     }
 }
 
-OfaAutoCompleteTabPage::AutoCompleteMultiListBox::~AutoCompleteMultiListBox()
-{
-    disposeOnce();
-}
-
-void OfaAutoCompleteTabPage::AutoCompleteMultiListBox::dispose()
+IMPL_LINK(OfaAutoCompleteTabPage, KeyReleaseHdl, const KeyEvent&, rEvent, bool)
 {
-    m_pPage.clear();
-    MultiListBox::dispose();
-}
-
-bool OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify(
-            NotifyEvent& rNEvt )
-{
-    bool bHandled = MultiListBox::PreNotify( rNEvt );
-
-    if( !bHandled && MouseNotifyEvent::KEYUP == rNEvt.GetType() )
+    bool bHandled = false;
+    const vcl::KeyCode& rKeyCode = rEvent.GetKeyCode();
+    switch (rKeyCode.GetModifier() | rKeyCode.GetCode())
     {
-        const vcl::KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
-        switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
-        {
         case KEY_DELETE:
-            m_pPage->DeleteHdl( nullptr );
+            DeleteHdl(*m_xPBEntries);
             bHandled = true;
             break;
-
         default:
-            if( KeyFuncType::COPY == rKeyCode.GetFunction() )
+            if (KeyFuncType::COPY == rKeyCode.GetFunction())
             {
-                m_pPage->CopyToClipboard();
+                CopyToClipboard();
                 bHandled = true;
             }
             break;
-        }
     }
     return bHandled;
 }
 
-extern "C" SAL_DLLPUBLIC_EXPORT void makeAutoCompleteMultiListBox(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap)
-{
-    WinBits nWinBits = WB_TABSTOP;
-
-    OUString sBorder = BuilderUtils::extractCustomProperty(rMap);
-    if (!sBorder.isEmpty())
-       nWinBits |= WB_BORDER;
-
-    rRet = VclPtr<OfaAutoCompleteTabPage::AutoCompleteMultiListBox>::Create(pParent, nWinBits);
-}
-
 // class OfaSmartTagOptionsTabPage ---------------------------------------------
 
 OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( vcl::Window* pParent,
diff --git a/cui/uiconfig/ui/acorexceptpage.ui b/cui/uiconfig/ui/acorexceptpage.ui
index bbe486163167..ee6564171d40 100644
--- a/cui/uiconfig/ui/acorexceptpage.ui
+++ b/cui/uiconfig/ui/acorexceptpage.ui
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkTreeStore" id="liststore1">
     <columns>
       <!-- column-name text -->
diff --git a/cui/uiconfig/ui/wordcompletionpage.ui b/cui/uiconfig/ui/wordcompletionpage.ui
index 77f42b9143ea..b54a667ac838 100644
--- a/cui/uiconfig/ui/wordcompletionpage.ui
+++ b/cui/uiconfig/ui/wordcompletionpage.ui
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="lower">50</property>
     <property name="upper">65535</property>
@@ -52,11 +51,39 @@
               </packing>
             </child>
             <child>
-              <object class="cuilo-AutoCompleteMultiListBox" id="entries:border">
+              <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="entries">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="headers_visible">False</property>
+                    <property name="search_column">0</property>
+                    <property name="show_expanders">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                        <property name="resizable">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderer2"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
@@ -83,10 +110,10 @@
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="wordcompletionpage|label1">_Max. entries:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">maxentries</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -98,7 +125,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="halign">start</property>
-                    <property name="text" translatable="no">500</property>
+                    <property name="text">500</property>
                     <property name="adjustment">adjustment1</property>
                     <property name="value">500</property>
                   </object>
@@ -122,10 +149,10 @@
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="wordcompletionpage|label2">Mi_n. word length:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">maxentries</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -137,7 +164,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="halign">start</property>
-                    <property name="text" translatable="no">100</property>
+                    <property name="text">100</property>
                     <property name="adjustment">adjustment2</property>
                     <property name="value">100</property>
                   </object>
@@ -189,7 +216,7 @@
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="use_underline">True</property>
-                            <property name="xalign">0.019999999552965164</property>
+                            <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
@@ -242,7 +269,7 @@
                         <property name="can_focus">False</property>
                         <property name="row_spacing">6</property>
                         <child>
-                          <object class="GtkCheckButton" id="whenclosing:wrap">
+                          <object class="GtkCheckButton" id="whenclosing">
                             <property name="label" translatable="yes" context="wordcompletionpage|whenclosing">_When closing a document, remove the words collected from it from the list</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -272,7 +299,6 @@
                     <property name="receives_default">False</property>
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
-                    <property name="yalign">0.5899999737739563</property>
                     <property name="draw_indicator">True</property>
                   </object>
                   <packing>
@@ -295,10 +321,10 @@
                   <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="wordcompletionpage|label3">Acc_ept with:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">acceptwith</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -341,4 +367,12 @@
       <widget name="minwordlen"/>
     </widgets>
   </object>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
 </interface>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index dd27e99e302f..89c1348c2c1a 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -169,9 +169,6 @@
     <glade-widget-class title="MultiLine Edit" name="svtlo-MultiLineEditSyntaxHighlight"
                         generic-name="MultiLineEdit" parent="GtkTextView"
                         icon-name="widget-gtk-textview"/>
-    <glade-widget-class title="AutoComplete MultiLine Edit" name="cuilo-AutoCompleteMultiListBox"
-                        generic-name="MultiLineEdit" parent="GtkTextView"
-                        icon-name="widget-gtk-textview"/>
     <glade-widget-class title="Address MultiLine Edit" name="swuilo-AddressMultiLineEdit"
                         generic-name="AddressMultiLineEdit" parent="GtkTextView"
                         icon-name="widget-gtk-textview"/>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index b682acd5f599..946966ca3214 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -42,9 +42,8 @@ protected:
     Link<Widget&, void> m_aFocusInHdl;
     Link<Widget&, void> m_aFocusOutHdl;
     Link<const Size&, void> m_aSizeAllocateHdl;
-
-    void signal_focus_in() { m_aFocusInHdl.Call(*this); }
-    void signal_focus_out() { m_aFocusOutHdl.Call(*this); }
+    Link<const KeyEvent&, bool> m_aKeyPressHdl;
+    Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
 
 public:
     virtual void set_sensitive(bool sensitive) = 0;
@@ -118,6 +117,18 @@ public:
         m_aSizeAllocateHdl = rLink;
     }
 
+    virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink)
+    {
+        assert(!m_aKeyPressHdl.IsSet() || !rLink.IsSet());
+        m_aKeyPressHdl = rLink;
+    }
+
+    virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink)
+    {
+        assert(!m_aKeyReleaseHdl.IsSet() || !rLink.IsSet());
+        m_aKeyReleaseHdl = rLink;
+    }
+
     virtual void grab_add() = 0;
     virtual bool has_grab() const = 0;
     virtual void grab_remove() = 0;
@@ -534,6 +545,7 @@ public:
     virtual void set_image(VirtualDevice* pDevice) = 0;
     virtual void set_from_icon_name(const OUString& rIconName) = 0;
     virtual OUString get_label() const = 0;
+    virtual void set_label_line_wrap(bool wrap) = 0;
     void clicked() { signal_clicked(); }
 
     void connect_clicked(const Link<Button&, void>& rLink) { m_aClickHdl = rLink; }
@@ -1171,8 +1183,6 @@ protected:
     Link<const MouseEvent&, void> m_aMousePressHdl;
     Link<const MouseEvent&, void> m_aMouseMotionHdl;
     Link<const MouseEvent&, void> m_aMouseReleaseHdl;
-    Link<const KeyEvent&, bool> m_aKeyPressHdl;
-    Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
     Link<Widget&, void> m_aStyleUpdatedHdl;
     Link<const Point&, bool> m_aPopupMenuHdl;
     Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl;
@@ -1197,8 +1207,6 @@ public:
     {
         m_aMouseReleaseHdl = rLink;
     }
-    void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; }
-    void connect_key_release(const Link<const KeyEvent&, bool>& rLink) { m_aKeyReleaseHdl = rLink; }
     void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; }
     void connect_popup_menu(const Link<const Point&, bool>& rLink) { m_aPopupMenuHdl = rLink; }
     void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink)
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 7aa3ad5bfa58..e21d19270afc 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -402,7 +402,6 @@ constructor_map = {
 
 custom_widgets = [
     'ArgEdit',
-    'AutoCompleteMultiListBox',
     'BookmarksBox',
     'CaptionComboBox',
     'CategoryListBox',
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index 5b0429602d10..eaa40081d65c 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -480,6 +480,7 @@ cui/uiconfig/ui/twolinespage.ui://GtkTreeView[@id='startbracket'] no-labelled-by
 cui/uiconfig/ui/twolinespage.ui://GtkTreeViewColumn[@id='treeviewcolumn1'] no-labelled-by
 cui/uiconfig/ui/twolinespage.ui://GtkTreeView[@id='endbracket'] no-labelled-by
 cui/uiconfig/ui/twolinespage.ui://GtkTreeViewColumn[@id='treeviewcolumn2'] no-labelled-by
-cui/uiconfig/ui/wordcompletionpage.ui://cuilo-AutoCompleteMultiListBox[@id='entries:border'] no-labelled-by
+cui/uiconfig/ui/wordcompletionpage.ui://GtkTreeView[@id='entries'] no-labelled-by
 cui/uiconfig/ui/wordcompletionpage.ui://GtkSpinButton[@id='maxentries'] duplicate-mnemonic
 cui/uiconfig/ui/wordcompletionpage.ui://GtkSpinButton[@id='minwordlen'] no-labelled-by
+cui/uiconfig/ui/wordcompletionpage.ui://GtkTreeViewColumn[@id='treeviewcolumn2'] no-labelled-by
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index b740bad17699..d9cdc5e0a63f 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -210,17 +210,26 @@ class SalInstanceWidget : public virtual weld::Widget
 private:
     VclPtr<vcl::Window> m_xWidget;
 
-    DECL_LINK(FocusInListener, VclWindowEvent&, void);
-    DECL_LINK(FocusOutListener, VclWindowEvent&, void);
-    DECL_LINK(ResizeListener, VclWindowEvent&, void);
+    DECL_LINK(EventListener, VclWindowEvent&, void);
 
     const bool m_bTakeOwnership;
+    bool m_bEventListener;
     int m_nBlockNotify;
 
+    void ensure_event_listener()
+    {
+        if (!m_bEventListener)
+        {
+            m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, EventListener));
+            m_bEventListener = true;
+        }
+    }
+
 public:
     SalInstanceWidget(vcl::Window* pWidget, bool bTakeOwnership)
         : m_xWidget(pWidget)
         , m_bTakeOwnership(bTakeOwnership)
+        , m_bEventListener(false)
         , m_nBlockNotify(0)
     {
     }
@@ -415,22 +424,34 @@ public:
 
     virtual void connect_focus_in(const Link<Widget&, void>& rLink) override
     {
-        m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, FocusInListener));
+        ensure_event_listener();
         weld::Widget::connect_focus_in(rLink);
     }
 
     virtual void connect_focus_out(const Link<Widget&, void>& rLink) override
     {
-        m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, FocusOutListener));
+        ensure_event_listener();
         weld::Widget::connect_focus_out(rLink);
     }
 
     virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override
     {
-        m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, ResizeListener));
+        ensure_event_listener();
         weld::Widget::connect_size_allocate(rLink);
     }
 
+    virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override
+    {
+        ensure_event_listener();
+        weld::Widget::connect_key_press(rLink);
+    }
+
+    virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override
+    {
+        ensure_event_listener();
+        weld::Widget::connect_key_release(rLink);
+    }
+
     virtual bool get_extents_relative_to(Widget& rRelative, int& x, int &y, int& width, int &height) override
     {
         tools::Rectangle aRect(m_xWidget->GetWindowExtentsRelative(dynamic_cast<SalInstanceWidget&>(rRelative).getWidget()));
@@ -480,12 +501,8 @@ public:
 
     virtual ~SalInstanceWidget() override
     {
-        if (m_aSizeAllocateHdl.IsSet())
-            m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, ResizeListener));
-        if (m_aFocusInHdl.IsSet())
-            m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, FocusInListener));
-        if (m_aFocusOutHdl.IsSet())
-            m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, FocusOutListener));
+        if (m_bEventListener)
+            m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, EventListener));
         if (m_bTakeOwnership)
             m_xWidget.disposeAndClear();
     }
@@ -516,23 +533,23 @@ public:
     }
 };
 
-IMPL_LINK(SalInstanceWidget, FocusInListener, VclWindowEvent&, rEvent, void)
+IMPL_LINK(SalInstanceWidget, EventListener, VclWindowEvent&, rEvent, void)
 {
     if (rEvent.GetId() == VclEventId::WindowGetFocus || rEvent.GetId() == VclEventId::WindowActivate)
-        signal_focus_in();
-}
-
-IMPL_LINK(SalInstanceWidget, FocusOutListener, VclWindowEvent&, rEvent, void)
-{
-    if (rEvent.GetId() == VclEventId::WindowLoseFocus || rEvent.GetId() == VclEventId::WindowDeactivate)
-        signal_focus_out();
-}
-
-IMPL_LINK(SalInstanceWidget, ResizeListener, VclWindowEvent&, rEvent, void)
-{
-    if (rEvent.GetId() == VclEventId::WindowResize)
-    {
+        m_aFocusInHdl.Call(*this);
+    else if (rEvent.GetId() == VclEventId::WindowLoseFocus || rEvent.GetId() == VclEventId::WindowDeactivate)
+        m_aFocusOutHdl.Call(*this);
+    else if (rEvent.GetId() == VclEventId::WindowResize)
         m_aSizeAllocateHdl.Call(m_xWidget->GetSizePixel());
+    else if (rEvent.GetId() == VclEventId::WindowKeyInput)
+    {
+        const KeyEvent* pKeyEvent = static_cast<const KeyEvent*>(rEvent.GetData());
+        m_aKeyPressHdl.Call(*pKeyEvent);
+    }
+    else if (rEvent.GetId() == VclEventId::WindowKeyUp)
+    {
+        const KeyEvent* pKeyEvent = static_cast<const KeyEvent*>(rEvent.GetData());
+        m_aKeyReleaseHdl.Call(*pKeyEvent);
     }
 }
 
@@ -1222,6 +1239,16 @@ public:
         m_xButton->SetModeImage(::Image(BitmapEx(rIconName)));
     }
 
+    virtual void set_label_line_wrap(bool wrap) override
+    {
+        WinBits nBits = m_xButton->GetStyle();
+        nBits &= ~WB_WORDBREAK;
+        if (wrap)
+            nBits |= WB_WORDBREAK;
+        m_xButton->SetStyle(nBits);
+        m_xButton->queue_resize();
+    }
+
     virtual OUString get_label() const override
     {
         return m_xButton->GetText();
@@ -2682,6 +2709,16 @@ public:
         weld::Widget::connect_size_allocate(rLink);
     }
 
+    virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override
+    {
+        weld::Widget::connect_key_press(rLink);
+    }
+
+    virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override
+    {
+        weld::Widget::connect_key_release(rLink);
+    }
+
     virtual a11yref get_accessible_parent() override
     {
         vcl::Window* pParent = m_xDrawingArea->GetParent();
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index b5e889d92e0d..b8dea3f8ee73 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -3696,7 +3696,8 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
 
 Size CheckBox::GetOptimalSize() const
 {
-    return CalcMinimumSize();
+    int nWidthRequest(get_width_request());
+    return CalcMinimumSize(nWidthRequest != -1 ? nWidthRequest : 0);
 }
 
 void CheckBox::ShowFocus(const tools::Rectangle& rRect)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7cf2f66a6434..a37d199e1511 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1178,6 +1178,18 @@ namespace
         const gchar* pStr = static_cast<const gchar*>(pData);
         return OString(pStr, pStr ? strlen(pStr) : 0);
     }
+
+    KeyEvent GtkToVcl(GdkEventKey& rEvent)
+    {
+        sal_uInt16 nKeyCode = GtkSalFrame::GetKeyCode(rEvent.keyval);
+        if (nKeyCode == 0)
+        {
+            guint updated_keyval = GtkSalFrame::GetKeyValFor(gdk_keymap_get_default(), rEvent.hardware_keycode, rEvent.group);
+            nKeyCode = GtkSalFrame::GetKeyCode(updated_keyval);
+        }
+        nKeyCode |= GtkSalFrame::GetKeyModCode(rEvent.state);
+        return KeyEvent(gdk_keyval_to_unicode(rEvent.keyval), nKeyCode, 0);
+    }
 }
 
 class GtkInstanceWidget : public virtual weld::Widget
@@ -1190,6 +1202,7 @@ private:
     gulong m_nFocusInSignalId;
     gulong m_nFocusOutSignalId;
     gulong m_nKeyPressSignalId;
+    gulong m_nKeyReleaseSignalId;
     gulong m_nSizeAllocateSignalId;
 
     static void signalFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
@@ -1199,6 +1212,11 @@ private:
         pThis->signal_focus_in();
     }
 
+    void signal_focus_in()
+    {
+        m_aFocusInHdl.Call(*this);
+    }
+
     static void signalFocusOut(GtkWidget*, GdkEvent*, gpointer widget)
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
@@ -1206,6 +1224,11 @@ private:
         pThis->signal_focus_out();
     }
 
+    void signal_focus_out()
+    {
+        m_aFocusOutHdl.Call(*this);
+    }
+
     static void signalSizeAllocate(GtkWidget*, GdkRectangle* allocation, gpointer widget)
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
@@ -1213,7 +1236,7 @@ private:
         pThis->signal_size_allocate(allocation->width, allocation->height);
     }
 
-    static gboolean signalKeyPress(GtkWidget*, GdkEventKey* pEvent, gpointer)
+    static gboolean signalKey(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
     {
         // #i1820# use locale specific decimal separator
         if (pEvent->keyval == GDK_KEY_KP_Decimal && Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
@@ -1221,7 +1244,9 @@ private:
             OUString aSep(Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep());
             pEvent->keyval = aSep[0];
         }
-        return false;
+
+        GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
+        return pThis->signal_key(pEvent);
     }
 
 public:
@@ -1235,9 +1260,13 @@ public:
     {
         GdkEventMask eEventMask(static_cast<GdkEventMask>(gtk_widget_get_events(pWidget)));
         if (eEventMask & GDK_BUTTON_PRESS_MASK)
-            m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKeyPress), this);
+            m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKey), this);
         else
             m_nKeyPressSignalId = 0;
+        if (eEventMask & GDK_BUTTON_RELEASE_MASK)
+            m_nKeyReleaseSignalId = g_signal_connect(pWidget, "key-release-event", G_CALLBACK(signalKey), this);
+        else
+            m_nKeyReleaseSignalId = 0;
     }
 
     virtual void set_sensitive(bool sensitive) override
@@ -1519,6 +1548,21 @@ public:
         m_aSizeAllocateHdl.Call(Size(nWidth, nHeight));
     }
 
+    gboolean signal_key(GdkEventKey* pEvent)
+    {
+        if (pEvent->type == GDK_KEY_PRESS && m_aKeyPressHdl.IsSet())
+        {
+            SolarMutexGuard aGuard;
+            return m_aKeyPressHdl.Call(GtkToVcl(*pEvent));
+        }
+        if (pEvent->type == GDK_KEY_RELEASE && m_aKeyReleaseHdl.IsSet())
+        {
+            SolarMutexGuard aGuard;
+            return m_aKeyReleaseHdl.Call(GtkToVcl(*pEvent));
+        }
+        return false;
+    }
+
     virtual void grab_add() override
     {
         gtk_grab_add(m_pWidget);
@@ -3321,6 +3365,12 @@ public:
         return ::get_label(m_pButton);
     }
 
+    virtual void set_label_line_wrap(bool wrap) override
+    {
+        GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pButton));
+        gtk_label_set_line_wrap(GTK_LABEL(pChild), wrap);
+    }
+
     // allow us to block buttons with click handlers making dialogs return a response
     bool has_click_handler() const
     {
@@ -5484,18 +5534,6 @@ static MouseEventModifiers ImplGetMouseMoveMode(sal_uInt16 nCode)
 namespace
 {
     AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
-
-    KeyEvent GtkToVcl(GdkEventKey& rEvent)
-    {
-        sal_uInt16 nKeyCode = GtkSalFrame::GetKeyCode(rEvent.keyval);
-        if (nKeyCode == 0)
-        {
-            guint updated_keyval = GtkSalFrame::GetKeyValFor(gdk_keymap_get_default(), rEvent.hardware_keycode, rEvent.group);
-            nKeyCode = GtkSalFrame::GetKeyCode(updated_keyval);
-        }
-        nKeyCode |= GtkSalFrame::GetKeyModCode(rEvent.state);
-        return KeyEvent(gdk_keyval_to_unicode(rEvent.keyval), nKeyCode, 0);
-    }
 }
 
 class GtkInstanceDrawingArea : public GtkInstanceWidget, public virtual weld::DrawingArea
@@ -5511,8 +5549,6 @@ private:
     gulong m_nButtonPressSignalId;
     gulong m_nMotionSignalId;
     gulong m_nButtonReleaseSignalId;
-    gulong m_nKeyPressSignalId;
-    gulong m_nKeyReleaseSignalId;
     gulong m_nStyleUpdatedSignalId;
     gulong m_nQueryTooltip;
     gulong m_nPopupMenu;
@@ -5689,25 +5725,6 @@ private:
         m_aMouseMotionHdl.Call(aMEvt);
         return true;
     }
-    static gboolean signalKey(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
-    {
-        GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
-        SolarMutexGuard aGuard;
-        return pThis->signal_key(pEvent);
-    }
-    gboolean signal_key(GdkEventKey* pEvent)
-    {
-        KeyEvent aKeyEvt(GtkToVcl(*pEvent));
-
-        bool bProcessed;
-        if (pEvent->type == GDK_KEY_PRESS)
-            bProcessed = m_aKeyPressHdl.Call(aKeyEvt);
-        else
-            bProcessed = m_aKeyReleaseHdl.Call(aKeyEvt);
-
-        return bProcessed;
-    }
-
 public:
     GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, const a11yref& rA11y, bool bTakeOwnership)
         : GtkInstanceWidget(GTK_WIDGET(pDrawingArea), bTakeOwnership)
@@ -5721,8 +5738,6 @@ public:
         , m_nButtonPressSignalId(g_signal_connect(m_pDrawingArea, "button-press-event", G_CALLBACK(signalButton), this))
         , m_nMotionSignalId(g_signal_connect(m_pDrawingArea, "motion-notify-event", G_CALLBACK(signalMotion), this))
         , m_nButtonReleaseSignalId(g_signal_connect(m_pDrawingArea, "button-release-event", G_CALLBACK(signalButton), this))
-        , m_nKeyPressSignalId(g_signal_connect(m_pDrawingArea, "key-press-event", G_CALLBACK(signalKey), this))
-        , m_nKeyReleaseSignalId(g_signal_connect(m_pDrawingArea,"key-release-event", G_CALLBACK(signalKey), this))
         , m_nStyleUpdatedSignalId(g_signal_connect(m_pDrawingArea,"style-updated", G_CALLBACK(signalStyleUpdated), this))
         , m_nQueryTooltip(g_signal_connect(m_pDrawingArea, "query-tooltip", G_CALLBACK(signalQueryTooltip), this))
         , m_nPopupMenu(g_signal_connect(m_pDrawingArea, "popup-menu", G_CALLBACK(signalPopupMenu), this))
@@ -5817,8 +5832,6 @@ public:
         g_signal_handler_disconnect(m_pDrawingArea, m_nPopupMenu);
         g_signal_handler_disconnect(m_pDrawingArea, m_nQueryTooltip);
         g_signal_handler_disconnect(m_pDrawingArea, m_nStyleUpdatedSignalId);
-        g_signal_handler_disconnect(m_pDrawingArea, m_nKeyPressSignalId);
-        g_signal_handler_disconnect(m_pDrawingArea, m_nKeyReleaseSignalId);
         g_signal_handler_disconnect(m_pDrawingArea, m_nButtonPressSignalId);
         g_signal_handler_disconnect(m_pDrawingArea, m_nMotionSignalId);
         g_signal_handler_disconnect(m_pDrawingArea, m_nButtonReleaseSignalId);


More information about the Libreoffice-commits mailing list