/[packages]/cauldron/libreoffice/current/SOURCES/0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch
ViewVC logotype

Contents of /cauldron/libreoffice/current/SOURCES/0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 658498 - (show annotations) (download)
Thu Jul 31 10:35:59 2014 UTC (6 years, 2 months ago) by tv
File size: 4757 byte(s)
SILENT: new file ./SOURCES/0001-avoid-problems-detecting-HTML-files-with-.xls-ext.patch
1 From 86c6f18c2766aad43d6e3bfcf3530e40440ebca7 Mon Sep 17 00:00:00 2001
2 From: David Tardon <dtardon@redhat.com>
3 Date: Tue, 8 Jul 2014 17:01:27 +0200
4 Subject: [PATCH] avoid problems detecting HTML files with .xls ext.
5
6 Change-Id: I9955223aac20f3f640fde51bb7231666c269ca70
7 ---
8 filter/Configuration_filter.mk | 1 +
9 filter/source/config/fragments/types/calc_HTML.xcu | 35 ++++++++++++++++++++++
10 filter/source/textfilterdetect/filterdetect.cxx | 6 ++--
11 3 files changed, 38 insertions(+), 4 deletions(-)
12 create mode 100644 filter/source/config/fragments/types/calc_HTML.xcu
13
14 diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
15 index e035464..0465f17 100644
16 --- a/filter/Configuration_filter.mk
17 +++ b/filter/Configuration_filter.mk
18 @@ -512,6 +512,7 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr
19 $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,filter/source/config/fragments/types,\
20 calc_DIF \
21 calc_ODS_FlatXML \
22 + calc_HTML \
23 generic_HTML \
24 generic_Text \
25 calc_Lotus \
26 diff --git a/filter/source/config/fragments/types/calc_HTML.xcu b/filter/source/config/fragments/types/calc_HTML.xcu
27 new file mode 100644
28 index 0000000..51bf8f1
29 --- /dev/null
30 +++ b/filter/source/config/fragments/types/calc_HTML.xcu
31 @@ -0,0 +1,35 @@
32 +<!--
33 + * This file is part of the LibreOffice project.
34 + *
35 + * This Source Code Form is subject to the terms of the Mozilla Public
36 + * License, v. 2.0. If a copy of the MPL was not distributed with this
37 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
38 + *
39 + * This file incorporates work covered by the following license notice:
40 + *
41 + * Licensed to the Apache Software Foundation (ASF) under one or more
42 + * contributor license agreements. See the NOTICE file distributed
43 + * with this work for additional information regarding copyright
44 + * ownership. The ASF licenses this file to you under the Apache
45 + * License, Version 2.0 (the "License"); you may not use this file
46 + * except in compliance with the License. You may obtain a copy of
47 + * the License at http://www.apache.org/licenses/LICENSE-2.0 .
48 +-->
49 + <!-- A special case: There are tools that export HTML with .xls
50 + extension. Allow to detect these early to avoid going through the
51 + whole list of detectors. This also avoids the risk of misdetection
52 + as something else, as there are some formats that are text files and
53 + the detection is just a heuristic (e.g., wp1 or wp42 supported by
54 + libwpd). -->
55 + <node oor:name="calc_HTML" oor:op="replace" >
56 + <prop oor:name="DetectService"><value>com.sun.star.comp.filters.PlainTextFilterDetect</value></prop>
57 + <prop oor:name="URLPattern"/>
58 + <prop oor:name="Extensions"><value>xls</value></prop>
59 + <prop oor:name="MediaType"><value>text/html</value></prop>
60 + <prop oor:name="Preferred"><value>false</value></prop>
61 + <prop oor:name="PreferredFilter"/>
62 + <prop oor:name="UIName">
63 + <value>HTML Table</value>
64 + </prop>
65 + <prop oor:name="ClipboardFormat"/>
66 + </node>
67 diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
68 index ffad7fa..1d29dd4 100644
69 --- a/filter/source/textfilterdetect/filterdetect.cxx
70 +++ b/filter/source/textfilterdetect/filterdetect.cxx
71 @@ -132,7 +132,7 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
72 OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET);
73 aExt = aExt.toAsciiLowerCase();
74
75 - if (aType == "generic_HTML")
76 + if ((aType == "generic_HTML") || (aType == "calc_HTML"))
77 {
78 uno::Reference<io::XInputStream> xInStream(aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM()], uno::UNO_QUERY);
79 if (!xInStream.is() || !IsHTMLStream(xInStream))
80 @@ -141,12 +141,10 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
81 // Decide which filter to use based on the document service first,
82 // then on extension if that's not available.
83
84 - if (aDocService == CALC_DOCSERVICE)
85 + if ((aDocService == CALC_DOCSERVICE) || (aType == "calc_HTML"))
86 aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER);
87 else if (aDocService == WRITER_DOCSERVICE)
88 aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(WRITER_HTML_FILTER);
89 - else if (aExt == "xls")
90 - aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER);
91 else
92 aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(WEB_HTML_FILTER);
93 }
94 --
95 1.9.3
96

  ViewVC Help
Powered by ViewVC 1.1.28