LCOV - code coverage report
Current view: top level - svx/source/dialog - rlrcitem.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 41 41 100.0 %
Date: 2015-06-13 12:38:46 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       56596 : SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
      39             : : SfxControllerItem(_nId, rBindings),
      40       56596 :   rRuler(rRul)
      41             : {
      42       56596 : }
      43             : 
      44             : 
      45             : 
      46        6269 : void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
      47             :                                  const SfxPoolItem* pState)
      48             : {
      49             :     // SfxItemState::DONTCARE => pState == -1 => PTR_CAST buff
      50        6269 :     if ( eState != SfxItemState::DEFAULT )
      51        1971 :         pState = 0;
      52             : 
      53        6269 :     switch(nSID)
      54             :     {
      55             :         // Left / right margin
      56             :         case SID_RULER_LR_MIN_MAX:
      57             :         {
      58         641 :             const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
      59         641 :             rRuler.UpdateFrameMinMax(pItem);
      60         641 :             break;
      61             :         }
      62             :         case SID_ATTR_LONG_LRSPACE:
      63             :         {
      64         316 :             const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
      65             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxLRSpaceItem expected");
      66         316 :             rRuler.UpdateFrame(pItem);
      67         316 :             break;
      68             :         }
      69             :         case SID_ATTR_LONG_ULSPACE:
      70             :         {
      71         330 :             const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
      72             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxULSpaceItem expected");
      73         330 :             rRuler.UpdateFrame(pItem);
      74         330 :             break;
      75             :         }
      76             :         case SID_ATTR_TABSTOP_VERTICAL:
      77             :         case SID_ATTR_TABSTOP:
      78             :         {
      79         600 :             const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
      80             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxTabStopItem expected");
      81         600 :             rRuler.Update(pItem);
      82         600 :             break;
      83             :         }
      84             :         case SID_ATTR_PARA_LRSPACE_VERTICAL:
      85             :         case SID_ATTR_PARA_LRSPACE:
      86             :         {
      87         601 :             const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
      88             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxLRSpaceItem expected");
      89         601 :             rRuler.UpdatePara(pItem);
      90         601 :             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        1126 :             const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
      98             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "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        1126 :             rRuler.Update(pItem, nSID);
     111             : #endif
     112        1126 :             break;
     113             :         }
     114             :         case SID_RULER_PAGE_POS:
     115             :         {   // Position page, page width
     116         670 :             const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
     117             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxPagePosSizeItem expected");
     118         670 :             rRuler.Update(pItem);
     119         670 :             break;
     120             :         }
     121             :         case SID_RULER_OBJECT:
     122             :         {   // Object selection
     123          74 :             const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
     124             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxObjectItem expected");
     125          74 :             rRuler.Update(pItem);
     126          74 :             break;
     127             :         }
     128             :         case SID_RULER_PROTECT:
     129             :         {
     130         639 :             const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
     131             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxProtectItem expected");
     132         639 :             rRuler.Update(pItem);
     133         639 :             break;
     134             :         }
     135             :         case SID_RULER_BORDER_DISTANCE:
     136             :         {
     137         635 :             const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
     138             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SvxLRSpaceItem expected");
     139         635 :             rRuler.UpdateParaBorder(pItem);
     140             :         }
     141         635 :         break;
     142             :         case SID_RULER_TEXT_RIGHT_TO_LEFT :
     143             :         {
     144         637 :             const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
     145             :             DBG_ASSERT(pState == nullptr || pItem != nullptr, "SfxBoolItem expected");
     146         637 :             rRuler.UpdateTextRTL(pItem);
     147             :         }
     148         637 :         break;
     149             :     }
     150        6659 : }
     151             : 
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11