[Libreoffice-commits] core.git: Branch 'feature/qt5-win' - 90 commits - avmedia/source basctl/source basegfx/source binaryurp/source bin/find-unneeded-includes canvas/source chart2/IwyuFilter_chart2.yaml chart2/source codemaker/source comphelper/source compilerplugins/clang config_host/config_global.h.in config_host/config_vclplug.h.in configure.ac connectivity/source cui/source cui/uiconfig dbaccess/source desktop/source editeng/source emfio/source extensions/source external/mariadb-connector-c external/pdfium forms/source fpicker/Library_fps.mk fpicker/source fpicker/WinResTarget_fps.mk helpcontent2 include/com include/connectivity include/filter include/osl include/rtl include/sal include/sfx2 include/svl include/svtools include/svx include/tools include/unoidl include/vcl lotuswordpro/source oox/source package/source registry/source Repository.mk sax/source sc/inc sc/IwyuFilter_sc.yaml sc/source sc/uiconfig sdext/source sd/qa sd/source sfx2/source solenv/clang-format solenv/sanitizers starmat h/uiconfig stoc/source store/source svgio/source svl/source svl/unx svtools/source svtools/uiconfig svx/source svx/uiconfig sw/inc sw/qa sw/source sw/uiconfig ucb/source UnoControls/source unotools/source vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_win.mk vcl/Module_vcl.mk vcl/qa vcl/qt5 vcl/source vcl/unx vcl/win vcl/workben writerfilter/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 09:08:37 UTC 2018


Rebased ref, commits from common ancestor:
commit 84e3c51aa147fd071a2c94c95dcfef08a4f7a556
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: Wed Sep 12 09:07:01 2018 +0000

    QT5 build VCL plugin on Windows
    
    Change-Id: I1bb673eb2c228d767caca6a9a860bd9d113d082f

diff --git a/Repository.mk b/Repository.mk
index 73432c0112e3..bf5af2f647c2 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -476,6 +476,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 685408e99062..768376b4b547 100644
--- a/configure.ac
+++ b/configure.ac
@@ -636,6 +636,7 @@ cygwin*|interix*)
     test_xrender=no
     test_freetype=no
     test_fontconfig=no
+    test_qt5=yes
     _os=WINNT
 
     DLLPOST=".dll"
@@ -4677,7 +4678,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
@@ -10016,10 +10016,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=""
@@ -10030,7 +10036,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)
@@ -11165,7 +11171,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] )
@@ -11187,6 +11197,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"
@@ -11216,7 +11230,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 d66a82319ed2..782bea8707a9 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 \
@@ -97,7 +98,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 \
@@ -106,9 +107,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 4f8d26c01c4b..c2a26d5e9685 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -114,6 +114,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 3cda6037c5e9..c5a59432cb49 100644
--- a/vcl/inc/qt5/Qt5Data.hxx
+++ b/vcl/inc/qt5/Qt5Data.hxx
@@ -29,18 +29,25 @@
 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;
+#ifndef _WIN32
     std::unique_ptr<GlyphCache> m_pGlyphCache;
+#endif
 
 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 0eb796330e38..978db593a328 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>
 
 class Qt5Graphics;
@@ -37,6 +39,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 SalFrame
 {
     friend class Qt5Widget;
@@ -47,12 +61,14 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : 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;
@@ -100,7 +116,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 6bde41ffa27f..b2c09af93f31 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;
@@ -38,7 +42,7 @@ class Qt5FontFace;
 class Qt5Frame;
 class Qt5Painter;
 
-class Qt5Graphics : public SalGraphics
+class SAL_DLLPRIVATE Qt5Graphics : public SalGraphics
 {
     friend class Qt5Bitmap;
     friend class Qt5Painter;
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index e68e55e8a5ef..21070ebafe4f 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,61 @@ class QApplication;
 class SalYieldMutex;
 class SalFrame;
 
+#ifdef _WIN32
+#include <salinst.hxx>
+#include <comphelper/solarmutex.hxx>
+
+class SalYieldMutex : public comphelper::SolarMutex
+{
+    SalYieldMutex(const SalYieldMutex&) = delete;
+    SalYieldMutex& operator=(const SalYieldMutex&) = delete;
+
+public:
+    SalYieldMutex();
+};
+
+#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
+{
+#ifdef _WIN32
+protected:
+    std::unique_ptr<SalYieldMutex> m_pSalYieldMutex;
+#endif
+
+public:
+#ifdef _WIN32
+    Qt5MocInstance()
+        : SalInstance()
+        , m_pSalYieldMutex(o3tl::make_unique<SalYieldMutex>())
+#else
+    Qt5MocInstance()
+        : SalGenericInstance(o3tl::make_unique<SalYieldMutex>())
+#endif
+    {
+    }
+
+#ifdef _WIN32
+    virtual comphelper::SolarMutex* GetYieldMutex() override;
+    virtual sal_uInt32 ReleaseYieldMutexAll() override;
+    virtual void AcquireYieldMutex(sal_uInt32 nCount = 1) override;
+#else
+    virtual GenPspGraphics* CreatePrintGraphics() override;
+    virtual void PostPrintersChanged() override;
+#endif
+};
+
 class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject,
-                                       public SalGenericInstance,
+                                       public Qt5MocInstance,
                                        public SalUserEventList
 {
     Q_OBJECT
@@ -54,7 +107,7 @@ Q_SIGNALS:
     bool ImplYieldSignal(bool bWait, bool bHandleAllCurrentEvents);
 
 public:
-    explicit Qt5Instance(std::unique_ptr<SalYieldMutex> pMutex, bool bUseCairo = false);
+    explicit Qt5Instance(bool bUseCairo = false);
     virtual ~Qt5Instance() override;
 
     virtual SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override;
@@ -78,7 +131,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 +149,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 74ba881ea15a..50175c79758a 100644
--- a/vcl/qt5/Qt5Data.cxx
+++ b/vcl/qt5/Qt5Data.cxx
@@ -149,12 +149,22 @@
 #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)
     , m_pGlyphCache(new GlyphCache())
+#else
+    : SalData()
+#endif
 {
+#ifdef _WIN32
+    m_pInstance = pInstance;
+    SetSalData(this);
+#endif
     ImplSVData* pSVData = ImplGetSVData();
 
     // draw toolbars on separate lines
@@ -309,9 +319,11 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle)
     return *m_aCursors[ePointerStyle];
 }
 
+#if 0
 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 3365ed4af3b8..dce3b838e543 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -44,8 +44,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)
@@ -54,10 +56,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)
@@ -161,6 +165,7 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect)
     CallCallback(SalEvent::Paint, &aPaintEvt);
 }
 
+#ifndef _WIN32
 void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
 {
     int width = 640;
@@ -172,6 +177,7 @@ void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
                                 nullptr);
     TriggerPaintEvent();
 }
+#endif
 
 SalGraphics* Qt5Frame::AcquireGraphics()
 {
@@ -180,6 +186,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
 
     m_bGraphicsInUse = true;
 
+#ifndef _WIN32
     if (m_bUseCairo)
     {
         if (!m_pOurSvpGraphics.get())
@@ -190,6 +197,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
         return m_pOurSvpGraphics.get();
     }
     else
+#endif
     {
         if (!m_pQt5Graphics.get())
         {
@@ -205,9 +213,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 18be768c04c0..b8c6c8c922eb 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -594,9 +594,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();
@@ -800,6 +798,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 f86a9c8834bc..35c2819f5a2e 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -43,8 +43,12 @@
 
 #include <headless/svpbmp.hxx>
 
-Qt5Instance::Qt5Instance(std::unique_ptr<SalYieldMutex> pMutex, bool bUseCairo)
-    : SalGenericInstance(std::move(pMutex))
+#ifdef _WIN32
+SalYieldMutex::SalYieldMutex() {}
+#endif
+
+Qt5Instance::Qt5Instance(bool bUseCairo)
+    : Qt5MocInstance()
     , m_postUserEventId(-1)
     , m_bUseCairo(bUseCairo)
 {
@@ -71,6 +75,21 @@ Qt5Instance::~Qt5Instance()
         free(m_pFakeArgvFreeable[i]);
 }
 
+comphelper::SolarMutex* Qt5MocInstance::GetYieldMutex()
+{
+    return m_pSalYieldMutex.get();
+}
+
+sal_uInt32 Qt5MocInstance::ReleaseYieldMutexAll()
+{
+    return m_pSalYieldMutex.get()->release( true/*bUnlockAll*/ );
+}
+
+void Qt5MocInstance::AcquireYieldMutex( sal_uInt32 nCount )
+{
+    m_pSalYieldMutex.get()->acquire( nCount );
+}
+
 SalFrame* Qt5Instance::CreateChildFrame(SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle)
 {
     return new Qt5Frame(nullptr, nStyle, m_bUseCairo);
@@ -93,9 +112,10 @@ SalObject* Qt5Instance::CreateObject(SalFrame* pParent, SystemWindowData*, bool
 void Qt5Instance::DestroyObject(SalObject* pObject) { delete pObject; }
 
 std::unique_ptr<SalVirtualDevice>
-Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, DeviceFormat eFormat,
+Qt5Instance::CreateVirtualDevice(SalGraphics* /* pGraphics */, long& nDX, long& nDY, DeviceFormat eFormat,
                                  const SystemGraphicsData* /* pData */)
 {
+#ifndef _WIN32
     if (m_bUseCairo)
     {
         SvpSalGraphics* pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics);
@@ -106,6 +126,7 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, D
         return pVD;
     }
     else
+#endif
     {
         std::unique_ptr<SalVirtualDevice> pVD(new Qt5VirtualDevice(eFormat, 1));
         pVD->SetSize(nDX, nDY);
@@ -131,9 +152,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>();
 }
 
@@ -265,28 +288,32 @@ 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);
 
     static const bool bUseCairo = (nullptr != getenv("SAL_VCL_QT5_USE_CAIRO"));
-    Qt5Instance* pInstance = new Qt5Instance(o3tl::make_unique<SalYieldMutex>(), bUseCairo);
+    Qt5Instance* pInstance = new Qt5Instance(bUseCairo);
 
     // initialize SalData
     new Qt5Data(pInstance);
diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx
index dd095f533c1a..24fcabe03470 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,7 +58,9 @@ static OUString getPdfDir(const PrinterInfo& rInfo)
     }
     return aDir;
 }
+#endif
 
+#ifndef _WIN32
 SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
                                                ImplJobSetup* pJobSetup)
 {
@@ -65,9 +70,17 @@ SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
 
     return pPrinter;
 }
+#else
+SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* /* pQueueInfo */,
+                                               ImplJobSetup* /* pJobSetup */)
+{
+    return nullptr;
+}
+#endif
 
 void Qt5Instance::DestroyInfoPrinter(SalInfoPrinter* pPrinter) { delete pPrinter; }
 
+#ifndef _WIN32
 std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrinter)
 {
     // create and initialize SalPrinter
@@ -76,7 +89,14 @@ std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrin
 
     return std::unique_ptr<SalPrinter>(pPrinter);
 }
+#else
+std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* /* pInfoPrinter */)
+{
+    return std::unique_ptr<SalPrinter>();
+}
+#endif
 
+#ifndef _WIN32
 void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
 {
     PrinterInfoManager& rManager(PrinterInfoManager::get());
@@ -113,6 +133,9 @@ void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
         pList->Add(pInfo);
     }
 }
+#else
+void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* /* pList */) {}
+#endif
 
 void Qt5Instance::DeletePrinterQueueInfo(SalPrinterQueueInfo* pInfo) { delete pInfo; }
 
@@ -120,12 +143,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..0c487b39d58c 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;
+#if 0
             case Qt::Key_Delete:
                 nCode = KEY_DELETE;
                 break;
+#endif
             case Qt::Key_Plus:
                 nCode = KEY_ADD;
                 break;
commit 2fed05fe38a0a2c2af850ca7ca993c45f997d0b0
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Sep 12 10:26:52 2018 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Sep 12 10:47:15 2018 +0200

    Implement Windows VCL backend as plugin
    
    Change-Id: If9c7c67f48311ac68ecc9f8e3a07f9bb7c73d962

diff --git a/Repository.mk b/Repository.mk
index 6787c1c0add5..73432c0112e3 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -401,6 +401,8 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(if $(MERGELIBS),merged) \
 	migrationoo2 \
 	migrationoo3 \
+	mork \
+	mozbootstrap \
 	msfilter \
 	$(call gb_Helper_optional,SCRIPTING,msforms) \
 	mtfrenderer \
@@ -459,9 +461,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	) \
 	vcl \
 	vclcanvas \
-	$(if $(USING_X11), \
-		vclplug_gen \
-	) \
 	writerperfect \
 	xmlscript \
 	xmlfa \
@@ -470,12 +469,14 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	xof \
 	xsltdlg \
 	xsltfilter \
-	mork \
-	mozbootstrap \
+	$(if $(USING_X11), \
+		vclplug_gen \
+	) \
 	$(if $(filter $(OS),WNT), \
 		ado \
 		oleautobridge \
 		smplmail \
+		vclplug_win \
 		wininetbe1 \
 	) \
 	$(if $(filter $(OS),MACOSX), \
diff --git a/include/vcl/dllapi.h b/include/vcl/dllapi.h
index b85e2ab87ce5..805d1cb00908 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
+#if (defined UNX  && ! defined MACOS) || defined _WIN32
 #define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC
 #else
 #define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index a582fe20a119..5c6f8f930f4f 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -203,28 +203,28 @@ private:
     bool                        mbInPrintPage;
     bool                        mbNewJobSetup;
 
-    SAL_DLLPRIVATE void         ImplInitData();
-    SAL_DLLPRIVATE void         ImplInit( SalPrinterQueueInfo* pInfo );
-    SAL_DLLPRIVATE void         ImplInitDisplay();
-    SAL_DLLPRIVATE static SalPrinterQueueInfo*
+    VCL_DLLPRIVATE void         ImplInitData();
+    VCL_DLLPRIVATE void         ImplInit( SalPrinterQueueInfo* pInfo );
+    VCL_DLLPRIVATE void         ImplInitDisplay();
+    VCL_DLLPRIVATE static SalPrinterQueueInfo*
                                 ImplGetQueueInfo( const OUString& rPrinterName, const OUString* pDriver );
-    SAL_DLLPRIVATE void         ImplUpdatePageData();
-    SAL_DLLPRIVATE void         ImplUpdateFontList();
-    SAL_DLLPRIVATE void         ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest );
+    VCL_DLLPRIVATE void         ImplUpdatePageData();
+    VCL_DLLPRIVATE void         ImplUpdateFontList();
+    VCL_DLLPRIVATE void         ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest );
 
-    SAL_DLLPRIVATE bool         StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController> const & );
+    VCL_DLLPRIVATE bool         StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController> const & );
 
-    static SAL_DLLPRIVATE ErrCode
+    static VCL_DLLPRIVATE ErrCode
                                 ImplSalPrinterErrorCodeToVCL( SalPrinterError nError );
 
 private:
-    SAL_DLLPRIVATE void         EndJob();
+    VCL_DLLPRIVATE void         EndJob();
                                 Printer( const Printer& rPrinter )    = delete;
     Printer&                    operator =( const Printer& rPrinter ) = delete;
 
 public:
-    SAL_DLLPRIVATE void         ImplStartPage();
-    SAL_DLLPRIVATE void         ImplEndPage();
+    VCL_DLLPRIVATE void         ImplStartPage();
+    VCL_DLLPRIVATE void         ImplEndPage();
 
 protected:
     virtual bool                AcquireGraphics() const override;
@@ -300,7 +300,7 @@ public:
         should the need arise to set the printer options outside vcl, also a method would have to be devised
         to not override these again internally
     */
-    SAL_DLLPRIVATE void         SetPrinterOptions( const PrinterOptions& rOptions );
+    VCL_DLLPRIVATE void         SetPrinterOptions( const PrinterOptions& rOptions );
     const PrinterOptions&       GetPrinterOptions() const { return( *mpPrinterOptions ); }
 
     bool                        SetOrientation( Orientation eOrient );
@@ -378,7 +378,7 @@ public:
 
         not exported, not usable outside vcl
     */
-    static void SAL_DLLPRIVATE  ImplPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController,
+    static void VCL_DLLPRIVATE  ImplPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController,
                                     const JobSetup& i_rInitSetup );
 };
 
@@ -535,36 +535,36 @@ public:
     // don't use outside vcl. Some of these are exported for
     // the benefit of vcl's plugins.
     // Still: DO NOT USE OUTSIDE VCL
-    VCL_PLUGIN_PUBLIC int               getFilteredPageCount();
-    SAL_DLLPRIVATE    PageSize          getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf,
+                      int               getFilteredPageCount();
+    VCL_DLLPRIVATE    PageSize          getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf,
                                             bool i_bMayUseCache = false );
-    VCL_PLUGIN_PUBLIC PageSize          getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf,
+                      PageSize          getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf,
                                             bool i_bMayUseCache = false );
-    VCL_PLUGIN_PUBLIC void              printFilteredPage( int i_nPage );
-    SAL_DLLPRIVATE    void              setPrinter( const VclPtr<Printer>& );
-    VCL_PLUGIN_PUBLIC void              createProgressDialog();
-    VCL_PLUGIN_PUBLIC bool              isProgressCanceled() const;
-    SAL_DLLPRIVATE    void              setMultipage( const MultiPageSetup& );
-    SAL_DLLPRIVATE    const MultiPageSetup&
+                      void              printFilteredPage( int i_nPage );
+    VCL_DLLPRIVATE    void              setPrinter( const VclPtr<Printer>& );
+                      void              createProgressDialog();
+                      bool              isProgressCanceled() const;
+    VCL_DLLPRIVATE    void              setMultipage( const MultiPageSetup& );
+    VCL_DLLPRIVATE    const MultiPageSetup&
                                         getMultipage() const;
-    VCL_PLUGIN_PUBLIC void              setLastPage( bool i_bLastPage );
-    SAL_DLLPRIVATE    void              setReversePrint( bool i_bReverse );
-    SAL_DLLPRIVATE    bool              getReversePrint() const;
-    SAL_DLLPRIVATE    void              setPapersizeFromSetup( bool i_bPapersizeFromSetup );
-    SAL_DLLPRIVATE    bool              getPapersizeFromSetup() const;
-    VCL_PLUGIN_PUBLIC void              setPrinterModified( bool i_bPapersizeFromSetup );
-    VCL_PLUGIN_PUBLIC bool              getPrinterModified() const;
-    SAL_DLLPRIVATE    void              pushPropertiesToPrinter();
-    SAL_DLLPRIVATE    void              resetPaperToLastConfigured();
-    VCL_PLUGIN_PUBLIC void              setJobState( css::view::PrintableState );
-    SAL_DLLPRIVATE    void              setupPrinter( weld::Window* i_pDlgParent );
-
-    SAL_DLLPRIVATE    int               getPageCountProtected() const;
-    SAL_DLLPRIVATE    css::uno::Sequence< css::beans::PropertyValue >
+                      void              setLastPage( bool i_bLastPage );
+    VCL_DLLPRIVATE    void              setReversePrint( bool i_bReverse );
+    VCL_DLLPRIVATE    bool              getReversePrint() const;
+    VCL_DLLPRIVATE    void              setPapersizeFromSetup( bool i_bPapersizeFromSetup );
+    VCL_DLLPRIVATE    bool              getPapersizeFromSetup() const;
+                      void              setPrinterModified( bool i_bPapersizeFromSetup );
+                      bool              getPrinterModified() const;
+    VCL_DLLPRIVATE    void              pushPropertiesToPrinter();
+    VCL_DLLPRIVATE    void              resetPaperToLastConfigured();
+                      void              setJobState( css::view::PrintableState );
+    VCL_DLLPRIVATE    void              setupPrinter( weld::Window* i_pDlgParent );
+
+    VCL_DLLPRIVATE    int               getPageCountProtected() const;
+    VCL_DLLPRIVATE    css::uno::Sequence< css::beans::PropertyValue >
                                         getPageParametersProtected( int i_nPage ) const;
 
-    SAL_DLLPRIVATE    DrawModeFlags     removeTransparencies( GDIMetaFile const & i_rIn, GDIMetaFile& o_rOut );
-    SAL_DLLPRIVATE    void              resetPrinterOptions( bool i_bFileOutput );
+    VCL_DLLPRIVATE    DrawModeFlags     removeTransparencies( GDIMetaFile const & i_rIn, GDIMetaFile& o_rOut );
+    VCL_DLLPRIVATE    void              resetPrinterOptions( bool i_bFileOutput );
 };
 
 class VCL_DLLPUBLIC PrinterOptionsHelper
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 2f69f6550dae..a2e66ebba63b 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -732,29 +732,9 @@ endif
 
 ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/opengl/win/gdiimpl \
     vcl/opengl/win/WinDeviceInfo \
     vcl/opengl/win/blocklist_parser \
-    vcl/win/app/saldata \
-    vcl/win/app/salinfo \
-    vcl/win/app/salinst \
-    vcl/win/app/salshl \
-    vcl/win/app/saltimer \
-    vcl/win/gdi/gdiimpl \
-    vcl/win/gdi/salbmp \
-    vcl/win/gdi/salgdi \
-    vcl/win/gdi/salgdi2 \
-    vcl/win/gdi/salfont \
-    vcl/win/gdi/salgdi_gdiplus \
-    vcl/win/gdi/salnativewidgets-luna \
-    vcl/win/gdi/salprn \
-    vcl/win/gdi/salvd \
-    vcl/win/gdi/winlayout \
-    vcl/win/gdi/DWriteTextRenderer \
-    vcl/win/window/salframe \
-    vcl/win/window/keynames \
-    vcl/win/window/salmenu \
-    vcl/win/window/salobj \
+    vcl/win/salplug \
 ))
 
 $(eval $(call gb_Library_use_system_win32_libs,vcl,\
@@ -775,9 +755,7 @@ $(eval $(call gb_Library_use_system_win32_libs,vcl,\
 ))
 
 $(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc))
-endif
 
-ifeq ($(OS),WNT)
 # HACK: dependency on icon themes so running unit tests don't
 # prevent delivering these by having open file handles on WNT
 $(eval $(call gb_Library_use_package,vcl,postprocess_images))
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk
new file mode 100644
index 000000000000..66ce982ab97b
--- /dev/null
+++ b/vcl/Library_vclplug_win.mk
@@ -0,0 +1,121 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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 .
+#
+
+$(eval $(call gb_Library_Library,vclplug_win))
+
+$(eval $(call gb_Library_use_custom_headers,vclplug_win,vcl/win))
+
+$(eval $(call gb_Library_set_include,vclplug_win,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/vcl/inc \
+    -I$(SRCDIR)/vcl/inc/win \
+))
+
+$(eval $(call gb_Library_add_defs,vclplug_win,\
+    -DVCLPLUG_WIN_IMPLEMENTATION \
+))
+
+ifeq ($(SYSTEM_GLM),TRUE)
+$(eval $(call gb_Library_add_defs,vclplug_win,\
+    -DGLM_ENABLE_EXPERIMENTAL \
+))
+endif
+
+$(eval $(call gb_Library_use_custom_headers,vclplug_win,\
+    officecfg/registry \
+))
+
+$(eval $(call gb_Library_use_sdk_api,vclplug_win))
+
+$(eval $(call gb_Library_use_libraries,vclplug_win,\
+    vcl \
+    tl \
+    utl \
+    sot \
+    ucbhelper \
+    basegfx \
+    comphelper \
+    cppuhelper \
+    i18nlangtag \
+    i18nutil \
+    $(if $(ENABLE_JAVA), \
+        jvmaccess) \
+    cppu \
+    sal \
+    salhelper \
+))
+
+$(eval $(call gb_Library_use_externals,vclplug_win,\
+    boost_headers \
+    epoxy \
+    glm_headers \
+    graphite \
+    harfbuzz \
+    icu_headers \
+    icuuc \
+))
+
+$(eval $(call gb_Library_add_exception_objects,vclplug_win,\
+    vcl/opengl/win/gdiimpl \
+    vcl/win/app/saldata \
+    vcl/win/app/salinfo \
+    vcl/win/app/salinst \
+    vcl/win/app/salshl \
+    vcl/win/app/saltimer \
+    vcl/win/gdi/gdiimpl \
+    vcl/win/gdi/salbmp \
+    vcl/win/gdi/salgdi \
+    vcl/win/gdi/salgdi2 \
+    vcl/win/gdi/salfont \
+    vcl/win/gdi/salgdi_gdiplus \
+    vcl/win/gdi/salnativewidgets-luna \
+    vcl/win/gdi/salprn \
+    vcl/win/gdi/salvd \
+    vcl/win/gdi/winlayout \
+    vcl/win/gdi/DWriteTextRenderer \
+    vcl/win/window/salframe \
+    vcl/win/window/keynames \
+    vcl/win/window/salmenu \
+    vcl/win/window/salobj \
+))
+
+$(eval $(call gb_Library_use_system_win32_libs,vclplug_win,\
+    advapi32 \
+    crypt32 \
+    gdi32 \
+    gdiplus \
+    imm32 \
+    mpr \
+    ole32 \
+    shell32 \
+    usp10 \
+    uuid \
+    version \
+    winspool \
+    setupapi \
+    shlwapi \
+))
+
+$(eval $(call gb_Library_add_nativeres,vclplug_win,vcl/salsrc))
+
+# HACK: dependency on icon themes so running unit tests don't
+# prevent delivering these by having open file handles on WNT
+$(eval $(call gb_Library_use_package,vclplug_win,postprocess_images))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index b8731614797a..4f8d26c01c4b 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -112,6 +112,7 @@ endif
 ifeq ($(OS),WNT)
 $(eval $(call gb_Module_add_targets,vcl,\
     WinResTarget_vcl \
+    Library_vclplug_win \
 ))
 endif
 
diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/fontselect.hxx
index 9707ba4e5fa9..51f70997ac53 100644
--- a/vcl/inc/fontselect.hxx
+++ b/vcl/inc/fontselect.hxx
@@ -34,7 +34,7 @@ class LogicalFontInstance;
 class PhysicalFontFace;
 class Size;
 
-class FontSelectPattern : public FontAttributes
+class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes
 {
 public:
                     FontSelectPattern( const vcl::Font&, const OUString& rSearchName,
diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx
index 66368b7cbcb9..76551c29d89d 100644
--- a/vcl/inc/fontsubset.hxx
+++ b/vcl/inc/fontsubset.hxx
@@ -44,7 +44,7 @@ namespace o3tl {
     template<> struct typed_flags<FontType> : is_typed_flags<FontType, (1<<8)-1> {};
 }
 
-class FontSubsetInfo final
+class VCL_DLLPUBLIC FontSubsetInfo final
 {
 public:
     explicit    FontSubsetInfo();
diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx
index 09fed59b7138..765dac0508e5 100644
--- a/vcl/inc/helpwin.hxx
+++ b/vcl/inc/helpwin.hxx
@@ -74,7 +74,7 @@ public:
 void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle,
         const OUString& rHelpText, const OUString& rStatusText,
         const Point& rScreenPos, const tools::Rectangle& rHelpArea );
-void ImplDestroyHelpWindow( bool bUpdateHideTime );
+VCL_DLLPUBLIC void ImplDestroyHelpWindow( bool bUpdateHideTime );
 void ImplSetHelpWindowPos( vcl::Window* pHelpWindow, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle,
                             const Point& rPos, const tools::Rectangle& rHelpArea );
 
diff --git a/vcl/inc/opengl/FixedTextureAtlas.hxx b/vcl/inc/opengl/FixedTextureAtlas.hxx
index 5d4eff4d0804..3187789fcdf0 100644
--- a/vcl/inc/opengl/FixedTextureAtlas.hxx
+++ b/vcl/inc/opengl/FixedTextureAtlas.hxx
@@ -16,7 +16,7 @@
 
 struct FixedTexture;
 
-class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager
+class FixedTextureAtlasManager final
 {
     std::vector<std::unique_ptr<FixedTexture>> maFixedTextures;
 
@@ -26,9 +26,13 @@ class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager
 
     void CreateNewTexture();
 
+    FixedTextureAtlasManager( const FixedTextureAtlasManager& ) = delete;
+    FixedTextureAtlasManager& operator=( const FixedTextureAtlasManager& ) = delete;
+
 public:
     FixedTextureAtlasManager(int nWidthFactor, int nHeightFactor, int nTextureSize);
     ~FixedTextureAtlasManager();
+
     OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData);
     OpenGLTexture Reserve(int nWidth, int nHeight);
 
diff --git a/vcl/inc/opengl/PackedTextureAtlas.hxx b/vcl/inc/opengl/PackedTextureAtlas.hxx
index cbe865a4d5a9..ea812440ea4e 100644
--- a/vcl/inc/opengl/PackedTextureAtlas.hxx
+++ b/vcl/inc/opengl/PackedTextureAtlas.hxx
@@ -26,7 +26,7 @@ struct PackedTexture;
  * [2]: https://github.com/lukaszdk/texture-atlas-generator
  *
  */
-class VCL_PLUGIN_PUBLIC PackedTextureAtlasManager
+class VCL_DLLPUBLIC PackedTextureAtlasManager final
 {
     std::vector<std::unique_ptr<PackedTexture>> maPackedTextures;
 
@@ -35,6 +35,9 @@ class VCL_PLUGIN_PUBLIC PackedTextureAtlasManager
 
     void CreateNewTexture();
 
+    PackedTextureAtlasManager( const PackedTextureAtlasManager& ) = delete;
+    PackedTextureAtlasManager& operator=( const PackedTextureAtlasManager& ) = delete;
+
 public:
 
     /**
@@ -43,6 +46,7 @@ public:
      */
     PackedTextureAtlasManager(int nTextureWidth, int nTextureHeight);
     ~PackedTextureAtlasManager();
+
     OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData);
     OpenGLTexture Reserve(int nWidth, int nHeight);
     std::vector<GLuint> ReduceTextureNumber(int nMaxNumberOfTextures);
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 912ce9ac98f0..38fdccf54620 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -208,7 +208,7 @@ void DestroySalInstance( SalInstance* pInst );
 
 void SalAbort( const OUString& rErrorText, bool bDumpCore );
 
-VCL_PLUGIN_PUBLIC const OUString& SalGetDesktopEnvironment();
+VCL_DLLPUBLIC const OUString& SalGetDesktopEnvironment();
 
 void InitSalData();                         // called from Application-Ctor
 void DeInitSalData();                       // called from Application-Dtor
diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx
index 014f61179b47..d9669793655d 100644
--- a/vcl/inc/salprn.hxx
+++ b/vcl/inc/salprn.hxx
@@ -86,6 +86,9 @@ public:
 
 class VCL_PLUGIN_PUBLIC SalPrinter
 {
+    SalPrinter( const SalPrinter& ) = delete;
+    SalPrinter& operator=( const SalPrinter& ) = delete;
+
 public:
     SalPrinter() {}
     virtual ~SalPrinter();
diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx
index 5e3478e45b2b..fc80e90d0ca9 100644
--- a/vcl/inc/salsys.hxx
+++ b/vcl/inc/salsys.hxx
@@ -83,7 +83,7 @@ public:
 
 };
 
-SalSystem* ImplGetSalSystem();
+VCL_DLLPUBLIC SalSystem* ImplGetSalSystem();
 
 #endif // INCLUDED_VCL_INC_SALSYS_HXX
 
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index c09834adeaef..b8df52622dfe 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -343,7 +343,7 @@ namespace vcl
  * @ingroup sft
  *
  */
-    SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont  *ttf,
+    VCL_DLLPUBLIC SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont  *ttf,
                               const char    *fname,
                               sal_uInt16 const *glyphArray,
                               sal_uInt8 const *encoding,
@@ -386,7 +386,7 @@ namespace vcl
  * @ingroup sft
  *
  */
-    TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical);
+    VCL_DLLPUBLIC TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical);
 
 #if defined(_WIN32) || defined(MACOSX) || defined(IOS)
 /**
@@ -398,7 +398,7 @@ namespace vcl
  * @return glyph ID, if the character is missing in the font, the return value is 0.
  * @ingroup sft
  */
-    sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch);
+    VCL_DLLPUBLIC sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch);
 #endif
 
 /**
@@ -410,7 +410,7 @@ namespace vcl
  * @ingroup sft
  *
  */
-    void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info);
+    VCL_DLLPUBLIC void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info);
 
 /**
  * Returns fonts metrics.
@@ -429,7 +429,7 @@ namespace vcl
 /**
  * returns the number of glyphs in a font
  */
- int GetTTGlyphCount( TrueTypeFont const * ttf );
+ VCL_DLLPUBLIC int GetTTGlyphCount( TrueTypeFont const * ttf );
 
 /**
  * provide access to the raw data of a SFNT-container's subtable
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 679debce188e..b591409bdf08 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -379,7 +379,7 @@ VCL_PLUGIN_PUBLIC OUString VclResId(const char* pId);
 DockingManager*     ImplGetDockingManager();
 BlendFrameCache*    ImplGetBlendFrameCache();
 
-bool        ImplCallPreNotify( NotifyEvent& rEvt );
+VCL_DLLPUBLIC bool        ImplCallPreNotify( NotifyEvent& rEvt );
 
 VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData();
 VCL_PLUGIN_PUBLIC void ImplHideSplash();
diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h
index e8677d239937..88defd3972d6 100644
--- a/vcl/inc/vclpluginapi.h
+++ b/vcl/inc/vclpluginapi.h
@@ -59,6 +59,12 @@
 #define VCLPLUG_SVP_PUBLIC SAL_DLLPUBLIC_IMPORT
 #endif
 
+#if defined VCLPLUG_WIN_IMPLEMENTATION
+#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
 #if defined DESKTOP_DETECTOR_IMPLEMENTATION
 #define DESKTOP_DETECTOR_PUBLIC SAL_DLLPUBLIC_EXPORT
 #else
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index a43d52e2f8ce..a1e95412a87c 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -36,7 +36,7 @@ public:
     /// invisible Window so non-main threads can SendMessage() the main thread
     HWND                mhComWnd;
     /// The Yield mutex ensures that only one thread calls into VCL
-    SalYieldMutex*      mpSalYieldMutex;
+    std::unique_ptr<SalYieldMutex> mpSalYieldMutex;
 
     osl::Condition      maWaitingYieldCond;
     unsigned            m_nNoYieldLock;
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 0f422f3cfc72..c252d64997ba 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -32,6 +32,7 @@
 #include <vcl/opengl/OpenGLHelper.hxx>
 #include <vcl/opengl/OpenGLContext.hxx>
 #include <vcl/timer.hxx>
+#include <vclpluginapi.h>
 
 #include <opengl/salbmp.hxx>
 #include <opengl/win/gdiimpl.hxx>
@@ -299,55 +300,33 @@ SalData::SalData()
 
     SetSalData( this );
     initNWF();
+
+    CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA)
+    static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
+    Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
 }
 
 SalData::~SalData()
 {
     deInitNWF();
     SetSalData( nullptr );
-}
-
-void InitSalData()
-{
-    SalData* pSalData = new SalData;
-    CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA)
-
-    // init GDIPlus
-    static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
-    Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, nullptr);
-}
 
-void DeInitSalData()
-{
     CoUninitialize();
-    SalData* pSalData = GetSalData();
 
-    // deinit GDIPlus
-    if(pSalData)
-    {
-        Gdiplus::GdiplusShutdown(pSalData->gdiplusToken);
-    }
-
-    delete pSalData;
+    if (gdiplusToken)
+        Gdiplus::GdiplusShutdown(gdiplusToken);
 }
 
-void InitSalMain()
+extern "C" {
+VCLPLUG_WIN_PUBLIC SalInstance* create_SalInstance()
 {
-    // remember data, copied from WinMain
-    SalData* pData = GetSalData();
-    if ( pData )    // Im AppServer NULL
-    {
-        STARTUPINFOW aSI;
-        aSI.cb = sizeof( aSI );
-        GetStartupInfoW( &aSI );
-        pData->mhInst    = GetModuleHandleW( nullptr );
-        pData->mnCmdShow = aSI.wShowWindow;
-    }
-}
+    SalData* pSalData = new SalData();
 
-SalInstance* CreateSalInstance()
-{
-    SalData* pSalData = GetSalData();
+    STARTUPINFOW aSI;
+    aSI.cb = sizeof( aSI );
+    GetStartupInfoW( &aSI );
+    pSalData->mhInst = GetModuleHandleW( nullptr );
+    pSalData->mnCmdShow = aSI.wShowWindow;
 
     pSalData->mnAppThreadId = GetCurrentThreadId();
 
@@ -405,40 +384,25 @@ SalInstance* CreateSalInstance()
 
     return pInst;
 }
-
-void DestroySalInstance( SalInstance* pInst )
-{
-    SalData* pSalData = GetSalData();
-
-    //  (only one instance in this version !!!)
-
-    ImplFreeSalGDI();
-
-    // reset instance
-    if ( pSalData->mpInstance == pInst )
-        pSalData->mpInstance = nullptr;
-
-    delete pInst;
 }
 
 WinSalInstance::WinSalInstance()
     : mhComWnd( nullptr )
+    , mpSalYieldMutex(o3tl::make_unique<SalYieldMutex>())
     , m_nNoYieldLock( 0 )
 {
-    mpSalYieldMutex = new SalYieldMutex();
     mpSalYieldMutex->acquire();
 }
 
 WinSalInstance::~WinSalInstance()
 {
-    mpSalYieldMutex->release();
-    delete mpSalYieldMutex;
+    ImplFreeSalGDI();
     DestroyWindow( mhComWnd );
 }
 
 comphelper::SolarMutex* WinSalInstance::GetYieldMutex()
 {
-    return mpSalYieldMutex;
+    return mpSalYieldMutex.get();
 }
 
 sal_uInt32 WinSalInstance::ReleaseYieldMutexAll()
@@ -1016,12 +980,6 @@ std::shared_ptr<SalBitmap> WinSalInstance::CreateSalBitmap()
         return std::make_shared<WinSalBitmap>();
 }
 
-const OUString& SalGetDesktopEnvironment()
-{
-    static OUString aDesktopEnvironment( "Windows" );
-    return aDesktopEnvironment;
-}
-
 int WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POINTERS pExceptionInfo)
 {
     // Decide if an exception is a c++ (mostly UNO) exception or a process violation.
diff --git a/vcl/win/salplug.cxx b/vcl/win/salplug.cxx
new file mode 100644
index 000000000000..65b8f64e8810
--- /dev/null
+++ b/vcl/win/salplug.cxx
@@ -0,0 +1,198 @@
+/* -*- 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 <osl/module.hxx>
+#include <osl/process.h>
+
+#include <rtl/bootstrap.hxx>
+#include <rtl/process.h>
+#include <sal/log.hxx>
+
+#include <salinst.hxx>
+#include <saldatabasic.hxx>
+#include <config_vclplug.h>
+#include <desktop/crashreport.hxx>
+
+#include <cstdio>
+#include <Windows.h>
+
+extern "C" {
+typedef SalInstance*(*salFactoryProc)();
+}
+
+namespace {
+
+// HACK to obtain Application::IsHeadlessModeEnabled early on, before
+// Application::EnableHeadlessMode has potentially been called:
+bool IsHeadlessModeRequested()
+{
+    if (Application::IsHeadlessModeEnabled()) {
+        return true;
+    }
+    sal_uInt32 n = rtl_getAppCommandArgCount();
+    for (sal_uInt32 i = 0; i < n; ++i) {
+        OUString arg;
+        rtl_getAppCommandArg(i, &arg.pData);
+        if ( arg == "--headless" || arg == "-headless" ) {
+            return true;
+        }
+    }
+    return false;
+}
+
+}
+
+static oslModule pCloseModule = nullptr;
+
+static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false )
+{
+    SalInstance* pInst = nullptr;
+    OUString aModule(
+#ifdef SAL_DLLPREFIX
+            SAL_DLLPREFIX
+#endif
+            "vclplug_" + rModuleBase + "lo" SAL_DLLEXTENSION );
+
+    osl::Module aMod;
+    if (aMod.loadRelative(reinterpret_cast<oslGenericFunction>(&tryInstance), aModule, SAL_LOADMODULE_GLOBAL))
+    {
+        salFactoryProc aProc = reinterpret_cast<salFactoryProc>(aMod.getFunctionSymbol("create_SalInstance"));
+        if (aProc)
+        {
+            pInst = aProc();
+            SAL_INFO(
+                "vcl.plugadapt",
+                "sal plugin " << aModule << " produced instance " << pInst);
+            if (pInst)
+            {
+                pCloseModule = static_cast<oslModule>(aMod);
+                aMod.release();
+            }
+        }
+        else
+        {
+            SAL_WARN(
+                "vcl.plugadapt",
+                "could not load symbol create_SalInstance from shared object "
+                    << aModule);
+        }
+    }
+    else if (bForce)
+    {
+        SAL_WARN("vcl.plugadapt", "could not load shared object " << aModule);
+    }
+    else
+    {
+        SAL_INFO("vcl.plugadapt", "could not load shared object " << aModule);
+    }
+
+    // coverity[leaked_storage] - this is on purpose
+    return pInst;
+}
+
+SalInstance *CreateSalInstance()
+{
+    SalInstance *pInst = nullptr;
+
+    OUString aUsePlugin;
+    rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin );
+
+    if( !aUsePlugin.isEmpty() )
+        pInst = tryInstance( aUsePlugin, true );
+
+    // fallback, try everything
+    static const char* const pPlugin[] = { "win" };
+
+    for ( int i = 0; !pInst && i != SAL_N_ELEMENTS(pPlugin); ++i )
+        pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) );
+
+    if( ! pInst )
+    {
+        std::fprintf( stderr, "no suitable windowing system found, exiting.\n" );
+        _exit( 1 );
+    }
+
+    // acquire SolarMutex
+    pInst->AcquireYieldMutex();
+
+    return pInst;
+}
+
+void DestroySalInstance( SalInstance *pInst )
+{
+    // release SolarMutex
+    pInst->ReleaseYieldMutexAll();
+
+    delete pInst;
+    if( pCloseModule )
+        osl_unloadModule( pCloseModule );
+}
+
+void InitSalData()
+{
+}
+
+void DeInitSalData()
+{
+}
+
+void InitSalMain()
+{
+}
+
+void SalAbort( const OUString& rErrorText, bool bDumpCore )
+{
+    if( rErrorText.isEmpty() )
+        std::fprintf( stderr, "Application Error\n" );
+    else
+    {
+        CrashReporter::AddKeyValue("AbortMessage", rErrorText);
+        std::fprintf( stderr, "%s\n", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
+    }
+    if( bDumpCore )
+        abort();
+    else
+        _exit(1);
+}
+
+const OUString& SalGetDesktopEnvironment()
+{
+    static OUString aDesktopEnvironment( "Windows" );
+    return aDesktopEnvironment;
+}
+
+SalData::SalData() :
+    m_pInstance(nullptr),
+    m_pPIManager(nullptr)
+{
+}
+
+SalData::~SalData() COVERITY_NOEXCEPT_FALSE
+{
+}
+
+bool HasAtHook()
+{
+    BOOL bIsRunning = FALSE;
+    // pvParam must be BOOL
+    return SystemParametersInfoW(SPI_GETSCREENREADER, 0, &bIsRunning, 0)
+        && bIsRunning;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index ef6d7ff2827a..91f561dc7b5e 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5863,14 +5863,4 @@ bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR
     return bResult;
 }
 
-#ifdef _WIN32
-bool HasAtHook()
-{
-    BOOL bIsRunning = FALSE;
-    // pvParam must be BOOL
-    return SystemParametersInfoW(SPI_GETSCREENREADER, 0, &bIsRunning, 0)
-        && bIsRunning;
-}
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a170f5c4a53f6a02ce9d7bb7458e3677c0d69ad3
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 10 14:43:20 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 12 10:24:28 2018 +0200

    loplugin:useuniqueptr in Compare
    
    Change-Id: I3d45c5b893e8dba348dd84ba8d1b96fa5a14d1cb
    Reviewed-on: https://gerrit.libreoffice.org/60351
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index c56b5ed3d999..f8c4f55e9a64 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -564,34 +564,31 @@ void Hash::CalcHashValue( CompareData& rData )
 
 Compare::Compare( sal_uLong nDiff, CompareData& rData1, CompareData& rData2 )
 {
-    MovedData *pMD1, *pMD2;
+    std::unique_ptr<MovedData> pMD1, pMD2;
     // Look for the differing lines
     {
         std::unique_ptr<sal_Char[]> pDiscard1( new sal_Char[ rData1.GetLineCount() ] );
         std::unique_ptr<sal_Char[]> pDiscard2( new sal_Char[ rData2.GetLineCount() ] );
 
-        sal_uLong* pCount1 = new sal_uLong[ nDiff ];
-        sal_uLong* pCount2 = new sal_uLong[ nDiff ];
-        memset( pCount1, 0, nDiff * sizeof( sal_uLong ));
-        memset( pCount2, 0, nDiff * sizeof( sal_uLong ));
+        std::unique_ptr<sal_uLong[]> pCount1(new sal_uLong[ nDiff ]);
+        std::unique_ptr<sal_uLong[]> pCount2(new sal_uLong[ nDiff ]);
+        memset( pCount1.get(), 0, nDiff * sizeof( sal_uLong ));
+        memset( pCount2.get(), 0, nDiff * sizeof( sal_uLong ));
 
         // find indices in CompareData which have been assigned multiple times
-        CountDifference( rData1, pCount1 );
-        CountDifference( rData2, pCount2 );
+        CountDifference( rData1, pCount1.get() );
+        CountDifference( rData2, pCount2.get() );
 
         // All which occur only once now have either been inserted or deleted.
         // All which are also contained in the other one have been moved.
-        SetDiscard( rData1, pDiscard1.get(), pCount2 );
-        SetDiscard( rData2, pDiscard2.get(), pCount1 );
-
-        // forget the arrays again
-        delete [] pCount1; delete [] pCount2;
+        SetDiscard( rData1, pDiscard1.get(), pCount2.get() );
+        SetDiscard( rData2, pDiscard2.get(), pCount1.get() );
 
         CheckDiscard( rData1.GetLineCount(), pDiscard1.get() );
         CheckDiscard( rData2.GetLineCount(), pDiscard2.get() );
 
-        pMD1 = new MovedData( rData1, pDiscard1.get() );
-        pMD2 = new MovedData( rData2, pDiscard2.get() );
+        pMD1.reset(new MovedData( rData1, pDiscard1.get() ));
+        pMD2.reset(new MovedData( rData2, pDiscard2.get() ));
     }
 
     {
@@ -599,9 +596,6 @@ Compare::Compare( sal_uLong nDiff, CompareData& rData1, CompareData& rData2 )
     }
 
     ShiftBoundaries( rData1, rData2 );
-
-    delete pMD1;
-    delete pMD2;
 }
 
 void Compare::CountDifference( const CompareData& rData, sal_uLong* pCounts )
commit a6ea0e89c092332e003567019294acc9e890eac2
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 12 08:42:12 2018 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 12 10:14:23 2018 +0200

    Avoid duplicate class name causing ODR violation
    
    ...as reported by ASan during e.g. UITest_writer_tests:
    
    > ==3420==ERROR: AddressSanitizer: odr-violation (0x7f523b312200):
    >   [1] size=152 'vtable for NumberingPreview' /data/sbergman/lo-san/core/cui/source/tabpages/numpages.cxx
    >   [2] size=152 'vtable for NumberingPreview' /data/sbergman/lo-san/core/sw/source/ui/misc/outline.cxx
    
    Change-Id: I8ed56e3af3c6ba21ce6d757854e92a0f2c043ede
    Reviewed-on: https://gerrit.libreoffice.org/60368
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 7d5ebc526e84..e3f24ca4aa34 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -65,6 +65,8 @@ class SvxNumberingPreview : public vcl::Window
 
 };
 
+namespace cui {
+
 class NumberingPreview : public weld::CustomWidgetController
 {
     const SvxNumRule*   pActNum;
@@ -86,6 +88,8 @@ public:
 
 };
 
+}
+
 struct SvxNumSettings_Impl
 {
     SvxNumType nNumberType;
@@ -391,7 +395,7 @@ class SvxNumPositionTabPage : public SfxTabPage
     bool                bInInintControl     : 1;  // workaround for Modify-error, is said to be corrected from 391 on
     bool                bLabelAlignmentPosAndSpaceModeActive;
 
-    NumberingPreview m_aPreviewWIN;
+    cui::NumberingPreview m_aPreviewWIN;
     std::unique_ptr<weld::TreeView> m_xLevelLB;
     // former set of controls shown for numbering rules containing list level
     // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 7ab6d400b8ab..8863e5fa968c 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2528,7 +2528,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
     rRenderContext.DrawOutDev(Point(), aSize, Point(), aSize, *pVDev);
 }
 
-NumberingPreview::NumberingPreview()
+cui::NumberingPreview::NumberingPreview()
     : pActNum(nullptr)
     , bPosition(false)
     , nActLevel(SAL_MAX_UINT16)
@@ -2536,7 +2536,7 @@ NumberingPreview::NumberingPreview()
 }
 
 // paint preview of numeration
-void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& /*rRect*/)
+void cui::NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& /*rRect*/)
 {
     Size aSize(rRenderContext.PixelToLogic(GetOutputSizePixel()));
 
commit b22e3d3b631efdb3f25066ecbecedbe3507fbb43
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 10 14:40:36 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 12 10:11:25 2018 +0200

    loplugin:useuniqueptr in SwAttrCheckArr
    
    Change-Id: If981fc6f64b28812e1face263da326c7a424487a
    Reviewed-on: https://gerrit.libreoffice.org/60345
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index d2d35f229f08..452064e866b8 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -350,7 +350,7 @@ bool SwAttrCheckArr::SetAttrFwd( const SwTextAttr& rAttr )
     const SfxPoolItem* pItem;
     // here we explicitly also search in character templates
     sal_uInt16 nWhch = rAttr.Which();
-    SfxWhichIter* pIter = nullptr;
+    std::unique_ptr<SfxWhichIter> pIter;
     const SfxPoolItem* pTmpItem = nullptr;
     const SfxItemSet* pSet = nullptr;
     if( RES_TXTATR_CHARFMT == nWhch || RES_TXTATR_AUTOFMT == nWhch )
@@ -361,7 +361,7 @@ bool SwAttrCheckArr::SetAttrFwd( const SwTextAttr& rAttr )
         pSet = CharFormat::GetItemSet( rAttr.GetAttr() );
         if ( pSet )
         {
-            pIter = new SfxWhichIter( *pSet );
+            pIter.reset(new SfxWhichIter( *pSet ));
             nWhch = pIter->FirstWhich();
             while( nWhch &&
                 SfxItemState::SET != pSet->GetItemState( nWhch, true, &pTmpItem ) )
@@ -486,7 +486,7 @@ bool SwAttrCheckArr::SetAttrFwd( const SwTextAttr& rAttr )
         else
             break;
     }
-    delete pIter;
+    pIter.reset();
     return Found();
 }
 
@@ -503,7 +503,7 @@ bool SwAttrCheckArr::SetAttrBwd( const SwTextAttr& rAttr )
     const SfxPoolItem* pItem;
     // here we explicitly also search in character templates
     sal_uInt16 nWhch = rAttr.Which();
-    SfxWhichIter* pIter = nullptr;
+    std::unique_ptr<SfxWhichIter> pIter;
     const SfxPoolItem* pTmpItem = nullptr;
     const SfxItemSet* pSet = nullptr;
     if( RES_TXTATR_CHARFMT == nWhch || RES_TXTATR_AUTOFMT == nWhch )
@@ -514,7 +514,7 @@ bool SwAttrCheckArr::SetAttrBwd( const SwTextAttr& rAttr )
         pSet = CharFormat::GetItemSet( rAttr.GetAttr() );
         if ( pSet )
         {
-            pIter = new SfxWhichIter( *pSet );
+            pIter.reset( new SfxWhichIter( *pSet ) );
             nWhch = pIter->FirstWhich();
             while( nWhch &&
                 SfxItemState::SET != pSet->GetItemState( nWhch, true, &pTmpItem ) )
@@ -637,7 +637,7 @@ bool SwAttrCheckArr::SetAttrBwd( const SwTextAttr& rAttr )
         else
             break;
     }
