f325b2
From 5bb7ebf9192f57c0de9eb58652dca638b34d2fe3 Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Mon, 14 Sep 2015 14:36:38 +0200
f325b2
Subject: [PATCH 118/398] sfx2: add SfxLokHelper
f325b2
f325b2
This is meant to be a class that is visible outside sfx2 (so e.g.
f325b2
desktop can use it later), but has access to various sfx2 internals.
f325b2
f325b2
Change-Id: I83204963492b11c1c4a621e86528a64fba27acf3
f325b2
(cherry picked from commit 58b5c13b00cd4d881e1d6313316cc621198a4b04)
f325b2
---
f325b2
 include/sfx2/lokhelper.hxx     | 21 +++++++++++++++++++++
f325b2
 sfx2/Library_sfx.mk            |  1 +
f325b2
 sfx2/source/view/lokhelper.cxx | 29 +++++++++++++++++++++++++++++
f325b2
 3 files changed, 51 insertions(+)
f325b2
 create mode 100644 include/sfx2/lokhelper.hxx
f325b2
 create mode 100644 sfx2/source/view/lokhelper.cxx
f325b2
f325b2
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
f325b2
new file mode 100644
f325b2
index 000000000000..d439bcedce19
f325b2
--- /dev/null
f325b2
+++ b/include/sfx2/lokhelper.hxx
f325b2
@@ -0,0 +1,21 @@
f325b2
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
f325b2
+/*
f325b2
+ * This file is part of the LibreOffice project.
f325b2
+ *
f325b2
+ * This Source Code Form is subject to the terms of the Mozilla Public
f325b2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
f325b2
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
f325b2
+ */
f325b2
+
f325b2
+#include <sfx2/dllapi.h>
f325b2
+
f325b2
+class SfxViewShell;
f325b2
+
f325b2
+class SFX2_DLLPUBLIC SfxLokHelper
f325b2
+{
f325b2
+public:
f325b2
+    /// Create a new view shell for pViewShell's object shell.
f325b2
+    static int createView(SfxViewShell* pViewShell);
f325b2
+};
f325b2
+
f325b2
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
f325b2
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
f325b2
index 0a1100e1f51a..40dedd502ba0 100644
f325b2
--- a/sfx2/Library_sfx.mk
f325b2
+++ b/sfx2/Library_sfx.mk
f325b2
@@ -290,6 +290,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
f325b2
     sfx2/source/view/frame2 \
f325b2
     sfx2/source/view/frmload \
f325b2
     sfx2/source/view/ipclient \
f325b2
+    sfx2/source/view/lokhelper \
f325b2
     sfx2/source/view/printer \
f325b2
     sfx2/source/view/sfxbasecontroller \
f325b2
     sfx2/source/view/userinputinterception \
f325b2
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
f325b2
new file mode 100644
f325b2
index 000000000000..4f500e0388ef
f325b2
--- /dev/null
f325b2
+++ b/sfx2/source/view/lokhelper.cxx
f325b2
@@ -0,0 +1,29 @@
f325b2
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
f325b2
+/*
f325b2
+ * This file is part of the LibreOffice project.
f325b2
+ *
f325b2
+ * This Source Code Form is subject to the terms of the Mozilla Public
f325b2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
f325b2
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
f325b2
+ */
f325b2
+
f325b2
+#include <sfx2/lokhelper.hxx>
f325b2
+#include <sfx2/viewsh.hxx>
f325b2
+#include <sfx2/request.hxx>
f325b2
+#include <sfx2/sfxsids.hrc>
f325b2
+#include <sfx2/viewfrm.hxx>
f325b2
+
f325b2
+#include <shellimpl.hxx>
f325b2
+
f325b2
+int SfxLokHelper::createView(SfxViewShell* pViewShell)
f325b2
+{
f325b2
+    SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
f325b2
+    SfxRequest aRequest(pViewFrame, SID_NEWWINDOW);
f325b2
+    pViewFrame->ExecView_Impl(aRequest);
f325b2
+
f325b2
+    // The SfxViewShell ctor always puts the view shell to the end of the vector.
f325b2
+    SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
f325b2
+    return rViewArr.size() - 1;
f325b2
+}
f325b2
+
f325b2
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
f325b2
-- 
f325b2
2.12.0
f325b2