LCOV - code coverage report
Current view: top level - svx/source/sdr/properties - measureproperties.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 33 38 86.8 %
Date: 2015-06-13 12:38:46 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/measureproperties.hxx>
      21             : #include <svl/itemset.hxx>
      22             : #include <svl/style.hxx>
      23             : #include <svx/svddef.hxx>
      24             : #include <editeng/eeitem.hxx>
      25             : #include <svx/svdomeas.hxx>
      26             : #include <svx/sxmsuitm.hxx>
      27             : #include <svx/xlnstit.hxx>
      28             : #include <svx/xlnstwit.hxx>
      29             : #include <svx/xlnedit.hxx>
      30             : #include <svx/xlnedwit.hxx>
      31             : #include <basegfx/point/b2dpoint.hxx>
      32             : #include <basegfx/polygon/b2dpolygon.hxx>
      33             : 
      34             : 
      35             : namespace sdr
      36             : {
      37             :     namespace properties
      38             :     {
      39             :         // create a new itemset
      40           7 :         SfxItemSet* MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
      41             :         {
      42             :             return new SfxItemSet(rPool,
      43             : 
      44             :                 // range from SdrAttrObj
      45             :                 SDRATTR_START, SDRATTR_SHADOW_LAST,
      46             :                 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
      47             :                 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
      48             : 
      49             :                 // range from SdrMeasureObj
      50             :                 SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
      51             : 
      52             :                 // range from SdrTextObj
      53             :                 EE_ITEMS_START, EE_ITEMS_END,
      54             : 
      55             :                 // end
      56           7 :                 0, 0);
      57             :         }
      58             : 
      59           7 :         MeasureProperties::MeasureProperties(SdrObject& rObj)
      60           7 :         :   TextProperties(rObj)
      61             :         {
      62           7 :         }
      63             : 
      64           0 :         MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
      65           0 :         :   TextProperties(rProps, rObj)
      66             :         {
      67           0 :         }
      68             : 
      69          14 :         MeasureProperties::~MeasureProperties()
      70             :         {
      71          14 :         }
      72             : 
      73           0 :         BaseProperties& MeasureProperties::Clone(SdrObject& rObj) const
      74             :         {
      75           0 :             return *(new MeasureProperties(*this, rObj));
      76             :         }
      77             : 
      78          28 :         void MeasureProperties::ItemSetChanged(const SfxItemSet& rSet)
      79             :         {
      80          28 :             SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
      81             : 
      82             :             // call parent
      83          28 :             TextProperties::ItemSetChanged(rSet);
      84             : 
      85             :             // local changes
      86          28 :             rObj.SetTextDirty();
      87          28 :         }
      88             : 
      89           7 :         void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
      90             :         {
      91           7 :             SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
      92             : 
      93             :             // local changes
      94           7 :             rObj.SetTextDirty();
      95             : 
      96             :             // call parent
      97           7 :             TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
      98           7 :         }
      99             : 
     100           7 :         void MeasureProperties::ForceDefaultAttributes()
     101             :         {
     102             :             // call parent
     103           7 :             TextProperties::ForceDefaultAttributes();
     104             : 
     105             :             // force ItemSet
     106           7 :             GetObjectItemSet();
     107             : 
     108             :             //#71958# by default, the show units Bool-Item is set as hard
     109             :             // attribute to sal_True to aviod confusion when copying SdrMeasureObj's
     110             :             // from one application to another
     111           7 :             mpItemSet->Put(makeSdrMeasureShowUnitItem(true));
     112             : 
     113           7 :             basegfx::B2DPolygon aNewPolygon;
     114           7 :             aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
     115           7 :             aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
     116           7 :             aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
     117           7 :             aNewPolygon.setClosed(true);
     118             : 
     119           7 :             mpItemSet->Put(XLineStartItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
     120           7 :             mpItemSet->Put(XLineStartWidthItem(200));
     121           7 :             mpItemSet->Put(XLineEndItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
     122           7 :             mpItemSet->Put(XLineEndWidthItem(200));
     123           7 :             mpItemSet->Put(XLineStyleItem(com::sun::star::drawing::LineStyle_SOLID));
     124           7 :         }
     125             :     } // end of namespace properties
     126         435 : } // end of namespace sdr
     127             : 
     128             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11