summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-25 00:16:45 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-25 00:18:49 +0200
commit6db92434c664116eb1ec6cb127f2cd957a03bb65 (patch)
tree4afc3b187cdb4df9acdbde677db489905df094c3
parentc931f3a5184928bc333796362a5616a93c6ed6d7 (diff)
uitest: add wrapper for special character window
Change-Id: I22acd9da3570e967f427207e242638f2bfd6ffb7
-rw-r--r--include/svx/charmap.hxx2
-rw-r--r--svx/Library_svx.mk1
-rw-r--r--svx/inc/uiobject.hxx34
-rw-r--r--svx/source/dialog/charmap.cxx7
-rw-r--r--svx/source/uitest/uiobject.cxx68
5 files changed, 112 insertions, 0 deletions
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index 5de50c73b30f..fbdf77c24041 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -74,6 +74,8 @@ public:
virtual void Resize() override;
+ virtual FactoryFunction GetUITestFactory() const override;
+
protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index c026002c2750..047eb9d7c40c 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -241,6 +241,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/tbxctrls/tbxcolor \
svx/source/tbxctrls/tbxdrctl \
svx/source/tbxctrls/verttexttbxctrl \
+ svx/source/uitest/uiobject \
svx/source/unodraw/recoveryui \
svx/source/unodraw/unoctabl \
svx/source/unodraw/UnoNamespaceMap \
diff --git a/svx/inc/uiobject.hxx b/svx/inc/uiobject.hxx
new file mode 100644
index 000000000000..2e90385cbcaa
--- /dev/null
+++ b/svx/inc/uiobject.hxx
@@ -0,0 +1,34 @@
+/* -*- 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 SvxShowCharSet;
+
+class SvxShowCharSetUIObject : WindowUIObject
+{
+ VclPtr<SvxShowCharSet> mxCharSet;
+
+public:
+
+ SvxShowCharSetUIObject(VclPtr<SvxShowCharSet> xCharSet);
+
+ 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:
+
+ OUString get_name() const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 3076debc8fd6..f214b0ddc070 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -33,6 +33,8 @@
#include <svx/svxdlg.hxx>
#include "charmapacc.hxx"
+#include "uiobject.hxx"
+
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -745,6 +747,11 @@ sal_Int32 SvxShowCharSet::getMaxCharCount() const
return mxFontCharMap->GetCharCount();
}
+FactoryFunction SvxShowCharSet::GetUITestFactory() const
+{
+ return SvxShowCharSetUIObject::create;
+}
+
// TODO: should be moved into Font Attributes stuff
// we let it mature here though because it is currently the only use
diff --git a/svx/source/uitest/uiobject.cxx b/svx/source/uitest/uiobject.cxx
new file mode 100644
index 000000000000..dc5db9e72ab9
--- /dev/null
+++ b/svx/source/uitest/uiobject.cxx
@@ -0,0 +1,68 @@
+/* -*- 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 <svx/charmap.hxx>
+
+SvxShowCharSetUIObject::SvxShowCharSetUIObject(VclPtr<SvxShowCharSet> xCharSet):
+ WindowUIObject(xCharSet),
+ mxCharSet(xCharSet)
+{
+}
+
+StringMap SvxShowCharSetUIObject::get_state()
+{
+ StringMap aMap = WindowUIObject::get_state();
+
+ return aMap;
+}
+
+void SvxShowCharSetUIObject::execute(const OUString& rAction,
+ const StringMap& rParameters)
+{
+ if (rAction == "SELECT")
+ {
+ if (rParameters.find("INDEX") != rParameters.end())
+ {
+ OUString aIndexStr = rParameters.find("INDEX")->second;
+
+ sal_Int32 nIndex = aIndexStr.toInt32();
+ mxCharSet->OutputIndex(nIndex);
+ }
+ else if (rParameters.find("COLUMN") != rParameters.end() &&
+ rParameters.find("ROW") != rParameters.end())
+ {
+ OUString aColStr = rParameters.find("COLUMN")->second;
+ OUString aRowStr = rParameters.find("ROW")->second;
+
+ sal_Int32 nColumn = aColStr.toInt32();
+ sal_Int32 nRow = aRowStr.toInt32();
+
+ sal_Int32 nIndex = nColumn * COLUMN_COUNT + nRow;
+ mxCharSet->OutputIndex(nIndex);
+ }
+ }
+ else
+ WindowUIObject::execute(rAction, rParameters);
+}
+
+std::unique_ptr<UIObject> SvxShowCharSetUIObject::create(vcl::Window* pWindow)
+{
+ SvxShowCharSet* pCharSet = dynamic_cast<SvxShowCharSet*>(pWindow);
+ assert(pCharSet);
+ return std::unique_ptr<UIObject>(new SvxShowCharSetUIObject(pCharSet));
+}
+
+OUString SvxShowCharSetUIObject::get_name() const
+{
+ return OUString("SvxShowCharSetUIObject");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */