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