integrate libpagemaker

Change-Id: I077d7c9a41793abdf5f001386f44ac407f94a6d3
This commit is contained in:
David Tardon 2014-06-26 21:26:11 +02:00
parent 0751477a37
commit 516fb340b1
22 changed files with 301 additions and 7 deletions

View file

@ -1910,6 +1910,39 @@ endef
endif # SYSTEM_MSPUB
ifneq ($(SYSTEM_PAGEMAKER),)
define gb_LinkTarget__use_pagemaker
$(call gb_LinkTarget_set_include,$(1),\
$$(INCLUDE) \
$(PAGEMAKER_CFLAGS) \
)
$(call gb_LinkTarget_add_libs,$(1),$(PAGEMAKER_LIBS))
endef
gb_ExternalProject__use_pagemaker :=
else # !SYSTEM_PAGEMAKER
define gb_LinkTarget__use_pagemaker
$(call gb_LinkTarget_set_include,$(1),\
-I$(call gb_UnpackedTarball_get_dir,libpagemaker)/inc \
$$(INCLUDE) \
)
$(call gb_LinkTarget_add_libs,$(1),\
$(call gb_UnpackedTarball_get_dir,libpagemaker)/src/lib/.libs/libpagemaker-0.0$(gb_StaticLibrary_PLAINEXT) \
)
$(call gb_LinkTarget_use_external_project,$(1),libpagemaker)
endef
define gb_ExternalProject__use_pagemaker
$(call gb_ExternalProject_use_external_project,$(1),libpagemaker)
endef
endif # SYSTEM_PAGEMAKER
ifneq ($(SYSTEM_VISIO),)
define gb_LinkTarget__use_visio

View file

@ -29,20 +29,20 @@ import stat
import sys
import threading, Queue
try:
from urllib.request import urlopen
from urllib.request import urlopen
except:
from urllib import urlopen
from urllib import urlopen
try:
import xmlrpc.client as xmlrpclib
import xmlrpc.client as xmlrpclib
except:
import xmlrpclib
import xmlrpclib
from xml.dom import minidom
from xml.sax.saxutils import escape
def urlopen_retry(url):
maxretries = 3
for i in range(maxretries + 1):
try:
maxretries = 3
for i in range(maxretries + 1):
try:
return urlopen(url)
except IOError as e:
print("caught IOError: " + str(e))

View file

@ -434,6 +434,8 @@ export OS_FOR_BUILD=@OS_FOR_BUILD@
export OUTPATH=@OUTPATH@
export PATH=@LO_PATH@
export LIBO_PATH_SEPARATOR=@P_SEP@
export PAGEMAKER_CFLAGS=$(gb_SPACE)@PAGEMAKER_CFLAGS@
export PAGEMAKER_LIBS=$(gb_SPACE)@PAGEMAKER_LIBS@
export PERL=@PERL@
export PKGFORMAT=@PKGFORMAT@
export PKGMK=@PKGMK@
@ -551,6 +553,7 @@ export SYSTEM_ODBC_HEADERS=@SYSTEM_ODBC_HEADERS@
export SYSTEM_ODFGEN=@SYSTEM_ODFGEN@
export SYSTEM_OPENLDAP=@SYSTEM_OPENLDAP@
export SYSTEM_OPENSSL=@SYSTEM_OPENSSL@
export SYSTEM_PAGEMAKER=@SYSTEM_PAGEMAKER@
export SYSTEM_POPPLER=@SYSTEM_POPPLER@
export SYSTEM_POSTGRESQL=@SYSTEM_POSTGRESQL@
export SYSTEM_PYTHON=@SYSTEM_PYTHON@

View file

@ -7770,6 +7770,11 @@ dnl Check for system libmwaw
dnl ===================================================================
libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
dnl ===================================================================
dnl Check for system libpagemaker
dnl ===================================================================
libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
dnl ===================================================================
dnl Check for system libvisio
dnl ===================================================================

View file

@ -110,6 +110,8 @@ export OPENCOLLADA_TARBALL := OpenCOLLADA-master-6509aa13af.tar.bz2
export OPENLDAP_TARBALL := 804c6cb5698db30b75ad0ff1c25baefd-openldap-2.4.31.tgz
export OPENSSL_TARBALL := 8d6d684a9430d5cc98a62a5d8fbda8cf-openssl-1.0.1h.tar.gz
export ORCUS_TARBALL := 7681383be6ce489d84c1c74f4e7f9643-liborcus-0.7.0.tar.bz2
export PAGEMAKER_MD5SUM := f4e44d2b3a67b5d5a18dce50366156f4
export PAGEMAKER_TARBALL := libpagemaker-0.0.0.tar.bz2
export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
export PNG_MD5SUM := 5266905cef49d1224437465ad4d67fd9
export PNG_TARBALL := libpng-1.5.18.tar.gz

View file

@ -80,6 +80,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
$(call gb_Helper_optional,OPENLDAP,openldap) \
$(call gb_Helper_optional,OPENSSL,openssl) \
$(call gb_Helper_optional,ORCUS,liborcus) \
$(call gb_Helper_optional,PAGEMAKER,libpagemaker) \
$(call gb_Helper_optional,POPPLER,poppler) \
$(call gb_Helper_optional,POSTGRESQL,postgresql) \
$(call gb_Helper_optional,PYTHON,python3) \

View file

@ -0,0 +1,41 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_ExternalProject_ExternalProject,libpagemaker))
$(eval $(call gb_ExternalProject_use_autoconf,libpagemaker,build))
$(eval $(call gb_ExternalProject_register_targets,libpagemaker,\
build \
))
$(eval $(call gb_ExternalProject_use_externals,libpagemaker,\
boost_headers \
revenge \
))
$(call gb_ExternalProject_get_state_target,libpagemaker,build) :
$(call gb_ExternalProject_run,build,\
export PKG_CONFIG="" \
&& ./configure \
--with-pic \
--enable-static \
--disable-shared \
--without-docs \
--disable-tools \
--disable-debug \
--disable-werror \
--disable-weffc \
$(if $(VERBOSE)$(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(if $(SYSTEM_BOOST),$(BOOST_CPPFLAGS),-I$(call gb_UnpackedTarball_get_dir,boost) -I$(BUILDDIR)/config_$(gb_Side))" \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
&& $(MAKE) \
)
# vim: set noet sw=4 ts=4:

7
external/libpagemaker/Makefile vendored Normal file
View file

@ -0,0 +1,7 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../../solenv/gbuild/partial_build.mk
# vim: set noet sw=4 ts=4:

View file

@ -0,0 +1,17 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_Module_Module,libpagemaker))
$(eval $(call gb_Module_add_targets,libpagemaker,\
ExternalProject_libpagemaker \
UnpackedTarball_libpagemaker \
))
# vim: set noet sw=4 ts=4:

1
external/libpagemaker/README vendored Normal file
View file

@ -0,0 +1 @@
Library parsing Adobe PageMaker documents.

View file

@ -0,0 +1,14 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_UnpackedTarball_UnpackedTarball,libpagemaker))
$(eval $(call gb_UnpackedTarball_set_tarball,libpagemaker,$(PAGEMAKER_TARBALL)))
# vim: set noet sw=4 ts=4:

View file

@ -624,6 +624,7 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_draw_types.xcu,filter/s
draw_Mac_Works \
draw_MacPaint \
draw_SuperPaint \
draw_PageMaker_Document \
)
$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.xcu,filter/source/config/fragments/filters,\
@ -645,6 +646,7 @@ $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.xcu,filt
Mac_Works_Draw \
MacPaint_Draw \
SuperPaint_Draw \
PageMakerDocument \
)
$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\

View file

@ -0,0 +1,13 @@
<node oor:name="PageMaker Document" oor:op="replace">
<prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>org.libreoffice.comp.Draw.PageMakerImportFilter</value></prop>
<prop oor:name="UserData"><value></value></prop>
<prop oor:name="UIName">
<value xml:lang="en-US">Adobe PageMaker</value>
</prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>draw_PageMaker_Document</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
</node>

View file

@ -0,0 +1,12 @@
<node oor:name="draw_PageMaker_Document" oor:op="replace" >
<prop oor:name="DetectService"><value>org.libreoffice.comp.Draw.PageMakerImportFilter</value></prop>
<prop oor:name="URLPattern"/>
<prop oor:name="Extensions"><value>p65 pm pm6 pmd</value></prop>
<prop oor:name="MediaType"><value>application/x-pagemaker</value></prop>
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>PageMaker Document</value></prop>
<prop oor:name="UIName">
<value>Adobe PageMaker</value>
</prop>
<prop oor:name="ClipboardFormat"/>
</node>

View file

@ -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 \

View file

@ -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: */

View file

@ -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: */

View file

@ -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>

View file

@ -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,