diff options
author | Tor Lillqvist <tml@collabora.com> | 2019-01-23 18:33:50 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2019-09-20 10:58:50 +0200 |
commit | 489ff389d166f95ff65597724e8958e96916608c (patch) | |
tree | 9884caa6f60b12cfdc16e9ac75dbd1dfe54a1a03 /sw | |
parent | 1beb93822b8f34afc481fd3ea6e99795b6fa6dbd (diff) |
Add WordBasic.FileClose()
Change-Id: Ifc48e5fbcc212f0e80cf6877e2781910e38e5e54
(cherry picked from commit e4b3fd40e583fbcbeba0bfb0a1457c1f92e1cb0f)
Reviewed-on: https://gerrit.libreoffice.org/79155
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/vba/vbaapplication.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index d3689de69efb..12e7c2e80dd5 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -77,6 +77,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, @@ -542,6 +543,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, |