Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/tox.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
#ifndef INCLUDED_SW_INC_TOX_HXX
20
#define INCLUDED_SW_INC_TOX_HXX
21
22
#include <vector>
23
#include <optional>
24
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>
34
35
#include "calbck.hxx"
36
#include "hints.hxx"
37
#include "swtypes.hxx"
38
#include "toxe.hxx"
39
#include "chpfld.hxx"
40
41
class SwTOXType;
42
class SwTOXMark;
43
class SwTextTOXMark;
44
class SwDoc;
45
class SwRootFrame;
46
class SwContentFrame;
47
class SwXDocumentIndexMark;
48
49
typedef std::vector<SwTOXMark*> SwTOXMarks;
50
51
namespace sw {
52
    struct CollectTextMarksHint final : SfxHint {
53
        SwTOXMarks& m_rMarks;
54
0
        CollectTextMarksHint(SwTOXMarks& rMarks) : SfxHint(SfxHintId::SwCollectTextMarks), m_rMarks(rMarks) {}
55
    };
56
    struct FindContentFrameHint final : SfxHint {
57
        SwContentFrame*& m_rpContentFrame;
58
        const SwRootFrame& m_rLayout;
59
        FindContentFrameHint(SwContentFrame*& rpContentFrame,const SwRootFrame& rLayout)
60
0
            : SfxHint(SfxHintId::SwFindContentFrame)
61
0
            , m_rpContentFrame(rpContentFrame)
62
0
            , m_rLayout(rLayout)
63
0
        {}
64
    };
65
    struct CollectTextTOXMarksForLayoutHint final : SfxHint {
66
        std::vector<std::reference_wrapper<SwTextTOXMark>>& m_rMarks;
67
        const SwRootFrame* m_pLayout;
68
        CollectTextTOXMarksForLayoutHint(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout)
69
0
            : SfxHint(SfxHintId::SwCollectTextTOXMarksForLayout), m_rMarks(rMarks), m_pLayout(pLayout) {}
70
    };
71
    SW_DLLPUBLIC auto PrepareJumpToTOXMark(SwDoc const& rDoc, std::u16string_view aName)
72
        -> std::optional<std::pair<SwTOXMark, sal_Int32>>;
73
}
74
75
// Entry of content index, alphabetical index or user defined index
76
77
extern const sal_Unicode C_NUM_REPL;
78
extern const sal_Unicode C_END_PAGE_NUM;
79
80
class SW_DLLPUBLIC SwTOXMark final
81
    : public SfxPoolItem
82
    , public SvtListener
83
{
84
    friend void InitCore();
85
    friend class SwTextTOXMark;
86
    friend SwTOXMark* createSwTOXMarkForItemInfoPackage();
87
    // friend class ItemInfoPackageSwAttributes;
88
89
    const SwTOXType* m_pType;
90
    OUString m_aAltText;    // Text of caption is different.
91
    OUString m_aPrimaryKey;
92
    OUString m_aSecondaryKey;
93
94
    // three more strings for phonetic sorting
95
    OUString m_aTextReading;
96
    OUString m_aPrimaryKeyReading;
97
    OUString m_aSecondaryKeyReading;
98
99
    SwTextTOXMark* m_pTextAttr;
100
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
105
106
    unotools::WeakReference<SwXDocumentIndexMark> m_wXDocumentIndexMark;
107
108
    SwTOXMark();                    // to create the default attribute in InitCore
109
110
    virtual void Notify(const SfxHint& rHint) override;
111
112
public:
113
114
    // single argument ctors shall be explicit.
115
    DECLARE_ITEM_TYPE_FUNCTION(SwTOXMark)
116
    explicit SwTOXMark( const SwTOXType* pTyp );
117
    virtual ~SwTOXMark() override;
118
119
    SwTOXMark( const SwTOXMark& rCopy );
120
    SwTOXMark& operator=( const SwTOXMark& rCopy );
121
122
    // "pure virtual methods" of SfxPoolItem
123
    virtual bool            operator==( const SfxPoolItem& ) const override;
124
    virtual SwTOXMark*      Clone( SfxItemPool* pPool = nullptr ) const override;
125
126
    void InvalidateTOXMark();
127
128
    OUString                GetText(SwRootFrame const* pLayout) const;
129
130
    inline bool             IsAlternativeText() const;
131
    inline const OUString&  GetAlternativeText() const;
132
133
    inline void             SetAlternativeText( const OUString& rAlt );
134
135
    // content or user defined index
136
    inline void             SetLevel(sal_uInt16 nLevel);
137
    inline sal_uInt16       GetLevel() const;
138
    inline void             SetBookmarkName( const OUString& bName);
139
    inline const OUString&  GetBookmarkName() const;
140
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);
147
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;
153
154
0
    bool                    IsAutoGenerated() const {return m_bAutoGenerated;}
155
0
    void                    SetAutoGenerated(bool bSet) {m_bAutoGenerated = bSet;}
156
157
0
    bool                    IsMainEntry() const {return m_bMainEntry;}
158
0
    void                    SetMainEntry(bool bSet) { m_bMainEntry = bSet;}
159
160
    inline const SwTOXType*    GetTOXType() const;
161
162
0
    const SwTextTOXMark* GetTextTOXMark() const   { return m_pTextAttr; }
163
0
          SwTextTOXMark* GetTextTOXMark()         { return m_pTextAttr; }
164
165
    SAL_DLLPRIVATE unotools::WeakReference<SwXDocumentIndexMark> const& GetXTOXMark() const
166
0
            { return m_wXDocumentIndexMark; }
167
    SAL_DLLPRIVATE void SetXTOXMark(rtl::Reference<SwXDocumentIndexMark> const& xMark);
168
169
    void RegisterToTOXType( SwTOXType& rMark );
170
171
    static constexpr OUString S_PAGE_DELI = u", "_ustr;
172
};
173
174
// index types
175
class SwTOXType final: public sw::BroadcastingModify
176
{
177
public:
178
    SwTOXType(SwDoc& rDoc, TOXTypes eTyp, OUString aName);
179
180
    // @@@ public copy ctor, but no copy assignment?
181
    SwTOXType(const SwTOXType& rCopy);
182
183
    inline const OUString&  GetTypeName() const;
184
    inline TOXTypes         GetType() const;
185
785
    SwDoc& GetDoc() const { return m_rDoc; }
186
    void CollectTextMarks(SwTOXMarks& rMarks) const
187
0
            { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextMarksHint(rMarks)); }
188
    SwContentFrame* FindContentFrame(const SwRootFrame& rLayout) const
189
0
    {
190
0
        SwContentFrame* pContentFrame = nullptr;
191
0
        CallSwClientNotify(sw::FindContentFrameHint(pContentFrame, rLayout));
192
0
        return pContentFrame;
193
0
    }
194
    void CollectTextTOXMarksForLayout(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout) const
195
0
            { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextTOXMarksForLayoutHint(rMarks, pLayout)); }
196
197
198
private:
199
    SwDoc&          m_rDoc;
200
    OUString        m_aName;
201
    TOXTypes        m_eType;
202
203
    // @@@ public copy ctor, but no copy assignment?
204
    SwTOXType & operator= (const SwTOXType &) = delete;
205
};
206
207
// Structure of the index lines
208
0
#define FORM_TITLE              0
209
0
#define FORM_ALPHA_DELIMITER   1
210
0
#define FORM_PRIMARY_KEY        2
211
0
#define FORM_SECONDARY_KEY      3
212
0
#define FORM_ENTRY              4
213
214
/*
215
 Pattern structure
216
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>
227
 */
228
229
// These enum values are stored and must not be changed!
230
enum FormTokenType
231
{
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
243
};
244
245
struct SW_DLLPUBLIC SwFormToken
246
{
247
    OUString        sText;
248
    UIName          sCharStyleName;
249
    SwTwips         nTabStopPosition;
250
    FormTokenType   eTokenType;
251
    sal_uInt16          nPoolId;
252
    SvxTabAdjust    eTabAlign;
253
    SwChapterFormat     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#
260
261
    SwFormToken(FormTokenType eType ) :
262
81.3k
        nTabStopPosition(0),
263
81.3k
        eTokenType(eType),
264
81.3k
        nPoolId(USHRT_MAX),
265
81.3k
        eTabAlign( SvxTabAdjust::Left ),
266
81.3k
        nChapterFormat(SwChapterFormat::Number),
267
81.3k
        nOutlineLevel(MAXLEVEL),   //default to maximum outline level
268
81.3k
        nAuthorityField(0 /*AUTH_FIELD_IDENTIFIER*/),
269
81.3k
        cTabFillChar(' '),
270
81.3k
        bWithTab(true)  // #i21237#
271
81.3k
    {}
272
273
    OUString GetString() const;
274
};
275
276
struct SwFormTokenEqualToFormTokenType
277
{
278
    FormTokenType eType;
279
280
1
    SwFormTokenEqualToFormTokenType(FormTokenType _eType) : eType(_eType) {}
281
    bool operator()(const SwFormToken & rToken)
282
2
    {
283
2
        return rToken.eTokenType == eType;
284
2
    }
285
};
286
287
/// Vector of tokens.
288
typedef std::vector<SwFormToken> SwFormTokens;
289
290
/**
291
   Helper class that converts vectors of tokens to strings and vice
292
   versa.
293
 */
294
class SwFormTokensHelper
295
{
296
    /// the tokens
297
    SwFormTokens m_Tokens;
298
299
public:
300
    /**
301
       constructor
302
303
       @param rStr   string representation of the tokens
304
    */
305
    SwFormTokensHelper(std::u16string_view aStr);
306
307
    /**
308
       Returns vector of tokens.
309
310
       @return vector of tokens
311
    */
312
2.29k
    const SwFormTokens & GetTokens() const { return m_Tokens; }
313
};
314
315
class SW_DLLPUBLIC SwForm
316
{
317
    SwFormTokens    m_aPattern[ AUTH_TYPE_END + 1 ]; // #i21237#
318
    UIName  m_aTemplate[ AUTH_TYPE_END + 1 ];
319
320
    TOXTypes    m_eType;
321
    sal_uInt16      m_nFormMaxLevel;
322
323
    bool    m_bIsRelTabPos : 1;
324
    bool    m_bCommaSeparated : 1;
325
326
public:
327
    SwForm( TOXTypes eTOXType = TOX_CONTENT );
328
    SwForm( const SwForm& rForm );
329
330
    SwForm& operator=( const SwForm& rForm );
331
332
    inline void SetTemplate(sal_uInt16 nLevel, const UIName& rName);
333
    inline UIName const & GetTemplate(sal_uInt16 nLevel) const;
334
335
    // #i21237#
336
    void    SetPattern(sal_uInt16 nLevel, SwFormTokens&& rName);
337
    void    SetPattern(sal_uInt16 nLevel, std::u16string_view aStr);
338
    const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
339
340
    // fill tab stop positions from template to pattern- #i21237#
341
    void AdjustTabStops( SwDoc const & rDoc );
342
343
    inline TOXTypes GetTOXType() const;
344
    inline sal_uInt16   GetFormMax() const;
345
346
0
    bool IsRelTabPos() const    {   return m_bIsRelTabPos; }
347
0
    void SetRelTabPos( bool b ) {   m_bIsRelTabPos = b;       }
348
349
0
    bool IsCommaSeparated() const       { return m_bCommaSeparated;}
350
0
    void SetCommaSeparated( bool b)     { m_bCommaSeparated = b;}
351
352
    static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
353
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();
364
};
365
366
// Content to create indexes of
367
enum class SwTOXElement : sal_uInt16
368
{
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
};
384
namespace o3tl {
385
    template<> struct typed_flags<SwTOXElement> : is_typed_flags<SwTOXElement, 0x3fff> {};
386
}
387
388
enum class SwTOIOptions : sal_uInt16
389
{
390
    NONE            = 0x00,
391
    SameEntry       = 0x01,
392
    FF              = 0x02,
393
    CaseSensitive   = 0x04,
394
    KeyAsEntry      = 0x08,
395
    AlphaDelimiter  = 0x10,
396
    Dash            = 0x20,
397
    InitialCaps     = 0x40,
398
};
399
namespace o3tl {
400
    template<> struct typed_flags<SwTOIOptions> : is_typed_flags<SwTOIOptions, 0x7f> {};
401
}
402
403
//which part of the caption is to be displayed
404
enum class SwCaptionDisplay
405
{
406
    Complete,
407
    Number,
408
    Text
409
};
410
411
enum class SwTOOElements : sal_uInt16
412
{
413
    NONE            = 0x00,
414
    Math            = 0x01,
415
    Chart           = 0x02,
416
    Calc            = 0x08,
417
    DrawImpress     = 0x10,
418
    Other           = 0x80,
419
};
420
namespace o3tl {
421
    template<> struct typed_flags<SwTOOElements> : is_typed_flags<SwTOOElements, 0x9b> {};
422
}
423
424
47.4k
#define TOX_STYLE_DELIMITER u'\x0001'
425
426
// Class for all indexes
427
class SW_DLLPUBLIC SwTOXBase : public SwClient
428
{
429
    SwForm      m_aForm;              // description of the lines
430
    UIName      m_aName;              // unique name
431
    OUString    m_aTitle;             // title
432
    OUString    m_aBookmarkName;      //Bookmark Name
433
434
    UIName      m_sMainEntryCharStyle; // name of the character style applied to main index entries
435
436
    UIName      m_aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
437
    UIName      m_sSequenceName;      // FieldTypeName of a caption sequence
438
439
    LanguageType    m_eLanguage;
440
    OUString        m_sSortAlgorithm;
441
442
    union {
443
        sal_uInt16      nLevel;             // consider outline levels
444
        SwTOIOptions    nOptions;           // options of alphabetical index
445
    } m_aData;
446
447
    SwTOXElement     m_nCreateType;        // sources to create the index from
448
    SwTOOElements    m_nOLEOptions;        // OLE sources
449
    SwCaptionDisplay m_eCaptionDisplay;
450
    bool        m_bProtected : 1;         // index protected ?
451
    bool        m_bFromChapter : 1;       // create from chapter or document
452
    bool        m_bFromObjectNames : 1;   // create a table or object index
453
                                    // from the names rather than the caption
454
    bool        m_bLevelFromChapter : 1; // User index: get the level from the source chapter
455
456
protected:
457
    // Add a data member, for record the TOC field expression of MS Word binary format
458
    // For keeping fidelity and may giving a better exporting performance
459
    OUString maMSTOCExpression;
460
    bool mbKeepExpression;
461
462
public:
463
    SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
464
               SwTOXElement nCreaType, OUString aTitle );
465
    SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = nullptr );
466
    virtual ~SwTOXBase() override;
467
468
    virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) override
469
3.38k
    {
470
3.38k
        if(rHint.GetId() == SfxHintId::SwDocumentDying)
471
0
            GetRegisteredIn()->Remove(*this);
472
3.38k
        else
473
3.38k
            SwClient::SwClientNotify(rMod, rHint);
474
3.38k
    }
475
    // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
476
    // If not, so create it and copy all other used things.
477
    void                CopyTOXBase( SwDoc*, const SwTOXBase& );
478
479
    const SwTOXType*    GetTOXType() const;
480
481
    SwTOXElement        GetCreateType() const;      // creation types
482
483
12.7k
    const UIName&       GetTOXName() const {return m_aName;}
484
3.30k
    void                SetTOXName(const UIName& rSet) {m_aName = rSet;}
485
486
    // for record the TOC field expression of MS Word binary format
487
0
    const OUString&     GetMSTOCExpression() const{return maMSTOCExpression;}
488
14
    void                SetMSTOCExpression(const OUString& rExp) {maMSTOCExpression = rExp;}
489
0
    void                EnableKeepExpression() {mbKeepExpression = true;}
490
0
    void                DisableKeepExpression() {mbKeepExpression = false;}
491
492
    const OUString&     GetTitle() const;           // Title
493
    const OUString&     GetBookmarkName() const;
494
    OUString const &    GetTypeName() const;        // Name
495
    const SwForm&       GetTOXForm() const;         // description of the lines
496
497
    void                SetCreate(SwTOXElement);
498
    void                SetTitle(const OUString& rTitle);
499
    void                SetTOXForm(const SwForm& rForm);
500
    void                SetBookmarkName(const OUString& bName);
501
502
    TOXTypes            GetType() const;
503
504
0
    const UIName&       GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;}
505
0
    void                SetMainEntryCharStyle(const UIName& rSet)  {m_sMainEntryCharStyle = rSet;}
506
507
    // content index only
508
    inline void             SetLevel(sal_uInt16);                   // consider outline level
509
    inline sal_uInt16       GetLevel() const;
510
511
    // alphabetical index only
512
    inline SwTOIOptions     GetOptions() const;                 // alphabetical index options
513
    inline void             SetOptions(SwTOIOptions nOpt);
514
515
    // index of objects
