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

Miklos Vajna vmiklos at collabora.co.uk
Sat May 23 03:20:38 PDT 2015


 include/LibreOfficeKit/LibreOfficeKitEnums.h |   10 +++++++++-
 libreofficekit/source/gtk/lokdocview.cxx     |    9 ++++++++-
 sw/source/uibase/uiview/view2.cxx            |    2 ++
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 490365b2452cb6fa96749475d996c6033b0d6407
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat May 23 10:44:07 2015 +0100

    lokdocview: update doc size on LOK_CALLBACK_PAGE_COUNT_CHANGED
    
    No need to do any actual rendering, the invalidation callback takes care
    of that.
    
    Change-Id: I9a3e45cab5250fc45eccb4577fe76377f76354eb

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index b2b7f2c..664baa2 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -911,6 +911,8 @@ const char* LOKDocView_Impl::callbackTypeToString(int nType)
         return "LOK_CALLBACK_STATUS_INDICATOR_FINISH";
     case LOK_CALLBACK_SEARCH_NOT_FOUND:
         return "LOK_CALLBACK_SEARCH_NOT_FOUND";
+    case LOK_CALLBACK_PAGE_COUNT_CHANGED:
+        return "LOK_CALLBACK_PAGE_COUNT_CHANGED";
     }
     return 0;
 }
@@ -1008,6 +1010,11 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
         searchNotFound(pCallback->m_aPayload);
     }
     break;
+    case LOK_CALLBACK_PAGE_COUNT_CHANGED:
+    {
+        m_pDocument->pClass->getDocumentSize(m_pDocument, &m_nDocumentWidthTwips, &m_nDocumentHeightTwips);
+    }
+    break;
     default:
         g_assert(false);
         break;
@@ -1031,7 +1038,7 @@ void LOKDocView_Impl::globalCallbackWorker(int nType, const char* pPayload, void
 
 void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload)
 {
-    LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload, m_pDocView);
+    LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView);
     g_info("lok_docview_callback_worker: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload);
 #if GTK_CHECK_VERSION(2,12,0)
     gdk_threads_add_idle(LOKDocView_Impl::callback, pCallback);
commit fb2e4da0e20fea3c085ddec899376e7f3671e1b1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat May 23 10:43:41 2015 +0100

    SwView::UpdatePageNums: add LOK callback about page count change
    
    Change-Id: If9ab69c9f3ec3f9f518738792ff020ef4cfd6390

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 9b65e88..ba4db82 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -140,7 +140,15 @@ typedef enum
     /**
      * No match was found for the search input
      */
-    LOK_CALLBACK_SEARCH_NOT_FOUND
+    LOK_CALLBACK_SEARCH_NOT_FOUND,
+
+    /**
+     * Number of pages changed in the document.
+     *
+     * Clients should assume that data returned by an earlier
+     * lok::Document::getDocumentSize() call is no longer valid.
+     */
+    LOK_CALLBACK_PAGE_COUNT_CHANGED
 }
 LibreOfficeKitCallbackType;
 
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index b6f947d..a8ce619 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -147,6 +147,7 @@
 #include <vcl/settings.hxx>
 
 #include <boost/scoped_ptr.hpp>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 const char sStatusDelim[] = " : ";
 const char sStatusComma[] = " , ";
@@ -1280,6 +1281,7 @@ void SwView::Execute(SfxRequest &rReq)
 /// invalidate page numbering field
 void SwView::UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr)
 {
+    GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_PAGE_COUNT_CHANGED, 0);
     OUString sTemp(GetPageStr( nPhyNum, nVirtNum, rPgStr ));
     const SfxStringItem aTmp( FN_STAT_PAGE, sTemp );
     // Used to distinguish which tooltip to show


More information about the Libreoffice-commits mailing list