bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / inc / toxmgr.hxx
blobc63284004d4a40839916d595d8dfd33aeae02762
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _TOXMGR_HXX
21 #define _TOXMGR_HXX
23 #include "swdllapi.h"
24 #include "tox.hxx"
25 #include <authfld.hxx>
27 class SwWrtShell;
28 class SwForm;
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
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;
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;
63 //TODO: TemplateNames
64 //const String* pTemplateName = 0, ???
66 // forbidden and not implemented.
67 SwTOXDescription();
68 SwTOXDescription(SwTOXDescription&);
69 SwTOXDescription & operator= (SwTOXDescription&);
71 public:
72 // single argument ctors shall be explicit.
73 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 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 bSortByDocument(sal_True)
91 ~SwTOXDescription()
93 delete pTitle;
94 delete pForm;
95 delete pTOUName;
98 void SetTOXType(TOXTypes eSet) { eTOXType = eSet;}
99 TOXTypes GetTOXType() const { return eTOXType;}
101 const String& GetStyleNames(sal_uInt16 nLvl) const
102 {return aStyleNames[nLvl];}
103 void SetStyleNames(const String& rSet, sal_uInt16 nLvl)
104 {aStyleNames[nLvl] = rSet; }
106 const String& GetAutoMarkURL() const { return sAutoMarkURL;}
107 void SetAutoMarkURL(const String& rSet) {sAutoMarkURL = rSet;}
109 void SetTitle(const String& pSet) {delete pTitle; pTitle = new String(pSet);}
110 const String* GetTitle() const {return pTitle; }
112 void SetTOUName(const String& pSet) {delete pTOUName; pTOUName = new String(pSet);}
113 const String* GetTOUName() const {return pTOUName; }
115 void SetForm(const SwForm& rSet) {delete pForm; pForm = new SwForm(rSet);}
116 const SwForm* GetForm() const {return pForm;}
118 void SetContentOptions(sal_uInt16 nSet) { nContent = nSet;}
119 sal_uInt16 GetContentOptions() const { return nContent;}
121 void SetIndexOptions(sal_uInt16 nSet) { nIndexOptions = nSet;}
122 sal_uInt16 GetIndexOptions() const { return nIndexOptions;}
124 const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
125 void SetMainEntryCharStyle(const String& rSet) {sMainEntryCharStyle = rSet;}
127 void SetLevel(sal_uInt8 nSet) {nLevel = nSet;}
128 sal_uInt8 GetLevel()const {return nLevel; }
130 void SetCreateFromObjectNames(sal_Bool bSet) { bFromObjectNames = bSet;}
131 sal_Bool IsCreateFromObjectNames() const {return bFromObjectNames;}
133 const String& GetSequenceName() const {return sSequenceName;}
134 void SetSequenceName(const String& rSet) {sSequenceName = rSet;}
136 SwCaptionDisplay GetCaptionDisplay() const { return eCaptionDisplay;}
137 void SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
139 void SetFromChapter(sal_Bool bSet) { bFromChapter = bSet;}
140 sal_Bool IsFromChapter() const {return bFromChapter;}
142 void SetReadonly(sal_Bool bSet){bReadonly = bSet;}
143 sal_Bool IsReadonly() const {return bReadonly;}
145 sal_uInt16 GetOLEOptions() const {return nOLEOptions;}
146 void SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;}
148 sal_Bool IsLevelFromChapter() const {return bLevelFromChapter;}
149 void SetLevelFromChapter(sal_Bool bSet) {bLevelFromChapter = bSet;}
151 String GetAuthBrackets() const {return sAuthBrackets;}
152 void SetAuthBrackets(const String& rSet) {sAuthBrackets = rSet;}
154 sal_Bool IsAuthSequence() const {return bIsAuthSequence;}
155 void SetAuthSequence(sal_Bool bSet){bIsAuthSequence = bSet;}
157 sal_Bool IsSortByDocument()const {return bSortByDocument ;}
158 void SetSortByDocument(sal_Bool bSet) {bSortByDocument = bSet;}
160 void SetSortKeys(SwTOXSortKey eKey1,
161 SwTOXSortKey eKey2,
162 SwTOXSortKey eKey3);
164 SwTOXSortKey GetSortKey1() const {return eSortKey1;}
165 SwTOXSortKey GetSortKey2() const {return eSortKey2;}
166 SwTOXSortKey GetSortKey3() const {return eSortKey3;}
168 LanguageType GetLanguage() const {return eLanguage;}
169 void SetLanguage(LanguageType nLang) {eLanguage = nLang;}
171 const String& GetSortAlgorithm()const {return sSortAlgorithm;}
172 void SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
174 void ApplyTo(SwTOXBase& rTOXBase);
178 class SwTOXMarkDescription
180 TOXTypes eTOXType;
181 int nLevel;
182 sal_Bool bMainEntry;
184 String* pPrimKey;
185 String* pSecKey;
186 String* pAltStr;
187 String* pTOUName;
189 String* pPhoneticReadingOfAltStr;
190 String* pPhoneticReadingOfPrimKey;
191 String* pPhoneticReadingOfSecKey;
193 // forbidden and not implemented.
194 SwTOXMarkDescription();
195 SwTOXMarkDescription(SwTOXMarkDescription&);
196 SwTOXMarkDescription & operator= (SwTOXMarkDescription&);
198 public:
199 // single argument ctors shall be explicit.
200 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 pPhoneticReadingOfSecKey(0)
213 ~SwTOXMarkDescription()
215 delete pPrimKey;
216 delete pSecKey;
217 delete pAltStr;
218 delete pTOUName;
219 delete pPhoneticReadingOfAltStr;
220 delete pPhoneticReadingOfPrimKey;
221 delete pPhoneticReadingOfSecKey;
224 TOXTypes GetTOXType()const {return eTOXType;}
226 void SetLevel(int nSet) {nLevel = nSet;}
227 int GetLevel() const {return nLevel;}
229 void SetMainEntry(sal_Bool bSet) {bMainEntry = bSet;}
230 sal_Bool IsMainEntry() const {return bMainEntry;}
232 void SetPrimKey(const String& rSet)
233 {delete pPrimKey; pPrimKey = new String(rSet);}
234 const String* GetPrimKey() const {return pPrimKey;}
236 void SetSecKey(const String& rSet)
237 {delete pSecKey; pSecKey = new String(rSet);}
238 const String* GetSecKey() const { return pSecKey; }
240 void SetAltStr(const String& rSet)
241 {delete pAltStr; pAltStr = new String(rSet);}
242 const String* GetAltStr() const { return pAltStr; }
244 void SetTOUName(const String& rSet)
245 {delete pTOUName; pTOUName = new String(rSet);}
246 const String* GetTOUName() const {return pTOUName;}
249 void SetPhoneticReadingOfAltStr(const String& rSet)
250 {delete pPhoneticReadingOfAltStr; pPhoneticReadingOfAltStr = new String(rSet);}
251 const String* GetPhoneticReadingOfAltStr() const { return pPhoneticReadingOfAltStr; }
253 void SetPhoneticReadingOfPrimKey(const String& rSet)
254 {delete pPhoneticReadingOfPrimKey; pPhoneticReadingOfPrimKey = new String(rSet);}
255 const String* GetPhoneticReadingOfPrimKey() const { return pPhoneticReadingOfPrimKey; }
257 void SetPhoneticReadingOfSecKey(const String& rSet)
258 {delete pPhoneticReadingOfSecKey; pPhoneticReadingOfSecKey = new String(rSet);}
259 const String* GetPhoneticReadingOfSecKey() const { return pPhoneticReadingOfSecKey; }
262 class SW_DLLPUBLIC SwTOXMgr
264 SwWrtShell* pSh;
265 SwTOXMark* pCurTOXMark;
266 SwTOXMarks aCurMarks;
268 SW_DLLPRIVATE sal_uInt16 GetUserTypeID(const String& rStr);
270 public:
271 // single argument ctors shall be explicit.
272 explicit SwTOXMgr(SwWrtShell* pShell);
275 // methods for directory marks
277 void InsertTOXMark(const SwTOXMarkDescription& rDesc);
279 void UpdateTOXMark(const SwTOXMarkDescription& rDesc);
282 void DeleteTOXMark();
283 void NextTOXMark(sal_Bool bSame=sal_False);
284 void PrevTOXMark(sal_Bool bSame=sal_False);
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);
294 // methods for directories
296 sal_Bool UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase = 0, const SfxItemSet* pSet = 0);
298 const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const;
299 const SwTOXBase* GetCurTOX();
303 /*--------------------------------------------------------------------
304 Description: inlines
305 --------------------------------------------------------------------*/
306 inline sal_uInt16 SwTOXMgr::GetTOXMarkCount()
307 { return aCurMarks.size(); }
309 inline SwTOXMark* SwTOXMgr::GetCurTOXMark()
310 { return pCurTOXMark; }
312 #endif
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */