LibreOffice Module svx (master) 1
uiobject.cxx
Go to the documentation of this file.
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 <memory>
11#include <uiobject.hxx>
12#include <svx/charmap.hxx>
13#include <svx/numvset.hxx>
14#include <vcl/window.hxx>
15
17 : DrawingAreaUIObject(rCharSetWin)
18 , mpCharSet(static_cast<SvxShowCharSet*>(mpController))
19{
20}
21
22void SvxShowCharSetUIObject::execute(const OUString& rAction,
23 const StringMap& rParameters)
24{
25 if (rAction == "SELECT")
26 {
27 if (rParameters.find("INDEX") != rParameters.end())
28 {
29 OUString aIndexStr = rParameters.find("INDEX")->second;
30
31 sal_Int32 nIndex = aIndexStr.toInt32();
33 }
34 else if (rParameters.find("COLUMN") != rParameters.end() &&
35 rParameters.find("ROW") != rParameters.end())
36 {
37 OUString aColStr = rParameters.find("COLUMN")->second;
38 OUString aRowStr = rParameters.find("ROW")->second;
39
40 sal_Int32 nColumn = aColStr.toInt32();
41 sal_Int32 nRow = aRowStr.toInt32();
42
43 sal_Int32 nIndex = nColumn * COLUMN_COUNT + nRow;
45 }
46 }
47 else
48 WindowUIObject::execute(rAction, rParameters);
49}
50
51std::unique_ptr<UIObject> SvxShowCharSetUIObject::create(vcl::Window* pWindow)
52{
53 return std::unique_ptr<UIObject>(new SvxShowCharSetUIObject(pWindow));
54}
55
57{
58 return "SvxShowCharSetUIObject";
59}
60
61
63 : DrawingAreaUIObject(pNumValueSetWin)
64 , mpNumValueSet(static_cast<SvxNumValueSet*>(mpController))
65{
66}
67
68void SvxNumValueSetUIObject::execute(const OUString& rAction,
69 const StringMap& rParameters)
70{
71 if (rAction == "CHOOSE")
72 {
73 if (rParameters.find("POS") != rParameters.end())
74 {
75 OUString aIndexStr = rParameters.find("POS")->second;
76 sal_Int32 nIndex = aIndexStr.toInt32();
79 }
80 }
81 else
82 DrawingAreaUIObject::execute(rAction, rParameters);
83}
84
85std::unique_ptr<UIObject> SvxNumValueSetUIObject::create(vcl::Window* pWindow)
86{
87 return std::unique_ptr<UIObject>(new SvxNumValueSetUIObject(pWindow));
88}
89
91{
92 return "SvxNumValueSetUIObject";
93}
94
96{
98 aMap["SelectedItemId"] = OUString::number( mpNumValueSet->GetSelectedItemId() );
99 aMap["SelectedItemPos"] = OUString::number( mpNumValueSet->GetSelectItemPos() );
100 aMap["ItemsCount"] = OUString::number(mpNumValueSet->GetItemCount());
102 return aMap;
103}
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::map< OUString, OUString > StringMap
#define COLUMN_COUNT
Definition: charmap.hxx:46
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Definition: uiobject.cxx:68
virtual StringMap get_state() override
Definition: uiobject.cxx:95
SvxNumValueSet * mpNumValueSet
OUString get_name() const override
Definition: uiobject.cxx:90
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
Definition: uiobject.cxx:85
SvxNumValueSetUIObject(vcl::Window *pNumValueSetWin)
Definition: uiobject.cxx:62
SvxShowCharSetUIObject(const VclPtr< vcl::Window > &rCharSetWin)
Definition: uiobject.cxx:16
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Definition: uiobject.cxx:22
OUString get_name() const override
Definition: uiobject.cxx:56
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
Definition: uiobject.cxx:51
SvxShowCharSet * mpCharSet
void OutputIndex(int index)
Definition: charmap.cxx:792
size_t GetItemCount() const
OUString GetItemText(sal_uInt16 nItemId) const
void SelectItem(sal_uInt16 nItemId)
sal_uInt16 GetSelectedItemId() const
virtual void Select()
size_t GetSelectItemPos() const
virtual StringMap get_state() override
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
sal_Int32 nIndex
HashMap_OWString_Interface aMap
SvxTableController * mpController