LCOV - code coverage report
Current view: top level - svx/source/dialog - rlrcitem.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 41 41 100.0 %
Date: 2014-11-03 Functions: 4 4 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       96720 : SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
      39             : : SfxControllerItem(_nId, rBindings),
      40       96720 :   rRuler(rRul)
      41             : {
      42       96720 : }
      43             : 
      44             : 
      45             : 
      46        3754 : void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
      47             :                                  const SfxPoolItem* pState)
      48             : {
      49             :     // SfxItemState::DONTCARE => pState == -1 => PTR_CAST buff
      50        3754 :     if ( eState != SfxItemState::DEFAULT )
      51        1139 :         pState = 0;
      52             : 
      53        3754 :     switch(nSID)
      54             :     {
      55             :         // Left / right margin
      56             :         case SID_RULER_LR_MIN_MAX:
      57             :         {
      58         378 :             const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
      59         378 :             rRuler.UpdateFrameMinMax(pItem);
      60         378 :             break;
      61             :         }
      62             :         case SID_ATTR_LONG_LRSPACE:
      63             :         {
      64         189 :             const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
      65             :             DBG_ASSERT(pState? 0 != pItem: true, "SvxLRSpaceItem expected");
      66         189 :             rRuler.UpdateFrame(pItem);
      67         189 :             break;
      68             :         }
      69             :         case SID_ATTR_LONG_ULSPACE:
      70             :         {
      71         189 :             const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
      72             :             DBG_ASSERT(pState? 0 != pItem: true, "SvxULSpaceItem expected");
      73         189 :             rRuler.UpdateFrame(pItem);
      74         189 :             break;
      75             :         }
      76             :         case SID_ATTR_TABSTOP_VERTICAL:
      77             :         case SID_ATTR_TABSTOP:
      78             :         {
      79         369 :             const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
      80             :             DBG_ASSERT(pState?  0 != pItem: true, "SvxTabStopItem expected");
      81         369 :             rRuler.Update(pItem);
      82         369 :             break;
      83             :         }
      84             :         case SID_ATTR_PARA_LRSPACE_VERTICAL:
      85             :         case SID_ATTR_PARA_LRSPACE:
      86             :         {
      87         363 :             const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
      88             :             DBG_ASSERT(pState?  0 != pItem: true, "SvxLRSpaceItem expected");
      89         363 :             rRuler.UpdatePara(pItem);
      90         363 :             break;
      91             :         }
      92             :         case SID_RULER_BORDERS_VERTICAL:
      93             :         case SID_RULER_BORDERS:
      94             :         case SID_RULER_ROWS:
      95             :         case SID_RULER_ROWS_VERTICAL:
      96             :         {
      97         720 :             const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
      98             :             DBG_ASSERT(pState?  0 != pItem: true, "SvxColumnItem expected");
      99             : #ifdef DBG_UTIL
     100             :             if(pItem)
     101             :             {
     102             :                 if(pItem->IsConsistent())
     103             :                     rRuler.Update(pItem, nSID);
     104             :                 else
     105             :                     OSL_FAIL("Column item corrupted");
     106             :             }
     107             :             else
     108             :                 rRuler.Update(pItem, nSID);
     109             : #else
     110         720 :             rRuler.Update(pItem, nSID);
     111             : #endif
     112         720 :             break;
     113             :         }
     114             :         case SID_RULER_PAGE_POS:
     115             :         {   // Position page, page width
     116         394 :             const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
     117             :             DBG_ASSERT(pState?  0 != pItem: true, "SvxPagePosSizeItem expected");
     118         394 :             rRuler.Update(pItem);
     119         394 :             break;
     120             :         }
     121             :         case SID_RULER_OBJECT:
     122             :         {   // Object selection
     123          18 :             const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
     124             :             DBG_ASSERT(pState?  0 != pItem: true, "SvxObjectItem expected");
     125          18 :             rRuler.Update(pItem);
     126          18 :             break;
     127             :         }
     128             :         case SID_RULER_PROTECT:
     129             :         {
     130         378 :             const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
     131             :             DBG_ASSERT(pState?  0 != pItem: true, "SvxProtectItem expected");
     132         378 :             rRuler.Update(pItem);
     133         378 :             break;
     134             :         }
     135             :         case SID_RULER_BORDER_DISTANCE:
     136             :         {
     137         378 :             const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
     138             :             DBG_ASSERT(pState?  0 != pItem: true, "SvxLRSpaceItem expected");
     139         378 :             rRuler.UpdateParaBorder(pItem);
     140             :         }
     141         378 :         break;
     142             :         case SID_RULER_TEXT_RIGHT_TO_LEFT :
     143             :         {
     144         378 :             const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
     145             :             DBG_ASSERT(pState?  0 != pItem: true, "SfxBoolItem expected");
     146         378 :             rRuler.UpdateTextRTL(pItem);
     147             :         }
     148         378 :         break;
     149             :     }
     150        4348 : }
     151             : 
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10