[Libreoffice-commits] core.git: desktop/source include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 26 19:58:53 UTC 2021


 desktop/source/lib/init.cxx  |    8 +-------
 include/vcl/dialoghelper.hxx |    2 +-
 vcl/source/window/dialog.cxx |    9 ++++-----
 3 files changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 71da8dd7d710f9038586800d3d9ac848d064c911
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 26 12:14:03 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 26 20:58:06 2021 +0100

    move lok FloatingWindow closing code to vcl
    
    Change-Id: I8e2c29e2c6450f79a7b80262f290b6afd13db7f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111627
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 76f08455e3a7..6636254bd7b8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -127,7 +127,6 @@
 #include <tools/json_writer.hxx>
 #include <svtools/ctrltool.hxx>
 #include <svtools/langtab.hxx>
-#include <vcl/floatwin.hxx>
 #include <vcl/fontcharmap.hxx>
 #include <vcl/graphicfilter.hxx>
 #ifdef IOS
@@ -5467,12 +5466,7 @@ static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindo
 
     if (nAction == LOK_WINDOW_CLOSE)
     {
-        bool bWasDialog = vcl::CloseDialog(pWindow);
-        if (!bWasDialog)
-        {
-            if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow.get()))
-                pFloatWin->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
-        }
+        vcl::CloseTopLevel(pWindow);
     }
     else if (nAction == LOK_WINDOW_PASTE)
     {
diff --git a/include/vcl/dialoghelper.hxx b/include/vcl/dialoghelper.hxx
index 828c21b2af17..549188e00214 100644
--- a/include/vcl/dialoghelper.hxx
+++ b/include/vcl/dialoghelper.hxx
@@ -23,7 +23,7 @@ VCL_DLLPUBLIC void EndAllDialogs(vcl::Window const* pParent);
 
 /* for LibreOffice kit */
 VCL_DLLPUBLIC void EnableDialogInput(vcl::Window* pDialog);
-VCL_DLLPUBLIC bool CloseDialog(vcl::Window* pDialog);
+VCL_DLLPUBLIC void CloseTopLevel(vcl::Window* pDialog);
 /// Pre-loads all modules containing UI information
 VCL_DLLPUBLIC void VclBuilderPreload();
 }
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index d65ac881aa30..3bfdbe1c4bb4 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -43,6 +43,7 @@
 #include <vcl/abstdlg.hxx>
 #include <vcl/accel.hxx>
 #include <vcl/builder.hxx>
+#include <vcl/floatwin.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/event.hxx>
@@ -1201,14 +1202,12 @@ namespace vcl
         }
     }
 
-    bool CloseDialog(vcl::Window* pWindow)
+    void CloseTopLevel(vcl::Window* pWindow)
     {
         if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
-        {
             pDialog->Close();
-            return true;
-        }
-        return false;
+        else if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow))
+            pFloatWin->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
     }
 }
 


More information about the Libreoffice-commits mailing list