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 <sal/config.h>
22 #include <svx/xflbckit.hxx>
23 #include <xftshtit.hxx>
24 #include <svx/xflboxy.hxx>
25 #include <svx/xflbstit.hxx>
26 #include <svx/xflclit.hxx>
27 #include <svx/xflgrit.hxx>
28 #include <svx/xflhtit.hxx>
29 #include <svx/xbtmpit.hxx>
30 #include <svx/xflftrit.hxx>
31 #include <svx/xsflclit.hxx>
32 #include <svx/xlntrit.hxx>
33 #include <svx/xfltrit.hxx>
34 #include <svx/xgrscit.hxx>
35 #include <svx/xflasit.hxx>
36 #include <svx/xflbmtit.hxx>
37 #include <svx/xflbmpit.hxx>
38 #include <svx/xflbmsxy.hxx>
39 #include <svx/xflbmsli.hxx>
40 #include <svx/xflbtoxy.hxx>
41 #include <svx/xlineit0.hxx>
42 #include <svx/xlinjoit.hxx>
43 #include <svx/xlncapit.hxx>
44 #include <svx/xfillit0.hxx>
45 #include <svx/xfilluseslidebackgrounditem.hxx>
46 #include <svx/xtextit0.hxx>
47 #include <svx/xlnasit.hxx>
48 #include <svx/xlndsit.hxx>
49 #include <svx/xlnwtit.hxx>
50 #include <svx/xlnclit.hxx>
51 #include <svx/xlnstit.hxx>
52 #include <svx/xlnedit.hxx>
53 #include <svx/xlnstwit.hxx>
54 #include <svx/xlnedwit.hxx>
55 #include <svx/xlnstcit.hxx>
56 #include <svx/xlnedcit.hxx>
57 #include <svx/xpool.hxx>
58 #include <svx/svddef.hxx>
59 #include <svx/svxids.hrc>
60 #include <svl/itemset.hxx>
61 #include <svx/xftadit.hxx>
62 #include <svx/xftdiit.hxx>
63 #include <svx/xftstit.hxx>
64 #include <svx/xftmrit.hxx>
65 #include <svx/xftouit.hxx>
66 #include <svx/xftshit.hxx>
67 #include <svx/xftshcit.hxx>
68 #include <svx/xftshxy.hxx>
70 XOutdevItemPool::XOutdevItemPool(SfxItemPool
* _pMaster
)
71 : SfxItemPool("XOutdevItemPool", SDRATTR_START
, SDRATTR_END
, nullptr, nullptr)
72 , mpLocalPoolDefaults(new std::vector
<SfxPoolItem
*>(SDRATTR_END
- SDRATTR_START
+ 1))
73 , mpLocalItemInfos(new SfxItemInfo
[SDRATTR_END
- SDRATTR_START
+ 1])
75 // prepare some defaults
76 const OUString aNullStr
;
77 const basegfx::B2DPolyPolygon aNullPol
;
78 const Color
aNullLineCol(COL_DEFAULT_SHAPE_STROKE
); // #i121448# Use defined default color
79 const Color
aNullFillCol(COL_DEFAULT_SHAPE_FILLING
); // #i121448# Use defined default color
80 const Color
aNullShadowCol(COL_LIGHTGRAY
);
81 const XDash aNullDash
;
82 const XHatch
aNullHatch(aNullLineCol
);
84 // get master pointer, evtl. add myself to the end of the pools
91 _pMaster
->GetLastPoolInChain()->SetSecondaryPool(this);
94 // prepare PoolDefaults
95 std::vector
<SfxPoolItem
*>& rPoolDefaults
= *mpLocalPoolDefaults
;
96 rPoolDefaults
[XATTR_LINESTYLE
-XATTR_START
] = new XLineStyleItem
;
97 rPoolDefaults
[XATTR_LINEDASH
-XATTR_START
] = new XLineDashItem(aNullDash
);
98 rPoolDefaults
[XATTR_LINEWIDTH
-XATTR_START
] = new XLineWidthItem
;
99 rPoolDefaults
[XATTR_LINECOLOR
-XATTR_START
] = new XLineColorItem(aNullStr
,aNullLineCol
);
100 rPoolDefaults
[XATTR_LINESTART
-XATTR_START
] = new XLineStartItem(aNullPol
);
101 rPoolDefaults
[XATTR_LINEEND
-XATTR_START
] = new XLineEndItem (aNullPol
);
102 rPoolDefaults
[XATTR_LINESTARTWIDTH
-XATTR_START
] = new XLineStartWidthItem
;
103 rPoolDefaults
[XATTR_LINEENDWIDTH
-XATTR_START
] = new XLineEndWidthItem
;
104 rPoolDefaults
[XATTR_LINESTARTCENTER
-XATTR_START
] = new XLineStartCenterItem
;
105 rPoolDefaults
[XATTR_LINEENDCENTER
-XATTR_START
] = new XLineEndCenterItem
;
106 rPoolDefaults
[XATTR_LINETRANSPARENCE
-XATTR_START
] = new XLineTransparenceItem
;
107 rPoolDefaults
[XATTR_LINEJOINT
-XATTR_START
] = new XLineJointItem
;
108 rPoolDefaults
[XATTR_LINECAP
-XATTR_START
] = new XLineCapItem
;
109 rPoolDefaults
[XATTR_FILLSTYLE
-XATTR_START
] = new XFillStyleItem
;
110 rPoolDefaults
[XATTR_FILLCOLOR
-XATTR_START
] = new XFillColorItem (aNullStr
,aNullFillCol
);
112 // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults
113 rPoolDefaults
[XATTR_FILLGRADIENT
-XATTR_START
] = new XFillGradientItem(basegfx::BGradient());
115 rPoolDefaults
[XATTR_FILLHATCH
-XATTR_START
] = new XFillHatchItem (aNullHatch
);
116 rPoolDefaults
[XATTR_FILLBITMAP
-XATTR_START
] = new XFillBitmapItem (Graphic());
117 rPoolDefaults
[XATTR_FILLTRANSPARENCE
-XATTR_START
] = new XFillTransparenceItem
;
118 rPoolDefaults
[XATTR_GRADIENTSTEPCOUNT
-XATTR_START
] = new XGradientStepCountItem
;
119 rPoolDefaults
[XATTR_FILLBMP_TILE
-XATTR_START
] = new XFillBmpTileItem
;
120 rPoolDefaults
[XATTR_FILLBMP_POS
-XATTR_START
] = new XFillBmpPosItem
;
121 rPoolDefaults
[XATTR_FILLBMP_SIZEX
-XATTR_START
] = new XFillBmpSizeXItem
;
122 rPoolDefaults
[XATTR_FILLBMP_SIZEY
-XATTR_START
] = new XFillBmpSizeYItem
;
123 rPoolDefaults
[XATTR_FILLBMP_SIZELOG
-XATTR_START
] = new XFillBmpSizeLogItem
;
124 rPoolDefaults
[XATTR_FILLBMP_TILEOFFSETX
-XATTR_START
] = new XFillBmpTileOffsetXItem
;
125 rPoolDefaults
[XATTR_FILLBMP_TILEOFFSETY
-XATTR_START
] = new XFillBmpTileOffsetYItem
;
126 rPoolDefaults
[XATTR_FILLBMP_STRETCH
-XATTR_START
] = new XFillBmpStretchItem
;
127 rPoolDefaults
[XATTR_FILLBMP_POSOFFSETX
-XATTR_START
] = new XFillBmpPosOffsetXItem
;
128 rPoolDefaults
[XATTR_FILLBMP_POSOFFSETY
-XATTR_START
] = new XFillBmpPosOffsetYItem
;
130 rPoolDefaults
[XATTR_FILLFLOATTRANSPARENCE
-XATTR_START
] = new XFillFloatTransparenceItem(
132 basegfx::BColorStops(
133 COL_BLACK
.getBColor(),
134 COL_BLACK
.getBColor())),
137 rPoolDefaults
[XATTR_SECONDARYFILLCOLOR
-XATTR_START
] = new XSecondaryFillColorItem(aNullStr
, aNullFillCol
);
138 rPoolDefaults
[XATTR_FILLBACKGROUND
-XATTR_START
] = new XFillBackgroundItem
;
139 rPoolDefaults
[XATTR_FILLUSESLIDEBACKGROUND
-XATTR_START
] = new XFillUseSlideBackgroundItem
;
140 rPoolDefaults
[XATTR_FORMTXTSTYLE
-XATTR_START
] = new XFormTextStyleItem
;
141 rPoolDefaults
[XATTR_FORMTXTADJUST
-XATTR_START
] = new XFormTextAdjustItem
;
142 rPoolDefaults
[XATTR_FORMTXTDISTANCE
-XATTR_START
] = new XFormTextDistanceItem
;
143 rPoolDefaults
[XATTR_FORMTXTSTART
-XATTR_START
] = new XFormTextStartItem
;
144 rPoolDefaults
[XATTR_FORMTXTMIRROR
-XATTR_START
] = new XFormTextMirrorItem
;
145 rPoolDefaults
[XATTR_FORMTXTOUTLINE
-XATTR_START
] = new XFormTextOutlineItem
;
146 rPoolDefaults
[XATTR_FORMTXTSHADOW
-XATTR_START
] = new XFormTextShadowItem
;
147 rPoolDefaults
[XATTR_FORMTXTSHDWCOLOR
-XATTR_START
] = new XFormTextShadowColorItem(aNullStr
,aNullShadowCol
);
148 rPoolDefaults
[XATTR_FORMTXTSHDWXVAL
-XATTR_START
] = new XFormTextShadowXValItem
;
149 rPoolDefaults
[XATTR_FORMTXTSHDWYVAL
-XATTR_START
] = new XFormTextShadowYValItem
;
150 rPoolDefaults
[XATTR_FORMTXTHIDEFORM
-XATTR_START
] = new XFormTextHideFormItem
;
151 rPoolDefaults
[XATTR_FORMTXTSHDWTRANSP
-XATTR_START
] = new XFormTextShadowTranspItem
;
154 rPoolDefaults
[XATTRSET_LINE
- XATTR_START
] = new XLineAttrSetItem(
155 SfxItemSetFixed
<XATTR_LINE_FIRST
, XATTR_LINE_LAST
>( *_pMaster
) );
156 rPoolDefaults
[XATTRSET_FILL
- XATTR_START
] = new XFillAttrSetItem(
157 SfxItemSetFixed
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>( *_pMaster
) );
160 for(sal_uInt16
i(GetFirstWhich()); i
<= GetLastWhich(); i
++)
162 mpLocalItemInfos
[i
- XATTR_START
]._nSID
= 0;
163 mpLocalItemInfos
[i
- XATTR_START
]._bPoolable
= true;
166 mpLocalItemInfos
[XATTR_LINESTYLE
-XATTR_START
]._nSID
= SID_ATTR_LINE_STYLE
;
167 mpLocalItemInfos
[XATTR_LINEDASH
-XATTR_START
]._nSID
= SID_ATTR_LINE_DASH
;
168 mpLocalItemInfos
[XATTR_LINEWIDTH
-XATTR_START
]._nSID
= SID_ATTR_LINE_WIDTH
;
169 mpLocalItemInfos
[XATTR_LINECOLOR
-XATTR_START
]._nSID
= SID_ATTR_LINE_COLOR
;
170 mpLocalItemInfos
[XATTR_LINESTART
-XATTR_START
]._nSID
= SID_ATTR_LINE_START
;
171 mpLocalItemInfos
[XATTR_LINEEND
-XATTR_START
]._nSID
= SID_ATTR_LINE_END
;
172 mpLocalItemInfos
[XATTR_LINESTARTWIDTH
-XATTR_START
]._nSID
= SID_ATTR_LINE_STARTWIDTH
;
173 mpLocalItemInfos
[XATTR_LINEENDWIDTH
-XATTR_START
]._nSID
= SID_ATTR_LINE_ENDWIDTH
;
174 mpLocalItemInfos
[XATTR_LINESTARTCENTER
-XATTR_START
]._nSID
= SID_ATTR_LINE_STARTCENTER
;
175 mpLocalItemInfos
[XATTR_LINEENDCENTER
-XATTR_START
]._nSID
= SID_ATTR_LINE_ENDCENTER
;
176 mpLocalItemInfos
[XATTR_FILLSTYLE
-XATTR_START
]._nSID
= SID_ATTR_FILL_STYLE
;
177 mpLocalItemInfos
[XATTR_FILLCOLOR
-XATTR_START
]._nSID
= SID_ATTR_FILL_COLOR
;
178 mpLocalItemInfos
[XATTR_FILLGRADIENT
-XATTR_START
]._nSID
= SID_ATTR_FILL_GRADIENT
;
179 mpLocalItemInfos
[XATTR_FILLHATCH
-XATTR_START
]._nSID
= SID_ATTR_FILL_HATCH
;
180 mpLocalItemInfos
[XATTR_FILLBITMAP
-XATTR_START
]._nSID
= SID_ATTR_FILL_BITMAP
;
181 mpLocalItemInfos
[XATTR_FORMTXTSTYLE
-XATTR_START
]._nSID
= SID_FORMTEXT_STYLE
;
182 mpLocalItemInfos
[XATTR_FORMTXTADJUST
-XATTR_START
]._nSID
= SID_FORMTEXT_ADJUST
;
183 mpLocalItemInfos
[XATTR_FORMTXTDISTANCE
-XATTR_START
]._nSID
= SID_FORMTEXT_DISTANCE
;
184 mpLocalItemInfos
[XATTR_FORMTXTSTART
-XATTR_START
]._nSID
= SID_FORMTEXT_START
;
185 mpLocalItemInfos
[XATTR_FORMTXTMIRROR
-XATTR_START
]._nSID
= SID_FORMTEXT_MIRROR
;
186 mpLocalItemInfos
[XATTR_FORMTXTOUTLINE
-XATTR_START
]._nSID
= SID_FORMTEXT_OUTLINE
;
187 mpLocalItemInfos
[XATTR_FORMTXTSHADOW
-XATTR_START
]._nSID
= SID_FORMTEXT_SHADOW
;
188 mpLocalItemInfos
[XATTR_FORMTXTSHDWCOLOR
-XATTR_START
]._nSID
= SID_FORMTEXT_SHDWCOLOR
;
189 mpLocalItemInfos
[XATTR_FORMTXTSHDWXVAL
-XATTR_START
]._nSID
= SID_FORMTEXT_SHDWXVAL
;
190 mpLocalItemInfos
[XATTR_FORMTXTSHDWYVAL
-XATTR_START
]._nSID
= SID_FORMTEXT_SHDWYVAL
;
191 mpLocalItemInfos
[XATTR_FORMTXTHIDEFORM
-XATTR_START
]._nSID
= SID_FORMTEXT_HIDEFORM
;
193 // associate new slots for panels with known items
194 mpLocalItemInfos
[XATTR_FILLUSESLIDEBACKGROUND
- XATTR_START
]._nSID
= SID_ATTR_FILL_USE_SLIDE_BACKGROUND
;
195 mpLocalItemInfos
[XATTR_FILLTRANSPARENCE
- XATTR_START
]._nSID
= SID_ATTR_FILL_TRANSPARENCE
;
196 mpLocalItemInfos
[XATTR_FILLFLOATTRANSPARENCE
- XATTR_START
]._nSID
= SID_ATTR_FILL_FLOATTRANSPARENCE
;
197 mpLocalItemInfos
[XATTR_LINETRANSPARENCE
- XATTR_START
]._nSID
= SID_ATTR_LINE_TRANSPARENCE
;
198 mpLocalItemInfos
[XATTR_LINEJOINT
- XATTR_START
]._nSID
= SID_ATTR_LINE_JOINT
;
199 mpLocalItemInfos
[XATTR_LINECAP
- XATTR_START
]._nSID
= SID_ATTR_LINE_CAP
;
201 // if it's my own creation level, set Defaults and ItemInfos
202 if(XATTR_START
== GetFirstWhich() && XATTR_END
== GetLastWhich())
204 SetDefaults(mpLocalPoolDefaults
);
205 SetItemInfos(mpLocalItemInfos
.get());
209 // copy ctor, clones all static defaults
210 XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool
& rPool
)
211 : SfxItemPool(rPool
, true),
212 mpLocalPoolDefaults(nullptr)
216 rtl::Reference
<SfxItemPool
> XOutdevItemPool::Clone() const
218 return new XOutdevItemPool(*this);
221 XOutdevItemPool::~XOutdevItemPool()
224 // release and delete static pool default items
225 ReleaseDefaults(true);
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */