diff options
Diffstat (limited to 'sc/source/ui/unoobj/scdetect.cxx')
-rw-r--r-- | sc/source/ui/unoobj/scdetect.cxx | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index affedff83c7b..1407c12e2618 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -125,7 +125,7 @@ static const sal_Char __FAR_DATA pFilterHtmlWeb[] = "calc_HTML_WebQuery"; static const sal_Char __FAR_DATA pFilterRtf[] = "Rich Text Format (StarCalc)"; -static BOOL lcl_MayBeAscii( SvStream& rStream ) +static sal_Bool lcl_MayBeAscii( SvStream& rStream ) { // ASCII/CSV is considered possible if there are no null bytes, or a Byte // Order Mark is present, or if, for Unicode UCS2/UTF-16, all null bytes @@ -136,12 +136,12 @@ static BOOL lcl_MayBeAscii( SvStream& rStream ) const size_t nBufSize = 2048; sal_uInt16 aBuffer[ nBufSize ]; sal_uInt8* pByte = reinterpret_cast<sal_uInt8*>(aBuffer); - ULONG nBytesRead = rStream.Read( pByte, nBufSize*2); + sal_uLong nBytesRead = rStream.Read( pByte, nBufSize*2); if ( nBytesRead >= 2 && (aBuffer[0] == 0xfffe || aBuffer[0] == 0xfeff) ) { // Unicode BOM file may contain null bytes. - return TRUE; + return sal_True; } const sal_uInt16* p = aBuffer; @@ -159,13 +159,13 @@ static BOOL lcl_MayBeAscii( SvStream& rStream ) return nMask != 0; } -static BOOL lcl_MayBeDBase( SvStream& rStream ) +static sal_Bool lcl_MayBeDBase( SvStream& rStream ) { // Look for dbf marker, see connectivity/source/inc/dbase/DTable.hxx // DBFType for values. - const BYTE nValidMarks[] = { + const sal_uInt8 nValidMarks[] = { 0x03, 0x04, 0x05, 0x30, 0x43, 0xB3, 0x83, 0x8b, 0x8e, 0xf5 }; - BYTE nMark; + sal_uInt8 nMark; rStream.Seek(STREAM_SEEK_TO_BEGIN); rStream >> nMark; bool bValidMark = false; @@ -175,24 +175,24 @@ static BOOL lcl_MayBeDBase( SvStream& rStream ) bValidMark = true; } if ( !bValidMark ) - return FALSE; + return sal_False; const size_t nHeaderBlockSize = 32; // Empty dbf is >= 32*2+1 bytes in size. const size_t nEmptyDbf = nHeaderBlockSize * 2 + 1; rStream.Seek(STREAM_SEEK_TO_END); - ULONG nSize = rStream.Tell(); + sal_uLong nSize = rStream.Tell(); if ( nSize < nEmptyDbf ) - return FALSE; + return sal_False; // length of header starts at 8 rStream.Seek(8); - USHORT nHeaderLen; + sal_uInt16 nHeaderLen; rStream >> nHeaderLen; if ( nHeaderLen < nEmptyDbf || nSize < nHeaderLen ) - return FALSE; + return sal_False; // Last byte of header must be 0x0d, this is how it's specified. // #i9581#,#i26407# but some applications don't follow the specification @@ -200,8 +200,8 @@ static BOOL lcl_MayBeDBase( SvStream& rStream ) // even boundary. Some (#i88577# ) even pad more or pad using a 0x1a ^Z // control character (#i8857#). This results in: // Last byte of header must be 0x0d on 32 bytes boundary. - USHORT nBlocks = (nHeaderLen - 1) / nHeaderBlockSize; - BYTE nEndFlag = 0; + sal_uInt16 nBlocks = (nHeaderLen - 1) / nHeaderBlockSize; + sal_uInt8 nEndFlag = 0; while ( nBlocks > 1 && nEndFlag != 0x0d ) { rStream.Seek( nBlocks-- * nHeaderBlockSize ); rStream >> nEndFlag; @@ -211,12 +211,12 @@ static BOOL lcl_MayBeDBase( SvStream& rStream ) } #if 0 -static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) +static sal_Bool lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) { if ( !pFilter ) - return FALSE; + return sal_False; - // TRUE for XML file or template + // sal_True for XML file or template // (template filter has no internal name -> allow configuration key names) String aName(pFilter->GetFilterName()); @@ -310,7 +310,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) SfxAllItemSet *pSet = new SfxAllItemSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, lDescriptor, *pSet ); - SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); + SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_DOC_READONLY, sal_False ); bWasReadOnly = pItem && pItem->GetValue(); @@ -333,10 +333,10 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) pFilter = aMatcher.GetFilter4EA( aTypeName ); // ctor of SfxMedium uses owner transition of ItemSet - SfxMedium aMedium( aURL, bWasReadOnly ? STREAM_STD_READ : STREAM_STD_READWRITE, FALSE, NULL, pSet ); - aMedium.UseInteractionHandler( TRUE ); + SfxMedium aMedium( aURL, bWasReadOnly ? STREAM_STD_READ : STREAM_STD_READWRITE, sal_False, NULL, pSet ); + aMedium.UseInteractionHandler( sal_True ); - BOOL bIsStorage = aMedium.IsStorage(); + sal_Bool bIsStorage = aMedium.IsStorage(); if ( aMedium.GetErrorCode() == ERRCODE_NONE ) { // remember input stream and content and put them into the descriptor later @@ -380,7 +380,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) String aFilterName; if ( pFilter ) aFilterName = pFilter->GetName(); - aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : FALSE, &aFilterName ); + aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : sal_False, &aFilterName ); } catch( lang::WrappedTargetException& aWrap ) { @@ -441,22 +441,22 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) pFilter = 0; if ( pStream ) { - SotStorageRef aStorage = new SotStorage ( pStream, FALSE ); + SotStorageRef aStorage = new SotStorage ( pStream, sal_False ); if ( !aStorage->GetError() ) { // Excel-5: detect through contained streams // there are some "excel" formats from 3rd party vendors that need to be distinguished String aStreamName(RTL_CONSTASCII_STRINGPARAM("Workbook")); - BOOL bExcel97Stream = ( aStorage->IsStream( aStreamName ) ); + sal_Bool bExcel97Stream = ( aStorage->IsStream( aStreamName ) ); aStreamName = String(RTL_CONSTASCII_STRINGPARAM("Book")); - BOOL bExcel5Stream = ( aStorage->IsStream( aStreamName ) ); + sal_Bool bExcel5Stream = ( aStorage->IsStream( aStreamName ) ); if ( bExcel97Stream || bExcel5Stream ) { if ( bExcel97Stream ) { String aOldName; - BOOL bIsCalcFilter = TRUE; + sal_Bool bIsCalcFilter = sal_True; if ( pPreselectedFilter ) { // cross filter; now this should be a type detection only, not a filter detection @@ -485,7 +485,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) else if ( bExcel5Stream ) { String aOldName; - BOOL bIsCalcFilter = TRUE; + sal_Bool bIsCalcFilter = sal_True; if ( pPreselectedFilter ) { // cross filter; now this should be a type detection only, not a filter detection @@ -529,18 +529,18 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) #define M_ALT(ANZ) (0x0200+(ANZ)) #define M_ENDE 0x8000 - static const UINT16 pLotus[] = // Lotus 1/1A/2 + static const sal_uInt16 pLotus[] = // Lotus 1/1A/2 { 0x0000, 0x0000, 0x0002, 0x0000, M_ALT(2), 0x0004, 0x0006, 0x0004, M_ENDE }; - static const UINT16 pLotusNew[] = // Lotus >= 9.7 + static const sal_uInt16 pLotusNew[] = // Lotus >= 9.7 { 0x0000, 0x0000, M_DC, 0x0000, // Rec# + Len (0x1a) M_ALT(3), 0x0003, 0x0004, 0x0005, // File Revision Code 97->ME 0x0010, 0x0004, 0x0000, 0x0000, M_ENDE }; - static const UINT16 pExcel1[] = // Excel BIFF2, BIFF3, BIFF4 + static const sal_uInt16 pExcel1[] = // Excel BIFF2, BIFF3, BIFF4 { 0x09, // lobyte of BOF rec ID (0x0009, 0x0209, 0x0409) M_ALT(3), 0x00, 0x02, 0x04, // hibyte of BOF rec ID (0x0009, 0x0209, 0x0409) M_ALT(3), 4, 6, 8, // lobyte of BOF rec size (4, 6, 8, 16) @@ -550,7 +550,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) 0x00, // hibyte of data type (0x0010, 0x0020, 0x0040) M_ENDE }; - static const UINT16 pExcel2[] = // Excel BIFF4 Workspace + static const sal_uInt16 pExcel2[] = // Excel BIFF4 Workspace { 0x09, // lobyte of BOF rec ID (0x0409) 0x04, // hibyte of BOF rec ID (0x0409) M_ALT(3), 4, 6, 8, // lobyte of BOF rec size (4, 6, 8, 16) @@ -560,7 +560,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) 0x01, // hibyte of data type (0x0100) M_ENDE }; - static const UINT16 pExcel3[] = // #i23425# Excel BIFF5, BIFF7, BIFF8 (simple book stream) + static const sal_uInt16 pExcel3[] = // #i23425# Excel BIFF5, BIFF7, BIFF8 (simple book stream) { 0x09, // lobyte of BOF rec ID (0x0809) 0x08, // hibyte of BOF rec ID (0x0809) M_ALT(4), 4, 6, 8, 16, // lobyte of BOF rec size @@ -570,7 +570,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) 0x00, // hibyte of data type M_ENDE }; - static const UINT16 pSc10[] = // StarCalc 1.0 Dokumente + static const sal_uInt16 pSc10[] = // StarCalc 1.0 Dokumente { 'B', 'l', 'a', 'i', 's', 'e', '-', 'T', 'a', 'b', 'e', 'l', 'l', 'e', 0x000A, 0x000D, 0x0000, // Sc10CopyRight[16] M_DC, M_DC, M_DC, M_DC, M_DC, M_DC, M_DC, M_DC, M_DC, M_DC, M_DC, @@ -579,21 +579,21 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) 0x0000, M_ENDE }; - static const UINT16 pLotus2[] = // Lotus >3 + static const sal_uInt16 pLotus2[] = // Lotus >3 { 0x0000, 0x0000, 0x001A, 0x0000, // Rec# + Len (26) M_ALT(2), 0x0000, 0x0002, // File Revision Code 0x0010, 0x0004, 0x0000, // File Revision Subcode M_ENDE }; - static const UINT16 pQPro[] = + static const sal_uInt16 pQPro[] = { 0x0000, 0x0000, 0x0002, 0x0000, M_ALT(4), 0x0001, 0x0002, // WB1, WB2 0x0006, 0x0007, // QPro 6/7 (?) 0x0010, M_ENDE }; - static const UINT16 pDIF1[] = // DIF mit CR-LF + static const sal_uInt16 pDIF1[] = // DIF mit CR-LF { 'T', 'A', 'B', 'L', 'E', M_DC, M_DC, @@ -602,7 +602,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) '\"', M_ENDE }; - static const UINT16 pDIF2[] = // DIF mit CR oder LF + static const sal_uInt16 pDIF2[] = // DIF mit CR oder LF { 'T', 'A', 'B', 'L', 'E', M_DC, @@ -611,13 +611,13 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) '\"', M_ENDE }; - static const UINT16 pSylk[] = // Sylk + static const sal_uInt16 pSylk[] = // Sylk { 'I', 'D', ';', M_ALT(3), 'P', 'N', 'E', // 'P' plus undocumented Excel extensions 'N' and 'E' M_ENDE }; - static const UINT16 *ppFilterPatterns[] = // Arrays mit Suchmustern + static const sal_uInt16 *ppFilterPatterns[] = // Arrays mit Suchmustern { pLotus, pExcel1, @@ -631,7 +631,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) pLotus2, pQPro }; - const UINT16 nFilterCount = sizeof(ppFilterPatterns) / sizeof(ppFilterPatterns[0]); + const sal_uInt16 nFilterCount = sizeof(ppFilterPatterns) / sizeof(ppFilterPatterns[0]); static const sal_Char* const pFilterName[] = // zugehoerige Filter { @@ -648,43 +648,43 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) pFilterQPro6 }; - // const UINT16 nByteMask = 0xFF; + // const sal_uInt16 nByteMask = 0xFF; // suchen Sie jetzt! // ... realisiert ueber 'Mustererkennung' - BYTE nAkt; - BOOL bSync; // Datei und Muster stimmen ueberein - USHORT nFilter; // Zaehler ueber alle Filter - const UINT16 *pSearch; // aktuelles Musterwort + sal_uInt8 nAkt; + sal_Bool bSync; // Datei und Muster stimmen ueberein + sal_uInt16 nFilter; // Zaehler ueber alle Filter + const sal_uInt16 *pSearch; // aktuelles Musterwort for ( nFilter = 0 ; nFilter < nFilterCount ; nFilter++ ) { rStr.Seek( 0 ); // am Anfang war alles Uebel... rStr >> nAkt; pSearch = ppFilterPatterns[ nFilter ]; - bSync = TRUE; + bSync = sal_True; while( !rStr.IsEof() && bSync ) { - register UINT16 nMuster = *pSearch; + register sal_uInt16 nMuster = *pSearch; if( nMuster < 0x0100 ) { // direkter Byte-Vergleich - if( ( BYTE ) nMuster != nAkt ) - bSync = FALSE; + if( ( sal_uInt8 ) nMuster != nAkt ) + bSync = sal_False; } else if( nMuster & M_DC ) { // don't care } else if( nMuster & M_ALT(0) ) { // alternative Bytes - BYTE nAnzAlt = ( BYTE ) nMuster; - bSync = FALSE; // zunaechst unsynchron + sal_uInt8 nAnzAlt = ( sal_uInt8 ) nMuster; + bSync = sal_False; // zunaechst unsynchron while( nAnzAlt > 0 ) { pSearch++; - if( ( BYTE ) *pSearch == nAkt ) - bSync = TRUE; // jetzt erst Synchronisierung + if( ( sal_uInt8 ) *pSearch == nAkt ) + bSync = sal_True; // jetzt erst Synchronisierung nAnzAlt--; } } @@ -700,7 +700,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) { // gefundenen Filter einstellen pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterName[ nFilter ]) ); } - bSync = FALSE; // leave inner loop + bSync = sal_False; // leave inner loop nFilter = nFilterCount; // leave outer loop } else |