[Libreoffice-commits] core.git: filter/Configuration_filter.mk filter/source writerperfect/source
Sean Young
sean at mess.org
Tue Oct 6 07:02:14 PDT 2015
filter/Configuration_filter.mk | 2 +
filter/source/config/fragments/filters/MS_Write.xcu | 30 +++++++++++++++
filter/source/config/fragments/types/writer_MS_Write.xcu | 29 ++++++++++++++
writerperfect/source/writer/MSWorksImportFilter.cxx | 25 +++++++++++-
4 files changed, 84 insertions(+), 2 deletions(-)
New commits:
commit c399caebe35e57d55edc4fcc19a7276a23e2645f
Author: Sean Young <sean at mess.org>
Date: Sun Oct 4 19:41:17 2015 +0100
Add Microsoft Write conversion
Change-Id: I528fd1e83c2cdd89fb13504beb9f86da9e02122d
Reviewed-on: https://gerrit.libreoffice.org/19182
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 5fe58b0..0357926 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -323,6 +323,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_writer_types.xcu
writer_StarOffice_XML_Writer \
writer_WordPerfect_Document \
writer_MS_Works_Document \
+ writer_MS_Write \
writer_Beagle_Works \
writer_ClarisWorks \
writer_DocMaker \
@@ -385,6 +386,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writer_filters
StarOffice_XML__Writer_ \
WordPerfect \
MS_Works \
+ MS_Write \
Beagle_Works \
ClarisWorks \
DocMaker \
diff --git a/filter/source/config/fragments/filters/MS_Write.xcu b/filter/source/config/fragments/filters/MS_Write.xcu
new file mode 100644
index 0000000..0616138
--- /dev/null
+++ b/filter/source/config/fragments/filters/MS_Write.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="MS_Write" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.MSWorksImportFilter</value></prop>
+ <prop oor:name="UserData"><value>WRI</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Microsoft Write</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>writer_MS_Write</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Write.xcu b/filter/source/config/fragments/types/writer_MS_Write.xcu
new file mode 100644
index 0000000..f42dca6
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_MS_Write.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="writer_MS_Write" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.Writer.MSWorksImportFilter</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>wri</value></prop>
+ <prop oor:name="MediaType"><value></value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>MS_Write</value></prop>
+ <prop oor:name="UIName">
+ <value>Microsoft Write</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx
index ff1e49d..42bd1cd 100644
--- a/writerperfect/source/writer/MSWorksImportFilter.cxx
+++ b/writerperfect/source/writer/MSWorksImportFilter.cxx
@@ -42,7 +42,7 @@ bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput,
std::string fileEncoding("");
try
{
- if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
+ if ((kind == libwps::WPS_TEXT) && (creator == libwps::WPS_MSWORKS) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
{
const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(
"Import MsWorks files(libwps)", "CP850");
@@ -55,6 +55,20 @@ bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput,
else if (pDlg->hasUserCalledCancel())
return false;
}
+ else if ((kind == libwps::WPS_TEXT) && (creator == libwps::WPS_MSWRITE) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
+ {
+ const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(
+ "Import MsWrite files(libwps)", "CP1252");
+ 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 (css::uno::Exception &e)
{
@@ -72,7 +86,14 @@ bool MSWorksImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OU
if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT))
{
- rTypeName = "writer_MS_Works_Document";
+ if (creator == libwps::WPS_MSWORKS)
+ {
+ rTypeName = "writer_MS_Works_Document";
+ }
+ else
+ {
+ rTypeName = "writer_MS_Write";
+ }
return true;
}
More information about the Libreoffice-commits
mailing list