summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-07-19 16:35:10 +0200
committerJan Holesovsky <kendy@collabora.com>2017-07-21 19:48:29 +0200
commitee6f8f1982d666f8fcda96d2141a9332a10b8273 (patch)
tree91e0be943b7ea20f5fca5b6eeee64f1756cf6996 /oox
parentlok: Add docm/xlsm/pptm filters to be known by LOK. (diff)
downloadcore-ee6f8f1982d666f8fcda96d2141a9332a10b8273.tar.gz
core-ee6f8f1982d666f8fcda96d2141a9332a10b8273.zip
sd pptm: Preserve the VBA stream on export.
This actually implements the reading of the VBA stream in Impress too, so the user will get a warning when opening such a file (that the it contains macros). Change-Id: I1638199529196ed217cbd9ebef88eb7c88f2179a Reviewed-on: https://gerrit.libreoffice.org/40197 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/40267 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx37
1 files changed, 26 insertions, 11 deletions
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index a41284c3177f..4ef9ea282dea 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
@@ -34,16 +35,18 @@
#include <com/sun/star/presentation/XPresentationPage.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
-#include "oox/drawingml/theme.hxx"
-#include "oox/drawingml/drawingmltypes.hxx"
-#include "oox/drawingml/themefragmenthandler.hxx"
-#include "drawingml/textliststylecontext.hxx"
+#include <oox/drawingml/theme.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
+#include <oox/drawingml/themefragmenthandler.hxx>
+#include <drawingml/textliststylecontext.hxx>
#include <oox/helper/attributelist.hxx>
-#include "oox/ppt/pptshape.hxx"
-#include "oox/ppt/presentationfragmenthandler.hxx"
-#include "oox/ppt/slidefragmenthandler.hxx"
-#include "oox/ppt/layoutfragmenthandler.hxx"
-#include "oox/ppt/pptimport.hxx"
+#include <oox/ole/olestorage.hxx>
+#include <oox/ole/vbaproject.hxx>
+#include <oox/ppt/pptshape.hxx>
+#include <oox/ppt/presentationfragmenthandler.hxx>
+#include <oox/ppt/slidefragmenthandler.hxx>
+#include <oox/ppt/layoutfragmenthandler.hxx>
+#include <oox/ppt/pptimport.hxx>
#include <oox/token/namespaces.hxx>
#include <oox/token/tokens.hxx>
@@ -394,8 +397,8 @@ void PresentationFragmentHandler::finalizeImport()
StringRangeEnumerator aRangeEnumerator( aPageRange, 0, nPageCount - 1 );
StringRangeEnumerator::Iterator aIter = aRangeEnumerator.begin();
StringRangeEnumerator::Iterator aEnd = aRangeEnumerator.end();
- if(aIter!=aEnd) {
-
+ if (aIter!=aEnd)
+ {
// todo: localized progress bar text
const Reference< task::XStatusIndicator >& rxStatusIndicator( getFilter().getStatusIndicator() );
if ( rxStatusIndicator.is() )
@@ -424,6 +427,18 @@ void PresentationFragmentHandler::finalizeImport()
if ( rxStatusIndicator.is() )
rxStatusIndicator->end();
}
+
+ // open the VBA project storage
+ OUString aVbaFragmentPath = getFragmentPathFromFirstType(CREATE_MSOFFICE_RELATION_TYPE("vbaProject"));
+ if (!aVbaFragmentPath.isEmpty())
+ {
+ uno::Reference<io::XInputStream> xInStrm = getFilter().openInputStream(aVbaFragmentPath);
+ if (xInStrm.is())
+ {
+ StorageRef xPrjStrg(new oox::ole::OleStorage(getFilter().getComponentContext(), xInStrm, false));
+ getFilter().getVbaProject().importVbaProject(*xPrjStrg);
+ }
+ }
}
// CT_Presentation