/src/libreoffice/svx/source/uitest/sdrobject.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 | | |
10 | | #include <svx/uiobject.hxx> |
11 | | #include <svx/svdobj.hxx> |
12 | | #include <svx/SvxColorValueSet.hxx> |
13 | | #include <tools/fract.hxx> |
14 | | #include <vcl/window.hxx> |
15 | | #include <memory> |
16 | | |
17 | | SvxColorValueSetUIObject::SvxColorValueSetUIObject(vcl::Window* pColorSetWin) |
18 | 0 | : DrawingAreaUIObject(pColorSetWin) |
19 | 0 | , mpColorSet(static_cast<SvxColorValueSet*>(mpController)) |
20 | 0 | { |
21 | 0 | } |
22 | | |
23 | | void SvxColorValueSetUIObject::execute(const OUString& rAction, const StringMap& rParameters) |
24 | 0 | { |
25 | 0 | if (rAction == "CHOOSE") |
26 | 0 | { |
27 | 0 | if (rParameters.find(u"POS"_ustr) != rParameters.end()) |
28 | 0 | { |
29 | 0 | OUString aIndexStr = rParameters.find(u"POS"_ustr)->second; |
30 | 0 | sal_Int32 nIndex = aIndexStr.toInt32(); |
31 | 0 | mpColorSet->SelectItem(nIndex); |
32 | 0 | mpColorSet->Select(); |
33 | 0 | } |
34 | 0 | } |
35 | 0 | else |
36 | 0 | DrawingAreaUIObject::execute(rAction, rParameters); |
37 | 0 | } |
38 | | |
39 | | std::unique_ptr<UIObject> SvxColorValueSetUIObject::create(vcl::Window* pWindow) |
40 | 0 | { |
41 | 0 | return std::unique_ptr<UIObject>(new SvxColorValueSetUIObject(pWindow)); |
42 | 0 | } |
43 | | |
44 | 0 | OUString SvxColorValueSetUIObject::get_name() const { return u"SvxColorValueSetUIObject"_ustr; } |
45 | | |
46 | | StringMap SvxColorValueSetUIObject::get_state() |
47 | 0 | { |
48 | 0 | StringMap aMap = DrawingAreaUIObject::get_state(); |
49 | 0 | aMap[u"CurrColorId"_ustr] = OUString::number(mpColorSet->GetSelectedItemId()); |
50 | 0 | aMap[u"CurrColorPos"_ustr] = OUString::number(mpColorSet->GetSelectItemPos()); |
51 | 0 | aMap[u"ColorsCount"_ustr] = OUString::number(mpColorSet->GetItemCount()); |
52 | 0 | aMap[u"ColCount"_ustr] = OUString::number(mpColorSet->GetColCount()); |
53 | 0 | aMap[u"ColorText"_ustr] = mpColorSet->GetItemText(mpColorSet->GetSelectedItemId()); |
54 | 0 | Color currColor = mpColorSet->GetItemColor(mpColorSet->GetSelectedItemId()); |
55 | 0 | aMap[u"R"_ustr] = OUString::number(currColor.GetRed()); |
56 | 0 | aMap[u"G"_ustr] = OUString::number(currColor.GetGreen()); |
57 | 0 | aMap[u"B"_ustr] = OUString::number(currColor.GetBlue()); |
58 | 0 | aMap[u"RGB"_ustr] = "(" + OUString::number(currColor.GetRed()) + "," |
59 | 0 | + OUString::number(currColor.GetGreen()) + "," |
60 | 0 | + OUString::number(currColor.GetBlue()) + ")"; |
61 | 0 | return aMap; |
62 | 0 | } |
63 | | |
64 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |