LCOV - code coverage report
Current view: top level - svx/source/sdr/properties - e3dcompoundproperties.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 45 53 84.9 %
Date: 2014-11-03 Functions: 9 11 81.8 %
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 <sdr/properties/e3dcompoundproperties.hxx>
      21             : #include <svl/itemset.hxx>
      22             : #include <svx/obj3d.hxx>
      23             : #include <svx/scene3d.hxx>
      24             : 
      25             : 
      26             : 
      27             : namespace sdr
      28             : {
      29             :     namespace properties
      30             :     {
      31        4098 :         E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj)
      32        4098 :         :   E3dProperties(rObj)
      33             :         {
      34        4098 :         }
      35             : 
      36           0 :         E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj)
      37           0 :         :   E3dProperties(rProps, rObj)
      38             :         {
      39           0 :         }
      40             : 
      41        4843 :         E3dCompoundProperties::~E3dCompoundProperties()
      42             :         {
      43        4843 :         }
      44             : 
      45           0 :         BaseProperties& E3dCompoundProperties::Clone(SdrObject& rObj) const
      46             :         {
      47           0 :             return *(new E3dCompoundProperties(*this, rObj));
      48             :         }
      49             : 
      50      190288 :         const SfxItemSet& E3dCompoundProperties::GetObjectItemSet() const
      51             :         {
      52             :             //DBG_ASSERT(sal_False, "E3dCompoundProperties::GetObjectItemSet() maybe the wrong call (!)");
      53      190288 :             return E3dProperties::GetObjectItemSet();
      54             :         }
      55             : 
      56       31734 :         const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const
      57             :         {
      58             :             // include Items of scene this object belongs to
      59       31734 :             E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject());
      60       31734 :             E3dScene* pScene = rObj.GetScene();
      61             : 
      62       31734 :             if(pScene)
      63             :             {
      64             :                 // force ItemSet
      65       31734 :                 GetObjectItemSet();
      66             : 
      67             :                 // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset
      68       31734 :                 SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
      69       31734 :                 aSet.Put(pScene->GetProperties().GetObjectItemSet());
      70       31734 :                 mpItemSet->Put(aSet);
      71             :             }
      72             : 
      73             :             // call parent
      74       31734 :             return E3dProperties::GetMergedItemSet();
      75             :         }
      76             : 
      77        9491 :         void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
      78             :         {
      79             :             // Set scene specific items at scene
      80        9491 :             E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject());
      81        9491 :             E3dScene* pScene = rObj.GetScene();
      82             : 
      83        9491 :             if(pScene)
      84             :             {
      85             :                 // force ItemSet
      86        9491 :                 GetObjectItemSet();
      87             : 
      88             :                 // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset
      89        9491 :                 SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
      90        9491 :                 aSet.Put(rSet);
      91             : 
      92        9491 :                 if(bClearAllItems)
      93             :                 {
      94           0 :                     pScene->GetProperties().ClearObjectItem();
      95             :                 }
      96             : 
      97        9491 :                 if(aSet.Count())
      98             :                 {
      99         919 :                     pScene->GetProperties().SetObjectItemSet(aSet);
     100        9491 :                 }
     101             :             }
     102             : 
     103             :             // call parent. This will set items on local object, too.
     104        9491 :             E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
     105        9491 :         }
     106             : 
     107       57488 :         void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich)
     108             :         {
     109             :             // call parent
     110       57488 :             E3dProperties::PostItemChange(nWhich);
     111             : 
     112             :             // handle value change
     113       57488 :             E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject());
     114             : 
     115       57488 :             switch(nWhich)
     116             :             {
     117             :                 // #i28528#
     118             :                 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
     119             :                 case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
     120             :                 {
     121         224 :                     rObj.ActionChanged();
     122         224 :                     break;
     123             :                 }
     124             :                 case SDRATTR_3DOBJ_DOUBLE_SIDED:
     125             :                 {
     126        1478 :                     rObj.ActionChanged();
     127        1478 :                     break;
     128             :                 }
     129             :                 case SDRATTR_3DOBJ_NORMALS_KIND:
     130             :                 {
     131        1446 :                     rObj.ActionChanged();
     132        1446 :                     break;
     133             :                 }
     134             :                 case SDRATTR_3DOBJ_NORMALS_INVERT:
     135             :                 {
     136           0 :                     rObj.ActionChanged();
     137           0 :                     break;
     138             :                 }
     139             :                 case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
     140             :                 {
     141         116 :                     rObj.ActionChanged();
     142         116 :                     break;
     143             :                 }
     144             :                 case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
     145             :                 {
     146         132 :                     rObj.ActionChanged();
     147         132 :                     break;
     148             :                 }
     149             :             }
     150       57488 :         }
     151             :     } // end of namespace properties
     152         651 : } // end of namespace sdr
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10