516
6.15k
    SwTOOElements           GetOLEOptions() const {return m_nOLEOptions;}
517
5.21k
    void                    SetOLEOptions(SwTOOElements nOpt) {m_nOLEOptions = nOpt;}
518
519
    // index of objects
520
521
    UIName const &          GetStyleNames(sal_uInt16 nLevel) const
522
116
                                {
523
116
                                SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
524
116
                                return m_aStyleNames[nLevel];
525
116
                                }
526
    void                    SetStyleNames(const UIName& rSet, sal_uInt16 nLevel)
527
17
                                {
528
17
                                SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
529
17
                                m_aStyleNames[nLevel] = rSet;
530
17
                                }
531
0
    bool                    IsFromChapter() const { return m_bFromChapter;}
532
0
    void                    SetFromChapter(bool bSet) { m_bFromChapter = bSet;}
533
534
0
    bool                    IsFromObjectNames() const {return m_bFromObjectNames;}
535
0
    void                    SetFromObjectNames(bool bSet) {m_bFromObjectNames = bSet;}
536
537
0
    bool                    IsLevelFromChapter() const {return m_bLevelFromChapter;}
538
0
    void                    SetLevelFromChapter(bool bSet) {m_bLevelFromChapter = bSet;}
539
540
3.19k
    bool                    IsProtected() const { return m_bProtected; }
541
3.02k
    void                    SetProtected(bool bSet) { m_bProtected = bSet; }
542
543
0
    const UIName&           GetSequenceName() const {return m_sSequenceName;}
544
13
    void                    SetSequenceName(const UIName& rSet) {m_sSequenceName = rSet;}
545
546
0
    SwCaptionDisplay        GetCaptionDisplay() const { return m_eCaptionDisplay;}
547
0
    void                    SetCaptionDisplay(SwCaptionDisplay eSet) {m_eCaptionDisplay = eSet;}
548
549
    bool                    IsTOXBaseInReadonly() const;
550
551
    const SfxItemSet*       GetAttrSet() const;
552
    void                    SetAttrSet( const SfxItemSet& );
553
554
0
    LanguageType    GetLanguage() const {return m_eLanguage;}
555
0
    void            SetLanguage(LanguageType nLang)  {m_eLanguage = nLang;}
556
557
0
    const OUString&         GetSortAlgorithm()const {return m_sSortAlgorithm;}
558
0
    void            SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;}
559
    // #i21237#
560
    void AdjustTabStops( SwDoc const & rDoc )
561
14
    {
562
14
        m_aForm.AdjustTabStops( rDoc );
563
14
    }
564
565
    SwTOXBase& operator=(const SwTOXBase& rSource);
566
    void RegisterToTOXType( SwTOXType& rMark );
567
};
568
569
//SwTOXMark
570
571
inline const OUString& SwTOXMark::GetAlternativeText() const
572
785
    {   return m_aAltText;    }
573
574
inline const OUString& SwTOXMark::GetBookmarkName() const
575
0
    {   return m_aBookmarkName;    }
576
577
inline const SwTOXType* SwTOXMark::GetTOXType() const
578
785
    { return m_pType; }
579
580
inline bool SwTOXMark::IsAlternativeText() const
581
0
    { return !m_aAltText.isEmpty(); }
