diff options
-rw-r--r-- | filter/Configuration_filter.mk | 2 | ||||
-rw-r--r-- | filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu | 2 | ||||
-rw-r--r-- | filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_VBA.xcu | 30 | ||||
-rw-r--r-- | filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu | 2 | ||||
-rw-r--r-- | filter/source/config/fragments/types/MS_PowerPoint_2007_XML_VBA.xcu | 28 | ||||
-rw-r--r-- | oox/source/core/filterdetect.cxx | 6 | ||||
-rw-r--r-- | oox/source/ppt/pptimport.cxx | 18 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptooxml.hxx | 9 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 77 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 5 | ||||
-rw-r--r-- | sd/util/sdfilt.component | 2 |
11 files changed, 110 insertions, 71 deletions
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index 0ed0d6170419..c39e5e03aba7 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -597,6 +597,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impress_types.xc MS_PowerPoint_2007_XML \ MS_PowerPoint_2007_XML_AutoPlay \ MS_PowerPoint_2007_XML_Template \ + MS_PowerPoint_2007_XML_VBA \ impress_OOXML_Presentation \ impress_OOXML_Presentation_Template \ impress_OOXML_Presentation_AutoPlay \ @@ -622,6 +623,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impress_filter impress_MS_PowerPoint_2007_XML \ impress_MS_PowerPoint_2007_XML_AutoPlay \ impress_MS_PowerPoint_2007_XML_Template \ + impress_MS_PowerPoint_2007_XML_VBA \ impress_OOXML \ impress_OOXML_Template \ impress_OOXML_AutoPlay \ diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu index 8814d1e4413d..08d17d688a3b 100644 --- a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu +++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu @@ -27,4 +27,4 @@ <prop oor:name="UIName"> <value xml:lang="en-US">Microsoft PowerPoint 2007-2013 XML</value> </prop> - </node> +</node> diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_VBA.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_VBA.xcu new file mode 100644 index 000000000000..3f52eea5eea8 --- /dev/null +++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_VBA.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> +<node oor:name="Impress MS PowerPoint 2007 XML VBA" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED ENCRYPTION PASSWORDTOMODIFY SUPPORTSSIGNING</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"><value>com.sun.star.comp.oox.ppt.PowerPointImport</value></prop> + <prop oor:name="UserData"><value>macro-enabled</value></prop> + <prop oor:name="FileFormatVersion"/> + <prop oor:name="Type"><value>MS PowerPoint 2007 XML VBA</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">Microsoft PowerPoint 2007-2013 XML VBA</value> + </prop> +</node> diff --git a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu index b709d6b8804d..5c3fdc2e4c31 100644 --- a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu +++ b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu @@ -18,7 +18,7 @@ <node oor:name="MS PowerPoint 2007 XML" oor:op="replace" > <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop> <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>pptx pptm</value></prop> + <prop oor:name="Extensions"><value>pptx</value></prop> <prop oor:name="MediaType"><value>application/vnd.openxmlformats-officedocument.presentationml.presentation</value></prop> <prop oor:name="Preferred"><value>true</value></prop> <prop oor:name="PreferredFilter"><value>Impress MS PowerPoint 2007 XML</value></prop> diff --git a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML_VBA.xcu b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML_VBA.xcu new file mode 100644 index 000000000000..4e4519f29794 --- /dev/null +++ b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML_VBA.xcu @@ -0,0 +1,28 @@ + +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> +<node oor:name="MS PowerPoint 2007 XML VBA" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>pptm</value></prop> + <prop oor:name="MediaType"><value>application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml</value></prop> + <prop oor:name="Preferred"><value>true</value></prop> + <prop oor:name="PreferredFilter"><value>Impress MS PowerPoint 2007 XML VBA</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Microsoft PowerPoint 2007-2013 XML VBA</value></prop> + <prop oor:name="ClipboardFormat"/> +</node> diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index f36c6496157f..24e47c1ca7c2 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -192,10 +192,12 @@ OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& r if ( rContentType == "application/vnd.ms-excel.sheet.binary.macroEnabled.main" ) return OUString( "MS Excel 2007 Binary" ); - if( rContentType == "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml" || - rContentType == "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml" ) + if (rContentType == "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml") return OUString( "MS PowerPoint 2007 XML" ); + if (rContentType == "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml") + return OUString( "MS PowerPoint 2007 XML VBA" ); + if( rContentType == "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml" || rContentType == "application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml" ) return OUString( "MS PowerPoint 2007 XML AutoPlay" ); diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index 30d3d2951b24..446a054ffd91 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <comphelper/propertysequence.hxx> #include <osl/diagnose.h> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> @@ -216,14 +217,23 @@ sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDe if( XmlFilterBase::filter( rDescriptor ) ) return true; - if( isExportFilter() ) { - Reference< XExporter > xExporter( Reference<css::lang::XMultiServiceFactory>(getComponentContext()->getServiceManager(), UNO_QUERY_THROW)->createInstance( "com.sun.star.comp.Impress.oox.PowerPointExport" ), UNO_QUERY ); + if (isExportFilter()) + { + uno::Sequence<uno::Any> aArguments(comphelper::InitAnySequence( + { + {"IsPPTM", uno::makeAny(exportVBA())}, + })); + + Reference<css::lang::XMultiServiceFactory> aFactory(getComponentContext()->getServiceManager(), UNO_QUERY_THROW); + Reference< XExporter > xExporter(aFactory->createInstanceWithArguments("com.sun.star.comp.Impress.oox.PowerPointExport", aArguments), UNO_QUERY); - if( xExporter.is() ) { + if (xExporter.is()) + { Reference< XComponent > xDocument( getModel(), UNO_QUERY ); Reference< XFilter > xFilter( xExporter, UNO_QUERY ); - if( xFilter.is() ) { + if (xFilter.is()) + { xExporter->setSourceDocument( xDocument ); if( xFilter->filter( rDescriptor ) ) return true; diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx index 2c486a778ce1..cc60f76d8089 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -39,8 +39,6 @@ namespace oox { } namespace core { -class PowerPointShapeExport; - struct LayoutInfo { std::vector< sal_Int32 > mnFileIdArray; @@ -65,7 +63,7 @@ class PowerPointExport : public XmlFilterBase, public PPTWriterBase friend class PowerPointShapeExport; public: - PowerPointExport( const css::uno::Reference< css::uno::XComponentContext > & rxCtxt ); + PowerPointExport(const css::uno::Reference<css::uno::XComponentContext> & rContext, const css::uno::Sequence<css::uno::Any>& rArguments); virtual ~PowerPointExport() override; @@ -134,6 +132,9 @@ private: virtual OUString SAL_CALL getImplementationName() override; + /// Should we export as .pptm, ie. do we contain macros? + bool mbPptm; + ::sax_fastparser::FSHelperPtr mPresentationFS; LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE]; @@ -146,8 +147,6 @@ private: bool mbCreateNotes; - static sal_Int32 nStyleLevelToken[5]; - ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap; struct AuthorComments { diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 5795a339ce23..c359859358a6 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -27,6 +27,7 @@ #include <epptdef.hxx> #include <oox/export/shapes.hxx> +#include <comphelper/sequenceashashmap.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/factory.hxx> #include <sax/fshelper.hxx> @@ -95,15 +96,15 @@ using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::container::XIndexAccess; using ::sax_fastparser::FSHelperPtr; - +using namespace oox::drawingml; +using namespace oox::core; #if OSL_DEBUG_LEVEL > 1 void dump_pset(Reference< XPropertySet > const & rXPropSet); #endif namespace oox { - using namespace drawingml; - namespace core { +namespace core { class PowerPointShapeExport : public ShapeExport { @@ -124,6 +125,9 @@ public: bool WritePlaceholder( const Reference< XShape >& xShape, PlaceholderType ePlaceholder, bool bMaster ); }; +} +} + enum PPTXLayout { LAYOUT_BLANK, LAYOUT_TITLE_SLIDE, @@ -315,8 +319,8 @@ ShapeExport& PowerPointShapeExport::WriteUnknownShape( const Reference< XShape > return *this; } -PowerPointExport::PowerPointExport( const Reference< XComponentContext > & rxCtxt ) - : XmlFilterBase(rxCtxt) +PowerPointExport::PowerPointExport(const Reference< XComponentContext > & rContext, const uno::Sequence<uno::Any>& rArguments) + : XmlFilterBase(rContext) , PPTWriterBase() , mnLayoutFileIdMax(1) , mnSlideIdMax(1 << 8) @@ -324,6 +328,8 @@ PowerPointExport::PowerPointExport( const Reference< XComponentContext > & rxCtx , mnAnimationNodeIdMax(1) , mbCreateNotes(false) { + comphelper::SequenceAsHashMap aArgumentsMap(rArguments); + mbPptm = aArgumentsMap.getUnpackedValueOrDefault("IsPPTM", false); } PowerPointExport::~PowerPointExport() @@ -358,8 +364,12 @@ bool PowerPointExport::exportDocument() addRelation( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", "ppt/presentation.xml" ); - mPresentationFS = openFragmentStreamWithSerializer( "ppt/presentation.xml", - "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml" ); + // PPTM needs a different media type for the presentation.xml stream. + OUString aMediaType("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"); + if (mbPptm) + aMediaType = "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml"; + + mPresentationFS = openFragmentStreamWithSerializer("ppt/presentation.xml", aMediaType); addRelation( mPresentationFS->getOutputStream(), "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", @@ -1658,15 +1668,6 @@ void PowerPointExport::AddLayoutIdAndRelation( const FSHelperPtr& pFS, sal_Int32 FSEND ); } -sal_Int32 PowerPointExport::nStyleLevelToken[5] = -{ - XML_lvl1pPr, - XML_lvl2pPr, - XML_lvl3pPr, - XML_lvl4pPr, - XML_lvl5pPr -}; - void PowerPointExport::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > const & aXBackgroundPropSet ) { SAL_INFO("sd.eppt", "write slide master: " << nPageNum << "\n--------------"); @@ -2286,51 +2287,17 @@ bool PowerPointExport::ImplCreateMainNotes() return true; } -OUString SAL_CALL PowerPointExport_getImplementationName() throw() -{ - return OUString( "com.sun.star.comp.Impress.oox.PowerPointExport" ); -} - -uno::Sequence< OUString > SAL_CALL PowerPointExport_getSupportedServiceNames() throw() -{ - return Sequence< OUString >(); -} - -/// @throws uno::Exception -uno::Reference< uno::XInterface > SAL_CALL PowerPointExport_createInstance(const uno::Reference< XComponentContext > & rxCtxt ) -{ - return static_cast<cppu::OWeakObject*>(new PowerPointExport( rxCtxt )); -} - OUString PowerPointExport::getImplementationName() { - return PowerPointExport_getImplementationName(); -} -} + return OUString("com.sun.star.comp.Impress.oox.PowerPointExport"); } // UNO component - -static const struct cppu::ImplementationEntry g_entries[] = -{ - { - oox::core::PowerPointExport_createInstance, - oox::core::PowerPointExport_getImplementationName, - oox::core::PowerPointExport_getSupportedServiceNames, - cppu::createSingleComponentFactory, - nullptr , 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -extern "C" +extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL +css_comp_Impress_oox_PowerPointExport(uno::XComponentContext* rxCtxt, + uno::Sequence<css::uno::Any> const& rArguments) { - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL sdfilt_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey ) -{ - return cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); -} - + return cppu::acquire(new PowerPointExport(rxCtxt, rArguments)); } #if OSL_DEBUG_LEVEL > 1 diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index c124c564a5a1..6c077ab3ae1a 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -387,8 +387,9 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium, uno::Reference<text::XTextRange> const& xInsertPosition) { const OUString aFilterName( rMedium.GetFilter()->GetFilterName() ); - if( aFilterName == "Impress MS PowerPoint 2007 XML" || - aFilterName == "Impress MS PowerPoint 2007 XML AutoPlay" ) + if (aFilterName == "Impress MS PowerPoint 2007 XML" || + aFilterName == "Impress MS PowerPoint 2007 XML AutoPlay" || + aFilterName == "Impress MS PowerPoint 2007 XML VBA") { // As this is a MSFT format, we should use the "MS Compat" // mode for spacing before and after paragraphs. diff --git a/sd/util/sdfilt.component b/sd/util/sdfilt.component index aca7724c625a..134a79f2d30a 100644 --- a/sd/util/sdfilt.component +++ b/sd/util/sdfilt.component @@ -9,5 +9,5 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" prefix="sdfilt" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.Impress.oox.PowerPointExport"/> + <implementation name="com.sun.star.comp.Impress.oox.PowerPointExport" constructor="css_comp_Impress_oox_PowerPointExport"/> </component> |