LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdoattr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 32 39 82.1 %
Date: 2012-08-25 Functions: 8 15 53.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 27 48 56.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <svx/svdoattr.hxx>
      31                 :            : #include <svx/xpool.hxx>
      32                 :            : #include "svx/svditext.hxx"
      33                 :            : #include <svx/svdmodel.hxx>
      34                 :            : #include <svx/svdpage.hxx>
      35                 :            : #include <svx/svdattr.hxx>
      36                 :            : #include <svx/svdattrx.hxx>
      37                 :            : #include <svx/svdpool.hxx>
      38                 :            : #include <svx/svdotext.hxx>
      39                 :            : #include <svx/svdocapt.hxx>
      40                 :            : #include <svx/svdograf.hxx>
      41                 :            : #include <svx/svdoole2.hxx>
      42                 :            : #include <svx/svdorect.hxx>
      43                 :            : #include <svx/svdocirc.hxx>
      44                 :            : #include <svx/svdomeas.hxx>
      45                 :            : #include <svl/smplhint.hxx>
      46                 :            : #include <svl/itemiter.hxx>
      47                 :            : #include <svx/xenum.hxx>
      48                 :            : #include <svx/xlineit0.hxx>
      49                 :            : #include <svx/xlnstwit.hxx>
      50                 :            : #include <svx/xlnedwit.hxx>
      51                 :            : #include <svx/xfillit0.hxx>
      52                 :            : #include <svx/xflbmtit.hxx>
      53                 :            : #include <svx/xtextit0.hxx>
      54                 :            : #include <svx/xflbstit.hxx>
      55                 :            : #include <svx/xflbtoxy.hxx>
      56                 :            : #include <svx/xftshit.hxx>
      57                 :            : 
      58                 :            : 
      59                 :            : #include <editeng/colritem.hxx>
      60                 :            : #include "editeng/fontitem.hxx"
      61                 :            : #include <editeng/fhgtitem.hxx>
      62                 :            : 
      63                 :            : #include <svx/xlnstcit.hxx>
      64                 :            : #include <svx/xlnwtit.hxx>
      65                 :            : #include <svl/style.hxx>
      66                 :            : #include <svl/whiter.hxx>
      67                 :            : #include <svx/xlnclit.hxx>
      68                 :            : #include <svx/xflclit.hxx>
      69                 :            : #include <svx/xlntrit.hxx>
      70                 :            : #include <svx/xfltrit.hxx>
      71                 :            : #include <svx/xlnedcit.hxx>
      72                 :            : #include <editeng/adjitem.hxx>
      73                 :            : #include <svx/xflbckit.hxx>
      74                 :            : #include <svx/xtable.hxx>
      75                 :            : #include <svx/xbtmpit.hxx>
      76                 :            : #include <svx/xlndsit.hxx>
      77                 :            : #include <svx/xlnedit.hxx>
      78                 :            : #include <svx/xflgrit.hxx>
      79                 :            : #include <svx/xflftrit.hxx>
      80                 :            : #include <svx/xflhtit.hxx>
      81                 :            : #include <svx/xlnstit.hxx>
      82                 :            : #include <svx/sdr/properties/attributeproperties.hxx>
      83                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      84                 :            : #include "svx/xlinjoit.hxx"
      85                 :            : 
      86                 :            : //////////////////////////////////////////////////////////////////////////////
      87                 :            : 
      88                 :          0 : sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
      89                 :            : {
      90         [ #  # ]:          0 :     return new sdr::properties::AttributeProperties(*this);
      91                 :            : }
      92                 :            : 
      93                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      94                 :            : 
      95 [ -  + ][ -  + ]:    1298496 : TYPEINIT1(SdrAttrObj,SdrObject);
      96                 :            : 
      97         [ +  - ]:      60340 : SdrAttrObj::SdrAttrObj()
      98                 :            : {
      99                 :      60340 : }
     100                 :            : 
     101                 :      60242 : SdrAttrObj::~SdrAttrObj()
     102                 :            : {
     103         [ -  + ]:      60242 : }
     104                 :            : 
     105                 :     216509 : const Rectangle& SdrAttrObj::GetSnapRect() const
     106                 :            : {
     107         [ +  + ]:     216509 :     if(bSnapRectDirty)
     108                 :            :     {
     109                 :     106632 :         ((SdrAttrObj*)this)->RecalcSnapRect();
     110                 :     106632 :         ((SdrAttrObj*)this)->bSnapRectDirty = false;
     111                 :            :     }
     112                 :            : 
     113                 :     216509 :     return maSnapRect;
     114                 :            : }
     115                 :            : 
     116                 :     111621 : void SdrAttrObj::SetModel(SdrModel* pNewModel)
     117                 :            : {
     118                 :     111621 :     SdrModel* pOldModel = pModel;
     119                 :            : 
     120                 :            :     // test for correct pool in ItemSet; move to new pool if necessary
     121 [ +  - ][ +  - ]:     111621 :     if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
         [ +  + ][ +  + ]
     122                 :            :     {
     123                 :      60063 :         MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
     124                 :            :     }
     125                 :            : 
     126                 :            :     // call parent
     127                 :     111621 :     SdrObject::SetModel(pNewModel);
     128                 :            : 
     129                 :            :     // modify properties
     130                 :     111621 :     GetProperties().SetModel(pOldModel, pNewModel);
     131                 :     111621 : }
     132                 :            : 
     133                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     134                 :            : // syntactical sugar for ItemSet accesses
     135                 :            : 
     136                 :      24934 : void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
     137                 :            : {
     138 [ +  - ][ +  + ]:      24934 :     SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
     139 [ +  + ][ +  - ]:      24934 :     sal_Bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
     140                 :            : 
     141         [ +  + ]:      24934 :     if(bDataChg)
     142                 :            :     {
     143         [ +  - ]:      15748 :         Rectangle aBoundRect = GetLastBoundRect();
     144         [ +  - ]:      15748 :         SetBoundRectDirty();
     145         [ +  - ]:      15748 :         SetRectsDirty(sal_True);
     146                 :            : 
     147                 :            :         // This may have led to object change
     148         [ +  - ]:      15748 :         SetChanged();
     149         [ +  - ]:      15748 :         BroadcastObjectChange();
     150         [ +  - ]:      15748 :         SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
     151                 :            :     }
     152                 :      24934 : }
     153                 :            : 
     154                 :        272 : sal_Int32 SdrAttrObj::ImpGetLineWdt() const
     155                 :            : {
     156                 :        272 :     sal_Int32 nRetval(0);
     157                 :            : 
     158         [ -  + ]:        272 :     if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue())
     159                 :            :     {
     160                 :          0 :         nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
     161                 :            :     }
     162                 :            : 
     163                 :        272 :     return nRetval;
     164                 :            : }
     165                 :            : 
     166                 :          0 : sal_Bool SdrAttrObj::HasFill() const
     167                 :            : {
     168 [ #  # ][ #  # ]:          0 :     return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
     169                 :            : }
     170                 :            : 
     171                 :          0 : sal_Bool SdrAttrObj::HasLine() const
     172                 :            : {
     173                 :          0 :     return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
     174                 :            : }
     175                 :            : 
     176                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10