LibreOffice Module vcl (master)  1
uitest/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 <vcl/uitest/uiobject.hxx>
13 
14 #include <vcl/svapp.hxx>
15 #include <vcl/toolkit/combobox.hxx>
16 #include <vcl/event.hxx>
17 #include <vcl/floatwin.hxx>
18 #include <vcl/tabpage.hxx>
19 #include <vcl/tabctrl.hxx>
20 #include <vcl/toolkit/lstbox.hxx>
21 #include <vcl/toolkit/spin.hxx>
22 #include <vcl/fmtfield.hxx>
23 #include <vcl/spinfld.hxx>
24 #include <vcl/toolkit/button.hxx>
25 #include <vcl/toolkit/dialog.hxx>
26 #include <vcl/toolkit/field.hxx>
27 #include <vcl/edit.hxx>
28 #include <vcl/vclmedit.hxx>
29 #include <vcl/uitest/logger.hxx>
30 #include <uiobject-internal.hxx>
31 
32 #include <comphelper/string.hxx>
33 #include <comphelper/lok.hxx>
34 
35 #include <rtl/ustrbuf.hxx>
36 #include <sal/log.hxx>
37 
38 #include <iostream>
39 #include <memory>
40 #include <vector>
41 
43 {
44 }
45 
47 {
49  aMap["NotImplemented"] = "NotImplemented";
50  return aMap;
51 }
52 
53 void UIObject::execute(const OUString& /*rAction*/,
54  const StringMap& /*rParameters*/)
55 {
56  // should never be called
57  throw std::exception();
58 }
59 
60 OUString UIObject::get_type() const
61 {
62  return "Generic UIObject";
63 }
64 
65 std::unique_ptr<UIObject> UIObject::get_child(const OUString&)
66 {
67  return std::unique_ptr<UIObject>();
68 }
69 
70 std::set<OUString> UIObject::get_children() const
71 {
72  return std::set<OUString>();
73 }
74 
75 OUString UIObject::dumpState() const
76 {
77  return OUString();
78 }
79 
80 OUString UIObject::dumpHierarchy() const
81 {
82  return OUString();
83 }
84 
85 OUString UIObject::get_action(VclEventId /*nEvent*/) const
86 {
87  return OUString();
88 }
89 
90 namespace {
91 
92 bool isDialogWindow(vcl::Window const * pWindow)
93 {
94  WindowType nType = pWindow->GetType();
95  if (nType == WindowType::DIALOG || nType == WindowType::MODELESSDIALOG)
96  return true;
97 
98  // MESSBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX
99  if (nType >= WindowType::MESSBOX && nType <= WindowType::QUERYBOX)
100  return true;
101 
102  if (nType == WindowType::TABDIALOG)
103  return true;
104 
105  return false;
106 }
107 
108 bool isTopWindow(vcl::Window const * pWindow)
109 {
110  WindowType eType = pWindow->GetType();
111  if (eType == WindowType::FLOATINGWINDOW)
112  {
113  return pWindow->GetStyle() & WB_SYSTEMFLOATWIN;
114  }
115  return false;
116 }
117 
118 vcl::Window* get_top_parent(vcl::Window* pWindow)
119 {
120  if (isDialogWindow(pWindow) || isTopWindow(pWindow))
121  return pWindow;
122 
123  vcl::Window* pParent = pWindow->GetParent();
124  if (!pParent)
125  return pWindow;
126 
127  return get_top_parent(pParent);
128 }
129 
130 std::vector<KeyEvent> generate_key_events_from_text(const OUString& rStr)
131 {
132  std::vector<KeyEvent> aEvents;
133  vcl::KeyCode aCode;
134  for (sal_Int32 i = 0, n = rStr.getLength();
135  i != n; ++i)
136  {
137  aEvents.emplace_back(rStr[i], aCode);
138  }
139  return aEvents;
140 }
141 
142 sal_uInt16 get_key(sal_Unicode cChar, bool& bShift)
143 {
144  bShift = false;
145  if (cChar >= 'a' && cChar <= 'z')
146  return KEY_A + (cChar - 'a');
147  else if (cChar >= 'A' && cChar <= 'Z')
148  {
149  bShift = true;
150  return KEY_A + (cChar - 'A');
151  }
152  else if (cChar >= '0' && cChar <= '9')
153  return KEY_0 + (cChar - 'A');
154 
155  return cChar;
156 }
157 
158 bool isFunctionKey(const OUString& rStr, sal_uInt16& rKeyCode)
159 {
160  std::map<OUString, sal_uInt16> aFunctionKeyMap = {
161  {"F1", KEY_F1},
162  {"F2", KEY_F2},
163  {"F3", KEY_F3},
164  {"F4", KEY_F4},
165  {"F5", KEY_F5},
166  {"F6", KEY_F6},
167  {"F7", KEY_F7},
168  {"F8", KEY_F8},
169  {"F9", KEY_F9},
170  {"F10", KEY_F10},
171  {"F11", KEY_F11},
172  {"F12", KEY_F12}
173  };
174 
175  rKeyCode = 0;
176  auto itr = aFunctionKeyMap.find(rStr);
177  if (itr == aFunctionKeyMap.end())
178  return false;
179 
180  rKeyCode = itr->second;
181  return true;
182 }
183 
184 std::vector<KeyEvent> generate_key_events_from_keycode(const OUString& rStr)
185 {
186  std::vector<KeyEvent> aEvents;
187 
188  std::map<OUString, sal_uInt16> aKeyMap = {
189  {"ESC", KEY_ESCAPE},
190  {"TAB", KEY_TAB},
191  {"DOWN", KEY_DOWN},
192  {"UP", KEY_UP},
193  {"LEFT", KEY_LEFT},
194  {"RIGHT", KEY_RIGHT},
195  {"DELETE", KEY_DELETE},
196  {"INSERT", KEY_INSERT},
197  {"SPACE", KEY_SPACE},
198  {"BACKSPACE", KEY_BACKSPACE},
199  {"RETURN", KEY_RETURN},
200  {"HOME", KEY_HOME},
201  {"END", KEY_END},
202  {"PAGEUP", KEY_PAGEUP},
203  {"PAGEDOWN", KEY_PAGEDOWN}
204  };
205 
206  // split string along '+'
207  // then translate to keycodes
208  bool bShift = false;
209  bool bMod1 = false;
210  bool bMod2 = false;
211  OUString aRemainingText;
212 
213  std::vector<OUString> aTokens = comphelper::string::split(rStr, '+');
214  for (auto const& token : aTokens)
215  {
216  OUString aToken = token.trim();
217  if (aToken == "CTRL")
218  {
219  bMod1 = true;
220  }
221  else if (aToken == "SHIFT")
222  {
223  bShift = true;
224  }
225  else if (aToken == "ALT")
226  {
227  bMod2 = true;
228  }
229  else
230  aRemainingText = aToken;
231  }
232 
233  sal_uInt16 nFunctionKey = 0;
234  if (isFunctionKey(aRemainingText, nFunctionKey))
235  {
236  vcl::KeyCode aCode(nFunctionKey, bShift, bMod1, bMod2, false);
237  aEvents.emplace_back(0, aCode);
238  }
239  else if (aKeyMap.find(aRemainingText) != aKeyMap.end())
240  {
241  sal_uInt16 nKey = aKeyMap[aRemainingText];
242  vcl::KeyCode aCode(nKey, bShift, bMod1, bMod2, false);
243  aEvents.emplace_back( 'a', aCode);
244  }
245  else
246  {
247  for (sal_Int32 i = 0; i < aRemainingText.getLength(); ++i)
248  {
249  bool bShiftThroughKey = false;
250  sal_uInt16 nKey = get_key(aRemainingText[i], bShiftThroughKey);
251  vcl::KeyCode aCode(nKey, bShift || bShiftThroughKey, bMod1, bMod2, false);
252  aEvents.emplace_back(aRemainingText[i], aCode);
253  }
254  }
255 
256  return aEvents;
257 }
258 
259 OUString to_string(const Point& rPos)
260 {
261  OUString sStr = OUString::number(rPos.X())
262  + "x"
263  + OUString::number(rPos.Y());
264 
265  return sStr;
266 }
267 
268 OUString to_string(const Size& rSize)
269 {
270  OUString sStr = OUString::number(rSize.Width())
271  + "x"
272  + OUString::number(rSize.Height());
273 
274  return sStr;
275 }
276 
277 }
278 
280  mxWindow(xWindow)
281 {
282 }
283 
285 {
286  // Double-buffering is not interesting for uitesting, but can result in direct paint for a
287  // double-buffered widget, which is incorrect.
290 
291  StringMap aMap;
292  aMap["Visible"] = OUString::boolean(mxWindow->IsVisible());
293  aMap["ReallyVisible"] = OUString::boolean(mxWindow->IsReallyVisible());
294  aMap["Enabled"] = OUString::boolean(mxWindow->IsEnabled());
295  aMap["WindowType"] = OUString::number(static_cast<sal_uInt16>(mxWindow->GetType()), 16);
296 
297  Point aPos = mxWindow->GetPosPixel();
298  aMap["RelPosition"] = to_string(aPos);
299  aMap["Size"] = to_string(mxWindow->GetSizePixel());
300  aMap["ID"] = mxWindow->get_id();
301  vcl::Window* pParent = mxWindow->GetParent();
302  if (pParent)
303  aMap["Parent"] = mxWindow->GetParent()->get_id();
304 
305  bool bIgnoreAllExceptTop = isDialogWindow(mxWindow.get());
306  while(pParent)
307  {
308  Point aParentPos = pParent->GetPosPixel();
309  if (!bIgnoreAllExceptTop)
310  aPos += aParentPos;
311 
312  if (isDialogWindow(pParent))
313  {
314  bIgnoreAllExceptTop = true;
315  }
316 
317  pParent = pParent->GetParent();
318 
319  if (!pParent && bIgnoreAllExceptTop)
320  aPos += aParentPos;
321  }
322  aMap["AbsPosition"] = to_string(aPos);
323  aMap["Text"] = mxWindow->GetText();
324  aMap["DisplayText"] = mxWindow->GetDisplayText();
325 
326  return aMap;
327 }
328 
329 void WindowUIObject::execute(const OUString& rAction,
330  const StringMap& rParameters)
331 {
332  bool bHandled = true;
333  if (rAction == "SET")
334  {
335  for (auto const& parameter : rParameters)
336  {
337  std::cout << parameter.first;
338  }
339  }
340  else if (rAction == "TYPE")
341  {
342  auto it = rParameters.find("TEXT");
343  if (it != rParameters.end())
344  {
345  const OUString& rText = it->second;
346  auto aKeyEvents = generate_key_events_from_text(rText);
347  for (auto const& keyEvent : aKeyEvents)
348  {
349  mxWindow->KeyInput(keyEvent);
350  }
351  }
352  else if (rParameters.find("KEYCODE") != rParameters.end())
353  {
354  auto itr = rParameters.find("KEYCODE");
355  const OUString rText = itr->second;
356  auto aKeyEvents = generate_key_events_from_keycode(rText);
357  for (auto const& keyEvent : aKeyEvents)
358  {
359  mxWindow->KeyInput(keyEvent);
360  }
361  }
362  else
363  {
364  SAL_WARN("vcl.uitest", "missing parameter TEXT to action TYPE");
365  return;
366  }
367  }
368  else if (rAction == "FOCUS")
369  {
370  mxWindow->GrabFocus();
371  }
372  else
373  {
374  bHandled = false;
375  }
376 
377  if (!bHandled)
378  {
379  SAL_WARN("vcl.uitest", "unknown action or parameter for " << get_name() << ". Action: " << rAction);
380  }
381 }
382 
383 OUString WindowUIObject::get_type() const
384 {
385  return get_name();
386 }
387 
388 namespace {
389 
390 vcl::Window* findChild(vcl::Window* pParent, const OUString& rID)
391 {
392  if (!pParent)
393  return nullptr;
394 
395  if (pParent->get_id() == rID)
396  return pParent;
397 
398  size_t nCount = pParent->GetChildCount();
399  for (size_t i = 0; i < nCount; ++i)
400  {
401  vcl::Window* pChild = pParent->GetChild(i);
402  if (pChild && pChild->get_id() == rID)
403  return pChild;
404 
405  vcl::Window* pResult = findChild(pChild, rID);
406  if (pResult)
407  return pResult;
408  }
409 
410  return nullptr;
411 }
412 
413 void addChildren(vcl::Window const * pParent, std::set<OUString>& rChildren)
414 {
415  if (!pParent)
416  return;
417 
418  size_t nCount = pParent->GetChildCount();
419  for (size_t i = 0; i < nCount; ++i)
420  {
421  vcl::Window* pChild = pParent->GetChild(i);
422  if (pChild)
423  {
424  OUString aId = pChild->get_id();
425  if (!aId.isEmpty())
426  {
427  auto ret = rChildren.insert(aId);
428  SAL_WARN_IF(!ret.second, "vcl.uitest", "duplicate ids for ui elements. violates locally unique requirement");
429  }
430 
431  addChildren(pChild, rChildren);
432  }
433  }
434 }
435 
436 }
437 
438 std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID)
439 {
440  // in a first step try the real children before moving to the top level parent
441  // This makes it easier to handle cases with the same ID as there is a way
442  // to resolve conflicts
443  vcl::Window* pWindow = findChild(mxWindow.get(), rID);
444  if (!pWindow)
445  {
446  vcl::Window* pDialogParent = get_top_parent(mxWindow.get());
447  pWindow = findChild(pDialogParent, rID);
448  }
449 
450  if (!pWindow)
451  throw css::uno::RuntimeException("Could not find child with id: " + rID);
452 
453  FactoryFunction aFunction = pWindow->GetUITestFactory();
454  return aFunction(pWindow);
455 }
456 
457 std::set<OUString> WindowUIObject::get_children() const
458 {
459  vcl::Window* pDialogParent = get_top_parent(mxWindow.get());
460  std::set<OUString> aChildren;
461  aChildren.insert(pDialogParent->get_id());
462  addChildren(pDialogParent, aChildren);
463  return aChildren;
464 }
465 
466 OUString WindowUIObject::get_name() const
467 {
468  return "WindowUIObject";
469 }
470 
471 namespace {
472 
473 OUString escape(const OUString& rStr)
474 {
475  return rStr.replaceAll("\"", "\\\"");
476 }
477 
478 }
479 
481 {
482  OUStringBuffer aStateString = "{\"name\":\"" + mxWindow->get_id() + "\"";
483  aStateString.append(", \"ImplementationName\":\"").appendAscii(typeid(*mxWindow).name()).append("\"");
484  StringMap aState = const_cast<WindowUIObject*>(this)->get_state();
485  for (auto const& elem : aState)
486  {
487  OUString property = ",\"" + elem.first + "\":\"" + escape(elem.second) + "\"";
488  aStateString.append(property);
489  }
490 
491  size_t nCount = mxWindow->GetChildCount();
492 
493  if (nCount)
494  aStateString.append(",\"children\":[");
495 
496  for (size_t i = 0; i < nCount; ++i)
497  {
498  if (i != 0)
499  {
500  aStateString.append(",");
501  }
502  vcl::Window* pChild = mxWindow->GetChild(i);
503  std::unique_ptr<UIObject> pChildWrapper =
504  pChild->GetUITestFactory()(pChild);
505  OUString children = pChildWrapper->dumpState();
506  aStateString.append(children);
507  }
508 
509  if (nCount)
510  aStateString.append("]");
511 
512  aStateString.append("}");
513 
514  OUString aString = aStateString.makeStringAndClear();
515  return aString.replaceAll("\n", "\\n");
516 }
517 
519 {
520  vcl::Window* pDialogParent = get_top_parent(mxWindow.get());
521  std::unique_ptr<UIObject> pParentWrapper =
522  pDialogParent->GetUITestFactory()(pDialogParent);
523  return pParentWrapper->dumpState();
524 }
525 
527 {
528 
529  OUString aActionName;
530  switch (nEvent)
531  {
534  return OUString();
535 
538  aActionName = "CLICK";
539  break;
540 
542  aActionName = "TYPE";
543  break;
544  default:
545  aActionName = OUString::number(static_cast<int>(nEvent));
546  }
547  return "";
548  //return "Action on element: " + mxWindow->get_id() + " with action : " + aActionName;
549 }
550 
551 std::unique_ptr<UIObject> WindowUIObject::create(vcl::Window* pWindow)
552 {
553  return std::unique_ptr<UIObject>(new WindowUIObject(pWindow));
554 }
555 
557  WindowUIObject(xButton),
558  mxButton(xButton)
559 {
560 }
561 
563 {
564 }
565 
567 {
569  // Move that to a Control base class
570  aMap["Label"] = mxButton->GetDisplayText();
571 
572  return aMap;
573 }
574 
575 void ButtonUIObject::execute(const OUString& rAction,
576  const StringMap& rParameters)
577 {
578  if (rAction == "CLICK")
579  {
580  //Click doesn't call toggle when it's a pushbutton tweaked to be a toggle-button
581  if (PushButton *pPushButton = (mxButton->GetStyle() & WB_TOGGLE) ? dynamic_cast<PushButton*>(mxButton.get()) : nullptr)
582  {
583  pPushButton->Check(!pPushButton->IsChecked());
584  pPushButton->Toggle();
585  return;
586  }
587  mxButton->Click();
588  }
589  else
590  WindowUIObject::execute(rAction, rParameters);
591 }
592 
593 OUString ButtonUIObject::get_name() const
594 {
595  return "ButtonUIObject";
596 }
597 
599 {
600  if (nEvent == VclEventId::ButtonClick)
601  {
602  if(mxButton->get_id()=="writer_all")
603  {
605  return "Start writer" ;
606  }
607  else if(mxButton->get_id()=="calc_all")
608  {
610  return "Start calc" ;
611  }
612  else if(mxButton->get_id()=="impress_all")
613  {
615  return "Start impress" ;
616  }
617  else if(mxButton->get_id()=="draw_all")
618  {
620  return "Start draw" ;
621  }
622  else if(mxButton->get_id()=="math_all")
623  {
625  return "Start math" ;
626  }
627  else if(mxButton->get_id()=="database_all")
628  {
630  return "Start database" ;
631  }
632  else{
633  if (get_top_parent(mxButton)->get_id().isEmpty()){
634  //This part because if we don't have parent
635  return "Click on '" + mxButton->get_id() ;
636  }
637  return "Click on '" + mxButton->get_id() + "' from "+
638  get_top_parent(mxButton)->get_id();
639  }
640  }
641  else
642  return WindowUIObject::get_action(nEvent);
643 }
644 
645 std::unique_ptr<UIObject> ButtonUIObject::create(vcl::Window* pWindow)
646 {
647  Button* pButton = dynamic_cast<Button*>(pWindow);
648  assert(pButton);
649  return std::unique_ptr<UIObject>(new ButtonUIObject(pButton));
650 }
651 
653  WindowUIObject(xDialog),
654  mxDialog(xDialog)
655 {
656 }
657 
659 {
660 }
661 
663 {
665  aMap["Modal"] = OUString::boolean(mxDialog->IsModalInputMode());
666 
667  return aMap;
668 }
669 
670 OUString DialogUIObject::get_name() const
671 {
672  return "DialogUIObject";
673 }
674 
675 std::unique_ptr<UIObject> DialogUIObject::create(vcl::Window* pWindow)
676 {
677  Dialog* pDialog = dynamic_cast<Dialog*>(pWindow);
678  assert(pDialog);
679  return std::unique_ptr<UIObject>(new DialogUIObject(pDialog));
680 }
681 
683  WindowUIObject(xEdit),
684  mxEdit(xEdit)
685 {
686 }
687 
689 {
690 }
691 
692 void EditUIObject::execute(const OUString& rAction,
693  const StringMap& rParameters)
694 {
695  bool bHandled = true;
696  if (rAction == "SET")
697  {
698  if (rParameters.find("TEXT") != rParameters.end())
699  {
700  auto it = rParameters.find("TEXT");
701  if (it == rParameters.end())
702  {
703  SAL_WARN("vcl.uitest", "missing parameter TEXT to action SET");
704  return;
705  }
706 
707  const OUString& rText = it->second;
708  auto aKeyEvents = generate_key_events_from_text(rText);
709  for (auto const& keyEvent : aKeyEvents)
710  {
711  mxEdit->KeyInput(keyEvent);
712  }
713  }
714  else
715  {
716  bHandled = false;
717  }
718  }
719  else if (rAction == "SELECT")
720  {
721  if (rParameters.find("FROM") != rParameters.end() &&
722  rParameters.find("TO") != rParameters.end())
723  {
724  long nMin = rParameters.find("FROM")->second.toInt32();
725  long nMax = rParameters.find("TO")->second.toInt32();
726  Selection aSelection(nMin, nMax);
727  mxEdit->SetSelection(aSelection);
728  }
729  }
730  else if (rAction == "CLEAR")
731  {
732  mxEdit->SetText("");
733  mxEdit->Modify();
734  bHandled = true;
735  }
736  else
737  {
738  bHandled = false;
739  }
740 
741  if (!bHandled)
742  WindowUIObject::execute(rAction, rParameters);
743 }
744 
746 {
748  aMap["MaxTextLength"] = OUString::number(mxEdit->GetMaxTextLen());
749  aMap["SelectedText"] = mxEdit->GetSelected();
750  aMap["Text"] = mxEdit->GetText();
751 
752  return aMap;
753 }
754 
755 OUString EditUIObject::get_action(VclEventId nEvent) const
756 {
757  if (nEvent == VclEventId::EditSelectionChanged)
758  {
759  const Selection& rSelection = mxEdit->GetSelection();
760  long nMin = rSelection.Min();
761  long nMax = rSelection.Max();
762  if(get_top_parent(mxEdit)->get_id().isEmpty()){
763  //This part because if we don't have parent
764  return "Select in '" +
765  mxEdit->get_id() +
766  "' {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
767  OUString::number(nMax) + "\"}"
768  ;
769  }
770  return "Select in '" +
771  mxEdit->get_id() +
772  "' {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
773  OUString::number(nMax) + "\"} from "
774  + get_top_parent(mxEdit)->get_id()
775  ;
776  }
777  else
778  return WindowUIObject::get_action(nEvent);
779 }
780 
781 OUString EditUIObject::get_name() const
782 {
783  return "EditUIObject";
784 }
785 
786 std::unique_ptr<UIObject> EditUIObject::create(vcl::Window* pWindow)
787 {
788  Edit* pEdit = dynamic_cast<Edit*>(pWindow);
789  assert(pEdit);
790  return std::unique_ptr<UIObject>(new EditUIObject(pEdit));
791 }
792 
794  WindowUIObject(xEdit),
795  mxEdit(xEdit)
796 {
797 }
798 
800 {
801 }
802 
803 void MultiLineEditUIObject::execute(const OUString& rAction,
804  const StringMap& rParameters)
805 {
806  bool bHandled = true;
807  if (rAction == "TYPE")
808  {
809  WindowUIObject aChildObj(mxEdit->GetTextWindow());
810  aChildObj.execute(rAction, rParameters);
811  }
812  else if (rAction == "SELECT")
813  {
814  if (rParameters.find("FROM") != rParameters.end() &&
815  rParameters.find("TO") != rParameters.end())
816  {
817  long nMin = rParameters.find("FROM")->second.toInt32();
818  long nMax = rParameters.find("TO")->second.toInt32();
819  Selection aSelection(nMin, nMax);
820  mxEdit->SetSelection(aSelection);
821  }
822  }
823  else
824  {
825  bHandled = false;
826  }
827 
828  if (!bHandled)
829  WindowUIObject::execute(rAction, rParameters);
830 }
831 
833 {
835  aMap["MaxTextLength"] = OUString::number(mxEdit->GetMaxTextLen());
836  aMap["SelectedText"] = mxEdit->GetSelected();
837  aMap["Text"] = mxEdit->GetText();
838 
839  return aMap;
840 }
841 
843 {
844  return "MultiLineEditUIObject";
845 }
846 
847 std::unique_ptr<UIObject> MultiLineEditUIObject::create(vcl::Window* pWindow)
848 {
849  VclMultiLineEdit* pEdit = dynamic_cast<VclMultiLineEdit*>(pWindow);
850  assert(pEdit);
851  return std::unique_ptr<UIObject>(new MultiLineEditUIObject(pEdit));
852 }
853 
855  WindowUIObject(xCheckbox),
856  mxCheckBox(xCheckbox)
857 {
858 }
859 
861 {
862 }
863 
864 void CheckBoxUIObject::execute(const OUString& rAction,
865  const StringMap& /*rParameters*/)
866 {
867  if (rAction == "CLICK")
868  {
869  // don't use toggle directly, it does not set the value
871  }
872 }
873 
875 {
877  aMap["Selected"] = OUString::boolean(mxCheckBox->IsChecked());
878  aMap["TriStateEnabled"] = OUString::boolean(mxCheckBox->IsTriStateEnabled());
879  return aMap;
880 }
881 
883 {
884  return "CheckBoxUIObject";
885 }
886 
888 {
889  if (nEvent == VclEventId::CheckboxToggle)
890  {
891  if(get_top_parent(mxCheckBox)->get_id().isEmpty()){
892  //This part because if we don't have parent
893  return "Toggle '" + mxCheckBox->get_id() + "' CheckBox";
894  }
895  return "Toggle '" + mxCheckBox->get_id() + "' CheckBox from " +
896  get_top_parent(mxCheckBox)->get_id();
897  }
898  else
899  return WindowUIObject::get_action(nEvent);
900 }
901 
902 std::unique_ptr<UIObject> CheckBoxUIObject::create(vcl::Window* pWindow)
903 {
904  CheckBox* pCheckBox = dynamic_cast<CheckBox*>(pWindow);
905  assert(pCheckBox);
906  return std::unique_ptr<UIObject>(new CheckBoxUIObject(pCheckBox));
907 }
908 
910  WindowUIObject(xRadioButton),
911  mxRadioButton(xRadioButton)
912 {
913 }
914 
916 {
917 }
918 
919 void RadioButtonUIObject::execute(const OUString& rAction,
920  const StringMap& /*rParameters*/)
921 {
922  if (rAction == "CLICK")
923  {
925  }
926 }
927 
929 {
931  aMap["Checked"] = OUString::boolean(mxRadioButton->IsChecked());
932 
933  return aMap;
934 }
935 
937 {
938  return "RadioButtonUIObject";
939 }
940 
942 {
943  if (nEvent == VclEventId::RadiobuttonToggle)
944  {
945  if(get_top_parent(mxRadioButton)->get_id().isEmpty()){
946  //This part because if we don't have parent
947  return "Select '" + mxRadioButton->get_id() + "' RadioButton";
948  }
949  return "Select '" + mxRadioButton->get_id() + "' RadioButton from " +
950  get_top_parent(mxRadioButton)->get_id();
951  }
952  else
953  return WindowUIObject::get_action(nEvent);
954 }
955 
956 std::unique_ptr<UIObject> RadioButtonUIObject::create(vcl::Window* pWindow)
957 {
958  RadioButton* pRadioButton = dynamic_cast<RadioButton*>(pWindow);
959  assert(pRadioButton);
960  return std::unique_ptr<UIObject>(new RadioButtonUIObject(pRadioButton));
961 }
962 
964  WindowUIObject(xTabPage),
965  mxTabPage(xTabPage)
966 {
967 }
968 
970 {
971 }
972 
973 void TabPageUIObject::execute(const OUString& rAction,
974  const StringMap& /*rParameters*/)
975 {
976  if (rAction == "SELECT")
977  {
978  /* code */
979  }
980 }
981 
983 {
985 
986  return aMap;
987 }
988 
990 {
991  return "TabPageUIObject";
992 }
993 
995  WindowUIObject(xListBox),
996  mxListBox(xListBox)
997 {
998 }
999 
1001 {
1002 }
1003 
1004 void ListBoxUIObject::execute(const OUString& rAction,
1005  const StringMap& rParameters)
1006 {
1007  if (!mxListBox->IsEnabled())
1008  return;
1009 
1010  bool isTiledRendering = comphelper::LibreOfficeKit::isActive();
1011  if (!isTiledRendering && !mxListBox->IsReallyVisible())
1012  return;
1013 
1014  if (rAction == "SELECT")
1015  {
1016  bool bSelect = true;
1017  if (rParameters.find("POS") != rParameters.end())
1018  {
1019  auto itr = rParameters.find("POS");
1020  OUString aVal = itr->second;
1021  sal_Int32 nPos = aVal.toInt32();
1022  mxListBox->SelectEntryPos(nPos, bSelect);
1023  }
1024  else if (rParameters.find("TEXT") != rParameters.end())
1025  {
1026  auto itr = rParameters.find("TEXT");
1027  OUString aText = itr->second;
1028  mxListBox->SelectEntry(aText, bSelect);
1029  }
1030  mxListBox->Select();
1031  }
1032  else
1033  WindowUIObject::execute(rAction, rParameters);
1034 }
1035 
1037 {
1039  aMap["ReadOnly"] = OUString::boolean(mxListBox->IsReadOnly());
1040  aMap["MultiSelect"] = OUString::boolean(mxListBox->IsMultiSelectionEnabled());
1041  aMap["EntryCount"] = OUString::number(mxListBox->GetEntryCount());
1042  aMap["SelectEntryCount"] = OUString::number(mxListBox->GetSelectedEntryCount());
1043  aMap["SelectEntryPos"] = OUString::number(mxListBox->GetSelectedEntryPos());
1044  aMap["SelectEntryText"] = mxListBox->GetSelectedEntry();
1045 
1046  return aMap;
1047 }
1048 
1050 {
1051  return "ListBoxUIObject";
1052 }
1053 
1055 {
1056  if (nEvent == VclEventId::ListboxSelect)
1057  {
1058  sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
1059  if(get_top_parent(mxListBox)->get_id().isEmpty()){
1060  //This part because if we don't have parent
1061  return "Select element with position " + OUString::number(nPos) +
1062  " in '" + mxListBox->get_id();
1063  }
1064  return "Select element with position " + OUString::number(nPos) +
1065  " in '" + mxListBox->get_id() +"' from" + get_top_parent(mxListBox)->get_id() ;
1066  }
1067  else if (nEvent == VclEventId::ListboxFocus)
1068  {
1069  if(get_top_parent(mxListBox)->get_id().isEmpty())
1070  {
1071  //This part because if we don't have parent
1072  return this->get_type() + " Action:FOCUS Id:" + mxListBox->get_id();
1073  }
1074  return this->get_type() + " Action:FOCUS Id:" + mxListBox->get_id() +
1075  " Parent:" + get_top_parent(mxListBox)->get_id();
1076  }
1077  else
1078  return WindowUIObject::get_action(nEvent);
1079 }
1080 
1081 std::unique_ptr<UIObject> ListBoxUIObject::create(vcl::Window* pWindow)
1082 {
1083  ListBox* pListBox = dynamic_cast<ListBox*>(pWindow);
1084  assert(pListBox);
1085  return std::unique_ptr<UIObject>(new ListBoxUIObject(pListBox));
1086 }
1087 
1089  WindowUIObject(xComboBox),
1090  mxComboBox(xComboBox)
1091 {
1092 }
1093 
1095 {
1096 }
1097 
1098 void ComboBoxUIObject::execute(const OUString& rAction,
1099  const StringMap& rParameters)
1100 {
1101  if (rAction == "SELECT")
1102  {
1103  if (rParameters.find("POS") != rParameters.end())
1104  {
1105  auto itr = rParameters.find("POS");
1106  OUString aVal = itr->second;
1107  sal_Int32 nPos = aVal.toInt32();
1108  mxComboBox->SelectEntryPos(nPos);
1109  }
1110  else if(rParameters.find("TEXT") != rParameters.end()){
1111  auto itr = rParameters.find("TEXT");
1112  OUString aVal = itr->second;
1113  sal_Int32 nPos = mxComboBox->GetEntryPos(aVal);
1114  mxComboBox->SelectEntryPos(nPos);
1115  }
1116  mxComboBox->Select();
1117  }
1118  else if (rAction == "TYPE")
1119  {
1120  if (mxComboBox->GetSubEdit())
1121  {
1122  Edit* pEdit = mxComboBox->GetSubEdit();
1123  std::unique_ptr<UIObject> pObj = EditUIObject::create(pEdit);
1124  pObj->execute(rAction, rParameters);
1125  }
1126  else
1127  WindowUIObject::execute(rAction, rParameters);
1128  }
1129  else
1130  WindowUIObject::execute(rAction, rParameters);
1131 }
1132 
1134 {
1136  return aMap;
1137 }
1138 
1140 {
1141  return "ComboBoxUIObject";
1142 }
1143 
1145 {
1146  if (nEvent == VclEventId::ComboboxSelect)
1147  {
1148  sal_Int32 nPos = mxComboBox->GetSelectedEntryPos();
1149  if (get_top_parent(mxComboBox)->get_id().isEmpty()){
1150  //This part because if we don't have parent
1151  return "Select in '" + mxComboBox->get_id() +
1152  "' ComboBox item number " + OUString::number(nPos);
1153  }
1154  return "Select in '" + mxComboBox->get_id() +
1155  "' ComboBox item number " + OUString::number(nPos) +
1156  " from " + get_top_parent(mxComboBox)->get_id();
1157  }
1158  else
1159  return WindowUIObject::get_action(nEvent);
1160 }
1161 
1162 std::unique_ptr<UIObject> ComboBoxUIObject::create(vcl::Window* pWindow)
1163 {
1164  ComboBox* pComboBox = dynamic_cast<ComboBox*>(pWindow);
1165  assert(pComboBox);
1166  return std::unique_ptr<UIObject>(new ComboBoxUIObject(pComboBox));
1167 }
1168 
1170  WindowUIObject(xSpinButton),
1171  mxSpinButton(xSpinButton)
1172 {
1173 }
1174 
1176 {
1177 }
1178 
1179 void SpinUIObject::execute(const OUString& rAction,
1180  const StringMap& /*rParameters*/)
1181 {
1182  if (rAction == "UP")
1183  {
1184  mxSpinButton->Up();
1185  }
1186  else if (rAction == "DOWN")
1187  {
1188  mxSpinButton->Down();
1189  }
1190 }
1191 
1193 {
1195  aMap["Min"] = OUString::number(mxSpinButton->GetRangeMin());
1196  aMap["Max"] = OUString::number(mxSpinButton->GetRangeMax());
1197  aMap["Step"] = OUString::number(mxSpinButton->GetValueStep());
1198  aMap["Value"] = OUString::number(mxSpinButton->GetValue());
1199 
1200  return aMap;
1201 }
1202 
1203 OUString SpinUIObject::get_action(VclEventId nEvent) const
1204 {
1205  if (nEvent == VclEventId::SpinbuttonUp)
1206  {
1207  return this->get_type() + " Action:UP Id:" + mxSpinButton->get_id() +
1208  " Parent:" + get_top_parent(mxSpinButton)->get_id();
1209  }
1210  else if (nEvent == VclEventId::SpinbuttonDown)
1211  {
1212  return this->get_type() + " Action:DOWN Id:" + mxSpinButton->get_id() +
1213  " Parent:" + get_top_parent(mxSpinButton)->get_id();
1214  }
1215  else
1216  return WindowUIObject::get_action(nEvent);
1217 }
1218 
1219 OUString SpinUIObject::get_name() const
1220 {
1221  return "SpinUIObject";
1222 }
1223 
1225  EditUIObject(xSpinField),
1226  mxSpinField(xSpinField)
1227 {
1228 }
1229 
1231 {
1232 }
1233 
1234 void SpinFieldUIObject::execute(const OUString& rAction,
1235  const StringMap& rParameters)
1236 {
1237  if (rAction == "UP")
1238  {
1239  mxSpinField->Up();
1240  }
1241  else if (rAction == "DOWN")
1242  {
1243  mxSpinField->Down();
1244  }
1245  else if (rAction == "TYPE")
1246  {
1247  if (mxSpinField->GetSubEdit())
1248  {
1249  Edit* pSubEdit = mxSpinField->GetSubEdit();
1250  EditUIObject aSubObject(pSubEdit);
1251  aSubObject.execute(rAction, rParameters);
1252  }
1253  }
1254  else
1255  EditUIObject::execute(rAction, rParameters);
1256 }
1257 
1259 {
1261 
1262  return aMap;
1263 }
1264 
1266 {
1267  if (nEvent == VclEventId::SpinfieldUp)
1268  {
1269  if(get_top_parent(mxSpinField)->get_id().isEmpty())
1270  {
1271  //This part because if we don't have parent
1272  return "Increase '" + mxSpinField->get_id();
1273  }
1274  return "Increase '" + mxSpinField->get_id() +
1275  "' from " + get_top_parent(mxSpinField)->get_id();
1276  }
1277  else if (nEvent == VclEventId::SpinfieldDown)
1278  {
1279  if(get_top_parent(mxSpinField)->get_id().isEmpty())
1280  {
1281  //This part because if we don't have parent
1282  return "Decrease '" + mxSpinField->get_id();
1283  }
1284  return "Decrease '" + mxSpinField->get_id() +
1285  "' from " + get_top_parent(mxSpinField)->get_id();
1286  }
1287  else
1288  return WindowUIObject::get_action(nEvent);
1289 }
1290 
1292 {
1293  return "SpinFieldUIObject";
1294 }
1295 
1296 std::unique_ptr<UIObject> SpinFieldUIObject::create(vcl::Window* pWindow)
1297 {
1298  SpinField* pSpinField = dynamic_cast<SpinField*>(pWindow);
1299  assert(pSpinField);
1300  return std::unique_ptr<UIObject>(new SpinFieldUIObject(pSpinField));
1301 }
1302 
1303 
1305  SpinFieldUIObject(xMetricField),
1306  mxMetricField(xMetricField)
1307 {
1308 }
1309 
1311 {
1312 }
1313 
1314 void MetricFieldUIObject::execute(const OUString& rAction,
1315  const StringMap& rParameters)
1316 {
1317  if (rAction == "VALUE")
1318  {
1319  auto itPos = rParameters.find("VALUE");
1320  if (itPos != rParameters.end())
1321  {
1322  mxMetricField->SetValueFromString(itPos->second);
1323  }
1324  }
1325  else
1326  SpinFieldUIObject::execute(rAction, rParameters);
1327 }
1328 
1330 {
1332  aMap["Value"] = mxMetricField->GetValueString();
1333 
1334  return aMap;
1335 }
1336 
1338 {
1339  return "MetricFieldUIObject";
1340 }
1341 
1342 std::unique_ptr<UIObject> MetricFieldUIObject::create(vcl::Window* pWindow)
1343 {
1344  MetricField* pMetricField = dynamic_cast<MetricField*>(pWindow);
1345  assert(pMetricField);
1346  return std::unique_ptr<UIObject>(new MetricFieldUIObject(pMetricField));
1347 }
1348 
1350  SpinFieldUIObject(xFormattedField),
1351  mxFormattedField(xFormattedField)
1352 {
1353 }
1354 
1356 {
1357 }
1358 
1359 void FormattedFieldUIObject::execute(const OUString& rAction,
1360  const StringMap& rParameters)
1361 {
1362  if (rAction == "VALUE")
1363  {
1364  auto itPos = rParameters.find("VALUE");
1365  if (itPos != rParameters.end())
1366  {
1367  mxFormattedField->SetValueFromString(itPos->second);
1368  }
1369  }
1370  else
1371  SpinFieldUIObject::execute(rAction, rParameters);
1372 }
1373 
1375 {
1377  aMap["Value"] = OUString::number(mxFormattedField->GetFormatter()->GetValue());
1378 
1379  return aMap;
1380 }
1381 
1383 {
1384  return "FormattedFieldUIObject";
1385 }
1386 
1387 std::unique_ptr<UIObject> FormattedFieldUIObject::create(vcl::Window* pWindow)
1388 {
1389  FormattedField* pFormattedField = dynamic_cast<FormattedField*>(pWindow);
1390  assert(pFormattedField);
1391  return std::unique_ptr<UIObject>(new FormattedFieldUIObject(pFormattedField));
1392 }
1393 
1395  WindowUIObject(xTabControl),
1396  mxTabControl(xTabControl)
1397 {
1398 }
1399 
1401 {
1402 }
1403 
1404 void TabControlUIObject::execute(const OUString& rAction,
1405  const StringMap& rParameters)
1406 {
1407  if (rAction == "SELECT")
1408  {
1409  if (rParameters.find("POS") != rParameters.end())
1410  {
1411  auto itr = rParameters.find("POS");
1412  sal_uInt32 nPos = itr->second.toUInt32();
1413  std::vector<sal_uInt16> aIds = mxTabControl->GetPageIDs();
1414  mxTabControl->SelectTabPage(aIds[nPos]);
1415  }
1416  }
1417  else
1418  WindowUIObject::execute(rAction, rParameters);
1419 }
1420 
1422 {
1424  aMap["PageCount"] = OUString::number(mxTabControl->GetPageCount());
1425 
1426  sal_uInt16 nPageId = mxTabControl->GetCurPageId();
1427  aMap["CurrPageId"] = OUString::number(nPageId);
1428  aMap["CurrPagePos"] = OUString::number(mxTabControl->GetPagePos(nPageId));
1429 
1430  return aMap;
1431 }
1432 
1434 {
1435  if (nEvent == VclEventId::TabpageActivate)
1436  {
1437  sal_Int32 nPageId = mxTabControl->GetCurPageId();
1438 
1439  if(get_top_parent(mxTabControl)->get_id().isEmpty()){
1440  //This part because if we don't have parent
1441  return "Choose Tab number " + OUString::number(mxTabControl->GetPagePos(nPageId)) +
1442  " in '" + mxTabControl->get_id();
1443  }
1444  return "Choose Tab number " + OUString::number(mxTabControl->GetPagePos(nPageId)) +
1445  " in '" + mxTabControl->get_id()+
1446  "' from " + get_top_parent(mxTabControl)->get_id() ;
1447  }
1448  else
1449  return WindowUIObject::get_action(nEvent);
1450 }
1451 
1453 {
1454  return "TabControlUIObject";
1455 }
1456 
1457 std::unique_ptr<UIObject> TabControlUIObject::create(vcl::Window* pWindow)
1458 {
1459  TabControl* pTabControl = dynamic_cast<TabControl*>(pWindow);
1460  assert(pTabControl);
1461  return std::unique_ptr<UIObject>(new TabControlUIObject(pTabControl));
1462 }
1463 
1465  WindowUIObject(xRoadmapWizard),
1466  mxRoadmapWizard(xRoadmapWizard)
1467 {
1468 }
1469 
1471 {
1472 }
1473 
1474 void RoadmapWizardUIObject::execute(const OUString& rAction,
1475  const StringMap& rParameters)
1476 {
1477  if (rAction == "SELECT")
1478  {
1479  if (rParameters.find("POS") != rParameters.end())
1480  {
1481  auto itr = rParameters.find("POS");
1482  sal_uInt32 nPos = itr->second.toUInt32();
1484  }
1485  }
1486  else
1487  WindowUIObject::execute(rAction, rParameters);
1488 }
1489 
1491 {
1493 
1494  aMap["CurrentStep"] = OUString::number(mxRoadmapWizard->GetCurrentRoadmapItemID());
1495 
1496  return aMap;
1497 }
1498 
1500 {
1501  return "RoadmapWizardUIObject";
1502 }
1503 
1504 std::unique_ptr<UIObject> RoadmapWizardUIObject::create(vcl::Window* pWindow)
1505 {
1506  vcl::RoadmapWizard* pRoadmapWizard = dynamic_cast<vcl::RoadmapWizard*>(pWindow);
1507  assert(pRoadmapWizard);
1508  return std::unique_ptr<UIObject>(new RoadmapWizardUIObject(pRoadmapWizard));
1509 }
1510 
1511 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString GetDisplayText() const override
Definition: ctrl.cxx:218
virtual Point GetPosPixel() const
Definition: window.cxx:2838
sal_Int32 GetEntryPos(const OUString &rStr) const
Definition: combobox.cxx:943
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
long Width() const
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual ~MultiLineEditUIObject() override
VclPtr< VclMultiLineEdit > mxEdit
Definition: uiobject.hxx:207
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
wizard for a roadmap
Definition: wizdlg.hxx:65
OUString GetSelectedEntry(sal_Int32 nSelIndex=0) const
Definition: listbox.cxx:990
RadioButtonUIObject(const VclPtr< RadioButton > &xCheckbox)
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
WinBits const WB_TOGGLE
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3910
MetricFieldUIObject(const VclPtr< MetricField > &xEdit)
sal_Int32 GetSelectedEntryPos(sal_Int32 nSelIndex=0) const
Definition: listbox.cxx:1002
virtual OUString GetSelected() const
Definition: edit.cxx:2493
ButtonUIObject(const VclPtr< Button > &xButton)
virtual std::unique_ptr< UIObject > get_child(const OUString &rID)
Returns the child of the current UIObject with the corresponding id.
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual OUString get_name() const override
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
VclPtr< SpinButton > mxSpinButton
Definition: uiobject.hxx:345
Edit * GetSubEdit() const
Definition: edit.hxx:223
void SetValueFromString(const OUString &rStr)
Definition: fmtfield.cxx:1312
long Height() const
A widget used to choose from a list of items and which has no entry.
Definition: lstbox.hxx:83
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
void SelectTabPage(sal_uInt16 nPageId)
Definition: tabctrl.cxx:1847
constexpr sal_uInt16 KEY_F3
Definition: keycodes.hxx:85
virtual OUString get_action(VclEventId nEvent) const
Gets the corresponding Action string for the event.
virtual OUString get_name() const override
virtual OUString get_name() const override
constexpr sal_uInt16 KEY_A
Definition: keycodes.hxx:56
constexpr sal_uInt16 KEY_0
Definition: keycodes.hxx:45
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
void Select()
Definition: listbox.cxx:898
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
constexpr sal_uInt16 KEY_F5
Definition: keycodes.hxx:87
constexpr sal_uInt16 KEY_F7
Definition: keycodes.hxx:89
virtual std::set< OUString > get_children() const override
Returns a set containing all descendants of the object.
sal_Int64 n
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2396
VclPtr< FormattedField > mxFormattedField
constexpr sal_uInt16 KEY_F4
Definition: keycodes.hxx:86
SAL_DLLPRIVATE void ImplCallClick(bool bGrabFocus=false, GetFocusFlags nFocusFlags=GetFocusFlags::NONE)
Definition: button.cxx:2200
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
OUString aId
FormattedFieldUIObject(const VclPtr< FormattedField > &xEdit)
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
constexpr sal_uInt16 KEY_F6
Definition: keycodes.hxx:88
virtual void Up()
Definition: spinfld.cxx:358
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
constexpr sal_uInt16 KEY_SPACE
Definition: keycodes.hxx:123
void Select()
Definition: combobox.cxx:501
virtual ~DialogUIObject() override
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
virtual OUString get_name() const
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
std::vector< OUString > split(const OUString &rStr, sal_Unicode cSeparator)
constexpr sal_uInt16 KEY_F1
Definition: keycodes.hxx:83
constexpr sal_uInt16 KEY_F9
Definition: keycodes.hxx:91
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
void SelectEntry(const OUString &rStr, bool bSelect=true)
Definition: listbox.cxx:1022
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
HashMap_OWString_Interface aMap
static UITestLogger & getInstance()
Definition: logger.cxx:539
virtual OUString dumpHierarchy() const override
Currently an internal method to dump the parent-child relationship starting from the current top focu...
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual ~RadioButtonUIObject() override
sal_uInt16 sal_Unicode
VclPtr< vcl::RoadmapWizard > mxRoadmapWizard
const OUString & get_id() const
Get the ID of the window.
Definition: window.cxx:3905
sal_uInt16 nPageId
void setAppName(OUString name)
Definition: logger.hxx:74
sal_Int32 GetEntryCount() const
Definition: listbox.cxx:983
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
TextWindow * GetTextWindow()
Definition: vclmedit.cxx:1518
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
double GetValue()
Definition: fmtfield.cxx:861
virtual ~FormattedFieldUIObject() override
virtual ~TabControlUIObject() override
virtual OUString dumpState() const override
Currently an internal method to dump the state of the current UIObject as represented by get_state()...
virtual sal_Int32 GetMaxTextLen() const
Definition: edit.hxx:186
int nCount
bool IsChecked() const
Definition: button.hxx:300
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
constexpr sal_uInt16 KEY_F2
Definition: keycodes.hxx:84
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
virtual void Click()
Definition: button.cxx:122
VclEventId
Definition: vclevent.hxx:39
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual OUString get_name() const override
bool IsModalInputMode() const
Definition: dialog.hxx:143
virtual const Selection & GetSelection() const
Definition: edit.cxx:2466
WindowUIObject(const VclPtr< vcl::Window > &xWindow)
virtual OUString get_name() const override
virtual OUString GetText() const
Definition: window.cxx:3085
WinBits const WB_SYSTEMFLOATWIN
virtual OUString get_name() const override
virtual std::set< OUString > get_children() const
Returns a set containing all descendants of the object.
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual OUString get_name() const override
Definition: edit.hxx:56
virtual OUString get_name() const override
SpinFieldUIObject(const VclPtr< SpinField > &xEdit)
virtual void Down()
Definition: spinfld.cxx:363
bool IsReadOnly() const
Definition: listbox.cxx:1324
virtual OUString GetDisplayText() const
Definition: window.cxx:3091
virtual void SetSelection(const Selection &rSelection)
Definition: edit.cxx:2392
sal_uInt16 GetPageCount() const
Definition: tabctrl.cxx:1764
SAL_DLLPRIVATE void ImplCheck()
Definition: button.cxx:3068
VclPtr< Edit > mxEdit
Definition: uiobject.hxx:184
MultiLineEditUIObject(const VclPtr< VclMultiLineEdit > &xEdit)
const SvXMLTokenMapEntry aChildren[]
DialogUIObject(const VclPtr< Dialog > &xDialog)
DocumentType eType
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
virtual OUString dumpHierarchy() const
Currently an internal method to dump the parent-child relationship starting from the current top focu...
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
virtual ~ButtonUIObject() override
long Min() const
void SelectRoadmapItemByID(int nId)
int i
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
bool IsTriStateEnabled() const
Definition: button.hxx:406
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
void SelectEntryPos(sal_Int32 nPos, bool bSelect=true)
Definition: listbox.cxx:1027
virtual OUString get_type() const
Returns the type of the UIObject.
ListBoxUIObject(const VclPtr< ListBox > &xListBox)
TabPageUIObject(const VclPtr< TabPage > &xTabPage)
VclPtr< Button > mxButton
Definition: uiobject.hxx:144
RoadmapWizardUIObject(const VclPtr< vcl::RoadmapWizard > &xRoadmapWizard)
virtual OUString GetText() const override
Definition: edit.cxx:2562
virtual void Modify()
Definition: edit.cxx:2312
sal_Int32 GetSelectedEntryCount() const
Definition: listbox.cxx:995
sal_Int32 GetSelectedEntryPos(sal_Int32 nSelIndex=0) const
Definition: combobox.cxx:1352
bool IsChecked() const
Definition: button.hxx:434
CheckBoxUIObject(const VclPtr< CheckBox > &xCheckbox)
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
virtual OUString get_name() const override
virtual sal_Int32 GetMaxTextLen() const override
Definition: vclmedit.cxx:1107
virtual void execute(const OUString &rAction, const StringMap &rParameters)
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual OUString GetSelected() const override
Definition: vclmedit.cxx:1122
virtual ~ComboBoxUIObject() override
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
virtual std::unique_ptr< UIObject > get_child(const OUString &rID) override
Returns the child of the current UIObject with the corresponding id.
VclPtr< MetricField > mxMetricField
void RequestDoubleBuffering(bool bRequest)
Enable/disable double-buffering of the frame window and all its children.
Definition: window.cxx:3841
virtual OUString get_name() const override
Formatter * GetFormatter()
Definition: fmtfield.cxx:1304
void GrabFocus()
Definition: window.cxx:3006
constexpr sal_uInt16 KEY_F10
Definition: keycodes.hxx:92
static void append(std::bitset< N > &rSet, size_t const nOffset, sal_uInt32 const nValue)
Definition: sft.cxx:2600
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: edit.cxx:1704
vcl::Window * GetParent() const
Definition: window2.cxx:1097
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual ~SpinUIObject() override
sal_uInt16 GetPagePos(sal_uInt16 nPageId) const
Definition: tabctrl.cxx:1776
virtual OUString dumpState() const
Currently an internal method to dump the state of the current UIObject as represented by get_state()...
virtual ~SpinFieldUIObject() override
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
std::vector< sal_uInt16 > GetPageIDs() const
Definition: tabctrl.cxx:2148
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1800
sal_uInt16 GetChildCount() const
Definition: stacking.cxx:1012
VclPtr< ComboBox > mxComboBox
Definition: uiobject.hxx:321
virtual OUString get_name() const override
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
virtual OUString get_name() const override
WindowType
VclPtr< Dialog > mxDialog
Definition: uiobject.hxx:166
#define SAL_WARN_IF(condition, area, stream)
VclPtr< CheckBox > mxCheckBox
Definition: uiobject.hxx:230
constexpr sal_uInt16 KEY_ESCAPE
Definition: keycodes.hxx:120
virtual OUString get_name() const override
void SetValueFromString(const OUString &rStr)
Definition: field.cxx:636
VclPtr< TabControl > mxTabControl
Definition: uiobject.hxx:392
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
bool IsVisible() const
Definition: window2.cxx:1102
VclPtr< RadioButton > mxRadioButton
Definition: uiobject.hxx:253
constexpr sal_uInt16 KEY_F11
Definition: keycodes.hxx:93
OUString GetValueString() const
Definition: field.cxx:629
constexpr sal_uInt16 KEY_F12
Definition: keycodes.hxx:94
ComboBoxUIObject(const VclPtr< ComboBox > &xListBox)
std::map< OUString, OUString > StringMap
VclPtr< ListBox > mxListBox
Definition: uiobject.hxx:296
virtual ~CheckBoxUIObject() override
virtual OUString get_type() const override
Returns the type of the UIObject.
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
QPRO_FUNC_TYPE nType
SpinUIObject(const VclPtr< SpinButton > &xSpinButton)
VclPtr< vcl::Window > mxWindow
Definition: uiobject.hxx:110
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
constexpr sal_uInt16 KEY_BACKSPACE
Definition: keycodes.hxx:122
TabControlUIObject(const VclPtr< TabControl > &mxTabControl)
bool IsMultiSelectionEnabled() const
Definition: listbox.cxx:1139
int GetCurrentRoadmapItemID() const
VclPtr< SpinField > mxSpinField
Definition: uiobject.hxx:368
A widget used to choose from a list of items and which has an entry.
Definition: combobox.hxx:38
WindowType GetType() const
Definition: window2.cxx:974
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
OUString GetText() const override
Definition: vclmedit.cxx:1152
bool IsEnabled() const
Definition: window2.cxx:1122
#define SAL_WARN(area, stream)
WinBits GetStyle() const
Definition: window2.cxx:953
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
virtual ~UIObject()
constexpr sal_uInt16 KEY_DELETE
Definition: keycodes.hxx:125
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
long Max() const
void SelectEntryPos(sal_Int32 nPos, bool bSelect=true)
Definition: combobox.cxx:1370
virtual void SetText(const OUString &rStr) override
Definition: edit.cxx:2543
constexpr sal_uInt16 KEY_INSERT
Definition: keycodes.hxx:124
bool IsReallyVisible() const
Definition: window2.cxx:1107
virtual ~RoadmapWizardUIObject() override
virtual ~TabPageUIObject() override
virtual ~MetricFieldUIObject() override
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Executes an action on the wrapped UI object, possibly with some additional parameters.
EditUIObject(const VclPtr< Edit > &xEdit)
virtual OUString get_name() const override
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly...
Definition: window.cxx:3836
virtual StringMap get_state()
Returns the state of the wrapped UI object as a string key value map.
virtual ~EditUIObject() override
virtual OUString get_action(VclEventId nEvent) const override
Gets the corresponding Action string for the event.
virtual OUString get_name() const override
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
virtual void SetSelection(const Selection &rSelection) override
Definition: vclmedit.cxx:1180
sal_uInt16 nPos
sal_uInt16 GetCurPageId() const
Definition: tabctrl.cxx:1839
constexpr sal_uInt16 KEY_TAB
Definition: keycodes.hxx:121
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual StringMap get_state() override
Returns the state of the wrapped UI object as a string key value map.
vcl::Window * GetChild(sal_uInt16 nChild) const
Definition: stacking.cxx:1028
constexpr sal_uInt16 KEY_F8
Definition: keycodes.hxx:90
virtual ~ListBoxUIObject() override