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 $
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 ************************************************************************/
38 #include <swtypes.hxx> // fuer MAXLEVEL
45 class SwDoc
; // fuer friend
47 class SwFmtColl
: public SwFmt
50 SwFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtName
,
51 const USHORT
* pWhichRanges
, SwFmtColl
* pDerFrom
,
53 : SwFmt( rPool
, pFmtName
, pWhichRanges
, pDerFrom
, nFmtWhich
)
56 SwFmtColl( SwAttrPool
& rPool
, const String
&rFmtName
,
57 const USHORT
* pWhichRanges
, SwFmtColl
* pDerFrom
,
59 : SwFmt( rPool
, rFmtName
, pWhichRanges
, pDerFrom
, nFmtWhich
)
64 // erstmal wird nicht kopiert und nicht zugewiesen
65 SwFmtColl(const SwFmtColl
& );
66 const SwFmtColl
&operator=(const SwFmtColl
&);
70 class SwTxtFmtColl
: public SwFmtColl
75 SwTxtFmtColl
*pNextTxtFmtColl
;
77 SwTxtFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
78 SwTxtFmtColl
* pDerFrom
= 0,
79 USHORT nFmtWh
= RES_TXTFMTCOLL
)
80 : SwFmtColl( rPool
, pFmtCollName
, aTxtFmtCollSetRange
,
82 nOutlineLevel( NO_NUMBERING
)
83 { pNextTxtFmtColl
= this; }
85 SwTxtFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
86 SwTxtFmtColl
* pDerFrom
= 0,
87 USHORT nFmtWh
= RES_TXTFMTCOLL
)
88 : SwFmtColl( rPool
, rFmtCollName
, aTxtFmtCollSetRange
,
90 nOutlineLevel( NO_NUMBERING
)
91 { pNextTxtFmtColl
= this; }
95 // zum "abfischen" von UL-/LR-/FontHeight Aenderungen
96 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
98 TYPEINFO(); //Bereits in Basisklasse Client drin.
100 inline void SetOutlineLevel( BYTE
);
101 inline BYTE
GetOutlineLevel() const { return nOutlineLevel
; }
103 inline void SetNextTxtFmtColl(SwTxtFmtColl
& rNext
);
104 SwTxtFmtColl
& GetNextTxtFmtColl() const { return *pNextTxtFmtColl
; }
106 BOOL
IsAtDocNodeSet() const;
108 /*----------------- JP 09.08.94 17:36 -------------------
109 wird die Funktionalitaet von Zeichenvorlagen an Absatzvorlagen
110 ueberhaupt benoetigt ??
112 Wenn, ja dann muessen im TextNode und hier in der TxtCollection ein 2.
113 Attset fuer die Char-Attribute angelegt werden; damit die Vererbung
114 und der Zugriff auf die gesetzen Attribute richtig funktioniert!!
116 virtual BOOL SetDerivedFrom( SwFmtColl* pDerFrom = 0 );
118 inline SwCharFmt* GetCharFmt() const;
119 inline BOOL IsCharFmtSet() const;
120 void SetCharFmt(SwCharFmt *);
122 inline BOOL SwTxtFmtColl::IsCharFmtSet() const
124 return aCharDepend.GetRegisteredIn() ? TRUE : FALSE;
126 inline SwCharFmt* SwTxtFmtColl::GetCharFmt() const
128 return (SwCharFmt*)aCharDepend.GetRegisteredIn();
130 --------------------------------------------------*/
133 typedef SwTxtFmtColl
* SwTxtFmtCollPtr
;
134 SV_DECL_PTRARR(SwTxtFmtColls
,SwTxtFmtCollPtr
,2,4)
137 class SwGrfFmtColl
: public SwFmtColl
141 SwGrfFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
142 SwGrfFmtColl
* pDerFrom
= 0 )
143 : SwFmtColl( rPool
, pFmtCollName
, aGrfFmtCollSetRange
,
144 pDerFrom
, RES_GRFFMTCOLL
)
147 SwGrfFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
148 SwGrfFmtColl
* pDerFrom
= 0 )
149 : SwFmtColl( rPool
, rFmtCollName
, aGrfFmtCollSetRange
,
150 pDerFrom
, RES_GRFFMTCOLL
)
154 TYPEINFO(); //Bereits in Basisklasse Client drin.
157 typedef SwGrfFmtColl
* SwGrfFmtCollPtr
;
158 SV_DECL_PTRARR(SwGrfFmtColls
,SwGrfFmtCollPtr
,2,4)
163 // --------- Bedingte Vorlagen -------------------------------
165 enum Master_CollConditions
167 PARA_IN_LIST
= 0x0001,
168 PARA_IN_OUTLINE
= 0x0002,
169 PARA_IN_FRAME
= 0x0004,
170 PARA_IN_TABLEHEAD
= 0x0008,
171 PARA_IN_TABLEBODY
= 0x0010,
172 PARA_IN_SECTION
= 0x0020,
173 PARA_IN_FOOTENOTE
= 0x0040,
174 PARA_IN_FOOTER
= 0x0080,
175 PARA_IN_HEADER
= 0x0100,
176 PARA_IN_ENDNOTE
= 0x0200,
178 USRFLD_EXPRESSION
= (int)0x8000
182 class SwCollCondition
: public SwClient
188 String
* pFldExpression
;
192 TYPEINFO(); //Bereits in Basisklasse Client drin.
195 SwCollCondition( SwTxtFmtColl
* pColl
, ULONG nMasterCond
,
196 ULONG nSubCond
= 0 );
198 virtual ~SwCollCondition();
200 int operator==( const SwCollCondition
& rCmp
) const;
201 int operator!=( const SwCollCondition
& rCmp
) const
202 { return ! (*this == rCmp
); }
204 ULONG
GetCondition() const { return nCondition
; }
205 ULONG
GetSubCondition() const { return aSubCondition
.nSubCondition
; }
206 const String
* GetFldExpression() const
207 { return aSubCondition
.pFldExpression
; }
209 void SetCondition( ULONG nCond
, ULONG nSubCond
);
210 SwTxtFmtColl
* GetTxtFmtColl() const { return (SwTxtFmtColl
*)GetRegisteredIn(); }
214 typedef SwCollCondition
* SwCollConditionPtr
;
215 SV_DECL_PTRARR_DEL( SwFmtCollConditions
, SwCollConditionPtr
, 0, 5 )//STRIP008 ;
217 class SwConditionTxtFmtColl
: public SwTxtFmtColl
221 SwFmtCollConditions aCondColls
;
223 SwConditionTxtFmtColl( SwAttrPool
& rPool
, const sal_Char
* pFmtCollName
,
224 SwTxtFmtColl
* pDerFrom
= 0 )
225 : SwTxtFmtColl( rPool
, pFmtCollName
, pDerFrom
, RES_CONDTXTFMTCOLL
)
227 SwConditionTxtFmtColl( SwAttrPool
& rPool
, const String
&rFmtCollName
,
228 SwTxtFmtColl
* pDerFrom
= 0 )
229 : SwTxtFmtColl( rPool
, rFmtCollName
, pDerFrom
, RES_CONDTXTFMTCOLL
)
233 TYPEINFO(); //Bereits in Basisklasse Client drin.
235 virtual ~SwConditionTxtFmtColl();
237 // zum "abfischen" von Aenderungen
238 // virtual void Modify( SfxPoolItem*, SfxPoolItem* );
240 const SwCollCondition
* HasCondition( const SwCollCondition
& rCond
) const;
241 const SwFmtCollConditions
& GetCondColls() const { return aCondColls
; }
242 void InsertCondition( const SwCollCondition
& rCond
);
248 // ------------- Inline Implementierungen --------------------
250 inline void SwTxtFmtColl::SetNextTxtFmtColl( SwTxtFmtColl
& rNext
)
252 pNextTxtFmtColl
= &rNext
;
255 inline void SwTxtFmtColl::SetOutlineLevel( BYTE nLevel
)
257 ASSERT( nLevel
< MAXLEVEL
|| nLevel
== NO_NUMBERING
,
258 "SwTxtFmtColl: Level too low" );
259 nOutlineLevel
= nLevel
;
263 } //namespace binfilter