summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2011-03-02 11:20:45 +0000
committerNoel Power <noel.power@novell.com>2011-03-02 11:36:54 +0000
commitf2dbae8892340230265136c193606aa01f754ade (patch)
tree3f1127c80a8407798dfc1c86d8b4431123e23179
parent09be9031ce3e3ffb6cc40f45ac5e1a4192adcb15 (diff)
resolves fdo#34909
enable import of macros for docxm
-rw-r--r--oox/inc/oox/helper/graphichelper.hxx2
-rw-r--r--oox/inc/oox/ole/olestorage.hxx2
-rw-r--r--oox/inc/oox/ole/vbaproject.hxx2
-rw-r--r--oox/prj/d.lst2
-rw-r--r--writerfilter/inc/ooxml/OOXMLDocument.hxx2
-rw-r--r--writerfilter/source/filter/ImportFilter.cxx20
-rw-r--r--writerfilter/source/ooxml/OOXMLStreamImpl.cxx4
7 files changed, 30 insertions, 4 deletions
diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx
index 1a07f23f3..5134ef677 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 dc97f9711..97108a62f 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 fc10e1de3..24863c2bd 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 e8a689b58..e2f066c4a 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 b6d45c5a1..0566e191a 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 a84ec89fd..1942adcd6 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 843381aec..ba48c20fa 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;