diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
commit | 9beefd6ebe5eb283711e4acbd37a3218bcf4ec76 (patch) | |
tree | 7f3839e36e2cd8edf26189cf87195cec47c787c1 /writerfilter | |
parent | 416fc7a2be488e0e0234e88455761f62b8a6ac5a (diff) | |
parent | 39f317ff5b64c9a00484921c5dda290ef33b03d1 (diff) |
merge commit
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/filter/ImportFilter.cxx | 42 | ||||
-rw-r--r-- | writerfilter/util/makefile.mk | 5 |
2 files changed, 26 insertions, 21 deletions
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index b67b7dd283ac..af27bac94540 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -32,6 +32,8 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/io/XInputStream.hpp> +#include <comphelper/mediadescriptor.hxx> +#include <oox/core/filterdetect.hxx> #include <dmapper/DomainMapper.hxx> #include <WriterFilter.hxx> #include <doctok/WW8Document.hxx> @@ -44,6 +46,7 @@ #include <resourcemodel/TagLogger.hxx> using namespace ::rtl; using namespace ::com::sun::star; +using ::comphelper::MediaDescriptor; /*-- 09.06.2006 10:15:20--------------------------------------------------- @@ -62,28 +65,29 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes if (!xExprtr.is() || !xFltr.is()) return sal_False; xExprtr->setSourceDocument(m_xSrcDoc); - if (xFltr->filter(aDescriptor)) - return sal_True; - return sal_False; + return xFltr->filter(aDescriptor); } else if (m_xDstDoc.is()) { - - sal_Int32 nLength = aDescriptor.getLength(); - const beans::PropertyValue * pValue = aDescriptor.getConstArray(); - uno::Reference < io::XInputStream > xInputStream; - ::rtl::OUString sFilterName; - for ( sal_Int32 i = 0 ; i < nLength; i++) - { - if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) ) - pValue[i].Value >>= xInputStream; - else if( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "FilterName" ) ) ) - pValue[i].Value >>= sFilterName; - } - if ( !xInputStream.is() ) - { - return sal_False; - } + MediaDescriptor aMediaDesc( aDescriptor ); + OUString sFilterName = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_FILTERNAME(), OUString() ); + + uno::Reference< io::XInputStream > xInputStream; + try + { + // use the oox.core.FilterDetect implementation to extract the decrypted ZIP package + uno::Reference< lang::XMultiServiceFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); + ::oox::core::FilterDetect aDetector( xFactory ); + xInputStream = aDetector.extractUnencryptedPackage( aMediaDesc ); + } + catch( uno::Exception& ) + { + } + + if ( !xInputStream.is() ) + { + return sal_False; + } #ifdef DEBUG_ELEMENT writerfilter::TagLogger::Pointer_t debugLogger diff --git a/writerfilter/util/makefile.mk b/writerfilter/util/makefile.mk index 08033ab9c8df..4e99764c688f 100644 --- a/writerfilter/util/makefile.mk +++ b/writerfilter/util/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -63,7 +63,8 @@ SHL1STDLIBS=\ $(CPPUHELPERLIB) \ $(COMPHELPERLIB) \ $(CPPULIB) \ - $(SALLIB) + $(SALLIB) \ + $(OOXLIB) SHL1DEPN= |