[Libreoffice-commits] core.git: editeng/source include/editeng sd/qa

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 17 23:27:38 PST 2015


 editeng/source/editeng/editview.cxx          |   10 +++-------
 editeng/source/editeng/impedit.cxx           |   17 ++++++-----------
 editeng/source/editeng/impedit.hxx           |    1 -
 editeng/source/editeng/impedit2.cxx          |    5 +++--
 editeng/source/editeng/impedit3.cxx          |    5 +++--
 include/editeng/editview.hxx                 |    1 -
 sd/qa/unit/tiledrendering/tiledrendering.cxx |    3 +++
 7 files changed, 18 insertions(+), 24 deletions(-)

New commits:
commit 68f411fb19d265ba391e730d16051b5887a30aa3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 18 08:25:35 2015 +0100

    editeng: clean up no longer necessary isTiledRendering() member functions
    
    Change-Id: I4bf3e9bd9cbf2b32d79cebd5ba0a818b1f4970c2

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 5653731..935fe5e 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -63,6 +63,7 @@
 #include <linguistic/lngprops.hxx>
 #include <vcl/settings.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
@@ -400,7 +401,7 @@ void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
             bGotoCursor = false;
         pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor );
 
-        if (pImpEditView->isTiledRendering())
+        if (comphelper::LibreOfficeKit::isActive())
             pImpEditView->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr());
     }
 }
@@ -408,7 +409,7 @@ void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
 void EditView::HideCursor()
 {
     pImpEditView->GetCursor()->Hide();
-    if (pImpEditView->isTiledRendering())
+    if (comphelper::LibreOfficeKit::isActive())
         pImpEditView->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr());
 }
 
@@ -587,11 +588,6 @@ void EditView::setTiledRendering(bool bTiledRendering)
     pImpEditView->setTiledRendering(bTiledRendering);
 }
 
-bool EditView::isTiledRendering()
-{
-    return pImpEditView->isTiledRendering();
-}
-
 void EditView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData)
 {
     pImpEditView->registerLibreOfficeKitCallback(pCallback, pLibreOfficeKitData);
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 453bcbe..d8e9a2d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -123,11 +123,6 @@ void ImpEditView::setTiledRendering(bool bTiledRendering)
     mbTiledRendering = bTiledRendering;
 }
 
-bool ImpEditView::isTiledRendering() const
-{
-    return mbTiledRendering;
-}
-
 void ImpEditView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData)
 {
     mpLibreOfficeKitCallback = pCallback;
@@ -145,7 +140,7 @@ void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
     // set state before notification
     aEditSelection = rEditSelection;
 
-    if (isTiledRendering())
+    if (comphelper::LibreOfficeKit::isActive())
         // Tiled rendering: selections are only painted when we are in selection mode.
         pEditEngine->SetInSelectionMode(aEditSelection.HasRange());
 
@@ -188,7 +183,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
 
     vcl::Region* pOldRegion = pRegion;
     vcl::Region aRegion;
-    if (isTiledRendering() && !pRegion)
+    if (comphelper::LibreOfficeKit::isActive() && !pRegion)
         pRegion = &aRegion;
 
     tools::PolyPolygon* pPolyPoly = nullptr;
@@ -325,7 +320,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
     {
         *pRegion = vcl::Region( *pPolyPoly );
 
-        if (isTiledRendering() && !pOldRegion)
+        if (comphelper::LibreOfficeKit::isActive() && !pOldRegion)
         {
             bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM;
 
@@ -947,7 +942,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16
 
         GetCursor()->SetSize( aCursorSz );
 
-        if (isTiledRendering())
+        if (comphelper::LibreOfficeKit::isActive())
         {
             const Point& rPos = GetCursor()->GetPos();
             Rectangle aRect(rPos.getX(), rPos.getY(), rPos.getX() + GetCursor()->GetWidth(), rPos.getY() + GetCursor()->GetHeight());
@@ -1562,8 +1557,8 @@ bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
     EditPaM aPaM = pEditEngine->GetPaM(aDocPos);
     bool bGotoCursor = DoAutoScroll();
 
-    // aTmpNewSel: Diff between old and new, not the new selection, unless tiled rendering
-    EditSelection aTmpNewSel( isTiledRendering() ? GetEditSelection().Min() : GetEditSelection().Max(), aPaM );
+    // aTmpNewSel: Diff between old and new, not the new selection, unless for tiled rendering
+    EditSelection aTmpNewSel( comphelper::LibreOfficeKit::isActive() ? GetEditSelection().Min() : GetEditSelection().Max(), aPaM );
 
     // #i27299#
     // work on copy of current selection and set new selection, if it has changed.
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 1c988459..e1da8ca 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -369,7 +369,6 @@ public:
                         return ( pBackgroundColor ? *pBackgroundColor : pOutWin->GetBackground().GetColor() ); }
 
     void            setTiledRendering(bool bTiledRendering);
-    bool            isTiledRendering() const;
     /// @see vcl::ITiledRenderable::registerCallback().
     void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
     /// Invokes the registered callback, if there are any.
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 1ae1dd8..1f9bc74 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -62,6 +62,7 @@
 #include <sot/exchange.hxx>
 #include <sot/formats.hxx>
 #include <o3tl/make_unique.hxx>
+#include <comphelper/lok.hxx>
 
 #include <unicode/ubidi.h>
 #include <algorithm>
@@ -570,7 +571,7 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView )
     // FIXME I believe resetting bInSelection should not be here even in the
     // non-tiled-rendering case, but it has been here since 2000 (and before)
     // so who knows what corner case it was supposed to solve back then
-    if (!pView->pImpEditView->isTiledRendering())
+    if (!comphelper::LibreOfficeKit::isActive())
         bInSelection = false;
 
     // Special treatments
@@ -906,7 +907,7 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE
     if ( bKeyModifySelection )
     {
         // Then the selection is expanded ... or the whole selection is painted in case of tiled rendering.
-        EditSelection aTmpNewSel( pEditView->isTiledRendering() ? pEditView->pImpEditView->GetEditSelection().Min() : aOldEnd, aPaM );
+        EditSelection aTmpNewSel( comphelper::LibreOfficeKit::isActive() ? pEditView->pImpEditView->GetEditSelection().Min() : aOldEnd, aPaM );
         pEditView->pImpEditView->DrawSelection( aTmpNewSel );
     }
     else
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 5b3498e..2f1465e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -74,6 +74,7 @@
 #include <comphelper/processfactory.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <comphelper/string.hxx>
+#include <comphelper/lok.hxx>
 #include <memory>
 
 using namespace ::com::sun::star;
@@ -293,7 +294,7 @@ void ImpEditEngine::UpdateViews( EditView* pCurView )
             aClipRect = pView->pImpEditView->GetWindowPos( aClipRect );
 
             // For tiled rendering, we have to always go via Invalidate().
-            if ( pView == pCurView && !pView->isTiledRendering())
+            if ( pView == pCurView && !comphelper::LibreOfficeKit::isActive())
                 Paint( pView->pImpEditView, aClipRect, nullptr, true );
             else
                 pView->GetWindow()->Invalidate( aClipRect );
@@ -3886,7 +3887,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRect, OutputDev
         // In case of tiled rendering pass a region to DrawSelection(), so that
         // selection callbacks are not emitted during every repaint.
         vcl::Region aRegion;
-        pView->DrawSelection(pView->GetEditSelection(), pView->isTiledRendering() ? &aRegion : nullptr, pTarget);
+        pView->DrawSelection(pView->GetEditSelection(), comphelper::LibreOfficeKit::isActive() ? &aRegion : nullptr, pTarget);
     }
 }
 
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index f2288a5..369f7db 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -182,7 +182,6 @@ public:
     Color           GetBackgroundColor() const;
 
     void            setTiledRendering(bool bTiledRendering);
-    bool            isTiledRendering();
     /// @see vcl::ITiledRenderable::registerCallback().
     void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
 
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index a6f5e9d..7c14fa9 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -23,6 +23,7 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <svl/srchitem.hxx>
+#include <comphelper/lok.hxx>
 
 #include <DrawDocShell.hxx>
 #include <ViewShell.hxx>
@@ -388,6 +389,7 @@ static void lcl_search(const OUString& rKey, bool bFindAll = false)
 
 void SdTiledRenderingTest::testSearch()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
     uno::Reference<container::XIndexAccess> xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
@@ -417,6 +419,7 @@ void SdTiledRenderingTest::testSearch()
     // This should trigger the not-found callback.
     lcl_search("ccc");
     CPPUNIT_ASSERT_EQUAL(false, m_bFound);
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testSearchAll()


More information about the Libreoffice-commits mailing list