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