1f6e50924SAndrew Rist /**************************************************************
2f6e50924SAndrew Rist *
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
10f6e50924SAndrew Rist *
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.
19f6e50924SAndrew Rist *
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
XOutdevItemPool(SfxItemPool * _pMaster,sal_uInt16 nAttrStart,sal_uInt16 nAttrEnd,sal_Bool bLoadRefCounts)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;
51*1396af09SArmin Le Grand const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #121448# Use defined default color
52*1396af09SArmin Le Grand const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #121448# Use defined default color
53cdf0e10cSrcweir const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY));
54cdf0e10cSrcweir const XDash aNullDash;
55*1396af09SArmin Le Grand const XGradient aNullGrad(RGB_Color(COL_BLACK), 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_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem;
122cdf0e10cSrcweir mppLocalPoolDefaults[XATTR_FORMTXTSHDWTRANSP -XATTR_START] = new XFormTextShadowTranspItem;
123cdf0e10cSrcweir
124cdf0e10cSrcweir // create SetItems
125cdf0e10cSrcweir SfxItemSet* pSet=new SfxItemSet(*_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST);
126cdf0e10cSrcweir mppLocalPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(pSet);
127cdf0e10cSrcweir pSet=new SfxItemSet(*_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST);
128cdf0e10cSrcweir mppLocalPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(pSet);
129cdf0e10cSrcweir
130cdf0e10cSrcweir // create ItemInfos
131cdf0e10cSrcweir mpLocalItemInfos = new SfxItemInfo[GetLastWhich() - GetFirstWhich() + 1];
132cdf0e10cSrcweir for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++)
133cdf0e10cSrcweir {
134cdf0e10cSrcweir mpLocalItemInfos[i - XATTR_START]._nSID = 0;
135cdf0e10cSrcweir mpLocalItemInfos[i - XATTR_START]._nFlags = SFX_ITEM_POOLABLE;
136cdf0e10cSrcweir }
137cdf0e10cSrcweir
138cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTYLE -XATTR_START]._nSID = SID_ATTR_LINE_STYLE;
139cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._nSID = SID_ATTR_LINE_DASH;
140cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_WIDTH;
141cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINECOLOR -XATTR_START]._nSID = SID_ATTR_LINE_COLOR;
142cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._nSID = SID_ATTR_LINE_START;
143cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._nSID = SID_ATTR_LINE_END;
144cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTARTWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_STARTWIDTH;
145cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEENDWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_ENDWIDTH;
146cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINESTARTCENTER -XATTR_START]._nSID = SID_ATTR_LINE_STARTCENTER;
147cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEENDCENTER -XATTR_START]._nSID = SID_ATTR_LINE_ENDCENTER;
148cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLSTYLE -XATTR_START]._nSID = SID_ATTR_FILL_STYLE;
149cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._nSID = SID_ATTR_FILL_COLOR;
150cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._nSID = SID_ATTR_FILL_GRADIENT;
151cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._nSID = SID_ATTR_FILL_HATCH;
152cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._nSID = SID_ATTR_FILL_BITMAP;
153cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSTYLE -XATTR_START]._nSID = SID_FORMTEXT_STYLE;
154cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTADJUST -XATTR_START]._nSID = SID_FORMTEXT_ADJUST;
155cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTDISTANCE -XATTR_START]._nSID = SID_FORMTEXT_DISTANCE;
156cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSTART -XATTR_START]._nSID = SID_FORMTEXT_START;
157cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTMIRROR -XATTR_START]._nSID = SID_FORMTEXT_MIRROR;
158cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTOUTLINE -XATTR_START]._nSID = SID_FORMTEXT_OUTLINE;
159cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHADOW -XATTR_START]._nSID = SID_FORMTEXT_SHADOW;
160cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHDWCOLOR -XATTR_START]._nSID = SID_FORMTEXT_SHDWCOLOR;
161cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHDWXVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWXVAL;
162cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWYVAL;
163cdf0e10cSrcweir mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM;
164cdf0e10cSrcweir
165cdf0e10cSrcweir // associate new slots for panels with known items
166cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE;
167cdf0e10cSrcweir mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE;
168cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE;
169cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nSID = SID_ATTR_LINE_JOINT;
170cdf0e10cSrcweir mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nSID = SID_ATTR_LINE_CAP;
171cdf0e10cSrcweir
172cdf0e10cSrcweir // if it's my own creation level, set Defaults and ItemInfos
173cdf0e10cSrcweir if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich())
174cdf0e10cSrcweir {
175cdf0e10cSrcweir SetDefaults(mppLocalPoolDefaults);
176cdf0e10cSrcweir SetItemInfos(mpLocalItemInfos);
177cdf0e10cSrcweir }
178cdf0e10cSrcweir }
179cdf0e10cSrcweir
180cdf0e10cSrcweir /*************************************************************************
181cdf0e10cSrcweir |*
182cdf0e10cSrcweir |* copy ctor, sorgt dafuer, dass die static defaults gecloned werden
183cdf0e10cSrcweir |* (Parameter 2 = sal_True)
184cdf0e10cSrcweir |*
185cdf0e10cSrcweir \************************************************************************/
186cdf0e10cSrcweir
XOutdevItemPool(const XOutdevItemPool & rPool)187cdf0e10cSrcweir XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool& rPool)
188cdf0e10cSrcweir : SfxItemPool(rPool, sal_True),
189cdf0e10cSrcweir mppLocalPoolDefaults(0L),
190cdf0e10cSrcweir mpLocalItemInfos(0L)
191cdf0e10cSrcweir {
192cdf0e10cSrcweir }
193cdf0e10cSrcweir
194cdf0e10cSrcweir /*************************************************************************
195cdf0e10cSrcweir |*
196cdf0e10cSrcweir |* Clone()
197cdf0e10cSrcweir |*
198cdf0e10cSrcweir \************************************************************************/
199cdf0e10cSrcweir
Clone() const200cdf0e10cSrcweir SfxItemPool* XOutdevItemPool::Clone() const
201cdf0e10cSrcweir {
202cdf0e10cSrcweir return new XOutdevItemPool(*this);
203cdf0e10cSrcweir }
204cdf0e10cSrcweir
205cdf0e10cSrcweir /*************************************************************************
206cdf0e10cSrcweir |*
207cdf0e10cSrcweir |* Destruktor
208cdf0e10cSrcweir |*
209cdf0e10cSrcweir \************************************************************************/
210cdf0e10cSrcweir
~XOutdevItemPool()211cdf0e10cSrcweir XOutdevItemPool::~XOutdevItemPool()
212cdf0e10cSrcweir {
213cdf0e10cSrcweir Delete();
214cdf0e10cSrcweir
215cdf0e10cSrcweir // remove own static defaults
216cdf0e10cSrcweir if(mppLocalPoolDefaults)
217cdf0e10cSrcweir {
218cdf0e10cSrcweir SfxPoolItem** ppDefaultItem = mppLocalPoolDefaults;
219cdf0e10cSrcweir for(sal_uInt16 i(GetLastWhich() - GetFirstWhich() + 1); i; --i, ++ppDefaultItem)
220cdf0e10cSrcweir {
221cdf0e10cSrcweir if ( *ppDefaultItem ) //Teile schon von abgel. Klasse abgeraeumt!
222cdf0e10cSrcweir {
223cdf0e10cSrcweir SetRefCount( **ppDefaultItem, 0 );
224cdf0e10cSrcweir delete *ppDefaultItem;
225cdf0e10cSrcweir }
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
228cdf0e10cSrcweir delete[] mppLocalPoolDefaults;
229cdf0e10cSrcweir }
230cdf0e10cSrcweir
231 if(mpLocalItemInfos)
232 {
233 delete[] mpLocalItemInfos;
234 }
235 }
236
237 // eof
238