[Libreoffice-commits] core.git: Branch 'feature/qt5-win+mac' - 746 commits - accessibility/inc accessibility/source android/source avmedia/source basctl/source basctl/uiconfig basegfx/source basegfx/test basic/source binaryurp/source bin/find-unneeded-includes bin/gla11y bin/parse-perfcheck.py bridges/source canvas/source canvas/workben chart2/inc chart2/IwyuFilter_chart2.yaml chart2/qa chart2/source chart2/uiconfig codemaker/source comphelper/Library_comphelper.mk comphelper/qa comphelper/source compilerplugins/clang compilerplugins/LICENSE.TXT config_host/config_vclplug.h.in config_host.mk.in configmgr/source configure.ac connectivity/Configuration_mysql_jdbc.mk connectivity/Library_mysql_jdbc.mk connectivity/Module_connectivity.mk connectivity/registry connectivity/source cppcanvas/source cppuhelper/source cppu/source cpputools/source cui/inc cui/Library_cui.mk cui/source cui/uiconfig dbaccess/CppunitTest_dbaccess_firebird_regression_test.mk dbaccess/CppunitTest_dbaccess_firebird_test.mk dbacc ess/Library_dba.mk dbaccess/Library_dbmm.mk dbaccess/Module_dbaccess.mk dbaccess/qa dbaccess/source dbaccess/uiconfig desktop/CppunitTest_desktop_lib.mk desktop/source desktop/unx desktop/win32 distro-configs/LibreOfficeiOS.conf download.lst drawinglayer/source dtrans/Library_mcnttype.mk dtrans/source editeng/CppunitTest_editeng_core.mk editeng/inc editeng/qa editeng/source embeddedobj/source embedserv/source emfio/CppunitTest_emfio_wmf_test.mk emfio/qa emfio/source extensions/Library_dbp.mk extensions/source extensions/test extensions/uiconfig external/gpgmepp external/libnumbertext external/liborcus external/pdfium external/xmlsec extras/source filter/qa filter/source filter/uiconfig forms/source formula/source formula/uiconfig fpicker/source fpicker/uiconfig framework/source framework/uiconfig .git-hooks/pre-commit helpcontent2 hwpfilter/source i18nlangtag/source i18npool/source i18nutil/source icon-themes/colibre_svg icon-themes/elementary icon-themes/elementary_svg icon-themes/ karasa_jaga icon-themes/README idlc/source idl/source include/basegfx include/basic include/comphelper include/editeng include/formula include/i18nutil include/IwyuFilter_include.yaml include/jvmaccess include/LibreOfficeKit include/o3tl include/oox include/registry include/sal include/sax include/sfx2 include/svl include/svtools include/svx include/test include/toolkit include/tools include/unotools include/vcl ios/CustomTarget_iOS_link.mk ios/CustomTarget_iOS_setup.mk ios/LibreOfficeLight io/source ios/UnitTest javaunohelper/com javaunohelper/source jvmfwk/inc jvmfwk/plugins l10ntools/inc l10ntools/source librelogo/source libreofficekit/qa libreofficekit/source lingucomponent/source linguistic/source lotuswordpro/inc lotuswordpro/source o3tl/qa odk/examples offapi/com officecfg/registry oox/inc oox/Library_oox.mk oox/qa oox/README.vars oox/source oox/util opencl/inc opencl/source package/inc package/source postprocess/CustomTarget_registry.mk postprocess/qa postprocess/Rdb_service s.mk pyuno/source qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests README.md registry/source registry/tools reportdesign/inc reportdesign/source reportdesign/uiconfig Repository.mk sal/cppunittester salhelper/qa sal/osl sal/qa sal/rtl sal/textenc sax/qa sax/source scaddins/source sccomp/source sc/CppunitTest_sc_dataprovider.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/inc sc/IwyuFilter_sc.yaml sc/Library_sc.mk scp2/source sc/qa scripting/source sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sdext/source sd/inc sd/qa sd/sdi sd/source sd/uiconfig sd/UIConfig_simpress.mk setup.cfg setup_native/source sfx2/inc sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig shell/inc shell/source slideshow/source smoketest/smoketest.cxx solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/gbuild solenv/sanitizers soltools/cpp soltools/mkdepend sot/inc sot/source starmath/inc starmath/source s tarmath/uiconfig stoc/source store/source svgio/inc svl/qa svl/source svtools/inc svtools/langsupport svtools/qa svtools/source svtools/uiconfig svx/inc svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_unoapi.mk sw/CppunitTest_sw_unowriter.mk sw/CppunitTest_sw_ww8export.mk sw/inc sw/Module_sw.mk sw/ooxmlexport_setup.mk sw/PythonTest_sw_python.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UITest_findReplace.mk sw/util test/Library_subsequenttest.mk test/Package_unittest.mk test/source testtools/source test/user-template toolkit/inc toolkit/source tools/source translations ucb/source uitest/loginterpreter.py unodevtools/source unoidl/source unotest/source unotools/source unoxml/source uui/source uui/uiconfig vbahelper/source vcl/android vcl/CppunitTest_vcl_complextext.mk vcl/CppunitTest_vcl_fontfeature.mk v cl/CppunitTest_vcl_pdfexport.mk vcl/CustomTarget_qt5_moc.mk vcl/headless vcl/inc vcl/ios vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_osx.mk vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_win.mk vcl/Module_vcl.mk vcl/null vcl/opengl vcl/osx vcl/qa vcl/qt5 vcl/quartz vcl/README vcl/README.lifecycle vcl/source vcl/uiconfig vcl/unx vcl/win vcl/workben winaccessibility/source writerfilter/source writerperfect/qa writerperfect/source xmlhelp/source xmloff/source xmlscript/source xmlsecurity/source xmlsecurity/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 18 09:33:59 UTC 2018


Rebased ref, commits from common ancestor:
commit c8bb78f4e7d4eec251b23a8783442a6dd97f3ca5
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Sep 17 11:01:59 2018 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Oct 18 11:30:46 2018 +0200

    Qt5 use LO provided native file pickers
    
    This uses the native file pickers on Windows and MacOSX.
    
    Change-Id: Ic836d3ed8de0760c6c94c68d61f6eaa96f773000

diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index d01d0508145a..e74d864f7998 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -90,7 +90,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/Qt5Bitmap \
     vcl/qt5/Qt5Clipboard \
     vcl/qt5/Qt5Data \
-    vcl/qt5/Qt5FilePicker \
+    $(if $(USING_X11),vcl/qt5/Qt5FilePicker) \
     vcl/qt5/Qt5Font \
     vcl/qt5/Qt5FontFace \
     vcl/qt5/Qt5Frame \
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index ffbbf103a7ae..7fded10d934b 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -214,17 +214,27 @@ void Qt5Instance::ProcessEvent(SalUserEvent aEvent)
 }
 
 css::uno::Reference<css::ui::dialogs::XFilePicker2>
-Qt5Instance::createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&)
+Qt5Instance::createFilePicker(const css::uno::Reference<css::uno::XComponentContext>& cntxt)
 {
+#if (defined _WIN32 || defined MACOSX)
+    return SalInstance::createFilePicker(cntxt);
+#else
+    (void)cntxt;
     return css::uno::Reference<css::ui::dialogs::XFilePicker2>(
         new Qt5FilePicker(QFileDialog::ExistingFile));
+#endif
 }
 
 css::uno::Reference<css::ui::dialogs::XFolderPicker2>
-Qt5Instance::createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&)
+Qt5Instance::createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& cntxt)
 {
+#if (defined _WIN32 || defined MACOSX)
+    return SalInstance::createFolderPicker(cntxt);
+#else
+    (void)cntxt;
     return css::uno::Reference<css::ui::dialogs::XFolderPicker2>(
         new Qt5FilePicker(QFileDialog::Directory));
+#endif
 }
 
 css::uno::Reference<css::uno::XInterface>
commit adf416594016696db87d37d530fc39a8659809a1
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Sep 13 11:32:12 2018 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Oct 18 11:30:43 2018 +0200

    Qt5 build VCL plugin on MacOSX
    
    Change-Id: I6ddec483703c95faf69b7b146363376765d5d6f8

diff --git a/Repository.mk b/Repository.mk
index 73ef91a888f8..eb6166eceb3d 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -483,6 +483,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 			AppleRemote \
 		) \
 		fps_aqua \
+		$(if $(ENABLE_QT5),vclplug_qt5) \
 		vclplug_osx \
 		MacOSXSpell \
 	) \
diff --git a/configure.ac b/configure.ac
index 3fd916fb4f8f..e27378c3449e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -671,6 +671,7 @@ darwin*) # Mac OS X or iOS
             host=x86_64-apple-darwin
         fi
     else
+        test_qt5=yes
         _os=Darwin
         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
         INSTROOTCONTENTSUFFIX=/Contents
@@ -11176,13 +11177,7 @@ if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
 then
-    qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
-    qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
-
-    if test -n "$supports_multilib"; then
-        qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
-    fi
-
+    qt5_fwk_search="QtCore QtGui QtWidgets QtNetwork"
     qt5_test_include="QtWidgets/qapplication.h"
     if test $_os == "WINNT"; then
         qt5_test_library="Qt5Widgets.lib"
@@ -11190,12 +11185,25 @@ then
         qt5_test_library="libQt5Widgets.so"
     fi
 
+    qt5_incdirs=""
+    qt5_libdirs=""
+    if test "$USING_X11" = TRUE; then
+        qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
+        qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
+        if test -n "$supports_multilib"; then
+            qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
+        fi
+    fi
+
     dnl Check for qmake5
     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
     if test "$QMAKE5" = "no"; then
         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
     else
