diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /svx/source/xoutdev/xpool.cxx | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'svx/source/xoutdev/xpool.cxx')
-rw-r--r-- | svx/source/xoutdev/xpool.cxx | 242 |
1 files changed, 242 insertions, 0 deletions
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx new file mode 100644 index 0000000000..017401983c --- /dev/null +++ b/svx/source/xoutdev/xpool.cxx @@ -0,0 +1,242 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sal/config.h> + +#include <svx/xflbckit.hxx> +#include <xftshtit.hxx> +#include <svx/xflboxy.hxx> +#include <svx/xflbstit.hxx> +#include <svx/xflclit.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xsflclit.hxx> +#include <svx/xlntrit.hxx> +#include <svx/xfltrit.hxx> +#include <svx/xgrscit.hxx> +#include <svx/xflasit.hxx> +#include <svx/xflbmtit.hxx> +#include <svx/xflbmpit.hxx> +#include <svx/xflbmsxy.hxx> +#include <svx/xflbmsli.hxx> +#include <svx/xflbtoxy.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xfilluseslidebackgrounditem.hxx> +#include <svx/xtextit0.hxx> +#include <svx/xlnasit.hxx> +#include <svx/xlndsit.hxx> +#include <svx/xlnwtit.hxx> +#include <svx/xlnclit.hxx> +#include <svx/xlnstit.hxx> +#include <svx/xlnedit.hxx> +#include <svx/xlnstwit.hxx> +#include <svx/xlnedwit.hxx> +#include <svx/xlnstcit.hxx> +#include <svx/xlnedcit.hxx> +#include <svx/xpool.hxx> +#include <svx/svddef.hxx> +#include <svx/svxids.hrc> +#include <svl/itemset.hxx> +#include <svx/xftadit.hxx> +#include <svx/xftdiit.hxx> +#include <svx/xftstit.hxx> +#include <svx/xftmrit.hxx> +#include <svx/xftouit.hxx> +#include <svx/xftshit.hxx> +#include <svx/xftshcit.hxx> +#include <svx/xftshxy.hxx> + +XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster) + : SfxItemPool("XOutdevItemPool", SDRATTR_START, SDRATTR_END, nullptr, nullptr) + , mpLocalPoolDefaults(new std::vector<SfxPoolItem*>(SDRATTR_END - SDRATTR_START + 1)) + , mpLocalItemInfos(new SfxItemInfo[SDRATTR_END - SDRATTR_START + 1]) +{ + // prepare some defaults + const OUString aNullStr; + const basegfx::B2DPolyPolygon aNullPol; + const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color + const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color + const Color aNullShadowCol(COL_LIGHTGRAY); + const XDash aNullDash; + const XHatch aNullHatch(aNullLineCol); + + // get master pointer, evtl. add myself to the end of the pools + if(!_pMaster) + { + _pMaster = this; + } + else + { + _pMaster->GetLastPoolInChain()->SetSecondaryPool(this); + } + + // prepare PoolDefaults + std::vector<SfxPoolItem*>& rPoolDefaults = *mpLocalPoolDefaults; + rPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem; + rPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(aNullDash); + rPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem; + rPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol); + rPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(aNullPol); + rPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem (aNullPol); + rPoolDefaults[XATTR_LINESTARTWIDTH -XATTR_START] = new XLineStartWidthItem; + rPoolDefaults[XATTR_LINEENDWIDTH -XATTR_START] = new XLineEndWidthItem; + rPoolDefaults[XATTR_LINESTARTCENTER -XATTR_START] = new XLineStartCenterItem; + rPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem; + rPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem; + rPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem; + rPoolDefaults[XATTR_LINECAP -XATTR_START] = new XLineCapItem; + rPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem; + rPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol); + + // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults + rPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(basegfx::BGradient()); + + rPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (aNullHatch); + rPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (Graphic()); + rPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem; + rPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem; + rPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem; + rPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem; + rPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem; + rPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem; + rPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem; + rPoolDefaults[XATTR_FILLBMP_TILEOFFSETX -XATTR_START] = new XFillBmpTileOffsetXItem; + rPoolDefaults[XATTR_FILLBMP_TILEOFFSETY -XATTR_START] = new XFillBmpTileOffsetYItem; + rPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem; + rPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem; + rPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem; + + rPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( + basegfx::BGradient( + basegfx::BColorStops( + COL_BLACK.getBColor(), + COL_BLACK.getBColor())), + false); + + rPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol); + rPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem; + rPoolDefaults[XATTR_FILLUSESLIDEBACKGROUND -XATTR_START] = new XFillUseSlideBackgroundItem; + rPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem; + rPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem; + rPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem; + rPoolDefaults[XATTR_FORMTXTSTART -XATTR_START] = new XFormTextStartItem; + rPoolDefaults[XATTR_FORMTXTMIRROR -XATTR_START] = new XFormTextMirrorItem; + rPoolDefaults[XATTR_FORMTXTOUTLINE -XATTR_START] = new XFormTextOutlineItem; + rPoolDefaults[XATTR_FORMTXTSHADOW -XATTR_START] = new XFormTextShadowItem; + rPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol); + rPoolDefaults[XATTR_FORMTXTSHDWXVAL -XATTR_START] = new XFormTextShadowXValItem; + rPoolDefaults[XATTR_FORMTXTSHDWYVAL -XATTR_START] = new XFormTextShadowYValItem; + rPoolDefaults[XATTR_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem; + rPoolDefaults[XATTR_FORMTXTSHDWTRANSP -XATTR_START] = new XFormTextShadowTranspItem; + + // create SetItems + rPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem( + SfxItemSetFixed<XATTR_LINE_FIRST, XATTR_LINE_LAST>( *_pMaster ) ); + rPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem( + SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST>( *_pMaster ) ); + + // create ItemInfos + for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++) + { + // _nSID, _bNeedsPoolRegistration, _bShareable + mpLocalItemInfos[i - XATTR_START]._nSID = 0; + mpLocalItemInfos[i - XATTR_START]._bNeedsPoolRegistration = false; + mpLocalItemInfos[i - XATTR_START]._bShareable = true; + } + + // these slots need _bNeedsPoolRegistration == true, see + // text @svl/source/items/itempool.cxx + mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._bNeedsPoolRegistration = true; + mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._bNeedsPoolRegistration = true; + mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._bNeedsPoolRegistration = true; + mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._bNeedsPoolRegistration = true; + mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._bNeedsPoolRegistration = true; + mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._bNeedsPoolRegistration = true; + mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._bNeedsPoolRegistration = true; + mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._bNeedsPoolRegistration = true; + + // set the SlotIDs, this is a mapping used by GetWhich()/GetSlotId() + mpLocalItemInfos[XATTR_LINESTYLE -XATTR_START]._nSID = SID_ATTR_LINE_STYLE; + mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._nSID = SID_ATTR_LINE_DASH; + mpLocalItemInfos[XATTR_LINEWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_WIDTH; + mpLocalItemInfos[XATTR_LINECOLOR -XATTR_START]._nSID = SID_ATTR_LINE_COLOR; + mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._nSID = SID_ATTR_LINE_START; + mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._nSID = SID_ATTR_LINE_END; + mpLocalItemInfos[XATTR_LINESTARTWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_STARTWIDTH; + mpLocalItemInfos[XATTR_LINEENDWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_ENDWIDTH; + mpLocalItemInfos[XATTR_LINESTARTCENTER -XATTR_START]._nSID = SID_ATTR_LINE_STARTCENTER; + mpLocalItemInfos[XATTR_LINEENDCENTER -XATTR_START]._nSID = SID_ATTR_LINE_ENDCENTER; + mpLocalItemInfos[XATTR_FILLSTYLE -XATTR_START]._nSID = SID_ATTR_FILL_STYLE; + mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._nSID = SID_ATTR_FILL_COLOR; + mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._nSID = SID_ATTR_FILL_GRADIENT; + mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._nSID = SID_ATTR_FILL_HATCH; + mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._nSID = SID_ATTR_FILL_BITMAP; + mpLocalItemInfos[XATTR_FORMTXTSTYLE -XATTR_START]._nSID = SID_FORMTEXT_STYLE; + mpLocalItemInfos[XATTR_FORMTXTADJUST -XATTR_START]._nSID = SID_FORMTEXT_ADJUST; + mpLocalItemInfos[XATTR_FORMTXTDISTANCE -XATTR_START]._nSID = SID_FORMTEXT_DISTANCE; + mpLocalItemInfos[XATTR_FORMTXTSTART -XATTR_START]._nSID = SID_FORMTEXT_START; + mpLocalItemInfos[XATTR_FORMTXTMIRROR -XATTR_START]._nSID = SID_FORMTEXT_MIRROR; + mpLocalItemInfos[XATTR_FORMTXTOUTLINE -XATTR_START]._nSID = SID_FORMTEXT_OUTLINE; + mpLocalItemInfos[XATTR_FORMTXTSHADOW -XATTR_START]._nSID = SID_FORMTEXT_SHADOW; + mpLocalItemInfos[XATTR_FORMTXTSHDWCOLOR -XATTR_START]._nSID = SID_FORMTEXT_SHDWCOLOR; + mpLocalItemInfos[XATTR_FORMTXTSHDWXVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWXVAL; + mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWYVAL; + mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM; + + // associate new slots for panels with known items + mpLocalItemInfos[XATTR_FILLUSESLIDEBACKGROUND - XATTR_START]._nSID = SID_ATTR_FILL_USE_SLIDE_BACKGROUND; + mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE; + mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE; + mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE; + mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nSID = SID_ATTR_LINE_JOINT; + mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nSID = SID_ATTR_LINE_CAP; + + // if it's my own creation level, set Defaults and ItemInfos + if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich()) + { + SetDefaults(mpLocalPoolDefaults); + SetItemInfos(mpLocalItemInfos.get()); + } +} + +// copy ctor, clones all static defaults +XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool& rPool) +: SfxItemPool(rPool, true), + mpLocalPoolDefaults(nullptr) +{ +} + +rtl::Reference<SfxItemPool> XOutdevItemPool::Clone() const +{ + return new XOutdevItemPool(*this); +} + +XOutdevItemPool::~XOutdevItemPool() +{ + Delete(); + // release and delete static pool default items + ReleaseDefaults(true); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |