LCOV - code coverage report
Current view: top level - sw/source/core/tox - tox.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 423 0.0 %
Date: 2014-04-14 Functions: 0 58 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <tools/resid.hxx>
      21             : #include <hintids.hxx>
      22             : #include <swtypes.hxx>
      23             : #include <txtatr.hxx>
      24             : #include <ndtxt.hxx>
      25             : #include <txttxmrk.hxx>
      26             : #include <tox.hxx>
      27             : #include <poolfmt.hrc>
      28             : #include <doc.hxx>
      29             : #include <docary.hxx>
      30             : #include <paratr.hxx>
      31             : #include <editeng/tstpitem.hxx>
      32             : #include <SwStyleNameMapper.hxx>
      33             : #include <hints.hxx>
      34             : #include <algorithm>
      35             : #include <functional>
      36             : #include <switerator.hxx>
      37             : 
      38             : using namespace std;
      39             : 
      40             : namespace
      41             : {
      42             : 
      43             : struct PatternIni
      44             : {
      45             :     sal_uInt16 n1;
      46             :     sal_uInt16 n2;
      47             :     sal_uInt16 n3;
      48             :     sal_uInt16 n4;
      49             :     sal_uInt16 n5;
      50             : };
      51             : const PatternIni aPatternIni[] =
      52             : {
      53             :     {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX},    //Header - no pattern
      54             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},   //AUTH_TYPE_ARTICLE,
      55             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_BOOK,
      56             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_BOOKLET,
      57             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_CONFERENCE,
      58             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_INBOOK,
      59             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_INCOLLECTION,
      60             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_INPROCEEDINGS,
      61             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_JOURNAL,
      62             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_MANUAL,
      63             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_MASTERSTHESIS,
      64             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_MISC,
      65             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_PHDTHESIS,
      66             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_PROCEEDINGS,
      67             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_TECHREPORT,
      68             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_UNPUBLISHED,
      69             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_EMAIL,
      70             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, AUTH_FIELD_URL, USHRT_MAX},//AUTH_TYPE_WWW,
      71             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_CUSTOM1,
      72             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_CUSTOM2,
      73             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_CUSTOM3,
      74             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_CUSTOM4,
      75             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_TYPE_CUSTOM5,
      76             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_FIELD_YEAR,
      77             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_FIELD_URL,
      78             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_FIELD_CUSTOM1,
      79             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_FIELD_CUSTOM2,
      80             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_FIELD_CUSTOM3,
      81             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_FIELD_CUSTOM4,
      82             :     {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX},     //AUTH_FIELD_CUSTOM5,
      83             :     {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}
      84             : };
      85             : 
      86           0 : static SwFormTokens lcl_GetAuthPattern(sal_uInt16 nTypeId)
      87             : {
      88           0 :     SwFormTokens aRet;
      89             : 
      90           0 :     PatternIni aIni = aPatternIni[nTypeId];
      91             :     sal_uInt16 nVals[5];
      92           0 :     nVals[0] = aIni.n1;
      93           0 :     nVals[1] = aIni.n2;
      94           0 :     nVals[2] = aIni.n3;
      95           0 :     nVals[3] = aIni.n4;
      96           0 :     nVals[4] = aIni.n5;
      97             : 
      98           0 :     SwFormToken aStartToken( TOKEN_AUTHORITY );
      99           0 :     aStartToken.nAuthorityField = AUTH_FIELD_IDENTIFIER;
     100           0 :     aRet.push_back( aStartToken );
     101           0 :     SwFormToken aSeparatorToken( TOKEN_TEXT );
     102           0 :     aSeparatorToken.sText = ": ";
     103           0 :     aRet.push_back( aSeparatorToken );
     104           0 :     SwFormToken aTextToken( TOKEN_TEXT );
     105           0 :     aTextToken.sText = ", ";
     106             : 
     107           0 :     for(sal_uInt16 i = 0; i < 5 ; i++)
     108             :     {
     109           0 :         if(nVals[i] == USHRT_MAX)
     110           0 :             break;
     111           0 :         if( i > 0 )
     112           0 :             aRet.push_back( aTextToken );
     113             : 
     114             :          // -> #i21237#
     115           0 :         SwFormToken aToken(TOKEN_AUTHORITY);
     116             : 
     117           0 :         aToken.nAuthorityField = nVals[i];
     118           0 :         aRet.push_back(aToken);
     119             :         // <- #i21237#
     120           0 :     }
     121             : 
     122           0 :     return aRet;
     123             : }
     124             : 
     125             : }
     126             : 
     127           0 : TYPEINIT2( SwTOXMark, SfxPoolItem, SwClient );    // fuers rtti
     128             : 
     129             : /*--------------------------------------------------------------------
     130             :      TOX dtor and ctor
     131             :  --------------------------------------------------------------------*/
     132             : 
     133             : /// pool default constructor
     134           0 : SwTOXMark::SwTOXMark()
     135             :     : SfxPoolItem( RES_TXTATR_TOXMARK )
     136             :     , SwModify( 0 )
     137             :     ,
     138             :     pTxtAttr( 0 ), nLevel( 0 ),
     139             :     bAutoGenerated(sal_False),
     140           0 :     bMainEntry(sal_False)
     141             : {
     142           0 : }
     143             : 
     144           0 : SwTOXMark::SwTOXMark( const SwTOXType* pTyp )
     145             :     : SfxPoolItem( RES_TXTATR_TOXMARK )
     146             :     , SwModify( const_cast<SwTOXType*>(pTyp) )
     147             :     ,
     148             :     pTxtAttr( 0 ), nLevel( 0 ),
     149             :     bAutoGenerated(sal_False),
     150           0 :     bMainEntry(sal_False)
     151             : {
     152           0 : }
     153             : 
     154           0 : SwTOXMark::SwTOXMark( const SwTOXMark& rCopy )
     155             :     : SfxPoolItem( RES_TXTATR_TOXMARK )
     156             :     , SwModify(rCopy.GetRegisteredInNonConst())
     157             :     ,
     158             :     aPrimaryKey( rCopy.aPrimaryKey ), aSecondaryKey( rCopy.aSecondaryKey ),
     159             :     aTextReading( rCopy.aTextReading ),
     160             :     aPrimaryKeyReading( rCopy.aPrimaryKeyReading ),
     161             :     aSecondaryKeyReading( rCopy.aSecondaryKeyReading ),
     162             :     pTxtAttr( 0 ), nLevel( rCopy.nLevel ),
     163             :     bAutoGenerated( rCopy.bAutoGenerated),
     164           0 :     bMainEntry(rCopy.bMainEntry)
     165             : {
     166             :     // Copy AlternativString
     167           0 :     aAltText = rCopy.aAltText;
     168           0 : }
     169             : 
     170           0 : SwTOXMark::~SwTOXMark()
     171             : {
     172           0 : }
     173             : 
     174           0 : void SwTOXMark::RegisterToTOXType( SwTOXType& rMark )
     175             : {
     176           0 :     rMark.Add(this);
     177           0 : }
     178             : 
     179           0 : bool SwTOXMark::operator==( const SfxPoolItem& rAttr ) const
     180             : {
     181             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "Attributes are not the same" );
     182           0 :     return GetRegisteredIn() == ((SwTOXMark&)rAttr).GetRegisteredIn();
     183             : }
     184             : 
     185           0 : SfxPoolItem* SwTOXMark::Clone( SfxItemPool* ) const
     186             : {
     187           0 :     return new SwTOXMark( *this );
     188             : }
     189             : 
     190           0 : void SwTOXMark::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew)
     191             : {
     192           0 :     NotifyClients(pOld, pNew);
     193           0 :     if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
     194             :     {   // invalidate cached uno object
     195             :         SetXTOXMark(::com::sun::star::uno::Reference<
     196           0 :                         ::com::sun::star::text::XDocumentIndexMark>(0));
     197             :     }
     198           0 : }
     199             : 
     200           0 : void SwTOXMark::InvalidateTOXMark()
     201             : {
     202             :     SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
     203           0 :         &static_cast<SwModify&>(*this) ); // cast to base class!
     204           0 :     NotifyClients(&aMsgHint, &aMsgHint);
     205           0 : }
     206             : 
     207           0 : OUString SwTOXMark::GetText() const
     208             : {
     209           0 :     if( !aAltText.isEmpty() )
     210           0 :         return aAltText;
     211             : 
     212           0 :     if( pTxtAttr && pTxtAttr->GetpTxtNd() )
     213             :     {
     214           0 :         const sal_Int32* pEndIdx = pTxtAttr->GetEnd();
     215             :         OSL_ENSURE( pEndIdx, "TOXMark without mark!");
     216           0 :         if( pEndIdx )
     217             :         {
     218           0 :             const sal_Int32 nStt = *pTxtAttr->GetStart();
     219           0 :             return pTxtAttr->GetpTxtNd()->GetExpandTxt( nStt, *pEndIdx-nStt );
     220             :         }
     221             :     }
     222             : 
     223           0 :     return OUString();
     224             : }
     225             : 
     226           0 : void SwTOXMark::InsertTOXMarks( SwTOXMarks& aMarks, const SwTOXType& rType )
     227             : {
     228           0 :     SwIterator<SwTOXMark,SwTOXType> aIter(rType);
     229           0 :     SwTOXMark* pMark = aIter.First();
     230           0 :     while( pMark )
     231             :     {
     232           0 :         if(pMark->GetTxtTOXMark())
     233           0 :             aMarks.push_back(pMark);
     234           0 :         pMark = aIter.Next();
     235           0 :     }
     236           0 : }
     237             : 
     238             : /*--------------------------------------------------------------------
     239             :   Manage types of TOX
     240             :  --------------------------------------------------------------------*/
     241             : 
     242           0 : SwTOXType::SwTOXType( TOXTypes eTyp, const OUString& rName )
     243             :     : SwModify(0),
     244             :     aName(rName),
     245           0 :     eType(eTyp)
     246             : {
     247           0 : }
     248             : 
     249           0 : SwTOXType::SwTOXType(const SwTOXType& rCopy)
     250           0 :     : SwModify( (SwModify*)rCopy.GetRegisteredIn() ),
     251             :     aName(rCopy.aName),
     252           0 :     eType(rCopy.eType)
     253             : {
     254           0 : }
     255             : 
     256             : /*--------------------------------------------------------------------
     257             :     Edit forms
     258             :   --------------------------------------------------------------------*/
     259             : 
     260           0 : SwForm::SwForm( TOXTypes eTyp ) // #i21237#
     261           0 :     : eType( eTyp ), nFormMaxLevel( SwForm::GetFormMaxLevel( eTyp )),
     262             : //  nFirstTabPos( lNumIndent ),
     263           0 :     bCommaSeparated(sal_False)
     264             : {
     265             :     //bHasFirstTabPos =
     266           0 :     bGenerateTabPos = sal_False;
     267           0 :     bIsRelTabPos = sal_True;
     268             : 
     269             :     // The table of contents has a certain number of headlines + headings
     270             :     // The user has 10 levels + headings
     271             :     // Keyword has 3 levels + headings+ separator
     272             :     // Indexes of tables, object illustrations and authorities consist of a heading and one level
     273             : 
     274             :     sal_uInt16 nPoolId;
     275           0 :     switch( eType )
     276             :     {
     277           0 :     case TOX_INDEX:         nPoolId = STR_POOLCOLL_TOX_IDXH;    break;
     278           0 :     case TOX_USER:          nPoolId = STR_POOLCOLL_TOX_USERH;   break;
     279           0 :     case TOX_CONTENT:       nPoolId = STR_POOLCOLL_TOX_CNTNTH;  break;
     280           0 :     case TOX_ILLUSTRATIONS: nPoolId = STR_POOLCOLL_TOX_ILLUSH;  break;
     281           0 :     case TOX_OBJECTS      : nPoolId = STR_POOLCOLL_TOX_OBJECTH; break;
     282           0 :     case TOX_TABLES       : nPoolId = STR_POOLCOLL_TOX_TABLESH; break;
     283           0 :     case TOX_AUTHORITIES  : nPoolId = STR_POOLCOLL_TOX_AUTHORITIESH;    break;
     284           0 :     case TOX_CITATION  : nPoolId = STR_POOLCOLL_TOX_CITATION; break;
     285             :     default:
     286             :         OSL_ENSURE( !this, "invalid TOXTyp");
     287           0 :         return ;
     288             :     }
     289             : 
     290           0 :     SwFormTokens aTokens;
     291           0 :     if (TOX_CONTENT == eType || TOX_ILLUSTRATIONS == eType )
     292             :     {
     293           0 :         SwFormToken aLinkStt (TOKEN_LINK_START);
     294           0 :         aLinkStt.sCharStyleName = SW_RES(STR_POOLCHR_TOXJUMP);
     295           0 :         aTokens.push_back(aLinkStt);
     296             :     }
     297             : 
     298           0 :     if (TOX_CONTENT == eType)
     299             :     {
     300           0 :         aTokens.push_back(SwFormToken(TOKEN_ENTRY_NO));
     301           0 :         aTokens.push_back(SwFormToken(TOKEN_ENTRY_TEXT));
     302             :     }
     303             :     else
     304           0 :         aTokens.push_back(SwFormToken(TOKEN_ENTRY));
     305             : 
     306           0 :     if (TOX_AUTHORITIES != eType)
     307             :     {
     308           0 :         SwFormToken aToken(TOKEN_TAB_STOP);
     309           0 :         aToken.nTabStopPosition = 0;
     310             : 
     311             :         // #i36870# right aligned tab for all
     312           0 :         aToken.cTabFillChar = '.';
     313           0 :         aToken.eTabAlign = SVX_TAB_ADJUST_END;
     314             : 
     315           0 :         aTokens.push_back(aToken);
     316           0 :         aTokens.push_back(SwFormToken(TOKEN_PAGE_NUMS));
     317             :     }
     318             : 
     319           0 :     if (TOX_CONTENT == eType || TOX_ILLUSTRATIONS == eType)
     320           0 :         aTokens.push_back(SwFormToken(TOKEN_LINK_END));
     321             : 
     322           0 :     SetTemplate( 0, SW_RESSTR( nPoolId++ ));
     323             : 
     324           0 :     if(TOX_INDEX == eType)
     325             :     {
     326           0 :         for( sal_uInt16 i = 1; i < 5; ++i  )
     327             :         {
     328           0 :             if(1 == i)
     329             :             {
     330           0 :                 SwFormTokens aTmpTokens;
     331           0 :                 SwFormToken aTmpToken(TOKEN_ENTRY);
     332           0 :                 aTmpTokens.push_back(aTmpToken);
     333             : 
     334           0 :                 SetPattern( i, aTmpTokens );
     335           0 :                 SetTemplate( i, SW_RESSTR( STR_POOLCOLL_TOX_IDXBREAK    ));
     336             :             }
     337             :             else
     338             :             {
     339           0 :                 SetPattern( i, aTokens );
     340           0 :                 SetTemplate( i, SW_RESSTR( STR_POOLCOLL_TOX_IDX1 + i - 2 ));
     341             :             }
     342             :         }
     343             :     }
     344             :     else
     345           0 :         for( sal_uInt16 i = 1; i < GetFormMax(); ++i, ++nPoolId )    // Number 0 is the title
     346             :         {
     347           0 :             if(TOX_AUTHORITIES == eType)
     348           0 :                 SetPattern(i, lcl_GetAuthPattern(i));
     349             :             else
     350           0 :                 SetPattern( i, aTokens );
     351             : 
     352           0 :             if( TOX_CONTENT == eType && 6 == i )
     353           0 :                 nPoolId = STR_POOLCOLL_TOX_CNTNT6;
     354           0 :             else if( TOX_USER == eType && 6 == i )
     355           0 :                 nPoolId = STR_POOLCOLL_TOX_USER6;
     356           0 :             else if( TOX_AUTHORITIES == eType )
     357           0 :                 nPoolId = STR_POOLCOLL_TOX_AUTHORITIES1;
     358           0 :             SetTemplate( i, SW_RESSTR( nPoolId ) );
     359           0 :         }
     360             : }
     361             : 
     362           0 : SwForm::SwForm(const SwForm& rForm)
     363           0 :     : eType( rForm.eType )
     364             : {
     365           0 :     *this = rForm;
     366           0 : }
     367             : 
     368           0 : SwForm& SwForm::operator=(const SwForm& rForm)
     369             : {
     370           0 :     eType = rForm.eType;
     371           0 :     nFormMaxLevel = rForm.nFormMaxLevel;
     372             : //  nFirstTabPos = rForm.nFirstTabPos;
     373             : //  bHasFirstTabPos = rForm.bHasFirstTabPos;
     374           0 :     bGenerateTabPos = rForm.bGenerateTabPos;
     375           0 :     bIsRelTabPos = rForm.bIsRelTabPos;
     376           0 :     bCommaSeparated = rForm.bCommaSeparated;
     377           0 :     for(sal_uInt16 i=0; i < nFormMaxLevel; ++i)
     378             :     {
     379           0 :         aPattern[i] = rForm.aPattern[i];
     380           0 :         aTemplate[i] = rForm.aTemplate[i];
     381             :     }
     382           0 :     return *this;
     383             : }
     384             : 
     385           0 : sal_uInt16 SwForm::GetFormMaxLevel( TOXTypes eTOXType )
     386             : {
     387           0 :     sal_uInt16 nRet = 0;
     388           0 :     switch( eTOXType )
     389             :     {
     390           0 :         case TOX_INDEX:         nRet = 5;                   break;
     391           0 :         case TOX_USER:          nRet = MAXLEVEL+1;          break;
     392           0 :         case TOX_CONTENT:       nRet = MAXLEVEL+1;          break;
     393             :         case TOX_ILLUSTRATIONS:
     394             :         case TOX_OBJECTS      :
     395           0 :         case TOX_TABLES       : nRet = 2; break;
     396             :         case TOX_BIBLIOGRAPHY :
     397             :         case TOX_CITATION:
     398           0 :         case TOX_AUTHORITIES  : nRet = AUTH_TYPE_END + 1;       break;
     399             :     }
     400           0 :     return nRet;
     401             : }
     402             : 
     403             : // #i21237#
     404           0 : bool operator == (const SwFormToken & rToken, FormTokenType eType)
     405             : {
     406           0 :     return rToken.eTokenType == eType;
     407             : }
     408             : 
     409           0 : void SwForm::AdjustTabStops( SwDoc& rDoc ) // #i21237#
     410             : {
     411           0 :     for(sal_uInt16 nLevel = 1; nLevel < GetFormMax(); nLevel++)
     412             :     {
     413           0 :         const OUString sTemplateName = GetTemplate(nLevel);
     414             : 
     415           0 :         SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( sTemplateName );
     416           0 :         if( pColl == NULL )
     417             :         {
     418             :             const sal_uInt16 nId =
     419           0 :                 SwStyleNameMapper::GetPoolIdFromUIName( sTemplateName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
     420           0 :             if ( USHRT_MAX != nId )
     421           0 :                 pColl = rDoc.GetTxtCollFromPool( nId );
     422             :         }
     423             : 
     424           0 :         const SvxTabStopItem* pTabStops = pColl != NULL ? &pColl->GetTabStops(sal_False) : 0;
     425           0 :         const sal_uInt16 nTabCount = pTabStops != NULL ? pTabStops->Count() : 0;
     426           0 :         if( pTabStops != NULL
     427           0 :             && nTabCount != 0 )
     428             :         {
     429           0 :             SwFormTokens aCurrentPattern = GetPattern(nLevel);
     430           0 :             SwFormTokens::iterator aIt = aCurrentPattern.begin();
     431             : 
     432           0 :             bool bChanged = false;
     433           0 :             for(sal_uInt16 nTab = 0; nTab < nTabCount; ++nTab)
     434             :             {
     435           0 :                 const SvxTabStop& rTab = (*pTabStops)[nTab];
     436             : 
     437           0 :                 aIt = find_if( aIt, aCurrentPattern.end(), SwFormTokenEqualToFormTokenType(TOKEN_TAB_STOP) );
     438           0 :                 if ( aIt != aCurrentPattern.end() )
     439             :                 {
     440           0 :                     bChanged = true;
     441           0 :                     aIt->nTabStopPosition = rTab.GetTabPos();
     442           0 :                     aIt->eTabAlign =
     443           0 :                         ( nTab == nTabCount - 1
     444           0 :                           && rTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
     445             :                         ? SVX_TAB_ADJUST_END
     446           0 :                         : rTab.GetAdjustment();
     447           0 :                     aIt->cTabFillChar = rTab.GetFill();
     448           0 :                     ++aIt;
     449             :                 }
     450             :                 else
     451           0 :                     break; // no more tokens to replace
     452             :             }
     453             : 
     454           0 :             if ( bChanged )
     455           0 :                 SetPattern( nLevel, aCurrentPattern );
     456             :         }
     457           0 :     }
     458           0 : }
     459             : 
     460           0 : OUString SwForm::GetFormEntry()       {return OUString("<E>");}
     461           0 : OUString SwForm::GetFormTab()         {return OUString("<T>");}
     462           0 : OUString SwForm::GetFormPageNums()    {return OUString("<#>");}
     463           0 : OUString SwForm::GetFormLinkStt()     {return OUString("<LS>");}
     464           0 : OUString SwForm::GetFormLinkEnd()     {return OUString("<LE>");}
     465           0 : OUString SwForm::GetFormEntryNum()    {return OUString("<E#>");}
     466           0 : OUString SwForm::GetFormEntryTxt()    {return OUString("<ET>");}
     467           0 : OUString SwForm::GetFormChapterMark() {return OUString("<C>");}
     468           0 : OUString SwForm::GetFormText()        {return OUString("<X>");}
     469           0 : OUString SwForm::GetFormAuth()        {return OUString("<A>");}
     470             : 
     471             : /*--------------------------------------------------------------------
     472             :   Ctor TOXBase
     473             :  --------------------------------------------------------------------*/
     474             : 
     475           0 : SwTOXBase::SwTOXBase(const SwTOXType* pTyp, const SwForm& rForm,
     476             :                      sal_uInt16 nCreaType, const OUString& rTitle )
     477             :     : SwClient((SwModify*)pTyp)
     478             :     , aForm(rForm)
     479             :     , aTitle(rTitle)
     480           0 :     , eLanguage((LanguageType)::GetAppLanguage())
     481             :     , nCreateType(nCreaType)
     482             :     , nOLEOptions(0)
     483             :     , eCaptionDisplay(CAPTION_COMPLETE)
     484             :     , bProtected( sal_True )
     485             :     , bFromChapter(sal_False)
     486             :     , bFromObjectNames(sal_False)
     487             :     , bLevelFromChapter(sal_False)
     488             :     , maMSTOCExpression()
     489           0 :     , mbKeepExpression(sal_True)
     490             : {
     491           0 :     aData.nOptions = 0;
     492           0 : }
     493             : 
     494           0 : SwTOXBase::SwTOXBase( const SwTOXBase& rSource, SwDoc* pDoc )
     495             :     : SwClient( rSource.GetRegisteredInNonConst() )
     496           0 :     , mbKeepExpression(sal_True)
     497             : {
     498           0 :     CopyTOXBase( pDoc, rSource );
     499           0 : }
     500             : 
     501           0 : void SwTOXBase::RegisterToTOXType( SwTOXType& rType )
     502             : {
     503           0 :     rType.Add( this );
     504           0 : }
     505             : 
     506           0 : SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource )
     507             : {
     508           0 :     maMSTOCExpression = rSource.maMSTOCExpression;
     509           0 :     SwTOXType* pType = (SwTOXType*)rSource.GetTOXType();
     510           0 :     if( pDoc && USHRT_MAX == pDoc->GetTOXTypes().GetPos( pType ))
     511             :     {
     512             :         // type not in pDoc, so create it now
     513           0 :         const SwTOXTypes& rTypes = pDoc->GetTOXTypes();
     514           0 :         bool bFound = false;
     515           0 :         for( sal_uInt16 n = rTypes.size(); n; )
     516             :         {
     517           0 :             const SwTOXType* pCmp = rTypes[ --n ];
     518           0 :             if( pCmp->GetType() == pType->GetType() &&
     519           0 :                 pCmp->GetTypeName() == pType->GetTypeName() )
     520             :             {
     521           0 :                 pType = (SwTOXType*)pCmp;
     522           0 :                 bFound = true;
     523           0 :                 break;
     524             :             }
     525             :         }
     526             : 
     527           0 :         if( !bFound )
     528           0 :             pType = (SwTOXType*)pDoc->InsertTOXType( *pType );
     529             :     }
     530           0 :     pType->Add( this );
     531             : 
     532           0 :     nCreateType = rSource.nCreateType;
     533           0 :     aTitle      = rSource.aTitle;
     534           0 :     aForm       = rSource.aForm;
     535           0 :     m_aBookmarkName = rSource.m_aBookmarkName;
     536           0 :     m_aEntryTypeName = rSource.m_aEntryTypeName ;
     537           0 :     bProtected  = rSource.bProtected;
     538           0 :     bFromChapter = rSource.bFromChapter;
     539           0 :     bFromObjectNames = rSource.bFromObjectNames;
     540           0 :     sMainEntryCharStyle = rSource.sMainEntryCharStyle;
     541           0 :     sSequenceName = rSource.sSequenceName;
     542           0 :     eCaptionDisplay = rSource.eCaptionDisplay;
     543           0 :     nOLEOptions = rSource.nOLEOptions;
     544           0 :     eLanguage = rSource.eLanguage;
     545           0 :     sSortAlgorithm = rSource.sSortAlgorithm;
     546           0 :     bLevelFromChapter = rSource.bLevelFromChapter;
     547             : 
     548           0 :     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
     549           0 :         aStyleNames[i] = rSource.aStyleNames[i];
     550             : 
     551             :     // its the same data type!
     552           0 :     aData.nOptions =  rSource.aData.nOptions;
     553             : 
     554           0 :     if( !pDoc || pDoc->IsCopyIsMove() )
     555           0 :         aName = rSource.GetTOXName();
     556             :     else
     557           0 :         aName = pDoc->GetUniqueTOXBaseName( *pType, rSource.GetTOXName() );
     558             : 
     559           0 :     return *this;
     560             : }
     561             : 
     562             : /*--------------------------------------------------------------------
     563             :   TOX specific functions
     564             :  --------------------------------------------------------------------*/
     565             : 
     566           0 : SwTOXBase::~SwTOXBase()
     567             : {
     568             : //    if( GetTOXType()->GetType() == TOX_USER  )
     569             : //        delete aData.pTemplateName;
     570           0 : }
     571             : 
     572           0 : void SwTOXBase::SetTitle(const OUString& rTitle)
     573           0 :     {   aTitle = rTitle; }
     574             : 
     575           0 : void SwTOXBase::SetBookmarkName(const OUString& bName)
     576             : {
     577           0 :      m_aBookmarkName = bName;
     578           0 : }
     579             : 
     580           0 : void SwTOXBase::SetEntryTypeName(const OUString& sName)
     581             : {
     582           0 :      m_aEntryTypeName = sName ;
     583           0 : }
     584             : 
     585           0 : SwTOXBase & SwTOXBase::operator = (const SwTOXBase & rSource)
     586             : {
     587           0 :     aForm = rSource.aForm;
     588           0 :     aName = rSource.aName;
     589           0 :     aTitle = rSource.aTitle;
     590           0 :     m_aBookmarkName = rSource.m_aBookmarkName;
     591           0 :     m_aEntryTypeName = rSource.m_aEntryTypeName ;
     592           0 :     sMainEntryCharStyle = rSource.sMainEntryCharStyle;
     593           0 :     for(sal_uInt16 nLevel = 0; nLevel < MAXLEVEL; nLevel++)
     594           0 :         aStyleNames[nLevel] = rSource.aStyleNames[nLevel];
     595           0 :     sSequenceName = rSource.sSequenceName;
     596           0 :     eLanguage = rSource.eLanguage;
     597           0 :     sSortAlgorithm = rSource.sSortAlgorithm;
     598           0 :     aData = rSource.aData;
     599           0 :     nCreateType = rSource.nCreateType;
     600           0 :     nOLEOptions = rSource.nOLEOptions;
     601           0 :     eCaptionDisplay = rSource.eCaptionDisplay;
     602           0 :     bProtected = rSource.bProtected;
     603           0 :     bFromChapter = rSource.bFromChapter;
     604           0 :     bFromObjectNames = rSource.bFromObjectNames;
     605           0 :     bLevelFromChapter = rSource.bLevelFromChapter;
     606             : 
     607           0 :     if (rSource.GetAttrSet())
     608           0 :         SetAttrSet(*rSource.GetAttrSet());
     609             : 
     610           0 :     return *this;
     611             : }
     612             : 
     613           0 : OUString SwFormToken::GetString() const
     614             : {
     615           0 :     OUString sToken;
     616             : 
     617           0 :     switch( eTokenType )
     618             :     {
     619             :         case TOKEN_ENTRY_NO:
     620           0 :             sToken = SwForm::GetFormEntryNum();
     621           0 :         break;
     622             :         case TOKEN_ENTRY_TEXT:
     623           0 :             sToken = SwForm::GetFormEntryTxt();
     624           0 :         break;
     625             :         case TOKEN_ENTRY:
     626           0 :             sToken = SwForm::GetFormEntry();
     627           0 :         break;
     628             :         case TOKEN_TAB_STOP:
     629           0 :             sToken = SwForm::GetFormTab();
     630           0 :         break;
     631             :         case TOKEN_TEXT:
     632             :             // Return a Token only if Text is not empty!
     633           0 :             if( sText.isEmpty() )
     634             :             {
     635           0 :                 return OUString();
     636             :             }
     637           0 :             sToken = SwForm::GetFormText();
     638           0 :         break;
     639             :         case TOKEN_PAGE_NUMS:
     640           0 :             sToken = SwForm::GetFormPageNums();
     641           0 :         break;
     642             :         case TOKEN_CHAPTER_INFO:
     643           0 :             sToken = SwForm::GetFormChapterMark();
     644           0 :         break;
     645             :         case TOKEN_LINK_START:
     646           0 :             sToken = SwForm::GetFormLinkStt();
     647           0 :         break;
     648             :         case TOKEN_LINK_END:
     649           0 :             sToken = SwForm::GetFormLinkEnd();
     650           0 :         break;
     651             :         case TOKEN_AUTHORITY:
     652             :         {
     653           0 :             sToken = SwForm::GetFormAuth();
     654             :         }
     655           0 :         break;
     656             :         case TOKEN_END:
     657           0 :         break;
     658             :     }
     659             : 
     660           0 :     OUString sData = " " + sCharStyleName + "," + OUString::number( nPoolId ) + ",";
     661             : 
     662             :     // TabStopPosition and TabAlign or ChapterInfoFormat
     663           0 :     switch (eTokenType)
     664             :     {
     665             :         case TOKEN_TAB_STOP:
     666           0 :             sData += OUString::number( nTabStopPosition ) + ","
     667           0 :                   +  OUString::number( static_cast< sal_Int32 >(eTabAlign) ) + ","
     668           0 :                   +  OUString(cTabFillChar) + ","
     669           0 :                   +  OUString::number( bWithTab );
     670           0 :             break;
     671             :         case TOKEN_CHAPTER_INFO:
     672             :         case TOKEN_ENTRY_NO:
     673             :             // add also maximum permitted level
     674           0 :             sData += OUString::number( nChapterFormat ) + ","
     675           0 :                   +  OUString::number( nOutlineLevel );
     676           0 :             break;
     677             :         case TOKEN_TEXT:
     678             :             sData += OUString(TOX_STYLE_DELIMITER)
     679           0 :                   +  sText.replaceAll(OUString(TOX_STYLE_DELIMITER), OUString())
     680           0 :                   +  OUString(TOX_STYLE_DELIMITER);
     681           0 :             break;
     682             :         case TOKEN_AUTHORITY:
     683           0 :             if (nAuthorityField<10)
     684             :             {
     685           0 :                  sData = "0" + OUString::number( nAuthorityField ) + sData;
     686             :             }
     687             :             else
     688             :             {
     689           0 :                  sData = OUString::number( nAuthorityField ) + sData;
     690             :             }
     691             :         default:
     692           0 :             break;
     693             :     }
     694             : 
     695           0 :     return sToken.copy(0, sToken.getLength()-1) + sData + sToken.copy(sToken.getLength()-1);
     696             : }
     697             : 
     698             : // -> #i21237#
     699           0 : SwFormTokensHelper::SwFormTokensHelper(const OUString & rPattern)
     700             : {
     701           0 :     sal_Int32 nCurPatternPos = 0;
     702           0 :     sal_Int32 nCurPatternLen = 0;
     703             : 
     704           0 :     while (nCurPatternPos < rPattern.getLength())
     705             :     {
     706             :         // FIXME: nCurPatternLen added but set to 0?
     707           0 :         nCurPatternPos = nCurPatternPos + nCurPatternLen;
     708             : 
     709           0 :         SwFormToken aToken = BuildToken(rPattern, nCurPatternPos);
     710           0 :         aTokens.push_back(aToken);
     711           0 :     }
     712           0 : }
     713             : 
     714           0 : SwFormToken SwFormTokensHelper::BuildToken( const OUString & sPattern,
     715             :                                             sal_Int32 & nCurPatternPos ) const
     716             : {
     717           0 :     OUString sToken( SearchNextToken(sPattern, nCurPatternPos) );
     718           0 :     nCurPatternPos += sToken.getLength();
     719           0 :     sal_Int32 nTokenLen = 0;
     720           0 :     FormTokenType eTokenType = GetTokenType(sToken, &nTokenLen);
     721             : 
     722             :     // at this point sPattern contains the
     723             :     // character style name, the PoolId, tab stop position, tab stop alignment, chapter info format
     724             :     // the form is: CharStyleName, PoolId[, TabStopPosition|ChapterInfoFormat[, TabStopAlignment[, TabFillChar]]]
     725             :     // in text tokens the form differs from the others: CharStyleName, PoolId[,\0xffinserted text\0xff]
     726           0 :     SwFormToken eRet( eTokenType );
     727           0 :     const OUString sAuthFieldEnum = sToken.copy( 2, 2 );
     728           0 :     sToken = sToken.copy( nTokenLen, sToken.getLength() - nTokenLen - 1);
     729             : 
     730           0 :     eRet.sCharStyleName = sToken.getToken( 0, ',');
     731           0 :     OUString sTmp( sToken.getToken( 1, ',' ));
     732           0 :     if( !sTmp.isEmpty() )
     733           0 :         eRet.nPoolId = static_cast<sal_uInt16>(sTmp.toInt32());
     734             : 
     735           0 :     switch( eTokenType )
     736             :     {
     737             : //i53420
     738             :     case TOKEN_CHAPTER_INFO:
     739             : //i53420
     740             :     case TOKEN_ENTRY_NO:
     741           0 :         sTmp = sToken.getToken( 2, ',' );
     742           0 :         if( !sTmp.isEmpty() )
     743           0 :             eRet.nChapterFormat = static_cast<sal_uInt16>(sTmp.toInt32());
     744           0 :         sTmp = sToken.getToken( 3, ',' );
     745           0 :         if( !sTmp.isEmpty() )
     746           0 :             eRet.nOutlineLevel = static_cast<sal_uInt16>(sTmp.toInt32()); //the maximum outline level to examine
     747           0 :         break;
     748             : 
     749             :     case TOKEN_TEXT:
     750             :         {
     751           0 :             const sal_Int32 nStartText = sToken.indexOf( TOX_STYLE_DELIMITER );
     752           0 :             if( nStartText>=0 && nStartText+1<sToken.getLength())
     753             :             {
     754             :                 const sal_Int32 nEndText = sToken.indexOf( TOX_STYLE_DELIMITER,
     755           0 :                                                            nStartText + 1);
     756           0 :                 if( nEndText>=0 )
     757             :                 {
     758           0 :                     eRet.sText = sToken.copy( nStartText + 1,
     759           0 :                                                 nEndText - nStartText - 1);
     760             :                 }
     761             :             }
     762             :         }
     763           0 :         break;
     764             : 
     765             :     case TOKEN_TAB_STOP:
     766           0 :         sTmp = sToken.getToken( 2, ',' );
     767           0 :         if( !sTmp.isEmpty() )
     768           0 :             eRet.nTabStopPosition = sTmp.toInt32();
     769             : 
     770           0 :         sTmp = sToken.getToken( 3, ',' );
     771           0 :         if( !sTmp.isEmpty() )
     772           0 :             eRet.eTabAlign = static_cast<SvxTabAdjust>(sTmp.toInt32());
     773             : 
     774           0 :         sTmp = sToken.getToken( 4, ',' );
     775           0 :         if( !sTmp.isEmpty() )
     776           0 :             eRet.cTabFillChar = sTmp[0];
     777             : 
     778           0 :         sTmp = sToken.getToken( 5, ',' );
     779           0 :         if( !sTmp.isEmpty() )
     780           0 :             eRet.bWithTab = 0 != sTmp.toInt32();
     781           0 :         break;
     782             : 
     783             :     case TOKEN_AUTHORITY:
     784           0 :         eRet.nAuthorityField = static_cast<sal_uInt16>(sAuthFieldEnum.toInt32());
     785           0 :         break;
     786           0 :     default: break;
     787             :     }
     788           0 :     return eRet;
     789             : }
     790             : 
     791           0 : OUString SwFormTokensHelper::SearchNextToken( const OUString & sPattern,
     792             :                                               sal_Int32 nStt ) const
     793             : {
     794             :     //it's not so easy - it doesn't work if the text part contains a '>'
     795             : 
     796           0 :     sal_Int32 nEnd = sPattern.indexOf( '>', nStt );
     797           0 :     if( nEnd<0 )
     798             :     {
     799             :         // FIXME: why is nEnd updated?
     800             :         //        should "aResult = sPattern.copy( nStt, nEnd - nStt );"
     801             :         //        or something like that be returned?
     802           0 :         nEnd = sPattern.getLength();
     803             :     }
     804             :     else
     805             :     {
     806             :         // apparently the TOX_STYLE_DELIMITER act as a bracketing for
     807             :         // TOKEN_TEXT tokens so that the user can have '>' inside the text...
     808           0 :         const sal_Int32 nTextSeparatorFirst = sPattern.indexOf( TOX_STYLE_DELIMITER, nStt );
     809           0 :         if (    nTextSeparatorFirst >= 0
     810           0 :             &&  nTextSeparatorFirst + 1 < sPattern.getLength()
     811           0 :             &&  nTextSeparatorFirst < nEnd)
     812             :         {
     813             :             const sal_Int32 nTextSeparatorSecond = sPattern.indexOf( TOX_STYLE_DELIMITER,
     814           0 :                                                                      nTextSeparatorFirst + 1 );
     815             :             // Since nEnd>=0 we don't need to check if nTextSeparatorSecond<0!
     816           0 :             if( nEnd < nTextSeparatorSecond )
     817           0 :                 nEnd = sPattern.indexOf( '>', nTextSeparatorSecond );
     818             :             // FIXME: No check to verify that nEnd is still >=0?
     819             :             assert(nEnd >= 0);
     820             :         }
     821             : 
     822           0 :         ++nEnd;
     823             : 
     824           0 :         return sPattern.copy( nStt, nEnd - nStt );
     825             :     }
     826             : 
     827           0 :     return OUString();
     828             : }
     829             : 
     830           0 : FormTokenType SwFormTokensHelper::GetTokenType(const OUString & sToken,
     831             :                                                sal_Int32 * pTokenLen) const
     832             : {
     833             :     static struct
     834           0 :     {
     835             :         OUString sNm;
     836             :         sal_uInt16 nOffset;
     837             :         FormTokenType eToken;
     838             :     } const aTokenArr[] = {
     839             :         { SwForm::GetFormTab(),         1, TOKEN_TAB_STOP },
     840             :         { SwForm::GetFormPageNums(),    1, TOKEN_PAGE_NUMS },
     841             :         { SwForm::GetFormLinkStt(),     1, TOKEN_LINK_START },
     842             :         { SwForm::GetFormLinkEnd(),     1, TOKEN_LINK_END },
     843             :         { SwForm::GetFormEntryNum(),    1, TOKEN_ENTRY_NO },
     844             :         { SwForm::GetFormEntryTxt(),    1, TOKEN_ENTRY_TEXT },
     845             :         { SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO },
     846             :         { SwForm::GetFormText(),        1, TOKEN_TEXT },
     847             :         { SwForm::GetFormEntry(),       1, TOKEN_ENTRY },
     848             :         { SwForm::GetFormAuth(),        3, TOKEN_AUTHORITY }
     849           0 :     };
     850             : 
     851           0 :     for( size_t i = 0; i<SAL_N_ELEMENTS(aTokenArr); ++i )
     852             :     {
     853           0 :         const sal_Int32 nLen(aTokenArr[i].sNm.getLength());
     854           0 :         if( sToken.startsWith( aTokenArr[i].sNm.copy(0, nLen - aTokenArr[i].nOffset) ))
     855             :         {
     856           0 :             if (pTokenLen)
     857           0 :                 *pTokenLen = nLen;
     858           0 :             return aTokenArr[ i ].eToken;
     859             :         }
     860             :     }
     861             : 
     862             :     OSL_FAIL( "wrong token" );
     863           0 :     return TOKEN_END;
     864             : }
     865             : 
     866             : // <- #i21237#
     867             : 
     868           0 : void SwForm::SetPattern(sal_uInt16 nLevel, const SwFormTokens& rTokens)
     869             : {
     870             :     OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX");
     871           0 :     aPattern[nLevel] = rTokens;
     872           0 : }
     873             : 
     874           0 : void SwForm::SetPattern(sal_uInt16 nLevel, const OUString & rStr)
     875             : {
     876             :     OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX");
     877             : 
     878           0 :     SwFormTokensHelper aHelper(rStr);
     879           0 :     aPattern[nLevel] = aHelper.GetTokens();
     880           0 : }
     881             : 
     882           0 : const SwFormTokens& SwForm::GetPattern(sal_uInt16 nLevel) const
     883             : {
     884             :     OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX");
     885           0 :     return aPattern[nLevel];
     886             : }
     887             : 
     888           0 : sal_uInt16 SwTOXTypes::GetPos(const SwTOXType* pTOXType) const
     889             : {
     890           0 :     const_iterator it = std::find(begin(), end(), pTOXType);
     891           0 :     return it == end() ? USHRT_MAX : it - begin();
     892             : }
     893             : 
     894           0 : SwTOXTypes::~SwTOXTypes()
     895             : {
     896           0 :     for(const_iterator it = begin(); it != end(); ++it)
     897           0 :         delete *it;
     898           0 : }
     899             : 
     900             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10