summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/tabdlg.hxx2
-rw-r--r--include/vcl/button.hxx5
-rw-r--r--include/vcl/combobox.hxx2
-rw-r--r--include/vcl/dialog.hxx2
-rw-r--r--include/vcl/edit.hxx2
-rw-r--r--include/vcl/lstbox.hxx2
-rw-r--r--include/vcl/spinfld.hxx2
-rw-r--r--include/vcl/uitest/factory.hxx6
-rw-r--r--include/vcl/window.hxx3
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/inc/uitest/uitest_factory.hxx21
-rw-r--r--sfx2/source/dialog/tabdlg.cxx14
-rw-r--r--sfx2/source/uitest/factory.cxx26
-rw-r--r--sfx2/source/uitest/sfx_uiobject.cxx9
-rw-r--r--vcl/Library_vcl.mk1
-rw-r--r--vcl/inc/uitest/factory.hxx34
-rw-r--r--vcl/inc/uitest/uiobject_impl.hxx21
-rw-r--r--vcl/source/control/button.cxx11
-rw-r--r--vcl/source/control/combobox.cxx6
-rw-r--r--vcl/source/control/edit.cxx6
-rw-r--r--vcl/source/control/listbox.cxx6
-rw-r--r--vcl/source/control/spinfld.cxx6
-rw-r--r--vcl/source/uitest/factory.cxx140
-rw-r--r--vcl/source/uitest/uiobject.cxx63
-rw-r--r--vcl/source/uitest/uitest.cxx8
-rw-r--r--vcl/source/window/dialog.cxx6
-rw-r--r--vcl/source/window/window.cxx5
27 files changed, 155 insertions, 255 deletions
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index a79465163328..99e223ab61b9 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -200,6 +200,8 @@ public:
//calls Ok without closing dialog
bool Apply();
+
+ virtual FactoryFunction GetUITestFactory() const override;
};
namespace sfx { class ItemConnectionBase; }
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index e40e16f8d96b..472949d86d99 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -96,6 +96,8 @@ public:
/// Sets the button state according to the FeatureStateEvent emitted by an Uno state change.
virtual void statusChanged(const css::frame::FeatureStateEvent& rEvent);
+ virtual FactoryFunction GetUITestFactory() const;
+
protected:
/// Handler for click, in case we want the button to handle uno commands (.uno:Something).
@@ -474,8 +476,9 @@ public:
virtual bool set_property(const OString &rKey, const OString &rValue) override;
virtual void ShowFocus(const Rectangle& rRect) override;
-};
+ virtual FactoryFunction GetUITestFactory() const override;
+};
inline void CheckBox::Check( bool bCheck )
{
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 61ad35838e4c..fd568f635146 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -181,6 +181,8 @@ public:
void setMaxWidthChars(sal_Int32 nWidth);
virtual bool set_property(const OString &rKey, const OString &rValue) override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
};
#endif // _COMBOBOX_HXX
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 9c0774712e31..afa8c2e33e81 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -96,6 +96,8 @@ public:
virtual short Execute();
bool IsInExecute() const { return mbInExecute; }
+ virtual FactoryFunction GetUITestFactory() const;
+
// Dialog::Execute replacement API
public:
virtual void StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl );
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 722a25855e20..357dc6af7de2 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -274,6 +274,8 @@ public:
void SetTextFilter(TextFilter* pFilter) { mpFilterText = pFilter; }
+ virtual FactoryFunction GetUITestFactory() const override;
+
// returns the minimum size a bordered Edit should have given the current
// global style settings (needed by sc's inputwin.cxx)
static Size GetMinimumEditSize();
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index c480e46d4e25..e35366a1358a 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -274,6 +274,8 @@ public:
void EnableQuickSelection( bool b );
static sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB);
+
+ virtual FactoryFunction GetUITestFactory() const override;
};
class VCL_DLLPUBLIC MultiListBox : public ListBox
diff --git a/include/vcl/spinfld.hxx b/include/vcl/spinfld.hxx
index bd1375af624f..f3346431ad89 100644
--- a/include/vcl/spinfld.hxx
+++ b/include/vcl/spinfld.hxx
@@ -99,6 +99,8 @@ public:
virtual Size CalcMinimumSizeForText(const OUString &rString) const override;
virtual Size GetOptimalSize() const override;
virtual Size CalcSize(sal_Int32 nChars) const override;
+
+ virtual FactoryFunction GetUITestFactory() const override;
};
#endif // INCLUDED_VCL_SPINFLD_HXX
diff --git a/include/vcl/uitest/factory.hxx b/include/vcl/uitest/factory.hxx
index 2e804497810c..da645f309b79 100644
--- a/include/vcl/uitest/factory.hxx
+++ b/include/vcl/uitest/factory.hxx
@@ -7,10 +7,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <vcl/dllapi.h>
-
-#include <tools/wintypes.hxx>
-
#include <memory>
#include <functional>
@@ -24,6 +20,4 @@ class UIObject;
typedef std::function<std::unique_ptr<UIObject>(vcl::Window*)> FactoryFunction;
-void UITEST_DLLPUBLIC registerUITestFactory(WindowType eType, FactoryFunction aFactory);
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 933e490e2684..d49ce633bd25 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -33,6 +33,7 @@
#include <vcl/keycodes.hxx>
#include <vcl/region.hxx>
#include <vcl/salnativewidgets.hxx>
+#include <vcl/uitest/factory.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ref.hxx>
#include <cppuhelper/weakref.hxx>
@@ -1587,6 +1588,8 @@ public:
virtual OUString GetSurroundingText() const;
virtual Selection GetSurroundingTextSelection() const;
+
+ virtual FactoryFunction GetUITestFactory() const;
};
}
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index ac848db0356c..696402b6eb0b 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -286,7 +286,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/styles/StyleManager \
sfx2/source/toolbox/imgmgr \
sfx2/source/toolbox/tbxitem \
- sfx2/source/uitest/factory \
sfx2/source/uitest/sfx_uiobject \
sfx2/source/view/classificationcontroller \
sfx2/source/view/classificationhelper \
diff --git a/sfx2/inc/uitest/uitest_factory.hxx b/sfx2/inc/uitest/uitest_factory.hxx
deleted file mode 100644
index b2d298f5a6eb..000000000000
--- a/sfx2/inc/uitest/uitest_factory.hxx
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <vcl/uitest/factory.hxx>
-
-class SfxUITestFactory
-{
-public:
-
- static void registerSfxTabDialog();
-
- static void registerSfxTabPage();
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index c61c1e285f13..4b33e3171006 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -37,7 +37,7 @@
#include <sfx2/sfxdlg.hxx>
#include <sfx2/itemconnect.hxx>
-#include "uitest/uitest_factory.hxx"
+#include "uitest/sfx_uiobject.hxx"
#include "dialog.hrc"
#include "helpid.hrc"
@@ -329,13 +329,6 @@ SfxTabDialog::SfxTabDialog
, m_pExampleSet(nullptr)
{
Init_Impl(bEditFmt);
-
- static bool bRegisterUITest = false;
- if (!bRegisterUITest)
- {
- SfxUITestFactory::registerSfxTabDialog();
- bRegisterUITest = true;
- }
}
@@ -1334,4 +1327,9 @@ void SfxTabDialog::SetInputSet( const SfxItemSet* pInSet )
}
}
+FactoryFunction SfxTabDialog::GetUITestFactory() const
+{
+ return SfxTabDialogUIObject::create;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/uitest/factory.cxx b/sfx2/source/uitest/factory.cxx
deleted file mode 100644
index 447943706ed1..000000000000
--- a/sfx2/source/uitest/factory.cxx
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <uitest/uitest_factory.hxx>
-#include <uitest/sfx_uiobject.hxx>
-
-#include <vcl/uitest/factory.hxx>
-
-
-void SfxUITestFactory::registerSfxTabDialog()
-{
- registerUITestFactory(WINDOW_TABDIALOG, FactoryFunction(SfxTabDialogUIObject::create));
-}
-
-void SfxUITestFactory::registerSfxTabPage()
-{
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/uitest/sfx_uiobject.cxx b/sfx2/source/uitest/sfx_uiobject.cxx
index 590ffd3a95ac..d42798781e1a 100644
--- a/sfx2/source/uitest/sfx_uiobject.cxx
+++ b/sfx2/source/uitest/sfx_uiobject.cxx
@@ -37,13 +37,8 @@ UIObjectType SfxTabDialogUIObject::get_type() const
std::unique_ptr<UIObject> SfxTabDialogUIObject::create(vcl::Window* pWindow)
{
SfxTabDialog* pDialog = dynamic_cast<SfxTabDialog*>(pWindow);
-
- if (pDialog)
- {
- return std::unique_ptr<UIObject>(new SfxTabDialogUIObject(pDialog));
- }
-
- return nullptr;
+ assert(pDialog);
+ return std::unique_ptr<UIObject>(new SfxTabDialogUIObject(pDialog));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 0cb7d260871a..78f38cfd6e53 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -393,7 +393,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/fontsubset/sft \
vcl/source/fontsubset/ttcr \
vcl/source/fontsubset/xlat \
- vcl/source/uitest/factory \
vcl/source/uitest/uiobject \
vcl/source/uitest/uitest \
vcl/source/uitest/uno/uiobject_uno \
diff --git a/vcl/inc/uitest/factory.hxx b/vcl/inc/uitest/factory.hxx
deleted file mode 100644
index 7018a198f984..000000000000
--- a/vcl/inc/uitest/factory.hxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <vcl/uitest/factory.hxx>
-
-#include <tools/wintypes.hxx>
-
-#include <memory>
-#include <map>
-
-namespace vcl
-{
-
-class Window;
-
-}
-
-class UIObject;
-
-class UITestWrapperFactory
-{
-public:
- static std::unique_ptr<UIObject> createObject(vcl::Window* pWindow);
-
- static std::map<WindowType, FactoryFunction> aFactoryMap;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/uitest/uiobject_impl.hxx b/vcl/inc/uitest/uiobject_impl.hxx
index 3bac973ecb58..f0843a7d0b0d 100644
--- a/vcl/inc/uitest/uiobject_impl.hxx
+++ b/vcl/inc/uitest/uiobject_impl.hxx
@@ -40,6 +40,8 @@ public:
virtual void dumpHierarchy() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const;
@@ -61,6 +63,8 @@ public:
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -78,6 +82,8 @@ public:
virtual StringMap get_state() override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -98,6 +104,8 @@ public:
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -119,6 +127,8 @@ public:
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -136,9 +146,10 @@ public:
virtual StringMap get_state() override;
-
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -160,6 +171,8 @@ public:
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -182,6 +195,8 @@ public:
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -203,6 +218,8 @@ public:
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
@@ -223,6 +240,8 @@ public:
virtual UIObjectType get_type() const override;
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
protected:
virtual OUString get_name() const override;
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 5399ae2e68bb..a5a444fbb021 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -36,6 +36,7 @@
#include <vcl/edit.hxx>
#include <vcl/layout.hxx>
#include <vcl/vclstatuslistener.hxx>
+#include <uitest/uiobject_impl.hxx>
#include <svids.hrc>
#include <svdata.hxx>
@@ -620,6 +621,11 @@ void Button::statusChanged(const css::frame::FeatureStateEvent& rEvent)
Enable(rEvent.IsEnabled);
}
+FactoryFunction Button::GetUITestFactory() const
+{
+ return ButtonUIObject::create;
+}
+
IMPL_STATIC_LINK_TYPED( Button, dispatchCommandHandler, Button*, pButton, void )
{
if (pButton == nullptr)
@@ -3791,6 +3797,11 @@ void CheckBox::ShowFocus(const Rectangle& rRect)
Button::ShowFocus(rRect);
}
+FactoryFunction CheckBox::GetUITestFactory() const
+{
+ return EditUIObject::create;
+}
+
ImageButton::ImageButton( vcl::Window* pParent, WinBits nStyle ) :
PushButton( pParent, nStyle )
{
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 2e0e32829f72..6a29c8e445f1 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -29,6 +29,7 @@
#include <vcl/button.hxx>
#include <vcl/event.hxx>
#include <vcl/settings.hxx>
+#include <uitest/uiobject_impl.hxx>
#include <svdata.hxx>
#include "listbox.hxx"
@@ -1569,4 +1570,9 @@ bool ComboBox::set_property(const OString &rKey, const OString &rValue)
return true;
}
+FactoryFunction ComboBox::GetUITestFactory() const
+{
+ return ComboBoxUIObject::create;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 4595309e8d93..0aed1f2acd5d 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -27,6 +27,7 @@
#include <vcl/layout.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
+#include <uitest/uiobject_impl.hxx>
#include <window.h>
#include <svdata.hxx>
@@ -3047,4 +3048,9 @@ Selection Edit::GetSurroundingTextSelection() const
return GetSelection();
}
+FactoryFunction Edit::GetUITestFactory() const
+{
+ return EditUIObject::create;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index 9fbb4dc1263c..4c62a80ba4c4 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -29,6 +29,7 @@
#include <vcl/lstbox.hxx>
#include <vcl/combobox.hxx>
#include <vcl/settings.hxx>
+#include <uitest/uiobject_impl.hxx>
#include "svdata.hxx"
#include "controldata.hxx"
@@ -1491,6 +1492,11 @@ void ListBox::SetEdgeBlending(bool bNew)
}
}
+FactoryFunction ListBox::GetUITestFactory() const
+{
+ return ListBoxUIObject::create;
+}
+
MultiListBox::MultiListBox( vcl::Window* pParent, WinBits nStyle ) :
ListBox( WINDOW_MULTILISTBOX )
{
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index d0247fbb1c03..4268a9715d2a 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -23,6 +23,7 @@
#include <vcl/decoview.hxx>
#include <vcl/spinfld.hxx>
#include <vcl/settings.hxx>
+#include <uitest/uiobject_impl.hxx>
#include "controldata.hxx"
#include "spin.hxx"
@@ -1040,4 +1041,9 @@ void SpinField::Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, D
}
}
+FactoryFunction SpinField::GetUITestFactory() const
+{
+ return SpinFieldUIObject::create;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/uitest/factory.cxx b/vcl/source/uitest/factory.cxx
deleted file mode 100644
index 31b03621aa61..000000000000
--- a/vcl/source/uitest/factory.cxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "uitest/factory.hxx"
-#include "uitest/uiobject_impl.hxx"
-
-#include <vcl/tabpage.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/combobox.hxx>
-#include <vcl/spin.hxx>
-#include <vcl/spinfld.hxx>
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/edit.hxx>
-
-std::map<WindowType, FactoryFunction> UITestWrapperFactory::aFactoryMap;
-
-void registerUITestFactory(WindowType eType, FactoryFunction aFactory)
-{
- UITestWrapperFactory::aFactoryMap.insert(std::pair<WindowType, FactoryFunction>(eType, aFactory));
-}
-
-std::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* pWindow)
-{
- if (!pWindow)
- return nullptr;
-
- auto itr = aFactoryMap.find(pWindow->GetType());
- if (itr != aFactoryMap.end())
- {
- std::unique_ptr<UIObject> pObj = itr->second(pWindow);
- if (pObj)
- return pObj;
- }
-
- switch (pWindow->GetType())
- {
- case WINDOW_BUTTON:
- case WINDOW_PUSHBUTTON:
- case WINDOW_OKBUTTON:
- case WINDOW_CANCELBUTTON:
- case WINDOW_HELPBUTTON:
- {
- Button* pButton = dynamic_cast<Button*>(pWindow);
- assert(pButton);
- return std::unique_ptr<UIObject>(new ButtonUIObject(pButton));
- }
- break;
- case WINDOW_MESSBOX:
- case WINDOW_INFOBOX:
- case WINDOW_WARNINGBOX:
- case WINDOW_ERRORBOX:
- case WINDOW_QUERYBOX:
- case WINDOW_DIALOG:
- case WINDOW_MODALDIALOG:
- case WINDOW_MODELESSDIALOG:
- case WINDOW_SYSTEMDIALOG:
- case WINDOW_PATHDIALOG:
- case WINDOW_FILEDIALOG:
- case WINDOW_PRINTERSETUPDIALOG:
- case WINDOW_PRINTDIALOG:
- case WINDOW_COLORDIALOG:
- case WINDOW_FONTDIALOG:
- case WINDOW_TABDIALOG:
- {
- Dialog* pDialog = dynamic_cast<Dialog*>(pWindow);
- assert(pDialog);
- return std::unique_ptr<UIObject>(new DialogUIObject(pDialog));
- }
- break;
- case WINDOW_EDIT:
- case WINDOW_MULTILINEEDIT:
- {
- Edit* pEdit = dynamic_cast<Edit*>(pWindow);
- assert(pEdit);
- return std::unique_ptr<UIObject>(new EditUIObject(pEdit));
- }
- break;
- case WINDOW_CHECKBOX:
- {
- CheckBox* pCheckBox = dynamic_cast<CheckBox*>(pWindow);
- assert(pCheckBox);
- return std::unique_ptr<UIObject>(new CheckBoxUIObject(pCheckBox));
- }
- break;
- case WINDOW_COMBOBOX:
- {
- ComboBox* pComboBox = dynamic_cast<ComboBox*>(pWindow);
- assert(pComboBox);
- return std::unique_ptr<UIObject>(new ComboBoxUIObject(pComboBox));
- }
- break;
- case WINDOW_LISTBOX:
- {
- ListBox* pListBox = dynamic_cast<ListBox*>(pWindow);
- assert(pListBox);
- return std::unique_ptr<UIObject>(new ListBoxUIObject(pListBox));
- }
- break;
- case WINDOW_TABPAGE:
- {
- //TabPage* pTabPage = dynamic_cast<TabPage*>(pWindow);
- //assert(pTabPage);
- // return std::unique_ptr<UIObject>(new TabPageUIObject(pTabPage));
- }
- break;
- case WINDOW_SPINBUTTON:
- {
- SpinButton* pSpinButton = dynamic_cast<SpinButton*>(pWindow);
- assert(pSpinButton);
- return std::unique_ptr<UIObject>(new SpinUIObject(pSpinButton));
- }
- break;
- case WINDOW_SPINFIELD:
- case WINDOW_PATTERNFIELD:
- case WINDOW_NUMERICFIELD:
- case WINDOW_METRICFIELD:
- case WINDOW_CURRENCYFIELD:
- case WINDOW_DATEFIELD:
- case WINDOW_TIMEFIELD:
- {
- SpinField* pSpinField = dynamic_cast<SpinField*>(pWindow);
- assert(pSpinField);
- return std::unique_ptr<UIObject>(new SpinFieldUIObject(pSpinField));
- }
- break;
- default:
- break;
- }
-
- return std::unique_ptr<UIObject>(new WindowUIObject(pWindow));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 23122c884615..f994833499bb 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -8,7 +8,6 @@
*/
#include "uitest/uiobject_impl.hxx"
-#include "uitest/factory.hxx"
#include <vcl/event.hxx>
#include <vcl/tabpage.hxx>
@@ -247,7 +246,8 @@ std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID)
vcl::Window* pDialogParent = get_dialog_parent(mxWindow.get());
vcl::Window* pWindow = findChild(pDialogParent, rID);
- return UITestWrapperFactory::createObject(pWindow);
+ FactoryFunction aFunction = pWindow->GetUITestFactory();
+ return aFunction(pWindow);
}
OUString WindowUIObject::get_name() const
@@ -270,9 +270,8 @@ void WindowUIObject::dumpState() const
for (size_t i = 0; i < nCount; ++i)
{
vcl::Window* pChild = mxWindow->GetChild(i);
- // TODO: moggi: we need to go through a factory for the new objects
std::unique_ptr<UIObject> pChildWrapper =
- UITestWrapperFactory::createObject(pChild);
+ pChild->GetUITestFactory()(pChild);
pChildWrapper->dumpState();
}
}
@@ -281,10 +280,15 @@ void WindowUIObject::dumpHierarchy() const
{
vcl::Window* pDialogParent = get_dialog_parent(mxWindow.get());
std::unique_ptr<UIObject> pParentWrapper =
- UITestWrapperFactory::createObject(pDialogParent);
+ pDialogParent->GetUITestFactory()(pDialogParent);
pParentWrapper->dumpState();
}
+std::unique_ptr<UIObject> WindowUIObject::create(vcl::Window* pWindow)
+{
+ return std::unique_ptr<UIObject>(new WindowUIObject(pWindow));
+}
+
ButtonUIObject::ButtonUIObject(VclPtr<Button> xButton):
WindowUIObject(xButton),
mxButton(xButton)
@@ -319,6 +323,13 @@ OUString ButtonUIObject::get_name() const
return OUString("ButtonUIObject");
}
+std::unique_ptr<UIObject> ButtonUIObject::create(vcl::Window* pWindow)
+{
+ Button* pButton = dynamic_cast<Button*>(pWindow);
+ assert(pButton);
+ return std::unique_ptr<UIObject>(new ButtonUIObject(pButton));
+}
+
DialogUIObject::DialogUIObject(VclPtr<Dialog> xDialog):
WindowUIObject(xDialog),
mxDialog(xDialog)
@@ -343,6 +354,13 @@ UIObjectType DialogUIObject::get_type() const
return UIObjectType::DIALOG;
}
+std::unique_ptr<UIObject> DialogUIObject::create(vcl::Window* pWindow)
+{
+ Dialog* pDialog = dynamic_cast<Dialog*>(pWindow);
+ assert(pDialog);
+ return std::unique_ptr<UIObject>(new DialogUIObject(pDialog));
+}
+
EditUIObject::EditUIObject(VclPtr<Edit> xEdit):
WindowUIObject(xEdit),
mxEdit(xEdit)
@@ -410,6 +428,13 @@ OUString EditUIObject::get_name() const
return OUString("EditUIObject");
}
+std::unique_ptr<UIObject> EditUIObject::create(vcl::Window* pWindow)
+{
+ Edit* pEdit = dynamic_cast<Edit*>(pWindow);
+ assert(pEdit);
+ return std::unique_ptr<UIObject>(new EditUIObject(pEdit));
+}
+
CheckBoxUIObject::CheckBoxUIObject(VclPtr<CheckBox> xCheckbox):
WindowUIObject(xCheckbox),
mxCheckBox(xCheckbox)
@@ -444,6 +469,13 @@ OUString CheckBoxUIObject::get_name() const
return OUString("CheckBoxUIObject");
}
+std::unique_ptr<UIObject> CheckBoxUIObject::create(vcl::Window* pWindow)
+{
+ CheckBox* pCheckBox = dynamic_cast<CheckBox*>(pWindow);
+ assert(pCheckBox);
+ return std::unique_ptr<UIObject>(new CheckBoxUIObject(pCheckBox));
+}
+
TabPageUIObject::TabPageUIObject(VclPtr<TabPage> xTabPage):
WindowUIObject(xTabPage),
mxTabPage(xTabPage)
@@ -529,6 +561,13 @@ OUString ListBoxUIObject::get_name() const
return OUString("ListBoxUIObject");
}
+std::unique_ptr<UIObject> ListBoxUIObject::create(vcl::Window* pWindow)
+{
+ ListBox* pListBox = dynamic_cast<ListBox*>(pWindow);
+ assert(pListBox);
+ return std::unique_ptr<UIObject>(new ListBoxUIObject(pListBox));
+}
+
ComboBoxUIObject::ComboBoxUIObject(VclPtr<ComboBox> xComboBox):
WindowUIObject(xComboBox),
mxComboBox(xComboBox)
@@ -568,6 +607,13 @@ OUString ComboBoxUIObject::get_name() const
return OUString("ComboBoxUIObject");
}
+std::unique_ptr<UIObject> ComboBoxUIObject::create(vcl::Window* pWindow)
+{
+ ComboBox* pComboBox = dynamic_cast<ComboBox*>(pWindow);
+ assert(pComboBox);
+ return std::unique_ptr<UIObject>(new ComboBoxUIObject(pComboBox));
+}
+
SpinUIObject::SpinUIObject(VclPtr<SpinButton> xSpinButton):
WindowUIObject(xSpinButton),
mxSpinButton(xSpinButton)
@@ -643,4 +689,11 @@ OUString SpinFieldUIObject::get_name() const
return OUString("SpinFieldUIObject");
}
+std::unique_ptr<UIObject> SpinFieldUIObject::create(vcl::Window* pWindow)
+{
+ SpinField* pSpinField = dynamic_cast<SpinField*>(pWindow);
+ assert(pSpinField);
+ return std::unique_ptr<UIObject>(new SpinFieldUIObject(pSpinField));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/uitest/uitest.cxx b/vcl/source/uitest/uitest.cxx
index 564538119801..85711ac3445c 100644
--- a/vcl/source/uitest/uitest.cxx
+++ b/vcl/source/uitest/uitest.cxx
@@ -12,8 +12,6 @@
#include <vcl/dialog.hxx>
-#include "uitest/factory.hxx"
-
#include "svdata.hxx"
#include <comphelper/dispatchcommand.hxx>
@@ -32,9 +30,11 @@ std::unique_ptr<UIObject> UITest::getFocusTopWindow()
ImplSVWinData& rWinData = pSVData->maWinData;
if (rWinData.mpLastExecuteDlg)
- return UITestWrapperFactory::createObject(rWinData.mpLastExecuteDlg.get());
+ {
+ rWinData.mpLastExecuteDlg->GetUITestFactory()(rWinData.mpLastExecuteDlg);
+ }
- return UITestWrapperFactory::createObject(rWinData.mpFirstFrame.get());
+ return rWinData.mpFirstFrame->GetUITestFactory()(rWinData.mpFirstFrame);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index b7c158a5bd8a..b7ce704e4b4b 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -49,6 +49,7 @@
#include <vcl/msgbox.hxx>
#include <vcl/unowrap.hxx>
#include <vcl/settings.hxx>
+#include <uitest/uiobject_impl.hxx>
#include <salframe.hxx>
#include <iostream>
@@ -1182,6 +1183,11 @@ bool Dialog::set_property(const OString &rKey, const OString &rValue)
return true;
}
+FactoryFunction Dialog::GetUITestFactory() const
+{
+ return DialogUIObject::create;
+}
+
VclBuilderContainer::VclBuilderContainer()
: m_pUIBuilder(nullptr)
{
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index d465adb3aab2..92a86e486263 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3785,6 +3785,11 @@ const OUString& Window::get_id() const
return mpWindowImpl->maID;
}
+FactoryFunction Window::GetUITestFactory() const
+{
+ return WindowUIObject::create;
+}
+
} /* namespace vcl */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */