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

Generated by: LCOV version 1.10