summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-02-08 13:48:13 +0100
committerJan Holesovsky <kendy@collabora.com>2016-02-08 13:56:21 +0100
commit8045c3931878c75da8e5229899ccbc895ccbed8a (patch)
tree3a8659336ee8a4a3f99b3eccaa54808e58695ebf
parent95d45e8a19babfc319b3e92ee89bb13fd9924631 (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
-rw-r--r--sw/inc/view.hxx10
-rw-r--r--sw/source/uibase/uiview/view.cxx3
-rw-r--r--sw/source/uibase/uiview/viewport.cxx10
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx3
4 files changed, 24 insertions, 2 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index b271c6d4fe2e..2086779ff9fa 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -255,6 +255,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);
@@ -553,6 +557,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 c5d6a6b9a5b4..17256a51eee8 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -713,7 +713,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)
{
static bool bRequestDoubleBuffering = getenv("VCL_DOUBLEBUFFERING_ENABLE");
if (bRequestDoubleBuffering)
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 326d2515cb3a..5ecfd6260431 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 aedf88ce7695..383f6ee3ccf5 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3192,7 +3192,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()