[Libreoffice-commits] core.git: sc/source
Kohei Yoshida (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 27 18:57:35 UTC 2019
sc/source/filter/inc/orcusfiltersimpl.hxx | 2 --
sc/source/filter/orcus/orcusfiltersimpl.cxx | 12 ------------
sc/source/filter/orcus/xmlcontext.cxx | 11 +++++++++--
3 files changed, 9 insertions(+), 16 deletions(-)
New commits:
commit d9f5a8f6cf771017a52252341b75a5d9c1c389e1
Author: Kohei Yoshida <kohei at libreoffice.org>
AuthorDate: Tue Aug 27 13:55:56 2019 -0400
Commit: Kohei Yoshida <kohei at libreoffice.org>
CommitDate: Tue Aug 27 20:55:54 2019 +0200
Use getSystemPathFromFileURL() which is exactly what we need.
Change-Id: I09b77435d1dcd1c5e717fe4f976620bcdcecfb54
Reviewed-on: https://gerrit.libreoffice.org/78206
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida <kohei at libreoffice.org>
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index ac8603c6cfaf..220e32f32608 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -17,8 +17,6 @@
class ScOrcusFiltersImpl : public ScOrcusFilters
{
public:
- static OString toSystemPath(const OUString& rPath);
-
virtual bool importCSV(ScDocument& rDoc, SfxMedium& rMedium) const override;
virtual bool importGnumeric(ScDocument& rDoc, SfxMedium& rMedium) const override;
virtual bool importExcel2003XML(ScDocument& rDoc, SfxMedium& rMedium) const override;
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 0f3b03dbbd15..72e2f3612aaa 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -28,12 +28,6 @@
#include <orcus/stream.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
-#ifdef _WIN32
-#define SYSTEM_PATH FSysStyle::Dos
-#else
-#define SYSTEM_PATH FSysStyle::Unix
-#endif
-
using namespace com::sun::star;
namespace {
@@ -81,12 +75,6 @@ bool loadFileContent(SfxMedium& rMedium, orcus::iface::import_filter& filter)
}
-OString ScOrcusFiltersImpl::toSystemPath(const OUString& rPath)
-{
- INetURLObject aURL(rPath);
- return OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
-}
-
bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, SfxMedium& rMedium) const
{
ScOrcusFactory aFactory(rDoc);
diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx
index 71c44bc35823..18574b0c2a1f 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -16,6 +16,7 @@
#include <vcl/weld.hxx>
#include <ucbhelper/content.hxx>
#include <sal/log.hxx>
+#include <osl/file.hxx>
#include <orcus/xml_structure_tree.hpp>
#include <orcus/xml_namespace.hpp>
@@ -238,8 +239,14 @@ public:
void ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam& rParam)
{
ScOrcusFactory aFactory(mrDoc, true);
- OString aSysPath = ScOrcusFiltersImpl::toSystemPath(maPath);
- const char* path = aSysPath.getStr();
+
+ OUString aSysPath;
+ if (osl::FileBase::getSystemPathFromFileURL(maPath, aSysPath) != osl::FileBase::E_None)
+ return;
+
+ OString aOSysPath = OUStringToOString(aSysPath, RTL_TEXTENCODING_UTF8);
+ const char* path = aOSysPath.getStr();
+
try
{
orcus::orcus_xml filter(maNsRepo, &aFactory, nullptr);
More information about the Libreoffice-commits
mailing list