diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-05-28 18:23:25 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-05-28 18:24:39 +0200 |
commit | bc37514ed6b8694872d0e958428a940ca9835619 (patch) | |
tree | f1f184eb0ce24fe237c5285ab2369d6a35ae11e4 /sd | |
parent | 9d6f44ccdd5eed7dd9f1a21612be3eca01aeb429 (diff) |
fdo#74132: Do not interrupt search in Impress and Draw.
Apparently this was forgotten; Writer and Calc already support this.
Change-Id: I1a187b54294cb84a1b48ef8e855cc75df3f75dd7
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/app/sdstring.src | 4 | ||||
-rw-r--r-- | sd/source/ui/app/strings.src | 8 | ||||
-rw-r--r-- | sd/source/ui/inc/sdstring.hrc | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/strings.hrc | 2 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 118 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/toolbar/findbar.xml | 2 | ||||
-rw-r--r-- | sd/uiconfig/simpress/toolbar/findbar.xml | 2 |
7 files changed, 56 insertions, 81 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 feebd92d62b2..a92766d05054 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,12 +721,9 @@ 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) { - ::boost::shared_ptr<DrawViewShell> pDrawViewShell(::boost::dynamic_pointer_cast<DrawViewShell>(pViewShell)); - - sal_uInt16 nSelectedPage = pDrawViewShell->GetCurPageId() - 1; + sal_uInt16 nSelectedPage = maCurrentPosition.mnPageIndex; if (nSelectedPage != mnStartPageIndex) { OString aPayload = OString::number(nSelectedPage); @@ -1065,86 +1065,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) @@ -1400,16 +1387,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> |