[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - 1338 commits - accessibility/AllLangMoTarget_acc.mk accessibility/AllLangResTarget_acc.mk accessibility/inc accessibility/Module_accessibility.mk accessibility/source android/Bootstrap android/source avmedia/AllLangMoTarget_avmedia.mk avmedia/AllLangResTarget_avmedia.mk avmedia/inc avmedia/Module_avmedia.mk avmedia/source basctl/AllLangMoTarget_basctl.mk basctl/AllLangResTarget_basctl.mk basctl/inc basctl/Module_basctl.mk basctl/sdi basctl/source basctl/uiconfig basegfx/source basegfx/test basic/AllLangMoTarget_sb.mk basic/AllLangResTarget_sb.mk basic/inc basic/Library_sb.mk basic/Module_basic.mk basic/qa basic/source bin/count-src-resources bin/distro-install-desktop-integration bin/distro-install-sdk bin/findunusedcode bin/find-unused-defines-in-hrc-files.py bin/gbuild-to-ide bin/gbuild-to-ideNS bin/generate-bash-completion bin/generate-bash-completion.py bin/lint-ui.py bin/lo-xlate-lang bin/run bin/update_pch bridges/Library_cpp_uno .mk bridges/source canvas/source chart2/AllLangMoTarget_chart.mk chart2/AllLangResTarget_chartcontroller.mk chart2/CppunitTest_chart2_export.mk chart2/CppunitTest_chart2_import.mk chart2/CppunitTest_chart2_trendcalculators.mk chart2/inc chart2/Library_chartcontroller.mk chart2/Module_chart2.mk chart2/qa chart2/source chart2/uiconfig codemaker/Module_codemaker.mk codemaker/source comphelper/Library_comphelper.mk comphelper/source compilerplugins/clang config_host.mk.in configmgr/source configure.ac connectivity/AllLangMoTarget_cnr.mk connectivity/AllLangResTarget_cnr.mk connectivity/AllLangResTarget_sdberr.mk connectivity/Configuration_writer.mk connectivity/CppunitTest_connectivity_ado.mk connectivity/CppunitTest_connectivity_commontools.mk connectivity/inc connectivity/Library_ado.mk connectivity/Library_calc.mk connectivity/Library_dbtools.mk connectivity/Library_evoab.mk connectivity/Library_file.mk connectivity/Library_firebird_sdbc.mk connectivity/Library_mork.mk connectivity/L ibrary_mysql.mk connectivity/Library_writer.mk connectivity/Module_connectivity.mk connectivity/qa connectivity/registry connectivity/source cppcanvas/CppunitTest_cppcanvas_emfplus.mk cppcanvas/inc cppcanvas/source cppuhelper/source cppu/qa cppu/source cpputools/source cui/AllLangMoTarget_cui.mk cui/AllLangResTarget_cui.mk cui/inc cui/Library_cui.mk cui/Module_cui.mk cui/source cui/uiconfig dbaccess/AllLangMoTarget_dba.mk dbaccess/AllLangResTarget_dba.mk dbaccess/AllLangResTarget_dbmm.mk dbaccess/AllLangResTarget_dbu.mk dbaccess/AllLangResTarget_sdbt.mk dbaccess/CppunitTest_dbaccess_dialog_save.mk dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk dbaccess/CppunitTest_dbaccess_hsqldb_test.mk dbaccess/CppunitTest_dbaccess_macros_test.mk dbaccess/CppunitTest_dbaccess_nolib_save.mk dbaccess/CppunitTest_dbaccess_RowSetClones.mk dbaccess/inc dbaccess/Library_dba.mk dbaccess/Library_dbaxml.mk dbaccess/Library_dbmm.mk dbaccess/Library_dbu.mk dbaccess/Library_sdbt.mk dbaccess/Module_dbacces s.mk dbaccess/source dbaccess/uiconfig desktop/AllLangMoTarget_dkt.mk desktop/AllLangResTarget_deploymentgui.mk desktop/AllLangResTarget_deployment.mk desktop/AllLangResTarget_dkt.mk desktop/inc desktop/Library_deploymentmisc.mk desktop/Library_deployment.mk desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/qa desktop/source desktop/uiconfig desktop/unx distro-configs/LibreOfficeFlatpak.conf download.lst drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/qa drawinglayer/source dtrans/source editeng/AllLangMoTarget_editeng.mk editeng/AllLangResTarget_editeng.mk editeng/CppunitTest_editeng_core.mk editeng/inc editeng/Library_editeng.mk editeng/Module_editeng.mk editeng/qa editeng/source editeng/uiconfig embeddedobj/Library_embobj.mk embeddedobj/source embedserv/source emfio/CppunitTest_emfio_emf_test.mk emfio/CppunitTest_emfio_wmf_test.mk emfio/emfio.component emfio/inc emfio/Library_emfio.mk emfio/Makefile emfio/Module_emfio.mk emfio/qa emfio/README emfi o/source extensions/AllLangMoTarget_pcr.mk extensions/AllLangResTarget_abp.mk extensions/AllLangResTarget_bib.mk extensions/AllLangResTarget_dbp.mk extensions/AllLangResTarget_pcr.mk extensions/AllLangResTarget_scn.mk extensions/AllLangResTarget_upd.mk extensions/CppunitTest_extensions_test_update.mk extensions/inc extensions/Library_res.mk extensions/Library_scn.mk extensions/Library_updchk.mk extensions/Module_extensions.mk extensions/qa extensions/source extensions/uiconfig external/boost external/coinmp external/cppunit external/expat external/fontconfig external/graphite external/libmwaw external/liborcus external/libstaroffice external/libwps external/libxmlsec external/pdfium extras/source filter/AllLangMoTarget_flt.mk filter/AllLangResTarget_eps.mk filter/AllLangResTarget_pdffilter.mk filter/AllLangResTarget_t602filter.mk filter/AllLangResTarget_xsltdlg.mk filter/Configuration_filter.mk filter/CppunitTest_filter_eps_test.mk filter/inc filter/Library_gie.mk filter/Library_gra phicfilter.mk filter/Library_t602filter.mk filter/Module_filter.mk filter/qa filter/source filter/uiconfig forms/AllLangMoTarget_frm.mk forms/AllLangResTarget_frm.mk forms/inc forms/Library_frm.mk forms/Module_forms.mk forms/source formula/AllLangMoTarget_for.mk formula/AllLangResTarget_for.mk formula/AllLangResTarget_forui.mk formula/inc formula/Library_for.mk formula/Module_formula.mk formula/source formula/uiconfig fpicker/AllLangMoTarget_fps.mk fpicker/AllLangResTarget_fps_office.mk fpicker/inc fpicker/Library_fps_aqua.mk fpicker/Library_fps.mk fpicker/Module_fpicker.mk fpicker/source fpicker/uiconfig framework/AllLangMoTarget_fwk.mk framework/AllLangResTarget_fwe.mk framework/inc framework/Library_fwe.mk framework/Module_framework.mk framework/qa framework/source framework/uiconfig helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/source i18nlangtag/source i18npool/inc i18npool/qa i18npool/source i18nutil/source icon-themes/breeze icon-themes/galaxy icon-themes/sifr i con-themes/sifr_dark idlc/inc idlc/source idl/inc idl/source include/android include/basic include/canvas include/codemaker include/com include/comphelper include/connectivity include/cppcanvas include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/fpicker include/framework include/i18nlangtag include/i18nutil include/LibreOfficeKit include/linguistic include/o3tl include/oox include/osl include/registry include/rsc include/rtl include/sal include/sax include/sfx2 include/sot include/svl include/svtools include/svx include/test include/toolkit include/tools include/uno include/unotools include/vbahelper include/vcl include/xmloff include/xmlreader instsetoo_native/CustomTarget_setup.mk instsetoo_native/inc_common io/source jvmfwk/plugins jvmfwk/source l10ntools/Executable_transex3.mk l10ntools/Executable_uiex.mk l10ntools/inc l10ntools/Module_l10ntools.mk l10ntools/source leak-suppress.txt libreofficekit/Executable_gtktiledvie wer.mk libreofficekit/qa libreofficekit/README libreofficekit/source lingucomponent/source linguistic/inc linguistic/source lotuswordpro/source Makefile.in mysqlc/source odk/docs odk/examples offapi/com offapi/type_reference offapi/UnoApi_offapi.mk officecfg/Configuration_officecfg.mk officecfg/registry onlineupdate/source oovbaapi/ooo oovbaapi/UnoApi_oovbaapi.mk oox/inc oox/Library_oox.mk oox/source opencl/inc opencl/source package/inc package/source postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk pyuno/source qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests readlicense_oo/license registry/source reportbuilder/java reportdesign/AllLangMoTarget_rpt.mk reportdesign/AllLangResTarget_rpt.mk reportdesign/AllLangResTarget_rptui.mk reportdesign/inc reportdesign/Library_rpt.mk reportdesign/Module_reportdesign.mk reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk RepositoryModule_build.mk RepositoryModule_host.mk rsc/documentation rsc/Exec utable_rsc.mk rsc/inc rsc/Makefile rsc/Module_rsc.mk rsc/README rsc/source salhelper/Module_salhelper.mk salhelper/source sal/osl sal/qa sal/rtl sal/textenc sax/inc sax/qa sax/source sax/test scaddins/AllLangMoTarget_sca.mk scaddins/AllLangResTarget_analysis.mk scaddins/AllLangResTarget_date.mk scaddins/AllLangResTarget_pricing.mk scaddins/inc scaddins/Library_analysis.mk scaddins/Library_date.mk scaddins/Library_pricing.mk scaddins/Module_scaddins.mk scaddins/source sc/AllLangMoTarget_sc.mk sc/AllLangResTarget_sc.mk sccomp/AllLangMoTarget_scc.mk sccomp/AllLangResTarget_solver.mk sccomp/inc sccomp/Library_solver.mk sccomp/Module_sccomp.mk sccomp/source sc/CppunitTest_sc_cellobj.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_screenshots.mk sc/CppunitTest_sc_tiledrendering.mk sc/CppunitTest_sc_ucalc.mk schema/odf1.0 sc/inc sc/Library_sc.mk sc/Library_vbaobj.mk sc/Module_sc.mk scp2/inc scp2/InstallModule_ooo.mk scp2/macros scp2/source

Pranav Kant pranavk at collabora.co.uk
Fri Jul 28 16:49:56 UTC 2017


Rebased ref, commits from common ancestor:
commit d7d9491c6c3644a48bdd7078507417183fff83ef
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jul 28 18:07:44 2017 +0530

    lokdialog: Dialog invalidation support
    
    For now, just invalidate the whole dialog whenever any of the controls
    in the dialog get invalidated.
    
    Since during dialog painting, many such invalidations are triggered,
    don't listen to them when we are painting.
    
    Change-Id: Ia8fc12cf9469691d60e91ef770d687e5ff01a7ef

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 44487da953ca..a4f60ac6c565 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -21,6 +21,8 @@ static bool g_bPartInInvalidation(false);
 
 static bool g_bTiledPainting(false);
 
+static bool g_bDialogPainting(false);
+
 static bool g_bTiledAnnotations(true);
 
 void setActive(bool bActive)
@@ -53,6 +55,16 @@ bool isTiledPainting()
     return g_bTiledPainting;
 }
 
+void setDialogPainting(bool bDialogPainting)
+{
+    g_bDialogPainting = bDialogPainting;
+}
+
+bool isDialogPainting()
+{
+    return g_bDialogPainting;
+}
+
 void setTiledAnnotations(bool bTiledAnnotations)
 {
     g_bTiledAnnotations = bTiledAnnotations;
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 300b71bb01ff..3905cb26ce19 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -504,7 +504,11 @@ typedef enum
     /**
      * The text content of the address field in Calc.
      */
-    LOK_CALLBACK_CELL_ADDRESS = 34
+    LOK_CALLBACK_CELL_ADDRESS = 34,
+    /**
+     * Dialog invalidation
+     */
+    LOK_CALLBACK_DIALOG_INVALIDATE = 35
 
 }
 LibreOfficeKitCallbackType;
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 253541a80cb6..7a293ca70352 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -52,6 +52,10 @@ COMPHELPER_DLLPUBLIC void setPartInInvalidation(bool bPartInInvalidation);
 COMPHELPER_DLLPUBLIC bool isTiledPainting();
 /// Set if we are doing tiled painting.
 COMPHELPER_DLLPUBLIC void setTiledPainting(bool bTiledPainting);
+/// Check if we are painting the dialog.
+COMPHELPER_DLLPUBLIC bool isDialogPainting();
+/// Set if we are painting the dialog.
+COMPHELPER_DLLPUBLIC void setDialogPainting(bool bDialogPainting);
 /// Set if we want no annotations rendering
 COMPHELPER_DLLPUBLIC void setTiledAnnotations(bool bTiledAnnotations);
 /// Check if annotations rendering is turned off
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index cb403c78a075..7609229db2a6 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -105,6 +105,8 @@ public:
     SfxBindings&            GetBindings()
                             { return *pBindings; }
 
+    virtual void            LogicInvalidate(const tools::Rectangle* pRectangle) override;
+
     DECL_LINK(TimerHdl, Timer *, void);
 
 };
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 9cf98fa40c88..65cd5964af97 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -41,7 +41,9 @@ public:
     /// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
     static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload);
     /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed.
-    static void notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload);
+    static void notifyDialogInvalidation(const OUString& rPayload);
+    /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed.
+    static void notifyInvalidation(SfxViewShell* pThisView, const OString& rPayload);
     /// A special value to signify 'infinity'.
     /// This value is chosen such that sal_Int32 will not overflow when manipulated.
     static const long MaxTwips = 1e9;
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index cb68cfe8f78a..8e2926ae1774 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -44,6 +44,8 @@ private:
 
     SAL_DLLPRIVATE void     ImplInitControlData();
 
+    virtual void            LogicInvalidate(const tools::Rectangle* pRectangle) override;
+
                             Control (const Control &) = delete;
                             Control & operator= (const Control &) = delete;
 
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index e452b9f50f48..65c71fc08c43 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -62,10 +62,14 @@ private:
 protected:
     using Window::ImplInit;
     SAL_DLLPRIVATE void    ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default );
+    OUString               maID; // identifier for this dialog
 
 public:
     SAL_DLLPRIVATE bool    IsInClose() const { return mbInClose; }
     virtual        void    doDeferredInit(WinBits nBits) override;
+    virtual        void    LogicInvalidate(const tools::Rectangle* pRectangle) override { (void)pRectangle; }
+    // Paints the current dialog to the given virtual device
+    void paintDialog(VirtualDevice& rDevice);
 
 protected:
     explicit        Dialog( WindowType nType );
@@ -101,9 +105,6 @@ public:
     virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
     virtual void PostPaint(vcl::RenderContext& rRenderContext) override;
 
-    // Paints the current dialog to the given virtual device
-    void paintDialog(VirtualDevice& rDevice);
-
     // ensureRepaint - triggers Application::Yield until the dialog is
     // completely repainted. Sometimes needed for dialogs showing progress
     // during actions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 88cf455e728c..142202566a96 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -433,6 +433,8 @@ callbackTypeToString (int nType)
         return "LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED";
     case LOK_CALLBACK_COMMENT:
         return "LOK_CALLBACK_COMMENT";
+    case LOK_CALLBACK_DIALOG_INVALIDATE:
+        return "LOK_CALLBACK_DIALOG_INVALIDATE";
     }
     g_assert(false);
     return nullptr;
@@ -1422,6 +1424,9 @@ callback (gpointer pData)
     case LOK_CALLBACK_COMMENT:
         g_signal_emit(pCallback->m_pDocView, doc_view_signals[COMMENT], 0, pCallback->m_aPayload.c_str());
         break;
+    case LOK_CALLBACK_DIALOG_INVALIDATE:
+        // TODO: Register the signal with lokdocview and emit it
+        break;
     default:
         g_assert(false);
         break;
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 30a14417d389..d140c571ab62 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -18,7 +18,10 @@
  */
 
 #include <stdlib.h>
+
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
+
 #include <osl/file.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/help.hxx>
@@ -29,6 +32,7 @@
 #include <vcl/idle.hxx>
 
 #include <sfx2/basedlgs.hxx>
+#include <sfx2/lokhelper.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/tabdlg.hxx>
 #include <sfx2/app.hxx>
@@ -390,6 +394,13 @@ void SfxModelessDialog::FillInfo(SfxChildWinInfo& rInfo) const
 }
 
 
+void SfxModelessDialog::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
+{
+    if (!comphelper::LibreOfficeKit::isDialogPainting())
+        SfxLokHelper::notifyDialogInvalidation(maID);
+}
+
+
 bool SfxFloatingWindow::EventNotify( NotifyEvent& rEvt )
 
 /*  [Description]
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 1597174af5b0..46d736206ddf 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -144,7 +144,20 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS
     }
 }
 
-void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload)
+void SfxLokHelper::notifyDialogInvalidation(const OUString& rDialogID)
+{
+    if (SfxLokHelper::getViewsCount() <= 0)
+        return;
+
+    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+    while (pViewShell)
+    {
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DIALOG_INVALIDATE, OUStringToOString(rDialogID, RTL_TEXTENCODING_UTF8).getStr());
+        pViewShell = SfxViewShell::GetNext(*pViewShell);
+    }
+}
+
+void SfxLokHelper::notifyInvalidation(SfxViewShell* pThisView, const OString& rPayload)
 {
     OStringBuffer aBuf;
     aBuf.append(rPayload);
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 5df29a0d3560..3bd877ea7162 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -18,11 +18,13 @@
  */
 
 #include <comphelper/processfactory.hxx>
+#include <comphelper/lok.hxx>
 
 #include <vcl/svapp.hxx>
 #include <vcl/event.hxx>
 #include <vcl/ctrl.hxx>
 #include <vcl/decoview.hxx>
+#include <vcl/dialog.hxx>
 #include <vcl/salnativewidgets.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/uitest/logger.hxx>
@@ -412,6 +414,19 @@ void Control::ImplInitSettings()
     ApplySettings(*this);
 }
 
+void Control::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
+{
+    // Several repaint, resize invalidations are emitted when we are painting,
+    // ignore all of those
+    if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
+    {
+        // For now just invalidate the whole dialog
+        Dialog* pParentDlg = GetParentDialog();
+        if (pParentDlg)
+            pParentDlg->LogicInvalidate(nullptr);
+    }
+}
+
 tools::Rectangle Control::DrawControlText( OutputDevice& _rTargetDevice, const tools::Rectangle& rRect, const OUString& _rStr,
     DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize ) const
 {
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 58f7d505b6ba..f341d422a1ec 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -505,6 +505,7 @@ void Dialog::doDeferredInit(WinBits nBits)
 Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription)
     : SystemWindow(WindowType::DIALOG)
     , mnInitFlag(InitFlag::Default)
+    , maID(rID)
 {
     ImplInitDialogData();
     loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription);
@@ -513,6 +514,7 @@ Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXML
 Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag)
     : SystemWindow(nType)
     , mnInitFlag(eFlag)
+    , maID(rID)
 {
     ImplInitDialogData();
     loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription);
commit 29d6edd3a64f21486cd9517191e584708e25cd01
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jul 14 18:54:52 2017 +0530

    gtktiledviewer: Implement modeless dialog rendering
    
    Hardcode modeless dialogs available in writer (very few) as of now in
    the combobox.
    
    Change-Id: I82d1442fbc71776dd64640ad048a0375ca041a67

diff --git a/libreofficekit/Executable_gtktiledviewer.mk b/libreofficekit/Executable_gtktiledviewer.mk
index f0667e247680..55434cef376e 100644
--- a/libreofficekit/Executable_gtktiledviewer.mk
+++ b/libreofficekit/Executable_gtktiledviewer.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_Executable_add_exception_objects,gtktiledviewer,\
     libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers \
     libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar \
     libreofficekit/qa/gtktiledviewer/gtv-comments-sidebar \
+    libreofficekit/qa/gtktiledviewer/gtv-lok-dialog \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index dae6821600e7..fbe5746ddf1e 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -31,6 +31,7 @@ struct GtvApplicationWindowPrivate
     GtkWidget* gridcontainer;
     GtkWidget* toolbarcontainer;
     GtkWidget* scrolledwindowcontainer;
+    GtkWidget* lokDialog;
 
     gboolean toolbarBroadcast;
     gboolean partSelectorBroadcast;
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
new file mode 100644
index 000000000000..31f16ae960b5
--- /dev/null
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <gtk/gtk.h>
+
+#include <cmath>
+#include <iostream>
+
+#include <gtv-application-window.hxx>
+#include <gtv-signal-handlers.hxx>
+#include <gtv-helpers.hxx>
+#include <gtv-lok-dialog.hxx>
+
+#include <map>
+#include <boost/property_tree/json_parser.hpp>
+
+struct GtvLokDialogPrivate
+{
+    LOKDocView* lokdocview;
+    gchar* dialogid;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GtvLokDialog, gtv_lok_dialog, GTK_TYPE_DIALOG);
+
+enum
+{
+    PROP_0,
+    PROP_LOKDOCVIEW_CONTEXT,
+    PROP_DIALOG_ID,
+    PROP_LAST
+};
+
+static GParamSpec* properties[PROP_LAST];
+
+static GtvLokDialogPrivate*
+getPrivate(GtvLokDialog* dialog)
+{
+    return static_cast<GtvLokDialogPrivate*>(gtv_lok_dialog_get_instance_private(dialog));
+}
+
+static void
+gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer)
+{
+    GtvLokDialog* pDialog = GTV_LOK_DIALOG(gtk_widget_get_toplevel(pDialogDrawingArea));
+    GtvLokDialogPrivate* priv = getPrivate(pDialog);
+
+    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);
+    gtk_widget_set_size_request(GTK_WIDGET(pDialogDrawingArea), nWidth, nHeight);
+
+    cairo_surface_flush(pSurface);
+    cairo_surface_mark_dirty(pSurface);
+
+    cairo_set_source_surface(pCairo, pSurface, 0, 0);
+    cairo_paint(pCairo);
+}
+
+static void
+gtv_lok_dialog_init(GtvLokDialog* dialog)
+{
+    GtkWidget* pContentArea = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+    GtkWidget* pDialogDrawingArea = gtk_drawing_area_new();
+
+    g_signal_connect(G_OBJECT(pDialogDrawingArea), "draw", G_CALLBACK(gtv_lok_dialog_draw), nullptr);
+    gtk_container_add(GTK_CONTAINER(pContentArea), pDialogDrawingArea);
+}
+
+static void
+gtv_lok_dialog_set_property(GObject* object, guint propId, const GValue* value, GParamSpec* pspec)
+{
+    GtvLokDialog* self = GTV_LOK_DIALOG(object);
+    GtvLokDialogPrivate* priv = getPrivate(self);
+
+    switch(propId)
+    {
+    case PROP_LOKDOCVIEW_CONTEXT:
+        priv->lokdocview = LOK_DOC_VIEW(g_value_get_object(value));
+        break;
+    case PROP_DIALOG_ID:
+        priv->dialogid = g_value_dup_string(value);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec);
+    }
+}
+
+static void
+gtv_lok_dialog_get_property(GObject* object, guint propId, GValue* value, GParamSpec* pspec)
+{
+    GtvLokDialog* self = GTV_LOK_DIALOG(object);
+    GtvLokDialogPrivate* priv = getPrivate(self);
+
+    switch(propId)
+    {
+    case PROP_LOKDOCVIEW_CONTEXT:
+        g_value_set_object(value, priv->lokdocview);
+        break;
+    case PROP_DIALOG_ID:
+        g_value_set_pointer(value, priv->dialogid);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec);
+    }
+}
+
+static void
+gtv_lok_dialog_finalize(GObject* object)
+{
+    GtvLokDialog* self = GTV_LOK_DIALOG(object);
+    GtvLokDialogPrivate* priv = getPrivate(self);
+
+    g_free(priv->dialogid);
+
+    G_OBJECT_CLASS(gtv_lok_dialog_parent_class)->finalize(object);
+}
+
+static void
+gtv_lok_dialog_class_init(GtvLokDialogClass* klass)
+{
+    G_OBJECT_CLASS(klass)->get_property = gtv_lok_dialog_get_property;
+    G_OBJECT_CLASS(klass)->set_property = gtv_lok_dialog_set_property;
+    G_OBJECT_CLASS(klass)->finalize = gtv_lok_dialog_finalize;
+
+    properties[PROP_LOKDOCVIEW_CONTEXT] = g_param_spec_object("lokdocview",
+                                                              "LOKDocView Context",
+                                                              "The LOKDocView context object to be used for dialog rendering",
+                                                              LOK_TYPE_DOC_VIEW,
+                                                              static_cast<GParamFlags>(G_PARAM_READWRITE |
+                                                                                       G_PARAM_CONSTRUCT_ONLY |
+                                                                                       G_PARAM_STATIC_STRINGS));
+
+    properties[PROP_DIALOG_ID] = g_param_spec_string("dialogid",
+                                                     "Dialog identifier",
+                                                     "Unique dialog identifier; UNO command for now",
+                                                     nullptr,
+                                                     static_cast<GParamFlags>(G_PARAM_READWRITE |
+                                                                              G_PARAM_CONSTRUCT_ONLY |
+                                                                              G_PARAM_STATIC_STRINGS));
+
+    g_object_class_install_properties (G_OBJECT_CLASS(klass), PROP_LAST, properties);
+}
+
+GtkWidget*
+gtv_lok_dialog_new(LOKDocView* pDocView, const gchar* dialogId)
+{
+    GtkWindow* pWindow = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
+    return GTK_WIDGET(g_object_new(GTV_TYPE_LOK_DIALOG,
+                                   "lokdocview", pDocView,
+                                   "dialogid", dialogId,
+                                   "title", "LOK Dialog",
+                                   "modal", false,
+                                   "transient-for", pWindow,
+                                   nullptr));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
new file mode 100644
index 000000000000..650d816e7e4a
--- /dev/null
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef GTV_LOK_DIALOG_H
+#define GTV_LOK_DIALOG_H
+
+#include <gtk/gtk.h>
+
+#include <LibreOfficeKit/LibreOfficeKitGtk.h>
+
+G_BEGIN_DECLS
+
+#define GTV_TYPE_LOK_DIALOG            (gtv_lok_dialog_get_type())
+#define GTV_LOK_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTV_TYPE_LOK_DIALOG, GtvLokDialog))
+#define GTV_IS_LOK_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTV_TYPE_LOK_DIALOG))
+#define GTV_LOK_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  GTV_TYPE_LOK_DIALOG, GtvLokDialogClass))
+#define GTV_IS_LOK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  GTV_TYPE_LOK_DIALOG))
+#define GTV_LOK_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  GTV_TYPE_LOK_DIALOG, GtvLokDialogClass))
+
+struct GtvLokDialog
+{
+    GtkDialog parent;
+};
+
+struct GtvLokDialogClass
+{
+    GtkDialogClass parentClass;
+};
+
+GType gtv_lok_dialog_get_type               (void) G_GNUC_CONST;
+
+GtkWidget* gtv_lok_dialog_new(LOKDocView* pDocView, const gchar* dialogId);
+
+G_END_DECLS
+
+#endif /* GTV_LOK_DIALOG_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
index 0da85fd89e65..108b3003ef1f 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
@@ -14,6 +14,7 @@
 #include <gtv-signal-handlers.hxx>
 #include <gtv-helpers.hxx>
 #include <gtv-calc-header-bar.hxx>
+#include <gtv-lok-dialog.hxx>
 
 #include <map>
 #include <memory>
@@ -34,6 +35,7 @@ struct GtvMainToolbarPrivateImpl
     GtkWidget* m_pDeleteComment;
     GtkWidget* m_pPartSelector;
     GtkWidget* m_pPartModeSelector;
+    GtkWidget* m_pDialogSelector;
 
     /// Sensitivity (enabled or disabled) for each tool item, ignoring edit state
     std::map<GtkToolItem*, bool> m_aToolItemSensitivities;
@@ -48,7 +50,8 @@ struct GtvMainToolbarPrivateImpl
         m_pJustifypara(nullptr),
         m_pDeleteComment(nullptr),
         m_pPartSelector(nullptr),
-        m_pPartModeSelector(nullptr)
+        m_pPartModeSelector(nullptr),
+        m_pDialogSelector(nullptr)
         { }
 };
 
@@ -95,6 +98,8 @@ gtv_main_toolbar_init(GtvMainToolbar* toolbar)
     priv->m_pDeleteComment = GTK_WIDGET(gtk_builder_get_object(builder.get(), "btn_removeannotation"));
     priv->m_pPartSelector = GTK_WIDGET(gtk_builder_get_object(builder.get(), "combo_partselector"));
     priv->m_pPartModeSelector = GTK_WIDGET(gtk_builder_get_object(builder.get(), "combo_partsmodeselector"));
+    priv->m_pDialogSelector = GTK_WIDGET(gtk_builder_get_object(builder.get(), "combo_dialogselector"));
+
     toolbar->m_pAddressbar = GTK_WIDGET(gtk_builder_get_object(builder.get(), "addressbar_entry"));
     toolbar->m_pFormulabar = GTK_WIDGET(gtk_builder_get_object(builder.get(), "formulabar_entry"));
 
@@ -113,6 +118,7 @@ gtv_main_toolbar_init(GtvMainToolbar* toolbar)
     gtk_builder_add_callback_symbol(builder.get(), "documentRepair", G_CALLBACK(documentRepair));
     gtk_builder_add_callback_symbol(builder.get(), "signalAddressbar", G_CALLBACK(signalAddressbar));
     gtk_builder_add_callback_symbol(builder.get(), "signalFormulabar", G_CALLBACK(signalFormulabar));
+    gtk_builder_add_callback_symbol(builder.get(), "openLokDialog", G_CALLBACK(openLokDialog));
 
     // find toolbar
     // Note: These buttons are not the part of GtvMainToolbar
@@ -175,6 +181,22 @@ static void populatePartSelector(GtvMainToolbar* toolbar)
     gtv_application_window_set_part_broadcast(window, true);
 }
 
+static void populateDialogSelector(GtvMainToolbar* toolbar)
+{
+    GtvMainToolbarPrivate& priv = getPrivate(toolbar);
+
+    GtkComboBoxText* pSelector = GTK_COMBO_BOX_TEXT(priv->m_pDialogSelector);
+    gtk_combo_box_text_append_text( pSelector, ".uno:SearchDialog" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:AcceptTrackedChanges" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:SpellingAndGrammarDialog" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:InsertField" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:ImageMapDialog" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:WordCountDialog" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:HyperlinkDialog" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:InsertIndexesEntry" );
+    gtk_combo_box_text_append_text( pSelector, ".uno:InsertAuthoritiesEntry");
+}
+
 void
 gtv_main_toolbar_doc_loaded(GtvMainToolbar* toolbar, LibreOfficeKitDocumentType eDocType, bool bEditMode)
 {
@@ -201,6 +223,8 @@ gtv_main_toolbar_doc_loaded(GtvMainToolbar* toolbar, LibreOfficeKitDocumentType
 
     // populate combo boxes
     populatePartSelector(toolbar);
+    // populate dialogs
+    populateDialogSelector(toolbar);
 }
 
 GtkContainer*
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index 3c9ee3e405f2..5b3b113d0a6e 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -12,6 +12,7 @@
 #include <gtv-application-window.hxx>
 #include <gtv-helpers.hxx>
 #include <gtv-lokdocview-signal-handlers.hxx>
+#include <gtv-lok-dialog.hxx>
 
 #include <sal/types.h>
 
@@ -281,6 +282,18 @@ void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
     }
 }
 
+void openLokDialog( GtkWidget* pSelector, gpointer /*pItem*/ )
+{
+    GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(pSelector));
+    gchar* pDialogId = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(pSelector));
+    GtkWidget* pDialog = gtv_lok_dialog_new(LOK_DOC_VIEW(window->lokdocview), pDialogId);
+    g_free(pDialogId);
+
+    gtk_window_set_resizable(GTK_WINDOW(pDialog), false);
+    gtk_widget_show_all(GTK_WIDGET(pDialog));
+    gtk_window_present(GTK_WINDOW(pDialog));
+}
+
 void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
 {
     static const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 };
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
index a19a7b5cd744..8ec37a66f552 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
@@ -28,6 +28,8 @@ void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ );
 
 void changePart( GtkWidget* pSelector, gpointer /*pItem*/ );
 
+void openLokDialog( GtkWidget* pSelector, gpointer /*pItem*/ );
+
 void changeZoom( GtkWidget* pButton, gpointer /* pItem */ );
 
 void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/);
diff --git a/libreofficekit/qa/gtktiledviewer/gtv.ui b/libreofficekit/qa/gtktiledviewer/gtv.ui
index e27f79714a4b..2dfe219c44f0 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv.ui
+++ b/libreofficekit/qa/gtktiledviewer/gtv.ui
@@ -445,6 +445,23 @@
       </packing>
     </child>
     <child>
+      <object class="GtkToolItem" id="dialogselectortoolitem">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkComboBoxText" id="combo_dialogselector">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <signal name="changed" handler="openLokDialog" swapped="no"/>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="homogeneous">True</property>
+      </packing>
+    </child>
+    <child>
       <object class="GtkToggleToolButton" id="btn_editmode">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
commit b719e1b0ddb4bd5e4562a0737f07b4cee10f3a23
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jul 28 18:05:20 2017 +0530

    lokdialog: Better dialog rendering API
    
    After painting the dialog, also write width and height of the rendered
    dialog. The dialog is rendered
    always on the top left of the given canvas, so client can crop the
    canvas accordingly.
    
    Change-Id: If052058a6db8a85d4e28ec88cffcca05564b17f0

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index dbc2e029889e..ea81c5e551b5 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -18,6 +18,8 @@
 #include <com/sun/star/util/XModifiable.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <boost/property_tree/json_parser.hpp>
+
+#include <vcl/scheduler.hxx>
 #include <comphelper/processfactory.hxx>
 #include <rtl/uri.hxx>
 #include <sfx2/objsh.hxx>
@@ -2161,12 +2163,10 @@ void DesktopLOKTest::testDialogsWriter()
     sal_Int32 nStride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nCanvasWidth);
     std::vector<unsigned char> aBuffer(nStride * nCanvasHeight);
 
-    pDocument->pClass->paintDialog(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight);
+    pDocument->pClass->paintDialog(pDocument, ".uno:WordCountDialog", aBuffer.data(), &nCanvasWidth, &nCanvasHeight);
 
     cairo_surface_t* pSurface = cairo_image_surface_create_for_data(aBuffer.data(), CAIRO_FORMAT_ARGB32, nCanvasWidth, nCanvasHeight, nStride);
     cairo_surface_write_to_png(pSurface, "/tmp/dialog.png");
-
-    CPPUNIT_ASSERT(false);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bc41b0994157..6c99fed756ab 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -583,7 +583,7 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
                           int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight);
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
 
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
     : mxComponent(xComponent)
@@ -2913,7 +2913,7 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
     return nullptr;
 }
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight)
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight)
 {
     SolarMutexGuard aGuard;
 
@@ -2922,11 +2922,11 @@ static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffe
     ScopedVclPtrInstance<VirtualDevice> pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
     pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
 
-    pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nWidth, nHeight), Fraction(1.0), Point(), pBuffer);
+    pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(*nWidth, *nHeight), Fraction(1.0), Point(), pBuffer);
 
-    vcl::DialogID aDialogID(pDialogRenderable->findDialog());
+    vcl::DialogID aDialogID = OUString::createFromAscii(pDialogId);
 
-    pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), nWidth, nHeight);
+    pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), *nWidth, *nHeight);
 }
 
 static char* lo_getError (LibreOfficeKit *pThis)
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
index 18694092c2fa..2621ec03947a 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -14,26 +14,29 @@
 #include <tools/gen.hxx>
 #include <vcl/pointr.hxx>
 #include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
+
+#include "IDialogRenderable.hxx"
+
+#include <map>
 
 namespace vcl
 {
 
-typedef sal_Int32 DialogID;
+typedef OUString DialogID;
 
 class VCL_DLLPUBLIC IDialogRenderable
 {
 public:
     virtual ~IDialogRenderable();
 
-    virtual DialogID findDialog() = 0;
-
-    virtual void paintDialog(DialogID rDialogID, VirtualDevice &rDevice,
-                             int nOutputWidth, int nOutputHeight) = 0;
+    virtual void paintDialog(const DialogID& rDialogID, VirtualDevice &rDevice,
+                             int& nOutputWidth, int& nOutputHeight) = 0;
 
-    virtual void postDialogMouseEvent(DialogID rDialogID, int nType,
+    virtual void postDialogMouseEvent(const DialogID& rDialogID, int nType,
                                       int nCharCode, int nKeyCode) = 0;
 
-    virtual void postDialogKeyEvent(DialogID rDialogID, int nType, int nX, int nY,
+    virtual void postDialogKeyEvent(const DialogID& rDialogID, int nType, int nX, int nY,
                                     int nCount, int nButtons, int nModifier) = 0;
 };
 
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 49737fdc6057..e452b9f50f48 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -101,6 +101,9 @@ public:
     virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
     virtual void PostPaint(vcl::RenderContext& rRenderContext) override;
 
+    // Paints the current dialog to the given virtual device
+    void paintDialog(VirtualDevice& rDevice);
+
     // ensureRepaint - triggers Application::Yield until the dialog is
     // completely repainted. Sometimes needed for dialogs showing progress
     // during actions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index f2dc662e299f..ea5fdce243a0 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -426,12 +426,11 @@ public:
     /// @see vcl::ITiledRenderable::getPostIts().
     OUString getPostIts() override;
 
-    vcl::DialogID findDialog() override;
-    void paintDialog(vcl::DialogID rDialogID, VirtualDevice &rDevice, int nWidth, int nHeight) override;
-    void postDialogMouseEvent(vcl::DialogID rDialogID, int nType,
+    void paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight) override;
+    void postDialogMouseEvent(const vcl::DialogID& rDialogID, int nType,
                              int nCharCode, int nKeyCode) override;
 
-    void postDialogKeyEvent(vcl::DialogID rDialogID, int nType, int nX, int nY,
+    void postDialogKeyEvent(const vcl::DialogID& rDialogID, int nType, int nX, int nY,
                             int nCount, int nButtons, int nModifier) override;
 
     // css::tiledrendering::XTiledRenderable
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index f8fd02e7799d..f30028a92dff 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -33,6 +33,8 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/sfxbasecontroller.hxx>
 #include <sfx2/docfile.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/msgpool.hxx>
 #include <sfx2/printer.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <toolkit/awt/vclxdevice.hxx>
@@ -3550,32 +3552,35 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
     #endif
 }
 
-vcl::DialogID SwXTextDocument::findDialog()
+void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight)
 {
-    return vcl::DialogID(0);
-}
-
-void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& rDevice, int nWidth, int nHeight)
-{
-    SfxViewShell* pViewShell = pDocShell->GetView();
-    SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
-    SfxChildWindow* pSfxChildWindow = SwSpellDialogChildWindow::CreateImpl(&pViewFrame->GetWindow(), SwSpellDialogChildWindow::GetChildWindowId(),
-                                                                           &pViewFrame->GetBindings(), nullptr);
-
-    Size aSize(nWidth, nHeight);
-
-    vcl::Window* pWindow = pSfxChildWindow->GetWindow();
+    SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame();
+    SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
+    const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID);
+    SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId());
+    if (!pChild)
+    {
+        pViewFrame->ToggleChildWindow(pSlot->GetSlotId());
+        pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId());
+        if (!pChild)
+        {
+            SAL_WARN("lok.dialog", "Dialog " << rDialogID << " is not supported");
+            return;
+        }
+    }
 
-    pWindow->SetSizePixel(aSize);
-    pWindow->Show();
-    pWindow->Paint(rDevice, tools::Rectangle(Point(), aSize));
+    Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow());
+    pDlg->paintDialog(rDevice);
+    const Size aSize = pDlg->GetOptimalSize();
+    nWidth = aSize.getWidth();
+    nHeight = aSize.getHeight();
 }
 
-void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
+void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
 {
 }
 
-void SwXTextDocument::postDialogKeyEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nX*/, int /*nY*/,
+void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& /*rDialogID*/, int /*nType*/, int /*nX*/, int /*nY*/,
                                          int /*nCount*/, int /*nButtons*/, int /*nModifier*/)
 {
 }
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index aa25bae8c74b..58f7d505b6ba 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -51,6 +51,7 @@
 #include <vcl/settings.hxx>
 #include <vcl/uitest/uiobject.hxx>
 #include <vcl/uitest/logger.hxx>
+#include <vcl/virdev.hxx>
 #include <salframe.hxx>
 
 #include <iostream>
@@ -847,6 +848,17 @@ bool Dialog::selectPageByUIXMLDescription(const OString& /*rUIXMLDescription*/)
     return true;
 }
 
+void Dialog::paintDialog(VirtualDevice& rDevice)
+{
+    setDeferredProperties();
+    ImplAdjustNWFSizes();
+    Show();
+    ToTop();
+    ensureRepaint();
+
+    PaintToDevice(&rDevice, Point(0, 0), Size());
+}
+
 void Dialog::ensureRepaint()
 {
     // ensure repaint
commit fc961074d199eb5d5c51cbcd5add106751e4b5af
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jul 28 16:34:56 2017 +0530

    Include dialogID in paintDialog API
    
    Change-Id: I6bc624272138f0e23d2e3abfd82b857fed12e12c

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 717b5b3d348c..a37b2ecdb13d 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -255,7 +255,7 @@ struct _LibreOfficeKitDocumentClass
                        size_t nSize);
 
     /// WIP
-    void (*paintDialog) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight);
+    void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
 
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
commit 3eee05dfccf3d92d656bb2af41e502f291cfb18f
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jun 30 14:20:19 2017 +0530

    Write the dialog rendering to file
    
    Change-Id: I7b10f9ee6e1f914e85ded8756b80c17a505ee0fc

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index d705e6c8ed97..dbc2e029889e 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2156,22 +2156,15 @@ void DesktopLOKTest::testExtractParameter()
 void DesktopLOKTest::testDialogsWriter()
 {
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
-    int nCanvasWidth = 100;
-    int nCanvasHeight = 300;
+    int nCanvasWidth = 800;
+    int nCanvasHeight = 600;
     sal_Int32 nStride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nCanvasWidth);
     std::vector<unsigned char> aBuffer(nStride * nCanvasHeight);
 
     pDocument->pClass->paintDialog(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight);
 
-    for (long y = 0; y < nCanvasHeight; ++y)
-    {
-        unsigned char* c = &aBuffer.data()[y * nStride];
-        for (long x = 0; x < nStride; ++x)
-        {
-            printf ("%02x ", c[x]);
-        }
-        printf ("\n");
-    }
+    cairo_surface_t* pSurface = cairo_image_surface_create_for_data(aBuffer.data(), CAIRO_FORMAT_ARGB32, nCanvasWidth, nCanvasHeight, nStride);
+    cairo_surface_write_to_png(pSurface, "/tmp/dialog.png");
 
     CPPUNIT_ASSERT(false);
 }
commit 4c525b412aea251ca1daf22cba5801a7ef5eb21b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Jun 22 12:20:01 2017 +0200

    Instantiate spell dialog and paint in a paintDialog call
    
    Change-Id: I7bd7f9cb33cd79d1e55ce51fe39917c5741bdf18

diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b6614780666a..f8fd02e7799d 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -164,6 +164,7 @@
 #include <svx/svdview.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <SwSpellDialogChildWindow.hxx>
 #include <memory>
 
 using namespace ::com::sun::star;
@@ -3554,12 +3555,20 @@ vcl::DialogID SwXTextDocument::findDialog()
     return vcl::DialogID(0);
 }
 
-void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& /*rDevice*/, int /*nWidth*/, int /*nHeight*/)
+void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& rDevice, int nWidth, int nHeight)
 {
-    //SwViewShell* pViewShell = pDocShell->GetWrtShell();
+    SfxViewShell* pViewShell = pDocShell->GetView();
+    SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+    SfxChildWindow* pSfxChildWindow = SwSpellDialogChildWindow::CreateImpl(&pViewFrame->GetWindow(), SwSpellDialogChildWindow::GetChildWindowId(),
+                                                                           &pViewFrame->GetBindings(), nullptr);
 
-    //SwSpellDialogChildWindow::CreateImpl(nullptr, SwSpellDialogChildWindow::GetChildWindowId(),
-    //                                     pViewShell->GetBindings(), );
+    Size aSize(nWidth, nHeight);
+
+    vcl::Window* pWindow = pSfxChildWindow->GetWindow();
+
+    pWindow->SetSizePixel(aSize);
+    pWindow->Show();
+    pWindow->Paint(rDevice, tools::Rectangle(Point(), aSize));
 }
 
 void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
commit 7634a80d6e1047465bf429fa735b9026d53f17fd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Jun 22 12:18:26 2017 +0200

    Test for paintDialog to show if we succeed to paint into a VD
    
    Change-Id: Iccba81ff4326f1fb3d93bdf9393d7d3cc3675f9e

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 58aea8beb431..d705e6c8ed97 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -39,7 +39,7 @@
 #include <cairo.h>
 #include <ostream>
 #include <config_features.h>
-#include <vcl/scheduler.hxx>
+#include <png.h>
 
 #include <lib/init.hxx>
 
@@ -115,6 +115,7 @@ public:
     void testCommentsCallbacksWriter();
     void testRunMacro();
     void testExtractParameter();
+    void testDialogsWriter();
 
     CPPUNIT_TEST_SUITE(DesktopLOKTest);
     CPPUNIT_TEST(testGetStyles);
@@ -157,6 +158,7 @@ public:
     CPPUNIT_TEST(testCommentsCallbacksWriter);
     CPPUNIT_TEST(testRunMacro);
     CPPUNIT_TEST(testExtractParameter);
+    CPPUNIT_TEST(testDialogsWriter);
     CPPUNIT_TEST_SUITE_END();
 
     uno::Reference<lang::XComponent> mxComponent;
@@ -178,7 +180,6 @@ public:
     // for testContextMenu{Calc, Writer}
     osl::Condition m_aContextMenuCondition;
     boost::property_tree::ptree m_aContextMenuResult;
-
 };
 
 LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType)
@@ -2152,6 +2153,29 @@ void DesktopLOKTest::testExtractParameter()
     CPPUNIT_ASSERT_EQUAL(OUString("Something1,Something2=blah,Something3"), aOptions);
 }
 
