[Libreoffice-commits] .: sc/source
Eike Rathke
erack at kemper.freedesktop.org
Thu May 10 10:08:02 PDT 2012
sc/source/ui/unoobj/scdetect.cxx | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
New commits:
commit aeb1451dff06ad00b1719f9bc45a2c8bdfa904f8
Author: Eike Rathke <erack at redhat.com>
Date: Thu May 10 19:07:47 2012 +0200
resolved fdo#49639 import .xls with HTML as such, not CSV
This restores the previous behavior for this content type, regression
introduced with the fix for fdo#40021 a5eadc6aaafec92df23c57e258882a2c98ece0ad
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 6ef1429..7fe787d 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -441,14 +441,13 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
}
else
{
- bool bIsXLS = false;
SvStream* pStream = aMedium.GetInStream();
const SfxFilter* pPreselectedFilter = pFilter;
- bool bCsvSelected = (pPreselectedFilter ?
- pPreselectedFilter->GetFilterName().EqualsAscii( pFilterAscii ) : false);
- if ( pPreselectedFilter && ( ( pPreselectedFilter->GetName().SearchAscii("Excel") != STRING_NOTFOUND ) ||
- ( !aPreselectedFilterName.Len() && bCsvSelected ) ) )
- bIsXLS = true;
+ bool bCsvSelected = (pPreselectedFilter &&
+ pPreselectedFilter->GetFilterName().EqualsAscii( pFilterAscii ));
+ bool bExcelSelected = (pPreselectedFilter &&
+ (pPreselectedFilter->GetName().SearchAscii("Excel") != STRING_NOTFOUND));
+ bool bIsXLS = (bExcelSelected || (bCsvSelected && !aPreselectedFilterName.Len()));
pFilter = 0;
if ( pStream )
{
@@ -750,12 +749,14 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
const sal_Size nTrySize = 80;
rtl::OString aHeader = read_uInt8s_ToOString(rStr, nTrySize);
+ bool bMaybeHtml = HTMLParser::IsHTMLFormat( aHeader.getStr());
+
if ( aHeader.copy(0, 5).equalsL("{\\rtf", 5) )
{
// test for RTF
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterRtf) );
}
- else if ( bIsXLS && bMaybeText )
+ else if ( bIsXLS && (bMaybeText && !bMaybeHtml) )
{
aHeader = comphelper::string::stripStart(aHeader, ' ');
// Detect Excel 2003 XML here only if XLS was preselected.
@@ -769,7 +770,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
pFilter = pPreselectedFilter;
else if ( bCsvSelected && bMaybeText )
pFilter = pPreselectedFilter;
- else if ( HTMLParser::IsHTMLFormat(aHeader.getStr()) )
+ else if ( bMaybeHtml )
{
// test for HTML
More information about the Libreoffice-commits
mailing list