LCOV - code coverage report
Current view: top level - sw/source/core/uibase/index - toxmgr.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 270 0.0 %
Date: 2014-04-11 Functions: 0 15 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 <wrtsh.hxx>
      21             : #include <shellres.hxx>
      22             : #include <swwait.hxx>
      23             : #include <view.hxx>
      24             : #include <toxmgr.hxx>
      25             : #include <crsskip.hxx>
      26             : #include <doc.hxx>
      27             : #include <IDocumentUndoRedo.hxx>
      28             : #include <swundo.hxx>
      29             : #include <globals.hrc>
      30             : 
      31             : /*--------------------------------------------------------------------
      32             :     Description: handle indexes with TOXMgr
      33             :  --------------------------------------------------------------------*/
      34             : 
      35           0 : SwTOXMgr::SwTOXMgr(SwWrtShell* pShell):
      36           0 :     pSh(pShell)
      37             : {
      38           0 :     GetTOXMarks();
      39           0 :     SetCurTOXMark(0);
      40           0 : }
      41             : 
      42             : /*--------------------------------------------------------------------
      43             :     Description: handle current TOXMarks
      44             :  --------------------------------------------------------------------*/
      45             : 
      46           0 : sal_uInt16 SwTOXMgr::GetTOXMarks()
      47             : {
      48           0 :     return pSh->GetCurTOXMarks(aCurMarks);
      49             : }
      50             : 
      51           0 : SwTOXMark* SwTOXMgr::GetTOXMark(sal_uInt16 nId)
      52             : {
      53           0 :     if(!aCurMarks.empty())
      54           0 :         return aCurMarks[nId];
      55           0 :     return 0;
      56             : }
      57             : 
      58           0 : void SwTOXMgr::DeleteTOXMark()
      59             : {
      60           0 :     SwTOXMark* pNext = 0;
      61           0 :     if( pCurTOXMark )
      62             :     {
      63           0 :         pNext = (SwTOXMark*)&pSh->GotoTOXMark( *pCurTOXMark, TOX_NXT );
      64           0 :         if( pNext == pCurTOXMark )
      65           0 :             pNext = 0;
      66             : 
      67           0 :         pSh->DeleteTOXMark( pCurTOXMark );
      68           0 :         pSh->SetModified();
      69             :     }
      70             :     // go to next one
      71           0 :     pCurTOXMark = pNext;
      72           0 : }
      73             : 
      74           0 : void    SwTOXMgr::InsertTOXMark(const SwTOXMarkDescription& rDesc)
      75             : {
      76           0 :     SwTOXMark* pMark = 0;
      77           0 :     switch(rDesc.GetTOXType())
      78             :     {
      79             :         case  TOX_CONTENT:
      80             :         {
      81             :             OSL_ENSURE(rDesc.GetLevel() > 0 && rDesc.GetLevel() <= MAXLEVEL,
      82             :                        "invalid InsertTOCMark level");
      83           0 :             pMark = new SwTOXMark(pSh->GetTOXType(TOX_CONTENT, 0));
      84           0 :             pMark->SetLevel( static_cast< sal_uInt16 >(rDesc.GetLevel()) );
      85             : 
      86           0 :             if(rDesc.GetAltStr())
      87           0 :                 pMark->SetAlternativeText(*rDesc.GetAltStr());
      88             :         }
      89           0 :         break;
      90             :         case  TOX_INDEX:
      91             :         {
      92           0 :             pMark = new SwTOXMark(pSh->GetTOXType(TOX_INDEX, 0));
      93             : 
      94           0 :             if( rDesc.GetPrimKey() && !rDesc.GetPrimKey()->isEmpty() )
      95             :             {
      96           0 :                 pMark->SetPrimaryKey( *rDesc.GetPrimKey() );
      97           0 :                 if(rDesc.GetPhoneticReadingOfPrimKey())
      98           0 :                     pMark->SetPrimaryKeyReading( *rDesc.GetPhoneticReadingOfPrimKey() );
      99             : 
     100           0 :                 if( rDesc.GetSecKey() && !rDesc.GetSecKey()->isEmpty() )
     101             :                 {
     102           0 :                     pMark->SetSecondaryKey( *rDesc.GetSecKey() );
     103           0 :                     if(rDesc.GetPhoneticReadingOfSecKey())
     104           0 :                         pMark->SetSecondaryKeyReading( *rDesc.GetPhoneticReadingOfSecKey() );
     105             :                 }
     106             :             }
     107           0 :             if(rDesc.GetAltStr())
     108           0 :                 pMark->SetAlternativeText(*rDesc.GetAltStr());
     109           0 :             if(rDesc.GetPhoneticReadingOfAltStr())
     110           0 :                 pMark->SetTextReading( *rDesc.GetPhoneticReadingOfAltStr() );
     111           0 :             pMark->SetMainEntry(rDesc.IsMainEntry());
     112             :         }
     113           0 :         break;
     114             :         case  TOX_USER:
     115             :         {
     116             :             OSL_ENSURE(rDesc.GetLevel() > 0 && rDesc.GetLevel() <= MAXLEVEL,
     117             :                        "invalid InsertTOCMark level");
     118           0 :             sal_uInt16 nId = rDesc.GetTOUName() ?
     119           0 :                 GetUserTypeID(*rDesc.GetTOUName()) : 0;
     120           0 :             pMark = new SwTOXMark(pSh->GetTOXType(TOX_USER, nId));
     121           0 :             pMark->SetLevel( static_cast< sal_uInt16 >(rDesc.GetLevel()) );
     122             : 
     123           0 :             if(rDesc.GetAltStr())
     124           0 :                 pMark->SetAlternativeText(*rDesc.GetAltStr());
     125             :         }
     126           0 :         break;
     127             :         case  TOX_BIBLIOGRAPHY:
     128             :         {
     129           0 :             pMark = new SwTOXMark(pSh->GetTOXType(TOX_BIBLIOGRAPHY, 0));
     130             : 
     131           0 :             if( rDesc.GetPrimKey() && !rDesc.GetPrimKey()->isEmpty() )
     132             :             {
     133           0 :                 pMark->SetPrimaryKey( *rDesc.GetPrimKey() );
     134           0 :                 if(rDesc.GetPhoneticReadingOfPrimKey())
     135           0 :                     pMark->SetPrimaryKeyReading( *rDesc.GetPhoneticReadingOfPrimKey() );
     136             : 
     137           0 :                 if( rDesc.GetSecKey() && !rDesc.GetSecKey()->isEmpty() )
     138             :                 {
     139           0 :                     pMark->SetSecondaryKey( *rDesc.GetSecKey() );
     140           0 :                     if(rDesc.GetPhoneticReadingOfSecKey())
     141           0 :                         pMark->SetSecondaryKeyReading( *rDesc.GetPhoneticReadingOfSecKey() );
     142             :                 }
     143             :             }
     144           0 :             if(rDesc.GetAltStr())
     145           0 :                 pMark->SetAlternativeText(*rDesc.GetAltStr());
     146           0 :             if(rDesc.GetPhoneticReadingOfAltStr())
     147           0 :                 pMark->SetTextReading( *rDesc.GetPhoneticReadingOfAltStr() );
     148           0 :             pMark->SetMainEntry(rDesc.IsMainEntry());
     149             :         }
     150           0 :         break;
     151             :         default:; //prevent warning
     152             :     }
     153             : 
     154           0 :     if (!pMark)
     155           0 :         return;
     156             : 
     157           0 :     pSh->StartAllAction();
     158           0 :     pSh->SwEditShell::Insert(*pMark);
     159           0 :     pSh->EndAllAction();
     160             : }
     161             : /*--------------------------------------------------------------------
     162             :     Description: Update of TOXMarks
     163             :  --------------------------------------------------------------------*/
     164             : 
     165           0 : void SwTOXMgr::UpdateTOXMark(const SwTOXMarkDescription& rDesc)
     166             : {
     167             :     OSL_ENSURE(pCurTOXMark, "no current TOXMark");
     168             : 
     169           0 :     pSh->StartAllAction();
     170           0 :     if(pCurTOXMark->GetTOXType()->GetType() == TOX_INDEX)
     171             :     {
     172           0 :         if(rDesc.GetPrimKey() && !rDesc.GetPrimKey()->isEmpty() )
     173             :         {
     174           0 :             pCurTOXMark->SetPrimaryKey( *rDesc.GetPrimKey() );
     175           0 :             if(rDesc.GetPhoneticReadingOfPrimKey())
     176           0 :                 pCurTOXMark->SetPrimaryKeyReading( *rDesc.GetPhoneticReadingOfPrimKey() );
     177             :             else
     178           0 :                 pCurTOXMark->SetPrimaryKeyReading( aEmptyOUStr );
     179             : 
     180           0 :             if( rDesc.GetSecKey() && !rDesc.GetSecKey()->isEmpty() )
     181             :             {
     182           0 :                 pCurTOXMark->SetSecondaryKey( *rDesc.GetSecKey() );
     183           0 :                 if(rDesc.GetPhoneticReadingOfSecKey())
     184           0 :                     pCurTOXMark->SetSecondaryKeyReading( *rDesc.GetPhoneticReadingOfSecKey() );
     185             :                 else
     186           0 :                     pCurTOXMark->SetSecondaryKeyReading( aEmptyOUStr );
     187             :             }
     188             :             else
     189             :             {
     190           0 :                 pCurTOXMark->SetSecondaryKey( aEmptyOUStr );
     191           0 :                 pCurTOXMark->SetSecondaryKeyReading( aEmptyOUStr );
     192             :             }
     193             :         }
     194             :         else
     195             :         {
     196           0 :             pCurTOXMark->SetPrimaryKey( aEmptyOUStr );
     197           0 :             pCurTOXMark->SetPrimaryKeyReading( aEmptyOUStr );
     198           0 :             pCurTOXMark->SetSecondaryKey( aEmptyOUStr );
     199           0 :             pCurTOXMark->SetSecondaryKeyReading( aEmptyOUStr );
     200             :         }
     201           0 :         if(rDesc.GetPhoneticReadingOfAltStr())
     202           0 :             pCurTOXMark->SetTextReading( *rDesc.GetPhoneticReadingOfAltStr() );
     203             :         else
     204           0 :             pCurTOXMark->SetTextReading( aEmptyOUStr );
     205           0 :         pCurTOXMark->SetMainEntry(rDesc.IsMainEntry());
     206             :     }
     207             :     else
     208           0 :         pCurTOXMark->SetLevel( static_cast< sal_uInt16 >(rDesc.GetLevel()) );
     209             : 
     210           0 :     if(rDesc.GetAltStr())
     211             :     {
     212             :         // JP 26.08.96: Bug 30344 - either the text of a Doc or an alternative test,
     213             :         //                          not both!
     214           0 :         sal_Bool bReplace = pCurTOXMark->IsAlternativeText();
     215           0 :         if( bReplace )
     216           0 :             pCurTOXMark->SetAlternativeText( *rDesc.GetAltStr() );
     217             :         else
     218             :         {
     219           0 :             SwTOXMark aCpy( *pCurTOXMark );
     220           0 :             aCurMarks.clear();
     221           0 :             pSh->DeleteTOXMark(pCurTOXMark);
     222           0 :             aCpy.SetAlternativeText( *rDesc.GetAltStr() );
     223           0 :             pSh->SwEditShell::Insert( aCpy );
     224           0 :             pCurTOXMark = 0;
     225             :         }
     226             :     }
     227           0 :     pSh->SetModified();
     228           0 :     pSh->EndAllAction();
     229             :     // Bug 36207 pCurTOXMark points nowhere here!
     230           0 :     if(!pCurTOXMark)
     231             :     {
     232           0 :         pSh->Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
     233           0 :         pSh->GetCurTOXMarks(aCurMarks);
     234           0 :         SetCurTOXMark(0);
     235             :     }
     236           0 : }
     237             : 
     238             : /*--------------------------------------------------------------------
     239             :     Description:    determine UserTypeID
     240             :  --------------------------------------------------------------------*/
     241             : 
     242           0 : sal_uInt16 SwTOXMgr::GetUserTypeID(const OUString& rStr)
     243             : {
     244           0 :     sal_uInt16 nSize = pSh->GetTOXTypeCount(TOX_USER);
     245           0 :     for(sal_uInt16 i=0; i < nSize; ++i)
     246             :     {
     247           0 :         const SwTOXType* pTmp = pSh->GetTOXType(TOX_USER, i);
     248           0 :         if(pTmp && pTmp->GetTypeName() == rStr)
     249           0 :             return i;
     250             :     }
     251           0 :     SwTOXType aUserType(TOX_USER, rStr);
     252           0 :     pSh->InsertTOXType(aUserType);
     253           0 :     return nSize;
     254             : }
     255             : 
     256             : /*--------------------------------------------------------------------
     257             :     Description: traveling between TOXMarks
     258             :  --------------------------------------------------------------------*/
     259             : 
     260           0 : void SwTOXMgr::NextTOXMark(sal_Bool bSame)
     261             : {
     262             :     OSL_ENSURE(pCurTOXMark, "no current TOXMark");
     263           0 :     if( pCurTOXMark )
     264             :     {
     265           0 :         SwTOXSearch eDir = bSame ? TOX_SAME_NXT : TOX_NXT;
     266           0 :         pCurTOXMark = (SwTOXMark*)&pSh->GotoTOXMark( *pCurTOXMark, eDir );
     267             :     }
     268           0 : }
     269             : 
     270           0 : void SwTOXMgr::PrevTOXMark(sal_Bool bSame)
     271             : {
     272             :     OSL_ENSURE(pCurTOXMark, "no current TOXMark");
     273           0 :     if( pCurTOXMark )
     274             :     {
     275           0 :         SwTOXSearch eDir = bSame ? TOX_SAME_PRV : TOX_PRV;
     276           0 :         pCurTOXMark = (SwTOXMark*)&pSh->GotoTOXMark(*pCurTOXMark, eDir );
     277             :     }
     278           0 : }
     279             : 
     280             : /*--------------------------------------------------------------------
     281             :     Description: insert keyword index
     282             :  --------------------------------------------------------------------*/
     283           0 : const SwTOXBase* SwTOXMgr::GetCurTOX()
     284             : {
     285           0 :     return pSh->GetCurTOX();
     286             : }
     287             : 
     288           0 : const SwTOXType* SwTOXMgr::GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
     289             : {
     290           0 :     return pSh->GetTOXType(eTyp, nId);
     291             : }
     292             : 
     293           0 : void SwTOXMgr::SetCurTOXMark(sal_uInt16 nId)
     294             : {
     295           0 :     pCurTOXMark = (nId < aCurMarks.size()) ? aCurMarks[nId] : 0;
     296           0 : }
     297             : 
     298           0 : sal_Bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc,
     299             :                                     SwTOXBase** ppBase,
     300             :                                     const SfxItemSet* pSet)
     301             : {
     302           0 :     SwWait aWait( *pSh->GetView().GetDocShell(), true );
     303           0 :     sal_Bool bRet = sal_True;
     304           0 :     const SwTOXBase* pCurTOX = ppBase && *ppBase ? *ppBase : GetCurTOX();
     305           0 :     SwTOXBase* pTOX = (SwTOXBase*)pCurTOX;
     306             : 
     307           0 :     SwTOXBase * pNewTOX = NULL;
     308             : 
     309           0 :     if (pTOX)
     310           0 :         pNewTOX = new SwTOXBase(*pTOX);
     311             : 
     312           0 :     TOXTypes eCurTOXType = rDesc.GetTOXType();
     313           0 :     if(pCurTOX && !ppBase && pSh->HasSelection())
     314           0 :         pSh->EnterStdMode();
     315             : 
     316           0 :     switch(eCurTOXType)
     317             :     {
     318             :         case TOX_INDEX :
     319             :         {
     320           0 :             if(!pCurTOX || (ppBase && !(*ppBase)))
     321             :             {
     322           0 :                 const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, 0);
     323           0 :                 SwForm aForm(eCurTOXType);
     324           0 :                 pNewTOX = new SwTOXBase(pType, aForm, nsSwTOXElement::TOX_MARK, pType->GetTypeName());
     325             :             }
     326           0 :             pNewTOX->SetOptions(rDesc.GetIndexOptions());
     327           0 :             pNewTOX->SetMainEntryCharStyle(rDesc.GetMainEntryCharStyle());
     328           0 :             pSh->SetTOIAutoMarkURL(rDesc.GetAutoMarkURL());
     329           0 :             pSh->ApplyAutoMark();
     330             :         }
     331           0 :         break;
     332             :         case TOX_CONTENT :
     333             :         {
     334           0 :             if(!pCurTOX || (ppBase && !(*ppBase)))
     335             :             {
     336           0 :                 const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, 0);
     337           0 :                 SwForm aForm(eCurTOXType);
     338           0 :                 pNewTOX = new SwTOXBase(pType, aForm, rDesc.GetContentOptions(), pType->GetTypeName());
     339             :             }
     340           0 :             pNewTOX->SetCreate(rDesc.GetContentOptions());
     341           0 :             pNewTOX->SetLevel(rDesc.GetLevel());
     342             :         }
     343           0 :         break;
     344             :         case TOX_USER :
     345             :         {
     346           0 :             if(!pCurTOX || (ppBase && !(*ppBase)))
     347             :             {
     348           0 :                 sal_uInt16 nPos  = 0;
     349           0 :                 sal_uInt16 nSize = pSh->GetTOXTypeCount(eCurTOXType);
     350           0 :                 for(sal_uInt16 i=0; rDesc.GetTOUName() && i < nSize; ++i)
     351           0 :                 {   const SwTOXType* pType = pSh->GetTOXType(TOX_USER, i);
     352           0 :                     if(pType->GetTypeName() == *rDesc.GetTOUName())
     353           0 :                     {   nPos = i;
     354           0 :                         break;
     355             :                     }
     356             :                 }
     357           0 :                 const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, nPos);
     358             : 
     359           0 :                 SwForm aForm(eCurTOXType);
     360           0 :                 pNewTOX = new SwTOXBase(pType, aForm, rDesc.GetContentOptions(), pType->GetTypeName());
     361             : 
     362             :             }
     363             :             else
     364             :             {
     365           0 :                 const_cast<SwTOXBase*>( pCurTOX )->SetCreate(rDesc.GetContentOptions());
     366             :             }
     367           0 :             pNewTOX->SetLevelFromChapter(rDesc.IsLevelFromChapter());
     368             :         }
     369           0 :         break;
     370           0 :         case TOX_CITATION: /** TODO */break;
     371             :         case TOX_OBJECTS:
     372             :         case TOX_TABLES:
     373             :         case TOX_AUTHORITIES:
     374             :         case TOX_BIBLIOGRAPHY:
     375             :         case TOX_ILLUSTRATIONS:
     376             :         {
     377             :             //Special handling for TOX_AUTHORITY
     378           0 :             if(TOX_AUTHORITIES == eCurTOXType)
     379             :             {
     380             :                 SwAuthorityFieldType* pFType = (SwAuthorityFieldType*)
     381           0 :                                                 pSh->GetFldType(RES_AUTHORITY, aEmptyOUStr);
     382           0 :                 if (!pFType)
     383             :                 {
     384           0 :                     SwAuthorityFieldType const type(pSh->GetDoc());
     385             :                     pFType = static_cast<SwAuthorityFieldType*>(
     386           0 :                                 pSh->InsertFldType(type));
     387             :                 }
     388           0 :                 pFType->SetPreSuffix(rDesc.GetAuthBrackets()[0],
     389           0 :                     rDesc.GetAuthBrackets()[1]);
     390           0 :                 pFType->SetSequence(rDesc.IsAuthSequence());
     391           0 :                 SwTOXSortKey rArr[3];
     392           0 :                 rArr[0] = rDesc.GetSortKey1();
     393           0 :                 rArr[1] = rDesc.GetSortKey2();
     394           0 :                 rArr[2] = rDesc.GetSortKey3();
     395           0 :                 pFType->SetSortKeys(3, rArr);
     396           0 :                 pFType->SetSortByDocument(rDesc.IsSortByDocument());
     397           0 :                 pFType->SetLanguage(rDesc.GetLanguage());
     398           0 :                 pFType->SetSortAlgorithm(rDesc.GetSortAlgorithm());
     399             : 
     400           0 :                 pFType->UpdateFlds();
     401             :             }
     402             :             // TODO: consider properties of the current TOXType
     403           0 :             if(!pCurTOX || (ppBase && !(*ppBase)))
     404             :             {
     405           0 :                 const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, 0);
     406           0 :                 SwForm aForm(eCurTOXType);
     407             :                 pNewTOX = new SwTOXBase(
     408             :                     pType, aForm,
     409           0 :                     TOX_AUTHORITIES == eCurTOXType ? nsSwTOXElement::TOX_MARK : 0, pType->GetTypeName());
     410             :             }
     411             :             else
     412             :             {
     413           0 :                 if((!ppBase || !(*ppBase)) && pSh->HasSelection())
     414           0 :                     pSh->DelRight();
     415           0 :                 pNewTOX = (SwTOXBase*)pCurTOX;
     416             :             }
     417           0 :             pNewTOX->SetFromObjectNames(rDesc.IsCreateFromObjectNames());
     418           0 :             pNewTOX->SetOLEOptions(rDesc.GetOLEOptions());
     419             :         }
     420           0 :         break;
     421             :     }
     422             : 
     423             :     OSL_ENSURE(pNewTOX, "no TOXBase created!" );
     424           0 :     if(!pNewTOX)
     425           0 :         return sal_False;
     426             : 
     427           0 :     pNewTOX->SetFromChapter(rDesc.IsFromChapter());
     428           0 :     pNewTOX->SetSequenceName(rDesc.GetSequenceName());
     429           0 :     pNewTOX->SetCaptionDisplay(rDesc.GetCaptionDisplay());
     430           0 :     pNewTOX->SetProtected(rDesc.IsReadonly());
     431             : 
     432           0 :     for(sal_uInt16 nLevel = 0; nLevel < MAXLEVEL; nLevel++)
     433           0 :         pNewTOX->SetStyleNames(rDesc.GetStyleNames(nLevel), nLevel);
     434             : 
     435           0 :     if(rDesc.GetTitle())
     436           0 :         pNewTOX->SetTitle(*rDesc.GetTitle());
     437           0 :     if(rDesc.GetForm())
     438           0 :         pNewTOX->SetTOXForm(*rDesc.GetForm());
     439           0 :     pNewTOX->SetLanguage(rDesc.GetLanguage());
     440           0 :     pNewTOX->SetSortAlgorithm(rDesc.GetSortAlgorithm());
     441             : 
     442           0 :     if(!pCurTOX || (ppBase && !(*ppBase)) )
     443             :     {
     444             :         // when ppBase is passed over, TOXBase is only created here
     445             :         // and then inserted in a global document by the dialog
     446           0 :         if(ppBase)
     447           0 :             (*ppBase) = pNewTOX;
     448             :         else
     449             :         {
     450           0 :             pSh->InsertTableOf(*pNewTOX, pSet);
     451           0 :             delete pNewTOX;
     452             :         }
     453             :     }
     454             :     else
     455             :     {
     456           0 :         SwDoc * pDoc = pSh->GetDoc();
     457             : 
     458           0 :         if (pDoc->GetIDocumentUndoRedo().DoesUndo())
     459             :         {
     460           0 :             pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
     461           0 :             pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL);
     462             :         }
     463             : 
     464           0 :         pDoc->ChgTOX(*pTOX, *pNewTOX);
     465             : 
     466           0 :         pTOX->DisableKeepExpression();
     467           0 :         bRet = pSh->UpdateTableOf(*pTOX, pSet);
     468           0 :         pTOX->EnableKeepExpression();
     469             : 
     470           0 :         if (pDoc->GetIDocumentUndoRedo().DoesUndo())
     471             :         {
     472           0 :             pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL);
     473             :         }
     474             :     }
     475             : 
     476           0 :     return bRet;
     477             : }
     478             : 
     479           0 : void SwTOXDescription::SetSortKeys(SwTOXSortKey eKey1,
     480             :                         SwTOXSortKey eKey2,
     481             :                             SwTOXSortKey eKey3)
     482             : {
     483           0 :     SwTOXSortKey aArr[3];
     484           0 :     sal_uInt16 nPos = 0;
     485           0 :     if(AUTH_FIELD_END > eKey1.eField)
     486           0 :         aArr[nPos++] = eKey1;
     487           0 :     if(AUTH_FIELD_END > eKey2.eField)
     488           0 :         aArr[nPos++] = eKey2;
     489           0 :     if(AUTH_FIELD_END > eKey3.eField)
     490           0 :         aArr[nPos++] = eKey3;
     491             : 
     492           0 :     eSortKey1 = aArr[0];
     493           0 :     eSortKey2 = aArr[1];
     494           0 :     eSortKey3 = aArr[2];
     495           0 : }
     496             : 
     497           0 : void SwTOXDescription::ApplyTo(SwTOXBase& rTOXBase)
     498             : {
     499           0 :     for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
     500           0 :         rTOXBase.SetStyleNames(GetStyleNames(i), i);
     501           0 :     rTOXBase.SetTitle(GetTitle() ? *GetTitle() : OUString());
     502           0 :     rTOXBase.SetCreate(GetContentOptions());
     503             : 
     504           0 :     if(GetTOXType() == TOX_INDEX)
     505           0 :         rTOXBase.SetOptions(GetIndexOptions());
     506           0 :     if(GetTOXType() != TOX_INDEX)
     507           0 :         rTOXBase.SetLevel(GetLevel());
     508           0 :     rTOXBase.SetFromObjectNames(IsCreateFromObjectNames());
     509           0 :     rTOXBase.SetSequenceName(GetSequenceName());
     510           0 :     rTOXBase.SetCaptionDisplay(GetCaptionDisplay());
     511           0 :     rTOXBase.SetFromChapter(IsFromChapter());
     512           0 :     rTOXBase.SetProtected(IsReadonly());
     513           0 :     rTOXBase.SetOLEOptions(GetOLEOptions());
     514           0 :     rTOXBase.SetLevelFromChapter(IsLevelFromChapter());
     515           0 :     rTOXBase.SetLanguage(eLanguage);
     516           0 :     rTOXBase.SetSortAlgorithm(sSortAlgorithm);
     517             : 
     518           0 : }
     519             : 
     520             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10