Blob Blame History Raw
From b2d1dd0d6c4368909b90733aed41d5dc26113c00 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Wed, 16 Sep 2015 10:32:34 +0200
Subject: [PATCH 140/398] Use SfxViewFrame::Current()

Allows getting rid of vcl::ITiledRenderable::getCurrentViewShell(),
which would do the same, just not implemented outside Writer.

Change-Id: Id26ceca560fb9002dc2d5c740c411b9c4a149523
(cherry picked from commit 8cb6094447041b7fbe29bd5584b5daf9babb5cad)
---
 desktop/source/lib/init.cxx       | 12 ++----------
 include/sfx2/lokhelper.hxx        |  4 ++--
 include/vcl/ITiledRenderable.hxx  |  8 --------
 sfx2/source/view/lokhelper.cxx    |  4 ++--
 sw/inc/unotxdoc.hxx               |  2 --
 sw/source/uibase/uno/unotxdoc.cxx |  5 -----
 6 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d76de5e5bb3c..fa99038860cd 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1049,19 +1049,11 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
     }
 }
 
-static int doc_createView(LibreOfficeKitDocument* pThis)
+static int doc_createView(LibreOfficeKitDocument* /*pThis*/)
 {
     SolarMutexGuard aGuard;
 
-    ITiledRenderable* pDoc = getTiledRenderable(pThis);
-    if (!pDoc)
-    {
-        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
-        return -1;
-    }
-
-    SfxViewShell* pViewShell = pDoc->getCurrentViewShell();
-    return SfxLokHelper::createView(pViewShell);
+    return SfxLokHelper::createView();
 }
 
 static void doc_destroyView(LibreOfficeKitDocument* /*pThis*/, int nId)
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index a05cd5d4b210..50516227e992 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -17,8 +17,8 @@ class SfxViewShell;
 class SFX2_DLLPUBLIC SfxLokHelper
 {
 public:
-    /// Create a new view shell for pViewShell's object shell.
-    static int createView(SfxViewShell* pViewShell);
+    /// Create a new view shell from the current view frame.
+    static int createView();
     /// Destroy a view shell from the global shell list.
     static void destroyView(size_t nId);
     /// Set a view shell as current one.
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index a31d808437af..6639745e4a2f 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -16,8 +16,6 @@
 #include <tools/gen.hxx>
 #include <vcl/virdev.hxx>
 
-class SfxViewShell;
-
 namespace vcl
 {
 
@@ -141,12 +139,6 @@ public:
      * @see lok::Document::resetSelection().
      */
     virtual void resetSelection() = 0;
-
-    /// Get the currently active view shell of the document.
-    virtual SfxViewShell* getCurrentViewShell()
-    {
-        return 0;
-    }
 };
 
 } // namespace vcl
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 0aea6db9c24e..f53d2b35b1bd 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -15,9 +15,9 @@
 
 #include <shellimpl.hxx>
 
-int SfxLokHelper::createView(SfxViewShell* pViewShell)
+int SfxLokHelper::createView()
 {
-    SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+    SfxViewFrame* pViewFrame = SfxViewFrame::Current();
     SfxRequest aRequest(pViewFrame, SID_NEWWINDOW);
     pViewFrame->ExecView_Impl(aRequest);
 
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 71dbb4f2fd5a..9f0b03b3af38 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -431,8 +431,6 @@ public:
     virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE;
     /// @see vcl::ITiledRenderable::resetSelection().
     virtual void resetSelection() SAL_OVERRIDE;
-    /// @see vcl::ITiledRenderable::getCurrentViewShell().
-    virtual SfxViewShell* getCurrentViewShell() SAL_OVERRIDE;
 
     // ::com::sun::star::tiledrendering::XTiledRenderable
     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;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 8dce9b5589d6..d6315d2964ae 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3410,11 +3410,6 @@ void SwXTextDocument::resetSelection()
     pWrtShell->ResetSelect(0, false);
 }
 
-SfxViewShell* SwXTextDocument::getCurrentViewShell()
-{
-    return pDocShell->GetView();
-}
-
 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)
 {
     SystemGraphicsData aData;
-- 
2.12.0