diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-06 10:09:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-07 08:19:14 +0100 |
commit | 536a6d6ca67d01c8470c242c6f1fd0750496eed4 (patch) | |
tree | cc2aed75621456aaeb31d26e910cc61baf3bfdd7 /sfx2/source/control/request.cxx | |
parent | 53a318196859140deb4b3c317db583a90cfd604c (diff) |
loplugin:flatten in sfx2
Change-Id: If4e07d497ead58a2ff58b5fdedd282b8784be421
Reviewed-on: https://gerrit.libreoffice.org/67435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/control/request.cxx')
-rw-r--r-- | sfx2/source/control/request.cxx | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index dbe72939e288..830579b306cb 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -157,20 +157,20 @@ SfxRequest::SfxRequest pImpl->SetPool( rOrig.pImpl->pPool ); // setup macro recording if it was in the original SfxRequest - if (rOrig.pImpl->pViewFrame && rOrig.pImpl->xRecorder.is()) + if (!rOrig.pImpl->pViewFrame || !rOrig.pImpl->xRecorder.is()) + return; + + nSlot = rOrig.nSlot; + pImpl->pViewFrame = rOrig.pImpl->pViewFrame; + if (pImpl->pViewFrame->GetDispatcher()->GetShellAndSlot_Impl(nSlot, &pImpl->pShell, &pImpl->pSlot, true, true)) { - nSlot = rOrig.nSlot; - pImpl->pViewFrame = rOrig.pImpl->pViewFrame; - if (pImpl->pViewFrame->GetDispatcher()->GetShellAndSlot_Impl(nSlot, &pImpl->pShell, &pImpl->pSlot, true, true)) - { - pImpl->SetPool( &pImpl->pShell->GetPool() ); - pImpl->xRecorder = SfxRequest::GetMacroRecorder(pImpl->pViewFrame); - pImpl->aTarget = pImpl->pShell->GetName(); - } - else - { - SAL_WARN("sfx", "Recording unsupported slot: " << pImpl->pPool->GetSlotId(nSlot)); - } + pImpl->SetPool( &pImpl->pShell->GetPool() ); + pImpl->xRecorder = SfxRequest::GetMacroRecorder(pImpl->pViewFrame); + pImpl->aTarget = pImpl->pShell->GetName(); + } + else + { + SAL_WARN("sfx", "Recording unsupported slot: " << pImpl->pPool->GetSlotId(nSlot)); } } @@ -335,42 +335,42 @@ void SfxRequest_Impl::Record OUString aCommand(".uno:"); aCommand += OUString( pSlot->GetUnoName(), strlen( pSlot->GetUnoName() ), RTL_TEXTENCODING_UTF8 ); OUString aCmd( aCommand ); - if(xRecorder.is()) + if(!xRecorder.is()) + return; + + uno::Reference< container::XIndexReplace > xReplace( xRecorder, uno::UNO_QUERY ); + if ( xReplace.is() && aCmd == ".uno:InsertText" ) { - uno::Reference< container::XIndexReplace > xReplace( xRecorder, uno::UNO_QUERY ); - if ( xReplace.is() && aCmd == ".uno:InsertText" ) + sal_Int32 nCount = xReplace->getCount(); + if ( nCount ) { - sal_Int32 nCount = xReplace->getCount(); - if ( nCount ) + frame::DispatchStatement aStatement; + uno::Any aElement = xReplace->getByIndex(nCount-1); + if ( (aElement >>= aStatement) && aStatement.aCommand == aCmd ) { - frame::DispatchStatement aStatement; - uno::Any aElement = xReplace->getByIndex(nCount-1); - if ( (aElement >>= aStatement) && aStatement.aCommand == aCmd ) - { - OUString aStr; - OUString aNew; - aStatement.aArgs[0].Value >>= aStr; - rArgs[0].Value >>= aNew; - aStr += aNew; - aStatement.aArgs[0].Value <<= aStr; - aElement <<= aStatement; - xReplace->replaceByIndex( nCount-1, aElement ); - return; - } + OUString aStr; + OUString aNew; + aStatement.aArgs[0].Value >>= aStr; + rArgs[0].Value >>= aNew; + aStr += aNew; + aStatement.aArgs[0].Value <<= aStr; + aElement <<= aStatement; + xReplace->replaceByIndex( nCount-1, aElement ); + return; } } + } - uno::Reference< util::XURLTransformer > xTransform = util::URLTransformer::create( xContext ); + uno::Reference< util::XURLTransformer > xTransform = util::URLTransformer::create( xContext ); - css::util::URL aURL; - aURL.Complete = aCmd; - xTransform->parseStrict(aURL); + css::util::URL aURL; + aURL.Complete = aCmd; + xTransform->parseStrict(aURL); - if (bDone) - xRecorder->recordDispatch(aURL,rArgs); - else - xRecorder->recordDispatchAsComment(aURL,rArgs); - } + if (bDone) + xRecorder->recordDispatch(aURL,rArgs); + else + xRecorder->recordDispatchAsComment(aURL,rArgs); } |