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