tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sw / inc / tox.hxx
blob99e91250c48e266c00d2bf6f13b08891a2f2bd57
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 <vector>
23 #include <optional>
25 #include <cppuhelper/weakref.hxx>
26 #include <editeng/svxenum.hxx>
27 #include <i18nlangtag/lang.h>
28 #include <o3tl/typed_flags_set.hxx>
29 #include <sal/log.hxx>
30 #include <svl/listener.hxx>
31 #include <svl/poolitem.hxx>
32 #include <unotools/weakref.hxx>
33 #include <com/sun/star/text/XDocumentIndexMark.hpp>
35 #include "calbck.hxx"
36 #include "hints.hxx"
37 #include "swtypes.hxx"
38 #include "toxe.hxx"
40 class SwTOXType;
41 class SwTOXMark;
42 class SwTextTOXMark;
43 class SwDoc;
44 class SwRootFrame;
45 class SwContentFrame;
46 class SwXDocumentIndexMark;
48 typedef std::vector<SwTOXMark*> SwTOXMarks;
50 namespace sw {
51 struct CollectTextMarksHint final : SfxHint {
52 SwTOXMarks& m_rMarks;
53 CollectTextMarksHint(SwTOXMarks& rMarks) : SfxHint(SfxHintId::SwCollectTextMarks), m_rMarks(rMarks) {}
55 struct FindContentFrameHint final : SfxHint {
56 SwContentFrame*& m_rpContentFrame;
57 const SwRootFrame& m_rLayout;
58 FindContentFrameHint(SwContentFrame*& rpContentFrame,const SwRootFrame& rLayout)
59 : SfxHint(SfxHintId::SwFindContentFrame)
60 , m_rpContentFrame(rpContentFrame)
61 , m_rLayout(rLayout)
64 struct CollectTextTOXMarksForLayoutHint final : SfxHint {
65 std::vector<std::reference_wrapper<SwTextTOXMark>>& m_rMarks;
66 const SwRootFrame* m_pLayout;
67 CollectTextTOXMarksForLayoutHint(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout)
68 : SfxHint(SfxHintId::SwCollectTextTOXMarksForLayout), m_rMarks(rMarks), m_pLayout(pLayout) {}
70 SW_DLLPUBLIC auto PrepareJumpToTOXMark(SwDoc const& rDoc, std::u16string_view aName)
71 -> std::optional<std::pair<SwTOXMark, sal_Int32>>;
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;
86 friend SwTOXMark* createSwTOXMarkForItemInfoPackage();
87 // friend class ItemInfoPackageSwAttributes;
89 const SwTOXType* m_pType;
90 OUString m_aAltText; // Text of caption is different.
91 OUString m_aPrimaryKey;
92 OUString m_aSecondaryKey;
94 // three more strings for phonetic sorting
95 OUString m_aTextReading;
96 OUString m_aPrimaryKeyReading;
97 OUString m_aSecondaryKeyReading;
99 SwTextTOXMark* m_pTextAttr;
101 sal_uInt16 m_nLevel;
102 OUString m_aBookmarkName;
103 bool m_bAutoGenerated; // generated using a concordance file
104 bool m_bMainEntry; // main entry emphasized by character style
106 unotools::WeakReference<SwXDocumentIndexMark> m_wXDocumentIndexMark;
108 SwTOXMark(); // to create the default attribute in InitCore
110 virtual void Notify(const SfxHint& rHint) override;
112 public:
114 // single argument ctors shall be explicit.
115 explicit SwTOXMark( const SwTOXType* pTyp );
116 virtual ~SwTOXMark() override;
118 SwTOXMark( const SwTOXMark& rCopy );
119 SwTOXMark& operator=( const SwTOXMark& rCopy );
121 // "pure virtual methods" of SfxPoolItem
122 virtual bool operator==( const SfxPoolItem& ) const override;
123 virtual SwTOXMark* Clone( SfxItemPool* pPool = nullptr ) const override;
125 void InvalidateTOXMark();
127 OUString GetText(SwRootFrame const* pLayout) const;
129 inline bool IsAlternativeText() const;
130 inline const OUString& GetAlternativeText() const;
132 inline void SetAlternativeText( const OUString& rAlt );
134 // content or user defined index
135 inline void SetLevel(sal_uInt16 nLevel);
136 inline sal_uInt16 GetLevel() const;
137 inline void SetBookmarkName( const OUString& bName);
138 inline const OUString& GetBookmarkName() const;
140 // for alphabetical index only
141 inline void SetPrimaryKey(const OUString& rStr );
142 inline void SetSecondaryKey(const OUString& rStr);
143 inline void SetTextReading(const OUString& rStr);
144 inline void SetPrimaryKeyReading(const OUString& rStr );
145 inline void SetSecondaryKeyReading(const OUString& rStr);
147 inline OUString const & GetPrimaryKey() const;
148 inline OUString const & GetSecondaryKey() const;
149 inline OUString const & GetTextReading() const;
150 inline OUString const & GetPrimaryKeyReading() const;
151 inline OUString const & GetSecondaryKeyReading() const;
153 bool IsAutoGenerated() const {return m_bAutoGenerated;}
154 void SetAutoGenerated(bool bSet) {m_bAutoGenerated = bSet;}
156 bool IsMainEntry() const {return m_bMainEntry;}
157 void SetMainEntry(bool bSet) { m_bMainEntry = bSet;}
159 inline const SwTOXType* GetTOXType() const;
161 const SwTextTOXMark* GetTextTOXMark() const { return m_pTextAttr; }
162 SwTextTOXMark* GetTextTOXMark() { return m_pTextAttr; }
164 SAL_DLLPRIVATE unotools::WeakReference<SwXDocumentIndexMark> const& GetXTOXMark() const
165 { return m_wXDocumentIndexMark; }
166 SAL_DLLPRIVATE void SetXTOXMark(rtl::Reference<SwXDocumentIndexMark> const& xMark);
168 void RegisterToTOXType( SwTOXType& rMark );
170 static constexpr OUString S_PAGE_DELI = u", "_ustr;
173 // index types
174 class SwTOXType final: public sw::BroadcastingModify
176 public:
177 SwTOXType(SwDoc& rDoc, TOXTypes eTyp, OUString aName);
179 // @@@ public copy ctor, but no copy assignment?
180 SwTOXType(const SwTOXType& rCopy);
182 inline const OUString& GetTypeName() const;
183 inline TOXTypes GetType() const;
184 SwDoc& GetDoc() const { return m_rDoc; }
185 void CollectTextMarks(SwTOXMarks& rMarks) const
186 { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextMarksHint(rMarks)); }
187 SwContentFrame* FindContentFrame(const SwRootFrame& rLayout) const
189 SwContentFrame* pContentFrame = nullptr;
190 CallSwClientNotify(sw::FindContentFrameHint(pContentFrame, rLayout));
191 return pContentFrame;
193 void CollectTextTOXMarksForLayout(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout) const
194 { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextTOXMarksForLayoutHint(rMarks, pLayout)); }
197 private:
198 SwDoc& m_rDoc;
199 OUString m_aName;
200 TOXTypes m_eType;
202 // @@@ public copy ctor, but no copy assignment?
203 SwTOXType & operator= (const SwTOXType &) = delete;
206 // Structure of the index lines
207 #define FORM_TITLE 0
208 #define FORM_ALPHA_DELIMITER 1
209 #define FORM_PRIMARY_KEY 2
210 #define FORM_SECONDARY_KEY 3
211 #define FORM_ENTRY 4
214 Pattern structure
216 <E#> - entry number <E# CharStyleName,PoolId>
217 <ET> - entry text <ET CharStyleName,PoolId>
218 <E> - entry text and number <E CharStyleName,PoolId>
219 <T> - tab stop <T,,Position,Adjust>
220 <C> - chapter info n = {0, 1, 2, 3, 4 } values of SwChapterFormat <C CharStyleName,PoolId>
221 <TX> - text token <X CharStyleName,PoolId, TOX_STYLE_DELIMITERTextContentTOX_STYLE_DELIMITER>
222 <#> - Page number <# CharStyleName,PoolId>
223 <LS> - Link start <LS>
224 <LE> - Link end <LE>
225 <A00> - Authority entry field <A02 CharStyleName, PoolId>
228 // These enum values are stored and must not be changed!
229 enum FormTokenType
231 TOKEN_ENTRY_NO,
232 TOKEN_ENTRY_TEXT,
233 TOKEN_ENTRY,
234 TOKEN_TAB_STOP,
235 TOKEN_TEXT,
236 TOKEN_PAGE_NUMS,
237 TOKEN_CHAPTER_INFO,
238 TOKEN_LINK_START,
239 TOKEN_LINK_END,
240 TOKEN_AUTHORITY,
241 TOKEN_END
244 struct SW_DLLPUBLIC SwFormToken
246 OUString sText;
247 OUString sCharStyleName;
248 SwTwips nTabStopPosition;
249 FormTokenType eTokenType;
250 sal_uInt16 nPoolId;
251 SvxTabAdjust eTabAlign;
252 sal_uInt16 nChapterFormat; //SwChapterFormat;
253 sal_uInt16 nOutlineLevel;//the maximum permitted outline level in numbering
254 sal_uInt16 nAuthorityField; //enum ToxAuthorityField
255 sal_Unicode cTabFillChar;
256 bool bWithTab; // true: do generate tab
257 // character only the tab stop
258 // #i21237#
260 SwFormToken(FormTokenType eType ) :
261 nTabStopPosition(0),
262 eTokenType(eType),
263 nPoolId(USHRT_MAX),
264 eTabAlign( SvxTabAdjust::Left ),
265 nChapterFormat(0 /*CF_NUMBER*/),
266 nOutlineLevel(MAXLEVEL), //default to maximum outline level
267 nAuthorityField(0 /*AUTH_FIELD_IDENTIFIER*/),
268 cTabFillChar(' '),
269 bWithTab(true) // #i21237#
272 OUString GetString() const;
275 struct SwFormTokenEqualToFormTokenType
277 FormTokenType eType;
279 SwFormTokenEqualToFormTokenType(FormTokenType _eType) : eType(_eType) {}
280 bool operator()(const SwFormToken & rToken)
282 return rToken.eTokenType == eType;
286 /// Vector of tokens.
287 typedef std::vector<SwFormToken> SwFormTokens;
290 Helper class that converts vectors of tokens to strings and vice
291 versa.
293 class SwFormTokensHelper
295 /// the tokens
296 SwFormTokens m_Tokens;
298 public:
300 constructor
302 @param rStr string representation of the tokens
304 SwFormTokensHelper(std::u16string_view aStr);
307 Returns vector of tokens.
309 @return vector of tokens
311 const SwFormTokens & GetTokens() const { return m_Tokens; }
314 class SW_DLLPUBLIC SwForm
316 SwFormTokens m_aPattern[ AUTH_TYPE_END + 1 ]; // #i21237#
317 OUString m_aTemplate[ AUTH_TYPE_END + 1 ];
319 TOXTypes m_eType;
320 sal_uInt16 m_nFormMaxLevel;
322 bool m_bIsRelTabPos : 1;
323 bool m_bCommaSeparated : 1;
325 public:
326 SwForm( TOXTypes eTOXType = TOX_CONTENT );
327 SwForm( const SwForm& rForm );
329 SwForm& operator=( const SwForm& rForm );
331 inline void SetTemplate(sal_uInt16 nLevel, const OUString& rName);
332 inline OUString const & GetTemplate(sal_uInt16 nLevel) const;
334 // #i21237#
335 void SetPattern(sal_uInt16 nLevel, SwFormTokens&& rName);
336 void SetPattern(sal_uInt16 nLevel, std::u16string_view aStr);
337 const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
339 // fill tab stop positions from template to pattern- #i21237#
340 void AdjustTabStops( SwDoc const & rDoc );
342 inline TOXTypes GetTOXType() const;
343 inline sal_uInt16 GetFormMax() const;
345 bool IsRelTabPos() const { return m_bIsRelTabPos; }
346 void SetRelTabPos( bool b ) { m_bIsRelTabPos = b; }
348 bool IsCommaSeparated() const { return m_bCommaSeparated;}
349 void SetCommaSeparated( bool b) { m_bCommaSeparated = b;}
351 static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
353 static OUString GetFormEntry();
354 static OUString GetFormTab();
355 static OUString GetFormPageNums();
356 static OUString GetFormLinkStt();
357 static OUString GetFormLinkEnd();
358 static OUString GetFormEntryNum();
359 static OUString GetFormEntryText();
360 static OUString GetFormChapterMark();
361 static OUString GetFormText();
362 static OUString GetFormAuth();
365 // Content to create indexes of
366 enum class SwTOXElement : sal_uInt16
368 NONE = 0x0000,
369 Mark = 0x0001,
370 OutlineLevel = 0x0002,
371 Template = 0x0004,
372 Ole = 0x0008,
373 Table = 0x0010,
374 Graphic = 0x0020,
375 Frame = 0x0040,
376 Sequence = 0x0080,
377 TableLeader = 0x0100,
378 TableInToc = 0x0200,
379 Bookmark = 0x0400,
380 Newline = 0x0800,
381 ParagraphOutlineLevel = 0x1000,
383 namespace o3tl {
384 template<> struct typed_flags<SwTOXElement> : is_typed_flags<SwTOXElement, 0x3fff> {};
387 enum class SwTOIOptions : sal_uInt16
389 NONE = 0x00,
390 SameEntry = 0x01,
391 FF = 0x02,
392 CaseSensitive = 0x04,
393 KeyAsEntry = 0x08,
394 AlphaDelimiter = 0x10,
395 Dash = 0x20,
396 InitialCaps = 0x40,
398 namespace o3tl {
399 template<> struct typed_flags<SwTOIOptions> : is_typed_flags<SwTOIOptions, 0x7f> {};
402 //which part of the caption is to be displayed
403 enum SwCaptionDisplay
405 CAPTION_COMPLETE,
406 CAPTION_NUMBER,
407 CAPTION_TEXT
410 enum class SwTOOElements : sal_uInt16
412 NONE = 0x00,
413 Math = 0x01,
414 Chart = 0x02,
415 Calc = 0x08,
416 DrawImpress = 0x10,
417 Other = 0x80,
419 namespace o3tl {
420 template<> struct typed_flags<SwTOOElements> : is_typed_flags<SwTOOElements, 0x9b> {};
423 #define TOX_STYLE_DELIMITER u'\x0001'
425 // Class for all indexes
426 class SW_DLLPUBLIC SwTOXBase : public SwClient
428 SwForm m_aForm; // description of the lines
429 OUString m_aName; // unique name
430 OUString m_aTitle; // title
431 OUString m_aBookmarkName; //Bookmark Name
433 OUString m_sMainEntryCharStyle; // name of the character style applied to main index entries
435 OUString m_aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
436 OUString m_sSequenceName; // FieldTypeName of a caption sequence
438 LanguageType m_eLanguage;
439 OUString m_sSortAlgorithm;
441 union {
442 sal_uInt16 nLevel; // consider outline levels
443 SwTOIOptions nOptions; // options of alphabetical index
444 } m_aData;
446 SwTOXElement m_nCreateType; // sources to create the index from
447 SwTOOElements m_nOLEOptions; // OLE sources
448 SwCaptionDisplay m_eCaptionDisplay;
449 bool m_bProtected : 1; // index protected ?
450 bool m_bFromChapter : 1; // create from chapter or document
451 bool m_bFromObjectNames : 1; // create a table or object index
452 // from the names rather than the caption
453 bool m_bLevelFromChapter : 1; // User index: get the level from the source chapter
455 protected:
456 // Add a data member, for record the TOC field expression of MS Word binary format
457 // For keeping fidelity and may giving a better exporting performance
458 OUString maMSTOCExpression;
459 bool mbKeepExpression;
461 public:
462 SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
463 SwTOXElement nCreaType, OUString aTitle );
464 SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = nullptr );
465 virtual ~SwTOXBase() override;
467 virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) override
469 if(rHint.GetId() == SfxHintId::SwDocumentDying)
470 GetRegisteredIn()->Remove(*this);
471 else
472 SwClient::SwClientNotify(rMod, rHint);
474 // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
475 // If not, so create it and copy all other used things.
476 void CopyTOXBase( SwDoc*, const SwTOXBase& );
478 const SwTOXType* GetTOXType() const;
480 SwTOXElement GetCreateType() const; // creation types
482 const OUString& GetTOXName() const {return m_aName;}
483 void SetTOXName(const OUString& rSet) {m_aName = rSet;}
485 // for record the TOC field expression of MS Word binary format
486 const OUString& GetMSTOCExpression() const{return maMSTOCExpression;}
487 void SetMSTOCExpression(const OUString& rExp) {maMSTOCExpression = rExp;}
488 void EnableKeepExpression() {mbKeepExpression = true;}
489 void DisableKeepExpression() {mbKeepExpression = false;}
491 const OUString& GetTitle() const; // Title
492 const OUString& GetBookmarkName() const;
493 OUString const & GetTypeName() const; // Name
494 const SwForm& GetTOXForm() const; // description of the lines
496 void SetCreate(SwTOXElement);
497 void SetTitle(const OUString& rTitle);
498 void SetTOXForm(const SwForm& rForm);
499 void SetBookmarkName(const OUString& bName);
501 TOXTypes GetType() const;
503 const OUString& GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;}
504 void SetMainEntryCharStyle(const OUString& rSet) {m_sMainEntryCharStyle = rSet;}
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 SwTOXType* SwTOXMark::GetTOXType() const
578 { return m_pType; }
580 inline bool SwTOXMark::IsAlternativeText() const
581 { return !m_aAltText.isEmpty(); }
583 inline void SwTOXMark::SetAlternativeText(const OUString& rAlt)
585 m_aAltText = rAlt;
588 inline void SwTOXMark::SetBookmarkName(const OUString& bName)
590 m_aBookmarkName = bName;
593 inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
595 SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
596 m_nLevel = nLvl;
599 inline void SwTOXMark::SetPrimaryKey( const OUString& rKey )
601 SAL_WARN_IF( GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
602 m_aPrimaryKey = rKey;
605 inline void SwTOXMark::SetSecondaryKey( const OUString& rKey )
607 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
608 m_aSecondaryKey = rKey;
611 inline void SwTOXMark::SetTextReading( const OUString& rText )
613 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
614 m_aTextReading = rText;
617 inline void SwTOXMark::SetPrimaryKeyReading( const OUString& rKey )
619 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
620 m_aPrimaryKeyReading = rKey;
623 inline void SwTOXMark::SetSecondaryKeyReading( const OUString& rKey )
625 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
626 m_aSecondaryKeyReading = rKey;
629 inline sal_uInt16 SwTOXMark::GetLevel() const
631 SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
632 return m_nLevel;
635 inline OUString const & SwTOXMark::GetPrimaryKey() const
637 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
638 return m_aPrimaryKey;
641 inline OUString const & SwTOXMark::GetSecondaryKey() const
643 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
644 return m_aSecondaryKey;
647 inline OUString const & SwTOXMark::GetTextReading() const
649 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
650 return m_aTextReading;
653 inline OUString const & SwTOXMark::GetPrimaryKeyReading() const
655 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
656 return m_aPrimaryKeyReading;
659 inline OUString const & SwTOXMark::GetSecondaryKeyReading() const
661 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
662 return m_aSecondaryKeyReading;
665 //SwForm
667 inline void SwForm::SetTemplate(sal_uInt16 nLevel, const OUString& rTemplate)
669 SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
670 m_aTemplate[nLevel] = rTemplate;
673 inline OUString const & SwForm::GetTemplate(sal_uInt16 nLevel) const
675 SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
676 return m_aTemplate[nLevel];
679 inline TOXTypes SwForm::GetTOXType() const
681 return m_eType;
684 inline sal_uInt16 SwForm::GetFormMax() const
686 return m_nFormMaxLevel;
689 //SwTOXType
691 inline const OUString& SwTOXType::GetTypeName() const
692 { return m_aName; }
694 inline TOXTypes SwTOXType::GetType() const
695 { return m_eType; }
697 // SwTOXBase
699 inline const SwTOXType* SwTOXBase::GetTOXType() const
700 { return static_cast<const SwTOXType*>(GetRegisteredIn()); }
702 inline SwTOXElement SwTOXBase::GetCreateType() const
703 { return m_nCreateType; }
705 inline const OUString& SwTOXBase::GetTitle() const
706 { return m_aTitle; }
708 inline const OUString& SwTOXBase::GetBookmarkName() const
709 { return m_aBookmarkName; }
711 inline OUString const & SwTOXBase::GetTypeName() const
712 { return GetTOXType()->GetTypeName(); }
714 inline const SwForm& SwTOXBase::GetTOXForm() const
715 { return m_aForm; }
717 inline void SwTOXBase::SetCreate(SwTOXElement nCreate)
718 { m_nCreateType = nCreate; }
720 inline void SwTOXBase::SetTOXForm(const SwForm& rForm)
721 { m_aForm = rForm; }
723 inline TOXTypes SwTOXBase::GetType() const
724 { return GetTOXType()->GetType(); }
726 inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
728 SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
729 m_aData.nLevel = nLev;
732 inline sal_uInt16 SwTOXBase::GetLevel() const
734 SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
735 return m_aData.nLevel;
738 inline SwTOIOptions SwTOXBase::GetOptions() const
740 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
741 return m_aData.nOptions;
744 inline void SwTOXBase::SetOptions(SwTOIOptions nOpt)
746 SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
747 m_aData.nOptions = nOpt;
750 #endif // INCLUDED_SW_INC_TOX_HXX
752 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */