summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RepositoryExternal.mk2
-rw-r--r--download.lst4
-rw-r--r--external/libwps/0001-QuattroPro-parser-correct-a-mistake-when-reading-neg.patch26
-rw-r--r--external/libwps/0001-error-C2065-M_PI-undeclared-identifier.patch35
-rw-r--r--external/libwps/ExternalPackage_libwps.mk6
-rw-r--r--external/libwps/ExternalProject_libwps.mk2
-rw-r--r--external/libwps/Library_wps.mk8
-rw-r--r--external/libwps/UnpackedTarball_libwps.mk7
-rw-r--r--filter/Configuration_filter.mk4
-rw-r--r--filter/source/config/fragments/filters/WPS_Lotus_Calc.xcu30
-rw-r--r--filter/source/config/fragments/filters/WPS_QPro_Calc.xcu30
-rw-r--r--filter/source/config/fragments/types/calc_WPS_Lotus_Document.xcu29
-rw-r--r--filter/source/config/fragments/types/calc_WPS_QPro_Document.xcu29
-rw-r--r--include/writerperfect/WPFTEncodingDialog.hxx56
-rw-r--r--scp2/source/ooo/file_ooo.scp1
-rw-r--r--scp2/source/ooo/module_ooo.scp1
-rw-r--r--writerperfect/Library_wpftcalc.mk2
-rw-r--r--writerperfect/Library_wpftdraw.mk2
-rw-r--r--writerperfect/Library_wpftimpress.mk2
-rw-r--r--writerperfect/Library_wpftwriter.mk2
-rw-r--r--writerperfect/Library_writerperfect.mk3
-rw-r--r--writerperfect/Module_writerperfect.mk4
-rw-r--r--writerperfect/UIConfig_writerperfect.mk26
-rw-r--r--writerperfect/source/calc/MSWorksCalcImportFilter.cxx71
-rw-r--r--writerperfect/source/common/WPFTEncodingDialog.cxx177
-rw-r--r--writerperfect/source/writer/MSWorksImportFilter.cxx34
-rw-r--r--writerperfect/uiconfig/ui/wpftencodingdialog.ui88
27 files changed, 667 insertions, 14 deletions
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index b6324cfa6eb9..e44b08a2855f 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2164,7 +2164,7 @@ $(call gb_LinkTarget_set_include,$(1),\
$$(INCLUDE) \
)
$(call gb_LinkTarget_add_libs,$(1),\
- -L$(call gb_UnpackedTarball_get_dir,libwps)/src/lib/.libs -lwps-0.3 \
+ -L$(call gb_UnpackedTarball_get_dir,libwps)/src/lib/.libs -lwps-0.4 \
)
endef
diff --git a/download.lst b/download.lst
index 6c61183cd1ce..7ea48622ef45 100644
--- a/download.lst
+++ b/download.lst
@@ -145,8 +145,8 @@ export WPD_MD5SUM := 0773d79a1f240ef9f4f20242b13c5bb7
export WPD_TARBALL := libwpd-0.10.0.tar.bz2
export WPG_MD5SUM := 17da9770cb8b317b7633f9807b32b71a
export WPG_TARBALL := libwpg-0.3.0.tar.bz2
-export WPS_MD5SUM := a111d9ef5a0dab564e9aec0f2cf8d218
-export WPS_TARBALL := libwps-0.3.1.tar.bz2
+export WPS_MD5SUM := e9162d2566421d9d71b3ad2377a68fd5
+export WPS_TARBALL := libwps-0.4.0.tar.bz2
export XSLTML_TARBALL := a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip
export ZLIB_MD5SUM := 44d667c142d7cda120332623eab69f40
export ZLIB_TARBALL := zlib-1.2.8.tar.gz
diff --git a/external/libwps/0001-QuattroPro-parser-correct-a-mistake-when-reading-neg.patch b/external/libwps/0001-QuattroPro-parser-correct-a-mistake-when-reading-neg.patch
new file mode 100644
index 000000000000..d5a6f5473d40
--- /dev/null
+++ b/external/libwps/0001-QuattroPro-parser-correct-a-mistake-when-reading-neg.patch
@@ -0,0 +1,26 @@
+From 45a3dd5393e07340d5a63d8a8735789d73a61b17 Mon Sep 17 00:00:00 2001
+From: osnola <alonso@loria.fr>
+Date: Mon, 18 May 2015 08:27:59 +0200
+Subject: [PATCH] QuattroPro parser: correct a mistake when reading negative
+ cell's position
+
+---
+ src/lib/QuattroSpreadsheet.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lib/QuattroSpreadsheet.cpp b/src/lib/QuattroSpreadsheet.cpp
+index cb0f4f5..ce5e20a 100644
+--- a/src/lib/QuattroSpreadsheet.cpp
++++ b/src/lib/QuattroSpreadsheet.cpp
+@@ -1668,7 +1668,7 @@ bool QuattroSpreadsheet::readCell
+ else
+ {
+ val &= 0x3FFF;
+- if (val & 0x2000) val = val - 0x4000;
++ if (val>0x1000) val = val - 0x2000;
+ }
+ if (dim==2)
+ val += sheetId;
+--
+2.3.2 (Apple Git-55)
+
diff --git a/external/libwps/0001-error-C2065-M_PI-undeclared-identifier.patch b/external/libwps/0001-error-C2065-M_PI-undeclared-identifier.patch
new file mode 100644
index 000000000000..01109dc72215
--- /dev/null
+++ b/external/libwps/0001-error-C2065-M_PI-undeclared-identifier.patch
@@ -0,0 +1,35 @@
+From 94af34d42129bad72fd7ce50dc6901287509703e Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon@redhat.com>
+Date: Mon, 18 May 2015 18:50:25 +0200
+Subject: [PATCH] error C2065: M_PI : undeclared identifier
+
+---
+ src/lib/libwps_internal.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/lib/libwps_internal.h b/src/lib/libwps_internal.h
+index fb9016d..02a87bc 100644
+--- a/src/lib/libwps_internal.h
++++ b/src/lib/libwps_internal.h
+@@ -28,6 +28,7 @@
+ #include <stdio.h>
+ #endif
+
++#include <cmath>
+ #include <iostream>
+ #include <map>
+ #include <string>
+@@ -36,6 +37,10 @@
+ #include <librevenge-stream/librevenge-stream.h>
+ #include <librevenge/librevenge.h>
+
++#ifndef M_PI
++#define M_PI 3.14159265358979323846
++#endif
++
+ #if defined(_MSC_VER) || defined(__DJGPP__)
+ typedef signed char int8_t;
+ typedef unsigned char uint8_t;
+--
+2.4.0
+
diff --git a/external/libwps/ExternalPackage_libwps.mk b/external/libwps/ExternalPackage_libwps.mk
index 3e0f79bbdb1f..f37dc316cdf7 100644
--- a/external/libwps/ExternalPackage_libwps.mk
+++ b/external/libwps/ExternalPackage_libwps.mk
@@ -12,11 +12,11 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,libwps,libwps))
$(eval $(call gb_ExternalPackage_use_external_project,libwps,libwps))
ifeq ($(OS),MACOSX)
-$(eval $(call gb_ExternalPackage_add_file,libwps,$(LIBO_LIB_FOLDER)/libwps-0.3.3.dylib,src/lib/.libs/libwps-0.3.3.dylib))
+$(eval $(call gb_ExternalPackage_add_file,libwps,$(LIBO_LIB_FOLDER)/libwps-0.4.4.dylib,src/lib/.libs/libwps-0.4.4.dylib))
else ifeq ($(OS),WNT)
-$(eval $(call gb_ExternalPackage_add_file,libwps,$(LIBO_LIB_FOLDER)/libwps-0.3.dll,src/lib/.libs/libwps-0.3.dll))
+$(eval $(call gb_ExternalPackage_add_file,libwps,$(LIBO_LIB_FOLDER)/libwps-0.4.dll,src/lib/.libs/libwps-0.4.dll))
else ifeq ($(filter IOS ANDROID,$(OS)),)
-$(eval $(call gb_ExternalPackage_add_file,libwps,$(LIBO_LIB_FOLDER)/libwps-0.3.so.3,src/lib/.libs/libwps-0.3.so.3.0.1))
+$(eval $(call gb_ExternalPackage_add_file,libwps,$(LIBO_LIB_FOLDER)/libwps-0.4.so.4,src/lib/.libs/libwps-0.4.so.4.0.0))
endif
# vim: set noet sw=4 ts=4:
diff --git a/external/libwps/ExternalProject_libwps.mk b/external/libwps/ExternalProject_libwps.mk
index be54d7bfb216..42cf8a41fe5f 100644
--- a/external/libwps/ExternalProject_libwps.mk
+++ b/external/libwps/ExternalProject_libwps.mk
@@ -41,7 +41,7 @@ $(call gb_ExternalProject_get_state_target,libwps,build) :
&& $(MAKE) \
$(if $(filter MACOSX,$(OS)),\
&& $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
- $(EXTERNAL_WORKDIR)/src/lib/.libs/libwps-0.3.3.dylib \
+ $(EXTERNAL_WORKDIR)/src/lib/.libs/libwps-0.4.4.dylib \
) \
)
diff --git a/external/libwps/Library_wps.mk b/external/libwps/Library_wps.mk
index be9f3c663c27..ef323cebb7bf 100644
--- a/external/libwps/Library_wps.mk
+++ b/external/libwps/Library_wps.mk
@@ -33,6 +33,12 @@ $(eval $(call gb_Library_add_defs,wps,\
$(eval $(call gb_Library_set_generated_cxx_suffix,wps,cpp))
$(eval $(call gb_Library_add_generated_exception_objects,wps,\
+ UnpackedTarball/libwps/src/lib/Lotus \
+ UnpackedTarball/libwps/src/lib/LotusGraph \
+ UnpackedTarball/libwps/src/lib/LotusSpreadsheet \
+ UnpackedTarball/libwps/src/lib/LotusStyleManager \
+ UnpackedTarball/libwps/src/lib/Quattro \
+ UnpackedTarball/libwps/src/lib/QuattroSpreadsheet \
UnpackedTarball/libwps/src/lib/WKS4 \
UnpackedTarball/libwps/src/lib/WKS4Spreadsheet \
UnpackedTarball/libwps/src/lib/WKSContentListener \
@@ -52,6 +58,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,wps,\
UnpackedTarball/libwps/src/lib/WPSDebug \
UnpackedTarball/libwps/src/lib/WPSDocument \
UnpackedTarball/libwps/src/lib/WPSFont \
+ UnpackedTarball/libwps/src/lib/WPSGraphicShape \
+ UnpackedTarball/libwps/src/lib/WPSGraphicStyle \
UnpackedTarball/libwps/src/lib/WPSHeader \
UnpackedTarball/libwps/src/lib/WPSList \
UnpackedTarball/libwps/src/lib/WPSOLEParser \
diff --git a/external/libwps/UnpackedTarball_libwps.mk b/external/libwps/UnpackedTarball_libwps.mk
index 1fd633acbe90..77662a7944f2 100644
--- a/external/libwps/UnpackedTarball_libwps.mk
+++ b/external/libwps/UnpackedTarball_libwps.mk
@@ -11,4 +11,11 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libwps))
$(eval $(call gb_UnpackedTarball_set_tarball,libwps,$(WPS_TARBALL)))
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libwps,1))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libwps,\
+ external/libwps/0001-QuattroPro-parser-correct-a-mistake-when-reading-neg.patch \
+ external/libwps/0001-error-C2065-M_PI-undeclared-identifier.patch \
+))
+
# vim: set noet sw=4 ts=4:
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index c0b4eb974f4d..c2d207629295 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -508,6 +508,8 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,f
calc_OOXML \
calc_OOXML_Template \
calc_MS_Works_Document \
+ calc_WPS_Lotus_Document \
+ calc_WPS_QPro_Document \
calc_Beagle_Works \
calc_ClarisWorks \
calc_Claris_Resolve \
@@ -546,6 +548,8 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calc_filters.x
calc_OOXML \
calc_OOXML_Template \
MS_Works_Calc \
+ WPS_Lotus_Calc \
+ WPS_QPro_Calc \
Beagle_Works_Calc \
ClarisWorks_Calc \
Claris_Resolve_Calc \
diff --git a/filter/source/config/fragments/filters/WPS_Lotus_Calc.xcu b/filter/source/config/fragments/filters/WPS_Lotus_Calc.xcu
new file mode 100644
index 000000000000..721e68f92533
--- /dev/null
+++ b/filter/source/config/fragments/filters/WPS_Lotus_Calc.xcu
@@ -0,0 +1,30 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="WPS_Lotus_Calc" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Calc.MSWorksCalcImportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Lotus Document</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_WPS_Lotus_Document</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/WPS_QPro_Calc.xcu b/filter/source/config/fragments/filters/WPS_QPro_Calc.xcu
new file mode 100644
index 000000000000..77c7b45d5f32
--- /dev/null
+++ b/filter/source/config/fragments/filters/WPS_QPro_Calc.xcu
@@ -0,0 +1,30 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="WPS_QPro_Calc" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Calc.MSWorksCalcImportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">QuattroPro Document</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>calc_WPS_QPro_Document</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_WPS_Lotus_Document.xcu b/filter/source/config/fragments/types/calc_WPS_Lotus_Document.xcu
new file mode 100644
index 000000000000..0ecc7114c3ed
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_WPS_Lotus_Document.xcu
@@ -0,0 +1,29 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="calc_WPS_Lotus_Document" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.Calc.MSWorksCalcImportFilter</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wk1 wk3</value></prop>
+ <prop oor:name="MediaType"></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>WPS_Lotus_Calc</value></prop>
+ <prop oor:name="UIName">
+ <value>Lotus Wk1-Wk3</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_WPS_QPro_Document.xcu b/filter/source/config/fragments/types/calc_WPS_QPro_Document.xcu
new file mode 100644
index 000000000000..a335004bd8cc
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_WPS_QPro_Document.xcu
@@ -0,0 +1,29 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="calc_WPS_QPro_Document" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.Calc.MSWorksCalcImportFilter</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wq1 wq2</value></prop>
+ <prop oor:name="MediaType"></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>WPS_QPro_Calc</value></prop>
+ <prop oor:name="UIName">
+ <value>QuattroPro Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/include/writerperfect/WPFTEncodingDialog.hxx b/include/writerperfect/WPFTEncodingDialog.hxx
new file mode 100644
index 000000000000..5288083837f5
--- /dev/null
+++ b/include/writerperfect/WPFTEncodingDialog.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* MSWorksImportFilter: Sets up the filter, and calls DocumentCollector
+ * to do the actual filtering
+ *
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_WRITERPERFECT_WPFTENCODINGDIALOG_HXX
+#define INCLUDED_WRITERPERFECT_WPFTENCODINGDIALOG_HXX
+
+#include <sal/types.h>
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <writerperfect/writerperfectdllapi.h>
+
+namespace writerperfect {
+
+class WRITERPERFECT_DLLPUBLIC WPFTEncodingDialog : public ModalDialog
+{
+public:
+ WPFTEncodingDialog( vcl::Window* pParent,
+ const OUString* pStrTitle = 0,
+ const OUString* defEncoding = 0);
+
+ virtual ~WPFTEncodingDialog();
+
+ OUString GetEncoding( ) const;
+ bool hasUserCalledCancel() const {
+ return m_userHasCancelled;
+ }
+private:
+ VclPtr<ListBox> m_pLbCharset;
+ VclPtr<OKButton> m_pBtnOk;
+ VclPtr<CancelButton> m_pBtnCancel;
+
+ bool m_userHasCancelled;
+private:
+ DECL_LINK( DoubleClickHdl, ListBox* );
+ DECL_LINK(CancelHdl, void*);
+
+ WPFTEncodingDialog(WPFTEncodingDialog const &) SAL_DELETED_FUNCTION;
+ WPFTEncodingDialog &operator=(WPFTEncodingDialog const &) SAL_DELETED_FUNCTION;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index 9a479ffa6fd0..a682256302ec 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -290,6 +290,7 @@ UI_FILELIST(tubes, "UIConfig/tubes.filelist")
#endif
UI_FILELIST(uui, "UIConfig/uui.filelist")
UI_FILELIST(vcl, "UIConfig/vcl.filelist")
+UI_FILELIST(writerperfect, "UIConfig/writerperfect.filelist")
UI_FILELIST(xmlsec, "UIConfig/xmlsec.filelist")
UI_FILELIST_ALL_LANG(basicide, modules/BasicIDE)
diff --git a/scp2/source/ooo/module_ooo.scp b/scp2/source/ooo/module_ooo.scp
index 73214d76cf4b..50066d325a13 100644
--- a/scp2/source/ooo/module_ooo.scp
+++ b/scp2/source/ooo/module_ooo.scp
@@ -125,6 +125,7 @@ Module gid_Module_Root
#endif
gid_File_Share_Config_Sofficecfg_uiconfig_uui,
gid_File_Share_Config_Sofficecfg_uiconfig_vcl,
+ gid_File_Share_Config_Sofficecfg_uiconfig_writerperfect,
gid_File_Share_Config_Sofficecfg_uiconfig_xmlsec,
gid_File_Share_Registry_Main_Xcd,
gid_File_Share_Registry_Forcedefault_Xcd,
diff --git a/writerperfect/Library_wpftcalc.mk b/writerperfect/Library_wpftcalc.mk
index 395d1d81a3ab..a68aa4846ffd 100644
--- a/writerperfect/Library_wpftcalc.mk
+++ b/writerperfect/Library_wpftcalc.mk
@@ -34,8 +34,10 @@ $(eval $(call gb_Library_use_libraries,wpftcalc,\
cppuhelper \
sal \
sot \
+ svx \
tl \
utl \
+ vcl \
writerperfect \
xo \
$(gb_UWINAPI) \
diff --git a/writerperfect/Library_wpftdraw.mk b/writerperfect/Library_wpftdraw.mk
index 29409c135e33..1e57fcd9aa1a 100644
--- a/writerperfect/Library_wpftdraw.mk
+++ b/writerperfect/Library_wpftdraw.mk
@@ -34,8 +34,10 @@ $(eval $(call gb_Library_use_libraries,wpftdraw,\
cppuhelper \
sal \
sot \
+ svx \
tl \
utl \
+ vcl \
writerperfect \
xo \
$(gb_UWINAPI) \
diff --git a/writerperfect/Library_wpftimpress.mk b/writerperfect/Library_wpftimpress.mk
index eac71cb02d31..3d35aa778151 100644
--- a/writerperfect/Library_wpftimpress.mk
+++ b/writerperfect/Library_wpftimpress.mk
@@ -34,9 +34,11 @@ $(eval $(call gb_Library_use_libraries,wpftimpress,\
cppuhelper \
sal \
sot \
+ svx \
tl \
ucbhelper \
utl \
+ vcl \
writerperfect \
xo \
$(gb_UWINAPI) \
diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk
index b47c2717f65c..8c32ea366f8f 100644
--- a/writerperfect/Library_wpftwriter.mk
+++ b/writerperfect/Library_wpftwriter.mk
@@ -36,9 +36,11 @@ $(eval $(call gb_Library_use_libraries,wpftwriter,\
sal \
sfx \
sot \
+ svx \
tl \
ucbhelper \
utl \
+ vcl \
writerperfect \
xo \
$(gb_UWINAPI) \
diff --git a/writerperfect/Library_writerperfect.mk b/writerperfect/Library_writerperfect.mk
index 3089b5a0add8..1343be6625b6 100644
--- a/writerperfect/Library_writerperfect.mk
+++ b/writerperfect/Library_writerperfect.mk
@@ -37,9 +37,11 @@ $(eval $(call gb_Library_use_libraries,writerperfect,\
cppuhelper \
sal \
sot \
+ svx \
tl \
ucbhelper \
utl \
+ vcl \
xo \
$(gb_UWINAPI) \
))
@@ -47,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,writerperfect,\
$(eval $(call gb_Library_add_exception_objects,writerperfect,\
writerperfect/source/common/DirectoryStream \
writerperfect/source/common/DocumentHandler \
+ writerperfect/source/common/WPFTEncodingDialog \
writerperfect/source/common/WPXSvInputStream \
))
diff --git a/writerperfect/Module_writerperfect.mk b/writerperfect/Module_writerperfect.mk
index 9c30697fea1c..e7870439eb05 100644
--- a/writerperfect/Module_writerperfect.mk
+++ b/writerperfect/Module_writerperfect.mk
@@ -27,6 +27,10 @@ $(eval $(call gb_Module_add_targets,writerperfect,\
Library_writerperfect \
))
+$(eval $(call gb_Module_add_l10n_targets,writerperfect,\
+ UIConfig_writerperfect \
+))
+
$(eval $(call gb_Module_add_check_targets,writerperfect,\
CppunitTest_writerperfect_stream \
))
diff --git a/writerperfect/UIConfig_writerperfect.mk b/writerperfect/UIConfig_writerperfect.mk
new file mode 100644
index 000000000000..d0d8ef5030fb
--- /dev/null
+++ b/writerperfect/UIConfig_writerperfect.mk
@@ -0,0 +1,26 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+$(eval $(call gb_UIConfig_UIConfig,writerperfect))
+
+$(eval $(call gb_UIConfig_add_uifiles,writerperfect,\
+ writerperfect/uiconfig/ui/wpftencodingdialog \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
index d8976389ded0..f68b4a00eab6 100644
--- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
@@ -14,6 +14,7 @@
#include <libwps/libwps.h>
+#include "writerperfect/WPFTEncodingDialog.hxx"
#include "MSWorksCalcImportFilter.hxx"
using com::sun::star::uno::Sequence;
@@ -26,18 +27,78 @@ using com::sun::star::uno::XComponentContext;
bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdsGenerator &rGenerator, utl::MediaDescriptor &)
{
- return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator);
+ libwps::WPSKind kind = libwps::WPS_TEXT;
+ libwps::WPSCreator creator;
+ bool needEncoding;
+ const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind, creator, needEncoding);
+
+ std::string fileEncoding("");
+ if ((kind == libwps::WPS_SPREADSHEET || kind == libwps::WPS_DATABASE) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
+ {
+ OUString title, encoding;
+ if (creator == libwps::WPS_MSWORKS)
+ {
+ title="Import MsWorks files(libwps)";
+ encoding="CP850";
+ }
+ else if (creator == libwps::WPS_LOTUS)
+ {
+ title="Import Lotus files(libwps)";
+ encoding="CP437";
+ }
+ else if (creator == libwps::WPS_SYMPHONY)
+ {
+ title="Import Symphony files(libwps)";
+ encoding="CP437";
+ }
+ else
+ {
+ title="Import Quattro Pro files(libwps)";
+ encoding="CP437";
+ }
+ try
+ {
+ const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(nullptr, &title, &encoding);
+ if (pDlg->Execute() == RET_OK)
+ {
+ if (!pDlg->GetEncoding().isEmpty())
+ fileEncoding=pDlg->GetEncoding().toUtf8().getStr();
+ }
+ // we can fail because we are in headless mode, the user has cancelled conversion, ...
+ else if (pDlg->hasUserCalledCancel())
+ return false;
+ }
+ catch (...)
+ {
+ }
+ }
+ return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator, "", fileEncoding.c_str());
}
bool MSWorksCalcImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
{
libwps::WPSKind kind = libwps::WPS_TEXT;
- const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind);
+ libwps::WPSCreator creator;
+ bool needEncoding;
+ const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind, creator, needEncoding);
- if ((kind == libwps::WPS_SPREADSHEET || kind == libwps::WPS_DATABASE) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT))
+ if ((kind == libwps::WPS_SPREADSHEET || kind == libwps::WPS_DATABASE) && confidence == libwps::WPS_CONFIDENCE_EXCELLENT)
{
- rTypeName = "calc_MS_Works_Document";
- return true;
+ if (creator == libwps::WPS_MSWORKS)
+ {
+ rTypeName = "calc_MS_Works_Document";
+ return true;
+ }
+ if (creator == libwps::WPS_LOTUS || creator == libwps::WPS_SYMPHONY)
+ {
+ rTypeName = "calc_WPS_Lotus_Document";
+ return true;
+ }
+ if (creator == libwps::WPS_QUATTRO_PRO)
+ {
+ rTypeName = "calc_WPS_QPro_Document";
+ return true;
+ }
}
return false;
diff --git a/writerperfect/source/common/WPFTEncodingDialog.cxx b/writerperfect/source/common/WPFTEncodingDialog.cxx
new file mode 100644
index 000000000000..4e04304a5247
--- /dev/null
+++ b/writerperfect/source/common/WPFTEncodingDialog.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <writerperfect/WPFTEncodingDialog.hxx>
+
+namespace writerperfect
+{
+
+namespace
+{
+
+struct EncodingImplementation
+{
+
+ static OUString const(s_encodings[]);
+
+ static int numEncodings();
+ static void insertEncodings(ListBox *box);
+ static void selectEncoding(ListBox *box, const OUString *encoding);
+ static OUString getEncoding(ListBox *box);
+};
+
+OUString const(EncodingImplementation::s_encodings[])=
+{
+ "MacArabic", "Arabic (Apple Macintosh)",
+ "CP864", "Arabic (DOS/OS2-864)",
+ "CP1006", "Arabic (IBM-1006)",
+ "CP1256", "Arabic (Windows-1256)",
+ "CP775", "Baltic (DOS/OS2-775)",
+ "CP1257", "Baltic (Windows-1257)",
+ "MacCeltic", "Celtic (Apple Macintosh)",
+ "MacCyrillic", "Cyrillic (Apple Macintosh)",
+ "CP855", "Cyrillic (DOS/OS2-855)",
+ "CP866", "Cyrillic (DOS/OS2-866/Russian)",
+ "CP1251", "Cyrillic (Windows-1251)",
+ "MacCEurope", "Eastern Europe (Apple Macintosh)",
+ "MacCroatian", "Eastern Europe (Apple Macintosh/Croatian)",
+ "MacRomanian", "Eastern Europe (Apple Macintosh/Romanian)",
+ "CP852", "Eastern Europe (DOS/OS2-852)",
+ "CP1250", "Eastern Europe (Windows-1250/WinLatin 2)",
+ "MacGreek", "Greek (Apple Macintosh)",
+ "CP737", "Greek (DOS/OS2-737)",
+ "CP869", "Greek (DOS/OS2-869/Greek-2)",
+ "CP875", "Greek (DOS/OS2-875)",
+ "CP1253", "Greek (Windows-1253)",
+ "MacHebrew", "Hebrew (Apple Macintosh)",
+ "CP424", "Hebrew (DOS/OS2-424)",
+ "CP856", "Hebrew (DOS/OS2-856)",
+ "CP862", "Hebrew (DOS/OS2-862)",
+ "CP1255", "Hebrew (Windows-1255)",
+ "CP500", "International (DOS/OS2-500)",
+ "MacThai", "Thai (Apple Macintosh)",
+ "CP874", "Thai (DOS/OS2-874)",
+ "MacTurkish", "Turkish (Apple Macintosh)",
+ "CP857", "Turkish (DOS/OS2-857)",
+ "CP1026", "Turkish (DOS/OS2-1026)",
+ "CP1254", "Turkish (Windows-1254)",
+ "CP1258", "Vietnamese (Windows-1258)",
+ "MacRoman", "Western Europe (Apple Macintosh)",
+ "MacIceland", "Western Europe (Apple Macintosh/Icelandic)",
+ "CP037", "Western Europe (DOS/OS2-037/US-Canada)",
+ "CP437", "Western Europe (DOS/OS2-437/US)",
+ "CP850", "Western Europe (DOS/OS2-850)",
+ "CP860", "Western Europe (DOS/OS2-860/Portuguese)",
+ "CP861", "Western Europe (DOS/OS2-861/Icelandic)",
+ "CP863", "Western Europe (DOS/OS2-863/French)",
+ "CP865", "Western Europe (DOS/OS2-865/Nordic)",
+ "CP1252", "Western Europe (Windows-1252/WinLatin 1)"
+};
+
+int EncodingImplementation::numEncodings()
+{
+ return int(sizeof(s_encodings)/(2*sizeof(const OUString *)));
+}
+
+void EncodingImplementation::insertEncodings(ListBox *box)
+{
+ sal_IntPtr num=sal_IntPtr(numEncodings());
+ for (sal_IntPtr i=0; i<num; ++i)
+ {
+ sal_IntPtr nAt=box->InsertEntry(s_encodings[2*i+1]);
+ box->SetEntryData(nAt, reinterpret_cast<void *>(i));
+ }
+}
+
+void EncodingImplementation::selectEncoding(ListBox *box, const OUString *encoding)
+{
+ if (!encoding)
+ return;
+ sal_IntPtr num=sal_IntPtr(numEncodings());
+ for (sal_IntPtr i=0; i<num; ++i)
+ {
+ if (*encoding!=s_encodings[2*i]) continue;
+ box->SelectEntryPos(i);
+ return;
+ }
+}
+
+OUString EncodingImplementation::getEncoding(ListBox *box)
+{
+ sal_IntPtr pos=(sal_IntPtr) box->GetSelectEntryData();
+ if (pos<0||pos>=numEncodings())
+ return OUString();
+ return s_encodings[2*pos];
+}
+
+}
+
+WPFTEncodingDialog::WPFTEncodingDialog(
+ vcl::Window *pParent,
+ const OUString *pStrTitle,
+ const OUString *encoding)
+ : ModalDialog(pParent, "WPFTEncodingDialog", "writerperfect/ui/WPFTEncodingDialog.ui"),
+ m_pLbCharset(), m_pBtnOk(), m_pBtnCancel(), m_userHasCancelled(false)
+{
+ get(m_pLbCharset, "comboboxtext");
+ get(m_pBtnOk, "ok");
+ get(m_pBtnCancel, "cancel");
+
+ m_pBtnCancel->SetClickHdl(LINK(this, WPFTEncodingDialog, CancelHdl));
+
+ EncodingImplementation::insertEncodings(m_pLbCharset);
+ m_pLbCharset->SetStyle(m_pLbCharset->GetStyle() | WB_SORT);
+ // m_pLbCharset->set_height_request(6 * m_pLbCharset->GetTextHeight());
+ m_pLbCharset->SetDoubleClickHdl(LINK(this, WPFTEncodingDialog, DoubleClickHdl));
+ if (encoding)
+ EncodingImplementation::selectEncoding(m_pLbCharset, encoding);
+ m_pLbCharset->Show();
+
+ if (pStrTitle)
+ SetText(*pStrTitle);
+}
+
+WPFTEncodingDialog::~WPFTEncodingDialog()
+{
+}
+
+OUString WPFTEncodingDialog::GetEncoding() const
+{
+ return EncodingImplementation::getEncoding(m_pLbCharset);
+}
+
+IMPL_LINK_NOARG(WPFTEncodingDialog, CancelHdl)
+{
+ m_userHasCancelled=true;
+ Close();
+ return 0;
+}
+
+IMPL_LINK(WPFTEncodingDialog, DoubleClickHdl, ListBox *, pLb)
+{
+ if (pLb == m_pLbCharset)
+ {
+ m_pBtnOk->Click();
+ }
+ return 0;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx
index 61c54f5779b4..f06a21a08ee6 100644
--- a/writerperfect/source/writer/MSWorksImportFilter.cxx
+++ b/writerperfect/source/writer/MSWorksImportFilter.cxx
@@ -9,11 +9,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <boost/scoped_ptr.hpp>
#include <com/sun/star/uno/Reference.h>
#include <cppuhelper/supportsservice.hxx>
#include <libwps/libwps.h>
+#include "writerperfect/WPFTEncodingDialog.hxx"
#include "MSWorksImportFilter.hxx"
using com::sun::star::uno::Sequence;
@@ -33,13 +35,41 @@ static bool handleEmbeddedWKSObject(const librevenge::RVNGBinaryData &data, OdfD
bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdtGenerator &rGenerator, utl::MediaDescriptor &)
{
- return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator);
+ libwps::WPSKind kind = libwps::WPS_TEXT;
+ libwps::WPSCreator creator;
+ bool needEncoding;
+ const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind, creator, needEncoding);
+
+ std::string fileEncoding("");
+ try
+ {
+ if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
+ {
+ OUString title("Import MsWorks files(libwps)");
+ OUString encoding("CP850");
+ const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(nullptr, &title, &encoding);
+ if (pDlg->Execute() == RET_OK)
+ {
+ if (!pDlg->GetEncoding().isEmpty())
+ fileEncoding=pDlg->GetEncoding().toUtf8().getStr();
+ }
+ // we can fail because we are in headless mode, the user has cancelled conversion, ...
+ else if (pDlg->hasUserCalledCancel())
+ return false;
+ }
+ }
+ catch (...)
+ {
+ }
+ return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator, "", fileEncoding.c_str());
}
bool MSWorksImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
{
libwps::WPSKind kind = libwps::WPS_TEXT;
- const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind);
+ libwps::WPSCreator creator;
+ bool needEncoding;
+ const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind, creator, needEncoding);
if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT))
{
diff --git a/writerperfect/uiconfig/ui/wpftencodingdialog.ui b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
new file mode 100644
index 000000000000..bf00869466d7
--- /dev/null
+++ b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+ <requires lib="gtk+" version="3.12"/>
+ <object class="GtkDialog" id="WPFTEncodingDialog">
+ <property name="can_focus">False</property>
+ <property name="modal">True</property>
+ <property name="default_height">-1</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <property name="yalign">0.62000000476837158</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-undo</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Character set:</property>
+ <attributes>
+ <attribute name="weight" value="semibold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="comboboxtext">
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ </action-widgets>
+ </object>
+</interface>