summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-07-19 16:35:10 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-20 09:25:18 +0200
commitb266d201d9ef5328f7d6f44b772ea936099a1fe4 (patch)
tree159dca4da51ee82c10c9259a70f50f360529ebd8 /oox
parent274f47003198c058ad974b74bc60c4954d49654d (diff)
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>
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 6f5f690088c9..41a283a445d1 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>
@@ -398,8 +401,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() )
@@ -431,6 +434,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