LCOV - code coverage report
Current view: top level - svx/source/stbctrls - insctrl.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 25 80.0 %
Date: 2015-06-13 12:38:46 Functions: 7 8 87.5 %
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 <vcl/status.hxx>
      21             : #include <svl/eitem.hxx>
      22             : #include <sfx2/app.hxx>
      23             : #include <sfx2/dispatch.hxx>
      24             : 
      25             : #include <svx/dialogs.hrc>
      26             : 
      27             : #include "svx/insctrl.hxx"
      28             : #include <svx/dialmgr.hxx>
      29             : 
      30         619 : SFX_IMPL_STATUSBAR_CONTROL(SvxInsertStatusBarControl, SfxBoolItem);
      31             : 
      32         508 : SvxInsertStatusBarControl::SvxInsertStatusBarControl( sal_uInt16 _nSlotId,
      33             :                                                       sal_uInt16 _nId,
      34             :                                                       StatusBar& rStb ) :
      35             : 
      36             :     SfxStatusBarControl( _nSlotId, _nId, rStb ),
      37         508 :     bInsert( true )
      38             : {
      39         508 : }
      40             : 
      41        1016 : SvxInsertStatusBarControl::~SvxInsertStatusBarControl()
      42             : {
      43        1016 : }
      44             : 
      45         808 : void SvxInsertStatusBarControl::StateChanged( sal_uInt16 , SfxItemState eState,
      46             :                                               const SfxPoolItem* pState )
      47             : {
      48         808 :     if ( SfxItemState::DEFAULT != eState )
      49         200 :         GetStatusBar().SetItemText( GetId(), "" );
      50             :     else
      51             :     {
      52             :         DBG_ASSERT( pState->ISA( SfxBoolItem ), "invalid item type" );
      53         608 :         const SfxBoolItem* pItem = static_cast<const SfxBoolItem*>(pState);
      54         608 :         bInsert = pItem->GetValue();
      55             : 
      56         608 :         if ( bInsert )
      57         608 :             GetStatusBar().SetQuickHelpText( GetId(), SVX_RESSTR( RID_SVXSTR_INSERT_HELPTEXT ) );
      58             :         else
      59           0 :             GetStatusBar().SetQuickHelpText( GetId(), SVX_RESSTR( RID_SVXSTR_OVERWRITE_HELPTEXT ) );
      60             : 
      61         608 :         DrawItemText_Impl();
      62             :     }
      63         808 : }
      64             : 
      65           0 : void SvxInsertStatusBarControl::Paint( const UserDrawEvent& )
      66             : {
      67           0 :     DrawItemText_Impl();
      68           0 : }
      69             : 
      70         608 : void SvxInsertStatusBarControl::DrawItemText_Impl()
      71             : {
      72         608 :     OUString aText;
      73         608 :     if ( !bInsert )
      74           0 :         aText = SVX_RESSTR( RID_SVXSTR_OVERWRITE_TEXT );
      75             : 
      76         608 :     GetStatusBar().SetItemText( GetId(), aText );
      77         608 : }
      78             : 
      79             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11