xref: /aoo4110/main/sw/inc/tox.hxx (revision b1cdbd2c)
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 
IsAutoGenerated() const134 	sal_Bool					IsAutoGenerated() const {return bAutoGenerated;}
SetAutoGenerated(sal_Bool bSet)135 	void					SetAutoGenerated(sal_Bool bSet) {bAutoGenerated = bSet;}
136 
IsMainEntry() const137 	sal_Bool					IsMainEntry() const {return bMainEntry;}
SetMainEntry(sal_Bool bSet)138 	void					SetMainEntry(sal_Bool bSet) { bMainEntry = bSet;}
139 
140 	inline const SwTOXType*    GetTOXType() const;
141 
GetTxtTOXMark() const142 	const SwTxtTOXMark* GetTxtTOXMark() const	{ return pTxtAttr; }
GetTxtTOXMark()143 		  SwTxtTOXMark* GetTxtTOXMark() 		{ return pTxtAttr; }
144 
145     SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
GetXTOXMark() const146         ::com::sun::star::text::XDocumentIndexMark> const& GetXTOXMark() const
147             { return m_wXDocumentIndexMark; }
SetXTOXMark(::com::sun::star::uno::Reference<::com::sun::star::text::XDocumentIndexMark> const & xMark)148     SW_DLLPRIVATE void SetXTOXMark(::com::sun::star::uno::Reference<
149                     ::com::sun::star::text::XDocumentIndexMark> const& xMark)
150             { m_wXDocumentIndexMark = xMark; }
DeRegister()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 
SwFormTokenSwFormToken236 	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 
SwFormTokenEqualToFormTokenTypeSwFormTokenEqualToFormTokenType265     SwFormTokenEqualToFormTokenType(FormTokenType _eType) : eType(_eType) {}
operator ()SwFormTokenEqualToFormTokenType266     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;
SwFormTokenToStringSwFormTokenToString281     SwFormTokenToString(String & _rText) : rText(_rText) {}
operator ()SwFormTokenToString282     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     */
SwFormTokensHelper(const SwFormTokens & rTokens)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     */
GetTokens() const353     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 
IsRelTabPos() const393     sal_Bool IsRelTabPos() const    {   return bIsRelTabPos; }
SetRelTabPos(sal_Bool b)394 	void SetRelTabPos( sal_Bool b ) { 	bIsRelTabPos = b;		}
395 
IsCommaSeparated() const396 	sal_Bool IsCommaSeparated() const 		{ return bCommaSeparated;}
SetCommaSeparated(sal_Bool b)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 
505 protected:
506     // Add a data member, for record the TOC field expression of MS Word binary format
507     // For keeping fedality and may giving a better exporting performance
508     String maMSTOCExpression;
509     sal_Bool mbKeepExpression;
510 
511 public:
512 	SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
513 			   sal_uInt16 nCreaType, const String& rTitle );
514 	SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = 0 );
515 	virtual ~SwTOXBase();
516 
517 	virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
518 
519 	// a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
520 	// If not, so create it an copy all other used things. The return is this
521 	SwTOXBase& CopyTOXBase( SwDoc*, const SwTOXBase& );
522 
523 	const SwTOXType*	GetTOXType() const;	//
524 
525     sal_uInt16              GetCreateType() const;      // creation types
526 
GetTOXName() const527 	const String&		GetTOXName() const {return aName;}
SetTOXName(const String & rSet)528 	void				SetTOXName(const String& rSet) {aName = rSet;}
529 
530     // for record the TOC field expression of MS Word binary format
GetMSTOCExpression() const531     const String&		GetMSTOCExpression() const{return maMSTOCExpression;}
SetMSTOCExpression(const String & rExp)532     void				SetMSTOCExpression(const String& rExp) {maMSTOCExpression = rExp;}
EnableKeepExpression()533     void				EnableKeepExpression() {mbKeepExpression = sal_True;}
DisableKeepExpression()534     void				DisableKeepExpression() {mbKeepExpression = sal_False;}
535 
536     const String&       GetTitle() const;           // Title
537     const String&       GetTypeName() const;        // Name
538     const SwForm&       GetTOXForm() const;         // description of the lines
539 
540 	void 				SetCreate(sal_uInt16);
541 	void				SetTitle(const String& rTitle);
542 	void				SetTOXForm(const SwForm& rForm);
543 
544 	TOXTypes			GetType() const;
545 
GetMainEntryCharStyle() const546 	const String&		GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
SetMainEntryCharStyle(const String & rSet)547 	void				SetMainEntryCharStyle(const String& rSet)  {sMainEntryCharStyle = rSet;}
548 
549     // content index only
550     inline void             SetLevel(sal_uInt16);                   // consider outline level
551 	inline sal_uInt16	  		GetLevel() const;
552 
553     // alphabetical index only
554     inline sal_uInt16           GetOptions() const;                 // alphabetical index options
555 	inline void   			SetOptions(sal_uInt16 nOpt);
556 
557 	// index of objects
GetOLEOptions() const558 	sal_uInt16 		GetOLEOptions() const {return nOLEOptions;}
SetOLEOptions(sal_uInt16 nOpt)559 	void   		SetOLEOptions(sal_uInt16 nOpt) {nOLEOptions = nOpt;}
560 
561 	// index of objects
562 
563     // user defined index only
564 	inline void				SetTemplateName(const String& rName); // Absatzlayout beachten
565 
GetStyleNames(sal_uInt16 nLevel) const566 	const String&			GetStyleNames(sal_uInt16 nLevel) const
567 								{
568 								DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
569 								return aStyleNames[nLevel];
570 								}
SetStyleNames(const String & rSet,sal_uInt16 nLevel)571 	void					SetStyleNames(const String& rSet, sal_uInt16 nLevel)
572 								{
573 								DBG_ASSERT( nLevel < MAXLEVEL, "Which level?");
574 								aStyleNames[nLevel] = rSet;
575 								}
IsFromChapter() const576 	sal_Bool					IsFromChapter() const { return bFromChapter;}
SetFromChapter(sal_Bool bSet)577 	void					SetFromChapter(sal_Bool bSet) { bFromChapter = bSet;}
578 
IsFromObjectNames() const579 	sal_Bool					IsFromObjectNames() const {return bFromObjectNames;}
SetFromObjectNames(sal_Bool bSet)580 	void					SetFromObjectNames(sal_Bool bSet) {bFromObjectNames = bSet;}
581 
IsLevelFromChapter() const582 	sal_Bool					IsLevelFromChapter() const {return bLevelFromChapter;}
SetLevelFromChapter(sal_Bool bSet)583 	void					SetLevelFromChapter(sal_Bool bSet) {bLevelFromChapter = bSet;}
584 
IsProtected() const585 	sal_Bool					IsProtected() const { return bProtected; }
SetProtected(sal_Bool bSet)586 	void					SetProtected(sal_Bool bSet) { bProtected = bSet; }
587 
GetSequenceName() const588 	const String&			GetSequenceName() const {return sSequenceName;}
SetSequenceName(const String & rSet)589 	void					SetSequenceName(const String& rSet) {sSequenceName = rSet;}
590 
GetCaptionDisplay() const591 	SwCaptionDisplay		GetCaptionDisplay() const { return eCaptionDisplay;}
SetCaptionDisplay(SwCaptionDisplay eSet)592 	void					SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
593 
594 	sal_Bool 					IsTOXBaseInReadonly() const;
595 
596 	const SfxItemSet*		GetAttrSet() const;
597 	void 					SetAttrSet( const SfxItemSet& );
598 
GetLanguage() const599     LanguageType    GetLanguage() const {return eLanguage;}
SetLanguage(LanguageType nLang)600     void            SetLanguage(LanguageType nLang)  {eLanguage = nLang;}
601 
GetSortAlgorithm() const602     const String&   GetSortAlgorithm()const {return sSortAlgorithm;}
SetSortAlgorithm(const String & rSet)603     void            SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
604     // #i21237#
605     void AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop);
606     SwTOXBase& 			operator=(const SwTOXBase& rSource);
607     void RegisterToTOXType( SwTOXType& rMark );
608 };
609 
610 
611 /*--------------------------------------------------------------------
612      Description:  Inlines
613  --------------------------------------------------------------------*/
614 
615 //
616 //SwTOXMark
617 //
GetAlternativeText() const618 inline const String& SwTOXMark::GetAlternativeText() const
619 	{	return aAltText;	}
620 
GetTOXType() const621 inline const SwTOXType* SwTOXMark::GetTOXType() const
622 	{ return (SwTOXType*)GetRegisteredIn(); }
623 
IsAlternativeText() const624 inline sal_Bool SwTOXMark::IsAlternativeText() const
625 	{ return aAltText.Len() > 0; }
626 
SetAlternativeText(const String & rAlt)627 inline void SwTOXMark::SetAlternativeText(const String& rAlt)
628 {
629 	aAltText = rAlt;
630 }
631 
SetLevel(sal_uInt16 nLvl)632 inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
633 {
634 	ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
635 	nLevel = nLvl;
636 }
637 
SetPrimaryKey(const String & rKey)638 inline void SwTOXMark::SetPrimaryKey( const String& rKey )
639 {
640 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
641 	aPrimaryKey = rKey;
642 }
643 
SetSecondaryKey(const String & rKey)644 inline void SwTOXMark::SetSecondaryKey( const String& rKey )
645 {
646 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
647 	aSecondaryKey = rKey;
648 }
649 
SetTextReading(const String & rTxt)650 inline void SwTOXMark::SetTextReading( const String& rTxt )
651 {
652 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
653     aTextReading = rTxt;
654 }
655 
SetPrimaryKeyReading(const String & rKey)656 inline void SwTOXMark::SetPrimaryKeyReading( const String& rKey )
657 {
658 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
659     aPrimaryKeyReading = rKey;
660 }
661 
SetSecondaryKeyReading(const String & rKey)662 inline void SwTOXMark::SetSecondaryKeyReading( const String& rKey )
663 {
664 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
665     aSecondaryKeyReading = rKey;
666 }
667 
GetLevel() const668 inline sal_uInt16 SwTOXMark::GetLevel() const
669 {
670 	ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
671 	return nLevel;
672 }
673 
GetPrimaryKey() const674 inline const String& SwTOXMark::GetPrimaryKey() const
675 {
676 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
677 	return aPrimaryKey;
678 }
679 
GetSecondaryKey() const680 inline const String& SwTOXMark::GetSecondaryKey() const
681 {
682 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
683 	return aSecondaryKey;
684 }
685 
GetTextReading() const686 inline const String& SwTOXMark::GetTextReading() const
687 {
688 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
689     return aTextReading;
690 }
691 
GetPrimaryKeyReading() const692 inline const String& SwTOXMark::GetPrimaryKeyReading() const
693 {
694 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
695     return aPrimaryKeyReading;
696 }
697 
GetSecondaryKeyReading() const698 inline const String& SwTOXMark::GetSecondaryKeyReading() const
699 {
700 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
701     return aSecondaryKeyReading;
702 }
703 
704 //
705 //SwForm
706 //
SetTemplate(sal_uInt16 nLevel,const String & rTemplate)707 inline void SwForm::SetTemplate(sal_uInt16 nLevel, const String& rTemplate)
708 {
709 	ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
710 	aTemplate[nLevel] = rTemplate;
711 }
712 
GetTemplate(sal_uInt16 nLevel) const713 inline const String& SwForm::GetTemplate(sal_uInt16 nLevel) const
714 {
715 	ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX");
716 	return aTemplate[nLevel];
717 }
718 
GetTOXType() const719 inline TOXTypes SwForm::GetTOXType() const
720 {
721     return eType;
722 }
723 
GetFormMax() const724 inline sal_uInt16 SwForm::GetFormMax() const
725 {
726 	return nFormMaxLevel;
727 }
728 
729 
730 //
731 //SwTOXType
732 //
GetTypeName() const733 inline const String& SwTOXType::GetTypeName() const
734 	{	return aName;	}
735 
GetType() const736 inline TOXTypes SwTOXType::GetType() const
737 	{	return eType;	}
738 
739 //
740 // SwTOXBase
741 //
GetTOXType() const742 inline const SwTOXType* SwTOXBase::GetTOXType() const
743 	{ return (SwTOXType*)GetRegisteredIn(); }
744 
GetCreateType() const745 inline sal_uInt16 SwTOXBase::GetCreateType() const
746 	{ return nCreateType; }
747 
GetTitle() const748 inline const String& SwTOXBase::GetTitle() const
749 	{ return aTitle; }
750 
GetTypeName() const751 inline const String& SwTOXBase::GetTypeName() const
752 	{ return GetTOXType()->GetTypeName();  }
753 
GetTOXForm() const754 inline const SwForm& SwTOXBase::GetTOXForm() const
755 	{ return aForm;	}
756 
AdjustTabStops(SwDoc & rDoc,sal_Bool bDefaultRightTabStop)757 inline void SwTOXBase::AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop)
758 {
759     aForm.AdjustTabStops(rDoc, bDefaultRightTabStop);
760 }
761 
SetCreate(sal_uInt16 nCreate)762 inline void SwTOXBase::SetCreate(sal_uInt16 nCreate)
763 	{ nCreateType = nCreate; }
764 
SetTOXForm(const SwForm & rForm)765 inline void	SwTOXBase::SetTOXForm(const SwForm& rForm)
766 	{  aForm = rForm; }
767 
GetType() const768 inline TOXTypes SwTOXBase::GetType() const
769 	{ return GetTOXType()->GetType(); }
770 
SetLevel(sal_uInt16 nLev)771 inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
772 {
773 	ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
774 	aData.nLevel = nLev;
775 }
776 
GetLevel() const777 inline sal_uInt16 SwTOXBase::GetLevel() const
778 {
779 	ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp");
780 	return aData.nLevel;
781 }
782 
SetTemplateName(const String & rName)783 inline void SwTOXBase::SetTemplateName(const String& rName)
784 {
785 //	ASSERT(GetTOXType()->GetType() == TOX_USER, "Falscher Feldtyp");
786 //	ASSERT(aData.pTemplateName, "pTemplateName == 0");
787 //	(*aData.pTemplateName) = rName;
788 	DBG_WARNING("SwTOXBase::SetTemplateName obsolete");
789 	aStyleNames[0] = rName;
790 
791 }
792 
GetOptions() const793 inline sal_uInt16 SwTOXBase::GetOptions() const
794 {
795 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
796 	return aData.nOptions;
797 }
798 
SetOptions(sal_uInt16 nOpt)799 inline void SwTOXBase::SetOptions(sal_uInt16 nOpt)
800 {
801 	ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp");
802 	aData.nOptions = nOpt;
803 }
804 
805 
806 #endif  // SW_TOX_HXX
807