This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO41X by this push:
     new b57309c179 git-svn-id: 
https://svn.apache.org/repos/asf/openoffice/trunk@1595439 
13f79535-47bb-0310-9956-ffa450edef68
b57309c179 is described below

commit b57309c179ab9add01ad3e639bbfbb6ccbe4ffb2
Author: Tsutomu Uchino <[email protected]>
AuthorDate: Sat May 17 10:16:40 2014 +0000

    git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1595439 
13f79535-47bb-0310-9956-ffa450edef68
    
    (cherry picked and adapted from commit 
718aea4866b8baf60c4038072103fda22842ad48)
---
 .../source/protocolhandler/scripthandler.cxx       | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/main/scripting/source/protocolhandler/scripthandler.cxx 
b/main/scripting/source/protocolhandler/scripthandler.cxx
index 3de168b659..d83a20b598 100644
--- a/main/scripting/source/protocolhandler/scripthandler.cxx
+++ b/main/scripting/source/protocolhandler/scripthandler.cxx
@@ -189,7 +189,28 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
                 OSL_ENSURE( xDocumentScripts.is(), 
"ScriptProtocolHandler::dispatchWithNotification: can't do the security check!" 
);
                 if ( !xDocumentScripts.is() ||
                      ( !bRefererIsTrusted && 
!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 allready ) 
@@ -346,6 +367,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();
 }

Reply via email to