[Libreoffice-commits] core.git: Branch 'feature/qt5-win' - 2 commits - config_host/config_vclplug.h.in configure.ac include/vcl Repository.mk vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_win.mk vcl/Module_vcl.mk vcl/qt5 vcl/win
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 12 08:45:54 UTC 2018
Rebased ref, commits from common ancestor:
commit 96e80d95d74ee419a7caf04d2d044f4dd6c495f2
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 10:33:13 2018 +0200
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 9861188660e2..1058d0dedf3e 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"
@@ -4679,7 +4680,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
@@ -9960,10 +9960,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=""
@@ -9974,7 +9980,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)
@@ -11109,7 +11115,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] )
@@ -11131,6 +11141,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"
@@ -11160,7 +11174,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..3364952d7c5c 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 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 12c294752f46b3da624140fc26546c24d4923bc8
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:33:13 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: */
More information about the Libreoffice-commits
mailing list