diff options
-rw-r--r-- | sw/Library_sw.mk | 1 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin3.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/inc/edtwin.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/uiobject.hxx | 42 | ||||
-rw-r--r-- | sw/source/uibase/uitest/uiobject.cxx | 55 |
5 files changed, 106 insertions, 0 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 0555d166e478..ea8c36205f48 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -691,6 +691,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/table/chartins \ sw/source/uibase/table/swtablerep \ sw/source/uibase/table/tablemgr \ + sw/source/uibase/uitest/uiobject \ sw/source/uibase/uiview/formatclipboard \ sw/source/uibase/uiview/pview \ sw/source/uibase/uiview/scroll \ diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx index 745bbd4ca864..52c56de46ecb 100644 --- a/sw/source/uibase/docvw/edtwin3.cxx +++ b/sw/source/uibase/docvw/edtwin3.cxx @@ -34,6 +34,7 @@ #include "pagedesc.hxx" #include <frmatr.hxx> #include <editeng/frmdiritem.hxx> +#include "uiobject.hxx" // Core-Notify void ScrollMDI( SwViewShell* pVwSh, const SwRect &rRect, @@ -165,4 +166,9 @@ void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt ) pSh->UnlockPaint(); } +FactoryFunction SwEditWin::GetUITestFactory() const +{ + return SwEditWinUIObject::create; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index cc4d52800ffa..1b713de27748 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -307,6 +307,8 @@ public: void SetCursorTwipPosition(const Point& rPosition, bool bPoint, bool bClearMark); /// Allows starting or ending a graphic move or resize action. void SetGraphicTwipPosition(bool bStart, const Point& rPosition); + + virtual FactoryFunction GetUITestFactory() const override; }; #endif diff --git a/sw/source/uibase/inc/uiobject.hxx b/sw/source/uibase/inc/uiobject.hxx new file mode 100644 index 000000000000..568aa6c487d0 --- /dev/null +++ b/sw/source/uibase/inc/uiobject.hxx @@ -0,0 +1,42 @@ +/* -*- 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/. + */ + +#ifndef SW_SOURCE_UIBASE_INC_UIOBJECT_HXX +#define SW_SOURCE_UIBASE_INC_UIOBJECT_HXX + +#include <vcl/uitest/uiobject.hxx> + +class SwEditWin; + +class SwEditWinUIObject : public WindowUIObject +{ +public: + + SwEditWinUIObject(VclPtr<SwEditWin> xEditWin); + + virtual StringMap get_state() override; + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; + +private: + + VclPtr<SwEditWin> mxEditWin; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uitest/uiobject.cxx b/sw/source/uibase/uitest/uiobject.cxx new file mode 100644 index 000000000000..9d45be13910f --- /dev/null +++ b/sw/source/uibase/uitest/uiobject.cxx @@ -0,0 +1,55 @@ +/* -*- 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 "uiobject.hxx" +#include "edtwin.hxx" +#include "view.hxx" + +SwEditWinUIObject::SwEditWinUIObject(VclPtr<SwEditWin> xEditWin): + WindowUIObject(xEditWin), + mxEditWin(xEditWin) +{ +} + +StringMap SwEditWinUIObject::get_state() +{ + StringMap aMap = WindowUIObject::get_state(); + + // aMap["SelectedText"] = mxEditWin + return aMap; +} + +void SwEditWinUIObject::execute(const OUString& rAction, + const StringMap& rParameters) +{ + if (rAction == "SET") + { + if (rParameters.find("ZOOM") != rParameters.end()) + { + auto itr = rParameters.find("ZOOM"); + OUString aVal = itr->second; + sal_Int32 nVal = aVal.toInt32(); + mxEditWin->GetView().SetZoom(SvxZoomType::PERCENT, nVal); + } + } +} + +OUString SwEditWinUIObject::get_name() const +{ + return OUString("SwEditWinUIObject"); +} + +std::unique_ptr<UIObject> SwEditWinUIObject::create(vcl::Window* pWindow) +{ + SwEditWin* pEditWin = dynamic_cast<SwEditWin*>(pWindow); + assert(pEditWin); + return std::unique_ptr<UIObject>(new SwEditWinUIObject(pEditWin)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |