[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 6 commits - editeng/source include/editeng include/svx sc/source sd/qa sd/source sfx2/source svx/source sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Sun Jun 12 13:14:06 UTC 2016


 editeng/source/editeng/editview.cxx          |    4 ++--
 editeng/source/editeng/impedit.cxx           |   17 ++++++++++++++++-
 editeng/source/editeng/impedit.hxx           |    4 +++-
 editeng/source/outliner/outlvw.cxx           |    8 +++++---
 include/editeng/editview.hxx                 |    3 ++-
 include/editeng/outliner.hxx                 |   12 ++++++++++--
 include/svx/svdmodel.hxx                     |    9 ++++++++-
 sc/source/core/data/document.cxx             |    6 ++++++
 sc/source/ui/app/inputhdl.cxx                |    2 +-
 sc/source/ui/view/tabvwshf.cxx               |   18 +++++++++++++-----
 sc/source/ui/view/viewdata.cxx               |    3 ++-
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   26 +++++++++++++++++++++++++-
 sd/source/ui/view/Outliner.cxx               |    2 ++
 sfx2/source/doc/sfxbasemodel.cxx             |   11 ++++++++++-
 svx/source/svdraw/svdedxv.cxx                |    2 +-
 svx/source/svdraw/svdmodel.cxx               |   24 ++++++++++++++++++++++++
 sw/inc/PostItMgr.hxx                         |    3 ++-
 sw/source/core/view/viewsh.cxx               |    2 +-
 sw/source/uibase/docvw/PostItMgr.cxx         |    6 +++---
 sw/source/uibase/docvw/SidebarWin.cxx        |    4 ++--
 20 files changed, 138 insertions(+), 28 deletions(-)

New commits:
commit a9c74302a54965aa7b7797ca248455e739eb7d16
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jan 14 14:20:40 2016 +0100

    editeng: handle SdrModel::isTiledSearching()
    
    Given that the edit/outliner views can come and go, avoid the lifecycle
    problems with just passing a pointer to the sdr model to editeng, and
    then it'll always have the up to date "are we searching" information.
    
    editeng can't depend on svx, so provide an interface class SdrModel can
    implement.
    
    (cherry picked from commit 7b5d20983dfbfb458898eeab54828ba5fef5841f)
    
    Change-Id: I3b98011593b00ac0fab05b6b9c591dd20d94c579

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 5653731..229cff5 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -592,9 +592,9 @@ bool EditView::isTiledRendering()
     return pImpEditView->isTiledRendering();
 }
 
-void EditView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData)
+void EditView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData, OutlinerSearchable *pSearchable)
 {
-    pImpEditView->registerLibreOfficeKitCallback(pCallback, pLibreOfficeKitData);
+    pImpEditView->registerLibreOfficeKitCallback(pCallback, pLibreOfficeKitData, pSearchable);
 }
 
 void EditView::SetControlWord( EVControlBits nWord )
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 8475a6a..bcbbf45 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -26,6 +26,7 @@
 #include <impedit.hxx>
 #include <editeng/editeng.hxx>
 #include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
 #include <tools/poly.hxx>
 #include <editeng/unolingu.hxx>
 #include <com/sun/star/linguistic2/XDictionaryEntry.hpp>
@@ -81,6 +82,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo
     mbTiledRendering    = false;
     mpLibreOfficeKitCallback = nullptr;
     mpLibreOfficeKitData = nullptr;
+    mpLibreOfficeKitSearchable = nullptr;
     nScrollDiffX        = 0;
     nExtraCursorFlags   = 0;
     nCursorBidiLevel    = CURSOR_BIDILEVEL_DONTKNOW;
@@ -128,14 +130,27 @@ bool ImpEditView::isTiledRendering() const
     return mbTiledRendering;
 }
 
-void ImpEditView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData)
+void ImpEditView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData, OutlinerSearchable* pSearchable)
 {
     mpLibreOfficeKitCallback = pCallback;
     mpLibreOfficeKitData = pData;
+    mpLibreOfficeKitSearchable = pSearchable;
 }
 
 void ImpEditView::libreOfficeKitCallback(int nType, const char* pPayload) const
 {
+    if (mpLibreOfficeKitSearchable && mpLibreOfficeKitSearchable->isTiledSearching())
+    {
+        switch (nType)
+        {
+        case LOK_CALLBACK_TEXT_SELECTION:
+        case LOK_CALLBACK_TEXT_SELECTION_START:
+        case LOK_CALLBACK_TEXT_SELECTION_END:
+        case LOK_CALLBACK_GRAPHIC_SELECTION:
+            return;
+        }
+    }
+
     if (mpLibreOfficeKitCallback)
         mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData);
 }
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 40bb0f7..ca05b3b 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -80,6 +80,7 @@
 
 class EditView;
 class EditEngine;
+class OutlinerSearchable;
 
 class SvxSearchItem;
 class SvxLRSpaceItem;
@@ -225,6 +226,7 @@ private:
     bool                mbTiledRendering;
     LibreOfficeKitCallback mpLibreOfficeKitCallback;
     void* mpLibreOfficeKitData;
+    OutlinerSearchable* mpLibreOfficeKitSearchable;
     EditEngine*         pEditEngine;
     VclPtr<vcl::Window> pOutWin;
     Pointer*            pPointer;
@@ -372,7 +374,7 @@ public:
     void            setTiledRendering(bool bTiledRendering);
     bool            isTiledRendering() const;
     /// @see vcl::ITiledRenderable::registerCallback().
-    void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
+    void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData, OutlinerSearchable* pSearchable);
     /// Invokes the registered callback, if there are any.
     void libreOfficeKitCallback(int nType, const char* pPayload) const;
 
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 782d0e2..412a897 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1437,9 +1437,9 @@ void OutlinerView::setTiledRendering(bool bTiledRendering)
     pEditView->setTiledRendering(bTiledRendering);
 }
 
-void OutlinerView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData)
+void OutlinerView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData, OutlinerSearchable* pSearchable)
 {
-    pEditView->registerLibreOfficeKitCallback(pCallback, pLibreOfficeKitData);
+    pEditView->registerLibreOfficeKitCallback(pCallback, pLibreOfficeKitData, pSearchable);
 }
 
 Color OutlinerView::GetBackgroundColor()
@@ -1467,7 +1467,9 @@ Selection OutlinerView::GetSurroundingTextSelection() const
     return pEditView->GetSurroundingTextSelection();
 }
 
-
+OutlinerSearchable::~OutlinerSearchable()
+{
+}
 
 // ===== some code for thesaurus sub menu within context menu
 
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 7de96d9..485d8d4 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -36,6 +36,7 @@
 class EditEngine;
 class ImpEditEngine;
 class ImpEditView;
+class OutlinerSearchable;
 class SvxSearchItem;
 class SvxFieldItem;
 namespace vcl { class Window; }
@@ -185,7 +186,7 @@ public:
     void            setTiledRendering(bool bTiledRendering);
     bool            isTiledRendering();
     /// @see vcl::ITiledRenderable::registerCallback().
-    void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
+    void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData, OutlinerSearchable *pSearchable);
 
     void            SetControlWord( EVControlBits nWord );
     EVControlBits   GetControlWord() const;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 4d3ef5b..0a5b54e 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -73,7 +73,7 @@ class SvKeyValueIterator;
 class SvxForbiddenCharactersTable;
 class OverflowingText;
 class NonOverflowingText;
-
+class OutlinerSearchable;
 
 namespace svl
 {
@@ -277,7 +277,7 @@ public:
     /// Set if we are doing tiled rendering.
     void        setTiledRendering(bool bTiledRendering);
     /// @see vcl::ITiledRenderable::registerCallback().
-    void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
+    void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData, OutlinerSearchable* pSearchable);
 
     SfxItemSet  GetAttribs();
 
@@ -379,6 +379,14 @@ public:
     void        SetEndCutPasteLinkHdl(const Link<LinkParamNone*,void> &rLink) { aEndCutPasteLink = rLink; }
 };
 
+/// Interface class to know if we do tiled searching.
+class EDITENG_DLLPUBLIC OutlinerSearchable
+{
+public:
+    virtual ~OutlinerSearchable();
+
+    virtual bool isTiledSearching() const = 0;
+};
 
 // some thesaurus functionality to avoid code duplication in different projects...
 bool EDITENG_DLLPUBLIC  GetStatusValueForThesaurusFromContext( OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView );
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 9842b4b..635e59d 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <cppuhelper/weakref.hxx>
 #include <editeng/forbiddencharacterstable.hxx>
+#include <editeng/outliner.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/link.hxx>
 #include <tools/weakbase.hxx>
@@ -149,7 +150,7 @@ public:
 
 struct SdrModelImpl;
 
-class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase< SdrModel >
+class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase< SdrModel >, public OutlinerSearchable
 {
 protected:
     std::vector<SdrPage*> maMaPag;     // master pages
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2395cba..00026e8 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1726,7 +1726,7 @@ void ScInputHandler::UpdateActiveView()
         if (rDoc.GetDrawLayer()->isTiledRendering())
         {
             ScDrawLayer *pDrawLayer = pDocShell->GetDocument().GetDrawLayer();
-            pTableView->registerLibreOfficeKitCallback(pDrawLayer->getLibreOfficeKitCallback(), pDrawLayer->getLibreOfficeKitData());
+            pTableView->registerLibreOfficeKitCallback(pDrawLayer->getLibreOfficeKitCallback(), pDrawLayer->getLibreOfficeKitData(), pDrawLayer);
             pTableView->setTiledRendering(true);
         }
     }
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 3488ed9..31f28c1 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -940,7 +940,8 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
         if (pDoc->GetDrawLayer() && pDoc->GetDrawLayer()->isTiledRendering())
         {
             pEditView[eWhich]->registerLibreOfficeKitCallback(pDoc->GetDrawLayer()->getLibreOfficeKitCallback(),
-                                                              pDoc->GetDrawLayer()->getLibreOfficeKitData());
+                                                              pDoc->GetDrawLayer()->getLibreOfficeKitData(),
+                                                              pDoc->GetDrawLayer());
             pEditView[eWhich]->setTiledRendering(true);
         }
     }
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 7952b22..01c9bc5 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -59,6 +59,7 @@ public:
     void testSearchAllSelections();
     void testResizeTable();
     void testResizeTableColumn();
+    void testSearchAllNotifications();
 #endif
 
     CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
@@ -75,6 +76,7 @@ public:
     CPPUNIT_TEST(testSearchAllSelections);
     CPPUNIT_TEST(testResizeTable);
     CPPUNIT_TEST(testResizeTableColumn);
+    CPPUNIT_TEST(testSearchAllNotifications);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -95,6 +97,8 @@ private:
     std::vector<OString> m_aSearchResultSelection;
     std::vector<int> m_aSearchResultPart;
     xmlBufferPtr m_pXmlBuffer;
+    int m_nSelectionBeforeSearchResult;
+    int m_nSelectionAfterSearchResult;
 #endif
 };
 
@@ -102,7 +106,9 @@ SdTiledRenderingTest::SdTiledRenderingTest()
 #if !defined(WNT) && !defined(MACOSX)
     : m_bFound(true),
       m_nPart(0),
-      m_pXmlBuffer(nullptr)
+      m_pXmlBuffer(nullptr),
+      m_nSelectionBeforeSearchResult(0),
+      m_nSelectionAfterSearchResult(0)
 #endif
 {
 }
@@ -192,6 +198,10 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
             lcl_convertRectangle(rString, aRectangle);
             m_aSelection.push_back(aRectangle);
         }
+        if (m_aSearchResultSelection.empty())
+            ++m_nSelectionBeforeSearchResult;
+        else
+            ++m_nSelectionAfterSearchResult;
     }
     break;
     case LOK_CALLBACK_SEARCH_NOT_FOUND:
@@ -589,6 +599,20 @@ void SdTiledRenderingTest::testResizeTableColumn()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SdTiledRenderingTest::testSearchAllNotifications()
+{
+    comphelper::LibreOfficeKit::setActive();
+    SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
+    pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
+
+    lcl_search("third", /*bFindAll=*/true);
+    // Make sure that we get no notifications about selection changes during search.
+    CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult);
+    // But we do get the selection of the first hit.
+    CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0);
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 #endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 492906d..66e323a 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -462,7 +462,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP
     pOutlView->SetControlWord(nStat);
     pOutlView->SetBackgroundColor( aBackground );
     pOutlView->setTiledRendering(GetModel()->isTiledRendering());
-    pOutlView->registerLibreOfficeKitCallback(GetModel()->getLibreOfficeKitCallback(), GetModel()->getLibreOfficeKitData());
+    pOutlView->registerLibreOfficeKitCallback(GetModel()->getLibreOfficeKitCallback(), GetModel()->getLibreOfficeKitData(), GetModel());
     if (pText!=nullptr)
     {
         pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode()));
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index b41bdb3..d4f21ca 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -63,6 +63,7 @@ class SwSidebarItem;
 class SwFrame;
 namespace vcl { class Window; }
 struct ImplSVEvent;
+class OutlinerSearchable;
 
 #define COL_NOTES_SIDEPANE_ARROW_ENABLED    RGB_COLORDATA(0,0,0)
 #define COL_NOTES_SIDEPANE_ARROW_DISABLED   RGB_COLORDATA(172,168,153)
@@ -291,7 +292,7 @@ class SwPostItMgr: public SfxListener
         void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage);
         void PaintTile(OutputDevice& rRenderContext, const Rectangle& rRect);
         /// Informs already created annotations about a newly registered LOK callback.
-        void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData);
+        void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData, OutlinerSearchable* pSearchable);
 };
 
 #endif
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 33ae463..a49685b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -118,7 +118,7 @@ void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallbac
 {
     getIDocumentDrawModelAccess().GetDrawModel()->registerLibreOfficeKitCallback(pCallback, pData);
     if (SwPostItMgr* pPostItMgr = GetPostItMgr())
-        pPostItMgr->registerLibreOfficeKitCallback(pCallback, pData);
+        pPostItMgr->registerLibreOfficeKitCallback(pCallback, pData, getIDocumentDrawModelAccess().GetDrawModel());
 }
 
 void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index d985940..86be220 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -881,7 +881,7 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe
     }
 }
 
-void SwPostItMgr::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData)
+void SwPostItMgr::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData, OutlinerSearchable* pSearchable)
 {
     for (SwSidebarItem* pItem : mvPostItFields)
     {
@@ -889,8 +889,8 @@ void SwPostItMgr::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallbac
         if (!pPostIt)
             continue;
 
-        pPostIt->GetOutlinerView()->setTiledRendering(mpWrtShell->isTiledRendering());
-        pPostIt->GetOutlinerView()->registerLibreOfficeKitCallback(pCallback, pData);
+        pPostIt->GetOutlinerView()->setTiledRendering(comphelper::LibreOfficeKit::isActive());
+        pPostIt->GetOutlinerView()->registerLibreOfficeKitCallback(pCallback, pData, pSearchable);
     }
 }
 
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 400a464..8e9ef75 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -618,8 +618,8 @@ void SwSidebarWin::InitControls()
         LibreOfficeKitCallback pCallback = nullptr;
         void* pData = nullptr;
         pDrawModel->getLibreOfficeKitCallback(pCallback, pData);
-        mpOutlinerView->setTiledRendering(mrView.GetWrtShellPtr()->isTiledRendering());
-        mpOutlinerView->registerLibreOfficeKitCallback(pCallback, pData);
+        mpOutlinerView->setTiledRendering(comphelper::LibreOfficeKit::isActive());
+        mpOutlinerView->registerLibreOfficeKitCallback(pCallback, pData, pDrawModel);
     }
 
     //create Scrollbars
commit 023e5d5edc5a024fd43a001a15011c5aef7e8adf
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jan 14 11:22:13 2016 +0100

    sd tiled rendering: it's pointless to send selection changes during search all
    
    But they do cause annoying flashing.
    
    Change-Id: Ic313a15429c5db98c5660a5274aa49e95dd217e5
    (cherry picked from commit b9565ef0a73c235cd1e14fce9031db6e9237c524)

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index d692374..9842b4b 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -178,6 +178,8 @@ protected:
     bool mbTiledRendering;
     LibreOfficeKitCallback mpLibreOfficeKitCallback;
     void* mpLibreOfficeKitData;
+    /// Set if we are in the middle of a tiled search.
+    bool mbTiledSearching;
     sal_uIntPtr           nProgressAkt;   // for the
     sal_uIntPtr           nProgressMax;   // ProgressBar-
     sal_uIntPtr           nProgressOfs;   // -Handler
@@ -347,6 +349,10 @@ public:
     void*                getLibreOfficeKitData() const;
     /// Invokes the registered callback, if there are any.
     void                 libreOfficeKitCallback(int nType, const char* pPayload) const;
+    /// Set if we are doing tiled searching.
+    void                 setTiledSearching(bool bTiledSearching);
+    /// Are we doing tiled searching?
+    bool                 isTiledSearching() const;
     // If a new MapMode is set on the RefDevice (or similar)
     void                 RefDeviceChanged(); // not yet implemented
     // default font height in logical units
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index ddf899e..d9b08e3 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -616,6 +616,7 @@ bool Outliner::SearchAndReplaceAll()
     }
     else if( nullptr != dynamic_cast< const DrawViewShell *>( pViewShell.get() ))
     {
+        pViewShell->GetDoc()->setTiledSearching(true);
         // Go to beginning/end of document.
         maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin();
         // Switch to the first object which contains the search string.
@@ -665,6 +666,7 @@ bool Outliner::SearchAndReplaceAll()
             OString aPayload = aStream.str().c_str();
             pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr());
         }
+        pViewShell->GetDoc()->setTiledSearching(false);
     }
 
     RestoreStartPosition ();
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 4f5ca08..97eb3a4 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -90,6 +90,7 @@
 #include <vcl/svapp.hxx>
 #include <memory>
 #include <libxml/xmlwriter.h>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -128,6 +129,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
     mbTiledRendering = false;
     mpLibreOfficeKitCallback = nullptr;
     mpLibreOfficeKitData = nullptr;
+    mbTiledSearching = false;
     nProgressAkt=0;
     nProgressMax=0;
     nProgressOfs=0;
@@ -835,10 +837,32 @@ void SdrModel::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback,
 
 void SdrModel::libreOfficeKitCallback(int nType, const char* pPayload) const
 {
+    if (mbTiledSearching)
+    {
+        switch (nType)
+        {
+        case LOK_CALLBACK_TEXT_SELECTION:
+        case LOK_CALLBACK_TEXT_SELECTION_START:
+        case LOK_CALLBACK_TEXT_SELECTION_END:
+        case LOK_CALLBACK_GRAPHIC_SELECTION:
+            return;
+        }
+    }
+
     if (mpLibreOfficeKitCallback)
         mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData);
 }
 
+void SdrModel::setTiledSearching(bool bTiledSearching)
+{
+    mbTiledSearching = bTiledSearching;
+}
+
+bool SdrModel::isTiledSearching() const
+{
+    return mbTiledSearching;
+}
+
 LibreOfficeKitCallback SdrModel::getLibreOfficeKitCallback() const
 {
     return mpLibreOfficeKitCallback;
commit 37a0c28b0b20a8db001bc92f5e1f25792a0ac39f
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Jan 14 11:52:18 2016 +0100

    sfx2: Convert the exception to one that we actually announce.
    
    Otherwise saving to a non-existing http:// URL leads to a crash.
    
    Change-Id: Ia4b49e2872616545dcedb2fc5553cf5a20a1f97d

diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 56ae242..53c5242 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1697,7 +1697,16 @@ void SAL_CALL SfxBaseModel::storeToURL( const   OUString&                   rURL
     {
         m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "storeToURL" );
         SfxSaveGuard aSaveGuard(this, m_pData, false);
-        impl_store( rURL, rArgs, true );
+        try {
+            impl_store(rURL, rArgs, true);
+        }
+        catch (const uno::Exception &e)
+        {
+            // convert to the exception we announce in the throw
+            // (eg. neon likes to throw InteractiveAugmentedIOException which
+            // is not an io::IOException)
+            throw io::IOException(e.Message, e.Context);
+        }
     }
 }
 
