diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-09-13 11:32:12 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-01-25 23:50:12 +0100 |
commit | d2da9dd4ef3b56a0491022c3469957339c161123 (patch) | |
tree | 1ece6c3df0f908e7935b3ac4a620337a2d0e4ec0 | |
parent | 9f805c1bb028c9e193c2c9e4d2b2714af28dedb3 (diff) |
Qt5 build VCL plugin on MacOSX
Change-Id: I6ddec483703c95faf69b7b146363376765d5d6f8
-rw-r--r-- | Repository.mk | 1 | ||||
-rw-r--r-- | configure.ac | 131 | ||||
-rw-r--r-- | include/vcl/dllapi.h | 2 | ||||
-rw-r--r-- | vcl/Library_vclplug_osx.mk | 1 | ||||
-rw-r--r-- | vcl/Library_vclplug_qt5.mk | 32 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 6 | ||||
-rw-r--r-- | vcl/inc/osx/salprn.h | 5 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Data.hxx | 8 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Frame.hxx | 8 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Instance.hxx | 8 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Printer.hxx | 23 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5System.hxx | 22 | ||||
-rw-r--r-- | vcl/qt5/Qt5Data.cxx | 12 | ||||
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 14 | ||||
-rw-r--r-- | vcl/qt5/Qt5Graphics_Text.cxx | 6 | ||||
-rw-r--r-- | vcl/qt5/Qt5Instance.cxx | 8 | ||||
-rw-r--r-- | vcl/qt5/Qt5Instance_Print.cxx | 14 | ||||
-rw-r--r-- | vcl/qt5/Qt5Instance_Print.mm | 20 | ||||
-rw-r--r-- | vcl/qt5/Qt5Object.cxx | 2 | ||||
-rw-r--r-- | vcl/qt5/Qt5Printer.cxx | 11 | ||||
-rw-r--r-- | vcl/qt5/Qt5Printer.mm | 20 | ||||
-rw-r--r-- | vcl/qt5/Qt5Tools.cxx | 2 | ||||
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 6 |
23 files changed, 252 insertions, 110 deletions
diff --git a/Repository.mk b/Repository.mk index f97de31dd93a..ddb396717fbe 100644 --- a/Repository.mk +++ b/Repository.mk @@ -484,6 +484,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ AppleRemote \ ) \ fps_aqua \ + $(if $(ENABLE_QT5),vclplug_qt5) \ vclplug_osx \ MacOSXSpell \ ) \ diff --git a/configure.ac b/configure.ac index 99687dec8119..527e24a49c1f 100644 --- a/configure.ac +++ b/configure.ac @@ -671,6 +671,7 @@ darwin*) # macOS or iOS host=x86_64-apple-darwin fi else + test_qt5=yes _os=Darwin INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app INSTROOTCONTENTSUFFIX=/Contents @@ -10101,6 +10102,7 @@ else enable_gtk3=no case "$_os" in WINNT) R="win" ;; + Darwin) R="osx" ;; esac fi @@ -10958,13 +10960,7 @@ if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \ \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \ \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \) then - qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes" - qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries" - - if test -n "$supports_multilib"; then - qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64" - fi - + qt5_fwk_search="QtCore QtGui QtWidgets QtNetwork" qt5_test_include="QtWidgets/qapplication.h" if test $_os == "WINNT"; then qt5_test_library="Qt5Widgets.lib" @@ -10972,12 +10968,25 @@ then qt5_test_library="libQt5Widgets.so" fi + qt5_incdirs="" + qt5_libdirs="" + if test "$USING_X11" = TRUE; then + qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes" + qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries" + if test -n "$supports_multilib"; then + qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64" + fi + fi + dnl Check for qmake5 AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] ) if test "$QMAKE5" = "no"; then AC_MSG_ERROR([Qmake not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".]) else - qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`" + case "$host_os" in + darwin*) qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\{0,\}\).*$/\1/p'`" ;; + *) qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`" ;; + esac if test -z "$qmake5_test_ver"; then AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".]) fi @@ -10990,49 +10999,87 @@ then fi fi - qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs" - qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs" - if test $_os == "WINNT"; then - qt5_incdirs="`cygpath -m $qt5_incdirs`" - qt5_libdirs="`cygpath -m $qt5_libdirs`" - fi + qt5_cmake_incdir="`$QMAKE5 -query QT_INSTALL_HEADERS`" + qt5_cmake_libdir="`$QMAKE5 -query QT_INSTALL_LIBS`" + case "$_os" in + WINNT) + qt5_incdirs="`cygpath -m $qt5_cmake_incdir`" + qt5_libdirs="`cygpath -m $qt5_cmake_libdir`" + ;; + Darwin) + qt5_incdirs="$qt5_cmake_incdir" + qt5_libdirs="$qt5_cmake_libdir" + qt5_libdir="$qt5_cmake_libdir" + ;; + *) + qt5_incdirs="$qt5_cmake_incdir $qt5_incdirs" + qt5_libdirs="$qt5_cmake_libdir $qt5_libdirs" + ;; + esac + AC_MSG_NOTICE([Qt5 headers: ${qt5_cmake_incdir}]) + AC_MSG_NOTICE([Qt5 libraries: ${qt5_cmake_libdir}]) - AC_MSG_CHECKING([for Qt5 headers]) - qt5_incdir="no" - for inc_dir in $qt5_incdirs; do - if test -r "$inc_dir/$qt5_test_include"; then - qt5_incdir="$inc_dir" - break + case "$_os" in + Darwin) + QT5_LIBS="-F ${qt5_libdirs}" + AC_MSG_CHECKING([for used Qt5 frameworks]) + qt5_fwk_missing="" + for fwk in ${qt5_fwk_search}; do + if test ! -d "${qt5_libdirs}/${fwk}.framework"; then + qt5_fwk_missing="${qt5_fwk_missing} $fwk"; + fi + QT5_LIBS="${QT5_LIBS} -framework $fwk" + done + if test -n "$qt5_fwk_missing"; then + AC_MSG_ERROR([Missing Qt5 frameworks in ${qt5_libdirs}:${qt5_fwk_missing}]) + else + AC_MSG_RESULT([${qt5_fwk_search}]) fi - done - AC_MSG_RESULT([$qt5_incdir]) - if test "x$qt5_incdir" = "xno"; then - AC_MSG_ERROR([Qt5 headers not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".]) - fi + ;; + *) + AC_MSG_CHECKING([for Qt5 headers]) + qt5_incdir="no" + for inc_dir in $qt5_incdirs; do + if test -r "$inc_dir/$qt5_test_include"; then + qt5_incdir="$inc_dir" + break + fi + done - AC_MSG_CHECKING([for Qt5 libraries]) - qt5_libdir="no" - for lib_dir in $qt5_libdirs; do - if test -r "$lib_dir/$qt5_test_library"; then - qt5_libdir="$lib_dir" - break + AC_MSG_RESULT([$qt5_incdir]) + if test "x$qt5_incdir" = "xno"; then + AC_MSG_ERROR([Qt5 headers not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".]) + fi + + AC_MSG_CHECKING([for Qt5 libraries]) + qt5_libdir="no" + for lib_dir in $qt5_libdirs; do + if test -r "$lib_dir/$qt5_test_library"; then + qt5_libdir="$lib_dir" + break + fi + done + AC_MSG_RESULT([$qt5_libdir]) + if test "x$qt5_libdir" = "xno"; then + AC_MSG_ERROR([Qt5 libraries not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".]) fi - done - AC_MSG_RESULT([$qt5_libdir]) - if test "x$qt5_libdir" = "xno"; then - AC_MSG_ERROR([Qt5 libraries not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".]) - fi + + if test $_os == "WINNT"; then + QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib" + else + QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network" + fi + + ;; + esac QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT" - QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") - if test $_os == "WINNT"; then - QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib" - else - QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network" + if test "$_os" = "Darwin"; then + QT5_CFLAGS="$QT5_CFLAGS -F $qt5_cmake_libdir" fi + QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") dnl Check for Meta Object Compiler - AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] ) if test "$MOC5" = "no"; then AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify diff --git a/include/vcl/dllapi.h b/include/vcl/dllapi.h index 805d1cb00908..668cbeb174c6 100644 --- a/include/vcl/dllapi.h +++ b/include/vcl/dllapi.h @@ -36,7 +36,7 @@ #define UITEST_DLLPUBLIC SAL_DLLPUBLIC_IMPORT #endif -#if (defined UNX && ! defined MACOS) || defined _WIN32 +#if defined UNX || defined MACOS || defined _WIN32 #define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC #else #define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE diff --git a/vcl/Library_vclplug_osx.mk b/vcl/Library_vclplug_osx.mk index 7b2e52f3b3d3..91396d425dec 100644 --- a/vcl/Library_vclplug_osx.mk +++ b/vcl/Library_vclplug_osx.mk @@ -71,6 +71,7 @@ $(eval $(call gb_Library_add_cxxflags,vclplug_osx,\ $(eval $(call gb_Library_add_defs,vclplug_osx,\ -DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \ + -DVCLPLUG_OSX_IMPLEMENTATION \ )) $(eval $(call gb_Library_add_objcxxobjects,vclplug_osx,\ diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk index 0d3a522b1b62..5c55118f57fa 100644 --- a/vcl/Library_vclplug_qt5.mk +++ b/vcl/Library_vclplug_qt5.mk @@ -26,6 +26,7 @@ $(eval $(call gb_Library_set_include,vclplug_qt5,\ -I$(SRCDIR)/vcl/inc \ -I$(SRCDIR)/vcl/inc/qt5 \ )) +# $(if $(filter MACOS,$(OS)), -F $(QT5_LIBS)) \ $(eval $(call gb_Library_add_defs,vclplug_qt5,\ -DVCLPLUG_QT5_IMPLEMENTATION \ @@ -67,6 +68,7 @@ $(eval $(call gb_Library_use_externals,vclplug_qt5,\ $(eval $(call gb_Library_add_defs,vclplug_qt5,\ $(QT5_CFLAGS) \ )) + $(eval $(call gb_Library_add_libs,vclplug_qt5,\ $(QT5_LIBS) \ )) @@ -96,13 +98,11 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ vcl/qt5/Qt5Graphics_GDI \ vcl/qt5/Qt5Graphics_Text \ vcl/qt5/Qt5Instance \ - vcl/qt5/Qt5Instance_Print \ vcl/qt5/Qt5MainWindow \ vcl/qt5/Qt5Menu \ vcl/qt5/Qt5Object \ vcl/qt5/Qt5OpenGLContext \ vcl/qt5/Qt5Painter \ - vcl/qt5/Qt5Printer \ $(if $(USING_X11),vcl/qt5/Qt5System) \ vcl/qt5/Qt5Timer \ vcl/qt5/Qt5Tools \ @@ -111,6 +111,34 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ vcl/qt5/Qt5XAccessible \ )) +ifeq ($(OS),MACOSX) +$(eval $(call gb_Library_use_system_darwin_frameworks,vclplug_qt5,\ + ApplicationServices \ + Cocoa \ + Carbon \ + CoreFoundation \ + $(if $(filter X86_64,$(CPUNAME)),,QuickTime) \ +)) + +$(eval $(call gb_Library_add_cxxflags,vclplug_qt5,\ + $(gb_OBJCXXFLAGS) \ +)) + +$(eval $(call gb_Library_use_libraries,vclplug_qt5,\ + vclplug_osx \ +)) + +$(eval $(call gb_Library_add_objcxxobjects,vclplug_qt5,\ + vcl/qt5/Qt5Instance_Print \ + vcl/qt5/Qt5Printer \ +)) +else +$(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ + vcl/qt5/Qt5Instance_Print \ + vcl/qt5/Qt5Printer \ +)) +endif + ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_libs,vclplug_qt5,\ -lm \ diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 7b4951e38160..3c8ae6cb7670 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -101,6 +101,12 @@ $(eval $(call gb_Module_add_targets,vcl,\ Package_osxres \ Library_vclplug_osx \ )) +ifneq ($(ENABLE_QT5),) +$(eval $(call gb_Module_add_targets,vcl,\ + CustomTarget_qt5_moc \ + Library_vclplug_qt5 \ +)) +endif endif ifeq ($(OS),WNT) diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index 0c7ec1e9edfd..8fd210654eac 100644 --- a/vcl/inc/osx/salprn.h +++ b/vcl/inc/osx/salprn.h @@ -22,13 +22,14 @@ #include <osx/osxvcltypes.h> +#include <vclpluginapi.h> #include <salprn.hxx> #include <memory> class AquaSalGraphics; -class AquaSalInfoPrinter : public SalInfoPrinter +class VCLPLUG_OSX_PUBLIC AquaSalInfoPrinter : public SalInfoPrinter { /// Printer graphics AquaSalGraphics* mpGraphics; @@ -111,7 +112,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter }; -class AquaSalPrinter : public SalPrinter +class VCLPLUG_OSX_PUBLIC AquaSalPrinter : public SalPrinter { AquaSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter public: diff --git a/vcl/inc/qt5/Qt5Data.hxx b/vcl/inc/qt5/Qt5Data.hxx index 9d64d566274f..27e0421ed4b3 100644 --- a/vcl/inc/qt5/Qt5Data.hxx +++ b/vcl/inc/qt5/Qt5Data.hxx @@ -29,10 +29,10 @@ class QCursor; class VCLPLUG_QT5_PUBLIC Qt5Data -#ifndef _WIN32 - : public GenericUnixSalData -#else +#if (defined MACOSX || defined _WIN32) : public SalData +#else + : public GenericUnixSalData #endif { o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors; @@ -40,7 +40,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Data public: explicit Qt5Data(SalInstance* pInstance); virtual ~Qt5Data() override; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) virtual void ErrorTrapPush() override; virtual bool ErrorTrapPop(bool bIgnoreError = true) override; #endif diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx index 1f9e6477cf48..7afcb7831414 100644 --- a/vcl/inc/qt5/Qt5Frame.hxx +++ b/vcl/inc/qt5/Qt5Frame.hxx @@ -24,7 +24,7 @@ #include "Qt5Tools.hxx" -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) #include <headless/svpgdi.hxx> #endif #include <vcl/svapp.hxx> @@ -44,7 +44,7 @@ class QScreen; class QImage; class SvpSalGraphics; -#ifdef _WIN32 +#if (defined MACOSX || defined _WIN32) typedef void (*damageHandler)(void* handle, sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight); @@ -68,7 +68,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame const bool m_bUseCairo; std::unique_ptr<QImage> m_pQImage; std::unique_ptr<Qt5Graphics> m_pQt5Graphics; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) UniqueCairoSurface m_pSurface; std::unique_ptr<SvpSalGraphics> m_pOurSvpGraphics; // in base class, this ptr is the same as m_pOurSvpGraphic @@ -137,7 +137,7 @@ public: void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) const; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) virtual void InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics); #endif virtual SalGraphics* AcquireGraphics() override; diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx index b5f52c041932..5e62da4ff40c 100644 --- a/vcl/inc/qt5/Qt5Instance.hxx +++ b/vcl/inc/qt5/Qt5Instance.hxx @@ -31,7 +31,7 @@ class QApplication; class SalYieldMutex; class SalFrame; -#ifdef _WIN32 +#if (defined MACOSX || defined _WIN32) #include <salinst.hxx> #include <comphelper/solarmutex.hxx> #include <memory> @@ -43,7 +43,7 @@ class SalFrame; // Qts moc doesn't like macros, so this is handled by an extra base class // It also keeps all the #ifdef handling local class VCLPLUG_QT5_PUBLIC Qt5MocInstance -#ifdef _WIN32 +#if (defined MACOSX || defined _WIN32) : public SalInstance #else : public SalGenericInstance @@ -51,7 +51,7 @@ class VCLPLUG_QT5_PUBLIC Qt5MocInstance { public: Qt5MocInstance() -#ifdef _WIN32 +#if (defined MACOSX || defined _WIN32) : SalInstance(o3tl::make_unique<comphelper::SolarMutex>()) #else : SalGenericInstance(o3tl::make_unique<SalYieldMutex>()) @@ -59,7 +59,7 @@ public: { } -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) virtual GenPspGraphics* CreatePrintGraphics() override; virtual void PostPrintersChanged() override; #endif diff --git a/vcl/inc/qt5/Qt5Printer.hxx b/vcl/inc/qt5/Qt5Printer.hxx index 4fcae075fe3c..84a46a9be8f7 100644 --- a/vcl/inc/qt5/Qt5Printer.hxx +++ b/vcl/inc/qt5/Qt5Printer.hxx @@ -19,21 +19,26 @@ #pragma once -#ifndef _WIN32 -#include <unx/genprn.h> -#else +#ifdef _WIN32 #include <WinDef.h> #include <win/salprn.h> +#else +#ifdef MACOSX +#include <osx/salprn.h> +#else +#include <unx/genprn.h> +#endif #endif - -class Point; -class SalFrame; class Qt5Printer -#ifndef _WIN32 - : public PspSalPrinter -#else +#ifdef _WIN32 : public WinSalPrinter +#else +#ifdef MACOSX + : public AquaSalPrinter +#else + : public PspSalPrinter +#endif #endif { public: diff --git a/vcl/inc/qt5/Qt5System.hxx b/vcl/inc/qt5/Qt5System.hxx index 6bd732956137..ef514227ed94 100644 --- a/vcl/inc/qt5/Qt5System.hxx +++ b/vcl/inc/qt5/Qt5System.hxx @@ -11,21 +11,29 @@ #include <vcl/sysdata.hxx> -#ifndef _WIN32 -#include <unx/gensys.h> -#else +#ifdef _WIN32 #include <win/salsys.h> +#else +#ifdef MACOSX +#include <osx/salsys.h> +#else +#include <unx/gensys.h> +#endif #endif class Qt5System -#ifndef _WIN32 - : public SalGenericSystem -#else +#ifdef _WIN32 : public WinSalSystem +#else +#ifdef MACOSX + : public AquaSalSystem +#else + : public SalGenericSystem +#endif #endif { public: -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) virtual unsigned int GetDisplayScreenCount() override; virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override; virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage, diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx index 1e2166a34c72..0475d0dbaecc 100644 --- a/vcl/qt5/Qt5Data.cxx +++ b/vcl/qt5/Qt5Data.cxx @@ -149,18 +149,18 @@ #include <unx/x11_cursors/wsshow_curs.h> #include <unx/x11_cursors/wsshow_mask.h> -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) #include <unx/glyphcache.hxx> #endif Qt5Data::Qt5Data(SalInstance* pInstance) -#ifndef _WIN32 - : GenericUnixSalData(SAL_DATA_QT5, pInstance) -#else +#if (defined MACOSX || defined _WIN32) : SalData() +#else + : GenericUnixSalData(SAL_DATA_QT5, pInstance) #endif { -#ifdef _WIN32 +#if (defined MACOSX || defined _WIN32) m_pInstance = pInstance; SetSalData(this); #endif @@ -318,7 +318,7 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle) return *m_aCursors[ePointerStyle]; } -#ifndef _WIN32 +#if !(defined _WIN32 || defined MACOSX) void Qt5Data::ErrorTrapPush() {} bool Qt5Data::ErrorTrapPop(bool /*bIgnoreError*/) { return false; } diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 285eba74d079..53c1b5eab324 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -48,7 +48,7 @@ #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) #include <cairo.h> #include <headless/svpgdi.hxx> #endif @@ -63,7 +63,7 @@ static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 nExten Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo ) : m_pTopLevel(nullptr) , m_bUseCairo(bUseCairo) -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) , m_pSvpGraphics(nullptr) #endif , m_bNullRegion(true) @@ -147,7 +147,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo maGeometry.nRightDecoration = 0; } -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) m_aSystemData.nSize = sizeof(SystemEnvData); m_aSystemData.aWindow = m_pQWidget->winId(); m_aSystemData.aShellWindow = reinterpret_cast<sal_IntPtr>(this); @@ -164,7 +164,7 @@ Qt5Frame::~Qt5Frame() else delete m_pQWidget; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) m_aSystemData.aShellWindow = 0; #endif } @@ -188,7 +188,7 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect) CallCallback(SalEvent::Paint, &aPaintEvt); } -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics) { int width = 640; @@ -208,7 +208,7 @@ SalGraphics* Qt5Frame::AcquireGraphics() m_bGraphicsInUse = true; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) if (m_bUseCairo) { if (!m_pOurSvpGraphics.get()) @@ -235,7 +235,7 @@ SalGraphics* Qt5Frame::AcquireGraphics() void Qt5Frame::ReleaseGraphics(SalGraphics* pSalGraph) { (void)pSalGraph; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) if (m_bUseCairo) assert(pSalGraph == m_pOurSvpGraphics.get()); else diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index 4028614c36f7..d27010020d3a 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -24,7 +24,7 @@ #include <o3tl/make_unique.hxx> #include <vcl/fontcharmap.hxx> -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) #include <unx/geninst.h> #include <unx/fontmanager.hxx> #include <unx/glyphcache.hxx> @@ -93,7 +93,7 @@ bool Qt5Graphics::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC) { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) static const bool bUseFontconfig = (nullptr == getenv("SAL_VCL_QT5_NO_FONTCONFIG")); #endif @@ -102,7 +102,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC) return; QFontDatabase aFDB; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) QStringList aFontFamilyList; if (bUseFontconfig) aFontFamilyList = aFDB.families(); diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx index 5d130dfd45be..1c4cad5d3a09 100644 --- a/vcl/qt5/Qt5Instance.cxx +++ b/vcl/qt5/Qt5Instance.cxx @@ -104,7 +104,7 @@ std::unique_ptr<SalVirtualDevice> Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, DeviceFormat eFormat, const SystemGraphicsData* /* pData */) { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) if (m_bUseCairo) { SvpSalGraphics* pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics); @@ -149,7 +149,7 @@ SalSystem* Qt5Instance::CreateSalSystem() { return new Qt5System; } std::shared_ptr<SalBitmap> Qt5Instance::CreateSalBitmap() { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) if (m_bUseCairo) return std::make_shared<SvpSalBitmap>(); else @@ -322,7 +322,7 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance() for (int i = 0; i < nFakeArgc; i++) pFakeArgv[i] = pFakeArgvFreeable[i]; -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) char* session_manager = nullptr; if (getenv("SESSION_MANAGER") != nullptr) { @@ -335,7 +335,7 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance() *pFakeArgc = nFakeArgc; pQApplication = new QApplication(*pFakeArgc, pFakeArgv); -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) if (session_manager != nullptr) { // coverity[tainted_string] - trusted source for setenv diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx index 0eb8a30cdce5..d2964f19db0f 100644 --- a/vcl/qt5/Qt5Instance_Print.cxx +++ b/vcl/qt5/Qt5Instance_Print.cxx @@ -20,7 +20,7 @@ #include <Qt5Instance.hxx> #include <Qt5Printer.hxx> -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) #include <vcl/svapp.hxx> #include <vcl/timer.hxx> @@ -39,7 +39,7 @@ using namespace psp; * static helpers */ -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) static OUString getPdfDir(const PrinterInfo& rInfo) { OUString aDir; @@ -63,7 +63,7 @@ static OUString getPdfDir(const PrinterInfo& rInfo) SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pJobSetup) { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) // create and initialize SalInfoPrinter PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter; configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup); @@ -79,7 +79,7 @@ void Qt5Instance::DestroyInfoPrinter(SalInfoPrinter* pPrinter) { delete pPrinter std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrinter) { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) // create and initialize SalPrinter Qt5Printer* pPrinter = new Qt5Printer(pInfoPrinter); pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData; @@ -93,7 +93,7 @@ std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrin void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList) { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) PrinterInfoManager& rManager(PrinterInfoManager::get()); static const char* pNoSyncDetection = getenv("SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION"); if (!pNoSyncDetection || !*pNoSyncDetection) @@ -136,7 +136,7 @@ void Qt5Instance::GetPrinterQueueState(SalPrinterQueueInfo*) {} OUString Qt5Instance::GetDefaultPrinter() { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) PrinterInfoManager& rManager(PrinterInfoManager::get()); return rManager.getDefaultPrinter(); #else @@ -144,7 +144,7 @@ OUString Qt5Instance::GetDefaultPrinter() #endif } -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) void Qt5MocInstance::PostPrintersChanged() {} GenPspGraphics* Qt5MocInstance::CreatePrintGraphics() { return new GenPspGraphics(); } diff --git a/vcl/qt5/Qt5Instance_Print.mm b/vcl/qt5/Qt5Instance_Print.mm new file mode 100644 index 000000000000..b4004831fda8 --- /dev/null +++ b/vcl/qt5/Qt5Instance_Print.mm @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "Qt5Instance_Print.cxx" diff --git a/vcl/qt5/Qt5Object.cxx b/vcl/qt5/Qt5Object.cxx index df1a4e5504d7..5e8c5e8b86ff 100644 --- a/vcl/qt5/Qt5Object.cxx +++ b/vcl/qt5/Qt5Object.cxx @@ -38,7 +38,7 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow) if (bShow) m_pQWidget->show(); -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) m_aSystemData.nSize = sizeof(SystemEnvData); m_aSystemData.aWindow = pParent->GetQWidget()->winId(); m_aSystemData.aShellWindow = reinterpret_cast<sal_IntPtr>(this); diff --git a/vcl/qt5/Qt5Printer.cxx b/vcl/qt5/Qt5Printer.cxx index 354045efb437..b32faf71a97d 100644 --- a/vcl/qt5/Qt5Printer.cxx +++ b/vcl/qt5/Qt5Printer.cxx @@ -25,11 +25,16 @@ #include <Qt5Printer.hxx> +#if defined _WIN32 Qt5Printer::Qt5Printer(SalInfoPrinter* /* pInfoPrinter */) -#ifndef _WIN32 - : PspSalPrinter(pInfoPrinter) -#else : WinSalPrinter() +#else +Qt5Printer::Qt5Printer(SalInfoPrinter* pInfoPrinter) +#ifdef MACOSX + : AquaSalPrinter(static_cast<AquaSalInfoPrinter*>(pInfoPrinter)) +#else + : PspSalPrinter(pInfoPrinter) +#endif #endif { } diff --git a/vcl/qt5/Qt5Printer.mm b/vcl/qt5/Qt5Printer.mm new file mode 100644 index 000000000000..6f2eed046866 --- /dev/null +++ b/vcl/qt5/Qt5Printer.mm @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "Qt5Printer.cxx" diff --git a/vcl/qt5/Qt5Tools.cxx b/vcl/qt5/Qt5Tools.cxx index b12a03539bbb..e14c6099d927 100644 --- a/vcl/qt5/Qt5Tools.cxx +++ b/vcl/qt5/Qt5Tools.cxx @@ -21,7 +21,7 @@ #include <vcl/event.hxx> -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) #include <cairo.h> void CairoDeleter::operator()(cairo_surface_t* pSurface) const { cairo_surface_destroy(pSurface); } diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 4dad8b3bda20..1ff36d002d1b 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -42,7 +42,7 @@ #include <vcl/commandevent.hxx> #include <vcl/event.hxx> -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) #include <cairo.h> #include <headless/svpgdi.hxx> #endif @@ -53,7 +53,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent) if (!m_pFrame->m_bNullRegion) p.setClipRegion(m_pFrame->m_aRegion); -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) if (m_pFrame->m_bUseCairo) { cairo_surface_t* pSurface = m_pFrame->m_pSurface.get(); @@ -70,7 +70,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent) void Qt5Widget::resizeEvent(QResizeEvent* pEvent) { -#ifndef _WIN32 +#if !(defined MACOSX || defined _WIN32) if (m_pFrame->m_bUseCairo) { int width = size().width(); |