diff options
-rw-r--r-- | oox/inc/oox/helper/graphichelper.hxx | 2 | ||||
-rw-r--r-- | oox/inc/oox/ole/olestorage.hxx | 2 | ||||
-rw-r--r-- | oox/inc/oox/ole/vbaproject.hxx | 2 | ||||
-rw-r--r-- | oox/prj/d.lst | 2 | ||||
-rw-r--r-- | writerfilter/inc/ooxml/OOXMLDocument.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/filter/ImportFilter.cxx | 20 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLStreamImpl.cxx | 4 |
7 files changed, 30 insertions, 4 deletions
diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx index 61504adea8ba..b6f09a25316b 100644 --- a/oox/inc/oox/helper/graphichelper.hxx +++ b/oox/inc/oox/helper/graphichelper.hxx @@ -65,7 +65,7 @@ namespace oox { resolves the graphic object from the passed URL and thus prevents it from being destroyed. */ -class GraphicHelper +class OOX_DLLPUBLIC GraphicHelper { public: explicit GraphicHelper( diff --git a/oox/inc/oox/ole/olestorage.hxx b/oox/inc/oox/ole/olestorage.hxx index ab2c02a21486..e76cb7e89d6b 100644 --- a/oox/inc/oox/ole/olestorage.hxx +++ b/oox/inc/oox/ole/olestorage.hxx @@ -42,7 +42,7 @@ namespace ole { // ============================================================================ /** Implements stream access for binary OLE storages. */ -class OleStorage : public StorageBase +class OOX_DLLPUBLIC OleStorage : public StorageBase { public: explicit OleStorage( diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx index fc10e1de3e62..24863c2bd314 100644 --- a/oox/inc/oox/ole/vbaproject.hxx +++ b/oox/inc/oox/ole/vbaproject.hxx @@ -70,7 +70,7 @@ private: // ============================================================================ -class VbaProject : public VbaFilterConfig +class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig { public: explicit VbaProject( diff --git a/oox/prj/d.lst b/oox/prj/d.lst index e8a689b58908..e2f066c4a7e6 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -41,6 +41,8 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls ..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx ..\inc\oox\export\*.hxx %_DEST%\inc%_EXT%\oox\export\*.hxx ..\inc\oox\ole\oleobjecthelper.hxx %_DEST%\inc%_EXT%\oox\ole\oleobjecthelper.hxx +..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx +..\inc\oox\ole\olestorage.hxx %_DEST%\inc%_EXT%\oox\ole\olestorage.hxx dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx index 3d83905b61a3..3a0b3904908c 100644 --- a/writerfilter/inc/ooxml/OOXMLDocument.hxx +++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx @@ -84,7 +84,7 @@ class WRITERFILTER_DLLPUBLIC OOXMLStream { public: enum StreamType_t { UNKNOWN, DOCUMENT, STYLES, FONTTABLE, NUMBERING, - FOOTNOTES, ENDNOTES, COMMENTS, THEME, SETTINGS }; + FOOTNOTES, ENDNOTES, COMMENTS, THEME, SETTINGS, VBAPROJECT }; typedef boost::shared_ptr<OOXMLStream> Pointer_t; virtual ~OOXMLStream() {} diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index 91f3d3d3f8d9..4eac9ed72279 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -42,6 +42,9 @@ #endif #include <resourcemodel/TagLogger.hxx> +#include <oox/ole/olestorage.hxx> +#include <oox/ole/vbaproject.hxx> +#include <oox/helper/graphichelper.hxx> using namespace ::rtl; using namespace ::com::sun::star; using ::comphelper::MediaDescriptor; @@ -124,6 +127,23 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes pDocument->setDrawPage(xDrawPage); pDocument->resolve(*pStream); + writerfilter::ooxml::OOXMLStream::Pointer_t pVBAProjectStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream( pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT )); + oox::StorageRef xVbaPrjStrg( new ::oox::ole::OleStorage( uno::Reference< lang::XMultiServiceFactory >( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ), pVBAProjectStream->getDocumentStream(), false ) ); + if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() ) + { + ::oox::ole::VbaProject aVbaProject( uno::Reference< lang::XMultiServiceFactory >( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ), xModel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Writer" ) ) ); + uno::Reference< frame::XFrame > xFrame = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_FRAME(), uno::Reference< frame::XFrame > () ); + + // if no XFrame try fallback to what we can glean from the Model + if ( !xFrame.is() ) + { + uno::Reference< frame::XController > xController = xModel->getCurrentController(); + xFrame = xController.is() ? xController->getFrame() : NULL; + } + + oox::GraphicHelper gHelper( uno::Reference< lang::XMultiServiceFactory >( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ), xFrame, xVbaPrjStrg ); + aVbaProject.importVbaProject( *xVbaPrjStrg, gHelper ); + } } else { diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx index 62c746828619..2cb058ea65d4 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx @@ -115,11 +115,15 @@ bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess> static rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("Target")); static rtl::OUString sTargetMode(RTL_CONSTASCII_USTRINGPARAM("TargetMode")); static rtl::OUString sExternal(RTL_CONSTASCII_USTRINGPARAM("External")); + static rtl::OUString sVBAProjectType(RTL_CONSTASCII_USTRINGPARAM("http://schemas.microsoft.com/office/2006/relationships/vbaProject")); rtl::OUString sStreamType; switch (nStreamType) { + case VBAPROJECT: + sStreamType = sVBAProjectType; + break; case DOCUMENT: sStreamType = sDocumentType; break; |