sw/inc/view.hxx | 10 ++++++++++ sw/source/uibase/uiview/view.cxx | 3 ++- sw/source/uibase/uiview/viewport.cxx | 10 ++++++++++ sw/source/uibase/uno/unotxdoc.cxx | 3 ++- 4 files changed, 24 insertions(+), 2 deletions(-)
New commits: commit 17fa758487c848b1f2ff06971cb64f4de7ac1a07 Author: Jan Holesovsky <ke...@collabora.com> Date: Mon Feb 8 13:48:13 2016 +0100 sw lok: For PgDown/PgUp, don't set the VisArea, instead use a dedicated var. The m_aVisArea may be changed by many other means (called internally from LibreOffice), so let's introduce a dedicated offset for PgUp / PgDown handling overwriting the computed value (if set). Change-Id: I7c869b1e3582145b58f0185f4df2882d07a81ddf diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index b8c1c1a..2593408 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -269,6 +269,10 @@ class SW_DLLPUBLIC SwView: public SfxViewShell m_bMakeSelectionVisible : 1, // transport the bookmark selection m_bAnnotationMode; ///< The real cursor position is inside an annotation. + /// LibreOfficeKit has to force the page size for PgUp/PgDown + /// functionality based on the user's view, instead of using the m_aVisArea. + SwTwips m_nLOKPageUpDownOffset; + // methods for searching // set search context SAL_DLLPRIVATE bool SearchAndWrap(bool bApi = false); @@ -589,6 +593,12 @@ public: OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr); + /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea. + void ForcePageUpDownOffset(SwTwips nTwips) + { + m_nLOKPageUpDownOffset = nTwips; + } + // hand over Shell SfxShell *GetCurShell() { return m_pShell; } SwDocShell *GetDocShell(); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index c0fb104..a9aed68 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -722,7 +722,8 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_bInDtor(false), m_bOldShellWasPagePreview(false), m_bIsPreviewDoubleClick(false), - m_bAnnotationMode(false) + m_bAnnotationMode(false), + m_nLOKPageUpDownOffset(0) { // According to discussion with MBA and further // investigations, no old SfxViewShell will be set as parameter <pOldSh>, diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 39e908d..b819706 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -542,6 +542,11 @@ bool SwView::GetPageScrollUpOffset( SwTwips &rOff ) const rOff = rOff - m_aVisArea.Top(); else if( GetWrtShell().GetCharRect().Top() < (m_aVisArea.Top() + nYScrl)) rOff += nYScrl; + + // in the LOK case, force the value set by the API + if (comphelper::LibreOfficeKit::isActive() && m_nLOKPageUpDownOffset > 0) + rOff = -m_nLOKPageUpDownOffset; + return true; } @@ -558,6 +563,11 @@ bool SwView::GetPageScrollDownOffset( SwTwips &rOff ) const else if( GetWrtShell().GetCharRect().Bottom() > ( m_aVisArea.Bottom() - nYScrl )) rOff -= nYScrl; + + // in the LOK case, force the value set by the API + if (comphelper::LibreOfficeKit::isActive() && m_nLOKPageUpDownOffset > 0) + rOff = m_nLOKPageUpDownOffset; + return rOff > 0; } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index b1f41c5..1f7fbf9 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3225,7 +3225,8 @@ void SwXTextDocument::setClientVisibleArea(const Rectangle& rRectangle) if (!pView) return; - pView->SetVisArea(rRectangle); + // set the PgUp/PgDown offset + pView->ForcePageUpDownOffset(2 * rRectangle.GetHeight() / 3); } Pointer SwXTextDocument::getPointer() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits