include/sfx2/tabdlg.hxx             |    3 
 include/vcl/button.hxx              |   21 ---
 include/vcl/combobox.hxx            |    2 
 include/vcl/dialog.hxx              |    2 
 include/vcl/edit.hxx                |    2 
 include/vcl/lstbox.hxx              |    2 
 include/vcl/spinfld.hxx             |    2 
 include/vcl/tabctrl.hxx             |    2 
 include/vcl/uitest/factory.hxx      |   23 +++
 include/vcl/uitest/uiobject.hxx     |  238 ++++++++++++++++++++++++++++++++++++
 include/vcl/window.hxx              |    3 
 sfx2/Library_sfx.mk                 |    1 
 sfx2/inc/uitest/sfx_uiobject.hxx    |   41 ++++++
 sfx2/source/dialog/tabdlg.cxx       |    7 +
 sfx2/source/uitest/sfx_uiobject.cxx |   95 ++++++++++++++
 uitest/demo_ui/tabdialog.py         |   49 +++++++
 vcl/Library_vcl.mk                  |    1 
 vcl/inc/uitest/factory.hxx          |   27 ----
 vcl/inc/uitest/uiobject_impl.hxx    |  230 ----------------------------------
 vcl/source/control/button.cxx       |   11 +
 vcl/source/control/combobox.cxx     |    6 
 vcl/source/control/edit.cxx         |    6 
 vcl/source/control/listbox.cxx      |    6 
 vcl/source/control/spinfld.cxx      |    6 
 vcl/source/control/tabctrl.cxx      |   12 +
 vcl/source/uitest/factory.cxx       |  122 ------------------
 vcl/source/uitest/uiobject.cxx      |   68 +++++++++-
 vcl/source/uitest/uitest.cxx        |    8 -
 vcl/source/window/dialog.cxx        |    6 
 vcl/source/window/window.cxx        |   24 ++-
 30 files changed, 610 insertions(+), 416 deletions(-)

New commits:
commit 3c05f49da80f19756f1586000077a05884ed00c0
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Thu Mar 31 06:11:29 2016 +0200

    uitest: add demo for tabdialog handling
    
    Change-Id: I217fb4a5fb1a8743def4e76522f90f0ee6a17917

diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py
new file mode 100644
index 0000000..ef62bf9
--- /dev/null
+++ b/uitest/demo_ui/tabdialog.py
@@ -0,0 +1,49 @@
+# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 
*/
+#
+# 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/.
+#
+
+from uitest_helper import UITest
+
+from helper import mkPropertyValues
+
+import time
+
+def select_tab_page_pos(xContext):
+    xUITest = xContext.ServiceManager.createInstanceWithContext(
+            "org.libreoffice.uitest.UITest", xContext)
+
+    ui_test = UITest(xUITest, xContext)
+
+    ui_test.create_doc_in_start_center("calc")
+
+    ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+    xCellsDlg = xUITest.getTopFocusWindow()
+
+    props = {"POS": "1"}
+    propsUNO = mkPropertyValues(props)
+    xCellsDlg.executeAction("SELECT", propsUNO)
+
+    time.sleep(20)
+
+def select_tab_page_name(xContext):
+    xUITest = xContext.ServiceManager.createInstanceWithContext(
+            "org.libreoffice.uitest.UITest", xContext)
+
+    ui_test = UITest(xUITest, xContext)
+
+    ui_test.create_doc_in_start_center("calc")
+
+    ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+    xCellsDlg = xUITest.getTopFocusWindow()
+
+    props = {"NAME": "Borders"}
+    propsUNO = mkPropertyValues(props)
+    xCellsDlg.executeAction("SELECT", propsUNO)
+
+    time.sleep(20)
+
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 14df2ac2d3689c082e1ef8ed6c10fbf15c23013c
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Thu Mar 31 06:10:50 2016 +0200

    uitest: support selecting different tab pages in tab dialog
    
    Change-Id: I541f83a87f5f3d459b2baf4587b76cb2fce5d5fc

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 441762c..36c4f34 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -60,6 +60,7 @@ class SFX2_DLLPUBLIC SfxTabDialog : public TabDialog
 private:
 friend class SfxTabPage;
 friend class SfxTabDialogController;
+friend class SfxTabDialogUIObject;
 
     VclPtr<VclBox>     m_pBox;
     VclPtr<TabControl> m_pTabCtrl;
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 2f0b1d9..ba6fc16 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -189,6 +189,8 @@ public:
         mbLayoutDirty = true;
     }
 
+    std::vector<sal_uInt16> GetPageIDs() const;
+
     virtual void queue_resize(StateChangedType eReason = 
StateChangedType::Layout) override;
 };
 
diff --git a/sfx2/source/uitest/sfx_uiobject.cxx 
b/sfx2/source/uitest/sfx_uiobject.cxx
index 138e485..1f41627 100644
--- a/sfx2/source/uitest/sfx_uiobject.cxx
+++ b/sfx2/source/uitest/sfx_uiobject.cxx
@@ -25,16 +25,53 @@ StringMap SfxTabDialogUIObject::get_state()
 {
     StringMap aMap = WindowUIObject::get_state();
     sal_uInt16 nPageId = mxTabDialog->GetCurPageId();
+    std::vector<sal_uInt16> aPageIds = mxTabDialog->m_pTabCtrl->GetPageIDs();
+    OUString aStrIds;
+    OUString aStrNames;
+    for (auto itr = aPageIds.begin(), itrEnd = aPageIds.end();
+            itr != itrEnd; ++itr)
+    {
+        aStrIds = aStrIds + OUString::number(*itr) + ";";
+        aStrNames = aStrNames + mxTabDialog->GetPageText(*itr) + ";";
+    }
+
+    aMap["PageIds"] = aStrIds;
+    aMap["PageNames"] = aStrNames;
     aMap["CurrentPageID"] = OUString::number(nPageId);
     aMap["CurrentPageText"] = mxTabDialog->GetPageText(nPageId);
     return aMap;
 }
 
 void SfxTabDialogUIObject::execute(const OUString& rAction,
-        const StringMap& /*rParameters*/)
+        const StringMap& rParameters)
 {
     if (rAction == "SELECT")
     {
+        if (rParameters.find("POS") != rParameters.end())
+        {
+            auto itr = rParameters.find("POS");
+            sal_uInt32 nPos = itr->second.toUInt32();
+            std::vector<sal_uInt16> aIds = 
mxTabDialog->m_pTabCtrl->GetPageIDs();
+            sal_uInt16 nPageId = aIds[nPos];
+            mxTabDialog->ShowPage(nPageId);
+        }
+        else if (rParameters.find("NAME") != rParameters.end())
+        {
+            auto itr = rParameters.find("NAME");
+            OUString aName = itr->second;
+            std::vector<sal_uInt16> aIds = 
mxTabDialog->m_pTabCtrl->GetPageIDs();
+            auto it = aIds.begin(), itEnd = aIds.end();
+            for (; it != itEnd; ++it)
+            {
+                if (mxTabDialog->GetPageText(*it) == aName)
+                    break;
+            }
+
+            if (it == aIds.end())
+                return;
+
+            mxTabDialog->ShowPage(*it);
+        }
     }
 }
 
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 38199eb..e796e5d 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2175,4 +2175,16 @@ void TabControl::queue_resize(StateChangedType eReason)
     Window::queue_resize(eReason);
 }
 
+std::vector<sal_uInt16> TabControl::GetPageIDs() const
+{
+    std::vector<sal_uInt16> aIDs;
+    for (auto itr = mpTabCtrlData->maItemList.begin(), itrEnd = 
mpTabCtrlData->maItemList.end();
+            itr != itrEnd; ++itr)
+    {
+        aIDs.push_back(itr->mnId);
+    }
+
+    return aIDs;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9ec00d2147412426366d1a3792c860e14a1e8ab1
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Thu Mar 31 06:10:26 2016 +0200

    fix bug in the uitesting framework
    
    Change-Id: I2f2b766c315403810f8446231d852345b837d633

diff --git a/vcl/source/uitest/uitest.cxx b/vcl/source/uitest/uitest.cxx
index 85711ac..da4f9fe 100644
--- a/vcl/source/uitest/uitest.cxx
+++ b/vcl/source/uitest/uitest.cxx
@@ -31,7 +31,7 @@ std::unique_ptr<UIObject> UITest::getFocusTopWindow()
 
     if (rWinData.mpLastExecuteDlg)
     {
-        
rWinData.mpLastExecuteDlg->GetUITestFactory()(rWinData.mpLastExecuteDlg);
+        return 
rWinData.mpLastExecuteDlg->GetUITestFactory()(rWinData.mpLastExecuteDlg);
     }
 
     return rWinData.mpFirstFrame->GetUITestFactory()(rWinData.mpFirstFrame);
commit 1ca1fd91fe3ef58f04658049015360008d83be2a
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Wed Mar 30 23:50:23 2016 +0200

    some small improvements for the TabDialog wrapper
    
    Change-Id: I1ab984859a88119aab56e34388078dbfb83d41ef

diff --git a/sfx2/inc/uitest/sfx_uiobject.hxx b/sfx2/inc/uitest/sfx_uiobject.hxx
index bee5a20..9a92772 100644
--- a/sfx2/inc/uitest/sfx_uiobject.hxx
+++ b/sfx2/inc/uitest/sfx_uiobject.hxx
@@ -32,6 +32,10 @@ public:
     virtual UIObjectType get_type() const override;
 
     static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+protected:
+
+    virtual OUString get_name() const override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/uitest/sfx_uiobject.cxx 
b/sfx2/source/uitest/sfx_uiobject.cxx
index 6cb6a23..138e485 100644
--- a/sfx2/source/uitest/sfx_uiobject.cxx
+++ b/sfx2/source/uitest/sfx_uiobject.cxx
@@ -23,7 +23,11 @@ SfxTabDialogUIObject::~SfxTabDialogUIObject()
 
 StringMap SfxTabDialogUIObject::get_state()
 {
-    return WindowUIObject::get_state();
+    StringMap aMap = WindowUIObject::get_state();
+    sal_uInt16 nPageId = mxTabDialog->GetCurPageId();
+    aMap["CurrentPageID"] = OUString::number(nPageId);
+    aMap["CurrentPageText"] = mxTabDialog->GetPageText(nPageId);
+    return aMap;
 }
 
 void SfxTabDialogUIObject::execute(const OUString& rAction,
@@ -31,7 +35,6 @@ void SfxTabDialogUIObject::execute(const OUString& rAction,
 {
     if (rAction == "SELECT")
     {
-
     }
 }
 
@@ -47,4 +50,9 @@ std::unique_ptr<UIObject> 
SfxTabDialogUIObject::create(vcl::Window* pWindow)
     return std::unique_ptr<UIObject>(new SfxTabDialogUIObject(pDialog));
 }
 
+OUString SfxTabDialogUIObject::get_name() const
+{
+    return OUString("SfxTabDialogUIObject");
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 106ac864a26a21f0162e2e7d67a3a10315e25662
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Wed Mar 30 23:43:39 2016 +0200

    don't use WindowUIObject if not necessary
    
    Change-Id: Iff31ce674651cb2a6150dd9a0822bfbf8f0b5aea

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 38df949..531d003 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1835,18 +1835,18 @@ void Window::KeyInput( const KeyEvent& rKEvt )
 
     if (cod.IsShift() && cod.IsMod1() && cod.GetCode() == KEY_F12)
     {
-        WindowUIObject aObject(this);
-        aObject.dumpState();
+        std::unique_ptr<UIObject> pObject = GetUITestFactory()(this);
+        pObject->dumpState();
 
         StringMap aMap;
         aMap["TEXT"] = "asd%3";
-        aObject.execute("TYPE", aMap);
+        pObject->execute("TYPE", aMap);
     }
 
     if (cod.IsShift() && cod.IsMod1() && cod.GetCode() == KEY_F10)
     {
-        WindowUIObject aObject(this);
-        std::unique_ptr<UIObject> pCancelBtn = aObject.get_child("edit");
+        std::unique_ptr<UIObject> pObject = GetUITestFactory()(this);
+        std::unique_ptr<UIObject> pCancelBtn = pObject->get_child("edit");
         StringMap aMap;
         aMap["TEXT"] = "asd%3";
         pCancelBtn->execute("SET", aMap);
@@ -1855,8 +1855,8 @@ void Window::KeyInput( const KeyEvent& rKEvt )
 
     if (cod.IsShift() && cod.IsMod1() && cod.GetCode() == KEY_F11)
     {
-        WindowUIObject aObject(this);
-        aObject.dumpHierarchy();
+        std::unique_ptr<UIObject> pObject = GetUITestFactory()(this);
+        pObject->dumpHierarchy();
     }
 
     if (cod.IsShift() && cod.IsMod1() && cod.GetCode() == KEY_F9)
commit 96fc86e37f8253ce231126699c5135d8ec3f0d62
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Wed Mar 30 23:43:10 2016 +0200

    fix wrong factory function for checkboxes
    
    Change-Id: I6392fbf162869c400a9f992e64a145f3bea8f2bc

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index bfcb215..ce4e8c0 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -3803,7 +3803,7 @@ void CheckBox::ShowFocus(const Rectangle& rRect)
 
 FactoryFunction CheckBox::GetUITestFactory() const
 {
-    return EditUIObject::create;
+    return CheckBoxUIObject::create;
 }
 
 ImageButton::ImageButton( vcl::Window* pParent, WinBits nStyle ) :
commit 5e8dd8fe96ce5853e8e77f158a151152a81221f4
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Wed Mar 30 05:27:54 2016 +0200

    move the declaration for the uitesting wrapper objects to public inc dir
    
    This allows non-vcl wrapper objects to inherit from the vcl base
    classes. This is especially important for the WindowUIObject base class
    object.
    
    Change-Id: I91ef69839ff4c031d3bcd21d70b4b9e7d62ad572

diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 855cac3..e7b104d 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -87,4 +87,242 @@ public:
     virtual void dumpHierarchy() const;
 };
 
+class TabPage;
+class ComboBox;
+class SpinButton;
+class SpinField;
+class Edit;
+class Dialog;
+class Button;
+class CheckBox;
+class ListBox;
+
+class UITEST_DLLPUBLIC WindowUIObject : public UIObject
+{
+    VclPtr<vcl::Window> mxWindow;
+
+public:
+
+    WindowUIObject(VclPtr<vcl::Window> xWindow);
+
+    virtual StringMap get_state() override;
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    virtual UIObjectType get_type() const override;
+
+    virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
+
+    virtual void dumpState() const override;
+
+    virtual void dumpHierarchy() const override;
+
+    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+protected:
+
+    virtual OUString get_name() const;
+
+};
+
+// TODO: moggi: what about push buttons?
+class UITEST_DLLPUBLIC ButtonUIObject : public WindowUIObject
+{
+    VclPtr<Button> mxButton;
+public:
+
+    ButtonUIObject(VclPtr<Button> xButton);
+
+    virtual StringMap get_state() override;
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    virtual UIObjectType get_type() const override;
+
+    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+protected:
+
+    virtual OUString get_name() const override;
+};
+
+class UITEST_DLLPUBLIC DialogUIObject : public WindowUIObject
+{
+    VclPtr<Dialog> mxDialog;
+
+public:
+
+    DialogUIObject(VclPtr<Dialog> xDialog);
+
+    virtual UIObjectType get_type() const override;
+
+    virtual StringMap get_state() override;
+
+    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+protected:
+
+    virtual OUString get_name() const override;
+};
+
+class UITEST_DLLPUBLIC EditUIObject : public WindowUIObject
+{
+    VclPtr<Edit> mxEdit;
+
+public:
+
+    EditUIObject(VclPtr<Edit> xEdit);
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    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;
+};
+
+// TODO: moggi: maybe let it inherit from the button case
+class UITEST_DLLPUBLIC CheckBoxUIObject : public WindowUIObject
+{
+private:
+    VclPtr<CheckBox> mxCheckBox;
+
+public:
+    CheckBoxUIObject(VclPtr<CheckBox> xCheckbox);
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    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;
+};
+
+class UITEST_DLLPUBLIC TabPageUIObject : public WindowUIObject
+{
+private:
+    VclPtr<TabPage> mxTabPage;
+public:
+    TabPageUIObject(VclPtr<TabPage> xTabPage);
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    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;
+};
+
+class UITEST_DLLPUBLIC ListBoxUIObject : public WindowUIObject
+{
+private:
+    VclPtr<ListBox> mxListBox;
+
+public:
+
+    ListBoxUIObject(VclPtr<ListBox> xListBox);
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    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;
+};
+
+// TODO: moggi: should it inherit from EditUIObject?
+class UITEST_DLLPUBLIC ComboBoxUIObject : public WindowUIObject
+{
+private:
+    VclPtr<ComboBox> mxComboBox;
+
+public:
+
+    ComboBoxUIObject(VclPtr<ComboBox> xListBox);
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    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;
+};
+
+class UITEST_DLLPUBLIC SpinUIObject : public WindowUIObject
+{
+private:
+    VclPtr<SpinButton> mxSpinButton;
+
+public:
+
+    SpinUIObject(VclPtr<SpinButton> xSpinButton);
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    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;
+};
+
+class UITEST_DLLPUBLIC SpinFieldUIObject : public EditUIObject
+{
+    VclPtr<SpinField> mxSpinField;
+
+public:
+
+    SpinFieldUIObject(VclPtr<SpinField> xEdit);
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    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;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/uitest/sfx_uiobject.hxx b/sfx2/inc/uitest/sfx_uiobject.hxx
index 6d77a5d..bee5a20 100644
--- a/sfx2/inc/uitest/sfx_uiobject.hxx
+++ b/sfx2/inc/uitest/sfx_uiobject.hxx
@@ -12,7 +12,7 @@
 
 class SfxTabDialog;
 
-class SfxTabDialogUIObject : public UIObject
+class SfxTabDialogUIObject : public WindowUIObject
 {
 private:
 
diff --git a/sfx2/source/uitest/sfx_uiobject.cxx 
b/sfx2/source/uitest/sfx_uiobject.cxx
index d427987..6cb6a23 100644
--- a/sfx2/source/uitest/sfx_uiobject.cxx
+++ b/sfx2/source/uitest/sfx_uiobject.cxx
@@ -12,6 +12,7 @@
 #include <sfx2/tabdlg.hxx>
 
 SfxTabDialogUIObject::SfxTabDialogUIObject(VclPtr<SfxTabDialog> xTabDialog):
+    WindowUIObject(xTabDialog),
     mxTabDialog(xTabDialog)
 {
 }
@@ -22,16 +23,21 @@ SfxTabDialogUIObject::~SfxTabDialogUIObject()
 
 StringMap SfxTabDialogUIObject::get_state()
 {
+    return WindowUIObject::get_state();
 }
 
-void SfxTabDialogUIObject::execute(const OUString& /*rAction*/,
+void SfxTabDialogUIObject::execute(const OUString& rAction,
         const StringMap& /*rParameters*/)
 {
+    if (rAction == "SELECT")
+    {
 
+    }
 }
 
 UIObjectType SfxTabDialogUIObject::get_type() const
 {
+    return UIObjectType::DIALOG;
 }
 
 std::unique_ptr<UIObject> SfxTabDialogUIObject::create(vcl::Window* pWindow)
diff --git a/vcl/inc/uitest/uiobject_impl.hxx b/vcl/inc/uitest/uiobject_impl.hxx
deleted file mode 100644
index f0843a7..0000000
--- a/vcl/inc/uitest/uiobject_impl.hxx
+++ /dev/null
@@ -1,250 +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/uiobject.hxx>
-
-class TabPage;
-class ComboBox;
-class SpinButton;
-class SpinField;
-class Edit;
-class Dialog;
-class Button;
-class CheckBox;
-class ListBox;
-
-class WindowUIObject : public UIObject
-{
-    VclPtr<vcl::Window> mxWindow;
-
-public:
-
-    WindowUIObject(VclPtr<vcl::Window> xWindow);
-
-    virtual StringMap get_state() override;
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    virtual UIObjectType get_type() const override;
-
-    virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
-
-    virtual void dumpState() const override;
-
-    virtual void dumpHierarchy() const override;
-
-    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
-
-protected:
-
-    virtual OUString get_name() const;
-
-};
-
-// TODO: moggi: what about push buttons?
-class ButtonUIObject : public WindowUIObject
-{
-    VclPtr<Button> mxButton;
-public:
-
-    ButtonUIObject(VclPtr<Button> xButton);
-
-    virtual StringMap get_state() override;
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    virtual UIObjectType get_type() const override;
-
-    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
-
-protected:
-
-    virtual OUString get_name() const override;
-};
-
-class DialogUIObject : public WindowUIObject
-{
-    VclPtr<Dialog> mxDialog;
-
-public:
-
-    DialogUIObject(VclPtr<Dialog> xDialog);
-
-    virtual UIObjectType get_type() const override;
-
-    virtual StringMap get_state() override;
-
-    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
-
-protected:
-
-    virtual OUString get_name() const override;
-};
-
-class EditUIObject : public WindowUIObject
-{
-    VclPtr<Edit> mxEdit;
-
-public:
-
-    EditUIObject(VclPtr<Edit> xEdit);
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    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;
-};
-
-// TODO: moggi: maybe let it inherit from the button case
-class CheckBoxUIObject : public WindowUIObject
-{
-private:
-    VclPtr<CheckBox> mxCheckBox;
-
-public:
-    CheckBoxUIObject(VclPtr<CheckBox> xCheckbox);
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    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;
-};
-
-class TabPageUIObject : public WindowUIObject
-{
-private:
-    VclPtr<TabPage> mxTabPage;
-public:
-    TabPageUIObject(VclPtr<TabPage> xTabPage);
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    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;
-};
-
-class ListBoxUIObject : public WindowUIObject
-{
-private:
-    VclPtr<ListBox> mxListBox;
-
-public:
-
-    ListBoxUIObject(VclPtr<ListBox> xListBox);
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    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;
-};
-
-// TODO: moggi: should it inherit from EditUIObject?
-class ComboBoxUIObject : public WindowUIObject
-{
-private:
-    VclPtr<ComboBox> mxComboBox;
-
-public:
-
-    ComboBoxUIObject(VclPtr<ComboBox> xListBox);
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    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;
-};
-
-class SpinUIObject : public WindowUIObject
-{
-private:
-    VclPtr<SpinButton> mxSpinButton;
-
-public:
-
-    SpinUIObject(VclPtr<SpinButton> xSpinButton);
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    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;
-};
-
-class SpinFieldUIObject : public EditUIObject
-{
-    VclPtr<SpinField> mxSpinField;
-
-public:
-
-    SpinFieldUIObject(VclPtr<SpinField> xEdit);
-
-    virtual void execute(const OUString& rAction,
-            const StringMap& rParameters) override;
-
-    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;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 22b2cc3..bfcb215 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -36,7 +36,7 @@
 #include <vcl/edit.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/vclstatuslistener.hxx>
-#include <uitest/uiobject_impl.hxx>
+#include <vcl/uitest/uiobject.hxx>
 
 #include <svids.hrc>
 #include <svdata.hxx>
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index c365553..f34704c 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -29,7 +29,7 @@
 #include <vcl/button.hxx>
 #include <vcl/event.hxx>
 #include <vcl/settings.hxx>
-#include <uitest/uiobject_impl.hxx>
+#include <vcl/uitest/uiobject.hxx>
 
 #include <svdata.hxx>
 #include "listbox.hxx"
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index a496694..6180eae 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -27,7 +27,7 @@
 #include <vcl/layout.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
-#include <uitest/uiobject_impl.hxx>
+#include <vcl/uitest/uiobject.hxx>
 
 #include <window.h>
 #include <svdata.hxx>
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index a55bdda..a304a9b 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -29,7 +29,7 @@
 #include <vcl/lstbox.hxx>
 #include <vcl/combobox.hxx>
 #include <vcl/settings.hxx>
-#include <uitest/uiobject_impl.hxx>
+#include <vcl/uitest/uiobject.hxx>
 
 #include "svdata.hxx"
 #include "controldata.hxx"
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index b207e9f..2451f4a 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -23,7 +23,7 @@
 #include <vcl/decoview.hxx>
 #include <vcl/spinfld.hxx>
 #include <vcl/settings.hxx>
-#include <uitest/uiobject_impl.hxx>
+#include <vcl/uitest/uiobject.hxx>
 
 #include "controldata.hxx"
 #include "spin.hxx"
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index f994833..173a05a 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "uitest/uiobject_impl.hxx"
+#include <vcl/uitest/uiobject.hxx>
 
 #include <vcl/event.hxx>
 #include <vcl/tabpage.hxx>
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index d8d44e9..98098a9 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -49,7 +49,7 @@
 #include <vcl/msgbox.hxx>
 #include <vcl/unowrap.hxx>
 #include <vcl/settings.hxx>
-#include <uitest/uiobject_impl.hxx>
+#include <vcl/uitest/uiobject.hxx>
 #include <salframe.hxx>
 
 #include <iostream>
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b158192..38df949 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -44,7 +44,7 @@
 #include <vcl/settings.hxx>
 #include <vcl/sysdata.hxx>
 
-#include "uitest/uiobject_impl.hxx"
+#include <vcl/uitest/uiobject.hxx>
 #include <vcl/uitest/uitest.hxx>
 
 #include <salframe.hxx>
commit 63af82e9d210f8ce32438f483aa9f6dfef88cb48
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Wed Mar 30 05:14:50 2016 +0200

    a slightly better approach for the factory problem in the ui testing
    
    Change-Id: I15dbf2446791c4be9be4e18e63c0d03104d8d405

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index b328ccb..441762c 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -198,6 +198,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 406dc26..5659729 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 77754b7..eae92eb 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -182,6 +182,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 3aa38f5..3006be1 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 57a8e07..fdcf365 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -275,6 +275,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 09067d2..098bc8b 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -275,6 +275,8 @@ public:
     void EnableQuickSelection( const 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 bd1375a..f334643 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 2e80449..da645f3 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 8371d23..f9b583b 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>
@@ -1567,6 +1568,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 ce65f19..b10a95f 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 b2d298f..0000000
--- 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 2452db7..79e9873 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"
@@ -332,13 +332,6 @@ SfxTabDialog::SfxTabDialog
     , pExampleSet(nullptr)
 {
     Init_Impl(bEditFmt);
-
-    static bool bRegisterUITest = false;
-    if (!bRegisterUITest)
-    {
-        SfxUITestFactory::registerSfxTabDialog();
-        bRegisterUITest = true;
-    }
 }
 
 
@@ -1349,4 +1342,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 4479437..0000000
--- 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 590ffd3..d427987 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 4d85855..63da54f 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -400,7 +400,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 7018a19..0000000
--- 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 3bac973..f0843a7 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 22e325c..22b2cc3 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>
@@ -622,6 +623,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)
@@ -3795,6 +3801,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 6b54142..c365553 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"
@@ -1565,4 +1566,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 9dab058..a496694 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>
@@ -3058,4 +3059,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 c2f50bc..a55bdda 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"
@@ -1504,6 +1505,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 c8a601d..b207e9f 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 31b0362..0000000
--- 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 23122c8..f994833 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 5645381..85711ac 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 683eefe..d8d44e9 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>
@@ -1186,6 +1187,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 41269b8..b158192 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3856,6 +3856,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: */
commit 28752cb60f299dfb659c7ff4412f181efd0cf910
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Wed Mar 30 05:14:16 2016 +0200

    remove excessive whitespace
    
    Change-Id: I184da822985b21e3c4f8157c585b2d0f83770d12

diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index e6eb446..406dc26 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -37,7 +37,6 @@ class UserDrawEvent;
 class ImplCommonButtonData;
 enum class DrawButtonFlags;
 
-
 class VCL_DLLPUBLIC Button : public Control
 {
 private:
@@ -103,7 +102,6 @@ protected:
     DECL_STATIC_LINK_TYPED(Button, dispatchCommandHandler, Button*, void);
 };
 
-
 enum class PushButtonDropdownStyle
 {
     NONE            = 0x0000,
@@ -111,7 +109,6 @@ enum class PushButtonDropdownStyle
     MenuButton      = 0x0002,
 };
 
-
 class VCL_DLLPUBLIC PushButton : public Button
 {
 protected:
@@ -202,19 +199,16 @@ public:
     virtual void    ShowFocus(const Rectangle& rRect) override;
 };
 
-
 inline void PushButton::Check( bool bCheck )
 {
     SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE );
 }
 
-
 inline bool PushButton::IsChecked() const
 {
     return (GetState() == TRISTATE_TRUE);
 }
 
-
 class VCL_DLLPUBLIC OKButton : public PushButton
 {
 protected:
@@ -231,7 +225,6 @@ public:
     virtual void    Click() override;
 };
 
-
 class VCL_DLLPUBLIC CancelButton : public PushButton
 {
 protected:
@@ -248,14 +241,12 @@ public:
     virtual void    Click() override;
 };
 
-
 class VCL_DLLPUBLIC CloseButton : public CancelButton
 {
 public:
     explicit CloseButton(vcl::Window* pParent, WinBits nStyle = 0);
 };
 
-
 class VCL_DLLPUBLIC HelpButton : public PushButton
 {
 protected:
@@ -272,7 +263,6 @@ public:
     virtual void    Click() override;
 };
 
-
 class VCL_DLLPUBLIC RadioButton : public Button
 {
 private:
@@ -398,7 +388,6 @@ public:
     virtual void ShowFocus(const Rectangle& rRect) override;
 };
 
-
 class VCL_DLLPUBLIC CheckBox : public Button
 {
 private:
@@ -493,13 +482,11 @@ inline void CheckBox::Check( bool bCheck )
     SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE );
 }
 
-
 inline bool CheckBox::IsChecked() const
 {
     return (GetState() == TRISTATE_TRUE);
 }
 
-
 class VCL_DLLPUBLIC ImageButton : public PushButton
 {
 protected:
@@ -516,7 +503,6 @@ public:
                  ImageButton( vcl::Window* pParent, const ResId& rResId );
 };
 
-
 class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
 {
                     ImageRadioButton( const ImageRadioButton & ) = delete;
@@ -526,7 +512,6 @@ public:
     explicit        ImageRadioButton( vcl::Window* pParent, WinBits nStyle = 0 
);
 };
 
-
 class VCL_DLLPUBLIC TriStateBox : public CheckBox
 {
                     TriStateBox( const TriStateBox & ) = delete;
@@ -536,7 +521,6 @@ public:
     explicit        TriStateBox( vcl::Window* pParent, WinBits nStyle = 0 );
 };
 
-
 class VCL_DLLPUBLIC DisclosureButton : public CheckBox
 {
 protected:
commit 856b9ca918604fa73001a1a315ee504c84792679
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Tue Mar 29 15:32:33 2016 +0200

    work on supporting ui objects in sfx2 for uitesting
    
    Change-Id: I693fe9cf697701a8cde5b78c382982c852ae7dfa

diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 5ab2bb3..ce65f19 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -286,6 +286,8 @@ $(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 \
     sfx2/source/view/frame \
diff --git a/sfx2/inc/uitest/sfx_uiobject.hxx b/sfx2/inc/uitest/sfx_uiobject.hxx
new file mode 100644
index 0000000..6d77a5d
--- /dev/null
+++ b/sfx2/inc/uitest/sfx_uiobject.hxx
@@ -0,0 +1,37 @@
+/* -*- 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/uiobject.hxx>
+#include <memory>
+
+class SfxTabDialog;
+
+class SfxTabDialogUIObject : public UIObject
+{
+private:
+
+    VclPtr<SfxTabDialog> mxTabDialog;
+
+public:
+
+    SfxTabDialogUIObject(VclPtr<SfxTabDialog> xTabDialog);
+
+    virtual ~SfxTabDialogUIObject();
+
+    virtual StringMap get_state() override;
+
+    virtual void execute(const OUString& rAction,
+            const StringMap& rParameters) override;
+
+    virtual UIObjectType get_type() const override;
+
+    static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/uitest/uitest_factory.hxx 
b/sfx2/inc/uitest/uitest_factory.hxx
new file mode 100644
index 0000000..b2d298f
--- /dev/null
+++ b/sfx2/inc/uitest/uitest_factory.hxx
@@ -0,0 +1,21 @@
+/* -*- 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 1780f84..2452db7 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -37,6 +37,8 @@
 #include <sfx2/sfxdlg.hxx>
 #include <sfx2/itemconnect.hxx>
 
+#include "uitest/uitest_factory.hxx"
+
 #include "dialog.hrc"
 #include "helpid.hrc"
 
@@ -330,6 +332,13 @@ SfxTabDialog::SfxTabDialog
     , pExampleSet(nullptr)
 {
     Init_Impl(bEditFmt);
+
+    static bool bRegisterUITest = false;
+    if (!bRegisterUITest)
+    {
+        SfxUITestFactory::registerSfxTabDialog();
+        bRegisterUITest = true;
+    }
 }
 
 
diff --git a/sfx2/source/uitest/factory.cxx b/sfx2/source/uitest/factory.cxx
new file mode 100644
index 0000000..4479437
--- /dev/null
+++ b/sfx2/source/uitest/factory.cxx
@@ -0,0 +1,26 @@
+/* -*- 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
new file mode 100644
index 0000000..590ffd3
--- /dev/null
+++ b/sfx2/source/uitest/sfx_uiobject.cxx
@@ -0,0 +1,49 @@
+/* -*- 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/sfx_uiobject.hxx>
+
+#include <sfx2/tabdlg.hxx>
+
+SfxTabDialogUIObject::SfxTabDialogUIObject(VclPtr<SfxTabDialog> xTabDialog):
+    mxTabDialog(xTabDialog)
+{
+}
+
+SfxTabDialogUIObject::~SfxTabDialogUIObject()
+{
+}
+
+StringMap SfxTabDialogUIObject::get_state()
+{
+}
+
+void SfxTabDialogUIObject::execute(const OUString& /*rAction*/,
+        const StringMap& /*rParameters*/)
+{
+
+}
+
+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;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1b5e71fe800c32adc3f6b3dc5e6d6daf0f8a2bf7
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Tue Mar 29 05:20:33 2016 +0200

    provide a way for non-vcl modules to register factories
    
    There are still two huge problems around my approach. It still requires
    to add some code to the existing widget class so that it registers the
    UI object wrapper. And secondly I have not yet solved the problem of
    longer inheritance hierarchies. E.g. A <- B <- C.
    
    However it is a first version that allows for now to extend the UI
    testing code into other places. I'm soon moving the header for the
    ui objects to the public include so that all objects can inherit from
    the basic vcl wrapper objects.
    
    Change-Id: Ifac9d635b4a68737048f50cd2a9d3e8830b165a5

diff --git a/include/vcl/uitest/factory.hxx b/include/vcl/uitest/factory.hxx
new file mode 100644
index 0000000..2e80449
--- /dev/null
+++ b/include/vcl/uitest/factory.hxx
@@ -0,0 +1,29 @@
+/* -*- 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/dllapi.h>
+
+#include <tools/wintypes.hxx>
+
+#include <memory>
+#include <functional>
+
+namespace vcl {
+
+class Window;
+
+}
+
+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/vcl/inc/uitest/factory.hxx b/vcl/inc/uitest/factory.hxx
index d519d9a..7018a19 100644
--- a/vcl/inc/uitest/factory.hxx
+++ b/vcl/inc/uitest/factory.hxx
@@ -7,7 +7,12 @@
  * 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
 {
@@ -22,6 +27,8 @@ 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/source/uitest/factory.cxx b/vcl/source/uitest/factory.cxx
index ff5520c..31b0362 100644
--- a/vcl/source/uitest/factory.cxx
+++ b/vcl/source/uitest/factory.cxx
@@ -19,11 +19,26 @@
 #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:
commit 3973dfdd1776626825d5c95806d4c7ac7141ab33
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Tue Mar 29 05:19:13 2016 +0200

    use forward declarations
    
    Change-Id: I0c2680766e914601078030856e4d4098878be9b5

diff --git a/vcl/inc/uitest/uiobject_impl.hxx b/vcl/inc/uitest/uiobject_impl.hxx
index 4e86e34..3bac973 100644
--- a/vcl/inc/uitest/uiobject_impl.hxx
+++ b/vcl/inc/uitest/uiobject_impl.hxx
@@ -9,14 +9,15 @@
 
 #include <vcl/uitest/uiobject.hxx>
 
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/edit.hxx>
-
 class TabPage;
 class ComboBox;
 class SpinButton;
 class SpinField;
+class Edit;
+class Dialog;
+class Button;
+class CheckBox;
+class ListBox;
 
 class WindowUIObject : public UIObject
 {
diff --git a/vcl/source/uitest/factory.cxx b/vcl/source/uitest/factory.cxx
index beec042..ff5520c 100644
--- a/vcl/source/uitest/factory.cxx
+++ b/vcl/source/uitest/factory.cxx
@@ -15,6 +15,9 @@
 #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::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* 
pWindow)
 {
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 0d9c97a..23122c8 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -16,6 +16,9 @@
 #include <vcl/combobox.hxx>
 #include <vcl/spin.hxx>
 #include <vcl/spinfld.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
 
 #include <rtl/ustrbuf.hxx>
 
commit 091ef8be9a9f95698b1f0b15d52582e5dc00c776
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Tue Mar 29 01:16:12 2016 +0200

    let us not call getenv for each window
    
    Change-Id: I26c34e9fa4efa34ac47343b4c0894c23bba0c13f

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c48ba70..41269b8 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -746,7 +746,8 @@ WindowImpl::WindowImpl( WindowType nType )
     mbFill                              = true;
     mbSecondary                         = false;
     mbNonHomogeneous                    = false;
-    mbDoubleBufferingRequested = getenv("VCL_DOUBLEBUFFERING_FORCE_ENABLE"); 
// when we are not sure, assume it cannot do double-buffering via RenderContext
+    static bool bDoubleBuffer = getenv("VCL_DOUBLEBUFFERING_FORCE_ENABLE");
+    mbDoubleBufferingRequested = bDoubleBuffer; // when we are not sure, 
assume it cannot do double-buffering via RenderContext
 }
 
 WindowImpl::~WindowImpl()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to