Bump version to 21.06.18.1
[LibreOffice.git] / sw / inc / tox.hxx
blobc7bcaacf036a1933abe980827d9fcd4bf0ec7249
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 .
19 #ifndef INCLUDED_SW_INC_TOX_HXX
20 #define INCLUDED_SW_INC_TOX_HXX
22 #include <cppuhelper/weakref.hxx>
23 #include <sal/log.hxx>
25 #include <i18nlangtag/lang.h>
26 #include <svl/poolitem.hxx>
27 #include <svl/listener.hxx>
29 #include <editeng/svxenum.hxx>
30 #include "swtypes.hxx"
31 #include "toxe.hxx"
32 #include "calbck.hxx"
33 #include <o3tl/typed_flags_set.hxx>
35 #include <vector>
37 namespace com::sun::star {
38 namespace text { class XDocumentIndexMark; }
40 class SwTOXType;
41 class SwTOXMark;
42 class SwTextTOXMark;
43 class SwDoc;
44 class SwRootFrame;
45 class SwContentFrame;
48 typedef std::vector<SwTOXMark*> SwTOXMarks;
50 namespace sw {
51 struct CollectTextMarksHint final : SfxHint {
52 SwTOXMarks& m_rMarks;
53 CollectTextMarksHint(SwTOXMarks& rMarks) : m_rMarks(rMarks) {}
55 struct FindContentFrameHint final : SfxHint {
56 SwContentFrame*& m_rpContentFrame;
57 const SwDoc& m_rDoc;
58 const SwRootFrame& m_rLayout;
59 const bool m_isReadOnlyAvailable;
60 FindContentFrameHint(SwContentFrame*& rpContentFrame, const SwDoc& rDoc, const SwRootFrame& rLayout, const bool isReadOnlyAvailable)
61 : m_rpContentFrame(rpContentFrame)
62 , m_rDoc(rDoc)
63 , m_rLayout(rLayout)
64 , m_isReadOnlyAvailable(isReadOnlyAvailable)
67 struct CollectTextTOXMarksForLayoutHint final : SfxHint {
68 std::vector<std::reference_wrapper<SwTextTOXMark>>& m_rMarks;
69 const SwRootFrame* m_pLayout;
70 CollectTextTOXMarksForLayoutHint(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout) : m_rMarks(rMarks), m_pLayout(pLayout) {}
74 // Entry of content index, alphabetical index or user defined index
76 extern const sal_Unicode C_NUM_REPL;
77 extern const sal_Unicode C_END_PAGE_NUM;
79 class SW_DLLPUBLIC SwTOXMark final
80 : public SfxPoolItem
81 , public sw::BroadcastingModify
82 , public SvtListener
84 friend void InitCore();
85 friend class SwTextTOXMark;
87 const SwTOXType* m_pType;
88 OUString m_aAltText; // Text of caption is different.
89 OUString m_aPrimaryKey;
90 OUString m_aSecondaryKey;
92 // three more strings for phonetic sorting
93 OUString m_aTextReading;
94 OUString m_aPrimaryKeyReading;
95 OUString m_aSecondaryKeyReading;
97 SwTextTOXMark* m_pTextAttr;
99 sal_uInt16 m_nLevel;
100 OUString m_aBookmarkName;
101 OUString m_aEntryTypeName; // stored specific entry type name for INDEX field \f
102 bool m_bAutoGenerated; // generated using a concordance file
103 bool m_bMainEntry; // main entry emphasized by character style
105 css::uno::WeakReference<css::text::XDocumentIndexMark> m_wXDocumentIndexMark;
107 SwTOXMark(); // to create the default attribute in InitCore
109 virtual void Notify(const SfxHint& rHint) override;
111 public:
113 // single argument ctors shall be explicit.
114 explicit SwTOXMark( const SwTOXType* pTyp );
115 virtual ~SwTOXMark() override;
117 SwTOXMark( const SwTOXMark& rCopy );
118 SwTOXMark& operator=( const SwTOXMark& rCopy );
120 // "pure virtual methods" of SfxPoolItem
121 virtual bool operator==( const SfxPoolItem& ) const override;
122 virtual SwTOXMark* Clone( SfxItemPool* pPool = nullptr ) const override;
124 void InvalidateTOXMark();
126 OUString GetText(SwRootFrame const* pLayout) const;
128 inline bool IsAlternativeText() const;
129 inline const OUString& GetAlternativeText() const;
131 inline void SetAlternativeText( const OUString& rAlt );
133 // content or user defined index
134 inline void SetLevel(sal_uInt16 nLevel);
135 inline sal_uInt16 GetLevel() const;
136 inline void SetBookmarkName( const OUString& bName);
137 inline const OUString& GetBookmarkName() const;
138 inline void SetEntryTypeName( const OUString& sName);
139 inline const OUString& GetEntryTypeName() const;
141 // for alphabetical index only
142 inline void SetPrimaryKey(const OUString& rStr );
143 inline void SetSecondaryKey(const OUString& rStr);
144 inline void SetTextReading(const OUString& rStr);
145 inline void SetPrimaryKeyReading(const OUString& rStr );
146 inline void SetSecondaryKeyReading(const OUString& rStr);
148 inline OUString const & GetPrimaryKey() const;
149 inline OUString const & GetSecondaryKey() const;
150 inline OUString const & GetTextReading() const;
151 inline OUString const & GetPrimaryKeyReading() const;
152 inline OUString const & GetSecondaryKeyReading() const;
154 bool IsAutoGenerated() const {return m_bAutoGenerated;}
155 void SetAutoGenerated(bool bSet) {m_bAutoGenerated = bSet;}
157 bool IsMainEntry() const {return m_bMainEntry;}
158 void SetMainEntry(bool bSet) { m_bMainEntry = bSet;}
160 inline const SwTOXType* GetTOXType() const;
162 const SwTextTOXMark* GetTextTOXMark() const { return m_pTextAttr; }
163 SwTextTOXMark* GetTextTOXMark() { return m_pTextAttr; }
165 SAL_DLLPRIVATE css::uno::WeakReference<css::text::XDocumentIndexMark> const& GetXTOXMark() const
166 { return m_wXDocumentIndexMark; }
167 SAL_DLLPRIVATE void SetXTOXMark(css::uno::Reference<css::text::XDocumentIndexMark> const& xMark)
168 { m_wXDocumentIndexMark = xMark; }
169 void RegisterToTOXType( SwTOXType& rMark );
171 static constexpr OUStringLiteral S_PAGE_DELI = u", ";
174 // index types
175 class SwTOXType final: public sw::BroadcastingModify
177 public:
178 SwTOXType(SwDoc& rDoc, TOXTypes eTyp, const OUString& rName);
180 // @@@ public copy ctor, but no copy assignment?
181 SwTOXType(const SwTOXType& rCopy);
183 inline const OUString& GetTypeName() const;
184 inline TOXTypes GetType() const;
185 SwDoc& GetDoc() const { return m_rDoc; }
186 void CollectTextMarks(SwTOXMarks& rMarks) const
187 { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextMarksHint(rMarks)); }
188 SwContentFrame* FindContentFrame(const SwDoc& rDoc, const SwRootFrame& rLayout, const bool isReadOnlyAvailable) const
190 SwContentFrame* pContentFrame = nullptr;
191 const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::FindContentFrameHint(pContentFrame, rDoc, rLayout, isReadOnlyAvailable));
192 return pContentFrame;
194 void CollectTextTOXMarksForLayout(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout) const
195 { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextTOXMarksForLayoutHint(rMarks, pLayout)); }
198 private:
199 SwDoc& m_rDoc;
200 OUString m_aName;
201 TOXTypes m_eType;
203 // @@@ public copy ctor, but no copy assignment?
204 SwTOXType & operator= (const SwTOXType &) = delete;
207 // Structure of the index lines
208 #define FORM_TITLE 0
209 #define FORM_ALPHA_DELIMITER 1
210 #define FORM_PRIMARY_KEY 2
211 #define FORM_SECONDARY_KEY 3
212 #define FORM_ENTRY 4
215 Pattern structure
217 <E#> - entry number <E# CharStyleName,PoolId>
218 <ET> - entry text <ET CharStyleName,PoolId>
219 <E> - entry text and number <E CharStyleName,PoolId>
220 <T> - tab stop <T,,Position,Adjust>
221 <C> - chapter info n = {0, 1, 2, 3, 4 } values of SwChapterFormat <C CharStyleName,PoolId>
222 <TX> - text token <X CharStyleName,PoolId, TOX_STYLE_DELIMITERTextContentTOX_STYLE_DELIMITER>
223 <#> - Page number <# CharStyleName,PoolId>
224 <LS> - Link start <LS>
225 <LE> - Link end <LE>
226 <A00> - Authority entry field <A02 CharStyleName, PoolId>
229 // These enum values are stored and must not be changed!
230 enum FormTokenType
232 TOKEN_ENTRY_NO,
233 TOKEN_ENTRY_TEXT,
234 TOKEN_ENTRY,
235 TOKEN_TAB_STOP,
236 TOKEN_TEXT,
237 TOKEN_PAGE_NUMS,
238 TOKEN_CHAPTER_INFO,
239 TOKEN_LINK_START,
240 TOKEN_LINK_END,
241 TOKEN_AUTHORITY,
242 TOKEN_END
245 struct SW_DLLPUBLIC SwFormToken
247 OUString sText;
248 OUString sCharStyleName;
249 SwTwips nTabStopPosition;
250 FormTokenType eTokenType;
251 sal_uInt16 nPoolId;
252 SvxTabAdjust eTabAlign;
253 sal_uInt16 nChapterFormat; //SwChapterFormat;
254 sal_uInt16 nOutlineLevel;//the maximum permitted outline level in numbering
255 sal_uInt16 nAuthorityField; //enum ToxAuthorityField
256 sal_Unicode cTabFillChar;
257 bool bWithTab; // true: do generate tab
258 // character only the tab stop
259 // #i21237#
261 SwFormToken(FormTokenType eType ) :
262 nTabStopPosition(0),
263 eTokenType(eType),
264 nPoolId(USHRT_MAX),
265 eTabAlign( SvxTabAdjust::Left ),
266 nChapterFormat(0 /*CF_NUMBER*/),
267 nOutlineLevel(MAXLEVEL), //default to maximum outline level
268 nAuthorityField(0 /*AUTH_FIELD_IDENTIFIER*/),
269 cTabFillChar(' '),
270 bWithTab(true) // #i21237#
273 OUString GetString() const;
276 struct SwFormTokenEqualToFormTokenType
278 FormTokenType eType;
280 SwFormTokenEqualToFormTokenType(FormTokenType _eType) : eType(_eType) {}
281 bool operator()(const SwFormToken & rToken)
283 return rToken.eTokenType == eType;
287 /// Vector of tokens.
288 typedef std::vector<SwFormToken> SwFormTokens;
291 Helper class that converts vectors of tokens to strings and vice
292 versa.
294 class SwFormTokensHelper
296 /// the tokens
297 SwFormTokens m_Tokens;
299 public:
301 constructor
303 @param rStr string representation of the tokens
305 SwFormTokensHelper(const OUString & rStr);
308 Returns vector of tokens.
310 @return vector of tokens
312 const SwFormTokens & GetTokens() const { return m_Tokens; }
315 class SW_DLLPUBLIC SwForm
317 SwFormTokens m_aPattern[ AUTH_TYPE_END + 1 ]; // #i21237#
318 OUString m_aTemplate[ AUTH_TYPE_END + 1 ];
320 TOXTypes m_eType;
321 sal_uInt16 m_nFormMaxLevel;
323 bool m_bIsRelTabPos : 1;
324 bool m_bCommaSeparated : 1;
326 public:
327 SwForm( TOXTypes eTOXType = TOX_CONTENT );
328 SwForm( const SwForm& rForm );
330 SwForm& operator=( const SwForm& rForm );
332 inline void SetTemplate(sal_uInt16 nLevel, const OUString& rName);
333 inline OUString const & GetTemplate(sal_uInt16 nLevel) const;
335 // #i21237#
336 void SetPattern(sal_uInt16 nLevel, const SwFormTokens& rName);
337 void SetPattern(sal_uInt16 nLevel, const OUString& rStr);
338 const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
340 // fill tab stop positions from template to pattern- #i21237#
341 void AdjustTabStops( SwDoc const & rDoc );
343 inline TOXTypes GetTOXType() const;
344 inline sal_uInt16 GetFormMax() const;
346 bool IsRelTabPos() const { return m_bIsRelTabPos; }
347 void SetRelTabPos( bool b ) { m_bIsRelTabPos = b; }
349 bool IsCommaSeparated() const { return m_bCommaSeparated;}
350 void SetCommaSeparated( bool b) { m_bCommaSeparated = b;}
352 static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
354 static OUString GetFormEntry();
355 static OUString GetFormTab();
356 static OUString GetFormPageNums();
357 static OUString GetFormLinkStt();
358 static OUString GetFormLinkEnd();
359 static OUString GetFormEntryNum();
360 static OUString GetFormEntryText();
361 static OUString GetFormChapterMark();
362 static OUString GetFormText();
363 static OUString GetFormAuth();
366 // Content to create indexes of
367 enum class SwTOXElement : sal_uInt16
369 NONE = 0x0000,
370 Mark = 0x0001,
371 OutlineLevel = 0x0002,
372 Template = 0x0004,
373 Ole = 0x0008,
374 Table = 0x0010,
375 Graphic = 0x0020,
376 Frame = 0x0040,
377 Sequence = 0x0080,
378 TableLeader = 0x0100,
379 TableInToc = 0x0200,
380 Bookmark = 0x0400,
381 Newline = 0x0800,
382 ParagraphOutlineLevel = 0x1000,
383 IndexEntryType = 0x2000,
385 namespace o3tl {
386 template<> struct typed_flags<SwTOXElement> : is_typed_flags<SwTOXElement, 0x3fff> {};
389 enum class SwTOIOptions : sal_uInt16
391 NONE = 0x00,
392 SameEntry = 0x01,
393 FF = 0x02,
394 CaseSensitive = 0x04,
395 KeyAsEntry = 0x08,
396 AlphaDelimiter = 0x10,
397 Dash = 0x20,
398 InitialCaps = 0x40,
400 namespace o3tl {
401 template<> struct typed_flags<SwTOIOptions> : is_typed_flags<SwTOIOptions, 0x7f> {};
404 //which part of the caption is to be displayed
405 enum SwCaptionDisplay
407 CAPTION_COMPLETE,
408 CAPTION_NUMBER,
409 CAPTION_TEXT
412 enum class SwTOOElements : sal_uInt16
414 NONE = 0x00,
415 Math = 0x01,
416 Chart = 0x02,
417 Calc = 0x08,
418 DrawImpress = 0x10,
419 Other = 0x80,
421 namespace o3tl {
422 template<> struct typed_flags<SwTOOElements> : is_typed_flags<SwTOOElements, 0x9b> {};
425 #define TOX_STYLE_DELIMITER u'\x0001'
427 // Class for all indexes
428 class SW_DLLPUBLIC SwTOXBase : public SwClient
430 SwForm m_aForm; // description of the lines
431 OUString m_aName; // unique name
432 OUString m_aTitle; // title
433 OUString m_aBookmarkName; //Bookmark Name
434 OUString m_aEntryTypeName; // Type name
436 OUString m_sMainEntryCharStyle; // name of the character style applied to main index entries
438 OUString m_aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
439 OUString m_sSequenceName; // FieldTypeName of a caption sequence
441 LanguageType m_eLanguage;
442 OUString m_sSortAlgorithm;
444 union {
445 sal_uInt16 nLevel; // consider outline levels
446 SwTOIOptions nOptions; // options of alphabetical index
447 } m_aData;
449 SwTOXElement m_nCreateType; // sources to create the index from
450 SwTOOElements m_nOLEOptions; // OLE sources
451 SwCaptionDisplay m_eCaptionDisplay;
452 bool m_bProtected : 1; // index protected ?
453 bool m_bFromChapter : 1; // create from chapter or document
454 bool m_bFromObjectNames : 1; // create a table or object index
455 // from the names rather than the caption
456 bool m_bLevelFromChapter : 1; // User index: get the level from the source chapter
458 protected:
459 // Add a data member, for record the TOC field expression of MS Word binary format
460 // For keeping fidelity and may giving a better exporting performance
461 OUString maMSTOCExpression;
462 bool mbKeepExpression;
464 public:
465 SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
466 SwTOXElement nCreaType, const OUString& rTitle );
467 SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = nullptr );
468 virtual ~SwTOXBase() override;
470 // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
471 // If not, so create it and copy all other used things.
472 void CopyTOXBase( SwDoc*, const SwTOXBase& );
474 const SwTOXType* GetTOXType() const;
476 SwTOXElement GetCreateType() const; // creation types
478 const OUString& GetTOXName() const {return m_aName;}
479 void SetTOXName(const OUString& rSet) {m_aName = rSet;}
481 // for record the TOC field expression of MS Word binary format
482 const OUString& GetMSTOCExpression() const{return maMSTOCExpression;}
483 void SetMSTOCExpression(const OUString& rExp) {maMSTOCExpression = rExp;}
484 void EnableKeepExpression() {mbKeepExpression = true;}
485 void DisableKeepExpression() {mbKeepExpression = false;}
487 const OUString& GetTitle() const; // Title
488 const OUString& GetBookmarkName() const;
489 OUString const & GetTypeName() const; // Name
490 const SwForm& GetTOXForm() const; // description of the lines
492 void SetCreate(SwTOXElement);
493 void SetTitle(const OUString& rTitle);
494 void SetTOXForm(const SwForm& rForm);
495 void SetBookmarkName(const OUString& bName);
497 TOXTypes GetType() const;
499 const OUString& GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;}
500 void SetMainEntryCharStyle(const OUString& rSet) {m_sMainEntryCharStyle = rSet;}
502 // for record the Index field expression of MS Word
503 const OUString& GetEntryTypeName() const;
504 void SetEntryTypeName(const OUString& sName);
506 // content index only
507 inline void SetLevel(sal_uInt16); // consider outline level
508 inline sal_uInt16 GetLevel() const;
510 // alphabetical index only
511 inline SwTOIOptions GetOptions() const; // alphabetical index options
512 inline void SetOptions(SwTOIOptions nOpt);
514 // index of objects
515 SwTOOElements GetOLEOptions() const {return m_nOLEOptions;}
516 void SetOLEOptions(SwTOOElements nOpt) {m_nOLEOptions = nOpt;}
518 // index of objects
520 OUString const & GetStyleNames(sal_uInt16 nLevel) const
522 SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
523 return m_aStyleNames[nLevel];
525 void SetStyleNames(const OUString& rSet, sal_uInt16 nLevel)
527 SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
528 m_aStyleNames[nLevel] = rSet;
530 bool IsFromChapter() const { return m_bFromChapter;}
531 void SetFromChapter(bool bSet) { m_bFromChapter = bSet;}
533 bool IsFromObjectNames() const {return m_bFromObjectNames;}
534 void SetFromObjectNames(bool bSet) {m_bFromObjectNames = bSet;}
536 bool IsLevelFromChapter() const {return m_bLevelFromChapter;}
537 void SetLevelFromChapter(bool bSet) {m_bLevelFromChapter = bSet;}
539 bool IsProtected() const { return m_bProtected; }
540 void SetProtected(bool bSet) { m_bProtected = bSet; }
542 const OUString& GetSequenceName() const {return m_sSequenceName;}
543 void SetSequenceName(const OUString& rSet) {m_sSequenceName = rSet;}
545 SwCaptionDisplay GetCaptionDisplay() const { return m_eCaptionDisplay;}
546 void SetCaptionDisplay(SwCaptionDisplay eSet) {m_eCaptionDisplay = eSet;}
548 bool IsTOXBaseInReadonly() const;
550 const SfxItemSet* GetAttrSet() const;
551 void SetAttrSet( const SfxItemSet& );
553 LanguageType GetLanguage() const {return m_eLanguage;}
554 void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;}
556 const OUString& GetSortAlgorithm()const {return m_sSortAlgorithm;}
557 void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;}
558 // #i21237#
559 void AdjustTabStops( SwDoc const & rDoc )
561 m_aForm.AdjustTabStops( rDoc );
564 SwTOXBase& operator=(const SwTOXBase& rSource);
565 void RegisterToTOXType( SwTOXType& rMark );
566 virtual bool IsVisible() const { return true; }
569 //SwTOXMark
571 inline const OUString& SwTOXMark::GetAlternativeText() const
572 { return m_aAltText; }
574 inline const OUString& SwTOXMark::GetBookmarkName() const
575 { return m_aBookmarkName; }
577 inline const OUString& SwTOXMark::GetEntryTypeName() const
578 { return m_aEntryTypeName; }
580 inline const SwTOXType* SwTOXMark::GetTOXType() const
581 { return m_pType; }
583 inline bool SwTOXMark::IsAlternativeText() const
584 { return !m_aAltText.isEmpty(); }
586 inline void SwTOXMark::SetAlternativeText(const OUString& rAlt)
588 m_aAltText = rAlt;
591 inline void SwTOXMark::SetBookmarkName(const OUString& bName)
593 m_aBookmarkName = bName;
596 inline void SwTOXMark::SetEntryTypeName(const OUString& sName)
598 m_aEntryTypeName = sName;
600 inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
602 SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
603 m_nLevel = nLvl;
606 inline void SwTOXMark::SetPrimaryKey( const OUString& rKey )
608 SAL_WARN_IF( GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
609 m_aPrimaryKey = rKey;
612 inline void SwTOXMark::SetSecondaryKey( const OUString& rKey )
614 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
615 m_aSecondaryKey = rKey;
618 inline void SwTOXMark::SetTextReading( const OUString& rText )
620 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
621 m_aTextReading = rText;
624 inline void SwTOXMark::SetPrimaryKeyReading( const OUString& rKey )
626 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
627 m_aPrimaryKeyReading = rKey;
630 inline void SwTOXMark::SetSecondaryKeyReading( const OUString& rKey )
632 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
633 m_aSecondaryKeyReading = rKey;
636 inline sal_uInt16 SwTOXMark::GetLevel() const
638 SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
639 return m_nLevel;
642 inline OUString const & SwTOXMark::GetPrimaryKey() const
644 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
645 return m_aPrimaryKey;
648 inline OUString const & SwTOXMark::GetSecondaryKey() const
650 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
651 return m_aSecondaryKey;
654 inline OUString const & SwTOXMark::GetTextReading() const
656 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
657 return m_aTextReading;
660 inline OUString const & SwTOXMark::GetPrimaryKeyReading() const
662 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
663 return m_aPrimaryKeyReading;
666 inline OUString const & SwTOXMark::GetSecondaryKeyReading() const
668 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
669 return m_aSecondaryKeyReading;
672 //SwForm
674 inline void SwForm::SetTemplate(sal_uInt16 nLevel, const OUString& rTemplate)
676 SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
677 m_aTemplate[nLevel] = rTemplate;
680 inline OUString const & SwForm::GetTemplate(sal_uInt16 nLevel) const
682 SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
683 return m_aTemplate[nLevel];
686 inline TOXTypes SwForm::GetTOXType() const
688 return m_eType;
691 inline sal_uInt16 SwForm::GetFormMax() const
693 return m_nFormMaxLevel;
696 //SwTOXType
698 inline const OUString& SwTOXType::GetTypeName() const
699 { return m_aName; }
701 inline TOXTypes SwTOXType::GetType() const
702 { return m_eType; }
704 // SwTOXBase
706 inline const SwTOXType* SwTOXBase::GetTOXType() const
707 { return static_cast<const SwTOXType*>(GetRegisteredIn()); }
709 inline SwTOXElement SwTOXBase::GetCreateType() const
710 { return m_nCreateType; }
712 inline const OUString& SwTOXBase::GetTitle() const
713 { return m_aTitle; }
715 inline const OUString& SwTOXBase::GetBookmarkName() const
716 { return m_aBookmarkName; }
718 inline const OUString& SwTOXBase::GetEntryTypeName() const
719 { return m_aEntryTypeName; }
721 inline OUString const & SwTOXBase::GetTypeName() const
722 { return GetTOXType()->GetTypeName(); }
724 inline const SwForm& SwTOXBase::GetTOXForm() const
725 { return m_aForm; }
727 inline void SwTOXBase::SetCreate(SwTOXElement nCreate)
728 { m_nCreateType = nCreate; }
730 inline void SwTOXBase::SetTOXForm(const SwForm& rForm)
731 { m_aForm = rForm; }
733 inline TOXTypes SwTOXBase::GetType() const
734 { return GetTOXType()->GetType(); }
736 inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
738 SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
739 m_aData.nLevel = nLev;
742 inline sal_uInt16 SwTOXBase::GetLevel() const
744 SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
745 return m_aData.nLevel;
748 inline SwTOIOptions SwTOXBase::GetOptions() const
750 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
751 return m_aData.nOptions;
754 inline void SwTOXBase::SetOptions(SwTOIOptions nOpt)
756 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
757 m_aData.nOptions = nOpt;
760 #endif // INCLUDED_SW_INC_TOX_HXX
762 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */