Kaydet (Commit) 9f1cc58c authored tarafından Muthu Subramanian K's avatar Muthu Subramanian K

Merging sc-xml-with-xls-ext.diff from patches.

These changes allow xml files with .xls extensions
to be opened in calc.
üst 770a8c2d
...@@ -116,6 +116,7 @@ static const sal_Char __FAR_DATA pFilterExcel95[] = "MS Excel 95"; ...@@ -116,6 +116,7 @@ static const sal_Char __FAR_DATA pFilterExcel95[] = "MS Excel 95";
static const sal_Char __FAR_DATA pFilterEx95Temp[] = "MS Excel 95 Vorlage/Template"; static const sal_Char __FAR_DATA pFilterEx95Temp[] = "MS Excel 95 Vorlage/Template";
static const sal_Char __FAR_DATA pFilterExcel97[] = "MS Excel 97"; static const sal_Char __FAR_DATA pFilterExcel97[] = "MS Excel 97";
static const sal_Char __FAR_DATA pFilterEx97Temp[] = "MS Excel 97 Vorlage/Template"; static const sal_Char __FAR_DATA pFilterEx97Temp[] = "MS Excel 97 Vorlage/Template";
static const sal_Char __FAR_DATA pFilter2003XML[] = "MS Excel 2003 XML";
static const sal_Char __FAR_DATA pFilterDBase[] = "dBase"; static const sal_Char __FAR_DATA pFilterDBase[] = "dBase";
static const sal_Char __FAR_DATA pFilterDif[] = "DIF"; static const sal_Char __FAR_DATA pFilterDif[] = "DIF";
static const sal_Char __FAR_DATA pFilterSylk[] = "SYLK"; static const sal_Char __FAR_DATA pFilterSylk[] = "SYLK";
...@@ -439,7 +440,8 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) ...@@ -439,7 +440,8 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
bool bIsXLS = false; bool bIsXLS = false;
SvStream* pStream = aMedium.GetInStream(); SvStream* pStream = aMedium.GetInStream();
const SfxFilter* pPreselectedFilter = pFilter; const SfxFilter* pPreselectedFilter = pFilter;
if ( pPreselectedFilter && pPreselectedFilter->GetName().SearchAscii("Excel") != STRING_NOTFOUND ) if ( ( pPreselectedFilter && pPreselectedFilter->GetName().SearchAscii("Excel") != STRING_NOTFOUND ) ||
( !aPreselectedFilterName.Len() && pPreselectedFilter->GetFilterName().EqualsAscii( pFilterAscii ) ) )
bIsXLS = true; bIsXLS = true;
pFilter = 0; pFilter = 0;
if ( pStream ) if ( pStream )
...@@ -722,13 +724,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) ...@@ -722,13 +724,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// without the preselection other filters (Writer) take precedence // without the preselection other filters (Writer) take precedence
// DBase can't be detected reliably, so it also needs preselection // DBase can't be detected reliably, so it also needs preselection
bool bMaybeText = lcl_MayBeAscii( rStr ); bool bMaybeText = lcl_MayBeAscii( rStr );
if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && bMaybeText )
{
// Text filter is accepted if preselected
pFilter = pPreselectedFilter;
}
else
{
// get file header // get file header
rStr.Seek( 0 ); rStr.Seek( 0 );
const int nTrySize = 80; const int nTrySize = 80;
...@@ -755,19 +751,24 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) ...@@ -755,19 +751,24 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
bFakeXLS = true; bFakeXLS = true;
} }
} }
else if ( bIsXLS && bMaybeText )
{
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) );
bFakeXLS = true;
}
else if ( aHeader.CompareTo( "{\\rtf", 5 ) == COMPARE_EQUAL ) else if ( aHeader.CompareTo( "{\\rtf", 5 ) == COMPARE_EQUAL )
{ {
// test for RTF // test for RTF
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterRtf) ); pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterRtf) );
} }
else if ( bIsXLS && bMaybeText )
{
aHeader.EraseLeadingChars();
if( aHeader.CompareTo( "<?xml", 5 ) == COMPARE_EQUAL )
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilter2003XML) );
else
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) );
bFakeXLS = true;
}
else if ( pPreselectedFilter->GetName().EqualsAscii(pFilterDBase) && lcl_MayBeDBase( rStr ) ) else if ( pPreselectedFilter->GetName().EqualsAscii(pFilterDBase) && lcl_MayBeDBase( rStr ) )
pFilter = pPreselectedFilter; pFilter = pPreselectedFilter;
} else if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && bMaybeText )
pFilter = pPreselectedFilter;
} }
} }
} }
......
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