diff options
author | Ingrid Halama <iha@openoffice.org> | 2010-06-01 11:40:18 +0200 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2010-06-01 11:40:18 +0200 |
commit | 675696c68217bac964cd6823aca4007832a6f005 (patch) | |
tree | 886480df5e83f0505b8ca84ff7f48f1987e36a36 /sc/source/ui/unoobj/scdetect.cxx | |
parent | dbafc22792c13d5f909447d84525a9d923430266 (diff) | |
parent | a24ed4a9d146127a698669b23635ba565c0f2e2f (diff) |
chart47: merge with DEV300_m80
Diffstat (limited to 'sc/source/ui/unoobj/scdetect.cxx')
-rw-r--r-- | sc/source/ui/unoobj/scdetect.cxx | 27 |
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 |