LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - formatpaintbrushctrl.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 16 36 44.4 %
Date: 2015-06-13 12:38:46 Functions: 8 14 57.1 %
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             : 
      21             : #include "svx/formatpaintbrushctrl.hxx"
      22             : 
      23             : #include <svl/eitem.hxx>
      24             : #include <sfx2/app.hxx>
      25             : #include <vcl/toolbox.hxx>
      26             : #include <vcl/settings.hxx>
      27             : 
      28             : 
      29             : namespace svx
      30             : {
      31             : 
      32             : 
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star::beans;
      35             : 
      36         703 : SFX_IMPL_TOOLBOX_CONTROL( FormatPaintBrushToolBoxControl, SfxBoolItem );
      37             : 
      38         571 : FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
      39             :     : SfxToolBoxControl( nSlotId, nId, rTbx )
      40             :     , m_bPersistentCopy(false)
      41         571 :     , m_aDoubleClickTimer()
      42             : {
      43         571 :     sal_uInt64 nDblClkTime = rTbx.GetSettings().GetMouseSettings().GetDoubleClickTime();
      44             : 
      45         571 :     m_aDoubleClickTimer.SetTimeoutHdl( LINK(this, FormatPaintBrushToolBoxControl, WaitDoubleClickHdl) );
      46         571 :     m_aDoubleClickTimer.SetTimeout(nDblClkTime);
      47         571 : }
      48             : 
      49             : 
      50             : 
      51        1713 : FormatPaintBrushToolBoxControl::~FormatPaintBrushToolBoxControl()
      52             : {
      53         571 :     m_aDoubleClickTimer.Stop();
      54        1142 : }
      55             : 
      56             : 
      57           0 : void FormatPaintBrushToolBoxControl::impl_executePaintBrush()
      58             : {
      59           0 :     Sequence< PropertyValue > aArgs( 1 );
      60           0 :     aArgs[0].Name  = "PersistentCopy";
      61           0 :     aArgs[0].Value = makeAny( m_bPersistentCopy );
      62             :     Dispatch( OUString( ".uno:FormatPaintbrush" )
      63           0 :         , aArgs );
      64           0 : }
      65             : 
      66             : 
      67           0 : void FormatPaintBrushToolBoxControl::DoubleClick()
      68             : {
      69           0 :     m_aDoubleClickTimer.Stop();
      70             : 
      71           0 :     m_bPersistentCopy = true;
      72           0 :     this->impl_executePaintBrush();
      73           0 : }
      74             : 
      75             : 
      76           0 : void FormatPaintBrushToolBoxControl::Click()
      77             : {
      78           0 :     m_bPersistentCopy = false;
      79           0 :     m_aDoubleClickTimer.Start();
      80           0 : }
      81             : 
      82             : 
      83           0 : IMPL_LINK_NOARG_TYPED(FormatPaintBrushToolBoxControl, WaitDoubleClickHdl, Timer *, void)
      84             : {
      85             :     //there was no second click during waiting
      86           0 :     this->impl_executePaintBrush();
      87           0 : }
      88             : 
      89             : 
      90           0 : void FormatPaintBrushToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
      91             : {
      92           0 : }
      93             : 
      94             : 
      95         959 : void FormatPaintBrushToolBoxControl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
      96             :                 const SfxPoolItem* pState )
      97             : {
      98         959 :     if( eState != SfxItemState::DEFAULT && eState != SfxItemState::SET )
      99         122 :         m_bPersistentCopy = false;
     100         959 :     SfxToolBoxControl::StateChanged( nSID, eState, pState );
     101         959 : }
     102             : 
     103             : 
     104         390 : } //namespace svx
     105             : 
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11