582
583
inline void SwTOXMark::SetAlternativeText(const OUString& rAlt)
584
785
{
585
785
    m_aAltText = rAlt;
586
785
}
587
588
inline void SwTOXMark::SetBookmarkName(const OUString& bName)
589
0
{
590
0
    m_aBookmarkName = bName;
591
0
}
592
593
inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
594
5
{
595
5
    SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
596
5
    m_nLevel = nLvl;
597
5
}
598
599
inline void SwTOXMark::SetPrimaryKey( const OUString& rKey )
600
781
{
601
781
    SAL_WARN_IF( GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
602
781
    m_aPrimaryKey = rKey;
603
781
}
604
605
inline void SwTOXMark::SetSecondaryKey( const OUString& rKey )
606
12
{
607
12
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
608
12
    m_aSecondaryKey = rKey;
609
12
}
610
611
inline void SwTOXMark::SetTextReading( const OUString& rText )
612
0
{
613
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
614
0
    m_aTextReading = rText;
615
0
}
616
617
inline void SwTOXMark::SetPrimaryKeyReading( const OUString& rKey )
618
0
{
619
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
620
0
    m_aPrimaryKeyReading = rKey;
621
0
}
622
623
inline void SwTOXMark::SetSecondaryKeyReading( const OUString& rKey )
624
0
{
625
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
626
0
    m_aSecondaryKeyReading = rKey;
627
0
}
628
629
inline sal_uInt16 SwTOXMark::GetLevel() const
630
0
{
631
0
    SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
632
0
    return m_nLevel;
633
0
}
634
635
inline OUString const & SwTOXMark::GetPrimaryKey() const
636
0
{
637
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
638
0
    return m_aPrimaryKey;
639
0
}
640
641
inline OUString const & SwTOXMark::GetSecondaryKey() const
642
0
{
643
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
644
0
    return m_aSecondaryKey;
645
0
}
646
647
inline OUString const & SwTOXMark::GetTextReading() const
648
0
{
649
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
650
0
    return m_aTextReading;
651
0
}
652
653
inline OUString const & SwTOXMark::GetPrimaryKeyReading() const
654
0
{
655
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
656
0
    return m_aPrimaryKeyReading;
657
0
}
658
659
inline OUString const & SwTOXMark::GetSecondaryKeyReading() const
660
0
{
661
0
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
662
0
    return m_aSecondaryKeyReading;
663
0
}
664
665
//SwForm
666
667
inline void SwForm::SetTemplate(sal_uInt16 nLevel, const UIName& rTemplate)
668
72.3k
{
669
72.3k
    SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
670
72.3k
    m_aTemplate[nLevel] = rTemplate;
671
72.3k
}
672
673
inline UIName const & SwForm::GetTemplate(sal_uInt16 nLevel) const
674
140
{
675
140
    SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
676
140
    return m_aTemplate[nLevel];
677
140
}
678
679
inline TOXTypes SwForm::GetTOXType() const
680
0
{
681
0
    return m_eType;
682
0
}
683
684
inline sal_uInt16 SwForm::GetFormMax() const
685
75.6k
{
686
75.6k
    return m_nFormMaxLevel;
687
75.6k
}
688
689
//SwTOXType
690
691
inline const OUString& SwTOXType::GetTypeName() const
692
13.5k
    {   return m_aName;   }
693
694
inline TOXTypes SwTOXType::GetType() const
695
45.6k
    {   return m_eType;   }
696
697
// SwTOXBase
698
699
inline const SwTOXType* SwTOXBase::GetTOXType() const
700
40.6k
    { return static_cast<const SwTOXType*>(GetRegisteredIn()); }
701
702
inline SwTOXElement SwTOXBase::GetCreateType() const
703
6.17k
    { return m_nCreateType; }
704
705
inline const OUString& SwTOXBase::GetTitle() const
706
3.19k
    { return m_aTitle; }
707
708
inline const OUString& SwTOXBase::GetBookmarkName() const
709
0
    { return m_aBookmarkName; }
710
711
inline OUString const & SwTOXBase::GetTypeName() const
712
0
    { return GetTOXType()->GetTypeName();  }
713
714
inline const SwForm& SwTOXBase::GetTOXForm() const
715
13.9k
    { return m_aForm; }
716
717
inline void SwTOXBase::SetCreate(SwTOXElement nCreate)
718
5.22k
    { m_nCreateType = nCreate; }
719
720
inline void SwTOXBase::SetTOXForm(const SwForm& rForm)
721
2.95k
    {  m_aForm = rForm; }
722
723
inline TOXTypes SwTOXBase::GetType() const
724
16.4k
    { return GetTOXType()->GetType(); }
725
726
inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
727
3.20k
{
728
3.20k
    SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
729
3.20k
    m_aData.nLevel = nLev;
730
3.20k
}
731
732
inline sal_uInt16 SwTOXBase::GetLevel() const
733
14
{
734
14
    SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
735
14
    return m_aData.nLevel;
736
14
}
737
738
inline SwTOIOptions SwTOXBase::GetOptions() const
739
3
{
740
3
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
741
3
    return m_aData.nOptions;
742
3
}
743
744
inline void SwTOXBase::SetOptions(SwTOIOptions nOpt)
745
3
{
746
3
    SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
747
3
    m_aData.nOptions = nOpt;
748
3
}
749
750
#endif // INCLUDED_SW_INC_TOX_HXX
751
752
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */