integrate libzmf
Change-Id: I0c7ea5b56ea4ed4839ff38798c0b915aaca81774 Reviewed-on: https://gerrit.libreoffice.org/26574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com>
This commit is contained in:
parent
878a860dff
commit
aaed6fe55a
19 changed files with 297 additions and 0 deletions
|
@ -209,6 +209,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
|
|||
$(call fetch_Optional,WPS,WPS_TARBALL) \
|
||||
$(call fetch_Optional,XSLTML,XSLTML_TARBALL) \
|
||||
$(call fetch_Optional,ZLIB,ZLIB_TARBALL) \
|
||||
$(call fetch_Optional,ZMF,ZMF_TARBALL) \
|
||||
,$(call fetch_Download_item,http://dev-www.libreoffice.org/src,$(item)))
|
||||
$(foreach item, \
|
||||
$(call fetch_Optional,DBGHELP,DBGHELP_DLL) \
|
||||
|
|
|
@ -2001,6 +2001,39 @@ endef
|
|||
endif # SYSTEM_PAGEMAKER
|
||||
|
||||
|
||||
ifneq ($(SYSTEM_ZMF),)
|
||||
|
||||
define gb_LinkTarget__use_zmf
|
||||
$(call gb_LinkTarget_set_include,$(1),\
|
||||
$$(INCLUDE) \
|
||||
$(ZMF_CFLAGS) \
|
||||
)
|
||||
$(call gb_LinkTarget_add_libs,$(1),$(ZMF_LIBS))
|
||||
|
||||
endef
|
||||
gb_ExternalProject__use_zmf :=
|
||||
|
||||
else # !SYSTEM_ZMF
|
||||
|
||||
define gb_LinkTarget__use_zmf
|
||||
$(call gb_LinkTarget_set_include,$(1),\
|
||||
-I$(call gb_UnpackedTarball_get_dir,libzmf)/inc \
|
||||
$$(INCLUDE) \
|
||||
)
|
||||
$(call gb_LinkTarget_add_libs,$(1),\
|
||||
$(call gb_UnpackedTarball_get_dir,libzmf)/src/lib/.libs/libzmf-0.0$(gb_StaticLibrary_PLAINEXT) \
|
||||
)
|
||||
$(call gb_LinkTarget_use_external_project,$(1),libzmf)
|
||||
|
||||
endef
|
||||
define gb_ExternalProject__use_zmf
|
||||
$(call gb_ExternalProject_use_external_project,$(1),libzmf)
|
||||
|
||||
endef
|
||||
|
||||
endif # SYSTEM_ZMF
|
||||
|
||||
|
||||
ifneq ($(SYSTEM_VISIO),)
|
||||
|
||||
define gb_LinkTarget__use_visio
|
||||
|
|
|
@ -585,6 +585,7 @@ export SYSTEM_WPD=@SYSTEM_WPD@
|
|||
export SYSTEM_WPG=@SYSTEM_WPG@
|
||||
export SYSTEM_WPS=@SYSTEM_WPS@
|
||||
export SYSTEM_ZLIB=@SYSTEM_ZLIB@
|
||||
export SYSTEM_ZMF=@SYSTEM_ZMF@
|
||||
export TARFILE_LOCATION=@TARFILE_LOCATION@
|
||||
export TDE_CFLAGS=$(gb_SPACE)@TDE_CFLAGS@
|
||||
export TDE_LIBS=$(gb_SPACE)@TDE_LIBS@
|
||||
|
@ -655,6 +656,8 @@ export XRENDER_LIBS=$(gb_SPACE)@XRENDER_LIBS@
|
|||
export XSLTPROC=@XSLTPROC@
|
||||
export ZLIB_CFLAGS=$(gb_SPACE)@ZLIB_CFLAGS@
|
||||
export ZLIB_LIBS=$(gb_SPACE)@ZLIB_LIBS@
|
||||
export ZMF_CFLAGS=$(gb_SPACE)@ZMF_CFLAGS@
|
||||
export ZMF_LIBS=$(gb_SPACE)@ZMF_LIBS@
|
||||
|
||||
# lang-related stuff
|
||||
include $(BUILDDIR)/config_$(gb_Side)_lang.mk
|
||||
|
|
|
@ -7872,6 +7872,11 @@ dnl Check for system libpagemaker
|
|||
dnl ===================================================================
|
||||
libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
|
||||
|
||||
dnl ===================================================================
|
||||
dnl Check for system libzmf
|
||||
dnl ===================================================================
|
||||
libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
|
||||
|
||||
dnl ===================================================================
|
||||
dnl Check for system libvisio
|
||||
dnl ===================================================================
|
||||
|
|
|
@ -164,6 +164,8 @@ export WPS_TARBALL := libwps-0.4.$(WPS_VERSION_MICRO).tar.bz2
|
|||
export XSLTML_TARBALL := a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip
|
||||
export ZLIB_MD5SUM := 44d667c142d7cda120332623eab69f40
|
||||
export ZLIB_TARBALL := zlib-1.2.8.tar.gz
|
||||
export ZMF_MD5SUM := b64a7780bfef91e0a953f436366b2047
|
||||
export ZMF_TARBALL := libzmf-0.0.0.tar.bz2
|
||||
|
||||
export MOZ_ZIP_INC := $(OS)$(COM)$(if $(filter INTEL,$(CPUNAME)),I,X)inc.zip
|
||||
export MOZ_ZIP_LIB := $(OS)$(COM)$(if $(filter INTEL,$(CPUNAME)),I,X)lib.zip
|
||||
|
|
1
external/Module_external.mk
vendored
1
external/Module_external.mk
vendored
|
@ -86,6 +86,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
|
|||
$(call gb_Helper_optional,ORCUS,liborcus) \
|
||||
$(call gb_Helper_optional,OWNCLOUD_ANDROID_LIB,owncloud-android-lib) \
|
||||
$(call gb_Helper_optional,PAGEMAKER,libpagemaker) \
|
||||
$(call gb_Helper_optional,ZMF,libzmf) \
|
||||
$(call gb_Helper_optional,POPPLER,poppler) \
|
||||
$(call gb_Helper_optional,POSTGRESQL,postgresql) \
|
||||
$(call gb_Helper_optional,PYTHON,$(if $(filter $(PYTHON_VERSION_MINOR),3),python33,python3)) \
|
||||
|
|
43
external/libzmf/ExternalProject_libzmf.mk
vendored
Normal file
43
external/libzmf/ExternalProject_libzmf.mk
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
# -*- 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,libzmf))
|
||||
|
||||
$(eval $(call gb_ExternalProject_use_autoconf,libzmf,build))
|
||||
|
||||
$(eval $(call gb_ExternalProject_register_targets,libzmf,\
|
||||
build \
|
||||
))
|
||||
|
||||
$(eval $(call gb_ExternalProject_use_externals,libzmf,\
|
||||
boost_headers \
|
||||
revenge \
|
||||
))
|
||||
|
||||
$(call gb_ExternalProject_get_state_target,libzmf,build) :
|
||||
$(call gb_ExternalProject_run,build,\
|
||||
export PKG_CONFIG="" \
|
||||
&& MAKE=$(MAKE) ./configure \
|
||||
--with-pic \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--without-docs \
|
||||
--disable-tools \
|
||||
--disable-debug \
|
||||
--disable-werror \
|
||||
--disable-weffc \
|
||||
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
|
||||
CXXFLAGS="$(CXXFLAGS) $(CXXFLAGS_CXX11) $(if $(SYSTEM_BOOST),$(BOOST_CPPFLAGS),-I$(call gb_UnpackedTarball_get_dir,boost))" \
|
||||
REVENGE_GENERATORS_CFLAGS=' ' REVENGE_GENERATORS_LIBS=' ' REVENGE_STREAM_CFLAGS=' ' REVENGE_STREAM_LIBS=' ' \
|
||||
ax_cv_cxx_compile_cxx11=yes \
|
||||
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
|
||||
&& $(MAKE) -C src/lib \
|
||||
)
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
7
external/libzmf/Makefile
vendored
Normal file
7
external/libzmf/Makefile
vendored
Normal 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:
|
17
external/libzmf/Module_libzmf.mk
vendored
Normal file
17
external/libzmf/Module_libzmf.mk
vendored
Normal 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,libzmf))
|
||||
|
||||
$(eval $(call gb_Module_add_targets,libzmf,\
|
||||
ExternalProject_libzmf \
|
||||
UnpackedTarball_libzmf \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
6
external/libzmf/README
vendored
Normal file
6
external/libzmf/README
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
libzmf is a library and a set of tools for reading and converting
|
||||
Zoner Draw and Zebra file formats.
|
||||
|
||||
libzmf requires boost and librevenge to build.
|
||||
|
||||
The library is available under MPL 2.0+ license.
|
24
external/libzmf/UnpackedTarball_libzmf.mk
vendored
Normal file
24
external/libzmf/UnpackedTarball_libzmf.mk
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- 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,libzmf))
|
||||
|
||||
$(eval $(call gb_UnpackedTarball_set_tarball,libzmf,$(ZMF_TARBALL)))
|
||||
|
||||
$(eval $(call gb_UnpackedTarball_set_patchlevel,libzmf,0))
|
||||
|
||||
ifeq ($(COM_IS_CLANG),TRUE)
|
||||
ifneq ($(filter -fsanitize=%,$(CC)),)
|
||||
$(eval $(call gb_UnpackedTarball_add_patches,libzmf, \
|
||||
external/libzmf/ubsan-visibility.patch \
|
||||
))
|
||||
endif
|
||||
endif
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
11
external/libzmf/ubsan-visibility.patch
vendored
Normal file
11
external/libzmf/ubsan-visibility.patch
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- configure
|
||||
+++ configure
|
||||
@@ -16787,7 +16787,7 @@
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fvisibility=hidden compiler flag" >&5
|
||||
$as_echo_n "checking for -fvisibility=hidden compiler flag... " >&6; }
|
||||
saved_CXXFLAGS="$CXXFLAGS"
|
||||
- CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
|
||||
+ CXXFLAGS="$CXXFLAGS -fvisibility-ms-compat"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
|
@ -547,6 +547,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_draw_types.xcu,f
|
|||
draw_Visio_Document \
|
||||
draw_ClarisWorks \
|
||||
draw_PageMaker_Document \
|
||||
draw_ZMF_Document \
|
||||
MWAW_Bitmap \
|
||||
MWAW_Drawing \
|
||||
))
|
||||
|
@ -566,6 +567,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.x
|
|||
FreehandDocument \
|
||||
ClarisWorks_Draw \
|
||||
PageMakerDocument \
|
||||
ZMFDocument \
|
||||
MWAW_Bitmap \
|
||||
MWAW_Drawing \
|
||||
))
|
||||
|
|
13
filter/source/config/fragments/filters/ZMFDocument.xcu
Normal file
13
filter/source/config/fragments/filters/ZMFDocument.xcu
Normal file
|
@ -0,0 +1,13 @@
|
|||
<node oor:name="ZMF Document" oor:op="replace">
|
||||
<prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
|
||||
<prop oor:name="UIComponent"/>
|
||||
<prop oor:name="FilterService"><value>org.libreoffice.comp.Draw.ZMFImportFilter</value></prop>
|
||||
<prop oor:name="UserData"/>
|
||||
<prop oor:name="UIName">
|
||||
<value xml:lang="en-US">Zoner Callisto/Draw</value>
|
||||
</prop>
|
||||
<prop oor:name="FileFormatVersion"><value>0</value></prop>
|
||||
<prop oor:name="Type"><value>draw_ZMF_Document</value></prop>
|
||||
<prop oor:name="TemplateName"/>
|
||||
<prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
|
||||
</node>
|
12
filter/source/config/fragments/types/draw_ZMF_Document.xcu
Normal file
12
filter/source/config/fragments/types/draw_ZMF_Document.xcu
Normal file
|
@ -0,0 +1,12 @@
|
|||
<node oor:name="draw_ZMF_Document" oor:op="replace" >
|
||||
<prop oor:name="DetectService"><value>org.libreoffice.comp.Draw.ZMFImportFilter</value></prop>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>zmf</value></prop>
|
||||
<prop oor:name="MediaType"/>
|
||||
<prop oor:name="Preferred"><value>true</value></prop>
|
||||
<prop oor:name="PreferredFilter"><value>ZMF Document</value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value>Zoner Callisto/Draw</value>
|
||||
</prop>
|
||||
<prop oor:name="ClipboardFormat"/>
|
||||
</node>
|
|
@ -56,6 +56,7 @@ $(eval $(call gb_Library_use_externals,wpftdraw,\
|
|||
wpg \
|
||||
wpd \
|
||||
zlib \
|
||||
zmf \
|
||||
lcms2 \
|
||||
libxml2 \
|
||||
icui18n \
|
||||
|
@ -71,6 +72,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftdraw,\
|
|||
writerperfect/source/draw/PageMakerImportFilter \
|
||||
writerperfect/source/draw/VisioImportFilter \
|
||||
writerperfect/source/draw/WPGImportFilter \
|
||||
writerperfect/source/draw/ZMFImportFilter \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
|
|
69
writerperfect/source/draw/ZMFImportFilter.cxx
Normal file
69
writerperfect/source/draw/ZMFImportFilter.cxx
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ZMFImportFilter: 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 <libzmf/libzmf.h>
|
||||
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
|
||||
#include "ZMFImportFilter.hxx"
|
||||
|
||||
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 ZMFImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
|
||||
{
|
||||
return libzmf::ZMFDocument::parse(&rInput, &rGenerator);
|
||||
}
|
||||
|
||||
bool ZMFImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
|
||||
{
|
||||
if (libzmf::ZMFDocument::isSupported(&rInput))
|
||||
{
|
||||
rTypeName = "draw_ZMF_Document";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
OUString SAL_CALL ZMFImportFilter::getImplementationName()
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
return OUString("org.libreoffice.comp.Draw.ZMFImportFilter");
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL ZMFImportFilter::supportsService(const OUString &rServiceName)
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
return cppu::supportsService(this, rServiceName);
|
||||
}
|
||||
|
||||
Sequence< OUString > SAL_CALL ZMFImportFilter::getSupportedServiceNames()
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
return Sequence< OUString >{"com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection"};
|
||||
}
|
||||
|
||||
extern "C"
|
||||
SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
|
||||
org_libreoffice_comp_Draw_ZMFImportFilter_get_implementation(
|
||||
css::uno::XComponentContext *const context,
|
||||
const css::uno::Sequence<css::uno::Any> &)
|
||||
{
|
||||
return cppu::acquire(new ZMFImportFilter(context));
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
41
writerperfect/source/draw/ZMFImportFilter.hxx
Normal file
41
writerperfect/source/draw/ZMFImportFilter.hxx
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* -*- 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 INCLUDED_WRITERPERFECT_SOURCE_DRAW_ZMFIMPORTFILTER_HXX
|
||||
#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_ZMFIMPORTFILTER_HXX
|
||||
|
||||
#include "ImportFilter.hxx"
|
||||
|
||||
#include "DocumentHandlerForOdg.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 ZMFImportFilter : public writerperfect::ImportFilter<OdgGenerator>
|
||||
{
|
||||
public:
|
||||
explicit ZMFImportFilter(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
|
||||
: writerperfect::ImportFilter<OdgGenerator>(rxContext)
|
||||
{
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName()
|
||||
throw (css::uno::RuntimeException, std::exception) override;
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
|
||||
throw (css::uno::RuntimeException, std::exception) override;
|
||||
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
|
||||
throw (css::uno::RuntimeException, std::exception) override;
|
||||
|
||||
private:
|
||||
virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override;
|
||||
virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -49,4 +49,9 @@
|
|||
<service name="com.sun.star.document.ImportFilter"/>
|
||||
<service name="com.sun.star.document.ExtendedTypeDetection"/>
|
||||
</implementation>
|
||||
<implementation name="org.libreoffice.comp.Draw.ZMFImportFilter"
|
||||
constructor="org_libreoffice_comp_Draw_ZMFImportFilter_get_implementation">
|
||||
<service name="com.sun.star.document.ImportFilter"/>
|
||||
<service name="com.sun.star.document.ExtendedTypeDetection"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
|
Loading…
Reference in a new issue