-    delete pIter;
+    pIter.reset();
     return Found();
 }
 
commit d8b4d2f9c6fe710031471bea360e9223f29c3eea
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 11 21:18:41 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 12 09:57:44 2018 +0200

    ofz#10301 Abrt
    
    Change-Id: I3ec766dd243fa27068ec44b16c941beaa9da1479
    Reviewed-on: https://gerrit.libreoffice.org/60359
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx
index e9175de10d60..86edeb0aa944 100644
--- a/emfio/source/emfuno/xemfparser.cxx
+++ b/emfio/source/emfuno/xemfparser.cxx
@@ -139,21 +139,28 @@ namespace emfio
 
                 bool bReadError(false);
 
-                if (nMetaType == 0x464d4520)
+                try
                 {
-                    // read and get possible failure/error, ReadEnhWMF returns success
-                    bReadError = !emfio::EmfReader(*pStream, aMtf).ReadEnhWMF();
-                }
-                else
-                {
-                    emfio::WmfReader(*pStream, aMtf, bExternalHeaderUsed ? &aExternalHeader : nullptr).ReadWMF();
+                    if (nMetaType == 0x464d4520)
+                    {
+                        // read and get possible failure/error, ReadEnhWMF returns success
+                        bReadError = !emfio::EmfReader(*pStream, aMtf).ReadEnhWMF();
+                    }
+                    else
+                    {
+                        emfio::WmfReader(*pStream, aMtf, bExternalHeaderUsed ? &aExternalHeader : nullptr).ReadWMF();
 
-                    // Need to check for ErrCode at stream to not lose former work.
-                    // This may contain important information and will behave the
-                    // same as before. When we have an error, do not create content
-                    ErrCode aErrCode(pStream->GetError());
+                        // Need to check for ErrCode at stream to not lose former work.
+                        // This may contain important information and will behave the
+                        // same as before. When we have an error, do not create content
+                        ErrCode aErrCode(pStream->GetError());
 
-                    bReadError = aErrCode.IsError();
+                        bReadError = aErrCode.IsError();
+                    }
+                }
+                catch (...)
+                {
+                    bReadError = true;
                 }
 
                 pStream->SetEndian(nOrigNumberFormat);
commit efa2681db1fb66e5f3677adff3a5e91ccba6b9ec
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Sep 11 22:28:08 2018 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Sep 12 09:56:22 2018 +0200

    Ensure fastparser thread is joined in case of exceptions.
    
    Change-Id: Ie0fb21776514a9a67e9fdff2ae856392cd711adb
    Reviewed-on: https://gerrit.libreoffice.org/60361
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index a2b1e38b79fb..2c730685f526 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -744,6 +744,7 @@ namespace
     private:
         FastSaxParserImpl& m_rParser;
         Entity& m_rEntity;
+        rtl::Reference<ParserThread> m_xParser;
     public:
         ParserCleanup(FastSaxParserImpl& rParser, Entity& rEntity)
             : m_rParser(rParser)
@@ -759,6 +760,20 @@ namespace
                 xmlFreeParserCtxt(m_rEntity.mpParser);
             }
             m_rParser.popEntity();
+            joinThread();
+        }
+        void setThread(const rtl::Reference<ParserThread> &xParser)
+        {
+            m_xParser = xParser;
+        }
+        void joinThread()
+        {
+            if (m_xParser.is())
+            {
+                rtl::Reference<ParserThread> xToJoin = m_xParser;
+                m_xParser.clear();
+                xToJoin->join();
+            }
         }
     };
 }
