LibreOffice Module svx (master)  1
formatpaintbrushctrl.cxx
Go to the documentation of this file.
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 
22 
23 #include <svl/eitem.hxx>
24 #include <vcl/toolbox.hxx>
25 #include <vcl/settings.hxx>
26 
27 
28 namespace svx
29 {
30 
31 
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::beans;
34 
35 SFX_IMPL_TOOLBOX_CONTROL( FormatPaintBrushToolBoxControl, SfxBoolItem );
36 
37 FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
38  : SfxToolBoxControl( nSlotId, nId, rTbx )
39  , m_bPersistentCopy(false)
40  , m_aDoubleClickTimer()
41 {
42  sal_uInt64 nDblClkTime = rTbx.GetSettings().GetMouseSettings().GetDoubleClickTime();
43 
45  m_aDoubleClickTimer.SetTimeout(nDblClkTime);
46 }
47 
48 
50 {
52 }
53 
54 
56 {
57  Sequence< PropertyValue > aArgs( 1 );
58  aArgs[0].Name = "PersistentCopy";
59  aArgs[0].Value <<= m_bPersistentCopy;
60  Dispatch( ".uno:FormatPaintbrush"
61  , aArgs );
62 }
63 
64 
66 {
68 
69  m_bPersistentCopy = true;
71 }
72 
73 
75 {
76  m_bPersistentCopy = false;
78 }
79 
80 
82 {
83  //there was no second click during waiting
84  impl_executePaintBrush();
85 }
86 
87 
88 void FormatPaintBrushToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
89 {
90 }
91 
92 
94  const SfxPoolItem* pState )
95 {
96  if( eState != SfxItemState::DEFAULT && eState != SfxItemState::SET )
97  m_bPersistentCopy = false;
98  SfxToolBoxControl::StateChanged( nSID, eState, pState );
99 }
100 
101 
102 } //namespace svx
103 
104 
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
IMPL_LINK_NOARG(SuggestionDisplay, SelectSuggestionValueSetHdl, SvtValueSet *, void)
sal_uInt64 GetDoubleClickTime() const
SFX_IMPL_TOOLBOX_CONTROL(FormatPaintBrushToolBoxControl, SfxBoolItem)
FormatPaintBrushToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx)
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState)
virtual void Start() override
virtual void Select(sal_uInt16 nSelectModifier) override
const AllSettings & GetSettings() const
void SetTimeout(sal_uInt64 nTimeoutMs)
SfxItemState
void Stop()
const MouseSettings & GetMouseSettings() const
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
void Dispatch(const OUString &aCommand, css::uno::Sequence< css::beans::PropertyValue > const &aArgs)