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 <svx/charmap.hxx>
13 #include <svx/numvset.hxx>
14 #include <vcl/window.hxx>
16 SvxShowCharSetUIObject::SvxShowCharSetUIObject(const VclPtr
<vcl::Window
>& rCharSetWin
)
17 : DrawingAreaUIObject(rCharSetWin
)
18 , mpCharSet(static_cast<SvxShowCharSet
*>(mpController
))
22 void SvxShowCharSetUIObject::execute(const OUString
& rAction
,
23 const StringMap
& rParameters
)
25 if (rAction
== "SELECT")
27 if (rParameters
.find("INDEX") != rParameters
.end())
29 OUString aIndexStr
= rParameters
.find("INDEX")->second
;
31 sal_Int32 nIndex
= aIndexStr
.toInt32();
32 mpCharSet
->OutputIndex(nIndex
);
34 else if (rParameters
.find("COLUMN") != rParameters
.end() &&
35 rParameters
.find("ROW") != rParameters
.end())
37 OUString aColStr
= rParameters
.find("COLUMN")->second
;
38 OUString aRowStr
= rParameters
.find("ROW")->second
;
40 sal_Int32 nColumn
= aColStr
.toInt32();
41 sal_Int32 nRow
= aRowStr
.toInt32();
43 sal_Int32 nIndex
= nColumn
* COLUMN_COUNT
+ nRow
;
44 mpCharSet
->OutputIndex(nIndex
);
48 WindowUIObject::execute(rAction
, rParameters
);
51 std::unique_ptr
<UIObject
> SvxShowCharSetUIObject::create(vcl::Window
* pWindow
)
53 return std::unique_ptr
<UIObject
>(new SvxShowCharSetUIObject(pWindow
));
56 OUString
SvxShowCharSetUIObject::get_name() const
58 return "SvxShowCharSetUIObject";
62 SvxNumValueSetUIObject::SvxNumValueSetUIObject(vcl::Window
* pNumValueSetWin
)
63 : DrawingAreaUIObject(pNumValueSetWin
)
64 , mpNumValueSet(static_cast<SvxNumValueSet
*>(mpController
))
68 void SvxNumValueSetUIObject::execute(const OUString
& rAction
,
69 const StringMap
& rParameters
)
71 if (rAction
== "CHOOSE")
73 if (rParameters
.find("POS") != rParameters
.end())
75 OUString aIndexStr
= rParameters
.find("POS")->second
;
76 sal_Int32 nIndex
= aIndexStr
.toInt32();
77 mpNumValueSet
->SelectItem(nIndex
);
78 mpNumValueSet
->Select();
82 DrawingAreaUIObject::execute(rAction
, rParameters
);
85 std::unique_ptr
<UIObject
> SvxNumValueSetUIObject::create(vcl::Window
* pWindow
)
87 return std::unique_ptr
<UIObject
>(new SvxNumValueSetUIObject(pWindow
));
90 OUString
SvxNumValueSetUIObject::get_name() const
92 return "SvxNumValueSetUIObject";
95 StringMap
SvxNumValueSetUIObject::get_state()
97 StringMap aMap
= WindowUIObject::get_state();
98 aMap
["SelectedItemId"] = OUString::number( mpNumValueSet
->GetSelectedItemId() );
99 aMap
["SelectedItemPos"] = OUString::number( mpNumValueSet
->GetSelectItemPos() );
100 aMap
["ItemsCount"] = OUString::number(mpNumValueSet
->GetItemCount());
101 aMap
["ItemText"] = mpNumValueSet
->GetItemText(mpNumValueSet
->GetSelectedItemId());
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */