summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-16 16:30:59 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-16 20:24:02 +0100
commit2d6f56e4f7e492ba5394a86f13bc710bf6c68335 (patch)
tree8a976f93d26be41329f74003861b3825c4bf7499
parentcd173ae7d6646eec21bc3937fc23676b3daab0ff (diff)
cid#1455212 Uncaught exception
Change-Id: I75956bfc3dccdf3ef400c3b9dcea40606abb8504 Reviewed-on: https://gerrit.libreoffice.org/82987 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sfx2/source/control/request.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index fcdb5c036f32..ec3d36eb4467 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -74,7 +74,7 @@ struct SfxRequest_Impl: public SfxListener
SfxViewFrame* pViewFrame;
css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
- css::uno::Reference< uno::XComponentContext > xContext;
+ css::uno::Reference< css::util::XURLTransformer > xTransform;
explicit SfxRequest_Impl( SfxRequest *pOwner )
: pAnti( pOwner)
@@ -88,7 +88,6 @@ struct SfxRequest_Impl: public SfxListener
, nCallMode( SfxCallMode::SYNCHRON )
, bAllowRecording( false )
, pViewFrame(nullptr)
- , xContext(comphelper::getProcessComponentContext())
{
}
@@ -167,6 +166,8 @@ SfxRequest::SfxRequest
{
pImpl->SetPool( &pImpl->pShell->GetPool() );
pImpl->xRecorder = SfxRequest::GetMacroRecorder(pImpl->pViewFrame);
+ if (pImpl->xRecorder)
+ pImpl->xTransform = util::URLTransformer::create(comphelper::getProcessComponentContext());
pImpl->aTarget = pImpl->pShell->GetName();
}
else
@@ -206,6 +207,8 @@ SfxRequest::SfxRequest
{
pImpl->SetPool( &pImpl->pShell->GetPool() );
pImpl->xRecorder = SfxRequest::GetMacroRecorder( pViewFrame );
+ if (pImpl->xRecorder)
+ pImpl->xTransform = util::URLTransformer::create(comphelper::getProcessComponentContext());
pImpl->aTarget = pImpl->pShell->GetName();
}
else
@@ -333,10 +336,11 @@ void SfxRequest_Impl::Record
*/
{
- OUString aCmd = ".uno:" + OUString::createFromAscii( pSlot->GetUnoName() );
if(!xRecorder.is())
return;
+ OUString aCmd = ".uno:" + OUString::createFromAscii( pSlot->GetUnoName() );
+
uno::Reference< container::XIndexReplace > xReplace( xRecorder, uno::UNO_QUERY );
if ( xReplace.is() && aCmd == ".uno:InsertText" )
{
@@ -360,8 +364,6 @@ void SfxRequest_Impl::Record
}
}
- uno::Reference< util::XURLTransformer > xTransform = util::URLTransformer::create( xContext );
-
css::util::URL aURL;
aURL.Complete = aCmd;
xTransform->parseStrict(aURL);
@@ -392,6 +394,8 @@ void SfxRequest::Record_Impl
pImpl->pShell = &rSh;
pImpl->pSlot = &rSlot;
pImpl->xRecorder = xRecorder;
+ if (!pImpl->xTransform)
+ pImpl->xTransform = util::URLTransformer::create(comphelper::getProcessComponentContext());
pImpl->aTarget = rSh.GetName();
pImpl->pViewFrame = pViewFrame;
}