1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SWATRSET_HXX 24 #define _SWATRSET_HXX 25 #include <tools/solar.h> 26 #include <tools/mempool.hxx> 27 #include <svl/itemset.hxx> 28 #include <svl/itempool.hxx> 29 #include <swdllapi.h> 30 31 class SwModify; 32 class SwDoc; 33 class OutputDevice; 34 class IDocumentSettingAccess; 35 class SfxBoolItem; 36 class SvxPostureItem; 37 class SvxWeightItem; 38 class SvxShadowedItem; 39 class SvxAutoKernItem; 40 class SvxWordLineModeItem; 41 class SvxContourItem; 42 class SvxKerningItem; 43 class SvxUnderlineItem; 44 class SvxOverlineItem; 45 class SvxCrossedOutItem; 46 class SvxFontHeightItem; 47 class SvxPropSizeItem; 48 class SvxFontItem; 49 class SvxColorItem; 50 class SvxCharSetColorItem; 51 class SvxLanguageItem; 52 class SvxEscapementItem; 53 class SvxCaseMapItem; 54 class SvxNoHyphenItem; 55 class SvxBlinkItem; 56 class SvxEmphasisMarkItem; 57 class SvxTwoLinesItem; 58 class SvxCharScaleWidthItem; 59 class SvxCharRotateItem; 60 class SvxCharReliefItem; 61 class SvxCharHiddenItem; 62 63 // Frame-Attribute 64 class SwFmtFillOrder; 65 class SwFmtFrmSize; 66 class SvxPaperBinItem; 67 class SvxLRSpaceItem; 68 class SvxULSpaceItem; 69 class SwFmtCntnt; 70 class SwFmtHeader; 71 class SwFmtFooter; 72 class SvxPrintItem; 73 class SvxOpaqueItem; 74 class SvxProtectItem; 75 class SwFmtSurround; 76 class SwFmtVertOrient; 77 class SwFmtHoriOrient; 78 class SwFmtAnchor; 79 class SvxBoxItem; 80 class SvxBrushItem; 81 class SvxShadowItem; 82 class SwFmtPageDesc; 83 class SvxFmtBreakItem; 84 class SwFmtCol; 85 class SvxMacroItem; 86 class SvxFmtKeepItem; 87 class SwFmtURL; 88 class SwFmtLineNumber; 89 class SwFmtEditInReadonly; 90 class SwFmtLayoutSplit; 91 class SwFmtRowSplit; 92 class SwFmtChain; 93 class SwFmtFtnAtTxtEnd; 94 class SwFmtEndAtTxtEnd; 95 class SwFmtNoBalancedColumns; 96 class SvxFrameDirectionItem; 97 class SwTextGridItem; 98 class SwHeaderAndFooterEatSpacingItem; 99 // OD 18.09.2003 #i18732# 100 class SwFmtFollowTextFlow; 101 // OD 2004-05-05 #i28701# 102 class SwFmtWrapInfluenceOnObjPos; 103 104 // Grafik-Attribute 105 class SwMirrorGrf; 106 class SwCropGrf; 107 class SwRotationGrf; 108 class SwLuminanceGrf; 109 class SwContrastGrf; 110 class SwChannelRGrf; 111 class SwChannelGGrf; 112 class SwChannelBGrf; 113 class SwGammaGrf; 114 class SwInvertGrf; 115 class SwTransparencyGrf; 116 class SwDrawModeGrf; 117 118 // Paragraph-Attribute 119 class SvxLineSpacingItem; 120 class SvxAdjustItem; 121 class SvxFmtSplitItem; 122 class SwRegisterItem; 123 class SwNumRuleItem; 124 class SvxWidowsItem; 125 class SvxOrphansItem; 126 class SvxTabStopItem; 127 class SvxHyphenZoneItem; 128 class SwFmtDrop; 129 class SvxScriptSpaceItem; 130 class SvxHangingPunctuationItem; 131 class SvxForbiddenRuleItem; 132 class SvxParaVertAlignItem; 133 class SvxParaGridItem; 134 class SwParaConnectBorderItem; 135 136 // TabellenBox-Attribute 137 class SwTblBoxNumFormat; 138 class SwTblBoxFormula; 139 class SwTblBoxValue; 140 141 class SwAttrPool : public SfxItemPool 142 { 143 private: 144 ///UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor 145 /// and destructor; still isolated to evtl. allow other use later 146 void createAndAddSecondaryPools(); 147 void removeAndDeleteSecondaryPools(); 148 149 friend void _InitCore(); // fuers anlegen/zerstoeren der 150 friend void _FinitCore(); // Versionsmaps 151 static sal_uInt16* pVersionMap1; 152 static sal_uInt16* pVersionMap2; 153 static sal_uInt16* pVersionMap3; 154 static sal_uInt16* pVersionMap4; 155 // OD 2004-01-21 #i18732# - due to extension of attribute set a new version 156 // map for binary filter is necessary (version map 5). 157 static sal_uInt16* pVersionMap5; 158 static sal_uInt16* pVersionMap6; 159 160 SwDoc* pDoc; 161 162 public: 163 SwAttrPool( SwDoc* pDoc ); 164 protected: 165 virtual ~SwAttrPool(); 166 public: 167 168 SwDoc* GetDoc() { return pDoc; } 169 const SwDoc* GetDoc() const { return pDoc; } 170 171 static sal_uInt16* GetVersionMap1() { return pVersionMap1; } 172 static sal_uInt16* GetVersionMap2() { return pVersionMap2; } 173 static sal_uInt16* GetVersionMap3() { return pVersionMap3; } 174 static sal_uInt16* GetVersionMap6() { return pVersionMap4; } 175 }; 176 177 178 class SW_DLLPUBLIC SwAttrSet : public SfxItemSet 179 { 180 // Pointer fuers Modify-System 181 SwAttrSet *pOldSet, *pNewSet; 182 183 // Notification-Callback 184 virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew ); 185 186 void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); } 187 public: 188 SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 ); 189 SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable ); 190 SwAttrSet( const SwAttrSet& ); 191 192 virtual SfxItemSet* Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const; 193 194 int Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew ); 195 int Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew ); 196 197 // ein Item oder einen Bereich loeschen 198 sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew ); 199 sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2, 200 SwAttrSet* pOld = 0, SwAttrSet* pNew = 0 ); 201 202 int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew ); 203 204 void GetPresentation( SfxItemPresentation ePres, 205 SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText ) const; 206 207 SwAttrPool* GetPool() const { return (SwAttrPool*)SfxItemSet::GetPool(); } 208 209 // kopiere die Attribute ggfs. ueber Dokumentgrenzen 210 void CopyToModify( SwModify& rMod ) const; 211 212 // ---------------------------------------------------------------- 213 // Sonderbehandlung fuer einige Attribute 214 // Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen: 215 // - SwFmtDropCaps 216 // - SwFmtPageDesc 217 // (Wird beim Einfuegen in Formate/Nodes gerufen) 218 // Second version is for the SwAttrSet handles of SwCntntNode. 219 bool SetModifyAtAttr( const SwModify* pModify ); 220 221 // Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer 222 // im Zugriff. 223 const SwDoc *GetDoc() const { return GetPool()->GetDoc(); } 224 SwDoc *GetDoc() { return GetPool()->GetDoc(); } 225 226 // GetMethoden: das Bool gibt an, ob nur im Set (sal_False) oder auch in 227 // den Parents gesucht werden soll. Wird nichts gefunden, 228 // wird das deflt. Attribut returnt. 229 // Charakter-Attribute - impl. steht im charatr.hxx 230 // AMA 12.10.94: Umstellung von SwFmt... auf Svx... 231 inline const SvxPostureItem &GetPosture( sal_Bool = sal_True ) const; 232 inline const SvxWeightItem &GetWeight( sal_Bool = sal_True ) const; 233 inline const SvxShadowedItem &GetShadowed( sal_Bool = sal_True ) const; 234 inline const SvxAutoKernItem &GetAutoKern( sal_Bool = sal_True ) const; 235 inline const SvxWordLineModeItem &GetWordLineMode( sal_Bool = sal_True ) const; 236 inline const SvxContourItem &GetContour( sal_Bool = sal_True ) const; 237 inline const SvxKerningItem &GetKerning( sal_Bool = sal_True ) const; 238 inline const SvxUnderlineItem &GetUnderline( sal_Bool = sal_True ) const; 239 inline const SvxOverlineItem &GetOverline( sal_Bool = sal_True ) const; 240 inline const SvxCrossedOutItem &GetCrossedOut( sal_Bool = sal_True ) const; 241 inline const SvxFontHeightItem &GetSize( sal_Bool = sal_True ) const; 242 inline const SvxPropSizeItem &GetPropSize( sal_Bool = sal_True ) const; 243 inline const SvxFontItem &GetFont( sal_Bool = sal_True ) const; 244 inline const SvxColorItem &GetColor( sal_Bool = sal_True ) const; 245 inline const SvxCharSetColorItem &GetCharSetColor( sal_Bool = sal_True ) const; 246 inline const SvxLanguageItem &GetLanguage( sal_Bool = sal_True ) const; 247 inline const SvxEscapementItem &GetEscapement( sal_Bool = sal_True ) const; 248 inline const SvxCaseMapItem &GetCaseMap( sal_Bool = sal_True ) const; 249 inline const SvxNoHyphenItem &GetNoHyphenHere( sal_Bool = sal_True ) const; 250 inline const SvxBlinkItem &GetBlink( sal_Bool = sal_True ) const; 251 inline const SvxBrushItem &GetChrBackground( sal_Bool = sal_True ) const; 252 inline const SvxFontItem &GetCJKFont( sal_Bool = sal_True ) const; 253 inline const SvxFontHeightItem &GetCJKSize( sal_Bool = sal_True ) const; 254 inline const SvxLanguageItem &GetCJKLanguage( sal_Bool = sal_True ) const; 255 inline const SvxPostureItem &GetCJKPosture( sal_Bool = sal_True ) const; 256 inline const SvxWeightItem &GetCJKWeight( sal_Bool = sal_True ) const; 257 inline const SvxFontItem &GetCTLFont( sal_Bool = sal_True ) const; 258 inline const SvxFontHeightItem &GetCTLSize( sal_Bool = sal_True ) const; 259 inline const SvxLanguageItem &GetCTLLanguage( sal_Bool = sal_True ) const; 260 inline const SvxPostureItem &GetCTLPosture( sal_Bool = sal_True ) const; 261 inline const SvxWeightItem &GetCTLWeight( sal_Bool = sal_True ) const; 262 inline const SfxBoolItem &GetWritingDirection( sal_Bool = sal_True ) const; 263 inline const SvxEmphasisMarkItem &GetEmphasisMark( sal_Bool = sal_True ) const; 264 inline const SvxTwoLinesItem &Get2Lines( sal_Bool = sal_True ) const; 265 inline const SvxCharScaleWidthItem &GetCharScaleW( sal_Bool = sal_True ) const; 266 inline const SvxCharRotateItem &GetCharRotate( sal_Bool = sal_True ) const; 267 inline const SvxCharReliefItem &GetCharRelief( sal_Bool = sal_True ) const; 268 inline const SvxCharHiddenItem &GetCharHidden( sal_Bool = sal_True ) const; 269 270 // Frame-Attribute - impl. steht im frmatr.hxx 271 inline const SwFmtFillOrder &GetFillOrder( sal_Bool = sal_True ) const; 272 inline const SwFmtFrmSize &GetFrmSize( sal_Bool = sal_True ) const; 273 inline const SvxPaperBinItem &GetPaperBin( sal_Bool = sal_True ) const; 274 inline const SvxLRSpaceItem &GetLRSpace( sal_Bool = sal_True ) const; 275 inline const SvxULSpaceItem &GetULSpace( sal_Bool = sal_True ) const; 276 inline const SwFmtCntnt &GetCntnt( sal_Bool = sal_True ) const; 277 inline const SwFmtHeader &GetHeader( sal_Bool = sal_True ) const; 278 inline const SwFmtFooter &GetFooter( sal_Bool = sal_True ) const; 279 inline const SvxPrintItem &GetPrint( sal_Bool = sal_True ) const; 280 inline const SvxOpaqueItem &GetOpaque( sal_Bool = sal_True ) const; 281 inline const SvxProtectItem &GetProtect( sal_Bool = sal_True ) const; 282 inline const SwFmtSurround &GetSurround( sal_Bool = sal_True ) const; 283 inline const SwFmtVertOrient &GetVertOrient( sal_Bool = sal_True ) const; 284 inline const SwFmtHoriOrient &GetHoriOrient( sal_Bool = sal_True ) const; 285 inline const SwFmtAnchor &GetAnchor( sal_Bool = sal_True ) const; 286 inline const SvxBoxItem &GetBox( sal_Bool = sal_True ) const; 287 inline const SvxFmtKeepItem &GetKeep( sal_Bool = sal_True ) const; 288 inline const SvxBrushItem &GetBackground( sal_Bool = sal_True ) const; 289 inline const SvxShadowItem &GetShadow( sal_Bool = sal_True ) const; 290 inline const SwFmtPageDesc &GetPageDesc( sal_Bool = sal_True ) const; 291 inline const SvxFmtBreakItem &GetBreak( sal_Bool = sal_True ) const; 292 inline const SwFmtCol &GetCol( sal_Bool = sal_True ) const; 293 inline const SvxMacroItem &GetMacro( sal_Bool = sal_True ) const; 294 inline const SwFmtURL &GetURL( sal_Bool = sal_True ) const; 295 inline const SwFmtEditInReadonly &GetEditInReadonly( sal_Bool = sal_True ) const; 296 inline const SwFmtLayoutSplit &GetLayoutSplit( sal_Bool = sal_True ) const; 297 inline const SwFmtRowSplit &GetRowSplit( sal_Bool = sal_True ) const; 298 inline const SwFmtChain &GetChain( sal_Bool = sal_True ) const; 299 inline const SwFmtLineNumber &GetLineNumber( sal_Bool = sal_True ) const; 300 inline const SwFmtFtnAtTxtEnd &GetFtnAtTxtEnd( sal_Bool = sal_True ) const; 301 inline const SwFmtEndAtTxtEnd &GetEndAtTxtEnd( sal_Bool = sal_True ) const; 302 inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const; 303 inline const SvxFrameDirectionItem &GetFrmDir( sal_Bool = sal_True ) const; 304 inline const SwTextGridItem &GetTextGrid( sal_Bool = sal_True ) const; 305 inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const; 306 // OD 18.09.2003 #i18732# 307 inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const; 308 // OD 2004-05-05 #i28701# 309 inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const; 310 311 // Grafik-Attribute - impl. steht im grfatr.hxx 312 inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const; 313 inline const SwCropGrf &GetCropGrf( sal_Bool = sal_True ) const; 314 inline const SwRotationGrf &GetRotationGrf(sal_Bool = sal_True ) const; 315 inline const SwLuminanceGrf &GetLuminanceGrf(sal_Bool = sal_True ) const; 316 inline const SwContrastGrf &GetContrastGrf(sal_Bool = sal_True ) const; 317 inline const SwChannelRGrf &GetChannelRGrf(sal_Bool = sal_True ) const; 318 inline const SwChannelGGrf &GetChannelGGrf(sal_Bool = sal_True ) const; 319 inline const SwChannelBGrf &GetChannelBGrf(sal_Bool = sal_True ) const; 320 inline const SwGammaGrf &GetGammaGrf(sal_Bool = sal_True ) const; 321 inline const SwInvertGrf &GetInvertGrf(sal_Bool = sal_True ) const; 322 inline const SwTransparencyGrf &GetTransparencyGrf(sal_Bool = sal_True ) const; 323 inline const SwDrawModeGrf &GetDrawModeGrf(sal_Bool = sal_True ) const; 324 325 // Paragraph-Attribute - impl. steht im paratr.hxx 326 inline const SvxLineSpacingItem &GetLineSpacing( sal_Bool = sal_True ) const; 327 inline const SvxAdjustItem &GetAdjust( sal_Bool = sal_True ) const; 328 inline const SvxFmtSplitItem &GetSplit( sal_Bool = sal_True ) const; 329 inline const SwRegisterItem &GetRegister( sal_Bool = sal_True ) const; 330 inline const SwNumRuleItem &GetNumRule( sal_Bool = sal_True ) const; 331 inline const SvxWidowsItem &GetWidows( sal_Bool = sal_True ) const; 332 inline const SvxOrphansItem &GetOrphans( sal_Bool = sal_True ) const; 333 inline const SvxTabStopItem &GetTabStops( sal_Bool = sal_True ) const; 334 inline const SvxHyphenZoneItem &GetHyphenZone( sal_Bool = sal_True ) const; 335 inline const SwFmtDrop &GetDrop( sal_Bool = sal_True ) const; 336 inline const SvxScriptSpaceItem &GetScriptSpace(sal_Bool = sal_True) const; 337 inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const; 338 inline const SvxForbiddenRuleItem &GetForbiddenRule(sal_Bool = sal_True) const; 339 inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const; 340 inline const SvxParaGridItem &GetParaGrid(sal_Bool = sal_True) const; 341 inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const; 342 343 // TabellenBox-Attribute - impl. steht im cellatr.hxx 344 inline const SwTblBoxNumFormat &GetTblBoxNumFmt( sal_Bool = sal_True ) const; 345 inline const SwTblBoxFormula &GetTblBoxFormula( sal_Bool = sal_True ) const; 346 inline const SwTblBoxValue &GetTblBoxValue( sal_Bool = sal_True ) const; 347 348 DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet) 349 }; 350 351 //Helper for filters to find true lineheight of a font 352 SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess, 353 const SwAttrSet &rSet, 354 const OutputDevice &rOut, sal_Int16 nScript); 355 #endif 356