xref: /aoo41x/main/sw/inc/tox.hxx (revision 1d2dbeb0)
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
386     // #i21237#
387 	void					AdjustTabStops(SwDoc& rDoc,
388                                            sal_Bool bInsertNewTabStops = sal_False);
389 
390     inline TOXTypes GetTOXType() const;
391 	inline sal_uInt16	GetFormMax() const;
392 
393     sal_Bool IsRelTabPos() const    {   return bIsRelTabPos; }
394 	void SetRelTabPos( sal_Bool b ) { 	bIsRelTabPos = b;		}
395 
396 	sal_Bool IsCommaSeparated() const 		{ return bCommaSeparated;}
397 	void SetCommaSeparated( sal_Bool b)		{ bCommaSeparated = b;}
398 
399     static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
400 
401 	static const sal_Char*	aFormEntry;				// <E>
402     static sal_uInt8 nFormEntryLen;                      // 3 characters
403 	static const sal_Char*	aFormTab;				// <T>
404     static sal_uInt8 nFormTabLen;                        // 3 characters
405 	static const sal_Char*	aFormPageNums;			// <P>
406     static sal_uInt8 nFormPageNumsLen;                   // 3 characters
407 	static const sal_Char* aFormLinkStt;			// <LS>
408     static sal_uInt8 nFormLinkSttLen;                    // 4 characters
409 	static const sal_Char* aFormLinkEnd;			// <LE>
410     static sal_uInt8 nFormLinkEndLen;                    // 4 characters
411 	static const sal_Char*	aFormEntryNum;			// <E#>
412     static sal_uInt8 nFormEntryNumLen;                   // 4 characters
413 	static const sal_Char*	aFormEntryTxt;			// <ET>
414     static sal_uInt8 nFormEntryTxtLen;                   // 4 characters
415 	static const sal_Char*	aFormChapterMark;		// <C>
416     static sal_uInt8 nFormChapterMarkLen;                // 3 characters
417 	static const sal_Char*	aFormText;				// <TX>
418     static sal_uInt8 nFormTextLen;                       // 4 characters
419 	static const sal_Char*	aFormAuth;				// <Axx> xx - decimal enum value
420     static sal_uInt8 nFormAuthLen;                       // 3 characters
421 };
422 
423 /*--------------------------------------------------------------------
424      Description: Content to create indexes of
425  --------------------------------------------------------------------*/
426 
427 typedef sal_uInt16 SwTOXElement;
428 namespace nsSwTOXElement
429 {
430     const SwTOXElement TOX_MARK             = 1;
431     const SwTOXElement TOX_OUTLINELEVEL     = 2;
432     const SwTOXElement TOX_TEMPLATE         = 4;
433     const SwTOXElement TOX_OLE              = 8;
434     const SwTOXElement TOX_TABLE            = 16;
435     const SwTOXElement TOX_GRAPHIC          = 32;
436     const SwTOXElement TOX_FRAME            = 64;
437     const SwTOXElement TOX_SEQUENCE         = 128;
438 }
439 
440 typedef sal_uInt16 SwTOIOptions;
441 namespace nsSwTOIOptions
442 {
443     const SwTOIOptions TOI_SAME_ENTRY       = 1;
444     const SwTOIOptions TOI_FF               = 2;
445     const SwTOIOptions TOI_CASE_SENSITIVE   = 4;
446     const SwTOIOptions TOI_KEY_AS_ENTRY     = 8;
447     const SwTOIOptions TOI_ALPHA_DELIMITTER = 16;
448     const SwTOIOptions TOI_DASH             = 32;
449     const SwTOIOptions TOI_INITIAL_CAPS     = 64;
450 }
451 
452 //which part of the caption is to be displayed
453 enum SwCaptionDisplay
454 {
455 	CAPTION_COMPLETE,
456 	CAPTION_NUMBER,
457 	CAPTION_TEXT
458 };
459 
460 typedef sal_uInt16 SwTOOElements;
461 namespace nsSwTOOElements
462 {
463     const SwTOOElements TOO_MATH            = 0x01;
464     const SwTOOElements TOO_CHART           = 0x02;
465     const SwTOOElements TOO_CALC            = 0x08;
466     const SwTOOElements TOO_DRAW_IMPRESS    = 0x10;
467 //  const SwTOOElements TOO_IMPRESS         = 0x20;
468     const SwTOOElements TOO_OTHER           = 0x80;
469 }
470 
471 #define TOX_STYLE_DELIMITER ((sal_Unicode)0x01)		//JP 19.07.00: use a control char
472 
473 /*--------------------------------------------------------------------
474      Description:  Class for all indexes
475  --------------------------------------------------------------------*/
476 
477 class SW_DLLPUBLIC SwTOXBase : public SwClient
478 {
479     SwForm      aForm;              // description of the lines
480 	String		aName; 				// unique name
481     String      aTitle;             // title
482 
483 	String 		sMainEntryCharStyle; // name of the character style applied to main index entries
484 
485 	String		aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
486 	String 		sSequenceName;		// FieldTypeName of a caption sequence
487 
488     LanguageType    eLanguage;
489     String          sSortAlgorithm;
490 
491     union {
492         sal_uInt16      nLevel;             // consider outline levels
493         sal_uInt16      nOptions;           // options of alphabetical index
494 	} aData;
495 
496     sal_uInt16      nCreateType;        // sources to create the index from
497 	sal_uInt16		nOLEOptions;		// OLE sources
498 	SwCaptionDisplay eCaptionDisplay;	//
499 	sal_Bool 		bProtected : 1;			// index protected ?
500 	sal_Bool		bFromChapter : 1; 		// create from chapter or document
501 	sal_Bool 		bFromObjectNames : 1; 	// create a table or object index
502 									// from the names rather than the caption
503 	sal_Bool		bLevelFromChapter : 1; // User index: get the level from the source chapter
504 public:
505 	SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
506 			   sal_uInt16 nCreaType, const String& rTitle );
507 	SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = 0 );
508 	virtual ~SwTOXBase();
509 
510 	virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
511 
512 	// a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
513 	// If not, so create it an copy all other used things. The return is this
514 	SwTOXBase& CopyTOXBase( SwDoc*, const SwTOXBase& );
515 
516 	const SwTOXType*	GetTOXType() const;	//
517 
518     sal_uInt16              GetCreateType() const;      // creation types
519 
520 	const String&		GetTOXName() const {return aName;}
521 	void				SetTOXName(const String& rSet) {aName = rSet;}
522 
523     const String&       GetTitle() const;           // Title
524     const String&       GetTypeName() const;        // Name
525     const SwForm&       GetTOXForm() const;         // description of the lines
526 
527 	void 				SetCreate(sal_uInt16);
528 	void				SetTitle(const String& rTitle);
529 	void				SetTOXForm(const SwForm& rForm);
530 
531 	TOXTypes			GetType() const;
532 
533 	const String&		GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
534 	void				SetMainEntryCharStyle(const String& rSet)  {sMainEntryCharStyle = rSet;}
535 
536     // content index only
537     inline void             SetLevel(sal_uInt16);                   // consider outline level
538 	inline sal_uInt16	  		GetLevel() const;
539 
540     // alphabetical index only
541     inline sal_uInt16           GetOptions() const;                 // alphabetical index options
542 	inline void   			SetOptions(sal_uInt16 nOpt);
543 
544 	// index of objects
545 	sal_uInt16 		GetOLEOptions() const {return nOLEOptions;}
546 	void   		SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;}
547 
548 	// index of objects
549 
550     // user defined index only
551 	inline void				SetTemplateName(const String& rName); // Absatzlayout beachten
552 
553 	const String&			GetStyleNames(sal_uInt16 nLevel) const
554 								{
555 								DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
556 								return aStyleNames[nLevel];
557 								}
558 	void					SetStyleNames(const String& rSet, sal_uInt16 nLevel)
559 								{
560 								DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
561 								aStyleNames[nLevel] = rSet;
562 								}
563 	sal_Bool					IsFromChapter() const { return bFromChapter;}
564 	void					SetFromChapter(sal_Bool bSet) { bFromChapter = bSet;}
565 
566 	sal_Bool					IsFromObjectNames() const {return bFromObjectNames;}
567 	void					SetFromObjectNames(sal_Bool bSet) {bFromObjectNames = bSet;}
568 
569 	sal_Bool					IsLevelFromChapter() const {return bLevelFromChapter;}
570 	void					SetLevelFromChapter(sal_Bool bSet) {bLevelFromChapter = bSet;}
571 
572 	sal_Bool					IsProtected() const { return bProtected; }
573 	void					SetProtected(sal_Bool bSet) { bProtected = bSet; }
574 
575 	const String&			GetSequenceName() const {return sSequenceName;}
576 	void					SetSequenceName(const String& rSet) {sSequenceName = rSet;}
577 
578 	SwCaptionDisplay		GetCaptionDisplay() const { return eCaptionDisplay;}
579 	void					SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
580 
581 	sal_Bool 					IsTOXBaseInReadonly() const;
582 
583 	const SfxItemSet*		GetAttrSet() const;
584 	void 					SetAttrSet( const SfxItemSet& );
585 
586     LanguageType    GetLanguage() const {return eLanguage;}
587     void            SetLanguage(LanguageType nLang)  {eLanguage = nLang;}
588 
589     const String&   GetSortAlgorithm()const {return sSortAlgorithm;}
590     void            SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
591     // #i21237#
592     void AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop);
593     SwTOXBase& 			operator=(const SwTOXBase& rSource);
594     void RegisterToTOXType( SwTOXType& rMark );
595 };
596 
597 
598 /*--------------------------------------------------------------------
599      Description:  Inlines
600  --------------------------------------------------------------------*/
601 
602 //
603 //SwTOXMark
604 //
605 inline const String& SwTOXMark::GetAlternativeText() const
606 	{	return aAltText;	}
607 
608 inline const SwTOXType* SwTOXMark::GetTOXType() const
609 	{ return (SwTOXType*)GetRegisteredIn(); }
610 
611 inline sal_Bool SwTOXMark::IsAlternativeText() const
612 	{ return aAltText.Len() > 0; }
613 
614 inline void SwTOXMark::SetAlternativeText(const String& rAlt)
615 {
616 	aAltText = rAlt;
617 }
618 
619 inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
620 {
621 	ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
622 	nLevel = nLvl;
623 }
624 
625 inline void SwTOXMark::SetPrimaryKey( const String& rKey )
626 {
627 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
628 	aPrimaryKey = rKey;
629 }
630 
631 inline void SwTOXMark::SetSecondaryKey( const String& rKey )
632 {
633 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
634 	aSecondaryKey = rKey;
635 }
636 
637 inline void SwTOXMark::SetTextReading( const String& rTxt )
638 {
639 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
640     aTextReading = rTxt;
641 }
642 
643 inline void SwTOXMark::SetPrimaryKeyReading( const String& rKey )
644 {
645 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
646     aPrimaryKeyReading = rKey;
647 }
648 
649 inline void SwTOXMark::SetSecondaryKeyReading( const String& rKey )
650 {
651 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
652     aSecondaryKeyReading = rKey;
653 }
654 
655 inline sal_uInt16 SwTOXMark::GetLevel() const
656 {
657 	ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
658 	return nLevel;
659 }
660 
661 inline const String& SwTOXMark::GetPrimaryKey() const
662 {
663 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
664 	return aPrimaryKey;
665 }
666 
667 inline const String& SwTOXMark::GetSecondaryKey() const
668 {
669 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
670 	return aSecondaryKey;
671 }
672 
673 inline const String& SwTOXMark::GetTextReading() const
674 {
675 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
676     return aTextReading;
677 }
678 
679 inline const String& SwTOXMark::GetPrimaryKeyReading() const
680 {
681 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
682     return aPrimaryKeyReading;
683 }
684 
685 inline const String& SwTOXMark::GetSecondaryKeyReading() const
686 {
687 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
688     return aSecondaryKeyReading;
689 }
690 
691 //
692 //SwForm
693 //
694 inline void SwForm::SetTemplate(sal_uInt16 nLevel, const String& rTemplate)
695 {
696 	ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
697 	aTemplate[nLevel] = rTemplate;
698 }
699 
700 inline const String& SwForm::GetTemplate(sal_uInt16 nLevel) const
701 {
702 	ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
703 	return aTemplate[nLevel];
704 }
705 
706 inline TOXTypes SwForm::GetTOXType() const
707 {
708     return eType;
709 }
710 
711 inline sal_uInt16 SwForm::GetFormMax() const
712 {
713 	return nFormMaxLevel;
714 }
715 
716 
717 //
718 //SwTOXType
719 //
720 inline const String& SwTOXType::GetTypeName() const
721 	{	return aName;	}
722 
723 inline TOXTypes SwTOXType::GetType() const
724 	{	return eType;	}
725 
726 //
727 // SwTOXBase
728 //
729 inline const SwTOXType* SwTOXBase::GetTOXType() const
730 	{ return (SwTOXType*)GetRegisteredIn(); }
731 
732 inline sal_uInt16 SwTOXBase::GetCreateType() const
733 	{ return nCreateType; }
734 
735 inline const String& SwTOXBase::GetTitle() const
736 	{ return aTitle; }
737 
738 inline const String& SwTOXBase::GetTypeName() const
739 	{ return GetTOXType()->GetTypeName();  }
740 
741 inline const SwForm& SwTOXBase::GetTOXForm() const
742 	{ return aForm;	}
743 
744 inline void SwTOXBase::AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop)
745 {
746     aForm.AdjustTabStops(rDoc, bDefaultRightTabStop);
747 }
748 
749 inline void SwTOXBase::SetCreate(sal_uInt16 nCreate)
750 	{ nCreateType = nCreate; }
751 
752 inline void	SwTOXBase::SetTOXForm(const SwForm& rForm)
753 	{  aForm = rForm; }
754 
755 inline TOXTypes SwTOXBase::GetType() const
756 	{ return GetTOXType()->GetType(); }
757 
758 inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
759 {
760 	ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
761 	aData.nLevel = nLev;
762 }
763 
764 inline sal_uInt16 SwTOXBase::GetLevel() const
765 {
766 	ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
767 	return aData.nLevel;
768 }
769 
770 inline void SwTOXBase::SetTemplateName(const String& rName)
771 {
772 //	ASSERT(GetTOXType()->GetType() == TOX_USER, "Falscher Feldtyp");
773 //	ASSERT(aData.pTemplateName, "pTemplateName == 0");
774 //	(*aData.pTemplateName) = rName;
775 	DBG_WARNING("SwTOXBase::SetTemplateName obsolete");
776 	aStyleNames[0] = rName;
777 
778 }
779 
780 inline sal_uInt16 SwTOXBase::GetOptions() const
781 {
782 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
783 	return aData.nOptions;
784 }
785 
786 inline void SwTOXBase::SetOptions(sal_uInt16 nOpt)
787 {
788 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
789 	aData.nOptions = nOpt;
790 }
791 
792 
793 #endif  // SW_TOX_HXX
794