LCOV - code coverage report
Current view: top level - sw/source/uibase/inc - toxmgr.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 101 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 72 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             : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_TOXMGR_HXX
      21             : #define INCLUDED_SW_SOURCE_UIBASE_INC_TOXMGR_HXX
      22             : 
      23             : #include "swdllapi.h"
      24             : #include "tox.hxx"
      25             : #include <authfld.hxx>
      26             : 
      27             : class SwWrtShell;
      28             : class SwForm;
      29             : 
      30             : // manager for directory functionality
      31             : //one single method will be sufficient to insert AND upate indexes
      32             : class SW_DLLPUBLIC SwTOXDescription
      33             : {
      34             :     TOXTypes            eTOXType;
      35             :     OUString            aStyleNames[MAXLEVEL];
      36             :     OUString            sSequenceName;
      37             :     OUString            sMainEntryCharStyle;
      38             :     OUString            sAutoMarkURL;
      39             :     OUString*           pTitle;
      40             :     OUString*           pTOUName;
      41             :     SwForm*             pForm;
      42             :     sal_uInt16          nContent;
      43             :     sal_uInt16          nIndexOptions;
      44             :     sal_uInt16          nOLEOptions;
      45             :     LanguageType        eLanguage;
      46             :     OUString            sSortAlgorithm;
      47             : 
      48             :     OUString            sAuthBrackets;
      49             :     SwCaptionDisplay    eCaptionDisplay;
      50             :     SwTOXSortKey        eSortKey1;
      51             :     SwTOXSortKey        eSortKey2;
      52             :     SwTOXSortKey        eSortKey3;
      53             :     sal_uInt8           nLevel;
      54             :     bool                bFromObjectNames : 1;
      55             :     bool                bFromChapter : 1;
      56             :     bool                bReadonly: 1;
      57             :     bool                bLevelFromChapter : 1;
      58             :     bool                bIsAuthSequence :1;
      59             :     bool                bSortByDocument :1;
      60             : 
      61             :     //TODO: TemplateNames
      62             :     //const String* pTemplateName = 0, ???
      63             : 
      64             :     SwTOXDescription(SwTOXDescription&) SAL_DELETED_FUNCTION;
      65             :     SwTOXDescription & operator= (SwTOXDescription&) SAL_DELETED_FUNCTION;
      66             : 
      67             : public:
      68             :     // single argument ctors shall be explicit.
      69           0 :     explicit SwTOXDescription(TOXTypes eType) :
      70             :         eTOXType(eType),
      71             :         pTitle(0),
      72             :         pTOUName(0),
      73             :         pForm(0),
      74             :         nContent(nsSwTOXElement::TOX_MARK | nsSwTOXElement::TOX_OUTLINELEVEL),
      75             :         nIndexOptions(nsSwTOIOptions::TOI_SAME_ENTRY|nsSwTOIOptions::TOI_FF|nsSwTOIOptions::TOI_CASE_SENSITIVE),
      76             :         nOLEOptions(0),
      77           0 :         eLanguage((LanguageType)::GetAppLanguage()),
      78             :         eCaptionDisplay(CAPTION_COMPLETE),
      79             :         nLevel(MAXLEVEL),
      80             :         bFromObjectNames(false),
      81             :         bFromChapter(false),
      82             :         bReadonly(true),
      83             :         bLevelFromChapter(false),
      84             :         bIsAuthSequence(false),
      85           0 :         bSortByDocument(true)
      86           0 :         {}
      87           0 :     ~SwTOXDescription()
      88           0 :         {
      89           0 :             delete pTitle;
      90           0 :             delete pForm;
      91           0 :             delete pTOUName;
      92           0 :         }
      93             : 
      94             :     void            SetTOXType(TOXTypes eSet) { eTOXType = eSet;}
      95           0 :     TOXTypes        GetTOXType() const { return eTOXType;}
      96             : 
      97           0 :     const OUString& GetStyleNames(sal_uInt16 nLvl) const
      98           0 :                                 {return aStyleNames[nLvl];}
      99           0 :     void            SetStyleNames(const OUString& rSet, sal_uInt16 nLvl)
     100           0 :                                 {aStyleNames[nLvl] = rSet; }
     101             : 
     102           0 :     const OUString& GetAutoMarkURL() const { return sAutoMarkURL;}
     103           0 :     void            SetAutoMarkURL(const OUString& rSet) {sAutoMarkURL = rSet;}
     104             : 
     105           0 :     void            SetTitle(const OUString& pSet) {delete pTitle; pTitle = new OUString(pSet);}
     106           0 :     const OUString* GetTitle() const {return pTitle; }
     107             : 
     108           0 :     void            SetTOUName(const OUString& pSet) {delete pTOUName; pTOUName = new OUString(pSet);}
     109           0 :     const OUString* GetTOUName() const {return pTOUName; }
     110             : 
     111           0 :     void            SetForm(const SwForm& rSet) {delete pForm; pForm = new SwForm(rSet);}
     112           0 :     const SwForm*   GetForm() const {return pForm;}
     113             : 
     114           0 :     void            SetContentOptions(sal_uInt16 nSet) { nContent = nSet;}
     115           0 :     sal_uInt16          GetContentOptions() const { return nContent;}
     116             : 
     117           0 :     void            SetIndexOptions(sal_uInt16 nSet) { nIndexOptions = nSet;}
     118           0 :     sal_uInt16          GetIndexOptions() const { return nIndexOptions;}
     119             : 
     120           0 :     const OUString& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
     121           0 :     void            SetMainEntryCharStyle(const OUString& rSet)  {sMainEntryCharStyle = rSet;}
     122             : 
     123           0 :     void            SetLevel(sal_uInt8 nSet) {nLevel = nSet;}
     124           0 :     sal_uInt8           GetLevel()const  {return nLevel; }
     125             : 
     126           0 :     void            SetCreateFromObjectNames(bool bSet) { bFromObjectNames = bSet;}
     127           0 :     bool            IsCreateFromObjectNames() const {return bFromObjectNames;}
     128             : 
     129           0 :     const OUString& GetSequenceName() const {return sSequenceName;}
     130           0 :     void            SetSequenceName(const OUString& rSet) {sSequenceName = rSet;}
     131             : 
     132           0 :     SwCaptionDisplay    GetCaptionDisplay() const { return eCaptionDisplay;}
     133           0 :     void                SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
     134             : 
     135           0 :     void            SetFromChapter(bool bSet) { bFromChapter = bSet;}
     136           0 :     bool            IsFromChapter() const {return bFromChapter;}
     137             : 
     138           0 :     void            SetReadonly(bool bSet){bReadonly = bSet;}
     139           0 :     bool            IsReadonly() const {return bReadonly;}
     140             : 
     141           0 :     sal_uInt16          GetOLEOptions() const {return nOLEOptions;}
     142           0 :     void            SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;}
     143             : 
     144           0 :     bool            IsLevelFromChapter() const {return bLevelFromChapter;}
     145           0 :     void            SetLevelFromChapter(bool bSet) {bLevelFromChapter = bSet;}
     146             : 
     147           0 :     OUString        GetAuthBrackets() const {return sAuthBrackets;}
     148           0 :     void            SetAuthBrackets(const OUString& rSet) {sAuthBrackets = rSet;}
     149             : 
     150           0 :     bool            IsAuthSequence() const {return bIsAuthSequence;}
     151           0 :     void            SetAuthSequence(bool bSet){bIsAuthSequence = bSet;}
     152             : 
     153           0 :     bool            IsSortByDocument()const {return bSortByDocument ;}
     154           0 :     void            SetSortByDocument(bool bSet) {bSortByDocument = bSet;}
     155             : 
     156             :     void SetSortKeys(SwTOXSortKey eKey1,
     157             :                         SwTOXSortKey eKey2,
     158             :                             SwTOXSortKey eKey3);
     159             : 
     160           0 :     SwTOXSortKey GetSortKey1() const {return eSortKey1;}
     161           0 :     SwTOXSortKey GetSortKey2() const {return eSortKey2;}
     162           0 :     SwTOXSortKey GetSortKey3() const {return eSortKey3;}
     163             : 
     164           0 :     LanguageType    GetLanguage() const {return eLanguage;}
     165           0 :     void            SetLanguage(LanguageType nLang)  {eLanguage = nLang;}
     166             : 
     167           0 :     const OUString& GetSortAlgorithm()const {return sSortAlgorithm;}
     168           0 :     void            SetSortAlgorithm(const OUString& rSet) {sSortAlgorithm = rSet;}
     169             : 
     170             :     void            ApplyTo(SwTOXBase& rTOXBase);
     171             : 
     172             : };
     173             : 
     174             : class SwTOXMarkDescription
     175             : {
     176             :     TOXTypes    eTOXType;
     177             :     int         nLevel;
     178             :     bool        bMainEntry;
     179             : 
     180             :     OUString*   pPrimKey;
     181             :     OUString*   pSecKey;
     182             :     OUString*   pAltStr;
     183             :     OUString*   pTOUName;
     184             : 
     185             :     OUString*   pPhoneticReadingOfAltStr;
     186             :     OUString*   pPhoneticReadingOfPrimKey;
     187             :     OUString*   pPhoneticReadingOfSecKey;
     188             : 
     189             :     SwTOXMarkDescription(SwTOXMarkDescription&) SAL_DELETED_FUNCTION;
     190             :     SwTOXMarkDescription & operator= (SwTOXMarkDescription&) SAL_DELETED_FUNCTION;
     191             : 
     192             : public:
     193             :     // single argument ctors shall be explicit.
     194           0 :     explicit SwTOXMarkDescription(TOXTypes eType) :
     195             :         eTOXType(eType),
     196             :         nLevel(0),
     197             :         bMainEntry(false),
     198             :         pPrimKey(0),
     199             :         pSecKey(0),
     200             :         pAltStr(0),
     201             :         pTOUName(0),
     202             :         pPhoneticReadingOfAltStr(0),
     203             :         pPhoneticReadingOfPrimKey(0),
     204           0 :         pPhoneticReadingOfSecKey(0)
     205             :         {
     206           0 :         }
     207           0 :     ~SwTOXMarkDescription()
     208             :     {
     209           0 :         delete pPrimKey;
     210           0 :         delete pSecKey;
     211           0 :         delete pAltStr;
     212           0 :         delete pTOUName;
     213           0 :         delete pPhoneticReadingOfAltStr;
     214           0 :         delete pPhoneticReadingOfPrimKey;
     215           0 :         delete pPhoneticReadingOfSecKey;
     216           0 :     }
     217             : 
     218           0 :     TOXTypes        GetTOXType()const {return eTOXType;}
     219             : 
     220           0 :     void            SetLevel(int nSet) {nLevel = nSet;}
     221           0 :     int             GetLevel() const {return nLevel;}
     222             : 
     223           0 :     void            SetMainEntry(bool bSet) {bMainEntry = bSet;}
     224           0 :     bool            IsMainEntry() const {return bMainEntry;}
     225             : 
     226           0 :     void            SetPrimKey(const OUString& rSet)
     227           0 :                                 {delete pPrimKey; pPrimKey = new OUString(rSet);}
     228           0 :     const OUString* GetPrimKey() const {return pPrimKey;}
     229             : 
     230           0 :     void            SetSecKey(const OUString& rSet)
     231           0 :                                 {delete pSecKey;  pSecKey  = new OUString(rSet);}
     232           0 :     const OUString* GetSecKey() const { return pSecKey; }
     233             : 
     234           0 :     void            SetAltStr(const OUString& rSet)
     235           0 :                                 {delete pAltStr;  pAltStr  = new OUString(rSet);}
     236           0 :     const OUString* GetAltStr() const { return pAltStr; }
     237             : 
     238           0 :     void            SetTOUName(const OUString& rSet)
     239           0 :                                 {delete pTOUName; pTOUName = new OUString(rSet);}
     240           0 :     const OUString* GetTOUName() const {return pTOUName;}
     241             : 
     242           0 :     void            SetPhoneticReadingOfAltStr(const OUString& rSet)
     243           0 :                                 {delete pPhoneticReadingOfAltStr;  pPhoneticReadingOfAltStr  = new OUString(rSet);}
     244           0 :     const OUString* GetPhoneticReadingOfAltStr() const {    return pPhoneticReadingOfAltStr; }
     245             : 
     246           0 :     void            SetPhoneticReadingOfPrimKey(const OUString& rSet)
     247           0 :                                 {delete pPhoneticReadingOfPrimKey;  pPhoneticReadingOfPrimKey  = new OUString(rSet);}
     248           0 :     const OUString* GetPhoneticReadingOfPrimKey() const {   return pPhoneticReadingOfPrimKey; }
     249             : 
     250           0 :     void            SetPhoneticReadingOfSecKey(const OUString& rSet)
     251           0 :                                 {delete pPhoneticReadingOfSecKey;  pPhoneticReadingOfSecKey  = new OUString(rSet);}
     252           0 :     const OUString* GetPhoneticReadingOfSecKey() const {    return pPhoneticReadingOfSecKey; }
     253             : };
     254             : 
     255           0 : class SW_DLLPUBLIC SwTOXMgr
     256             : {
     257             :     SwWrtShell*         pSh;
     258             :     SwTOXMark*          pCurTOXMark;
     259             :     SwTOXMarks          aCurMarks;
     260             : 
     261             :     SAL_DLLPRIVATE sal_uInt16                GetUserTypeID(const OUString& rStr);
     262             : 
     263             : public:
     264             :     // single argument ctors shall be explicit.
     265             :     explicit SwTOXMgr(SwWrtShell* pShell);
     266             : 
     267             :     // methods for directory marks
     268             : 
     269             :     void    InsertTOXMark(const SwTOXMarkDescription& rDesc);
     270             : 
     271             :     void    UpdateTOXMark(const SwTOXMarkDescription& rDesc);
     272             : 
     273             :     void                DeleteTOXMark();
     274             :     void                NextTOXMark(bool bSame=false);
     275             :     void                PrevTOXMark(bool bSame=false);
     276             : 
     277             :     // get current TOXmarks
     278             :     sal_uInt16              GetTOXMarks();
     279             :     sal_uInt16              GetTOXMarkCount();
     280             :     SwTOXMark*          GetTOXMark(sal_uInt16 nId);
     281             :     SwTOXMark*          GetCurTOXMark();
     282             :     void                SetCurTOXMark(sal_uInt16 nId);
     283             : 
     284             :     // methods for directories
     285             : 
     286             :     bool    UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase = 0, const SfxItemSet* pSet = 0);
     287             : 
     288             :     const SwTOXType*    GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const;
     289             :     const SwTOXBase*    GetCurTOX();
     290             : 
     291             : };
     292             : 
     293             : // inlines
     294           0 : inline sal_uInt16 SwTOXMgr::GetTOXMarkCount()
     295           0 :     {   return aCurMarks.size();   }
     296             : 
     297           0 : inline SwTOXMark* SwTOXMgr::GetCurTOXMark()
     298           0 :     {   return pCurTOXMark; }
     299             : 
     300             : #endif
     301             : 
     302             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11