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