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

Generated by: LCOV version 1.10