[Libreoffice-commits] core.git: sw/source

Tor Lillqvist tml at collabora.com
Thu May 31 11:16:33 UTC 2018


 sw/source/uibase/app/docsh2.cxx |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 7fbfd070f97b048534725e1d89840031631c52d2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 13 14:43:59 2018 +0300

    Emit DocumentChange events less eagerly (to Automation clients)
    
    They are supposed to be emitten when a new document is created, an
    existing document opened, or a document is made the active
    document. (Hopefully our SfxEventHintId::ActivateDoc matches the last
    one semantically.)
    
    Change-Id: Ic53285fc3d1b9a61ababf77f06477081cef20f27

diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 22696b2af35f..40d5976c64d2 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -254,10 +254,21 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
     if( xVbaEvents.is() )
         lcl_processCompatibleSfxHint( xVbaEvents, rHint );
 
-    if ( rHint.GetId() == SfxHintId::DocChanged )
+    if ( const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint) )
     {
-        uno::Sequence< css::uno::Any > aArgs;
-        SW_MOD()->CallAutomationApplicationEventSinks( "DocumentChange", aArgs );
+        switch( pSfxEventHint->GetEventId() )
+        {
+            case SfxEventHintId::ActivateDoc:
+            case SfxEventHintId::CreateDoc:
+            case SfxEventHintId::OpenDoc:
+            {
+                uno::Sequence< css::uno::Any > aArgs;
+                SW_MOD()->CallAutomationApplicationEventSinks( "DocumentChange", aArgs );
+                break;
+            }
+            default:
+                break;
+        }
     }
 
     sal_uInt16 nAction = 0;


More information about the Libreoffice-commits mailing list