[Libreoffice-commits] core.git: sc/source vcl/workben
Caolán McNamara
caolanm at redhat.com
Tue Nov 7 09:03:25 UTC 2017
sc/source/filter/excel/excel.cxx | 14 ++++++++++++++
sc/source/filter/lotus/lotus.cxx | 19 ++++++-------------
vcl/workben/fftester.cxx | 14 ++++++++++++++
3 files changed, 34 insertions(+), 13 deletions(-)
New commits:
commit c96c7c8b6bfc3a12745c505937e1d3b8dc6591ab
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 6 15:15:10 2017 +0000
add 1-2-3 wks to fftester
Change-Id: I4deb6831a809d516d286a90903b7b89c8e07b2b0
Reviewed-on: https://gerrit.libreoffice.org/44367
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index ca4262d8cbaa..fb72a5cd73f3 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -266,4 +266,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportXLS(SvStream& rStream)
return bRet;
}
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWKS(SvStream& rStream)
+{
+ ScDLL::Init();
+ SfxMedium aMedium;
+ css::uno::Reference<css::io::XInputStream> xStm(new utl::OInputStreamWrapper(rStream));
+ aMedium.GetItemSet()->Put(SfxUsrAnyItem(SID_INPUTSTREAM, css::uno::makeAny(xStm)));
+ ScDocument aDocument;
+ ScDocOptions aDocOpt = aDocument.GetDocOptions();
+ aDocOpt.SetLookUpColRowNames(false);
+ aDocument.SetDocOptions(aDocOpt);
+ aDocument.MakeTable(0);
+ return ScFormatFilter::Get().ScImportLotus123(aMedium, &aDocument, RTL_TEXTENCODING_ASCII_US) == ERRCODE_NONE;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/lotus.cxx b/sc/source/filter/lotus/lotus.cxx
index 89d1d6a985fb..4eca011a212f 100644
--- a/sc/source/filter/lotus/lotus.cxx
+++ b/sc/source/filter/lotus/lotus.cxx
@@ -22,6 +22,7 @@
#include <sfx2/docfile.hxx>
#include <tools/urlobj.hxx>
+#include <unotools/configmgr.hxx>
#include <scerrors.hxx>
#include <root.hxx>
@@ -30,16 +31,10 @@
ErrCode ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocument* pDocument, rtl_TextEncoding eSrc )
{
- ScFilterOptions aFilterOpt;
- bool bWithWK3 = aFilterOpt.GetWK3Flag();
-
- SvStream* pStream = rMedium.GetInStream();
-
- if( !pStream )
+ SvStream* pStream = rMedium.GetInStream();
+ if (!pStream)
return SCERR_IMPORT_OPEN;
- ErrCode eRet;
-
pStream->Seek( 0 );
pStream->SetBufferSize( 32768 );
@@ -48,7 +43,9 @@ ErrCode ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocume
ImportLotus aLotusImport(aContext, *pStream, pDocument, eSrc);
- if( bWithWK3 )
+ const bool bWithWK3 = utl::ConfigManager::IsAvoidConfig() || ScFilterOptions().GetWK3Flag();
+ ErrCode eRet;
+ if (bWithWK3)
eRet = aLotusImport.Read();
else
eRet = ErrCode(0xFFFFFFFF); // force WK1 /WKS
@@ -57,13 +54,9 @@ ErrCode ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocume
if( eRet == ErrCode(0xFFFFFFFF) )
{
pStream->Seek( 0 );
-
pStream->SetBufferSize( 32768 );
-
eRet = ScImportLotus123old(aContext, *pStream, pDocument, eSrc);
-
pStream->SetBufferSize( 0 );
-
return eRet;
}
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index ad8cd79a1af8..952988f32341 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -416,6 +416,20 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
SvFileStream aFileStream(out, StreamMode::READ);
ret = (int) (*pfnImport)(aFileStream);
}
+ else if (strcmp(argv[2], "wks") == 0)
+ {
+ static FFilterCall pfnImport(nullptr);
+ if (!pfnImport)
+ {
+ osl::Module aLibrary;
+ aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
+ pfnImport = reinterpret_cast<FFilterCall>(
+ aLibrary.getFunctionSymbol("TestImportWKS"));
+ aLibrary.release();
+ }
+ SvFileStream aFileStream(out, StreamMode::READ);
+ ret = (int) (*pfnImport)(aFileStream);
+ }
else if (strcmp(argv[2], "hwp") == 0)
{
static FFilterCall pfnImport(nullptr);
More information about the Libreoffice-commits
mailing list