[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - include/sfx2 sfx2/source svx/source sw/source

Caolán McNamara caolanm at redhat.com
Fri Dec 1 01:14:35 UTC 2017


 include/sfx2/dispatch.hxx                |   11 ++++++-----
 include/sfx2/request.hxx                 |   11 ++++++++++-
 sfx2/source/control/dispatch.cxx         |    4 ++--
 sfx2/source/control/request.cxx          |   10 +++++++++-
 sfx2/source/control/unoctitm.cxx         |   15 ++++++++++++---
 svx/source/tbxctrls/bulletsnumbering.cxx |    4 +++-
 sw/source/uibase/shells/txtnum.cxx       |   10 ++++++----
 7 files changed, 48 insertions(+), 17 deletions(-)

New commits:
commit 351104c0bf672294cc686e6baa4322c42e496b3c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 9 16:11:25 2017 +0000

    tdf#113647 bullet dialog has wrong modal parent
    
    Reviewed-on: https://gerrit.libreoffice.org/44554
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 31b26130d90d4746cbb126fd9b6c1cb3487f644f)
    
    Change-Id: Ia2e6171a1aeb3b8ad679a547a63ccaeac20481df
    Reviewed-on: https://gerrit.libreoffice.org/44978
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
index cde10c2929fb..b788507e62e7 100644
--- a/include/sfx2/dispatch.hxx
+++ b/include/sfx2/dispatch.hxx
@@ -122,11 +122,12 @@ public:
                                  sal_uInt16 nModi = 0,
                                  const SfxPoolItem **pInternalArgs = nullptr);
 
-    const SfxPoolItem*  Execute( sal_uInt16 nSlot,
-                                 SfxCallMode nCall,
-                                 SfxItemSet* pArgs,
-                                 SfxItemSet* pInternalArgs,
-                                 sal_uInt16 nModi);
+    const SfxPoolItem*  Execute(sal_uInt16 nSlot,
+                                SfxCallMode nCall,
+                                SfxItemSet const * pArgs,
+                                SfxItemSet const * pInternalArgs,
+                                sal_uInt16 nModi,
+                                vcl::Window* pDialogParent = nullptr);
 
     const SfxPoolItem*  ExecuteList( sal_uInt16 nSlot,
                                  SfxCallMode nCall,
diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx
index b95ca969ed8f..39802dade7a6 100644
--- a/include/sfx2/request.hxx
+++ b/include/sfx2/request.hxx
@@ -41,6 +41,11 @@ class SfxViewFrame;
 struct SfxRequest_Impl;
 enum class SfxCallMode : sal_uInt16;
 
+namespace vcl
+{
+    class Window;
+}
+
 class SFX2_DLLPUBLIC SfxRequest: public SfxHint
 {
 friend struct SfxRequest_Impl;
@@ -61,7 +66,7 @@ public:
                         SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, SfxItemPool &rPool );
                         SfxRequest( const SfxSlot* pSlot, const css::uno::Sequence < css::beans::PropertyValue >& rArgs,
                                             SfxCallMode nCallMode, SfxItemPool &rPool );
-                        SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs );
+                        SfxRequest(sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs, vcl::Window* pDialogParent = nullptr);
                         SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs, const SfxAllItemSet& rSfxInternalArgs );
                         SfxRequest( const SfxRequest& rOrig );
                         virtual ~SfxRequest() override;
@@ -90,6 +95,10 @@ public:
         return nullptr;
     }
 
+    /** Return the window that should be used as the parent for any dialogs this request creates
+    */
+    vcl::Window* GetDialogParent() const;
+
     void                ReleaseArgs();
     void                SetReturnValue(const SfxPoolItem &);
     const SfxPoolItem*  GetReturnValue() const;
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 8002f37ed1b2..9e69b4b8b9f7 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -961,7 +961,7 @@ const SfxSlot* SfxDispatcher::GetSlot( const OUString& rCommand )
 }
 
 const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall,
-        SfxItemSet* pArgs, SfxItemSet* pInternalArgs, sal_uInt16 nModi)
+        SfxItemSet const * pArgs, SfxItemSet const * pInternalArgs, sal_uInt16 nModi, vcl::Window* pDialogParent)
 {
     if ( IsLocked() )
         return nullptr;
@@ -980,7 +980,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall,
                 pArg = aIter.NextItem() )
                 MappedPut_Impl( aSet, *pArg );
         }
-        SfxRequest aReq( nSlot, nCall, aSet );
+        SfxRequest aReq(nSlot, nCall, aSet, pDialogParent);
         if (pInternalArgs)
             aReq.SetInternalArgs_Impl( *pInternalArgs );
         aReq.SetModifier( nModi );
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index 77a7e4d6d5d7..27951bc2437e 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -67,6 +67,7 @@ struct SfxRequest_Impl: public SfxListener
     bool            bAllowRecording;
     std::unique_ptr<SfxAllItemSet>
                     pInternalArgs;
+    VclPtr<vcl::Window> xDialogParent;
     SfxViewFrame*   pViewFrame;
 
     css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
