diff options
Diffstat (limited to 'sw/source/core/tox/tox.cxx')
-rw-r--r-- | sw/source/core/tox/tox.cxx | 136 |
1 files changed, 72 insertions, 64 deletions
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index 28a41ea7d364..152432de4d75 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -59,16 +59,16 @@ const sal_Char* SwForm::aFormEntryTxt = "<ET>"; const sal_Char* SwForm::aFormChapterMark= "<C>"; const sal_Char* SwForm::aFormText = "<X>"; const sal_Char* SwForm::aFormAuth = "<A>"; -BYTE SwForm::nFormTabLen = 3; -BYTE SwForm::nFormEntryLen = 3; -BYTE SwForm::nFormPageNumsLen = 3; -BYTE SwForm::nFormLinkSttLen = 4; -BYTE SwForm::nFormLinkEndLen = 4; -BYTE SwForm::nFormEntryNumLen = 4; -BYTE SwForm::nFormEntryTxtLen = 4; -BYTE SwForm::nFormChapterMarkLen = 3; -BYTE SwForm::nFormTextLen = 3; -BYTE SwForm::nFormAuthLen = 5; +sal_uInt8 SwForm::nFormTabLen = 3; +sal_uInt8 SwForm::nFormEntryLen = 3; +sal_uInt8 SwForm::nFormPageNumsLen = 3; +sal_uInt8 SwForm::nFormLinkSttLen = 4; +sal_uInt8 SwForm::nFormLinkEndLen = 4; +sal_uInt8 SwForm::nFormEntryNumLen = 4; +sal_uInt8 SwForm::nFormEntryTxtLen = 4; +sal_uInt8 SwForm::nFormChapterMarkLen = 3; +sal_uInt8 SwForm::nFormTextLen = 3; +sal_uInt8 SwForm::nFormAuthLen = 5; SV_IMPL_PTRARR(SwTOXMarks, SwTOXMark*) @@ -76,11 +76,11 @@ TYPEINIT2( SwTOXMark, SfxPoolItem, SwClient ); // fuers rtti struct PatternIni { - USHORT n1; - USHORT n2; - USHORT n3; - USHORT n4; - USHORT n5; + sal_uInt16 n1; + sal_uInt16 n2; + sal_uInt16 n3; + sal_uInt16 n4; + sal_uInt16 n5; }; const PatternIni aPatternIni[] = { @@ -116,12 +116,20 @@ const PatternIni aPatternIni[] = {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_CUSTOM5, {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX} }; +<<<<<<< local SwFormTokens lcl_GetAuthPattern(USHORT nTypeId) +======= +/* -----------------23.09.99 13:58------------------- + + --------------------------------------------------*/ +// -> #i21237# +SwFormTokens lcl_GetAuthPattern(sal_uInt16 nTypeId) +>>>>>>> other { SwFormTokens aRet; PatternIni aIni = aPatternIni[nTypeId]; - USHORT nVals[5]; + sal_uInt16 nVals[5]; nVals[0] = aIni.n1; nVals[1] = aIni.n2; nVals[2] = aIni.n3; @@ -137,7 +145,7 @@ SwFormTokens lcl_GetAuthPattern(USHORT nTypeId) SwFormToken aTextToken( TOKEN_TEXT ); aTextToken.sText = String::CreateFromAscii( ", " ); - for(USHORT i = 0; i < 5 ; i++) + for(sal_uInt16 i = 0; i < 5 ; i++) { if(nVals[i] == USHRT_MAX) break; @@ -165,8 +173,8 @@ SwTOXMark::SwTOXMark() , SwModify( 0 ) , pTxtAttr( 0 ), - bAutoGenerated(FALSE), - bMainEntry(FALSE) + bAutoGenerated(sal_False), + bMainEntry(sal_False) { } @@ -176,8 +184,8 @@ SwTOXMark::SwTOXMark( const SwTOXType* pTyp ) , SwModify( const_cast<SwTOXType*>(pTyp) ) , pTxtAttr( 0 ), nLevel( 0 ), - bAutoGenerated(FALSE), - bMainEntry(FALSE) + bAutoGenerated(sal_False), + bMainEntry(sal_False) { } @@ -294,18 +302,18 @@ SwTOXType::SwTOXType(const SwTOXType& rCopy) SwForm::SwForm( TOXTypes eTyp ) // #i21237# : eType( eTyp ), nFormMaxLevel( SwForm::GetFormMaxLevel( eTyp )), // nFirstTabPos( lNumIndent ), - bCommaSeparated(FALSE) + bCommaSeparated(sal_False) { //bHasFirstTabPos = - bGenerateTabPos = FALSE; - bIsRelTabPos = TRUE; + bGenerateTabPos = sal_False; + bIsRelTabPos = sal_True; // Inhaltsverzeichnis hat entsprechend Anzahl Headlines + Ueberschrift // Benutzer hat 10 Ebenen + Ueberschrift // Stichwort hat 3 Ebenen + Ueberschrift + Trenner // indexes of tables, objects illustrations and authorities consist of a heading and one level - USHORT nPoolId; + sal_uInt16 nPoolId; switch( eType ) { case TOX_INDEX: nPoolId = STR_POOLCOLL_TOX_IDXH; break; @@ -347,7 +355,7 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237# if(TOX_INDEX == eType) { - for( USHORT i = 1; i < 5; ++i ) + for( sal_uInt16 i = 1; i < 5; ++i ) { if(1 == i) { @@ -366,7 +374,7 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237# } } else - for( USHORT i = 1; i < GetFormMax(); ++i, ++nPoolId ) // Nr 0 ist der Titel + for( sal_uInt16 i = 1; i < GetFormMax(); ++i, ++nPoolId ) // Nr 0 ist der Titel { if(TOX_AUTHORITIES == eType) SetPattern(i, lcl_GetAuthPattern(i)); @@ -400,7 +408,7 @@ SwForm& SwForm::operator=(const SwForm& rForm) bGenerateTabPos = rForm.bGenerateTabPos; bIsRelTabPos = rForm.bIsRelTabPos; bCommaSeparated = rForm.bCommaSeparated; - for(USHORT i=0; i < nFormMaxLevel; ++i) + for(sal_uInt16 i=0; i < nFormMaxLevel; ++i) { aPattern[i] = rForm.aPattern[i]; aTemplate[i] = rForm.aTemplate[i]; @@ -408,9 +416,9 @@ SwForm& SwForm::operator=(const SwForm& rForm) return *this; } -USHORT SwForm::GetFormMaxLevel( TOXTypes eTOXType ) +sal_uInt16 SwForm::GetFormMaxLevel( TOXTypes eTOXType ) { - USHORT nRet = 0; + sal_uInt16 nRet = 0; switch( eTOXType ) { case TOX_INDEX: nRet = 5; break; @@ -431,34 +439,34 @@ bool operator == (const SwFormToken & rToken, FormTokenType eType) } //----------------------------------------------------------------------------- -void SwForm::AdjustTabStops(SwDoc& rDoc, BOOL bInsertNewTapStops) // #i21237# +void SwForm::AdjustTabStops(SwDoc& rDoc, sal_Bool bInsertNewTapStops) // #i21237# { - for(USHORT nLevel = 1; nLevel < GetFormMax(); nLevel++) + for(sal_uInt16 nLevel = 1; nLevel < GetFormMax(); nLevel++) { const String& sTemplateName = GetTemplate(nLevel); SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( sTemplateName ); if( !pColl ) { - USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName + sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName ( sTemplateName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); // #i21237# if( USHRT_MAX != nId ) pColl = rDoc.GetTxtCollFromPool( nId ); } const SvxTabStopItem* pTabStops = 0; - USHORT nTabCount = 0; + sal_uInt16 nTabCount = 0; if( pColl && - 0 != ( pTabStops = &pColl->GetTabStops(FALSE) ) && + 0 != ( pTabStops = &pColl->GetTabStops(sal_False) ) && 0 != ( nTabCount = pTabStops->Count() ) ) { // #i21237# SwFormTokens aCurrentPattern = GetPattern(nLevel); SwFormTokens::iterator aIt = aCurrentPattern.begin(); - BOOL bChanged = FALSE; + sal_Bool bChanged = sal_False; - for(USHORT nTab = 0; nTab < nTabCount; ++nTab) + for(sal_uInt16 nTab = 0; nTab < nTabCount; ++nTab) { const SvxTabStop& rTab = (*pTabStops)[nTab]; @@ -469,9 +477,9 @@ void SwForm::AdjustTabStops(SwDoc& rDoc, BOOL bInsertNewTapStops) // #i21237# { if ( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() ) { - bChanged = TRUE; + bChanged = sal_True; SwFormToken aToken(TOKEN_TAB_STOP); - aToken.bWithTab = FALSE; + aToken.bWithTab = sal_False; aToken.nTabStopPosition = rTab.GetTabPos(); aToken.eTabAlign = rTab.GetAdjustment(); aToken.cTabFillChar = rTab.GetFill(); @@ -486,7 +494,7 @@ void SwForm::AdjustTabStops(SwDoc& rDoc, BOOL bInsertNewTapStops) // #i21237# (TOKEN_TAB_STOP)); if ( aIt != aCurrentPattern.end() ) { - bChanged = TRUE; + bChanged = sal_True; aIt->nTabStopPosition = rTab.GetTabPos(); aIt->eTabAlign = nTab == nTabCount - 1 && SVX_TAB_ADJUST_RIGHT == rTab.GetAdjustment() ? @@ -512,7 +520,7 @@ void SwForm::AdjustTabStops(SwDoc& rDoc, BOOL bInsertNewTapStops) // #i21237# SwTOXBase::SwTOXBase(const SwTOXType* pTyp, const SwForm& rForm, - USHORT nCreaType, const String& rTitle ) + sal_uInt16 nCreaType, const String& rTitle ) : SwClient((SwModify*)pTyp), aForm(rForm), aTitle(rTitle), @@ -520,10 +528,10 @@ SwTOXBase::SwTOXBase(const SwTOXType* pTyp, const SwForm& rForm, nCreateType(nCreaType), nOLEOptions(0), eCaptionDisplay(CAPTION_COMPLETE), - bProtected( TRUE ), - bFromChapter(FALSE), - bFromObjectNames(FALSE), - bLevelFromChapter(FALSE) + bProtected( sal_True ), + bFromChapter(sal_False), + bFromObjectNames(sal_False), + bLevelFromChapter(sal_False) { aData.nOptions = 0; } @@ -547,15 +555,15 @@ SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource ) { // type not in pDoc, so create it now const SwTOXTypes& rTypes = pDoc->GetTOXTypes(); - BOOL bFound = FALSE; - for( USHORT n = rTypes.Count(); n; ) + sal_Bool bFound = sal_False; + for( sal_uInt16 n = rTypes.Count(); n; ) { const SwTOXType* pCmp = rTypes[ --n ]; if( pCmp->GetType() == pType->GetType() && pCmp->GetTypeName() == pType->GetTypeName() ) { pType = (SwTOXType*)pCmp; - bFound = TRUE; + bFound = sal_True; break; } } @@ -578,7 +586,7 @@ SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource ) eLanguage = rSource.eLanguage; sSortAlgorithm = rSource.sSortAlgorithm; - for( USHORT i = 0; i < MAXLEVEL; ++i ) + for( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) aStyleNames[i] = rSource.aStyleNames[i]; // its the same data type! @@ -615,7 +623,7 @@ SwTOXBase & SwTOXBase::operator = (const SwTOXBase & rSource) aName = rSource.aName; aTitle = rSource.aTitle; sMainEntryCharStyle = rSource.sMainEntryCharStyle; - for(USHORT nLevel = 0; nLevel < MAXLEVEL; nLevel++) + for(sal_uInt16 nLevel = 0; nLevel < MAXLEVEL; nLevel++) aStyleNames[nLevel] = rSource.aStyleNames[nLevel]; sSequenceName = rSource.sSequenceName; eLanguage = rSource.eLanguage; @@ -667,7 +675,7 @@ String SwFormToken::GetString() const { String sRet; - BOOL bAppend = TRUE; + sal_Bool bAppend = sal_True; switch( eTokenType ) { case TOKEN_ENTRY_NO: @@ -746,7 +754,7 @@ String SwFormToken::GetString() const sRet += TOX_STYLE_DELIMITER; } else - bAppend = FALSE; + bAppend = sal_False; } else if(TOKEN_ENTRY_NO == eTokenType) { @@ -803,16 +811,16 @@ SwFormToken SwFormTokensHelper::BuildToken( const String & sPattern, eRet.sCharStyleName = sToken.GetToken( 0, ','); String sTmp( sToken.GetToken( 1, ',' )); if( sTmp.Len() ) - eRet.nPoolId = static_cast<USHORT>(sTmp.ToInt32()); + eRet.nPoolId = static_cast<sal_uInt16>(sTmp.ToInt32()); switch( eTokenType ) { //i53420 case TOKEN_ENTRY_NO: if( (sTmp = sToken.GetToken( 2, ',' ) ).Len() ) - eRet.nChapterFormat = static_cast<USHORT>(sTmp.ToInt32()); + eRet.nChapterFormat = static_cast<sal_uInt16>(sTmp.ToInt32()); if( (sTmp = sToken.GetToken( 3, ',' ) ).Len() ) - eRet.nOutlineLevel = static_cast<USHORT>(sTmp.ToInt32()); //the maximum outline level to examine + eRet.nOutlineLevel = static_cast<sal_uInt16>(sTmp.ToInt32()); //the maximum outline level to examine break; case TOKEN_TEXT: @@ -847,15 +855,15 @@ SwFormToken SwFormTokensHelper::BuildToken( const String & sPattern, case TOKEN_CHAPTER_INFO: if( (sTmp = sToken.GetToken( 2, ',' ) ).Len() ) - eRet.nChapterFormat = static_cast<USHORT>(sTmp.ToInt32()); //SwChapterFormat; + eRet.nChapterFormat = static_cast<sal_uInt16>(sTmp.ToInt32()); //SwChapterFormat; //i53420 if( (sTmp = sToken.GetToken( 3, ',' ) ).Len() ) - eRet.nOutlineLevel = static_cast<USHORT>(sTmp.ToInt32()); //the maximum outline level to examine + eRet.nOutlineLevel = static_cast<sal_uInt16>(sTmp.ToInt32()); //the maximum outline level to examine break; case TOKEN_AUTHORITY: - eRet.nAuthorityField = static_cast<USHORT>(sAuthFieldEnum.ToInt32()); + eRet.nAuthorityField = static_cast<sal_uInt16>(sAuthFieldEnum.ToInt32()); break; default: break; } @@ -866,7 +874,7 @@ String SwFormTokensHelper::SearchNextToken( const String & sPattern, xub_StrLen nStt ) const { //it's not so easy - it doesn't work if the text part contains a '>' - //USHORT nTokenEnd = sPattern.Search('>'); + //sal_uInt16 nTokenEnd = sPattern.Search('>'); String aResult; @@ -901,8 +909,8 @@ FormTokenType SwFormTokensHelper::GetTokenType(const String & sToken, static struct { const sal_Char* pNm; - USHORT nLen; - USHORT nOffset; + sal_uInt16 nLen; + sal_uInt16 nOffset; FormTokenType eToken; } __READONLY_DATA aTokenArr[] = { { SwForm::aFormTab, SwForm::nFormEntryLen, 1, TOKEN_TAB_STOP }, @@ -939,13 +947,13 @@ FormTokenType SwFormTokensHelper::GetTokenType(const String & sToken, // <- #i21237# -void SwForm::SetPattern(USHORT nLevel, const SwFormTokens& rTokens) +void SwForm::SetPattern(sal_uInt16 nLevel, const SwFormTokens& rTokens) { ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); aPattern[nLevel] = rTokens; } -void SwForm::SetPattern(USHORT nLevel, const String & rStr) +void SwForm::SetPattern(sal_uInt16 nLevel, const String & rStr) { ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); @@ -953,7 +961,7 @@ void SwForm::SetPattern(USHORT nLevel, const String & rStr) aPattern[nLevel] = aHelper.GetTokens(); } -const SwFormTokens& SwForm::GetPattern(USHORT nLevel) const +const SwFormTokens& SwForm::GetPattern(sal_uInt16 nLevel) const { ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); return aPattern[nLevel]; |