-        qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
+        case "$host_os" in
+        darwin*) qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\{0,\}\).*$/\1/p'`" ;;
+        *) qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`" ;;
+        esac
         if test -z "$qmake5_test_ver"; then
             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
         fi
@@ -11208,49 +11216,86 @@ then
         fi
     fi
 
-    qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
-    qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
-    if test $_os == "WINNT"; then
-        qt5_incdirs="`cygpath -m $qt5_incdirs`"
-        qt5_libdirs="`cygpath -m $qt5_libdirs`"
-    fi
+    qt5_cmake_incdir="`$QMAKE5 -query QT_INSTALL_HEADERS`"
+    qt5_cmake_libdir="`$QMAKE5 -query QT_INSTALL_LIBS`"
+    case "$_os" in
+    WINNT)
+        qt5_incdirs="`cygpath -m $qt5_cmake_incdir`"
+        qt5_libdirs="`cygpath -m $qt5_cmake_libdir`"
+        ;;
+    Darwin)
+        qt5_incdirs="$qt5_cmake_incdir"
+        qt5_libdirs="$qt5_cmake_libdir"
+        ;;
+    *)
+        qt5_incdirs="$qt5_cmake_incdir $qt5_incdirs"
+        qt5_libdirs="$qt5_cmake_libdir $qt5_libdirs"
+        ;;
+    esac
+    AC_MSG_NOTICE([Qt5 headers: ${qt5_cmake_incdir}])
+    AC_MSG_NOTICE([Qt5 libraries: ${qt5_cmake_libdir}])
 
-    AC_MSG_CHECKING([for Qt5 headers])
-    qt5_incdir="no"
-    for inc_dir in $qt5_incdirs; do
-        if test -r "$inc_dir/$qt5_test_include"; then
-            qt5_incdir="$inc_dir"
-            break
+    case "$_os" in
+    Darwin)
+        QT5_LIBS="-F ${qt5_libdirs}"
+        AC_MSG_CHECKING([for used Qt5 frameworks])
+        qt5_fwk_missing=""
+        for fwk in ${qt5_fwk_search}; do
+            if test ! -d "${qt5_libdirs}/${fwk}.framework"; then
+                qt5_fwk_missing="${qt5_fwk_missing} $fwk";
+            fi
+            QT5_LIBS="${QT5_LIBS} -framework $fwk"
+        done
+        if test -n "$qt5_fwk_missing"; then
+            AC_MSG_ERROR([Missing Qt5 frameworks in ${qt5_libdirs}:${qt5_fwk_missing}])
+        else
+            AC_MSG_RESULT([${qt5_fwk_search}])
         fi
-    done
-    AC_MSG_RESULT([$qt5_incdir])
-    if test "x$qt5_incdir" = "xno"; then
-        AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
-    fi
+        ;;
+    *)
+        AC_MSG_CHECKING([for Qt5 headers])
+        qt5_incdir="no"
+        for inc_dir in $qt5_incdirs; do
+            if test -r "$inc_dir/$qt5_test_include"; then
+                qt5_incdir="$inc_dir"
+                break
+            fi
+        done
 
-    AC_MSG_CHECKING([for Qt5 libraries])
-    qt5_libdir="no"
-    for lib_dir in $qt5_libdirs; do
-        if test -r "$lib_dir/$qt5_test_library"; then
-            qt5_libdir="$lib_dir"
-            break
+        AC_MSG_RESULT([$qt5_incdir])
+        if test "x$qt5_incdir" = "xno"; then
+            AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
+        fi
+
+        AC_MSG_CHECKING([for Qt5 libraries])
+        qt5_libdir="no"
+        for lib_dir in $qt5_libdirs; do
+            if test -r "$lib_dir/$qt5_test_library"; then
+                qt5_libdir="$lib_dir"
+                break
+            fi
+        done
+        AC_MSG_RESULT([$qt5_libdir])
+        if test "x$qt5_libdir" = "xno"; then
+            AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
         fi
-    done
-    AC_MSG_RESULT([$qt5_libdir])
-    if test "x$qt5_libdir" = "xno"; then
-        AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
-    fi
+
+        if test $_os == "WINNT"; then
+            QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib"
+        else
+            QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+        fi
+
+        ;;
+    esac
 
     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
-    QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
-    if test $_os == "WINNT"; then
-        QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib"
-    else
-        QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+    if test "$_os" = "Darwin"; then
+        QT5_CFLAGS="$QT5_CFLAGS -F $qt5_cmake_libdir"
     fi
+    QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
 
     dnl Check for Meta Object Compiler
-
     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
     if test "$MOC5" = "no"; then
         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
diff --git a/include/vcl/dllapi.h b/include/vcl/dllapi.h
index 805d1cb00908..668cbeb174c6 100644
--- a/include/vcl/dllapi.h
+++ b/include/vcl/dllapi.h
@@ -36,7 +36,7 @@
 #define UITEST_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
 #endif
 
-#if (defined UNX  && ! defined MACOS) || defined _WIN32
+#if defined UNX || defined MACOS || defined _WIN32
 #define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC
 #else
 #define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE
diff --git a/vcl/Library_vclplug_osx.mk b/vcl/Library_vclplug_osx.mk
index 7b2e52f3b3d3..7294bb661d1a 100644
--- a/vcl/Library_vclplug_osx.mk
+++ b/vcl/Library_vclplug_osx.mk
@@ -24,6 +24,11 @@ $(eval $(call gb_Library_set_include,vclplug_osx,\
     -I$(SRCDIR)/vcl/inc \
 ))
 
+$(eval $(call gb_Library_add_defs,vclplug_osx,\
+    -DVCLPLUG_OSX_IMPLEMENTATION \
+    -DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \
+))
+
 $(eval $(call gb_Library_use_sdk_api,vclplug_osx))
 
 $(eval $(call gb_Library_use_custom_headers,vclplug_osx,\
@@ -69,10 +74,6 @@ $(eval $(call gb_Library_add_cxxflags,vclplug_osx,\
     $(gb_OBJCXXFLAGS) \
 ))
 
-$(eval $(call gb_Library_add_defs,vclplug_osx,\
-    -DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \
-))
-
 $(eval $(call gb_Library_add_objcxxobjects,vclplug_osx,\
     vcl/osx/a11yactionwrapper \
     vcl/osx/a11ycomponentwrapper \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index b4a0f7aaf6ff..d01d0508145a 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_Library_set_include,vclplug_qt5,\
     -I$(SRCDIR)/vcl/inc \
     -I$(SRCDIR)/vcl/inc/qt5 \
 ))
+#	$(if $(filter MACOS,$(OS)), -F $(QT5_LIBS)) \
 
 $(eval $(call gb_Library_add_defs,vclplug_qt5,\
     -DVCLPLUG_QT5_IMPLEMENTATION \
@@ -67,6 +68,7 @@ $(eval $(call gb_Library_use_externals,vclplug_qt5,\
 $(eval $(call gb_Library_add_defs,vclplug_qt5,\
     $(QT5_CFLAGS) \
 ))
+
 $(eval $(call gb_Library_add_libs,vclplug_qt5,\
     $(QT5_LIBS) \
 ))
@@ -97,12 +99,10 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/Qt5Graphics_GDI \
     vcl/qt5/Qt5Graphics_Text \
     vcl/qt5/Qt5Instance \
-    vcl/qt5/Qt5Instance_Print \
     vcl/qt5/Qt5MainWindow \
     vcl/qt5/Qt5Menu \
     vcl/qt5/Qt5Object \
     vcl/qt5/Qt5Painter \
-    vcl/qt5/Qt5Printer \
     $(if $(USING_X11),vcl/qt5/Qt5System) \
     vcl/qt5/Qt5Timer \
     vcl/qt5/Qt5Tools \
@@ -111,6 +111,34 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/Qt5XAccessible \
 ))
 
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_Library_use_system_darwin_frameworks,vclplug_qt5,\
+    ApplicationServices \
+    Cocoa \
+    Carbon \
+    CoreFoundation \
+    $(if $(filter X86_64,$(CPUNAME)),,QuickTime) \
+))
+
+$(eval $(call gb_Library_add_cxxflags,vclplug_qt5,\
+    $(gb_OBJCXXFLAGS) \
+))
+
+$(eval $(call gb_Library_use_libraries,vclplug_qt5,\
+    vclplug_osx \
+))
+
+$(eval $(call gb_Library_add_objcxxobjects,vclplug_qt5,\
+    vcl/qt5/Qt5Instance_Print \
+    vcl/qt5/Qt5Printer \
+))
+else
+$(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
+    vcl/qt5/Qt5Instance_Print \
+    vcl/qt5/Qt5Printer \
+))
+endif
+
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_libs,vclplug_qt5,\
     -lm \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 8fbe1fdca943..c8520fbd4c6c 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -108,6 +108,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
     Package_osxres \
     Library_vclplug_osx \
 ))
+ifneq ($(ENABLE_QT5),)
+$(eval $(call gb_Module_add_targets,vcl,\
+    CustomTarget_qt5_moc \
+    Library_vclplug_qt5 \
+))
+endif
 endif
 
 ifeq ($(OS),WNT)
diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h
index 0c7ec1e9edfd..8fd210654eac 100644
--- a/vcl/inc/osx/salprn.h
+++ b/vcl/inc/osx/salprn.h
@@ -22,13 +22,14 @@
 
 #include <osx/osxvcltypes.h>
 
+#include <vclpluginapi.h>
 #include <salprn.hxx>
 
 #include <memory>
 
 class AquaSalGraphics;
 
-class AquaSalInfoPrinter : public SalInfoPrinter
+class VCLPLUG_OSX_PUBLIC AquaSalInfoPrinter : public SalInfoPrinter
 {
     /// Printer graphics
     AquaSalGraphics*        mpGraphics;
@@ -111,7 +112,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter
 };
 
 
-class AquaSalPrinter : public SalPrinter
+class VCLPLUG_OSX_PUBLIC AquaSalPrinter : public SalPrinter
 {
     AquaSalInfoPrinter*         mpInfoPrinter;          // pointer to the compatible InfoPrinter
     public:
diff --git a/vcl/inc/qt5/Qt5Data.hxx b/vcl/inc/qt5/Qt5Data.hxx
index b487f41e1e5a..bf01a0c57ac1 100644
--- a/vcl/inc/qt5/Qt5Data.hxx
+++ b/vcl/inc/qt5/Qt5Data.hxx
@@ -30,10 +30,10 @@ class GlyphCache;
 class QCursor;
 
 class VCLPLUG_QT5_PUBLIC Qt5Data
-#ifndef _WIN32
-    : public GenericUnixSalData
-#else
+#if (defined MACOSX || defined _WIN32)
     : public SalData
+#else
+    : public GenericUnixSalData
 #endif
 {
     o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors;
@@ -41,7 +41,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Data
 public:
     explicit Qt5Data(SalInstance* pInstance);
     virtual ~Qt5Data() override;
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     virtual void ErrorTrapPush() override;
     virtual bool ErrorTrapPop(bool bIgnoreError = true) override;
 #endif
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index d7b793827667..a3d2240a8a02 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -24,7 +24,7 @@
 
 #include "Qt5Tools.hxx"
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 #include <headless/svpgdi.hxx>
 #endif
 #include <vcl/svapp.hxx>
@@ -41,7 +41,7 @@ class QScreen;
 class QImage;
 class SvpSalGraphics;
 
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
 typedef void (*damageHandler)(void* handle,
                               sal_Int32 nExtentsX, sal_Int32 nExtentsY,
                               sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight);
@@ -65,7 +65,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
     const bool m_bUseCairo;
     std::unique_ptr<QImage> m_pQImage;
     std::unique_ptr<Qt5Graphics> m_pQt5Graphics;
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     UniqueCairoSurface m_pSurface;
     std::unique_ptr<SvpSalGraphics> m_pOurSvpGraphics;
     // in base class, this ptr is the same as m_pOurSvpGraphic
@@ -126,7 +126,7 @@ public:
     void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
                 sal_Int32 nExtentsHeight) const;
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     virtual void InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics);
 #endif
     virtual SalGraphics* AcquireGraphics() override;
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index c54158e5bc2c..e80760272053 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -31,7 +31,7 @@ class QApplication;
 class SalYieldMutex;
 class SalFrame;
 
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
 #include <salinst.hxx>
 #include <comphelper/solarmutex.hxx>
 #else
@@ -41,7 +41,7 @@ class SalFrame;
 // Qts moc doesn't like macros, so this is handled by an extra base class
 // It also keeps all the #ifdef handling local
 class VCLPLUG_QT5_PUBLIC Qt5MocInstance
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
     : public SalInstance
 #else
     : public SalGenericInstance
@@ -49,7 +49,7 @@ class VCLPLUG_QT5_PUBLIC Qt5MocInstance
 {
 public:
     Qt5MocInstance()
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
         : SalInstance(o3tl::make_unique<comphelper::SolarMutex>())
 #else
         : SalGenericInstance(o3tl::make_unique<SalYieldMutex>())
@@ -57,7 +57,7 @@ public:
     {
     }
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     virtual GenPspGraphics* CreatePrintGraphics() override;
     virtual void PostPrintersChanged() override;
 #endif
diff --git a/vcl/inc/qt5/Qt5Printer.hxx b/vcl/inc/qt5/Qt5Printer.hxx
index 4fcae075fe3c..84a46a9be8f7 100644
--- a/vcl/inc/qt5/Qt5Printer.hxx
+++ b/vcl/inc/qt5/Qt5Printer.hxx
@@ -19,21 +19,26 @@
 
 #pragma once
 
-#ifndef _WIN32
-#include <unx/genprn.h>
-#else
+#ifdef _WIN32
 #include <WinDef.h>
 #include <win/salprn.h>
+#else
+#ifdef MACOSX
+#include <osx/salprn.h>
+#else
+#include <unx/genprn.h>
+#endif
 #endif
-
-class Point;
-class SalFrame;
 
 class Qt5Printer
-#ifndef _WIN32
-    : public PspSalPrinter
-#else
+#ifdef _WIN32
     : public WinSalPrinter
+#else
+#ifdef MACOSX
+    : public AquaSalPrinter
+#else
+    : public PspSalPrinter
+#endif
 #endif
 {
 public:
diff --git a/vcl/inc/qt5/Qt5System.hxx b/vcl/inc/qt5/Qt5System.hxx
index 6bd732956137..ef514227ed94 100644
--- a/vcl/inc/qt5/Qt5System.hxx
+++ b/vcl/inc/qt5/Qt5System.hxx
@@ -11,21 +11,29 @@
 
 #include <vcl/sysdata.hxx>
 
-#ifndef _WIN32
-#include <unx/gensys.h>
-#else
+#ifdef _WIN32
 #include <win/salsys.h>
+#else
+#ifdef MACOSX
+#include <osx/salsys.h>
+#else
+#include <unx/gensys.h>
+#endif
 #endif
 
 class Qt5System
-#ifndef _WIN32
-    : public SalGenericSystem
-#else
+#ifdef _WIN32
     : public WinSalSystem
+#else
+#ifdef MACOSX
+    : public AquaSalSystem
+#else
+    : public SalGenericSystem
+#endif
 #endif
 {
 public:
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     virtual unsigned int GetDisplayScreenCount() override;
     virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override;
     virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage,
diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx
index 1e2166a34c72..0475d0dbaecc 100644
--- a/vcl/qt5/Qt5Data.cxx
+++ b/vcl/qt5/Qt5Data.cxx
@@ -149,18 +149,18 @@
 #include <unx/x11_cursors/wsshow_curs.h>
 #include <unx/x11_cursors/wsshow_mask.h>
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 #include <unx/glyphcache.hxx>
 #endif
 
 Qt5Data::Qt5Data(SalInstance* pInstance)
-#ifndef _WIN32
-    : GenericUnixSalData(SAL_DATA_QT5, pInstance)
-#else
+#if (defined MACOSX || defined _WIN32)
     : SalData()
+#else
+    : GenericUnixSalData(SAL_DATA_QT5, pInstance)
 #endif
 {
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
     m_pInstance = pInstance;
     SetSalData(this);
 #endif
@@ -318,7 +318,7 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle)
     return *m_aCursors[ePointerStyle];
 }
 
-#ifndef _WIN32
+#if !(defined _WIN32 || defined MACOSX)
 void Qt5Data::ErrorTrapPush() {}
 
 bool Qt5Data::ErrorTrapPop(bool /*bIgnoreError*/) { return false; }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 6fa97fedda92..51553e34fb3c 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -45,7 +45,7 @@
 #include <vcl/layout.hxx>
 #include <vcl/syswin.hxx>
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 #include <cairo.h>
 #include <headless/svpgdi.hxx>
 #endif
@@ -60,7 +60,7 @@ static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 nExten
 Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo )
     : m_pTopLevel(nullptr)
     , m_bUseCairo(bUseCairo)
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     , m_pSvpGraphics(nullptr)
 #endif
     , m_bNullRegion(true)
@@ -167,7 +167,7 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect)
     CallCallback(SalEvent::Paint, &aPaintEvt);
 }
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
 {
     int width = 640;
@@ -188,7 +188,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
 
     m_bGraphicsInUse = true;
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (m_bUseCairo)
     {
         if (!m_pOurSvpGraphics.get())
@@ -215,7 +215,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
 void Qt5Frame::ReleaseGraphics(SalGraphics* pSalGraph)
 {
     (void)pSalGraph;
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (m_bUseCairo)
         assert(pSalGraph == m_pOurSvpGraphics.get());
     else
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index e39c1b8c95a3..d4c718a3194b 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -23,7 +23,7 @@
 #include <Qt5Painter.hxx>
 
 #include <vcl/fontcharmap.hxx>
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 #include <unx/geninst.h>
 #include <unx/fontmanager.hxx>
 #endif
@@ -90,7 +90,7 @@ bool Qt5Graphics::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities)
 
 void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     static const bool bUseFontconfig = (nullptr == getenv("SAL_VCL_QT5_NO_FONTCONFIG"));
 #endif
 
@@ -100,7 +100,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
 
     QFontDatabase aFDB;
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (bUseFontconfig)
     {
         ::std::vector<psp::fontID> aList;
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index afa3e6ebb869..ffbbf103a7ae 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -99,7 +99,7 @@ std::unique_ptr<SalVirtualDevice>
 Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, DeviceFormat eFormat,
                                  const SystemGraphicsData* /* pData */)
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (m_bUseCairo)
     {
         SvpSalGraphics* pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics);
@@ -138,7 +138,7 @@ SalSystem* Qt5Instance::CreateSalSystem() { return new Qt5System; }
 
 std::shared_ptr<SalBitmap> Qt5Instance::CreateSalBitmap()
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (m_bUseCairo)
         return std::make_shared<SvpSalBitmap>();
     else
@@ -294,7 +294,7 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance()
     for (int i = 0; i < nFakeArgc; i++)
         pFakeArgv[i] = pFakeArgvFreeable[i];
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     char* session_manager = nullptr;
     if (getenv("SESSION_MANAGER") != nullptr)
     {
@@ -307,7 +307,7 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance()
     *pFakeArgc = nFakeArgc;
     pQApplication = new QApplication(*pFakeArgc, pFakeArgv);
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (session_manager != nullptr)
     {
         // coverity[tainted_string] - trusted source for setenv
diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx
index 5b7864ef6fe4..d396fc87e416 100644
--- a/vcl/qt5/Qt5Instance_Print.cxx
+++ b/vcl/qt5/Qt5Instance_Print.cxx
@@ -20,7 +20,7 @@
 #include <Qt5Instance.hxx>
 #include <Qt5Printer.hxx>
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 #include <vcl/svapp.hxx>
 #include <vcl/timer.hxx>
 
@@ -39,7 +39,7 @@ using namespace psp;
  *  static helpers
  */
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 static OUString getPdfDir(const PrinterInfo& rInfo)
 {
     OUString aDir;
@@ -63,7 +63,7 @@ static OUString getPdfDir(const PrinterInfo& rInfo)
 SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
                                                ImplJobSetup* pJobSetup)
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     // create and initialize SalInfoPrinter
     PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter;
     configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup);
@@ -79,7 +79,7 @@ void Qt5Instance::DestroyInfoPrinter(SalInfoPrinter* pPrinter) { delete pPrinter
 
 std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrinter)
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     // create and initialize SalPrinter
     Qt5Printer* pPrinter = new Qt5Printer(pInfoPrinter);
     pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
@@ -93,7 +93,7 @@ std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrin
 
 void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     PrinterInfoManager& rManager(PrinterInfoManager::get());
     static const char* pNoSyncDetection = getenv("SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION");
     if (!pNoSyncDetection || !*pNoSyncDetection)
@@ -138,7 +138,7 @@ void Qt5Instance::GetPrinterQueueState(SalPrinterQueueInfo*) {}
 
 OUString Qt5Instance::GetDefaultPrinter()
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     PrinterInfoManager& rManager(PrinterInfoManager::get());
     return rManager.getDefaultPrinter();
 #else
@@ -146,7 +146,7 @@ OUString Qt5Instance::GetDefaultPrinter()
 #endif
 }
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 void Qt5MocInstance::PostPrintersChanged() {}
 
 GenPspGraphics* Qt5MocInstance::CreatePrintGraphics() { return new GenPspGraphics(); }
diff --git a/vcl/qt5/Qt5Instance_Print.mm b/vcl/qt5/Qt5Instance_Print.mm
new file mode 100644
index 000000000000..b4004831fda8
--- /dev/null
+++ b/vcl/qt5/Qt5Instance_Print.mm
@@ -0,0 +1,20 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "Qt5Instance_Print.cxx"
diff --git a/vcl/qt5/Qt5Printer.cxx b/vcl/qt5/Qt5Printer.cxx
index 2f30b3b53720..9ea85124b5ec 100644
--- a/vcl/qt5/Qt5Printer.cxx
+++ b/vcl/qt5/Qt5Printer.cxx
@@ -23,11 +23,16 @@
 #include <tools/gen.hxx>
 #include <Qt5Printer.hxx>
 
+#if defined _WIN32
 Qt5Printer::Qt5Printer(SalInfoPrinter* /* pInfoPrinter */)
-#ifndef _WIN32
-    : PspSalPrinter(pInfoPrinter)
-#else
     : WinSalPrinter()
+#else
+Qt5Printer::Qt5Printer(SalInfoPrinter* pInfoPrinter)
+#ifdef MACOSX
+    : AquaSalPrinter(static_cast<AquaSalInfoPrinter*>(pInfoPrinter))
+#else
+    : PspSalPrinter(pInfoPrinter)
+#endif
 #endif
 {
 }
diff --git a/vcl/qt5/Qt5Printer.mm b/vcl/qt5/Qt5Printer.mm
new file mode 100644
index 000000000000..6f2eed046866
--- /dev/null
+++ b/vcl/qt5/Qt5Printer.mm
@@ -0,0 +1,20 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "Qt5Printer.cxx"
diff --git a/vcl/qt5/Qt5Tools.cxx b/vcl/qt5/Qt5Tools.cxx
index b12a03539bbb..e14c6099d927 100644
--- a/vcl/qt5/Qt5Tools.cxx
+++ b/vcl/qt5/Qt5Tools.cxx
@@ -21,7 +21,7 @@
 
 #include <vcl/event.hxx>
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 #include <cairo.h>
 
 void CairoDeleter::operator()(cairo_surface_t* pSurface) const { cairo_surface_destroy(pSurface); }
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 67207802a071..f1c449eb4ca9 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -35,7 +35,7 @@
 #include <QtWidgets/QtWidgets>
 #include <QtWidgets/QMainWindow>
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
 #include <cairo.h>
 #include <headless/svpgdi.hxx>
 #endif
@@ -46,7 +46,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent)
     if (!m_pFrame->m_bNullRegion)
         p.setClipRegion(m_pFrame->m_aRegion);
 
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (m_pFrame->m_bUseCairo)
     {
         cairo_surface_t* pSurface = m_pFrame->m_pSurface.get();
@@ -63,7 +63,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent)
 
 void Qt5Widget::resizeEvent(QResizeEvent* /*event*/)
 {
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
     if (m_pFrame->m_bUseCairo)
     {
         int width = size().width();
commit 8150a9b50e84bce717c3f7527fccf54a29319a18
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Sep 12 10:30:05 2018 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Oct 18 11:28:29 2018 +0200

    Qt5 build VCL plugin on Windows
    
    Change-Id: I1bb673eb2c228d767caca6a9a860bd9d113d082f

diff --git a/Repository.mk b/Repository.mk
index f7162e48e080..73ef91a888f8 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -474,6 +474,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 		ado \
 		oleautobridge \
 		smplmail \
+		$(if $(ENABLE_QT5),vclplug_qt5) \
 		vclplug_win \
 		wininetbe1 \
 	) \
diff --git a/config_host/config_vclplug.h.in b/config_host/config_vclplug.h.in
index be9c136245ee..c02853d5282d 100644
--- a/config_host/config_vclplug.h.in
+++ b/config_host/config_vclplug.h.in
@@ -11,5 +11,6 @@ Settings about which X11 desktops have support enabled.
 #define ENABLE_KDE4 0
 #define ENABLE_KDE5 0
 #define ENABLE_GTK3_KDE5 0
+#define ENABLE_QT5 0
 
 #endif
diff --git a/configure.ac b/configure.ac
index a20e0be6c688..3fd916fb4f8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,6 +635,7 @@ cygwin*|interix*)
     test_xrender=no
     test_freetype=no
     test_fontconfig=no
+    test_qt5=yes
     _os=WINNT
 
     DLLPOST=".dll"
@@ -4678,7 +4679,6 @@ if test "$USING_X11" != TRUE; then
     build_gstreamer_0_10=no
     test_kde4=no
     test_kde5=no
-    test_qt5=no
     test_gtk3_kde5=no
     enable_cairo_canvas=no
 fi
@@ -10029,10 +10029,16 @@ dnl ===================================================================
 dnl Test which vclplugs have to be built.
 dnl ===================================================================
 R=""
-if test "$USING_X11" != TRUE; then
+if test "$USING_X11" = TRUE; then
+    R="gen"
+else
     enable_gtk=no
     enable_gtk3=no
+    if test "$_os" = "WINNT"; then
+        R="win"
+    fi
 fi
+
 GTK3_CFLAGS=""
 GTK3_LIBS=""
 ENABLE_GTK3=""
@@ -10043,7 +10049,7 @@ if test "x$enable_gtk3" = "xyes"; then
     : ${with_system_cairo:=yes}
     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.18 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
     if test "x$ENABLE_GTK3" = "xTRUE"; then
-        R="gtk3"
+        R=" gtk3"
         dnl Avoid installed by unpackaged files for now.
         if test -z "$PKGFORMAT"; then
             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
@@ -11178,7 +11184,11 @@ then
     fi
 
     qt5_test_include="QtWidgets/qapplication.h"
-    qt5_test_library="libQt5Widgets.so"
+    if test $_os == "WINNT"; then
+        qt5_test_library="Qt5Widgets.lib"
+    else
+        qt5_test_library="libQt5Widgets.so"
+    fi
 
     dnl Check for qmake5
     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
@@ -11200,6 +11210,10 @@ then
 
     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
+    if test $_os == "WINNT"; then
+        qt5_incdirs="`cygpath -m $qt5_incdirs`"
+        qt5_libdirs="`cygpath -m $qt5_libdirs`"
+    fi
 
     AC_MSG_CHECKING([for Qt5 headers])
     qt5_incdir="no"
@@ -11229,7 +11243,11 @@ then
 
     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
-    QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+    if test $_os == "WINNT"; then
+        QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib"
+    else
+        QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+    fi
 
     dnl Check for Meta Object Compiler
 
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index a57fd53ddf24..b4a0f7aaf6ff 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_Library_use_sdk_api,vclplug_qt5))
 
 $(eval $(call gb_Library_use_libraries,vclplug_qt5,\
     $(if $(USING_X11),vclplug_gen) \
+    $(if $(filter WNT,$(OS)),vclplug_win) \
     vcl \
     tl \
     utl \
@@ -54,7 +55,7 @@ $(eval $(call gb_Library_use_libraries,vclplug_qt5,\
 
 $(eval $(call gb_Library_use_externals,vclplug_qt5,\
     boost_headers \
-    cairo \
+    $(if $(USING_X11),cairo) \
     epoxy \
     graphite \
     harfbuzz \
@@ -102,7 +103,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/Qt5Object \
     vcl/qt5/Qt5Painter \
     vcl/qt5/Qt5Printer \
-    vcl/qt5/Qt5System \
+    $(if $(USING_X11),vcl/qt5/Qt5System) \
     vcl/qt5/Qt5Timer \
     vcl/qt5/Qt5Tools \
     vcl/qt5/Qt5VirtualDevice \
@@ -112,9 +113,9 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
 
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_libs,vclplug_qt5,\
-	-lm \
-	-ldl \
-	-lpthread \
+    -lm \
+    -ldl \
+    -lpthread \
 ))
 endif
 
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index df3bf6e26412..8fbe1fdca943 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -115,6 +115,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
     WinResTarget_vcl \
     Library_vclplug_win \
 ))
+ifneq ($(ENABLE_QT5),)
+$(eval $(call gb_Module_add_targets,vcl,\
+    CustomTarget_qt5_moc \
+    Library_vclplug_qt5 \
+))
+endif
 endif
 
 ifeq ($(OS),HAIKU)
diff --git a/vcl/inc/qt5/Qt5Bitmap.hxx b/vcl/inc/qt5/Qt5Bitmap.hxx
index ba2ea5a2f58a..3f1421a820a5 100644
--- a/vcl/inc/qt5/Qt5Bitmap.hxx
+++ b/vcl/inc/qt5/Qt5Bitmap.hxx
@@ -19,13 +19,14 @@
 
 #pragma once
 
+#include <vclpluginapi.h>
 #include <salbmp.hxx>
 
 #include <memory>
 
 class QImage;
 
-class VCL_DLLPUBLIC Qt5Bitmap : public SalBitmap
+class VCLPLUG_QT5_PUBLIC Qt5Bitmap : public SalBitmap
 {
     std::unique_ptr<QImage> m_pImage;
     BitmapPalette m_aPalette;
diff --git a/vcl/inc/qt5/Qt5Data.hxx b/vcl/inc/qt5/Qt5Data.hxx
index 6f64925cb2f5..b487f41e1e5a 100644
--- a/vcl/inc/qt5/Qt5Data.hxx
+++ b/vcl/inc/qt5/Qt5Data.hxx
@@ -29,17 +29,22 @@
 class GlyphCache;
 class QCursor;
 
-class VCLPLUG_QT5_PUBLIC Qt5Data : public GenericUnixSalData
+class VCLPLUG_QT5_PUBLIC Qt5Data
+#ifndef _WIN32
+    : public GenericUnixSalData
+#else
+    : public SalData
+#endif
 {
     o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors;
 
 public:
     explicit Qt5Data(SalInstance* pInstance);
     virtual ~Qt5Data() override;
-
+#ifndef _WIN32
     virtual void ErrorTrapPush() override;
     virtual bool ErrorTrapPop(bool bIgnoreError = true) override;
-
+#endif
     QCursor& getCursor(PointerStyle ePointerStyle);
 
     static bool noNativeControls();
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 577a9cce2fde..d7b793827667 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -24,7 +24,9 @@
 
 #include "Qt5Tools.hxx"
 
+#ifndef _WIN32
 #include <headless/svpgdi.hxx>
+#endif
 #include <vcl/svapp.hxx>
 
 #include <QtCore/QObject>
@@ -39,6 +41,18 @@ class QScreen;
 class QImage;
 class SvpSalGraphics;
 
+#ifdef _WIN32
+typedef void (*damageHandler)(void* handle,
+                              sal_Int32 nExtentsX, sal_Int32 nExtentsY,
+                              sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight);
+
+struct VCL_DLLPUBLIC DamageHandler
+{
+    void *handle;
+    damageHandler damaged;
+};
+#endif
+
 class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
 {
     Q_OBJECT
@@ -51,12 +65,14 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
     const bool m_bUseCairo;
     std::unique_ptr<QImage> m_pQImage;
     std::unique_ptr<Qt5Graphics> m_pQt5Graphics;
+#ifndef _WIN32
     UniqueCairoSurface m_pSurface;
     std::unique_ptr<SvpSalGraphics> m_pOurSvpGraphics;
     // in base class, this ptr is the same as m_pOurSvpGraphic
     // in derived class, it can point to a derivative
     // of SvpSalGraphics (which the derived class then owns)
     SvpSalGraphics* m_pSvpGraphics;
+#endif
     DamageHandler m_aDamageHandler;
     QRegion m_aRegion;
     bool m_bNullRegion;
@@ -110,7 +126,9 @@ public:
     void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
                 sal_Int32 nExtentsHeight) const;
 
+#ifndef _WIN32
     virtual void InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics);
+#endif
     virtual SalGraphics* AcquireGraphics() override;
     virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
 
diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx
index 76c39146728c..dd909f0372fd 100644
--- a/vcl/inc/qt5/Qt5Graphics.hxx
+++ b/vcl/inc/qt5/Qt5Graphics.hxx
@@ -30,6 +30,10 @@
 #include "Qt5Data.hxx"
 #include "Qt5Graphics_Controls.hxx"
 
+#ifdef _WIN32
+#include <QtWidgets/QPushButton>
+#endif
+
 class PhysicalFontCollection;
 class QImage;
 class QPushButton;
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 58ab6e329544..c54158e5bc2c 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -20,10 +20,10 @@
 #pragma once
 
 #include <vclpluginapi.h>
-#include <unx/geninst.h>
 #include <salusereventlist.hxx>
 
 #include <osl/conditn.hxx>
+#include <o3tl/make_unique.hxx>
 
 #include <QtCore/QObject>
 
@@ -31,8 +31,40 @@ class QApplication;
 class SalYieldMutex;
 class SalFrame;
 
+#ifdef _WIN32
+#include <salinst.hxx>
+#include <comphelper/solarmutex.hxx>
+#else
+#include <unx/geninst.h>
+#endif
+
+// Qts moc doesn't like macros, so this is handled by an extra base class
+// It also keeps all the #ifdef handling local
+class VCLPLUG_QT5_PUBLIC Qt5MocInstance
+#ifdef _WIN32
+    : public SalInstance
+#else
+    : public SalGenericInstance
+#endif
+{
+public:
+    Qt5MocInstance()
+#ifdef _WIN32
+        : SalInstance(o3tl::make_unique<comphelper::SolarMutex>())
+#else
+        : SalGenericInstance(o3tl::make_unique<SalYieldMutex>())
+#endif
+    {
+    }
+
+#ifndef _WIN32
+    virtual GenPspGraphics* CreatePrintGraphics() override;
+    virtual void PostPrintersChanged() override;
+#endif
+};
+
 class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject,
-                                       public SalGenericInstance,
+                                       public Qt5MocInstance,
                                        public SalUserEventList
 {
     Q_OBJECT
@@ -78,7 +110,6 @@ public:
     virtual void GetPrinterQueueState(SalPrinterQueueInfo* pInfo) override;
     virtual void DeletePrinterQueueInfo(SalPrinterQueueInfo* pInfo) override;
     virtual OUString GetDefaultPrinter() override;
-    virtual void PostPrintersChanged() override;
 
     virtual std::unique_ptr<SalMenu> CreateMenu(bool, Menu*) override;
     virtual std::unique_ptr<SalMenuItem> CreateMenuItem(const SalItemParams&) override;
@@ -97,8 +128,6 @@ public:
     virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType,
                                          const OUString& rDocumentService) override;
 
-    virtual GenPspGraphics* CreatePrintGraphics() override;
-
     virtual bool IsMainThread() const override;
 
     virtual void TriggerUserEventProcessing() override;
diff --git a/vcl/inc/qt5/Qt5Printer.hxx b/vcl/inc/qt5/Qt5Printer.hxx
index 81a38206e4f1..4fcae075fe3c 100644
--- a/vcl/inc/qt5/Qt5Printer.hxx
+++ b/vcl/inc/qt5/Qt5Printer.hxx
@@ -19,11 +19,22 @@
 
 #pragma once
 
+#ifndef _WIN32
 #include <unx/genprn.h>
+#else
+#include <WinDef.h>
+#include <win/salprn.h>
+#endif
 
+class Point;
 class SalFrame;
 
-class Qt5Printer : public PspSalPrinter
+class Qt5Printer
+#ifndef _WIN32
+    : public PspSalPrinter
+#else
+    : public WinSalPrinter
+#endif
 {
 public:
     Qt5Printer(SalInfoPrinter* pInfoPrinter);
diff --git a/vcl/inc/qt5/Qt5System.hxx b/vcl/inc/qt5/Qt5System.hxx
index 0d51bb29f358..6bd732956137 100644
--- a/vcl/inc/qt5/Qt5System.hxx
+++ b/vcl/inc/qt5/Qt5System.hxx
@@ -10,15 +10,27 @@
 #pragma once
 
 #include <vcl/sysdata.hxx>
+
+#ifndef _WIN32
 #include <unx/gensys.h>
+#else
+#include <win/salsys.h>
+#endif
 
-class Qt5System : public SalGenericSystem
+class Qt5System
+#ifndef _WIN32
+    : public SalGenericSystem
+#else
+    : public WinSalSystem
+#endif
 {
 public:
+#ifndef _WIN32
     virtual unsigned int GetDisplayScreenCount() override;
     virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override;
     virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage,
                                  const std::vector<OUString>& rButtons) override;
+#endif
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index c919b401e191..967cac0507de 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -82,7 +82,9 @@ inline QImage::Format getBitFormat(sal_uInt16 nBitCount)
             std::abort();
             break;
     }
+#ifndef _WIN32
     return QImage::Format_Invalid;
+#endif
 }
 
 inline sal_uInt16 getFormatBits(QImage::Format eFormat)
@@ -102,10 +104,13 @@ inline sal_uInt16 getFormatBits(QImage::Format eFormat)
             return 32;
         default:
             std::abort();
+#ifndef _WIN32
             return 0;
+#endif
     }
 }
 
+#ifndef _WIN32
 typedef struct _cairo_surface cairo_surface_t;
 struct CairoDeleter
 {
@@ -113,6 +118,7 @@ struct CairoDeleter
 };
 
 typedef std::unique_ptr<cairo_surface_t, CairoDeleter> UniqueCairoSurface;
+#endif
 
 sal_uInt16 GetKeyModCode(Qt::KeyboardModifiers eKeyModifiers);
 sal_uInt16 GetMouseModCode(Qt::MouseButtons eButtons);
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index c0c6e7fb7932..ef8737acc1f4 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -70,7 +70,7 @@ public:
 };
 
 
-class WinSalPrinter : public SalPrinter
+class SAL_DLLPUBLIC_EXPORT WinSalPrinter : public SalPrinter
 {
 public:
     WinSalGraphics*         mpGraphics;             // current Printer graphics
diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h
index 03f627b5abb2..59f087136b79 100644
--- a/vcl/inc/win/salsys.h
+++ b/vcl/inc/win/salsys.h
@@ -25,7 +25,7 @@
 #include <vector>
 #include <map>
 
-class WinSalSystem : public SalSystem
+class SAL_DLLPUBLIC_EXPORT WinSalSystem : public SalSystem
 {
 public:
     struct DisplayMonitor
diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx
index 1830dab0e523..1e2166a34c72 100644
--- a/vcl/qt5/Qt5Data.cxx
+++ b/vcl/qt5/Qt5Data.cxx
@@ -149,11 +149,21 @@
 #include <unx/x11_cursors/wsshow_curs.h>
 #include <unx/x11_cursors/wsshow_mask.h>
 
+#ifndef _WIN32
 #include <unx/glyphcache.hxx>
+#endif
 
 Qt5Data::Qt5Data(SalInstance* pInstance)
+#ifndef _WIN32
     : GenericUnixSalData(SAL_DATA_QT5, pInstance)
+#else
+    : SalData()
+#endif
 {
+#ifdef _WIN32
+    m_pInstance = pInstance;
+    SetSalData(this);
+#endif
     ImplSVData* pSVData = ImplGetSVData();
 
     // draw toolbars on separate lines
@@ -308,9 +318,11 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle)
     return *m_aCursors[ePointerStyle];
 }
 
+#ifndef _WIN32
 void Qt5Data::ErrorTrapPush() {}
 
 bool Qt5Data::ErrorTrapPop(bool /*bIgnoreError*/) { return false; }
+#endif
 
 bool Qt5Data::noNativeControls()
 {
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index b42ec5e08a0c..6fa97fedda92 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -45,8 +45,10 @@
 #include <vcl/layout.hxx>
 #include <vcl/syswin.hxx>
 
+#ifndef _WIN32
 #include <cairo.h>
 #include <headless/svpgdi.hxx>
+#endif
 
 static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 nExtentsY,
                              sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight)
@@ -55,10 +57,12 @@ static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 nExten
     pThis->Damage(nExtentsX, nExtentsY, nExtentsWidth, nExtentsHeight);
 }
 
-Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
+Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo )
     : m_pTopLevel(nullptr)
     , m_bUseCairo(bUseCairo)
+#ifndef _WIN32
     , m_pSvpGraphics(nullptr)
+#endif
     , m_bNullRegion(true)
     , m_bGraphicsInUse(false)
     , m_ePointerStyle(PointerStyle::Arrow)
@@ -163,6 +167,7 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect)
     CallCallback(SalEvent::Paint, &aPaintEvt);
 }
 
+#ifndef _WIN32
 void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
 {
     int width = 640;
@@ -174,6 +179,7 @@ void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
                                 nullptr);
     TriggerPaintEvent();
 }
+#endif
 
 SalGraphics* Qt5Frame::AcquireGraphics()
 {
@@ -182,6 +188,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
 
     m_bGraphicsInUse = true;
 
+#ifndef _WIN32
     if (m_bUseCairo)
     {
         if (!m_pOurSvpGraphics.get())
@@ -192,6 +199,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
         return m_pOurSvpGraphics.get();
     }
     else
+#endif
     {
         if (!m_pQt5Graphics.get())
         {
@@ -207,9 +215,11 @@ SalGraphics* Qt5Frame::AcquireGraphics()
 void Qt5Frame::ReleaseGraphics(SalGraphics* pSalGraph)
 {
     (void)pSalGraph;
+#ifndef _WIN32
     if (m_bUseCairo)
         assert(pSalGraph == m_pOurSvpGraphics.get());
     else
+#endif
         assert(pSalGraph == m_pQt5Graphics.get());
     m_bGraphicsInUse = false;
 }
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index fbf7ae05bf6b..05c514a0a927 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -28,6 +28,8 @@
 #include <QtWidgets/QPushButton>
 #include <QtWidgets/QWidget>
 
+#include <vcl/sysdata.hxx>
+
 Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage )
     : m_pFrame( pFrame )
     , m_pQImage( pQImage )
diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index d98cdafe0137..1818fb041055 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -595,9 +595,7 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part,
     }
     else if (type == ControlType::Progress && part == ControlPart::Entire)
     {
-        SAL_WNODEPRECATED_DECLARATIONS_PUSH
-        QStyleOptionProgressBarV2 option;
-        SAL_WNODEPRECATED_DECLARATIONS_POP
+        QStyleOptionProgressBar option;
         option.minimum = 0;
         option.maximum = widgetRect.width();
         option.progress = value.getNumericVal();
@@ -801,6 +799,7 @@ bool Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart
                     retVal = true;
                     break;
                 default:
+                    h = 0; w = 0;
                     break;
             }
             if (retVal)
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 94aa069db0c1..e39c1b8c95a3 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -23,8 +23,10 @@
 #include <Qt5Painter.hxx>
 
 #include <vcl/fontcharmap.hxx>
+#ifndef _WIN32
 #include <unx/geninst.h>
 #include <unx/fontmanager.hxx>
+#endif
 
 #include <sallayout.hxx>
 #include <PhysicalFontCollection.hxx>
@@ -88,7 +90,9 @@ bool Qt5Graphics::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities)
 
 void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
 {
+#ifndef _WIN32
     static const bool bUseFontconfig = (nullptr == getenv("SAL_VCL_QT5_NO_FONTCONFIG"));
+#endif
 
     m_pFontCollection = pPFC;
     if (pPFC->Count())
@@ -96,6 +100,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
 
     QFontDatabase aFDB;
 
+#ifndef _WIN32
     if (bUseFontconfig)
     {
         ::std::vector<psp::fontID> aList;
@@ -114,6 +119,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
 
         SalGenericInstance::RegisterFontSubstitutors(pPFC);
     }
+#endif
 
     for (auto& family : aFDB.families())
         for (auto& style : aFDB.styles(family))
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 71e9883416f1..afa3e6ebb869 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -47,7 +47,7 @@
 #include <headless/svpbmp.hxx>
 
 Qt5Instance::Qt5Instance(bool bUseCairo)
-    : SalGenericInstance(o3tl::make_unique<SalYieldMutex>())
+    : Qt5MocInstance()
     , m_postUserEventId(-1)
     , m_bUseCairo(bUseCairo)
 {
@@ -99,6 +99,7 @@ std::unique_ptr<SalVirtualDevice>
 Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, DeviceFormat eFormat,
                                  const SystemGraphicsData* /* pData */)
 {
+#ifndef _WIN32
     if (m_bUseCairo)
     {
         SvpSalGraphics* pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics);
@@ -109,6 +110,9 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, D
         return pVD;
     }
     else
+#else
+    (void)pGraphics;
+#endif
     {
         std::unique_ptr<SalVirtualDevice> pVD(new Qt5VirtualDevice(eFormat, 1));
         pVD->SetSize(nDX, nDY);
@@ -134,9 +138,11 @@ SalSystem* Qt5Instance::CreateSalSystem() { return new Qt5System; }
 
 std::shared_ptr<SalBitmap> Qt5Instance::CreateSalBitmap()
 {
+#ifndef _WIN32
     if (m_bUseCairo)
         return std::make_shared<SvpSalBitmap>();
     else
+#endif
         return std::make_shared<Qt5Bitmap>();
 }
 
@@ -288,23 +294,27 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance()
     for (int i = 0; i < nFakeArgc; i++)
         pFakeArgv[i] = pFakeArgvFreeable[i];
 
+#ifndef _WIN32
     char* session_manager = nullptr;
     if (getenv("SESSION_MANAGER") != nullptr)
     {
         session_manager = strdup(getenv("SESSION_MANAGER"));
         unsetenv("SESSION_MANAGER");
     }
+#endif
 
     int* pFakeArgc = new int;
     *pFakeArgc = nFakeArgc;
     pQApplication = new QApplication(*pFakeArgc, pFakeArgv);
 
+#ifndef _WIN32
     if (session_manager != nullptr)
     {
         // coverity[tainted_string] - trusted source for setenv
         setenv("SESSION_MANAGER", session_manager, 1);
         free(session_manager);
     }
+#endif
 
     QApplication::setQuitOnLastWindowClosed(false);
 
diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx
index 501db07e7362..5b7864ef6fe4 100644
--- a/vcl/qt5/Qt5Instance_Print.cxx
+++ b/vcl/qt5/Qt5Instance_Print.cxx
@@ -20,23 +20,26 @@
 #include <Qt5Instance.hxx>
 #include <Qt5Printer.hxx>
 
+#ifndef _WIN32
 #include <vcl/svapp.hxx>
 #include <vcl/timer.hxx>
-#include <printerinfomanager.hxx>
 
 #include <jobset.h>
 #include <print.h>
-#include <salptype.hxx>
 #include <saldatabasic.hxx>
 
+#include <salptype.hxx>
+#include <printerinfomanager.hxx>
 #include <unx/genpspgraphics.h>
 
 using namespace psp;
+#endif
 
 /*
  *  static helpers
  */
 
+#ifndef _WIN32
 static OUString getPdfDir(const PrinterInfo& rInfo)
 {
     OUString aDir;
@@ -55,30 +58,42 @@ static OUString getPdfDir(const PrinterInfo& rInfo)
     }
     return aDir;
 }
+#endif
 
 SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
                                                ImplJobSetup* pJobSetup)
 {
+#ifndef _WIN32
     // create and initialize SalInfoPrinter
     PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter;
     configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup);
 
     return pPrinter;
+#else
+    (void)pQueueInfo; (void)pJobSetup;
+    return nullptr;
+#endif
 }
 
 void Qt5Instance::DestroyInfoPrinter(SalInfoPrinter* pPrinter) { delete pPrinter; }
 
 std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrinter)
 {
+#ifndef _WIN32
     // create and initialize SalPrinter
     Qt5Printer* pPrinter = new Qt5Printer(pInfoPrinter);
     pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
 
     return std::unique_ptr<SalPrinter>(pPrinter);
+#else
+    (void)pInfoPrinter;
+    return std::unique_ptr<SalPrinter>();
+#endif
 }
 
 void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
 {
+#ifndef _WIN32
     PrinterInfoManager& rManager(PrinterInfoManager::get());
     static const char* pNoSyncDetection = getenv("SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION");
     if (!pNoSyncDetection || !*pNoSyncDetection)
@@ -112,6 +127,9 @@ void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
 
         pList->Add(pInfo);
     }
+#else
+    (void)pList;
+#endif
 }
 
 void Qt5Instance::DeletePrinterQueueInfo(SalPrinterQueueInfo* pInfo) { delete pInfo; }
@@ -120,12 +138,18 @@ void Qt5Instance::GetPrinterQueueState(SalPrinterQueueInfo*) {}
 
 OUString Qt5Instance::GetDefaultPrinter()
 {
+#ifndef _WIN32
     PrinterInfoManager& rManager(PrinterInfoManager::get());
     return rManager.getDefaultPrinter();
+#else
+    return OUString();
+#endif
 }
 
-void Qt5Instance::PostPrintersChanged() {}
+#ifndef _WIN32
+void Qt5MocInstance::PostPrintersChanged() {}
 
-GenPspGraphics* Qt5Instance::CreatePrintGraphics() { return new GenPspGraphics(); }
+GenPspGraphics* Qt5MocInstance::CreatePrintGraphics() { return new GenPspGraphics(); }
+#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Painter.cxx b/vcl/qt5/Qt5Painter.cxx
index 06eeb2895214..efaf04e9b570 100644
--- a/vcl/qt5/Qt5Painter.cxx
+++ b/vcl/qt5/Qt5Painter.cxx
@@ -20,6 +20,7 @@
 #include <Qt5Painter.hxx>
 
 #include <QtGui/QColor>
+#include <QtWidgets/QPushButton>
 
 Qt5Painter::Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush, sal_uInt8 nTransparency)
     : m_rGraphics(rGraphics)
diff --git a/vcl/qt5/Qt5Printer.cxx b/vcl/qt5/Qt5Printer.cxx
index 16a6a1115073..2f30b3b53720 100644
--- a/vcl/qt5/Qt5Printer.cxx
+++ b/vcl/qt5/Qt5Printer.cxx
@@ -17,10 +17,18 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <svsys.h>
+#include <salptype.hxx>
+
+#include <tools/gen.hxx>
 #include <Qt5Printer.hxx>
 
-Qt5Printer::Qt5Printer(SalInfoPrinter* pInfoPrinter)
+Qt5Printer::Qt5Printer(SalInfoPrinter* /* pInfoPrinter */)
+#ifndef _WIN32
     : PspSalPrinter(pInfoPrinter)
+#else
+    : WinSalPrinter()
+#endif
 {
 }
 
diff --git a/vcl/qt5/Qt5Tools.cxx b/vcl/qt5/Qt5Tools.cxx
index 54ac3f99e26f..b12a03539bbb 100644
--- a/vcl/qt5/Qt5Tools.cxx
+++ b/vcl/qt5/Qt5Tools.cxx
@@ -19,11 +19,13 @@
 
 #include <Qt5Tools.hxx>
 
-#include <cairo.h>
-
 #include <vcl/event.hxx>
 
+#ifndef _WIN32
+#include <cairo.h>
+
 void CairoDeleter::operator()(cairo_surface_t* pSurface) const { cairo_surface_destroy(pSurface); }
+#endif
 
 sal_uInt16 GetKeyModCode(Qt::KeyboardModifiers eKeyModifiers)
 {
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 00ab29744a67..67207802a071 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -35,8 +35,10 @@
 #include <QtWidgets/QtWidgets>
 #include <QtWidgets/QMainWindow>
 
+#ifndef _WIN32
 #include <cairo.h>
 #include <headless/svpgdi.hxx>
+#endif
 
 void Qt5Widget::paintEvent(QPaintEvent* pEvent)
 {
@@ -44,6 +46,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent)
     if (!m_pFrame->m_bNullRegion)
         p.setClipRegion(m_pFrame->m_aRegion);
 
+#ifndef _WIN32
     if (m_pFrame->m_bUseCairo)
     {
         cairo_surface_t* pSurface = m_pFrame->m_pSurface.get();
@@ -54,11 +57,13 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent)
         p.drawImage(pEvent->rect().topLeft(), aImage, pEvent->rect());
     }
     else
+#endif
         p.drawImage(pEvent->rect().topLeft(), *m_pFrame->m_pQImage, pEvent->rect());
 }
 
 void Qt5Widget::resizeEvent(QResizeEvent* /*event*/)
 {
+#ifndef _WIN32
     if (m_pFrame->m_bUseCairo)
     {
         int width = size().width();
@@ -75,6 +80,7 @@ void Qt5Widget::resizeEvent(QResizeEvent* /*event*/)
         }
     }
     else
+#endif
     {
         QImage* pImage = new QImage(size(), Qt5_DefaultFormat32);
         m_pFrame->m_pQt5Graphics->ChangeQImage(pImage);
@@ -236,9 +242,11 @@ static sal_uInt16 GetKeyCode(int keyval)
             case Qt::Key_Insert:
                 nCode = KEY_INSERT;
                 break;
+#ifndef _WIN32
             case Qt::Key_Delete:
                 nCode = KEY_DELETE;
                 break;
+#endif
             case Qt::Key_Plus:
                 nCode = KEY_ADD;
                 break;
commit 3ffdf76d43bcfc249216e1602a016f36cb377226
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 18 09:47:09 2018 +0100
Commit:     Gerrit Code Review <gerrit at gerrit.libreoffice.org>
CommitDate: Thu Oct 18 10:47:28 2018 +0200

    Update git submodules
    
    * Update helpcontent2 from branch 'master'
      - update help ids
    
        Change-Id: I475516915714d6d05e3ccb65b2309241da9ff4ea

diff --git a/helpcontent2 b/helpcontent2
index f41adf3e2e94..709fb4d48be9 160000
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit f41adf3e2e942af9ec6c0687cf3490f6b7e5f6fc
+Subproject commit 709fb4d48be9df6aff0edb5d840b21e18e9291e6
commit dfd5385d97d4c359185450f5d0acc5aac4a7527b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Oct 18 08:08:12 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 18 10:46:58 2018 +0200

    loplugin:staticvar in sc
    
    Change-Id: I9f1d66e9af454a27a341e56bbe50a558898b65a1
    Reviewed-on: https://gerrit.libreoffice.org/61900
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index aac73cf8238a..37bbdc35ff50 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -90,10 +90,10 @@ struct TestParam
         bool const bOptimal;
     };
     const char* sTestDoc;
-    int const nImportType;
-    int const nExportType; // -1 for import test, otherwise this is an export test
-    int const nRowData;
-    RowData* const pData;
+    int nImportType;
+    int nExportType; // -1 for import test, otherwise this is an export test
+    int nRowData;
+    RowData const * pData;
 };
 
 struct FileFormat {
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx
index 114f2571f610..88548cca3699 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -43,7 +43,7 @@ struct DataBarData
     databar::ScAxisPosition eAxisPosition;
 };
 
-DataBarData aData[] = {
+DataBarData const aData[] = {
     { ScRange(1,2,0,1,5,0), COLORSCALE_AUTO, COLORSCALE_AUTO, databar::AUTOMATIC },
     { ScRange(3,2,0,3,5,0), COLORSCALE_MIN, COLORSCALE_MAX, databar::AUTOMATIC },
     { ScRange(5,2,0,5,5,0), COLORSCALE_PERCENTILE, COLORSCALE_PERCENT, databar::AUTOMATIC },
@@ -82,7 +82,7 @@ struct ColorScale2EntryData
     ScColorScaleEntryType eUpperType;
 };
 
-ColorScale2EntryData aData2Entry[] = {
+ColorScale2EntryData const aData2Entry[] = {
     { ScRange(1,2,0,1,5,0), COLORSCALE_MIN, COLORSCALE_MAX },
     { ScRange(3,2,0,3,5,0), COLORSCALE_PERCENTILE, COLORSCALE_PERCENT },
     { ScRange(5,2,0,5,5,0), COLORSCALE_VALUE, COLORSCALE_FORMULA }
@@ -121,7 +121,7 @@ struct ColorScale3EntryData
     ScColorScaleEntryType eUpperType;
 };
 
-ColorScale3EntryData aData3Entry[] = {
+ColorScale3EntryData const aData3Entry[] = {
     { ScRange(1,1,1,1,6,1), COLORSCALE_MIN, COLORSCALE_PERCENTILE, COLORSCALE_MAX },
     { ScRange(3,1,1,3,6,1), COLORSCALE_PERCENTILE, COLORSCALE_VALUE, COLORSCALE_PERCENT },
     { ScRange(5,1,1,5,6,1), COLORSCALE_VALUE, COLORSCALE_VALUE, COLORSCALE_FORMULA }
@@ -159,11 +159,11 @@ void testFunctionsExcel2010_Impl( ScDocument& rDoc )
 {
     // Original test case document is functions-excel-2010.xlsx
     // Which test rows to evaluate, 1-based as in UI to ease maintenance.
-    struct
+    static struct
     {
         SCROW nRow;
         bool  bEvaluate;
-    } aTests[] = {
+    } const aTests[] = {
         {  2, false },  // name=[ AGGREGATE ], result=0, expected=1
         {  3, true  },
         {  4, true  },
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx
index 609ee98e0a63..ceb43d6ce664 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -153,7 +153,7 @@ void ScPivotTableFiltersTest::tearDown()
 
 void ScPivotTableFiltersTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
 {
-    struct
+    static const struct
     {
         xmlChar* pPrefix;
         xmlChar* pURI;
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index ef0b5c96eec2..2472b3f9d55f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -341,7 +341,7 @@ private:
 
 void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
 {
-    struct { xmlChar* pPrefix; xmlChar* pURI; } aNamespaces[] =
+    static const struct { xmlChar* pPrefix; xmlChar* pURI; } aNamespaces[] =
     {
         { BAD_CAST("w"), BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main") },
         { BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main") },
@@ -1192,7 +1192,7 @@ void ScExportTest::testDataBarExportXLSX()
 
 void ScExportTest::testMiscRowHeightExport()
 {
-    TestParam::RowData DfltRowData[] =
+    static const TestParam::RowData DfltRowData[] =
     {
         { 0, 4, 0, 529, 0, false },
         { 5, 10, 0, 1058, 0, false },
@@ -1202,7 +1202,7 @@ void ScExportTest::testMiscRowHeightExport()
         { 1048573, 1048575, 0, 529, 0, false },
     };
 
-    TestParam::RowData EmptyRepeatRowData[] =
+    static const TestParam::RowData EmptyRepeatRowData[] =
     {
         // rows 0-4, 5-10, 17-20 are all set at various
         // heights, there is no content in the rows, there
@@ -2308,7 +2308,7 @@ const char* toBorderName( SvxBorderLineStyle eStyle )
 
 void ScExportTest::testExcelCellBorders( sal_uLong nFormatType )
 {
-    struct
+    static const struct
     {
         SCROW mnRow;
         SvxBorderLineStyle mnStyle;
@@ -2521,7 +2521,7 @@ void ScExportTest::testTrackChangesSimpleXLSX()
 
         bool check( const ScDocument& rDoc )
         {
-            CheckItem aChecks[] =
+            static const CheckItem aChecks[] =
             {
                 {  1, SC_CAT_CONTENT     , 1, 1, 0, 1, 1, 0, false },
                 {  2, SC_CAT_INSERT_ROWS , 0, 2, 0, 0, 2, 0, true },
@@ -2732,7 +2732,7 @@ void ScExportTest::testSheetTabColorsXLSX()
                 }
             }
 
-            const Color aXclColors[] =
+            static const Color aXclColors[] =
             {
                 0x0000B050, // green
                 0x00FF0000, // red
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index d10794a197d7..eca265feeb9d 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2763,7 +2763,7 @@ void ScFiltersTest::testFormulaDependency()
 
 void ScFiltersTest::testMiscRowHeights()
 {
-    TestParam::RowData DfltRowData[] =
+    static const TestParam::RowData DfltRowData[] =
     {
         // check rows at the beginning and end of document
         // and make sure they are reported as the default row
@@ -2772,7 +2772,7 @@ void ScFiltersTest::testMiscRowHeights()
         { 1048573, 1048575, 0, -1, 0, false  },
     };
 
-    TestParam::RowData MultiLineOptData[] =
+    static const TestParam::RowData MultiLineOptData[] =
     {
         // Row 0 is 12.63 mm, but optimal flag is set
         { 0, 0, 0, 1236, CHECK_OPTIMAL, true  },
@@ -2908,7 +2908,7 @@ void ScFiltersTest::testOutlineODS()
         size_t nIndex;
     };
 
-    OutlineData aRow[] =
+    static const OutlineData aRow[] =
     {
         { 1, 29, false, true, 0, 0 },
         { 2, 26, false, true, 1, 0 },
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a5af0c3e0db0..5645600c2a45 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -612,7 +612,7 @@ void Test::testSelectionFunction()
     };
 
     {
-        Check aChecks[] =
+        static const Check aChecks[] =
         {
             { SUBTOTAL_FUNC_AVE,              3.5 },
             { SUBTOTAL_FUNC_CNT2,            12.0 },
@@ -640,7 +640,7 @@ void Test::testSelectionFunction()
     CPPUNIT_ASSERT_MESSAGE("This row should be hidden.", m_pDoc->RowHidden(5, 0));
 
     {
-        Check aChecks[] =
+        static const Check aChecks[] =
         {
             { SUBTOTAL_FUNC_AVE,              3.0 },
             { SUBTOTAL_FUNC_CNT2,             8.0 },
@@ -667,7 +667,7 @@ void Test::testSelectionFunction()
         // D3 (numeric cell containing 5.)
         ScAddress aPos(3, 2, 0);
 
-        Check aChecks[] =
+        static const Check aChecks[] =
         {
             { SUBTOTAL_FUNC_AVE,             5.0 },
             { SUBTOTAL_FUNC_CNT2,            1.0 },
@@ -691,7 +691,7 @@ void Test::testSelectionFunction()
         // B7 (string formula cell containing ="C".)
         ScAddress aPos(1, 6, 0);
 
-        Check aChecks[] =
+        static const Check aChecks[] =
         {
             { SUBTOTAL_FUNC_CNT2,            1.0 },
             { SUBTOTAL_FUNC_SELECTION_COUNT, 1.0 }
@@ -905,7 +905,7 @@ void Test::testHorizontalIterator()
             { "E", "3" }
         };
 
-        HoriIterCheck aChecks[] = {
+        static const HoriIterCheck aChecks[] = {
             { 0, 0, "A" },
             { 1, 0, "B" },
             { 0, 1, "C" },
@@ -931,7 +931,7 @@ void Test::testHorizontalIterator()
             { "D", "E" },
         };
 
-        HoriIterCheck aChecks[] = {
+        static const HoriIterCheck aChecks[] = {
             { 0, 0, "A" },
             { 1, 0, "B" },
             { 0, 1, "C" },
@@ -960,7 +960,7 @@ void Test::testHorizontalIterator()
             {  nullptr,   nullptr  },
         };
 
-        HoriIterCheck aChecks[] = {
+        static const HoriIterCheck aChecks[] = {
             { 1, 0, "A" },
             { 1, 2, "1" },
             { 0, 3, "B" },
@@ -1002,7 +1002,7 @@ void Test::testHorizontalIterator()
             {  nullptr,  "A" },
         };
 
-        HoriIterCheck aChecks[] = {
+        static const HoriIterCheck aChecks[] = {
             { 1, 2, "A" },
         };
 
@@ -1023,7 +1023,7 @@ void Test::testHorizontalIterator()
             {  nullptr,   nullptr  },
         };
 
-        HoriIterCheck aChecks[] = {
+        static const HoriIterCheck aChecks[] = {
             { 1, 2, "A" },
             { 1, 3, "1" },
         };
@@ -1518,7 +1518,7 @@ void Test::testFuncParam()
 
 void Test::testNamedRange()
 {
-    RangeNameDef aNames[] = {
+    static const RangeNameDef aNames[] = {
         { "Divisor",  "$Sheet1.$A$1:$A$1048576", 1 },
         { "MyRange1", "$Sheet1.$A$1:$A$100",     2 },
         { "MyRange2", "$Sheet1.$B$1:$B$100",     3 },
@@ -1600,7 +1600,7 @@ void Test::testInsertNameList()
 {
     m_pDoc->InsertTab(0, "Test");
 
-    RangeNameDef aNames[] = {
+    static const RangeNameDef aNames[] = {
         { "MyRange1", "$Test.$A$1:$A$100", 1 },
         { "MyRange2", "$Test.$B$1:$B$100", 2 },
         { "MyRange3", "$Test.$C$1:$C$100", 3 }
@@ -3722,7 +3722,7 @@ void Test::testCopyPasteSkipEmpty()
 
     // Check the initial condition.
     {
-        Check aChecks[] = {
+        static const Check aChecks[] = {
             { "A", COL_BLUE, true },
             { "B", COL_BLUE, true },
             { "C", COL_BLUE, true },
@@ -3753,7 +3753,7 @@ void Test::testCopyPasteSkipEmpty()
 
     // Check the content after the paste.
     {
-        Check aChecks[] = {
+        static const Check aChecks[] = {
             { "Clip1", COL_YELLOW, false },
             { "B",     COL_BLUE,   true },
             { "Clip2", COL_YELLOW, false },
@@ -3768,7 +3768,7 @@ void Test::testCopyPasteSkipEmpty()
     // Undo, and check the content.
     aUndo.Undo();
     {
-        Check aChecks[] = {
+        static const Check aChecks[] = {
             { "A", COL_BLUE, true },
             { "B", COL_BLUE, true },
             { "C", COL_BLUE, true },
@@ -3783,7 +3783,7 @@ void Test::testCopyPasteSkipEmpty()
     // Redo, and check the content again.
     aUndo.Redo();
     {
-        Check aChecks[] = {
+        static const Check aChecks[] = {
             { "Clip1", COL_YELLOW, false },
             { "B",     COL_BLUE,   true },
             { "Clip2", COL_YELLOW, false },
diff --git a/sc/qa/unit/ucalc_column.cxx b/sc/qa/unit/ucalc_column.cxx
index a650b628b20f..35ffc0151a77 100644
--- a/sc/qa/unit/ucalc_column.cxx
+++ b/sc/qa/unit/ucalc_column.cxx
@@ -99,7 +99,7 @@ void Test::testSetFormula()
 {
     m_pDoc->InsertTab(0, "Test");
 
-    struct aInputs
+    static struct aInputs
     {
         const char* aName;
         SCROW const nRow;
@@ -108,7 +108,7 @@ void Test::testSetFormula()
         const char* aFormula2;      // Represents the formula that is actually stored in the cell.
         formula::FormulaGrammar::Grammar const eGram;
 
-    } aTest[] = {
+    } const aTest[] = {
         { "Rock and Roll" ,5 , 4 , "=SUM($D$2:$F$3)"             ,"=SUM($D$2:$F$3)" , formula::FormulaGrammar::Grammar::GRAM_ENGLISH     },
         { "Blues"         ,5 , 5 , "=A1-$C2+B$3-$F$4"            ,"=A1-$C2+B$3-$F$4", formula::FormulaGrammar::Grammar::GRAM_NATIVE      },
         { "Acoustic"      ,6 , 6 , "=A1-$C2+B$3-$F$4"            ,"=A1-$C2+B$3-$F$4", formula::FormulaGrammar::Grammar::GRAM_NATIVE_XL_A1},
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index ad64e51e4853..633bfd86fbcc 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -562,9 +562,9 @@ void Test::testIconSet()
     m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1);
     pList->InsertNew(pFormat);
 
-    struct {
+    static struct {
         double nVal; sal_Int32 nIndex;
-    } aTests[] = {
+    } const aTests[] = {
         { -1.0, 0 },
         { 0.0, 0 },
         { 1.0, 1 },
@@ -590,7 +590,7 @@ struct ScDataBarLengthData
     double const nLength;
 };
 
-void testDataBarLengthImpl(ScDocument* pDoc, ScDataBarLengthData* pData, const ScRange& rRange,
+void testDataBarLengthImpl(ScDocument* pDoc, const ScDataBarLengthData* pData, const ScRange& rRange,
         double nMinVal, ScColorScaleEntryType eMinType,
         double nMaxVal, ScColorScaleEntryType eMaxType,
         double nZeroPos, databar::ScAxisPosition eAxisPos)
@@ -635,7 +635,7 @@ void Test::testDataBarLengthAutomaticAxis()
 {
     m_pDoc->InsertTab(0, "Test");
 
-    ScDataBarLengthData aValues[] = {
+    static const ScDataBarLengthData aValues[] = {
         { 2, 0 },
         { 3, 0 },
         { 4, 25.0 },
@@ -650,7 +650,7 @@ void Test::testDataBarLengthAutomaticAxis()
     testDataBarLengthImpl(m_pDoc, aValues, ScRange(0,0,0,0,7,0),
             3, COLORSCALE_VALUE, 7, COLORSCALE_VALUE, 0.0, databar::AUTOMATIC);
 
-    ScDataBarLengthData aValues2[] = {
+    static const ScDataBarLengthData aValues2[] = {
         { -6, -100 },
         { -5, -100 },
         { -4, -100 },
@@ -672,7 +672,7 @@ void Test::testDataBarLengthAutomaticAxis()
     testDataBarLengthImpl(m_pDoc, aValues2, ScRange(1,0,0,1,15,0),
             -4, COLORSCALE_VALUE, 8, COLORSCALE_VALUE, 1.0/3.0 * 100, databar::AUTOMATIC);
 
-    ScDataBarLengthData aValues3[] = {
+    static const ScDataBarLengthData aValues3[] = {
         { 2, 0.0 },
         { 3, 25.0 },
         { 4, 50.0 },
@@ -682,7 +682,7 @@ void Test::testDataBarLengthAutomaticAxis()
     testDataBarLengthImpl(m_pDoc, aValues3, ScRange(2,0,0,2,3,0),
             0, COLORSCALE_MIN, 0, COLORSCALE_MAX, 0, databar::AUTOMATIC);
 
-    ScDataBarLengthData aValues4[] = {
+    static const ScDataBarLengthData aValues4[] = {
         { 2, 40.0 },
         { 3, 60.0 },
         { 4, 80.0 },
@@ -699,7 +699,7 @@ void Test::testDataBarLengthMiddleAxis()
 {
     m_pDoc->InsertTab(0, "Test");
 
-    ScDataBarLengthData aValues[] = {
+    static const ScDataBarLengthData aValues[] = {
         { 1, 25.0 },
         { 2, 25.0 },
         { 3, 37.5 },
@@ -715,7 +715,7 @@ void Test::testDataBarLengthMiddleAxis()
     testDataBarLengthImpl(m_pDoc, aValues, ScRange(0,0,0,0,8,0),
             2, COLORSCALE_VALUE, 8, COLORSCALE_VALUE, 50.0, databar::MIDDLE);
 
-    ScDataBarLengthData aValues2[] = {
+    static const ScDataBarLengthData aValues2[] = {
         { -6, -50 },
         { -5, -50 },
         { -4, -50 },
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 6bfccbc97bdc..cc55a350f9db 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -103,8 +103,8 @@ void Test::testFormulaCreateStringFromTokens()
     m_pDoc->InsertTab(3, aTabName4);
 
     // Insert named ranges.
-    struct {
-        bool const bGlobal;
+    static const struct {
+        bool bGlobal;
         const char* pName;
         const char* pExpr;
     } aNames[] = {
@@ -139,7 +139,7 @@ void Test::testFormulaCreateStringFromTokens()
     }
 
     // Insert DB ranges.
-    struct {
+    static const struct {
         const char* pName;
         SCTAB const nTab;
         SCCOL const nCol1;
@@ -809,7 +809,7 @@ void Test::testFormulaHashAndTag()
 
     // Test formula hashing.
 
-    struct {
+    static const struct {
         const char* pFormula1; const char* pFormula2; bool bEqual;
     } aHashTests[] = {
         { "=1", "=2", false }, // different constants
@@ -864,7 +864,7 @@ void Test::testFormulaHashAndTag()
 
     // Test formula vectorization state.
 
-    struct {
+    static const struct {
         const char* pFormula;
         ScFormulaVectorState const eState;
     } aVectorTests[] = {
@@ -903,7 +903,7 @@ void Test::testFormulaTokenEquality()
         bool const mbEqual;
     };
 
-    FormulaTokenEqualityTest aTests[] = {
+    static const FormulaTokenEqualityTest aTests[] = {
         { "R1C2", "R1C2", true },
         { "R1C2", "R1C3", false },
         { "R1C2", "R2C2", false },
@@ -990,7 +990,7 @@ void Test::testFormulaRefData()
 
 void Test::testFormulaCompiler()
 {
-    struct {
+    static const struct {
         const char* pInput; FormulaGrammar::Grammar eInputGram;
         const char* pOutput; FormulaGrammar::Grammar eOutputGram;
     } aTests[] = {
@@ -1040,7 +1040,7 @@ void Test::testFormulaCompilerJumpReordering()
         aCompRPN.CompileTokenArray();
 
         // RPN tokens should be ordered: B1, ocIf, C1, ocSep, D1, ocClose.
-        TokenCheck aCheckRPN[] =
+        static const TokenCheck aCheckRPN[] =
         {
             { ocPush,  svSingleRef },
             { ocIf,    svUnknown   }, // type is context dependent, don't test it
@@ -1068,7 +1068,7 @@ void Test::testFormulaCompilerJumpReordering()
         aCompRPN2.EnableJumpCommandReorder(false);
         aCompRPN2.CompileTokenArray();
 
-        TokenCheck aCheckRPN2[] =
+        static const TokenCheck aCheckRPN2[] =
         {
             { ocPush,  svSingleRef },
             { ocPush,  svDouble    },
@@ -4646,7 +4646,7 @@ void Test::testFuncCOUNTIF()
     printRange(m_pDoc, ScRange(0, 0, 0, 0, 8, 0), "data range for COUNTIF");
 
     // formulas and results
-    struct {
+    static const struct {
         const char* pFormula; double fResult;
     } aChecks[] = {
         { "=COUNTIF(A1:A12;1999)",       1 },
@@ -4838,7 +4838,7 @@ void Test::testFuncIFERROR()
     printRange(m_pDoc, ScRange(0, 0, 0, 0, nRows-1, 0), "data range for IFERROR/IFNA");
 
     // formulas and results
-    struct {
+    static const struct {
         const char* pFormula; const char* pResult;
     } aChecks[] = {
         { "=IFERROR(A1;9)",                         "1" },
@@ -5007,7 +5007,7 @@ void Test::testFuncNUMBERVALUE()
     printRange(m_pDoc, ScRange(0, 0, 0, 0, nRows - 1, 0), "data range for NUMBERVALUE");
 
     // formulas and results
-    struct {
+    static const struct {
         const char* pFormula; const char* pResult;
     } aChecks[] = {
         { "=NUMBERVALUE(A1;\"b\";\"ag\")",  "199.9" },
@@ -5189,7 +5189,7 @@ void Test::testFuncVLOOKUP()
     printRange(m_pDoc, ScRange(0, 0, 0, 1, 13, 0), "raw data for VLOOKUP");
 
     // Formula data
-    struct {
+    static const struct {
         const char* pLookup; const char* pFormula; const char* pRes;
     } aChecks[] = {
         { "Lookup",  "Formula", nullptr },
@@ -5321,7 +5321,7 @@ struct StrStrCheck {
 };
 
 template<size_t DataSize, size_t FormulaSize, int Type>
-static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], StrStrCheck aChecks[FormulaSize])
+static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], const StrStrCheck aChecks[FormulaSize])
 {
     size_t nDataSize = DataSize;
     for (size_t i = 0; i < nDataSize; ++i)
@@ -5360,7 +5360,7 @@ static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], StrStrCh
 }
 
 template<size_t DataSize, size_t FormulaSize, int Type>
-static void runTestHorizontalMATCH(ScDocument* pDoc, const char* aData[DataSize], StrStrCheck aChecks[FormulaSize])
+static void runTestHorizontalMATCH(ScDocument* pDoc, const char* aData[DataSize], const StrStrCheck aChecks[FormulaSize])
 {
     size_t nDataSize = DataSize;
     for (size_t i = 0; i < nDataSize; ++i)
@@ -5425,7 +5425,7 @@ void Test::testFuncMATCH()
         };
 
         // formula (B1:C12)
-        StrStrCheck aChecks[] = {
+        static const StrStrCheck aChecks[] = {
             { "0.8",   "#N/A" },
             { "1.2",      "1" },
             { "2.3",      "2" },
@@ -5469,7 +5469,7 @@ void Test::testFuncMATCH()
         };
 
         // formula (B1:C12)
-        StrStrCheck aChecks[] = {
+        static const StrStrCheck aChecks[] = {
             { "10",      "#N/A" },
             { "8.9",     "4" },
             { "7.8",     "5" },
@@ -6481,7 +6481,7 @@ void Test::testExternalRefFunctions()
 
     m_pDoc->InsertTab(0, "Test");
 
-    struct {
+    static const struct {
         const char* pFormula; double fResult;
     } aChecks[] = {
         { "=SUM('file:///extdata.fake'#Data.A1:A4)",     10 },
@@ -6816,7 +6816,7 @@ void Test::testFuncTableRef()
     /* TODO: should the item/header separator really be equal to the parameter
      * separator, thus be locale dependent and ';' semicolon here, or should it
      * be a fixed ',' comma instead? */
-    struct {
+    static const struct {
         const char* pName;
         const char* pExpr;
         const char* pCounta; // expected result when used in row 2 (first data row) as argument to COUNTA()
@@ -6990,7 +6990,7 @@ void Test::testFuncTableRef()
     }
 
     // Named expressions that use header-less Table structured references.
-    struct {
+    static const struct {
         const char* pName;
         const char* pExpr;
         const char* pCounta; // expected result when used in row 10 (first data row) as argument to COUNTA()
diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx
index f8a1da6235ef..d62a6cb3b9d0 100644
--- a/sc/qa/unit/ucalc_pivottable.cxx
+++ b/sc/qa/unit/ucalc_pivottable.cxx
@@ -46,7 +46,7 @@ struct DPFieldDef
 };
 
 template<size_t Size>
-ScRange insertDPSourceData(ScDocument* pDoc, DPFieldDef aFields[], size_t nFieldCount, const char* aData[][Size], size_t nDataCount)
+ScRange insertDPSourceData(ScDocument* pDoc, DPFieldDef const aFields[], size_t nFieldCount, const char* aData[][Size], size_t nDataCount)
 {
     // Insert field names in row 0.
     for (size_t i = 0; i < nFieldCount; ++i)
@@ -84,7 +84,7 @@ bool checkDPTableOutput(
 }
 
 ScDPObject* createDPFromSourceDesc(
-    ScDocument* pDoc, const ScSheetSourceDesc& rDesc, DPFieldDef aFields[], size_t nFieldCount,
+    ScDocument* pDoc, const ScSheetSourceDesc& rDesc, const DPFieldDef aFields[], size_t nFieldCount,
     bool bFilterButton)
 {
     ScDPObject* pDPObj = new ScDPObject(pDoc);
@@ -155,7 +155,7 @@ ScDPObject* createDPFromSourceDesc(
 }
 
 ScDPObject* createDPFromRange(
-    ScDocument* pDoc, const ScRange& rRange, DPFieldDef aFields[], size_t nFieldCount,
+    ScDocument* pDoc, const ScRange& rRange, const DPFieldDef aFields[], size_t nFieldCount,
     bool bFilterButton)
 {
     ScSheetSourceDesc aSheetDesc(pDoc);
@@ -195,7 +195,7 @@ void Test::testPivotTable()
     m_pDoc->InsertTab(1, "Table");
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Group", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
         { "Score", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -377,7 +377,7 @@ void Test::testPivotTableLabels()
     m_pDoc->InsertTab(1, "Table");
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Software", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Version",  sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
         { "1.2.3",    sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -432,7 +432,7 @@ void Test::testPivotTableDateLabels()
     m_pDoc->InsertTab(1, "Table");
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Date",  sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -507,7 +507,7 @@ void Test::testPivotTableFilters()
     m_pDoc->InsertTab(1, "Table");
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",   sheet::DataPilotFieldOrientation_HIDDEN, ScGeneralFunction::NONE, false },
         { "Group1", sheet::DataPilotFieldOrientation_HIDDEN, ScGeneralFunction::NONE, false },
         { "Group2", sheet::DataPilotFieldOrientation_PAGE, ScGeneralFunction::NONE, false },
@@ -659,7 +659,7 @@ void Test::testPivotTableNamedSource()
     m_pDoc->InsertTab(1, "Table");
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Group", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
         { "Score", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -958,7 +958,7 @@ void Test::testPivotTableDuplicateDataFields()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::COUNT, false }
@@ -1050,7 +1050,7 @@ void Test::testPivotTableNormalGrouping()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1210,7 +1210,7 @@ void Test::testPivotTableNumberGrouping()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Order", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Score", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1293,7 +1293,7 @@ void Test::testPivotTableDateGrouping()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Date", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1461,7 +1461,7 @@ void Test::testPivotTableEmptyRows()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1572,7 +1572,7 @@ void Test::testPivotTableTextNumber()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1671,7 +1671,7 @@ void Test::testPivotTableCaseInsensitiveStrings()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1745,7 +1745,7 @@ void Test::testPivotTableNumStability()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Total", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1830,7 +1830,7 @@ void Test::testPivotTableFieldReference()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -1998,7 +1998,7 @@ void Test::testPivotTableDocFunc()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
     };
@@ -2073,7 +2073,7 @@ void Test::testFuncGETPIVOTDATA()
 
     {
         // Dimension definition
-        DPFieldDef aFields[] = {
+        static const DPFieldDef aFields[] = {
             { "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
             { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
         };
@@ -2134,7 +2134,7 @@ void Test::testFuncGETPIVOTDATA()
 
     {
         // Dimension definition
-        DPFieldDef aFields[] = {
+        static const DPFieldDef aFields[] = {
             { "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
             { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
             { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::COUNT, false },
@@ -2228,7 +2228,7 @@ void Test::testFuncGETPIVOTDATALeafAccess()
     ScDPObject* pDPObj = nullptr;
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Type", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Member", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
@@ -2267,7 +2267,7 @@ void Test::testFuncGETPIVOTDATALeafAccess()
         double const mfResult;
     };
 
-    Check aChecks[] = {
+    static const Check aChecks[] = {
         { "=GETPIVOTDATA($A$1;\"Member[Anna]\")",     1.0 },
         { "=GETPIVOTDATA($A$1;\"Member[Brittany]\")", 2.0 },
         { "=GETPIVOTDATA($A$1;\"Member[Cecilia]\")",  3.0 },
@@ -2303,7 +2303,7 @@ void Test::testPivotTableRepeatItemLabels()
     m_pDoc->InsertTab(1, "Table");
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Name",  sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, true },
         { "Country", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Year", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
@@ -2380,7 +2380,7 @@ void Test::testPivotTableDPCollection()
     m_pDoc->InsertTab(1, "Table");
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Software", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Version",  sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
         { "1.2.3",    sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -2489,7 +2489,7 @@ void Test::testPivotTableMedianFunc()
     };
 
     // Dimension definition
-    DPFieldDef aFields[] = {
+    static const DPFieldDef aFields[] = {
         { "Condition", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
         { "Day1Hit", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::MEDIAN, false },
         { "Day1Miss", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::MEDIAN, false },
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index 9a2c759b0aab..bf817873a341 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -472,9 +472,9 @@ void Test::testSortInFormulaGroup()
 {
     SortRefUpdateSetter aUpdateSet;
 
-    static struct {
-        SCCOL const nCol;
-        SCROW const nRow;
+    static const struct {
+        SCCOL nCol;
+        SCROW nRow;
         const char *pData;
     } aEntries[] = {
         { 0, 0, "3" },   { 1, 0, "=A1" },
@@ -506,10 +506,10 @@ void Test::testSortInFormulaGroup()
 
     m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr);
 
-    static struct {
-        SCCOL const nCol;
-        SCROW const nRow;
-        double const fValue;
+    static const struct {
+        SCCOL nCol;
+        SCROW nRow;
+        double fValue;
     } aResults[] = {
         { 0, 0, 1.0 },   { 1, 0, 1.0 },
         { 0, 1, 2.0 },   { 1, 1, 3.0 },
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index afbcd765f01d..6f31ab7cf234 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -415,7 +415,7 @@ ScFunctionList::ScFunctionList()
     // See ScFuncDescCore definition for format details.
     // This list must be sorted in order of the opcode, dbgutil builds enable _GLIBCXX_DEBUG
     // which will concept check that the list is sorted on first use to ensure this holds
-    ScFuncDescCore aDescs[] =
+    static const ScFuncDescCore aDescs[] =
     {
         { SC_OPCODE_IF, ENTRY(SC_OPCODE_IF_ARY), 0, ID_FUNCTION_GRP_LOGIC, HID_FUNC_WENN, 3, { 0, 1, 1 } },
         { SC_OPCODE_IF_ERROR, ENTRY(SC_OPCODE_IF_ERROR_ARY), 0, ID_FUNCTION_GRP_LOGIC, HID_FUNC_IFERROR, 2, { 0, 0 } },
@@ -818,10 +818,10 @@ ScFunctionList::ScFunctionList()
     // otherwise the sub resources within the resource blocks and the
     // resource blocks themselves would had to be ordered according to
     // OpCodes, which is utopian...
-    ScFuncDescCore* pDescsEnd = aDescs + SAL_N_ELEMENTS(aDescs);
+    ScFuncDescCore const * pDescsEnd = aDescs + SAL_N_ELEMENTS(aDescs);
     for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
     {
-        ScFuncDescCore *pEntry = std::lower_bound(aDescs, pDescsEnd, i,
+        const ScFuncDescCore *pEntry = std::lower_bound(aDescs, pDescsEnd, i,
             [](const ScFuncDescCore &rItem, sal_uInt16 key)
             {
                 return rItem.nOpCode < key;
diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
index cbed718e5f98..154bd2f73c34 100644
--- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
@@ -35,7 +35,7 @@ struct StatisticCalculation {
     const char* aResultRangeName;
 };
 
-static StatisticCalculation lclBasicStatistics[] =
+static StatisticCalculation const lclBasicStatistics[] =
 {
     { STR_ANOVA_LABEL_GROUPS, nullptr,             nullptr       },
     { STRID_CALC_COUNT,       "=COUNT(%RANGE%)",   "COUNT_RANGE" },
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index c0126179be85..9dd0cd45a6d9 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -80,7 +80,7 @@ struct ConditionEntryApiMap
     sal_Int32 const nApiMode;
 };
 
-ConditionEntryApiMap aConditionEntryMap[] =
+static ConditionEntryApiMap const aConditionEntryMap[] =
 {
     {ScConditionMode::Equal, sheet::ConditionFormatOperator::EQUAL},
     {ScConditionMode::Less, sheet::ConditionFormatOperator::LESS},
@@ -131,7 +131,7 @@ struct ColorScaleEntryTypeApiMap
     sal_Int32 const nApiType;
 };
 
-ColorScaleEntryTypeApiMap aColorScaleEntryTypeMap[] =
+static ColorScaleEntryTypeApiMap const aColorScaleEntryTypeMap[] =
 {
     { COLORSCALE_MIN, sheet::ColorScaleEntryType::COLORSCALE_MIN },
     { COLORSCALE_MAX, sheet::ColorScaleEntryType::COLORSCALE_MAX },
@@ -180,7 +180,7 @@ struct DataBarAxisApiMap
     sal_Int32 const nApiPos;
 };
 
-DataBarAxisApiMap aDataBarAxisMap[] =
+static DataBarAxisApiMap const aDataBarAxisMap[] =
 {
     { databar::NONE, sheet::DataBarAxis::AXIS_NONE },
     { databar::AUTOMATIC, sheet::DataBarAxis::AXIS_AUTOMATIC },
@@ -193,7 +193,7 @@ struct DataBarEntryTypeApiMap
     sal_Int32 const nApiType;
 };
 
-DataBarEntryTypeApiMap aDataBarEntryTypeMap[] =
+static DataBarEntryTypeApiMap const aDataBarEntryTypeMap[] =
 {
     { COLORSCALE_AUTO, sheet::DataBarEntryType::DATABAR_AUTO },
     { COLORSCALE_MIN, sheet::DataBarEntryType::DATABAR_MIN },
@@ -260,7 +260,7 @@ struct IconSetEntryTypeApiMap
     sal_Int32 const nApiType;
 };
 
-IconSetEntryTypeApiMap aIconSetEntryTypeMap[] =
+static IconSetEntryTypeApiMap const aIconSetEntryTypeMap[] =
 {
     { COLORSCALE_MIN, sheet::IconSetFormatEntry::ICONSET_MIN },
     { COLORSCALE_VALUE, sheet::IconSetFormatEntry::ICONSET_VALUE },
@@ -292,7 +292,7 @@ struct DateTypeApiMap
     sal_Int32 const nApiType;
 };
 
-DateTypeApiMap aDateTypeApiMap[] =
+static DateTypeApiMap const aDateTypeApiMap[] =
 {
     { condformat::TODAY, sheet::DateType::TODAY },
     { condformat::YESTERDAY, sheet::DateType::YESTERDAY },
@@ -741,7 +741,7 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue(
             sal_Int32 nVal;
             if (aValue >>= nVal)
             {
-                for (ConditionEntryApiMap & rEntry : aConditionEntryMap)
+                for (ConditionEntryApiMap const & rEntry : aConditionEntryMap)
                 {
                     if (rEntry.nApiMode == nVal)
                     {
@@ -789,7 +789,7 @@ uno::Any SAL_CALL ScConditionEntryObj::getPropertyValue( const OUString& aProper
         case Operator:
         {
             ScConditionMode eMode = getCoreObject()->GetOperation();
-            for (ConditionEntryApiMap & rEntry : aConditionEntryMap)
+            for (ConditionEntryApiMap const & rEntry : aConditionEntryMap)
             {
                 if (rEntry.eMode == eMode)
                 {
@@ -869,7 +869,7 @@ void setColorScaleEntry(ScColorScaleEntry* pEntry, uno::Reference<sheet::XColorS
     ScColorScaleEntryType eType = ScColorScaleEntryType();
     sal_Int32 nApiType = xEntry->getType();
     bool bFound = false;
-    for (ColorScaleEntryTypeApiMap & rEntry : aColorScaleEntryTypeMap)
+    for (ColorScaleEntryTypeApiMap const & rEntry : aColorScaleEntryTypeMap)
     {
         if (rEntry.nApiType == nApiType)
         {
@@ -1023,7 +1023,7 @@ void ScColorScaleEntryObj::setColor(util::Color aColor)
 sal_Int32 ScColorScaleEntryObj::getType()
 {
     ScColorScaleEntry* pEntry = getCoreObject();
-    for (ColorScaleEntryTypeApiMap & rEntry : aColorScaleEntryTypeMap)
+    for (ColorScaleEntryTypeApiMap const & rEntry : aColorScaleEntryTypeMap)
     {
         if (rEntry.eType == pEntry->GetType())
         {
@@ -1037,7 +1037,7 @@ sal_Int32 ScColorScaleEntryObj::getType()
 void ScColorScaleEntryObj::setType(sal_Int32 nType)
 {
     ScColorScaleEntry* pEntry = getCoreObject();
-    for (ColorScaleEntryTypeApiMap & rEntry : aColorScaleEntryTypeMap)
+    for (ColorScaleEntryTypeApiMap const & rEntry : aColorScaleEntryTypeMap)
     {
         if (rEntry.nApiType == nType)
         {
@@ -1120,7 +1120,7 @@ void setDataBarEntry(ScColorScaleEntry* pEntry, uno::Reference<sheet::XDataBarEn
     ScColorScaleEntryType eType = ScColorScaleEntryType();
     sal_Int32 nApiType = xEntry->getType();
     bool bFound = false;
-    for (DataBarEntryTypeApiMap & rEntry : aDataBarEntryTypeMap)
+    for (DataBarEntryTypeApiMap const & rEntry : aDataBarEntryTypeMap)
     {
         if (rEntry.nApiType == nApiType)
         {
@@ -1167,7 +1167,7 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue(
             sal_Int32 nVal;
             if (aValue >>= nVal)
             {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list