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 @@
*/
#include "sdstring.hrc"
String STR_SAR_NOT_FOUND
{
Text [ en-US ] = "Search key not found.";
};
String STR_SAR_WRAP_FORWARD
{
......
......@@ -459,10 +459,6 @@ String STR_OBJECTS
{
Text [ en-US ] = "Objects" ;
};
String STR_END_SEARCHING
{
Text [ en-US ] = "The document search is finished." ;
};
String STR_END_SPELLING
{
Text [ en-US ] = "Spellcheck of entire document has been completed." ;
......@@ -507,10 +503,6 @@ String STR_UNDO_SET_PRESLAYOUT
{
Text [ en-US ] = "Apply presentation layout" ;
};
String STR_STRING_NOTFOUND
{
Text [ en-US ] = "Search key not found." ;
};
String STR_PLAY
{
Text [ en-US ] = "~Play" ;
......
......@@ -20,7 +20,6 @@
#define SID_SD_STRING_START RID_APP_START+300
// 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_BACKWARD SID_SD_STRING_START+25
#define STR_SAR_WRAP_FORWARD_DRAW SID_SD_STRING_START+26
......
......@@ -200,7 +200,6 @@
#define STR_IMPORT_GRFILTER_TOOBIG (RID_APP_START+340)
#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_NOLANGUAGE (RID_APP_START+344)
#define STR_ASK_FOR_CONVERT_TO_BEZIER (RID_APP_START+347)
......@@ -210,7 +209,6 @@
#define STR_UNDO_INSERT_FILE (RID_APP_START+352)
#define STR_UNDO_INSERT_SPECCHAR (RID_APP_START+353)
#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_STOP (RID_APP_START+357)
#define STR_UNDO_ORIGINALSIZE (RID_APP_START+359)
......
......@@ -439,6 +439,9 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
{
bool bEndOfSearch = true;
// clear the search toolbar entry
SvxSearchDialogWrapper::SetSearchLabel(SL_Empty);
mpDrawDocument->GetDocSh()->SetWaitCursor( true );
if (mbPrepareSpellingPending)
PrepareSpelling();
......@@ -718,8 +721,7 @@ bool Outliner::SearchAndReplaceOnce()
mpDrawDocument->GetDocSh()->SetWaitCursor( false );
// notify LibreOfficeKit about changed page
if (pViewShell && pViewShell->GetDoc()->isTiledRendering() &&
mbStringFound && pViewShell->ISA(DrawViewShell))
if (pViewShell && pViewShell->GetDoc()->isTiledRendering() && mbStringFound)
{
OString aPayload = OString::number(maCurrentPosition.mnPageIndex);
pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr());
......@@ -1040,86 +1042,73 @@ void Outliner::EndOfSearch()
void Outliner::ShowEndOfSearchDialog()
{
OUString aString;
mbWholeDocumentProcessed = true;
if (meMode == SEARCH)
{
if (mbStringFound)
aString = SD_RESSTR(STR_END_SEARCHING);
else
if (!mbStringFound)
{
aString = SD_RESSTR(STR_STRING_NOTFOUND);
SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
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
{
if (mpView->AreObjectsMarked())
aString = SD_RESSTR(STR_END_SPELLING_OBJ);
else
aString = SD_RESSTR(STR_END_SPELLING);
}
aString = SD_RESSTR(STR_END_SPELLING);
// Show the message in an info box that is modal with respect to the
// whole application.
ScopedVclPtrInstance< MessageDialog > aInfoBox(nullptr, aString, VCL_MESSAGE_INFO);
ShowModalMessageBox (*aInfoBox.get());
mbWholeDocumentProcessed = true;
}
bool Outliner::ShowWrapArroundDialog()
{
bool bDoWrapArround = false;
// Determine whether to show the dialog.
bool bShowDialog = false;
if (mpSearchItem != NULL)
if (mpSearchItem)
{
// When searching display the dialog only for single find&replace.
const SvxSearchCmd nCommand (mpSearchItem->GetCommand());
bShowDialog = (nCommand==SvxSearchCmd::REPLACE)
|| (nCommand==SvxSearchCmd::FIND);
}
else
// Spell checking needs the dialog, too.
bShowDialog = (meMode == SPELL);
boost::shared_ptr<ViewShell> pViewShell(mpWeakViewShell.lock());
if (pViewShell && pViewShell->GetDoc()->isTiledRendering())
{
// Wrap around without asking anything.
bShowDialog = false;
bDoWrapArround = true;
}
const SvxSearchCmd nCommand(mpSearchItem->GetCommand());
if (nCommand == SvxSearchCmd::REPLACE || nCommand == SvxSearchCmd::FIND)
{
if (mbDirectionIsForward)
SvxSearchDialogWrapper::SetSearchLabel(SL_End);
else
SvxSearchDialogWrapper::SetSearchLabel(SL_Start);
if (bShowDialog)
{
// 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;
return true;
}
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());
bDoWrapArround = (nBoxResult == RET_YES);
return false;
}
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)
......@@ -1375,16 +1364,15 @@ bool Outliner::HandleFailedSearch()
// that there is no match.
if (HasNoPreviousMatch ())
{
// No match found in the whole presentation. Tell the user.
ScopedVclPtrInstance< InfoBox > aInfoBox(nullptr, SD_RESSTR(STR_SAR_NOT_FOUND));
ShowModalMessageBox (*aInfoBox.get());
// No match found in the whole presentation.
SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
}
else
{
// No further matches found. Ask the user whether to wrap
// around and start again.
bContinueSearch = ShowWrapArroundDialog ();
bContinueSearch = ShowWrapArroundDialog();
}
}
......
......@@ -26,4 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchLabel"/>
</toolbar:toolbar>
......@@ -26,4 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:MatchCase"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchDialog"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SearchLabel"/>
</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