commit b5118e2871b348f7a6830eadb30097e96414798d
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 13 15:03:37 2016 +0100

    sc: Fix the unit tests.
    
    Change-Id: I1d5ea5835115bca3c8d24dc1f2e43c14d5d7b47a
    (cherry picked from commit 395b69a2c8a205a0fcb40c31651031fe9e1a4583)

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 464bf03..dae9bd4 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -105,6 +105,7 @@
 #include <memory>
 #include <boost/checked_delete.hpp>
 
+#include <comphelper/lok.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include "mtvelements.hxx"
@@ -569,7 +570,7 @@ bool ScDocument::InsertTab(
         aCxt.mnTabDeletedEnd = nPos;
         SetAllFormulasDirty(aCxt);
 
-        if (GetDrawLayer()->isTiledRendering())
+        if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
             GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
     }
 
commit 4056e31404616985d15e8c6f1d9bb756e6ee6d68
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 13 11:56:34 2016 +0100

    sc: Further .uno:Insert (inserting a new sheet) tweak.
    
    Change-Id: I5437e173009be2b21594abfa133c1b48e53a2ff3
    (cherry picked from commit 19ef189f3bebe46a412d22fb6205b0e4c1aa377f)

diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 0aed03b..4371353 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -193,8 +193,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                         else
                             --nTabNr;
 
-                        if ( nTabNr <= nTabCount )
-                            bOk = InsertTable( aName, nTabNr );
+                        if (nTabNr > nTabCount)
+                            nTabNr = nTabCount;
+
+                        bOk = InsertTable(aName, nTabNr);
                     }
 
                     if (bOk)
commit 8057e89cf964f8afaed0c569d9e59281b262912d
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 13 11:12:12 2016 +0100

    sc: Make .uno:Insert (inserting a new sheet) always succeed.
    
    Also, when provided with '0' as the sheet number, treat it as adding at the
    end - which I think is the usual use case one wants to target.
    
    Change-Id: I9e1a1733c2310b8c6bb7ff239351e88bbef09ac7
    (cherry picked from commit b70b579b7cc27a6bd2a348acf474b2c2e3fd7e9a)

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 721877f..464bf03 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -105,6 +105,8 @@
 #include <memory>
 #include <boost/checked_delete.hpp>
 
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
 #include "mtvelements.hxx"
 
 using ::editeng::SvxBorderLine;
@@ -566,6 +568,9 @@ bool ScDocument::InsertTab(
         aCxt.mnTabDeletedStart = nPos;
         aCxt.mnTabDeletedEnd = nPos;
         SetAllFormulasDirty(aCxt);
+
+        if (GetDrawLayer()->isTiledRendering())
+            GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
     }
 
     return bValid;
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 6c8d7de..0aed03b 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -178,15 +178,21 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     bool bOk = false;
                     const SfxPoolItem*  pTabItem;
                     const SfxPoolItem*  pNameItem;
-                    OUString            aName;
 
                     if ( pReqArgs->HasItem( FN_PARAM_1, &pTabItem ) &&
                          pReqArgs->HasItem( nSlot, &pNameItem ) )
                     {
+                        OUString aName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
+                        pDoc->CreateValidTabName(aName);
+
                         // sheet number from basic: 1-based
+                        // 0 is special, means adding at the end
+                        nTabNr = static_cast<const SfxUInt16Item*>(pTabItem)->GetValue();
+                        if (nTabNr == 0)
+                            nTabNr = nTabCount;
+                        else
+                            --nTabNr;
 
-                        aName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
-                        nTabNr = static_cast<const SfxUInt16Item*>(pTabItem)->GetValue() - 1;
                         if ( nTabNr <= nTabCount )
                             bOk = InsertTable( aName, nTabNr );
                     }


More information about the Libreoffice-commits mailing list