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

Generated by: LCOV version 1.10