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

Miklos Vajna vmiklos at collabora.co.uk
Wed Jan 13 23:54:34 PST 2016


 sd/qa/unit/tiledrendering/tiledrendering.cxx |    6 ++++++
 sd/source/ui/func/fusel.cxx                  |    6 +++---
 sd/source/ui/view/Outliner.cxx               |    9 +++++----
 sd/source/ui/view/sdwindow.cxx               |    7 ++++---
 sd/source/ui/view/viewshe2.cxx               |    3 ++-
 sd/source/ui/view/viewshel.cxx               |    7 ++++---
 6 files changed, 24 insertions(+), 14 deletions(-)

New commits:
commit 972d27f5652646d28dea9c5bdb3f987e8a8aebe8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jan 14 08:53:03 2016 +0100

    sd: clean up remaining non-static isTiledRendering() usage
    
    Change-Id: I36b0edc55b9c275bef5cf82af2bdf0ccb3ebe621

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 7c14fa9..13b4223 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -254,6 +254,7 @@ void SdTiledRenderingTest::testPostKeyEvent()
 
 void SdTiledRenderingTest::testPostMouseEvent()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -277,6 +278,7 @@ void SdTiledRenderingTest::testPostMouseEvent()
     CPPUNIT_ASSERT(pView->GetTextEditObject());
     // The new cursor position must be before the first word.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), rEditView.GetSelection().nStartPos);
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testSetTextSelection()
@@ -424,6 +426,7 @@ void SdTiledRenderingTest::testSearch()
 
 void SdTiledRenderingTest::testSearchAll()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
     pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
 
@@ -438,10 +441,12 @@ void SdTiledRenderingTest::testSearchAll()
     lcl_search("second", /*bFindAll=*/true);
     // This was 0: no SET_PART was emitted.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), m_nPart);
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testSearchAllSelections()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
     pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
 
@@ -450,6 +455,7 @@ void SdTiledRenderingTest::testSearchAllSelections()
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), m_nPart);
     // This was 1: only the first match was highlighted.
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m_aSelection.size());
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 #endif
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 03569ca..fbd0587 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -72,12 +72,12 @@
 #include <svx/sdrhittesthelper.hxx>
 
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
 
 using namespace ::com::sun::star;
 
 namespace sd {
 
-
 FuSelection::FuSelection (
     ViewShell* pViewSh,
     ::sd::Window* pWin,
@@ -154,7 +154,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
     sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
     sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
 
-    if (mpDoc->isTiledRendering())
+    if (comphelper::LibreOfficeKit::isActive())
     {
         // When tiled rendering, we always work in logic units, use the non-pixel constants.
         nDrgLog = DRGLOG;
@@ -275,7 +275,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
                 mpWindow->ReleaseMouse();
 
                 // If tiled rendering, let client handles URL execution and early returns.
-                if (mpDoc->isTiledRendering())
+                if (comphelper::LibreOfficeKit::isActive())
                 {
                     mpDoc->libreOfficeKitCallback(LOK_CALLBACK_HYPERLINK_CLICKED,
                             aVEvt.pURLField->GetURL().toUtf8().getStr());
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index caf2da7..1eb659a 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -74,6 +74,7 @@
 #include <editeng/editerr.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <comphelper/string.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -632,7 +633,7 @@ bool Outliner::SearchAndReplaceAll()
         do
         {
             bFoundMatch = ! SearchAndReplaceOnce(&aSelections);
-            if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && pViewShell->GetDoc()->isTiledRendering() && bFoundMatch && aSelections.size() == 1)
+            if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && comphelper::LibreOfficeKit::isActive() && bFoundMatch && aSelections.size() == 1)
             {
                 // Without this, RememberStartPosition() will think it already has a remembered position.
                 mnStartPageIndex = (sal_uInt16)-1;
@@ -645,7 +646,7 @@ bool Outliner::SearchAndReplaceAll()
         }
         while (bFoundMatch);
 
-        if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && pViewShell->GetDoc()->isTiledRendering() && !aSelections.empty())
+        if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && comphelper::LibreOfficeKit::isActive() && !aSelections.empty())
         {
             boost::property_tree::ptree aTree;
             aTree.put("searchString", mpSearchItem->GetSearchString().toUtf8().getStr());
@@ -669,7 +670,7 @@ bool Outliner::SearchAndReplaceAll()
 
     RestoreStartPosition ();
 
-    if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && pViewShell->GetDoc()->isTiledRendering() && !bRet)
+    if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && comphelper::LibreOfficeKit::isActive() && !bRet)
     {
         // Find-all, tiled rendering and we have at least one match.
         OString aPayload = OString::number(mnStartPageIndex);
@@ -782,7 +783,7 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections)
 
     mpDrawDocument->GetDocSh()->SetWaitCursor( false );
 
