1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmtcol.hxx,v $
10 * $Revision: 1.13.144.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <svtools/svarray.hxx>
36 #include <swtypes.hxx> // fuer MAXLEVEL
38 class SwDoc
; // fuer friend
40 class SwFmtColl
: public SwFmt
43 SwFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtName
,
44 const USHORT
* pWhichRanges
, SwFmtColl
* pDerFrom
,
46 : SwFmt( rPool
, pFmtName
, pWhichRanges
, pDerFrom
, nFmtWhich
)
49 SwFmtColl( SwAttrPool
& rPool
, const String
&rFmtName
,
50 const USHORT
* pWhichRanges
, SwFmtColl
* pDerFrom
,
52 : SwFmt( rPool
, rFmtName
, pWhichRanges
, pDerFrom
, nFmtWhich
)
57 // erstmal wird nicht kopiert und nicht zugewiesen
58 SwFmtColl(const SwFmtColl
& );
59 const SwFmtColl
&operator=(const SwFmtColl
&);
63 class SW_DLLPUBLIC SwTxtFmtColl
: public SwFmtColl
67 SwTxtFmtColl(const SwTxtFmtColl
& rRef
);
69 // --> OD 2007-01-24 #i73790#
70 bool mbStayAssignedToListLevelOfOutlineStyle
;
74 //BYTE nOutlineLevel; //<-#outline level, removed by zhaojianwei
75 bool mbAssignedToOutlineStyle
;//<-#outline level added by zhaojianwei
77 SwTxtFmtColl
*pNextTxtFmtColl
;
79 SwTxtFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
80 SwTxtFmtColl
* pDerFrom
= 0,
81 USHORT nFmtWh
= RES_TXTFMTCOLL
)
82 : SwFmtColl( rPool
, pFmtCollName
, aTxtFmtCollSetRange
,
84 // --> OD 2007-01-24 #i73790#
85 mbStayAssignedToListLevelOfOutlineStyle( false ),
87 //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
88 mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
89 { pNextTxtFmtColl
= this; }
91 SwTxtFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
92 SwTxtFmtColl
* pDerFrom
= 0,
93 USHORT nFmtWh
= RES_TXTFMTCOLL
)
94 : SwFmtColl( rPool
, rFmtCollName
, aTxtFmtCollSetRange
,
96 // --> OD 2007-01-24 #i73790#
97 mbStayAssignedToListLevelOfOutlineStyle( false ),
99 //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
100 mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
101 { pNextTxtFmtColl
= this; }
104 // zum "abfischen" von UL-/LR-/FontHeight Aenderungen
105 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
107 TYPEINFO(); //Bereits in Basisklasse Client drin.
109 inline void SetNextTxtFmtColl(SwTxtFmtColl
& rNext
);
110 SwTxtFmtColl
& GetNextTxtFmtColl() const { return *pNextTxtFmtColl
; }
112 BOOL
IsAtDocNodeSet() const;
114 // --> OD 2006-11-22 #i71574#
115 //<-#outline level,zhaojianwei
116 void SetAttrOutlineLevel( int );
117 int GetAttrOutlineLevel() const;
118 int GetAssignedOutlineStyleLevel() const;
119 inline bool IsAssignedToListLevelOfOutlineStyle() const
121 return mbAssignedToOutlineStyle
;
123 void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel
);
124 void DeleteAssignmentToListLevelOfOutlineStyle();
128 // --> OD 2008-03-04 #refactorlists#
129 // override to recognize changes on the <SwNumRuleItem> and register/unregister
130 // the paragragh style at the corresponding <SwNumRule> instance
131 virtual BOOL
SetFmtAttr( const SfxPoolItem
& rAttr
);
132 virtual BOOL
SetFmtAttr( const SfxItemSet
& rSet
);
133 virtual BOOL
ResetFmtAttr( USHORT nWhich1
, USHORT nWhich2
= 0 );
136 // --> OD 2007-01-24 #i73790#
137 // override <ResetAllFmtAttr()> to stay assigned to list level of outline style
138 virtual USHORT
ResetAllFmtAttr();
140 inline bool StayAssignedToListLevelOfOutlineStyle() const
142 return mbStayAssignedToListLevelOfOutlineStyle
;
146 // --> OD 2008-02-13 #newlistleveattrs#
147 bool AreListLevelIndentsApplicable() const;
150 /*----------------- JP 09.08.94 17:36 -------------------
151 wird die Funktionalitaet von Zeichenvorlagen an Absatzvorlagen
152 ueberhaupt benoetigt ??
154 Wenn, ja dann muessen im TextNode und hier in der TxtCollection ein 2.
155 Attset fuer die Char-Attribute angelegt werden; damit die Vererbung
156 und der Zugriff auf die gesetzen Attribute richtig funktioniert!!
158 virtual BOOL SetDerivedFrom( SwFmtColl* pDerFrom = 0 );
160 inline SwCharFmt* GetCharFmt() const;
161 inline BOOL IsCharFmtSet() const;
162 void SetCharFmt(SwCharFmt *);
164 inline BOOL SwTxtFmtColl::IsCharFmtSet() const
166 return aCharDepend.GetRegisteredIn() ? TRUE : FALSE;
168 inline SwCharFmt* SwTxtFmtColl::GetCharFmt() const
170 return (SwCharFmt*)aCharDepend.GetRegisteredIn();
172 --------------------------------------------------*/
175 typedef SwTxtFmtColl
* SwTxtFmtCollPtr
;
176 SV_DECL_PTRARR(SwTxtFmtColls
,SwTxtFmtCollPtr
,2,4)
179 class SwGrfFmtColl
: public SwFmtColl
183 SwGrfFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
184 SwGrfFmtColl
* pDerFrom
= 0 )
185 : SwFmtColl( rPool
, pFmtCollName
, aGrfFmtCollSetRange
,
186 pDerFrom
, RES_GRFFMTCOLL
)
189 SwGrfFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
190 SwGrfFmtColl
* pDerFrom
= 0 )
191 : SwFmtColl( rPool
, rFmtCollName
, aGrfFmtCollSetRange
,
192 pDerFrom
, RES_GRFFMTCOLL
)
196 TYPEINFO(); //Bereits in Basisklasse Client drin.
199 typedef SwGrfFmtColl
* SwGrfFmtCollPtr
;
200 SV_DECL_PTRARR(SwGrfFmtColls
,SwGrfFmtCollPtr
,2,4)
205 // --------- Bedingte Vorlagen -------------------------------
207 enum Master_CollConditions
209 PARA_IN_LIST
= 0x0001,
210 PARA_IN_OUTLINE
= 0x0002,
211 PARA_IN_FRAME
= 0x0004,
212 PARA_IN_TABLEHEAD
= 0x0008,
213 PARA_IN_TABLEBODY
= 0x0010,
214 PARA_IN_SECTION
= 0x0020,
215 PARA_IN_FOOTENOTE
= 0x0040,
216 PARA_IN_FOOTER
= 0x0080,
217 PARA_IN_HEADER
= 0x0100,
218 PARA_IN_ENDNOTE
= 0x0200,
220 USRFLD_EXPRESSION
= (int)0x8000
224 class SW_DLLPUBLIC SwCollCondition
: public SwClient
230 String
* pFldExpression
;
234 TYPEINFO(); //Bereits in Basisklasse Client drin.
237 SwCollCondition( SwTxtFmtColl
* pColl
, ULONG nMasterCond
,
238 ULONG nSubCond
= 0 );
239 SwCollCondition( SwTxtFmtColl
* pColl
, ULONG nMasterCond
,
240 const String
& rSubExp
);
241 virtual ~SwCollCondition();
243 // @@@ public copy ctor, but no copy assignment?
244 SwCollCondition( const SwCollCondition
& rCpy
);
246 // @@@ public copy ctor, but no copy assignment?
247 SwCollCondition
& operator= (const SwCollCondition
&);
250 int operator==( const SwCollCondition
& rCmp
) const;
251 int operator!=( const SwCollCondition
& rCmp
) const
252 { return ! (*this == rCmp
); }
254 ULONG
GetCondition() const { return nCondition
; }
255 ULONG
GetSubCondition() const { return aSubCondition
.nSubCondition
; }
256 const String
* GetFldExpression() const
257 { return aSubCondition
.pFldExpression
; }
259 void SetCondition( ULONG nCond
, ULONG nSubCond
);
260 SwTxtFmtColl
* GetTxtFmtColl() const { return (SwTxtFmtColl
*)GetRegisteredIn(); }
264 typedef SwCollCondition
* SwCollConditionPtr
;
265 SV_DECL_PTRARR_DEL( SwFmtCollConditions
, SwCollConditionPtr
, 0, 5 )
267 class SW_DLLPUBLIC SwConditionTxtFmtColl
: public SwTxtFmtColl
271 SwFmtCollConditions aCondColls
;
273 SwConditionTxtFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
274 SwTxtFmtColl
* pDerFrom
= 0 )
275 : SwTxtFmtColl( rPool
, pFmtCollName
, pDerFrom
, RES_CONDTXTFMTCOLL
)
277 SwConditionTxtFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
278 SwTxtFmtColl
* pDerFrom
= 0 )
279 : SwTxtFmtColl( rPool
, rFmtCollName
, pDerFrom
, RES_CONDTXTFMTCOLL
)
283 TYPEINFO(); //Bereits in Basisklasse Client drin.
285 virtual ~SwConditionTxtFmtColl();
287 // zum "abfischen" von Aenderungen
288 // virtual void Modify( SfxPoolItem*, SfxPoolItem* );
290 const SwCollCondition
* HasCondition( const SwCollCondition
& rCond
) const;
291 const SwFmtCollConditions
& GetCondColls() const { return aCondColls
; }
292 void InsertCondition( const SwCollCondition
& rCond
);
293 BOOL
RemoveCondition( const SwCollCondition
& rCond
);
295 void SetConditions( const SwFmtCollConditions
& );
300 // ------------- Inline Implementierungen --------------------
302 inline void SwTxtFmtColl::SetNextTxtFmtColl( SwTxtFmtColl
& rNext
)
304 pNextTxtFmtColl
= &rNext
;