+void DesktopLOKTest::testDialogsWriter()
+{
+    LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+    int nCanvasWidth = 100;
+    int nCanvasHeight = 300;
+    sal_Int32 nStride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nCanvasWidth);
+    std::vector<unsigned char> aBuffer(nStride * nCanvasHeight);
+
+    pDocument->pClass->paintDialog(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight);
+
+    for (long y = 0; y < nCanvasHeight; ++y)
+    {
+        unsigned char* c = &aBuffer.data()[y * nStride];
+        for (long x = 0; x < nStride; ++x)
+        {
+            printf ("%02x ", c[x]);
+        }
+        printf ("\n");
+    }
+
+    CPPUNIT_ASSERT(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 3605085bd8fc7d1a8727da68a403cd1fe58fe3ef
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri May 26 22:55:31 2017 +0200

    Add IDialogRenderable interface for rendering of dialogs
    
    Change-Id: I1d85729a1ac1a99d33ea2bde1b50ccf4c05ca9a9

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index be81a0fca0b0..bc41b0994157 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -77,6 +77,7 @@
 #include <vcl/sysdata.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/ITiledRenderable.hxx>
+#include <vcl/IDialogRenderable.hxx>
 #include <unicode/uchar.h>
 #include <unotools/configmgr.hxx>
 #include <unotools/syslocaleoptions.hxx>
@@ -582,6 +583,8 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
                           int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
 
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight);
+
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
     : mxComponent(xComponent)
 {
@@ -628,6 +631,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->renderFont = doc_renderFont;
         m_pDocumentClass->getPartHash = doc_getPartHash;
 
+        m_pDocumentClass->paintDialog = doc_paintDialog;
+
         gDocumentClass = m_pDocumentClass;
     }
     pClass = m_pDocumentClass.get();
@@ -1144,6 +1149,12 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
     return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
 }
 
+IDialogRenderable* getDialogRenderable(LibreOfficeKitDocument* pThis)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+    return dynamic_cast<IDialogRenderable*>(pDocument->mxComponent.get());
+}
+
 } // anonymous namespace
 
 // Wonder global state ...
@@ -2902,6 +2913,22 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
     return nullptr;
 }
 
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight)
+{
+    SolarMutexGuard aGuard;
+
+    IDialogRenderable* pDialogRenderable = getDialogRenderable(pThis);
+
+    ScopedVclPtrInstance<VirtualDevice> pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
+    pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+
+    pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nWidth, nHeight), Fraction(1.0), Point(), pBuffer);
+
+    vcl::DialogID aDialogID(pDialogRenderable->findDialog());
+
+    pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), nWidth, nHeight);
+}
+
 static char* lo_getError (LibreOfficeKit *pThis)
 {
     SolarMutexGuard aGuard;
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index a4035c7351f0..717b5b3d348c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -254,6 +254,9 @@ struct _LibreOfficeKitDocumentClass
                        int* pArray,
                        size_t nSize);
 
+    /// WIP
+    void (*paintDialog) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
new file mode 100644
index 000000000000..18694092c2fa
--- /dev/null
+++ b/include/vcl/IDialogRenderable.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+#define INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/pointr.hxx>
+#include <vcl/virdev.hxx>
+
+namespace vcl
+{
+
+typedef sal_Int32 DialogID;
+
+class VCL_DLLPUBLIC IDialogRenderable
+{
+public:
+    virtual ~IDialogRenderable();
+
+    virtual DialogID findDialog() = 0;
+
+    virtual void paintDialog(DialogID rDialogID, VirtualDevice &rDevice,
+                             int nOutputWidth, int nOutputHeight) = 0;
+
+    virtual void postDialogMouseEvent(DialogID rDialogID, int nType,
+                                      int nCharCode, int nKeyCode) = 0;
+
+    virtual void postDialogKeyEvent(DialogID rDialogID, int nType, int nX, int nY,
+                                    int nCount, int nButtons, int nModifier) = 0;
+};
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index ccbfb62589cd..f2dc662e299f 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -69,6 +69,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <vcl/event.hxx>
 #include <vcl/ITiledRenderable.hxx>
+#include <vcl/IDialogRenderable.hxx>
 #include <com/sun/star/tiledrendering/XTiledRenderable.hpp>
 
 #include <unobaseclass.hxx>
@@ -130,6 +131,7 @@ class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
     public SvxFmMSFactory,
     public SfxBaseModel,
     public vcl::ITiledRenderable,
+    public vcl::IDialogRenderable,
     public css::tiledrendering::XTiledRenderable
 {
 private:
@@ -423,6 +425,15 @@ public:
     OUString getTrackedChangeAuthors() override;
     /// @see vcl::ITiledRenderable::getPostIts().
     OUString getPostIts() override;
+
+    vcl::DialogID findDialog() override;
+    void paintDialog(vcl::DialogID rDialogID, VirtualDevice &rDevice, int nWidth, int nHeight) override;
+    void postDialogMouseEvent(vcl::DialogID rDialogID, int nType,
+                             int nCharCode, int nKeyCode) override;
+
+    void postDialogKeyEvent(vcl::DialogID rDialogID, int nType, int nX, int nY,
+                            int nCount, int nButtons, int nModifier) override;
+
     // css::tiledrendering::XTiledRenderable
     virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) override;
 
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index aca79a13c678..b6614780666a 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3549,6 +3549,28 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
     #endif
 }
 
