xref: /AOO41X/main/sw/inc/fmtcol.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _FMTCOL_HXX
24cdf0e10cSrcweir #define _FMTCOL_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svl/svarray.hxx>
27cdf0e10cSrcweir #include "swdllapi.h"
28cdf0e10cSrcweir #include <format.hxx>
29cdf0e10cSrcweir #include <swtypes.hxx>		// fuer MAXLEVEL
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class SwDoc;		// fuer friend
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class SwFmtColl : public SwFmt
34cdf0e10cSrcweir {
35cdf0e10cSrcweir protected:
36cdf0e10cSrcweir 	SwFmtColl( SwAttrPool& rPool, const sal_Char* pFmtName,
37cdf0e10cSrcweir 				const sal_uInt16* pWhichRanges, SwFmtColl* pDerFrom,
38cdf0e10cSrcweir 				sal_uInt16 nFmtWhich )
39cdf0e10cSrcweir 	  	: SwFmt( rPool, pFmtName, pWhichRanges, pDerFrom, nFmtWhich )
40cdf0e10cSrcweir 	{ SetAuto( sal_False ); }
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	SwFmtColl( SwAttrPool& rPool, const String &rFmtName,
43cdf0e10cSrcweir 				const sal_uInt16* pWhichRanges, SwFmtColl* pDerFrom,
44cdf0e10cSrcweir 				sal_uInt16 nFmtWhich )
45cdf0e10cSrcweir 	  	: SwFmt( rPool, rFmtName, pWhichRanges, pDerFrom, nFmtWhich )
46cdf0e10cSrcweir 	{ SetAuto( sal_False ); }
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir private:
50cdf0e10cSrcweir 	// erstmal wird nicht kopiert und nicht zugewiesen
51cdf0e10cSrcweir 	SwFmtColl(const SwFmtColl & );
52cdf0e10cSrcweir 	const SwFmtColl &operator=(const SwFmtColl &);
53cdf0e10cSrcweir };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class SW_DLLPUBLIC SwTxtFmtColl: public SwFmtColl
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	friend class SwDoc;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     SwTxtFmtColl(const SwTxtFmtColl & rRef);
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     // --> OD 2007-01-24 #i73790#
63cdf0e10cSrcweir     bool mbStayAssignedToListLevelOfOutlineStyle;
64cdf0e10cSrcweir     // <--
65cdf0e10cSrcweir 
66cdf0e10cSrcweir protected:
67cdf0e10cSrcweir 	//sal_uInt8 nOutlineLevel;		 //<-#outline level, removed by zhaojianwei
68cdf0e10cSrcweir 	bool mbAssignedToOutlineStyle;//<-#outline level added by zhaojianwei
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	SwTxtFmtColl *pNextTxtFmtColl;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	SwTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
73cdf0e10cSrcweir 					SwTxtFmtColl* pDerFrom = 0,
74cdf0e10cSrcweir 					sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
75cdf0e10cSrcweir 		: SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange,
76cdf0e10cSrcweir 						pDerFrom, nFmtWh ),
77cdf0e10cSrcweir           // --> OD 2007-01-24 #i73790#
78cdf0e10cSrcweir           mbStayAssignedToListLevelOfOutlineStyle( false ),
79cdf0e10cSrcweir           // <--
80cdf0e10cSrcweir           //nOutlineLevel( NO_NUMBERING )	//<-#outline level,removed by zhaojianwei
81cdf0e10cSrcweir 		  mbAssignedToOutlineStyle(false)	//<-#outline level,added by zhaojianwei
82cdf0e10cSrcweir     { pNextTxtFmtColl = this; }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	SwTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
85cdf0e10cSrcweir 					SwTxtFmtColl* pDerFrom = 0,
86cdf0e10cSrcweir 					sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
87cdf0e10cSrcweir 		: SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange,
88cdf0e10cSrcweir 						pDerFrom, nFmtWh ),
89cdf0e10cSrcweir           // --> OD 2007-01-24 #i73790#
90cdf0e10cSrcweir           mbStayAssignedToListLevelOfOutlineStyle( false ),
91cdf0e10cSrcweir           // <--
92cdf0e10cSrcweir           //nOutlineLevel( NO_NUMBERING )	//<-#outline level,removed by zhaojianwei
93cdf0e10cSrcweir 		  mbAssignedToOutlineStyle(false)	//<-#outline level,added by zhaojianwei
94cdf0e10cSrcweir     { pNextTxtFmtColl = this; }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	// zum "abfischen" von UL-/LR-/FontHeight Aenderungen
97cdf0e10cSrcweir    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir public:
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	inline void SetNextTxtFmtColl(SwTxtFmtColl& rNext);
104cdf0e10cSrcweir 	SwTxtFmtColl& GetNextTxtFmtColl() const { return *pNextTxtFmtColl; }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	sal_Bool IsAtDocNodeSet() const;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     // --> OD 2006-11-22 #i71574#
109cdf0e10cSrcweir    //<-#outline level,zhaojianwei
110cdf0e10cSrcweir 	void SetAttrOutlineLevel( int );
111cdf0e10cSrcweir 	int  GetAttrOutlineLevel() const;
112cdf0e10cSrcweir 	int  GetAssignedOutlineStyleLevel() const;
113cdf0e10cSrcweir     inline bool IsAssignedToListLevelOfOutlineStyle() const
114cdf0e10cSrcweir     {
115cdf0e10cSrcweir         return mbAssignedToOutlineStyle;
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir 	void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
118cdf0e10cSrcweir     void DeleteAssignmentToListLevelOfOutlineStyle();
119cdf0e10cSrcweir 	//<-end
120cdf0e10cSrcweir     // <--
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     // --> OD 2008-03-04 #refactorlists#
123cdf0e10cSrcweir     // override to recognize changes on the <SwNumRuleItem> and register/unregister
124cdf0e10cSrcweir     // the paragragh style at the corresponding <SwNumRule> instance
125cdf0e10cSrcweir     virtual sal_Bool SetFmtAttr( const SfxPoolItem& rAttr );
126cdf0e10cSrcweir     virtual sal_Bool SetFmtAttr( const SfxItemSet& rSet );
127cdf0e10cSrcweir     virtual sal_Bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
128cdf0e10cSrcweir     // <--
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     // --> OD 2007-01-24 #i73790#
131cdf0e10cSrcweir     // override <ResetAllFmtAttr()> to stay assigned to list level of outline style
132cdf0e10cSrcweir     virtual sal_uInt16 ResetAllFmtAttr();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     inline bool StayAssignedToListLevelOfOutlineStyle() const
135cdf0e10cSrcweir     {
136cdf0e10cSrcweir         return mbStayAssignedToListLevelOfOutlineStyle;
137cdf0e10cSrcweir     }
138cdf0e10cSrcweir     // <--
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     // --> OD 2008-02-13 #newlistleveattrs#
141cdf0e10cSrcweir     bool AreListLevelIndentsApplicable() const;
142cdf0e10cSrcweir     // <--
143cdf0e10cSrcweir 
144cdf0e10cSrcweir /*----------------- JP 09.08.94 17:36 -------------------
145cdf0e10cSrcweir  wird die Funktionalitaet von Zeichenvorlagen an Absatzvorlagen
146cdf0e10cSrcweir  ueberhaupt benoetigt ??
147cdf0e10cSrcweir 
148cdf0e10cSrcweir  Wenn, ja dann muessen im TextNode und hier in der TxtCollection ein 2.
149cdf0e10cSrcweir  Attset fuer die Char-Attribute angelegt werden; damit die Vererbung
150cdf0e10cSrcweir  und der Zugriff auf die gesetzen Attribute richtig funktioniert!!
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	virtual sal_Bool SetDerivedFrom( SwFmtColl* pDerFrom = 0 );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	inline SwCharFmt* GetCharFmt() const;
155cdf0e10cSrcweir 	inline sal_Bool IsCharFmtSet() const;
156cdf0e10cSrcweir 	void SetCharFmt(SwCharFmt *);
157cdf0e10cSrcweir 	void ResetCharFmt();
158cdf0e10cSrcweir inline sal_Bool SwTxtFmtColl::IsCharFmtSet() const
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 	return aCharDepend.GetRegisteredIn() ? sal_True : sal_False;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir inline SwCharFmt* SwTxtFmtColl::GetCharFmt() const
163cdf0e10cSrcweir {
164cdf0e10cSrcweir 	return (SwCharFmt*)aCharDepend.GetRegisteredIn();
165cdf0e10cSrcweir }
166cdf0e10cSrcweir --------------------------------------------------*/
167cdf0e10cSrcweir };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir typedef SwTxtFmtColl* SwTxtFmtCollPtr;
170cdf0e10cSrcweir SV_DECL_PTRARR(SwTxtFmtColls,SwTxtFmtCollPtr,2,4)
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 
173cdf0e10cSrcweir class SwGrfFmtColl: public SwFmtColl
174cdf0e10cSrcweir {
175cdf0e10cSrcweir 	friend class SwDoc;
176cdf0e10cSrcweir protected:
177cdf0e10cSrcweir 	SwGrfFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
178cdf0e10cSrcweir 					SwGrfFmtColl* pDerFrom = 0 )
179cdf0e10cSrcweir 		: SwFmtColl( rPool, pFmtCollName, aGrfFmtCollSetRange,
180cdf0e10cSrcweir 					pDerFrom, RES_GRFFMTCOLL )
181cdf0e10cSrcweir 	{}
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	SwGrfFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
184cdf0e10cSrcweir 					SwGrfFmtColl* pDerFrom = 0 )
185cdf0e10cSrcweir 		: SwFmtColl( rPool, rFmtCollName, aGrfFmtCollSetRange,
186cdf0e10cSrcweir 					pDerFrom, RES_GRFFMTCOLL )
187cdf0e10cSrcweir 	{}
188cdf0e10cSrcweir 
189cdf0e10cSrcweir public:
190cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
191cdf0e10cSrcweir };
192cdf0e10cSrcweir 
193cdf0e10cSrcweir typedef SwGrfFmtColl* SwGrfFmtCollPtr;
194cdf0e10cSrcweir SV_DECL_PTRARR(SwGrfFmtColls,SwGrfFmtCollPtr,2,4)
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 
198cdf0e10cSrcweir //FEATURE::CONDCOLL
199cdf0e10cSrcweir // --------- Bedingte Vorlagen -------------------------------
200cdf0e10cSrcweir 
201cdf0e10cSrcweir enum Master_CollConditions
202cdf0e10cSrcweir {
203cdf0e10cSrcweir 	PARA_IN_LIST		= 0x0001,
204cdf0e10cSrcweir 	PARA_IN_OUTLINE		= 0x0002,
205cdf0e10cSrcweir 	PARA_IN_FRAME		= 0x0004,
206cdf0e10cSrcweir 	PARA_IN_TABLEHEAD	= 0x0008,
207cdf0e10cSrcweir 	PARA_IN_TABLEBODY	= 0x0010,
208cdf0e10cSrcweir 	PARA_IN_SECTION		= 0x0020,
209cdf0e10cSrcweir 	PARA_IN_FOOTENOTE 	= 0x0040,
210cdf0e10cSrcweir 	PARA_IN_FOOTER 		= 0x0080,
211cdf0e10cSrcweir 	PARA_IN_HEADER 		= 0x0100,
212cdf0e10cSrcweir 	PARA_IN_ENDNOTE 	= 0x0200,
213cdf0e10cSrcweir 	// ...
214cdf0e10cSrcweir 	USRFLD_EXPRESSION	= (int)0x8000
215cdf0e10cSrcweir };
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 
218cdf0e10cSrcweir class SW_DLLPUBLIC SwCollCondition : public SwClient
219cdf0e10cSrcweir {
220cdf0e10cSrcweir 	sal_uLong nCondition;
221cdf0e10cSrcweir 	union
222cdf0e10cSrcweir 	{
223cdf0e10cSrcweir 		sal_uLong nSubCondition;
224cdf0e10cSrcweir 		String* pFldExpression;
225cdf0e10cSrcweir 	} aSubCondition;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir public:
228cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
232cdf0e10cSrcweir 					sal_uLong nSubCond = 0 );
233cdf0e10cSrcweir 	SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
234cdf0e10cSrcweir 					const String& rSubExp );
235cdf0e10cSrcweir 	virtual ~SwCollCondition();
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	// @@@ public copy ctor, but no copy assignment?
238cdf0e10cSrcweir 	SwCollCondition( const SwCollCondition& rCpy );
239cdf0e10cSrcweir private:
240cdf0e10cSrcweir 	// @@@ public copy ctor, but no copy assignment?
241cdf0e10cSrcweir 	SwCollCondition & operator= (const SwCollCondition &);
242cdf0e10cSrcweir public:
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	int operator==( const SwCollCondition& rCmp ) const;
245cdf0e10cSrcweir 	int operator!=( const SwCollCondition& rCmp ) const
246cdf0e10cSrcweir 							{ return ! (*this == rCmp); }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 	sal_uLong GetCondition() const 		{ return nCondition; }
249cdf0e10cSrcweir 	sal_uLong GetSubCondition() const	{ return aSubCondition.nSubCondition; }
250cdf0e10cSrcweir 	const String* GetFldExpression() const
251cdf0e10cSrcweir 									{ return aSubCondition.pFldExpression; }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	void SetCondition( sal_uLong nCond, sal_uLong nSubCond );
254cdf0e10cSrcweir 	SwTxtFmtColl* GetTxtFmtColl() const 	{ return (SwTxtFmtColl*)GetRegisteredIn(); }
255cdf0e10cSrcweir     void RegisterToFormat( SwFmt& );
256cdf0e10cSrcweir };
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 
259cdf0e10cSrcweir typedef SwCollCondition* SwCollConditionPtr;
260cdf0e10cSrcweir SV_DECL_PTRARR_DEL( SwFmtCollConditions, SwCollConditionPtr, 0, 5 )
261cdf0e10cSrcweir 
262cdf0e10cSrcweir class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl
263cdf0e10cSrcweir {
264cdf0e10cSrcweir 	friend class SwDoc;
265cdf0e10cSrcweir protected:
266cdf0e10cSrcweir 	SwFmtCollConditions aCondColls;
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	SwConditionTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
269cdf0e10cSrcweir 							SwTxtFmtColl* pDerFrom = 0 )
270cdf0e10cSrcweir 		: SwTxtFmtColl( rPool, pFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
271cdf0e10cSrcweir 	{}
272cdf0e10cSrcweir 	SwConditionTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
273cdf0e10cSrcweir 							SwTxtFmtColl* pDerFrom = 0 )
274cdf0e10cSrcweir 		: SwTxtFmtColl( rPool, rFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
275cdf0e10cSrcweir 	{}
276cdf0e10cSrcweir 
277cdf0e10cSrcweir public:
278cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	virtual ~SwConditionTxtFmtColl();
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
283cdf0e10cSrcweir 	const SwFmtCollConditions& GetCondColls() const		{ return aCondColls; }
284cdf0e10cSrcweir 	void InsertCondition( const SwCollCondition& rCond );
285cdf0e10cSrcweir 	sal_Bool RemoveCondition( const SwCollCondition& rCond );
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 	void SetConditions( const SwFmtCollConditions& );
288cdf0e10cSrcweir };
289cdf0e10cSrcweir 
290cdf0e10cSrcweir //FEATURE::CONDCOLL
291cdf0e10cSrcweir 
292cdf0e10cSrcweir // ------------- Inline Implementierungen --------------------
293cdf0e10cSrcweir 
294cdf0e10cSrcweir inline void SwTxtFmtColl::SetNextTxtFmtColl( SwTxtFmtColl& rNext )
295cdf0e10cSrcweir {
296cdf0e10cSrcweir 	pNextTxtFmtColl = &rNext;
297cdf0e10cSrcweir }
298cdf0e10cSrcweir #endif
299cdf0e10cSrcweir 
300