summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-04-05 19:48:10 +0200
committerEike Rathke <erack@redhat.com>2012-04-05 19:48:37 +0200
commit0de1b33bf73f075cff12fbe288129b2afff8216d (patch)
treeda1c335f099631fe1bf12da9378bc607a8a04d47
parent0d5f437bf7ee3ea8cf9787ccf8bf22d67eee92b8 (diff)
resolved fdo#48347 do not override preselected CSV with SYLK detection
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 0efb037f0a02..fdab3736a9ee 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -444,8 +444,10 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
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() && pPreselectedFilter->GetFilterName().EqualsAscii( pFilterAscii ) ) ) )
+ ( !aPreselectedFilterName.Len() && bCsvSelected ) ) )
bIsXLS = true;
pFilter = 0;
if ( pStream )
@@ -676,9 +678,15 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
for ( nFilter = 0 ; nFilter < nFilterCount ; nFilter++ )
{
+ pSearch = ppFilterPatterns[ nFilter ];
+ if (bCsvSelected && pSearch == pSylk)
+ // SYLK 4 characters is really too weak to
+ // override preselected CSV, already ID;Name
+ // would trigger that. fdo#48347
+ continue;
+
rStr.Seek( 0 ); // am Anfang war alles Uebel...
rStr >> nAkt;
- pSearch = ppFilterPatterns[ nFilter ];
bSync = sal_True;
while( !rStr.IsEof() && bSync )
{
@@ -759,7 +767,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
}
else if ( pPreselectedFilter->GetName().EqualsAscii(pFilterDBase) && lcl_MayBeDBase( rStr ) )
pFilter = pPreselectedFilter;
- else if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && bMaybeText )
+ else if ( bCsvSelected && bMaybeText )
pFilter = pPreselectedFilter;
else if ( HTMLParser::IsHTMLFormat(aHeader.getStr()) )
{
@@ -789,7 +797,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
{
// 0-length stream, preselected Text/CSV is ok, user
// may want to write to that file later.
- if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) )
+ if ( bCsvSelected )
pFilter = pPreselectedFilter;
}
}