1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: toxmgr.hxx,v $
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 ************************************************************************/
36 #include <authfld.hxx>
41 /*--------------------------------------------------------------------
42 Beschreibung: Manager fuer Verzeichnisfunktionalitaet
43 --------------------------------------------------------------------*/
44 //one single method will be sufficient to insert AND upate indexes
46 class SW_DLLPUBLIC SwTOXDescription
49 String aStyleNames
[MAXLEVEL
];
51 String sMainEntryCharStyle
;
59 LanguageType eLanguage
;
60 String sSortAlgorithm
;
63 SwCaptionDisplay eCaptionDisplay
;
64 SwTOXSortKey eSortKey1
;
65 SwTOXSortKey eSortKey2
;
66 SwTOXSortKey eSortKey3
;
68 BOOL bFromObjectNames
: 1;
69 BOOL bFromChapter
: 1;
71 BOOL bLevelFromChapter
: 1;
72 BOOL bIsAuthSequence
:1;
73 BOOL bSortByDocument
:1;
76 //const String* pTemplateName = 0, ???
78 // forbidden and not implemented.
80 SwTOXDescription(SwTOXDescription
&);
81 SwTOXDescription
& operator= (SwTOXDescription
&);
84 // single argument ctors shall be explicit.
85 explicit SwTOXDescription(TOXTypes eType
) :
90 nContent(nsSwTOXElement::TOX_MARK
| nsSwTOXElement::TOX_OUTLINELEVEL
),
91 nIndexOptions(nsSwTOIOptions::TOI_SAME_ENTRY
|nsSwTOIOptions::TOI_FF
|nsSwTOIOptions::TOI_CASE_SENSITIVE
),
93 eLanguage((LanguageType
)::GetAppLanguage()),
94 eCaptionDisplay(CAPTION_COMPLETE
),
96 bFromObjectNames(FALSE
),
99 bLevelFromChapter(FALSE
),
100 bIsAuthSequence(FALSE
),
101 bSortByDocument(TRUE
)
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
,
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
201 String
* pPhoneticReadingOfAltStr
;
202 String
* pPhoneticReadingOfPrimKey
;
203 String
* pPhoneticReadingOfSecKey
;
205 // forbidden and not implemented.
206 SwTOXMarkDescription();
207 SwTOXMarkDescription(SwTOXMarkDescription
&);
208 SwTOXMarkDescription
& operator= (SwTOXMarkDescription
&);
211 // single argument ctors shall be explicit.
212 explicit SwTOXMarkDescription(TOXTypes eType
) :
220 pPhoneticReadingOfAltStr(0),
221 pPhoneticReadingOfPrimKey(0),
222 pPhoneticReadingOfSecKey(0)
225 ~SwTOXMarkDescription()
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
277 SwTOXMark
* pCurTOXMark
;
278 SwTOXMarks aCurMarks
;
280 SW_DLLPRIVATE USHORT
GetUserTypeID(const String
& rStr
);
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
; }