diff options
Diffstat (limited to 'sw/source/core/swg/swblocks.cxx')
-rw-r--r-- | sw/source/core/swg/swblocks.cxx | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 4329e7345384..3c0409b764cc 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -63,9 +63,9 @@ SV_IMPL_OP_PTRARR_SORT( SwBlockNames, SwBlockName* ); // Hash-Code errechnen (muss nicht eindeutig sein) -USHORT SwImpBlocks::Hash( const String& r ) +sal_uInt16 SwImpBlocks::Hash( const String& r ) { - USHORT n = 0; + sal_uInt16 n = 0; xub_StrLen nLen = r.Len(); if( nLen > 8 ) nLen = 8; @@ -78,14 +78,14 @@ USHORT SwImpBlocks::Hash( const String& r ) SwBlockName::SwBlockName( const String& rShort, const String& rLong, long n ) : nPos( n ), aShort( rShort ), aLong( rLong ), aPackageName (rShort), - bIsOnlyTxtFlagInit( FALSE ), bIsOnlyTxt( FALSE ) + bIsOnlyTxtFlagInit( sal_False ), bIsOnlyTxt( sal_False ) { nHashS = SwImpBlocks::Hash( rShort ); nHashL = SwImpBlocks::Hash( rLong ); } SwBlockName::SwBlockName( const String& rShort, const String& rLong, const String& rPackageName) : nPos( 0 ), aShort( rShort ), aLong( rLong ), aPackageName (rPackageName), - bIsOnlyTxtFlagInit( FALSE ), bIsOnlyTxt( FALSE ) + bIsOnlyTxtFlagInit( sal_False ), bIsOnlyTxt( sal_False ) { nHashS = SwImpBlocks::Hash( rShort ); nHashL = SwImpBlocks::Hash( rLong ); @@ -107,9 +107,9 @@ short SwImpBlocks::GetFileType( const String& rFile ) } -SwImpBlocks::SwImpBlocks( const String& rFile, BOOL ) - : aFile( rFile ), pDoc( 0 ), nCur( (USHORT)-1 ), - bReadOnly( TRUE ), bInPutMuchBlocks( FALSE ) +SwImpBlocks::SwImpBlocks( const String& rFile, sal_Bool ) + : aFile( rFile ), pDoc( 0 ), nCur( (sal_uInt16)-1 ), + bReadOnly( sal_True ), bInPutMuchBlocks( sal_False ) { FStatHelper::GetModifiedDateTimeOfFile( rFile, &aDateModified, &aTimeModified ); @@ -130,7 +130,7 @@ void SwImpBlocks::ClearDoc() pDoc->ClearDoc(); } -ULONG SwImpBlocks::GetDocForConversion( USHORT n ) +sal_uLong SwImpBlocks::GetDocForConversion( sal_uInt16 n ) { return GetDoc( n ); } @@ -147,42 +147,42 @@ SwPaM* SwImpBlocks::MakePaM() } -USHORT SwImpBlocks::GetCount() const +sal_uInt16 SwImpBlocks::GetCount() const { return aNames.Count(); } // Case Insensitive -USHORT SwImpBlocks::GetIndex( const String& rShort ) const +sal_uInt16 SwImpBlocks::GetIndex( const String& rShort ) const { String s( GetAppCharClass().upper( rShort ) ); - USHORT nHash = Hash( s ); - for( USHORT i = 0; i < aNames.Count(); i++ ) + sal_uInt16 nHash = Hash( s ); + for( sal_uInt16 i = 0; i < aNames.Count(); i++ ) { SwBlockName* pName = aNames[ i ]; if( pName->nHashS == nHash && pName->aShort == s ) return i; } - return (USHORT) -1; + return (sal_uInt16) -1; } -USHORT SwImpBlocks::GetLongIndex( const String& rLong ) const +sal_uInt16 SwImpBlocks::GetLongIndex( const String& rLong ) const { - USHORT nHash = Hash( rLong ); - for( USHORT i = 0; i < aNames.Count(); i++ ) + sal_uInt16 nHash = Hash( rLong ); + for( sal_uInt16 i = 0; i < aNames.Count(); i++ ) { SwBlockName* pName = aNames[ i ]; if( pName->nHashL == nHash && pName->aLong == rLong ) return i; } - return (USHORT) -1; + return (sal_uInt16) -1; } -const String& SwImpBlocks::GetShortName( USHORT n ) const +const String& SwImpBlocks::GetShortName( sal_uInt16 n ) const { if( n < aNames.Count() ) return aNames[ n ]->aShort; @@ -190,14 +190,14 @@ const String& SwImpBlocks::GetShortName( USHORT n ) const } -const String& SwImpBlocks::GetLongName( USHORT n ) const +const String& SwImpBlocks::GetLongName( sal_uInt16 n ) const { if( n < aNames.Count() ) return aNames[ n ]->aLong; return aEmptyStr; } -const String& SwImpBlocks::GetPackageName( USHORT n ) const +const String& SwImpBlocks::GetPackageName( sal_uInt16 n ) const { if( n < aNames.Count() ) return aNames[ n ]->aPackageName; @@ -205,20 +205,20 @@ const String& SwImpBlocks::GetPackageName( USHORT n ) const } void SwImpBlocks::AddName( const String& rShort, const String& rLong, - BOOL bOnlyTxt ) + sal_Bool bOnlyTxt ) { - USHORT nIdx = GetIndex( rShort ); - if( nIdx != (USHORT) -1 ) + sal_uInt16 nIdx = GetIndex( rShort ); + if( nIdx != (sal_uInt16) -1 ) aNames.DeleteAndDestroy( nIdx ); SwBlockName* pNew = new SwBlockName( rShort, rLong, 0L ); - pNew->bIsOnlyTxtFlagInit = TRUE; + pNew->bIsOnlyTxtFlagInit = sal_True; pNew->bIsOnlyTxt = bOnlyTxt; aNames.C40_PTR_INSERT( SwBlockName, pNew ); } -BOOL SwImpBlocks::IsFileChanged() const +sal_Bool SwImpBlocks::IsFileChanged() const { Date aTempDateModified( aDateModified ); Time aTempTimeModified( aTimeModified ); @@ -235,25 +235,25 @@ void SwImpBlocks::Touch() &aDateModified, &aTimeModified ); } -BOOL SwImpBlocks::IsOnlyTextBlock( const String& ) const +sal_Bool SwImpBlocks::IsOnlyTextBlock( const String& ) const { - return FALSE; + return sal_False; } -ULONG SwImpBlocks::GetMacroTable( USHORT, SvxMacroTableDtor&, sal_Bool ) +sal_uLong SwImpBlocks::GetMacroTable( sal_uInt16, SvxMacroTableDtor&, sal_Bool ) { return 0; } -ULONG SwImpBlocks::SetMacroTable( USHORT , +sal_uLong SwImpBlocks::SetMacroTable( sal_uInt16 , const SvxMacroTableDtor& , sal_Bool ) { return 0; } -BOOL SwImpBlocks::PutMuchEntries( BOOL ) +sal_Bool SwImpBlocks::PutMuchEntries( sal_Bool ) { - return FALSE; + return sal_False; } //////////////////////////////////////////////////////////////////////////// @@ -293,20 +293,20 @@ void SwTextBlocks::SetName( const String& r ) } -BOOL SwTextBlocks::IsOld() const +sal_Bool SwTextBlocks::IsOld() const { if (pImp) { short nType = pImp->GetFileType(); if (SWBLK_SW3 == nType || SWBLK_SW2 == nType ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } /* -ULONG SwTextBlocks::ConvertToNew() +sal_uLong SwTextBlocks::ConvertToNew() { // Wir nehmen die aktuelle Datei, benennen diese in .BAK um // und kreieren den neuen Storage @@ -318,7 +318,7 @@ ULONG SwTextBlocks::ConvertToNew() Sw3TextBlocks *pThree = NULL; SwImpBlocks *pOld = NULL; - pImp->nCur = (USHORT) -1; + pImp->nCur = (sal_uInt16) -1; String aName( pImp->aFile ); delete pImp; pImp = NULL; // Jetzt wird umbenannt @@ -329,7 +329,7 @@ ULONG SwTextBlocks::ConvertToNew() String aOld( aOldFull.GetMainURL( INetURLObject::NO_DECODE ) ); String aNew( aNewFull.GetMainURL( INetURLObject::NO_DECODE ) ); - BOOL bError = !SWUnoHelper::UCB_CopyFile( aNew, aOld, TRUE ); + sal_Bool bError = !SWUnoHelper::UCB_CopyFile( aNew, aOld, sal_True ); if( bError ) { if (nType == SWBLK_SW2) @@ -360,23 +360,23 @@ ULONG SwTextBlocks::ConvertToNew() } else { - nErr = pThree->OpenFile ( TRUE ); + nErr = pThree->OpenFile ( sal_True ); // Within this call, Sw3IoImp::SetDoc calls RemoveLink // on the old document, and deletes it if the // ref count is now zero pThree->SetDoc ( pNew->pDoc ); pOld->pDoc->AddLink(); } - if( !nErr && 0 == ( nErr = pNew->OpenFile( FALSE )) ) + if( !nErr && 0 == ( nErr = pNew->OpenFile( sal_False )) ) { - nErr = pNew->SetConvertMode( TRUE ); + nErr = pNew->SetConvertMode( sal_True ); // jetzt werden die Bausteine einfach umkopiert! if( !nErr ) { if (SWBLK_SW2 == nType) pTwo->StatLineStartPercent(); - USHORT nCount = pOld->GetCount(); - for( USHORT i = 0; i < nCount; i++ ) + sal_uInt16 nCount = pOld->GetCount(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { pNew->ClearDoc(); String aShort( pOld->GetShortName( i ) ); @@ -418,7 +418,7 @@ ULONG SwTextBlocks::ConvertToNew() ::EndProgress( pOld->pDoc->GetDocShell() ); } if( !nErr ) - nErr = pNew->SetConvertMode( FALSE ); + nErr = pNew->SetConvertMode( sal_False ); } if ( SWBLK_SW3 == nType ) { @@ -441,7 +441,7 @@ ULONG SwTextBlocks::ConvertToNew() { delete pOld; delete pNew; SWUnoHelper::UCB_DeleteFile( aNew ); - SWUnoHelper::UCB_CopyFile( aOld, aNew, TRUE ); + SWUnoHelper::UCB_CopyFile( aOld, aNew, sal_True ); if ( SWBLK_SW2 == nType ) pImp = new Sw2TextBlocks( aOld ); else @@ -455,25 +455,25 @@ ULONG SwTextBlocks::ConvertToNew() } */ -USHORT SwTextBlocks::GetCount() const +sal_uInt16 SwTextBlocks::GetCount() const { return pImp ? pImp->GetCount() : 0; } -USHORT SwTextBlocks::GetIndex( const String& r ) const +sal_uInt16 SwTextBlocks::GetIndex( const String& r ) const { - return pImp ? pImp->GetIndex( r ) : (USHORT) -1; + return pImp ? pImp->GetIndex( r ) : (sal_uInt16) -1; } -USHORT SwTextBlocks::GetLongIndex( const String& r ) const +sal_uInt16 SwTextBlocks::GetLongIndex( const String& r ) const { - return pImp ? (USHORT)(pImp->GetLongIndex( r )) : (USHORT) -1; + return pImp ? (sal_uInt16)(pImp->GetLongIndex( r )) : (sal_uInt16) -1; } -const String& SwTextBlocks::GetShortName( USHORT n ) const +const String& SwTextBlocks::GetShortName( sal_uInt16 n ) const { if( pImp ) return pImp->GetShortName( n ); @@ -481,7 +481,7 @@ const String& SwTextBlocks::GetShortName( USHORT n ) const } -const String& SwTextBlocks::GetLongName( USHORT n ) const +const String& SwTextBlocks::GetLongName( sal_uInt16 n ) const { if( pImp ) return pImp->GetLongName( n ); @@ -489,34 +489,34 @@ const String& SwTextBlocks::GetLongName( USHORT n ) const } -BOOL SwTextBlocks::Delete( USHORT n ) +sal_Bool SwTextBlocks::Delete( sal_uInt16 n ) { if( pImp && !pImp->bInPutMuchBlocks ) { if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == (nErr = pImp->OpenFile( FALSE ) )) + else if( 0 == (nErr = pImp->OpenFile( sal_False ) )) { nErr = pImp->Delete( n ); if( !nErr ) pImp->aNames.DeleteAndDestroy( n ); if( n == pImp->nCur ) - pImp->nCur = (USHORT) -1; + pImp->nCur = (sal_uInt16) -1; if( !nErr ) nErr = pImp->MakeBlockList(); } pImp->CloseFile(); pImp->Touch(); - return BOOL( nErr == 0 ); + return sal_Bool( nErr == 0 ); } - return FALSE; + return sal_False; } -USHORT SwTextBlocks::Rename( USHORT n, const String* s, const String* l ) +sal_uInt16 SwTextBlocks::Rename( sal_uInt16 n, const String* s, const String* l ) { - USHORT nIdx = (USHORT)-1; + sal_uInt16 nIdx = (sal_uInt16)-1; if( pImp && !pImp->bInPutMuchBlocks ) { pImp->nCur = nIdx; @@ -528,19 +528,19 @@ USHORT SwTextBlocks::Rename( USHORT n, const String* s, const String* l ) if( !aNew.Len() ) { ASSERT( !this, "Kein Kurzname in Rename angegeben" ); - nErr = ERR_SWG_INTERNAL_ERROR; return (USHORT) -1; + nErr = ERR_SWG_INTERNAL_ERROR; return (sal_uInt16) -1; } if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == ( nErr = pImp->OpenFile( FALSE ))) + else if( 0 == ( nErr = pImp->OpenFile( sal_False ))) { // Vorher den neuen Eintrag in die Liste setzen! GetAppCharClass().toUpper( aNew ); nErr = pImp->Rename( n, aNew, aLong ); if( !nErr ) { - BOOL bOnlyTxt = pImp->aNames[ n ]->bIsOnlyTxt; + sal_Bool bOnlyTxt = pImp->aNames[ n ]->bIsOnlyTxt; pImp->aNames.DeleteAndDestroy( n ); pImp->AddName( aNew, aLong, bOnlyTxt ); nErr = pImp->MakeBlockList(); @@ -554,15 +554,15 @@ USHORT SwTextBlocks::Rename( USHORT n, const String* s, const String* l ) return nIdx; } -ULONG SwTextBlocks::CopyBlock( SwTextBlocks& rSource, String& rSrcShort, +sal_uLong SwTextBlocks::CopyBlock( SwTextBlocks& rSource, String& rSrcShort, const String& rLong ) { - BOOL bIsOld = FALSE; + sal_Bool bIsOld = sal_False; if (rSource.pImp) { short nType = rSource.pImp->GetFileType(); if (SWBLK_SW2 == nType || SWBLK_SW3 == nType ) - bIsOld = TRUE; + bIsOld = sal_True; } if( bIsOld ) //rSource.IsOld() ) nErr = ERR_SWG_OLD_GLOSSARY; @@ -573,29 +573,29 @@ ULONG SwTextBlocks::CopyBlock( SwTextBlocks& rSource, String& rSrcShort, return nErr; } -BOOL SwTextBlocks::BeginGetDoc( USHORT n ) +sal_Bool SwTextBlocks::BeginGetDoc( sal_uInt16 n ) { if( pImp && !pImp->bInPutMuchBlocks ) { // diese Optimierierung darf es nicht mehr geben. OLE-Objecte muessen auf // ihre SubStorages zugreifem koennen! // if( n == pImp->nCur ) -// return TRUE; +// return sal_True; if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == ( nErr = pImp->OpenFile( TRUE ))) + else if( 0 == ( nErr = pImp->OpenFile( sal_True ))) { pImp->ClearDoc(); nErr = pImp->GetDoc( n ); if( nErr ) - pImp->nCur = (USHORT)-1; + pImp->nCur = (sal_uInt16)-1; else pImp->nCur = n; } - return BOOL( nErr == 0 ); + return sal_Bool( nErr == 0 ); } - return FALSE; + return sal_False; } @@ -606,17 +606,17 @@ void SwTextBlocks::EndGetDoc() } -BOOL SwTextBlocks::BeginPutDoc( const String& s, const String& l ) +sal_Bool SwTextBlocks::BeginPutDoc( const String& s, const String& l ) { if( pImp ) { - BOOL bOk = pImp->bInPutMuchBlocks; + sal_Bool bOk = pImp->bInPutMuchBlocks; if( !bOk ) { if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; else - nErr = pImp->OpenFile( FALSE ); + nErr = pImp->OpenFile( sal_False ); bOk = 0 == nErr; } if( bOk ) @@ -632,16 +632,16 @@ BOOL SwTextBlocks::BeginPutDoc( const String& s, const String& l ) } -USHORT SwTextBlocks::PutDoc() +sal_uInt16 SwTextBlocks::PutDoc() { - USHORT nIdx = (USHORT)-1; + sal_uInt16 nIdx = (sal_uInt16)-1; if( pImp ) { nErr = pImp->PutDoc(); if( !nErr ) { pImp->nCur = GetIndex( pImp->aShort ); - if( pImp->nCur != (USHORT) -1 ) + if( pImp->nCur != (sal_uInt16) -1 ) pImp->aNames[ pImp->nCur ]->aLong = pImp->aLong; else { @@ -661,19 +661,19 @@ USHORT SwTextBlocks::PutDoc() return nIdx; } -USHORT SwTextBlocks::PutText( const String& rShort, const String& rName, +sal_uInt16 SwTextBlocks::PutText( const String& rShort, const String& rName, const String& rTxt ) { - USHORT nIdx = (USHORT) -1; + sal_uInt16 nIdx = (sal_uInt16) -1; if( pImp ) { - BOOL bOk = pImp->bInPutMuchBlocks; + sal_Bool bOk = pImp->bInPutMuchBlocks; if( !bOk ) { if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; else - nErr = pImp->OpenFile( FALSE ); + nErr = pImp->OpenFile( sal_False ); bOk = 0 == nErr; } if( bOk ) @@ -681,15 +681,15 @@ USHORT SwTextBlocks::PutText( const String& rShort, const String& rName, String aNew( rShort ); GetAppCharClass().toUpper( aNew ); nErr = pImp->PutText( aNew, rName, rTxt ); - pImp->nCur = (USHORT) -1; + pImp->nCur = (sal_uInt16) -1; if( !nErr ) { nIdx = GetIndex( pImp->aShort ); - if( nIdx != (USHORT) -1 ) + if( nIdx != (sal_uInt16) -1 ) pImp->aNames[ nIdx ]->aLong = rName; else { - pImp->AddName( pImp->aShort, rName, TRUE ); + pImp->AddName( pImp->aShort, rName, sal_True ); nIdx = pImp->GetIndex( pImp->aShort ); } if( !pImp->bInPutMuchBlocks ) @@ -718,7 +718,7 @@ void SwTextBlocks::ClearDoc() { if( pImp ) pImp->ClearDoc(); - pImp->nCur = (USHORT) -1; + pImp->nCur = (sal_uInt16) -1; } @@ -728,22 +728,22 @@ const String& SwTextBlocks::GetFileName() const } -BOOL SwTextBlocks::IsReadOnly() const +sal_Bool SwTextBlocks::IsReadOnly() const { return pImp->bReadOnly; } -BOOL SwTextBlocks::IsOnlyTextBlock( USHORT nIdx ) const +sal_Bool SwTextBlocks::IsOnlyTextBlock( sal_uInt16 nIdx ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pImp && !pImp->bInPutMuchBlocks ) { SwBlockName* pBlkNm = pImp->aNames[ nIdx ]; if( !pBlkNm->bIsOnlyTxtFlagInit && - !pImp->IsFileChanged() && !pImp->OpenFile( TRUE ) ) + !pImp->IsFileChanged() && !pImp->OpenFile( sal_True ) ) { pBlkNm->bIsOnlyTxt = pImp->IsOnlyTextBlock( pBlkNm->aShort ); - pBlkNm->bIsOnlyTxtFlagInit = TRUE; + pBlkNm->bIsOnlyTxtFlagInit = sal_True; pImp->CloseFile(); } bRet = pBlkNm->bIsOnlyTxt; @@ -751,9 +751,9 @@ BOOL SwTextBlocks::IsOnlyTextBlock( USHORT nIdx ) const return bRet; } -BOOL SwTextBlocks::IsOnlyTextBlock( const String& rShort ) const +sal_Bool SwTextBlocks::IsOnlyTextBlock( const String& rShort ) const { - USHORT nIdx = pImp->GetIndex( rShort ); + sal_uInt16 nIdx = pImp->GetIndex( rShort ); if( USHRT_MAX != nIdx ) { if( pImp->aNames[ nIdx ]->bIsOnlyTxtFlagInit ) @@ -762,38 +762,38 @@ BOOL SwTextBlocks::IsOnlyTextBlock( const String& rShort ) const } ASSERT( !this, "ungueltiger Name" ); - return FALSE; + return sal_False; } -BOOL SwTextBlocks::GetMacroTable( USHORT nIdx, SvxMacroTableDtor& rMacroTbl ) +sal_Bool SwTextBlocks::GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if ( pImp && !pImp->bInPutMuchBlocks ) bRet = ( 0 == pImp->GetMacroTable( nIdx, rMacroTbl ) ); return bRet; } -BOOL SwTextBlocks::SetMacroTable( USHORT nIdx, +sal_Bool SwTextBlocks::SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTbl ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if ( pImp && !pImp->bInPutMuchBlocks ) bRet = ( 0 == pImp->SetMacroTable( nIdx, rMacroTbl ) ); return bRet; } -BOOL SwTextBlocks::StartPutMuchBlockEntries() +sal_Bool SwTextBlocks::StartPutMuchBlockEntries() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !IsOld() && pImp ) - bRet = pImp->PutMuchEntries( TRUE ); + bRet = pImp->PutMuchEntries( sal_True ); return bRet; } void SwTextBlocks::EndPutMuchBlockEntries() { if( pImp ) - pImp->PutMuchEntries( FALSE ); + pImp->PutMuchEntries( sal_False ); } /*-- 20.09.2004 10:25:33--------------------------------------------------- |