summaryrefslogtreecommitdiff
path: root/sd/source/ui/uitest/uiobject.cxx
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-05-22 05:54:11 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-18 17:02:38 +0200
commitfdfc55da301435dfd52b0365b8edda7aa893f983 (patch)
treeabc8c696491fc6d69faefcffbf98ea2f0c4bb458 /sd/source/ui/uitest/uiobject.cxx
parentb67527fb75cd95201d9251064e8b9d5b1c4fe62a (diff)
uitest: add initial code for impress main edit window
Change-Id: I82eabe1df33878316907e664ddbcd8edf6a73d33
Diffstat (limited to 'sd/source/ui/uitest/uiobject.cxx')
-rw-r--r--sd/source/ui/uitest/uiobject.cxx77
1 files changed, 77 insertions, 0 deletions
diff --git a/sd/source/ui/uitest/uiobject.cxx b/sd/source/ui/uitest/uiobject.cxx
new file mode 100644
index 000000000000..90535c6d66aa
--- /dev/null
+++ b/sd/source/ui/uitest/uiobject.cxx
@@ -0,0 +1,77 @@
+/* -*- 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 "Window.hxx"
+#include "DrawViewShell.hxx"
+
+ImpressWindowUIObject::ImpressWindowUIObject(VclPtr<sd::Window> xWindow):
+ WindowUIObject(xWindow),
+ mxWindow(xWindow)
+{
+}
+
+StringMap ImpressWindowUIObject::get_state()
+{
+ StringMap aMap = WindowUIObject::get_state();
+
+ aMap["SelectedText"] = getViewShell()->GetSelectionText();
+ aMap["CurrentSlide"] = OUString::number(getViewShell()->GetCurPageId());
+
+ return aMap;
+}
+
+void ImpressWindowUIObject::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();
+ getViewShell()->SetZoom(nVal);
+ }
+ }
+ else if (rAction == "GOTO")
+ {
+ if (rParameters.find("PAGE") != rParameters.end())
+ {
+ auto itr = rParameters.find("PAGE");
+ OUString aVal = itr->second;
+ sal_Int32 nVal = aVal.toInt32();
+ getViewShell()->SwitchPage(nVal);
+ }
+ }
+ WindowUIObject::execute(rAction, rParameters);
+}
+
+OUString ImpressWindowUIObject::get_name() const
+{
+ return OUString("ImpressWindowUIObject");
+}
+
+std::unique_ptr<UIObject> ImpressWindowUIObject::create(vcl::Window* pWindow)
+{
+ sd::Window* pWin = dynamic_cast<sd::Window*>(pWindow);
+ assert(pWin);
+ return std::unique_ptr<UIObject>(new ImpressWindowUIObject(pWin));
+}
+
+sd::DrawViewShell* ImpressWindowUIObject::getViewShell()
+{
+ sd::DrawViewShell* pViewShell = dynamic_cast<sd::DrawViewShell*>(mxWindow->GetViewShell());
+ assert(pViewShell);
+
+ return pViewShell;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */