[Libreoffice-commits] core.git: Branch 'feature/qt5-win+mac' - 62 commits - accessibility/source android/source avmedia/source basctl/source basegfx/source basegfx/test basic/source canvas/source chart2/source chart2/uiconfig comphelper/source config_host/config_vclplug.h.in configure.ac connectivity/source cpputools/source cui/source cui/uiconfig dbaccess/source desktop/qa desktop/source drawinglayer/source editeng/source extensions/source extras/Module_extras.mk extras/Persona_dark.mk extras/Persona_gray.mk extras/Persona_green.mk extras/Persona_pink.mk extras/Persona_sand.mk extras/Personas.mk extras/Persona_white.mk extras/source filter/source forms/source formula/source fpicker/source framework/source hwpfilter/source icon-themes/elementary icon-themes/elementary_svg include/oox include/svx include/vcl ios/LibreOfficeLight jvmfwk/source l10ntools/source libreofficekit/source lingucomponent/source linguistic/source lotuswordpro/source offapi/com officecfg/registry oox/inc oox/source package/s ource readlicense_oo/license reportdesign/source Repository.mk salhelper/source sal/osl sal/qa sc/inc sc/qa scripting/source sc/source sc/uiconfig sdext/source sd/inc sd/qa sd/source sd/uiconfig sfx2/source slideshow/source solenv/bin sot/source svgio/inc svgio/source svl/source svtools/source svx/source sw/inc sw/qa sw/source sw/uiconfig sw/util test/source toolkit/source tools/source ucb/source unotools/source uui/source vbahelper/source vcl/inc vcl/Library_vclplug_osx.mk vcl/Library_vclplug_qt5.mk vcl/Module_vcl.mk vcl/opengl vcl/qt5 vcl/source vcl/unx vcl/workben winaccessibility/README writerfilter/source xmloff/qa xmloff/source xmlsecurity/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Oct 19 13:26:00 UTC 2018
Rebased ref, commits from common ancestor:
commit 8079a5e43bbb1ed54327ac48b0781d597f797be8
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Sep 17 11:01:59 2018 +0200
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Oct 19 13:20:11 2018 +0000
Qt5 use LO provided native file pickers
This uses the native file pickers on Windows and MacOSX.
Change-Id: Ic836d3ed8de0760c6c94c68d61f6eaa96f773000
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 8ef4108a3558..25671ca498eb 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -91,7 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5Clipboard \
vcl/qt5/Qt5Data \
vcl/qt5/Qt5DragAndDrop \
- vcl/qt5/Qt5FilePicker \
+ $(if $(USING_X11),vcl/qt5/Qt5FilePicker) \
vcl/qt5/Qt5Font \
vcl/qt5/Qt5FontFace \
vcl/qt5/Qt5Frame \
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index ca11acb2a788..289ba32fff19 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -215,17 +215,27 @@ void Qt5Instance::ProcessEvent(SalUserEvent aEvent)
}
css::uno::Reference<css::ui::dialogs::XFilePicker2>
-Qt5Instance::createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&)
+Qt5Instance::createFilePicker(const css::uno::Reference<css::uno::XComponentContext>& cntxt)
{
+#if (defined _WIN32 || defined MACOSX)
+ return SalInstance::createFilePicker(cntxt);
+#else
+ (void)cntxt;
return css::uno::Reference<css::ui::dialogs::XFilePicker2>(
new Qt5FilePicker(QFileDialog::ExistingFile));
+#endif
}
css::uno::Reference<css::ui::dialogs::XFolderPicker2>
-Qt5Instance::createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&)
+Qt5Instance::createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& cntxt)
{
+#if (defined _WIN32 || defined MACOSX)
+ return SalInstance::createFolderPicker(cntxt);
+#else
+ (void)cntxt;
return css::uno::Reference<css::ui::dialogs::XFolderPicker2>(
new Qt5FilePicker(QFileDialog::Directory));
+#endif
}
css::uno::Reference<css::uno::XInterface>
commit 9f5451279912c4f84bf02cfbafdd1e9f1f8d31c6
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Sep 13 11:32:12 2018 +0200
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Oct 19 13:19:52 2018 +0000
Qt5 build VCL plugin on MacOSX
Change-Id: I6ddec483703c95faf69b7b146363376765d5d6f8
diff --git a/Repository.mk b/Repository.mk
index 430e1d6bc6de..6c81261a6722 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -483,6 +483,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
AppleRemote \
) \
fps_aqua \
+ $(if $(ENABLE_QT5),vclplug_qt5) \
vclplug_osx \
MacOSXSpell \
) \
diff --git a/configure.ac b/configure.ac
index 3fd916fb4f8f..e27378c3449e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -671,6 +671,7 @@ darwin*) # Mac OS X or iOS
host=x86_64-apple-darwin
fi
else
+ test_qt5=yes
_os=Darwin
INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
INSTROOTCONTENTSUFFIX=/Contents
@@ -11176,13 +11177,7 @@ if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
\( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
\( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
then
- qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
- qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
-
- if test -n "$supports_multilib"; then
- qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
- fi
-
+ qt5_fwk_search="QtCore QtGui QtWidgets QtNetwork"
qt5_test_include="QtWidgets/qapplication.h"
if test $_os == "WINNT"; then
qt5_test_library="Qt5Widgets.lib"
@@ -11190,12 +11185,25 @@ then
qt5_test_library="libQt5Widgets.so"
fi
+ qt5_incdirs=""
+ qt5_libdirs=""
+ if test "$USING_X11" = TRUE; then
+ qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
+ qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
+ if test -n "$supports_multilib"; then
+ qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
+ fi
+ fi
+
dnl Check for qmake5
AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
if test "$QMAKE5" = "no"; then
AC_MSG_ERROR([Qmake not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
else
- qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
+ case "$host_os" in
+ darwin*) qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\{0,\}\).*$/\1/p'`" ;;
+ *) qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`" ;;
+ esac
if test -z "$qmake5_test_ver"; then
AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
fi
@@ -11208,49 +11216,86 @@ then
fi
fi
- qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
- qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
- if test $_os == "WINNT"; then
- qt5_incdirs="`cygpath -m $qt5_incdirs`"
- qt5_libdirs="`cygpath -m $qt5_libdirs`"
- fi
+ qt5_cmake_incdir="`$QMAKE5 -query QT_INSTALL_HEADERS`"
+ qt5_cmake_libdir="`$QMAKE5 -query QT_INSTALL_LIBS`"
+ case "$_os" in
+ WINNT)
+ qt5_incdirs="`cygpath -m $qt5_cmake_incdir`"
+ qt5_libdirs="`cygpath -m $qt5_cmake_libdir`"
+ ;;
+ Darwin)
+ qt5_incdirs="$qt5_cmake_incdir"
+ qt5_libdirs="$qt5_cmake_libdir"
+ ;;
+ *)
+ qt5_incdirs="$qt5_cmake_incdir $qt5_incdirs"
+ qt5_libdirs="$qt5_cmake_libdir $qt5_libdirs"
+ ;;
+ esac
+ AC_MSG_NOTICE([Qt5 headers: ${qt5_cmake_incdir}])
+ AC_MSG_NOTICE([Qt5 libraries: ${qt5_cmake_libdir}])
- AC_MSG_CHECKING([for Qt5 headers])
- qt5_incdir="no"
- for inc_dir in $qt5_incdirs; do
- if test -r "$inc_dir/$qt5_test_include"; then
- qt5_incdir="$inc_dir"
- break
+ case "$_os" in
+ Darwin)
+ QT5_LIBS="-F ${qt5_libdirs}"
+ AC_MSG_CHECKING([for used Qt5 frameworks])
+ qt5_fwk_missing=""
+ for fwk in ${qt5_fwk_search}; do
+ if test ! -d "${qt5_libdirs}/${fwk}.framework"; then
+ qt5_fwk_missing="${qt5_fwk_missing} $fwk";
+ fi
+ QT5_LIBS="${QT5_LIBS} -framework $fwk"
+ done
+ if test -n "$qt5_fwk_missing"; then
+ AC_MSG_ERROR([Missing Qt5 frameworks in ${qt5_libdirs}:${qt5_fwk_missing}])
+ else
+ AC_MSG_RESULT([${qt5_fwk_search}])
fi
- done
- AC_MSG_RESULT([$qt5_incdir])
- if test "x$qt5_incdir" = "xno"; then
- AC_MSG_ERROR([Qt5 headers not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
- fi
+ ;;
+ *)
+ AC_MSG_CHECKING([for Qt5 headers])
+ qt5_incdir="no"
+ for inc_dir in $qt5_incdirs; do
+ if test -r "$inc_dir/$qt5_test_include"; then
+ qt5_incdir="$inc_dir"
+ break
+ fi
+ done
- AC_MSG_CHECKING([for Qt5 libraries])
- qt5_libdir="no"
- for lib_dir in $qt5_libdirs; do
- if test -r "$lib_dir/$qt5_test_library"; then
- qt5_libdir="$lib_dir"
- break
+ AC_MSG_RESULT([$qt5_incdir])
+ if test "x$qt5_incdir" = "xno"; then
+ AC_MSG_ERROR([Qt5 headers not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
+ fi
+
+ AC_MSG_CHECKING([for Qt5 libraries])
+ qt5_libdir="no"
+ for lib_dir in $qt5_libdirs; do
+ if test -r "$lib_dir/$qt5_test_library"; then
+ qt5_libdir="$lib_dir"
+ break
+ fi
+ done
+ AC_MSG_RESULT([$qt5_libdir])
+ if test "x$qt5_libdir" = "xno"; then
+ AC_MSG_ERROR([Qt5 libraries not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
fi
- done
- AC_MSG_RESULT([$qt5_libdir])
- if test "x$qt5_libdir" = "xno"; then
- AC_MSG_ERROR([Qt5 libraries not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
- fi
+
+ if test $_os == "WINNT"; then
+ QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib"
+ else
+ QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+ fi
+
+ ;;
+ esac
QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
- QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
- if test $_os == "WINNT"; then
- QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib"
- else
- QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+ if test "$_os" = "Darwin"; then
+ QT5_CFLAGS="$QT5_CFLAGS -F $qt5_cmake_libdir"
fi
+ QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
dnl Check for Meta Object Compiler
-
AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
if test "$MOC5" = "no"; then
AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify
diff --git a/include/vcl/dllapi.h b/include/vcl/dllapi.h
index 805d1cb00908..668cbeb174c6 100644
--- a/include/vcl/dllapi.h
+++ b/include/vcl/dllapi.h
@@ -36,7 +36,7 @@
#define UITEST_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
#endif
-#if (defined UNX && ! defined MACOS) || defined _WIN32
+#if defined UNX || defined MACOS || defined _WIN32
#define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC
#else
#define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE
diff --git a/vcl/Library_vclplug_osx.mk b/vcl/Library_vclplug_osx.mk
index 7b2e52f3b3d3..7294bb661d1a 100644
--- a/vcl/Library_vclplug_osx.mk
+++ b/vcl/Library_vclplug_osx.mk
@@ -24,6 +24,11 @@ $(eval $(call gb_Library_set_include,vclplug_osx,\
-I$(SRCDIR)/vcl/inc \
))
+$(eval $(call gb_Library_add_defs,vclplug_osx,\
+ -DVCLPLUG_OSX_IMPLEMENTATION \
+ -DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \
+))
+
$(eval $(call gb_Library_use_sdk_api,vclplug_osx))
$(eval $(call gb_Library_use_custom_headers,vclplug_osx,\
@@ -69,10 +74,6 @@ $(eval $(call gb_Library_add_cxxflags,vclplug_osx,\
$(gb_OBJCXXFLAGS) \
))
-$(eval $(call gb_Library_add_defs,vclplug_osx,\
- -DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \
-))
-
$(eval $(call gb_Library_add_objcxxobjects,vclplug_osx,\
vcl/osx/a11yactionwrapper \
vcl/osx/a11ycomponentwrapper \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 316cf2ea8ac1..8ef4108a3558 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) \
))
@@ -98,12 +100,10 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5Graphics_GDI \
vcl/qt5/Qt5Graphics_Text \
vcl/qt5/Qt5Instance \
- vcl/qt5/Qt5Instance_Print \
vcl/qt5/Qt5MainWindow \
vcl/qt5/Qt5Menu \
vcl/qt5/Qt5Object \
vcl/qt5/Qt5Painter \
- vcl/qt5/Qt5Printer \
$(if $(USING_X11),vcl/qt5/Qt5System) \
vcl/qt5/Qt5Timer \
vcl/qt5/Qt5Tools \
@@ -112,6 +112,34 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5XAccessible \
))
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_Library_use_system_darwin_frameworks,vclplug_qt5,\
+ ApplicationServices \
+ Cocoa \
+ Carbon \
+ CoreFoundation \
+ $(if $(filter X86_64,$(CPUNAME)),,QuickTime) \
+))
+
+$(eval $(call gb_Library_add_cxxflags,vclplug_qt5,\
+ $(gb_OBJCXXFLAGS) \
+))
+
+$(eval $(call gb_Library_use_libraries,vclplug_qt5,\
+ vclplug_osx \
+))
+
+$(eval $(call gb_Library_add_objcxxobjects,vclplug_qt5,\
+ vcl/qt5/Qt5Instance_Print \
+ vcl/qt5/Qt5Printer \
+))
+else
+$(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
+ vcl/qt5/Qt5Instance_Print \
+ vcl/qt5/Qt5Printer \
+))
+endif
+
ifeq ($(OS),LINUX)
$(eval $(call gb_Library_add_libs,vclplug_qt5,\
-lm \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 8fbe1fdca943..c8520fbd4c6c 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -108,6 +108,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
Package_osxres \
Library_vclplug_osx \
))
+ifneq ($(ENABLE_QT5),)
+$(eval $(call gb_Module_add_targets,vcl,\
+ CustomTarget_qt5_moc \
+ Library_vclplug_qt5 \
+))
+endif
endif
ifeq ($(OS),WNT)
diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h
index 0c7ec1e9edfd..8fd210654eac 100644
--- a/vcl/inc/osx/salprn.h
+++ b/vcl/inc/osx/salprn.h
@@ -22,13 +22,14 @@
#include <osx/osxvcltypes.h>
+#include <vclpluginapi.h>
#include <salprn.hxx>
#include <memory>
class AquaSalGraphics;
-class AquaSalInfoPrinter : public SalInfoPrinter
+class VCLPLUG_OSX_PUBLIC AquaSalInfoPrinter : public SalInfoPrinter
{
/// Printer graphics
AquaSalGraphics* mpGraphics;
@@ -111,7 +112,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter
};
-class AquaSalPrinter : public SalPrinter
+class VCLPLUG_OSX_PUBLIC AquaSalPrinter : public SalPrinter
{
AquaSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter
public:
diff --git a/vcl/inc/qt5/Qt5Data.hxx b/vcl/inc/qt5/Qt5Data.hxx
index b487f41e1e5a..bf01a0c57ac1 100644
--- a/vcl/inc/qt5/Qt5Data.hxx
+++ b/vcl/inc/qt5/Qt5Data.hxx
@@ -30,10 +30,10 @@ class GlyphCache;
class QCursor;
class VCLPLUG_QT5_PUBLIC Qt5Data
-#ifndef _WIN32
- : public GenericUnixSalData
-#else
+#if (defined MACOSX || defined _WIN32)
: public SalData
+#else
+ : public GenericUnixSalData
#endif
{
o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors;
@@ -41,7 +41,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Data
public:
explicit Qt5Data(SalInstance* pInstance);
virtual ~Qt5Data() override;
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
virtual void ErrorTrapPush() override;
virtual bool ErrorTrapPop(bool bIgnoreError = true) override;
#endif
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 4c50a05abbca..74e2cf1bc27f 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
@@ -135,7 +135,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 74e81b8e6c80..7619194c2498 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -31,7 +31,7 @@ class QApplication;
class SalYieldMutex;
class SalFrame;
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
#include <salinst.hxx>
#include <comphelper/solarmutex.hxx>
#else
@@ -41,7 +41,7 @@ class SalFrame;
// Qts moc doesn't like macros, so this is handled by an extra base class
// It also keeps all the #ifdef handling local
class VCLPLUG_QT5_PUBLIC Qt5MocInstance
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
: public SalInstance
#else
: public SalGenericInstance
@@ -49,7 +49,7 @@ class VCLPLUG_QT5_PUBLIC Qt5MocInstance
{
public:
Qt5MocInstance()
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
: SalInstance(o3tl::make_unique<comphelper::SolarMutex>())
#else
: SalGenericInstance(o3tl::make_unique<SalYieldMutex>())
@@ -57,7 +57,7 @@ public:
{
}
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
virtual GenPspGraphics* CreatePrintGraphics() override;
virtual void PostPrintersChanged() override;
#endif
diff --git a/vcl/inc/qt5/Qt5Printer.hxx b/vcl/inc/qt5/Qt5Printer.hxx
index 4fcae075fe3c..84a46a9be8f7 100644
--- a/vcl/inc/qt5/Qt5Printer.hxx
+++ b/vcl/inc/qt5/Qt5Printer.hxx
@@ -19,21 +19,26 @@
#pragma once
-#ifndef _WIN32
-#include <unx/genprn.h>
-#else
+#ifdef _WIN32
#include <WinDef.h>
#include <win/salprn.h>
+#else
+#ifdef MACOSX
+#include <osx/salprn.h>
+#else
+#include <unx/genprn.h>
+#endif
#endif
-
-class Point;
-class SalFrame;
class Qt5Printer
-#ifndef _WIN32
- : public PspSalPrinter
-#else
+#ifdef _WIN32
: public WinSalPrinter
+#else
+#ifdef MACOSX
+ : public AquaSalPrinter
+#else
+ : public PspSalPrinter
+#endif
#endif
{
public:
diff --git a/vcl/inc/qt5/Qt5System.hxx b/vcl/inc/qt5/Qt5System.hxx
index 6bd732956137..ef514227ed94 100644
--- a/vcl/inc/qt5/Qt5System.hxx
+++ b/vcl/inc/qt5/Qt5System.hxx
@@ -11,21 +11,29 @@
#include <vcl/sysdata.hxx>
-#ifndef _WIN32
-#include <unx/gensys.h>
-#else
+#ifdef _WIN32
#include <win/salsys.h>
+#else
+#ifdef MACOSX
+#include <osx/salsys.h>
+#else
+#include <unx/gensys.h>
+#endif
#endif
class Qt5System
-#ifndef _WIN32
- : public SalGenericSystem
-#else
+#ifdef _WIN32
: public WinSalSystem
+#else
+#ifdef MACOSX
+ : public AquaSalSystem
+#else
+ : public SalGenericSystem
+#endif
#endif
{
public:
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
virtual unsigned int GetDisplayScreenCount() override;
virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override;
virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage,
diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx
index 1e2166a34c72..0475d0dbaecc 100644
--- a/vcl/qt5/Qt5Data.cxx
+++ b/vcl/qt5/Qt5Data.cxx
@@ -149,18 +149,18 @@
#include <unx/x11_cursors/wsshow_curs.h>
#include <unx/x11_cursors/wsshow_mask.h>
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
#include <unx/glyphcache.hxx>
#endif
Qt5Data::Qt5Data(SalInstance* pInstance)
-#ifndef _WIN32
- : GenericUnixSalData(SAL_DATA_QT5, pInstance)
-#else
+#if (defined MACOSX || defined _WIN32)
: SalData()
+#else
+ : GenericUnixSalData(SAL_DATA_QT5, pInstance)
#endif
{
-#ifdef _WIN32
+#if (defined MACOSX || defined _WIN32)
m_pInstance = pInstance;
SetSalData(this);
#endif
@@ -318,7 +318,7 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle)
return *m_aCursors[ePointerStyle];
}
-#ifndef _WIN32
+#if !(defined _WIN32 || defined MACOSX)
void Qt5Data::ErrorTrapPush() {}
bool Qt5Data::ErrorTrapPop(bool /*bIgnoreError*/) { return false; }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 92d0e801f54e..de89a8cfc120 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)
@@ -182,7 +182,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;
@@ -203,7 +203,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
m_bGraphicsInUse = true;
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
if (m_bUseCairo)
{
if (!m_pOurSvpGraphics.get())
@@ -230,7 +230,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
void Qt5Frame::ReleaseGraphics(SalGraphics* pSalGraph)
{
(void)pSalGraph;
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
if (m_bUseCairo)
assert(pSalGraph == m_pOurSvpGraphics.get());
else
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index e39c1b8c95a3..d4c718a3194b 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -23,7 +23,7 @@
#include <Qt5Painter.hxx>
#include <vcl/fontcharmap.hxx>
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
#include <unx/geninst.h>
#include <unx/fontmanager.hxx>
#endif
@@ -90,7 +90,7 @@ bool Qt5Graphics::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities)
void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
{
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
static const bool bUseFontconfig = (nullptr == getenv("SAL_VCL_QT5_NO_FONTCONFIG"));
#endif
@@ -100,7 +100,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
QFontDatabase aFDB;
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
if (bUseFontconfig)
{
::std::vector<psp::fontID> aList;
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 6325bb34df53..ca11acb2a788 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -100,7 +100,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);
@@ -139,7 +139,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
@@ -305,7 +305,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)
{
@@ -318,7 +318,7 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance()
*pFakeArgc = nFakeArgc;
pQApplication = new QApplication(*pFakeArgc, pFakeArgv);
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
if (session_manager != nullptr)
{
// coverity[tainted_string] - trusted source for setenv
diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx
index 5b7864ef6fe4..d396fc87e416 100644
--- a/vcl/qt5/Qt5Instance_Print.cxx
+++ b/vcl/qt5/Qt5Instance_Print.cxx
@@ -20,7 +20,7 @@
#include <Qt5Instance.hxx>
#include <Qt5Printer.hxx>
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
@@ -39,7 +39,7 @@ using namespace psp;
* static helpers
*/
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
static OUString getPdfDir(const PrinterInfo& rInfo)
{
OUString aDir;
@@ -63,7 +63,7 @@ static OUString getPdfDir(const PrinterInfo& rInfo)
SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
ImplJobSetup* pJobSetup)
{
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
// create and initialize SalInfoPrinter
PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter;
configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup);
@@ -79,7 +79,7 @@ void Qt5Instance::DestroyInfoPrinter(SalInfoPrinter* pPrinter) { delete pPrinter
std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrinter)
{
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
// create and initialize SalPrinter
Qt5Printer* pPrinter = new Qt5Printer(pInfoPrinter);
pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
@@ -93,7 +93,7 @@ std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrin
void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
{
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
PrinterInfoManager& rManager(PrinterInfoManager::get());
static const char* pNoSyncDetection = getenv("SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION");
if (!pNoSyncDetection || !*pNoSyncDetection)
@@ -138,7 +138,7 @@ void Qt5Instance::GetPrinterQueueState(SalPrinterQueueInfo*) {}
OUString Qt5Instance::GetDefaultPrinter()
{
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
PrinterInfoManager& rManager(PrinterInfoManager::get());
return rManager.getDefaultPrinter();
#else
@@ -146,7 +146,7 @@ OUString Qt5Instance::GetDefaultPrinter()
#endif
}
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
void Qt5MocInstance::PostPrintersChanged() {}
GenPspGraphics* Qt5MocInstance::CreatePrintGraphics() { return new GenPspGraphics(); }
diff --git a/vcl/qt5/Qt5Instance_Print.mm b/vcl/qt5/Qt5Instance_Print.mm
new file mode 100644
index 000000000000..b4004831fda8
--- /dev/null
+++ b/vcl/qt5/Qt5Instance_Print.mm
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "Qt5Instance_Print.cxx"
diff --git a/vcl/qt5/Qt5Printer.cxx b/vcl/qt5/Qt5Printer.cxx
index 2f30b3b53720..9ea85124b5ec 100644
--- a/vcl/qt5/Qt5Printer.cxx
+++ b/vcl/qt5/Qt5Printer.cxx
@@ -23,11 +23,16 @@
#include <tools/gen.hxx>
#include <Qt5Printer.hxx>
+#if defined _WIN32
Qt5Printer::Qt5Printer(SalInfoPrinter* /* pInfoPrinter */)
-#ifndef _WIN32
- : PspSalPrinter(pInfoPrinter)
-#else
: WinSalPrinter()
+#else
+Qt5Printer::Qt5Printer(SalInfoPrinter* pInfoPrinter)
+#ifdef MACOSX
+ : AquaSalPrinter(static_cast<AquaSalInfoPrinter*>(pInfoPrinter))
+#else
+ : PspSalPrinter(pInfoPrinter)
+#endif
#endif
{
}
diff --git a/vcl/qt5/Qt5Printer.mm b/vcl/qt5/Qt5Printer.mm
new file mode 100644
index 000000000000..6f2eed046866
--- /dev/null
+++ b/vcl/qt5/Qt5Printer.mm
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "Qt5Printer.cxx"
diff --git a/vcl/qt5/Qt5Tools.cxx b/vcl/qt5/Qt5Tools.cxx
index b12a03539bbb..e14c6099d927 100644
--- a/vcl/qt5/Qt5Tools.cxx
+++ b/vcl/qt5/Qt5Tools.cxx
@@ -21,7 +21,7 @@
#include <vcl/event.hxx>
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
#include <cairo.h>
void CairoDeleter::operator()(cairo_surface_t* pSurface) const { cairo_surface_destroy(pSurface); }
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index c3f416ce8f22..c1f226c38b45 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -35,7 +35,7 @@
#include <QtWidgets/QtWidgets>
#include <QtWidgets/QMainWindow>
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
#include <cairo.h>
#include <headless/svpgdi.hxx>
#endif
@@ -46,7 +46,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent)
if (!m_pFrame->m_bNullRegion)
p.setClipRegion(m_pFrame->m_aRegion);
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
if (m_pFrame->m_bUseCairo)
{
cairo_surface_t* pSurface = m_pFrame->m_pSurface.get();
@@ -63,7 +63,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent)
void Qt5Widget::resizeEvent(QResizeEvent* /*event*/)
{
-#ifndef _WIN32
+#if !(defined MACOSX || defined _WIN32)
if (m_pFrame->m_bUseCairo)
{
int width = size().width();
commit 55103a07cf61ab7def0bc25efcdabcd9029f16a0
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: Fri Oct 19 13:19:34 2018 +0000
Qt5 build VCL plugin on Windows
Change-Id: I1bb673eb2c228d767caca6a9a860bd9d113d082f
diff --git a/Repository.mk b/Repository.mk
index 224902491c13..430e1d6bc6de 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -474,6 +474,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
ado \
oleautobridge \
smplmail \
+ $(if $(ENABLE_QT5),vclplug_qt5) \
vclplug_win \
wininetbe1 \
) \
diff --git a/config_host/config_vclplug.h.in b/config_host/config_vclplug.h.in
index be9c136245ee..c02853d5282d 100644
--- a/config_host/config_vclplug.h.in
+++ b/config_host/config_vclplug.h.in
@@ -11,5 +11,6 @@ Settings about which X11 desktops have support enabled.
#define ENABLE_KDE4 0
#define ENABLE_KDE5 0
#define ENABLE_GTK3_KDE5 0
+#define ENABLE_QT5 0
#endif
diff --git a/configure.ac b/configure.ac
index a20e0be6c688..3fd916fb4f8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,6 +635,7 @@ cygwin*|interix*)
test_xrender=no
test_freetype=no
test_fontconfig=no
+ test_qt5=yes
_os=WINNT
DLLPOST=".dll"
@@ -4678,7 +4679,6 @@ if test "$USING_X11" != TRUE; then
build_gstreamer_0_10=no
test_kde4=no
test_kde5=no
- test_qt5=no
test_gtk3_kde5=no
enable_cairo_canvas=no
fi
@@ -10029,10 +10029,16 @@ dnl ===================================================================
dnl Test which vclplugs have to be built.
dnl ===================================================================
R=""
-if test "$USING_X11" != TRUE; then
+if test "$USING_X11" = TRUE; then
+ R="gen"
+else
enable_gtk=no
enable_gtk3=no
+ if test "$_os" = "WINNT"; then
+ R="win"
+ fi
fi
+
GTK3_CFLAGS=""
GTK3_LIBS=""
ENABLE_GTK3=""
@@ -10043,7 +10049,7 @@ if test "x$enable_gtk3" = "xyes"; then
: ${with_system_cairo:=yes}
PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.18 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
if test "x$ENABLE_GTK3" = "xTRUE"; then
- R="gtk3"
+ R=" gtk3"
dnl Avoid installed by unpackaged files for now.
if test -z "$PKGFORMAT"; then
GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
@@ -11178,7 +11184,11 @@ then
fi
qt5_test_include="QtWidgets/qapplication.h"
- qt5_test_library="libQt5Widgets.so"
+ if test $_os == "WINNT"; then
+ qt5_test_library="Qt5Widgets.lib"
+ else
+ qt5_test_library="libQt5Widgets.so"
+ fi
dnl Check for qmake5
AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
@@ -11200,6 +11210,10 @@ then
qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
+ if test $_os == "WINNT"; then
+ qt5_incdirs="`cygpath -m $qt5_incdirs`"
+ qt5_libdirs="`cygpath -m $qt5_libdirs`"
+ fi
AC_MSG_CHECKING([for Qt5 headers])
qt5_incdir="no"
@@ -11229,7 +11243,11 @@ then
QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
- QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+ if test $_os == "WINNT"; then
+ QT5_LIBS="-LIBPATH:$qt5_libdir Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib Qt5Network.lib"
+ else
+ QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
+ fi
dnl Check for Meta Object Compiler
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index c835b748696b..316cf2ea8ac1 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 \
@@ -103,7 +104,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 \
@@ -113,9 +114,9 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
ifeq ($(OS),LINUX)
$(eval $(call gb_Library_add_libs,vclplug_qt5,\
- -lm \
- -ldl \
- -lpthread \
+ -lm \
+ -ldl \
+ -lpthread \
))
endif
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index df3bf6e26412..8fbe1fdca943 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -115,6 +115,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
WinResTarget_vcl \
Library_vclplug_win \
))
+ifneq ($(ENABLE_QT5),)
+$(eval $(call gb_Module_add_targets,vcl,\
+ CustomTarget_qt5_moc \
+ Library_vclplug_qt5 \
+))
+endif
endif
ifeq ($(OS),HAIKU)
diff --git a/vcl/inc/qt5/Qt5Bitmap.hxx b/vcl/inc/qt5/Qt5Bitmap.hxx
index ba2ea5a2f58a..3f1421a820a5 100644
--- a/vcl/inc/qt5/Qt5Bitmap.hxx
+++ b/vcl/inc/qt5/Qt5Bitmap.hxx
@@ -19,13 +19,14 @@
#pragma once
+#include <vclpluginapi.h>
#include <salbmp.hxx>
#include <memory>
class QImage;
-class VCL_DLLPUBLIC Qt5Bitmap : public SalBitmap
+class VCLPLUG_QT5_PUBLIC Qt5Bitmap : public SalBitmap
{
std::unique_ptr<QImage> m_pImage;
BitmapPalette m_aPalette;
diff --git a/vcl/inc/qt5/Qt5Data.hxx b/vcl/inc/qt5/Qt5Data.hxx
index 6f64925cb2f5..b487f41e1e5a 100644
--- a/vcl/inc/qt5/Qt5Data.hxx
+++ b/vcl/inc/qt5/Qt5Data.hxx
@@ -29,17 +29,22 @@
class GlyphCache;
class QCursor;
-class VCLPLUG_QT5_PUBLIC Qt5Data : public GenericUnixSalData
+class VCLPLUG_QT5_PUBLIC Qt5Data
+#ifndef _WIN32
+ : public GenericUnixSalData
+#else
+ : public SalData
+#endif
{
o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors;
public:
explicit Qt5Data(SalInstance* pInstance);
virtual ~Qt5Data() override;
-
+#ifndef _WIN32
virtual void ErrorTrapPush() override;
virtual bool ErrorTrapPop(bool bIgnoreError = true) override;
-
+#endif
QCursor& getCursor(PointerStyle ePointerStyle);
static bool noNativeControls();
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 110fa9b279cf..4c50a05abbca 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;
@@ -119,7 +135,9 @@ public:
void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
sal_Int32 nExtentsHeight) const;
+#ifndef _WIN32
virtual void InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics);
+#endif
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx
index 76c39146728c..dd909f0372fd 100644
--- a/vcl/inc/qt5/Qt5Graphics.hxx
+++ b/vcl/inc/qt5/Qt5Graphics.hxx
@@ -30,6 +30,10 @@
#include "Qt5Data.hxx"
#include "Qt5Graphics_Controls.hxx"
+#ifdef _WIN32
+#include <QtWidgets/QPushButton>
+#endif
+
class PhysicalFontCollection;
class QImage;
class QPushButton;
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 8f5a2670b238..74e81b8e6c80 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -20,10 +20,10 @@
#pragma once
#include <vclpluginapi.h>
-#include <unx/geninst.h>
#include <salusereventlist.hxx>
#include <osl/conditn.hxx>
+#include <o3tl/make_unique.hxx>
#include <QtCore/QObject>
@@ -31,8 +31,40 @@ class QApplication;
class SalYieldMutex;
class SalFrame;
+#ifdef _WIN32
+#include <salinst.hxx>
+#include <comphelper/solarmutex.hxx>
+#else
+#include <unx/geninst.h>
+#endif
+
+// Qts moc doesn't like macros, so this is handled by an extra base class
+// It also keeps all the #ifdef handling local
+class VCLPLUG_QT5_PUBLIC Qt5MocInstance
+#ifdef _WIN32
+ : public SalInstance
+#else
+ : public SalGenericInstance
+#endif
+{
+public:
+ Qt5MocInstance()
+#ifdef _WIN32
+ : SalInstance(o3tl::make_unique<comphelper::SolarMutex>())
+#else
+ : SalGenericInstance(o3tl::make_unique<SalYieldMutex>())
+#endif
+ {
+ }
+
+#ifndef _WIN32
+ virtual GenPspGraphics* CreatePrintGraphics() override;
+ virtual void PostPrintersChanged() override;
+#endif
+};
+
class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject,
- public SalGenericInstance,
+ public Qt5MocInstance,
public SalUserEventList
{
Q_OBJECT
@@ -78,7 +110,6 @@ public:
virtual void GetPrinterQueueState(SalPrinterQueueInfo* pInfo) override;
virtual void DeletePrinterQueueInfo(SalPrinterQueueInfo* pInfo) override;
virtual OUString GetDefaultPrinter() override;
- virtual void PostPrintersChanged() override;
virtual std::unique_ptr<SalMenu> CreateMenu(bool, Menu*) override;
virtual std::unique_ptr<SalMenuItem> CreateMenuItem(const SalItemParams&) override;
@@ -97,8 +128,6 @@ public:
virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType,
const OUString& rDocumentService) override;
- virtual GenPspGraphics* CreatePrintGraphics() override;
-
virtual bool IsMainThread() const override;
virtual void TriggerUserEventProcessing() override;
diff --git a/vcl/inc/qt5/Qt5Printer.hxx b/vcl/inc/qt5/Qt5Printer.hxx
index 81a38206e4f1..4fcae075fe3c 100644
--- a/vcl/inc/qt5/Qt5Printer.hxx
+++ b/vcl/inc/qt5/Qt5Printer.hxx
@@ -19,11 +19,22 @@
#pragma once
+#ifndef _WIN32
#include <unx/genprn.h>
+#else
+#include <WinDef.h>
+#include <win/salprn.h>
+#endif
+class Point;
class SalFrame;
-class Qt5Printer : public PspSalPrinter
+class Qt5Printer
+#ifndef _WIN32
+ : public PspSalPrinter
+#else
+ : public WinSalPrinter
+#endif
{
public:
Qt5Printer(SalInfoPrinter* pInfoPrinter);
diff --git a/vcl/inc/qt5/Qt5System.hxx b/vcl/inc/qt5/Qt5System.hxx
index 0d51bb29f358..6bd732956137 100644
--- a/vcl/inc/qt5/Qt5System.hxx
+++ b/vcl/inc/qt5/Qt5System.hxx
@@ -10,15 +10,27 @@
#pragma once
#include <vcl/sysdata.hxx>
+
+#ifndef _WIN32
#include <unx/gensys.h>
+#else
+#include <win/salsys.h>
+#endif
-class Qt5System : public SalGenericSystem
+class Qt5System
+#ifndef _WIN32
+ : public SalGenericSystem
+#else
+ : public WinSalSystem
+#endif
{
public:
+#ifndef _WIN32
virtual unsigned int GetDisplayScreenCount() override;
virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override;
virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage,
const std::vector<OUString>& rButtons) override;
+#endif
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index c919b401e191..967cac0507de 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -82,7 +82,9 @@ inline QImage::Format getBitFormat(sal_uInt16 nBitCount)
std::abort();
break;
}
+#ifndef _WIN32
return QImage::Format_Invalid;
+#endif
}
inline sal_uInt16 getFormatBits(QImage::Format eFormat)
@@ -102,10 +104,13 @@ inline sal_uInt16 getFormatBits(QImage::Format eFormat)
return 32;
default:
std::abort();
+#ifndef _WIN32
return 0;
+#endif
}
}
+#ifndef _WIN32
typedef struct _cairo_surface cairo_surface_t;
struct CairoDeleter
{
@@ -113,6 +118,7 @@ struct CairoDeleter
};
typedef std::unique_ptr<cairo_surface_t, CairoDeleter> UniqueCairoSurface;
+#endif
sal_uInt16 GetKeyModCode(Qt::KeyboardModifiers eKeyModifiers);
sal_uInt16 GetMouseModCode(Qt::MouseButtons eButtons);
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index c0c6e7fb7932..ef8737acc1f4 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -70,7 +70,7 @@ public:
};
-class WinSalPrinter : public SalPrinter
+class SAL_DLLPUBLIC_EXPORT WinSalPrinter : public SalPrinter
{
public:
WinSalGraphics* mpGraphics; // current Printer graphics
diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h
index 03f627b5abb2..59f087136b79 100644
--- a/vcl/inc/win/salsys.h
+++ b/vcl/inc/win/salsys.h
@@ -25,7 +25,7 @@
#include <vector>
#include <map>
-class WinSalSystem : public SalSystem
+class SAL_DLLPUBLIC_EXPORT WinSalSystem : public SalSystem
{
public:
struct DisplayMonitor
diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx
index 1830dab0e523..1e2166a34c72 100644
--- a/vcl/qt5/Qt5Data.cxx
+++ b/vcl/qt5/Qt5Data.cxx
@@ -149,11 +149,21 @@
#include <unx/x11_cursors/wsshow_curs.h>
#include <unx/x11_cursors/wsshow_mask.h>
+#ifndef _WIN32
#include <unx/glyphcache.hxx>
+#endif
Qt5Data::Qt5Data(SalInstance* pInstance)
+#ifndef _WIN32
: GenericUnixSalData(SAL_DATA_QT5, pInstance)
+#else
+ : SalData()
+#endif
{
+#ifdef _WIN32
+ m_pInstance = pInstance;
+ SetSalData(this);
+#endif
ImplSVData* pSVData = ImplGetSVData();
// draw toolbars on separate lines
@@ -308,9 +318,11 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle)
return *m_aCursors[ePointerStyle];
}
+#ifndef _WIN32
void Qt5Data::ErrorTrapPush() {}
bool Qt5Data::ErrorTrapPop(bool /*bIgnoreError*/) { return false; }
+#endif
bool Qt5Data::noNativeControls()
{
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 66272a9f34f6..92d0e801f54e 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)
@@ -178,6 +182,7 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect)
CallCallback(SalEvent::Paint, &aPaintEvt);
}
+#ifndef _WIN32
void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
{
int width = 640;
@@ -189,6 +194,7 @@ void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
nullptr);
TriggerPaintEvent();
}
+#endif
SalGraphics* Qt5Frame::AcquireGraphics()
{
@@ -197,6 +203,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
m_bGraphicsInUse = true;
+#ifndef _WIN32
if (m_bUseCairo)
{
if (!m_pOurSvpGraphics.get())
@@ -207,6 +214,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
return m_pOurSvpGraphics.get();
}
else
+#endif
{
if (!m_pQt5Graphics.get())
{
@@ -222,9 +230,11 @@ SalGraphics* Qt5Frame::AcquireGraphics()
void Qt5Frame::ReleaseGraphics(SalGraphics* pSalGraph)
{
(void)pSalGraph;
+#ifndef _WIN32
if (m_bUseCairo)
assert(pSalGraph == m_pOurSvpGraphics.get());
else
+#endif
assert(pSalGraph == m_pQt5Graphics.get());
m_bGraphicsInUse = false;
}
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index fbf7ae05bf6b..05c514a0a927 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -28,6 +28,8 @@
#include <QtWidgets/QPushButton>
#include <QtWidgets/QWidget>
+#include <vcl/sysdata.hxx>
+
Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage )
: m_pFrame( pFrame )
, m_pQImage( pQImage )
diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index d98cdafe0137..1818fb041055 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -595,9 +595,7 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part,
}
else if (type == ControlType::Progress && part == ControlPart::Entire)
{
- SAL_WNODEPRECATED_DECLARATIONS_PUSH
- QStyleOptionProgressBarV2 option;
- SAL_WNODEPRECATED_DECLARATIONS_POP
+ QStyleOptionProgressBar option;
option.minimum = 0;
option.maximum = widgetRect.width();
option.progress = value.getNumericVal();
@@ -801,6 +799,7 @@ bool Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart
retVal = true;
break;
default:
+ h = 0; w = 0;
break;
}
if (retVal)
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 94aa069db0c1..e39c1b8c95a3 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -23,8 +23,10 @@
#include <Qt5Painter.hxx>
#include <vcl/fontcharmap.hxx>
+#ifndef _WIN32
#include <unx/geninst.h>
#include <unx/fontmanager.hxx>
+#endif
#include <sallayout.hxx>
#include <PhysicalFontCollection.hxx>
@@ -88,7 +90,9 @@ bool Qt5Graphics::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities)
void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
{
+#ifndef _WIN32
static const bool bUseFontconfig = (nullptr == getenv("SAL_VCL_QT5_NO_FONTCONFIG"));
+#endif
m_pFontCollection = pPFC;
if (pPFC->Count())
@@ -96,6 +100,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
QFontDatabase aFDB;
+#ifndef _WIN32
if (bUseFontconfig)
{
::std::vector<psp::fontID> aList;
@@ -114,6 +119,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC)
SalGenericInstance::RegisterFontSubstitutors(pPFC);
}
+#endif
for (auto& family : aFDB.families())
for (auto& style : aFDB.styles(family))
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index f780860dccc5..6325bb34df53 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -48,7 +48,7 @@
#include <headless/svpbmp.hxx>
Qt5Instance::Qt5Instance(bool bUseCairo)
- : SalGenericInstance(o3tl::make_unique<SalYieldMutex>())
+ : Qt5MocInstance()
, m_postUserEventId(-1)
, m_bUseCairo(bUseCairo)
{
@@ -100,6 +100,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);
@@ -110,6 +111,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);
@@ -135,9 +139,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>();
}
@@ -299,23 +305,27 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance()
for (int i = 0; i < nFakeArgc; i++)
pFakeArgv[i] = pFakeArgvFreeable[i];
+#ifndef _WIN32
char* session_manager = nullptr;
if (getenv("SESSION_MANAGER") != nullptr)
{
session_manager = strdup(getenv("SESSION_MANAGER"));
unsetenv("SESSION_MANAGER");
}
+#endif
int* pFakeArgc = new int;
*pFakeArgc = nFakeArgc;
pQApplication = new QApplication(*pFakeArgc, pFakeArgv);
+#ifndef _WIN32
if (session_manager != nullptr)
{
// coverity[tainted_string] - trusted source for setenv
setenv("SESSION_MANAGER", session_manager, 1);
free(session_manager);
}
+#endif
QApplication::setQuitOnLastWindowClosed(false);
diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx
index 501db07e7362..5b7864ef6fe4 100644
--- a/vcl/qt5/Qt5Instance_Print.cxx
+++ b/vcl/qt5/Qt5Instance_Print.cxx
@@ -20,23 +20,26 @@
#include <Qt5Instance.hxx>
#include <Qt5Printer.hxx>
+#ifndef _WIN32
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
-#include <printerinfomanager.hxx>
#include <jobset.h>
#include <print.h>
-#include <salptype.hxx>
#include <saldatabasic.hxx>
+#include <salptype.hxx>
+#include <printerinfomanager.hxx>
#include <unx/genpspgraphics.h>
using namespace psp;
+#endif
/*
* static helpers
*/
+#ifndef _WIN32
static OUString getPdfDir(const PrinterInfo& rInfo)
{
OUString aDir;
@@ -55,30 +58,42 @@ static OUString getPdfDir(const PrinterInfo& rInfo)
}
return aDir;
}
+#endif
SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
ImplJobSetup* pJobSetup)
{
+#ifndef _WIN32
// create and initialize SalInfoPrinter
PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter;
configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup);
return pPrinter;
+#else
+ (void)pQueueInfo; (void)pJobSetup;
+ return nullptr;
+#endif
}
void Qt5Instance::DestroyInfoPrinter(SalInfoPrinter* pPrinter) { delete pPrinter; }
std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrinter)
{
+#ifndef _WIN32
// create and initialize SalPrinter
Qt5Printer* pPrinter = new Qt5Printer(pInfoPrinter);
pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
return std::unique_ptr<SalPrinter>(pPrinter);
+#else
+ (void)pInfoPrinter;
+ return std::unique_ptr<SalPrinter>();
+#endif
}
void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
{
+#ifndef _WIN32
PrinterInfoManager& rManager(PrinterInfoManager::get());
static const char* pNoSyncDetection = getenv("SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION");
if (!pNoSyncDetection || !*pNoSyncDetection)
@@ -112,6 +127,9 @@ void Qt5Instance::GetPrinterQueueInfo(ImplPrnQueueList* pList)
pList->Add(pInfo);
}
+#else
+ (void)pList;
+#endif
}
void Qt5Instance::DeletePrinterQueueInfo(SalPrinterQueueInfo* pInfo) { delete pInfo; }
@@ -120,12 +138,18 @@ void Qt5Instance::GetPrinterQueueState(SalPrinterQueueInfo*) {}
OUString Qt5Instance::GetDefaultPrinter()
{
+#ifndef _WIN32
PrinterInfoManager& rManager(PrinterInfoManager::get());
return rManager.getDefaultPrinter();
+#else
+ return OUString();
+#endif
}
-void Qt5Instance::PostPrintersChanged() {}
+#ifndef _WIN32
+void Qt5MocInstance::PostPrintersChanged() {}
-GenPspGraphics* Qt5Instance::CreatePrintGraphics() { return new GenPspGraphics(); }
+GenPspGraphics* Qt5MocInstance::CreatePrintGraphics() { return new GenPspGraphics(); }
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Painter.cxx b/vcl/qt5/Qt5Painter.cxx
index 06eeb2895214..efaf04e9b570 100644
--- a/vcl/qt5/Qt5Painter.cxx
+++ b/vcl/qt5/Qt5Painter.cxx
@@ -20,6 +20,7 @@
#include <Qt5Painter.hxx>
#include <QtGui/QColor>
+#include <QtWidgets/QPushButton>
Qt5Painter::Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush, sal_uInt8 nTransparency)
: m_rGraphics(rGraphics)
diff --git a/vcl/qt5/Qt5Printer.cxx b/vcl/qt5/Qt5Printer.cxx
index 16a6a1115073..2f30b3b53720 100644
--- a/vcl/qt5/Qt5Printer.cxx
+++ b/vcl/qt5/Qt5Printer.cxx
@@ -17,10 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <svsys.h>
+#include <salptype.hxx>
+
+#include <tools/gen.hxx>
#include <Qt5Printer.hxx>
-Qt5Printer::Qt5Printer(SalInfoPrinter* pInfoPrinter)
+Qt5Printer::Qt5Printer(SalInfoPrinter* /* pInfoPrinter */)
+#ifndef _WIN32
: PspSalPrinter(pInfoPrinter)
+#else
+ : WinSalPrinter()
+#endif
{
}
diff --git a/vcl/qt5/Qt5Tools.cxx b/vcl/qt5/Qt5Tools.cxx
index 54ac3f99e26f..b12a03539bbb 100644
--- a/vcl/qt5/Qt5Tools.cxx
+++ b/vcl/qt5/Qt5Tools.cxx
@@ -19,11 +19,13 @@
#include <Qt5Tools.hxx>
-#include <cairo.h>
-
#include <vcl/event.hxx>
+#ifndef _WIN32
+#include <cairo.h>
+
void CairoDeleter::operator()(cairo_surface_t* pSurface) const { cairo_surface_destroy(pSurface); }
+#endif
sal_uInt16 GetKeyModCode(Qt::KeyboardModifiers eKeyModifiers)
{
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index a47aaca8b853..c3f416ce8f22 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);
@@ -273,9 +279,11 @@ static sal_uInt16 GetKeyCode(int keyval)
case Qt::Key_Insert:
nCode = KEY_INSERT;
break;
+#ifndef _WIN32
case Qt::Key_Delete:
nCode = KEY_DELETE;
break;
+#endif
case Qt::Key_Plus:
nCode = KEY_ADD;
break;
commit d0777b400c48867da3a26313949093efeb8787eb
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 19 12:03:01 2018 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 19 14:52:15 2018 +0200
Turn ScStyleSheet::Usage into scoped enum
...to avoid -Werror,-Wshadow from Clang trunk with
<https://reviews.llvm.org/D52400> "Improve -Wshadow warnings with enumerators",
warning about shadowing of USAGE in e.g. enum ESCHER_BlibType in
include/filter/msfilter/escherex.hxx
Change-Id: If492c5086402e46158d3de5d4d6b00b61412c655
Reviewed-on: https://gerrit.libreoffice.org/61985
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx
index b1b4ad68e7c7..bd5aa843d8b4 100644
--- a/sc/inc/stlsheet.hxx
+++ b/sc/inc/stlsheet.hxx
@@ -32,7 +32,7 @@ friend class ScStyleSheetPool;
public:
- enum Usage
+ enum class Usage
{
UNKNOWN,
USED,
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 5c3d5a7153ab..e5c3f3534e55 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1850,7 +1850,7 @@ bool ScAttrArray::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
const ScStyleSheet* pStyle = pDocument->GetDefPattern()->GetStyleSheet();
if ( pStyle )
{
- pStyle->SetUsage( ScStyleSheet::USED );
+ pStyle->SetUsage( ScStyleSheet::Usage::USED );
if ( pStyle == &rStyle )
return true;
}
@@ -1865,7 +1865,7 @@ bool ScAttrArray::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
const ScStyleSheet* pStyle = mvData[nPos].pPattern->GetStyleSheet();
if ( pStyle )
{
- pStyle->SetUsage( ScStyleSheet::USED );
+ pStyle->SetUsage( ScStyleSheet::Usage::USED );
if ( pStyle == &rStyle )
{
bIsUsed = true;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 490cb93e59a4..4a9b7fb93c3e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4967,7 +4967,7 @@ void ScDocument::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool b
bool ScDocument::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
{
- if ( bStyleSheetUsageInvalid || rStyle.GetUsage() == ScStyleSheet::UNKNOWN )
+ if ( bStyleSheetUsageInvalid || rStyle.GetUsage() == ScStyleSheet::Usage::UNKNOWN )
{
SfxStyleSheetIterator aIter( mxPoolHelper->GetStylePool(),
SfxStyleFamily::Para );
@@ -4977,7 +4977,7 @@ bool ScDocument::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
if (pStyle->isScStyleSheet())
{
const ScStyleSheet* pScStyle = static_cast<const ScStyleSheet*>( pStyle );
- pScStyle->SetUsage( ScStyleSheet::NOTUSED );
+ pScStyle->SetUsage( ScStyleSheet::Usage::NOTUSED );
}
}
@@ -4999,7 +4999,7 @@ bool ScDocument::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
return bIsUsed;
}
- return rStyle.GetUsage() == ScStyleSheet::USED;
+ return rStyle.GetUsage() == ScStyleSheet::Usage::USED;
}
bool ScDocument::ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow,
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 21c24e4ec913..3597205aa829 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -54,13 +54,13 @@ ScStyleSheet::ScStyleSheet( const OUString& rName,
SfxStyleSearchBits nMaskP )
: SfxStyleSheet ( rName, rPoolP, eFamily, nMaskP )
- , eUsage( UNKNOWN )
+ , eUsage( Usage::UNKNOWN )
{
}
ScStyleSheet::ScStyleSheet( const ScStyleSheet& rStyle )
: SfxStyleSheet ( rStyle )
- , eUsage( UNKNOWN )
+ , eUsage( Usage::UNKNOWN )
{
}
@@ -261,10 +261,10 @@ bool ScStyleSheet::IsUsed() const
// and store the state.
ScDocument* pDoc = static_cast<ScStyleSheetPool*>(m_pPool)->GetDocument();
if ( pDoc && pDoc->IsStyleSheetUsed( *this ) )
- eUsage = USED;
+ eUsage = Usage::USED;
else
- eUsage = NOTUSED;
- return eUsage == USED;
+ eUsage = Usage::NOTUSED;
+ return eUsage == Usage::USED;
}
else
return true;
commit 22a2ed832bae50f85a254f0604d375aeca207c9e
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 18 14:30:42 2018 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Oct 19 14:43:05 2018 +0200
Introduce UnixErrnoString() and use it in sal/osl/unx
The UnixErrnoString() function returns the symbolic name of an errno
value, like "ENOENT". For now this is local to sal/osl/unx.
If it can't figure out the symbolic name, it returns it as a number
followed by the cleartext description (as from strerror()) in
parentheses.
Rationale why to use this and not strerror(): This is intended to be
used in SAL_INFO() and SAL_WARN(). Such messages are intended to be
read by developers, not end-users. Developers are (or should be)
familiar with symbolic errno names in code anyway. The symbolic names
of errno values are (or should be) instantly recognizable as such,
they all start with E and are in UPPERCASE.
strerror() can be localised although in LibreOffice it apparently
isn't as there allegedly aren't setlocale() calls. But, anyway, the
error strings might be less familiar to a developer than the symbolc
errno names that one uses when coding.
When encountering an unfamiliar error string the developer might want
to add special handling for that error case in the code. They would
need a reverse mapping from error string to errno value, by manually
searching <errno.h>, looking at the comments there, hoping the match
what strerror() produces, to find the corresponding symbolic errno
value.
Change-Id: Idc11595d528e8432a32bf474e6791f4ea7262a1e
Reviewed-on: https://gerrit.libreoffice.org/61931
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/sal/osl/unx/conditn.cxx b/sal/osl/unx/conditn.cxx
index 45f1c0e600a2..cede35a86d04 100644
--- a/sal/osl/unx/conditn.cxx
+++ b/sal/osl/unx/conditn.cxx
@@ -22,6 +22,7 @@
#include <assert.h>
#include "system.hxx"
+#include "unixerrnostring.hxx"
#include <sal/log.hxx>
#include <sal/types.h>
@@ -53,7 +54,7 @@ oslCondition SAL_CALL osl_createCondition()
nRet = pthread_cond_init(&pCond->m_Condition, PTHREAD_CONDATTR_DEFAULT);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "pthread_cond_init failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "pthread_cond_init failed: " << UnixErrnoString(nRet) );
free(pCond);
return nullptr;
@@ -62,10 +63,10 @@ oslCondition SAL_CALL osl_createCondition()
nRet = pthread_mutex_init(&pCond->m_Lock, PTHREAD_MUTEXATTR_DEFAULT);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "pthread_mutex_init failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "pthread_mutex_init failed: " << UnixErrnoString(nRet) );
nRet = pthread_cond_destroy(&pCond->m_Condition);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "pthread_cond_destroy failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "pthread_cond_destroy failed: " << UnixErrnoString(nRet) );
free(pCond);
pCond = nullptr;
@@ -87,9 +88,9 @@ void SAL_CALL osl_destroyCondition(oslCondition Condition)
if ( pCond )
{
int nRet = pthread_cond_destroy(&pCond->m_Condition);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "pthread_cond_destroy failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "pthread_cond_destroy failed: " << UnixErrnoString(nRet) );
nRet = pthread_mutex_destroy(&pCond->m_Lock);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "pthread_mutex_destroy failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "pthread_mutex_destroy failed: " << UnixErrnoString(nRet) );
free(Condition);
}
@@ -106,7 +107,7 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
nRet = pthread_mutex_lock(&pCond->m_Lock);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "osl_setCondition(" << pCond << "): pthread_mutex_lock failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "osl_setCondition(" << pCond << "): pthread_mutex_lock failed: " << UnixErrnoString(nRet) );
return false;
}
@@ -114,7 +115,7 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
nRet = pthread_cond_broadcast(&pCond->m_Condition);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "osl_setCondition(" << pCond << "): pthread_cond_broadcast failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "osl_setCondition(" << pCond << "): pthread_cond_broadcast failed: " << UnixErrnoString(nRet) );
// try to unlock the mutex
pthread_mutex_unlock(&pCond->m_Lock);
return false;
@@ -123,7 +124,7 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
nRet = pthread_mutex_unlock(&pCond->m_Lock);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "osl_setCondition(" << pCond << "): pthread_mutex_unlock failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "osl_setCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
return false;
}
@@ -145,7 +146,7 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
nRet = pthread_mutex_lock(&pCond->m_Lock);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "osl_resetCondition(" << pCond << "): pthread_mutex_lock failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "osl_resetCondition(" << pCond << "): pthread_mutex_lock failed: " << UnixErrnoString(nRet) );
return false;
}
@@ -154,7 +155,7 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
nRet = pthread_mutex_unlock(&pCond->m_Lock);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "osl_resetCondition(" << pCond << "): pthread_mutex_unlock failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "osl_resetCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
return false;
}
@@ -177,7 +178,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
nRet = pthread_mutex_lock(&pCond->m_Lock);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_lock failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_lock failed: " << UnixErrnoString(nRet) );
return osl_cond_result_error;
}
@@ -203,7 +204,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
{
Result = osl_cond_result_timeout;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
return Result;
}
@@ -211,7 +212,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
{
Result = osl_cond_result_error;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
return Result;
}
}
@@ -226,10 +227,10 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
nRet = pthread_cond_wait(&pCond->m_Condition, &pCond->m_Lock);
if ( nRet != 0 )
{
- SAL_WARN( "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_cond_wait failed: " << strerror(nRet) );
+ SAL_WARN( "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_cond_wait failed: " << UnixErrnoString(nRet) );
Result = osl_cond_result_error;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
return Result;
}
@@ -237,7 +238,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
}
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
SAL_INFO( "sal.osl.condition", "osl_waitCondition(" << pCond << "): " << (Result == osl_cond_result_ok ? "OK" : "ERROR") );
@@ -254,12 +255,12 @@ sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition)
pCond = static_cast<oslConditionImpl*>(Condition);
nRet = pthread_mutex_lock(&pCond->m_Lock);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_checkCondition(" << pCond << "): pthread_mutex_lock failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_checkCondition(" << pCond << "): pthread_mutex_lock failed: " << UnixErrnoString(nRet) );
State = pCond->m_State;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_checkCondition(" << pCond << "): pthread_mutex_unlock failed: " << strerror(nRet) );
+ SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_checkCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
SAL_INFO( "sal.osl.condition", "osl_checkCondition(" << pCond << "): " << (State ? "YES" : "NO") );
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index ae1bc31c9069..9f888579e3a9 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -33,6 +33,7 @@
#include "file_impl.hxx"
#include "file_url.hxx"
#include "uunxapi.hxx"
+#include "unixerrnostring.hxx"
#include <algorithm>
#include <cassert>
@@ -257,7 +258,7 @@ oslFileError FileHandle_Impl::setSize(sal_uInt64 uSize)
if (nCurPos == off_t(-1))
{
int e = errno;
- SAL_INFO("sal.file", "lseek(" << m_fd << ",0,SEEK_CUR): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "lseek(" << m_fd << ",0,SEEK_CUR): " << UnixErrnoString(e));
return result;
}
else
@@ -267,7 +268,7 @@ oslFileError FileHandle_Impl::setSize(sal_uInt64 uSize)
if (lseek(m_fd, static_cast<off_t>(nSize - 1), SEEK_SET) == -1)
{
int e = errno;
- SAL_INFO("sal.file", "lseek(" << m_fd << "," << nSize - 1 << ",SEEK_SET): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "lseek(" << m_fd << "," << nSize - 1 << ",SEEK_SET): " << UnixErrnoString(e));
return result;
}
else
@@ -277,7 +278,7 @@ oslFileError FileHandle_Impl::setSize(sal_uInt64 uSize)
{
/* Failure. Restore saved position */
int e = errno;
- SAL_INFO("sal.file", "write(" << m_fd << ",\"\",1): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "write(" << m_fd << ",\"\",1): " << UnixErrnoString(e));
(void) lseek(m_fd, nCurPos, SEEK_SET);
return result;
}
@@ -912,7 +913,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI
if (f == -1)
{
int e = errno;
- SAL_INFO("sal.file", "fcntl(" << fd << ",F_GETFL,0): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "fcntl(" << fd << ",F_GETFL,0): " << UnixErrnoString(e));
eRet = oslTranslateFileError(e);
(void) close(fd);
SAL_INFO("sal.file", "close(" << fd << ")");
@@ -924,7 +925,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI
if (fcntl(fd, F_SETFL, (f & ~O_NONBLOCK)) == -1)
{
int e = errno;
- SAL_INFO("sal.file", "fcntl(" << fd << ",F_SETFL,(f & ~O_NONBLOCK)): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "fcntl(" << fd << ",F_SETFL,(f & ~O_NONBLOCK)): " << UnixErrnoString(e));
eRet = oslTranslateFileError(e);
(void) close(fd);
SAL_INFO("sal.file", "close(" << fd << ")");
@@ -940,7 +941,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI
if (fstat(fd, &aFileStat) == -1)
{
int e = errno;
- SAL_INFO("sal.file", "fstat(" << fd << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "fstat(" << fd << "): " << UnixErrnoString(e));
eRet = oslTranslateFileError(e);
(void) close(fd);
SAL_INFO("sal.file", "close(" << fd << ")");
@@ -964,7 +965,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI
if (flock(fd, LOCK_EX | LOCK_NB) == -1)
{
int e = errno;
- SAL_INFO("sal.file", "flock(" << fd << ",LOCK_EX|LOCK_NB): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "flock(" << fd << ",LOCK_EX|LOCK_NB): " << UnixErrnoString(e));
/* Mac OSX returns ENOTSUP for webdav drives. We should try read lock */
// Restore errno after possibly having been overwritten by the SAL_INFO above...
@@ -990,7 +991,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI
if (fcntl(fd, F_SETLK, &aflock) == -1)
{
int e = errno;
- SAL_INFO("sal.file", "fcntl(" << fd << ",F_SETLK): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "fcntl(" << fd << ",F_SETLK): " << UnixErrnoString(e));
eRet = oslTranslateFileError(e);
(void) close(fd);
SAL_INFO("sal.file", "close(" << fd << ")");
@@ -1070,7 +1071,7 @@ oslFileError SAL_CALL osl_closeFile(oslFileHandle Handle)
else if (close(pImpl->m_fd) == -1)
{
int e = errno;
- SAL_INFO("sal.file", "close(" << pImpl->m_fd << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "close(" << pImpl->m_fd << "): " << UnixErrnoString(e));
/* translate error code */
result = oslTranslateFileError(e);
}
@@ -1102,7 +1103,7 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle)
if (fsync(pImpl->m_fd) == -1)
{
int e = errno;
- SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): " << UnixErrnoString(e));
return oslTranslateFileError(e);
}
else
@@ -1204,7 +1205,7 @@ oslFileError SAL_CALL osl_mapFile(
#elif defined __sun
if (madvise(static_cast< caddr_t >(p), nLength, MADV_WILLNEED) != 0)
- SAL_INFO("sal.file", "madvise(..., MADV_WILLNEED) failed with " << strerror(errno));
+ SAL_INFO("sal.file", "madvise(..., MADV_WILLNEED) failed with " << UnixErrnoString(errno));
#endif
}
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index a45d32e4c79e..05e72997070b 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -34,6 +34,7 @@
#include "file_url.hxx"
#include "uunxapi.hxx"
#include "readwrite_helper.hxx"
+#include "unixerrnostring.hxx"
#include <sys/types.h>
#include <errno.h>
@@ -217,7 +218,7 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
else
{
int e = errno;
- SAL_INFO("sal.file", "opendir(" << path << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "opendir(" << path << "): " << UnixErrnoString(e));
// Restore errno after possible modification by SAL_INFO above
errno = e;
}
@@ -250,7 +251,7 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory pDirectory)
if (closedir( pDirImpl->pDirStruct) != 0)
{
int e = errno;
- SAL_INFO("sal.file", "closedir(" << pDirImpl->pDirStruct << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "closedir(" << pDirImpl->pDirStruct << "): " << UnixErrnoString(e));
err = oslTranslateFileError(e);
}
else
@@ -470,7 +471,7 @@ oslFileError osl_psz_createDirectory(char const * pszPath, sal_uInt32 flags)
if ( nRet < 0 )
{
nRet=errno;
- SAL_INFO("sal.file", "mkdir(" << pszPath << ",0" << std::oct << mode << std::dec << "): errno " << nRet << ": " << strerror(nRet));
+ SAL_INFO("sal.file", "mkdir(" << pszPath << ",0" << std::oct << mode << std::dec << "): " << UnixErrnoString(nRet));
return oslTranslateFileError(nRet);
}
else
@@ -488,7 +489,7 @@ static oslFileError osl_psz_removeDirectory( const sal_Char* pszPath )
if ( nRet < 0 )
{
nRet=errno;
- SAL_INFO("sal.file", "rmdir(" << pszPath << "): errno " << nRet << ": " << strerror(nRet));
+ SAL_INFO("sal.file", "rmdir(" << pszPath << "): " << UnixErrnoString(nRet));
return oslTranslateFileError(nRet);
}
else
@@ -712,7 +713,7 @@ static oslFileError osl_unlinkFile(const sal_Char* pszPath)
if (nRet < 0)
{
nRet=errno;
- SAL_INFO("sal.file", "unlink(" << pszPath << "): errno " << nRet << ": " << strerror(nRet));
+ SAL_INFO("sal.file", "unlink(" << pszPath << "): " << UnixErrnoString(nRet));
return oslTranslateFileError(nRet);
}
else
@@ -730,7 +731,7 @@ static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* ps
if (nRet < 0)
{
nRet=errno;
- SAL_INFO("sal.file", "rename(" << pszPath << "," << pszDestPath << "): errno " << nRet << ": " << strerror(nRet));
+ SAL_INFO("sal.file", "rename(" << pszPath << "," << pszDestPath << "): " << UnixErrnoString(nRet));
return oslTranslateFileError(nRet);
}
else
@@ -820,7 +821,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
{
int e = errno;
SAL_INFO("sal.file", "rename(" << pszDestFileName << ", " << tmpDestFile
- << "): errno " << e << ": " << strerror(e));
+ << "): " << UnixErrnoString(e));
if (e == ENOENT)
{
DestFileExists = 0;
@@ -859,7 +860,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
if (unlink(pszDestFileName) != 0)
{
int e = errno;
- SAL_INFO("sal.file", "unlink(" << pszDestFileName << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "unlink(" << pszDestFileName << "): " << UnixErrnoString(e));
}
else
SAL_INFO("sal.file", "unlink(" << pszDestFileName << "): OK");
@@ -868,7 +869,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
{
int e = errno;
SAL_INFO("sal.file", "rename(" << tmpDestFile << ", " << pszDestFileName
- << "): errno " << e << ": " << strerror(e));
+ << "): " << UnixErrnoString(e));
}
else
SAL_INFO("sal.file", "rename(" << tmpDestFile << ", " << pszDestFileName << "): OK");
@@ -898,7 +899,7 @@ void attemptChangeMetadata( const sal_Char* pszFileName, mode_t nMode, time_t nA
#endif
{
int e = errno;
- SAL_INFO("sal.file", "chmod(" << pszFileName << ",0" << std::oct << nMode << std::dec <<"): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "chmod(" << pszFileName << ",0" << std::oct << nMode << std::dec <<"): " << UnixErrnoString(e));
}
else
SAL_INFO("sal.file", "chmod(" << pszFileName << ",0" << std::oct << nMode << std::dec <<"): OK");
@@ -979,7 +980,7 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
if ( DestFileFD < 0 )
{
nRet=errno;
- SAL_INFO("sal.file", "open(" << pszDestFileName << ",O_WRONLY|O_CREAT,0" << std::oct << mode << std::dec << "): errno " << nRet << ": " << strerror(nRet));
+ SAL_INFO("sal.file", "open(" << pszDestFileName << ",O_WRONLY|O_CREAT,0" << std::oct << mode << std::dec << "): " << UnixErrnoString(nRet));
osl_closeFile(SourceFileFH);
return nRet;
}
@@ -1023,7 +1024,7 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
if ( close( DestFileFD ) == -1 )
{
int e = errno;
- SAL_INFO("sal.file", "close(" << DestFileFD << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "close(" << DestFileFD << "): " << UnixErrnoString(e));
if ( nRet == 0 )
nRet = e;
}
diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx
index 570b452a4cfa..72c36f5eb9ab 100644
--- a/sal/osl/unx/mutex.cxx
+++ b/sal/osl/unx/mutex.cxx
@@ -24,6 +24,7 @@
#endif
#endif
#include "system.hxx"
+#include "unixerrnostring.hxx"
#include <sal/log.hxx>
#include <osl/mutex.h>
@@ -57,7 +58,7 @@ oslMutex SAL_CALL osl_createMutex()
nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr);
if ( nRet != 0 )
{
- SAL_WARN("sal.osl.mutex", "pthread_muxex_init failed: " << strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_muxex_init failed: " << UnixErrnoString(nRet));
free(pMutex);
pMutex = nullptr;
@@ -79,7 +80,7 @@ void SAL_CALL osl_destroyMutex(oslMutexImpl *pMutex)
nRet = pthread_mutex_destroy(&(pMutex->mutex));
if ( nRet != 0 )
{
- SAL_WARN("sal.osl.mutex", "pthread_mutex_destroy failed: " << strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_mutex_destroy failed: " << UnixErrnoString(nRet));
}
free(pMutex);
@@ -97,7 +98,7 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutexImpl *pMutex)
nRet = pthread_mutex_lock(&(pMutex->mutex));
if ( nRet != 0 )
{
- SAL_WARN("sal.osl.mutex", "pthread_mutex_lock failed: " << strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_mutex_lock failed: " << UnixErrnoString(nRet));
return false;
}
return true;
@@ -134,7 +135,7 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutexImpl *pMutex)
nRet = pthread_mutex_unlock(&(pMutex->mutex));
if ( nRet != 0 )
{
- SAL_WARN("sal.osl.mutex", "pthread_mutex_unlock failed: " << strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_mutex_unlock failed: " << UnixErrnoString(nRet));
return false;
}
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx
index 5d80168927a1..3af20aad5284 100644
--- a/sal/osl/unx/pipe.cxx
+++ b/sal/osl/unx/pipe.cxx
@@ -30,6 +30,7 @@
#include "sockimpl.hxx"
#include "secimpl.hxx"
+#include "unixerrnostring.hxx"
#include <cassert>
@@ -222,7 +223,7 @@ static oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Op
pPipe->m_Socket = socket(AF_UNIX, SOCK_STREAM, 0);
if (pPipe->m_Socket < 0)
{
- SAL_WARN("sal.osl.pipe", "socket() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "socket() failed: " << UnixErrnoString(errno));
destroyPipeImpl(pPipe);
return nullptr;
}
@@ -233,7 +234,7 @@ static oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Op
Flags |= FD_CLOEXEC;
if (fcntl(pPipe->m_Socket, F_SETFD, Flags) == -1)
{
- SAL_WARN("sal.osl.pipe", "fcntl() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "fcntl() failed: " << UnixErrnoString(errno));
}
}
@@ -270,7 +271,7 @@ static oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Op
/* ok, fs clean */
if (bind(pPipe->m_Socket, reinterpret_cast< sockaddr* >(&addr), len) < 0)
{
- SAL_WARN("sal.osl.pipe", "bind() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "bind() failed: " << UnixErrnoString(errno));
close(pPipe->m_Socket);
destroyPipeImpl(pPipe);
return nullptr;
@@ -286,7 +287,7 @@ static oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Op
if (listen(pPipe->m_Socket, 5) < 0)
{
- SAL_WARN("sal.osl.pipe", "listen() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "listen() failed: " << UnixErrnoString(errno));
// cid#1255391 warns about unlink(name) after stat(name, &status)
// above, but the intervening call to bind makes those two clearly
// unrelated, as it would fail if name existed at that point in
@@ -307,7 +308,7 @@ static oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Op
if (connect(pPipe->m_Socket, reinterpret_cast< sockaddr* >(&addr), len) >= 0)
return pPipe;
- SAL_WARN("sal.osl.pipe", "connect() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "connect() failed: " << UnixErrnoString(errno));
}
close (pPipe->m_Socket);
@@ -361,7 +362,7 @@ void SAL_CALL osl_closePipe(oslPipe pPipe)
int fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0)
{
- SAL_WARN("sal.osl.pipe", "socket() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "socket() failed: " << UnixErrnoString(errno));
return;
}
@@ -374,7 +375,7 @@ void SAL_CALL osl_closePipe(oslPipe pPipe)
nRet = connect(fd, reinterpret_cast< sockaddr* >(&addr), sizeof(addr));
if (nRet < 0)
- SAL_WARN("sal.osl.pipe", "connect() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "connect() failed: " << UnixErrnoString(errno));
close(fd);
}
@@ -382,11 +383,11 @@ void SAL_CALL osl_closePipe(oslPipe pPipe)
nRet = shutdown(ConnFD, 2);
if (nRet < 0)
- SAL_WARN("sal.osl.pipe", "shutdown() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "shutdown() failed: " << UnixErrnoString(errno));
nRet = close(ConnFD);
if (nRet < 0)
- SAL_WARN("sal.osl.pipe", "close() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "close() failed: " << UnixErrnoString(errno));
/* remove filesystem entry */
if (strlen(pPipe->m_Name) > 0)
@@ -418,7 +419,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
if (s < 0)
{
- SAL_WARN("sal.osl.pipe", "accept() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "accept() failed: " << UnixErrnoString(errno));
return nullptr;
}
@@ -446,7 +447,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
{
flags |= FD_CLOEXEC;
if (fcntl(s, F_SETFD, flags) < 0)
- SAL_WARN("sal.osl.pipe", "fcntl() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "fcntl() failed: " << UnixErrnoString(errno));
}
pAcceptedPipe->m_Socket = s;
@@ -471,7 +472,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe,
nRet = recv(pPipe->m_Socket, pBuffer, BytesToRead, 0);
if (nRet < 0)
- SAL_WARN("sal.osl.pipe", "recv() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "recv() failed: " << UnixErrnoString(errno));
return nRet;
}
@@ -493,7 +494,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe,
nRet = send(pPipe->m_Socket, pBuffer, BytesToSend, 0);
if (nRet <= 0)
- SAL_WARN("sal.osl.pipe", "send() failed: " << strerror(errno));
+ SAL_WARN("sal.osl.pipe", "send() failed: " << UnixErrnoString(errno));
return nRet;
}
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index b88e5246d1a7..480bb264a267 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -41,6 +41,7 @@
#endif
#include "system.hxx"
+#include "unixerrnostring.hxx"
#if defined(__sun)
# include <sys/procfs.h>
#endif
@@ -174,7 +175,7 @@ static void ChildStatusProc(void *pData)
OSL_ASSERT(geteuid() == 0); /* must be root */
if (! INIT_GROUPS(data.m_name, data.m_gid) || (setuid(data.m_uid) != 0))
- SAL_WARN("sal.osl", "Failed to change uid and guid, errno=" << errno << " (" << strerror(errno) << ")" );
+ SAL_WARN("sal.osl", "Failed to change uid and guid: " << UnixErrnoString(errno));
const rtl::OUString envVar("HOME");
osl_clearEnvironment(envVar.pData);
@@ -234,14 +235,14 @@ static void ChildStatusProc(void *pData)
execv(data.m_pszArgs[0], const_cast<char **>(data.m_pszArgs));
}
- SAL_WARN("sal.osl", "Failed to exec, errno=" << errno << " (" << strerror(errno) << ")");
+ SAL_WARN("sal.osl", "Failed to exec: " << UnixErrnoString(errno));
SAL_WARN("sal.osl", "ChildStatusProc : starting '" << data.m_pszArgs[0] << "' failed");
/* if we reach here, something went wrong */
errno_copy = errno;
if ( !safeWrite(channel[1], &errno_copy, sizeof(errno_copy)) )
- SAL_WARN("sal.osl", "sendFdPipe : sending failed (" << strerror(errno) << ")");
+ SAL_WARN("sal.osl", "sendFdPipe : sending failed: " << UnixErrnoString(errno));
if ( channel[1] != -1 )
close(channel[1]);
@@ -300,7 +301,7 @@ static void ChildStatusProc(void *pData)
if ( child_pid < 0)
{
- SAL_WARN("sal.osl", "Failed to wait for child process, errno=" << errno << " (" << strerror(errno) << ")");
+ SAL_WARN("sal.osl", "Failed to wait for child process: " << UnixErrnoString(errno));
/*
We got another error than EINTR. Anyway we have to wake up the
@@ -341,7 +342,7 @@ static void ChildStatusProc(void *pData)
else
{
SAL_WARN("sal.osl", "ChildStatusProc : starting '" << data.m_pszArgs[0] << "' failed");
- SAL_WARN("sal.osl", "Failed to launch child process, child reports errno=" << status << " (" << strerror(status) << ")");
+ SAL_WARN("sal.osl", "Failed to launch child process, child reports " << UnixErrnoString(status));
/* Close pipe ends */
if ( pdata->m_pInputWrite )
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 6af40898a58c..a986dfd0d41f 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -20,6 +20,7 @@
#include "system.hxx"
#include "readwrite_helper.hxx"
#include "file_url.hxx"
+#include "unixerrnostring.hxx"
#include <osl/diagnose.h>
#include <osl/profile.h>
@@ -334,7 +335,7 @@ static bool writeProfileImpl(osl_TFile* pFile)
if ( !safeWrite(pFile->m_Handle, pFile->m_pWriteBuf, pFile->m_nWriteBufLen - pFile->m_nWriteBufFree) )
{
- SAL_INFO("sal.osl", "write failed " << strerror(errno));
+ SAL_INFO("sal.osl", "write failed: " << UnixErrnoString(errno));
return false;
}
@@ -928,7 +929,7 @@ static bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode)
if ( fcntl(pFile->m_Handle, F_SETLKW, &lock) == -1 && errno != ENOTSUP )
#endif
{
- SAL_INFO("sal.osl", "fcntl returned -1 (" << strerror(errno) << ")");
+ SAL_INFO("sal.osl", "fcntl failed: " << UnixErrnoString(errno));
return false;
}
@@ -953,7 +954,7 @@ static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption Pro
if (pFile->m_Handle == -1)
{
int e = errno;
- SAL_INFO("sal.file", "open(" << pszFilename << ",O_RDONLY): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "open(" << pszFilename << ",O_RDONLY): " << UnixErrnoString(e));
}
else
SAL_INFO("sal.file", "open(" << pszFilename << ",O_RDONLY) => " << pFile->m_Handle);
@@ -967,7 +968,7 @@ static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption Pro
((pFile->m_Handle = open(pszFilename, O_RDWR)) < 0))
{
int e = errno;
- SAL_INFO("sal.file", "open(" << pszFilename << ",...): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "open(" << pszFilename << ",...): " << UnixErrnoString(e));
free(pFile);
return nullptr;
}
@@ -1079,7 +1080,7 @@ static sal_Char* OslProfile_getLine(osl_TFile* pFile)
if ((Max = read(pFile->m_Handle, &pFile->m_ReadBuf[Bytes], Free)) < 0)
{
- SAL_INFO("sal.osl", "read failed " << strerror(errno));
+ SAL_INFO("sal.osl", "read failed: " << UnixErrnoString(errno));
if( pLine )
free( pLine );
@@ -1728,7 +1729,7 @@ static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
if (!result)
{
int e = errno;
- SAL_INFO("sal.file", "rename(" << pProfile->m_FileName << "," << pszBakFile << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "rename(" << pProfile->m_FileName << "," << pszBakFile << "): " << UnixErrnoString(e));
}
else
{
@@ -1737,7 +1738,7 @@ static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
if (!result)
{
int e = errno;
- SAL_INFO("sal.file", "rename(" << pszTmpFile << "," << pProfile->m_FileName << "): errno " << e << ": " << strerror(e));
+ SAL_INFO("sal.file", "rename(" << pszTmpFile << "," << pProfile->m_FileName << "): " << UnixErrnoString(e));
}
else
{
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 05a6234f64df..698de982e181 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -30,6 +30,7 @@
#include <sal/log.hxx>
#include "sockimpl.hxx"
+#include "unixerrnostring.hxx"
/* defines for poll */
#ifdef HAVE_POLL_H
@@ -1179,7 +1180,7 @@ oslSocket SAL_CALL osl_createSocket(
if(pSocket->m_Socket == OSL_INVALID_SOCKET)
{
int nErrno = errno;
- SAL_WARN( "sal.osl", "socket creation failed: (" << nErrno << ") " << strerror(nErrno) );
+ SAL_WARN( "sal.osl", "socket creation failed: " << UnixErrnoString(nErrno) );
destroySocketImpl(pSocket);
pSocket= nullptr;
@@ -1195,7 +1196,7 @@ oslSocket SAL_CALL osl_createSocket(
{
pSocket->m_nLastError=errno;
int nErrno = errno;
- SAL_WARN( "sal.osl", "failed changing socket flags: (" << nErrno << ") " << strerror(nErrno) );
+ SAL_WARN( "sal.osl", "failed changing socket flags: " << UnixErrnoString(nErrno) );
}
}
else
@@ -1258,7 +1259,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
if (nRet < 0)
{
int nErrno = errno;
- SAL_WARN( "sal.osl", "getsockname call failed with error: (" << nErrno << ") " << strerror(nErrno) );
+ SAL_WARN( "sal.osl", "getsockname call failed: " << UnixErrnoString(nErrno) );
}
if (s.aSockAddr.sa_family == AF_INET)
@@ -1272,7 +1273,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
if (nConnFD < 0)
{
int nErrno = errno;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list