@@ -250,7 +251,8 @@ SfxRequest::SfxRequest
 (
     sal_uInt16                  nSlotId,
     SfxCallMode                 nMode,
-    const SfxAllItemSet&        rSfxArgs
+    const SfxAllItemSet&        rSfxArgs,
+    vcl::Window* pDialogParent
 )
 
 // creates a SfxRequest with arguments
@@ -266,6 +268,7 @@ SfxRequest::SfxRequest
     pImpl->pShell = nullptr;
     pImpl->pSlot = nullptr;
     pImpl->nCallMode = nMode;
+    pImpl->xDialogParent = pDialogParent;
 }
 
 
@@ -756,4 +759,9 @@ void SfxRequest::ReleaseArgs()
     pImpl->pInternalArgs.reset();
 }
 
+vcl::Window* SfxRequest::GetDialogParent() const
+{
+    return pImpl->xDialogParent;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index dbbd96074f77..25e156ef2512 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -30,6 +30,7 @@
 #include <svtools/javainteractionhandler.hxx>
 #include <svl/itempool.hxx>
 #include <tools/urlobj.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
 #include <com/sun/star/awt/FontDescriptor.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
@@ -645,6 +646,8 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
         SfxCallMode nCall = SfxCallMode::RECORD;
         sal_Int32   nMarkArg = -1;
 
+        VclPtr<vcl::Window> xDialogParent;
+
         // Filter arguments which shouldn't be part of the sequence property value
         sal_uInt16  nModifier(0);
         std::vector< css::beans::PropertyValue > aAddArgs;
@@ -657,6 +660,12 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
                 if( rProp.Value >>= bTemp )
                     nCall = bTemp ? SfxCallMode::SYNCHRON : SfxCallMode::ASYNCHRON;
             }
+            else if( rProp.Name == "DialogParent" )
+            {
+                Reference<css::awt::XWindow> xWindow;
+                if (rProp.Value >>= xWindow)
+                    xDialogParent = VCLUnoHelper::GetWindow(xWindow);
+            }
             else if( rProp.Name == "Bookmark" )
             {
                 nMarkArg = n;
@@ -741,7 +750,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
                         if (xSet->Count())
                         {
                             // execute with arguments - call directly
-                            pItem = pDispatcher->Execute(GetId(), nCall, xSet.get(), &aInternalSet, nModifier);
+                            pItem = pDispatcher->Execute(GetId(), nCall, xSet.get(), &aInternalSet, nModifier, xDialogParent);
                             if ( pItem != nullptr )
                             {
                                 if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem))
@@ -778,10 +787,10 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
                 TransformParameters( GetId(), lNewArgs, aSet );
 
                 if ( aSet.Count() )
-                    pItem = pDispatcher->Execute( GetId(), nCall, &aSet, &aInternalSet, nModifier );
+                    pItem = pDispatcher->Execute(GetId(), nCall, &aSet, &aInternalSet, nModifier, xDialogParent);
                 else
                     // SfxRequests take empty sets as argument sets, GetArgs() returning non-zero!
-                    pItem = pDispatcher->Execute( GetId(), nCall, nullptr, &aInternalSet, nModifier );
+                    pItem = pDispatcher->Execute(GetId(), nCall, nullptr, &aInternalSet, nModifier, xDialogParent);
 
                 // no bindings, no invalidate ( usually done in SfxDispatcher::Call_Impl()! )
                 if (SfxApplication* pApp = SfxApplication::Get())
diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx
index ab931156aa7e..67092593f3ac 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -15,6 +15,7 @@
 #include <svtools/popupwindowcontroller.hxx>
 #include <svtools/toolbarmenu.hxx>
 #include <svx/dialogs.hrc>
+#include <toolkit/helper/vclunohelper.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/numvset.hxx>
 #include <vcl/commandinfoprovider.hxx>
@@ -183,7 +184,8 @@ void NumberingPopup::VSSelectHdl(void* pControl)
     }
     else if ( getSelectedEntryId() == 1 )
     {
-        auto aArgs( comphelper::InitPropertySequence( { { "Page", css::uno::makeAny( OUString("customize") ) } } ) );
+        auto aArgs( comphelper::InitPropertySequence( { { "Page", css::uno::makeAny( OUString("customize") ) },
+                                                        { "DialogParent", css::uno::makeAny(VCLUnoHelper::GetInterface(GetParent())) } } ) );
         mrController.dispatchCommand( ".uno:OutlineBullet", aArgs );
     }
 }
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index 2e19f7816ac7..8ac81578c8d1 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -184,10 +184,12 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
         pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh)));
 
         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-        OSL_ENSURE(pFact, "Dialog creation failed!");
-        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET,
-                                                        GetView().GetWindow(), &aSet, GetShell()));
-        OSL_ENSURE(pDlg, "Dialog creation failed!");
+        assert(pFact && "Dialog creation failed!");
+        vcl::Window *pParent = rReq.GetDialogParent();
+        if (!pParent)
+            pParent = GetView().GetWindow();
+        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog(DLG_SVXTEST_NUM_BULLET, pParent, &aSet, GetShell()));
+        assert(pDlg && "Dialog creation failed!");
         const SfxStringItem* pPageItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
         if ( pPageItem )
             pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );


More information about the Libreoffice-commits mailing list