From 96cd2abd748ed24e5aba50cc4c300cf06e512db3 Mon Sep 17 00:00:00 2001 From: Mihai Varga Date: Fri, 6 Nov 2015 14:34:28 +0200 Subject: LOK: setClientZoom() - sets the client zoom level We need to know the client's view level to correctly handle the mouse events in calc. PaintTile() set a zoom level that corresponds to the requested tiles and previously postMouseEvent would call SetZoom(1,1). Now we can make use of knowing the client's view level and call SetZoom() with the correct parameters Change-Id: I34b5afcdcc06a671a8ac92c03e87404e42adf4cd Conflicts: sc/source/ui/unoobj/docuno.cxx --- desktop/source/lib/init.cxx | 20 +++++++++++++++++++- desktop/source/lib/lokandroid.cxx | 8 ++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'desktop') diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e33544abec90..94b81e049cd2 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -318,7 +318,11 @@ static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, int nY); static void doc_resetSelection (LibreOfficeKitDocument* pThis); static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); - +static void doc_setClientZoom(LibreOfficeKitDocument* pThis, + int nTilePixelWidth, + int nTilePixelHeight, + int nTileTwipWidth, + int nTileTwipHeight); static int doc_createView(LibreOfficeKitDocument* pThis); static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); static void doc_setView(LibreOfficeKitDocument* pThis, int nId); @@ -358,6 +362,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference setGraphicSelection = doc_setGraphicSelection; m_pDocumentClass->resetSelection = doc_resetSelection; m_pDocumentClass->getCommandValues = doc_getCommandValues; + m_pDocumentClass->setClientZoom = doc_setClientZoom; m_pDocumentClass->createView = doc_createView; m_pDocumentClass->destroyView = doc_destroyView; @@ -1470,6 +1475,19 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo } } +static void doc_setClientZoom(LibreOfficeKitDocument* pThis, int nTilePixelWidth, int nTilePixelHeight, + int nTileTwipWidth, int nTileTwipHeight) +{ + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + + pDoc->setClientZoom(nTilePixelWidth, nTilePixelHeight, nTileTwipWidth, nTileTwipHeight); +} + static int doc_createView(LibreOfficeKitDocument* /*pThis*/) { SolarMutexGuard aGuard; diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx index 017ab8a9cdaf..0c360d3c2b9c 100644 --- a/desktop/source/lib/lokandroid.cxx +++ b/desktop/source/lib/lokandroid.cxx @@ -358,4 +358,12 @@ extern "C" SAL_JNI_EXPORT jstring JNICALL Java_org_libreoffice_kit_Document_getC return pEnv->NewStringUTF(pValue); } + +extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setClientZoom + (JNIEnv* pEnv, jobject aObject, jint nTilePixelWidth, jint nTilePixelHeight, jint nTileTwipWidth, jint nTileTwipHeight) +{ + LibreOfficeKitDocument* pDocument = getHandle(pEnv, aObject); + pDocument->pClass->setClientZoom(pDocument, nTilePixelWidth, nTilePixelHeight, nTileTwipWidth, nTileTwipHeight); + +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit