135360
From b2d1dd0d6c4368909b90733aed41d5dc26113c00 Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Wed, 16 Sep 2015 10:32:34 +0200
135360
Subject: [PATCH 140/398] Use SfxViewFrame::Current()
135360
135360
Allows getting rid of vcl::ITiledRenderable::getCurrentViewShell(),
135360
which would do the same, just not implemented outside Writer.
135360
135360
Change-Id: Id26ceca560fb9002dc2d5c740c411b9c4a149523
135360
(cherry picked from commit 8cb6094447041b7fbe29bd5584b5daf9babb5cad)
135360
---
135360
 desktop/source/lib/init.cxx       | 12 ++----------
135360
 include/sfx2/lokhelper.hxx        |  4 ++--
135360
 include/vcl/ITiledRenderable.hxx  |  8 --------
135360
 sfx2/source/view/lokhelper.cxx    |  4 ++--
135360
 sw/inc/unotxdoc.hxx               |  2 --
135360
 sw/source/uibase/uno/unotxdoc.cxx |  5 -----
135360
 6 files changed, 6 insertions(+), 29 deletions(-)
135360
135360
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
135360
index d76de5e5bb3c..fa99038860cd 100644
135360
--- a/desktop/source/lib/init.cxx
135360
+++ b/desktop/source/lib/init.cxx
135360
@@ -1049,19 +1049,11 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
135360
     }
135360
 }
135360
 
135360
-static int doc_createView(LibreOfficeKitDocument* pThis)
135360
+static int doc_createView(LibreOfficeKitDocument* /*pThis*/)
135360
 {
135360
     SolarMutexGuard aGuard;
135360
 
135360
-    ITiledRenderable* pDoc = getTiledRenderable(pThis);
135360
-    if (!pDoc)
135360
-    {
135360
-        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
135360
-        return -1;
135360
-    }
135360
-
135360
-    SfxViewShell* pViewShell = pDoc->getCurrentViewShell();
135360
-    return SfxLokHelper::createView(pViewShell);
135360
+    return SfxLokHelper::createView();
135360
 }
135360
 
135360
 static void doc_destroyView(LibreOfficeKitDocument* /*pThis*/, int nId)
135360
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
135360
index a05cd5d4b210..50516227e992 100644
135360
--- a/include/sfx2/lokhelper.hxx
135360
+++ b/include/sfx2/lokhelper.hxx
135360
@@ -17,8 +17,8 @@ class SfxViewShell;
135360
 class SFX2_DLLPUBLIC SfxLokHelper
135360
 {
135360
 public:
135360
-    /// Create a new view shell for pViewShell's object shell.
135360
-    static int createView(SfxViewShell* pViewShell);
135360
+    /// Create a new view shell from the current view frame.
135360
+    static int createView();
135360
     /// Destroy a view shell from the global shell list.
135360
     static void destroyView(size_t nId);
135360
     /// Set a view shell as current one.
135360
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
135360
index a31d808437af..6639745e4a2f 100644
135360
--- a/include/vcl/ITiledRenderable.hxx
135360
+++ b/include/vcl/ITiledRenderable.hxx
135360
@@ -16,8 +16,6 @@
135360
 #include <tools/gen.hxx>
135360
 #include <vcl/virdev.hxx>
135360
 
135360
-class SfxViewShell;
135360
-
135360
 namespace vcl
135360
 {
135360
 
135360
@@ -141,12 +139,6 @@ public:
135360
      * @see lok::Document::resetSelection().
135360
      */
135360
     virtual void resetSelection() = 0;
135360
-
135360
-    /// Get the currently active view shell of the document.
135360
-    virtual SfxViewShell* getCurrentViewShell()
135360
-    {
135360
-        return 0;
135360
-    }
135360
 };
135360
 
135360
 } // namespace vcl
135360
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
135360
index 0aea6db9c24e..f53d2b35b1bd 100644
135360
--- a/sfx2/source/view/lokhelper.cxx
135360
+++ b/sfx2/source/view/lokhelper.cxx
135360
@@ -15,9 +15,9 @@
135360
 
135360
 #include <shellimpl.hxx>
135360
 
135360
-int SfxLokHelper::createView(SfxViewShell* pViewShell)
135360
+int SfxLokHelper::createView()
135360
 {
135360
-    SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
135360
+    SfxViewFrame* pViewFrame = SfxViewFrame::Current();
135360
     SfxRequest aRequest(pViewFrame, SID_NEWWINDOW);
135360
     pViewFrame->ExecView_Impl(aRequest);
135360
 
135360
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
135360
index 71dbb4f2fd5a..9f0b03b3af38 100644
135360
--- a/sw/inc/unotxdoc.hxx
135360
+++ b/sw/inc/unotxdoc.hxx
135360
@@ -431,8 +431,6 @@ public:
135360
     virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE;
135360
     /// @see vcl::ITiledRenderable::resetSelection().
135360
     virtual void resetSelection() SAL_OVERRIDE;
135360
-    /// @see vcl::ITiledRenderable::getCurrentViewShell().
135360
-    virtual SfxViewShell* getCurrentViewShell() SAL_OVERRIDE;
135360
 
135360
     // ::com::sun::star::tiledrendering::XTiledRenderable
135360
     virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
135360
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
135360
index 8dce9b5589d6..d6315d2964ae 100644
135360
--- a/sw/source/uibase/uno/unotxdoc.cxx
135360
+++ b/sw/source/uibase/uno/unotxdoc.cxx
135360
@@ -3410,11 +3410,6 @@ void SwXTextDocument::resetSelection()
135360
     pWrtShell->ResetSelect(0, false);
135360
 }
135360
 
135360
-SfxViewShell* SwXTextDocument::getCurrentViewShell()
135360
-{
135360
-    return pDocShell->GetView();
135360
-}
135360
-
135360
 void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception)
135360
 {
135360
     SystemGraphicsData aData;
135360
-- 
135360
2.12.0
135360