summaryrefslogtreecommitdiff
path: root/sw/inc/tox.hxx
blob: eb3705b7170e3b5a975bd15b2853c9ef05f40a7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/*************************************************************************
 *
 *  $RCSfile: tox.hxx,v $
 *
 *  $Revision: 1.2 $
 *
 *  last change: $Author: jp $ $Date: 2000-10-05 12:04:44 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _TOX_HXX
#define _TOX_HXX

#ifndef _SVARRAY_HXX //autogen
#include <svtools/svarray.hxx>
#endif

#ifndef _STRING_HXX //autogen
#include <tools/string.hxx>
#endif

#ifndef _SFXPOOLITEM_HXX //autogen
#include <svtools/poolitem.hxx>
#endif

#ifndef _SWTYPES_HXX
#include <swtypes.hxx>
#endif
#ifndef _TOXE_HXX
#include <toxe.hxx>
#endif
#ifndef _CALBCK_HXX
#include <calbck.hxx>
#endif
#ifndef _ERRHDL_HXX
#include <errhdl.hxx>
#endif

class SwTOXType;
class SwTOXMark;
class SwTxtTOXMark;
class SwDoc;

SV_DECL_PTRARR(SwTOXMarks, SwTOXMark*, 0, 10)

/*--------------------------------------------------------------------
     Beschreibung:  Eintrag fuer Inhaltsverzeichnis oder Benutzerverz.
 --------------------------------------------------------------------*/

#define IVER_TOXMARK_STRPOOL ((USHORT)1)
#define IVER_TOXMARK_NEWTOX ((USHORT)2)

class SwTOXMark : public SfxPoolItem, public SwClient
{
    friend void _InitCore();
    friend class SwTxtTOXMark;

    String aAltText;    // Der Text des Eintrages ist unterschiedlich
    String aPrimaryKey, aSecondaryKey;

    SwTxtTOXMark* pTxtAttr;

    USHORT  nLevel;
    BOOL    bAutoGenerated : 1;     // generated using a concordance file
    BOOL    bMainEntry : 1;         // main entry emphasized by character style


    SwTOXMark();                    // for crete the dflt. atr. in _InitCore

public:
    TYPEINFO();   // fuers rtti

    SwTOXMark( const SwTOXType* pTyp );
    SwTOXMark( const SwTOXMark& rCopy );
    virtual ~SwTOXMark();

    // "pure virtual Methoden" vom SfxPoolItem
    virtual int             operator==( const SfxPoolItem& ) const;
    virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
    virtual SfxPoolItem*    Create(SvStream &, USHORT nVer) const;
    virtual SvStream&       Store(SvStream &, USHORT nIVer) const;
    virtual USHORT          GetVersion( USHORT nFFVer ) const;

    SwTOXMark&              operator=( const SwTOXMark& rCopy );
    String                  GetText() const;

    inline BOOL             IsAlternativeText() const;
    inline const String&    GetAlternativeText() const;

    inline void             SetAlternativeText( const String& rAlt );

    // Inhalts-/Benutzerverzeichnis - spezifisch
    inline void             SetLevel(USHORT nLevel);
    inline USHORT           GetLevel() const;

    // Index - spezifisch
    inline void             SetPrimaryKey(const String& rStr );
    inline void             SetSecondaryKey(const String& rStr);
    inline const String&    GetPrimaryKey() const;
    inline const String&    GetSecondaryKey() const;

    BOOL                    IsAutoGenerated() const {return bAutoGenerated;}
    void                    SetAutoGenerated(BOOL bSet) {bAutoGenerated = bSet;}

    BOOL                    IsMainEntry() const {return bMainEntry;}
    void                    SetMainEntry(BOOL bSet) { bMainEntry = bSet;}

    inline const SwTOXType*    GetTOXType() const;

    const SwTxtTOXMark* GetTxtTOXMark() const   { return pTxtAttr; }
          SwTxtTOXMark* GetTxtTOXMark()         { return pTxtAttr; }
};

/*--------------------------------------------------------------------
     Beschreibung:  Typen einzelner Verzeichnisse
 --------------------------------------------------------------------*/

class SwTOXType : public SwModify
{
public:
    SwTOXType(TOXTypes eTyp, const String& aName);
    SwTOXType(const SwTOXType& rCopy);

    inline  const String&   GetTypeName() const;
    void                    SetTypeName(const String& rName);
    inline TOXTypes         GetType() const;

private:
    String          aName;
    TOXTypes        eType;
};

/*--------------------------------------------------------------------
     Beschreibung:  Muster fuer Zeilen eines Verzeichnisses
 --------------------------------------------------------------------*/

#define FORM_TITLE              0
#define FORM_ALPHA_DELIMITTER   1
#define FORM_PRIMARY_KEY        2
#define FORM_SECONDARY_KEY      3
#define FORM_ENTRY              4

/*
 Pattern structure

 <E#> - entry number                    <E# CharStyleName,PoolId>
 <ET> - entry text                      <ET CharStyleName,PoolId>
 <E>  - entry text and number           <E CharStyleName,PoolId>
 <T>  - tab stop                        <T,,Position,Adjust>
 <C>  - chapter info n = {0, 1, 2, 3, 4 } values of SwChapterFormat <C CharStyleName,PoolId>
 <TX> - text token                      <X CharStyleName,PoolId, TOX_STYLE_DELIMITERTextContentTOX_STYLE_DELIMITER>
 <#>  - Page number                     <# CharStyleName,PoolId>
 <LS> - Link start                      <LS>
 <LE> - Link end                        <LE>
 <A00> - Authority entry field          <A02 CharStyleName, PoolId>
 */

// These enum values are stored and must not change!
enum FormTokenType
{
    TOKEN_ENTRY_NO,
    TOKEN_ENTRY_TEXT,
    TOKEN_ENTRY,
    TOKEN_TAB_STOP,
    TOKEN_TEXT,
    TOKEN_PAGE_NUMS,
    TOKEN_CHAPTER_INFO,
    TOKEN_LINK_START,
    TOKEN_LINK_END,
    TOKEN_AUTHORITY,
    TOKEN_END
};

struct SwFormToken
{
    String          sText;
    String          sCharStyleName;
    SwTwips         nTabStopPosition;
    FormTokenType   eTokenType;
    USHORT          nPoolId;
    USHORT          eTabAlign;
    USHORT          nChapterFormat;     //SwChapterFormat;
    USHORT          nAuthorityField;    //enum ToxAuthorityField
    sal_Unicode     cTabFillChar;

    SwFormToken(FormTokenType eType ) :
        eTokenType(eType),
        nTabStopPosition(ULONG_MAX),
        nPoolId(USHRT_MAX),
        eTabAlign(0 /*SVX_TAB_ADJUST_LEFT*/),
        cTabFillChar(' '),
        nChapterFormat(0 /*CF_NUMBER*/),
        nAuthorityField(0)/*AUTH_FIELD_IDENTIFIER*/{}

    String GetString() const;
};

class SwFormTokenEnumerator
{
    String sPattern;
    xub_StrLen nCurPatternPos;
    xub_StrLen nCurPatternLen;

    FormTokenType _SearchNextToken( xub_StrLen nStt, xub_StrLen& rEnd,
                                    xub_StrLen* pTokenLen = 0 ) const;
    SwFormToken BuildToken( FormTokenType, xub_StrLen ) const;

public:
    SwFormTokenEnumerator( const String& rPattern );
    BOOL            HasNextToken() const
        { return nCurPatternPos + nCurPatternLen < sPattern.Len(); }

    SwFormToken     GetNextToken();
    SwFormToken     GetCurToken() const;

    FormTokenType   GetCurTokenType();
    FormTokenType   GetNextTokenType();
    FormTokenType   GetPrevTokenType();
    void            RemoveCurToken();
    void            InsertToken( const SwFormToken& rToken );
    const String&   GetPattern() const      { return sPattern; }
};

class SwForm
{
    String  aPattern[ AUTH_TYPE_END + 1 ];
    String  aTemplate[ AUTH_TYPE_END + 1 ];
    USHORT  nType, nFormMaxLevel;
    //USHORT    nFirstTabPos; -> Value in tab token
//  BOOL    bHasFirstTabPos : 1;
    BOOL    bGenerateTabPos : 1;
    BOOL    bIsRelTabPos : 1;
    BOOL    bCommaSeparated : 1;

public:
    SwForm( USHORT nType = TOX_CONTENT );
    SwForm( const SwForm& rForm );

    SwForm& operator=( const SwForm& rForm );

    inline void             SetTemplate(USHORT nLevel, const String& rName);
    inline const String&    GetTemplate(USHORT nLevel) const;

    inline void             SetPattern(USHORT nLevel, const String& rName);
    inline const String&    GetPattern(USHORT nLevel) const;

    //convert pattern string from old to new format or vice versa
    static String           ConvertPatternTo51(const String& rSource);
    static String           ConvertPatternFrom51(const String& rSource, TOXTypes eType);

    // fill tab stop positions from template to pattern
    void                    AdjustTabStops(SwDoc& rDoc);

    SwFormTokenEnumerator   CreateTokenEnumerator(USHORT nLevel) const
        {return SwFormTokenEnumerator(GetPattern(nLevel));}

    inline USHORT   GetTOXType() const;
    inline USHORT   GetFormMax() const;

    USHORT GetFirstTabPos() const  ;    //{ return nFirstTabPos; }
    void SetFirstTabPos( USHORT n );    //{ nFirstTabPos = n; }

    BOOL IsFirstTabPosFlag() const  ;   //{ return bHasFirstTabPos; }
    void SetFirstTabPosFlag( BOOL b );  //{ bHasFirstTabPos = b; }

    BOOL IsGenerateTabPos() const       { return bGenerateTabPos; }
    void SetGenerateTabPos( BOOL b )    { bGenerateTabPos = b; }

    BOOL IsRelTabPos() const    {   return bIsRelTabPos; }
    void SetRelTabPos( BOOL b ) {   bIsRelTabPos = b;       }

    BOOL IsCommaSeparated() const       { return bCommaSeparated;}
    void SetCommaSeparated( BOOL b)     { bCommaSeparated = b;}

    static USHORT GetFormMaxLevel( USHORT nType );

    static const sal_Char*  aFormEntry;             // <E>
    static BYTE nFormEntryLen;                      // 3 Zeichen
    static const sal_Char*  aFormTab;               // <T>
    static BYTE nFormTabLen;                        // 3 Zeichen
    static const sal_Char*  aFormPageNums;          // <P>
    static BYTE nFormPageNumsLen;                   // 3 Zeichen
    static const sal_Char* aFormLinkStt;            // <LS>
    static BYTE nFormLinkSttLen;                    // 4 Zeichen
    static const sal_Char* aFormLinkEnd;            // <LE>
    static BYTE nFormLinkEndLen;                    // 4 Zeichen
    static const sal_Char*  aFormEntryNum;          // <E#>
    static BYTE nFormEntryNumLen;                   // 4 Zeichen
    static const sal_Char*  aFormEntryTxt;          // <ET>
    static BYTE nFormEntryTxtLen;                   // 4 Zeichen
    static const sal_Char*  aFormChapterMark;       // <C>
    static BYTE nFormChapterMarkLen;                // 3 Zeichen
    static const sal_Char*  aFormText;              // <TX>
    static BYTE nFormTextLen;                       // 4 Zeichen
    static const sal_Char*  aFormAuth;              // <Axx> xx - decimal enum value
    static BYTE nFormAuthLen;                       // 3 chars
};

/*--------------------------------------------------------------------
     Beschreibung: Inhalte aus denen Verzeichnisse generiert werden
 --------------------------------------------------------------------*/

enum SwTOXElement
{
    TOX_MARK            = 1,
    TOX_OUTLINELEVEL    = 2,
    TOX_TEMPLATE        = 4,
    TOX_OLE             = 8,
    TOX_TABLE           = 16,
    TOX_GRAPHIC         = 32,
    TOX_FRAME           = 64,
    TOX_SEQUENCE        = 128
};

enum SwTOIOptions
{
    TOI_SAME_ENTRY          = 1,
    TOI_FF                  = 2,
    TOI_CASE_SENSITIVE      = 4,
    TOI_KEY_AS_ENTRY        = 8,
    TOI_ALPHA_DELIMITTER    = 16,
    TOI_DASH                = 32,
    TOI_INITIAL_CAPS        = 64
};

//which part of the caption is to be displayed
enum SwCaptionDisplay
{
    CAPTION_COMPLETE,
    CAPTION_NUMBER,
    CAPTION_TEXT
};

enum SwTOOElements
{
    TOO_MATH        = 0x01,
    TOO_CHART       = 0x02,
    TOO_CALC        = 0x08,
    TOO_DRAW_IMPRESS= 0x10,
//  TOO_IMPRESS     = 0x20,

    TOO_OTHER       = 0x80
};

#define TOX_STYLE_DELIMITER ((sal_Unicode)0x01)     //JP 19.07.00: use a control char

/*--------------------------------------------------------------------
     Beschreibung:  Klasse aller  Verzeichnisse
 --------------------------------------------------------------------*/

