Kaydet (Commit) 6372080c authored tarafından Miklos Vajna's avatar Miklos Vajna

sd: use ScopeGuard in Outliner::SearchAndReplaceAll()

So the flag will be reset on early return as well.

Change-Id: Ib086ec4a02dda291a0291a8ac40660c16de0fbf6
üst abbf57dd
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <comphelper/lok.hxx> #include <comphelper/lok.hxx>
#include <comphelper/scopeguard.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -617,7 +618,10 @@ bool Outliner::SearchAndReplaceAll() ...@@ -617,7 +618,10 @@ bool Outliner::SearchAndReplaceAll()
} }
else if( nullptr != dynamic_cast< const DrawViewShell *>( pViewShell.get() )) else if( nullptr != dynamic_cast< const DrawViewShell *>( pViewShell.get() ))
{ {
// Disable selection change notifications during search all.
pViewShell->GetDoc()->setTiledSearching(true); pViewShell->GetDoc()->setTiledSearching(true);
comphelper::ScopeGuard aGuard([pViewShell]() { pViewShell->GetDoc()->setTiledSearching(false); });
// Go to beginning/end of document. // Go to beginning/end of document.
maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin();
// Switch to the first object which contains the search string. // Switch to the first object which contains the search string.
...@@ -667,7 +671,6 @@ bool Outliner::SearchAndReplaceAll() ...@@ -667,7 +671,6 @@ bool Outliner::SearchAndReplaceAll()
OString aPayload = aStream.str().c_str(); OString aPayload = aStream.str().c_str();
pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr());
} }
pViewShell->GetDoc()->setTiledSearching(false);
} }
RestoreStartPosition (); RestoreStartPosition ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment