LCOV - code coverage report
Current view: top level - svx/source/dialog - rlrcitem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 41 41 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 44 58 75.9 %

           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                 :            : #include <svl/rectitem.hxx>
      30                 :            : 
      31                 :            : 
      32                 :            : 
      33                 :            : 
      34                 :            : 
      35                 :            : 
      36                 :            : #include <svx/dialogs.hrc>
      37                 :            : 
      38                 :            : #include <svx/ruler.hxx>
      39                 :            : #include <editeng/lrspitem.hxx>
      40                 :            : #include <editeng/ulspitem.hxx>
      41                 :            : #include <editeng/tstpitem.hxx>
      42                 :            : #include "editeng/protitem.hxx"
      43                 :            : #include "rlrcitem.hxx"
      44                 :            : #include "svx/rulritem.hxx"
      45                 :            : #include <svl/eitem.hxx>
      46                 :            : 
      47                 :            : // class SvxRulerItem ----------------------------------------------------
      48                 :            : 
      49                 :      28024 : SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
      50                 :            : : SfxControllerItem(_nId, rBindings),
      51                 :      28024 :   rRuler(rRul)
      52                 :            : {
      53                 :      28024 : }
      54                 :            : 
      55                 :            : // -----------------------------------------------------------------------
      56                 :            : 
      57                 :      10811 : void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
      58                 :            :                                  const SfxPoolItem* pState)
      59                 :            : {
      60                 :            :     // SFX_ITEM_DONTCARE => pState == -1 => PTR_CAST buff
      61         [ +  + ]:      10811 :     if ( eState != SFX_ITEM_AVAILABLE )
      62                 :       3414 :         pState = 0;
      63                 :            : 
      64   [ +  +  +  +  :      10811 :     switch(nSID)
          +  +  +  +  +  
                +  +  - ]
      65                 :            :     {
      66                 :            :         // Left / right margin
      67                 :            :         case SID_RULER_LR_MIN_MAX:
      68                 :            :         {
      69 [ +  - ][ +  - ]:       1102 :             const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
      70                 :       1102 :             rRuler.UpdateFrameMinMax(pItem);
      71                 :       1102 :             break;
      72                 :            :         }
      73                 :            :         case SID_ATTR_LONG_LRSPACE:
      74                 :            :         {
      75 [ +  + ][ +  - ]:        557 :             const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
      76                 :            :             DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
      77                 :        557 :             rRuler.UpdateFrame(pItem);
      78                 :        557 :             break;
      79                 :            :         }
      80                 :            :         case SID_ATTR_LONG_ULSPACE:
      81                 :            :         {
      82 [ +  + ][ +  - ]:        555 :             const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
      83                 :            :             DBG_ASSERT(pState? 0 != pItem: true, "SvxULSpaceItem expected");
      84                 :        555 :             rRuler.UpdateFrame(pItem);
      85                 :        555 :             break;
      86                 :            :         }
      87                 :            :         case SID_ATTR_TABSTOP_VERTICAL:
      88                 :            :         case SID_ATTR_TABSTOP:
      89                 :            :         {
      90 [ +  + ][ +  - ]:       1042 :             const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
      91                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SvxTabStopItem expected");
      92                 :       1042 :             rRuler.Update(pItem);
      93                 :       1042 :             break;
      94                 :            :         }
      95                 :            :         case SID_ATTR_PARA_LRSPACE_VERTICAL:
      96                 :            :         case SID_ATTR_PARA_LRSPACE:
      97                 :            :         {
      98 [ +  + ][ +  - ]:       1042 :             const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
      99                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SvxLRSpaceItem expected");
     100                 :       1042 :             rRuler.UpdatePara(pItem);
     101                 :       1042 :             break;
     102                 :            :         }
     103                 :            :         case SID_RULER_BORDERS_VERTICAL:
     104                 :            :         case SID_RULER_BORDERS:
     105                 :            :         case SID_RULER_ROWS:
     106                 :            :         case SID_RULER_ROWS_VERTICAL:
     107                 :            :         {
     108 [ +  + ][ +  - ]:       1973 :             const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
     109                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SvxColumnItem expected");
     110                 :            : #ifdef DBG_UTIL
     111                 :            :             if(pItem)
     112                 :            :             {
     113                 :            :                 if(pItem->IsConsistent())
     114                 :            :                     rRuler.Update(pItem, nSID);
     115                 :            :                 else
     116                 :            :                     OSL_FAIL("Column item corrupted");
     117                 :            :             }
     118                 :            :             else
     119                 :            :                 rRuler.Update(pItem, nSID);
     120                 :            : #else
     121                 :       1973 :             rRuler.Update(pItem, nSID);
     122                 :            : #endif
     123                 :       1973 :             break;
     124                 :            :         }
     125                 :            :         case SID_RULER_PAGE_POS:
     126                 :            :         {   // Position page, page width
     127 [ +  - ][ +  - ]:       1138 :             const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
     128                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SvxPagePosSizeItem expected");
     129                 :       1138 :             rRuler.Update(pItem);
     130                 :       1138 :             break;
     131                 :            :         }
     132                 :            :         case SID_RULER_OBJECT:
     133                 :            :         {   // Object selection
     134 [ +  + ][ +  - ]:        110 :             const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
     135                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SvxObjectItem expected");
     136                 :        110 :             rRuler.Update(pItem);
     137                 :        110 :             break;
     138                 :            :         }
     139                 :            :         case SID_RULER_PROTECT:
     140                 :            :         {
     141 [ +  + ][ +  - ]:       1100 :             const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
     142                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SvxProtectItem expected");
     143                 :       1100 :             rRuler.Update(pItem);
     144                 :       1100 :             break;
     145                 :            :         }
     146                 :            :         case SID_RULER_BORDER_DISTANCE:
     147                 :            :         {
     148 [ +  + ][ +  - ]:       1096 :             const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
     149                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SvxLRSpaceItem expected");
     150                 :       1096 :             rRuler.UpdateParaBorder(pItem);
     151                 :            :         }
     152                 :       1096 :         break;
     153                 :            :         case SID_RULER_TEXT_RIGHT_TO_LEFT :
     154                 :            :         {
     155 [ +  + ][ +  - ]:       1096 :             const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
     156                 :            :             DBG_ASSERT(pState?  0 != pItem: true, "SfxBoolItem expected");
     157                 :       1096 :             rRuler.UpdateTextRTL(pItem);
     158                 :            :         }
     159                 :       1096 :         break;
     160                 :            :     }
     161                 :      10811 : }
     162                 :            : 
     163                 :            : 
     164                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10