[Libreoffice-commits] core.git: 2 commits - include/LibreOfficeKit libreofficekit/source sw/source tools/source

Mihai Varga mihai.varga at collabora.com
Tue May 19 02:59:45 PDT 2015


 include/LibreOfficeKit/LibreOfficeKitEnums.h |    7 ++++++-
 libreofficekit/source/gtk/lokdocview.cxx     |    4 ++++
 sw/source/uibase/uiview/viewsrch.cxx         |   15 +++++++++++++++
 tools/source/generic/fract.cxx               |    6 ++++++
 4 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 158614a2abc35d122e467d2006830f2c5375aa84
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Tue May 19 10:55:18 2015 +0300

    LOKit callback for search not found
    
    Needed for signaling the user when no match was found for
    the searched input
    
    Change-Id: I171ee956d94d6fd83036ae34102c2f1bdd5661de
    Reviewed-on: https://gerrit.libreoffice.org/15798
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index aaf99be..ffa2f64 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -138,7 +138,12 @@ typedef enum
      *
      * Not necessarily ever emitted.
      */
-    LOK_CALLBACK_STATUS_INDICATOR_FINISH
+    LOK_CALLBACK_STATUS_INDICATOR_FINISH,
+
+    /**
+     * No match was found for the search input
+     */
+    LOK_CALLBACK_SEARCH_NOT_FOUND
 }
 LibreOfficeKitCallbackType;
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index f7f040a..47b57a6 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -914,6 +914,8 @@ const char* LOKDocView_Impl::callbackTypeToString(int nType)
         return "LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE";
     case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
         return "LOK_CALLBACK_STATUS_INDICATOR_FINISH";
+    case LOK_CALLBACK_SEARCH_NOT_FOUND:
+        return "LOK_CALLBACK_SEARCH_NOT_FOUND";
     }
     return 0;
 }
@@ -1006,6 +1008,8 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
         commandChanged(pCallback->m_aPayload);
     }
     break;
+    case LOK_CALLBACK_SEARCH_NOT_FOUND:
+    break;
     default:
         g_assert(false);
         break;
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index e1deaba..a7c7c88 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -57,6 +57,7 @@
 #include <docsh.hxx>
 #include <doc.hxx>
 #include <unocrsr.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <view.hrc>
 #include <SwRewriter.hxx>
@@ -213,7 +214,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
                 {
 #if HAVE_FEATURE_DESKTOP
                     if( !bApi )
+                    {
+                        m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
+                                m_pSrchItem->GetSearchString().toUtf8().getStr());
                         SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
+                    }
 #endif
                     m_bFound = false;
                 }
@@ -335,7 +340,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
                     {
 #if HAVE_FEATURE_DESKTOP
                         if( !bApi )
+                        {
+                            m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
+                                    m_pSrchItem->GetSearchString().toUtf8().getStr());
                             SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
+                        }
 #endif
                         m_bFound = false;
                         return;
@@ -511,6 +520,8 @@ bool SwView::SearchAndWrap(bool bApi)
         if( !bApi )
         {
 #if HAVE_FEATURE_DESKTOP
+            m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
+                    m_pSrchItem->GetSearchString().toUtf8().getStr());
             SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
 #endif
         }
@@ -551,7 +562,11 @@ bool SwView::SearchAndWrap(bool bApi)
             SvxSearchDialogWrapper::SetSearchLabel(SL_Start);
     }
     else if(!bApi)
+    {
+        m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
+                m_pSrchItem->GetSearchString().toUtf8().getStr());
         SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
+    }
 #endif
     return m_bFound;
 }
commit d6c80f239ee7487e38ce17afdb02c160fca7d313
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 19 11:42:04 2015 +0200

    tools: check for data loss in WriteFraction
    
    Currently it's only used in VCL's MapMode.
    
    Change-Id: Ib8ce09fadc704bc4d592d333d4cf3bddc9185036

diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index b5db1e0..72ce43d 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -384,6 +384,12 @@ SvStream& WriteFraction( SvStream& rOStream, const Fraction& rFract )
         rOStream.WriteInt32( 0 );
         rOStream.WriteInt32( -1 );
     } else {
+#if OSL_DEBUG_LEVEL > 0
+        // can only write 32 bits - check that no data is lost!
+        boost::rational<sal_Int64> copy(rFract.mpImpl->value);
+        rational_ReduceInaccurate(copy, 32);
+        assert(copy == rFract.mpImpl->value && "data loss in WriteFraction!");
+#endif
         rOStream.WriteInt32( rFract.mpImpl->value.numerator() );
         rOStream.WriteInt32( rFract.mpImpl->value.denominator() );
     }


More information about the Libreoffice-commits mailing list