LCOV - code coverage report
Current view: top level - svx/source/xoutdev - xpool.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 124 0.0 %
Date: 2014-04-14 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 <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>
      26             : 
      27           0 : XOutdevItemPool::XOutdevItemPool(
      28             :     SfxItemPool* _pMaster,
      29             :     sal_uInt16 nAttrStart,
      30             :     sal_uInt16 nAttrEnd,
      31             :     bool bLoadRefCounts)
      32           0 : :   SfxItemPool("XOutdevItemPool", nAttrStart, nAttrEnd, 0L, 0L, bLoadRefCounts)
      33             : {
      34             :     // prepare some defaults
      35           0 :     const OUString aNullStr;
      36           0 :     const Graphic aNullGraphic;
      37           0 :     const basegfx::B2DPolyPolygon aNullPol;
      38           0 :     const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color
      39           0 :     const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color
      40           0 :     const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY));
      41           0 :     const XDash aNullDash;
      42           0 :     const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
      43           0 :     const XHatch aNullHatch(aNullLineCol);
      44             : 
      45             :     // get master pointer, evtl. add myself to the end of the pools
      46           0 :     if(!_pMaster)
      47             :     {
      48           0 :         _pMaster = this;
      49             :     }
      50             :     else
      51             :     {
      52           0 :         SfxItemPool* pParent = _pMaster;
      53             : 
      54           0 :         while(pParent->GetSecondaryPool())
      55             :         {
      56           0 :             pParent = pParent->GetSecondaryPool();
      57             :         }
      58             : 
      59           0 :         pParent->SetSecondaryPool(this);
      60             :     }
      61             : 
      62             :     // prepare PoolDefaults
      63           0 :     mppLocalPoolDefaults = new SfxPoolItem*[GetLastWhich() - GetFirstWhich() + 1];
      64             : 
      65           0 :     mppLocalPoolDefaults[XATTR_LINESTYLE          -XATTR_START] = new XLineStyleItem;
      66           0 :     mppLocalPoolDefaults[XATTR_LINEDASH           -XATTR_START] = new XLineDashItem(this,aNullDash);
      67           0 :     mppLocalPoolDefaults[XATTR_LINEWIDTH          -XATTR_START] = new XLineWidthItem;
      68           0 :     mppLocalPoolDefaults[XATTR_LINECOLOR          -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol);
      69           0 :     mppLocalPoolDefaults[XATTR_LINESTART          -XATTR_START] = new XLineStartItem(this,aNullPol);
      70           0 :     mppLocalPoolDefaults[XATTR_LINEEND            -XATTR_START] = new XLineEndItem  (this,aNullPol);
      71           0 :     mppLocalPoolDefaults[XATTR_LINESTARTWIDTH     -XATTR_START] = new XLineStartWidthItem;
      72           0 :     mppLocalPoolDefaults[XATTR_LINEENDWIDTH       -XATTR_START] = new XLineEndWidthItem;
      73           0 :     mppLocalPoolDefaults[XATTR_LINESTARTCENTER    -XATTR_START] = new XLineStartCenterItem;
      74           0 :     mppLocalPoolDefaults[XATTR_LINEENDCENTER      -XATTR_START] = new XLineEndCenterItem;
      75           0 :     mppLocalPoolDefaults[XATTR_LINETRANSPARENCE   -XATTR_START] = new XLineTransparenceItem;
      76           0 :     mppLocalPoolDefaults[XATTR_LINEJOINT            -XATTR_START] = new XLineJointItem;
      77           0 :     mppLocalPoolDefaults[XATTR_LINECAP            -XATTR_START] = new XLineCapItem;
      78           0 :     mppLocalPoolDefaults[XATTR_FILLSTYLE                -XATTR_START] = new XFillStyleItem;
      79           0 :     mppLocalPoolDefaults[XATTR_FILLCOLOR                -XATTR_START] = new XFillColorItem   (aNullStr,aNullFillCol);
      80           0 :     mppLocalPoolDefaults[XATTR_FILLGRADIENT         -XATTR_START] = new XFillGradientItem(aNullGrad);
      81           0 :     mppLocalPoolDefaults[XATTR_FILLHATCH                -XATTR_START] = new XFillHatchItem   (this,aNullHatch);
      82           0 :     mppLocalPoolDefaults[XATTR_FILLBITMAP               -XATTR_START] = new XFillBitmapItem  (this, aNullGraphic);
      83           0 :     mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE     -XATTR_START] = new XFillTransparenceItem;
      84           0 :     mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT        -XATTR_START] = new XGradientStepCountItem;
      85           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_TILE         -XATTR_START] = new XFillBmpTileItem;
      86           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_POS          -XATTR_START] = new XFillBmpPosItem;
      87           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX            -XATTR_START] = new XFillBmpSizeXItem;
      88           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY            -XATTR_START] = new XFillBmpSizeYItem;
      89           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG      -XATTR_START] = new XFillBmpSizeLogItem;
      90           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX  -XATTR_START] = new XFillBmpTileOffsetXItem;
      91           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY  -XATTR_START] = new XFillBmpTileOffsetYItem;
      92           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH      -XATTR_START] = new XFillBmpStretchItem;
      93           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX       -XATTR_START] = new XFillBmpPosOffsetXItem;
      94           0 :     mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY       -XATTR_START] = new XFillBmpPosOffsetYItem;
      95           0 :     mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE    -XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, false );
      96           0 :     mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR       -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol);
      97           0 :     mppLocalPoolDefaults[XATTR_FILLBACKGROUND           -XATTR_START] = new XFillBackgroundItem;
      98           0 :     mppLocalPoolDefaults[XATTR_FORMTXTSTYLE       -XATTR_START] = new XFormTextStyleItem;
      99           0 :     mppLocalPoolDefaults[XATTR_FORMTXTADJUST      -XATTR_START] = new XFormTextAdjustItem;
     100           0 :     mppLocalPoolDefaults[XATTR_FORMTXTDISTANCE    -XATTR_START] = new XFormTextDistanceItem;
     101           0 :     mppLocalPoolDefaults[XATTR_FORMTXTSTART       -XATTR_START] = new XFormTextStartItem;
     102           0 :     mppLocalPoolDefaults[XATTR_FORMTXTMIRROR      -XATTR_START] = new XFormTextMirrorItem;
     103           0 :     mppLocalPoolDefaults[XATTR_FORMTXTOUTLINE     -XATTR_START] = new XFormTextOutlineItem;
     104           0 :     mppLocalPoolDefaults[XATTR_FORMTXTSHADOW      -XATTR_START] = new XFormTextShadowItem;
     105           0 :     mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR   -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol);
     106           0 :     mppLocalPoolDefaults[XATTR_FORMTXTSHDWXVAL    -XATTR_START] = new XFormTextShadowXValItem;
     107           0 :     mppLocalPoolDefaults[XATTR_FORMTXTSHDWYVAL    -XATTR_START] = new XFormTextShadowYValItem;
     108           0 :     mppLocalPoolDefaults[XATTR_FORMTXTHIDEFORM    -XATTR_START] = new XFormTextHideFormItem;
     109           0 :     mppLocalPoolDefaults[XATTR_FORMTXTSHDWTRANSP  -XATTR_START] = new XFormTextShadowTranspItem;
     110             : 
     111             :     // create SetItems
     112           0 :     SfxItemSet* pSet=new SfxItemSet(*_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST);
     113           0 :     mppLocalPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(pSet);
     114           0 :     pSet=new SfxItemSet(*_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST);
     115           0 :     mppLocalPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(pSet);
     116             : 
     117             :     // create ItemInfos
     118           0 :     mpLocalItemInfos = new SfxItemInfo[GetLastWhich() - GetFirstWhich() + 1];
     119           0 :     for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++)
     120             :     {
     121           0 :         mpLocalItemInfos[i - XATTR_START]._nSID = 0;
     122           0 :         mpLocalItemInfos[i - XATTR_START]._nFlags = SFX_ITEM_POOLABLE;
     123             :     }
     124             : 
     125           0 :     mpLocalItemInfos[XATTR_LINESTYLE        -XATTR_START]._nSID = SID_ATTR_LINE_STYLE;
     126           0 :     mpLocalItemInfos[XATTR_LINEDASH         -XATTR_START]._nSID = SID_ATTR_LINE_DASH;
     127           0 :     mpLocalItemInfos[XATTR_LINEWIDTH        -XATTR_START]._nSID = SID_ATTR_LINE_WIDTH;
     128           0 :     mpLocalItemInfos[XATTR_LINECOLOR        -XATTR_START]._nSID = SID_ATTR_LINE_COLOR;
     129           0 :     mpLocalItemInfos[XATTR_LINESTART        -XATTR_START]._nSID = SID_ATTR_LINE_START;
     130           0 :     mpLocalItemInfos[XATTR_LINEEND          -XATTR_START]._nSID = SID_ATTR_LINE_END;
     131           0 :     mpLocalItemInfos[XATTR_LINESTARTWIDTH   -XATTR_START]._nSID = SID_ATTR_LINE_STARTWIDTH;
     132           0 :     mpLocalItemInfos[XATTR_LINEENDWIDTH     -XATTR_START]._nSID = SID_ATTR_LINE_ENDWIDTH;
     133           0 :     mpLocalItemInfos[XATTR_LINESTARTCENTER  -XATTR_START]._nSID = SID_ATTR_LINE_STARTCENTER;
     134           0 :     mpLocalItemInfos[XATTR_LINEENDCENTER    -XATTR_START]._nSID = SID_ATTR_LINE_ENDCENTER;
     135           0 :     mpLocalItemInfos[XATTR_FILLSTYLE        -XATTR_START]._nSID = SID_ATTR_FILL_STYLE;
     136           0 :     mpLocalItemInfos[XATTR_FILLCOLOR        -XATTR_START]._nSID = SID_ATTR_FILL_COLOR;
     137           0 :     mpLocalItemInfos[XATTR_FILLGRADIENT     -XATTR_START]._nSID = SID_ATTR_FILL_GRADIENT;
     138           0 :     mpLocalItemInfos[XATTR_FILLHATCH        -XATTR_START]._nSID = SID_ATTR_FILL_HATCH;
     139           0 :     mpLocalItemInfos[XATTR_FILLBITMAP       -XATTR_START]._nSID = SID_ATTR_FILL_BITMAP;
     140           0 :     mpLocalItemInfos[XATTR_FORMTXTSTYLE     -XATTR_START]._nSID = SID_FORMTEXT_STYLE;
     141           0 :     mpLocalItemInfos[XATTR_FORMTXTADJUST    -XATTR_START]._nSID = SID_FORMTEXT_ADJUST;
     142           0 :     mpLocalItemInfos[XATTR_FORMTXTDISTANCE  -XATTR_START]._nSID = SID_FORMTEXT_DISTANCE;
     143           0 :     mpLocalItemInfos[XATTR_FORMTXTSTART     -XATTR_START]._nSID = SID_FORMTEXT_START;
     144           0 :     mpLocalItemInfos[XATTR_FORMTXTMIRROR    -XATTR_START]._nSID = SID_FORMTEXT_MIRROR;
     145           0 :     mpLocalItemInfos[XATTR_FORMTXTOUTLINE   -XATTR_START]._nSID = SID_FORMTEXT_OUTLINE;
     146           0 :     mpLocalItemInfos[XATTR_FORMTXTSHADOW    -XATTR_START]._nSID = SID_FORMTEXT_SHADOW;
     147           0 :     mpLocalItemInfos[XATTR_FORMTXTSHDWCOLOR -XATTR_START]._nSID = SID_FORMTEXT_SHDWCOLOR;
     148           0 :     mpLocalItemInfos[XATTR_FORMTXTSHDWXVAL  -XATTR_START]._nSID = SID_FORMTEXT_SHDWXVAL;
     149           0 :     mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL  -XATTR_START]._nSID = SID_FORMTEXT_SHDWYVAL;
     150           0 :     mpLocalItemInfos[XATTR_FORMTXTHIDEFORM  -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM;
     151             : 
     152             :     // associate new slots for panels with known items
     153           0 :     mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE;
     154           0 :     mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE;
     155           0 :     mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE;
     156           0 :     mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nSID = SID_ATTR_LINE_JOINT;
     157           0 :     mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nSID = SID_ATTR_LINE_CAP;
     158             : 
     159             :     // if it's my own creation level, set Defaults and ItemInfos
     160           0 :     if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich())
     161             :     {
     162           0 :         SetDefaults(mppLocalPoolDefaults);
     163           0 :         SetItemInfos(mpLocalItemInfos);
     164           0 :     }
     165           0 : }
     166             : 
     167             : // copy ctor, clones all static defaults
     168           0 : XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool& rPool)
     169             : :   SfxItemPool(rPool, true),
     170             :     mppLocalPoolDefaults(0L),
     171           0 :     mpLocalItemInfos(0L)
     172             : {
     173           0 : }
     174             : 
     175           0 : SfxItemPool* XOutdevItemPool::Clone() const
     176             : {
     177           0 :     return new XOutdevItemPool(*this);
     178             : }
     179             : 
     180           0 : XOutdevItemPool::~XOutdevItemPool()
     181             : {
     182           0 :     Delete();
     183             : 
     184             :     // remove own static defaults
     185           0 :     if(mppLocalPoolDefaults)
     186             :     {
     187           0 :         SfxPoolItem** ppDefaultItem = mppLocalPoolDefaults;
     188           0 :         for(sal_uInt16 i(GetLastWhich() - GetFirstWhich() + 1); i; --i, ++ppDefaultItem)
     189             :         {
     190           0 :             if ( *ppDefaultItem ) // these parts might be already cleaned up from a derived class
     191             :             {
     192           0 :                 SetRefCount( **ppDefaultItem, 0 );
     193           0 :                 delete *ppDefaultItem;
     194             :             }
     195             :         }
     196             : 
     197           0 :         delete[] mppLocalPoolDefaults;
     198             :     }
     199             : 
     200           0 :     if(mpLocalItemInfos)
     201             :     {
     202           0 :         delete[] mpLocalItemInfos;
     203             :     }
     204           0 : }
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10