[Libreoffice-commits] core.git: include/sfx2 sfx2/source svx/source sw/source
Caolán McNamara
caolanm at redhat.com
Mon Mar 5 13:48:50 UTC 2018
include/sfx2/dispatch.hxx | 3 +--
include/sfx2/request.hxx | 16 +++++++---------
sfx2/source/appl/appserv.cxx | 27 ++++++++++++++++-----------
sfx2/source/control/dispatch.cxx | 4 ++--
sfx2/source/control/request.cxx | 10 +---------
sfx2/source/control/unoctitm.cxx | 14 +++-----------
svx/source/tbxctrls/bulletsnumbering.cxx | 3 +--
sw/source/uibase/shells/txtnum.cxx | 2 +-
8 files changed, 32 insertions(+), 47 deletions(-)
New commits:
commit 972a4a88cf1caec63cb3dcd3be610d1a840f50c9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 5 11:45:16 2018 +0000
there's already a way to pass around the SfxRequest source frame
Change-Id: I790497c3e651890e0971ee334d599a98a7aae7f0
Reviewed-on: https://gerrit.libreoffice.org/50768
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
index 3daa2b0087d8..49777df94687 100644
--- a/include/sfx2/dispatch.hxx
+++ b/include/sfx2/dispatch.hxx
@@ -128,8 +128,7 @@ public:
SfxCallMode nCall,
SfxItemSet const * pArgs,
SfxItemSet const * pInternalArgs,
- sal_uInt16 nModi,
- vcl::Window* pDialogParent);
+ sal_uInt16 nModi);
const SfxPoolItem* ExecuteList( sal_uInt16 nSlot,
SfxCallMode nCall,
diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx
index eb6e1fb0832a..60b5dfe4f8e7 100644
--- a/include/sfx2/request.hxx
+++ b/include/sfx2/request.hxx
@@ -41,10 +41,8 @@ class SfxViewFrame;
struct SfxRequest_Impl;
enum class SfxCallMode : sal_uInt16;
-namespace vcl
-{
- class Window;
-}
+namespace vcl { class Window; }
+namespace weld { class Window; }
class SFX2_DLLPUBLIC SfxRequest: public SfxHint
{
@@ -66,7 +64,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, vcl::Window* pDialogParent = nullptr);
+ SfxRequest(sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs);
SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs, const SfxAllItemSet& rSfxInternalArgs );
SfxRequest( const SfxRequest& rOrig );
virtual ~SfxRequest() override;
@@ -95,10 +93,6 @@ 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;
@@ -122,6 +116,10 @@ public:
void ForgetAllArgs();
+ /** Return the window that should be used as the parent for any dialogs this request creates
+ */
+ vcl::Window* GetFrameWindow() const;
+ weld::Window* GetFrameWeld() const;
private:
const SfxRequest& operator=(const SfxRequest &) = delete;
};
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index bc04d9b178a6..550578327d0b 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -271,7 +271,7 @@ static void showDocument( const char* pBaseName )
namespace
{
- Reference<XFrame> GetRequestFrame(SfxRequest& rReq)
+ Reference<XFrame> GetRequestFrame(const SfxRequest& rReq)
{
const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl();
const SfxPoolItem* pItem = nullptr;
@@ -284,7 +284,7 @@ namespace
return xFrame;
}
- weld::Window* getFrameWeld(const Reference<XFrame>& rFrame)
+ vcl::Window* getFrameWindow(const Reference<XFrame>& rFrame)
{
if (rFrame.is())
{
@@ -292,8 +292,7 @@ namespace
{
Reference< awt::XWindow > xContainerWindow(rFrame->getContainerWindow(), UNO_SET_THROW);
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContainerWindow);
- if (pWindow)
- return pWindow->GetFrameWeld();
+ return pWindow;
}
catch (const Exception&)
{
@@ -305,11 +304,6 @@ namespace
return nullptr;
}
- weld::Window* GetRequestFrameWeld(SfxRequest& rReq)
- {
- return getFrameWeld(GetRequestFrame(rReq));
- }
-
class LicenseDialog
{
private:
@@ -362,6 +356,17 @@ namespace
};
}
+vcl::Window* SfxRequest::GetFrameWindow() const
+{
+ return getFrameWindow(GetRequestFrame(*this));
+}
+
+weld::Window* SfxRequest::GetFrameWeld() const
+{
+ vcl::Window* pWin = GetFrameWindow();
+ return pWin ? pWin->GetFrameWeld() : nullptr;
+}
+
void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
{
bool bDone = false;
@@ -566,7 +571,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
}
case SID_SHOW_LICENSE:
{
- LicenseDialog aDialog(GetRequestFrameWeld(rReq));
+ LicenseDialog aDialog(rReq.GetFrameWeld());
aDialog.run();
break;
}
@@ -1030,7 +1035,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
}
case SID_SAFE_MODE:
{
- SafeModeQueryDialog aDialog(GetRequestFrameWeld(rReq));
+ SafeModeQueryDialog aDialog(rReq.GetFrameWeld());
aDialog.run();
break;
}
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 07b251f552e4..6bc623a7b461 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -934,7 +934,7 @@ const SfxSlot* SfxDispatcher::GetSlot( const OUString& rCommand )
}
const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall,
- SfxItemSet const * pArgs, SfxItemSet const * pInternalArgs, sal_uInt16 nModi, vcl::Window* pDialogParent)
+ SfxItemSet const * pArgs, SfxItemSet const * pInternalArgs, sal_uInt16 nModi)
{
if ( IsLocked() )
return nullptr;
@@ -953,7 +953,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall,
pArg = aIter.NextItem() )
MappedPut_Impl( aSet, *pArg );
}
- SfxRequest aReq(nSlot, nCall, aSet, pDialogParent);
+ SfxRequest aReq(nSlot, nCall, aSet);
if (pInternalArgs)
aReq.SetInternalArgs_Impl( *pInternalArgs );
aReq.SetModifier( nModi );
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index 086aa45ec38c..42fe49edf3ea 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -67,7 +67,6 @@ 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;
@@ -264,8 +263,7 @@ SfxRequest::SfxRequest
(
sal_uInt16 nSlotId,
SfxCallMode nMode,
- const SfxAllItemSet& rSfxArgs,
- vcl::Window* pDialogParent
+ const SfxAllItemSet& rSfxArgs
)
// creates a SfxRequest with arguments
@@ -281,7 +279,6 @@ SfxRequest::SfxRequest
pImpl->pShell = nullptr;
pImpl->pSlot = nullptr;
pImpl->nCallMode = nMode;
- pImpl->xDialogParent = pDialogParent;
}
@@ -760,9 +757,4 @@ 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 023ab89701e3..ec4563f59b43 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -640,8 +640,6 @@ void 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;
@@ -654,12 +652,6 @@ void 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;
@@ -744,7 +736,7 @@ void 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, xDialogParent);
+ pItem = pDispatcher->Execute(GetId(), nCall, xSet.get(), &aInternalSet, nModifier);
if ( pItem != nullptr )
{
if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem))
@@ -781,10 +773,10 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
TransformParameters( GetId(), lNewArgs, aSet );
if ( aSet.Count() )
- pItem = pDispatcher->Execute(GetId(), nCall, &aSet, &aInternalSet, nModifier, xDialogParent);
+ pItem = pDispatcher->Execute(GetId(), nCall, &aSet, &aInternalSet, nModifier);
else
// SfxRequests take empty sets as argument sets, GetArgs() returning non-zero!
- pItem = pDispatcher->Execute(GetId(), nCall, nullptr, &aInternalSet, nModifier, xDialogParent);
+ pItem = pDispatcher->Execute(GetId(), nCall, nullptr, &aInternalSet, nModifier);
// 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 19452663a579..e334262ac17d 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -181,8 +181,7 @@ void NumberingPopup::VSSelectHdl(void const * pControl)
}
else if ( getSelectedEntryId() == 1 )
{
- auto aArgs( comphelper::InitPropertySequence( { { "Page", css::uno::makeAny( OUString("customize") ) },
- { "DialogParent", css::uno::makeAny(VCLUnoHelper::GetInterface(GetParent())) } } ) );
+ auto aArgs( comphelper::InitPropertySequence( { { "Page", css::uno::makeAny( OUString("customize") ) } } ) );
mrController.dispatchCommand( ".uno:OutlineBullet", aArgs );
}
}
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index 6a715a75ae94..5565c2bd1db6 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -184,7 +184,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
assert(pFact && "Dialog creation failed!");
- vcl::Window *pParent = rReq.GetDialogParent();
+ vcl::Window *pParent = rReq.GetFrameWindow();
if (!pParent)
pParent = GetView().GetWindow();
More information about the Libreoffice-commits
mailing list