@@ -799,6 +814,7 @@ void FastSaxParserImpl::parseStream(const InputSource& rStructSource)
     {
         rtl::Reference<ParserThread> xParser;
         xParser = new ParserThread(this);
+        aEnsureFree.setThread(xParser);
         xParser->launch();
         bool done = false;
         do {
@@ -840,7 +856,7 @@ void FastSaxParserImpl::parseStream(const InputSource& rStructSource)
                 rEntity.maUsedEvents.push(std::move(xEventList));
             }
         } while (!done);
-        xParser->join();
+        aEnsureFree.joinThread();
         deleteUsedEvents();
 
         // callbacks used inside XML_Parse may have caught an exception
commit ec06ffdfd54b1f6997f905f9252cecabde3a1c5a
Author:     Gabor Kelemen <kelemeng at ubuntu.com>
AuthorDate: Tue Sep 11 19:10:32 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Sep 12 09:43:41 2018 +0200

    tdf#42949 Fix IWYU warnings in chart2/source/controller/[a,i,m,s]*/*hxx
    
    Found with bin/find-unneeded-includes
    Only removal proposals are dealt with here.
    
    Change-Id: I5f445522e9a1ccd60555e992adf345b254b2ac83
    Reviewed-on: https://gerrit.libreoffice.org/60335
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/chart2/IwyuFilter_chart2.yaml b/chart2/IwyuFilter_chart2.yaml
index f3899404d2c8..f95575b0282c 100644
--- a/chart2/IwyuFilter_chart2.yaml
+++ b/chart2/IwyuFilter_chart2.yaml
@@ -393,3 +393,50 @@ blacklist:
     chart2/source/controller/inc/RangeSelectionHelper.hxx:
     # base class has to be a complete type
     - com/sun/star/uno/Sequence.h
+    chart2/source/controller/inc/RangeSelectionListener.hxx:
+    # base class has to be a complete type
+    - com/sun/star/sheet/XRangeSelectionListener.hpp
+    chart2/source/controller/accessibility/AccessibleChartShape.hxx:
+    # base class has to be a complete type
+    - AccessibleBase.hxx
+    - com/sun/star/accessibility/XAccessibleExtendedComponent.hpp
+    chart2/source/controller/accessibility/AccessibleChartElement.hxx:
+    # base class has to be a complete type
+    - AccessibleBase.hxx
+    - com/sun/star/accessibility/XAccessibleExtendedComponent.hpp
+    chart2/source/controller/main/ChartModelClone.hxx:
+    # Needed for implicit dtor
+    - com/sun/star/uno/Any.hxx
+    chart2/source/controller/main/ChartFrameloader.hxx:
+    # base class has to be a complete type
+    - com/sun/star/frame/XSynchronousFrameLoader.hpp
+    - com/sun/star/lang/XServiceInfo.hpp
+    chart2/source/controller/main/CommandDispatch.hxx:
+    # base class has to be a complete type
+    - com/sun/star/frame/XDispatch.hpp
+    - com/sun/star/util/XModifyListener.hpp
+    - comphelper/interfacecontainer2.hxx
+    chart2/source/controller/main/ControllerCommandDispatch.hxx:
+    # base class has to be a complete type
+    - CommandDispatch.hxx
+    - com/sun/star/view/XSelectionChangeListener.hpp
+    chart2/source/controller/main/ElementSelector.hxx:
+    # base class has to be a complete type
+    - com/sun/star/lang/XServiceInfo.hpp
+    chart2/source/controller/main/StatusBarCommandDispatch.hxx:
+    # base class has to be a complete type
+    - CommandDispatch.hxx
+    - com/sun/star/view/XSelectionChangeListener.hpp
+    chart2/source/controller/main/UndoActions.hxx:
+    # base class has to be a complete type
+    - com/sun/star/document/XUndoAction.hpp
+    chart2/source/controller/sidebar/Chart2PanelFactory.hxx:
+    # base class has to be a complete type
+    - com/sun/star/ui/XUIElementFactory.hpp
+    - com/sun/star/lang/XServiceInfo.hpp
+    chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx:
+    # base class has to be a complete type
+    - com/sun/star/util/XModifyListener.hpp
+    chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx:
+    # base class has to be a complete type
+    - com/sun/star/view/XSelectionChangeListener.hpp
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
index a126bc134cfb..b66d59b114e5 100644
--- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
@@ -25,10 +25,12 @@
 
 #include <com/sun/star/awt/XDevice.hpp>
 #include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/beans/XMultiPropertySet.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.hxx b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
index 1e79f684b84c..e4b8f9cd3d53 100644
--- a/chart2/source/controller/accessibility/AccessibleChartElement.hxx
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
@@ -20,24 +20,11 @@
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLECHARTELEMENT_HXX
 
 #include <AccessibleBase.hxx>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/document/XEventListener.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <comphelper/accessibleeventnotifier.hxx>
-#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
-
-#include <vector>
-#include <map>
+
+namespace com { namespace sun { namespace star { namespace accessibility { class XAccessible; } } } }
+namespace com { namespace sun { namespace star { namespace accessibility { class XAccessibleContext; } } } }
+namespace com { namespace sun { namespace star { namespace awt { class XFont; } } } }
 
 namespace chart
 {
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.hxx b/chart2/source/controller/accessibility/ChartElementFactory.hxx
index 9a59a8ebdf85..2d0b29b9cb2a 100644
--- a/chart2/source/controller/accessibility/ChartElementFactory.hxx
+++ b/chart2/source/controller/accessibility/ChartElementFactory.hxx
@@ -19,12 +19,11 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_CHARTELEMENTFACTORY_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_CHARTELEMENTFACTORY_HXX
 
-#include <AccessibleBase.hxx>
-
 namespace chart
 {
 
 class AccessibleBase;
+struct AccessibleElementInfo;
 
 class ChartElementFactory
 {
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
index 8ec702ff8813..b8c85f61c046 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -19,15 +19,10 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_ITEMSETWRAPPER_SCHWHICHPAIRS_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_ITEMSETWRAPPER_SCHWHICHPAIRS_HXX
 
-#include <svl/intitem.hxx>
-#include <svl/ilstitem.hxx>
 #include <svx/svxids.hrc>
 #include <svx/xdef.hxx>
 #include <svx/svddef.hxx>
-#include <svx/chrtitem.hxx>
-#include <editeng/brushitem.hxx>
 #include <editeng/eeitem.hxx>
-#include <editeng/sizeitem.hxx>
 
 #include <chartview/ChartSfxItemIds.hxx>
 
diff --git a/chart2/source/controller/main/ChartFrameloader.cxx b/chart2/source/controller/main/ChartFrameloader.cxx
index b55d6ee48f58..00d58ea7f0f3 100644
--- a/chart2/source/controller/main/ChartFrameloader.cxx
+++ b/chart2/source/controller/main/ChartFrameloader.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/document/XImporter.hpp>
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <tools/diagnose_ex.h>
 
 namespace chart
diff --git a/chart2/source/controller/main/ChartFrameloader.hxx b/chart2/source/controller/main/ChartFrameloader.hxx
index a6911dd7710d..9287198aa62b 100644
--- a/chart2/source/controller/main/ChartFrameloader.hxx
+++ b/chart2/source/controller/main/ChartFrameloader.hxx
@@ -22,9 +22,10 @@
 #include <osl/conditn.hxx>
 #include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
 #include <cppuhelper/implbase.hxx>
 
+namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
+
 namespace chart
 {
 
diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx
index 1b2f828d3f79..339547943552 100644
--- a/chart2/source/controller/main/ChartModelClone.cxx
+++ b/chart2/source/controller/main/ChartModelClone.cxx
@@ -24,6 +24,7 @@
 #include <DataSourceHelper.hxx>
 
 #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
 #include <com/sun/star/util/XCloneable.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
diff --git a/chart2/source/controller/main/ChartModelClone.hxx b/chart2/source/controller/main/ChartModelClone.hxx
index a12adda1bc01..8d1dbb0edc55 100644
--- a/chart2/source/controller/main/ChartModelClone.hxx
+++ b/chart2/source/controller/main/ChartModelClone.hxx
@@ -20,8 +20,11 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTMODELCLONE_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTMODELCLONE_HXX
 
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star { namespace chart2 { class XInternalDataProvider; } } } }
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
 
 namespace chart
 {
diff --git a/chart2/source/controller/main/CommandDispatch.hxx b/chart2/source/controller/main/CommandDispatch.hxx
index c21c6b7b8164..761ade94b3fc 100644
--- a/chart2/source/controller/main/CommandDispatch.hxx
+++ b/chart2/source/controller/main/CommandDispatch.hxx
@@ -24,12 +24,12 @@
 #include <comphelper/interfacecontainer2.hxx>
 #include <com/sun/star/frame/XDispatch.hpp>
 #include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
 
-#include <vector>
 #include <map>
 
+namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
+namespace com { namespace sun { namespace star { namespace util { class XURLTransformer; } } } }
+
 namespace chart
 {
 
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/main/ControllerCommandDispatch.hxx
index f0b125444bf6..4e105f86702c 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.hxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx
@@ -20,12 +20,14 @@
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CONTROLLERCOMMANDDISPATCH_HXX
 
 #include "CommandDispatch.hxx"
-#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
 #include <cppuhelper/implbase.hxx>
 #include <rtl/ref.hxx>
 
 #include <memory>
 
+namespace com { namespace sun { namespace star { namespace view { class XSelectionSupplier; } } } }
+
 namespace chart
 {
 
diff --git a/chart2/source/controller/main/DragMethod_Base.cxx b/chart2/source/controller/main/DragMethod_Base.cxx
index 1739833ed94b..9d8a2b6d84b0 100644
--- a/chart2/source/controller/main/DragMethod_Base.cxx
+++ b/chart2/source/controller/main/DragMethod_Base.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "DragMethod_Base.hxx"
+#include <DrawViewWrapper.hxx>
 
 #include <ObjectNameProvider.hxx>
 #include <ObjectIdentifier.hxx>
diff --git a/chart2/source/controller/main/DragMethod_Base.hxx b/chart2/source/controller/main/DragMethod_Base.hxx
index a25457a37ae4..d9fc78d72be9 100644
--- a/chart2/source/controller/main/DragMethod_Base.hxx
+++ b/chart2/source/controller/main/DragMethod_Base.hxx
@@ -19,11 +19,13 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_BASE_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_DRAGMETHOD_BASE_HXX
 
-#include <DrawViewWrapper.hxx>
 #include <svx/ActionDescriptionProvider.hxx>
 #include <svx/svddrgmt.hxx>
 #include <cppuhelper/weakref.hxx>
 
+namespace chart { class DrawViewWrapper; }
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
+
 namespace chart
 {
 
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx
index 4731c8252ee7..c150e7b297c9 100644
--- a/chart2/source/controller/main/DragMethod_PieSegment.cxx
+++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "DragMethod_PieSegment.hxx"
+#include <DrawViewWrapper.hxx>
 
 #include <strings.hrc>
 #include <ResId.hxx>
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
index a2a46befe667..87415cdcaee2 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "DragMethod_RotateDiagram.hxx"
+#include <DrawViewWrapper.hxx>
 
 #include <SelectionHelper.hxx>
 #include <CommonConverters.hxx>
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.hxx b/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
index 286078ebfcc7..863e7559f3b3 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
@@ -23,6 +23,9 @@
 
 #include <basegfx/polygon/b3dpolypolygon.hxx>
 
+class E3dScene;
+namespace chart { class DrawViewWrapper; }
+
 namespace chart
 {
 
diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx
index ab1818bf1e15..e59984e709fa 100644
--- a/chart2/source/controller/main/ElementSelector.hxx
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_ELEMENTSELECTOR_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_ELEMENTSELECTOR_HXX
 
-#include <ObjectHierarchy.hxx>
+#include <ObjectIdentifier.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/implbase1.hxx>
 #include <svtools/toolboxcontroller.hxx>
diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
index 6d06c63d240a..b6ed23d3d073 100644
--- a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
+++ b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
@@ -22,7 +22,6 @@
 #include "CommandDispatch.hxx"
 
 #include <com/sun/star/frame/DispatchInformation.hpp>
-#include <com/sun/star/util/URL.hpp>
 
 namespace chart
 {
diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.cxx b/chart2/source/controller/main/StatusBarCommandDispatch.cxx
index 63766b9b49ed..fc4d71b40906 100644
--- a/chart2/source/controller/main/StatusBarCommandDispatch.cxx
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.cxx
@@ -21,6 +21,8 @@
 #include <ObjectNameProvider.hxx>
 #include <com/sun/star/util/XModifyBroadcaster.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
 
 using namespace ::com::sun::star;
 
diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.hxx b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
index de2f61b2a6c0..6c3734154ecf 100644
--- a/chart2/source/controller/main/StatusBarCommandDispatch.hxx
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
@@ -22,9 +22,11 @@
 #include "CommandDispatch.hxx"
 #include <ObjectIdentifier.hxx>
 #include <cppuhelper/implbase.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
+namespace com { namespace sun { namespace star { namespace util { class XModifiable; } } } }
+namespace com { namespace sun { namespace star { namespace view { class XSelectionSupplier; } } } }
 
 namespace chart
 {
diff --git a/chart2/source/controller/main/UndoActions.hxx b/chart2/source/controller/main/UndoActions.hxx
index f1ecf3ee131a..598bf4f25430 100644
--- a/chart2/source/controller/main/UndoActions.hxx
+++ b/chart2/source/controller/main/UndoActions.hxx
@@ -19,17 +19,15 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
 
-#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/document/XUndoAction.hpp>
 
 #include <rtl/ustring.hxx>
-#include <unotools/configitem.hxx>
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/basemutex.hxx>
 
 #include <memory>
-#include <deque>
-#include <utility>
+
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
 
 class SdrUndoAction;
 
diff --git a/chart2/source/controller/main/UndoCommandDispatch.hxx b/chart2/source/controller/main/UndoCommandDispatch.hxx
index db6e299c0efd..60a8273135b4 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.hxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.hxx
@@ -21,8 +21,8 @@
 
 #include "CommandDispatch.hxx"
 
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/document/XUndoManager.hpp>
+namespace com { namespace sun { namespace star { namespace document { class XUndoManager; } } } }
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
 
 namespace chart
 {
diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx
index 2bb5008dde09..ec6f97b0b3ca 100644
--- a/chart2/source/controller/main/UndoGuard.cxx
+++ b/chart2/source/controller/main/UndoGuard.cxx
@@ -22,6 +22,8 @@
 #include "UndoActions.hxx"
 
 #include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 
 #include <tools/diagnose_ex.h>
 
diff --git a/chart2/source/controller/main/UndoGuard.hxx b/chart2/source/controller/main/UndoGuard.hxx
index b8ade04817d8..5f3331ed63c0 100644
--- a/chart2/source/controller/main/UndoGuard.hxx
+++ b/chart2/source/controller/main/UndoGuard.hxx
@@ -21,13 +21,13 @@
 
 #include "ChartModelClone.hxx"
 
-#include <com/sun/star/document/XUndoManager.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-
 #include <rtl/ustring.hxx>
 
 #include <memory>
 
+namespace com { namespace sun { namespace star { namespace document { class XUndoManager; } } } }
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
+
 namespace chart
 {
 
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.hxx b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
index 14570c143a88..4a1b043c1130 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
@@ -21,7 +21,6 @@
 
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/basemutex.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/ui/XUIElementFactory.hpp>
 
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index 234a23e4f392..454c99a86851 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -10,20 +10,11 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAREAPANEL_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAREAPANEL_HXX
 
-#include <vcl/ctrl.hxx>
-#include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/SidebarModelUpdate.hxx>
-#include <svx/xgrad.hxx>
-#include <svx/itemwin.hxx>
 #include <svx/xfillit0.hxx>
-#include <svx/xflclit.hxx>
 #include <svx/xflgrit.hxx>
 #include <svx/xflhtit.hxx>
 #include <svx/xbtmpit.hxx>
-#include <svx/drawitem.hxx>
-#include <svx/sidebar/PanelLayout.hxx>
-#include <svl/intitem.hxx>
-#include <com/sun/star/ui/XUIElement.hpp>
 
 #include <svx/sidebar/AreaPropertyPanelBase.hxx>
 
@@ -33,11 +24,7 @@
 
 class XFillFloatTransparenceItem;
 class XFillTransparenceItem;
-class XFillStyleItem;
-class XFillGradientItem;
 class XFillColorItem;
-class XFillHatchItem;
-class XFillBitmapItem;
 
 namespace chart {
 
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index a6fe43feb11f..2b651d8d95f6 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -20,10 +20,9 @@
 #include "ChartSidebarModifyListener.hxx"
 #include "ChartSidebarSelectionListener.hxx"
 
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/view/XSelectionChangeListener.hpp>
+namespace com { namespace sun { namespace star { namespace util { class XModifyListener; } } } }
+namespace com { namespace sun { namespace star { namespace view { class XSelectionChangeListener; } } } }
 
-class FixedText;
 class ListBox;
 class MetricField;
 
diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.hxx b/chart2/source/controller/sidebar/ChartColorWrapper.hxx
index 9237bf36e218..05b0e9f38fea 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx
@@ -10,10 +10,11 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTCOLORWRAPPER_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTCOLORWRAPPER_HXX
 
-#include <com/sun/star/frame/XModel.hpp>
-#include <tools/color.hxx>
+#include <com/sun/star/uno/Reference.hxx>
 #include <svx/Palette.hxx>
 
+namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
+
 class SvxColorToolBoxControl;
 
 namespace chart { namespace sidebar {
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 512749246a24..eca293645cc4 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -19,7 +19,6 @@
 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTELEMENTSPANEL_HXX
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTELEMENTSPANEL_HXX
 
-#include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
 #include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
@@ -27,11 +26,9 @@
 #include "ChartSidebarModifyListener.hxx"
 #include <TitleHelper.hxx>
 
-#include <com/sun/star/util/XModifyListener.hpp>
+namespace com { namespace sun { namespace star { namespace util { class XModifyListener; } } } }
 
-class FixedText;
 class ListBox;
-class NumericField;
 
 namespace chart {
 
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index 5a55b7402293..f4dec42c5521 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -18,12 +18,10 @@
 
 #include "ChartSidebarModifyListener.hxx"
 
-#include <com/sun/star/util/XModifyListener.hpp>
+namespace com { namespace sun { namespace star { namespace util { class XModifyListener; } } } }
 
-class FixedText;
 class ListBox;
 class NumericField;
-class MetricField;
 class Edit;
 
 namespace chart {
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx
index 6222a1ddfa55..c0b3d19fd579 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.hxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list