summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-05-28 18:23:25 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-06-02 05:33:18 +0000
commit948d606b0260a33a5db77061f560afebde3fcdb7 (patch)
treeb89b5107f2d8f14bb3af41b92ec9ffe5dd8275b3
parent0722427f7e0d7181a10149d3ac21579836b51b39 (diff)
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/15953 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--sd/source/ui/app/sdstring.src4
-rw-r--r--sd/source/ui/app/strings.src8
-rw-r--r--sd/source/ui/inc/sdstring.hrc1
-rw-r--r--sd/source/ui/inc/strings.hrc2
-rw-r--r--sd/source/ui/view/Outliner.cxx114
-rw-r--r--sd/uiconfig/sdraw/toolbar/findbar.xml2
-rw-r--r--sd/uiconfig/simpress/toolbar/findbar.xml2
7 files changed, 55 insertions, 78 deletions
diff --git a/sd/source/ui/app/sdstring.src b/sd/source/ui/app/sdstring.src
index 2198a1a2e5ff..6751765441fd 100644
--- a/sd/source/ui/app/sdstring.src
+++ b/sd/source/ui/app/sdstring.src
@@ -18,10 +18,6 @@
*/
#include "sdstring.hrc"
-String STR_SAR_NOT_FOUND
-{
- Text [ en-US ] = "Search key not found.";
-};
String STR_SAR_WRAP_FORWARD
{
diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src
index ed790cfb9d6e..6308c02e15a0 100644
--- a/sd/source/ui/app/strings.src
+++ b/sd/source/ui/app/strings.src
@@ -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" ;
diff --git a/sd/source/ui/inc/sdstring.hrc b/sd/source/ui/inc/sdstring.hrc
index 9d11d16181ad..abf2acf68755 100644
--- a/sd/source/ui/inc/sdstring.hrc
+++ b/sd/source/ui/inc/sdstring.hrc
@@ -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
diff --git a/sd/source/ui/inc/strings.hrc b/sd/source/ui/inc/strings.hrc
index a5da566ec55a..ca3f496af9f1 100644
--- a/sd/source/ui/inc/strings.hrc
+++ b/sd/source/ui/inc/strings.hrc
@@ -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)
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index ba9651249b0e..e073118c4a8f 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -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();
}
}
diff --git a/sd/uiconfig/sdraw/toolbar/findbar.xml b/sd/uiconfig/sdraw/toolbar/findbar.xml
index 4e8ec6ba0743..807ffbfa2dcd 100644
--- a/sd/uiconfig/sdraw/toolbar/findbar.xml
+++ b/sd/uiconfig/sdraw/toolbar/findbar.xml
@@ -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>
diff --git a/sd/uiconfig/simpress/toolbar/findbar.xml b/sd/uiconfig/simpress/toolbar/findbar.xml
index 4e8ec6ba0743..807ffbfa2dcd 100644
--- a/sd/uiconfig/simpress/toolbar/findbar.xml
+++ b/sd/uiconfig/simpress/toolbar/findbar.xml
@@ -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>