diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 15 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 2 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 5 | ||||
-rw-r--r-- | include/vcl/IDialogRenderable.hxx | 2 | ||||
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx | 13 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 5 |
7 files changed, 32 insertions, 12 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 0e1a023b887f..6da4125ddf1d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -631,7 +631,7 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, int* pFontHeight); static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart); -static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight); +static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* nHeight); static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight); @@ -3112,7 +3112,7 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/, return nullptr; } -static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight) +static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* nHeight) { SolarMutexGuard aGuard; @@ -3126,7 +3126,16 @@ static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* pDialogId vcl::DialogID aDialogID = OUString::createFromAscii(pDialogId); comphelper::LibreOfficeKit::setDialogPainting(true); - pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), *nWidth, *nHeight); + + // copy the title of the dialog to outparam + OUString aDialogTitle; + pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), aDialogTitle, *nWidth, *nHeight); + if (!aDialogTitle.isEmpty()) + { + OString aTitleString = OUStringToOString(aDialogTitle, RTL_TEXTENCODING_UTF8); + *pDialogTitle = static_cast<char*>(malloc(aTitleString.getLength() + 1)); + strcpy(*pDialogTitle, aTitleString.getStr()); + } comphelper::LibreOfficeKit::setDialogPainting(false); } diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 36d1ed7e7783..de425f4f965e 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -254,7 +254,7 @@ struct _LibreOfficeKitDocumentClass /// Paints dialog with given dialog id to the buffer /// @see lok::Document::paintDialog(). - void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight); + void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* nHeight); /// @see lok::Document::paintActiveFloatingWindow(). void (*paintActiveFloatingWindow) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight); diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index ecfae8a4cad3..4c682cf6635a 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -161,16 +161,19 @@ public: * * @param pDialogId Unique dialog id to be painted * @param pBuffer Buffer with enough memory allocated to render any dialog + * @param pDialogTitle output parameter pointing to a dialog title + * string. Should be freed by the caller. * @param nWidth output parameter returning the width of the rendered dialog. * @param nHeight output parameter returning the height of the rendered dialog */ void paintDialog(const char* pDialogId, unsigned char* pBuffer, + char** pDialogTitle, int& nWidth, int& nHeight) { return mpDoc->pClass->paintDialog(mpDoc, pDialogId, pBuffer, - &nWidth, &nHeight); + pDialogTitle, &nWidth, &nHeight); } /** diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx index 02e959ea6fad..539d2117f201 100644 --- a/include/vcl/IDialogRenderable.hxx +++ b/include/vcl/IDialogRenderable.hxx @@ -31,7 +31,7 @@ public: virtual ~IDialogRenderable(); virtual void paintDialog(const DialogID& rDialogID, VirtualDevice &rDevice, - int& nOutputWidth, int& nOutputHeight) = 0; + OUString& rDialogTitle, int& nOutputWidth, int& nOutputHeight) = 0; virtual void paintActiveFloatingWindow(const DialogID& rDialogID, VirtualDevice &rDevice, int& nOutputWidth, int& nOutputHeight) = 0; diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx index 0db80a8ef8f0..677245512821 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx @@ -87,14 +87,20 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer) GtvLokDialog* pDialog = GTV_LOK_DIALOG(gtk_widget_get_toplevel(pDialogDrawingArea)); GtvLokDialogPrivate* priv = getPrivate(pDialog); - g_info("panting dialog"); int nWidth = 1024; int nHeight = 768; 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)); - pDocument->pClass->paintDialog(pDocument, priv->dialogid, pBuffer, &nWidth, &nHeight); + char* pDialogTitle = nullptr; + pDocument->pClass->paintDialog(pDocument, priv->dialogid, pBuffer, &pDialogTitle, &nWidth, &nHeight); + if (pDialogTitle) + { + gtk_window_set_title(GTK_WINDOW(pDialog), pDialogTitle); + free(pDialogTitle); + } + gtk_widget_set_size_request(GTK_WIDGET(pDialogDrawingArea), nWidth, nHeight); cairo_surface_flush(pSurface); @@ -472,7 +478,6 @@ gtv_lok_dialog_invalidate(GtvLokDialog* dialog) { GtvLokDialogPrivate* priv = getPrivate(dialog); - // trigger a draw on the dialog drawing area gtk_widget_queue_draw(priv->pDialogDrawingArea); } @@ -597,7 +602,7 @@ void gtv_lok_dialog_child_invalidate(GtvLokDialog* dialog, int nX, int nY) g_info("Dialog's floating window invalidate"); GtvLokDialogPrivate* priv = getPrivate(dialog); - // remove any existing floating windows, for now + // create new if doesn't exist if (!priv->pFloatingWin) { priv->pFloatingWin = gtk_window_new(GTK_WINDOW_POPUP); diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index b86c570abddb..7719f608a287 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -452,7 +452,7 @@ public: /// @see vcl::ITiledRenderable::getPostIts(). OUString getPostIts() override; - void paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight) override; + void paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, OUString& rDialogTitle, int& nWidth, int& nHeight) override; void paintActiveFloatingWindow(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight) override; void postDialogKeyEvent(const vcl::DialogID& rDialogID, int nType, int nCharCode, int nKeyCode) override; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 99921da44b47..6510af9d016e 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3711,7 +3711,7 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I #endif } -void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight) +void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, OUString& rDialogTitle, int& nWidth, int& nHeight) { SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); @@ -3737,6 +3737,9 @@ void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& // register the instance so that vcl::Dialog can emit LOK callbacks pDlg->registerDialogRenderable(this, rDialogID); pDlg->paintDialog(rDevice); + + // set outparams + rDialogTitle = pDlg->GetText(); const Size aSize = pDlg->GetOptimalSize(); nWidth = aSize.getWidth(); nHeight = aSize.getHeight(); |