Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/tbxctrls/formatpaintbrushctrl.cxx
Line
Count
Source
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 <comphelper/propertyvalue.hxx>
24
#include <svl/eitem.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
SFX_IMPL_TOOLBOX_CONTROL( FormatPaintBrushToolBoxControl, SfxBoolItem );
37
38
FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx )
39
0
    : SfxToolBoxControl( nSlotId, nId, rTbx )
40
0
    , m_bPersistentCopy(false)
41
0
    , m_aDoubleClickTimer("FormatPaintBrushToolBoxControl m_aDoubleClickTimer")
42
0
{
43
0
    sal_uInt64 nDblClkTime = rTbx.GetSettings().GetMouseSettings().GetDoubleClickTime();
44
45
0
    m_aDoubleClickTimer.SetInvokeHandler( LINK(this, FormatPaintBrushToolBoxControl, WaitDoubleClickHdl) );
46
0
    m_aDoubleClickTimer.SetTimeout(nDblClkTime);
47
0
}
Unexecuted instantiation: svx::FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl(unsigned short, o3tl::strong_int<unsigned short, ToolBoxItemIdTag>, ToolBox&)
Unexecuted instantiation: svx::FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl(unsigned short, o3tl::strong_int<unsigned short, ToolBoxItemIdTag>, ToolBox&)
48
49
50
FormatPaintBrushToolBoxControl::~FormatPaintBrushToolBoxControl()
51
0
{
52
0
    m_aDoubleClickTimer.Stop();
53
0
}
54
55
56
void FormatPaintBrushToolBoxControl::impl_executePaintBrush()
57
0
{
58
0
    Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(u"PersistentCopy"_ustr,
59
0
                                                                   m_bPersistentCopy) };
60
0
    Dispatch( u".uno:FormatPaintbrush"_ustr
61
0
        , aArgs );
62
0
}
63
64
65
void FormatPaintBrushToolBoxControl::DoubleClick()
66
0
{
67
0
    m_aDoubleClickTimer.Stop();
68
69
0
    m_bPersistentCopy = true;
70
0
    impl_executePaintBrush();
71
0
}
72
73
74
void FormatPaintBrushToolBoxControl::Click()
75
0
{
76
0
    m_bPersistentCopy = false;
77
0
    m_aDoubleClickTimer.Start();
78
0
}
79
80
81
IMPL_LINK_NOARG(FormatPaintBrushToolBoxControl, WaitDoubleClickHdl, Timer *, void)
82
0
{
83
    //there was no second click during waiting
84
0
    impl_executePaintBrush();
85
0
}
86
87
88
void FormatPaintBrushToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
89
0
{
90
0
}
91
92
93
void FormatPaintBrushToolBoxControl::StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
94
                const SfxPoolItem* pState )
95
0
{
96
0
    if( eState != SfxItemState::DEFAULT && eState != SfxItemState::SET )
97
0
        m_bPersistentCopy = false;
98
0
    SfxToolBoxControl::StateChangedAtToolBoxControl( nSID, eState, pState );
99
0
}
100
101
102
} //namespace svx
103
104
105
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */