summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorTsutomu Uchino <hanya@apache.org>2014-05-17 10:16:40 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-05-18 08:53:07 +0100
commita00c4c5e2fb9461fef1fbce4d51c8cdf36141b9f (patch)
treeef8f58147aedea25ccbe7c237ae4dbc63ba4603d /scripting
parentfc974a4028fcc14304be85f36f5b15524beff5e4 (diff)
Resolves: #i113481# query script invocation from the current frame...
when the controller is not yet attached (cherry picked from commit 03a410876fbdb5f9e1a7216d9d622557275d4896) Change-Id: I1da3b3da258445d5187dcc75c4d151d08f9017dc
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index 50fa627a9e6f..d2c6f75a16f2 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -158,7 +158,28 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
OSL_ENSURE( xDocumentScripts.is(), "ScriptProtocolHandler::dispatchWithNotification: can't do the security check!" );
if ( !xDocumentScripts.is() || !xDocumentScripts->getAllowMacroExecution() )
+ {
+ if ( xListener.is() )
+ {
+ ::com::sun::star::frame::DispatchResultEvent aEvent(
+ static_cast< ::cppu::OWeakObject* >( this ),
+ ::com::sun::star::frame::DispatchResultState::FAILURE,
+ invokeResult );
+ try
+ {
+ xListener->dispatchFinished( aEvent ) ;
+ }
+ catch(RuntimeException & e)
+ {
+ OSL_TRACE(
+ "ScriptProtocolHandler::dispatchWithNotification: caught RuntimeException"
+ "while dispatchFinished with failture of the execution %s",
+ ::rtl::OUStringToOString( e.Message,
+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ }
+ }
return;
+ }
}
// Creates a ScriptProvider ( if one is not created already )
@@ -333,6 +354,25 @@ ScriptProtocolHandler::getScriptInvocation()
if ( !m_xScriptInvocation.set( xController->getModel(), UNO_QUERY ) )
m_xScriptInvocation.set( xController, UNO_QUERY );
}
+ else
+ {
+ Reference< XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
+ if ( xFrame.is() )
+ {
+ SfxFrame* pFrame = NULL;
+ for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
+ {
+ if ( pFrame->GetFrameInterface() == xFrame )
+ break;
+ }
+ SfxObjectShell* pDocShell = pFrame ? pFrame->GetCurrentDocument() : SfxObjectShell::Current();
+ if ( pDocShell )
+ {
+ Reference< XModel > xModel( pDocShell->GetModel() );
+ m_xScriptInvocation.set( xModel, UNO_QUERY );
+ }
+ }
+ }
}
return m_xScriptInvocation.is();
}