-    if (pViewShell && pViewShell->GetDoc()->isTiledRendering() && mbStringFound)
+    if (pViewShell && comphelper::LibreOfficeKit::isActive() && mbStringFound)
     {
         std::vector<Rectangle> aLogicRects;
         pOutlinerView->GetSelectionRectangles(aLogicRects);
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index effde24..c1e2594 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -41,6 +41,7 @@
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
 
 namespace sd {
 
@@ -330,7 +331,7 @@ long Window::SetZoomFactor(long nZoom)
         nZoom = mnMinZoom;
 
     // Set the zoom factor at the window's map mode.
-    if (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering())
+    if (!comphelper::LibreOfficeKit::isActive())
     {
         MapMode aMap(GetMapMode());
         aMap.SetScaleX(Fraction(nZoom, 100));
@@ -569,7 +570,7 @@ void Window::UpdateMapOrigin(bool bInvalidate)
     maPrevSize = aWinSize;
 
     // When tiled rendering, the above UpdateMapMode() call doesn't touch the map mode.
-    if (bChanged && bInvalidate && (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering()))
+    if (bChanged && bInvalidate && !comphelper::LibreOfficeKit::isActive())
         Invalidate();
 }
 
@@ -609,7 +610,7 @@ void Window::UpdateMapMode()
     Point aNewOrigin (-maWinPos.X(), -maWinPos.Y());
     maWinPos += maViewOrigin;
 
-    if (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering())
+    if (!comphelper::LibreOfficeKit::isActive())
     {
         MapMode aMap(GetMapMode());
         aMap.SetOrigin(aNewOrigin);
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index b86daec..628292f 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -71,6 +71,7 @@
 #include <svtools/soerr.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <svx/charthelper.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace com::sun::star;
 
@@ -390,7 +391,7 @@ void ViewShell::SetZoomRect(const Rectangle& rZoomRect)
         mpContentWindow->UpdateMapOrigin();
 
         // When tiled rendering, UpdateMapOrigin() doesn't touch the map mode.
-        if (!GetDoc()->isTiledRendering())
+        if (!comphelper::LibreOfficeKit::isActive())
             // #i74769# see above
             mpContentWindow->Invalidate(InvalidateFlags::Children);
     }
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index a3e92b0..67a38fe 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -65,6 +65,7 @@
 #include <svx/fontworkbar.hxx>
 #include <svx/svdoutl.hxx>
 #include <tools/diagnose_ex.h>
+#include <comphelper/lok.hxx>
 
 #include <svl/slstitm.hxx>
 #include <sfx2/request.hxx>
@@ -500,7 +501,7 @@ void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
 void ViewShell::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
 {
     // When we're not doing tiled rendering, then positions must be passed as pixels.
-    assert(GetDoc()->isTiledRendering());
+    assert(comphelper::LibreOfficeKit::isActive());
 
     Point aPoint = mpActiveWindow->GetPointerPosPixel();
     mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel());
@@ -513,7 +514,7 @@ void ViewShell::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
 void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
 {
     // When we're not doing tiled rendering, then positions must be passed as pixels.
-    assert(GetDoc()->isTiledRendering());
+    assert(comphelper::LibreOfficeKit::isActive());
 
     Point aPoint = mpActiveWindow->GetPointerPosPixel();
     mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel());
@@ -526,7 +527,7 @@ void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
 void ViewShell::LogicMouseMove(const MouseEvent& rMouseEvent)
 {
     // When we're not doing tiled rendering, then positions must be passed as pixels.
-    assert(GetDoc()->isTiledRendering());
+    assert(comphelper::LibreOfficeKit::isActive());
 
     Point aPoint = mpActiveWindow->GetPointerPosPixel();
     mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel());


More information about the Libreoffice-commits mailing list