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

Generated by: LCOV version 1.10