diff options
author | Sean Young <sean@mess.org> | 2015-10-04 19:41:17 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-10-06 14:01:48 +0000 |
commit | c399caebe35e57d55edc4fcc19a7276a23e2645f (patch) | |
tree | f65aab4c646db8ca6d71226eec3c98f0f01134f0 /writerperfect | |
parent | 7bbb14d6d617dcfd199d429b0cb964e372ed0c08 (diff) |
Add Microsoft Write conversion
Change-Id: I528fd1e83c2cdd89fb13504beb9f86da9e02122d
Reviewed-on: https://gerrit.libreoffice.org/19182
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/source/writer/MSWorksImportFilter.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx index ff1e49dd5250..42bd1cd118ab 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; } |