summaryrefslogtreecommitdiff
path: root/writerperfect/source/writer
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2016-02-07 13:28:31 +0000
committerDavid Tardon <dtardon@redhat.com>2016-02-15 12:15:23 +0000
commit2f7f818eeada83c0491dbf40253934d177c36621 (patch)
tree870242b73365e2c535adfccc78322fd302398432 /writerperfect/source/writer
parent2abdcfd641883f246fe78f2fbe38499c9382c059 (diff)
Add Microsoft Word for DOS conversion
Change-Id: I9e20a35dd8e18ba1a9251f4dc3ce903183c250cf Reviewed-on: https://gerrit.libreoffice.org/22368 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'writerperfect/source/writer')
-rw-r--r--writerperfect/source/writer/MSWorksImportFilter.cxx45
1 files changed, 28 insertions, 17 deletions
diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx
index b08ddb3c08dd..f8a03c8ecd15 100644
--- a/writerperfect/source/writer/MSWorksImportFilter.cxx
+++ b/writerperfect/source/writer/MSWorksImportFilter.cxx
@@ -42,23 +42,31 @@ bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput,
std::string fileEncoding("");
try
{
- if ((kind == libwps::WPS_TEXT) && (creator == libwps::WPS_MSWORKS) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
+ if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
{
- const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(
- "Import MsWorks files(libwps)", "CP850");
- if (pDlg->Execute() == RET_OK)
+ OUString title, encoding;
+
+ switch (creator)
{
- if (!pDlg->GetEncoding().isEmpty())
- fileEncoding=pDlg->GetEncoding().toUtf8().getStr();
+ case libwps::WPS_MSWORKS:
+ title = "Import MsWorks files(libwps)";
+ encoding = "CP850";
+ break;
+ case libwps::WPS_RESERVED_0: // MS Write
+ title = "Import MsWrite files(libwps)";
+ encoding = "CP1251";
+ break;
+ case libwps::WPS_RESERVED_1: // DosWord
+ title = "Import DosWord files(libwps)";
+ encoding = "CP850";
+ break;
+ default:
+ title = "Import files(libwps)";
+ encoding = "CP850";
+ break;
}
- // we can fail because we are in headless mode, the user has cancelled conversion, ...
- else if (pDlg->hasUserCalledCancel())
- return false;
- }
- else if ((kind == libwps::WPS_TEXT) && (creator == libwps::WPS_RESERVED_0) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
- {
- const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(
- "Import MsWrite files(libwps)", "CP1252");
+
+ const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(title, encoding);
if (pDlg->Execute() == RET_OK)
{
if (!pDlg->GetEncoding().isEmpty())
@@ -68,7 +76,6 @@ bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput,
else if (pDlg->hasUserCalledCancel())
return false;
}
-
}
catch (css::uno::Exception &e)
{
@@ -90,11 +97,15 @@ bool MSWorksImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OU
{
rTypeName = "writer_MS_Works_Document";
}
- else
+ else if (creator == libwps::WPS_RESERVED_0)
{
- // NOTE: this handles MS Word for DOS too ATM
rTypeName = "writer_MS_Write";
}
+ else
+ {
+ rTypeName = "writer_DosWord";
+ }
+
return true;
}