[Libreoffice-commits] core.git: 2 commits - sd/source sd/uiconfig vcl/source

Jan Holesovsky kendy at collabora.com
Thu May 28 09:27:09 PDT 2015


 sd/source/ui/app/sdstring.src            |    4 -
 sd/source/ui/app/strings.src             |    8 --
 sd/source/ui/inc/sdstring.hrc            |    1 
 sd/source/ui/inc/strings.hrc             |    2 
 sd/source/ui/view/Outliner.cxx           |  118 +++++++++++++------------------
 sd/uiconfig/sdraw/toolbar/findbar.xml    |    2 
 sd/uiconfig/simpress/toolbar/findbar.xml |    2 
 vcl/source/window/window2.cxx            |    4 +
 8 files changed, 60 insertions(+), 81 deletions(-)

New commits:
commit bc37514ed6b8694872d0e958428a940ca9835619
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu May 28 18:23:25 2015 +0200

    fdo#74132: Do not interrupt search in Impress and Draw.
    
    Apparently this was forgotten; Writer and Calc already support this.
    
    Change-Id: I1a187b54294cb84a1b48ef8e855cc75df3f75dd7

diff --git a/sd/source/ui/app/sdstring.src b/sd/source/ui/app/sdstring.src
index 2198a1a..6751765 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 ed790cf..6308c02 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 9d11d16..abf2acf 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 a5da566..ca3f496a 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 feebd92d..a92766d 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 4e8ec6b..807ffbf 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 4e8ec6b..807ffbf 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>
commit 9d6f44ccdd5eed7dd9f1a21612be3eca01aeb429
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu May 28 16:39:48 2015 +0200

    vcl: Do nothing when we don't have mpWindowImpl.
    
    Avoids a crash in Impress search.
    
    Change-Id: I07106e0185a1fe4cfa09a6783396c0d48b028f10

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 717f5d7..fc3b1ff 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1723,6 +1723,8 @@ bool Window::set_property(const OString &rKey, const OString &rValue)
 
 void Window::set_height_request(sal_Int32 nHeightRequest)
 {
+    if (!mpWindowImpl)
+        return;
 
     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
 
@@ -1735,6 +1737,8 @@ void Window::set_height_request(sal_Int32 nHeightRequest)
 
 void Window::set_width_request(sal_Int32 nWidthRequest)
 {
+    if (!mpWindowImpl)
+        return;
 
     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
 


More information about the Libreoffice-commits mailing list