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 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 27 #include <svx/xtable.hxx> 28 #include "svx/xattr.hxx" 29 #include <svx/xpool.hxx> 30 #include <svx/svdattr.hxx> 31 #include <svx/svxids.hrc> 32 #include <svl/itemset.hxx> 33 34 /************************************************************************* 35 |* 36 |* Konstruktor 37 |* 38 \************************************************************************/ 39 40 XOutdevItemPool::XOutdevItemPool( 41 SfxItemPool* _pMaster, 42 sal_uInt16 nAttrStart, 43 sal_uInt16 nAttrEnd, 44 sal_Bool bLoadRefCounts) 45 : SfxItemPool(String("XOutdevItemPool", gsl_getSystemTextEncoding()), nAttrStart, nAttrEnd, 0L, 0L, bLoadRefCounts) 46 { 47 // prepare some defaults 48 const XubString aNullStr; 49 const Bitmap aNullBmp; 50 const basegfx::B2DPolyPolygon aNullPol; 51 const Color aNullLineCol(RGB_Color(COL_BLACK)); 52 const Color aNullFillCol(RGB_COLORDATA( 153, 204, 255 )); 53 const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY)); 54 const XDash aNullDash; 55 const XGradient aNullGrad(aNullLineCol, RGB_Color(COL_WHITE)); 56 const XHatch aNullHatch(aNullLineCol); 57 58 // get master pointer, evtl. add myself to the end of the pools 59 if(!_pMaster) 60 { 61 _pMaster = this; 62 } 63 else 64 { 65 SfxItemPool* pParent = _pMaster; 66 67 while(pParent->GetSecondaryPool()) 68 { 69 pParent = pParent->GetSecondaryPool(); 70 } 71 72 pParent->SetSecondaryPool(this); 73 } 74 75 // prepare PoolDefaults 76 mppLocalPoolDefaults = new SfxPoolItem*[GetLastWhich() - GetFirstWhich() + 1]; 77 78 mppLocalPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem; 79 mppLocalPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(this,aNullDash); 80 mppLocalPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem; 81 mppLocalPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol); 82 mppLocalPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(this,aNullPol); 83 mppLocalPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem (this,aNullPol); 84 mppLocalPoolDefaults[XATTR_LINESTARTWIDTH -XATTR_START] = new XLineStartWidthItem; 85 mppLocalPoolDefaults[XATTR_LINEENDWIDTH -XATTR_START] = new XLineEndWidthItem; 86 mppLocalPoolDefaults[XATTR_LINESTARTCENTER -XATTR_START] = new XLineStartCenterItem; 87 mppLocalPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem; 88 mppLocalPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem; 89 mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem; 90 mppLocalPoolDefaults[XATTR_LINECAP -XATTR_START] = new XLineCapItem; 91 mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem; 92 mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol); 93 mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(this,aNullGrad); 94 mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (this,aNullHatch); 95 mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this,aNullBmp); 96 mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem; 97 mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem; 98 mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem; 99 mppLocalPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem; 100 mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem; 101 mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem; 102 mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem; 103 mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX -XATTR_START] = new XFillBmpTileOffsetXItem; 104 mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY -XATTR_START] = new XFillBmpTileOffsetYItem; 105 mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem; 106 mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem; 107 mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem; 108 mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, sal_False ); 109 mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol); 110 mppLocalPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem; 111 mppLocalPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem; 112 mppLocalPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem; 113 mppLocalPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem; 114 mppLocalPoolDefaults[XATTR_FORMTXTSTART -XATTR_START] = new XFormTextStartItem; 115 mppLocalPoolDefaults[XATTR_FORMTXTMIRROR -XATTR_START] = new XFormTextMirrorItem; 116 mppLocalPoolDefaults[XATTR_FORMTXTOUTLINE -XATTR_START] = new XFormTextOutlineItem; 117 mppLocalPoolDefaults[XATTR_FORMTXTSHADOW -XATTR_START] = new XFormTextShadowItem; 118 mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol); 119 mppLocalPoolDefaults[XATTR_FORMTXTSHDWXVAL -XATTR_START] = new XFormTextShadowXValItem; 120 mppLocalPoolDefaults[XATTR_FORMTXTSHDWYVAL -XATTR_START] = new XFormTextShadowYValItem; 121 mppLocalPoolDefaults[XATTR_FORMTXTSTDFORM -XATTR_START] = new XFormTextStdFormItem; 122 mppLocalPoolDefaults[XATTR_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem; 123 mppLocalPoolDefaults[XATTR_FORMTXTSHDWTRANSP -XATTR_START] = new XFormTextShadowTranspItem; 124 125 // create SetItems 126 SfxItemSet* pSet=new SfxItemSet(*_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST); 127 mppLocalPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(pSet); 128 pSet=new SfxItemSet(*_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST); 129 mppLocalPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(pSet); 130 131 // create ItemInfos 132 mpLocalItemInfos = new SfxItemInfo[GetLastWhich() - GetFirstWhich() + 1]; 133 for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++) 134 { 135 mpLocalItemInfos[i - XATTR_START]._nSID = 0; 136 mpLocalItemInfos[i - XATTR_START]._nFlags = SFX_ITEM_POOLABLE; 137 } 138 139 mpLocalItemInfos[XATTR_LINESTYLE -XATTR_START]._nSID = SID_ATTR_LINE_STYLE; 140 mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._nSID = SID_ATTR_LINE_DASH; 141 mpLocalItemInfos[XATTR_LINEWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_WIDTH; 142 mpLocalItemInfos[XATTR_LINECOLOR -XATTR_START]._nSID = SID_ATTR_LINE_COLOR; 143 mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._nSID = SID_ATTR_LINE_START; 144 mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._nSID = SID_ATTR_LINE_END; 145 mpLocalItemInfos[XATTR_LINESTARTWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_STARTWIDTH; 146 mpLocalItemInfos[XATTR_LINEENDWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_ENDWIDTH; 147 mpLocalItemInfos[XATTR_LINESTARTCENTER -XATTR_START]._nSID = SID_ATTR_LINE_STARTCENTER; 148 mpLocalItemInfos[XATTR_LINEENDCENTER -XATTR_START]._nSID = SID_ATTR_LINE_ENDCENTER; 149 mpLocalItemInfos[XATTR_FILLSTYLE -XATTR_START]._nSID = SID_ATTR_FILL_STYLE; 150 mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._nSID = SID_ATTR_FILL_COLOR; 151 mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._nSID = SID_ATTR_FILL_GRADIENT; 152 mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._nSID = SID_ATTR_FILL_HATCH; 153 mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._nSID = SID_ATTR_FILL_BITMAP; 154 mpLocalItemInfos[XATTR_FORMTXTSTYLE -XATTR_START]._nSID = SID_FORMTEXT_STYLE; 155 mpLocalItemInfos[XATTR_FORMTXTADJUST -XATTR_START]._nSID = SID_FORMTEXT_ADJUST; 156 mpLocalItemInfos[XATTR_FORMTXTDISTANCE -XATTR_START]._nSID = SID_FORMTEXT_DISTANCE; 157 mpLocalItemInfos[XATTR_FORMTXTSTART -XATTR_START]._nSID = SID_FORMTEXT_START; 158 mpLocalItemInfos[XATTR_FORMTXTMIRROR -XATTR_START]._nSID = SID_FORMTEXT_MIRROR; 159 mpLocalItemInfos[XATTR_FORMTXTOUTLINE -XATTR_START]._nSID = SID_FORMTEXT_OUTLINE; 160 mpLocalItemInfos[XATTR_FORMTXTSHADOW -XATTR_START]._nSID = SID_FORMTEXT_SHADOW; 161 mpLocalItemInfos[XATTR_FORMTXTSHDWCOLOR -XATTR_START]._nSID = SID_FORMTEXT_SHDWCOLOR; 162 mpLocalItemInfos[XATTR_FORMTXTSHDWXVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWXVAL; 163 mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWYVAL; 164 mpLocalItemInfos[XATTR_FORMTXTSTDFORM -XATTR_START]._nSID = SID_FORMTEXT_STDFORM; 165 mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM; 166 167 // if it's my own creation level, set Defaults and ItemInfos 168 if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich()) 169 { 170 SetDefaults(mppLocalPoolDefaults); 171 SetItemInfos(mpLocalItemInfos); 172 } 173 } 174 175 /************************************************************************* 176 |* 177 |* copy ctor, sorgt dafuer, dass die static defaults gecloned werden 178 |* (Parameter 2 = sal_True) 179 |* 180 \************************************************************************/ 181 182 XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool& rPool) 183 : SfxItemPool(rPool, sal_True), 184 mppLocalPoolDefaults(0L), 185 mpLocalItemInfos(0L) 186 { 187 } 188 189 /************************************************************************* 190 |* 191 |* Clone() 192 |* 193 \************************************************************************/ 194 195 SfxItemPool* XOutdevItemPool::Clone() const 196 { 197 return new XOutdevItemPool(*this); 198 } 199 200 /************************************************************************* 201 |* 202 |* Destruktor 203 |* 204 \************************************************************************/ 205 206 XOutdevItemPool::~XOutdevItemPool() 207 { 208 Delete(); 209 210 // remove own static defaults 211 if(mppLocalPoolDefaults) 212 { 213 SfxPoolItem** ppDefaultItem = mppLocalPoolDefaults; 214 for(sal_uInt16 i(GetLastWhich() - GetFirstWhich() + 1); i; --i, ++ppDefaultItem) 215 { 216 if ( *ppDefaultItem ) //Teile schon von abgel. Klasse abgeraeumt! 217 { 218 SetRefCount( **ppDefaultItem, 0 ); 219 delete *ppDefaultItem; 220 } 221 } 222 223 delete[] mppLocalPoolDefaults; 224 } 225 226 if(mpLocalItemInfos) 227 { 228 delete[] mpLocalItemInfos; 229 } 230 } 231 232 // eof 233