diff options
author | jp <jp@openoffice.org> | 2000-10-20 09:56:11 +0000 |
---|---|---|
committer | jp <jp@openoffice.org> | 2000-10-20 09:56:11 +0000 |
commit | f5b6e61dc99ab6925d26f2cc5a74b05881184334 (patch) | |
tree | 3f4d3914e8e65b0e2e54c24eb53ec18982b96089 | |
parent | ce1c2052be062ad244ab779bff1bde5538512131 (diff) |
should changes: use CharClass instead of International
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 70 | ||||
-rw-r--r-- | sw/source/core/inc/doctxm.hxx | 17 | ||||
-rw-r--r-- | sw/source/core/inc/txmsrt.hxx | 60 | ||||
-rw-r--r-- | sw/source/core/tox/txmsrt.cxx | 105 |
4 files changed, 166 insertions, 86 deletions
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 4e2fecd06bb9..3e952e7c3a40 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: doctxm.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jp $ $Date: 2000-10-05 12:07:35 $ + * last change: $Author: jp $ $Date: 2000-10-20 10:55:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -904,14 +904,8 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr) pDoc->SetModified(); // get current Language - const International* pIntl = &Application::GetAppInternational(); - LanguageType eLang = ((const SvxLanguageItem&)pDoc->GetAttrPool(). - GetDefaultItem(RES_CHRATR_LANGUAGE )).GetLanguage(); - - if( !( eLang == ::GetSystemLanguage() && - LANGUAGE_SYSTEM == pIntl->GetLanguage() ) && - eLang != pIntl->GetLanguage() ) - pIntl = new International( eLang ); + SwTOXInternational aIntl( ((const SvxLanguageItem&)pDoc->GetAttrPool(). + GetDefaultItem(RES_CHRATR_LANGUAGE )).GetLanguage() ); aSortArr.DeleteAndDestroy( 0, aSortArr.Count() ); @@ -987,7 +981,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); pDoc->UpdateNumRule(); if( GetCreateType() & TOX_MARK ) - UpdateMarks( *pIntl, pOwnChapterNode ); + UpdateMarks( aIntl, pOwnChapterNode ); if( GetCreateType() & TOX_OUTLINELEVEL ) UpdateOutline( pOwnChapterNode ); @@ -1016,13 +1010,13 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); UpdateCntnt( TOX_FRAME, pOwnChapterNode ); if(TOX_AUTHORITIES == SwTOXBase::GetType()) - UpdateAuthorities( pOwnChapterNode, *pIntl ); + UpdateAuthorities( pOwnChapterNode, aIntl ); // Bei Bedarf Alphadelimitter einfuegen (nur bei Stichwoertern) // if( TOX_INDEX == SwTOXBase::GetType() && ( GetOptions() & TOI_ALPHA_DELIMITTER ) ) - InsertAlphaDelimitter( *pIntl ); + InsertAlphaDelimitter( aIntl ); // sortierte Liste aller Verzeichnismarken und Verzeichnisbereiche void* p = 0; @@ -1112,10 +1106,6 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); SwFrm::CheckPageDescs( (SwPageFrm*)pDoc->GetRootFrm()->Lower() ); SetProtect( SwTOXBase::IsProtected() ); - - // ggfs. noch die International Klasse loeschen - if( pIntl != &Application::GetAppInternational() ) - delete (International*)pIntl; } /*-------------------------------------------------------------------- @@ -1123,7 +1113,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); --------------------------------------------------------------------*/ -void SwTOXBaseSection::InsertAlphaDelimitter( const International& rIntl ) +void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl ) { SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); sal_Unicode nDeli, nLastDeli = 0; @@ -1217,7 +1207,7 @@ SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( USHORT nLevel ) Beschreibung: Aus Markierungen erzeugen --------------------------------------------------------------------*/ -void SwTOXBaseSection::UpdateMarks( const International& rIntl, +void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl, const SwTxtNode* pOwnChapterNode ) { const SwModify* pType = SwTOXBase::GetRegisteredIn(); @@ -1394,7 +1384,7 @@ void SwTOXBaseSection::UpdateSequence( const SwTxtNode* pOwnChapterNode ) --------------------------------------------------*/ void SwTOXBaseSection::UpdateAuthorities( const SwTxtNode* pOwnChapterNode, - const International& rIntl ) + const SwTOXInternational& rIntl ) { SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); SwFieldType* pAuthFld = pDoc->GetFldType(RES_AUTHORITY, aEmptyStr); @@ -1872,10 +1862,17 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, USHORT nCount, void SwTOXBaseSection::UpdatePageNum() { + if( !aSortArr.Count() ) + return ; + // die aktuellen Seitennummern ins Verzeichnis eintragen SwPageFrm* pAktPage = 0; USHORT nPage = 0; SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); + + SwTOXInternational aIntl( ((const SvxLanguageItem&)pDoc->GetAttrPool(). + GetDefaultItem(RES_CHRATR_LANGUAGE )).GetLanguage() ); + for( USHORT nCnt = 0; nCnt < aSortArr.Count(); ++nCnt ) { // Schleife ueber alle SourceNodes @@ -1957,7 +1954,8 @@ void SwTOXBaseSection::UpdatePageNum() const SwTxtNode* pTxtNd = pBase->pTOXNd->GetTxtNode(); ASSERT( pTxtNd, "kein TextNode, falsches Verzeichnis" ); - _UpdatePageNum( (SwTxtNode*)pTxtNd, aNums, aDescs, pMainNums ); + _UpdatePageNum( (SwTxtNode*)pTxtNd, aNums, aDescs, pMainNums, + aIntl ); } DELETEZ(pMainNums); aNums.Remove(0, aNums.Count()); @@ -1985,7 +1983,8 @@ BOOL lcl_HasMainEntry( const SvUShorts* pMainEntryNums, USHORT nToFind ) void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, const SvUShorts& rNums, const SvPtrarr & rDescs, - const SvUShorts* pMainEntryNums) + const SvUShorts* pMainEntryNums, + const SwTOXInternational& rIntl ) { //collect starts end ends of main entry character style SvUShorts* pCharStyleIdx = pMainEntryNums ? new SvUShorts : 0; @@ -2052,10 +2051,9 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, { if ( nCount >= 1 ) { - FollowingText eText = nCount > 1 ? FOLLOWTEXT_PAGES - : FOLLOWTEXT_PAGE; - aNumStr += Application::GetAppInternational(). - GetFollowingText( eText ); + USHORT eText = nCount > 1 ? FOLLOWTEXT_PAGES + : FOLLOWTEXT_PAGE; + aNumStr += rIntl.GetFollowingText( eText ); } } else @@ -2095,10 +2093,9 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, { if( nCount >= 1 ) { - FollowingText eText = nCount > 1 ? FOLLOWTEXT_PAGES + USHORT eText = nCount > 1 ? FOLLOWTEXT_PAGES : FOLLOWTEXT_PAGE; - aNumStr += Application::GetAppInternational(). - GetFollowingText( eText ); + aNumStr += rIntl.GetFollowingText( eText ); } } else @@ -2170,10 +2167,10 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew) rMark.GetPrimaryKey().Len() ) { aRange = GetKeyRange( rMark.GetPrimaryKey(), FORM_PRIMARY_KEY, - aRange, *pNew->pIntl ); + aRange, *pNew->pTOXIntl ); if( rMark.GetSecondaryKey().Len() ) aRange = GetKeyRange( rMark.GetSecondaryKey(), FORM_SECONDARY_KEY, - aRange, *pNew->pIntl ); + aRange, *pNew->pTOXIntl ); } } // Pos suchen und einfuegen @@ -2240,11 +2237,14 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew) Range SwTOXBaseSection::GetKeyRange(const String& rStr, USHORT nLevel, const Range& rRange, - const International& rIntl ) + const SwTOXInternational& rIntl ) { String sToCompare(rStr); - if(0 != (TOI_INITIAL_CAPS & GetOptions())) - sToCompare.SetChar(0, rIntl.Upper(sToCompare.GetChar(0))); + if( 0 != (TOI_INITIAL_CAPS & GetOptions()) ) + { + String sUpper( rIntl.ToUpper( sToCompare, 0 )); + sToCompare.Erase( 0, 1 ).Insert( sUpper, 0 ); + } ASSERT(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0"); @@ -2258,7 +2258,7 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, { SwTOXSortTabBase* pBase = aSortArr[i]; String aTmp = pBase->GetTxt(); - if( rIntl.CompareEqual( aTmp, sToCompare, nCmpFlags ) && + if( rIntl.IsEqual( aTmp, sToCompare, nCmpFlags ) && pBase->GetLevel() == nLevel && pBase->GetType() == TOX_SORT_CUSTOM) break; diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx index 4e577cb873ad..d00a64613f22 100644 --- a/sw/source/core/inc/doctxm.hxx +++ b/sw/source/core/inc/doctxm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: doctxm.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:08:20 $ + * last change: $Author: jp $ $Date: 2000-10-20 10:53:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,7 @@ #include <section.hxx> #endif -class International; +class SwTOXInternational; class SvUShorts; class SvStringsDtor; class SvPtrarr; @@ -94,7 +94,7 @@ class SwTOXBaseSection : public SwTOXBase, public SwSection { SwTOXSortTabBases aSortArr; - void UpdateMarks( const International& rIntl, + void UpdateMarks( const SwTOXInternational& rIntl, const SwTxtNode* pOwnChapterNode ); void UpdateOutline( const SwTxtNode* pOwnChapterNode ); void UpdateTemplate( const SwTxtNode* pOwnChapterNode ); @@ -103,14 +103,14 @@ class SwTOXBaseSection : public SwTOXBase, public SwSection void UpdateTable( const SwTxtNode* pOwnChapterNode ); void UpdateSequence( const SwTxtNode* pOwnChapterNode ); void UpdateAuthorities( const SwTxtNode* pOwnChapterNode, - const International& rIntl ); + const SwTOXInternational& rIntl ); void UpdateAll(); // Sortiert einfuegen ins Array fuer die Generierung void InsertSorted(SwTOXSortTabBase* pBase); // Alpha-Trennzeichen bei der Generierung einfuegen - void InsertAlphaDelimitter( const International& rIntl ); + void InsertAlphaDelimitter( const SwTOXInternational& rIntl ); // Textrumpf generieren void GenerateText( USHORT nArrayIdx, USHORT nCount, SvStringsDtor& ); @@ -119,11 +119,12 @@ class SwTOXBaseSection : public SwTOXBase, public SwSection void _UpdatePageNum( SwTxtNode* pNd, const SvUShorts& rNums, const SvPtrarr &rDescs, - const SvUShorts* pMainEntryNums ); + const SvUShorts* pMainEntryNums, + const SwTOXInternational& rIntl ); // Bereich fuer Stichwort einfuegen suchen Range GetKeyRange(const String& rStr, USHORT nLevel, const Range& rRange, - const International& rIntl ); + const SwTOXInternational& rIntl ); // returne die TextCollection ueber den Namen / aus Format-Pool SwTxtFmtColl* GetTxtFmtColl( USHORT nLevel ); diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx index 57072e8ea8f0..571d9c8182c8 100644 --- a/sw/source/core/inc/txmsrt.hxx +++ b/sw/source/core/inc/txmsrt.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txmsrt.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:08:21 $ + * last change: $Author: jp $ $Date: 2000-10-20 10:53:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,11 +61,18 @@ #ifndef _TXMSRT_HXX #define _TXMSRT_HXX +#ifndef _LANG_HXX +#include <tools/lang.hxx> +#endif +#ifndef _INTN_HXX +#include <tools/intn.hxx> +#endif #ifndef _TOX_HXX #include <tox.hxx> #endif class International; +class CharClass; class SwCntntNode; class SwTxtNode; class SwTxtTOXMark; @@ -96,6 +103,43 @@ struct SwTOXSource SV_DECL_VARARR( SwTOXSources, SwTOXSource, 0, 10 ) +class SwTOXInternational +{ + International* pIntl; + CharClass* pCharClass; + LanguageType eLang; + +public: + SwTOXInternational( LanguageType nLang ); + SwTOXInternational( const SwTOXInternational& ); + ~SwTOXInternational(); + + inline BOOL IsEqual( const String& rTxt1, const String& rTxt2, + USHORT nFlags ) const + { + return COMPARE_EQUAL == pIntl->Compare( rTxt1, rTxt2, nFlags ); + } + inline BOOL IsLess( const String& rTxt1, const String& rTxt2, + USHORT nFlags ) const + { + return COMPARE_LESS == pIntl->Compare( rTxt1, rTxt2, nFlags ); + } + inline StringCompare Compare( const String& rTxt1, const String& rTxt2, + USHORT nFlags ) const + { + return pIntl->Compare( rTxt1, rTxt2, nFlags ); + } + + inline sal_Unicode GetIndexChar( const String& rTxt ) const + { return pIntl->GetIndexChar( rTxt ); } + + inline String GetFollowingText( USHORT nType ) const + { return pIntl->GetFollowingText( (FollowingText)nType ); } + + String ToUpper( const String& rStr, xub_StrLen nPos ) const; + inline BOOL IsNumeric( const String& rStr ) const; +}; + /*-------------------------------------------------------------------- Beschreibung: Klassen fuer die Sortierung der Verzeichnisse --------------------------------------------------------------------*/ @@ -105,7 +149,7 @@ struct SwTOXSortTabBase SwTOXSources aTOXSources; const SwTxtNode* pTOXNd; const SwTxtTOXMark* pTxtMark; - const International* pIntl; + const SwTOXInternational* pTOXIntl; ULONG nPos; xub_StrLen nCntPos; USHORT nType, nLanguage; @@ -114,7 +158,7 @@ struct SwTOXSortTabBase SwTOXSortTabBase( TOXSortType nType, const SwCntntNode* pTOXSrc, const SwTxtTOXMark* pTxtMark, - const International* pIntl ); + const SwTOXInternational* pIntl ); USHORT GetType() const { return nType; } USHORT GetOptions() const { return nOpt; } @@ -151,7 +195,7 @@ inline const String& SwTOXSortTabBase::GetTxt() const struct SwTOXIndex : public SwTOXSortTabBase { SwTOXIndex( const SwTxtNode&, const SwTxtTOXMark*, USHORT nOptions, BYTE nKeyLevel, - const International& rIntl ); + const SwTOXInternational& rIntl ); virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const; virtual USHORT GetLevel() const; @@ -165,7 +209,7 @@ private: struct SwTOXCustom : public SwTOXSortTabBase { - SwTOXCustom(const String& rKey, USHORT nLevel, const International& rIntl ); + SwTOXCustom(const String& rKey, USHORT nLevel, const SwTOXInternational& rIntl ); virtual USHORT GetLevel() const; virtual BOOL operator==( const SwTOXSortTabBase& ); @@ -184,7 +228,7 @@ private: struct SwTOXContent : public SwTOXSortTabBase { SwTOXContent( const SwTxtNode&, const SwTxtTOXMark*, - const International& rIntl ); + const SwTOXInternational& rIntl ); virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const; virtual USHORT GetLevel() const; @@ -231,7 +275,7 @@ private: virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const; virtual void _GetText( String& ); public: - SwTOXAuthority( const SwCntntNode& rNd, SwFmtFld& rField, const International& rIntl ); + SwTOXAuthority( const SwCntntNode& rNd, SwFmtFld& rField, const SwTOXInternational& rIntl ); SwFmtFld& GetFldFmt() {return m_rField;} virtual BOOL operator==( const SwTOXSortTabBase& ); diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index aad7e3626480..289fd4784077 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txmsrt.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:08:27 $ + * last change: $Author: jp $ $Date: 2000-10-20 10:56:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,15 +65,18 @@ #pragma hdrstop -#ifndef _INTN_HXX //autogen -#include <tools/intn.hxx> -#endif #ifndef _TOOLS_RESID_HXX #include <tools/resid.hxx> #endif #ifndef _URLOBJ_HXX #include <tools/urlobj.hxx> #endif +#ifndef _UNOTOOLS_CHARCLASS_HXX +#include <unotools/charclass.hxx> +#endif +#ifndef _UNO_LINGU_HXX +#include <svx/unolingu.hxx> +#endif #ifndef _DOC_HXX #include <doc.hxx> @@ -143,6 +146,35 @@ USHORT SwTOXSortTabBase::nOpt = 0; SV_IMPL_VARARR( SwTOXSources, SwTOXSource ) +SwTOXInternational::SwTOXInternational( LanguageType nLang ) + : eLang( nLang ) +{ + pIntl = new International( eLang ); + pCharClass = new CharClass( SvxCreateLocale( eLang )); +} + +SwTOXInternational::SwTOXInternational( const SwTOXInternational& rIntl ) + : eLang( rIntl.eLang ) +{ + pIntl = new International( *rIntl.pIntl ); + pCharClass = new CharClass( SvxCreateLocale( rIntl.eLang )); +} + +SwTOXInternational::~SwTOXInternational() +{ + delete pCharClass; + delete pIntl; +} + +String SwTOXInternational::ToUpper( const String& rStr, xub_StrLen nPos ) const +{ + return pCharClass->toUpper( rStr, nPos, 1 ); +} +inline BOOL SwTOXInternational::IsNumeric( const String& rStr ) const +{ + return pCharClass->isNumeric( rStr ); +} + /*-------------------------------------------------------------------- Beschreibung: SortierElement fuer Verzeichniseintraege --------------------------------------------------------------------*/ @@ -150,12 +182,13 @@ SV_IMPL_VARARR( SwTOXSources, SwTOXSource ) SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwCntntNode* pNd, const SwTxtTOXMark* pMark, - const International* pInter ) + const SwTOXInternational* pInter ) : pTxtMark( pMark ), pTOXNd( 0 ), nPos( 0 ), nType( nTyp ), - pIntl( pInter ), bValidTxt( FALSE ), nCntPos( 0 ) + pTOXIntl( pInter ), bValidTxt( FALSE ), nCntPos( 0 ) { if( pNd ) { + DBG_ASSERT(pTOXIntl, "No SwTOXInternational" ); xub_StrLen n = 0; if( pTxtMark ) n = *pTxtMark->GetStart(); @@ -229,8 +262,8 @@ BOOL SwTOXSortTabBase::operator==( const SwTOXSortTabBase& rCmp ) *pEndCmp = rCmp.pTxtMark->GetEnd(); bRet = ( ( pEnd && pEndCmp ) || ( !pEnd && !pEndCmp ) ) && - COMPARE_EQUAL == pIntl->Compare( GetTxt(), - rCmp.GetTxt(), INTN_COMPARE_IGNORECASE ); + pTOXIntl->IsEqual( GetTxt(), rCmp.GetTxt(), + INTN_COMPARE_IGNORECASE ); } } return bRet; @@ -266,8 +299,8 @@ BOOL SwTOXSortTabBase::operator<( const SwTOXSortTabBase& rCmp ) // beide Pointer vorhanden -> vergleiche Text // beide Pointer nicht vorhanden -> vergleiche AlternativText if( ( pEnd && pEndCmp ) || ( !pEnd && !pEndCmp ) ) - return COMPARE_LESS == pIntl->Compare( GetTxt(), - rCmp.GetTxt(), INTN_COMPARE_IGNORECASE ); + return pTOXIntl->IsLess( GetTxt(), rCmp.GetTxt(), + INTN_COMPARE_IGNORECASE ); if( pEnd && !pEndCmp ) return TRUE; @@ -292,7 +325,7 @@ BOOL SwTOXSortTabBase::operator<( const SwTOXSortTabBase& rCmp ) SwTOXIndex::SwTOXIndex( const SwTxtNode& rNd, const SwTxtTOXMark* pMark, USHORT nOptions, BYTE nKyLevel, - const International& rIntl ) + const SwTOXInternational& rIntl ) : SwTOXSortTabBase( TOX_SORT_INDEX, &rNd, pMark, &rIntl ), nKeyLevel(nKyLevel) { @@ -315,15 +348,15 @@ BOOL SwTOXIndex::operator==( const SwTOXSortTabBase& rCmpBase ) return FALSE; String sMyTxt( GetTxt() ), sOtherTxt( rCmp.GetTxt() ); - sMyTxt.Insert( pIntl->GetIndexChar( sMyTxt ), 0 ); - sOtherTxt.Insert( pIntl->GetIndexChar( sOtherTxt ), 0 ); + sMyTxt.Insert( pTOXIntl->GetIndexChar( sMyTxt ), 0 ); + sOtherTxt.Insert( pTOXIntl->GetIndexChar( sOtherTxt ), 0 ); USHORT nCmpFlags; if( GetOptions() & TOI_CASE_SENSITIVE ) nCmpFlags = 0; else nCmpFlags = INTN_COMPARE_IGNORECASE; - bRet = COMPARE_EQUAL == pIntl->Compare( sMyTxt, sOtherTxt, nCmpFlags ); + bRet = pTOXIntl->IsEqual( sMyTxt, sOtherTxt, nCmpFlags ); // Wenn nicht zusammengefasst wird muss die Pos aus gewertet werden if(bRet && !(GetOptions() & TOI_SAME_ENTRY)) @@ -345,15 +378,15 @@ BOOL SwTOXIndex::operator<( const SwTOXSortTabBase& rCmpBase ) USHORT nFlag = GetOptions() & TOI_CASE_SENSITIVE ? 0 : INTN_COMPARE_IGNORECASE; String sMyTxt( GetTxt() ), sOtherTxt( rCmp.GetTxt() ); - sMyTxt.Insert( pIntl->GetIndexChar( sMyTxt ), 0 ); - sOtherTxt.Insert( pIntl->GetIndexChar( sOtherTxt ), 0 ); + sMyTxt.Insert( pTOXIntl->GetIndexChar( sMyTxt ), 0 ); + sOtherTxt.Insert( pTOXIntl->GetIndexChar( sOtherTxt ), 0 ); - BOOL bRet = COMPARE_LESS == pIntl->Compare( sMyTxt, sOtherTxt, nFlag ) && + BOOL bRet = pTOXIntl->IsLess( sMyTxt, sOtherTxt, nFlag ) && GetLevel() == rCmp.GetLevel(); // Wenn nicht zusammengefasst wird muss die Pos aus gewertet werden if( !bRet && !(GetOptions() & TOI_SAME_ENTRY) ) - bRet = COMPARE_EQUAL == pIntl->Compare( sMyTxt, sOtherTxt, nFlag ) && + bRet = pTOXIntl->IsEqual( sMyTxt, sOtherTxt, nFlag ) && nPos < rCmp.nPos; return bRet; @@ -382,9 +415,10 @@ void SwTOXIndex::_GetText( String& rTxt ) break; } // if TOI_INITIAL_CAPS is set, first character is to be capitalized - if(TOI_INITIAL_CAPS&nOpt && pIntl) + if( TOI_INITIAL_CAPS & nOpt && pTOXIntl ) { - rTxt.SetChar(0, pIntl->Upper(rTxt.GetChar(0))); + String sUpper( pTOXIntl->ToUpper( rTxt, 0 )); + rTxt.Erase( 0, 1 ).Insert( sUpper, 0 ); } } @@ -398,9 +432,10 @@ void SwTOXIndex::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT ) cons sTmp = ((SwTxtNode*)aTOXSources[0].pNd)->GetExpandTxt( *pTxtMark->GetStart(), *pEnd - *pTxtMark->GetStart()); - if(TOI_INITIAL_CAPS&nOpt && pIntl) + if(TOI_INITIAL_CAPS&nOpt && pTOXIntl) { - sTmp.SetChar(0, pIntl->Upper(sTmp.GetChar(0))); + String sUpper( pTOXIntl->ToUpper( sTmp, 0 )); + sTmp.Erase( 0, 1 ).Insert( sUpper, 0 ); } } else @@ -433,7 +468,7 @@ USHORT SwTOXIndex::GetLevel() const SwTOXCustom::SwTOXCustom(const String& rStr, USHORT nLevel, - const International& rIntl ) + const SwTOXInternational& rIntl ) : SwTOXSortTabBase( TOX_SORT_CUSTOM, 0, 0, &rIntl ), aKey(rStr), nLev(nLevel) { @@ -442,14 +477,14 @@ SwTOXCustom::SwTOXCustom(const String& rStr, USHORT nLevel, BOOL SwTOXCustom::operator==(const SwTOXSortTabBase& rCmpBase) { - return COMPARE_EQUAL == pIntl->Compare( GetTxt(), rCmpBase.GetTxt() ) && + return pTOXIntl->IsEqual( GetTxt(), rCmpBase.GetTxt(), 0 ) && GetLevel() == rCmpBase.GetLevel(); } BOOL SwTOXCustom::operator < (const SwTOXSortTabBase& rCmpBase) { - return COMPARE_LESS == pIntl->Compare( GetTxt(), rCmpBase.GetTxt() ) && + return pTOXIntl->IsLess( GetTxt(), rCmpBase.GetTxt(), 0 ) && GetLevel() <= rCmpBase.GetLevel(); } @@ -471,7 +506,7 @@ void SwTOXCustom::_GetText( String& rTxt ) SwTOXContent::SwTOXContent( const SwTxtNode& rNd, const SwTxtTOXMark* pMark, - const International& rIntl) + const SwTOXInternational& rIntl) : SwTOXSortTabBase( TOX_SORT_CONTENT, &rNd, pMark, &rIntl ) { } @@ -719,7 +754,7 @@ String SwTOXTable::GetURL() const -----------------------------------------------------------------------*/ SwTOXAuthority::SwTOXAuthority( const SwCntntNode& rNd, - SwFmtFld& rField, const International& rIntl ) : + SwFmtFld& rField, const SwTOXInternational& rIntl ) : SwTOXSortTabBase( TOX_SORT_AUTHORITY, &rNd, 0, &rIntl ), m_rField(rField) { @@ -730,7 +765,7 @@ USHORT SwTOXAuthority::GetLevel() const String sText(((SwAuthorityField*)m_rField.GetFld())-> GetFieldText(AUTH_FIELD_AUTHORITY_TYPE)); USHORT nRet = 0; - if( pIntl->IsNumeric( sText ) ) + if( pTOXIntl->IsNumeric( sText ) ) { nRet = sText.ToInt32(); nRet++; @@ -796,7 +831,6 @@ BOOL SwTOXAuthority::operator<( const SwTOXSortTabBase& rBase) SwAuthorityField* pCmpField = (SwAuthorityField*) ((SwTOXAuthority&)rBase).m_rField.GetFld(); - DBG_ASSERT(pIntl, "No International?") for(USHORT i = 0; i < pType->GetSortKeyCount(); i++) { @@ -804,12 +838,13 @@ BOOL SwTOXAuthority::operator<( const SwTOXSortTabBase& rBase) String sText1 = pField->GetFieldText(pKey->eField); String sText2 = pCmpField->GetFieldText(pKey->eField); - StringCompare eComp = pIntl->Compare( sText1, sText2, + StringCompare eComp = pTOXIntl->Compare( sText1, sText2, INTN_COMPARE_IGNORECASE); - if(COMPARE_EQUAL == eComp) - continue; - bRet = (COMPARE_LESS == eComp) == pKey->bSortAscending; - break; + if( COMPARE_EQUAL != eComp ) + { + bRet = (COMPARE_LESS == eComp) == pKey->bSortAscending; + break; + } } } return bRet; |