diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-02-08 13:48:13 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-02-08 13:55:45 +0100 |
commit | 17fa758487c848b1f2ff06971cb64f4de7ac1a07 (patch) | |
tree | c628a6dd48cfae4cb8fdc9b7f04167ca88cdac45 /sw | |
parent | d9959d3763e155b45d7bd2181bb81803566517be (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/view.hxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewport.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 3 |
4 files changed, 24 insertions, 2 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index b8c1c1a3d236..2593408d946d 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 c0fb1047fae5..a9aed68246ab 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 39e908d21f85..b819706919df 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 b1f41c5e7a6a..1f7fbf9de8f6 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() |