LCOV - code coverage report
Current view: top level - sw/source/core/tox - txmsrt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 63 386 16.3 %
Date: 2012-08-25 Functions: 10 45 22.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 43 668 6.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <tools/resid.hxx>
      31                 :            : #include <unotools/charclass.hxx>
      32                 :            : #include <com/sun/star/i18n/CollatorOptions.hpp>
      33                 :            : #include <editeng/unolingu.hxx>
      34                 :            : #include <txtfld.hxx>
      35                 :            : #include <doc.hxx>
      36                 :            : #include <docary.hxx>
      37                 :            : #include <cntfrm.hxx>
      38                 :            : #include <node.hxx>
      39                 :            : #include <frmatr.hxx>
      40                 :            : #include <pam.hxx>
      41                 :            : #include <txttxmrk.hxx>
      42                 :            : #include <frmfmt.hxx>
      43                 :            : #include <fmtfld.hxx>
      44                 :            : #include <txmsrt.hxx>
      45                 :            : #include <ndtxt.hxx>
      46                 :            : #include <txtatr.hxx>
      47                 :            : #include <swtable.hxx>
      48                 :            : #include <expfld.hxx>
      49                 :            : #include <authfld.hxx>
      50                 :            : #include <toxwrap.hxx>
      51                 :            : 
      52                 :            : #include <comcore.hrc>
      53                 :            : #include <numrule.hxx>
      54                 :            : 
      55                 :            : extern sal_Bool IsFrameBehind( const SwTxtNode& rMyNd, xub_StrLen nMySttPos,
      56                 :            :                            const SwTxtNode& rBehindNd, xub_StrLen nSttPos );
      57                 :            : 
      58                 :            : using namespace ::com::sun::star;
      59                 :            : using namespace ::com::sun::star::uno;
      60                 :            : using ::rtl::OUString;
      61                 :            : /*--------------------------------------------------------------------
      62                 :            :   Initialize strings
      63                 :            :  --------------------------------------------------------------------*/
      64                 :            : 
      65                 :            : sal_uInt16 SwTOXSortTabBase::nOpt = 0;
      66                 :            : 
      67                 :          4 : SwTOXInternational::SwTOXInternational( LanguageType nLang, sal_uInt16 nOpt,
      68                 :            :                                         const String& rSortAlgorithm ) :
      69                 :            :     eLang( nLang ),
      70                 :            :     sSortAlgorithm(rSortAlgorithm),
      71                 :          4 :     nOptions( nOpt )
      72                 :            : {
      73         [ +  - ]:          4 :     Init();
      74                 :          4 : }
      75                 :            : 
      76                 :          0 : SwTOXInternational::SwTOXInternational( const SwTOXInternational& rIntl ) :
      77                 :            :     eLang( rIntl.eLang ),
      78                 :            :     sSortAlgorithm(rIntl.sSortAlgorithm),
      79                 :          0 :     nOptions( rIntl.nOptions )
      80                 :            : {
      81         [ #  # ]:          0 :   Init();
      82                 :          0 : }
      83                 :            : 
      84                 :          4 : void SwTOXInternational::Init()
      85                 :            : {
      86 [ +  - ][ +  - ]:          4 :     pIndexWrapper = new IndexEntrySupplierWrapper();
      87                 :            : 
      88         [ +  - ]:          4 :     const lang::Locale aLcl( SvxCreateLocale( eLang ) );
      89                 :          4 :     pIndexWrapper->SetLocale( aLcl );
      90                 :            : 
      91         [ -  + ]:          4 :     if(!sSortAlgorithm.Len())
      92                 :            :     {
      93         [ #  # ]:          0 :         Sequence < OUString > aSeq( pIndexWrapper->GetAlgorithmList( aLcl ));
      94         [ #  # ]:          0 :         if(aSeq.getLength())
      95 [ #  # ][ #  # ]:          0 :             sSortAlgorithm = aSeq.getConstArray()[0];
      96                 :            :     }
      97                 :            : 
      98         [ +  - ]:          4 :     if ( nOptions & nsSwTOIOptions::TOI_CASE_SENSITIVE )
      99         [ +  - ]:          4 :         pIndexWrapper->LoadAlgorithm( aLcl, sSortAlgorithm, 0 );
     100                 :            :     else
     101         [ #  # ]:          0 :         pIndexWrapper->LoadAlgorithm( aLcl, sSortAlgorithm, SW_COLLATOR_IGNORES );
     102                 :            : 
     103 [ +  - ][ +  - ]:          4 :     pCharClass = new CharClass( aLcl );
     104                 :            : 
     105                 :          4 : }
     106                 :            : 
     107                 :          4 : SwTOXInternational::~SwTOXInternational()
     108                 :            : {
     109 [ +  - ][ +  - ]:          4 :     delete pCharClass;
     110 [ +  - ][ +  - ]:          4 :     delete pIndexWrapper;
     111                 :          4 : }
     112                 :            : 
     113                 :          2 : String SwTOXInternational::ToUpper( const String& rStr, xub_StrLen nPos ) const
     114                 :            : {
     115 [ +  - ][ +  - ]:          2 :     return pCharClass->uppercase( rStr, nPos, 1 );
     116                 :            : }
     117                 :          0 : inline sal_Bool SwTOXInternational::IsNumeric( const String& rStr ) const
     118                 :            : {
     119                 :          0 :     return pCharClass->isNumeric( rStr );
     120                 :            : }
     121                 :            : 
     122                 :          0 : sal_Int32 SwTOXInternational::Compare( const String& rTxt1, const String& rTxtReading1,
     123                 :            :                                        const lang::Locale& rLocale1,
     124                 :            :                                        const String& rTxt2, const String& rTxtReading2,
     125                 :            :                                        const lang::Locale& rLocale2 ) const
     126                 :            : {
     127                 :            :     return pIndexWrapper->CompareIndexEntry( rTxt1, rTxtReading1, rLocale1,
     128                 :          0 :                                              rTxt2, rTxtReading2, rLocale2 );
     129                 :            : }
     130                 :            : 
     131                 :          2 : String SwTOXInternational::GetIndexKey( const String& rTxt, const String& rTxtReading,
     132                 :            :                                         const lang::Locale& rLocale ) const
     133                 :            : {
     134                 :          2 :     return pIndexWrapper->GetIndexKey( rTxt, rTxtReading, rLocale );
     135                 :            : }
     136                 :            : 
     137                 :          0 : String SwTOXInternational::GetFollowingText( sal_Bool bMorePages ) const
     138                 :            : {
     139                 :          0 :     return pIndexWrapper->GetFollowingText( bMorePages );
     140                 :            : }
     141                 :            : 
     142                 :            : /*--------------------------------------------------------------------
     143                 :            :   SortElement for TOX entries
     144                 :            :  --------------------------------------------------------------------*/
     145                 :            : 
     146                 :            : 
     147                 :          2 : SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwCntntNode* pNd,
     148                 :            :                                     const SwTxtTOXMark* pMark,
     149                 :            :                                     const SwTOXInternational* pInter,
     150                 :            :                                     const lang::Locale* pLocale )
     151                 :            :     : pTOXNd( 0 ), pTxtMark( pMark ), pTOXIntl( pInter ),
     152 [ +  - ][ +  - ]:          2 :     nPos( 0 ), nCntPos( 0 ), nType( static_cast<sal_uInt16>(nTyp) ), bValidTxt( sal_False )
     153                 :            : {
     154         [ +  - ]:          2 :     if ( pLocale )
     155                 :          2 :         aLocale = *pLocale;
     156                 :            : 
     157         [ +  - ]:          2 :     if( pNd )
     158                 :            :     {
     159                 :          2 :         xub_StrLen n = 0;
     160         [ +  - ]:          2 :         if( pTxtMark )
     161                 :          2 :             n = *pTxtMark->GetStart();
     162                 :            :         SwTOXSource aTmp( pNd, n,
     163         [ +  - ]:          2 :                     pTxtMark ? pTxtMark->GetTOXMark().IsMainEntry() : sal_False );
     164         [ +  - ]:          2 :         aTOXSources.push_back(aTmp);
     165                 :            : 
     166                 :          2 :         nPos = pNd->GetIndex();
     167                 :            : 
     168         [ -  + ]:          2 :         switch( nTyp )
     169                 :            :         {
     170                 :            :         case TOX_SORT_CONTENT:
     171                 :            :         case TOX_SORT_PARA:
     172                 :            :         case TOX_SORT_TABLE:
     173                 :            :             // If they are in a special areas, we should get the position at the
     174                 :            :             // body
     175         [ #  # ]:          0 :             if( nPos < pNd->GetNodes().GetEndOfExtras().GetIndex() )
     176                 :            :             {
     177                 :            :                 // Then get the 'anchor' (body) position
     178                 :          0 :                 Point aPt;
     179 [ #  # ][ #  # ]:          0 :                 const SwCntntFrm* pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
     180         [ #  # ]:          0 :                 if( pFrm )
     181                 :            :                 {
     182         [ #  # ]:          0 :                     SwPosition aPos( *pNd );
     183                 :          0 :                     const SwDoc& rDoc = *pNd->GetDoc();
     184         [ #  # ]:          0 :                     bool const bResult = GetBodyTxtNode( rDoc, aPos, *pFrm );
     185                 :            :                     OSL_ENSURE(bResult, "where is the text node");
     186                 :            :                     (void) bResult; // unused in non-debug
     187                 :          0 :                     nPos = aPos.nNode.GetIndex();
     188         [ #  # ]:          0 :                     nCntPos = aPos.nContent.GetIndex();
     189                 :            :                 }
     190                 :            :             }
     191                 :            :             else
     192                 :          0 :                 nCntPos = n;
     193                 :          0 :             break;
     194                 :          2 :         default: break;
     195                 :            :         }
     196                 :            :     }
     197                 :          2 : }
     198                 :            : 
     199                 :            : 
     200                 :          0 : String SwTOXSortTabBase::GetURL() const
     201                 :            : {
     202                 :          0 :     return aEmptyStr;
     203                 :            : }
     204                 :            : 
     205                 :          0 : void SwTOXSortTabBase::FillText( SwTxtNode& rNd, const SwIndex& rInsPos,
     206                 :            :                                     sal_uInt16 ) const
     207                 :            : {
     208         [ #  # ]:          0 :     String sMyTxt;
     209         [ #  # ]:          0 :     String sMyTxtReading;
     210                 :            : 
     211         [ #  # ]:          0 :     GetTxt( sMyTxt, sMyTxtReading );
     212                 :            : 
     213 [ #  # ][ #  # ]:          0 :     rNd.InsertText( sMyTxt, rInsPos );
                 [ #  # ]
     214                 :          0 : }
     215                 :            : 
     216                 :          0 : sal_Bool SwTOXSortTabBase::operator==( const SwTOXSortTabBase& rCmp )
     217                 :            : {
     218                 :            :     sal_Bool bRet = nPos == rCmp.nPos && nCntPos == rCmp.nCntPos &&
     219                 :          0 :             (!aTOXSources[0].pNd || !rCmp.aTOXSources[0].pNd ||
     220 [ #  # ][ #  #  :          0 :             aTOXSources[0].pNd == rCmp.aTOXSources[0].pNd );
             #  #  #  # ]
                 [ #  # ]
     221                 :            : 
     222         [ #  # ]:          0 :     if( TOX_SORT_CONTENT == nType )
     223                 :            :     {
     224                 :            :         bRet = bRet && pTxtMark && rCmp.pTxtMark &&
     225 [ #  # ][ #  # ]:          0 :                 *pTxtMark->GetStart() == *rCmp.pTxtMark->GetStart();
         [ #  # ][ #  # ]
     226                 :            : 
     227         [ #  # ]:          0 :         if( bRet )
     228                 :            :         {
     229                 :            :             // Both pointers exist -> compare text
     230                 :            :             // else -> compare AlternativeText
     231                 :          0 :             const xub_StrLen *pEnd  = pTxtMark->GetEnd(),
     232                 :          0 :                                 *pEndCmp = rCmp.pTxtMark->GetEnd();
     233                 :            : 
     234         [ #  # ]:          0 :             String sMyTxt;
     235         [ #  # ]:          0 :             String sMyTxtReading;
     236         [ #  # ]:          0 :             GetTxt( sMyTxt, sMyTxtReading );
     237                 :            : 
     238         [ #  # ]:          0 :             String sOtherTxt;
     239         [ #  # ]:          0 :             String sOtherTxtReading;
     240         [ #  # ]:          0 :             rCmp.GetTxt( sOtherTxt, sOtherTxtReading );
     241                 :            : 
     242                 :            :             bRet = ( ( pEnd && pEndCmp ) || ( !pEnd && !pEndCmp ) ) &&
     243                 :          0 :                     pTOXIntl->IsEqual( sMyTxt, sMyTxtReading, GetLocale(),
     244 [ #  # ][ #  # ]:          0 :                                        sOtherTxt, sOtherTxtReading, rCmp.GetLocale() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     245                 :            :         }
     246                 :            :     }
     247                 :          0 :     return bRet;
     248                 :            : }
     249                 :            : 
     250                 :          0 : sal_Bool SwTOXSortTabBase::operator<( const SwTOXSortTabBase& rCmp )
     251                 :            : {
     252         [ #  # ]:          0 :     if( nPos < rCmp.nPos )
     253                 :          0 :         return sal_True;
     254                 :            : 
     255         [ #  # ]:          0 :     if( nPos == rCmp.nPos )
     256                 :            :     {
     257         [ #  # ]:          0 :         if( nCntPos < rCmp.nCntPos )
     258                 :          0 :             return sal_True;
     259                 :            : 
     260         [ #  # ]:          0 :         if( nCntPos == rCmp.nCntPos )
     261                 :            :         {
     262         [ #  # ]:          0 :             const SwNode* pFirst = aTOXSources[0].pNd;
     263         [ #  # ]:          0 :             const SwNode* pNext = rCmp.aTOXSources[0].pNd;
     264                 :            : 
     265 [ #  # ][ #  # ]:          0 :             if( pFirst && pFirst == pNext )
     266                 :            :             {
     267 [ #  # ][ #  # ]:          0 :                 if( TOX_SORT_CONTENT == nType && pTxtMark && rCmp.pTxtMark )
                 [ #  # ]
     268                 :            :                 {
     269         [ #  # ]:          0 :                     if( *pTxtMark->GetStart() < *rCmp.pTxtMark->GetStart() )
     270                 :          0 :                         return sal_True;
     271                 :            : 
     272         [ #  # ]:          0 :                     if( *pTxtMark->GetStart() == *rCmp.pTxtMark->GetStart() )
     273                 :            :                     {
     274                 :          0 :                         const xub_StrLen *pEnd = pTxtMark->GetEnd(),
     275                 :          0 :                                             *pEndCmp = rCmp.pTxtMark->GetEnd();
     276                 :            : 
     277         [ #  # ]:          0 :                         String sMyTxt;
     278         [ #  # ]:          0 :                         String sMyTxtReading;
     279         [ #  # ]:          0 :                         GetTxt( sMyTxt, sMyTxtReading );
     280                 :            : 
     281         [ #  # ]:          0 :                         String sOtherTxt;
     282         [ #  # ]:          0 :                         String sOtherTxtReading;
     283         [ #  # ]:          0 :                         rCmp.GetTxt( sOtherTxt, sOtherTxtReading );
     284                 :            : 
     285                 :            :                         // Both pointers exist -> compare text
     286                 :            :                         // else -> compare AlternativeText
     287 [ #  # ][ #  # ]:          0 :                         if( ( pEnd && pEndCmp ) || ( !pEnd && !pEndCmp ) )
         [ #  # ][ #  # ]
     288                 :          0 :                             pTOXIntl->IsEqual( sMyTxt, sMyTxtReading, GetLocale(),
     289         [ #  # ]:          0 :                                                sOtherTxt, sOtherTxtReading, rCmp.GetLocale() );
     290                 :            : 
     291 [ #  # ][ #  # ]:          0 :                         if( pEnd && !pEndCmp )
     292 [ #  # ][ #  # ]:          0 :                             return sal_True;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     293                 :            :                     }
     294                 :          0 :                 }
     295                 :            :             }
     296 [ #  # ][ #  # ]:          0 :             else if( pFirst && pFirst->IsTxtNode() &&
           [ #  #  #  # ]
                 [ #  # ]
     297                 :          0 :                      pNext && pNext->IsTxtNode() )
     298                 :            :                     return ::IsFrameBehind( *(SwTxtNode*)pNext, nCntPos,
     299 [ #  # ][ #  # ]:          0 :                                             *(SwTxtNode*)pFirst, nCntPos );
     300                 :            :         }
     301                 :            :     }
     302                 :          0 :     return sal_False;
     303                 :            : }
     304                 :            : 
     305                 :            : /*--------------------------------------------------------------------
     306                 :            :    Sorted keyword entry
     307                 :            :  --------------------------------------------------------------------*/
     308                 :            : 
     309                 :            : 
     310                 :          2 : SwTOXIndex::SwTOXIndex( const SwTxtNode& rNd,
     311                 :            :                         const SwTxtTOXMark* pMark, sal_uInt16 nOptions,
     312                 :            :                         sal_uInt8 nKyLevel,
     313                 :            :                         const SwTOXInternational& rIntl,
     314                 :            :                         const lang::Locale& rLocale )
     315                 :            :     : SwTOXSortTabBase( TOX_SORT_INDEX, &rNd, pMark, &rIntl, &rLocale ),
     316                 :          2 :     nKeyLevel(nKyLevel)
     317                 :            : {
     318                 :          2 :     nPos = rNd.GetIndex();
     319                 :          2 :     nOpt = nOptions;
     320                 :          2 : }
     321                 :            : 
     322                 :            : //
     323                 :            : // Compare keywords. Only relates to the text.
     324                 :            : //
     325                 :            : 
     326                 :            : 
     327                 :          0 : sal_Bool SwTOXIndex::operator==( const SwTOXSortTabBase& rCmpBase )
     328                 :            : {
     329                 :          0 :     SwTOXIndex& rCmp = (SwTOXIndex&)rCmpBase;
     330                 :            : 
     331                 :            :     // Respect case taking dependencies into account
     332 [ #  # ][ #  # ]:          0 :     if(GetLevel() != rCmp.GetLevel() || nKeyLevel != rCmp.nKeyLevel)
         [ #  # ][ #  # ]
                 [ #  # ]
     333                 :          0 :         return sal_False;
     334                 :            : 
     335                 :            :     OSL_ENSURE(pTxtMark, "pTxtMark == 0, No keyword");
     336                 :            : 
     337         [ #  # ]:          0 :     String sMyTxt;
     338         [ #  # ]:          0 :     String sMyTxtReading;
     339         [ #  # ]:          0 :     GetTxt( sMyTxt, sMyTxtReading );
     340                 :            : 
     341         [ #  # ]:          0 :     String sOtherTxt;
     342         [ #  # ]:          0 :     String sOtherTxtReading;
     343         [ #  # ]:          0 :     rCmp.GetTxt( sOtherTxt, sOtherTxtReading );
     344                 :            : 
     345                 :          0 :     sal_Bool bRet = pTOXIntl->IsEqual( sMyTxt, sMyTxtReading, GetLocale(),
     346         [ #  # ]:          0 :                                    sOtherTxt, sOtherTxtReading, rCmp.GetLocale() );
     347                 :            : 
     348                 :            :     // If we don't summarize we need to evaluate the Pos
     349 [ #  # ][ #  # ]:          0 :     if(bRet && !(GetOptions() & nsSwTOIOptions::TOI_SAME_ENTRY))
                 [ #  # ]
     350                 :          0 :         bRet = nPos == rCmp.nPos;
     351                 :            : 
     352 [ #  # ][ #  # ]:          0 :     return bRet;
         [ #  # ][ #  # ]
     353                 :            : }
     354                 :            : 
     355                 :            : //
     356                 :            : // operator, only depends on the text
     357                 :            : 
     358                 :          0 : sal_Bool SwTOXIndex::operator<( const SwTOXSortTabBase& rCmpBase )
     359                 :            : {
     360                 :          0 :     SwTOXIndex& rCmp = (SwTOXIndex&)rCmpBase;
     361                 :            : 
     362                 :            :     OSL_ENSURE(pTxtMark, "pTxtMark == 0, No keyword");
     363                 :            : 
     364         [ #  # ]:          0 :     String sMyTxt;
     365         [ #  # ]:          0 :     String sMyTxtReading;
     366         [ #  # ]:          0 :     GetTxt( sMyTxt, sMyTxtReading );
     367                 :            : 
     368         [ #  # ]:          0 :     String sOtherTxt;
     369         [ #  # ]:          0 :     String sOtherTxtReading;
     370         [ #  # ]:          0 :     rCmp.GetTxt( sOtherTxt, sOtherTxtReading );
     371                 :            : 
     372 [ #  # ][ #  # ]:          0 :     sal_Bool bRet = GetLevel() == rCmp.GetLevel() &&
     373                 :          0 :                 pTOXIntl->IsLess( sMyTxt, sMyTxtReading, GetLocale(),
     374 [ #  # ][ #  # ]:          0 :                                   sOtherTxt, sOtherTxtReading, rCmp.GetLocale() );
                 [ #  # ]
     375                 :            : 
     376                 :            :     // If we don't summarize we need to evaluate the Pos
     377 [ #  # ][ #  # ]:          0 :     if( !bRet && !(GetOptions() & nsSwTOIOptions::TOI_SAME_ENTRY) )
                 [ #  # ]
     378                 :            :     {
     379                 :          0 :         bRet = pTOXIntl->IsEqual( sMyTxt, sMyTxtReading, GetLocale(),
     380         [ #  # ]:          0 :                                    sOtherTxt, sOtherTxtReading, rCmp.GetLocale() ) &&
     381 [ #  # ][ #  # ]:          0 :                nPos < rCmp.nPos;
     382                 :            :     }
     383                 :            : 
     384 [ #  # ][ #  # ]:          0 :     return bRet;
         [ #  # ][ #  # ]
     385                 :            : }
     386                 :            : 
     387                 :            : //
     388                 :            : // The keyword itself
     389                 :            : 
     390                 :          2 : void SwTOXIndex::GetText_Impl( String& rTxt, String& rTxtReading ) const
     391                 :            : {
     392                 :            :     OSL_ENSURE(pTxtMark, "pTxtMark == 0, No keyword");
     393                 :          2 :     const SwTOXMark& rTOXMark = pTxtMark->GetTOXMark();
     394   [ -  -  +  - ]:          2 :     switch(nKeyLevel)
     395                 :            :     {
     396                 :            :         case FORM_PRIMARY_KEY    :
     397                 :            :         {
     398                 :          0 :             rTxt = rTOXMark.GetPrimaryKey();
     399                 :          0 :             rTxtReading = rTOXMark.GetPrimaryKeyReading();
     400                 :            :         }
     401                 :          0 :         break;
     402                 :            :         case FORM_SECONDARY_KEY  :
     403                 :            :         {
     404                 :          0 :             rTxt = rTOXMark.GetSecondaryKey();
     405                 :          0 :             rTxtReading = rTOXMark.GetSecondaryKeyReading();
     406                 :            :         }
     407                 :          0 :         break;
     408                 :            :         case FORM_ENTRY          :
     409                 :            :         {
     410         [ +  - ]:          2 :             rTxt = rTOXMark.GetText();
     411                 :          2 :             rTxtReading = rTOXMark.GetTextReading();
     412                 :            :         }
     413                 :          2 :         break;
     414                 :            :     }
     415                 :            :     // if TOI_INITIAL_CAPS is set, first character is to be capitalized
     416 [ +  - ][ +  - ]:          2 :     if( nsSwTOIOptions::TOI_INITIAL_CAPS & nOpt && pTOXIntl )
     417                 :            :     {
     418         [ +  - ]:          2 :         String sUpper( pTOXIntl->ToUpper( rTxt, 0 ));
     419 [ +  - ][ +  - ]:          2 :         rTxt.Erase( 0, 1 ).Insert( sUpper, 0 );
                 [ +  - ]
     420                 :            :     }
     421                 :          2 : }
     422                 :            : 
     423                 :          2 : void SwTOXIndex::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 ) const
     424                 :            : {
     425                 :          2 :     const xub_StrLen* pEnd = pTxtMark->GetEnd();
     426         [ +  - ]:          2 :     String sTmp;
     427         [ +  - ]:          2 :     String sTmpReading;
     428         [ +  - ]:          4 :     if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() &&
           [ +  -  -  + ]
                 [ -  + ]
     429                 :          2 :             0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY))
     430                 :            :     {
     431                 :          0 :         sTmp = ((SwTxtNode*)aTOXSources[0].pNd)->GetExpandTxt(
     432                 :          0 :                             *pTxtMark->GetStart(),
     433 [ #  # ][ #  # ]:          0 :                             *pEnd - *pTxtMark->GetStart());
                 [ #  # ]
     434 [ #  # ][ #  # ]:          0 :         if(nsSwTOIOptions::TOI_INITIAL_CAPS&nOpt && pTOXIntl)
     435                 :            :         {
     436         [ #  # ]:          0 :             String sUpper( pTOXIntl->ToUpper( sTmp, 0 ));
     437 [ #  # ][ #  # ]:          0 :             sTmp.Erase( 0, 1 ).Insert( sUpper, 0 );
                 [ #  # ]
     438                 :            :         }
     439                 :            :     }
     440                 :            :     else
     441         [ +  - ]:          2 :         GetTxt( sTmp, sTmpReading );
     442                 :            : 
     443 [ +  - ][ +  - ]:          2 :     rNd.InsertText( sTmp, rInsPos );
                 [ +  - ]
     444                 :          2 : }
     445                 :            : 
     446                 :            : 
     447                 :            : 
     448                 :          6 : sal_uInt16 SwTOXIndex::GetLevel() const
     449                 :            : {
     450                 :            :     OSL_ENSURE(pTxtMark, "pTxtMark == 0, No keyword");
     451                 :            : 
     452                 :          6 :     sal_uInt16 nForm = FORM_PRIMARY_KEY;
     453                 :            : 
     454   [ -  +  #  # ]:          6 :     if( 0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY)&&
                 [ -  + ]
     455                 :          0 :         pTxtMark->GetTOXMark().GetPrimaryKey().Len() )
     456                 :            :     {
     457                 :          0 :         nForm = FORM_SECONDARY_KEY;
     458         [ #  # ]:          0 :         if( pTxtMark->GetTOXMark().GetSecondaryKey().Len() )
     459                 :          0 :             nForm = FORM_ENTRY;
     460                 :            :     }
     461                 :          6 :     return nForm;
     462                 :            : }
     463                 :            : 
     464                 :            : /*--------------------------------------------------------------------
     465                 :            :   Key and separator
     466                 :            :  --------------------------------------------------------------------*/
     467                 :            : 
     468                 :            : 
     469                 :          0 : SwTOXCustom::SwTOXCustom(const String& rStr, const String& rReading,
     470                 :            :                          sal_uInt16 nLevel,
     471                 :            :                          const SwTOXInternational& rIntl,
     472                 :            :                          const lang::Locale& rLocale )
     473                 :            :     : SwTOXSortTabBase( TOX_SORT_CUSTOM, 0, 0, &rIntl, &rLocale ),
     474 [ #  # ][ #  # ]:          0 :     aKey(rStr), sReading(rReading), nLev(nLevel)
     475                 :            : {
     476                 :          0 : }
     477                 :            : 
     478                 :            : 
     479                 :          0 : sal_Bool SwTOXCustom::operator==(const SwTOXSortTabBase& rCmpBase)
     480                 :            : {
     481         [ #  # ]:          0 :     String sMyTxt;
     482         [ #  # ]:          0 :     String sMyTxtReading;
     483         [ #  # ]:          0 :     GetTxt( sMyTxt, sMyTxtReading );
     484                 :            : 
     485         [ #  # ]:          0 :     String sOtherTxt;
     486         [ #  # ]:          0 :     String sOtherTxtReading;
     487         [ #  # ]:          0 :     rCmpBase.GetTxt( sOtherTxt, sOtherTxtReading );
     488                 :            : 
     489 [ #  # ][ #  # ]:          0 :     return GetLevel() == rCmpBase.GetLevel() &&
     490                 :          0 :            pTOXIntl->IsEqual( sMyTxt, sMyTxtReading, GetLocale(),
     491 [ #  # ][ #  # ]:          0 :                               sOtherTxt, sOtherTxtReading, rCmpBase.GetLocale() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     492                 :            : }
     493                 :            : 
     494                 :            : 
     495                 :          0 : sal_Bool SwTOXCustom::operator < (const SwTOXSortTabBase& rCmpBase)
     496                 :            : {
     497         [ #  # ]:          0 :     String sMyTxt;
     498         [ #  # ]:          0 :     String sMyTxtReading;
     499         [ #  # ]:          0 :     GetTxt( sMyTxt, sMyTxtReading );
     500                 :            : 
     501         [ #  # ]:          0 :     String sOtherTxt;
     502         [ #  # ]:          0 :     String sOtherTxtReading;
     503         [ #  # ]:          0 :     rCmpBase.GetTxt( sOtherTxt, sOtherTxtReading );
     504                 :            : 
     505 [ #  # ][ #  # ]:          0 :     return  GetLevel() <= rCmpBase.GetLevel() &&
     506                 :          0 :             pTOXIntl->IsLess( sMyTxt, sMyTxtReading, GetLocale(),
     507 [ #  # ][ #  # ]:          0 :                               sOtherTxt, sOtherTxtReading, rCmpBase.GetLocale() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     508                 :            : }
     509                 :            : 
     510                 :            : 
     511                 :          0 : sal_uInt16 SwTOXCustom::GetLevel() const
     512                 :            : {
     513                 :          0 :     return nLev;
     514                 :            : }
     515                 :            : 
     516                 :            : 
     517                 :          0 : void SwTOXCustom::GetText_Impl( String& rTxt, String &rTxtReading ) const
     518                 :            : {
     519                 :          0 :     rTxt = aKey;
     520                 :          0 :     rTxtReading = sReading;
     521                 :          0 : }
     522                 :            : 
     523                 :            : 
     524                 :            : /*--------------------------------------------------------------------
     525                 :            :    Sorts the TOX entries
     526                 :            :  --------------------------------------------------------------------*/
     527                 :            : 
     528                 :            : 
     529                 :          0 : SwTOXContent::SwTOXContent( const SwTxtNode& rNd, const SwTxtTOXMark* pMark,
     530                 :            :                         const SwTOXInternational& rIntl)
     531                 :          0 :     : SwTOXSortTabBase( TOX_SORT_CONTENT, &rNd, pMark, &rIntl )
     532                 :            : {
     533                 :          0 : }
     534                 :            : 
     535                 :            : 
     536                 :            : // The content's text
     537                 :            : 
     538                 :          0 : void SwTOXContent::GetText_Impl( String& rTxt, String& rTxtReading ) const
     539                 :            : {
     540                 :          0 :     const xub_StrLen* pEnd = pTxtMark->GetEnd();
     541 [ #  # ][ #  # ]:          0 :     if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() )
                 [ #  # ]
     542                 :            :     {
     543                 :          0 :         rTxt = ((SwTxtNode*)aTOXSources[0].pNd)->GetExpandTxt(
     544                 :          0 :                                      *pTxtMark->GetStart(),
     545         [ #  # ]:          0 :                                      *pEnd - *pTxtMark->GetStart() );
     546                 :            : 
     547                 :          0 :         rTxtReading = pTxtMark->GetTOXMark().GetTextReading();
     548                 :            :     }
     549                 :            :     else
     550                 :          0 :         rTxt = pTxtMark->GetTOXMark().GetAlternativeText();
     551                 :          0 : }
     552                 :            : 
     553                 :          0 : void SwTOXContent::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 ) const
     554                 :            : {
     555                 :          0 :     const xub_StrLen* pEnd = pTxtMark->GetEnd();
     556 [ #  # ][ #  # ]:          0 :     if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() )
                 [ #  # ]
     557                 :          0 :         ((SwTxtNode*)aTOXSources[0].pNd)->GetExpandTxt( rNd, &rInsPos,
     558                 :          0 :                                     *pTxtMark->GetStart(),
     559                 :          0 :                                     *pEnd - *pTxtMark->GetStart() );
     560                 :            :     else
     561                 :            :     {
     562 [ #  # ][ #  # ]:          0 :         String sTmp, sTmpReading;
     563         [ #  # ]:          0 :         GetTxt( sTmp, sTmpReading );
     564 [ #  # ][ #  # ]:          0 :         rNd.InsertText( sTmp, rInsPos );
                 [ #  # ]
     565                 :            :     }
     566                 :          0 : }
     567                 :            : 
     568                 :            : //
     569                 :            : // The level for displaying it
     570                 :            : //
     571                 :            : 
     572                 :            : 
     573                 :          0 : sal_uInt16 SwTOXContent::GetLevel() const
     574                 :            : {
     575                 :          0 :     return pTxtMark->GetTOXMark().GetLevel();
     576                 :            : }
     577                 :            : 
     578                 :            : /*--------------------------------------------------------------------
     579                 :            :    TOX assembled from paragraphs
     580                 :            :    Watch out for OLE/graphics when sorting!
     581                 :            :    The position must not come from the document, but from the "anchor"!
     582                 :            :  --------------------------------------------------------------------*/
     583                 :            : 
     584                 :          0 : SwTOXPara::SwTOXPara( const SwCntntNode& rNd, SwTOXElement eT, sal_uInt16 nLevel )
     585                 :            :     : SwTOXSortTabBase( TOX_SORT_PARA, &rNd, 0, 0 ),
     586                 :            :     eType( eT ),
     587                 :            :     m_nLevel(nLevel),
     588                 :            :     nStartIndex(0),
     589                 :          0 :     nEndIndex(STRING_LEN)
     590                 :            : {
     591                 :          0 : }
     592                 :            : 
     593                 :            : 
     594                 :          0 : void SwTOXPara::GetText_Impl( String& rTxt, String& ) const
     595                 :            : {
     596                 :          0 :     const SwCntntNode* pNd = aTOXSources[0].pNd;
     597      [ #  #  # ]:          0 :     switch( eType )
     598                 :            :     {
     599                 :            :     case nsSwTOXElement::TOX_SEQUENCE:
     600                 :            :     case nsSwTOXElement::TOX_TEMPLATE:
     601                 :            :     case nsSwTOXElement::TOX_OUTLINELEVEL:
     602                 :            :         {
     603                 :          0 :             xub_StrLen nStt = nStartIndex;
     604                 :            :             rTxt = ((SwTxtNode*)pNd)->GetExpandTxt(
     605                 :            :                     nStt,
     606 [ #  # ][ #  # ]:          0 :                     STRING_NOTFOUND == nEndIndex ? STRING_LEN : nEndIndex - nStt);
     607                 :            :         }
     608                 :          0 :         break;
     609                 :            : 
     610                 :            :     case nsSwTOXElement::TOX_OLE:
     611                 :            :     case nsSwTOXElement::TOX_GRAPHIC:
     612                 :            :     case nsSwTOXElement::TOX_FRAME:
     613                 :            :         {
     614                 :            :             // Find the FlyFormat; the object/graphic name is there
     615                 :          0 :             SwFrmFmt* pFly = pNd->GetFlyFmt();
     616         [ #  # ]:          0 :             if( pFly )
     617                 :          0 :                 rTxt = pFly->GetName();
     618                 :            :             else
     619                 :            :             {
     620                 :            :                 OSL_ENSURE( !this, "Graphic/object without name" );
     621                 :            :                 sal_uInt16 nId = nsSwTOXElement::TOX_OLE == eType
     622                 :            :                                 ? STR_OBJECT_DEFNAME
     623                 :            :                                 : nsSwTOXElement::TOX_GRAPHIC == eType
     624                 :            :                                     ? STR_GRAPHIC_DEFNAME
     625 [ #  # ][ #  # ]:          0 :                                     : STR_FRAME_DEFNAME;
     626 [ #  # ][ #  # ]:          0 :                 rTxt = SW_RESSTR( nId );
     627                 :            :             }
     628                 :            :         }
     629                 :          0 :         break;
     630                 :          0 :     default: break;
     631                 :            :     }
     632                 :          0 : }
     633                 :            : 
     634                 :          0 : void SwTOXPara::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 ) const
     635                 :            : {
     636 [ #  # ][ #  # ]:          0 :     if( nsSwTOXElement::TOX_TEMPLATE == eType || nsSwTOXElement::TOX_SEQUENCE == eType  || nsSwTOXElement::TOX_OUTLINELEVEL == eType)
                 [ #  # ]
     637                 :            :     {
     638                 :          0 :         SwTxtNode* pSrc = (SwTxtNode*)aTOXSources[0].pNd;
     639                 :          0 :         xub_StrLen nStt = nStartIndex;
     640                 :            :         pSrc->GetExpandTxt( rNd, &rInsPos, nStt,
     641                 :            :                 nEndIndex == STRING_LEN ? STRING_LEN : nEndIndex - nStt,
     642         [ #  # ]:          0 :                 sal_False, sal_False, sal_True );
     643                 :            :     }
     644                 :            :     else
     645                 :            :     {
     646 [ #  # ][ #  # ]:          0 :         String sTmp, sTmpReading;
     647         [ #  # ]:          0 :         GetTxt( sTmp, sTmpReading );
     648         [ #  # ]:          0 :         sTmp.SearchAndReplaceAll('\t', ' ');
     649 [ #  # ][ #  # ]:          0 :         rNd.InsertText( sTmp, rInsPos );
                 [ #  # ]
     650                 :            :     }
     651                 :          0 : }
     652                 :            : 
     653                 :            : 
     654                 :          0 : sal_uInt16 SwTOXPara::GetLevel() const
     655                 :            : {
     656                 :          0 :     sal_uInt16 nRet = m_nLevel;
     657                 :          0 :     const SwCntntNode*  pNd = aTOXSources[0].pNd;
     658                 :            : 
     659 [ #  # ][ #  # ]:          0 :     if( nsSwTOXElement::TOX_OUTLINELEVEL == eType && pNd->GetTxtNode() )
                 [ #  # ]
     660                 :            :     {
     661                 :          0 :         const int nTmp = ((SwTxtNode*)pNd)->GetAttrOutlineLevel();
     662         [ #  # ]:          0 :         if(nTmp != 0 )
     663                 :          0 :             nRet = static_cast<sal_uInt16>(nTmp);
     664                 :            :     }
     665                 :          0 :     return nRet;
     666                 :            : }
     667                 :            : 
     668                 :            : 
     669                 :          0 : String SwTOXPara::GetURL() const
     670                 :            : {
     671                 :          0 :     String aTxt;
     672                 :          0 :     const SwCntntNode* pNd = aTOXSources[0].pNd;
     673      [ #  #  # ]:          0 :     switch( eType )
     674                 :            :     {
     675                 :            :     case nsSwTOXElement::TOX_TEMPLATE:
     676                 :            :     case nsSwTOXElement::TOX_OUTLINELEVEL:
     677                 :            :         {
     678                 :          0 :             const SwTxtNode * pTxtNd = static_cast<const SwTxtNode *>(pNd);
     679                 :            : 
     680                 :          0 :             SwDoc* pDoc = const_cast<SwDoc*>( pTxtNd->GetDoc() );
     681         [ #  # ]:          0 :             ::sw::mark::IMark const * const pMark = pDoc->getIDocumentMarkAccess()->getMarkForTxtNode(
     682                 :            :                                 *(pTxtNd),
     683         [ #  # ]:          0 :                                 IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK);
     684         [ #  # ]:          0 :             aTxt = '#';
     685 [ #  # ][ #  # ]:          0 :             const String aMarkName( pMark->GetName() );
     686 [ #  # ][ #  # ]:          0 :             aTxt += aMarkName;
     687                 :            :         }
     688                 :          0 :         break;
     689                 :            : 
     690                 :            :     case nsSwTOXElement::TOX_OLE:
     691                 :            :     case nsSwTOXElement::TOX_GRAPHIC:
     692                 :            :     case nsSwTOXElement::TOX_FRAME:
     693                 :            :         {
     694                 :            :             // Find the FlyFormat; the object/graphic name is there
     695         [ #  # ]:          0 :             SwFrmFmt* pFly = pNd->GetFlyFmt();
     696         [ #  # ]:          0 :             if( pFly )
     697                 :            :             {
     698 [ #  # ][ #  # ]:          0 :                 (( aTxt = '#' ) += pFly->GetName() ) += cMarkSeperator;
                 [ #  # ]
     699                 :            :                 const sal_Char* pStr;
     700   [ #  #  #  # ]:          0 :                 switch( eType )
     701                 :            :                 {
     702                 :          0 :                 case nsSwTOXElement::TOX_OLE:       pStr = pMarkToOLE; break;
     703                 :          0 :                 case nsSwTOXElement::TOX_GRAPHIC:   pStr = pMarkToGraphic; break;
     704                 :          0 :                 case nsSwTOXElement::TOX_FRAME:     pStr = pMarkToFrame; break;
     705                 :          0 :                 default:            pStr = 0;
     706                 :            :                 }
     707         [ #  # ]:          0 :                 if( pStr )
     708         [ #  # ]:          0 :                     aTxt.AppendAscii( pStr );
     709                 :            :             }
     710                 :            :         }
     711                 :          0 :         break;
     712                 :          0 :     default: break;
     713                 :            :     }
     714                 :          0 :     return aTxt;
     715                 :            : }
     716                 :            : 
     717                 :            : 
     718                 :            : /*--------------------------------------------------------------------
     719                 :            :   Table
     720                 :            :  --------------------------------------------------------------------*/
     721                 :            : 
     722                 :            : 
     723                 :          0 : SwTOXTable::SwTOXTable( const SwCntntNode& rNd )
     724                 :            :     : SwTOXSortTabBase( TOX_SORT_TABLE, &rNd, 0, 0 ),
     725                 :          0 :     nLevel(FORM_ALPHA_DELIMITTER)
     726                 :            : {
     727                 :          0 : }
     728                 :            : 
     729                 :            : 
     730                 :          0 : void SwTOXTable::GetText_Impl( String& rTxt, String& ) const
     731                 :            : {
     732         [ #  # ]:          0 :     const SwNode* pNd = aTOXSources[0].pNd;
     733 [ #  # ][ #  # ]:          0 :     if( pNd && 0 != ( pNd = pNd->FindTableNode() ) )
                 [ #  # ]
     734                 :            :     {
     735                 :          0 :         rTxt = ((SwTableNode*)pNd)->GetTable().GetFrmFmt()->GetName();
     736                 :            :     }
     737                 :            :     else
     738                 :            :     {
     739                 :            :         OSL_ENSURE( !this, "Where's my table?" );
     740 [ #  # ][ #  # ]:          0 :         rTxt = SW_RESSTR( STR_TABLE_DEFNAME );
     741                 :            :     }
     742                 :          0 : }
     743                 :            : 
     744                 :          0 : sal_uInt16 SwTOXTable::GetLevel() const
     745                 :            : {
     746                 :          0 :     return nLevel;
     747                 :            : }
     748                 :            : 
     749                 :            : 
     750                 :          0 : String SwTOXTable::GetURL() const
     751                 :            : {
     752                 :          0 :     String aTxt;
     753         [ #  # ]:          0 :     const SwNode* pNd = aTOXSources[0].pNd;
     754 [ #  # ][ #  # ]:          0 :     if( pNd && 0 != ( pNd = pNd->FindTableNode() ) )
         [ #  # ][ #  # ]
     755                 :            :     {
     756         [ #  # ]:          0 :         aTxt = ((SwTableNode*)pNd)->GetTable().GetFrmFmt()->GetName();
     757         [ #  # ]:          0 :         if( aTxt.Len() )
     758                 :            :         {
     759 [ #  # ][ #  # ]:          0 :             ( aTxt.Insert( '#', 0 ) += cMarkSeperator ).
     760         [ #  # ]:          0 :                                             AppendAscii( pMarkToTable );
     761                 :            :         }
     762                 :            :     }
     763                 :          0 :     return aTxt;
     764                 :            : }
     765                 :            : 
     766                 :          0 : SwTOXAuthority::SwTOXAuthority( const SwCntntNode& rNd,
     767                 :            :                 SwFmtFld& rField, const SwTOXInternational& rIntl ) :
     768                 :            :     SwTOXSortTabBase( TOX_SORT_AUTHORITY, &rNd, 0, &rIntl ),
     769                 :          0 :     m_rField(rField)
     770                 :            : {
     771         [ #  # ]:          0 :     if(rField.GetTxtFld())
     772                 :          0 :         nCntPos = *rField.GetTxtFld()->GetStart();
     773                 :          0 : }
     774                 :            : 
     775                 :          0 : sal_uInt16 SwTOXAuthority::GetLevel() const
     776                 :            : {
     777                 :          0 :     String sText(((SwAuthorityField*)m_rField.GetFld())->
     778 [ #  # ][ #  # ]:          0 :                         GetFieldText(AUTH_FIELD_AUTHORITY_TYPE));
     779                 :            :     //#i18655# the level '0' is the heading level therefor the values are incremented here
     780                 :          0 :     sal_uInt16 nRet = 1;
     781 [ #  # ][ #  # ]:          0 :     if( pTOXIntl->IsNumeric( sText ) )
     782                 :            :     {
     783         [ #  # ]:          0 :         nRet = (sal_uInt16)sText.ToInt32();
     784                 :          0 :         nRet++;
     785                 :            :     }
     786                 :            :     //illegal values are also set to 'ARTICLE' as non-numeric values are
     787         [ #  # ]:          0 :     if(nRet > AUTH_TYPE_END)
     788                 :          0 :         nRet = 1;
     789         [ #  # ]:          0 :     return nRet;
     790                 :            : }
     791                 :            : 
     792                 :          0 : static String lcl_GetText(SwFmtFld const& rField)
     793                 :            : {
     794                 :          0 :     return rField.GetFld()->ExpandField(true);
     795                 :            : }
     796                 :            : 
     797                 :          0 : void SwTOXAuthority::GetText_Impl( String& rTxt, String& ) const
     798                 :            : {
     799         [ #  # ]:          0 :     rTxt = lcl_GetText(m_rField);
     800                 :          0 : }
     801                 :            : 
     802                 :          0 : void    SwTOXAuthority::FillText( SwTxtNode& rNd,
     803                 :            :                         const SwIndex& rInsPos, sal_uInt16 nAuthField ) const
     804                 :            : {
     805                 :          0 :     SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetFld();
     806         [ #  # ]:          0 :     String sText;
     807         [ #  # ]:          0 :     if(AUTH_FIELD_IDENTIFIER == nAuthField)
     808                 :            :     {
     809 [ #  # ][ #  # ]:          0 :         sText = lcl_GetText(m_rField);
                 [ #  # ]
     810                 :          0 :         const SwAuthorityFieldType* pType = (const SwAuthorityFieldType*)pField->GetTyp();
     811                 :          0 :         sal_Unicode cChar = pType->GetPrefix();
     812 [ #  # ][ #  # ]:          0 :         if(cChar && cChar != ' ')
     813         [ #  # ]:          0 :             sText.Erase(0, 1);
     814                 :          0 :         cChar = pType->GetSuffix();
     815 [ #  # ][ #  # ]:          0 :         if(cChar && cChar != ' ')
     816         [ #  # ]:          0 :             sText.Erase(sText.Len() - 1, 1);
     817                 :            :     }
     818         [ #  # ]:          0 :     else if(AUTH_FIELD_AUTHORITY_TYPE == nAuthField)
     819                 :            :     {
     820         [ #  # ]:          0 :         sal_uInt16 nLevel = GetLevel();
     821         [ #  # ]:          0 :         if(nLevel)
     822 [ #  # ][ #  # ]:          0 :             sText = SwAuthorityFieldType::GetAuthTypeName((ToxAuthorityType) --nLevel);
     823                 :            :     }
     824                 :            :     else
     825 [ #  # ][ #  # ]:          0 :         sText = (pField->GetFieldText((ToxAuthorityField) nAuthField));
     826 [ #  # ][ #  # ]:          0 :     rNd.InsertText( sText, rInsPos );
     827                 :          0 : }
     828                 :            : 
     829                 :          0 : sal_Bool    SwTOXAuthority::operator==( const SwTOXSortTabBase& rCmp)
     830                 :            : {
     831                 :            :     return nType == rCmp.nType &&
     832                 :          0 :             ((SwAuthorityField*)m_rField.GetFld())->GetHandle() ==
     833   [ #  #  #  # ]:          0 :                 ((SwAuthorityField*)((SwTOXAuthority&)rCmp).m_rField.GetFld())->GetHandle();
     834                 :            : }
     835                 :            : 
     836                 :          0 : sal_Bool    SwTOXAuthority::operator<( const SwTOXSortTabBase& rBase)
     837                 :            : {
     838                 :          0 :     sal_Bool bRet = sal_False;
     839                 :          0 :     SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetFld();
     840                 :            :     SwAuthorityFieldType* pType = (SwAuthorityFieldType*)
     841                 :          0 :                                                 pField->GetTyp();
     842         [ #  # ]:          0 :     if(pType->IsSortByDocument())
     843                 :          0 :         bRet = SwTOXSortTabBase::operator<(rBase);
     844                 :            :     else
     845                 :            :     {
     846                 :            :         SwAuthorityField* pCmpField = (SwAuthorityField*)
     847                 :          0 :                         ((SwTOXAuthority&)rBase).m_rField.GetFld();
     848                 :            : 
     849                 :            : 
     850         [ #  # ]:          0 :         for(sal_uInt16 i = 0; i < pType->GetSortKeyCount(); i++)
     851                 :            :         {
     852         [ #  # ]:          0 :             const SwTOXSortKey* pKey = pType->GetSortKey(i);
     853 [ #  # ][ #  # ]:          0 :             String sMyTxt = pField->GetFieldText(pKey->eField);
     854         [ #  # ]:          0 :             String sMyTxtReading;
     855 [ #  # ][ #  # ]:          0 :             String sOtherTxt = pCmpField->GetFieldText(pKey->eField);
     856         [ #  # ]:          0 :             String sOtherTxtReading;
     857                 :            : 
     858                 :          0 :             sal_Int32 nComp = pTOXIntl->Compare( sMyTxt, sMyTxtReading, GetLocale(),
     859         [ #  # ]:          0 :                                                  sOtherTxt, sOtherTxtReading, rBase.GetLocale() );
     860                 :            : 
     861         [ #  # ]:          0 :             if( nComp )
     862                 :            :             {
     863                 :          0 :                 bRet = (-1 == nComp) == pKey->bSortAscending;
     864                 :            :                 break;
     865                 :            :             }
     866 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     867                 :            :     }
     868                 :          0 :     return bRet;
     869                 :            : }
     870                 :            : 
     871                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10