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