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

Generated by: LCOV version 1.10