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 
14 #include <svx/numvset.hxx>
15 
17  : DrawingAreaUIObject(rCharSetWin)
18  , mpCharSet(static_cast<SvxShowCharSet*>(mpController))
19 {
20 }
21 
22 void 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();
32  mpCharSet->OutputIndex(nIndex);
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;
44  mpCharSet->OutputIndex(nIndex);
45  }
46  }
47  else
48  WindowUIObject::execute(rAction, rParameters);
49 }
50 
51 std::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 
68 void 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();
77  mpNumValueSet->SelectItem(nIndex);
79  }
80  }
81  else
82  DrawingAreaUIObject::execute(rAction, rParameters);
83 }
84 
85 std::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: */
sal_Int32 nIndex
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Definition: uiobject.cxx:68
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
Definition: uiobject.cxx:51
SvxNumValueSet * mpNumValueSet
SvxTableController * mpController
SvxNumValueSetUIObject(vcl::Window *pNumValueSetWin)
Definition: uiobject.cxx:62
sal_uInt16 GetSelectedItemId() const
SvxShowCharSetUIObject(const VclPtr< vcl::Window > &rCharSetWin)
Definition: uiobject.cxx:16
OUString get_name() const override
Definition: uiobject.cxx:56
virtual StringMap get_state() override
Definition: uiobject.cxx:95
HashMap_OWString_Interface aMap
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
virtual StringMap get_state() override
SvxShowCharSet * mpCharSet
OUString get_name() const override
Definition: uiobject.cxx:90
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Definition: uiobject.cxx:22
std::map< const OUString, OUString > StringMap
OUString GetItemText(sal_uInt16 nItemId) const
size_t GetSelectItemPos() const
void SelectItem(sal_uInt16 nItemId)
size_t GetItemCount() const
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
Definition: uiobject.cxx:85
#define COLUMN_COUNT
Definition: charmap.hxx:46
virtual void Select()
void OutputIndex(int index)
Definition: charmap.cxx:754