LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/inc - toxmgr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 101 0.0 %
Date: 2012-12-27 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 _TOXMGR_HXX
      21             : #define _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             :     String              aStyleNames[MAXLEVEL];
      38             :     String              sSequenceName;
      39             :     String              sMainEntryCharStyle;
      40             :     String              sAutoMarkURL;
      41             :     String*             pTitle;
      42             :     String*             pTOUName;
      43             :     SwForm*             pForm;
      44             :     sal_uInt16              nContent;
      45             :     sal_uInt16              nIndexOptions;
      46             :     sal_uInt16              nOLEOptions;
      47             :     LanguageType        eLanguage;
      48             :     String              sSortAlgorithm;
      49             : 
      50             :     String              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 String&   GetStyleNames(sal_uInt16 nLvl) const
     102           0 :                                 {return aStyleNames[nLvl];}
     103           0 :     void            SetStyleNames(const String& rSet, sal_uInt16 nLvl)
     104           0 :                                 {aStyleNames[nLvl] = rSet; }
     105             : 
     106           0 :     const String&   GetAutoMarkURL() const { return sAutoMarkURL;}
     107           0 :     void            SetAutoMarkURL(const String& rSet) {sAutoMarkURL = rSet;}
     108             : 
     109           0 :     void            SetTitle(const String& pSet) {delete pTitle; pTitle = new String(pSet);}
     110           0 :     const String*   GetTitle() const {return pTitle; }
     111             : 
     112           0 :     void            SetTOUName(const String& pSet) {delete pTOUName; pTOUName = new String(pSet);}
     113           0 :     const String*   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 String&   GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
     125           0 :     void            SetMainEntryCharStyle(const String& 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 String&   GetSequenceName() const {return sSequenceName;}
     134           0 :     void            SetSequenceName(const String& 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 :     String          GetAuthBrackets() const {return sAuthBrackets;}
     152           0 :     void            SetAuthBrackets(const String& 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 String&   GetSortAlgorithm()const {return sSortAlgorithm;}
     172           0 :     void            SetSortAlgorithm(const String& 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             :     String*     pPrimKey;
     185             :     String*     pSecKey;
     186             :     String*     pAltStr;
     187             :     String*     pTOUName;
     188             : 
     189             :     String*     pPhoneticReadingOfAltStr;
     190             :     String*     pPhoneticReadingOfPrimKey;
     191             :     String*     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 String& rSet)
     233           0 :                                 {delete pPrimKey; pPrimKey = new String(rSet);}
     234           0 :     const String*   GetPrimKey() const {return pPrimKey;}
     235             : 
     236           0 :     void            SetSecKey(const String& rSet)
     237           0 :                                 {delete pSecKey;  pSecKey  = new String(rSet);}
     238           0 :     const String*   GetSecKey() const { return pSecKey; }
     239             : 
     240           0 :     void            SetAltStr(const String& rSet)
     241           0 :                                 {delete pAltStr;  pAltStr  = new String(rSet);}
     242           0 :     const String*   GetAltStr() const { return pAltStr; }
     243             : 
     244           0 :     void            SetTOUName(const String& rSet)
     245           0 :                                 {delete pTOUName; pTOUName = new String(rSet);}
     246           0 :     const String*   GetTOUName() const {return pTOUName;}
     247             : 
     248             : 
     249           0 :     void            SetPhoneticReadingOfAltStr(const String& rSet)
     250           0 :                                 {delete pPhoneticReadingOfAltStr;  pPhoneticReadingOfAltStr  = new String(rSet);}
     251           0 :     const String*   GetPhoneticReadingOfAltStr() const {    return pPhoneticReadingOfAltStr; }
     252             : 
     253           0 :     void            SetPhoneticReadingOfPrimKey(const String& rSet)
     254           0 :                                 {delete pPhoneticReadingOfPrimKey;  pPhoneticReadingOfPrimKey  = new String(rSet);}
     255           0 :     const String*   GetPhoneticReadingOfPrimKey() const {   return pPhoneticReadingOfPrimKey; }
     256             : 
     257           0 :     void            SetPhoneticReadingOfSecKey(const String& rSet)
     258           0 :                                 {delete pPhoneticReadingOfSecKey;  pPhoneticReadingOfSecKey  = new String(rSet);}
     259           0 :     const String*   GetPhoneticReadingOfSecKey() const {    return pPhoneticReadingOfSecKey; }
     260             : };
     261             : 
     262           0 : class SW_DLLPUBLIC SwTOXMgr
     263             : {
     264             :     SwWrtShell*         pSh;
     265             :     SwTOXMark*          pCurTOXMark;
     266             :     SwTOXMarks          aCurMarks;
     267             : 
     268             :     SW_DLLPRIVATE sal_uInt16                GetUserTypeID(const String& rStr);
     269             : 
     270             : public:
     271             :     // single argument ctors shall be explicit.
     272             :     explicit SwTOXMgr(SwWrtShell* pShell);
     273             : 
     274             :     //
     275             :     // methods for directory marks
     276             :     //
     277             :     void    InsertTOXMark(const SwTOXMarkDescription& rDesc);
     278             : 
     279             :     void    UpdateTOXMark(const SwTOXMarkDescription& rDesc);
     280             : 
     281             : 
     282             :     void                DeleteTOXMark();
     283             :     void                NextTOXMark(sal_Bool bSame=sal_False);
     284             :     void                PrevTOXMark(sal_Bool bSame=sal_False);
     285             : 
     286             :     // get current TOXmarks
     287             :     sal_uInt16              GetTOXMarks();
     288             :     sal_uInt16              GetTOXMarkCount();
     289             :     SwTOXMark*          GetTOXMark(sal_uInt16 nId);
     290             :     SwTOXMark*          GetCurTOXMark();
     291             :     void                SetCurTOXMark(sal_uInt16 nId);
     292             : 
     293             :     //
     294             :     // methods for directories
     295             :     //
     296             :     sal_Bool    UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase = 0, const SfxItemSet* pSet = 0);
     297             : 
     298             :     const SwTOXType*    GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const;
     299             :     const SwTOXBase*    GetCurTOX();
     300             : 
     301             : };
     302             : 
     303             : /*--------------------------------------------------------------------
     304             :     Description: inlines
     305             :  --------------------------------------------------------------------*/
     306           0 : inline sal_uInt16 SwTOXMgr::GetTOXMarkCount()
     307           0 :     {   return aCurMarks.size();   }
     308             : 
     309           0 : inline SwTOXMark* SwTOXMgr::GetCurTOXMark()
     310           0 :     {   return pCurTOXMark; }
     311             : 
     312             : #endif
     313             : 
     314             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10