nss: upgrade to release 3.73
[LibreOffice.git] / svtools / source / uitest / uiobject.cxx
blob0b3d78daf7b03316795b8c970906237e46e3ebc7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <memory>
11 #include <uiobject.hxx>
12 #include <svtools/valueset.hxx>
14 ValueSetUIObject::ValueSetUIObject(const VclPtr<vcl::Window>& rSetWin)
15 : DrawingAreaUIObject(rSetWin)
16 , mpSet(static_cast<ValueSet*>(mpController))
20 void ValueSetUIObject::execute(const OUString& rAction, const StringMap& rParameters)
22 if (rAction == "CHOOSE")
24 if (rParameters.find("POS") != rParameters.end())
26 OUString aIndexStr = rParameters.find("POS")->second;
28 sal_Int32 nIndex = aIndexStr.toInt32();
29 mpSet->SelectItem(nIndex);
30 mpSet->Select();
33 else
34 DrawingAreaUIObject::execute(rAction, rParameters);
37 std::unique_ptr<UIObject> ValueSetUIObject::create(vcl::Window* pWindow)
39 return std::unique_ptr<UIObject>(new ValueSetUIObject(pWindow));
42 OUString ValueSetUIObject::get_name() const { return "ValueSetUIObject"; }
44 StringMap ValueSetUIObject::get_state()
46 StringMap aMap = DrawingAreaUIObject::get_state();
47 aMap["SelectedItemId"] = OUString::number(mpSet->GetSelectedItemId());
48 aMap["SelectedItemPos"] = OUString::number(mpSet->GetSelectItemPos());
49 aMap["ItemsCount"] = OUString::number(mpSet->GetItemCount());
50 return aMap;
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */