[Libreoffice-commits] .: postprocess/packcomponents Repository.mk scp2/source writerperfect/Library_cdrimport.mk writerperfect/Library_msworks.mk writerperfect/Library_visioimport.mk writerperfect/Library_wpftdraw.mk writerperfect/Library_wpft.mk writerperfect/Library_wpftwriter.mk writerperfect/Library_wpgimport.mk writerperfect/Module_writerperfect.mk writerperfect/source writerperfect/util
Fridrich Strba
fridrich at kemper.freedesktop.org
Thu Apr 19 05:38:20 PDT 2012
Repository.mk | 7
postprocess/packcomponents/makefile.mk | 7
scp2/source/graphicfilter/file_graphicfilter.scp | 6
scp2/source/graphicfilter/module_graphicfilter.scp | 3
scp2/source/ooo/file_library_ooo.scp | 4
scp2/source/writer/module_writer.scp | 3
writerperfect/Library_cdrimport.mk | 72 --
writerperfect/Library_msworks.mk | 69 --
writerperfect/Library_visioimport.mk | 69 --
writerperfect/Library_wpft.mk | 71 --
writerperfect/Library_wpftdraw.mk | 75 ++
writerperfect/Library_wpftwriter.mk | 73 ++
writerperfect/Library_wpgimport.mk | 68 --
writerperfect/Module_writerperfect.mk | 26
writerperfect/source/cdrimp/CDRImportFilter.cxx | 276 --------
writerperfect/source/cdrimp/CDRImportFilter.hxx | 110 ---
writerperfect/source/cdrimp/CMXImportFilter.cxx | 276 --------
writerperfect/source/cdrimp/CMXImportFilter.hxx | 110 ---
writerperfect/source/cdrimp/cdrimport_genericfilter.cxx | 82 --
writerperfect/source/draw/CDRImportFilter.cxx | 276 ++++++++
writerperfect/source/draw/CDRImportFilter.hxx | 110 +++
writerperfect/source/draw/CMXImportFilter.cxx | 276 ++++++++
writerperfect/source/draw/CMXImportFilter.hxx | 110 +++
writerperfect/source/draw/VisioImportFilter.cxx | 276 ++++++++
writerperfect/source/draw/VisioImportFilter.hxx | 110 +++
writerperfect/source/draw/WPGImportFilter.cxx | 275 ++++++++
writerperfect/source/draw/WPGImportFilter.hxx | 110 +++
writerperfect/source/draw/wpftdraw_genericfilter.cxx | 110 +++
writerperfect/source/vsdimp/VisioImportFilter.cxx | 276 --------
writerperfect/source/vsdimp/VisioImportFilter.hxx | 115 ---
writerperfect/source/vsdimp/visioimport_genericfilter.cxx | 68 --
writerperfect/source/wpdimp/WordPerfectImportFilter.cxx | 461 --------------
writerperfect/source/wpdimp/WordPerfectImportFilter.hxx | 176 -----
writerperfect/source/wpdimp/wpft_genericfilter.cxx | 67 --
writerperfect/source/wpgimp/WPGImportFilter.cxx | 275 --------
writerperfect/source/wpgimp/WPGImportFilter.hxx | 115 ---
writerperfect/source/wpgimp/wpgimport_genericfilter.cxx | 68 --
writerperfect/source/wpsimp/MSWorksImportFilter.cxx | 277 --------
writerperfect/source/wpsimp/MSWorksImportFilter.hxx | 112 ---
writerperfect/source/wpsimp/msworks_genericfilter.cxx | 68 --
writerperfect/source/writer/MSWorksImportFilter.cxx | 277 ++++++++
writerperfect/source/writer/MSWorksImportFilter.hxx | 112 +++
writerperfect/source/writer/WordPerfectImportFilter.cxx | 461 ++++++++++++++
writerperfect/source/writer/WordPerfectImportFilter.hxx | 176 +++++
writerperfect/source/writer/wpftwriter_genericfilter.cxx | 81 ++
writerperfect/util/cdrfilter.component | 12
writerperfect/util/msworksfilter.component | 8
writerperfect/util/visiofilter.component | 8
writerperfect/util/wpft.component | 35 -
writerperfect/util/wpftdraw.component | 20
writerperfect/util/wpftwriter.component | 39 +
writerperfect/util/wpgfilter.component | 8
52 files changed, 2983 insertions(+), 3392 deletions(-)
New commits:
commit 9284c50f975ce91fcb50e3849bbe38af50dbcb6c
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Thu Apr 19 14:33:09 2012 +0200
Diminish the number of writerperfect libraries
Instead of a pleiade of libraries, one for graphic filters (wpftdraw)
and one for text document filters (wpftwriter) to diminish duplicate
static linking.
diff --git a/Repository.mk b/Repository.mk
index 37a872c..fa75986 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -277,7 +277,6 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \
merged \
msfilter \
msword \
- msworks \
odfflatxml \
offacc \
pcr \
@@ -338,10 +337,8 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \
vclplug_kde \
vclplug_kde4 \
vclplug_svp \
- cdrimport \
- visioimport \
- wpft \
- wpgimport \
+ wpftdraw \
+ wpftwriter \
writerfilter \
xcr \
xmlfa \
diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk
index c8067e2..b921281 100644
--- a/postprocess/packcomponents/makefile.mk
+++ b/postprocess/packcomponents/makefile.mk
@@ -205,11 +205,8 @@ my_components += \
my_components += \
component/writerfilter/util/writerfilter \
- component/writerperfect/util/msworksfilter \
- component/writerperfect/util/visiofilter \
- component/writerperfect/util/wpft \
- component/writerperfect/util/wpgfilter \
- component/writerperfect/util/cdrfilter \
+ component/writerperfect/util/wpftwriter \
+ component/writerperfect/util/wpftdraw \
.ENDIF
diff --git a/scp2/source/graphicfilter/file_graphicfilter.scp b/scp2/source/graphicfilter/file_graphicfilter.scp
index 17761de..ee58421 100644
--- a/scp2/source/graphicfilter/file_graphicfilter.scp
+++ b/scp2/source/graphicfilter/file_graphicfilter.scp
@@ -38,8 +38,4 @@ STD_LIB_FILE( gid_File_Lib_Flash, flash )
STD_LIB_FILE( gid_File_Lib_Svg, svgfilter )
-STD_FILTER_FILE( gid_File_Lib_WPGImport, wpgimport )
-
-STD_FILTER_FILE( gid_File_Lib_VisioImport, visioimport )
-
-STD_FILTER_FILE( gid_File_Lib_CDRImport, cdrimport )
+STD_FILTER_FILE( gid_File_Lib_WpftDraw, wpftdraw )
diff --git a/scp2/source/graphicfilter/module_graphicfilter.scp b/scp2/source/graphicfilter/module_graphicfilter.scp
index dd66724..f428c0c 100644
--- a/scp2/source/graphicfilter/module_graphicfilter.scp
+++ b/scp2/source/graphicfilter/module_graphicfilter.scp
@@ -33,7 +33,6 @@ Module gid_Module_Optional_Grfflt
Sortkey = "600";
ParentID = gid_Module_Optional;
Default = YES;
- Files = (gid_File_Lib_Svg, gid_File_Lib_Flash, gid_File_Lib_WPGImport,
- gid_File_Lib_VisioImport, gid_File_Lib_CDRImport,
+ Files = (gid_File_Lib_Svg, gid_File_Lib_Flash, gid_File_Lib_WpftDraw,
gid_File_Share_Registry_Graphicfilter_Xcd);
End
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index 1f3b605..63b2f8f 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -888,9 +888,7 @@ End
#endif
-STD_LIB_FILE(gid_File_Lib_Wpft,wpft)
-
-STD_LIB_FILE(gid_File_Lib_Msworks,msworks)
+STD_LIB_FILE(gid_File_Lib_WpftWriter,wpftwriter)
STD_LIB_FILE(gid_File_Lib_T602Filter,t602filter)
diff --git a/scp2/source/writer/module_writer.scp b/scp2/source/writer/module_writer.scp
index e66214b..33b9e44 100644
--- a/scp2/source/writer/module_writer.scp
+++ b/scp2/source/writer/module_writer.scp
@@ -48,8 +48,7 @@ Module gid_Module_Prg_Wrt_Bin
gid_File_Lib_Swd,
gid_File_Lib_Swui,
gid_File_Lib_Msword,
- gid_File_Lib_Wpft,
- gid_File_Lib_Msworks,
+ gid_File_Lib_WpftWriter,
gid_File_Lib_T602Filter,
gid_File_Lib_Writerfilter,
gid_File_Lib_Wlwp,
diff --git a/writerperfect/Library_cdrimport.mk b/writerperfect/Library_cdrimport.mk
deleted file mode 100644
index 257757c..0000000
--- a/writerperfect/Library_cdrimport.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2011 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-$(eval $(call gb_Library_Library,cdrimport))
-
-$(eval $(call gb_Library_set_componentfile,cdrimport,writerperfect/util/cdrfilter))
-
-$(eval $(call gb_Library_set_include,cdrimport,\
- $$(INCLUDE) \
- -I$(SRCDIR)/writerperfect/source \
-))
-
-$(eval $(call gb_Library_use_api,cdrimport,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_Library_use_libraries,cdrimport,\
- cppu \
- cppuhelper \
- sal \
- sot \
- tl \
- utl \
- xo \
- $(gb_STDLIBS) \
-))
-
-$(eval $(call gb_Library_use_static_libraries,cdrimport,\
- writerperfect \
-))
-
-$(eval $(call gb_Library_use_externals,cdrimport,\
- wpd \
- wpg \
- cdr \
- lcms2 \
- zlib \
-))
-
-$(eval $(call gb_Library_add_exception_objects,cdrimport,\
- writerperfect/source/cdrimp/CDRImportFilter \
- writerperfect/source/cdrimp/CMXImportFilter \
- writerperfect/source/cdrimp/cdrimport_genericfilter \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Library_msworks.mk b/writerperfect/Library_msworks.mk
deleted file mode 100644
index 7efb994..0000000
--- a/writerperfect/Library_msworks.mk
+++ /dev/null
@@ -1,69 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2011 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-$(eval $(call gb_Library_Library,msworks))
-
-$(eval $(call gb_Library_set_componentfile,msworks,writerperfect/util/msworksfilter))
-
-$(eval $(call gb_Library_set_include,msworks,\
- $$(INCLUDE) \
- -I$(SRCDIR)/writerperfect/source \
-))
-
-$(eval $(call gb_Library_use_api,msworks,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_Library_use_libraries,msworks,\
- cppu \
- cppuhelper \
- sal \
- sot \
- ucbhelper \
- tl \
- utl \
- xo \
- $(gb_STDLIBS) \
-))
-
-$(eval $(call gb_Library_use_static_libraries,msworks,\
- writerperfect \
-))
-
-$(eval $(call gb_Library_use_externals,msworks,\
- wpd \
- wps \
-))
-
-$(eval $(call gb_Library_add_exception_objects,msworks,\
- writerperfect/source/wpsimp/MSWorksImportFilter \
- writerperfect/source/wpsimp/msworks_genericfilter \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Library_visioimport.mk b/writerperfect/Library_visioimport.mk
deleted file mode 100644
index 7db2b04..0000000
--- a/writerperfect/Library_visioimport.mk
+++ /dev/null
@@ -1,69 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2011 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-$(eval $(call gb_Library_Library,visioimport))
-
-$(eval $(call gb_Library_set_componentfile,visioimport,writerperfect/util/visiofilter))
-
-$(eval $(call gb_Library_set_include,visioimport,\
- $$(INCLUDE) \
- -I$(SRCDIR)/writerperfect/source \
-))
-
-$(eval $(call gb_Library_use_api,visioimport,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_Library_use_libraries,visioimport,\
- cppu \
- cppuhelper \
- sal \
- sot \
- tl \
- utl \
- xo \
- $(gb_STDLIBS) \
-))
-
-$(eval $(call gb_Library_use_static_libraries,visioimport,\
- writerperfect \
-))
-
-$(eval $(call gb_Library_use_externals,visioimport,\
- wpd \
- wpg \
- visio \
-))
-
-$(eval $(call gb_Library_add_exception_objects,visioimport,\
- writerperfect/source/vsdimp/VisioImportFilter \
- writerperfect/source/vsdimp/visioimport_genericfilter \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Library_wpft.mk b/writerperfect/Library_wpft.mk
deleted file mode 100644
index 113cb17..0000000
--- a/writerperfect/Library_wpft.mk
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2011 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-$(eval $(call gb_Library_Library,wpft))
-
-$(eval $(call gb_Library_set_componentfile,wpft,writerperfect/util/wpft))
-
-$(eval $(call gb_Library_set_include,wpft,\
- $$(INCLUDE) \
- -I$(SRCDIR)/writerperfect/source \
-))
-
-$(eval $(call gb_Library_use_api,wpft,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_Library_use_libraries,wpft,\
- cppu \
- cppuhelper \
- vcl \
- sal \
- sfx \
- sot \
- tl \
- ucbhelper \
- utl \
- xo \
- $(gb_STDLIBS) \
-))
-
-$(eval $(call gb_Library_use_static_libraries,wpft,\
- writerperfect \
-))
-
-$(eval $(call gb_Library_use_externals,wpft,\
- wpd \
- wpg \
-))
-
-$(eval $(call gb_Library_add_exception_objects,wpft,\
- writerperfect/source/wpdimp/WordPerfectImportFilter \
- writerperfect/source/wpdimp/wpft_genericfilter \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Library_wpftdraw.mk b/writerperfect/Library_wpftdraw.mk
new file mode 100644
index 0000000..e4c3b51
--- /dev/null
+++ b/writerperfect/Library_wpftdraw.mk
@@ -0,0 +1,75 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,wpftdraw))
+
+$(eval $(call gb_Library_set_componentfile,wpftdraw,writerperfect/util/wpftdraw))
+
+$(eval $(call gb_Library_set_include,wpftdraw,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/writerperfect/source \
+))
+
+$(eval $(call gb_Library_use_api,wpftdraw,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_Library_use_libraries,wpftdraw,\
+ cppu \
+ cppuhelper \
+ sal \
+ sot \
+ tl \
+ utl \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_use_static_libraries,wpftdraw,\
+ writerperfect \
+))
+
+$(eval $(call gb_Library_use_externals,wpftdraw,\
+ wpd \
+ wpg \
+ visio \
+ cdr \
+ lcms2 \
+ zlib \
+))
+
+$(eval $(call gb_Library_add_exception_objects,wpftdraw,\
+ writerperfect/source/draw/CDRImportFilter \
+ writerperfect/source/draw/CMXImportFilter \
+ writerperfect/source/draw/VisioImportFilter \
+ writerperfect/source/draw/WPGImportFilter \
+ writerperfect/source/draw/wpftdraw_genericfilter \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk
new file mode 100644
index 0000000..6110035
--- /dev/null
+++ b/writerperfect/Library_wpftwriter.mk
@@ -0,0 +1,73 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,wpftwriter))
+
+$(eval $(call gb_Library_set_componentfile,wpftwriter,writerperfect/util/wpftwriter))
+
+$(eval $(call gb_Library_set_include,wpftwriter,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/writerperfect/source \
+))
+
+$(eval $(call gb_Library_use_api,wpftwriter,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_Library_use_libraries,wpftwriter,\
+ cppu \
+ cppuhelper \
+ vcl \
+ sal \
+ sfx \
+ sot \
+ tl \
+ ucbhelper \
+ utl \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_use_static_libraries,wpftwriter,\
+ writerperfect \
+))
+
+$(eval $(call gb_Library_use_externals,wpftwriter,\
+ wpd \
+ wpg \
+ wps \
+))
+
+$(eval $(call gb_Library_add_exception_objects,wpftwriter,\
+ writerperfect/source/writer/MSWorksImportFilter \
+ writerperfect/source/writer/WordPerfectImportFilter \
+ writerperfect/source/writer/wpftwriter_genericfilter \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Library_wpgimport.mk b/writerperfect/Library_wpgimport.mk
deleted file mode 100644
index b2cbd66..0000000
--- a/writerperfect/Library_wpgimport.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2011 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-$(eval $(call gb_Library_Library,wpgimport))
-
-$(eval $(call gb_Library_set_componentfile,wpgimport,writerperfect/util/wpgfilter))
-
-$(eval $(call gb_Library_set_include,wpgimport,\
- $$(INCLUDE) \
- -I$(SRCDIR)/writerperfect/source \
-))
-
-$(eval $(call gb_Library_use_api,wpgimport,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_Library_use_libraries,wpgimport,\
- cppu \
- cppuhelper \
- sal \
- sot \
- tl \
- utl \
- xo \
- $(gb_STDLIBS) \
-))
-
-$(eval $(call gb_Library_use_static_libraries,wpgimport,\
- writerperfect \
-))
-
-$(eval $(call gb_Library_use_externals,wpgimport,\
- wpd \
- wpg \
-))
-
-$(eval $(call gb_Library_add_exception_objects,wpgimport,\
- writerperfect/source/wpgimp/WPGImportFilter \
- writerperfect/source/wpgimp/wpgimport_genericfilter \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Module_writerperfect.mk b/writerperfect/Module_writerperfect.mk
index dc2039c..0e1bee0 100644
--- a/writerperfect/Module_writerperfect.mk
+++ b/writerperfect/Module_writerperfect.mk
@@ -28,42 +28,32 @@
$(eval $(call gb_Module_Module,writerperfect))
-ifneq (,$(filter YES,$(SYSTEM_LIBCDR))$(filter LIBCDR,$(BUILD_TYPE)))
-$(eval $(call gb_Module_add_targets,writerperfect,\
- Library_cdrimport \
-))
-endif
-
ifneq (,$(filter YES,$(SYSTEM_LIBWPD))$(filter LIBWPD,$(BUILD_TYPE)))
ifneq (,$(filter YES,$(SYSTEM_LIBWPS))$(filter LIBWPS,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_targets,writerperfect,\
- Library_msworks \
+ Library_wpftwriter \
))
endif
endif
+ifneq (,$(filter YES,$(SYSTEM_LIBWPD))$(filter LIBWPD,$(BUILD_TYPE)))
+ifneq (,$(filter YES,$(SYSTEM_LIBWPG))$(filter LIBWPG,$(BUILD_TYPE)))
ifneq (,$(filter YES,$(SYSTEM_LIBVISIO))$(filter LIBVISIO,$(BUILD_TYPE)))
+ifneq (,$(filter YES,$(SYSTEM_LIBCDR))$(filter LIBCDR,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_targets,writerperfect,\
- Library_visioimport \
+ Library_wpftdraw \
))
endif
-
-ifneq (,$(filter YES,$(SYSTEM_LIBWPD))$(filter LIBWPD,$(BUILD_TYPE)))
-$(eval $(call gb_Module_add_targets,writerperfect,\
- Library_wpft \
-))
endif
-
-ifneq (,$(filter YES,$(SYSTEM_LIBWPG))$(filter LIBWPG,$(BUILD_TYPE)))
-$(eval $(call gb_Module_add_targets,writerperfect,\
- Library_wpgimport \
-))
+endif
endif
ifneq (,$(filter YES,$(SYSTEM_LIBWPD))$(filter LIBWPD,$(BUILD_TYPE)))
+ifneq (,$(filter YES,$(SYSTEM_LIBWPG))$(filter LIBWPG,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_targets,writerperfect,\
StaticLibrary_writerperfect \
))
endif
+endif
# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/source/cdrimp/CDRImportFilter.cxx b/writerperfect/source/cdrimp/CDRImportFilter.cxx
deleted file mode 100644
index 2476a55..0000000
--- a/writerperfect/source/cdrimp/CDRImportFilter.cxx
+++ /dev/null
@@ -1,276 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* CDRImportFilter: Sets up the filter, and calls OdgExporter
- * to do the actual filtering
- *
- * Copyright (C) 2000 by Sun Microsystems, Inc.
- * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
- * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
- * Copyright (C) 2004-2006 Fridrich Strba <fridrich.strba at bluewin.ch>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Contributor(s): Martin Gallwey (gallwey at sun.com)
- *
- */
-
-/* "This product is not manufactured, approved, or supported by
- * Corel Corporation or Corel Corporation Limited."
- */
-
-#include <osl/diagnose.h>
-#include <rtl/tencinfo.h>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/uno/Reference.h>
-
-#include <xmloff/attrlist.hxx>
-
-#include <libcdr/libcdr.h>
-#include "filter/DocumentHandler.hxx"
-#include "filter/OdgGenerator.hxx"
-#include "CDRImportFilter.hxx"
-#include "stream/WPXSvStream.h"
-
-#include <iostream>
-
-using namespace ::com::sun::star::uno;
-using com::sun::star::uno::Reference;
-using com::sun::star::io::XInputStream;
-using com::sun::star::io::XSeekable;
-using com::sun::star::uno::Sequence;
-using namespace ::rtl;
-using rtl::OString;
-using rtl::OUString;
-using com::sun::star::uno::Sequence;
-using com::sun::star::uno::Reference;
-using com::sun::star::uno::Any;
-using com::sun::star::uno::UNO_QUERY;
-using com::sun::star::uno::XInterface;
-using com::sun::star::uno::Exception;
-using com::sun::star::uno::RuntimeException;
-using com::sun::star::lang::XMultiServiceFactory;
-using com::sun::star::beans::PropertyValue;
-using com::sun::star::document::XFilter;
-using com::sun::star::document::XExtendedFilterDetection;
-
-using com::sun::star::io::XInputStream;
-using com::sun::star::document::XImporter;
-using com::sun::star::xml::sax::InputSource;
-using com::sun::star::xml::sax::XAttributeList;
-using com::sun::star::xml::sax::XDocumentHandler;
-using com::sun::star::xml::sax::XParser;
-
-
-sal_Bool SAL_CALL CDRImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::filter" << std::endl;
-#endif
- sal_Int32 nLength = aDescriptor.getLength();
- const PropertyValue *pValue = aDescriptor.getConstArray();
- OUString sURL;
- Reference < XInputStream > xInputStream;
- for ( sal_Int32 i = 0 ; i < nLength; i++)
- {
- if ( pValue[i].Name == "InputStream" )
- pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name == "URL" )
- pValue[i].Value >>= sURL;
- }
- if ( !xInputStream.is() )
- {
- OSL_ASSERT( 0 );
- return sal_False;
- }
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
-
- // An XML import service: what we push sax messages to..
- OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
- Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
-
- // The XImporter sets up an empty target document for XDocumentHandler to write to..
- Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
- xImporter->setTargetDocument( mxDoc );
-
- // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
- // writes to in-memory target doc
- DocumentHandler xHandler(xInternalHandler);
-
- WPXSvInputStream input( xInputStream );
-
- OdgGenerator exporter(&xHandler, ODF_FLAT_XML);
- bool tmpParseResult = libcdr::CDRDocument::parse(&input, &exporter);
- return tmpParseResult;
-}
-
-void SAL_CALL CDRImportFilter::cancel( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::cancel" << std::endl;
-#endif
-}
-
-// XImporter
-void SAL_CALL CDRImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
-throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::setTargetDocument" << std::endl;
-#endif
- mxDoc = xDoc;
-}
-
-// XExtendedFilterDetection
-OUString SAL_CALL CDRImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
-throw( com::sun::star::uno::RuntimeException )
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::detect" << std::endl;
-#endif
- OUString sTypeName;
- sal_Int32 nLength = Descriptor.getLength();
- sal_Int32 location = nLength;
- const PropertyValue *pValue = Descriptor.getConstArray();
- Reference < XInputStream > xInputStream;
- for ( sal_Int32 i = 0 ; i < nLength; i++)
- {
- if ( pValue[i].Name == "TypeName" )
- location=i;
- else if ( pValue[i].Name == "InputStream" )
- pValue[i].Value >>= xInputStream;
- }
-
- WPXSvInputStream input( xInputStream );
-
- if (libcdr::CDRDocument::isSupported(&input))
- sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw_CorelDraw_Document" ) );
-
- if (sTypeName.getLength())
- {
- if ( location == Descriptor.getLength() )
- {
- Descriptor.realloc(nLength+1);
- Descriptor[location].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName"));
- }
-
- Descriptor[location].Value <<=sTypeName;
- }
- return sTypeName;
-}
-
-
-// XInitialization
-void SAL_CALL CDRImportFilter::initialize( const Sequence< Any >& aArguments )
-throw (Exception, RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::initialize" << std::endl;
-#endif
- Sequence < PropertyValue > aAnySeq;
- sal_Int32 nLength = aArguments.getLength();
- if ( nLength && ( aArguments[0] >>= aAnySeq ) )
- {
- const PropertyValue *pValue = aAnySeq.getConstArray();
- nLength = aAnySeq.getLength();
- for ( sal_Int32 i = 0 ; i < nLength; i++)
- {
- if ( pValue[i].Name == "Type" )
- {
- pValue[i].Value >>= msFilterName;
- break;
- }
- }
- }
-}
-OUString CDRImportFilter_getImplementationName ()
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter_getImplementationName" << std::endl;
-#endif
- return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.CDRImportFilter" ) );
-}
-
-#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
-#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
-sal_Bool SAL_CALL CDRImportFilter_supportsService( const OUString &ServiceName )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter_supportsService" << std::endl;
-#endif
- return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
-}
-Sequence< OUString > SAL_CALL CDRImportFilter_getSupportedServiceNames( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter_getSupportedServiceNames" << std::endl;
-#endif
- Sequence < OUString > aRet(2);
- OUString *pArray = aRet.getArray();
- pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
- pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
- return aRet;
-}
-#undef SERVICE_NAME2
-#undef SERVICE_NAME1
-
-Reference< XInterface > SAL_CALL CDRImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
-throw( Exception )
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter_createInstance" << std::endl;
-#endif
- return (cppu::OWeakObject *) new CDRImportFilter( rSMgr );
-}
-
-// XServiceInfo
-OUString SAL_CALL CDRImportFilter::getImplementationName( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::getImplementationName" << std::endl;
-#endif
- return CDRImportFilter_getImplementationName();
-}
-sal_Bool SAL_CALL CDRImportFilter::supportsService( const OUString &rServiceName )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::supportsService" << std::endl;
-#endif
- return CDRImportFilter_supportsService( rServiceName );
-}
-Sequence< OUString > SAL_CALL CDRImportFilter::getSupportedServiceNames( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CDRImportFilter::getSupportedServiceNames" << std::endl;
-#endif
- return CDRImportFilter_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/cdrimp/CDRImportFilter.hxx b/writerperfect/source/cdrimp/CDRImportFilter.hxx
deleted file mode 100644
index 56f124e..0000000
--- a/writerperfect/source/cdrimp/CDRImportFilter.hxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Copyright (C) 2000 by Sun Microsystems, Inc.
- * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
- * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
- * Copyright (C) 2004 Fridrich Strba <fridrich.strba at bluewin.ch>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Contributor(s): Martin Gallwey (gallwey at sun.com)
- *
- */
-
-/* "This product is not manufactured, approved, or supported by
- * Corel Corporation or Corel Corporation Limited."
- */
-#ifndef _CDRIMPORTFILTER_HXX
-#define _CDRIMPORTFILTER_HXX
-
-#include <com/sun/star/document/XFilter.hpp>
-#include <com/sun/star/document/XImporter.hpp>
-#include <com/sun/star/document/XExtendedFilterDetection.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <cppuhelper/implbase5.hxx>
-
-#include <stdio.h>
-
-/* 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 CDRImportFilter : public cppu::WeakImplHelper5
- <
- com::sun::star::document::XFilter,
- com::sun::star::document::XImporter,
- com::sun::star::document::XExtendedFilterDetection,
- com::sun::star::lang::XInitialization,
- com::sun::star::lang::XServiceInfo
- >
-{
-protected:
- // oo.org declares
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
- ::rtl::OUString msFilterName;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
-
-public:
- CDRImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
- : mxMSF( rxMSF ) {}
- virtual ~CDRImportFilter() {}
-
- // XFilter
- virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancel( )
- throw (::com::sun::star::uno::RuntimeException);
-
- // XImporter
- virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
- throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-
- //XExtendedFilterDetection
- virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
- throw( com::sun::star::uno::RuntimeException );
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
- throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &ServiceName )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-::rtl::OUString CDRImportFilter_getImplementationName()
-throw ( ::com::sun::star::uno::RuntimeException );
-
-sal_Bool SAL_CALL CDRImportFilter_supportsService( const ::rtl::OUString &ServiceName )
-throw ( ::com::sun::star::uno::RuntimeException );
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL CDRImportFilter_getSupportedServiceNames( )
-throw ( ::com::sun::star::uno::RuntimeException );
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-SAL_CALL CDRImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
-throw ( ::com::sun::star::uno::Exception );
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/cdrimp/CMXImportFilter.cxx b/writerperfect/source/cdrimp/CMXImportFilter.cxx
deleted file mode 100644
index 76a9d06..0000000
--- a/writerperfect/source/cdrimp/CMXImportFilter.cxx
+++ /dev/null
@@ -1,276 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* CMXImportFilter: Sets up the filter, and calls OdgExporter
- * to do the actual filtering
- *
- * Copyright (C) 2000 by Sun Microsystems, Inc.
- * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
- * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
- * Copyright (C) 2004-2006 Fridrich Strba <fridrich.strba at bluewin.ch>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Contributor(s): Martin Gallwey (gallwey at sun.com)
- *
- */
-
-/* "This product is not manufactured, approved, or supported by
- * Corel Corporation or Corel Corporation Limited."
- */
-
-#include <osl/diagnose.h>
-#include <rtl/tencinfo.h>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/uno/Reference.h>
-
-#include <xmloff/attrlist.hxx>
-
-#include <libcdr/libcdr.h>
-#include "filter/DocumentHandler.hxx"
-#include "filter/OdgGenerator.hxx"
-#include "CMXImportFilter.hxx"
-#include "stream/WPXSvStream.h"
-
-#include <iostream>
-
-using namespace ::com::sun::star::uno;
-using com::sun::star::uno::Reference;
-using com::sun::star::io::XInputStream;
-using com::sun::star::io::XSeekable;
-using com::sun::star::uno::Sequence;
-using namespace ::rtl;
-using rtl::OString;
-using rtl::OUString;
-using com::sun::star::uno::Sequence;
-using com::sun::star::uno::Reference;
-using com::sun::star::uno::Any;
-using com::sun::star::uno::UNO_QUERY;
-using com::sun::star::uno::XInterface;
-using com::sun::star::uno::Exception;
-using com::sun::star::uno::RuntimeException;
-using com::sun::star::lang::XMultiServiceFactory;
-using com::sun::star::beans::PropertyValue;
-using com::sun::star::document::XFilter;
-using com::sun::star::document::XExtendedFilterDetection;
-
-using com::sun::star::io::XInputStream;
-using com::sun::star::document::XImporter;
-using com::sun::star::xml::sax::InputSource;
-using com::sun::star::xml::sax::XAttributeList;
-using com::sun::star::xml::sax::XDocumentHandler;
-using com::sun::star::xml::sax::XParser;
-
-
-sal_Bool SAL_CALL CMXImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::filter" << std::endl;
-#endif
- sal_Int32 nLength = aDescriptor.getLength();
- const PropertyValue *pValue = aDescriptor.getConstArray();
- OUString sURL;
- Reference < XInputStream > xInputStream;
- for ( sal_Int32 i = 0 ; i < nLength; i++)
- {
- if ( pValue[i].Name == "InputStream" )
- pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name == "URL" )
- pValue[i].Value >>= sURL;
- }
- if ( !xInputStream.is() )
- {
- OSL_ASSERT( 0 );
- return sal_False;
- }
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
-
- // An XML import service: what we push sax messages to..
- OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
- Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
-
- // The XImporter sets up an empty target document for XDocumentHandler to write to..
- Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
- xImporter->setTargetDocument( mxDoc );
-
- // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
- // writes to in-memory target doc
- DocumentHandler xHandler(xInternalHandler);
-
- WPXSvInputStream input( xInputStream );
-
- OdgGenerator exporter(&xHandler, ODF_FLAT_XML);
- bool tmpParseResult = libcdr::CMXDocument::parse(&input, &exporter);
- return tmpParseResult;
-}
-
-void SAL_CALL CMXImportFilter::cancel( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::cancel" << std::endl;
-#endif
-}
-
-// XImporter
-void SAL_CALL CMXImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
-throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::setTargetDocument" << std::endl;
-#endif
- mxDoc = xDoc;
-}
-
-// XExtendedFilterDetection
-OUString SAL_CALL CMXImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
-throw( com::sun::star::uno::RuntimeException )
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::detect" << std::endl;
-#endif
- OUString sTypeName;
- sal_Int32 nLength = Descriptor.getLength();
- sal_Int32 location = nLength;
- const PropertyValue *pValue = Descriptor.getConstArray();
- Reference < XInputStream > xInputStream;
- for ( sal_Int32 i = 0 ; i < nLength; i++)
- {
- if ( pValue[i].Name == "TypeName" )
- location=i;
- else if ( pValue[i].Name == "InputStream" )
- pValue[i].Value >>= xInputStream;
- }
-
- WPXSvInputStream input( xInputStream );
-
- if (libcdr::CMXDocument::isSupported(&input))
- sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw_CorelDraw_Document" ) );
-
- if (sTypeName.getLength())
- {
- if ( location == Descriptor.getLength() )
- {
- Descriptor.realloc(nLength+1);
- Descriptor[location].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName"));
- }
-
- Descriptor[location].Value <<=sTypeName;
- }
- return sTypeName;
-}
-
-
-// XInitialization
-void SAL_CALL CMXImportFilter::initialize( const Sequence< Any >& aArguments )
-throw (Exception, RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::initialize" << std::endl;
-#endif
- Sequence < PropertyValue > aAnySeq;
- sal_Int32 nLength = aArguments.getLength();
- if ( nLength && ( aArguments[0] >>= aAnySeq ) )
- {
- const PropertyValue *pValue = aAnySeq.getConstArray();
- nLength = aAnySeq.getLength();
- for ( sal_Int32 i = 0 ; i < nLength; i++)
- {
- if ( pValue[i].Name == "Type" )
- {
- pValue[i].Value >>= msFilterName;
- break;
- }
- }
- }
-}
-OUString CMXImportFilter_getImplementationName ()
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter_getImplementationName" << std::endl;
-#endif
- return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.CMXImportFilter" ) );
-}
-
-#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
-#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
-sal_Bool SAL_CALL CMXImportFilter_supportsService( const OUString &ServiceName )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter_supportsService" << std::endl;
-#endif
- return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
-}
-Sequence< OUString > SAL_CALL CMXImportFilter_getSupportedServiceNames( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter_getSupportedServiceNames" << std::endl;
-#endif
- Sequence < OUString > aRet(2);
- OUString *pArray = aRet.getArray();
- pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
- pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
- return aRet;
-}
-#undef SERVICE_NAME2
-#undef SERVICE_NAME1
-
-Reference< XInterface > SAL_CALL CMXImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
-throw( Exception )
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter_createInstance" << std::endl;
-#endif
- return (cppu::OWeakObject *) new CMXImportFilter( rSMgr );
-}
-
-// XServiceInfo
-OUString SAL_CALL CMXImportFilter::getImplementationName( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::getImplementationName" << std::endl;
-#endif
- return CMXImportFilter_getImplementationName();
-}
-sal_Bool SAL_CALL CMXImportFilter::supportsService( const OUString &rServiceName )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::supportsService" << std::endl;
-#endif
- return CMXImportFilter_supportsService( rServiceName );
-}
-Sequence< OUString > SAL_CALL CMXImportFilter::getSupportedServiceNames( )
-throw (RuntimeException)
-{
-#ifdef DEBUG
- std::cerr << "CMXImportFilter::getSupportedServiceNames" << std::endl;
-#endif
- return CMXImportFilter_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/cdrimp/CMXImportFilter.hxx b/writerperfect/source/cdrimp/CMXImportFilter.hxx
deleted file mode 100644
index a9ec8f4..0000000
--- a/writerperfect/source/cdrimp/CMXImportFilter.hxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Copyright (C) 2000 by Sun Microsystems, Inc.
- * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
- * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
- * Copyright (C) 2004 Fridrich Strba <fridrich.strba at bluewin.ch>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Contributor(s): Martin Gallwey (gallwey at sun.com)
- *
- */
-
-/* "This product is not manufactured, approved, or supported by
- * Corel Corporation or Corel Corporation Limited."
- */
-#ifndef _CMXIMPORTFILTER_HXX
-#define _CMXIMPORTFILTER_HXX
-
-#include <com/sun/star/document/XFilter.hpp>
-#include <com/sun/star/document/XImporter.hpp>
-#include <com/sun/star/document/XExtendedFilterDetection.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <cppuhelper/implbase5.hxx>
-
-#include <stdio.h>
-
-/* 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 CMXImportFilter : public cppu::WeakImplHelper5
- <
- com::sun::star::document::XFilter,
- com::sun::star::document::XImporter,
- com::sun::star::document::XExtendedFilterDetection,
- com::sun::star::lang::XInitialization,
- com::sun::star::lang::XServiceInfo
- >
-{
-protected:
- // oo.org declares
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
- ::rtl::OUString msFilterName;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
-
-public:
- CMXImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
- : mxMSF( rxMSF ) {}
- virtual ~CMXImportFilter() {}
-
- // XFilter
- virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancel( )
- throw (::com::sun::star::uno::RuntimeException);
-
- // XImporter
- virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
- throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-
- //XExtendedFilterDetection
- virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
- throw( com::sun::star::uno::RuntimeException );
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
- throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &ServiceName )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-::rtl::OUString CMXImportFilter_getImplementationName()
-throw ( ::com::sun::star::uno::RuntimeException );
-
-sal_Bool SAL_CALL CMXImportFilter_supportsService( const ::rtl::OUString &ServiceName )
-throw ( ::com::sun::star::uno::RuntimeException );
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL CMXImportFilter_getSupportedServiceNames( )
-throw ( ::com::sun::star::uno::RuntimeException );
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-SAL_CALL CMXImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
-throw ( ::com::sun::star::uno::Exception );
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/cdrimp/cdrimport_genericfilter.cxx b/writerperfect/source/cdrimp/cdrimport_genericfilter.cxx
deleted file mode 100644
index 5612610..0000000
--- a/writerperfect/source/cdrimp/cdrimport_genericfilter.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* genericfilter: mostly generic code for registering the filter
- *
- * Portions of this code Copyright 2000 by Sun Microsystems, Inc.
- * Rest is Copyright (C) 2002 William Lachance (wlach at interlog.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-/* "This product is not manufactured, approved, or supported by
- * Corel Corporation or Corel Corporation Limited."
- */
-#include <stdio.h>
-
-#include <osl/mutex.hxx>
-#include <osl/thread.h>
-#include <cppuhelper/factory.hxx>
-
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include "CDRImportFilter.hxx"
-#include "CMXImportFilter.hxx"
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-extern "C"
-{
- SAL_DLLPUBLIC_EXPORT void *SAL_CALL cdrfilter_component_getFactory(
- const sal_Char *pImplName, void *pServiceManager, void * /* pRegistryKey */ )
- {
- void *pRet = 0;
-
- OUString implName = OUString::createFromAscii( pImplName );
- if ( pServiceManager && implName.equals(CDRImportFilter_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- CDRImportFilter_createInstance, CDRImportFilter_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
- if ( pServiceManager && implName.equals(CMXImportFilter_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- CMXImportFilter_createInstance, CMXImportFilter_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/CDRImportFilter.cxx b/writerperfect/source/draw/CDRImportFilter.cxx
new file mode 100644
index 0000000..2476a55
--- /dev/null
+++ b/writerperfect/source/draw/CDRImportFilter.cxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* CDRImportFilter: Sets up the filter, and calls OdgExporter
+ * to do the actual filtering
+ *
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004-2006 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#include <osl/diagnose.h>
+#include <rtl/tencinfo.h>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/uno/Reference.h>
+
+#include <xmloff/attrlist.hxx>
+
+#include <libcdr/libcdr.h>
+#include "filter/DocumentHandler.hxx"
+#include "filter/OdgGenerator.hxx"
+#include "CDRImportFilter.hxx"
+#include "stream/WPXSvStream.h"
+
+#include <iostream>
+
+using namespace ::com::sun::star::uno;
+using com::sun::star::uno::Reference;
+using com::sun::star::io::XInputStream;
+using com::sun::star::io::XSeekable;
+using com::sun::star::uno::Sequence;
+using namespace ::rtl;
+using rtl::OString;
+using rtl::OUString;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+
+using com::sun::star::io::XInputStream;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::InputSource;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xml::sax::XDocumentHandler;
+using com::sun::star::xml::sax::XParser;
+
+
+sal_Bool SAL_CALL CDRImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::filter" << std::endl;
+#endif
+ sal_Int32 nLength = aDescriptor.getLength();
+ const PropertyValue *pValue = aDescriptor.getConstArray();
+ OUString sURL;
+ Reference < XInputStream > xInputStream;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "InputStream" )
+ pValue[i].Value >>= xInputStream;
+ else if ( pValue[i].Name == "URL" )
+ pValue[i].Value >>= sURL;
+ }
+ if ( !xInputStream.is() )
+ {
+ OSL_ASSERT( 0 );
+ return sal_False;
+ }
+ OString sFileName;
+ sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
+
+ // An XML import service: what we push sax messages to..
+ OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
+ Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
+
+ // The XImporter sets up an empty target document for XDocumentHandler to write to..
+ Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
+ xImporter->setTargetDocument( mxDoc );
+
+ // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
+ // writes to in-memory target doc
+ DocumentHandler xHandler(xInternalHandler);
+
+ WPXSvInputStream input( xInputStream );
+
+ OdgGenerator exporter(&xHandler, ODF_FLAT_XML);
+ bool tmpParseResult = libcdr::CDRDocument::parse(&input, &exporter);
+ return tmpParseResult;
+}
+
+void SAL_CALL CDRImportFilter::cancel( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::cancel" << std::endl;
+#endif
+}
+
+// XImporter
+void SAL_CALL CDRImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::setTargetDocument" << std::endl;
+#endif
+ mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL CDRImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
+throw( com::sun::star::uno::RuntimeException )
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::detect" << std::endl;
+#endif
+ OUString sTypeName;
+ sal_Int32 nLength = Descriptor.getLength();
+ sal_Int32 location = nLength;
+ const PropertyValue *pValue = Descriptor.getConstArray();
+ Reference < XInputStream > xInputStream;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "TypeName" )
+ location=i;
+ else if ( pValue[i].Name == "InputStream" )
+ pValue[i].Value >>= xInputStream;
+ }
+
+ WPXSvInputStream input( xInputStream );
+
+ if (libcdr::CDRDocument::isSupported(&input))
+ sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw_CorelDraw_Document" ) );
+
+ if (sTypeName.getLength())
+ {
+ if ( location == Descriptor.getLength() )
+ {
+ Descriptor.realloc(nLength+1);
+ Descriptor[location].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName"));
+ }
+
+ Descriptor[location].Value <<=sTypeName;
+ }
+ return sTypeName;
+}
+
+
+// XInitialization
+void SAL_CALL CDRImportFilter::initialize( const Sequence< Any >& aArguments )
+throw (Exception, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::initialize" << std::endl;
+#endif
+ Sequence < PropertyValue > aAnySeq;
+ sal_Int32 nLength = aArguments.getLength();
+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+ {
+ const PropertyValue *pValue = aAnySeq.getConstArray();
+ nLength = aAnySeq.getLength();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "Type" )
+ {
+ pValue[i].Value >>= msFilterName;
+ break;
+ }
+ }
+ }
+}
+OUString CDRImportFilter_getImplementationName ()
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter_getImplementationName" << std::endl;
+#endif
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.CDRImportFilter" ) );
+}
+
+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
+sal_Bool SAL_CALL CDRImportFilter_supportsService( const OUString &ServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter_supportsService" << std::endl;
+#endif
+ return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
+}
+Sequence< OUString > SAL_CALL CDRImportFilter_getSupportedServiceNames( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter_getSupportedServiceNames" << std::endl;
+#endif
+ Sequence < OUString > aRet(2);
+ OUString *pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+ return aRet;
+}
+#undef SERVICE_NAME2
+#undef SERVICE_NAME1
+
+Reference< XInterface > SAL_CALL CDRImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+throw( Exception )
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter_createInstance" << std::endl;
+#endif
+ return (cppu::OWeakObject *) new CDRImportFilter( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL CDRImportFilter::getImplementationName( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::getImplementationName" << std::endl;
+#endif
+ return CDRImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL CDRImportFilter::supportsService( const OUString &rServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::supportsService" << std::endl;
+#endif
+ return CDRImportFilter_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL CDRImportFilter::getSupportedServiceNames( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CDRImportFilter::getSupportedServiceNames" << std::endl;
+#endif
+ return CDRImportFilter_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/CDRImportFilter.hxx b/writerperfect/source/draw/CDRImportFilter.hxx
new file mode 100644
index 0000000..56f124e
--- /dev/null
+++ b/writerperfect/source/draw/CDRImportFilter.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#ifndef _CDRIMPORTFILTER_HXX
+#define _CDRIMPORTFILTER_HXX
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+#include <stdio.h>
+
+/* 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 CDRImportFilter : public cppu::WeakImplHelper5
+ <
+ com::sun::star::document::XFilter,
+ com::sun::star::document::XImporter,
+ com::sun::star::document::XExtendedFilterDetection,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo
+ >
+{
+protected:
+ // oo.org declares
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+ ::rtl::OUString msFilterName;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
+
+public:
+ CDRImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {}
+ virtual ~CDRImportFilter() {}
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ //XExtendedFilterDetection
+ virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+::rtl::OUString CDRImportFilter_getImplementationName()
+throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL CDRImportFilter_supportsService( const ::rtl::OUString &ServiceName )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL CDRImportFilter_getSupportedServiceNames( )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL CDRImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+throw ( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/CMXImportFilter.cxx b/writerperfect/source/draw/CMXImportFilter.cxx
new file mode 100644
index 0000000..76a9d06
--- /dev/null
+++ b/writerperfect/source/draw/CMXImportFilter.cxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* CMXImportFilter: Sets up the filter, and calls OdgExporter
+ * to do the actual filtering
+ *
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004-2006 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#include <osl/diagnose.h>
+#include <rtl/tencinfo.h>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/uno/Reference.h>
+
+#include <xmloff/attrlist.hxx>
+
+#include <libcdr/libcdr.h>
+#include "filter/DocumentHandler.hxx"
+#include "filter/OdgGenerator.hxx"
+#include "CMXImportFilter.hxx"
+#include "stream/WPXSvStream.h"
+
+#include <iostream>
+
+using namespace ::com::sun::star::uno;
+using com::sun::star::uno::Reference;
+using com::sun::star::io::XInputStream;
+using com::sun::star::io::XSeekable;
+using com::sun::star::uno::Sequence;
+using namespace ::rtl;
+using rtl::OString;
+using rtl::OUString;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+
+using com::sun::star::io::XInputStream;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::InputSource;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xml::sax::XDocumentHandler;
+using com::sun::star::xml::sax::XParser;
+
+
+sal_Bool SAL_CALL CMXImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::filter" << std::endl;
+#endif
+ sal_Int32 nLength = aDescriptor.getLength();
+ const PropertyValue *pValue = aDescriptor.getConstArray();
+ OUString sURL;
+ Reference < XInputStream > xInputStream;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "InputStream" )
+ pValue[i].Value >>= xInputStream;
+ else if ( pValue[i].Name == "URL" )
+ pValue[i].Value >>= sURL;
+ }
+ if ( !xInputStream.is() )
+ {
+ OSL_ASSERT( 0 );
+ return sal_False;
+ }
+ OString sFileName;
+ sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
+
+ // An XML import service: what we push sax messages to..
+ OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
+ Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
+
+ // The XImporter sets up an empty target document for XDocumentHandler to write to..
+ Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
+ xImporter->setTargetDocument( mxDoc );
+
+ // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
+ // writes to in-memory target doc
+ DocumentHandler xHandler(xInternalHandler);
+
+ WPXSvInputStream input( xInputStream );
+
+ OdgGenerator exporter(&xHandler, ODF_FLAT_XML);
+ bool tmpParseResult = libcdr::CMXDocument::parse(&input, &exporter);
+ return tmpParseResult;
+}
+
+void SAL_CALL CMXImportFilter::cancel( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::cancel" << std::endl;
+#endif
+}
+
+// XImporter
+void SAL_CALL CMXImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::setTargetDocument" << std::endl;
+#endif
+ mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL CMXImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
+throw( com::sun::star::uno::RuntimeException )
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::detect" << std::endl;
+#endif
+ OUString sTypeName;
+ sal_Int32 nLength = Descriptor.getLength();
+ sal_Int32 location = nLength;
+ const PropertyValue *pValue = Descriptor.getConstArray();
+ Reference < XInputStream > xInputStream;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "TypeName" )
+ location=i;
+ else if ( pValue[i].Name == "InputStream" )
+ pValue[i].Value >>= xInputStream;
+ }
+
+ WPXSvInputStream input( xInputStream );
+
+ if (libcdr::CMXDocument::isSupported(&input))
+ sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw_CorelDraw_Document" ) );
+
+ if (sTypeName.getLength())
+ {
+ if ( location == Descriptor.getLength() )
+ {
+ Descriptor.realloc(nLength+1);
+ Descriptor[location].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName"));
+ }
+
+ Descriptor[location].Value <<=sTypeName;
+ }
+ return sTypeName;
+}
+
+
+// XInitialization
+void SAL_CALL CMXImportFilter::initialize( const Sequence< Any >& aArguments )
+throw (Exception, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::initialize" << std::endl;
+#endif
+ Sequence < PropertyValue > aAnySeq;
+ sal_Int32 nLength = aArguments.getLength();
+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+ {
+ const PropertyValue *pValue = aAnySeq.getConstArray();
+ nLength = aAnySeq.getLength();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "Type" )
+ {
+ pValue[i].Value >>= msFilterName;
+ break;
+ }
+ }
+ }
+}
+OUString CMXImportFilter_getImplementationName ()
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter_getImplementationName" << std::endl;
+#endif
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.CMXImportFilter" ) );
+}
+
+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
+sal_Bool SAL_CALL CMXImportFilter_supportsService( const OUString &ServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter_supportsService" << std::endl;
+#endif
+ return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
+}
+Sequence< OUString > SAL_CALL CMXImportFilter_getSupportedServiceNames( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter_getSupportedServiceNames" << std::endl;
+#endif
+ Sequence < OUString > aRet(2);
+ OUString *pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+ return aRet;
+}
+#undef SERVICE_NAME2
+#undef SERVICE_NAME1
+
+Reference< XInterface > SAL_CALL CMXImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+throw( Exception )
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter_createInstance" << std::endl;
+#endif
+ return (cppu::OWeakObject *) new CMXImportFilter( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL CMXImportFilter::getImplementationName( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::getImplementationName" << std::endl;
+#endif
+ return CMXImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL CMXImportFilter::supportsService( const OUString &rServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::supportsService" << std::endl;
+#endif
+ return CMXImportFilter_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL CMXImportFilter::getSupportedServiceNames( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "CMXImportFilter::getSupportedServiceNames" << std::endl;
+#endif
+ return CMXImportFilter_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/CMXImportFilter.hxx b/writerperfect/source/draw/CMXImportFilter.hxx
new file mode 100644
index 0000000..a9ec8f4
--- /dev/null
+++ b/writerperfect/source/draw/CMXImportFilter.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#ifndef _CMXIMPORTFILTER_HXX
+#define _CMXIMPORTFILTER_HXX
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+#include <stdio.h>
+
+/* 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 CMXImportFilter : public cppu::WeakImplHelper5
+ <
+ com::sun::star::document::XFilter,
+ com::sun::star::document::XImporter,
+ com::sun::star::document::XExtendedFilterDetection,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo
+ >
+{
+protected:
+ // oo.org declares
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+ ::rtl::OUString msFilterName;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
+
+public:
+ CMXImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {}
+ virtual ~CMXImportFilter() {}
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ //XExtendedFilterDetection
+ virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+::rtl::OUString CMXImportFilter_getImplementationName()
+throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL CMXImportFilter_supportsService( const ::rtl::OUString &ServiceName )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL CMXImportFilter_getSupportedServiceNames( )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL CMXImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+throw ( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/VisioImportFilter.cxx b/writerperfect/source/draw/VisioImportFilter.cxx
new file mode 100644
index 0000000..13bf089
--- /dev/null
+++ b/writerperfect/source/draw/VisioImportFilter.cxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* VisioImportFilter: Sets up the filter, and calls OdgExporter
+ * to do the actual filtering
+ *
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004-2006 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#include <osl/diagnose.h>
+#include <rtl/tencinfo.h>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/uno/Reference.h>
+
+#include <xmloff/attrlist.hxx>
+
+#include <libvisio/libvisio.h>
+#include "filter/DocumentHandler.hxx"
+#include "filter/OdgGenerator.hxx"
+#include "VisioImportFilter.hxx"
+#include "stream/WPXSvStream.h"
+
+#include <iostream>
+
+using namespace ::com::sun::star::uno;
+using com::sun::star::uno::Reference;
+using com::sun::star::io::XInputStream;
+using com::sun::star::io::XSeekable;
+using com::sun::star::uno::Sequence;
+using namespace ::rtl;
+using rtl::OString;
+using rtl::OUString;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+
+using com::sun::star::io::XInputStream;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::InputSource;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xml::sax::XDocumentHandler;
+using com::sun::star::xml::sax::XParser;
+
+
+sal_Bool SAL_CALL VisioImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::filter" << std::endl;
+#endif
+ sal_Int32 nLength = aDescriptor.getLength();
+ const PropertyValue *pValue = aDescriptor.getConstArray();
+ OUString sURL;
+ Reference < XInputStream > xInputStream;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "InputStream" )
+ pValue[i].Value >>= xInputStream;
+ else if ( pValue[i].Name == "URL" )
+ pValue[i].Value >>= sURL;
+ }
+ if ( !xInputStream.is() )
+ {
+ OSL_ASSERT( 0 );
+ return sal_False;
+ }
+ OString sFileName;
+ sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
+
+ // An XML import service: what we push sax messages to..
+ OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
+ Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
+
+ // The XImporter sets up an empty target document for XDocumentHandler to write to..
+ Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
+ xImporter->setTargetDocument( mxDoc );
+
+ // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
+ // writes to in-memory target doc
+ DocumentHandler xHandler(xInternalHandler);
+
+ WPXSvInputStream input( xInputStream );
+
+ OdgGenerator exporter(&xHandler, ODF_FLAT_XML);
+ bool tmpParseResult = libvisio::VisioDocument::parse(&input, &exporter);
+ return tmpParseResult;
+}
+
+void SAL_CALL VisioImportFilter::cancel( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::cancel" << std::endl;
+#endif
+}
+
+// XImporter
+void SAL_CALL VisioImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::setTargetDocument" << std::endl;
+#endif
+ mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL VisioImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
+throw( com::sun::star::uno::RuntimeException )
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::detect" << std::endl;
+#endif
+ OUString sTypeName;
+ sal_Int32 nLength = Descriptor.getLength();
+ sal_Int32 location = nLength;
+ const PropertyValue *pValue = Descriptor.getConstArray();
+ Reference < XInputStream > xInputStream;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "TypeName" )
+ location=i;
+ else if ( pValue[i].Name == "InputStream" )
+ pValue[i].Value >>= xInputStream;
+ }
+
+ WPXSvInputStream input( xInputStream );
+
+ if (libvisio::VisioDocument::isSupported(&input))
+ sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw_Visio_Document" ) );
+
+ if (!sTypeName.isEmpty())
+ {
+ if ( location == Descriptor.getLength() )
+ {
+ Descriptor.realloc(nLength+1);
+ Descriptor[location].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName"));
+ }
+
+ Descriptor[location].Value <<=sTypeName;
+ }
+ return sTypeName;
+}
+
+
+// XInitialization
+void SAL_CALL VisioImportFilter::initialize( const Sequence< Any >& aArguments )
+throw (Exception, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::initialize" << std::endl;
+#endif
+ Sequence < PropertyValue > aAnySeq;
+ sal_Int32 nLength = aArguments.getLength();
+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+ {
+ const PropertyValue *pValue = aAnySeq.getConstArray();
+ nLength = aAnySeq.getLength();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "Type" )
+ {
+ pValue[i].Value >>= msFilterName;
+ break;
+ }
+ }
+ }
+}
+OUString VisioImportFilter_getImplementationName ()
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_getImplementationName" << std::endl;
+#endif
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.VisioImportFilter" ) );
+}
+
+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
+sal_Bool SAL_CALL VisioImportFilter_supportsService( const OUString &ServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_supportsService" << std::endl;
+#endif
+ return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
+}
+Sequence< OUString > SAL_CALL VisioImportFilter_getSupportedServiceNames( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_getSupportedServiceNames" << std::endl;
+#endif
+ Sequence < OUString > aRet(2);
+ OUString *pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+ return aRet;
+}
+#undef SERVICE_NAME2
+#undef SERVICE_NAME1
+
+Reference< XInterface > SAL_CALL VisioImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+throw( Exception )
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_createInstance" << std::endl;
+#endif
+ return (cppu::OWeakObject *) new VisioImportFilter( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL VisioImportFilter::getImplementationName( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::getImplementationName" << std::endl;
+#endif
+ return VisioImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL VisioImportFilter::supportsService( const OUString &rServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::supportsService" << std::endl;
+#endif
+ return VisioImportFilter_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL VisioImportFilter::getSupportedServiceNames( )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::getSupportedServiceNames" << std::endl;
+#endif
+ return VisioImportFilter_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/VisioImportFilter.hxx b/writerperfect/source/draw/VisioImportFilter.hxx
new file mode 100644
index 0000000..377c007
--- /dev/null
+++ b/writerperfect/source/draw/VisioImportFilter.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#ifndef _VISIOIMPORTFILTER_HXX
+#define _VISIOIMPORTFILTER_HXX
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+#include <stdio.h>
+
+/* 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 VisioImportFilter : public cppu::WeakImplHelper5
+ <
+ com::sun::star::document::XFilter,
+ com::sun::star::document::XImporter,
+ com::sun::star::document::XExtendedFilterDetection,
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo
+ >
+{
+protected:
+ // oo.org declares
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+ ::rtl::OUString msFilterName;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
+
+public:
+ VisioImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {}
+ virtual ~VisioImportFilter() {}
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ //XExtendedFilterDetection
+ virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+::rtl::OUString VisioImportFilter_getImplementationName()
+throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL VisioImportFilter_supportsService( const ::rtl::OUString &ServiceName )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL VisioImportFilter_getSupportedServiceNames( )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL VisioImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+throw ( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/WPGImportFilter.cxx b/writerperfect/source/draw/WPGImportFilter.cxx
new file mode 100644
index 0000000..ff7612b
--- /dev/null
+++ b/writerperfect/source/draw/WPGImportFilter.cxx
@@ -0,0 +1,275 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list