Kaydet (Commit) 1298c1d1 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

We don't check the extension for html

...since 86c6f18c,
so move the related code and comment to the plain
text scope.

Change-Id: I501ebaba915ddaa3f5d1d8d2977d3ba70fb6071b
üst 65f70e0d
...@@ -125,12 +125,6 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal ...@@ -125,12 +125,6 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
OUString aType = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_TYPENAME(), OUString() ); OUString aType = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_TYPENAME(), OUString() );
OUString aDocService = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_DOCUMENTSERVICE(), OUString() ); OUString aDocService = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_DOCUMENTSERVICE(), OUString() );
OUString aUrl = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), OUString() );
// Get the file name extension.
INetURLObject aParser(aUrl);
OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET);
aExt = aExt.toAsciiLowerCase();
if ((aType == "generic_HTML") || (aType == "calc_HTML")) if ((aType == "generic_HTML") || (aType == "calc_HTML"))
{ {
...@@ -138,9 +132,6 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal ...@@ -138,9 +132,6 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
if (!xInStream.is() || !IsHTMLStream(xInStream)) if (!xInStream.is() || !IsHTMLStream(xInStream))
return OUString(); return OUString();
// Decide which filter to use based on the document service first,
// then on extension if that's not available.
if ((aDocService == CALC_DOCSERVICE) || (aType == "calc_HTML")) if ((aDocService == CALC_DOCSERVICE) || (aType == "calc_HTML"))
aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER); aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER);
else if (aDocService == WRITER_DOCSERVICE) else if (aDocService == WRITER_DOCSERVICE)
...@@ -151,6 +142,13 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal ...@@ -151,6 +142,13 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
else if (aType == "generic_Text") else if (aType == "generic_Text")
{ {
// Get the file name extension.
INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), OUString() ) );
OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET);
aExt = aExt.toAsciiLowerCase();
// 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)
aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_TEXT_FILTER); aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_TEXT_FILTER);
else if (aDocService == WRITER_DOCSERVICE) else if (aDocService == WRITER_DOCSERVICE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment