summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-06-26 21:26:11 +0200
committerDavid Tardon <dtardon@redhat.com>2014-06-27 10:39:29 +0200
commit516fb340b1842a5deec3de61e47bb5a7ec5c1980 (patch)
treefb2ba6511bffdb9321f2802723b73fa156882204 /writerperfect
parent0751477a375e0b6bb82c5aa47c9e666d6dc2ba8c (diff)
integrate libpagemaker
Change-Id: I077d7c9a41793abdf5f001386f44ac407f94a6d3
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/Library_wpftdraw.mk2
-rw-r--r--writerperfect/qa/unit/data/draw/libpagemaker/fail/.gitignore0
-rw-r--r--writerperfect/qa/unit/data/draw/libpagemaker/indeterminate/.gitignore0
-rw-r--r--writerperfect/qa/unit/data/draw/libpagemaker/pass/shapes.pmdbin0 -> 96256 bytes
-rw-r--r--writerperfect/source/draw/PageMakerImportFilter.cxx83
-rw-r--r--writerperfect/source/draw/PageMakerImportFilter.hxx49
-rw-r--r--writerperfect/source/draw/wpftdraw.component4
-rw-r--r--writerperfect/source/draw/wpftdraw_genericfilter.cxx5
8 files changed, 143 insertions, 0 deletions
diff --git a/writerperfect/Library_wpftdraw.mk b/writerperfect/Library_wpftdraw.mk
index 01a1ebe506ca..973431c7c442 100644
--- a/writerperfect/Library_wpftdraw.mk
+++ b/writerperfect/Library_wpftdraw.mk
@@ -42,6 +42,7 @@ $(eval $(call gb_Library_use_externals,wpftdraw,\
mspub \
mwaw \
odfgen \
+ pagemaker \
revenge \
visio \
wpg \
@@ -60,6 +61,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftdraw,\
writerperfect/source/draw/ImportFilterBase \
writerperfect/source/draw/MSPUBImportFilter \
writerperfect/source/draw/MWAWDrawImportFilter \
+ writerperfect/source/draw/PageMakerImportFilter \
writerperfect/source/draw/VisioImportFilter \
writerperfect/source/draw/WPGImportFilter \
writerperfect/source/draw/wpftdraw_genericfilter \
diff --git a/writerperfect/qa/unit/data/draw/libpagemaker/fail/.gitignore b/writerperfect/qa/unit/data/draw/libpagemaker/fail/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/writerperfect/qa/unit/data/draw/libpagemaker/fail/.gitignore
diff --git a/writerperfect/qa/unit/data/draw/libpagemaker/indeterminate/.gitignore b/writerperfect/qa/unit/data/draw/libpagemaker/indeterminate/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/writerperfect/qa/unit/data/draw/libpagemaker/indeterminate/.gitignore
diff --git a/writerperfect/qa/unit/data/draw/libpagemaker/pass/shapes.pmd b/writerperfect/qa/unit/data/draw/libpagemaker/pass/shapes.pmd
new file mode 100644
index 000000000000..40e7df8b2f74
--- /dev/null
+++ b/writerperfect/qa/unit/data/draw/libpagemaker/pass/shapes.pmd
Binary files differ
diff --git a/writerperfect/source/draw/PageMakerImportFilter.cxx b/writerperfect/source/draw/PageMakerImportFilter.cxx
new file mode 100644
index 000000000000..a43cfaeb59e1
--- /dev/null
+++ b/writerperfect/source/draw/PageMakerImportFilter.cxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* PageMakerImportFilter: Sets up the filter, and calls OdgExporter
+ * to do the actual filtering
+ *
+ * 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/.
+ */
+
+#include <libodfgen/libodfgen.hxx>
+
+#include <libpagemaker/libpagemaker.h>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/supportsservice.hxx>
+
+#include "PageMakerImportFilter.hxx"
+
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::XComponentContext;
+using com::sun::star::uno::XInterface;
+
+bool PageMakerImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator )
+{
+ return libpagemaker::PMDocument::parse(&rInput, &rGenerator);
+}
+
+bool PageMakerImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName )
+{
+ if (libpagemaker::PMDocument::isSupported(&rInput))
+ {
+ rTypeName = "draw_PageMaker_Document";
+ return true;
+ }
+
+ return false;
+}
+
+OUString PageMakerImportFilter_getImplementationName ()
+throw (RuntimeException)
+{
+ return OUString( "org.libreoffice.comp.Draw.PageMakerImportFilter" );
+}
+
+Sequence< OUString > SAL_CALL PageMakerImportFilter_getSupportedServiceNames( )
+throw (RuntimeException)
+{
+ Sequence< OUString > aRet(2);
+ OUString *pArray = aRet.getArray();
+ pArray[0] = "com.sun.star.document.ImportFilter";
+ pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
+ return aRet;
+}
+
+Reference< XInterface > SAL_CALL PageMakerImportFilter_createInstance( const Reference< XComponentContext > & rContext)
+throw( Exception )
+{
+ return (cppu::OWeakObject *) new PageMakerImportFilter( rContext );
+}
+
+// XServiceInfo
+OUString SAL_CALL PageMakerImportFilter::getImplementationName( )
+throw (RuntimeException, std::exception)
+{
+ return PageMakerImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL PageMakerImportFilter::supportsService( const OUString &rServiceName )
+throw (RuntimeException, std::exception)
+{
+ return cppu::supportsService( this, rServiceName );
+}
+Sequence< OUString > SAL_CALL PageMakerImportFilter::getSupportedServiceNames( )
+throw (RuntimeException, std::exception)
+{
+ return PageMakerImportFilter_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/PageMakerImportFilter.hxx b/writerperfect/source/draw/PageMakerImportFilter.hxx
new file mode 100644
index 000000000000..cc9ef994209d
--- /dev/null
+++ b/writerperfect/source/draw/PageMakerImportFilter.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef _PAGEMAKERIMPORTFILTER_HXX
+#define _PAGEMAKERIMPORTFILTER_HXX
+
+#include "ImportFilterBase.hxx"
+
+/* This component will be instantiated for both import or export. Whether it calls
+ * setSourceDocument or setTargetDocument determines which Impl function the filter
+ * member calls */
+class PageMakerImportFilter : public writerperfect::draw::ImportFilterBase
+{
+public:
+ PageMakerImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext )
+ : writerperfect::draw::ImportFilterBase( rxContext )
+ {
+ }
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual sal_Bool SAL_CALL supportsService( const OUString &ServiceName )
+ throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+private:
+ virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE;
+ virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) SAL_OVERRIDE;
+};
+
+OUString PageMakerImportFilter_getImplementationName()
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL PageMakerImportFilter_getSupportedServiceNames( )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL PageMakerImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rContext)
+throw ( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/wpftdraw.component b/writerperfect/source/draw/wpftdraw.component
index cc65f3c778d0..efc56736efdd 100644
--- a/writerperfect/source/draw/wpftdraw.component
+++ b/writerperfect/source/draw/wpftdraw.component
@@ -37,4 +37,8 @@
<service name="com.sun.star.document.ImportFilter"/>
<service name="com.sun.star.document.ExtendedTypeDetection"/>
</implementation>
+ <implementation name="org.libreoffice.comp.Draw.PageMakerImportFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
</component>
diff --git a/writerperfect/source/draw/wpftdraw_genericfilter.cxx b/writerperfect/source/draw/wpftdraw_genericfilter.cxx
index 821ac7c14161..e80014123fdd 100644
--- a/writerperfect/source/draw/wpftdraw_genericfilter.cxx
+++ b/writerperfect/source/draw/wpftdraw_genericfilter.cxx
@@ -33,6 +33,7 @@
#include "CMXImportFilter.hxx"
#include "MSPUBImportFilter.hxx"
#include "MWAWDrawImportFilter.hxx"
+#include "PageMakerImportFilter.hxx"
#include "FreehandImportFilter.hxx"
#include "VisioImportFilter.hxx"
#include "WPGImportFilter.hxx"
@@ -50,6 +51,10 @@ static cppu::ImplementationEntry const services[] = {
&FreehandImportFilter_getImplementationName,
&FreehandImportFilter_getSupportedServiceNames,
&cppu::createSingleComponentFactory, 0, 0 },
+ { &PageMakerImportFilter_createInstance,
+ &PageMakerImportFilter_getImplementationName,
+ &PageMakerImportFilter_getSupportedServiceNames,
+ &cppu::createSingleComponentFactory, 0, 0 },
{ &MSPUBImportFilter_createInstance,
&MSPUBImportFilter_getImplementationName,
&MSPUBImportFilter_getSupportedServiceNames,