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

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 10 23:07:00 PST 2015


 sw/inc/viewsh.hxx                              |    2 --
 sw/qa/extras/tiledrendering/tiledrendering.cxx |    6 ++++++
 sw/source/core/crsr/swcrsr.cxx                 |    3 ++-
 sw/source/core/crsr/viscrs.cxx                 |    4 ++--
 sw/source/core/layout/trvlfrm.cxx              |    3 ++-
 sw/source/core/view/viewimp.cxx                |    5 +++--
 sw/source/core/view/viewsh.cxx                 |   20 ++++++++------------
 sw/source/uibase/docvw/PostItMgr.cxx           |    2 +-
 sw/source/uibase/docvw/SidebarWin.cxx          |    2 +-
 sw/source/uibase/docvw/edtwin.cxx              |   18 +++++++++---------
 sw/source/uibase/wrtsh/wrtsh2.cxx              |    4 ++--
 11 files changed, 36 insertions(+), 33 deletions(-)

New commits:
commit fd205e40c58aa749fbe458d74ca0c2373a1017dc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 11 08:04:47 2015 +0100

    sw: clean up no longer needed SwViewShell::isTiledRendering()
    
    Change-Id: Icd719c461613f8c59cad81b256678307f69974e1

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 7a83589..bd1a0b5 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -574,8 +574,6 @@ public:
     void libreOfficeKitCallback(int nType, const char* pPayload) const;
     /// Set if we are doing tiled rendering.
     void setTiledRendering(bool bTiledRendering);
-    /// Are we doing tiled rendering?
-    bool isTiledRendering() const;
 
     void setOutputToWindow(bool bOutputToWindow);
     bool isOutputToWindow() const;
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index a975fff..0e5539c 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -151,6 +151,7 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
 
 void SwTiledRenderingTest::testRegisterCallback()
 {
+    comphelper::LibreOfficeKit::setActive();
     SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
     pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
@@ -161,6 +162,7 @@ void SwTiledRenderingTest::testRegisterCallback()
     CPPUNIT_ASSERT(!m_aInvalidation.IsEmpty());
     Rectangle aTopLeft(0, 0, 256*15, 256*15); // 1 px = 15 twips, assuming 96 DPI.
     CPPUNIT_ASSERT(m_aInvalidation.IsOver(aTopLeft));
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SwTiledRenderingTest::testPostKeyEvent()
@@ -180,6 +182,7 @@ void SwTiledRenderingTest::testPostKeyEvent()
 
 void SwTiledRenderingTest::testPostMouseEvent()
 {
+    comphelper::LibreOfficeKit::setActive();
     SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
@@ -193,6 +196,7 @@ void SwTiledRenderingTest::testPostMouseEvent()
     pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aStart.getX(), aStart.getY(), 1);
     // The new cursor position must be before the first word.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), pShellCursor->GetPoint()->nContent.GetIndex());
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SwTiledRenderingTest::testSetTextSelection()
@@ -419,6 +423,7 @@ void SwTiledRenderingTest::testSearchTextFrameWrapAround()
 
 void SwTiledRenderingTest::testDocumentSizeChanged()
 {
+    comphelper::LibreOfficeKit::setActive();
     // Get the current document size.
     SwXTextDocument* pXTextDocument = createDoc("2-pages.odt");
     pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
@@ -432,6 +437,7 @@ void SwTiledRenderingTest::testDocumentSizeChanged()
     CPPUNIT_ASSERT_EQUAL(aSize.getWidth(), m_aDocumentSize.getWidth());
     // Document height should be smaller now.
     CPPUNIT_ASSERT(aSize.getHeight() > m_aDocumentSize.getHeight());
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SwTiledRenderingTest::testSearchAll()
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index dfba8e3..471fa9e 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -52,6 +52,7 @@
 #include <redline.hxx>
 #include <txatbase.hxx>
 #include <memory>
+#include <comphelper/lok.hxx>
 
 using namespace ::com::sun::star::i18n;
 
@@ -1379,7 +1380,7 @@ bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, const
                                 nWordType,
                                 bForward ));
 
-            if (pViewShell->isTiledRendering() && aBndry.startPos == aBndry.endPos && nPtPos > 0)
+            if (comphelper::LibreOfficeKit::isActive() && aBndry.startPos == aBndry.endPos && nPtPos > 0)
             {
                 // nPtPos is the end of the paragraph, select the last word then.
                 --nPtPos;
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 044083b..50344ee 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -92,7 +92,7 @@ void SwVisibleCursor::Show()
         m_bIsVisible = true;
 
         // display at all?
-        if( m_pCursorShell->VisArea().IsOver( m_pCursorShell->m_aCharRect ) || m_pCursorShell->isTiledRendering() )
+        if( m_pCursorShell->VisArea().IsOver( m_pCursorShell->m_aCharRect ) || comphelper::LibreOfficeKit::isActive() )
             _SetPosAndShow();
     }
 }
@@ -756,7 +756,7 @@ void SwShellTableCursor::FillRects()
 
     bool bStart = true;
     SwRegionRects aReg( GetShell()->VisArea() );
-    if (GetShell()->isTiledRendering())
+    if (comphelper::LibreOfficeKit::isActive())
         aReg = GetShell()->getIDocumentLayoutAccess().GetCurrentLayout()->Frame();
     SwNodes& rNds = GetDoc()->GetNodes();
     SwFrame* pEndFrame = nullptr;
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index aa86732..c955254 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -47,6 +47,7 @@
 
 #include <cfloat>
 #include <swselectionlist.hxx>
+#include <comphelper/lok.hxx>
 
 namespace {
     bool lcl_GetCursorOfst_Objects( const SwPageFrame* pPageFrame, bool bSearchBackground,
@@ -2020,7 +2021,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
 
     bool bIgnoreVisArea = true;
     if (pSh)
-        bIgnoreVisArea = pSh->GetViewOptions()->IsPDFExport() || pSh->isTiledRendering();
+        bIgnoreVisArea = pSh->GetViewOptions()->IsPDFExport() || comphelper::LibreOfficeKit::isActive();
 
     // #i12836# enhanced pdf
     SwRegionRects aRegion( !bIgnoreVisArea ?
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index d84ffa9..7d6017c 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -35,6 +35,7 @@
 #include <pagepreviewlayout.hxx>
 #include <comcore.hrc>
 #include <svx/svdundo.hxx>
+#include <comphelper/lok.hxx>
 #include <IDocumentLayoutAccess.hxx>
 #include <IDocumentDrawModelAccess.hxx>
 #include <IDocumentDeviceAccess.hxx>
@@ -132,13 +133,13 @@ void SwViewShellImp::DelRegion()
 bool SwViewShellImp::AddPaintRect( const SwRect &rRect )
 {
     // In case of tiled rendering the visual area is the last painted tile -> not interesting.
-    if ( rRect.IsOver( m_pShell->VisArea() ) || m_pShell->isTiledRendering() )
+    if ( rRect.IsOver( m_pShell->VisArea() ) || comphelper::LibreOfficeKit::isActive() )
     {
         if ( !m_pRegion )
         {
             // In case of normal rendering, this makes sure only visible rectangles are painted.
             // Otherwise get the rectangle of the full document, so all paint rectangles are invalidated.
-            const SwRect& rArea = m_pShell->isTiledRendering() ? m_pShell->GetLayout()->Frame() : m_pShell->VisArea();
+            const SwRect& rArea = comphelper::LibreOfficeKit::isActive() ? m_pShell->GetLayout()->Frame() : m_pShell->VisArea();
             m_pRegion = new SwRegionRects( rArea );
         }
         (*m_pRegion) -= rRect;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 1b01d6e..e0ff3fd 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -80,6 +80,7 @@
 #include <svx/sdrpaintwindow.hxx>
 #include <svx/sdr/overlay/overlaymanager.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
 
 #if !HAVE_FEATURE_DESKTOP
 #include <vcl/sysdata.hxx>
@@ -134,11 +135,6 @@ void SwViewShell::setTiledRendering(bool bTiledRendering)
     getIDocumentDrawModelAccess().GetDrawModel()->setTiledRendering(bTiledRendering);
 }
 
-bool SwViewShell::isTiledRendering() const
-{
-    return getIDocumentDrawModelAccess().GetDrawModel()->isTiledRendering();
-}
-
 void SwViewShell::setOutputToWindow(bool bOutputToWindow)
 {
     mbOutputToWindow = bOutputToWindow;
@@ -195,7 +191,7 @@ void SwViewShell::DLPrePaint2(const vcl::Region& rRegion)
             MakeDrawView();
 
         // Prefer window; if not available, get mpOut (e.g. printer)
-        const bool bWindow = GetWin() && !isTiledRendering() && !isOutputToWindow();
+        const bool bWindow = GetWin() && !comphelper::LibreOfficeKit::isActive() && !isOutputToWindow();
         mpPrePostOutDev = bWindow ? GetWin(): GetOut();
 
         // #i74769# use SdrPaintWindow now direct
@@ -424,7 +420,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
 
                             if ( bPaintsFromSystem )
                                 PaintDesktop(*GetOut(), aRect);
-                            if (!isTiledRendering())
+                            if (!comphelper::LibreOfficeKit::isActive())
                                 pCurrentLayout->Paint( *mpOut, aRect );
                             else
                                 pCurrentLayout->GetCurrShell()->InvalidateWindows(aRect.SVRect());
@@ -567,7 +563,7 @@ void SwViewShell::InvalidateWindows( const SwRect &rRect )
                     ::RepaintPagePreview( &rSh, rRect );
                 // In case of tiled rendering, invalidation is wanted even if
                 // the rectangle is outside the visual area.
-                else if ( rSh.VisArea().IsOver( rRect ) || rSh.isTiledRendering() )
+                else if ( rSh.VisArea().IsOver( rRect ) || comphelper::LibreOfficeKit::isActive() )
                     rSh.GetWin()->Invalidate( rRect.SVRect() );
             }
         }
@@ -578,7 +574,7 @@ const SwRect& SwViewShell::VisArea() const
 {
     // when using the tiled rendering, consider the entire document as our
     // visible area
-    return isTiledRendering()? GetLayout()->Frame(): maVisArea;
+    return comphelper::LibreOfficeKit::isActive()? GetLayout()->Frame(): maVisArea;
 }
 
 void SwViewShell::MakeVisible( const SwRect &rRect )
@@ -1022,7 +1018,7 @@ void SwViewShell::SizeChgNotify()
                 OUString sDisplay = rNum.GetNumStr( nVirtNum );
                 PageNumNotify( this, pCnt->GetPhyPageNum(), nVirtNum, sDisplay );
 
-                if (isTiledRendering())
+                if (comphelper::LibreOfficeKit::isActive())
                 {
                     Size aDocSize = GetDocSize();
                     std::stringstream ss;
@@ -1182,7 +1178,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
 
     // When tiled rendering, the map mode of the window is disabled, avoid
     // enabling it here.
-    if (!isTiledRendering())
+    if (!comphelper::LibreOfficeKit::isActive())
     {
         Point aPt( VisArea().Pos() );
         aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y();
@@ -1860,7 +1856,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
     // TODO clean up SwViewShell's approach to output devices (the many of
     // them - mpBufferedOut, mpOut, mpWin, ...)
     OutputDevice *pSaveOut = mpOut;
-    bool bTiledRendering = isTiledRendering();
+    bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
     setTiledRendering(true);
     mbInLibreOfficeKitCallback = true;
     mpOut = &rDevice;
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index d985940..c4d0f6a 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -889,7 +889,7 @@ void SwPostItMgr::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallbac
         if (!pPostIt)
             continue;
 
-        pPostIt->GetOutlinerView()->setTiledRendering(mpWrtShell->isTiledRendering());
+        pPostIt->GetOutlinerView()->setTiledRendering(comphelper::LibreOfficeKit::isActive());
         pPostIt->GetOutlinerView()->registerLibreOfficeKitCallback(pCallback, pData);
     }
 }
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index c0ec62d1..6f73a63 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -618,7 +618,7 @@ void SwSidebarWin::InitControls()
         LibreOfficeKitCallback pCallback = nullptr;
         void* pData = nullptr;
         pDrawModel->getLibreOfficeKitCallback(pCallback, pData);
-        mpOutlinerView->setTiledRendering(mrView.GetWrtShellPtr()->isTiledRendering());
+        mpOutlinerView->setTiledRendering(comphelper::LibreOfficeKit::isActive());
         mpOutlinerView->registerLibreOfficeKitCallback(pCallback, pData);
     }
 
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 852f525..2a11d57 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3293,7 +3293,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                             {
                             case nsSelectionType::SEL_GRF:
                                 RstMBDownFlags();
-                                if (!rSh.isTiledRendering())
+                                if (!comphelper::LibreOfficeKit::isActive())
                                 {
                                     GetView().GetViewFrame()->GetBindings().Execute(
                                         FN_FORMAT_GRAFIC_DLG, nullptr, 0,
@@ -3312,7 +3312,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 
                             case nsSelectionType::SEL_FRM:
                                 RstMBDownFlags();
-                                if (!rSh.isTiledRendering())
+                                if (!comphelper::LibreOfficeKit::isActive())
                                 {
                                     GetView().GetViewFrame()->GetBindings().Execute(
                                         FN_FORMAT_FRAME_DLG, nullptr, 0,
@@ -3331,7 +3331,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 
                         // if the cursor position was corrected or if a Fly
                         // was selected in ReadOnlyMode, no word selection, except when tiled rendering.
-                        if ((!g_bValidCursorPos || rSh.IsFrameSelected()) && !rSh.isTiledRendering())
+                        if ((!g_bValidCursorPos || rSh.IsFrameSelected()) && !comphelper::LibreOfficeKit::isActive())
                             return;
 
                         SwField *pField;
@@ -3383,7 +3383,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                         }
                         else
                         {
-                            if (!rSh.SelWrd(&aDocPos) && rSh.isTiledRendering())
+                            if (!rSh.SelWrd(&aDocPos) && comphelper::LibreOfficeKit::isActive())
                                 // Double click did not select any word: try to
                                 // select the current cell in case we are in a
                                 // table.
@@ -3786,7 +3786,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
     }
 
     const Point aOldPt( rSh.VisArea().Pos() );
-    const bool bInsWin = rSh.VisArea().IsInside( aDocPt ) || rSh.isTiledRendering();
+    const bool bInsWin = rSh.VisArea().IsInside( aDocPt ) || comphelper::LibreOfficeKit::isActive();
 
     if( m_pShadCursor && !bInsWin )
         delete m_pShadCursor, m_pShadCursor = nullptr;
@@ -4891,7 +4891,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
     if (bCallBase)
         Window::MouseButtonUp(rMEvt);
 
-    if (pSdrView && rMEvt.GetClicks() == 1 && rSh.isTiledRendering())
+    if (pSdrView && rMEvt.GetClicks() == 1 && comphelper::LibreOfficeKit::isActive())
     {
         // When tiled rendering, single click on a shape text starts editing already.
         SdrViewEvent aViewEvent;
@@ -6301,7 +6301,7 @@ void SwEditWin::LogicInvalidate(const Rectangle* pRectangle)
 void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
 {
     // When we're not doing tiled rendering, then positions must be passed as pixels.
-    assert(m_rView.GetWrtShell().isTiledRendering());
+    assert(comphelper::LibreOfficeKit::isActive());
 
     Point aPoint = GetPointerPosPixel();
     SetLastMousePos(rMouseEvent.GetPosPixel());
@@ -6314,7 +6314,7 @@ void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
 void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
 {
     // When we're not doing tiled rendering, then positions must be passed as pixels.
-    assert(m_rView.GetWrtShell().isTiledRendering());
+    assert(comphelper::LibreOfficeKit::isActive());
 
     Point aPoint = GetPointerPosPixel();
     SetLastMousePos(rMouseEvent.GetPosPixel());
@@ -6327,7 +6327,7 @@ void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
 void SwEditWin::LogicMouseMove(const MouseEvent& rMouseEvent)
 {
     // When we're not doing tiled rendering, then positions must be passed as pixels.
-    assert(m_rView.GetWrtShell().isTiledRendering());
+    assert(comphelper::LibreOfficeKit::isActive());
 
     Point aPoint = GetPointerPosPixel();
     SetLastMousePos(rMouseEvent.GetPosPixel());
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 1f88e46..4cc21fa 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -63,10 +63,10 @@
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 
-#include <xmloff/odffields.hxx>
 #include <memory>
 
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
 
 void SwWrtShell::Insert(SwField &rField)
 {
@@ -472,7 +472,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, sal_uInt16 nFilter,
         return;
 
     // We are doing tiledRendering, let the client handles the URL loading.
-    if (rVSh.isTiledRendering())
+    if (comphelper::LibreOfficeKit::isActive())
     {
         rVSh.libreOfficeKitCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr());
         return;


More information about the Libreoffice-commits mailing list