editeng/source/editeng/editview.cxx          |   44 ++++++---------------------
 editeng/source/outliner/outlvw.cxx           |    4 +-
 include/editeng/editview.hxx                 |    2 -
 include/editeng/outliner.hxx                 |    2 -
 sc/source/ui/view/gridwin.cxx                |    2 -
 sd/source/ui/view/drviews4.cxx               |    2 -
 sd/source/ui/view/outlnvsh.cxx               |    2 -
 sw/source/uibase/docvw/SidebarTxtControl.cxx |    2 -
 sw/source/uibase/uiview/viewdraw.cxx         |    2 -
 9 files changed, 20 insertions(+), 42 deletions(-)

New commits:
commit 84a4da19ae0f5e092a0deb7007a34d2ee78d5da7
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Apr 6 14:45:46 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Apr 6 21:28:03 2021 +0200

    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 <caol...@redhat.com>

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 )
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 6e06cdd77a97..97b7bb2df3c5 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -298,7 +298,7 @@ public:
 
     bool            IsCursorAtWrongSpelledWord();
     bool            IsWrongSpelledWordAtPos( const Point& rPosPixel, bool 
bMarkIfWrong = false );
-    void            ExecuteSpellPopup( const Point& rPosPixel, 
Link<SpellCallbackInfo&,void> const * pCallBack );
+    void            ExecuteSpellPopup(const Point& rPosPixel, const 
Link<SpellCallbackInfo&,void>& rCallBack);
     OUString        SpellIgnoreWord();
 
     void                InsertField( const SvxFieldItem& rFld );
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 55d48fbd7d26..cf92acfbf283 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -347,7 +347,7 @@ public:
 
     bool        IsCursorAtWrongSpelledWord();
     bool        IsWrongSpelledWordAtPos( const Point& rPosPixel );
-    void        ExecuteSpellPopup( const Point& rPosPixel, 
Link<SpellCallbackInfo&,void> const * pCallBack );
+    void        ExecuteSpellPopup(const Point& rPosPixel, const 
Link<SpellCallbackInfo&,void>& rCallBack);
 
     void        SetInvalidateMore( sal_uInt16 nPixel );
     sal_uInt16  GetInvalidateMore() const;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e9f0fde3f4df..75ae937c22a5 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2962,7 +2962,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
                 pHdl->SetModified();
 
             Link<SpellCallbackInfo&,void> aLink = LINK( this, ScGridWindow, 
PopupSpellingHdl );
-            pEditView->ExecuteSpellPopup( aMenuPos, &aLink );
+            pEditView->ExecuteSpellPopup(aMenuPos, aLink);
 
             bDone = true;
         }
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 39f428bb8658..2fd177135ecf 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -640,7 +640,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, 
::sd::Window* pWin)
                                 // first release the mouse.
                                 GetActiveWindow()->ReleaseMouse();
                                 LockInput();
-                                pOutlinerView->ExecuteSpellPopup(aPos, &aLink);
+                                pOutlinerView->ExecuteSpellPopup(aPos, aLink);
                                 pOutlinerView->GetEditView().Invalidate();
                                 UnlockInput();
                             }
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index f106b943a8b1..b18a0460b4e9 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1356,7 +1356,7 @@ void OutlineViewShell::Command( const CommandEvent& 
rCEvt, ::sd::Window* pWin )
             // Popup for Online-Spelling now handled by DrawDocShell
             Link<SpellCallbackInfo&,void> aLink = LINK(GetDocSh(), 
DrawDocShell, OnlineSpellCallback);
 
-            pOLV->ExecuteSpellPopup(aPos, &aLink);
+            pOLV->ExecuteSpellPopup(aPos, aLink);
             pOLV->GetEditView().Invalidate();
         }
         else
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 17b4346f1247..e9ce19243225 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -418,7 +418,7 @@ bool SidebarTextControl::Command( const CommandEvent& rCEvt 
)
              pEditView->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(), 
true ))
         {
             Link<SpellCallbackInfo&,void> aLink = LINK(this, 
SidebarTextControl, OnlineSpellCallback);
-            pEditView->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
+            pEditView->ExecuteSpellPopup(rCEvt.GetMousePosPixel(), aLink);
         }
         else
         {
diff --git a/sw/source/uibase/uiview/viewdraw.cxx 
b/sw/source/uibase/uiview/viewdraw.cxx
index 80c42872c29b..0e860f80472b 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -721,7 +721,7 @@ bool SwView::ExecDrwTextSpellPopup(const Point& rPt)
     {
         bRet = true;
         Link<SpellCallbackInfo&,void> aLink = LINK(this, SwView, 
OnlineSpellCallback);
-        pOLV->ExecuteSpellPopup( aPos,&aLink );
+        pOLV->ExecuteSpellPopup(aPos, aLink);
     }
     return bRet;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to