diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-09-12 10:30:05 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-01-25 23:50:10 +0100 |
commit | 9f805c1bb028c9e193c2c9e4d2b2714af28dedb3 (patch) | |
tree | dce942cb8c7b4e3d793bbca860ebf9b255fc9e88 | |
parent | b0b089e8f7a6df793761bdec6ee9d98b1bf12a5a (diff) |
Qt5 build VCL plugin on Windows
Change-Id: I1bb673eb2c228d767caca6a9a860bd9d113d082f
28 files changed, 267 insertions, 43 deletions
diff --git a/Repository.mk b/Repository.mk index 4ae85285c7d0..f97de31dd93a 100644 --- a/Repository.mk +++ b/Repository.mk @@ -475,6 +475,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 5bd9b4b98fe4..5a6875756b94 100644 --- a/config_host/config_vclplug.h.in +++ b/config_host/config_vclplug.h.in @@ -10,5 +10,6 @@ Settings about which X11 desktops have support enabled. #define ENABLE_GTK 0 #define ENABLE_KDE5 0 #define ENABLE_GTK3_KDE5 0 +#define ENABLE_QT5 0 #endif diff --git a/configure.ac b/configure.ac index 16666c887612..99687dec8119 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" @@ -4681,7 +4682,6 @@ if test "$USING_X11" != TRUE; then build_gstreamer_1_0=no build_gstreamer_0_10=no test_kde5=no - test_qt5=no test_gtk3_kde5=no enable_cairo_canvas=no fi @@ -10094,10 +10094,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 + case "$_os" in + WINNT) R="win" ;; + esac fi + GTK3_CFLAGS="" GTK3_LIBS="" ENABLE_GTK3="" @@ -10108,7 +10114,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) @@ -10960,7 +10966,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] ) @@ -10982,6 +10992,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" @@ -11011,7 +11025,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/CustomTarget_qt5_macosx_rpath.mk b/vcl/CustomTarget_qt5_macosx_rpath.mk new file mode 100644 index 000000000000..49ffac57cb33 --- /dev/null +++ b/vcl/CustomTarget_qt5_macosx_rpath.mk @@ -0,0 +1,22 @@ +# -*- 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/. +# + +$(eval $(call gb_CustomTarget_CustomTarget,vcl/qt5)) + +#$(call gb_CustomTarget_get_target,vcl/qt5) : \ +# $(call gb_LinkTarget_get_target,vclplug_qt5).rpath +# $(call gb_LinkTarget__get_workdir_linktargetname,vclplug_qt5) + +#$(call gb_CustomTarget_get_workdir,$(INSTROOT)/program/)/%.moc : \ +# $(SRCDIR)/vcl/inc/qt5/%.hxx \ +# | $(call gb_CustomTarget_get_workdir,vcl/qt5)/.dir +# $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),RPATH,1) +# install_name_tool -add_rpath $(QT5_LIBDIR) + +# vim: set noet sw=4: diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk index f7fbfd1cdbdb..0d3a522b1b62 100644 --- a/vcl/Library_vclplug_qt5.mk +++ b/vcl/Library_vclplug_qt5.mk @@ -35,6 +35,7 @@ $(eval $(call gb_Library_use_sdk_api,vclplug_qt5)) $(eval $(call gb_Library_use_libraries,vclplug_qt5,\ $(if $(USING_X11),vclplug_gen) \ + $(if $(filter WNT,$(OS)),vclplug_win) \ vcl \ tl \ utl \ @@ -54,7 +55,7 @@ $(eval $(call gb_Library_use_libraries,vclplug_qt5,\ $(eval $(call gb_Library_use_externals,vclplug_qt5,\ boost_headers \ - cairo \ + $(if $(USING_X11),cairo) \ epoxy \ graphite \ harfbuzz \ @@ -102,7 +103,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ vcl/qt5/Qt5OpenGLContext \ vcl/qt5/Qt5Painter \ vcl/qt5/Qt5Printer \ - vcl/qt5/Qt5System \ + $(if $(USING_X11),vcl/qt5/Qt5System) \ vcl/qt5/Qt5Timer \ vcl/qt5/Qt5Tools \ vcl/qt5/Qt5VirtualDevice \ @@ -112,9 +113,9 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_libs,vclplug_qt5,\ - -lm \ - -ldl \ - -lpthread \ + -lm \ + -ldl \ + -lpthread \ )) endif diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 95dd579c38de..7b4951e38160 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -108,6 +108,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 ef537d0c040f..9d64d566274f 100644 --- a/vcl/inc/qt5/Qt5Data.hxx +++ b/vcl/inc/qt5/Qt5Data.hxx @@ -28,17 +28,22 @@ class QCursor; -class VCLPLUG_QT5_PUBLIC Qt5Data : public GenericUnixSalData +class VCLPLUG_QT5_PUBLIC Qt5Data +#ifndef _WIN32 + : public GenericUnixSalData +#else + : public SalData +#endif { o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors; public: explicit Qt5Data(SalInstance* pInstance); virtual ~Qt5Data() override; - +#ifndef _WIN32 virtual void ErrorTrapPush() override; virtual bool ErrorTrapPop(bool bIgnoreError = true) override; - +#endif QCursor& getCursor(PointerStyle ePointerStyle); static bool noNativeControls(); diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx index e88c1ead3d85..1f9e6477cf48 100644 --- a/vcl/inc/qt5/Qt5Frame.hxx +++ b/vcl/inc/qt5/Qt5Frame.hxx @@ -24,7 +24,9 @@ #include "Qt5Tools.hxx" +#ifndef _WIN32 #include <headless/svpgdi.hxx> +#endif #include <vcl/svapp.hxx> #include <vcl/sysdata.hxx> @@ -42,6 +44,18 @@ class QScreen; class QImage; class SvpSalGraphics; +#ifdef _WIN32 +typedef void (*damageHandler)(void* handle, + sal_Int32 nExtentsX, sal_Int32 nExtentsY, + sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight); + +struct VCL_DLLPUBLIC DamageHandler +{ + void *handle; + damageHandler damaged; +}; +#endif + class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame { Q_OBJECT @@ -54,12 +68,14 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame const bool m_bUseCairo; std::unique_ptr<QImage> m_pQImage; std::unique_ptr<Qt5Graphics> m_pQt5Graphics; +#ifndef _WIN32 UniqueCairoSurface m_pSurface; std::unique_ptr<SvpSalGraphics> m_pOurSvpGraphics; // in base class, this ptr is the same as m_pOurSvpGraphic // in derived class, it can point to a derivative // of SvpSalGraphics (which the derived class then owns) SvpSalGraphics* m_pSvpGraphics; +#endif DamageHandler m_aDamageHandler; QRegion m_aRegion; bool m_bNullRegion; @@ -121,7 +137,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 b11f926f72bb..f44923d6b781 100644 --- a/vcl/inc/qt5/Qt5Graphics.hxx +++ b/vcl/inc/qt5/Qt5Graphics.hxx @@ -30,6 +30,10 @@ #include "Qt5Data.hxx" #include "Qt5Graphics_Controls.hxx" +#ifdef _WIN32 +#include <QtWidgets/QPushButton> +#endif + class PhysicalFontCollection; class QImage; class QPushButton; diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx index 91682bd87950..b5f52c041932 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,42 @@ class QApplication; class SalYieldMutex; class SalFrame; +#ifdef _WIN32 +#include <salinst.hxx> +#include <comphelper/solarmutex.hxx> +#include <memory> +#include <unordered_map> +#else +#include <unx/geninst.h> +#endif + +// Qts moc doesn't like macros, so this is handled by an extra base class +// It also keeps all the #ifdef handling local +class VCLPLUG_QT5_PUBLIC Qt5MocInstance +#ifdef _WIN32 + : public SalInstance +#else + : public SalGenericInstance +#endif +{ +public: + Qt5MocInstance() +#ifdef _WIN32 + : SalInstance(o3tl::make_unique<comphelper::SolarMutex>()) +#else + : SalGenericInstance(o3tl::make_unique<SalYieldMutex>()) +#endif + { + } + +#ifndef _WIN32 + virtual GenPspGraphics* CreatePrintGraphics() override; + virtual void PostPrintersChanged() override; +#endif +}; + class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject, - public SalGenericInstance, + public Qt5MocInstance, public SalUserEventList { Q_OBJECT @@ -79,7 +113,6 @@ public: virtual void GetPrinterQueueInfo(ImplPrnQueueList* pList) override; virtual void GetPrinterQueueState(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; @@ -98,8 +131,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 57bf94793955..5fe9444e2960 100644 --- a/vcl/inc/qt5/Qt5Tools.hxx +++ b/vcl/inc/qt5/Qt5Tools.hxx @@ -94,7 +94,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) @@ -114,10 +116,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 { @@ -125,6 +130,7 @@ struct CairoDeleter }; typedef std::unique_ptr<cairo_surface_t, CairoDeleter> UniqueCairoSurface; +#endif sal_uInt16 GetKeyModCode(Qt::KeyboardModifiers eKeyModifiers); sal_uInt16 GetMouseModCode(Qt::MouseButtons eButtons); diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index c0c6e7fb7932..ef8737acc1f4 100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -70,7 +70,7 @@ public: }; -class WinSalPrinter : public SalPrinter +class SAL_DLLPUBLIC_EXPORT WinSalPrinter : public SalPrinter { public: WinSalGraphics* mpGraphics; // current Printer graphics diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h index 03f627b5abb2..59f087136b79 100644 --- a/vcl/inc/win/salsys.h +++ b/vcl/inc/win/salsys.h @@ -25,7 +25,7 @@ #include <vector> #include <map> -class WinSalSystem : public SalSystem +class SAL_DLLPUBLIC_EXPORT WinSalSystem : public SalSystem { public: struct DisplayMonitor diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx index 1830dab0e523..1e2166a34c72 100644 --- a/vcl/qt5/Qt5Data.cxx +++ b/vcl/qt5/Qt5Data.cxx @@ -149,11 +149,21 @@ #include <unx/x11_cursors/wsshow_curs.h> #include <unx/x11_cursors/wsshow_mask.h> +#ifndef _WIN32 #include <unx/glyphcache.hxx> +#endif Qt5Data::Qt5Data(SalInstance* pInstance) +#ifndef _WIN32 : GenericUnixSalData(SAL_DATA_QT5, pInstance) +#else + : SalData() +#endif { +#ifdef _WIN32 + m_pInstance = pInstance; + SetSalData(this); +#endif ImplSVData* pSVData = ImplGetSVData(); // draw toolbars on separate lines @@ -308,9 +318,11 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle) return *m_aCursors[ePointerStyle]; } +#ifndef _WIN32 void Qt5Data::ErrorTrapPush() {} bool Qt5Data::ErrorTrapPop(bool /*bIgnoreError*/) { return false; } +#endif bool Qt5Data::noNativeControls() { diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index e3ced2dec236..285eba74d079 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -48,8 +48,10 @@ #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> +#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) @@ -58,10 +60,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) @@ -143,13 +147,12 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) maGeometry.nRightDecoration = 0; } +#ifndef _WIN32 m_aSystemData.nSize = sizeof(SystemEnvData); m_aSystemData.aWindow = m_pQWidget->winId(); m_aSystemData.aShellWindow = reinterpret_cast<sal_IntPtr>(this); - //m_aSystemData.pSalFrame = this; - //m_aSystemData.pWidget = m_pQWidget; - //m_aSystemData.nScreen = m_nXScreen.getXScreen(); m_aSystemData.pToolkit = "qt5"; +#endif } Qt5Frame::~Qt5Frame() @@ -160,7 +163,10 @@ Qt5Frame::~Qt5Frame() delete m_pTopLevel; else delete m_pQWidget; + +#ifndef _WIN32 m_aSystemData.aShellWindow = 0; +#endif } void Qt5Frame::Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, @@ -182,6 +188,7 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect) CallCallback(SalEvent::Paint, &aPaintEvt); } +#ifndef _WIN32 void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics) { int width = 640; @@ -192,6 +199,7 @@ void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics) cairo_surface_set_user_data(m_pSurface.get(), SvpSalGraphics::getDamageKey(), &m_aDamageHandler, nullptr); } +#endif SalGraphics* Qt5Frame::AcquireGraphics() { @@ -200,6 +208,7 @@ SalGraphics* Qt5Frame::AcquireGraphics() m_bGraphicsInUse = true; +#ifndef _WIN32 if (m_bUseCairo) { if (!m_pOurSvpGraphics.get()) @@ -210,6 +219,7 @@ SalGraphics* Qt5Frame::AcquireGraphics() return m_pOurSvpGraphics.get(); } else +#endif { if (!m_pQt5Graphics.get()) { @@ -225,9 +235,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 8763752c0615..00b039b910a9 100644 --- a/vcl/qt5/Qt5Graphics_Controls.cxx +++ b/vcl/qt5/Qt5Graphics_Controls.cxx @@ -595,9 +595,7 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part, } else if (type == ControlType::Progress && part == ControlPart::Entire) { - SAL_WNODEPRECATED_DECLARATIONS_PUSH - QStyleOptionProgressBarV2 option; - SAL_WNODEPRECATED_DECLARATIONS_POP + QStyleOptionProgressBar option; option.minimum = 0; option.maximum = widgetRect.width(); option.progress = value.getNumericVal(); @@ -801,6 +799,7 @@ bool Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart retVal = true; break; default: + h = 0; w = 0; break; } if (retVal) diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index 87bdb054655f..4028614c36f7 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -24,10 +24,12 @@ #include <o3tl/make_unique.hxx> #include <vcl/fontcharmap.hxx> +#ifndef _WIN32 #include <unx/geninst.h> #include <unx/fontmanager.hxx> #include <unx/glyphcache.hxx> #include <unx/genpspgraphics.h> +#endif #include <sallayout.hxx> #include <PhysicalFontCollection.hxx> @@ -91,13 +93,16 @@ 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()) return; QFontDatabase aFDB; +#ifndef _WIN32 QStringList aFontFamilyList; if (bUseFontconfig) aFontFamilyList = aFDB.families(); @@ -136,6 +141,8 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC) if (bUseFontconfig) 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 dceb97d89f6d..5d130dfd45be 100644 --- a/vcl/qt5/Qt5Instance.cxx +++ b/vcl/qt5/Qt5Instance.cxx @@ -50,7 +50,7 @@ #include <headless/svpbmp.hxx> Qt5Instance::Qt5Instance(bool bUseCairo) - : SalGenericInstance(o3tl::make_unique<SalYieldMutex>()) + : Qt5MocInstance() , m_postUserEventId(-1) , m_bUseCairo(bUseCairo) { @@ -104,6 +104,7 @@ std::unique_ptr<SalVirtualDevice> Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, DeviceFormat eFormat, const SystemGraphicsData* /* pData */) { +#ifndef _WIN32 if (m_bUseCairo) { SvpSalGraphics* pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics); @@ -114,6 +115,9 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, D return pVD; } else +#else + (void)pGraphics; +#endif { std::unique_ptr<SalVirtualDevice> pVD(new Qt5VirtualDevice(eFormat, 1)); pVD->SetSize(nDX, nDY); @@ -145,9 +149,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>(); } @@ -316,23 +322,27 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance() for (int i = 0; i < nFakeArgc; i++) pFakeArgv[i] = pFakeArgvFreeable[i]; +#ifndef _WIN32 char* session_manager = nullptr; if (getenv("SESSION_MANAGER") != nullptr) { session_manager = strdup(getenv("SESSION_MANAGER")); unsetenv("SESSION_MANAGER"); } +#endif int* pFakeArgc = new int; *pFakeArgc = nFakeArgc; pQApplication = new QApplication(*pFakeArgc, pFakeArgv); +#ifndef _WIN32 if (session_manager != nullptr) { // coverity[tainted_string] - trusted source for setenv setenv("SESSION_MANAGER", session_manager, 1); free(session_manager); } +#endif QApplication::setQuitOnLastWindowClosed(false); diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx index 1a0410844976..0eb8a30cdce5 100644 --- a/vcl/qt5/Qt5Instance_Print.cxx +++ b/vcl/qt5/Qt5Instance_Print.cxx @@ -20,23 +20,26 @@ #include <Qt5Instance.hxx> #include <Qt5Printer.hxx> +#ifndef _WIN32 #include <vcl/svapp.hxx> #include <vcl/timer.hxx> -#include <printerinfomanager.hxx> #include <jobset.h> #include <print.h> -#include <salptype.hxx> #include <saldatabasic.hxx> +#include <salptype.hxx> +#include <printerinfomanager.hxx> #include <unx/genpspgraphics.h> using namespace psp; +#endif /* * static helpers */ +#ifndef _WIN32 static OUString getPdfDir(const PrinterInfo& rInfo) { OUString aDir; @@ -55,30 +58,42 @@ static OUString getPdfDir(const PrinterInfo& rInfo) } return aDir; } +#endif SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pJobSetup) { +#ifndef _WIN32 // create and initialize SalInfoPrinter PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter; configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup); return pPrinter; +#else + (void)pQueueInfo; (void)pJobSetup; + return nullptr; +#endif } void Qt5Instance::DestroyInfoPrinter(SalInfoPrinter* pPrinter) { delete pPrinter; } std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrinter) { +#ifndef _WIN32 // create and initialize SalPrinter Qt5Printer* pPrinter = new Qt5Printer(pInfoPrinter); pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData; return std::unique_ptr<SalPrinter>(pPrinter); +#else + (void)pInfoPrinter; + return std::unique_ptr<SalPrinter>(); +#endif } void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList) { +#ifndef _WIN32 PrinterInfoManager& rManager(PrinterInfoManager::get()); static const char* pNoSyncDetection = getenv("SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION"); if (!pNoSyncDetection || !*pNoSyncDetection) @@ -112,18 +127,27 @@ void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList) pList->Add(std::move(pInfo)); } +#else + (void)pList; +#endif } 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/Qt5Object.cxx b/vcl/qt5/Qt5Object.cxx index e498283ef1ee..df1a4e5504d7 100644 --- a/vcl/qt5/Qt5Object.cxx +++ b/vcl/qt5/Qt5Object.cxx @@ -38,13 +38,12 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow) if (bShow) m_pQWidget->show(); +#ifndef _WIN32 m_aSystemData.nSize = sizeof(SystemEnvData); m_aSystemData.aWindow = pParent->GetQWidget()->winId(); m_aSystemData.aShellWindow = reinterpret_cast<sal_IntPtr>(this); - //m_aSystemData.pSalFrame = this; - //m_aSystemData.pWidget = m_pQWidget; - //m_aSystemData.nScreen = m_nXScreen.getXScreen(); m_aSystemData.pToolkit = "qt5"; +#endif } void Qt5Object::ResetClipRegion() 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..354045efb437 100644 --- a/vcl/qt5/Qt5Printer.cxx +++ b/vcl/qt5/Qt5Printer.cxx @@ -17,10 +17,20 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <svsys.h> +#include <salptype.hxx> + +#include <rtl/ustring.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 6d75cd60df73..4dad8b3bda20 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -39,17 +39,21 @@ #include <QtWidgets/QToolTip> #include <QtWidgets/QWidget> -#include <cairo.h> -#include <headless/svpgdi.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> +#ifndef _WIN32 +#include <cairo.h> +#include <headless/svpgdi.hxx> +#endif + void Qt5Widget::paintEvent(QPaintEvent* pEvent) { QPainter p(this); 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(); @@ -60,11 +64,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* pEvent) { +#ifndef _WIN32 if (m_pFrame->m_bUseCairo) { int width = size().width(); @@ -89,6 +95,7 @@ void Qt5Widget::resizeEvent(QResizeEvent* pEvent) } } else +#endif { QImage* pImage = nullptr; @@ -297,9 +304,11 @@ static sal_uInt16 GetKeyCode(int keyval) case Qt::Key_Insert: nCode = KEY_INSERT; break; +#ifndef _WIN32 case Qt::Key_Delete: nCode = KEY_DELETE; break; +#endif case Qt::Key_Plus: nCode = KEY_ADD; break; |