[Libreoffice-commits] core.git: 3 commits - libreofficekit/source sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 22 10:19:35 PST 2016


 libreofficekit/source/gtk/lokdocview.cxx                   |   10 +++++
 sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx             |   26 ++++++++++++-
 sw/source/uibase/uiview/viewport.cxx                       |    6 ++-
 4 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit 7b48a8fb2f0a0d8b854ec00d5f03ec09e8cfa4da
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 22 18:34:27 2016 +0100

    sw tiled rendering: avoid unnecessary invalidation in SwView::SetVisArea()
    
    SwWrtShell's visible area is set to the entire document since
    12e3b51abe883202af09769873f87b27d7de118b (tdf#94237 tiled rendering: Use
    the entire document as the visual area., 2015-09-15).
    
    Let's be consistent and do the same for SwView, so that
    SwView::PageDown() and all other similar functions do not cause
    unnecessary invalidations, as this way later we'll realize that SwView's
    and SwWrtShell's visible area is the same.
    
    Change-Id: Ia22f07ddfb18c6f5ab6cbafede7cf8799b1177a1

diff --git a/sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt b/sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt
new file mode 100644
index 0000000..0cad2d2
Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/pagedown-invalidation.odt differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 160f3aa..cf0afae 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -48,6 +48,7 @@ public:
     void testDocumentSizeChanged();
     void testSearchAll();
     void testSearchAllNotifications();
+    void testPageDownInvalidation();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -64,6 +65,7 @@ public:
     CPPUNIT_TEST(testDocumentSizeChanged);
     CPPUNIT_TEST(testSearchAll);
     CPPUNIT_TEST(testSearchAllNotifications);
+    CPPUNIT_TEST(testPageDownInvalidation);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -78,12 +80,14 @@ private:
     std::vector<int> m_aSearchResultPart;
     int m_nSelectionBeforeSearchResult;
     int m_nSelectionAfterSearchResult;
+    int m_nInvalidations;
 };
 
 SwTiledRenderingTest::SwTiledRenderingTest()
     : m_bFound(true),
       m_nSelectionBeforeSearchResult(0),
-      m_nSelectionAfterSearchResult(0)
+      m_nSelectionAfterSearchResult(0),
+      m_nInvalidations(0)
 {
 }
 
@@ -119,6 +123,7 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
             m_aInvalidation.setWidth(aSeq[2].toInt32());
             m_aInvalidation.setHeight(aSeq[3].toInt32());
         }
+        ++m_nInvalidations;
     }
     break;
     case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
@@ -493,6 +498,25 @@ void SwTiledRenderingTest::testSearchAllNotifications()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SwTiledRenderingTest::testPageDownInvalidation()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    SwXTextDocument* pXTextDocument = createDoc("pagedown-invalidation.odt");
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
+    {
+        {".uno:HideWhitespace", uno::makeAny(true)},
+    }));
+    pXTextDocument->initializeForTiledRendering(aPropertyValues);
+    pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
+    comphelper::dispatchCommand(".uno:PageDown", uno::Sequence<beans::PropertyValue>());
+
+    // This was 2.
+    CPPUNIT_ASSERT_EQUAL(0, m_nInvalidations);
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 4114011..326d251 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -49,6 +49,7 @@
 #include <IDocumentSettingAccess.hxx>
 
 #include <basegfx/tools/zoomtools.hxx>
+#include <comphelper/lok.hxx>
 
 // The SetVisArea of the DocShell must not be called from InnerResizePixel.
 // But our adjustments must take place.
@@ -212,7 +213,10 @@ m_aDocSz = rSz;
 
 void SwView::SetVisArea( const Rectangle &rRect, bool bUpdateScrollbar )
 {
-    const Size aOldSz( m_aVisArea.GetSize() );
+    Size aOldSz( m_aVisArea.GetSize() );
+    if (comphelper::LibreOfficeKit::isActive() && m_pWrtShell)
+        // If m_pWrtShell's visible area is the whole document, do the same here.
+        aOldSz = m_pWrtShell->VisArea().SSize();
 
     const Point aTopLeft(     AlignToPixel( rRect.TopLeft() ));
     const Point aBottomRight( AlignToPixel( rRect.BottomRight() ));
commit 455069c6ec3e3b08dda1c7cc1104161a935b0364
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 22 17:16:33 2016 +0100

    lokdocview: handle page down and page up
    
    Change-Id: I119633474236faa95ecf5fd26cd89789b313e382

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 74b7b84..73f27bc 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -592,6 +592,12 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
     case GDK_KEY_Right:
         nKeyCode = com::sun::star::awt::Key::RIGHT;
         break;
+    case GDK_KEY_Page_Down:
+        nKeyCode = com::sun::star::awt::Key::PAGEDOWN;
+        break;
+    case GDK_KEY_Page_Up:
+        nKeyCode = com::sun::star::awt::Key::PAGEUP;
+        break;
     case GDK_KEY_Shift_L:
     case GDK_KEY_Shift_R:
         if (pEvent->type == GDK_KEY_PRESS)
commit 3d6dd6d83d0084ac5287413579cf7c1d62734078
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 22 17:10:53 2016 +0100

    lokdocview: log lok::Document::getTextSelection() parameters
    
    Change-Id: I7706fe40705bc74bcebd53b58239c4b159bab7c0

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index f63e9d6..74b7b84 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2750,6 +2750,10 @@ lok_doc_view_copy_selection (LOKDocView* pDocView,
     LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView);
     if (!pDocument)
         return nullptr;
+
+    std::stringstream ss;
+    ss << "lok::Document::getTextSelection('" << pMimeType << "')";
+    g_info("%s", ss.str().c_str());
     return pDocument->pClass->getTextSelection(pDocument, pMimeType, pUsedMimeType);
 }
 


More information about the Libreoffice-commits mailing list