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