summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-05 11:45:16 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-05 14:48:28 +0100
commit972a4a88cf1caec63cb3dcd3be610d1a840f50c9 (patch)
tree35cdfc924bce421424c5e4f9768ad3b18e33fd70 /sfx2
parentddd43218e9900536381733735adf8681d345e775 (diff)
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@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appserv.cxx27
-rw-r--r--sfx2/source/control/dispatch.cxx4
-rw-r--r--sfx2/source/control/request.cxx10
-rw-r--r--sfx2/source/control/unoctitm.cxx14
4 files changed, 22 insertions, 33 deletions
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())