diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-06 14:45:46 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-04-06 21:28:03 +0200 |
commit | 84a4da19ae0f5e092a0deb7007a34d2ee78d5da7 (patch) | |
tree | cddce0f7c446ff6713bed64fa1d5b302f259398c /editeng | |
parent | 8bdf557876a65ab6d7860874ee2c7fd4ca3cc52b (diff) |
ExecuteSpellPopup never called with a null spelling callback
Change-Id: Id03001541ccfd8503a7b8181598bad9811542b4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113694
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 44 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 4 |
2 files changed, 13 insertions, 35 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 5f3fb49e7a08..7cc5e123db35 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -958,7 +958,7 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLa pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str()); } -void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo&,void> const * pCallBack ) +void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void> &rCallBack) { OutputDevice& rDevice = pImpEditView->GetOutputDevice(); Point aPos(rDevice.PixelToLogic(rPosPixel)); @@ -1165,11 +1165,8 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo if (sId == "ignore") { OUString aWord = pImpEditView->SpellIgnoreWord(); - if ( pCallBack ) - { - SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord ); - pCallBack->Call( aInf ); - } + SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord ); + rCallBack.Call(aInf); SetSelection( aOldSel ); } else if (sId == "wordlanguage" || sId == "paralanguage") @@ -1194,35 +1191,19 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo SetAttribs( aAttrs ); pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer(); - if ( pCallBack ) - { - SpellCallbackInfo aInf( (sId == "wordlanguage") ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE ); - pCallBack->Call( aInf ); - } + SpellCallbackInfo aInf((sId == "wordlanguage") ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE); + rCallBack.Call(aInf); SetSelection( aOldSel ); } else if (sId == "check") { - if ( !pCallBack ) - { - // Set Cursor before word... - EditPaM aCursor = pImpEditView->GetEditSelection().Min(); - pImpEditView->DrawSelectionXOR(); - pImpEditView->SetEditSelection( EditSelection( aCursor, aCursor ) ); - pImpEditView->DrawSelectionXOR(); - // Crashes when no SfxApp - pImpEditView->pEditEngine->pImpEditEngine->Spell( this, false ); - } - else - { - SpellCallbackInfo aInf( SpellCallbackCommand::STARTSPELLDLG, OUString() ); - pCallBack->Call( aInf ); - } + SpellCallbackInfo aInf( SpellCallbackCommand::STARTSPELLDLG, OUString() ); + rCallBack.Call(aInf); } - else if (sId == "autocorrectdlg" && pCallBack) + else if (sId == "autocorrectdlg") { SpellCallbackInfo aInf( SpellCallbackCommand::AUTOCORRECT_OPTIONS, OUString() ); - pCallBack->Call( aInf ); + rCallBack.Call(aInf); } else if ( sId.toInt32() >= MN_DICTSTART || sId == "add") { @@ -1249,11 +1230,8 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo aPaM.GetNode()->GetWrongList()->ResetInvalidRange(0, aPaM.GetNode()->Len()); pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer(); - if ( pCallBack ) - { - SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, aSelected ); - pCallBack->Call( aInf ); - } + SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, aSelected ); + rCallBack.Call(aInf); SetSelection( aOldSel ); } else if ( sId.toInt32() >= MN_AUTOSTART ) diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index f74689f91ded..7201bf840f24 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1346,9 +1346,9 @@ bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel ) return pEditView->IsWrongSpelledWordAtPos( rPosPixel, /*bMarkIfWrong*/false ); } -void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo&,void> const * pStartDlg ) +void OutlinerView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rStartDlg) { - pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg ); + pEditView->ExecuteSpellPopup(rPosPixel, rStartDlg); } void OutlinerView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) |