class SwTOXBase : public SwClient
{
    // not implemented
    SwTOXBase&          operator=(const SwTOXBase& rSource);

//protected:

    SwForm      aForm;              // Aussehen  der Eintragzeile
    String      aName;              // unique name
    String      aTitle;             // Der Verzeichnistitel

    String      sMainEntryCharStyle; // name of the character style applied to main index entries

    String      aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
    String      sSequenceName;      // FieldTypeName of a caption sequence

    union {
        USHORT      nLevel;             // Gliederungsebenen beachten
        USHORT      nOptions;           // Optionen fuer Index
    } aData;

    USHORT      nCreateType;        // Quellen aus dem das Verzeichnis generiert wird
    USHORT      nOLEOptions;        // OLE sources
    SwCaptionDisplay eCaptionDisplay;   //
    BOOL        bProtected : 1;         // index protected ?
    BOOL        bFromChapter : 1;       // create from chapter or document
    BOOL        bFromObjectNames : 1;   // create a table or object index
                                    // from the names rather than the caption
    BOOL        bLevelFromChapter : 1; // User index: get the level from the source chapter
public:
    SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
               USHORT nCreaType, const String& rTitle );
    SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = 0 );
    virtual ~SwTOXBase();

    virtual BOOL GetInfo( SfxPoolItem& rInfo ) const;

    // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
    // If not, so create it an copy all other used things. The return is this
    SwTOXBase& CopyTOXBase( SwDoc*, const SwTOXBase& );

    const SwTOXType*    GetTOXType() const; //

    USHORT              GetCreateType() const;      // Aus Inhaltsformen generieren

    const String&       GetTOXName() const {return aName;}
    void                SetTOXName(const String& rSet) {aName = rSet;}

    const String&       GetTitle() const;           // Titel des Verzeichnisses
    const String&       GetTypeName() const;        // Name des Verzeichnisses
    const SwForm&       GetTOXForm() const;         // Aussehen der Zeile

    void                SetCreate(USHORT);
    void                SetTitle(const String& rTitle);
    void                SetTOXForm(const SwForm& rForm);

    TOXTypes            GetType() const;

    const String&       GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
    void                SetMainEntryCharStyle(const String& rSet)  {sMainEntryCharStyle = rSet;}

    // Inhaltsverzeichnis - spezifisch
    inline void             SetLevel(USHORT);                   // Gliederungsebene beachten
    inline USHORT           GetLevel() const;

    // Index - spezifisch
    inline USHORT           GetOptions() const;                 // Optionen fuer Index
    inline void             SetOptions(USHORT nOpt);

    // index of objects
    USHORT      GetOLEOptions() const {return nOLEOptions;}
    void        SetOLEOptions(USHORT nOpt) {nOLEOptions = nOpt;}

    // index of objects

    // Benutzerverzeichnis - spezifisch
    inline void             SetTemplateName(const String& rName); // Absatzlayout beachten
    inline String           GetTemplateName() const;

    const String&           GetStyleNames(USHORT nLevel) const
                                {
                                DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
                                return aStyleNames[nLevel];
                                }
    void                    SetStyleNames(const String& rSet, USHORT nLevel)
                                {
                                DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
                                aStyleNames[nLevel] = rSet;
                                }
    BOOL                    HasAnyStyleNames() const;

    BOOL                    IsFromChapter() const { return bFromChapter;}
    void                    SetFromChapter(BOOL bSet) { bFromChapter = bSet;}

    BOOL                    IsFromObjectNames() const {return bFromObjectNames;}
    void                    SetFromObjectNames(BOOL bSet) {bFromObjectNames = bSet;}

    BOOL                    IsLevelFromChapter() const {return bLevelFromChapter;}
    void                    SetLevelFromChapter(BOOL bSet) {bLevelFromChapter = bSet;}

    BOOL                    IsProtected() const { return bProtected; }
    void                    SetProtected(BOOL bSet) { bProtected = bSet; }

    const String&           GetSequenceName() const {return sSequenceName;}
    void                    SetSequenceName(const String& rSet) {sSequenceName = rSet;}

    SwCaptionDisplay        GetCaptionDisplay() const { return eCaptionDisplay;}
    void                    SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}

    BOOL                    IsTOXBaseInReadonly() const;

    const SfxItemSet*       GetAttrSet() const;
    void                    SetAttrSet( const SfxItemSet& );

    static const String&    GetTOXName(TOXTypes eType);           // toxmgr.cxx

};


