1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*1d2dbeb0SAndrew Rist * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist *
11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist *
13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the
17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist * under the License.
19*1d2dbeb0SAndrew Rist *
20*1d2dbeb0SAndrew Rist *************************************************************/
21*1d2dbeb0SAndrew Rist
22*1d2dbeb0SAndrew 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 --------------------------------------------------------------------*/
37cdf0e10cSrcweir //one single method will be sufficient to insert AND upate 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.
SwTOXDescription(TOXTypes eType)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 {}
~SwTOXDescription()96cdf0e10cSrcweir ~SwTOXDescription()
97cdf0e10cSrcweir {
98cdf0e10cSrcweir delete pTitle;
99cdf0e10cSrcweir delete pForm;
100cdf0e10cSrcweir delete pTOUName;
101cdf0e10cSrcweir }
102cdf0e10cSrcweir
SetTOXType(TOXTypes eSet)103cdf0e10cSrcweir void SetTOXType(TOXTypes eSet) { eTOXType = eSet;}
GetTOXType() const104cdf0e10cSrcweir TOXTypes GetTOXType() const { return eTOXType;}
105cdf0e10cSrcweir
GetStyleNames(sal_uInt16 nLvl) const106cdf0e10cSrcweir const String& GetStyleNames(sal_uInt16 nLvl) const
107cdf0e10cSrcweir {return aStyleNames[nLvl];}
SetStyleNames(const String & rSet,sal_uInt16 nLvl)108cdf0e10cSrcweir void SetStyleNames(const String& rSet, sal_uInt16 nLvl)
109cdf0e10cSrcweir {aStyleNames[nLvl] = rSet; }
110cdf0e10cSrcweir
GetAutoMarkURL() const111cdf0e10cSrcweir const String& GetAutoMarkURL() const { return sAutoMarkURL;}
SetAutoMarkURL(const String & rSet)112cdf0e10cSrcweir void SetAutoMarkURL(const String& rSet) {sAutoMarkURL = rSet;}
113cdf0e10cSrcweir
SetTitle(const String & pSet)114cdf0e10cSrcweir void SetTitle(const String& pSet) {delete pTitle; pTitle = new String(pSet);}
GetTitle() const115cdf0e10cSrcweir const String* GetTitle() const {return pTitle; }
116cdf0e10cSrcweir
SetTOUName(const String & pSet)117cdf0e10cSrcweir void SetTOUName(const String& pSet) {delete pTOUName; pTOUName = new String(pSet);}
GetTOUName() const118cdf0e10cSrcweir const String* GetTOUName() const {return pTOUName; }
119cdf0e10cSrcweir
SetForm(const SwForm & rSet)120cdf0e10cSrcweir void SetForm(const SwForm& rSet) {delete pForm; pForm = new SwForm(rSet);}
GetForm() const121cdf0e10cSrcweir const SwForm* GetForm() const {return pForm;}
122cdf0e10cSrcweir
SetContentOptions(sal_uInt16 nSet)123cdf0e10cSrcweir void SetContentOptions(sal_uInt16 nSet) { nContent = nSet;}
GetContentOptions() const124cdf0e10cSrcweir sal_uInt16 GetContentOptions() const { return nContent;}
125cdf0e10cSrcweir
SetIndexOptions(sal_uInt16 nSet)126cdf0e10cSrcweir void SetIndexOptions(sal_uInt16 nSet) { nIndexOptions = nSet;}
GetIndexOptions() const127cdf0e10cSrcweir sal_uInt16 GetIndexOptions() const { return nIndexOptions;}
128cdf0e10cSrcweir
GetMainEntryCharStyle() const129cdf0e10cSrcweir const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
SetMainEntryCharStyle(const String & rSet)130cdf0e10cSrcweir void SetMainEntryCharStyle(const String& rSet) {sMainEntryCharStyle = rSet;}
131cdf0e10cSrcweir
SetLevel(sal_uInt8 nSet)132cdf0e10cSrcweir void SetLevel(sal_uInt8 nSet) {nLevel = nSet;}
GetLevel() const133cdf0e10cSrcweir sal_uInt8 GetLevel()const {return nLevel; }
134cdf0e10cSrcweir
SetCreateFromObjectNames(sal_Bool bSet)135cdf0e10cSrcweir void SetCreateFromObjectNames(sal_Bool bSet) { bFromObjectNames = bSet;}
IsCreateFromObjectNames() const136cdf0e10cSrcweir sal_Bool IsCreateFromObjectNames() const {return bFromObjectNames;}
137cdf0e10cSrcweir
GetSequenceName() const138cdf0e10cSrcweir const String& GetSequenceName() const {return sSequenceName;}
SetSequenceName(const String & rSet)139cdf0e10cSrcweir void SetSequenceName(const String& rSet) {sSequenceName = rSet;}
140cdf0e10cSrcweir
GetCaptionDisplay() const141cdf0e10cSrcweir SwCaptionDisplay GetCaptionDisplay() const { return eCaptionDisplay;}
SetCaptionDisplay(SwCaptionDisplay eSet)142cdf0e10cSrcweir void SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
143cdf0e10cSrcweir
SetFromChapter(sal_Bool bSet)144cdf0e10cSrcweir void SetFromChapter(sal_Bool bSet) { bFromChapter = bSet;}
IsFromChapter() const145cdf0e10cSrcweir sal_Bool IsFromChapter() const {return bFromChapter;}
146cdf0e10cSrcweir
SetReadonly(sal_Bool bSet)147cdf0e10cSrcweir void SetReadonly(sal_Bool bSet){bReadonly = bSet;}
IsReadonly() const148cdf0e10cSrcweir sal_Bool IsReadonly() const {return bReadonly;}
149cdf0e10cSrcweir
GetOLEOptions() const150cdf0e10cSrcweir sal_uInt16 GetOLEOptions() const {return nOLEOptions;}
SetOLEOptions(sal_uInt16 nOpt)151cdf0e10cSrcweir void SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;}
152cdf0e10cSrcweir
IsLevelFromChapter() const153cdf0e10cSrcweir sal_Bool IsLevelFromChapter() const {return bLevelFromChapter;}
SetLevelFromChapter(sal_Bool bSet)154cdf0e10cSrcweir void SetLevelFromChapter(sal_Bool bSet) {bLevelFromChapter = bSet;}
155cdf0e10cSrcweir
GetAuthBrackets() const156cdf0e10cSrcweir String GetAuthBrackets() const {return sAuthBrackets;}
SetAuthBrackets(const String & rSet)157cdf0e10cSrcweir void SetAuthBrackets(const String& rSet) {sAuthBrackets = rSet;}
158cdf0e10cSrcweir
IsAuthSequence() const159cdf0e10cSrcweir sal_Bool IsAuthSequence() const {return bIsAuthSequence;}
SetAuthSequence(sal_Bool bSet)160cdf0e10cSrcweir void SetAuthSequence(sal_Bool bSet){bIsAuthSequence = bSet;}
161cdf0e10cSrcweir
IsSortByDocument() const162cdf0e10cSrcweir sal_Bool IsSortByDocument()const {return bSortByDocument ;}
SetSortByDocument(sal_Bool bSet)163cdf0e10cSrcweir void SetSortByDocument(sal_Bool bSet) {bSortByDocument = bSet;}
164cdf0e10cSrcweir
165cdf0e10cSrcweir void SetSortKeys(SwTOXSortKey eKey1,
166cdf0e10cSrcweir SwTOXSortKey eKey2,
167cdf0e10cSrcweir SwTOXSortKey eKey3);
168cdf0e10cSrcweir
GetSortKey1() const169cdf0e10cSrcweir SwTOXSortKey GetSortKey1() const {return eSortKey1;}
GetSortKey2() const170cdf0e10cSrcweir SwTOXSortKey GetSortKey2() const {return eSortKey2;}
GetSortKey3() const171cdf0e10cSrcweir SwTOXSortKey GetSortKey3() const {return eSortKey3;}
172cdf0e10cSrcweir
GetLanguage() const173cdf0e10cSrcweir LanguageType GetLanguage() const {return eLanguage;}
SetLanguage(LanguageType nLang)174cdf0e10cSrcweir void SetLanguage(LanguageType nLang) {eLanguage = nLang;}
175cdf0e10cSrcweir
GetSortAlgorithm() const176cdf0e10cSrcweir const String& GetSortAlgorithm()const {return sSortAlgorithm;}
SetSortAlgorithm(const String & rSet)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.
SwTOXMarkDescription(TOXTypes eType)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 }
~SwTOXMarkDescription()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
GetTOXType() const229cdf0e10cSrcweir TOXTypes GetTOXType()const {return eTOXType;}
230cdf0e10cSrcweir
SetLevel(int nSet)231cdf0e10cSrcweir void SetLevel(int nSet) {nLevel = nSet;}
GetLevel() const232cdf0e10cSrcweir int GetLevel() const {return nLevel;}
233cdf0e10cSrcweir
SetMainEntry(sal_Bool bSet)234cdf0e10cSrcweir void SetMainEntry(sal_Bool bSet) {bMainEntry = bSet;}
IsMainEntry() const235cdf0e10cSrcweir sal_Bool IsMainEntry() const {return bMainEntry;}
236cdf0e10cSrcweir
SetPrimKey(const String & rSet)237cdf0e10cSrcweir void SetPrimKey(const String& rSet)
238cdf0e10cSrcweir {delete pPrimKey; pPrimKey = new String(rSet);}
GetPrimKey() const239cdf0e10cSrcweir const String* GetPrimKey() const {return pPrimKey;}
240cdf0e10cSrcweir
SetSecKey(const String & rSet)241cdf0e10cSrcweir void SetSecKey(const String& rSet)
242cdf0e10cSrcweir {delete pSecKey; pSecKey = new String(rSet);}
GetSecKey() const243cdf0e10cSrcweir const String* GetSecKey() const { return pSecKey; }
244cdf0e10cSrcweir
SetAltStr(const String & rSet)245cdf0e10cSrcweir void SetAltStr(const String& rSet)
246cdf0e10cSrcweir {delete pAltStr; pAltStr = new String(rSet);}
GetAltStr() const247cdf0e10cSrcweir const String* GetAltStr() const { return pAltStr; }
248cdf0e10cSrcweir
SetTOUName(const String & rSet)249cdf0e10cSrcweir void SetTOUName(const String& rSet)
250cdf0e10cSrcweir {delete pTOUName; pTOUName = new String(rSet);}
GetTOUName() const251cdf0e10cSrcweir const String* GetTOUName() const {return pTOUName;}
252cdf0e10cSrcweir
253cdf0e10cSrcweir
SetPhoneticReadingOfAltStr(const String & rSet)254cdf0e10cSrcweir void SetPhoneticReadingOfAltStr(const String& rSet)
255cdf0e10cSrcweir {delete pPhoneticReadingOfAltStr; pPhoneticReadingOfAltStr = new String(rSet);}
GetPhoneticReadingOfAltStr() const256cdf0e10cSrcweir const String* GetPhoneticReadingOfAltStr() const { return pPhoneticReadingOfAltStr; }
257cdf0e10cSrcweir
SetPhoneticReadingOfPrimKey(const String & rSet)258cdf0e10cSrcweir void SetPhoneticReadingOfPrimKey(const String& rSet)
259cdf0e10cSrcweir {delete pPhoneticReadingOfPrimKey; pPhoneticReadingOfPrimKey = new String(rSet);}
GetPhoneticReadingOfPrimKey() const260cdf0e10cSrcweir const String* GetPhoneticReadingOfPrimKey() const { return pPhoneticReadingOfPrimKey; }
261cdf0e10cSrcweir
SetPhoneticReadingOfSecKey(const String & rSet)262cdf0e10cSrcweir void SetPhoneticReadingOfSecKey(const String& rSet)
263cdf0e10cSrcweir {delete pPhoneticReadingOfSecKey; pPhoneticReadingOfSecKey = new String(rSet);}
GetPhoneticReadingOfSecKey() const264cdf0e10cSrcweir 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
GetTOXMarkCount()313cdf0e10cSrcweir inline sal_uInt16 SwTOXMgr::GetTOXMarkCount()
314cdf0e10cSrcweir { return aCurMarks.Count(); }
315cdf0e10cSrcweir
316cdf0e10cSrcweir
GetCurTOXMark()317cdf0e10cSrcweir inline SwTOXMark* SwTOXMgr::GetCurTOXMark()
318cdf0e10cSrcweir { return pCurTOXMark; }
319cdf0e10cSrcweir
320cdf0e10cSrcweir #endif
321