Kaydet (Commit) 948d606b authored tarafından Jan Holesovsky's avatar Jan Holesovsky Kaydeden (comit) Adolfo Jayme Barrientos

fdo#74132: Do not interrupt search in Impress and Draw.

Apparently this was forgotten; Writer and Calc already support this.

Change-Id: I1a187b54294cb84a1b48ef8e855cc75df3f75dd7
Reviewed-on: https://gerrit.libreoffice.org/15953Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Reviewed-by: 's avatarAdolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: 's avatarAdolfo Jayme Barrientos <fitojb@ubuntu.com>
üst 0722427f
...@@ -18,10 +18,6 @@ ...@@ -18,10 +18,6 @@
*/ */
#include "sdstring.hrc" #include "sdstring.hrc"
String STR_SAR_NOT_FOUND
{
Text [ en-US ] = "Search key not found.";
};
String STR_SAR_WRAP_FORWARD String STR_SAR_WRAP_FORWARD
{ {
......
...@@ -459,10 +459,6 @@ String STR_OBJECTS ...@@ -459,10 +459,6 @@ String STR_OBJECTS
{ {
Text [ en-US ] = "Objects" ; Text [ en-US ] = "Objects" ;
}; };
String STR_END_SEARCHING
{
Text [ en-US ] = "The document search is finished." ;
};
String STR_END_SPELLING String STR_END_SPELLING
{ {
Text [ en-US ] = "Spellcheck of entire document has been completed." ; Text [ en-US ] = "Spellcheck of entire document has been completed." ;
...@@ -507,10 +503,6 @@ String STR_UNDO_SET_PRESLAYOUT ...@@ -507,10 +503,6 @@ String STR_UNDO_SET_PRESLAYOUT
{ {
Text [ en-US ] = "Apply presentation layout" ; Text [ en-US ] = "Apply presentation layout" ;
}; };
String STR_STRING_NOTFOUND
{
Text [ en-US ] = "Search key not found." ;
};
String STR_PLAY String STR_PLAY
{ {
Text [ en-US ] = "~Play" ; Text [ en-US ] = "~Play" ;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#define SID_SD_STRING_START RID_APP_START+300 #define SID_SD_STRING_START RID_APP_START+300
// Texts for search and replace info and question boxes. // Texts for search and replace info and question boxes.
#define STR_SAR_NOT_FOUND SID_SD_STRING_START+23
#define STR_SAR_WRAP_FORWARD SID_SD_STRING_START+24 #define STR_SAR_WRAP_FORWARD SID_SD_STRING_START+24
#define STR_SAR_WRAP_BACKWARD SID_SD_STRING_START+25 #define STR_SAR_WRAP_BACKWARD SID_SD_STRING_START+25
#define STR_SAR_WRAP_FORWARD_DRAW SID_SD_STRING_START+26 #define STR_SAR_WRAP_FORWARD_DRAW SID_SD_STRING_START+26
......
...@@ -200,7 +200,6 @@ ...@@ -200,7 +200,6 @@
#define STR_IMPORT_GRFILTER_TOOBIG (RID_APP_START+340) #define STR_IMPORT_GRFILTER_TOOBIG (RID_APP_START+340)
#define STR_OBJECTS (RID_APP_START+341) #define STR_OBJECTS (RID_APP_START+341)
#define STR_END_SEARCHING (RID_APP_START+342)
#define STR_END_SPELLING (RID_APP_START+343) #define STR_END_SPELLING (RID_APP_START+343)
#define STR_NOLANGUAGE (RID_APP_START+344) #define STR_NOLANGUAGE (RID_APP_START+344)
#define STR_ASK_FOR_CONVERT_TO_BEZIER (RID_APP_START+347) #define STR_ASK_FOR_CONVERT_TO_BEZIER (RID_APP_START+347)
...@@ -210,7 +209,6 @@ ...@@ -210,7 +209,6 @@
#define STR_UNDO_INSERT_FILE (RID_APP_START+352) #define STR_UNDO_INSERT_FILE (RID_APP_START+352)
#define STR_UNDO_INSERT_SPECCHAR (RID_APP_START+353) #define STR_UNDO_INSERT_SPECCHAR (RID_APP_START+353)
#define STR_UNDO_SET_PRESLAYOUT (RID_APP_START+354) #define STR_UNDO_SET_PRESLAYOUT (RID_APP_START+354)
#define STR_STRING_NOTFOUND (RID_APP_START+355)
#define STR_PLAY (RID_APP_START+356) #define STR_PLAY (RID_APP_START+356)
#define STR_STOP (RID_APP_START+357) #define STR_STOP (RID_APP_START+357)
#define STR_UNDO_ORIGINALSIZE (RID_APP_START+359) #define STR_UNDO_ORIGINALSIZE (RID_APP_START+359)
......
...@@ -439,6 +439,9 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) ...@@ -439,6 +439,9 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
{ {
bool bEndOfSearch = true; bool bEndOfSearch = true;
// clear the search toolbar entry
SvxSearchDialogWrapper::SetSearchLabel(SL_Empty);
mpDrawDocument->GetDocSh()->SetWaitCursor( true ); mpDrawDocument->GetDocSh()->SetWaitCursor( true );
if (mbPrepareSpellingPending) if (mbPrepareSpellingPending)
PrepareSpelling(); PrepareSpelling();
...@@ -718,8 +721,7 @@ bool Outliner::SearchAndReplaceOnce() ...@@ -718,8 +721,7 @@ bool Outliner::SearchAndReplaceOnce()
mpDrawDocument->GetDocSh()->SetWaitCursor( false ); mpDrawDocument->GetDocSh()->SetWaitCursor( false );
// notify LibreOfficeKit about changed page // notify LibreOfficeKit about changed page
if (pViewShell && pViewShell->GetDoc()->isTiledRendering() && if (pViewShell && pViewShell->GetDoc()->isTiledRendering() && mbStringFound)
mbStringFound && pViewShell->ISA(DrawViewShell))
{ {
OString aPayload = OString::number(maCurrentPosition.mnPageIndex); OString aPayload = OString::number(maCurrentPosition.mnPageIndex);
pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr());
...@@ -1040,86 +1042,73 @@ void Outliner::EndOfSearch() ...@@ -1040,86 +1042,73 @@ void Outliner::EndOfSearch()
void Outliner::ShowEndOfSearchDialog() void Outliner::ShowEndOfSearchDialog()
{ {
OUString aString; mbWholeDocumentProcessed = true;
if (meMode == SEARCH) if (meMode == SEARCH)
{ {
if (mbStringFound) if (!mbStringFound)
aString = SD_RESSTR(STR_END_SEARCHING);
else
{ {
aString = SD_RESSTR(STR_STRING_NOTFOUND); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
mpDrawDocument->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpDrawDocument->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
mpSearchItem->GetSearchString().toUtf8().getStr()); mpSearchItem->GetSearchString().toUtf8().getStr());
} }
// don't do anything else for search
return;
} }
OUString aString;
if (mpView->AreObjectsMarked())
aString = SD_RESSTR(STR_END_SPELLING_OBJ);
else else
{ aString = SD_RESSTR(STR_END_SPELLING);
if (mpView->AreObjectsMarked())
aString = SD_RESSTR(STR_END_SPELLING_OBJ);
else
aString = SD_RESSTR(STR_END_SPELLING);
}
// Show the message in an info box that is modal with respect to the // Show the message in an info box that is modal with respect to the
// whole application. // whole application.
ScopedVclPtrInstance< MessageDialog > aInfoBox(nullptr, aString, VCL_MESSAGE_INFO); ScopedVclPtrInstance< MessageDialog > aInfoBox(nullptr, aString, VCL_MESSAGE_INFO);
ShowModalMessageBox (*aInfoBox.get()); ShowModalMessageBox (*aInfoBox.get());
mbWholeDocumentProcessed = true;
} }
bool Outliner::ShowWrapArroundDialog() bool Outliner::ShowWrapArroundDialog()
{ {
bool bDoWrapArround = false;
// Determine whether to show the dialog. // Determine whether to show the dialog.
bool bShowDialog = false; if (mpSearchItem)
if (mpSearchItem != NULL)
{ {
// When searching display the dialog only for single find&replace. // When searching display the dialog only for single find&replace.
const SvxSearchCmd nCommand (mpSearchItem->GetCommand()); const SvxSearchCmd nCommand(mpSearchItem->GetCommand());
bShowDialog = (nCommand==SvxSearchCmd::REPLACE) if (nCommand == SvxSearchCmd::REPLACE || nCommand == SvxSearchCmd::FIND)
|| (nCommand==SvxSearchCmd::FIND); {
} if (mbDirectionIsForward)
else SvxSearchDialogWrapper::SetSearchLabel(SL_End);
// Spell checking needs the dialog, too. else
bShowDialog = (meMode == SPELL); SvxSearchDialogWrapper::SetSearchLabel(SL_Start);
boost::shared_ptr<ViewShell> pViewShell(mpWeakViewShell.lock());
if (pViewShell && pViewShell->GetDoc()->isTiledRendering())
{
// Wrap around without asking anything.
bShowDialog = false;
bDoWrapArround = true;
}
if (bShowDialog) return true;
{ }
// The question text depends on the search direction.
bool bImpress = mpDrawDocument!=NULL
&& mpDrawDocument->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
sal_uInt16 nStringId;
if (mbDirectionIsForward)
nStringId = bImpress
? STR_SAR_WRAP_FORWARD
: STR_SAR_WRAP_FORWARD_DRAW;
else else
nStringId = bImpress return false;
? STR_SAR_WRAP_BACKWARD
: STR_SAR_WRAP_BACKWARD_DRAW;
// Pop up question box that asks the user whether to wrap around.
// The dialog is made modal with respect to the whole application.
ScopedVclPtrInstance<QueryBox> aQuestionBox (
nullptr, WB_YES_NO | WB_DEF_YES, SD_RESSTR(nStringId));
aQuestionBox->SetImage (QueryBox::GetStandardImage());
sal_uInt16 nBoxResult = ShowModalMessageBox(*aQuestionBox.get());
bDoWrapArround = (nBoxResult == RET_YES);
} }
return bDoWrapArround; // show dialog only for spelling
if (meMode != SPELL)
return false;
// The question text depends on the search direction.
bool bImpress = mpDrawDocument && mpDrawDocument->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
sal_uInt16 nStringId;
if (mbDirectionIsForward)
nStringId = bImpress ? STR_SAR_WRAP_FORWARD : STR_SAR_WRAP_FORWARD_DRAW;
else
nStringId = bImpress ? STR_SAR_WRAP_BACKWARD : STR_SAR_WRAP_BACKWARD_DRAW;
// Pop up question box that asks the user whether to wrap around.
// The dialog is made modal with respect to the whole application.
ScopedVclPtrInstance<QueryBox> aQuestionBox(nullptr, WB_YES_NO | WB_DEF_YES, SD_RESSTR(nStringId));
aQuestionBox->SetImage(QueryBox::GetStandardImage());
sal_uInt16 nBoxResult = ShowModalMessageBox(*aQuestionBox.get());
return (nBoxResult == RET_YES);
} }
bool Outliner::IsValidTextObject (const ::sd::outliner::IteratorPosition& rPosition) bool Outliner::IsValidTextObject (const ::sd::outliner::IteratorPosition& rPosition)
...@@ -1375,16 +1364,15 @@ bool Outliner::HandleFailedSearch() ...@@ -1375,16 +1364,15 @@ bool Outliner::HandleFailedSearch()
// that there is no match. // that there is no match.
if (HasNoPreviousMatch ()) if (HasNoPreviousMatch ())
{ {
// No match found in the whole presentation. Tell the user. // No match found in the whole presentation.
ScopedVclPtrInstance< InfoBox > aInfoBox(nullptr, SD_RESSTR(STR_SAR_NOT_FOUND)); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
ShowModalMessageBox (*aInfoBox.get());
} }
else else
{ {
// No further matches found. Ask the user whether to wrap // No further matches found. Ask the user whether to wrap
// around and start again. // around and start again.
bContinueSearch = ShowWrapArroundDialog (); bContinueSearch = ShowWrapArroundDialog();
} }
} }
......
...@@ -26,4 +26,6 @@ ...@@ -26,4 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/> <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/> <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/> <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchLabel"/>
</toolbar:toolbar> </toolbar:toolbar>
...@@ -26,4 +26,6 @@ ...@@ -26,4 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/> <toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/> <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/> <toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchLabel"/>
</toolbar:toolbar> </toolbar:toolbar>
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