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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 23 21:48:56 UTC 2019


 oovbaapi/ooo/vba/word/XWordBasic.idl |    1 +
 sw/source/ui/vba/vbaapplication.cxx  |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit e4b3fd40e583fbcbeba0bfb0a1457c1f92e1cb0f
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Jan 23 18:33:50 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Jan 23 18:35:44 2019 +0200

    Add WordBasic.FileClose()
    
    Change-Id: Ifc48e5fbcc212f0e80cf6877e2781910e38e5e54

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl b/oovbaapi/ooo/vba/word/XWordBasic.idl
index d704b92b122c..5150a431401b 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -18,6 +18,7 @@ interface XWordBasic
 
     void FileOpen( [in] string Name, [in] any ConfirmConversions, [in] any ReadOnly, [in] any AddToMru, [in] any PasswordDoc, [in] any PasswordDot, [in] any Revert, [in] any WritePasswordDoc, [in] any WritePasswordDot );
     void FileSave();
+    void FileClose( [in] any Save );
     void ToolsOptionsView( [in] any DraftFont, [in] any WrapToWindow, [in] any PicturePlaceHolders, [in] any FieldCodes, [in] any BookMarks, [in] any FieldShading, [in] any StatusBar, [in] any HScroll, [in] any VScroll, [in] any StyleAreaWidth, [in] any Tabs, [in] any Spaces, [in] any Paras, [in] any Hyphens, [in] any Hidden, [in] any ShowAll, [in] any Drawings, [in] any Anchors, [in] any TextBoundaries, [in] any VRuler, [in] any Highlight );
     string WindowName();
     boolean ExistingBookmark( [in] string Name );
diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx
index 1a49c04635ab..a8279c18b413 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -76,6 +76,7 @@ public:
 
     virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override;
     virtual void SAL_CALL FileSave() override;
+    virtual void SAL_CALL FileClose( const css::uno::Any& Save ) override;
     virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& DraftFont,
                                             const css::uno::Any& WrapToWindow,
                                             const css::uno::Any& PicturePlaceHolders,
@@ -541,6 +542,25 @@ SwWordBasic::FileSave()
 }
 
 void SAL_CALL
+SwWordBasic::FileClose( const css::uno::Any& Save )
+{
+    uno::Reference< frame::XModel > xModel( mpApp->getCurrentDocument(), uno::UNO_SET_THROW );
+
+    sal_Bool bSave = false;
+    if (Save.hasValue() && (Save >>= bSave) && bSave)
+        FileSave();
+
+    // FIXME: Here I would much prefer to call VbaDocumentBase::Close() but not sure how to get at
+    // the VbaDocumentBase of the current document. (Probably it is easy and I haven't looked hard
+    // enough.)
+    //
+    // FIXME: Error handling. If there is no current document, return some kind of error? But for
+    // now, just ignore errors. This code is written to work for a very specific customer use case
+    // ayway, not for an arbitrary sequence of COM calls to the "VBA" API.
+    dispatchRequests(xModel,".uno:CloseDoc");
+}
+
+void SAL_CALL
 SwWordBasic::ToolsOptionsView( const css::uno::Any& DraftFont,
                                const css::uno::Any& WrapToWindow,
                                const css::uno::Any& PicturePlaceHolders,


More information about the Libreoffice-commits mailing list