LCOV - code coverage report
Current view: top level - svx/source/sdr/properties - itemsettools.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 40 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/sdr/properties/itemsettools.hxx>
      21             : #include <tools/debug.hxx>
      22             : #include <svl/itemset.hxx>
      23             : #include <svl/whiter.hxx>
      24             : #include <svx/svdogrp.hxx>
      25             : #include <svx/svditer.hxx>
      26             : #include <vcl/region.hxx>
      27             : 
      28             : 
      29             : // class to remember broadcast start positions
      30             : 
      31             : namespace sdr
      32             : {
      33             :     namespace properties
      34             :     {
      35           0 :         ItemChangeBroadcaster::ItemChangeBroadcaster(const SdrObject& rObj)
      36             :         {
      37           0 :             if(rObj.ISA(SdrObjGroup))
      38             :             {
      39           0 :                 SdrObjListIter aIter((const SdrObjGroup&)rObj, IM_DEEPNOGROUPS);
      40           0 :                 mpData = new RectangleVector;
      41             :                 DBG_ASSERT(mpData, "ItemChangeBroadcaster: No memory (!)");
      42           0 :                 ((RectangleVector*)mpData)->reserve(aIter.Count());
      43             : 
      44           0 :                 while(aIter.IsMore())
      45             :                 {
      46           0 :                     SdrObject* pObj = aIter.Next();
      47             : 
      48           0 :                     if(pObj)
      49             :                     {
      50           0 :                         ((RectangleVector*)mpData)->push_back(pObj->GetLastBoundRect());
      51             :                     }
      52             :                 }
      53             : 
      54           0 :                 mnCount = ((RectangleVector*)mpData)->size();
      55             :             }
      56             :             else
      57             :             {
      58           0 :                 mpData = new Rectangle(rObj.GetLastBoundRect());
      59           0 :                 mnCount = 1L;
      60             :             }
      61           0 :         }
      62             : 
      63           0 :         ItemChangeBroadcaster::~ItemChangeBroadcaster()
      64             :         {
      65           0 :             if(mnCount > 1)
      66             :             {
      67           0 :                 delete ((RectangleVector*)mpData);
      68             :             }
      69             :             else
      70             :             {
      71           0 :                 delete ((Rectangle*)mpData);
      72             :             }
      73           0 :         }
      74             : 
      75           0 :         sal_uInt32 ItemChangeBroadcaster::GetRectangleCount() const
      76             :         {
      77           0 :             return mnCount;
      78             :         }
      79             : 
      80           0 :         const Rectangle& ItemChangeBroadcaster::GetRectangle(sal_uInt32 nIndex) const
      81             :         {
      82           0 :             if(mnCount > 1)
      83             :             {
      84           0 :                 return (*((RectangleVector*)mpData))[nIndex];
      85             :             }
      86             :             else
      87             :             {
      88           0 :                 return *((Rectangle*)mpData);
      89             :             }
      90             :         }
      91             :     } // end of namespace properties
      92             : } // end of namespace sdr
      93             : 
      94             : 
      95             : 
      96             : namespace sdr
      97             : {
      98             :     namespace properties
      99             :     {
     100           0 :         void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale)
     101             :         {
     102           0 :             sal_Int32 nMul(rScale.GetNumerator());
     103           0 :             sal_Int32 nDiv(rScale.GetDenominator());
     104             : 
     105           0 :             if(!rScale.IsValid() || !nDiv)
     106             :             {
     107           0 :                 return;
     108             :             }
     109             : 
     110           0 :             SfxWhichIter aIter(rSet);
     111           0 :             sal_uInt16 nWhich(aIter.FirstWhich());
     112           0 :             const SfxPoolItem *pItem = NULL;
     113             : 
     114           0 :             while(nWhich)
     115             :             {
     116           0 :                 if(SFX_ITEM_SET == rSet.GetItemState(nWhich, false, &pItem))
     117             :                 {
     118           0 :                     if(pItem->HasMetrics())
     119             :                     {
     120           0 :                         SfxPoolItem* pNewItem = pItem->Clone();
     121           0 :                         pNewItem->ScaleMetrics(nMul, nDiv);
     122           0 :                         rSet.Put(*pNewItem);
     123             :                     }
     124             :                 }
     125           0 :                 nWhich = aIter.NextWhich();
     126           0 :             }
     127             :         }
     128             :     } // end of namespace properties
     129             : } // end of namespace sdr
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10