diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-02 10:32:36 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-02 11:06:46 +0100 |
commit | 1ae319aa81b7d42441886dd232256b0336308cf3 (patch) | |
tree | 9bc50238914cdc79f4dadcf5d66a5fa0071ef499 | |
parent | 4dae4ed81b82ea3f5ae5f1097e5c75c3b1f0644e (diff) |
LOK: add Document::setClientVisibleArea()
... and implement it in Writer.
Otherwise there is no way we can perform e.g. page down in an expected
way. Without this, the core visible area depends on the zoom in the
document, and the client visible area can be something entirely
different.
(cherry picked from commit bd8610ebafa9caf9f09a5aba9cca04c23691513d)
Conflicts:
libreofficekit/source/gtk/lokdocview.cxx
sw/inc/unotxdoc.hxx
Change-Id: Iadfb5a225da09a2551ffa41ddf503bb3d22b3eae
-rw-r--r-- | desktop/source/lib/init.cxx | 15 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 2 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 15 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 5 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 9 |
6 files changed, 48 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 53603095c09a..0fbece04b7f1 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -369,6 +369,7 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis, int nTilePixelHeight, int nTileTwipWidth, int nTileTwipHeight); +static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight); static int doc_createView(LibreOfficeKitDocument* pThis); static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); static void doc_setView(LibreOfficeKitDocument* pThis, int nId); @@ -415,6 +416,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->resetSelection = doc_resetSelection; m_pDocumentClass->getCommandValues = doc_getCommandValues; m_pDocumentClass->setClientZoom = doc_setClientZoom; + m_pDocumentClass->setClientVisibleArea = doc_setClientVisibleArea; m_pDocumentClass->createView = doc_createView; m_pDocumentClass->destroyView = doc_destroyView; @@ -1543,6 +1545,19 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis, int nTilePixelWidth pDoc->setClientZoom(nTilePixelWidth, nTilePixelHeight, nTileTwipWidth, nTileTwipHeight); } +static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight) +{ + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + + Rectangle aRectangle(Point(nX, nY), Size(nWidth, nHeight)); + pDoc->setClientVisibleArea(aRectangle); +} + static int doc_createView(LibreOfficeKitDocument* /*pThis*/) { SolarMutexGuard aGuard; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index b3b61ba52e41..4feaaf758cae 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -203,6 +203,8 @@ struct _LibreOfficeKitDocumentClass int nTilePixelHeight, int nTileTwipWidth, int nTileTwipHeight); + /// @see lok::Document::setVisibleArea). + void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight); /// @see lok::Document::createView(). int (*createView) (LibreOfficeKitDocument* pThis); diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index df9e211cab53..1f2311ae6604 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -330,6 +330,21 @@ public: } /** + * Inform core about the currently visible area of the document on the + * client, so that it can perform e.g. page down (which depends on the + * visible height) in a sane way. + * + * @param nX - top left corner horizontal position + * @param nY - top left corner vertical position + * @param nWidth - area width + * @param nHeight - area height + */ + inline void setClientVisibleArea(int nX, int nY, int nWidth, int nHeight) + { + mpDoc->pClass->setClientVisibleArea(mpDoc, nX, nY, nWidth, nHeight); + } + + /** * Create a new view for an existing document. * By default a loaded document has 1 view. * @return the ID of the new view. diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index e31fd7004fdc..34f53153b9cb 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -197,6 +197,11 @@ public: int /*nTileTwipHeight*/) { } + + /// @see lok::Document::setClientVisibleArea(). + virtual void setClientVisibleArea(const Rectangle& /*rRectangle*/) + { + } }; } // namespace vcl diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 37cadfd92e87..1251f76b1e94 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -438,6 +438,8 @@ public: virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::isMimeTypeSupported(). virtual bool isMimeTypeSupported() SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::setClientVisibleArea(). + virtual void setClientVisibleArea(const Rectangle& rRectangle) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::getPointer(). virtual Pointer getPointer() SAL_OVERRIDE; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 6a0a216b050a..27612b14f029 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3218,6 +3218,15 @@ bool SwXTextDocument::isMimeTypeSupported() return aDataHelper.GetXTransferable().is() && SwTransferable::IsPaste(*pWrtShell, aDataHelper); } +void SwXTextDocument::setClientVisibleArea(const Rectangle& rRectangle) +{ + SwView* pView = pDocShell->GetView(); + if (!pView) + return; + + pView->SetVisArea(rRectangle); +} + Pointer SwXTextDocument::getPointer() { SolarMutexGuard aGuard; |