diff options
Diffstat (limited to 'sd/source/filter/eppt/pptx-epptooxml.cxx')
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 2319b431ee8a..68b8372f2777 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -27,12 +27,14 @@ #include <oox/export/shapes.hxx> #include <comphelper/sequenceashashmap.hxx> +#include <comphelper/storagehelper.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/factory.hxx> #include <sax/fshelper.hxx> #include <rtl/ustrbuf.hxx> #include <filter/msfilter/escherex.hxx> #include <tools/poly.hxx> +#include <unotools/ucbstreamhelper.hxx> #include <com/sun/star/animations/AnimationAdditiveMode.hpp> #include <com/sun/star/animations/AnimationCalcMode.hpp> @@ -53,6 +55,7 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/RectanglePoint.hpp> +#include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/geometry/RealPoint2D.hpp> #include <com/sun/star/office/XAnnotationEnumeration.hpp> #include <com/sun/star/office/XAnnotationAccess.hpp> @@ -66,6 +69,7 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> // presentation namespaces #define PNMSS FSNS(XML_xmlns, XML_a), "http://schemas.openxmlformats.org/drawingml/2006/main", \ @@ -395,6 +399,8 @@ bool PowerPointExport::exportDocument() throw (css::uno::RuntimeException, std:: WriteAuthors(); + WriteVBA(); + mPresentationFS->endElementNS( XML_p, XML_presentation ); mPresentationFS.reset(); // Free all FSHelperPtr, to flush data before committing storage @@ -1437,7 +1443,8 @@ void PowerPointExport::WriteAuthors() sal_Int32 PowerPointExport::GetAuthorIdAndLastIndex( const OUString& sAuthor, sal_Int32& nLastIndex ) { - if ( maAuthors.count( sAuthor ) <= 0 ) { + if (maAuthors.count(sAuthor) <= 0) + { struct AuthorComments aAuthorComments; aAuthorComments.nId = maAuthors.size(); @@ -1511,6 +1518,32 @@ bool PowerPointExport::WriteComments( sal_uInt32 nPageNum ) return false; } +void PowerPointExport::WriteVBA() +{ + if (!mbPptm) + return; + + uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(getModel(), uno::UNO_QUERY); + if (!xStorageBasedDocument.is()) + return; + + uno::Reference<embed::XStorage> xDocumentStorage(xStorageBasedDocument->getDocumentStorage(), uno::UNO_QUERY); + OUString aMacrosName("_MS_VBA_Macros"); + if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName)) + return; + + const sal_Int32 nOpenMode = embed::ElementModes::READ; + uno::Reference<io::XInputStream> xMacrosStream(xDocumentStorage->openStreamElement(aMacrosName, nOpenMode), uno::UNO_QUERY); + if (!xMacrosStream.is()) + return; + + uno::Reference<io::XOutputStream> xOutputStream = openFragmentStream("ppt/vbaProject.bin", "application/vnd.ms-office.vbaProject"); + comphelper::OStorageHelper::CopyInputToOutput(xMacrosStream, xOutputStream); + + // Write the relationship. + addRelation(mPresentationFS->getOutputStream(), "http://schemas.microsoft.com/office/2006/relationships/vbaProject", "vbaProject.bin"); +} + void PowerPointExport::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 /* nMode */, bool bHasBackground, Reference< XPropertySet > const & aXBackgroundPropSet ) { |