avoid problems detecting HTML files with xls ext.

f41
David Tardon 11 years ago
parent 7678f7d6d1
commit e4aa87326b

@ -0,0 +1,96 @@
From 86c6f18c2766aad43d6e3bfcf3530e40440ebca7 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Tue, 8 Jul 2014 17:01:27 +0200
Subject: [PATCH] avoid problems detecting HTML files with .xls ext.
Change-Id: I9955223aac20f3f640fde51bb7231666c269ca70
---
filter/Configuration_filter.mk | 1 +
filter/source/config/fragments/types/calc_HTML.xcu | 35 ++++++++++++++++++++++
filter/source/textfilterdetect/filterdetect.cxx | 6 ++--
3 files changed, 38 insertions(+), 4 deletions(-)
create mode 100644 filter/source/config/fragments/types/calc_HTML.xcu
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index e035464..0465f17 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -512,6 +512,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr
$(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,filter/source/config/fragments/types,\
calc_DIF \
calc_ODS_FlatXML \
+ calc_HTML \
generic_HTML \
generic_Text \
calc_Lotus \
diff --git a/filter/source/config/fragments/types/calc_HTML.xcu b/filter/source/config/fragments/types/calc_HTML.xcu
new file mode 100644
index 0000000..51bf8f1
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_HTML.xcu
@@ -0,0 +1,35 @@
+<!--
+ * 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 .
+-->
+ <!-- A special case: There are tools that export HTML with .xls
+ extension. Allow to detect these early to avoid going through the
+ whole list of detectors. This also avoids the risk of misdetection
+ as something else, as there are some formats that are text files and
+ the detection is just a heuristic (e.g., wp1 or wp42 supported by
+ libwpd). -->
+ <node oor:name="calc_HTML" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.filters.PlainTextFilterDetect</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>xls</value></prop>
+ <prop oor:name="MediaType"><value>text/html</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value>HTML Table</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index ffad7fa..1d29dd4 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -132,7 +132,7 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET);
aExt = aExt.toAsciiLowerCase();
- if (aType == "generic_HTML")
+ if ((aType == "generic_HTML") || (aType == "calc_HTML"))
{
uno::Reference<io::XInputStream> xInStream(aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM()], uno::UNO_QUERY);
if (!xInStream.is() || !IsHTMLStream(xInStream))
@@ -141,12 +141,10 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
// Decide which filter to use based on the document service first,
// then on extension if that's not available.
- if (aDocService == CALC_DOCSERVICE)
+ if ((aDocService == CALC_DOCSERVICE) || (aType == "calc_HTML"))
aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER);
else if (aDocService == WRITER_DOCSERVICE)
aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(WRITER_HTML_FILTER);
- else if (aExt == "xls")
- aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER);
else
aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(WEB_HTML_FILTER);
}
--
1.9.3

@ -46,7 +46,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice Name: libreoffice
Epoch: 1 Epoch: 1
Version: %{libo_version}.2 Version: %{libo_version}.2
Release: 1%{?libo_prerelease}%{?dist} Release: 2%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
Group: Applications/Productivity Group: Applications/Productivity
URL: http://www.libreoffice.org/ URL: http://www.libreoffice.org/
@ -304,6 +304,7 @@ Patch13: 0001-add-X-TryExec-entries-to-desktop-files.patch
Patch14: 0001-disable-PSD-import-test-which-deadlocks-on-ARM.patch Patch14: 0001-disable-PSD-import-test-which-deadlocks-on-ARM.patch
Patch15: 0001-rhbz-1111216-allow-to-export-an-empty-sheet-to-PDF.patch Patch15: 0001-rhbz-1111216-allow-to-export-an-empty-sheet-to-PDF.patch
Patch16: 0001-allow-build-with-icu-4.2.patch Patch16: 0001-allow-build-with-icu-4.2.patch
Patch17: 0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch
%define instdir %{_libdir} %define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice %define baseinstdir %{instdir}/libreoffice
@ -2275,6 +2276,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif %endif
%changelog %changelog
* Tue Jul 08 2014 David Tardon <dtardon@redhat.com> - 1:4.3.0.2-2
- avoid problems detecting HTML files with xls extension
* Wed Jul 02 2014 David Tardon <dtardon@redhat.com> - 1:4.3.0.2-1 * Wed Jul 02 2014 David Tardon <dtardon@redhat.com> - 1:4.3.0.2-1
- update to 4.3.0 rc2 - update to 4.3.0 rc2

Loading…
Cancel
Save