LCOV - code coverage report
Current view: top level - svx/source/stbctrls - insctrl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 38 0.0 %
Date: 2014-04-14 Functions: 0 9 0.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 <tools/shl.hxx>
      21             : #include <vcl/status.hxx>
      22             : #include <svl/eitem.hxx>
      23             : #include <sfx2/app.hxx>
      24             : #include <sfx2/dispatch.hxx>
      25             : 
      26             : #include <svx/dialogs.hrc>
      27             : 
      28             : #include "svx/insctrl.hxx"
      29             : #include <svx/dialmgr.hxx>
      30             : 
      31           0 : SFX_IMPL_STATUSBAR_CONTROL(SvxInsertStatusBarControl, SfxBoolItem);
      32             : 
      33             : // class SvxInsertStatusBarControl ---------------------------------------
      34             : 
      35           0 : SvxInsertStatusBarControl::SvxInsertStatusBarControl( sal_uInt16 _nSlotId,
      36             :                                                       sal_uInt16 _nId,
      37             :                                                       StatusBar& rStb ) :
      38             : 
      39             :     SfxStatusBarControl( _nSlotId, _nId, rStb ),
      40           0 :     bInsert( true )
      41             : {
      42           0 : }
      43             : 
      44             : 
      45             : 
      46           0 : SvxInsertStatusBarControl::~SvxInsertStatusBarControl()
      47             : {
      48           0 : }
      49             : 
      50             : 
      51             : 
      52           0 : void SvxInsertStatusBarControl::StateChanged( sal_uInt16 , SfxItemState eState,
      53             :                                               const SfxPoolItem* pState )
      54             : {
      55           0 :     if ( SFX_ITEM_AVAILABLE != eState )
      56           0 :         GetStatusBar().SetItemText( GetId(), "" );
      57             :     else
      58             :     {
      59             :         DBG_ASSERT( pState->ISA( SfxBoolItem ), "invalid item type" );
      60           0 :         SfxBoolItem* pItem = (SfxBoolItem*)pState;
      61           0 :         bInsert = pItem->GetValue();
      62             : 
      63           0 :         if ( bInsert )
      64           0 :             GetStatusBar().SetQuickHelpText( GetId(), SVX_RESSTR( RID_SVXSTR_INSERT_HELPTEXT ) );
      65             :         else
      66           0 :             GetStatusBar().SetQuickHelpText( GetId(), SVX_RESSTR( RID_SVXSTR_OVERWRITE_HELPTEXT ) );
      67             : 
      68           0 :         DrawItemText_Impl();
      69             :     }
      70           0 : }
      71             : 
      72             : 
      73             : 
      74           0 : void SvxInsertStatusBarControl::Click()
      75             : {
      76           0 :     if ( GetStatusBar().GetItemText( GetId() ).isEmpty() )
      77           0 :         return;
      78           0 :     bInsert = !bInsert;
      79           0 :     SfxBoolItem aIns( GetSlotId(), bInsert );
      80             : 
      81           0 :     ::com::sun::star::uno::Any a;
      82           0 :     bool bHasValue = aIns.QueryValue( a );
      83           0 :     if (!bHasValue)
      84           0 :         return;
      85             : 
      86           0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
      87           0 :     aArgs[0].Name = "InsertMode";
      88           0 :     aArgs[0].Value = a;
      89             : 
      90           0 :     execute( aArgs );
      91             : }
      92             : 
      93             : 
      94             : 
      95           0 : void SvxInsertStatusBarControl::Paint( const UserDrawEvent& )
      96             : {
      97           0 :     DrawItemText_Impl();
      98           0 : }
      99             : 
     100             : 
     101             : 
     102           0 : void SvxInsertStatusBarControl::DrawItemText_Impl()
     103             : {
     104           0 :     OUString aText;
     105           0 :     if ( !bInsert )
     106           0 :         aText = SVX_RESSTR( RID_SVXSTR_OVERWRITE_TEXT );
     107             : 
     108           0 :     GetStatusBar().SetItemText( GetId(), aText );
     109           0 : }
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10