/*--------------------------------------------------------------------
     Beschreibung:  Inlines
 --------------------------------------------------------------------*/

//
//SwTOXMark
//
inline const String& SwTOXMark::GetAlternativeText() const
    {   return aAltText;    }

inline const SwTOXType* SwTOXMark::GetTOXType() const
    { return (SwTOXType*)GetRegisteredIn(); }

inline BOOL SwTOXMark::IsAlternativeText() const
    { return aAltText.Len() > 0; }

inline void SwTOXMark::SetAlternativeText(const String& rAlt)
{
    aAltText = rAlt;
}

inline void SwTOXMark::SetLevel( USHORT nLvl )
{
    ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
    nLevel = nLvl;
}

inline void SwTOXMark::SetPrimaryKey( const String& rKey )
{
    ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
    aPrimaryKey = rKey;
}

inline void SwTOXMark::SetSecondaryKey( const String& rKey )
{
    ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
    aSecondaryKey = rKey;
}

inline USHORT SwTOXMark::GetLevel() const
{
    ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
    return nLevel;
}

inline const String& SwTOXMark::GetPrimaryKey() const
{
    ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
    return aPrimaryKey;
}

inline const String& SwTOXMark::GetSecondaryKey() const
{
    ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
    return aSecondaryKey;
}


//
//SwForm
//
inline void SwForm::SetTemplate(USHORT nLevel, const String& rName)
{
    ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
    aTemplate[nLevel] = rName;
}

inline void SwForm::SetPattern(USHORT nLevel, const String& rName)
{
    ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
    aPattern[nLevel] = rName;
}

inline const String& SwForm::GetPattern(USHORT nLevel) const
{
    ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
    return aPattern[nLevel];
}

inline const String& SwForm::GetTemplate(USHORT nLevel) const
{
    ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
    return aTemplate[nLevel];
}

inline USHORT SwForm::GetTOXType() const
{
    return nType;
}

inline USHORT SwForm::GetFormMax() const
{
    return nFormMaxLevel;
}


//
//SwTOXType
//
inline const String& SwTOXType::GetTypeName() const
    {   return aName;   }

inline void SwTOXType::SetTypeName(const String& rName)
    {   aName = rName;  }

inline TOXTypes SwTOXType::GetType() const
    {   return eType;   }

//
// SwTOXBase
//
inline const SwTOXType* SwTOXBase::GetTOXType() const
    { return (SwTOXType*)GetRegisteredIn(); }

inline USHORT SwTOXBase::GetCreateType() const
    { return nCreateType; }

inline const String& SwTOXBase::GetTitle() const
    { return aTitle; }

inline const String& SwTOXBase::GetTypeName() const
    { return GetTOXType()->GetTypeName();  }

inline const SwForm& SwTOXBase::GetTOXForm() const
    { return aForm; }

inline void SwTOXBase::SetCreate(USHORT nCreate)
    { nCreateType = nCreate; }

inline void SwTOXBase::SetTitle(const String& rTitle)
    {   aTitle = rTitle; }

inline void SwTOXBase::SetTOXForm(const SwForm& rForm)
    {  aForm = rForm; }

inline TOXTypes SwTOXBase::GetType() const
    { return GetTOXType()->GetType(); }

inline void SwTOXBase::SetLevel(USHORT nLev)
{
    ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
    aData.nLevel = nLev;
}

inline USHORT SwTOXBase::GetLevel() const
{
    ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
    return aData.nLevel;
}

inline void SwTOXBase::SetTemplateName(const String& rName)
{
//  ASSERT(GetTOXType()->GetType() == TOX_USER, "Falscher Feldtyp");
//  ASSERT(aData.pTemplateName, "pTemplateName == 0");
//  (*aData.pTemplateName) = rName;
    DBG_WARNING("SwTOXBase::SetTemplateName obsolete")
    aStyleNames[0] = rName;

}

inline String SwTOXBase::GetTemplateName() const
{
//  ASSERT(GetTOXType()->GetType() == TOX_USER, "Falscher Feldtyp");
//  return *aData.pTemplateName;
    DBG_WARNING("SwTOXBase::GetTemplateName obsolete")
    return aStyleNames[0].GetToken(0, TOX_STYLE_DELIMITER);
}

inline USHORT SwTOXBase::GetOptions() const
{
    ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
    return aData.nOptions;
}

inline void SwTOXBase::SetOptions(USHORT nOpt)
{
    ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
    aData.nOptions = nOpt;
}


#endif  // _TOX_HXX