summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/scdetect.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/unoobj/scdetect.cxx')
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index cded62efa3a8..80cb88595b11 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -256,6 +256,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
sal_Int32 nIndexOfReadOnlyFlag = -1;
sal_Int32 nIndexOfTemplateFlag = -1;
sal_Int32 nIndexOfDocumentTitle = -1;
+ bool bFakeXLS = false;
for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
{
@@ -436,8 +437,11 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
}
else
{
+ bool bIsXLS = false;
SvStream* pStream = aMedium.GetInStream();
const SfxFilter* pPreselectedFilter = pFilter;
+ if ( pPreselectedFilter && pPreselectedFilter->GetName().SearchAscii("Excel") != STRING_NOTFOUND )
+ bIsXLS = true;
pFilter = 0;
if ( pStream )
{
@@ -718,7 +722,8 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// further checks for filters only if they are preselected: ASCII, HTML, RTF, DBase
// without the preselection other filters (Writer) take precedence
// DBase can't be detected reliably, so it also needs preselection
- if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && lcl_MayBeAscii( rStr ) )
+ bool bMaybeText = lcl_MayBeAscii( rStr );
+ if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && bMaybeText )
{
// Text filter is accepted if preselected
pFilter = pPreselectedFilter;
@@ -747,8 +752,15 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
else
{
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterHtmlWeb) );
+ if ( bIsXLS )
+ bFakeXLS = true;
}
}
+ else if ( bIsXLS && bMaybeText )
+ {
+ pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) );
+ bFakeXLS = true;
+ }
else if ( aHeader.CompareTo( "{\\rtf", 5 ) == COMPARE_EQUAL )
{
// test for RTF
@@ -834,6 +846,19 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
lDescriptor[nIndexOfDocumentTitle].Value <<= aDocumentTitle;
}
+ if ( bFakeXLS )
+ {
+ if ( nIndexOfFilterName == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("FilterName");
+ lDescriptor[nPropertyCount].Value <<= rtl::OUString(pFilter->GetName());
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfFilterName].Value <<= rtl::OUString(pFilter->GetName());
+ }
+
if ( pFilter )
aTypeName = pFilter->GetTypeName();
else