xref: /trunk/main/sw/inc/tox.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef SW_TOX_HXX
28 #define SW_TOX_HXX
29 
30 #include <cppuhelper/weakref.hxx>
31 
32 #include <i18npool/lang.h>
33 #include <tools/string.hxx>
34 
35 #include <editeng/svxenum.hxx>
36 #include <svl/svarray.hxx>
37 #include <svl/poolitem.hxx>
38 #include "swdllapi.h"
39 #include <swtypes.hxx>
40 #include <toxe.hxx>
41 #include <calbck.hxx>
42 #include <errhdl.hxx>
43 
44 #ifndef INCLUDED_VECTOR
45 #include <vector> // #i21237#
46 #define INCLUDED_VECTOR
47 #endif
48 
49 
50 namespace com { namespace sun { namespace star {
51     namespace text { class XDocumentIndexMark; }
52 } } }
53 
54 class SwTOXType;
55 class SwTOXMark;
56 class SwTxtTOXMark;
57 class SwDoc;
58 
59 SV_DECL_PTRARR(SwTOXMarks, SwTOXMark*, 0, 10)
60 
61 /*--------------------------------------------------------------------
62      Description:  Entry of content index, alphabetical index or user defined index
63  --------------------------------------------------------------------*/
64 
65 #define IVER_TOXMARK_STRPOOL ((sal_uInt16)1)
66 #define IVER_TOXMARK_NEWTOX ((sal_uInt16)2)
67 
68 class SW_DLLPUBLIC SwTOXMark
69     : public SfxPoolItem
70     , public SwModify
71 {
72     friend void _InitCore();
73     friend class SwTxtTOXMark;
74 
75     String aAltText;    // Der Text des Eintrages ist unterschiedlich
76     String aPrimaryKey, aSecondaryKey;
77 
78     // three more strings for phonetic sorting
79     String aTextReading;
80     String aPrimaryKeyReading;
81     String aSecondaryKeyReading;
82 
83     SwTxtTOXMark* pTxtAttr;
84 
85     sal_uInt16  nLevel;
86     sal_Bool    bAutoGenerated : 1;     // generated using a concordance file
87     sal_Bool    bMainEntry : 1;         // main entry emphasized by character style
88 
89     ::com::sun::star::uno::WeakReference<
90         ::com::sun::star::text::XDocumentIndexMark> m_wXDocumentIndexMark;
91 
92     SwTOXMark();                    // to create the dflt. atr. in _InitCore
93 
94 protected:
95     // SwClient
96    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
97 
98 public:
99     TYPEINFO();   // rtti
100 
101     // single argument ctors shall be explicit.
102     explicit SwTOXMark( const SwTOXType* pTyp );
103     virtual ~SwTOXMark();
104 
105     SwTOXMark( const SwTOXMark& rCopy );
106     SwTOXMark& operator=( const SwTOXMark& rCopy );
107 
108     // "pure virtual methods" of SfxPoolItem
109     virtual int             operator==( const SfxPoolItem& ) const;
110     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
111 
112     void InvalidateTOXMark();
113 
114     String                  GetText() const;
115 
116     inline sal_Bool             IsAlternativeText() const;
117     inline const String&    GetAlternativeText() const;
118 
119     inline void             SetAlternativeText( const String& rAlt );
120 
121     // content or user defined index
122     inline void             SetLevel(sal_uInt16 nLevel);
123     inline sal_uInt16           GetLevel() const;
124 
125     // for alphabetical index only
126     inline void             SetPrimaryKey(const String& rStr );
127     inline void             SetSecondaryKey(const String& rStr);
128     inline void             SetTextReading(const String& rStr);
129     inline void             SetPrimaryKeyReading(const String& rStr );
130     inline void             SetSecondaryKeyReading(const String& rStr);
131 
132     inline const String&    GetPrimaryKey() const;
133     inline const String&    GetSecondaryKey() const;
134     inline const String&    GetTextReading() const;
135     inline const String&    GetPrimaryKeyReading() const;
136     inline const String&    GetSecondaryKeyReading() const;
137 
138     sal_Bool                    IsAutoGenerated() const {return bAutoGenerated;}
139     void                    SetAutoGenerated(sal_Bool bSet) {bAutoGenerated = bSet;}
140 
141     sal_Bool                    IsMainEntry() const {return bMainEntry;}
142     void                    SetMainEntry(sal_Bool bSet) { bMainEntry = bSet;}
143 
144     inline const SwTOXType*    GetTOXType() const;
145 
146     const SwTxtTOXMark* GetTxtTOXMark() const   { return pTxtAttr; }
147           SwTxtTOXMark* GetTxtTOXMark()         { return pTxtAttr; }
148 
149     SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
150         ::com::sun::star::text::XDocumentIndexMark> const& GetXTOXMark() const
151             { return m_wXDocumentIndexMark; }
152     SW_DLLPRIVATE void SetXTOXMark(::com::sun::star::uno::Reference<
153                     ::com::sun::star::text::XDocumentIndexMark> const& xMark)
154             { m_wXDocumentIndexMark = xMark; }
155     void DeRegister() { GetRegisteredInNonConst()->Remove( this ); }
156     void RegisterToTOXType( SwTOXType& rMark );
157     static void InsertTOXMarks( SwTOXMarks& aMarks, const SwTOXType& rType );
158 };
159 
160 /*--------------------------------------------------------------------
161      Description:  index types
162  --------------------------------------------------------------------*/
163 
164 class SwTOXType : public SwModify
165 {
166 public:
167     SwTOXType(TOXTypes eTyp, const String& aName);
168 
169     // @@@ public copy ctor, but no copy assignment?
170     SwTOXType(const SwTOXType& rCopy);
171 
172     inline  const String&   GetTypeName() const;
173     inline TOXTypes         GetType() const;
174 
175 private:
176     String          aName;
177     TOXTypes        eType;
178 
179     // @@@ public copy ctor, but no copy assignment?
180     SwTOXType & operator= (const SwTOXType &);
181 };
182 
183 /*--------------------------------------------------------------------
184      Description:  Structure of the index lines
185  --------------------------------------------------------------------*/
186 
187 #define FORM_TITLE              0
188 #define FORM_ALPHA_DELIMITTER   1
189 #define FORM_PRIMARY_KEY        2
190 #define FORM_SECONDARY_KEY      3
191 #define FORM_ENTRY              4
192 
193 /*
194  Pattern structure
195 
196  <E#> - entry number                    <E# CharStyleName,PoolId>
197  <ET> - entry text                      <ET CharStyleName,PoolId>
198  <E>  - entry text and number           <E CharStyleName,PoolId>
199  <T>  - tab stop                        <T,,Position,Adjust>
200  <C>  - chapter info n = {0, 1, 2, 3, 4 } values of SwChapterFormat <C CharStyleName,PoolId>
201  <TX> - text token                      <X CharStyleName,PoolId, TOX_STYLE_DELIMITERTextContentTOX_STYLE_DELIMITER>
202  <#>  - Page number                     <# CharStyleName,PoolId>
203  <LS> - Link start                      <LS>
204  <LE> - Link end                        <LE>
205  <A00> - Authority entry field          <A02 CharStyleName, PoolId>
206  */
207 
208 // These enum values are stored and must not be changed!
209 enum FormTokenType
210 {
211     TOKEN_ENTRY_NO,
212     TOKEN_ENTRY_TEXT,
213     TOKEN_ENTRY,
214     TOKEN_TAB_STOP,
215     TOKEN_TEXT,
216     TOKEN_PAGE_NUMS,
217     TOKEN_CHAPTER_INFO,
218     TOKEN_LINK_START,
219     TOKEN_LINK_END,
220     TOKEN_AUTHORITY,
221     TOKEN_END
222 };
223 
224 struct SW_DLLPUBLIC SwFormToken
225 {
226     String          sText;
227     String          sCharStyleName;
228     SwTwips         nTabStopPosition;
229     FormTokenType   eTokenType;
230     sal_uInt16          nPoolId;
231     SvxTabAdjust    eTabAlign;
232     sal_uInt16          nChapterFormat;     //SwChapterFormat;
233     sal_uInt16          nOutlineLevel;//the maximum permitted outline level in numbering
234     sal_uInt16          nAuthorityField;    //enum ToxAuthorityField
235     sal_Unicode     cTabFillChar;
236     sal_Bool        bWithTab;      // sal_True: do generate tab
237                                    // character only the tab stop
238                                    // #i21237#
239 
240     SwFormToken(FormTokenType eType ) :
241         nTabStopPosition(0),
242         eTokenType(eType),
243         nPoolId(USHRT_MAX),
244         eTabAlign( SVX_TAB_ADJUST_LEFT ),
245         nChapterFormat(0 /*CF_NUMBER*/),
246         nOutlineLevel(MAXLEVEL),   //default to maximum outline level
247         nAuthorityField(0 /*AUTH_FIELD_IDENTIFIER*/),
248         cTabFillChar(' '),
249         bWithTab(sal_True)  // #i21237#
250     {}
251 
252     String GetString() const;
253 };
254 
255 // -> #i21237#
256 /**
257     Functor that is true when a given token has a certain token type.
258 
259     @param _eType  the type to check for
260     @param rToken  the token to check
261 
262     @retval sal_True   the token has the given type
263     @retval sal_False  else
264 */
265 struct SwFormTokenEqualToFormTokenType
266 {
267     FormTokenType eType;
268 
269     SwFormTokenEqualToFormTokenType(FormTokenType _eType) : eType(_eType) {}
270     bool operator()(const SwFormToken & rToken)
271     {
272         return rToken.eTokenType == eType;
273     }
274 };
275 
276 /**
277    Functor that appends the string representation of a given token to a string.
278 
279    @param _rText    string to append the string representation to
280    @param rToken    token whose string representation is appended
281 */
282 struct SwFormTokenToString
283 {
284     String & rText;
285     SwFormTokenToString(String & _rText) : rText(_rText) {}
286     void operator()(const SwFormToken & rToken) { rText += rToken.GetString(); }
287 };
288 
289 /// Vector of tokens.
290 typedef std::vector<SwFormToken> SwFormTokens;
291 
292 /**
293    Helper class that converts vectors of tokens to strings and vice
294    versa.
295  */
296 class SW_DLLPUBLIC SwFormTokensHelper
297 {
298     /// the tokens
299     SwFormTokens aTokens;
300 
301     /**
302        Builds a token from its string representation.
303 
304        @sPattern          the whole pattern
305        @nCurPatternPos    starting position of the token
306 
307        @return the token
308      */
309     SW_DLLPRIVATE SwFormToken BuildToken( const String & sPattern,
310                                           xub_StrLen & nCurPatternPos ) const;
311 
312     /**
313        Returns the string of a token.
314 
315        @param sPattern    the whole pattern
316        @param nStt        starting position of the token
317 
318        @return   the string representation of the token
319     */
320     SW_DLLPRIVATE String SearchNextToken( const String & sPattern,
321                                           xub_StrLen nStt ) const;
322 
323     /**
324        Returns the type of a token.
325 
326        @param sToken     the string representation of the token
327        @param pTokenLen  return parameter the length of the head of the token
328 
329        If pTokenLen is non-NULL the length of the token's head is
330        written to *pTokenLen
331 
332        @return the type of the token
333     */
334     SW_DLLPRIVATE FormTokenType GetTokenType(const String & sToken,
335                                              xub_StrLen * pTokenLen) const;
336 
337 public:
338     /**
339        contructor
340 
341        @param rTokens       vector of tokens
342     */
343     SwFormTokensHelper(const SwFormTokens & rTokens) : aTokens(rTokens) {}
344 
345     /**
346        constructor
347 
348        @param rStr   string representation of the tokens
349     */
350     SwFormTokensHelper(const String & rStr);
351 
352     /**
353        Returns vector of tokens.
354 
355        @return vector of tokens
356     */
357     const SwFormTokens & GetTokens() const { return aTokens; }
358 };
359 // <- #i21237#
360 
361 class SW_DLLPUBLIC SwForm
362 {
363     SwFormTokens    aPattern[ AUTH_TYPE_END + 1 ]; // #i21237#
364     String  aTemplate[ AUTH_TYPE_END + 1 ];
365 
366     TOXTypes    eType;
367     sal_uInt16      nFormMaxLevel;
368 
369     //sal_uInt16    nFirstTabPos; -> Value in tab token
370 //  sal_Bool    bHasFirstTabPos : 1;
371     sal_Bool    bGenerateTabPos : 1;
372     sal_Bool    bIsRelTabPos : 1;
373     sal_Bool    bCommaSeparated : 1;
374 
375 public:
376     SwForm( TOXTypes eTOXType = TOX_CONTENT );
377     SwForm( const SwForm& rForm );
378 
379     SwForm& operator=( const SwForm& rForm );
380 
381     inline void SetTemplate(sal_uInt16 nLevel, const String& rName);
382     inline const String&    GetTemplate(sal_uInt16 nLevel) const;
383 
384     // #i21237#
385     void    SetPattern(sal_uInt16 nLevel, const SwFormTokens& rName);
386     void    SetPattern(sal_uInt16 nLevel, const String& rStr);
387     const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
388 
389     // fill tab stop positions from template to pattern
390     // #i21237#
391     void                    AdjustTabStops(SwDoc& rDoc,
392                                            sal_Bool bInsertNewTabStops = sal_False);
393 
394     inline TOXTypes GetTOXType() const;
395     inline sal_uInt16   GetFormMax() const;
396 
397     sal_Bool IsRelTabPos() const    {   return bIsRelTabPos; }
398     void SetRelTabPos( sal_Bool b ) {   bIsRelTabPos = b;       }
399 
400     sal_Bool IsCommaSeparated() const       { return bCommaSeparated;}
401     void SetCommaSeparated( sal_Bool b)     { bCommaSeparated = b;}
402 
403     static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
404 
405     static const sal_Char*  aFormEntry;             // <E>
406     static sal_uInt8 nFormEntryLen;                      // 3 characters
407     static const sal_Char*  aFormTab;               // <T>
408     static sal_uInt8 nFormTabLen;                        // 3 characters
409     static const sal_Char*  aFormPageNums;          // <P>
410     static sal_uInt8 nFormPageNumsLen;                   // 3 characters
411     static const sal_Char* aFormLinkStt;            // <LS>
412     static sal_uInt8 nFormLinkSttLen;                    // 4 characters
413     static const sal_Char* aFormLinkEnd;            // <LE>
414     static sal_uInt8 nFormLinkEndLen;                    // 4 characters
415     static const sal_Char*  aFormEntryNum;          // <E#>
416     static sal_uInt8 nFormEntryNumLen;                   // 4 characters
417     static const sal_Char*  aFormEntryTxt;          // <ET>
418     static sal_uInt8 nFormEntryTxtLen;                   // 4 characters
419     static const sal_Char*  aFormChapterMark;       // <C>
420     static sal_uInt8 nFormChapterMarkLen;                // 3 characters
421     static const sal_Char*  aFormText;              // <TX>
422     static sal_uInt8 nFormTextLen;                       // 4 characters
423     static const sal_Char*  aFormAuth;              // <Axx> xx - decimal enum value
424     static sal_uInt8 nFormAuthLen;                       // 3 characters
425 };
426 
427 /*--------------------------------------------------------------------
428      Description: Content to create indexes of
429  --------------------------------------------------------------------*/
430 
431 typedef sal_uInt16 SwTOXElement;
432 namespace nsSwTOXElement
433 {
434     const SwTOXElement TOX_MARK             = 1;
435     const SwTOXElement TOX_OUTLINELEVEL     = 2;
436     const SwTOXElement TOX_TEMPLATE         = 4;
437     const SwTOXElement TOX_OLE              = 8;
438     const SwTOXElement TOX_TABLE            = 16;
439     const SwTOXElement TOX_GRAPHIC          = 32;
440     const SwTOXElement TOX_FRAME            = 64;
441     const SwTOXElement TOX_SEQUENCE         = 128;
442 }
443 
444 typedef sal_uInt16 SwTOIOptions;
445 namespace nsSwTOIOptions
446 {
447     const SwTOIOptions TOI_SAME_ENTRY       = 1;
448     const SwTOIOptions TOI_FF               = 2;
449     const SwTOIOptions TOI_CASE_SENSITIVE   = 4;
450     const SwTOIOptions TOI_KEY_AS_ENTRY     = 8;
451     const SwTOIOptions TOI_ALPHA_DELIMITTER = 16;
452     const SwTOIOptions TOI_DASH             = 32;
453     const SwTOIOptions TOI_INITIAL_CAPS     = 64;
454 }
455 
456 //which part of the caption is to be displayed
457 enum SwCaptionDisplay
458 {
459     CAPTION_COMPLETE,
460     CAPTION_NUMBER,
461     CAPTION_TEXT
462 };
463 
464 typedef sal_uInt16 SwTOOElements;
465 namespace nsSwTOOElements
466 {
467     const SwTOOElements TOO_MATH            = 0x01;
468     const SwTOOElements TOO_CHART           = 0x02;
469     const SwTOOElements TOO_CALC            = 0x08;
470     const SwTOOElements TOO_DRAW_IMPRESS    = 0x10;
471 //  const SwTOOElements TOO_IMPRESS         = 0x20;
472     const SwTOOElements TOO_OTHER           = 0x80;
473 }
474 
475 #define TOX_STYLE_DELIMITER ((sal_Unicode)0x01)     //JP 19.07.00: use a control char
476 
477 /*--------------------------------------------------------------------
478      Description:  Class for all indexes
479  --------------------------------------------------------------------*/
480 
481 class SW_DLLPUBLIC SwTOXBase : public SwClient
482 {
483     SwForm      aForm;              // description of the lines
484     String      aName;              // unique name
485     String      aTitle;             // title
486 
487     String      sMainEntryCharStyle; // name of the character style applied to main index entries
488 
489     String      aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
490     String      sSequenceName;      // FieldTypeName of a caption sequence
491 
492     LanguageType    eLanguage;
493     String          sSortAlgorithm;
494 
495     union {
496         sal_uInt16      nLevel;             // consider outline levels
497         sal_uInt16      nOptions;           // options of alphabetical index
498     } aData;
499 
500     sal_uInt16      nCreateType;        // sources to create the index from
501     sal_uInt16      nOLEOptions;        // OLE sources
502     SwCaptionDisplay eCaptionDisplay;   //
503     sal_Bool        bProtected : 1;         // index protected ?
504     sal_Bool        bFromChapter : 1;       // create from chapter or document
505     sal_Bool        bFromObjectNames : 1;   // create a table or object index
506                                     // from the names rather than the caption
507     sal_Bool        bLevelFromChapter : 1; // User index: get the level from the source chapter
508 public:
509     SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
510                sal_uInt16 nCreaType, const String& rTitle );
511     SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = 0 );
512     virtual ~SwTOXBase();
513 
514     virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
515 
516     // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
517     // If not, so create it an copy all other used things. The return is this
518     SwTOXBase& CopyTOXBase( SwDoc*, const SwTOXBase& );
519 
520     const SwTOXType*    GetTOXType() const; //
521 
522     sal_uInt16              GetCreateType() const;      // creation types
523 
524     const String&       GetTOXName() const {return aName;}
525     void                SetTOXName(const String& rSet) {aName = rSet;}
526 
527     const String&       GetTitle() const;           // Title
528     const String&       GetTypeName() const;        // Name
529     const SwForm&       GetTOXForm() const;         // description of the lines
530 
531     void                SetCreate(sal_uInt16);
532     void                SetTitle(const String& rTitle);
533     void                SetTOXForm(const SwForm& rForm);
534 
535     TOXTypes            GetType() const;
536 
537     const String&       GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
538     void                SetMainEntryCharStyle(const String& rSet)  {sMainEntryCharStyle = rSet;}
539 
540     // content index only
541     inline void             SetLevel(sal_uInt16);                   // consider outline level
542     inline sal_uInt16           GetLevel() const;
543 
544     // alphabetical index only
545     inline sal_uInt16           GetOptions() const;                 // alphabetical index options
546     inline void             SetOptions(sal_uInt16 nOpt);
547 
548     // index of objects
549     sal_uInt16      GetOLEOptions() const {return nOLEOptions;}
550     void        SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;}
551 
552     // index of objects
553 
554     // user defined index only
555     inline void             SetTemplateName(const String& rName); // Absatzlayout beachten
556 
557     const String&           GetStyleNames(sal_uInt16 nLevel) const
558                                 {
559                                 DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
560                                 return aStyleNames[nLevel];
561                                 }
562     void                    SetStyleNames(const String& rSet, sal_uInt16 nLevel)
563                                 {
564                                 DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
565                                 aStyleNames[nLevel] = rSet;
566                                 }
567     sal_Bool                    IsFromChapter() const { return bFromChapter;}
568     void                    SetFromChapter(sal_Bool bSet) { bFromChapter = bSet;}
569 
570     sal_Bool                    IsFromObjectNames() const {return bFromObjectNames;}
571     void                    SetFromObjectNames(sal_Bool bSet) {bFromObjectNames = bSet;}
572 
573     sal_Bool                    IsLevelFromChapter() const {return bLevelFromChapter;}
574     void                    SetLevelFromChapter(sal_Bool bSet) {bLevelFromChapter = bSet;}
575 
576     sal_Bool                    IsProtected() const { return bProtected; }
577     void                    SetProtected(sal_Bool bSet) { bProtected = bSet; }
578 
579     const String&           GetSequenceName() const {return sSequenceName;}
580     void                    SetSequenceName(const String& rSet) {sSequenceName = rSet;}
581 
582     SwCaptionDisplay        GetCaptionDisplay() const { return eCaptionDisplay;}
583     void                    SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
584 
585     sal_Bool                    IsTOXBaseInReadonly() const;
586 
587     const SfxItemSet*       GetAttrSet() const;
588     void                    SetAttrSet( const SfxItemSet& );
589 
590     LanguageType    GetLanguage() const {return eLanguage;}
591     void            SetLanguage(LanguageType nLang)  {eLanguage = nLang;}
592 
593     const String&   GetSortAlgorithm()const {return sSortAlgorithm;}
594     void            SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
595     // #i21237#
596     void AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop);
597     SwTOXBase&          operator=(const SwTOXBase& rSource);
598     void RegisterToTOXType( SwTOXType& rMark );
599 };
600 
601 
602 /*--------------------------------------------------------------------
603      Description:  Inlines
604  --------------------------------------------------------------------*/
605 
606 //
607 //SwTOXMark
608 //
609 inline const String& SwTOXMark::GetAlternativeText() const
610     {   return aAltText;    }
611 
612 inline const SwTOXType* SwTOXMark::GetTOXType() const
613     { return (SwTOXType*)GetRegisteredIn(); }
614 
615 inline sal_Bool SwTOXMark::IsAlternativeText() const
616     { return aAltText.Len() > 0; }
617 
618 inline void SwTOXMark::SetAlternativeText(const String& rAlt)
619 {
620     aAltText = rAlt;
621 }
622 
623 inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
624 {
625     ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
626     nLevel = nLvl;
627 }
628 
629 inline void SwTOXMark::SetPrimaryKey( const String& rKey )
630 {
631     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
632     aPrimaryKey = rKey;
633 }
634 
635 inline void SwTOXMark::SetSecondaryKey( const String& rKey )
636 {
637     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
638     aSecondaryKey = rKey;
639 }
640 
641 inline void SwTOXMark::SetTextReading( const String& rTxt )
642 {
643     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
644     aTextReading = rTxt;
645 }
646 
647 inline void SwTOXMark::SetPrimaryKeyReading( const String& rKey )
648 {
649     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
650     aPrimaryKeyReading = rKey;
651 }
652 
653 inline void SwTOXMark::SetSecondaryKeyReading( const String& rKey )
654 {
655     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
656     aSecondaryKeyReading = rKey;
657 }
658 
659 inline sal_uInt16 SwTOXMark::GetLevel() const
660 {
661     ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
662     return nLevel;
663 }
664 
665 inline const String& SwTOXMark::GetPrimaryKey() const
666 {
667     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
668     return aPrimaryKey;
669 }
670 
671 inline const String& SwTOXMark::GetSecondaryKey() const
672 {
673     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
674     return aSecondaryKey;
675 }
676 
677 inline const String& SwTOXMark::GetTextReading() const
678 {
679     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
680     return aTextReading;
681 }
682 
683 inline const String& SwTOXMark::GetPrimaryKeyReading() const
684 {
685     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
686     return aPrimaryKeyReading;
687 }
688 
689 inline const String& SwTOXMark::GetSecondaryKeyReading() const
690 {
691     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
692     return aSecondaryKeyReading;
693 }
694 
695 //
696 //SwForm
697 //
698 inline void SwForm::SetTemplate(sal_uInt16 nLevel, const String& rTemplate)
699 {
700     ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
701     aTemplate[nLevel] = rTemplate;
702 }
703 
704 inline const String& SwForm::GetTemplate(sal_uInt16 nLevel) const
705 {
706     ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
707     return aTemplate[nLevel];
708 }
709 
710 inline TOXTypes SwForm::GetTOXType() const
711 {
712     return eType;
713 }
714 
715 inline sal_uInt16 SwForm::GetFormMax() const
716 {
717     return nFormMaxLevel;
718 }
719 
720 
721 //
722 //SwTOXType
723 //
724 inline const String& SwTOXType::GetTypeName() const
725     {   return aName;   }
726 
727 inline TOXTypes SwTOXType::GetType() const
728     {   return eType;   }
729 
730 //
731 // SwTOXBase
732 //
733 inline const SwTOXType* SwTOXBase::GetTOXType() const
734     { return (SwTOXType*)GetRegisteredIn(); }
735 
736 inline sal_uInt16 SwTOXBase::GetCreateType() const
737     { return nCreateType; }
738 
739 inline const String& SwTOXBase::GetTitle() const
740     { return aTitle; }
741 
742 inline const String& SwTOXBase::GetTypeName() const
743     { return GetTOXType()->GetTypeName();  }
744 
745 inline const SwForm& SwTOXBase::GetTOXForm() const
746     { return aForm; }
747 
748 inline void SwTOXBase::AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop)
749 {
750     aForm.AdjustTabStops(rDoc, bDefaultRightTabStop);
751 }
752 
753 inline void SwTOXBase::SetCreate(sal_uInt16 nCreate)
754     { nCreateType = nCreate; }
755 
756 inline void SwTOXBase::SetTOXForm(const SwForm& rForm)
757     {  aForm = rForm; }
758 
759 inline TOXTypes SwTOXBase::GetType() const
760     { return GetTOXType()->GetType(); }
761 
762 inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
763 {
764     ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
765     aData.nLevel = nLev;
766 }
767 
768 inline sal_uInt16 SwTOXBase::GetLevel() const
769 {
770     ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
771     return aData.nLevel;
772 }
773 
774 inline void SwTOXBase::SetTemplateName(const String& rName)
775 {
776 //  ASSERT(GetTOXType()->GetType() == TOX_USER, "Falscher Feldtyp");
777 //  ASSERT(aData.pTemplateName, "pTemplateName == 0");
778 //  (*aData.pTemplateName) = rName;
779     DBG_WARNING("SwTOXBase::SetTemplateName obsolete");
780     aStyleNames[0] = rName;
781 
782 }
783 
784 inline sal_uInt16 SwTOXBase::GetOptions() const
785 {
786     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
787     return aData.nOptions;
788 }
789 
790 inline void SwTOXBase::SetOptions(sal_uInt16 nOpt)
791 {
792     ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
793     aData.nOptions = nOpt;
794 }
795 
796 
797 #endif  // SW_TOX_HXX
798