+vcl::DialogID SwXTextDocument::findDialog()
+{
+    return vcl::DialogID(0);
+}
+
+void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& /*rDevice*/, int /*nWidth*/, int /*nHeight*/)
+{
+    //SwViewShell* pViewShell = pDocShell->GetWrtShell();
+
+    //SwSpellDialogChildWindow::CreateImpl(nullptr, SwSpellDialogChildWindow::GetChildWindowId(),
+    //                                     pViewShell->GetBindings(), );
+}
+
+void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
+{
+}
+
+void SwXTextDocument::postDialogKeyEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nX*/, int /*nY*/,
+                                         int /*nCount*/, int /*nButtons*/, int /*nModifier*/)
+{
+}
+
 void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
 {
     return SwXTextDocumentBaseClass::operator new(t);
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 0c62ba2c4366..4790fe7094b5 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -338,6 +338,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/app/IconThemeScanner \
     vcl/source/app/IconThemeSelector \
     vcl/source/app/ITiledRenderable \
+    vcl/source/app/IDialogRenderable \
     vcl/source/app/sound \
     vcl/source/app/stdtext \
     vcl/source/app/svapp \
diff --git a/vcl/source/app/IDialogRenderable.cxx b/vcl/source/app/IDialogRenderable.cxx
new file mode 100644
index 000000000000..58ec05265101
--- /dev/null
+++ b/vcl/source/app/IDialogRenderable.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <vcl/IDialogRenderable.hxx>
+
+namespace vcl
+{
+
+IDialogRenderable::~IDialogRenderable()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit bf3e6044577e01a28e4d0bb4af3be90ee44149dc
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri May 26 22:37:06 2017 +0200

    move ITileRenderable implementation to own file
    
    Change-Id: Ib05ecf5f92e0ae4adf99c4dd10d60e730a95cf45

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 6b40a48d8783..0c62ba2c4366 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -337,6 +337,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/app/IconThemeInfo \
     vcl/source/app/IconThemeScanner \
     vcl/source/app/IconThemeSelector \
+    vcl/source/app/ITiledRenderable \
     vcl/source/app/sound \
     vcl/source/app/stdtext \
     vcl/source/app/svapp \
diff --git a/vcl/source/app/ITiledRenderable.cxx b/vcl/source/app/ITiledRenderable.cxx
new file mode 100644
index 000000000000..3eb5dcd2da6e
--- /dev/null
+++ b/vcl/source/app/ITiledRenderable.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <vcl/ITiledRenderable.hxx>
+
+namespace vcl
+{
+
+ITiledRenderable::~ITiledRenderable()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 52bb9f566873..974533d9ea13 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -23,18 +23,8 @@
 #include "outdev.h"
 #include "PhysicalFontCollection.hxx"
 #include "svdata.hxx"
-
 #include <vcl/ITiledRenderable.hxx>
 
-namespace vcl
-{
-
-ITiledRenderable::~ITiledRenderable()
-{
-}
-
-}
-
 using namespace ::com::sun::star::uno;
 
 bool VirtualDevice::AcquireGraphics() const
commit ff91292f2b6bd6fbf0f078436c770938e0cf8af2
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jul 26 23:28:09 2017 +0530

    Give name to debug event injector
    
    Change-Id: I3468776797426b04c1cb3206dbb194837a652e16

diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx
index 2b83f4f92f03..99de7f0b664e 100644
--- a/vcl/source/window/debugevent.cxx
+++ b/vcl/source/window/debugevent.cxx
@@ -22,7 +22,8 @@
 #if OSL_DEBUG_LEVEL > 0
 
 DebugEventInjector::DebugEventInjector( sal_uInt32 nMaxEvents) :
-    mnEventsLeft( nMaxEvents )
+      Timer("debug event injector")
+    , mnEventsLeft( nMaxEvents )
 {
     SetTimeout( 1000 /* ms */ );
     Start();
commit ee7435560caa067452972037cbf10ea0a4d747fe
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jun 28 18:51:51 2017 +0530

    Typo
    
    Change-Id: I2ecf3050aa68a0f2986c43b651d71b662a77e55a

diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index adcfe9e93dbe..2c32d2c75874 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -123,7 +123,7 @@ void ScScreenshotTest::initialize()
 
 void ScScreenshotTest::registerKnownDialogsByID(mapType& rKnownDialogs)
 {
-    // fill map of unknown dialogs
+    // fill map of known dialogs
     rKnownDialogs["modules/scalc/ui/insertsheet.ui"] = 0;
     rKnownDialogs["modules/scalc/ui/deletecells.ui"] = 1;
     rKnownDialogs["modules/scalc/ui/pastespecial.ui"] = 2;
commit 294967eb16a54225344ecb1913bdf85a0dc24585
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 28 15:22:01 2017 +0200

    configure: new odfvalidator requires Java 8
    
    Change-Id: Iaac1f13e6c189e2e13b86258268741c14a537799

diff --git a/configure.ac b/configure.ac
index d0ecde9d9f36..51f336a9b83f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2015,7 +2015,7 @@ AC_ARG_WITH(export-validation,
     AS_HELP_STRING([--without-export-validation],
         [Disable validating OOXML and ODF files as exported from in-tree tests.
          Use this option e.g. if your system only provides Java 5.]),
-,with_export_validation=yes)
+,with_export_validation=auto)
 
 AC_ARG_WITH(bffvalidator,
     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
@@ -7038,9 +7038,19 @@ dnl ===================================================================
 dnl Export file validation
 dnl ===================================================================
 AC_MSG_CHECKING([whether to enable export file validation])
-if test "$with_export_validation" = yes; then
+if test "$with_export_validation" != "no"; then
     if test -z "$ENABLE_JAVA"; then
-        AC_MSG_RESULT([no, as Java is disabled])
+        if test "$with_export_validation" = "yes"; then
+            AC_MSG_ERROR([requested, but Java is disabled])
+        else
+            AC_MSG_RESULT([no, as Java is disabled])
+        fi
+    elif test "$_jdk_ver" -lt 10800; then
+        if test "$with_export_validation" = "yes"; then
+            AC_MSG_ERROR([requested, but Java is too old, need Java 8])
+        else
+            AC_MSG_RESULT([no, as Java is too old, need Java 8])
+        fi
     else
         AC_MSG_RESULT([yes])
         AC_DEFINE(HAVE_EXPORT_VALIDATION)
@@ -7112,7 +7122,7 @@ AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
 if test "$with_bffvalidator" != "no"; then
     AC_DEFINE(HAVE_BFFVALIDATOR)
 
-    if test "$with_export_validation" != "yes"; then
+    if test "$with_export_validation" = "no"; then
         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
     fi
 
commit b09deb075319c1c19f91e3a6f64429b61682ebf8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Jul 28 11:47:51 2017 +0200

    loplugin:constparams handle constructors
    
    had to change the structure of the plugin considerably, was too messy to
    structure it to do the calculations on a per-function basis
    
    Change-Id: I4edee7735f726101105c607368124a08dba21086
    Reviewed-on: https://gerrit.libreoffice.org/40516
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/accessibility/inc/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/extended/accessibleiconchoicectrl.hxx
index 3d83f7762bf9..b97e5bc70ab3 100644
--- a/accessibility/inc/extended/accessibleiconchoicectrl.hxx
+++ b/accessibility/inc/extended/accessibleiconchoicectrl.hxx
@@ -61,7 +61,7 @@ namespace accessibility
             @param  _xParent
                 is our parent accessible object
         */
-        AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl,
+        AccessibleIconChoiceCtrl( SvtIconChoiceCtrl const & _rIconCtrl,
                                   const css::uno::Reference< css::accessibility::XAccessible >& _xParent );
 
         // XTypeProvider
diff --git a/accessibility/inc/extended/accessiblelistbox.hxx b/accessibility/inc/extended/accessiblelistbox.hxx
index 924eb9347d15..374d99ad5c77 100644
--- a/accessibility/inc/extended/accessiblelistbox.hxx
+++ b/accessibility/inc/extended/accessiblelistbox.hxx
@@ -74,7 +74,7 @@ namespace accessibility
             @param  _xParent
                 is our parent accessible object
         */
-        AccessibleListBox( SvTreeListBox& _rListBox,
+        AccessibleListBox( SvTreeListBox const & _rListBox,
                            const css::uno::Reference< css::accessibility::XAccessible >& _xParent );
 
         // XTypeProvider
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index 6a2c77955b00..0f66fbc7d46c 100644
--- a/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -44,7 +44,7 @@ namespace accessibility
 
     // Ctor() and Dtor()
 
-    AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) :
+    AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl( SvtIconChoiceCtrl const & _rIconCtrl, const Reference< XAccessible >& _xParent ) :
 
         VCLXAccessibleComponent( _rIconCtrl.GetWindowPeer() ),
         m_xParent       ( _xParent )
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index c19499de7dc2..8c5765835bb7 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -49,7 +49,7 @@ namespace accessibility
 
     // Ctor() and Dtor()
 
-    AccessibleListBox::AccessibleListBox( SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) :
+    AccessibleListBox::AccessibleListBox( SvTreeListBox const & _rListBox, const Reference< XAccessible >& _xParent ) :
 
         VCLXAccessibleComponent( _rListBox.GetWindowPeer() ),
         m_xParent( _xParent )
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 9189d7538df8..823e2a04fd63 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -438,7 +438,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
     return pInfo;
 }
 
-BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
+BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib, OUString const * pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
 {
     Init();
 
@@ -604,7 +604,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
     SetGlobalUNOConstant( "DialogLibraries", uno::Any( mpImpl->maContainerInfo.mxDialogCont ) );
 }
 
-BasicManager::BasicManager( StarBASIC* pSLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
+BasicManager::BasicManager( StarBASIC* pSLib, OUString const * pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
 {
     Init();
     DBG_ASSERT( pSLib, "BasicManager cannot be created with a NULL-Pointer!" );
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 11c2806a4632..ab9a333ad5a8 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -292,8 +292,8 @@ class UCBStream : public SvStream
     Reference< XStream >        xS;
     Reference< XSeekable >      xSeek;
 public:
-    explicit UCBStream( Reference< XInputStream > & xIS );
-    explicit UCBStream( Reference< XStream > & xS );
+    explicit UCBStream( Reference< XInputStream > const & xIS );
+    explicit UCBStream( Reference< XStream > const & xS );
                        virtual ~UCBStream() override;
     virtual std::size_t GetData( void* pData, std::size_t nSize ) override;
     virtual std::size_t PutData( const void* pData, std::size_t nSize ) override;
@@ -302,13 +302,13 @@ public:
     virtual void        SetSize( sal_uInt64 nSize ) override;
 };
 
-UCBStream::UCBStream( Reference< XInputStream > & rStm )
+UCBStream::UCBStream( Reference< XInputStream > const & rStm )
     : xIS( rStm )
     , xSeek( rStm, UNO_QUERY )
 {
 }
 
-UCBStream::UCBStream( Reference< XStream > & rStm )
+UCBStream::UCBStream( Reference< XStream > const & rStm )
     : xS( rStm )
     , xSeek( rStm, UNO_QUERY )
 {
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index 7f09fb4ef579..ebf93aeb8282 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -1197,7 +1197,7 @@ namespace
         PackedFileEntry(
             sal_uInt32 nFullFileSize,
             sal_uInt32 nCrc32,
-            FileSharedPtr& rFile,
+            FileSharedPtr const & rFile,
             bool bDoCompress)
         :   mnFullFileSize(nFullFileSize),
             mnPackFileSize(nFullFileSize),
@@ -1549,7 +1549,7 @@ namespace
             return bRetval;
         }
 
-        bool tryPush(FileSharedPtr& rFileCandidate, bool bCompress)
+        bool tryPush(FileSharedPtr const & rFileCandidate, bool bCompress)
         {
             sal_uInt64 nFileSize(0);
 
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 76b1b91784a8..93b325a06657 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -8,7 +8,8 @@
  */
 
 #include <string>
-#include <set>
+#include <unordered_set>
+#include <unordered_map>
 #include <iostream>
 
 #include "plugin.hxx"
@@ -24,6 +25,10 @@
 namespace
 {
 
+static bool startswith(const std::string& rStr, const char* pSubStr) {
+    return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
+}
+
 class ConstParams:
     public RecursiveASTVisitor<ConstParams>, public loplugin::Plugin
 {
@@ -31,35 +36,69 @@ public:
     explicit ConstParams(InstantiationData const & data): Plugin(data) {}
 
     virtual void run() override {
+        std::string fn( compiler.getSourceManager().getFileEntryForID(
+                        compiler.getSourceManager().getMainFileID())->getName() );
+        normalizeDotDotInFilePath(fn);
+        if (startswith(fn, SRCDIR "/sal/")
+            || startswith(fn, SRCDIR "/bridges/")
+            || startswith(fn, SRCDIR "/binaryurp/")
+            || startswith(fn, SRCDIR "/stoc/")
+            || startswith(fn, WORKDIR "/YaccTarget/unoidl/source/sourceprovider-parser.cxx")
+            // some weird calling through a function pointer
+            || startswith(fn, SRCDIR "/svtools/source/table/defaultinputhandler.cxx")
+            // windows only
+            || startswith(fn, SRCDIR "/basic/source/sbx/sbxdec.cxx")
+            || startswith(fn, SRCDIR "/sfx2/source/doc/syspath.cxx")
+            // ignore this for now
+            || startswith(fn, SRCDIR "/libreofficekit")
+            )
+            return;
+
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+
+        for (const ParmVarDecl *pParmVarDecl : interestingSet) {
+            if (cannotBeConstSet.find(pParmVarDecl) == cannotBeConstSet.end()) {
+                report(
+                    DiagnosticsEngine::Warning,
+                    "this parameter can be const",
+                    pParmVarDecl->getLocStart())
+                    << pParmVarDecl->getSourceRange();
+                auto functionDecl = parmToFunction[pParmVarDecl];
+                if (functionDecl->getCanonicalDecl()->getLocation() != functionDecl->getLocation()) {
+                    unsigned idx = pParmVarDecl->getFunctionScopeIndex();
+                    const ParmVarDecl* pOther = functionDecl->getCanonicalDecl()->getParamDecl(idx);
+                    report(
+                        DiagnosticsEngine::Note,
+                        "canonical parameter declaration here",
+                        pOther->getLocStart())
+                        << pOther->getSourceRange();
+                }
+            }
+        }
     }
 
-    bool VisitFunctionDecl(FunctionDecl *);
-    bool VisitDeclRefExpr( const DeclRefExpr* );
+    bool VisitFunctionDecl(const FunctionDecl *);
+    bool VisitDeclRefExpr(const DeclRefExpr *);
 
 private:
     bool checkIfCanBeConst(const Stmt*, const ParmVarDecl*);
     bool isPointerOrReferenceToConst(const QualType& qt);
     StringRef getFilename(const SourceLocation& loc);
 
-    bool mbInsideFunction;
-    std::set<const ParmVarDecl*> interestingSet;
-    std::set<const ParmVarDecl*> cannotBeConstSet;
+    std::unordered_set<const ParmVarDecl*> interestingSet;
+    std::unordered_map<const ParmVarDecl*, const FunctionDecl*> parmToFunction;
+    std::unordered_set<const ParmVarDecl*> cannotBeConstSet;
 };
 
-bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
+bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
 {
-    if (ignoreLocation(functionDecl) || !functionDecl->doesThisDeclarationHaveABody()) {
+    if (ignoreLocation(functionDecl) || !functionDecl->isThisDeclarationADefinition()) {
         return true;
     }
     // ignore stuff that forms part of the stable URE interface
     if (isInUnoIncludeFile(functionDecl)) {
         return true;
     }
-    // TODO ignore these for now, requires some extra work
-    if (isa<CXXConstructorDecl>(functionDecl)) {
-        return true;
-    }
     // TODO ignore template stuff for now
     if (functionDecl->getTemplatedKind() != FunctionDecl::TK_NonTemplate) {
         return true;
@@ -82,11 +121,12 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
     if (functionDecl->getLocation().isMacroID())
         return true;
 
-    if (functionDecl->getIdentifier()) {
+    if (functionDecl->getIdentifier())
+    {
         StringRef name = functionDecl->getName();
         if (name == "yyerror" // ignore lex/yacc callback
-                // some function callbacks
-                // TODO should really use a two-pass algorithm to detect and ignore these automatically
+                    // some function callbacks
+                    // TODO should really use a two-pass algorithm to detect and ignore these automatically
             || name == "PDFSigningPKCS7PasswordCallback"
             || name == "VCLExceptionSignal_impl"
             || name == "parseXcsFile"
@@ -114,6 +154,7 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
             || name == "ImpGetEscDir"
             || name == "ImpGetPercent"
             || name == "ImpGetAlign"
+            || name == "write_function"
              // #ifdef win32
             || name == "convert_slashes"
                 // UNO component entry points
@@ -129,22 +170,7 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
                 return true;
     }
 
-    StringRef aFileName = getFilename(functionDecl->getLocStart());
-    if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sal/")
-        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/bridges/")
-        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/binaryurp/")
-        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/stoc/")
-        || loplugin::hasPathnamePrefix(aFileName, WORKDIR "/YaccTarget/unoidl/source/sourceprovider-parser.cxx")
-        // some weird calling through a function pointer
-        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/svtools/source/table/defaultinputhandler.cxx")
-        // windows only
-        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/basic/source/sbx/sbxdec.cxx")
-        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sfx2/source/doc/syspath.cxx")) {
-        return true;
-    }
-
     // calculate the ones we want to check
-    interestingSet.clear();
     for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
         // ignore unused params
         if (pParmVarDecl->getName().empty())
@@ -165,48 +191,27 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
         // const is meaningless when applied to function pointer types
         if (pParmVarDecl->getType()->isFunctionPointerType())
             continue;
+        // ignore things with template params
+        if (pParmVarDecl->getType()->isInstantiationDependentType())
+            continue;
         interestingSet.insert(pParmVarDecl);
+        parmToFunction[pParmVarDecl] = functionDecl;
     }
-    if (interestingSet.empty()) {
-        return true;
-    }
-
-    mbInsideFunction = true;
-    cannotBeConstSet.clear();
-    bool ret = RecursiveASTVisitor::TraverseStmt(functionDecl->getBody());
-    mbInsideFunction = false;
 
-    for (const ParmVarDecl *pParmVarDecl : interestingSet) {
-        if (cannotBeConstSet.find(pParmVarDecl) == cannotBeConstSet.end()) {
-            report(
-                DiagnosticsEngine::Warning,
-                "this parameter can be const",
-                pParmVarDecl->getLocStart())
-                << pParmVarDecl->getSourceRange();
-            if (functionDecl->getCanonicalDecl()->getLocation() != functionDecl->getLocation()) {
-                unsigned idx = pParmVarDecl->getFunctionScopeIndex();
-                ParmVarDecl* pOther = functionDecl->getCanonicalDecl()->getParamDecl(idx);
-                report(
-                    DiagnosticsEngine::Note,
-                    "canonical parameter declaration here",
-                    pOther->getLocStart())
-                    << pOther->getSourceRange();
-            }
-        }
-    }
-    return ret;
+    return true;
 }
 
 bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
 {
-    if (!mbInsideFunction) {
+    if (ignoreLocation(declRefExpr)) {
         return true;
     }
-    const ParmVarDecl* parmVarDecl = dyn_cast_or_null<ParmVarDecl>(declRefExpr->getDecl());
-    if (!parmVarDecl) {
+    // ignore stuff that forms part of the stable URE interface
+    if (isInUnoIncludeFile(declRefExpr->getLocStart())) {
         return true;
     }
-    if (interestingSet.find(parmVarDecl) == interestingSet.end()) {
+    const ParmVarDecl* parmVarDecl = dyn_cast_or_null<ParmVarDecl>(declRefExpr->getDecl());
+    if (!parmVarDecl) {
         return true;
     }
     // no need to check again if we have already eliminated this one
@@ -218,13 +223,41 @@ bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
     return true;
 }
 
-// Walk up from a DeclRefExpr to a ParamVarDecl, checking if the usage means that the
-// ParamVarDecl can be const.
+// Walk up from a statement that contains a DeclRefExpr, checking if the usage means that the
+// related ParamVarDecl can be const.
 bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVarDecl)
 {
     const Stmt* parent = parentStmt( stmt );
-    if (isa<UnaryOperator>(parent)) {
-        const UnaryOperator* unaryOperator = dyn_cast<UnaryOperator>(parent);
+    if (!parent)
+    {
+        // check if we're inside a CXXCtorInitializer
+        auto parentsRange = compiler.getASTContext().getParents(*stmt);
+        if ( parentsRange.begin() == parentsRange.end())
+            return true;
+        auto cxxConstructorDecl = dyn_cast_or_null<CXXConstructorDecl>(parentsRange.begin()->get<Decl>());
+        if (!cxxConstructorDecl)
+            return true;
+        for ( auto cxxCtorInitializer : cxxConstructorDecl->inits())
+        {
+            if (cxxCtorInitializer->isAnyMemberInitializer() && cxxCtorInitializer->getInit() == stmt)
+            {
+                // if the member is not pointer or ref to-const, we cannot make the param const
+                auto fieldDecl = cxxCtorInitializer->getAnyMember();
+                auto tc = loplugin::TypeCheck(fieldDecl->getType());
+                return tc.Pointer().Const() || tc.LvalueReference().Const();
+            }
+        }
+        parmVarDecl->dump();
+        stmt->dump();
+        cxxConstructorDecl->dump();
+        report(
+             DiagnosticsEngine::Warning,
+             "couldn't find the CXXCtorInitializer?",
+              stmt->getLocStart())
+              << stmt->getSourceRange();
+        return false;
+    }
+    if (auto unaryOperator = dyn_cast<UnaryOperator>(parent)) {
         UnaryOperator::Opcode op = unaryOperator->getOpcode();
         if (op == UO_AddrOf || op == UO_PreInc || op == UO_PostInc
             || op == UO_PreDec || op == UO_PostDec) {
@@ -254,17 +287,15 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
             return checkIfCanBeConst(parent, parmVarDecl);
         }
         return true;
-    } else if (isa<CXXConstructExpr>(parent)) {
-        const CXXConstructExpr* constructExpr = dyn_cast<CXXConstructExpr>(parent);
+    } else if (auto constructExpr = dyn_cast<CXXConstructExpr>(parent)) {
         const CXXConstructorDecl * constructorDecl = constructExpr->getConstructor();
         for (unsigned i = 0; i < constructExpr->getNumArgs(); ++i) {
             if (constructExpr->getArg(i) == stmt) {
                 return isPointerOrReferenceToConst(constructorDecl->getParamDecl(i)->getType());
             }
         }
-    } else if (isa<CXXOperatorCallExpr>(parent)) {
-        const CXXOperatorCallExpr* operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent);
-        const CXXMethodDecl* calleeMethodDecl = dyn_cast<CXXMethodDecl>(operatorCallExpr->getDirectCallee());
+    } else if (auto operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent)) {
+        const CXXMethodDecl* calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(operatorCallExpr->getDirectCallee());
         if (calleeMethodDecl) {
             // unary operator
             if (calleeMethodDecl->getNumParams() == 0) {
@@ -293,8 +324,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
                 }
             }
         }
-    } else if (isa<CallExpr>(parent)) {
-        const CallExpr* callExpr = dyn_cast<CallExpr>(parent);
+    } else if (auto callExpr = dyn_cast<CallExpr>(parent)) {
         QualType functionType = callExpr->getCallee()->getType();
         if (functionType->isFunctionPointerType()) {
             functionType = functionType->getPointeeType();
@@ -314,27 +344,29 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
             }
         }
         const FunctionDecl* calleeFunctionDecl = callExpr->getDirectCallee();
-        if (isa<CXXMemberCallExpr>(parent)) {
-            const CXXMemberCallExpr* memberCallExpr = dyn_cast<CXXMemberCallExpr>(parent);
-            const MemberExpr* memberExpr = dyn_cast<MemberExpr>(stmt);
-            if (memberExpr && memberCallExpr->getImplicitObjectArgument() == memberExpr->getBase())
-            {
-                const CXXMethodDecl* calleeMethodDecl = dyn_cast<CXXMethodDecl>(calleeFunctionDecl);
-                return calleeMethodDecl->isConst();
+        if (calleeFunctionDecl)
+        {
+            if (auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(parent)) {
+                const MemberExpr* memberExpr = dyn_cast<MemberExpr>(stmt);
+                if (memberExpr && memberCallExpr->getImplicitObjectArgument() == memberExpr->getBase())
+                {
+                    const CXXMethodDecl* calleeMethodDecl = dyn_cast<CXXMethodDecl>(calleeFunctionDecl);
+                    return calleeMethodDecl->isConst();
+                }
             }
-        }
-        // TODO could do better
-        if (calleeFunctionDecl->isVariadic()) {
-            return false;
-        }
-        if (callExpr->getCallee() == stmt) {
-            return true;
-        }
-        for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
-            if (i >= calleeFunctionDecl->getNumParams()) // can happen in template code
-                break;
-            if (callExpr->getArg(i) == stmt) {
-                return isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType());
+            // TODO could do better
+            if (calleeFunctionDecl->isVariadic()) {
+                return false;
+            }
+            if (callExpr->getCallee() == stmt) {
+                return true;
+            }
+            for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
+                if (i >= calleeFunctionDecl->getNumParams()) // can happen in template code
+                    break;
+                if (callExpr->getArg(i) == stmt) {
+                    return isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType());
+                }
             }
         }
     } else if (isa<CXXReinterpretCastExpr>(parent)) {
@@ -370,15 +402,20 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
         return false;
     } else if (isa<VAArgExpr>(parent)) {
         return false;
+    } else if (isa<CXXDependentScopeMemberExpr>(parent)) {
+        return false;
     } else if (isa<MaterializeTemporaryExpr>(parent)) {
         return true;
-    } else if (const ConditionalOperator* conditionalExpr = dyn_cast<ConditionalOperator>(parent)) {
+    } else if (auto conditionalExpr = dyn_cast<ConditionalOperator>(parent)) {
         if (conditionalExpr->getCond() == stmt)
             return true;
         return checkIfCanBeConst(parent, parmVarDecl);
     } else if (isa<UnaryExprOrTypeTraitExpr>(parent)) {
         return false; // ???
-    } else if (isa<CXXNewExpr>(parent)) {
+    } else if (auto cxxNewExpr = dyn_cast<CXXNewExpr>(parent)) {
+        for (auto pa : cxxNewExpr->placement_arguments())
+            if (pa == stmt)
+                return false;
         return true; // because the ParamVarDecl must be a parameter to the expression, probably an array length
     } else if (auto lambdaExpr = dyn_cast<LambdaExpr>(parent)) {
         for (auto it = lambdaExpr->capture_begin(); it != lambdaExpr->capture_end(); ++it)
@@ -386,18 +423,21 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
             if (it->capturesVariable() && it->getCapturedVar() == parmVarDecl)
                 return it->getCaptureKind() != LCK_ByRef;
         }
-        /* sigh. just running this message will cause clang to crash (in sdext)
-        report(
-             DiagnosticsEngine::Warning,
-             "cannot handle this lambda",
-              parent->getLocStart())
-              << parent->getSourceRange();
-        parent->dump();
-        parmVarDecl->dump();
-         */
-         return false;
+        return false;
     } else if (isa<CXXTypeidExpr>(parent)) {
         return true;
+    } else if (isa<ParenListExpr>(parent)) {
+        return true;
+    } else if (isa<CXXUnresolvedConstructExpr>(parent)) {
+        return false;
+    } else if (isa<UnresolvedMemberExpr>(parent)) {
+        return false;
+    } else if (isa<PackExpansionExpr>(parent)) {
+        return false;
+    } else if (isa<ExprWithCleanups>(parent)) {
+        return checkIfCanBeConst(parent, parmVarDecl);
+    } else if (isa<CaseStmt>(parent)) {
+        return true;
     } else {
         parent->dump();
         parmVarDecl->dump();
diff --git a/compilerplugins/clang/test/constparams.cxx b/compilerplugins/clang/test/constparams.cxx
new file mode 100644
index 000000000000..fd4ee2cd63f7
--- /dev/null
+++ b/compilerplugins/clang/test/constparams.cxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+struct Class1
+{
+    int const * m_f1;
+    Class1(int * f1) : m_f1(f1) {} // expected-error {{this parameter can be const [loplugin:constparams]}}
+};
+
+struct Class2
+{
+    int * m_f2;
+    Class2(int * f2) : m_f2(f2) {}
+};
+struct Class3
+{
+    int * m_f2;
+    Class3(void * f2) : m_f2(static_cast<int*>(f2)) {}
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx
index 69b1692735eb..6e3e29450fef 100644
--- a/connectivity/source/drivers/file/fcode.cxx
+++ b/connectivity/source/drivers/file/fcode.cxx
@@ -65,7 +65,7 @@ void OOperandValue::setValue(const ORowSetValue& _rVal)
     m_aValue = _rVal;
 }
 
-OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos)
+OOperandParam::OOperandParam(OSQLParseNode const * pNode, sal_Int32 _nPos)
     : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR)         // Standard-Type
 {
     OSL_ENSURE(SQL_ISRULE(pNode,parameter),"Argument is not a parameter");
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index d922a5293022..1953fb5303a6 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -134,7 +134,7 @@ void OPredicateCompiler::start(OSQLParseNode const * pSQLParseNode)
 }
 
 
-OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
+OOperand* OPredicateCompiler::execute(OSQLParseNode const * pPredicateNode)
 {
     OOperand* pOperand = nullptr;
     if (pPredicateNode->count() == 3 &&                         // Expression is bracketed
@@ -408,7 +408,7 @@ void OPredicateCompiler::execute_ISNULL(OSQLParseNode const * pPredicateNode)
     m_aCodeList.push_back(pOperator);
 }
 
-OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode)
+OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode const * pPredicateNode)
 {
     OOperand* pOperand = nullptr;
 
diff --git a/connectivity/source/drivers/firebird/Blob.cxx b/connectivity/source/drivers/firebird/Blob.cxx
index be4922d7f33c..b71c8844cb72 100644
--- a/connectivity/source/drivers/firebird/Blob.cxx
+++ b/connectivity/source/drivers/firebird/Blob.cxx
@@ -31,7 +31,7 @@ using namespace ::com::sun::star::uno;
 
 Blob::Blob(isc_db_handle* pDatabaseHandle,
            isc_tr_handle* pTransactionHandle,
-           ISC_QUAD& aBlobID):
+           ISC_QUAD const & aBlobID):
     Blob_BASE(m_aMutex),
     m_pDatabaseHandle(pDatabaseHandle),
     m_pTransactionHandle(pTransactionHandle),
diff --git a/connectivity/source/drivers/firebird/Blob.hxx b/connectivity/source/drivers/firebird/Blob.hxx
index eb8e282bf911..9afa09dec8fd 100644
--- a/connectivity/source/drivers/firebird/Blob.hxx
+++ b/connectivity/source/drivers/firebird/Blob.hxx
@@ -58,7 +58,7 @@ namespace connectivity
         public:
             Blob(isc_db_handle* pDatabaseHandle,
                  isc_tr_handle* pTransactionHandle,
-                 ISC_QUAD& aBlobID);
+                 ISC_QUAD const & aBlobID);
 
             // ---- XBlob ----------------------------------------------------
             virtual sal_Int64 SAL_CALL
diff --git a/connectivity/source/drivers/firebird/Clob.cxx b/connectivity/source/drivers/firebird/Clob.cxx
index 4f70a000a242..7e2d49727ed1 100644
--- a/connectivity/source/drivers/firebird/Clob.cxx
+++ b/connectivity/source/drivers/firebird/Clob.cxx
@@ -26,7 +26,7 @@ using namespace ::com::sun::star::uno;
 
 Clob::Clob(isc_db_handle* pDatabaseHandle,
            isc_tr_handle* pTransactionHandle,
-           ISC_QUAD& aBlobID):
+           ISC_QUAD const & aBlobID):
     Clob_BASE(m_aMutex),
     m_aBlob(new connectivity::firebird::Blob(pDatabaseHandle, pTransactionHandle, aBlobID))
 {
diff --git a/connectivity/source/drivers/firebird/Clob.hxx b/connectivity/source/drivers/firebird/Clob.hxx
index b71bec19fa51..d435312f9f36 100644
--- a/connectivity/source/drivers/firebird/Clob.hxx
+++ b/connectivity/source/drivers/firebird/Clob.hxx
@@ -41,7 +41,7 @@ namespace connectivity
         public:
             Clob(isc_db_handle* pDatabaseHandle,
                  isc_tr_handle* pTransactionHandle,
-                 ISC_QUAD& aBlobID);
+                 ISC_QUAD const & aBlobID);
 
             // ---- XClob ----------------------------------------------------
             virtual sal_Int64 SAL_CALL
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index f6807cf2bbe1..d792ecb72fb0 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -349,7 +349,7 @@ void Connection::notifyDatabaseModified()
 IMPLEMENT_SERVICE_INFO(Connection, "com.sun.star.sdbc.drivers.firebird.Connection",
                                                     "com.sun.star.sdbc.Connection")
 
-Reference< XBlob> Connection::createBlob(ISC_QUAD* pBlobId)
+Reference< XBlob> Connection::createBlob(ISC_QUAD const * pBlobId)
 {
     MutexGuard aGuard(m_aMutex);
     checkDisposed(Connection_BASE::rBHelper.bDisposed);
@@ -362,7 +362,7 @@ Reference< XBlob> Connection::createBlob(ISC_QUAD* pBlobId)
     return xReturn;
 }
 
-Reference< XClob> Connection::createClob(ISC_QUAD* pBlobId)
+Reference< XClob> Connection::createClob(ISC_QUAD const * pBlobId)
 {
     MutexGuard aGuard(m_aMutex);
     checkDisposed(Connection_BASE::rBHelper.bDisposed);
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 43bccf9ab8f8..70f5a417af42 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -211,11 +211,11 @@ namespace connectivity
              * @throws css::uno::RuntimeException
              */
             css::uno::Reference< css::sdbc::XBlob>
-                createBlob(ISC_QUAD* pBlobID);
+                createBlob(ISC_QUAD const * pBlobID);
             /// @throws css::sdbc::SQLException
             /// @throws css::uno::RuntimeException
             css::uno::Reference< css::sdbc::XClob>
-                createClob(ISC_QUAD* pBlobID);
+                createClob(ISC_QUAD const * pBlobID);
 
             /**
              * Create and/or connect to the sdbcx Catalog. This is completely
diff --git a/connectivity/source/drivers/firebird/Tables.hxx b/connectivity/source/drivers/firebird/Tables.hxx
index e106b8b65c4d..d391ca8b0999 100644
--- a/connectivity/source/drivers/firebird/Tables.hxx
+++ b/connectivity/source/drivers/firebird/Tables.hxx
@@ -45,7 +45,7 @@ namespace connectivity
             Tables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData,
                    ::cppu::OWeakObject& rParent,
                    ::osl::Mutex& rMutex,
-                   ::connectivity::TStringVector& rNames) : sdbcx::OCollection(rParent, true, rMutex, rNames), m_xMetaData(rMetaData) {}
+                   ::connectivity::TStringVector const & rNames) : sdbcx::OCollection(rParent, true, rMutex, rNames), m_xMetaData(rMetaData) {}
 
             // TODO: we should also implement XDataDescriptorFactory, XRefreshable,
             // XAppend,  etc., but all are optional.
diff --git a/connectivity/source/drivers/firebird/Users.cxx b/connectivity/source/drivers/firebird/Users.cxx
index a887a679e7e8..edaa9edb6862 100644
--- a/connectivity/source/drivers/firebird/Users.cxx
+++ b/connectivity/source/drivers/firebird/Users.cxx
@@ -30,7 +30,7 @@ using namespace ::com::sun::star::uno;
 Users::Users(const uno::Reference< XDatabaseMetaData >& rMetaData,
              OWeakObject& rParent,
              Mutex& rMutex,
-             TStringVector& rNames) :
+             TStringVector const & rNames) :
     OCollection(rParent,
                 true,
                 rMutex,
diff --git a/connectivity/source/drivers/firebird/Users.hxx b/connectivity/source/drivers/firebird/Users.hxx
index 75ba14499eb5..a689e672b5bc 100644
--- a/connectivity/source/drivers/firebird/Users.hxx
+++ b/connectivity/source/drivers/firebird/Users.hxx
@@ -42,7 +42,7 @@ namespace connectivity
             Users(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData,
                   ::cppu::OWeakObject& rParent,
                   ::osl::Mutex& rMutex,
-                  ::connectivity::TStringVector& rNames);
+                  ::connectivity::TStringVector const & rNames);
 
             // TODO: we should also implement XDataDescriptorFactory, XRefreshable,
             // XAppend,  etc., but all are optional.
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index 6b46bd2f5654..06341803ba2b 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -117,7 +117,7 @@ ResultSetMetaData::ResultSetMetaData(
     const css::uno::Reference< css::sdbc::XResultSet >  & origin,
     ResultSet * pResultSet,
     ConnectionSettings **ppSettings,
-    PGresult *pResult,
+    PGresult const *pResult,
     const OUString &schemaName,
     const OUString &tableName ) :
     m_xMutex( refMutex ),
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
index 1beede2b835d..2c1b5e5e5965 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
@@ -94,7 +94,7 @@ public:
         const css::uno::Reference< css::sdbc::XResultSet >  & origin,
         ResultSet *pResultSet,
         ConnectionSettings **pSettings,
-        PGresult *pResult,
+        PGresult const *pResult,
         const OUString &schemaName,
         const OUString &tableName );
 
diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx
index 8ac3676b26d0..40e0a1100c95 100644
--- a/connectivity/source/inc/file/fcode.hxx
+++ b/connectivity/source/inc/file/fcode.hxx
@@ -110,7 +110,7 @@ namespace connectivity
         class OOperandParam : public OOperandRow
         {
         public:
-            OOperandParam(connectivity::OSQLParseNode* pNode, sal_Int32 _nPos);
+            OOperandParam(connectivity::OSQLParseNode const * pNode, sal_Int32 _nPos);
         };
 
         // Value operands
diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx
index 0e8606002e6c..a20ce876fe03 100644
--- a/connectivity/source/inc/file/fcomp.hxx
+++ b/connectivity/source/inc/file/fcomp.hxx
@@ -59,7 +59,7 @@ namespace connectivity
             void dispose();
 
             void start(connectivity::OSQLParseNode const * pSQLParseNode);
-            OOperand* execute(connectivity::OSQLParseNode* pPredicateNode);
+            OOperand* execute(connectivity::OSQLParseNode const * pPredicateNode);
 
             void Clean();
             bool isClean() const {return m_aCodeList.empty();}
@@ -81,7 +81,7 @@ namespace connectivity
             void execute_ISNULL(connectivity::OSQLParseNode const * pPredicateNode);
             /// @throws css::sdbc::SQLException
             /// @throws css::uno::RuntimeException
-            OOperand* execute_Operand(connectivity::OSQLParseNode* pPredicateNode);
+            OOperand* execute_Operand(connectivity::OSQLParseNode const * pPredicateNode);
             /// @throws css::sdbc::SQLException
             /// @throws css::uno::RuntimeException
             void execute_Fold(OSQLParseNode const * pPredicateNode);
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 312550eac166..cdf90ef71eac 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -769,7 +769,7 @@ namespace cppcanvas
                                   const OUString&     rText,
                                   sal_Int32                  nStartPos,
                                   sal_Int32                  nLen,
-                                  VirtualDevice&             rVDev,
+                                  VirtualDevice const &      rVDev,
                                   const CanvasSharedPtr&     rCanvas,
                                   const OutDevState&         rState );
 
@@ -781,7 +781,7 @@ namespace cppcanvas
                                   const OUString&            rText,
                                   sal_Int32                         nStartPos,
                                   sal_Int32                         nLen,
-                                  VirtualDevice&                    rVDev,
+                                  VirtualDevice const &             rVDev,
                                   const CanvasSharedPtr&            rCanvas,
                                   const OutDevState&                rState,
                                   const ::basegfx::B2DHomMatrix&    rTextTransform );
@@ -833,7 +833,7 @@ namespace cppcanvas
                                                 const OUString&     rText,
                                                 sal_Int32                  nStartPos,
                                                 sal_Int32                  nLen,
-                                                VirtualDevice&             rVDev,
+                                                VirtualDevice const &      rVDev,
                                                 const CanvasSharedPtr&     rCanvas,
                                                 const OutDevState&         rState ) :
                 mxFont( rState.xFont ),
@@ -872,7 +872,7 @@ namespace cppcanvas
                                                 const OUString&          rText,
                                                 sal_Int32                       nStartPos,
                                                 sal_Int32                       nLen,
-                                                VirtualDevice&                  rVDev,
+                                                VirtualDevice const &           rVDev,
                                                 const CanvasSharedPtr&          rCanvas,
                                                 const OutDevState&              rState,
                                                 const ::basegfx::B2DHomMatrix&  rTextTransform ) :
@@ -1190,7 +1190,7 @@ namespace cppcanvas
                                        sal_Int32                        nStartPos,
                                        sal_Int32                        nLen,
                                        const uno::Sequence< double >&   rOffsets,
-                                       VirtualDevice&                   rVDev,
+                                       VirtualDevice const &            rVDev,
                                        const CanvasSharedPtr&           rCanvas,
                                        const OutDevState&               rState  );
                 EffectTextArrayAction( const ::basegfx::B2DPoint&       rStartPoint,
@@ -1202,7 +1202,7 @@ namespace cppcanvas
                                        sal_Int32                        nStartPos,
                                        sal_Int32                        nLen,
                                        const uno::Sequence< double >&   rOffsets,
-                                       VirtualDevice&                   rVDev,
+                                       VirtualDevice const &            rVDev,
                                        const CanvasSharedPtr&           rCanvas,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list