1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 #include <svl/svarray.hxx>
33 #include <swtypes.hxx> // fuer MAXLEVEL
35 class SwDoc
; // fuer friend
37 class SwFmtColl
: public SwFmt
40 SwFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtName
,
41 const USHORT
* pWhichRanges
, SwFmtColl
* pDerFrom
,
43 : SwFmt( rPool
, pFmtName
, pWhichRanges
, pDerFrom
, nFmtWhich
)
46 SwFmtColl( SwAttrPool
& rPool
, const String
&rFmtName
,
47 const USHORT
* pWhichRanges
, SwFmtColl
* pDerFrom
,
49 : SwFmt( rPool
, rFmtName
, pWhichRanges
, pDerFrom
, nFmtWhich
)
54 // erstmal wird nicht kopiert und nicht zugewiesen
55 SwFmtColl(const SwFmtColl
& );
56 const SwFmtColl
&operator=(const SwFmtColl
&);
60 class SW_DLLPUBLIC SwTxtFmtColl
: public SwFmtColl
64 SwTxtFmtColl(const SwTxtFmtColl
& rRef
);
66 // --> OD 2007-01-24 #i73790#
67 bool mbStayAssignedToListLevelOfOutlineStyle
;
71 //BYTE nOutlineLevel; //<-#outline level, removed by zhaojianwei
72 bool mbAssignedToOutlineStyle
;//<-#outline level added by zhaojianwei
74 SwTxtFmtColl
*pNextTxtFmtColl
;
76 SwTxtFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
77 SwTxtFmtColl
* pDerFrom
= 0,
78 USHORT nFmtWh
= RES_TXTFMTCOLL
)
79 : SwFmtColl( rPool
, pFmtCollName
, aTxtFmtCollSetRange
,
81 // --> OD 2007-01-24 #i73790#
82 mbStayAssignedToListLevelOfOutlineStyle( false ),
84 //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
85 mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
86 { pNextTxtFmtColl
= this; }
88 SwTxtFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
89 SwTxtFmtColl
* pDerFrom
= 0,
90 USHORT nFmtWh
= RES_TXTFMTCOLL
)
91 : SwFmtColl( rPool
, rFmtCollName
, aTxtFmtCollSetRange
,
93 // --> OD 2007-01-24 #i73790#
94 mbStayAssignedToListLevelOfOutlineStyle( false ),
96 //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
97 mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
98 { pNextTxtFmtColl
= this; }
101 // zum "abfischen" von UL-/LR-/FontHeight Aenderungen
102 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
104 TYPEINFO(); //Bereits in Basisklasse Client drin.
106 inline void SetNextTxtFmtColl(SwTxtFmtColl
& rNext
);
107 SwTxtFmtColl
& GetNextTxtFmtColl() const { return *pNextTxtFmtColl
; }
109 BOOL
IsAtDocNodeSet() const;
111 // --> OD 2006-11-22 #i71574#
112 //<-#outline level,zhaojianwei
113 void SetAttrOutlineLevel( int );
114 int GetAttrOutlineLevel() const;
115 int GetAssignedOutlineStyleLevel() const;
116 inline bool IsAssignedToListLevelOfOutlineStyle() const
118 return mbAssignedToOutlineStyle
;
120 void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel
);
121 void DeleteAssignmentToListLevelOfOutlineStyle();
125 // --> OD 2008-03-04 #refactorlists#
126 // override to recognize changes on the <SwNumRuleItem> and register/unregister
127 // the paragragh style at the corresponding <SwNumRule> instance
128 virtual BOOL
SetFmtAttr( const SfxPoolItem
& rAttr
);
129 virtual BOOL
SetFmtAttr( const SfxItemSet
& rSet
);
130 virtual BOOL
ResetFmtAttr( USHORT nWhich1
, USHORT nWhich2
= 0 );
133 // --> OD 2007-01-24 #i73790#
134 // override <ResetAllFmtAttr()> to stay assigned to list level of outline style
135 virtual USHORT
ResetAllFmtAttr();
137 inline bool StayAssignedToListLevelOfOutlineStyle() const
139 return mbStayAssignedToListLevelOfOutlineStyle
;
143 // --> OD 2008-02-13 #newlistleveattrs#
144 bool AreListLevelIndentsApplicable() const;
147 /*----------------- JP 09.08.94 17:36 -------------------
148 wird die Funktionalitaet von Zeichenvorlagen an Absatzvorlagen
149 ueberhaupt benoetigt ??
151 Wenn, ja dann muessen im TextNode und hier in der TxtCollection ein 2.
152 Attset fuer die Char-Attribute angelegt werden; damit die Vererbung
153 und der Zugriff auf die gesetzen Attribute richtig funktioniert!!
155 virtual BOOL SetDerivedFrom( SwFmtColl* pDerFrom = 0 );
157 inline SwCharFmt* GetCharFmt() const;
158 inline BOOL IsCharFmtSet() const;
159 void SetCharFmt(SwCharFmt *);
161 inline BOOL SwTxtFmtColl::IsCharFmtSet() const
163 return aCharDepend.GetRegisteredIn() ? TRUE : FALSE;
165 inline SwCharFmt* SwTxtFmtColl::GetCharFmt() const
167 return (SwCharFmt*)aCharDepend.GetRegisteredIn();
169 --------------------------------------------------*/
172 typedef SwTxtFmtColl
* SwTxtFmtCollPtr
;
173 SV_DECL_PTRARR(SwTxtFmtColls
,SwTxtFmtCollPtr
,2,4)
176 class SwGrfFmtColl
: public SwFmtColl
180 SwGrfFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
181 SwGrfFmtColl
* pDerFrom
= 0 )
182 : SwFmtColl( rPool
, pFmtCollName
, aGrfFmtCollSetRange
,
183 pDerFrom
, RES_GRFFMTCOLL
)
186 SwGrfFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
187 SwGrfFmtColl
* pDerFrom
= 0 )
188 : SwFmtColl( rPool
, rFmtCollName
, aGrfFmtCollSetRange
,
189 pDerFrom
, RES_GRFFMTCOLL
)
193 TYPEINFO(); //Bereits in Basisklasse Client drin.
196 typedef SwGrfFmtColl
* SwGrfFmtCollPtr
;
197 SV_DECL_PTRARR(SwGrfFmtColls
,SwGrfFmtCollPtr
,2,4)
202 // --------- Bedingte Vorlagen -------------------------------
204 enum Master_CollConditions
206 PARA_IN_LIST
= 0x0001,
207 PARA_IN_OUTLINE
= 0x0002,
208 PARA_IN_FRAME
= 0x0004,
209 PARA_IN_TABLEHEAD
= 0x0008,
210 PARA_IN_TABLEBODY
= 0x0010,
211 PARA_IN_SECTION
= 0x0020,
212 PARA_IN_FOOTENOTE
= 0x0040,
213 PARA_IN_FOOTER
= 0x0080,
214 PARA_IN_HEADER
= 0x0100,
215 PARA_IN_ENDNOTE
= 0x0200,
217 USRFLD_EXPRESSION
= (int)0x8000
221 class SW_DLLPUBLIC SwCollCondition
: public SwClient
227 String
* pFldExpression
;
231 TYPEINFO(); //Bereits in Basisklasse Client drin.
234 SwCollCondition( SwTxtFmtColl
* pColl
, ULONG nMasterCond
,
235 ULONG nSubCond
= 0 );
236 SwCollCondition( SwTxtFmtColl
* pColl
, ULONG nMasterCond
,
237 const String
& rSubExp
);
238 virtual ~SwCollCondition();
240 // @@@ public copy ctor, but no copy assignment?
241 SwCollCondition( const SwCollCondition
& rCpy
);
243 // @@@ public copy ctor, but no copy assignment?
244 SwCollCondition
& operator= (const SwCollCondition
&);
247 int operator==( const SwCollCondition
& rCmp
) const;
248 int operator!=( const SwCollCondition
& rCmp
) const
249 { return ! (*this == rCmp
); }
251 ULONG
GetCondition() const { return nCondition
; }
252 ULONG
GetSubCondition() const { return aSubCondition
.nSubCondition
; }
253 const String
* GetFldExpression() const
254 { return aSubCondition
.pFldExpression
; }
256 void SetCondition( ULONG nCond
, ULONG nSubCond
);
257 SwTxtFmtColl
* GetTxtFmtColl() const { return (SwTxtFmtColl
*)GetRegisteredIn(); }
261 typedef SwCollCondition
* SwCollConditionPtr
;
262 SV_DECL_PTRARR_DEL( SwFmtCollConditions
, SwCollConditionPtr
, 0, 5 )
264 class SW_DLLPUBLIC SwConditionTxtFmtColl
: public SwTxtFmtColl
268 SwFmtCollConditions aCondColls
;
270 SwConditionTxtFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
271 SwTxtFmtColl
* pDerFrom
= 0 )
272 : SwTxtFmtColl( rPool
, pFmtCollName
, pDerFrom
, RES_CONDTXTFMTCOLL
)
274 SwConditionTxtFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
275 SwTxtFmtColl
* pDerFrom
= 0 )
276 : SwTxtFmtColl( rPool
, rFmtCollName
, pDerFrom
, RES_CONDTXTFMTCOLL
)
280 TYPEINFO(); //Bereits in Basisklasse Client drin.
282 virtual ~SwConditionTxtFmtColl();
284 // zum "abfischen" von Aenderungen
285 // virtual void Modify( SfxPoolItem*, SfxPoolItem* );
287 const SwCollCondition
* HasCondition( const SwCollCondition
& rCond
) const;
288 const SwFmtCollConditions
& GetCondColls() const { return aCondColls
; }
289 void InsertCondition( const SwCollCondition
& rCond
);
290 BOOL
RemoveCondition( const SwCollCondition
& rCond
);
292 void SetConditions( const SwFmtCollConditions
& );
297 // ------------- Inline Implementierungen --------------------
299 inline void SwTxtFmtColl::SetNextTxtFmtColl( SwTxtFmtColl
& rNext
)
301 pNextTxtFmtColl
= &rNext
;