[Libreoffice-commits] core.git: sw/inc sw/source

Jan Holesovsky kendy at collabora.com
Mon Feb 8 12:57:48 UTC 2016


 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 8045c3931878c75da8e5229899ccbc895ccbed8a
Author: Jan Holesovsky <kendy at 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 b271c6d..2086779 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 c5d6a6b..17256a5 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 326d251..5ecfd62 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 aedf88c..383f6ee 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()


More information about the Libreoffice-commits mailing list