From 5f14947e09b3986e6ed56b58efcb196eb76a984c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 22 May 2019 19:30:37 +0300 Subject: Add ooo.vba.word.XDocument.SavePreviewPngAs() and implement This is for COLEAT's internal use. Change-Id: If1ac2a5b251129e4431d3c0bde82529d6bdc7ccc (cherry picked from commit 41f996044ad752faa19ed6cde4b659d38e74ea07) Reviewed-on: https://gerrit.libreoffice.org/79215 Reviewed-by: Tor Lillqvist Tested-by: Tor Lillqvist --- sw/source/ui/vba/vbadocument.cxx | 16 ++++++++++++++++ sw/source/ui/vba/vbadocument.hxx | 1 + 2 files changed, 17 insertions(+) (limited to 'sw/source') diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index ba0bfc27189b..ff5d3b4ffdc7 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -518,6 +518,22 @@ SwVbaDocument::SaveAs( const uno::Any& FileName, const uno::Any& FileFormat, con return SaveAs2000( FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter ); } +void SAL_CALL +SwVbaDocument::SavePreviewPngAs( const uno::Any& FileName ) +{ + OUString sFileName; + FileName >>= sFileName; + OUString sURL; + osl::FileBase::getFileURLFromSystemPath( sFileName, sURL ); + + uno::Sequence< beans::PropertyValue > storeProps(1); + storeProps[0].Name = "FilterName" ; + storeProps[0].Value <<= OUString("writer_png_Export"); + + uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW ); + xStor->storeToURL( sURL, storeProps ); +} + uno::Any SwVbaDocument::getControlShape( const OUString& sName ) { diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx index 1acb42e9232f..af4c93f32f95 100644 --- a/sw/source/ui/vba/vbadocument.hxx +++ b/sw/source/ui/vba/vbadocument.hxx @@ -90,6 +90,7 @@ public: virtual css::uno::Any SAL_CALL Frames( const css::uno::Any& aIndex ) override; virtual void SAL_CALL SaveAs2000( const css::uno::Any& FileName, const css::uno::Any& FileFormat, const css::uno::Any& LockComments, const css::uno::Any& Password, const css::uno::Any& AddToRecentFiles, const css::uno::Any& WritePassword, const css::uno::Any& ReadOnlyRecommended, const css::uno::Any& EmbedTrueTypeFonts, const css::uno::Any& SaveNativePictureFormat, const css::uno::Any& SaveFormsData, const css::uno::Any& SaveAsAOCELetter ) override; virtual void SAL_CALL SaveAs( const css::uno::Any& FileName, const css::uno::Any& FileFormat, const css::uno::Any& LockComments, const css::uno::Any& Password, const css::uno::Any& AddToRecentFiles, const css::uno::Any& WritePassword, const css::uno::Any& ReadOnlyRecommended, const css::uno::Any& EmbedTrueTypeFonts, const css::uno::Any& SaveNativePictureFormat, const css::uno::Any& SaveFormsData, const css::uno::Any& SaveAsAOCELetter, const css::uno::Any& Encoding, const css::uno::Any& InsertLineBreaks, const css::uno::Any& AllowSubstitutions, const css::uno::Any& LineEnding, const css::uno::Any& AddBiDiMarks ) override; + virtual void SAL_CALL SavePreviewPngAs( const css::uno::Any& FileName ) override; // XInvocation virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) override; -- cgit