[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - oovbaapi/ooo sw/source

Tor Lillqvist tml at collabora.com
Thu Jun 7 13:10:28 UTC 2018


 oovbaapi/ooo/vba/word/XApplication.idl |   10 ++++++++++
 sw/source/ui/vba/vbaapplication.cxx    |   17 +++++++++++++++++
 sw/source/ui/vba/vbaapplication.hxx    |    2 ++
 3 files changed, 29 insertions(+)

New commits:
commit ace6be80f86203af6bd1900f2e18645351c3959d
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Jun 7 12:02:23 2018 +0300

    Add ooo.vba.word.Application.StatusBar property for debug output from client
    
    In many cases you don't want to use a bunch of MessageBox() calls in a
    VB6 client you are developing against LibreOffice, as that disrupts
    the working of the client. The developer might not mind, but other
    people trying it will be bothered by having to click through a stream
    of message boxes. Also, it is hard to correctly interpret the
    chronological sequence of LibreOffice's own debug output lines and
    such MessageBox() windows.
    
    WScript.Echo calls from a VBScript client are a bit better as they
    don't require any click-through, but still there is the problem of
    correlating with LibreOffice's own debug output.
    
    Setting this StatusBar property causes LibreOffice to output a
    SAL_INFO line with the tag "extensions.olebridge". Thus they are
    automatically merged with LibreOffice's own output and displayed in
    correct order.
    
    Sure, the intent of some existing 3rd-party client that sets this
    property would be to actually display a message in the status bar
    (whatever that corresponds to in LibreOffice), but until some such
    need is actually encountered, it's enough to just use it for this
    debug output functionality. After all, this property was not
    implemented at all earlier, so adding it now with somewhat special
    semantics is not a regression.
    
    (Note that on the Calc side, ooo.vba.excel.XApplication did have a
    StatusBar property already, and setting that does seem to attempt to
    display the text in some way. Possibly it should be enhanced to also
    do the SAL_INFO thing, for consistency? And possibly we should also
    have the message being displayed in the same fashion on the Writer
    side?)
    
    Change-Id: I5bf1e776d6401adfc43a558a2d919bd675298e1a
    Reviewed-on: https://gerrit.libreoffice.org/55415
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/oovbaapi/ooo/vba/word/XApplication.idl b/oovbaapi/ooo/vba/word/XApplication.idl
index 4b0f4f4e9a2a..141f9c5be2ac 100644
--- a/oovbaapi/ooo/vba/word/XApplication.idl
+++ b/oovbaapi/ooo/vba/word/XApplication.idl
@@ -39,6 +39,16 @@ interface XApplication : XConnectable
     [attribute] long Height;
     [attribute] long Left;
     [attribute] long Top;
+    // Setting this displays the string in a SAL_INFO message with tag
+    // extensions.olebridge. Provides a way to get a message from an
+    // Automation client into LibreOffice's debug output. Less
+    // disruptive than a MessageBox() in a VB6 client, for instance.
+    // And makes it possible to get merged debug output from both the client
+    // and LibreOffice in proper synchronized order.
+    //
+    // Actually write-only but there is no way to say that in UNO IDL.
+    // The getter just returns an empty string.
+    [attribute] string StatusBar;
 
     any CommandBars( [in] any Index );
     any Documents( [in] any Index );
diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx
index 897be10a8c11..fb0218511af6 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -269,6 +269,23 @@ void SAL_CALL SwVbaApplication::setTop( sal_Int32 _top )
     pWindow->setTop( _top );
 }
 
+OUString SAL_CALL SwVbaApplication::getStatusBar()
+{
+    return OUString("");
+}
+
+void SAL_CALL SwVbaApplication::setStatusBar( const OUString& _statusbar )
+{
+    // Yes, we intentionally use the "extensions.olebridge" tag here even if this is sw. We
+    // interpret setting the StatusBar property as a request from an Automation client to display
+    // the string in LibreOffice's debug output, and all other generic Automation support debug
+    // output (in extensions/source/ole) uses that tag. If the check for "cross-module" or mixed log
+    // areas in compilerplugins/clang/sallogareas.cxx is re-activated, this will have to be added as
+    // a special case.
+
+    SAL_INFO("extensions.olebridge", "Client debug output: " << _statusbar);
+}
+
 float SAL_CALL SwVbaApplication::CentimetersToPoints( float Centimeters )
 {
     return VbaApplicationBase::CentimetersToPoints( Centimeters );
diff --git a/sw/source/ui/vba/vbaapplication.hxx b/sw/source/ui/vba/vbaapplication.hxx
index 1f7f0501c06d..38f9a994bf1d 100644
--- a/sw/source/ui/vba/vbaapplication.hxx
+++ b/sw/source/ui/vba/vbaapplication.hxx
@@ -85,6 +85,8 @@ public:
     virtual void SAL_CALL setLeft( sal_Int32 _left ) override;
     virtual sal_Int32 SAL_CALL getTop() override;
     virtual void SAL_CALL setTop( sal_Int32 _top ) override;
+    virtual OUString SAL_CALL getStatusBar() override;
+    virtual void SAL_CALL setStatusBar( const OUString& _statusbar ) override;
     virtual float SAL_CALL CentimetersToPoints( float Centimeters ) override;
     virtual void SAL_CALL ShowMe() override;
     virtual void SAL_CALL Resize( sal_Int32 Width, sal_Int32 Height ) override;


More information about the Libreoffice-commits mailing list