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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu May 9 13:53:16 UTC 2019


 include/sfx2/sfxsids.hrc     |    3 ++-
 sfx2/source/appl/appserv.cxx |   11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 2479ab8b788ca000f2e979d0858de8d05de8e858
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 9 09:54:44 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 9 15:51:56 2019 +0200

    add a way to specify SfxRequest preferred dialog parent
    
    when the parent isn't a XFrame, i.e. want the parent to be an open
    dialog
    
    Change-Id: I2dfaac1fd057095de154de549e9f395ce30d118b
    Reviewed-on: https://gerrit.libreoffice.org/72034
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 5736a0d80adb..7c0508b75415 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -259,8 +259,9 @@ class SvxSearchItem;
 #define SID_NO_EMBEDDED_DS                  TypedWhichId<SfxBoolItem>(SID_SFX_START + 1731)
 #define SID_IS_REDACT_MODE                  (SID_SFX_START + 1733)
 #define SID_REDACTION_STYLE                 (SID_SFX_START + 1734)
+#define SID_DIALOG_PARENT                   (SID_SFX_START + 1735)
 
-//      SID_SFX_free_START                  (SID_SFX_START + 1735)
+//      SID_SFX_free_START                  (SID_SFX_START + 1736)
 //      SID_SFX_free_END                    (SID_SFX_START + 3999)
 
 #define SID_OPEN_NEW_VIEW                   (SID_SFX_START + 520)
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index c8e3bfd77124..c533c345330e 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -361,6 +361,17 @@ vcl::Window* SfxRequest::GetFrameWindow() const
 
 weld::Window* SfxRequest::GetFrameWeld() const
 {
+    const SfxItemSet* pIntArgs = GetInternalArgs_Impl();
+    const SfxPoolItem* pItem = nullptr;
+    if (pIntArgs && pIntArgs->GetItemState(SID_DIALOG_PARENT, false, &pItem) == SfxItemState::SET)
+    {
+        assert(dynamic_cast<const SfxUnoAnyItem*>(pItem));
+        auto aAny = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
+        Reference<awt::XWindow> xWindow;
+        aAny >>= xWindow;
+        return Application::GetFrameWeld(xWindow);
+    }
+
     vcl::Window* pWin = GetFrameWindow();
     return pWin ? pWin->GetFrameWeld() : nullptr;
 }


More information about the Libreoffice-commits mailing list