LCOV - code coverage report
Current view: top level - svx/source/sdr/properties - circleproperties.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 34 43 79.1 %
Date: 2014-11-03 Functions: 11 11 100.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 <sdr/properties/circleproperties.hxx>
      21             : #include <svl/itemset.hxx>
      22             : #include <svl/style.hxx>
      23             : #include <svx/svddef.hxx>
      24             : #include <editeng/eeitem.hxx>
      25             : #include <svx/svdocirc.hxx>
      26             : #include <sxcikitm.hxx>
      27             : #include <svx/sxciaitm.hxx>
      28             : 
      29             : 
      30             : 
      31             : namespace sdr
      32             : {
      33             :     namespace properties
      34             :     {
      35             :         // create a new itemset
      36         186 :         SfxItemSet& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
      37             :         {
      38             :             return *(new SfxItemSet(rPool,
      39             : 
      40             :                 // range from SdrAttrObj
      41             :                 SDRATTR_START, SDRATTR_SHADOW_LAST,
      42             :                 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
      43             :                 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
      44             : 
      45             :                 // range from SdrCircObj
      46             :                 SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
      47             : 
      48             :                 // range from SdrTextObj
      49             :                 EE_ITEMS_START, EE_ITEMS_END,
      50             : 
      51             :                 // end
      52         186 :                 0, 0));
      53             :         }
      54             : 
      55         186 :         CircleProperties::CircleProperties(SdrObject& rObj)
      56         186 :         :   RectangleProperties(rObj)
      57             :         {
      58         186 :         }
      59             : 
      60           2 :         CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
      61           2 :         :   RectangleProperties(rProps, rObj)
      62             :         {
      63           2 :         }
      64             : 
      65         376 :         CircleProperties::~CircleProperties()
      66             :         {
      67         376 :         }
      68             : 
      69           2 :         BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
      70             :         {
      71           2 :             return *(new CircleProperties(*this, rObj));
      72             :         }
      73             : 
      74         802 :         void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
      75             :         {
      76         802 :             SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
      77             : 
      78             :             // call parent
      79         802 :             RectangleProperties::ItemSetChanged(rSet);
      80             : 
      81             :             // local changes
      82         802 :             rObj.ImpSetAttrToCircInfo();
      83         802 :         }
      84             : 
      85         342 :         void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
      86             :         {
      87         342 :             SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
      88             : 
      89             :             // local changes
      90         342 :             rObj.SetXPolyDirty();
      91             : 
      92             :             // call parent
      93         342 :             RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
      94             : 
      95             :             // local changes
      96         342 :             rObj.ImpSetAttrToCircInfo();
      97         342 :         }
      98             : 
      99         186 :         void CircleProperties::ForceDefaultAttributes()
     100             :         {
     101         186 :             SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
     102         186 :             SdrCircKind eKindA = SDRCIRC_FULL;
     103         186 :             SdrObjKind eKind = rObj.GetCircleKind();
     104             : 
     105         186 :             if(eKind == OBJ_SECT)
     106             :             {
     107           0 :                 eKindA = SDRCIRC_SECT;
     108             :             }
     109         186 :             else if(eKind == OBJ_CARC)
     110             :             {
     111           0 :                 eKindA = SDRCIRC_ARC;
     112             :             }
     113         186 :             else if(eKind == OBJ_CCUT)
     114             :             {
     115           0 :                 eKindA = SDRCIRC_CUT;
     116             :             }
     117             : 
     118         186 :             if(eKindA != SDRCIRC_FULL)
     119             :             {
     120             :                 // force ItemSet
     121           0 :                 GetObjectItemSet();
     122             : 
     123           0 :                 mpItemSet->Put(SdrCircKindItem(eKindA));
     124             : 
     125           0 :                 if(rObj.GetStartWink())
     126             :                 {
     127           0 :                     mpItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartWink()));
     128             :                 }
     129             : 
     130           0 :                 if(rObj.GetEndWink() != 36000)
     131             :                 {
     132           0 :                     mpItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndWink()));
     133             :                 }
     134             :             }
     135             : 
     136             :             // call parent after SetObjectItem(SdrCircKindItem())
     137             :             // because ForceDefaultAttr() will call
     138             :             // ImpSetAttrToCircInfo() which needs a correct
     139             :             // SdrCircKindItem
     140         186 :             RectangleProperties::ForceDefaultAttributes();
     141         186 :         }
     142             :     } // end of namespace properties
     143         651 : } // end of namespace sdr
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10