1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _TOXMGR_HXX 29*cdf0e10cSrcweir #define _TOXMGR_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "swdllapi.h" 32*cdf0e10cSrcweir #include "tox.hxx" 33*cdf0e10cSrcweir #include <authfld.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir class SwWrtShell; 36*cdf0e10cSrcweir class SwForm; 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir /*-------------------------------------------------------------------- 39*cdf0e10cSrcweir Beschreibung: Manager fuer Verzeichnisfunktionalitaet 40*cdf0e10cSrcweir --------------------------------------------------------------------*/ 41*cdf0e10cSrcweir //one single method will be sufficient to insert AND upate indexes 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir class SW_DLLPUBLIC SwTOXDescription 44*cdf0e10cSrcweir { 45*cdf0e10cSrcweir TOXTypes eTOXType; 46*cdf0e10cSrcweir String aStyleNames[MAXLEVEL]; 47*cdf0e10cSrcweir String sSequenceName; 48*cdf0e10cSrcweir String sMainEntryCharStyle; 49*cdf0e10cSrcweir String sAutoMarkURL; 50*cdf0e10cSrcweir String* pTitle; 51*cdf0e10cSrcweir String* pTOUName; 52*cdf0e10cSrcweir SwForm* pForm; 53*cdf0e10cSrcweir sal_uInt16 nContent; 54*cdf0e10cSrcweir sal_uInt16 nIndexOptions; 55*cdf0e10cSrcweir sal_uInt16 nOLEOptions; 56*cdf0e10cSrcweir LanguageType eLanguage; 57*cdf0e10cSrcweir String sSortAlgorithm; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir String sAuthBrackets; 60*cdf0e10cSrcweir SwCaptionDisplay eCaptionDisplay; 61*cdf0e10cSrcweir SwTOXSortKey eSortKey1; 62*cdf0e10cSrcweir SwTOXSortKey eSortKey2; 63*cdf0e10cSrcweir SwTOXSortKey eSortKey3; 64*cdf0e10cSrcweir sal_uInt8 nLevel; 65*cdf0e10cSrcweir sal_Bool bFromObjectNames : 1; 66*cdf0e10cSrcweir sal_Bool bFromChapter : 1; 67*cdf0e10cSrcweir sal_Bool bReadonly: 1; 68*cdf0e10cSrcweir sal_Bool bLevelFromChapter : 1; 69*cdf0e10cSrcweir sal_Bool bIsAuthSequence :1; 70*cdf0e10cSrcweir sal_Bool bSortByDocument :1; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir //TODO: TemplateNames 73*cdf0e10cSrcweir //const String* pTemplateName = 0, ??? 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir // forbidden and not implemented. 76*cdf0e10cSrcweir SwTOXDescription(); 77*cdf0e10cSrcweir SwTOXDescription(SwTOXDescription&); 78*cdf0e10cSrcweir SwTOXDescription & operator= (SwTOXDescription&); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir public: 81*cdf0e10cSrcweir // single argument ctors shall be explicit. 82*cdf0e10cSrcweir explicit SwTOXDescription(TOXTypes eType) : 83*cdf0e10cSrcweir eTOXType(eType), 84*cdf0e10cSrcweir pTitle(0), 85*cdf0e10cSrcweir pTOUName(0), 86*cdf0e10cSrcweir pForm(0), 87*cdf0e10cSrcweir nContent(nsSwTOXElement::TOX_MARK | nsSwTOXElement::TOX_OUTLINELEVEL), 88*cdf0e10cSrcweir nIndexOptions(nsSwTOIOptions::TOI_SAME_ENTRY|nsSwTOIOptions::TOI_FF|nsSwTOIOptions::TOI_CASE_SENSITIVE), 89*cdf0e10cSrcweir nOLEOptions(0), 90*cdf0e10cSrcweir eLanguage((LanguageType)::GetAppLanguage()), 91*cdf0e10cSrcweir eCaptionDisplay(CAPTION_COMPLETE), 92*cdf0e10cSrcweir nLevel(MAXLEVEL), 93*cdf0e10cSrcweir bFromObjectNames(sal_False), 94*cdf0e10cSrcweir bFromChapter(sal_False), 95*cdf0e10cSrcweir bReadonly(sal_True), 96*cdf0e10cSrcweir bLevelFromChapter(sal_False), 97*cdf0e10cSrcweir bIsAuthSequence(sal_False), 98*cdf0e10cSrcweir bSortByDocument(sal_True) 99*cdf0e10cSrcweir {} 100*cdf0e10cSrcweir ~SwTOXDescription() 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir delete pTitle; 103*cdf0e10cSrcweir delete pForm; 104*cdf0e10cSrcweir delete pTOUName; 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir void SetTOXType(TOXTypes eSet) { eTOXType = eSet;} 108*cdf0e10cSrcweir TOXTypes GetTOXType() const { return eTOXType;} 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir const String& GetStyleNames(sal_uInt16 nLvl) const 111*cdf0e10cSrcweir {return aStyleNames[nLvl];} 112*cdf0e10cSrcweir void SetStyleNames(const String& rSet, sal_uInt16 nLvl) 113*cdf0e10cSrcweir {aStyleNames[nLvl] = rSet; } 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir const String& GetAutoMarkURL() const { return sAutoMarkURL;} 116*cdf0e10cSrcweir void SetAutoMarkURL(const String& rSet) {sAutoMarkURL = rSet;} 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir void SetTitle(const String& pSet) {delete pTitle; pTitle = new String(pSet);} 119*cdf0e10cSrcweir const String* GetTitle() const {return pTitle; } 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir void SetTOUName(const String& pSet) {delete pTOUName; pTOUName = new String(pSet);} 122*cdf0e10cSrcweir const String* GetTOUName() const {return pTOUName; } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir void SetForm(const SwForm& rSet) {delete pForm; pForm = new SwForm(rSet);} 125*cdf0e10cSrcweir const SwForm* GetForm() const {return pForm;} 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir void SetContentOptions(sal_uInt16 nSet) { nContent = nSet;} 128*cdf0e10cSrcweir sal_uInt16 GetContentOptions() const { return nContent;} 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir void SetIndexOptions(sal_uInt16 nSet) { nIndexOptions = nSet;} 131*cdf0e10cSrcweir sal_uInt16 GetIndexOptions() const { return nIndexOptions;} 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;} 134*cdf0e10cSrcweir void SetMainEntryCharStyle(const String& rSet) {sMainEntryCharStyle = rSet;} 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir void SetLevel(sal_uInt8 nSet) {nLevel = nSet;} 137*cdf0e10cSrcweir sal_uInt8 GetLevel()const {return nLevel; } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir void SetCreateFromObjectNames(sal_Bool bSet) { bFromObjectNames = bSet;} 140*cdf0e10cSrcweir sal_Bool IsCreateFromObjectNames() const {return bFromObjectNames;} 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir const String& GetSequenceName() const {return sSequenceName;} 143*cdf0e10cSrcweir void SetSequenceName(const String& rSet) {sSequenceName = rSet;} 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir SwCaptionDisplay GetCaptionDisplay() const { return eCaptionDisplay;} 146*cdf0e10cSrcweir void SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;} 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir void SetFromChapter(sal_Bool bSet) { bFromChapter = bSet;} 149*cdf0e10cSrcweir sal_Bool IsFromChapter() const {return bFromChapter;} 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir void SetReadonly(sal_Bool bSet){bReadonly = bSet;} 152*cdf0e10cSrcweir sal_Bool IsReadonly() const {return bReadonly;} 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_uInt16 GetOLEOptions() const {return nOLEOptions;} 155*cdf0e10cSrcweir void SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;} 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir sal_Bool IsLevelFromChapter() const {return bLevelFromChapter;} 158*cdf0e10cSrcweir void SetLevelFromChapter(sal_Bool bSet) {bLevelFromChapter = bSet;} 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir String GetAuthBrackets() const {return sAuthBrackets;} 161*cdf0e10cSrcweir void SetAuthBrackets(const String& rSet) {sAuthBrackets = rSet;} 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir sal_Bool IsAuthSequence() const {return bIsAuthSequence;} 164*cdf0e10cSrcweir void SetAuthSequence(sal_Bool bSet){bIsAuthSequence = bSet;} 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir sal_Bool IsSortByDocument()const {return bSortByDocument ;} 167*cdf0e10cSrcweir void SetSortByDocument(sal_Bool bSet) {bSortByDocument = bSet;} 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir void SetSortKeys(SwTOXSortKey eKey1, 170*cdf0e10cSrcweir SwTOXSortKey eKey2, 171*cdf0e10cSrcweir SwTOXSortKey eKey3); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir SwTOXSortKey GetSortKey1() const {return eSortKey1;} 174*cdf0e10cSrcweir SwTOXSortKey GetSortKey2() const {return eSortKey2;} 175*cdf0e10cSrcweir SwTOXSortKey GetSortKey3() const {return eSortKey3;} 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir LanguageType GetLanguage() const {return eLanguage;} 178*cdf0e10cSrcweir void SetLanguage(LanguageType nLang) {eLanguage = nLang;} 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir const String& GetSortAlgorithm()const {return sSortAlgorithm;} 181*cdf0e10cSrcweir void SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;} 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir void ApplyTo(SwTOXBase& rTOXBase); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir }; 186*cdf0e10cSrcweir // -------------------------------------------------------------------------------- 187*cdf0e10cSrcweir class SwTOXMarkDescription 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir TOXTypes eTOXType; 190*cdf0e10cSrcweir int nLevel; 191*cdf0e10cSrcweir sal_Bool bMainEntry; 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir String* pPrimKey; 194*cdf0e10cSrcweir String* pSecKey; 195*cdf0e10cSrcweir String* pAltStr; 196*cdf0e10cSrcweir String* pTOUName; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir String* pPhoneticReadingOfAltStr; 199*cdf0e10cSrcweir String* pPhoneticReadingOfPrimKey; 200*cdf0e10cSrcweir String* pPhoneticReadingOfSecKey; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir // forbidden and not implemented. 203*cdf0e10cSrcweir SwTOXMarkDescription(); 204*cdf0e10cSrcweir SwTOXMarkDescription(SwTOXMarkDescription&); 205*cdf0e10cSrcweir SwTOXMarkDescription & operator= (SwTOXMarkDescription&); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir public: 208*cdf0e10cSrcweir // single argument ctors shall be explicit. 209*cdf0e10cSrcweir explicit SwTOXMarkDescription(TOXTypes eType) : 210*cdf0e10cSrcweir eTOXType(eType), 211*cdf0e10cSrcweir nLevel(0), 212*cdf0e10cSrcweir bMainEntry(sal_False), 213*cdf0e10cSrcweir pPrimKey(0), 214*cdf0e10cSrcweir pSecKey(0), 215*cdf0e10cSrcweir pAltStr(0), 216*cdf0e10cSrcweir pTOUName(0), 217*cdf0e10cSrcweir pPhoneticReadingOfAltStr(0), 218*cdf0e10cSrcweir pPhoneticReadingOfPrimKey(0), 219*cdf0e10cSrcweir pPhoneticReadingOfSecKey(0) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir ~SwTOXMarkDescription() 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir delete pPrimKey; 225*cdf0e10cSrcweir delete pSecKey; 226*cdf0e10cSrcweir delete pAltStr; 227*cdf0e10cSrcweir delete pTOUName; 228*cdf0e10cSrcweir delete pPhoneticReadingOfAltStr; 229*cdf0e10cSrcweir delete pPhoneticReadingOfPrimKey; 230*cdf0e10cSrcweir delete pPhoneticReadingOfSecKey; 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir TOXTypes GetTOXType()const {return eTOXType;} 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir void SetLevel(int nSet) {nLevel = nSet;} 236*cdf0e10cSrcweir int GetLevel() const {return nLevel;} 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir void SetMainEntry(sal_Bool bSet) {bMainEntry = bSet;} 239*cdf0e10cSrcweir sal_Bool IsMainEntry() const {return bMainEntry;} 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir void SetPrimKey(const String& rSet) 242*cdf0e10cSrcweir {delete pPrimKey; pPrimKey = new String(rSet);} 243*cdf0e10cSrcweir const String* GetPrimKey() const {return pPrimKey;} 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir void SetSecKey(const String& rSet) 246*cdf0e10cSrcweir {delete pSecKey; pSecKey = new String(rSet);} 247*cdf0e10cSrcweir const String* GetSecKey() const { return pSecKey; } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir void SetAltStr(const String& rSet) 250*cdf0e10cSrcweir {delete pAltStr; pAltStr = new String(rSet);} 251*cdf0e10cSrcweir const String* GetAltStr() const { return pAltStr; } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir void SetTOUName(const String& rSet) 254*cdf0e10cSrcweir {delete pTOUName; pTOUName = new String(rSet);} 255*cdf0e10cSrcweir const String* GetTOUName() const {return pTOUName;} 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir void SetPhoneticReadingOfAltStr(const String& rSet) 259*cdf0e10cSrcweir {delete pPhoneticReadingOfAltStr; pPhoneticReadingOfAltStr = new String(rSet);} 260*cdf0e10cSrcweir const String* GetPhoneticReadingOfAltStr() const { return pPhoneticReadingOfAltStr; } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir void SetPhoneticReadingOfPrimKey(const String& rSet) 263*cdf0e10cSrcweir {delete pPhoneticReadingOfPrimKey; pPhoneticReadingOfPrimKey = new String(rSet);} 264*cdf0e10cSrcweir const String* GetPhoneticReadingOfPrimKey() const { return pPhoneticReadingOfPrimKey; } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir void SetPhoneticReadingOfSecKey(const String& rSet) 267*cdf0e10cSrcweir {delete pPhoneticReadingOfSecKey; pPhoneticReadingOfSecKey = new String(rSet);} 268*cdf0e10cSrcweir const String* GetPhoneticReadingOfSecKey() const { return pPhoneticReadingOfSecKey; } 269*cdf0e10cSrcweir }; 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir class SW_DLLPUBLIC SwTOXMgr 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir SwWrtShell* pSh; 274*cdf0e10cSrcweir SwTOXMark* pCurTOXMark; 275*cdf0e10cSrcweir SwTOXMarks aCurMarks; 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir SW_DLLPRIVATE sal_uInt16 GetUserTypeID(const String& rStr); 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir public: 280*cdf0e10cSrcweir // single argument ctors shall be explicit. 281*cdf0e10cSrcweir explicit SwTOXMgr(SwWrtShell* pShell); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir // 284*cdf0e10cSrcweir // Methoden fuer Verzeichnismarkierungen 285*cdf0e10cSrcweir // 286*cdf0e10cSrcweir void InsertTOXMark(const SwTOXMarkDescription& rDesc); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir void UpdateTOXMark(const SwTOXMarkDescription& rDesc); 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir void DeleteTOXMark(); 292*cdf0e10cSrcweir void NextTOXMark(sal_Bool bSame=sal_False); 293*cdf0e10cSrcweir void PrevTOXMark(sal_Bool bSame=sal_False); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir // Aktuelle TOXmarks holen 296*cdf0e10cSrcweir sal_uInt16 GetTOXMarks(); 297*cdf0e10cSrcweir sal_uInt16 GetTOXMarkCount(); 298*cdf0e10cSrcweir SwTOXMark* GetTOXMark(sal_uInt16 nId); 299*cdf0e10cSrcweir SwTOXMark* GetCurTOXMark(); 300*cdf0e10cSrcweir void SetCurTOXMark(sal_uInt16 nId); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir // 303*cdf0e10cSrcweir // Methoden fuer Verzeichnisse 304*cdf0e10cSrcweir // 305*cdf0e10cSrcweir sal_Bool UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase = 0, const SfxItemSet* pSet = 0); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const; 308*cdf0e10cSrcweir const SwTOXBase* GetCurTOX(); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir }; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir /*-------------------------------------------------------------------- 314*cdf0e10cSrcweir Beschreibung: Inlines 315*cdf0e10cSrcweir --------------------------------------------------------------------*/ 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir inline sal_uInt16 SwTOXMgr::GetTOXMarkCount() 318*cdf0e10cSrcweir { return aCurMarks.Count(); } 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir inline SwTOXMark* SwTOXMgr::GetCurTOXMark() 322*cdf0e10cSrcweir { return pCurTOXMark; } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir #endif 325