summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-06-14 21:56:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-06-21 21:33:30 +0200
commit5261417cbb3051b812164838d19c0f748573df45 (patch)
treed159cce1d6903854fc13437c5cca5ce15e48281f /vcl/source
parentfda464112540011dd6e2bd267720d2800af3a5f2 (diff)
weld SpellDialog
a) use EditEngine instead of TextEngine as the former can be hosted in a foreign widget b) use a SfxGrabBagItem to hold the custom spellchecking info inside the EditEngine c) in longer paragraphs the current word is now auto-scrolled into view d) rename Invalidate to InvalidateDialog Change-Id: Ic6db019c32cdfd5f354c58ee7394fdaa040b86e1 Reviewed-on: https://gerrit.libreoffice.org/74119 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/salvtables.cxx33
-rw-r--r--vcl/source/control/edit.cxx4
-rw-r--r--vcl/source/edit/vclmedit.cxx4
3 files changed, 35 insertions, 6 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index fadd5607c365..b17e0215258d 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -695,9 +695,9 @@ public:
void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent)
{
- if (rEvent.GetId() == VclEventId::WindowGetFocus || rEvent.GetId() == VclEventId::WindowActivate)
+ if (rEvent.GetId() == VclEventId::WindowGetFocus)
m_aFocusInHdl.Call(*this);
- else if (rEvent.GetId() == VclEventId::WindowLoseFocus || rEvent.GetId() == VclEventId::WindowDeactivate)
+ else if (rEvent.GetId() == VclEventId::WindowLoseFocus)
m_aFocusOutHdl.Call(*this);
else if (rEvent.GetId() == VclEventId::WindowResize)
m_aSizeAllocateHdl.Call(m_xWidget->GetSizePixel());
@@ -1140,6 +1140,22 @@ public:
return *m_xWindow->GetSystemData();
}
+ virtual void connect_toplevel_focus_changed(const Link<weld::Widget&, void>& rLink) override
+ {
+ ensure_event_listener();
+ weld::Window::connect_toplevel_focus_changed(rLink);
+ }
+
+ virtual void HandleEventListener(VclWindowEvent& rEvent) override
+ {
+ if (rEvent.GetId() == VclEventId::WindowActivate || rEvent.GetId() == VclEventId::WindowDeactivate)
+ {
+ signal_toplevel_focus_changed();
+ return;
+ }
+ SalInstanceContainer::HandleEventListener(rEvent);
+ }
+
virtual ~SalInstanceWindow() override
{
clear_child_help(m_xWindow);
@@ -1893,6 +1909,7 @@ public:
m_xMenuButton->SetSelectHdl(LINK(this, SalInstanceMenuButton, MenuSelectHdl));
if (PopupMenu* pMenu = m_xMenuButton->GetPopupMenu())
{
+ pMenu->SetMenuFlags(MenuFlags::NoAutoMnemonics);
const auto nCount = pMenu->GetItemCount();
m_nLastId = nCount ? pMenu->GetItemId(nCount-1) : 0;
}
@@ -1947,6 +1964,12 @@ public:
pMenu->RemoveItem(pMenu->GetItemPos(pMenu->GetItemId(rId)));
}
+ virtual void clear() override
+ {
+ PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
+ pMenu->Clear();
+ }
+
virtual void set_item_active(const OString& rIdent, bool bActive) override
{
PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
@@ -1959,6 +1982,12 @@ public:
pMenu->SetItemText(pMenu->GetItemId(rIdent), rText);
}
+ virtual OUString get_item_label(const OString& rIdent) const override
+ {
+ PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
+ return pMenu->GetItemText(pMenu->GetItemId(rIdent));
+ }
+
virtual void set_item_visible(const OString& rIdent, bool bShow) override
{
PopupMenu* pMenu = m_xMenuButton->GetPopupMenu();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 57d037546c5f..926bc3193a7a 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1467,7 +1467,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
if ( pImplFncGetSpecialChars )
{
Selection aSaveSel = GetSelection(); // if someone changes the selection in Get/LoseFocus, e.g. URL bar
- OUString aChars = pImplFncGetSpecialChars( this, GetFont() );
+ OUString aChars = pImplFncGetSpecialChars( GetFrameWeld(), GetFont() );
SetSelection( aSaveSel );
if ( !aChars.isEmpty() )
{
@@ -2028,7 +2028,7 @@ void Edit::Command( const CommandEvent& rCEvt )
}
else if (sCommand == "specialchar" && pImplFncGetSpecialChars)
{
- OUString aChars = pImplFncGetSpecialChars( this, GetFont() );
+ OUString aChars = pImplFncGetSpecialChars(GetFrameWeld(), GetFont());
SetSelection( aSaveSel );
if (!aChars.isEmpty())
{
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index df9e23683d62..faa8e18061a5 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -715,7 +715,7 @@ void TextWindow::KeyInput( const KeyEvent& rKEvent )
{
// to maintain the selection
mbActivePopup = true;
- OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
+ OUString aChars = Edit::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
if (!aChars.isEmpty())
{
mpExtTextView->InsertText( aChars );
@@ -829,7 +829,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
}
else if (sCommand == "specialchar")
{
- OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
+ OUString aChars = Edit::GetGetSpecialCharsFunction()(GetFrameWeld(), GetFont());
if (!aChars.isEmpty())
{
mpExtTextView->InsertText( aChars );