/src/libreoffice/vcl/source/uitest/toolboxitemuiobject.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ |
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 | | |
10 | | #include <uitest/toolboxitemuiobject.hxx> |
11 | | |
12 | | ToolBoxItemUIObject::ToolBoxItemUIObject(const VclPtr<ToolBox>& pToolBox, ToolBoxItemId nId) |
13 | 0 | : m_pToolBox(pToolBox) |
14 | 0 | , m_nId(nId) |
15 | 0 | { |
16 | 0 | } |
17 | | |
18 | 0 | ToolBoxItemUIObject::~ToolBoxItemUIObject() {} |
19 | | |
20 | | StringMap ToolBoxItemUIObject::get_state() |
21 | 0 | { |
22 | 0 | const tools::Rectangle aRect = m_pToolBox->GetItemRect(m_nId); |
23 | 0 | StringMap aMap{ |
24 | 0 | { u"Enabled"_ustr, OUString::boolean(m_pToolBox->IsItemEnabled(m_nId)) }, |
25 | 0 | { u"Text"_ustr, m_pToolBox->GetItemText(m_nId) }, |
26 | 0 | { u"X"_ustr, OUString::number(aRect.getX()) }, |
27 | 0 | { u"Y"_ustr, OUString::number(aRect.getY()) }, |
28 | 0 | { u"Width"_ustr, OUString::number(aRect.GetWidth()) }, |
29 | 0 | { u"Height"_ustr, OUString::number(aRect.GetHeight()) }, |
30 | 0 | }; |
31 | |
|
32 | 0 | return aMap; |
33 | 0 | } |
34 | | |
35 | | bool ToolBoxItemUIObject::equals(const UIObject& rOther) const |
36 | 0 | { |
37 | 0 | const ToolBoxItemUIObject* pOther = dynamic_cast<const ToolBoxItemUIObject*>(&rOther); |
38 | 0 | if (!pOther) |
39 | 0 | return false; |
40 | | |
41 | 0 | return m_pToolBox == pOther->m_pToolBox && m_nId == pOther->m_nId; |
42 | 0 | } |
43 | | |
44 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |