xref: /aoo42x/main/sw/inc/fmtcol.hxx (revision 28f5a95a)
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
101d2dbeb0SAndrew Rist  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
121d2dbeb0SAndrew Rist  *
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.
191d2dbeb0SAndrew Rist  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew 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:
SwFmtColl(SwAttrPool & rPool,const sal_Char * pFmtName,const sal_uInt16 * pWhichRanges,SwFmtColl * pDerFrom,sal_uInt16 nFmtWhich)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 
SwFmtColl(SwAttrPool & rPool,const String & rFmtName,const sal_uInt16 * pWhichRanges,SwFmtColl * pDerFrom,sal_uInt16 nFmtWhich)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 
SwTxtFmtColl(SwAttrPool & rPool,const sal_Char * pFmtCollName,SwTxtFmtColl * pDerFrom=0,sal_uInt16 nFmtWh=RES_TXTFMTCOLL)72*28f5a95aSOliver-Rainer Wittmann     SwTxtFmtColl(
73*28f5a95aSOliver-Rainer Wittmann         SwAttrPool& rPool,
74*28f5a95aSOliver-Rainer Wittmann         const sal_Char* pFmtCollName,
75*28f5a95aSOliver-Rainer Wittmann         SwTxtFmtColl* pDerFrom = 0,
76*28f5a95aSOliver-Rainer Wittmann         sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
77*28f5a95aSOliver-Rainer Wittmann         : SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange
78*28f5a95aSOliver-Rainer Wittmann         , pDerFrom, nFmtWh )
79*28f5a95aSOliver-Rainer Wittmann 	    , mbStayAssignedToListLevelOfOutlineStyle( false )
80*28f5a95aSOliver-Rainer Wittmann 	    , mbAssignedToOutlineStyle( false )
81*28f5a95aSOliver-Rainer Wittmann     {
82*28f5a95aSOliver-Rainer Wittmann         pNextTxtFmtColl = this;
83*28f5a95aSOliver-Rainer Wittmann     }
84*28f5a95aSOliver-Rainer Wittmann 
SwTxtFmtColl(SwAttrPool & rPool,const String & rFmtCollName,SwTxtFmtColl * pDerFrom=0,sal_uInt16 nFmtWh=RES_TXTFMTCOLL)85*28f5a95aSOliver-Rainer Wittmann     SwTxtFmtColl(
86*28f5a95aSOliver-Rainer Wittmann         SwAttrPool& rPool,
87*28f5a95aSOliver-Rainer Wittmann         const String &rFmtCollName,
88*28f5a95aSOliver-Rainer Wittmann         SwTxtFmtColl* pDerFrom = 0,
89*28f5a95aSOliver-Rainer Wittmann         sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
90*28f5a95aSOliver-Rainer Wittmann         : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange
91*28f5a95aSOliver-Rainer Wittmann         , pDerFrom, nFmtWh )
92*28f5a95aSOliver-Rainer Wittmann         , mbStayAssignedToListLevelOfOutlineStyle( false )
93*28f5a95aSOliver-Rainer Wittmann         , mbAssignedToOutlineStyle( false )
94*28f5a95aSOliver-Rainer Wittmann     {
95*28f5a95aSOliver-Rainer Wittmann         pNextTxtFmtColl = this;
96*28f5a95aSOliver-Rainer Wittmann     }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	// zum "abfischen" von UL-/LR-/FontHeight Aenderungen
99cdf0e10cSrcweir    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir public:
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	inline void SetNextTxtFmtColl(SwTxtFmtColl& rNext);
GetNextTxtFmtColl() const106cdf0e10cSrcweir 	SwTxtFmtColl& GetNextTxtFmtColl() const { return *pNextTxtFmtColl; }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	sal_Bool IsAtDocNodeSet() const;
109cdf0e10cSrcweir 
110*28f5a95aSOliver-Rainer Wittmann     void SetAttrOutlineLevel( int );
111*28f5a95aSOliver-Rainer Wittmann     int GetAttrOutlineLevel() const;
112*28f5a95aSOliver-Rainer Wittmann 
113*28f5a95aSOliver-Rainer Wittmann     // Return the list level of the Outline Style - the List Style for the outline numbering -
114*28f5a95aSOliver-Rainer Wittmann     // to which the Paragraph Style is assigned.
115*28f5a95aSOliver-Rainer Wittmann     int GetAssignedOutlineStyleLevel() const;
116*28f5a95aSOliver-Rainer Wittmann 
IsAssignedToListLevelOfOutlineStyle() const117cdf0e10cSrcweir     inline bool IsAssignedToListLevelOfOutlineStyle() const
118cdf0e10cSrcweir     {
119cdf0e10cSrcweir         return mbAssignedToOutlineStyle;
120cdf0e10cSrcweir     }
121cdf0e10cSrcweir 
122*28f5a95aSOliver-Rainer Wittmann     // If a Paragraph Style is assigned to list level N of the Outline Style,
123*28f5a95aSOliver-Rainer Wittmann     // then its outline level - AttrOutlineLevel - is set to N+1
124*28f5a95aSOliver-Rainer Wittmann     void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
125*28f5a95aSOliver-Rainer Wittmann 
126*28f5a95aSOliver-Rainer Wittmann 	void DeleteAssignmentToListLevelOfOutlineStyle( const bool bResetOutlineLevel = true );
127*28f5a95aSOliver-Rainer Wittmann 
128cdf0e10cSrcweir     // override to recognize changes on the <SwNumRuleItem> and register/unregister
129cdf0e10cSrcweir     // the paragragh style at the corresponding <SwNumRule> instance
130cdf0e10cSrcweir     virtual sal_Bool SetFmtAttr( const SfxPoolItem& rAttr );
131cdf0e10cSrcweir     virtual sal_Bool SetFmtAttr( const SfxItemSet& rSet );
132cdf0e10cSrcweir     virtual sal_Bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     // override <ResetAllFmtAttr()> to stay assigned to list level of outline style
135cdf0e10cSrcweir     virtual sal_uInt16 ResetAllFmtAttr();
136cdf0e10cSrcweir 
StayAssignedToListLevelOfOutlineStyle() const137cdf0e10cSrcweir     inline bool StayAssignedToListLevelOfOutlineStyle() const
138cdf0e10cSrcweir     {
139cdf0e10cSrcweir         return mbStayAssignedToListLevelOfOutlineStyle;
140cdf0e10cSrcweir     }
141cdf0e10cSrcweir     // <--
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     // --> OD 2008-02-13 #newlistleveattrs#
144cdf0e10cSrcweir     bool AreListLevelIndentsApplicable() const;
145cdf0e10cSrcweir     // <--
146cdf0e10cSrcweir 
147cdf0e10cSrcweir /*----------------- JP 09.08.94 17:36 -------------------
148cdf0e10cSrcweir  wird die Funktionalitaet von Zeichenvorlagen an Absatzvorlagen
149cdf0e10cSrcweir  ueberhaupt benoetigt ??
150cdf0e10cSrcweir 
151cdf0e10cSrcweir  Wenn, ja dann muessen im TextNode und hier in der TxtCollection ein 2.
152cdf0e10cSrcweir  Attset fuer die Char-Attribute angelegt werden; damit die Vererbung
153cdf0e10cSrcweir  und der Zugriff auf die gesetzen Attribute richtig funktioniert!!
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	virtual sal_Bool SetDerivedFrom( SwFmtColl* pDerFrom = 0 );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	inline SwCharFmt* GetCharFmt() const;
158cdf0e10cSrcweir 	inline sal_Bool IsCharFmtSet() const;
159cdf0e10cSrcweir 	void SetCharFmt(SwCharFmt *);
160cdf0e10cSrcweir 	void ResetCharFmt();
161cdf0e10cSrcweir inline sal_Bool SwTxtFmtColl::IsCharFmtSet() const
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	return aCharDepend.GetRegisteredIn() ? sal_True : sal_False;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir inline SwCharFmt* SwTxtFmtColl::GetCharFmt() const
166cdf0e10cSrcweir {
167cdf0e10cSrcweir 	return (SwCharFmt*)aCharDepend.GetRegisteredIn();
168cdf0e10cSrcweir }
169cdf0e10cSrcweir --------------------------------------------------*/
170cdf0e10cSrcweir };
171cdf0e10cSrcweir 
172cdf0e10cSrcweir typedef SwTxtFmtColl* SwTxtFmtCollPtr;
173cdf0e10cSrcweir SV_DECL_PTRARR(SwTxtFmtColls,SwTxtFmtCollPtr,2,4)
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 
176cdf0e10cSrcweir class SwGrfFmtColl: public SwFmtColl
177cdf0e10cSrcweir {
178cdf0e10cSrcweir 	friend class SwDoc;
179cdf0e10cSrcweir protected:
SwGrfFmtColl(SwAttrPool & rPool,const sal_Char * pFmtCollName,SwGrfFmtColl * pDerFrom=0)180cdf0e10cSrcweir 	SwGrfFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
181cdf0e10cSrcweir 					SwGrfFmtColl* pDerFrom = 0 )
182cdf0e10cSrcweir 		: SwFmtColl( rPool, pFmtCollName, aGrfFmtCollSetRange,
183cdf0e10cSrcweir 					pDerFrom, RES_GRFFMTCOLL )
184cdf0e10cSrcweir 	{}
185cdf0e10cSrcweir 
SwGrfFmtColl(SwAttrPool & rPool,const String & rFmtCollName,SwGrfFmtColl * pDerFrom=0)186cdf0e10cSrcweir 	SwGrfFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
187cdf0e10cSrcweir 					SwGrfFmtColl* pDerFrom = 0 )
188cdf0e10cSrcweir 		: SwFmtColl( rPool, rFmtCollName, aGrfFmtCollSetRange,
189cdf0e10cSrcweir 					pDerFrom, RES_GRFFMTCOLL )
190cdf0e10cSrcweir 	{}
191cdf0e10cSrcweir 
192cdf0e10cSrcweir public:
193cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
194cdf0e10cSrcweir };
195cdf0e10cSrcweir 
196cdf0e10cSrcweir typedef SwGrfFmtColl* SwGrfFmtCollPtr;
197cdf0e10cSrcweir SV_DECL_PTRARR(SwGrfFmtColls,SwGrfFmtCollPtr,2,4)
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 
201cdf0e10cSrcweir //FEATURE::CONDCOLL
202cdf0e10cSrcweir // --------- Bedingte Vorlagen -------------------------------
203cdf0e10cSrcweir 
204cdf0e10cSrcweir enum Master_CollConditions
205cdf0e10cSrcweir {
206cdf0e10cSrcweir 	PARA_IN_LIST		= 0x0001,
207cdf0e10cSrcweir 	PARA_IN_OUTLINE		= 0x0002,
208cdf0e10cSrcweir 	PARA_IN_FRAME		= 0x0004,
209cdf0e10cSrcweir 	PARA_IN_TABLEHEAD	= 0x0008,
210cdf0e10cSrcweir 	PARA_IN_TABLEBODY	= 0x0010,
211cdf0e10cSrcweir 	PARA_IN_SECTION		= 0x0020,
212cdf0e10cSrcweir 	PARA_IN_FOOTENOTE 	= 0x0040,
213cdf0e10cSrcweir 	PARA_IN_FOOTER 		= 0x0080,
214cdf0e10cSrcweir 	PARA_IN_HEADER 		= 0x0100,
215cdf0e10cSrcweir 	PARA_IN_ENDNOTE 	= 0x0200,
216cdf0e10cSrcweir 	// ...
217cdf0e10cSrcweir 	USRFLD_EXPRESSION	= (int)0x8000
218cdf0e10cSrcweir };
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
221cdf0e10cSrcweir class SW_DLLPUBLIC SwCollCondition : public SwClient
222cdf0e10cSrcweir {
223cdf0e10cSrcweir 	sal_uLong nCondition;
224cdf0e10cSrcweir 	union
225cdf0e10cSrcweir 	{
226cdf0e10cSrcweir 		sal_uLong nSubCondition;
227cdf0e10cSrcweir 		String* pFldExpression;
228cdf0e10cSrcweir 	} aSubCondition;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir public:
231cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 	SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
235cdf0e10cSrcweir 					sal_uLong nSubCond = 0 );
236cdf0e10cSrcweir 	SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
237cdf0e10cSrcweir 					const String& rSubExp );
238cdf0e10cSrcweir 	virtual ~SwCollCondition();
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	// @@@ public copy ctor, but no copy assignment?
241cdf0e10cSrcweir 	SwCollCondition( const SwCollCondition& rCpy );
242cdf0e10cSrcweir private:
243cdf0e10cSrcweir 	// @@@ public copy ctor, but no copy assignment?
244cdf0e10cSrcweir 	SwCollCondition & operator= (const SwCollCondition &);
245cdf0e10cSrcweir public:
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	int operator==( const SwCollCondition& rCmp ) const;
operator !=(const SwCollCondition & rCmp) const248cdf0e10cSrcweir 	int operator!=( const SwCollCondition& rCmp ) const
249cdf0e10cSrcweir 							{ return ! (*this == rCmp); }
250cdf0e10cSrcweir 
GetCondition() const251cdf0e10cSrcweir 	sal_uLong GetCondition() const 		{ return nCondition; }
GetSubCondition() const252cdf0e10cSrcweir 	sal_uLong GetSubCondition() const	{ return aSubCondition.nSubCondition; }
GetFldExpression() const253cdf0e10cSrcweir 	const String* GetFldExpression() const
254cdf0e10cSrcweir 									{ return aSubCondition.pFldExpression; }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	void SetCondition( sal_uLong nCond, sal_uLong nSubCond );
GetTxtFmtColl() const257cdf0e10cSrcweir 	SwTxtFmtColl* GetTxtFmtColl() const 	{ return (SwTxtFmtColl*)GetRegisteredIn(); }
258cdf0e10cSrcweir     void RegisterToFormat( SwFmt& );
259cdf0e10cSrcweir };
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 
262cdf0e10cSrcweir typedef SwCollCondition* SwCollConditionPtr;
263cdf0e10cSrcweir SV_DECL_PTRARR_DEL( SwFmtCollConditions, SwCollConditionPtr, 0, 5 )
264cdf0e10cSrcweir 
265cdf0e10cSrcweir class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl
266cdf0e10cSrcweir {
267cdf0e10cSrcweir 	friend class SwDoc;
268cdf0e10cSrcweir protected:
269cdf0e10cSrcweir 	SwFmtCollConditions aCondColls;
270cdf0e10cSrcweir 
SwConditionTxtFmtColl(SwAttrPool & rPool,const sal_Char * pFmtCollName,SwTxtFmtColl * pDerFrom=0)271cdf0e10cSrcweir 	SwConditionTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
272cdf0e10cSrcweir 							SwTxtFmtColl* pDerFrom = 0 )
273cdf0e10cSrcweir 		: SwTxtFmtColl( rPool, pFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
274cdf0e10cSrcweir 	{}
SwConditionTxtFmtColl(SwAttrPool & rPool,const String & rFmtCollName,SwTxtFmtColl * pDerFrom=0)275cdf0e10cSrcweir 	SwConditionTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
276cdf0e10cSrcweir 							SwTxtFmtColl* pDerFrom = 0 )
277cdf0e10cSrcweir 		: SwTxtFmtColl( rPool, rFmtCollName, pDerFrom, RES_CONDTXTFMTCOLL )
278cdf0e10cSrcweir 	{}
279cdf0e10cSrcweir 
280cdf0e10cSrcweir public:
281cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	virtual ~SwConditionTxtFmtColl();
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
GetCondColls() const286cdf0e10cSrcweir 	const SwFmtCollConditions& GetCondColls() const		{ return aCondColls; }
287cdf0e10cSrcweir 	void InsertCondition( const SwCollCondition& rCond );
288cdf0e10cSrcweir 	sal_Bool RemoveCondition( const SwCollCondition& rCond );
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	void SetConditions( const SwFmtCollConditions& );
291cdf0e10cSrcweir };
292cdf0e10cSrcweir 
293cdf0e10cSrcweir //FEATURE::CONDCOLL
294cdf0e10cSrcweir 
295cdf0e10cSrcweir // ------------- Inline Implementierungen --------------------
296cdf0e10cSrcweir 
SetNextTxtFmtColl(SwTxtFmtColl & rNext)297cdf0e10cSrcweir inline void SwTxtFmtColl::SetNextTxtFmtColl( SwTxtFmtColl& rNext )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir 	pNextTxtFmtColl = &rNext;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir #endif
302cdf0e10cSrcweir 
303