1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/xtable.hxx>
21 #include "svx/xattr.hxx"
22 #include <svx/xpool.hxx>
23 #include <svx/svdattr.hxx>
24 #include <svx/svxids.hrc>
25 #include <svl/itemset.hxx>
27 /*************************************************************************
31 \************************************************************************/
33 XOutdevItemPool::XOutdevItemPool(
34 SfxItemPool
* _pMaster
,
35 sal_uInt16 nAttrStart
,
37 sal_Bool bLoadRefCounts
)
38 : SfxItemPool(String("XOutdevItemPool", osl_getThreadTextEncoding()), nAttrStart
, nAttrEnd
, 0L, 0L, bLoadRefCounts
)
40 // prepare some defaults
41 const XubString aNullStr
;
42 const Graphic aNullGraphic
;
43 const basegfx::B2DPolyPolygon aNullPol
;
44 const Color
aNullLineCol(RGB_Color(COL_BLACK
));
45 const Color
aNullFillCol(RGB_COLORDATA( 153, 204, 255 ));
46 const Color
aNullShadowCol(RGB_Color(COL_LIGHTGRAY
));
47 const XDash aNullDash
;
48 const XGradient
aNullGrad(aNullLineCol
, RGB_Color(COL_WHITE
));
49 const XHatch
aNullHatch(aNullLineCol
);
51 // get master pointer, evtl. add myself to the end of the pools
58 SfxItemPool
* pParent
= _pMaster
;
60 while(pParent
->GetSecondaryPool())
62 pParent
= pParent
->GetSecondaryPool();
65 pParent
->SetSecondaryPool(this);
68 // prepare PoolDefaults
69 mppLocalPoolDefaults
= new SfxPoolItem
*[GetLastWhich() - GetFirstWhich() + 1];
71 mppLocalPoolDefaults
[XATTR_LINESTYLE
-XATTR_START
] = new XLineStyleItem
;
72 mppLocalPoolDefaults
[XATTR_LINEDASH
-XATTR_START
] = new XLineDashItem(this,aNullDash
);
73 mppLocalPoolDefaults
[XATTR_LINEWIDTH
-XATTR_START
] = new XLineWidthItem
;
74 mppLocalPoolDefaults
[XATTR_LINECOLOR
-XATTR_START
] = new XLineColorItem(aNullStr
,aNullLineCol
);
75 mppLocalPoolDefaults
[XATTR_LINESTART
-XATTR_START
] = new XLineStartItem(this,aNullPol
);
76 mppLocalPoolDefaults
[XATTR_LINEEND
-XATTR_START
] = new XLineEndItem (this,aNullPol
);
77 mppLocalPoolDefaults
[XATTR_LINESTARTWIDTH
-XATTR_START
] = new XLineStartWidthItem
;
78 mppLocalPoolDefaults
[XATTR_LINEENDWIDTH
-XATTR_START
] = new XLineEndWidthItem
;
79 mppLocalPoolDefaults
[XATTR_LINESTARTCENTER
-XATTR_START
] = new XLineStartCenterItem
;
80 mppLocalPoolDefaults
[XATTR_LINEENDCENTER
-XATTR_START
] = new XLineEndCenterItem
;
81 mppLocalPoolDefaults
[XATTR_LINETRANSPARENCE
-XATTR_START
] = new XLineTransparenceItem
;
82 mppLocalPoolDefaults
[XATTR_LINEJOINT
-XATTR_START
] = new XLineJointItem
;
83 mppLocalPoolDefaults
[XATTR_LINECAP
-XATTR_START
] = new XLineCapItem
;
84 mppLocalPoolDefaults
[XATTR_FILLSTYLE
-XATTR_START
] = new XFillStyleItem
;
85 mppLocalPoolDefaults
[XATTR_FILLCOLOR
-XATTR_START
] = new XFillColorItem (aNullStr
,aNullFillCol
);
86 mppLocalPoolDefaults
[XATTR_FILLGRADIENT
-XATTR_START
] = new XFillGradientItem(aNullGrad
);
87 mppLocalPoolDefaults
[XATTR_FILLHATCH
-XATTR_START
] = new XFillHatchItem (this,aNullHatch
);
88 mppLocalPoolDefaults
[XATTR_FILLBITMAP
-XATTR_START
] = new XFillBitmapItem (this, aNullGraphic
);
89 mppLocalPoolDefaults
[XATTR_FILLTRANSPARENCE
-XATTR_START
] = new XFillTransparenceItem
;
90 mppLocalPoolDefaults
[XATTR_GRADIENTSTEPCOUNT
-XATTR_START
] = new XGradientStepCountItem
;
91 mppLocalPoolDefaults
[XATTR_FILLBMP_TILE
-XATTR_START
] = new XFillBmpTileItem
;
92 mppLocalPoolDefaults
[XATTR_FILLBMP_POS
-XATTR_START
] = new XFillBmpPosItem
;
93 mppLocalPoolDefaults
[XATTR_FILLBMP_SIZEX
-XATTR_START
] = new XFillBmpSizeXItem
;
94 mppLocalPoolDefaults
[XATTR_FILLBMP_SIZEY
-XATTR_START
] = new XFillBmpSizeYItem
;
95 mppLocalPoolDefaults
[XATTR_FILLBMP_SIZELOG
-XATTR_START
] = new XFillBmpSizeLogItem
;
96 mppLocalPoolDefaults
[XATTR_FILLBMP_TILEOFFSETX
-XATTR_START
] = new XFillBmpTileOffsetXItem
;
97 mppLocalPoolDefaults
[XATTR_FILLBMP_TILEOFFSETY
-XATTR_START
] = new XFillBmpTileOffsetYItem
;
98 mppLocalPoolDefaults
[XATTR_FILLBMP_STRETCH
-XATTR_START
] = new XFillBmpStretchItem
;
99 mppLocalPoolDefaults
[XATTR_FILLBMP_POSOFFSETX
-XATTR_START
] = new XFillBmpPosOffsetXItem
;
100 mppLocalPoolDefaults
[XATTR_FILLBMP_POSOFFSETY
-XATTR_START
] = new XFillBmpPosOffsetYItem
;
101 mppLocalPoolDefaults
[XATTR_FILLFLOATTRANSPARENCE
-XATTR_START
] = new XFillFloatTransparenceItem( this, aNullGrad
, sal_False
);
102 mppLocalPoolDefaults
[XATTR_SECONDARYFILLCOLOR
-XATTR_START
] = new XSecondaryFillColorItem(aNullStr
, aNullFillCol
);
103 mppLocalPoolDefaults
[XATTR_FILLBACKGROUND
-XATTR_START
] = new XFillBackgroundItem
;
104 mppLocalPoolDefaults
[XATTR_FORMTXTSTYLE
-XATTR_START
] = new XFormTextStyleItem
;
105 mppLocalPoolDefaults
[XATTR_FORMTXTADJUST
-XATTR_START
] = new XFormTextAdjustItem
;
106 mppLocalPoolDefaults
[XATTR_FORMTXTDISTANCE
-XATTR_START
] = new XFormTextDistanceItem
;
107 mppLocalPoolDefaults
[XATTR_FORMTXTSTART
-XATTR_START
] = new XFormTextStartItem
;
108 mppLocalPoolDefaults
[XATTR_FORMTXTMIRROR
-XATTR_START
] = new XFormTextMirrorItem
;
109 mppLocalPoolDefaults
[XATTR_FORMTXTOUTLINE
-XATTR_START
] = new XFormTextOutlineItem
;
110 mppLocalPoolDefaults
[XATTR_FORMTXTSHADOW
-XATTR_START
] = new XFormTextShadowItem
;
111 mppLocalPoolDefaults
[XATTR_FORMTXTSHDWCOLOR
-XATTR_START
] = new XFormTextShadowColorItem(aNullStr
,aNullShadowCol
);
112 mppLocalPoolDefaults
[XATTR_FORMTXTSHDWXVAL
-XATTR_START
] = new XFormTextShadowXValItem
;
113 mppLocalPoolDefaults
[XATTR_FORMTXTSHDWYVAL
-XATTR_START
] = new XFormTextShadowYValItem
;
114 mppLocalPoolDefaults
[XATTR_FORMTXTSTDFORM
-XATTR_START
] = new XFormTextStdFormItem
;
115 mppLocalPoolDefaults
[XATTR_FORMTXTHIDEFORM
-XATTR_START
] = new XFormTextHideFormItem
;
116 mppLocalPoolDefaults
[XATTR_FORMTXTSHDWTRANSP
-XATTR_START
] = new XFormTextShadowTranspItem
;
119 SfxItemSet
* pSet
=new SfxItemSet(*_pMaster
, XATTR_LINE_FIRST
, XATTR_LINE_LAST
);
120 mppLocalPoolDefaults
[XATTRSET_LINE
- XATTR_START
] = new XLineAttrSetItem(pSet
);
121 pSet
=new SfxItemSet(*_pMaster
, XATTR_FILL_FIRST
, XATTR_FILL_LAST
);
122 mppLocalPoolDefaults
[XATTRSET_FILL
- XATTR_START
] = new XFillAttrSetItem(pSet
);
125 mpLocalItemInfos
= new SfxItemInfo
[GetLastWhich() - GetFirstWhich() + 1];
126 for(sal_uInt16
i(GetFirstWhich()); i
<= GetLastWhich(); i
++)
128 mpLocalItemInfos
[i
- XATTR_START
]._nSID
= 0;
129 mpLocalItemInfos
[i
- XATTR_START
]._nFlags
= SFX_ITEM_POOLABLE
;
132 mpLocalItemInfos
[XATTR_LINESTYLE
-XATTR_START
]._nSID
= SID_ATTR_LINE_STYLE
;
133 mpLocalItemInfos
[XATTR_LINEDASH
-XATTR_START
]._nSID
= SID_ATTR_LINE_DASH
;
134 mpLocalItemInfos
[XATTR_LINEWIDTH
-XATTR_START
]._nSID
= SID_ATTR_LINE_WIDTH
;
135 mpLocalItemInfos
[XATTR_LINECOLOR
-XATTR_START
]._nSID
= SID_ATTR_LINE_COLOR
;
136 mpLocalItemInfos
[XATTR_LINESTART
-XATTR_START
]._nSID
= SID_ATTR_LINE_START
;
137 mpLocalItemInfos
[XATTR_LINEEND
-XATTR_START
]._nSID
= SID_ATTR_LINE_END
;
138 mpLocalItemInfos
[XATTR_LINESTARTWIDTH
-XATTR_START
]._nSID
= SID_ATTR_LINE_STARTWIDTH
;
139 mpLocalItemInfos
[XATTR_LINEENDWIDTH
-XATTR_START
]._nSID
= SID_ATTR_LINE_ENDWIDTH
;
140 mpLocalItemInfos
[XATTR_LINESTARTCENTER
-XATTR_START
]._nSID
= SID_ATTR_LINE_STARTCENTER
;
141 mpLocalItemInfos
[XATTR_LINEENDCENTER
-XATTR_START
]._nSID
= SID_ATTR_LINE_ENDCENTER
;
142 mpLocalItemInfos
[XATTR_FILLSTYLE
-XATTR_START
]._nSID
= SID_ATTR_FILL_STYLE
;
143 mpLocalItemInfos
[XATTR_FILLCOLOR
-XATTR_START
]._nSID
= SID_ATTR_FILL_COLOR
;
144 mpLocalItemInfos
[XATTR_FILLGRADIENT
-XATTR_START
]._nSID
= SID_ATTR_FILL_GRADIENT
;
145 mpLocalItemInfos
[XATTR_FILLHATCH
-XATTR_START
]._nSID
= SID_ATTR_FILL_HATCH
;
146 mpLocalItemInfos
[XATTR_FILLBITMAP
-XATTR_START
]._nSID
= SID_ATTR_FILL_BITMAP
;
147 mpLocalItemInfos
[XATTR_FORMTXTSTYLE
-XATTR_START
]._nSID
= SID_FORMTEXT_STYLE
;
148 mpLocalItemInfos
[XATTR_FORMTXTADJUST
-XATTR_START
]._nSID
= SID_FORMTEXT_ADJUST
;
149 mpLocalItemInfos
[XATTR_FORMTXTDISTANCE
-XATTR_START
]._nSID
= SID_FORMTEXT_DISTANCE
;
150 mpLocalItemInfos
[XATTR_FORMTXTSTART
-XATTR_START
]._nSID
= SID_FORMTEXT_START
;
151 mpLocalItemInfos
[XATTR_FORMTXTMIRROR
-XATTR_START
]._nSID
= SID_FORMTEXT_MIRROR
;
152 mpLocalItemInfos
[XATTR_FORMTXTOUTLINE
-XATTR_START
]._nSID
= SID_FORMTEXT_OUTLINE
;
153 mpLocalItemInfos
[XATTR_FORMTXTSHADOW
-XATTR_START
]._nSID
= SID_FORMTEXT_SHADOW
;
154 mpLocalItemInfos
[XATTR_FORMTXTSHDWCOLOR
-XATTR_START
]._nSID
= SID_FORMTEXT_SHDWCOLOR
;
155 mpLocalItemInfos
[XATTR_FORMTXTSHDWXVAL
-XATTR_START
]._nSID
= SID_FORMTEXT_SHDWXVAL
;
156 mpLocalItemInfos
[XATTR_FORMTXTSHDWYVAL
-XATTR_START
]._nSID
= SID_FORMTEXT_SHDWYVAL
;
157 mpLocalItemInfos
[XATTR_FORMTXTSTDFORM
-XATTR_START
]._nSID
= SID_FORMTEXT_STDFORM
;
158 mpLocalItemInfos
[XATTR_FORMTXTHIDEFORM
-XATTR_START
]._nSID
= SID_FORMTEXT_HIDEFORM
;
160 // associate new slots for panels with known items
161 mpLocalItemInfos
[XATTR_FILLTRANSPARENCE
- XATTR_START
]._nSID
= SID_ATTR_FILL_TRANSPARENCE
;
162 mpLocalItemInfos
[XATTR_FILLFLOATTRANSPARENCE
- XATTR_START
]._nSID
= SID_ATTR_FILL_FLOATTRANSPARENCE
;
163 mpLocalItemInfos
[XATTR_LINETRANSPARENCE
- XATTR_START
]._nSID
= SID_ATTR_LINE_TRANSPARENCE
;
164 mpLocalItemInfos
[XATTR_LINEJOINT
- XATTR_START
]._nSID
= SID_ATTR_LINE_JOINT
;
165 mpLocalItemInfos
[XATTR_LINECAP
- XATTR_START
]._nSID
= SID_ATTR_LINE_CAP
;
167 // if it's my own creation level, set Defaults and ItemInfos
168 if(XATTR_START
== GetFirstWhich() && XATTR_END
== GetLastWhich())
170 SetDefaults(mppLocalPoolDefaults
);
171 SetItemInfos(mpLocalItemInfos
);
175 /*************************************************************************
177 |* copy ctor, sorgt dafuer, dass die static defaults gecloned werden
178 |* (Parameter 2 = sal_True)
180 \************************************************************************/
182 XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool
& rPool
)
183 : SfxItemPool(rPool
, sal_True
),
184 mppLocalPoolDefaults(0L),
189 /*************************************************************************
193 \************************************************************************/
195 SfxItemPool
* XOutdevItemPool::Clone() const
197 return new XOutdevItemPool(*this);
200 /*************************************************************************
204 \************************************************************************/
206 XOutdevItemPool::~XOutdevItemPool()
210 // remove own static defaults
211 if(mppLocalPoolDefaults
)
213 SfxPoolItem
** ppDefaultItem
= mppLocalPoolDefaults
;
214 for(sal_uInt16
i(GetLastWhich() - GetFirstWhich() + 1); i
; --i
, ++ppDefaultItem
)
216 if ( *ppDefaultItem
) //Teile schon von abgel. Klasse abgeraeumt!
218 SetRefCount( **ppDefaultItem
, 0 );
219 delete *ppDefaultItem
;
223 delete[] mppLocalPoolDefaults
;
228 delete[] mpLocalItemInfos
;
232 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */