[Libreoffice-commits] core.git: Branch 'feature/lok_dialog2' - 8 commits - desktop/source include/LibreOfficeKit include/sfx2 libreofficekit/qa sfx2/source solenv/bin vcl/source

Jan Holesovsky kendy at collabora.com
Tue Nov 28 10:54:25 UTC 2017


Rebased ref, commits from common ancestor:
commit 316a2cf644f08c10045406fee073dee49c88a030
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Nov 28 11:52:16 2017 +0100

    Fix 'unused parameter' warnings.
    
    Change-Id: I8478e907a66ca918eddc7a543cbcf23e17d9ee5a

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0261040e4d35..95d4cda6ecd9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2247,7 +2247,7 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
     pDoc->postKeyEvent(nType, nCharCode, nKeyCode);
 }
 
-static void doc_postDialogKeyEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode)
+static void doc_postDialogKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode)
 {
     SolarMutexGuard aGuard;
 
@@ -2425,7 +2425,7 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
     }
 }
 
-static void doc_postDialogMouseEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+static void doc_postDialogMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
 {
     SolarMutexGuard aGuard;
 
@@ -2456,7 +2456,7 @@ static void doc_postDialogMouseEvent(LibreOfficeKitDocument* pThis, unsigned nLO
     }
 }
 
-static void doc_postDialogChildMouseEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+static void doc_postDialogChildMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
 {
     SolarMutexGuard aGuard;
 
@@ -3263,7 +3263,7 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
     return nullptr;
 }
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
+static void doc_paintDialog(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId,
                             unsigned char* pBuffer,
                             const int nX, const int nY,
                             const int nWidth, const int nHeight)
@@ -3291,7 +3291,7 @@ static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId
     comphelper::LibreOfficeKit::setDialogPainting(false);
 }
 
-static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, int* nWidth, int* nHeight)
+static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, unsigned char* pBuffer, int* nWidth, int* nHeight)
 {
     SolarMutexGuard aGuard;
 
commit 56eca864aa1241ac74d9f2e16cc62e8e66afa177
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Nov 28 02:53:48 2017 +0530

    lokdialog: Remove getDialogInfo + update gtktiledviewer accordingly.
    
    Change-Id: I6f810c97f2fadd3b1ea602a97e24c8b42f4a84b9

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ece7600f178d..0261040e4d35 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -615,9 +615,6 @@ static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId
                             const int nX, const int nY,
                             const int nWidth, const int nHeight);
 
-static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
-                              char** pDialogTitle, int* nWidth, int* nHeight);
-
 static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, int* nWidth, int* nHeight);
 
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
@@ -670,7 +667,6 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->getPartHash = doc_getPartHash;
 
         m_pDocumentClass->paintDialog = doc_paintDialog;
-        m_pDocumentClass->getDialogInfo = doc_getDialogInfo;
         m_pDocumentClass->paintActiveFloatingWindow = doc_paintActiveFloatingWindow;
 
         gDocumentClass = m_pDocumentClass;
@@ -3267,35 +3263,6 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
     return nullptr;
 }
 
-static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
-                              char** pDialogTitle, int* nWidth, int* nHeight)
-{
-    // FIXME - I guess we should kill this one, and use only the callback
-    // "created"?
-
-    SolarMutexGuard aGuard;
-
-    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
-    if (!pWindow)
-    {
-        gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
-        return;
-    }
-
-    OUString aDialogTitle(pWindow->GetText());
-    const Size aSize = pWindow->GetSizePixel();
-    *nWidth = aSize.getWidth();
-    *nHeight = aSize.getHeight();
-
-    // copy dialog title
-    if (!aDialogTitle.isEmpty())
-    {
-        OString aTitleString = OUStringToOString(aDialogTitle, RTL_TEXTENCODING_UTF8);
-        *pDialogTitle = static_cast<char*>(malloc(aTitleString.getLength() + 1));
-        strcpy(*pDialogTitle, aTitleString.getStr());
-    }
-}
-
 static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
                             unsigned char* pBuffer,
                             const int nX, const int nY,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 071da712703e..e623ecb2508e 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -273,11 +273,6 @@ struct _LibreOfficeKitDocumentClass
                          const int x, const int y,
                          const int width, const int height);
 
-    /// Get info about dialog with given dialog id
-    /// @see lok::Document::getDialogInfo().
-    void (*getDialogInfo) (LibreOfficeKitDocument* pThis, unsigned nDialogId,
-                           char** pDialogTitle, int* pWidth, int* pHeight);
-
     /// @see lok::Document::paintActiveFloatingWindow().
     void (*paintActiveFloatingWindow) (LibreOfficeKitDocument* pThis, unsigned nDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index c99b425daff6..86ceab46c484 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -178,23 +178,6 @@ public:
                                           x, y, width, height);
     }
 
-    /* Get info about dialog with given dialog id
-     *
-     * @param nDialogId Unique dialog id for which to get info about
-     * @param pDialogTitle Pointer to pointer pointing to string containing the
-     * dialog title. Caller should the pointer to allocated string themselves.
-     * @param pWidth The width of the dialog
-     * @param pHeight The height of the dialog
-     */
-    void getDialogInfo(unsigned nDialogId,
-                       char** pDialogTitle,
-                       int& pWidth,
-                       int& pHeight)
-    {
-        return mpDoc->pClass->getDialogInfo(mpDoc, nDialogId, pDialogTitle, &pWidth, &pHeight);
-
-    }
-
     /**
      * Renders the active floating window of a dialog
      *
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index b5325cf853c0..74cb58e09d48 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -94,9 +94,9 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer)
     GdkRectangle aRect;
     gdk_cairo_get_clip_rectangle(pCairo, &aRect);
     g_info("Painting dialog region: %d, %d, %d, %d", aRect.x, aRect.y, aRect.width, aRect.height);
+
     int nWidth = priv->m_nWidth;
     int nHeight = priv->m_nHeight;
-    g_info("canvas width: %d and height %d", nWidth, nHeight);
     if (aRect.width != 0 && aRect.height != 0)
     {
         nWidth = aRect.width;
@@ -106,18 +106,9 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer)
     cairo_surface_t* pSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight);
     unsigned char* pBuffer = cairo_image_surface_get_data(pSurface);
     LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(priv->lokdocview));
-    char* pDialogTitle = nullptr;
     pDocument->pClass->paintDialog(pDocument, priv->dialogid, pBuffer, aRect.x, aRect.y, nWidth, nHeight);
-    int outWidth = 0, outHeight = 0;
-    pDocument->pClass->getDialogInfo(pDocument, priv->dialogid, &pDialogTitle, &outWidth, &outHeight);
-    g_debug("getDialogInfo: width: %d, height: %d", outWidth, outHeight);
-    if (pDialogTitle)
-    {
-        gtk_window_set_title(GTK_WINDOW(pDialog), pDialogTitle);
-        free(pDialogTitle);
-    }
 
-    gtk_widget_set_size_request(GTK_WIDGET(pDialogDrawingArea), outWidth, outHeight);
+    gtk_widget_set_size_request(GTK_WIDGET(pDialogDrawingArea), priv->m_nWidth, priv->m_nHeight);
 
     cairo_surface_flush(pSurface);
     cairo_surface_mark_dirty(pSurface);
@@ -411,6 +402,9 @@ gtv_lok_dialog_set_property(GObject* object, guint propId, const GValue* value,
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec);
     }
+
+    //if (propId == PROP_DIALOG_WIDTH || propId == PROP_DIALOG_HEIGHT)
+    //  gtk_widget_set_size_request(GTK_WIDGET(priv->pDialogDrawingArea), priv->m_nWidth, priv->m_nHeight);
 }
 
 static void
@@ -692,6 +686,7 @@ void gtv_lok_dialog_child_close(GtvLokDialog* dialog)
 GtkWidget*
 gtv_lok_dialog_new(LOKDocView* pDocView, guint dialogId, guint width, guint height)
 {
+    g_debug("Dialog [ %d ] of size: %d x %d created", dialogId, width, height);
     GtkWindow* pWindow = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
     return GTK_WIDGET(g_object_new(GTV_TYPE_LOK_DIALOG,
                                    "lokdocview", pDocView,
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 62f639957d2b..79839aeccad2 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -331,14 +331,35 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, gchar* pPayload, gpoint
 
     GList* pChildWins = gtv_application_window_get_all_child_windows(window);
     GList* pIt = nullptr;
-    for (pIt = pChildWins; pIt != nullptr; pIt = pIt->next)
+    bool found = false;
+    for (pIt = pChildWins; !found && pIt != nullptr; pIt = pIt->next)
     {
         guint nChildDialogId = 0;
         g_object_get(pIt->data, "dialogid", &nChildDialogId, nullptr);
         if (nDialogId == nChildDialogId)
         {
+            found = true;
+
             if (aAction == "close")
                 gtk_widget_destroy(GTK_WIDGET(pIt->data));
+            else if (aAction == "size_changed")
+            {
+                const std::string aSize = aRoot.get<std::string>("size");
+                std::vector<int> aSizePoints = GtvHelpers::splitIntoIntegers(aSize, ", ", 2);
+                if (aSizePoints.size() != 2)
+                {
+                    g_error("Malformed size_changed callback");
+                    break;
+                }
+
+                g_object_set(G_OBJECT(pIt->data),
+                             "width", aSizePoints[0],
+                             "height", aSizePoints[1],
+                             nullptr);
+
+                GdkRectangle aGdkRectangle = {0, 0, 0, 0};
+                gtv_lok_dialog_invalidate(GTV_LOK_DIALOG(pIt->data), aGdkRectangle);
+            }
             else if (aAction == "invalidate")
             {
                 GdkRectangle aGdkRectangle = {0, 0, 0, 0};
commit c2f9da7f10c532088c85849453ef2dbad9c28174
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Nov 28 02:25:36 2017 +0530

    lokdialog: Notify the current view only
    
    Change-Id: I55e0dbf1677a24905d337c58184a4419c1020a87

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index f9543e9d0471..d5d868010490 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -151,7 +151,7 @@ void SfxLokHelper::notifyWindow(vcl::LOKWindowId nLOKWindowId,
     if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0)
         return;
 
-    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+
     OString aPayload = OString("{ \"dialogId\": \"") + OString::number(nLOKWindowId) + OString("\"");
     aPayload += OString(", \"action\": \"") + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8).getStr() + OString("\"");
 
@@ -165,11 +165,8 @@ void SfxLokHelper::notifyWindow(vcl::LOKWindowId nLOKWindowId,
     }
     aPayload += "}";
 
-    while (pViewShell)
-    {
+    if (SfxViewShell* pViewShell = SfxViewShell::Current())
         pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DIALOG, aPayload.getStr());
-        pViewShell = SfxViewShell::GetNext(*pViewShell);
-    }
 }
 
 void SfxLokHelper::notifyWindowChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos)
@@ -177,17 +174,14 @@ void SfxLokHelper::notifyWindowChild(vcl::LOKWindowId nLOKWindowId, const OUStri
     if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0)
         return;
 
-    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+
     const OString aPayload = OString("{ \"dialogId\": \"") + OString::number(nLOKWindowId) +
         OString("\", \"action\": \"") + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8).getStr() +
         OString("\", \"position\": \"") + OString::number(rPos.getX()) + OString(", ") + OString::number(rPos.getY()) +
         + "\" }";
 
-    while (pViewShell)
-    {
+    if (SfxViewShell* pViewShell = SfxViewShell::Current())
         pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DIALOG_CHILD, aPayload.getStr());
-        pViewShell = SfxViewShell::GetNext(*pViewShell);
-    }
 }
 
 void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload)
commit cf805f1ecf0b907a6fa3c722f673a98735b02ead
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Nov 28 01:44:46 2017 +0530

    lokdialog: new callback size_changed with new size of the dialog
    
    Change-Id: Ibb864cb588ae7db92381c5578701d3ce09185f34

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 2ae4cf305530..e0bfc6cc1b06 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1224,9 +1224,12 @@ void Dialog::Resize()
     if (comphelper::LibreOfficeKit::isDialogPainting())
         return;
 
-    // inform LOK clients
     if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
-        pNotifier->notifyWindow(GetLOKWindowId(), "invalidate");
+    {
+        std::vector<vcl::LOKPayloadItem> aItems;
+        aItems.emplace_back(std::make_pair("size", GetOptimalSize().toString()));
+        pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
+    }
 }
 
 bool Dialog::set_property(const OString &rKey, const OUString &rValue)
commit 2eb0fc71dee54c5116361563dda6610bf4e4a5e5
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Nov 28 01:21:38 2017 +0530

    lokdialog: Emit "created" callback after initial dialog layouting
    
    StateChangeType::InitShow is a good indicator that layouting has
    finished; we can rely that the size as returned by vcl::Window will be
    correct.
    
    The problem previously was that borders were not calculated by the time
    "created" callback was emitted resulting in incorrect returned window
    size.
    
    Change-Id: I878c210dc2e7b3fe99123fe126830f58dc97feba

diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 6fdb41784ade..db885c7173a2 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -75,6 +75,7 @@ public:
     virtual short       Execute() override;
     const SfxItemSet*   GetOutputItemSet() const { return pOutputSet; }
     const SfxItemSet*   GetInputItemSet() const { return pInputSet; }
+    void                StateChanged( StateChangedType nStateChange ) override;
 };
 
 // class SfxModelessDialog --------------------------------------------------
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 533496966d12..4cdb4eaeee0b 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -190,6 +190,7 @@ public:
 
     short               Execute() override;
     void                StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) override;
+    void                StateChanged( StateChangedType nStateChange ) override;
     void                Start();
 
     const SfxItemSet*   GetExampleSet() const { return m_pExampleSet; }
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index e9cadef82db0..c20a046ec200 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -161,9 +161,9 @@ void SfxModalDialog::dispose()
     SetDialogData_Impl();
     delete pOutputSet;
 
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    if (comphelper::LibreOfficeKit::isActive())
     {
+        SfxViewShell* pViewShell = SfxViewShell::Current();
         pViewShell->notifyWindow(GetLOKWindowId(), "close");
         ReleaseLOKNotifier();
     }
@@ -173,17 +173,26 @@ void SfxModalDialog::dispose()
 
 short SfxModalDialog::Execute()
 {
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    // we need to set the notifier here to be able to launch the dialog
+    // otherwise dialog will die out in DialogCancelMode::Silent
+    if (comphelper::LibreOfficeKit::isActive())
+        SetLOKNotifier(SfxViewShell::Current());
+
+    return ModalDialog::Execute();
+}
+
+void SfxModalDialog::StateChanged(StateChangedType nType)
+{
+    ModalDialog::StateChanged(nType);
+
+    if (comphelper::LibreOfficeKit::isActive() && nType == StateChangedType::InitShow)
     {
-        SetLOKNotifier(pViewShell);
         const Size aSize = GetOptimalSize();
         std::vector<vcl::LOKPayloadItem> aItems;
         aItems.emplace_back(std::make_pair("size", aSize.toString()));
-        pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
+        SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "created", aItems);
     }
 
-    return ModalDialog::Execute();
 }
 
 void SfxModalDialog::CreateOutputItemSet( SfxItemPool& rPool )
@@ -244,22 +253,20 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
             }
         }
 
-        SfxViewShell* pViewShell = SfxViewShell::Current();
-        if (comphelper::LibreOfficeKit::isActive() && pViewShell)
-        {
-            SetLOKNotifier(pViewShell);
-            // Below method doesn't really give the exact dimensions,
-            // Check GetSizePixel() ?
-            const Size aOptimalSize = GetOptimalSize();
-            std::vector<vcl::LOKPayloadItem> aItems;
-            aItems.emplace_back(std::make_pair("size", aOptimalSize.toString()));
-            pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
-        }
-
         pImpl->bConstructed = true;
     }
 
     ModelessDialog::StateChanged( nStateChange );
+
+    if (comphelper::LibreOfficeKit::isActive() &&
+        nStateChange == StateChangedType::InitShow)
+    {
+        SfxViewShell* pViewShell = SfxViewShell::Current();
+        SetLOKNotifier(pViewShell);
+        std::vector<vcl::LOKPayloadItem> aItems;
+        aItems.emplace_back(std::make_pair("size", GetOptimalSize().toString()));
+        pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
+    }
 }
 
 void SfxModelessDialog::Initialize(SfxChildWinInfo const *pInfo)
@@ -388,9 +395,9 @@ void SfxModelessDialog::dispose()
         pBindings->SetActiveFrame( nullptr );
     pImpl.reset();
 
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    if (comphelper::LibreOfficeKit::isActive())
     {
+        SfxViewShell* pViewShell = SfxViewShell::Current();
         pViewShell->notifyWindow(GetLOKWindowId(), "close");
         ReleaseLOKNotifier();
     }
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index ce9e1a753984..c347a295f7ec 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -512,21 +512,29 @@ void SfxTabDialog::RemoveStandardButton()
     m_pBaseFmtBtn->Hide();
 }
 
-short SfxTabDialog::Execute()
+void SfxTabDialog::StateChanged( StateChangedType nType  )
 {
-    if ( !m_pTabCtrl->GetPageCount() )
-        return RET_CANCEL;
-    Start_Impl();
+    TabDialog::StateChanged(nType);
 
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    if (comphelper::LibreOfficeKit::isActive() && nType == StateChangedType::InitShow)
     {
-        SetLOKNotifier(pViewShell);
         const Size aSize = GetOptimalSize();
         std::vector<vcl::LOKPayloadItem> aItems;
         aItems.emplace_back(std::make_pair("size", aSize.toString()));
-        pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
+        SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "created", aItems);
     }
+}
+
+short SfxTabDialog::Execute()
+{
+    if ( !m_pTabCtrl->GetPageCount() )
+        return RET_CANCEL;
+    Start_Impl();
+
+    // we need to set the notifier here to be able to launch the dialog
+    // otherwise dialog will die out in DialogCancelMode::Silent
+    if (comphelper::LibreOfficeKit::isActive())
+        SetLOKNotifier(SfxViewShell::Current());
 
     return TabDialog::Execute();
 }
commit 0e8ad5c2234b117e5ec9fb27301af2b9fe6c7874
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Nov 27 23:25:35 2017 +0530

    etags: pass the "-e" flag directly to ctag binary
    
    'man ctags' says that emacs mode will be enabled if the ctags binary is
    renamed as etags or '-e' flag is provided to ctags binary.
    
    Before this patch, the script assumes that host system has an 'etags'
    binary renamed from 'ctags' program. This is not always the case in all
    hosts. Eg: In Fedora, 'etags' binary is provided by emacs-common package
    which doesn't understand the flags given later in the script.
    
    It is safe to just explicitly enable the emacs mode via '-e' flag to the
    ctags binary.
    
    Change-Id: Ic7ded56cff32683fc5e9d3fcc7405e79da4c23b7

diff --git a/solenv/bin/create-tags b/solenv/bin/create-tags
index dd4c1d3e46c0..c9fd565b823f 100755
--- a/solenv/bin/create-tags
+++ b/solenv/bin/create-tags
@@ -7,11 +7,7 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-ctags=ctags
-if test "$1" = "-e"; then
-    ctags=etags
-fi
-
+ctags="ctags $@"
 saloptions="-ISAL_DELETED_FUNCTION -ISAL_OVERRIDE -ISAL_FINAL"
 omnicppoptions="--c++-kinds=+p --fields=+iaS --extra=+q"
 
commit 4cc1ece9f8e0af3f8d5c074bb43d84066c23e256
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Nov 27 21:05:56 2017 +0530

    lokdialog: Emit callback when title is changed
    
    The plan is to remove the getDialogInfo from LOK API but one more step
    before doing that is to find out why the dialog size in 'created'
    dialog callback is less than what the actual dialog after painting is.
    
    Change-Id: I5176e175cbf7ed81c1465feeeea053c9a024fbd9

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 66cef2d575a5..2ae4cf305530 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -57,6 +57,7 @@
 #include <salframe.hxx>
 
 #include <iostream>
+#include <utility>
 
 static OString ImplGetDialogText( Dialog* pDialog )
 {
@@ -691,6 +692,15 @@ void Dialog::StateChanged( StateChangedType nType )
 
         ImplMouseAutoPos( this );
     }
+    else if (nType == StateChangedType::Text)
+    {
+        if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+        {
+            std::vector<vcl::LOKPayloadItem> aPayload;
+            aPayload.push_back(std::make_pair(OString("title"), GetText().toUtf8()));
+            pNotifier->notifyWindow(GetLOKWindowId(), "title_changed", aPayload);
+        }
+    }
 
     SystemWindow::StateChanged( nType );
 
commit baf695fdd241244c14584ea6a6b29af9f2ab22a1
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Nov 24 18:40:01 2017 +0530

    lokdialog: Launch dialogs which have a notifier registered
    
    Change-Id: I062fa291668b7dbfb8bc8e8d455a7933378ce7d9

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 2881754ff13e..66cef2d575a5 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -784,7 +784,7 @@ bool Dialog::ImplStartExecuteModal()
     case Application::DialogCancelMode::Off:
         break;
     case Application::DialogCancelMode::Silent:
-        if (ImplGetDialogText(this) == "Character")
+        if (GetLOKNotifier())
             break;
 
         SAL_INFO(


More information about the Libreoffice-commits mailing list