Blame SOURCES/0207-sd-tiled-rendering-search-rectangle-is-part-specific.patch

135360
From 303f6bd02ad4cbaec4caf67682da5aed87b2ccaa Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Wed, 14 Oct 2015 12:32:12 +0200
135360
Subject: [PATCH 207/398] sd tiled rendering: search rectangle is part-specific
135360
135360
Change-Id: I88865db539779bc401550d7b4a3729b89d7e18b1
135360
(cherry picked from commit dd1fc2242a64a0b9ae8031a5edc7ecfcde4ec3df)
135360
---
135360
 sd/inc/Outliner.hxx            | 16 +++++++++++++++-
135360
 sd/source/ui/view/Outliner.cxx | 16 +++++++++++-----
135360
 2 files changed, 26 insertions(+), 6 deletions(-)
135360
135360
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx
135360
index f01e244de308..9f1f6aae3e8a 100644
135360
--- a/sd/inc/Outliner.hxx
135360
+++ b/sd/inc/Outliner.hxx
135360
@@ -41,6 +41,20 @@ class View;
135360
 class ViewShell;
135360
 class Window;
135360
 
135360
+/// Describes a single search hit: a set of rectangles on a given page.
135360
+struct SearchSelection
135360
+{
135360
+    /// 0-based index of the page that has the selection.
135360
+    int m_nPage;
135360
+    /**
135360
+     * List of selection rectangles in twips -- multiple rectangles only in
135360
+     * case the selection spans over more layout lines.
135360
+     */
135360
+    OString m_aRectangles;
135360
+
135360
+    SearchSelection(int nPage, const OString& rRectangles);
135360
+};
135360
+
135360
 /** The main purpose of this class is searching and replacing as well as
135360
     spelling of impress documents.  The main part of both tasks lies in
135360
     iterating over the pages and view modes of a document and apply the
135360
@@ -364,7 +378,7 @@ private:
135360
             The return value specifies whether the search ended (</sal_True>) or
135360
             another call to this method is required (</sal_False>).
135360
     */
135360
-    bool SearchAndReplaceOnce(std::vector<OString>* pSelections = 0);
135360
+    bool SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections = 0);
135360
 
135360
     /** Detect changes of the document or view and react accordingly.  Such
135360
         changes may occur because different calls to
135360
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
135360
index e02e879494b8..22db187ab7c8 100644
135360
--- a/sd/source/ui/view/Outliner.cxx
135360
+++ b/sd/source/ui/view/Outliner.cxx
135360
@@ -83,6 +83,12 @@ class SfxStyleSheetPool;
135360
 
135360
 namespace sd {
135360
 
135360
+SearchSelection::SearchSelection(int nPage, const OString& rRectangles)
135360
+    : m_nPage(nPage),
135360
+    m_aRectangles(rRectangles)
135360
+{
135360
+}
135360
+
135360
 class Outliner::Implementation
135360
 {
135360
 public:
135360
@@ -621,7 +627,7 @@ bool Outliner::SearchAndReplaceAll()
135360
 
135360
         // Search/replace until the end of the document is reached.
135360
         bool bFoundMatch;
135360
-        std::vector<OString> aSelections;
135360
+        std::vector<SearchSelection> aSelections;
135360
         do
135360
         {
135360
             bFoundMatch = ! SearchAndReplaceOnce(&aSelections);
135360
@@ -634,10 +640,10 @@ bool Outliner::SearchAndReplaceAll()
135360
             aTree.put("searchString", mpSearchItem->GetSearchString().toUtf8().getStr());
135360
 
135360
             boost::property_tree::ptree aChildren;
135360
-            for (const OString& rSelection : aSelections)
135360
+            for (const SearchSelection& rSelection : aSelections)
135360
             {
135360
                 boost::property_tree::ptree aChild;
135360
-                aChild.put("", rSelection.getStr());
135360
+                aChild.put("", rSelection.m_aRectangles.getStr());
135360
                 aChildren.push_back(std::make_pair("", aChild));
135360
             }
135360
             aTree.add_child("searchResultSelection", aChildren);
135360
@@ -655,7 +661,7 @@ bool Outliner::SearchAndReplaceAll()
135360
     return true;
135360
 }
135360
 
135360
-bool Outliner::SearchAndReplaceOnce(std::vector<OString>* pSelections)
135360
+bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections)
135360
 {
135360
     DetectChange ();
135360
 
135360
@@ -775,7 +781,7 @@ bool Outliner::SearchAndReplaceOnce(std::vector<OString>* pSelections)
135360
         }
135360
         else
135360
         {
135360
-            pSelections->push_back(sRectangles);
135360
+            pSelections->push_back(SearchSelection(maCurrentPosition.mnPageIndex, sRectangles));
135360
         }
135360
     }
135360
 
135360
-- 
135360
2.12.0
135360