1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #include <uiobject.hxx>
12 #include <svtools/valueset.hxx>
13 #include <vcl/window.hxx>
15 ValueSetUIObject::ValueSetUIObject(const VclPtr
<vcl::Window
>& rSetWin
)
16 : DrawingAreaUIObject(rSetWin
)
17 , mpSet(static_cast<ValueSet
*>(mpController
))
21 void ValueSetUIObject::execute(const OUString
& rAction
, const StringMap
& rParameters
)
23 if (rAction
== "CHOOSE")
25 if (rParameters
.find("POS") != rParameters
.end())
27 OUString aIndexStr
= rParameters
.find("POS")->second
;
29 sal_Int32 nIndex
= aIndexStr
.toInt32();
30 mpSet
->SelectItem(nIndex
);
35 DrawingAreaUIObject::execute(rAction
, rParameters
);
38 std::unique_ptr
<UIObject
> ValueSetUIObject::create(vcl::Window
* pWindow
)
40 return std::unique_ptr
<UIObject
>(new ValueSetUIObject(pWindow
));
43 OUString
ValueSetUIObject::get_name() const { return "ValueSetUIObject"; }
45 StringMap
ValueSetUIObject::get_state()
47 StringMap aMap
= DrawingAreaUIObject::get_state();
48 aMap
["SelectedItemId"] = OUString::number(mpSet
->GetSelectedItemId());
49 aMap
["SelectedItemPos"] = OUString::number(mpSet
->GetSelectItemPos());
50 aMap
["ItemsCount"] = OUString::number(mpSet
->GetItemCount());
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */