1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svx/xtable.hxx> 28cdf0e10cSrcweir #include "svx/xattr.hxx" 29cdf0e10cSrcweir #include <svx/xpool.hxx> 30cdf0e10cSrcweir #include <svx/svdattr.hxx> 31cdf0e10cSrcweir #include <svx/svxids.hrc> 32cdf0e10cSrcweir #include <svl/itemset.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir /************************************************************************* 35cdf0e10cSrcweir |* 36cdf0e10cSrcweir |* Konstruktor 37cdf0e10cSrcweir |* 38cdf0e10cSrcweir \************************************************************************/ 39cdf0e10cSrcweir 40cdf0e10cSrcweir XOutdevItemPool::XOutdevItemPool( 41cdf0e10cSrcweir SfxItemPool* _pMaster, 42cdf0e10cSrcweir sal_uInt16 nAttrStart, 43cdf0e10cSrcweir sal_uInt16 nAttrEnd, 44cdf0e10cSrcweir sal_Bool bLoadRefCounts) 45cdf0e10cSrcweir : SfxItemPool(String("XOutdevItemPool", gsl_getSystemTextEncoding()), nAttrStart, nAttrEnd, 0L, 0L, bLoadRefCounts) 46cdf0e10cSrcweir { 47cdf0e10cSrcweir // prepare some defaults 48cdf0e10cSrcweir const XubString aNullStr; 4970d3707aSArmin Le Grand const Graphic aNullGraphic; 50cdf0e10cSrcweir const basegfx::B2DPolyPolygon aNullPol; 51cdf0e10cSrcweir const Color aNullLineCol(RGB_Color(COL_BLACK)); 52cdf0e10cSrcweir const Color aNullFillCol(RGB_COLORDATA( 153, 204, 255 )); 53cdf0e10cSrcweir const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY)); 54cdf0e10cSrcweir const XDash aNullDash; 55cdf0e10cSrcweir const XGradient aNullGrad(aNullLineCol, RGB_Color(COL_WHITE)); 56cdf0e10cSrcweir const XHatch aNullHatch(aNullLineCol); 57cdf0e10cSrcweir 58cdf0e10cSrcweir // get master pointer, evtl. add myself to the end of the pools 59cdf0e10cSrcweir if(!_pMaster) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir _pMaster = this; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir else 64cdf0e10cSrcweir { 65cdf0e10cSrcweir SfxItemPool* pParent = _pMaster; 66cdf0e10cSrcweir 67cdf0e10cSrcweir while(pParent->GetSecondaryPool()) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir pParent = pParent->GetSecondaryPool(); 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir pParent->SetSecondaryPool(this); 73cdf0e10cSrcweir } 74cdf0e10cSrcweir 75cdf0e10cSrcweir // prepare PoolDefaults 76cdf0e10cSrcweir mppLocalPoolDefaults = new SfxPoolItem*[GetLastWhich() - GetFirstWhich() + 1]; 77cdf0e10cSrcweir 78cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem; 79cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(this,aNullDash); 80cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem; 81cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol); 82cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(this,aNullPol); 83cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem (this,aNullPol); 84cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINESTARTWIDTH -XATTR_START] = new XLineStartWidthItem; 85cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINEENDWIDTH -XATTR_START] = new XLineEndWidthItem; 86cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINESTARTCENTER -XATTR_START] = new XLineStartCenterItem; 87cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem; 88cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem; 89cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem; 905aaf853bSArmin Le Grand mppLocalPoolDefaults[XATTR_LINECAP -XATTR_START] = new XLineCapItem; 91cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem; 92cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol); 93cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(this,aNullGrad); 94cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (this,aNullHatch); 9570d3707aSArmin Le Grand mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this, aNullGraphic); 96cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem; 97cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem; 98cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem; 99cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem; 100cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem; 101cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem; 102cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem; 103cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX -XATTR_START] = new XFillBmpTileOffsetXItem; 104cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY -XATTR_START] = new XFillBmpTileOffsetYItem; 105cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem; 106cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem; 107cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem; 108cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, sal_False ); 109cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol); 110cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem; 111cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem; 112cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem; 113cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem; 114cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSTART -XATTR_START] = new XFormTextStartItem; 115cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTMIRROR -XATTR_START] = new XFormTextMirrorItem; 116cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTOUTLINE -XATTR_START] = new XFormTextOutlineItem; 117cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSHADOW -XATTR_START] = new XFormTextShadowItem; 118cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol); 119cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSHDWXVAL -XATTR_START] = new XFormTextShadowXValItem; 120cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSHDWYVAL -XATTR_START] = new XFormTextShadowYValItem; 121cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSTDFORM -XATTR_START] = new XFormTextStdFormItem; 122cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem; 123cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSHDWTRANSP -XATTR_START] = new XFormTextShadowTranspItem; 124cdf0e10cSrcweir 125cdf0e10cSrcweir // create SetItems 126cdf0e10cSrcweir SfxItemSet* pSet=new SfxItemSet(*_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST); 127cdf0e10cSrcweir mppLocalPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(pSet); 128cdf0e10cSrcweir pSet=new SfxItemSet(*_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST); 129cdf0e10cSrcweir mppLocalPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(pSet); 130cdf0e10cSrcweir 131cdf0e10cSrcweir // create ItemInfos 132cdf0e10cSrcweir mpLocalItemInfos = new SfxItemInfo[GetLastWhich() - GetFirstWhich() + 1]; 133cdf0e10cSrcweir for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir mpLocalItemInfos[i - XATTR_START]._nSID = 0; 136cdf0e10cSrcweir mpLocalItemInfos[i - XATTR_START]._nFlags = SFX_ITEM_POOLABLE; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTYLE -XATTR_START]._nSID = SID_ATTR_LINE_STYLE; 140cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._nSID = SID_ATTR_LINE_DASH; 141cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_WIDTH; 142cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINECOLOR -XATTR_START]._nSID = SID_ATTR_LINE_COLOR; 143cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._nSID = SID_ATTR_LINE_START; 144cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._nSID = SID_ATTR_LINE_END; 145cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTARTWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_STARTWIDTH; 146cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEENDWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_ENDWIDTH; 147cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTARTCENTER -XATTR_START]._nSID = SID_ATTR_LINE_STARTCENTER; 148cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEENDCENTER -XATTR_START]._nSID = SID_ATTR_LINE_ENDCENTER; 149cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLSTYLE -XATTR_START]._nSID = SID_ATTR_FILL_STYLE; 150cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._nSID = SID_ATTR_FILL_COLOR; 151cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._nSID = SID_ATTR_FILL_GRADIENT; 152cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._nSID = SID_ATTR_FILL_HATCH; 153cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._nSID = SID_ATTR_FILL_BITMAP; 154cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSTYLE -XATTR_START]._nSID = SID_FORMTEXT_STYLE; 155cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTADJUST -XATTR_START]._nSID = SID_FORMTEXT_ADJUST; 156cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTDISTANCE -XATTR_START]._nSID = SID_FORMTEXT_DISTANCE; 157cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSTART -XATTR_START]._nSID = SID_FORMTEXT_START; 158cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTMIRROR -XATTR_START]._nSID = SID_FORMTEXT_MIRROR; 159cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTOUTLINE -XATTR_START]._nSID = SID_FORMTEXT_OUTLINE; 160cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHADOW -XATTR_START]._nSID = SID_FORMTEXT_SHADOW; 161cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHDWCOLOR -XATTR_START]._nSID = SID_FORMTEXT_SHDWCOLOR; 162cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHDWXVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWXVAL; 163cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWYVAL; 164cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSTDFORM -XATTR_START]._nSID = SID_FORMTEXT_STDFORM; 165cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM; 166cdf0e10cSrcweir 167*d5370dc8SArmin Le Grand // associate new slots for panels with known items 168*d5370dc8SArmin Le Grand mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE; 169*d5370dc8SArmin Le Grand mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE; 170*d5370dc8SArmin Le Grand mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE; 171*d5370dc8SArmin Le Grand mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nSID = SID_ATTR_LINE_JOINT; 172*d5370dc8SArmin Le Grand mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nSID = SID_ATTR_LINE_CAP; 173*d5370dc8SArmin Le Grand 174cdf0e10cSrcweir // if it's my own creation level, set Defaults and ItemInfos 175cdf0e10cSrcweir if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich()) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir SetDefaults(mppLocalPoolDefaults); 178cdf0e10cSrcweir SetItemInfos(mpLocalItemInfos); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir /************************************************************************* 183cdf0e10cSrcweir |* 184cdf0e10cSrcweir |* copy ctor, sorgt dafuer, dass die static defaults gecloned werden 185cdf0e10cSrcweir |* (Parameter 2 = sal_True) 186cdf0e10cSrcweir |* 187cdf0e10cSrcweir \************************************************************************/ 188cdf0e10cSrcweir 189cdf0e10cSrcweir XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool& rPool) 190cdf0e10cSrcweir : SfxItemPool(rPool, sal_True), 191cdf0e10cSrcweir mppLocalPoolDefaults(0L), 192cdf0e10cSrcweir mpLocalItemInfos(0L) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir /************************************************************************* 197cdf0e10cSrcweir |* 198cdf0e10cSrcweir |* Clone() 199cdf0e10cSrcweir |* 200cdf0e10cSrcweir \************************************************************************/ 201cdf0e10cSrcweir 202cdf0e10cSrcweir SfxItemPool* XOutdevItemPool::Clone() const 203cdf0e10cSrcweir { 204cdf0e10cSrcweir return new XOutdevItemPool(*this); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir 207cdf0e10cSrcweir /************************************************************************* 208cdf0e10cSrcweir |* 209cdf0e10cSrcweir |* Destruktor 210cdf0e10cSrcweir |* 211cdf0e10cSrcweir \************************************************************************/ 212cdf0e10cSrcweir 213cdf0e10cSrcweir XOutdevItemPool::~XOutdevItemPool() 214cdf0e10cSrcweir { 215cdf0e10cSrcweir Delete(); 216cdf0e10cSrcweir 217cdf0e10cSrcweir // remove own static defaults 218cdf0e10cSrcweir if(mppLocalPoolDefaults) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir SfxPoolItem** ppDefaultItem = mppLocalPoolDefaults; 221cdf0e10cSrcweir for(sal_uInt16 i(GetLastWhich() - GetFirstWhich() + 1); i; --i, ++ppDefaultItem) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir if ( *ppDefaultItem ) //Teile schon von abgel. Klasse abgeraeumt! 224cdf0e10cSrcweir { 225cdf0e10cSrcweir SetRefCount( **ppDefaultItem, 0 ); 226cdf0e10cSrcweir delete *ppDefaultItem; 227cdf0e10cSrcweir } 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir delete[] mppLocalPoolDefaults; 231cdf0e10cSrcweir } 232cdf0e10cSrcweir 233cdf0e10cSrcweir if(mpLocalItemInfos) 234cdf0e10cSrcweir { 235cdf0e10cSrcweir delete[] mpLocalItemInfos; 236cdf0e10cSrcweir } 237cdf0e10cSrcweir } 238cdf0e10cSrcweir 239cdf0e10cSrcweir // eof 240