[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sfx2/source

Pranav Kant pranavk at collabora.co.uk
Thu Dec 14 12:44:35 UTC 2017


 sfx2/source/dialog/basedlgs.cxx |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit b5b0ac92512ead854066f7e5c908109c848e7327
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Dec 14 13:11:00 2017 +0530

    lokdialog: Send close callback when dialog dissappears too
    
    Change-Id: I88bea3dc1ae938d31462e85ca1a8f48dd13e8e89
    (cherry picked from commit 76de866e162502518acbc0ab020c257b80946c2d)
    Reviewed-on: https://gerrit.libreoffice.org/46439
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 8bbf8bd3dee6..77486632c91d 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -167,10 +167,9 @@ void SfxModalDialog::dispose()
     SetDialogData_Impl();
     delete pOutputSet;
 
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    if (comphelper::LibreOfficeKit::isActive() && GetLOKNotifier())
     {
-        pViewShell->notifyWindow(GetLOKWindowId(), "close");
+        SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "close");
         ReleaseLOKNotifier();
     }
 
@@ -214,13 +213,13 @@ void SfxModalDialog::CreateOutputItemSet( const SfxItemSet& rSet )
 
 void SfxModalDialog::StateChanged( StateChangedType nType )
 {
-    if (comphelper::LibreOfficeKit::isActive() && nType == StateChangedType::InitShow)
+    if (comphelper::LibreOfficeKit::isActive())
     {
-        // There are some dialogs, like Hyperlink dialog, which inherit from
-        // SfxModalDialog even though they are modeless, i.e., their Execute method
-        // isn't called.
-        if (!GetLOKNotifier())
+        if (nType == StateChangedType::InitShow && !GetLOKNotifier())
         {
+            // There are some dialogs, like Hyperlink dialog, which inherit from
+            // SfxModalDialog even though they are modeless, i.e., their Execute method
+            // isn't called.
             SetLOKNotifier(SfxViewShell::Current());
             const Size aSize = GetOptimalSize();
             std::vector<vcl::LOKPayloadItem> aItems;
@@ -228,6 +227,13 @@ void SfxModalDialog::StateChanged( StateChangedType nType )
             aItems.emplace_back(std::make_pair("size", aSize.toString()));
             SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "created", aItems);
         }
+        else if (nType == StateChangedType::Visible &&
+                 !IsVisible() &&
+                 GetLOKNotifier())
+        {
+            SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "close");
+            ReleaseLOKNotifier();
+        }
     }
 
     ModalDialog::StateChanged(nType);


More information about the Libreoffice-commits mailing list