LibreOffice Module svx (master) 1
xpool.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21
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>
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>
69
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])
74{
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);
83
84 // get master pointer, evtl. add myself to the end of the pools
85 if(!_pMaster)
86 {
87 _pMaster = this;
88 }
89 else
90 {
91 _pMaster->GetLastPoolInChain()->SetSecondaryPool(this);
92 }
93
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);
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);
111
112 // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults
114
115 rPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (aNullHatch);
116 rPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (Graphic());
119 rPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem;
120 rPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem;
129
135 false);
136
137 rPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol);
147 rPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol);
152
153 // create SetItems
154 rPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(
156 rPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(
158
159 // create ItemInfos
160 for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++)
161 {
162 mpLocalItemInfos[i - XATTR_START]._nSID = 0;
163 mpLocalItemInfos[i - XATTR_START]._bPoolable = true;
164 }
165
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;
192
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;
200
201 // if it's my own creation level, set Defaults and ItemInfos
203 {
206 }
207}
208
209// copy ctor, clones all static defaults
211: SfxItemPool(rPool, true),
212 mpLocalPoolDefaults(nullptr)
213{
214}
215
217{
218 return new XOutdevItemPool(*this);
219}
220
222{
223 Delete();
224 // release and delete static pool default items
225 ReleaseDefaults(true);
226}
227
228/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
basegfx::BColor getBColor() const
void Delete()
void SetDefaults(std::vector< SfxPoolItem * > *pDefaults)
SfxItemPool * GetLastPoolInChain()
void SetItemInfos(const SfxItemInfo *pInfos)
sal_uInt16 GetLastWhich() const
void ReleaseDefaults(bool bDelete=false)
sal_uInt16 GetFirstWhich() const
void SetSecondaryPool(SfxItemPool *pPool)
Definition: xdash.hxx:32
Item to enable slide background for filled objects.
std::unique_ptr< SfxItemInfo[]> mpLocalItemInfos
Definition: xpool.hxx:37
XOutdevItemPool(SfxItemPool *pMaster)
Definition: xpool.cxx:70
virtual ~XOutdevItemPool() override
Definition: xpool.cxx:221
std::vector< SfxPoolItem * > * mpLocalPoolDefaults
Definition: xpool.hxx:36
virtual rtl::Reference< SfxItemPool > Clone() const override
Definition: xpool.cxx:216
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
int i
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr sal_uInt16 SDRATTR_END(SDRATTR_WRITINGMODE2_LAST)
constexpr TypedWhichId< XFillBmpPosOffsetYItem > XATTR_FILLBMP_POSOFFSETY(XATTR_FILL_FIRST+18)
constexpr TypedWhichId< XGradientStepCountItem > XATTR_GRADIENTSTEPCOUNT(XATTR_FILL_FIRST+6)
constexpr TypedWhichId< XFillBmpPosItem > XATTR_FILLBMP_POS(XATTR_FILL_FIRST+8)
constexpr TypedWhichId< XFillUseSlideBackgroundItem > XATTR_FILLUSESLIDEBACKGROUND(XATTR_FILL_FIRST+20)
constexpr TypedWhichId< XLineJointItem > XATTR_LINEJOINT(XATTR_LINE_FIRST+11)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XFillAttrSetItem > XATTRSET_FILL(XATTR_FILL_LAST+1)
constexpr TypedWhichId< XFillBmpTileOffsetXItem > XATTR_FILLBMP_TILEOFFSETX(XATTR_FILL_FIRST+14)
constexpr sal_uInt16 XATTR_START
Definition: xdef.hxx:88
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr TypedWhichId< XSecondaryFillColorItem > XATTR_SECONDARYFILLCOLOR(XATTR_FILL_FIRST+12)
constexpr sal_uInt16 XATTR_END
Definition: xdef.hxx:147
constexpr TypedWhichId< XFormTextMirrorItem > XATTR_FORMTXTMIRROR(XATTR_TEXT_FIRST+4)
constexpr TypedWhichId< XFormTextStyleItem > XATTR_FORMTXTSTYLE(XATTR_TEXT_FIRST)
constexpr TypedWhichId< XFormTextStartItem > XATTR_FORMTXTSTART(XATTR_TEXT_FIRST+3)
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< XLineStartWidthItem > XATTR_LINESTARTWIDTH(XATTR_LINE_FIRST+6)
constexpr TypedWhichId< XFormTextShadowTranspItem > XATTR_FORMTXTSHDWTRANSP(XATTR_TEXT_FIRST+11)
constexpr TypedWhichId< SfxMetricItem > XATTR_FILLBMP_SIZEX(XATTR_FILL_FIRST+9)
constexpr TypedWhichId< XFormTextShadowYValItem > XATTR_FORMTXTSHDWYVAL(XATTR_TEXT_FIRST+9)
constexpr TypedWhichId< XLineCapItem > XATTR_LINECAP(XATTR_LINE_FIRST+12)
constexpr TypedWhichId< XFormTextHideFormItem > XATTR_FORMTXTHIDEFORM(XATTR_TEXT_FIRST+10)
constexpr TypedWhichId< XLineDashItem > XATTR_LINEDASH(XATTR_LINE_FIRST+1)
constexpr TypedWhichId< XFormTextDistanceItem > XATTR_FORMTXTDISTANCE(XATTR_TEXT_FIRST+2)
#define COL_DEFAULT_SHAPE_FILLING
Definition: xdef.hxx:85
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
constexpr TypedWhichId< XFillBmpPosOffsetXItem > XATTR_FILLBMP_POSOFFSETX(XATTR_FILL_FIRST+17)
constexpr TypedWhichId< XFillBmpTileOffsetYItem > XATTR_FILLBMP_TILEOFFSETY(XATTR_FILL_FIRST+15)
constexpr TypedWhichId< XFormTextShadowItem > XATTR_FORMTXTSHADOW(XATTR_TEXT_FIRST+6)
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)
constexpr TypedWhichId< XFormTextOutlineItem > XATTR_FORMTXTOUTLINE(XATTR_TEXT_FIRST+5)
constexpr TypedWhichId< XFormTextShadowXValItem > XATTR_FORMTXTSHDWXVAL(XATTR_TEXT_FIRST+8)
constexpr TypedWhichId< XFillBmpSizeYItem > XATTR_FILLBMP_SIZEY(XATTR_FILL_FIRST+10)
constexpr TypedWhichId< XFormTextShadowColorItem > XATTR_FORMTXTSHDWCOLOR(XATTR_TEXT_FIRST+7)
constexpr TypedWhichId< XFillBmpStretchItem > XATTR_FILLBMP_STRETCH(XATTR_FILL_FIRST+16)
constexpr TypedWhichId< XLineEndCenterItem > XATTR_LINEENDCENTER(XATTR_LINE_FIRST+9)
constexpr TypedWhichId< XLineAttrSetItem > XATTRSET_LINE(XATTR_LINE_LAST+1)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr TypedWhichId< XFillBmpSizeLogItem > XATTR_FILLBMP_SIZELOG(XATTR_FILL_FIRST+13)
constexpr TypedWhichId< XLineStartCenterItem > XATTR_LINESTARTCENTER(XATTR_LINE_FIRST+8)
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
#define COL_DEFAULT_SHAPE_STROKE
Definition: xdef.hxx:86
constexpr TypedWhichId< XFillBackgroundItem > XATTR_FILLBACKGROUND(XATTR_FILL_FIRST+19)
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFormTextAdjustItem > XATTR_FORMTXTADJUST(XATTR_TEXT_FIRST+1)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
constexpr TypedWhichId< XLineEndWidthItem > XATTR_LINEENDWIDTH(XATTR_LINE_FIRST+7)
constexpr TypedWhichId< XLineTransparenceItem > XATTR_LINETRANSPARENCE(XATTR_LINE_FIRST+10)