summaryrefslogtreecommitdiffstats
path: root/vcl/inc/qt5
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /vcl/inc/qt5
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vcl/inc/qt5')
-rw-r--r--vcl/inc/qt5/QtAccessibleEventListener.hxx38
-rw-r--r--vcl/inc/qt5/QtAccessibleWidget.hxx159
-rw-r--r--vcl/inc/qt5/QtBitmap.hxx61
-rw-r--r--vcl/inc/qt5/QtClipboard.hxx97
-rw-r--r--vcl/inc/qt5/QtData.hxx49
-rw-r--r--vcl/inc/qt5/QtDragAndDrop.hxx115
-rw-r--r--vcl/inc/qt5/QtFilePicker.hxx186
-rw-r--r--vcl/inc/qt5/QtFont.hxx43
-rw-r--r--vcl/inc/qt5/QtFontFace.hxx76
-rw-r--r--vcl/inc/qt5/QtFrame.hxx240
-rw-r--r--vcl/inc/qt5/QtGraphics.hxx251
-rw-r--r--vcl/inc/qt5/QtGraphicsBase.hxx29
-rw-r--r--vcl/inc/qt5/QtGraphics_Controls.hxx99
-rw-r--r--vcl/inc/qt5/QtInstance.hxx190
-rw-r--r--vcl/inc/qt5/QtMainWindow.hxx40
-rw-r--r--vcl/inc/qt5/QtMenu.hxx132
-rw-r--r--vcl/inc/qt5/QtObject.hxx86
-rw-r--r--vcl/inc/qt5/QtOpenGLContext.hxx50
-rw-r--r--vcl/inc/qt5/QtPainter.hxx68
-rw-r--r--vcl/inc/qt5/QtPrinter.hxx32
-rw-r--r--vcl/inc/qt5/QtSvpGraphics.hxx54
-rw-r--r--vcl/inc/qt5/QtSvpSurface.hxx44
-rw-r--r--vcl/inc/qt5/QtSystem.hxx23
-rw-r--r--vcl/inc/qt5/QtTimer.hxx49
-rw-r--r--vcl/inc/qt5/QtTools.hxx188
-rw-r--r--vcl/inc/qt5/QtTransferable.hxx128
-rw-r--r--vcl/inc/qt5/QtVirtualDevice.hxx56
-rw-r--r--vcl/inc/qt5/QtWidget.hxx123
-rw-r--r--vcl/inc/qt5/QtXAccessible.hxx34
29 files changed, 2740 insertions, 0 deletions
diff --git a/vcl/inc/qt5/QtAccessibleEventListener.hxx b/vcl/inc/qt5/QtAccessibleEventListener.hxx
new file mode 100644
index 000000000..a73f6d31f
--- /dev/null
+++ b/vcl/inc/qt5/QtAccessibleEventListener.hxx
@@ -0,0 +1,38 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+
+#include "QtAccessibleWidget.hxx"
+
+#include <cppuhelper/implbase.hxx>
+
+class QtAccessibleEventListener final
+ : public cppu::WeakImplHelper<css::accessibility::XAccessibleEventListener>
+{
+public:
+ QtAccessibleEventListener(
+ const css::uno::Reference<css::accessibility::XAccessible> xAccessible,
+ QtAccessibleWidget* pAccessibleWidget);
+
+ virtual void SAL_CALL
+ notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override;
+
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+private:
+ css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
+ QtAccessibleWidget* m_pAccessibleWidget;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtAccessibleWidget.hxx b/vcl/inc/qt5/QtAccessibleWidget.hxx
new file mode 100644
index 000000000..102b5658f
--- /dev/null
+++ b/vcl/inc/qt5/QtAccessibleWidget.hxx
@@ -0,0 +1,159 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QPair>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleActionInterface>
+#include <QtGui/QAccessibleInterface>
+#include <QtGui/QAccessibleTableCellInterface>
+#include <QtGui/QAccessibleTableInterface>
+#include <QtGui/QAccessibleTextInterface>
+#include <QtGui/QAccessibleValueInterface>
+#include <QtGui/QColor>
+#include <QtGui/QWindow>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+namespace com::sun::star::accessibility
+{
+class XAccessibleTable;
+}
+
+class QtFrame;
+class QtWidget;
+
+class QtAccessibleWidget final : public QObject,
+ public QAccessibleInterface,
+ public QAccessibleActionInterface,
+ public QAccessibleTextInterface,
+ public QAccessibleEditableTextInterface,
+ public QAccessibleTableCellInterface,
+ public QAccessibleTableInterface,
+ public QAccessibleValueInterface
+{
+ Q_OBJECT
+
+public:
+ QtAccessibleWidget(const css::uno::Reference<css::accessibility::XAccessible> xAccessible,
+ QObject* pObject);
+ QWindow* window() const override;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface* child) const override;
+ QVector<QPair<QAccessibleInterface*, QAccessible::Relation>>
+ relations(QAccessible::Relation match = QAccessible::AllRelations) const override;
+ QAccessibleInterface* focusChild() const override;
+
+ QRect rect() const override;
+
+ QAccessibleInterface* parent() const override;
+ QAccessibleInterface* child(int index) const override;
+
+ QString text(QAccessible::Text t) const override;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
+
+ QColor foregroundColor() const override;
+ QColor backgroundColor() const override;
+
+ bool isValid() const override;
+ QObject* object() const override;
+ void setText(QAccessible::Text t, const QString& text) override;
+ QAccessibleInterface* childAt(int x, int y) const override;
+
+ void* interface_cast(QAccessible::InterfaceType t) override;
+
+ // QAccessibleActionInterface
+ QStringList actionNames() const override;
+ void doAction(const QString& actionName) override;
+ QStringList keyBindingsForAction(const QString& actionName) const override;
+
+ // QAccessibleTextInterface
+ void addSelection(int startOffset, int endOffset) override;
+ QString attributes(int offset, int* startOffset, int* endOffset) const override;
+ int characterCount() const override;
+ QRect characterRect(int offset) const override;
+ int cursorPosition() const override;
+ int offsetAtPoint(const QPoint& point) const override;
+ void removeSelection(int selectionIndex) override;
+ void scrollToSubstring(int startIndex, int endIndex) override;
+ void selection(int selectionIndex, int* startOffset, int* endOffset) const override;
+ int selectionCount() const override;
+ void setCursorPosition(int position) override;
+ void setSelection(int selectionIndex, int startOffset, int endOffset) override;
+ QString text(int startOffset, int endOffset) const override;
+ QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int* startOffset, int* endOffset) const override;
+ QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int* startOffset,
+ int* endOffset) const override;
+ QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType,
+ int* startOffset, int* endOffset) const override;
+
+ // QAccessibleEditableTextInterface
+ virtual void deleteText(int startOffset, int endOffset) override;
+ virtual void insertText(int offset, const QString& text) override;
+ virtual void replaceText(int startOffset, int endOffset, const QString& text) override;
+
+ // QAccessibleValueInterface
+ QVariant currentValue() const override;
+ QVariant maximumValue() const override;
+ QVariant minimumStepSize() const override;
+ QVariant minimumValue() const override;
+ void setCurrentValue(const QVariant& value) override;
+
+ // QAccessibleTableInterface
+ virtual QAccessibleInterface* caption() const override;
+ virtual QAccessibleInterface* cellAt(int row, int column) const override;
+ virtual int columnCount() const override;
+ virtual QString columnDescription(int column) const override;
+ virtual bool isColumnSelected(int column) const override;
+ virtual bool isRowSelected(int row) const override;
+ virtual void modelChange(QAccessibleTableModelChangeEvent* event) override;
+ virtual int rowCount() const override;
+ virtual QString rowDescription(int row) const override;
+ virtual bool selectColumn(int column) override;
+ virtual bool selectRow(int row) override;
+ virtual int selectedCellCount() const override;
+ virtual QList<QAccessibleInterface*> selectedCells() const override;
+ virtual int selectedColumnCount() const override;
+ virtual QList<int> selectedColumns() const override;
+ virtual int selectedRowCount() const override;
+ virtual QList<int> selectedRows() const override;
+ virtual QAccessibleInterface* summary() const override;
+ virtual bool unselectColumn(int column) override;
+ virtual bool unselectRow(int row) override;
+
+ // QAccessibleTableCellInterface
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const override;
+ virtual int columnIndex() const override;
+ virtual bool isSelected() const override;
+ virtual int columnExtent() const override;
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const override;
+ virtual int rowExtent() const override;
+ virtual int rowIndex() const override;
+ virtual QAccessibleInterface* table() const override;
+
+ // Factory
+ static QAccessibleInterface* customFactory(const QString& classname, QObject* object);
+
+private:
+ css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
+ css::uno::Reference<css::accessibility::XAccessibleContext> getAccessibleContextImpl() const;
+ css::uno::Reference<css::accessibility::XAccessibleTable> getAccessibleTableForParent() const;
+ QObject* m_pObject;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtBitmap.hxx b/vcl/inc/qt5/QtBitmap.hxx
new file mode 100644
index 000000000..a15deab29
--- /dev/null
+++ b/vcl/inc/qt5/QtBitmap.hxx
@@ -0,0 +1,61 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <salbmp.hxx>
+
+#include <memory>
+
+class QImage;
+
+class QtBitmap final : public SalBitmap
+{
+ std::unique_ptr<QImage> m_pImage;
+ BitmapPalette m_aPalette;
+
+public:
+ QtBitmap();
+ QtBitmap(const QImage& rQImage);
+
+ const QImage* GetQImage() const { return m_pImage.get(); }
+
+ virtual bool Create(const Size& rSize, vcl::PixelFormat ePixelFormat,
+ const BitmapPalette& rPal) override;
+ virtual bool Create(const SalBitmap& rSalBmp) override;
+ virtual bool Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) override;
+ virtual bool Create(const SalBitmap& rSalBmp, vcl::PixelFormat eNewPixelFormat) override;
+ virtual bool Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas,
+ Size& rSize, bool bMask = false) override;
+ virtual void Destroy() final override;
+ virtual Size GetSize() const override;
+ virtual sal_uInt16 GetBitCount() const override;
+
+ virtual BitmapBuffer* AcquireBuffer(BitmapAccessMode nMode) override;
+ virtual void ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode) override;
+ virtual bool GetSystemData(BitmapSystemData& rData) override;
+
+ virtual bool ScalingSupported() const override;
+ virtual bool Scale(const double& rScaleX, const double& rScaleY,
+ BmpScaleFlag nScaleFlag) override;
+ virtual bool Replace(const Color& rSearchColor, const Color& rReplaceColor,
+ sal_uInt8 nTol) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtClipboard.hxx b/vcl/inc/qt5/QtClipboard.hxx
new file mode 100644
index 000000000..69c2f7a27
--- /dev/null
+++ b/vcl/inc/qt5/QtClipboard.hxx
@@ -0,0 +1,97 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+#include <cppuhelper/compbase.hxx>
+
+#include <QtGui/QClipboard>
+
+/**
+ * This implementation has two main functions, which handle the clipboard content:
+ * the XClipboard::setContent function and the QClipboard::change signal handler.
+ *
+ * The first just sets the respective clipboard to the expected content from LO,
+ * the latter will handle any reported changes.
+ **/
+class QtClipboard final
+ : public QObject,
+ public cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard,
+ css::datatransfer::clipboard::XFlushableClipboard,
+ css::lang::XServiceInfo>
+{
+ Q_OBJECT
+
+ osl::Mutex m_aMutex;
+ const OUString m_aClipboardName;
+ const QClipboard::Mode m_aClipboardMode;
+ // has to be set, if LO changes the QClipboard itself, so it won't instantly lose
+ // ownership by it's self-triggered QClipboard::changed handler
+ bool m_bOwnClipboardChange;
+ // true, if LO really wants to give up clipboard ownership
+ bool m_bDoClear;
+
+ // if not empty, this holds the setContents provided XTransferable or a QtClipboardTransferable
+ css::uno::Reference<css::datatransfer::XTransferable> m_aContents;
+ // the owner of the current contents, which must be informed on content change
+ css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> m_aOwner;
+ std::vector<css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>> m_aListeners;
+
+ static bool isOwner(const QClipboard::Mode aMode);
+ static bool isSupported(const QClipboard::Mode aMode);
+
+ explicit QtClipboard(const OUString& aModeString, const QClipboard::Mode aMode);
+
+private Q_SLOTS:
+ void handleChanged(QClipboard::Mode mode);
+ void handleClearClipboard();
+
+signals:
+ void clearClipboard();
+
+public:
+ // factory function to construct only valid QtClipboard objects by name
+ static css::uno::Reference<css::uno::XInterface> create(const OUString& aModeString);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XClipboard
+ virtual css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getContents() override;
+ virtual void SAL_CALL setContents(
+ const css::uno::Reference<css::datatransfer::XTransferable>& xTrans,
+ const css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
+ override;
+ virtual OUString SAL_CALL getName() override;
+
+ // XClipboardEx
+ virtual sal_Int8 SAL_CALL getRenderingCapabilities() override;
+
+ // XFlushableClipboard
+ virtual void SAL_CALL flushClipboard() override;
+
+ // XClipboardNotifier
+ virtual void SAL_CALL addClipboardListener(
+ const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
+ override;
+ virtual void SAL_CALL removeClipboardListener(
+ const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
+ override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtData.hxx b/vcl/inc/qt5/QtData.hxx
new file mode 100644
index 000000000..82cfecd57
--- /dev/null
+++ b/vcl/inc/qt5/QtData.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <unx/gendata.hxx>
+
+#include <o3tl/enumarray.hxx>
+#include <vcl/ptrstyle.hxx>
+#include <memory>
+#include <vclpluginapi.h>
+
+class QCursor;
+
+class VCLPLUG_QT_PUBLIC QtData final : public GenericUnixSalData
+{
+ o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors;
+
+public:
+ explicit QtData();
+ virtual ~QtData() override;
+
+ virtual void ErrorTrapPush() override;
+ virtual bool ErrorTrapPop(bool bIgnoreError = true) override;
+
+ QCursor& getCursor(PointerStyle ePointerStyle);
+
+ static bool noNativeControls();
+};
+
+inline QtData* GetQtData() { return static_cast<QtData*>(GetSalData()); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtDragAndDrop.hxx b/vcl/inc/qt5/QtDragAndDrop.hxx
new file mode 100644
index 000000000..0ca1ebfb8
--- /dev/null
+++ b/vcl/inc/qt5/QtDragAndDrop.hxx
@@ -0,0 +1,115 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase.hxx>
+
+class QtFrame;
+
+class QtDragSource final
+ : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource,
+ css::lang::XInitialization, css::lang::XServiceInfo>
+{
+ osl::Mutex m_aMutex;
+ QtFrame* m_pFrame;
+ css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> m_xListener;
+
+public:
+ QtDragSource()
+ : WeakComponentImplHelper(m_aMutex)
+ , m_pFrame(nullptr)
+ {
+ }
+
+ virtual ~QtDragSource() override;
+
+ // XDragSource
+ virtual sal_Bool SAL_CALL isDragImageSupported() override;
+ virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction) override;
+ virtual void SAL_CALL startDrag(
+ const css::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions,
+ sal_Int32 cursor, sal_Int32 image,
+ const css::uno::Reference<css::datatransfer::XTransferable>& transferable,
+ const css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>& listener) override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
+ void deinitialize();
+
+ OUString SAL_CALL getImplementationName() override;
+
+ sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ void fire_dragEnd(sal_Int8 nAction, bool bSuccessful);
+};
+
+class QtDropTarget final
+ : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget,
+ css::datatransfer::dnd::XDropTargetDragContext,
+ css::datatransfer::dnd::XDropTargetDropContext,
+ css::lang::XInitialization, css::lang::XServiceInfo>
+{
+ osl::Mutex m_aMutex;
+ QtFrame* m_pFrame;
+ sal_Int8 m_nDropAction;
+ bool m_bActive;
+ sal_Int8 m_nDefaultActions;
+ std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners;
+ bool m_bDropSuccessful;
+
+public:
+ QtDropTarget();
+ virtual ~QtDropTarget() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArgs) override;
+ void deinitialize();
+
+ // XDropTarget
+ virtual void SAL_CALL addDropTargetListener(
+ const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
+ virtual void SAL_CALL removeDropTargetListener(
+ const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
+ virtual sal_Bool SAL_CALL isActive() override;
+ virtual void SAL_CALL setActive(sal_Bool active) override;
+ virtual sal_Int8 SAL_CALL getDefaultActions() override;
+ virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override;
+
+ // XDropTargetDragContext
+ virtual void SAL_CALL acceptDrag(sal_Int8 dragOperation) override;
+ virtual void SAL_CALL rejectDrag() override;
+
+ // XDropTargetDropContext
+ virtual void SAL_CALL acceptDrop(sal_Int8 dropOperation) override;
+ virtual void SAL_CALL rejectDrop() override;
+ virtual void SAL_CALL dropComplete(sal_Bool success) override;
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+ sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
+ void fire_dragExit(const css::datatransfer::dnd::DropTargetEvent& dte);
+ void fire_dragOver(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
+ void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde);
+
+ sal_Int8 proposedDropAction() const { return m_nDropAction; }
+ bool dropSuccessful() const { return m_bDropSuccessful; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtFilePicker.hxx b/vcl/inc/qt5/QtFilePicker.hxx
new file mode 100644
index 000000000..20ee52e83
--- /dev/null
+++ b/vcl/inc/qt5/QtFilePicker.hxx
@@ -0,0 +1,186 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+
+#include <cppuhelper/compbase.hxx>
+
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <osl/conditn.hxx>
+#include <osl/mutex.hxx>
+#include <unotools/resmgr.hxx>
+
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QHash>
+#include <QtWidgets/QFileDialog>
+
+#include <memory>
+
+class QComboBox;
+class QGridLayout;
+class QLabel;
+class QWidget;
+
+typedef ::cppu::WeakComponentImplHelper<
+ css::frame::XTerminateListener, css::lang::XInitialization, css::lang::XServiceInfo,
+ css::ui::dialogs::XFilePicker3, css::ui::dialogs::XFilePickerControlAccess,
+ css::ui::dialogs::XAsynchronousExecutableDialog, css::ui::dialogs::XFolderPicker2>
+ QtFilePicker_Base;
+
+class VCLPLUG_QT_PUBLIC QtFilePicker : public QObject, public QtFilePicker_Base
+{
+ Q_OBJECT
+
+private:
+ css::uno::Reference<css::uno::XComponentContext> m_context;
+
+ css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener;
+ css::uno::Reference<css::ui::dialogs::XDialogClosedListener> m_xClosedListener;
+
+ osl::Mutex m_aHelperMutex; ///< mutex used by the WeakComponentImplHelper
+
+ QStringList m_aNamedFilterList; ///< to keep the original sequence
+ QHash<QString, QString> m_aTitleToFilterMap;
+ // to retrieve the filename extension for a given filter
+ QHash<QString, QString> m_aNamedFilterToExtensionMap;
+ QString m_aCurrentFilter;
+
+ QGridLayout* m_pLayout; ///< layout for extra custom controls
+ QHash<sal_Int16, QWidget*> m_aCustomWidgetsMap; ///< map of SAL control ID's to widget
+
+ const bool m_bIsFolderPicker;
+
+ QWidget* m_pParentWidget;
+
+protected:
+ std::unique_ptr<QFileDialog> m_pFileDialog; ///< the file picker dialog
+ QWidget* m_pExtraControls; ///< widget to contain extra custom controls
+
+public:
+ // use non-native file dialog by default; there's no easy way to add custom widgets
+ // in a generic way in the native one
+ explicit QtFilePicker(css::uno::Reference<css::uno::XComponentContext> const& context,
+ QFileDialog::FileMode, bool bUseNative = false);
+ virtual ~QtFilePicker() override;
+
+ // XFilePickerNotifier
+ virtual void SAL_CALL addFilePickerListener(
+ const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
+ virtual void SAL_CALL removeFilePickerListener(
+ const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
+
+ // XFilterManager functions
+ virtual void SAL_CALL appendFilter(const OUString& rTitle, const OUString& rFilter) override;
+ virtual void SAL_CALL setCurrentFilter(const OUString& rTitle) override;
+ virtual OUString SAL_CALL getCurrentFilter() override;
+
+ // XFilterGroupManager functions
+ virtual void SAL_CALL
+ appendFilterGroup(const OUString& rGroupTitle,
+ const css::uno::Sequence<css::beans::StringPair>& rFilters) override;
+
+ // XCancellable
+ virtual void SAL_CALL cancel() override;
+
+ // XExecutableDialog functions
+ virtual void SAL_CALL setTitle(const OUString& rTitle) override;
+ virtual sal_Int16 SAL_CALL execute() override;
+
+ // XAsynchronousExecutableDialog functions
+ virtual void SAL_CALL setDialogTitle(const OUString&) override;
+ virtual void SAL_CALL
+ startExecuteModal(const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>&) override;
+
+ // XFilePicker functions
+ virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override;
+ virtual void SAL_CALL setDefaultName(const OUString& rName) override;
+ virtual void SAL_CALL setDisplayDirectory(const OUString& rDirectory) override;
+ virtual OUString SAL_CALL getDisplayDirectory() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getFiles() override;
+
+ // XFilePickerControlAccess functions
+ virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction,
+ const css::uno::Any& rValue) override;
+ virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId,
+ sal_Int16 nControlAction) override;
+ virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override;
+ virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString& rLabel) override;
+ virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override;
+
+ // XFilePicker2 functions
+ virtual css::uno::Sequence<OUString> SAL_CALL getSelectedFiles() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
+
+ // XEventListener
+ void SAL_CALL disposing(const css::lang::EventObject& rEvent) override;
+ using cppu::WeakComponentImplHelperBase::disposing;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XFolderPicker functions
+ virtual OUString SAL_CALL getDirectory() override;
+ virtual void SAL_CALL setDescription(const OUString& rDescription) override;
+
+ // XTerminateListener
+ void SAL_CALL queryTermination(const css::lang::EventObject& aEvent) override;
+ void SAL_CALL notifyTermination(const css::lang::EventObject& aEvent) override;
+
+protected:
+ virtual void addCustomControl(sal_Int16 controlId);
+ void setCustomControlWidgetLayout(QGridLayout* pLayout) { m_pLayout = pLayout; }
+
+private:
+ QtFilePicker(const QtFilePicker&) = delete;
+ QtFilePicker& operator=(const QtFilePicker&) = delete;
+
+ static QString getResString(TranslateId pRedId);
+ static css::uno::Any handleGetListValue(const QComboBox* pWidget, sal_Int16 nControlAction);
+ static void handleSetListValue(QComboBox* pQComboBox, sal_Int16 nAction,
+ const css::uno::Any& rValue);
+
+ void prepareExecute();
+
+private Q_SLOTS:
+ // emit XFilePickerListener controlStateChanged event
+ void filterSelected(const QString&);
+ // emit XFilePickerListener fileSelectionChanged event
+ void currentChanged(const QString&);
+ // (un)set automatic file extension
+ virtual void updateAutomaticFileExtension();
+ void finished(int);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtFont.hxx b/vcl/inc/qt5/QtFont.hxx
new file mode 100644
index 000000000..237523e2d
--- /dev/null
+++ b/vcl/inc/qt5/QtFont.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <fontinstance.hxx>
+
+#include <QtGui/QFont>
+
+#include "QtFontFace.hxx"
+
+class QtFont final : public QFont, public LogicalFontInstance
+{
+ friend rtl::Reference<LogicalFontInstance>
+ QtFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const;
+
+ bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override;
+ bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override;
+
+ virtual hb_font_t* ImplInitHbFont() override;
+
+ explicit QtFont(const vcl::font::PhysicalFontFace&, const vcl::font::FontSelectPattern&);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtFontFace.hxx b/vcl/inc/qt5/QtFontFace.hxx
new file mode 100644
index 000000000..5b0460443
--- /dev/null
+++ b/vcl/inc/qt5/QtFontFace.hxx
@@ -0,0 +1,76 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <vclpluginapi.h>
+#include <font/PhysicalFontFace.hxx>
+
+#include <tools/ref.hxx>
+#include <vcl/fontcapabilities.hxx>
+#include <vcl/fontcharmap.hxx>
+
+#include <QtCore/QString>
+#include <QtGui/QFont>
+
+class FontAttributes;
+namespace vcl::font
+{
+class FontSelectPattern;
+}
+
+class QtFontFace final : public vcl::font::PhysicalFontFace
+{
+public:
+ static QtFontFace* fromQFont(const QFont& rFont);
+ static QtFontFace* fromQFontDatabase(const QString& aFamily, const QString& aStyle);
+ static void fillAttributesFromQFont(const QFont& rFont, FontAttributes& rFA);
+
+ VCLPLUG_QT_PUBLIC static FontWeight toFontWeight(const int nWeight);
+ VCLPLUG_QT_PUBLIC static FontWidth toFontWidth(const int nStretch);
+ VCLPLUG_QT_PUBLIC static FontItalic toFontItalic(const QFont::Style eStyle);
+
+ sal_IntPtr GetFontId() const override;
+
+ QFont CreateFont() const;
+ int GetFontTable(const char pTagName[5], unsigned char*) const;
+
+ FontCharMapRef GetFontCharMap() const override;
+ bool GetFontCapabilities(vcl::FontCapabilities&) const override;
+ bool HasChar(sal_uInt32 cChar) const;
+
+ rtl::Reference<LogicalFontInstance>
+ CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const override;
+
+private:
+ typedef enum { Font, FontDB } FontIdType;
+
+ QtFontFace(const QtFontFace&);
+ QtFontFace(const FontAttributes&, const QString& rFontID, const FontIdType);
+
+ const QString m_aFontId;
+ const FontIdType m_eFontIdType;
+ mutable FontCharMapRef m_xCharMap;
+ mutable vcl::FontCapabilities m_aFontCapabilities;
+ mutable bool m_bFontCapabilitiesRead;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
new file mode 100644
index 000000000..2d7c5718d
--- /dev/null
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -0,0 +1,240 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <config_vclplug.h>
+
+#include <salframe.hxx>
+#include <vclpluginapi.h>
+
+#include "QtTools.hxx"
+#include "QtWidget.hxx"
+
+#include <headless/svpgdi.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/sysdata.hxx>
+
+#include <QtCore/QObject>
+
+#if CHECK_QT5_USING_X11
+#include <unx/screensaverinhibitor.hxx>
+// any better way to get rid of the X11 / Qt type clashes?
+#undef Bool
+#undef CursorShape
+#undef Expose
+#undef KeyPress
+#undef KeyRelease
+#undef FocusIn
+#undef FocusOut
+#undef FontChange
+#undef None
+#undef Status
+#undef Unsorted
+#endif
+
+class QtDragSource;
+class QtDropTarget;
+class QtGraphics;
+class QtInstance;
+class QtMainWindow;
+class QtMenu;
+class QtSvpGraphics;
+
+class QDragMoveEvent;
+class QDropEvent;
+class QImage;
+class QMimeData;
+class QPaintDevice;
+class QScreen;
+class QWidget;
+
+class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame
+{
+ Q_OBJECT
+
+ friend class QtWidget;
+
+ QtWidget* m_pQWidget;
+ QtMainWindow* m_pTopLevel;
+
+ const bool m_bUseCairo;
+ std::unique_ptr<QImage> m_pQImage;
+ std::unique_ptr<QtGraphics> m_pQtGraphics;
+ UniqueCairoSurface m_pSurface;
+ std::unique_ptr<QtSvpGraphics> m_pSvpGraphics;
+ DamageHandler m_aDamageHandler;
+ QRegion m_aRegion;
+ bool m_bNullRegion;
+
+ bool m_bGraphicsInUse;
+ SalFrameStyleFlags m_nStyle;
+ QtFrame* m_pParent;
+ PointerStyle m_ePointerStyle;
+
+ SystemEnvData m_aSystemData;
+
+ QtDragSource* m_pDragSource;
+ QtDropTarget* m_pDropTarget;
+ bool m_bInDrag;
+
+ bool m_bDefaultSize;
+ bool m_bDefaultPos;
+ bool m_bFullScreen;
+ bool m_bFullScreenSpanAll;
+ sal_uInt32 m_nRestoreScreen;
+ QRect m_aRestoreGeometry;
+
+#if CHECK_QT5_USING_X11
+ ScreenSaverInhibitor m_ScreenSaverInhibitor;
+#endif
+#if CHECK_ANY_QT_USING_X11
+ ModKeyFlags m_nKeyModifiers;
+#endif
+
+ LanguageType m_nInputLanguage;
+
+ OUString m_aTooltipText;
+ QRect m_aTooltipArea;
+
+ void SetDefaultPos();
+ Size CalcDefaultSize();
+ void SetDefaultSize();
+
+ bool isChild(bool bPlug = true, bool bSysChild = true) const
+ {
+ SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE;
+ if (bPlug)
+ nMask |= SalFrameStyleFlags::PLUG;
+ if (bSysChild)
+ nMask |= SalFrameStyleFlags::SYSTEMCHILD;
+ return bool(m_nStyle & nMask);
+ }
+
+ bool isWindow() const;
+ QWindow* windowHandle() const;
+ QScreen* screen() const;
+ bool isMinimized() const;
+ bool isMaximized() const;
+ void SetWindowStateImpl(Qt::WindowStates eState);
+ int menuBarOffset() const;
+
+ void fixICCCMwindowGroup();
+
+private Q_SLOTS:
+ void screenChanged(QScreen*);
+
+public:
+ QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo);
+ virtual ~QtFrame() override;
+
+ QWidget* GetQWidget() const { return m_pQWidget; }
+ QtMainWindow* GetTopLevelWindow() const { return m_pTopLevel; }
+ QWidget* asChild() const;
+ qreal devicePixelRatioF() const;
+
+ void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
+ sal_Int32 nExtentsHeight) const;
+
+ virtual SalGraphics* AcquireGraphics() override;
+ virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
+
+ virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
+
+ virtual void SetTitle(const OUString& rTitle) override;
+ virtual void SetIcon(sal_uInt16 nIcon) override;
+ virtual void SetMenu(SalMenu* pMenu) override;
+ virtual void DrawMenuBar() override;
+
+ virtual void registerDragSource(QtDragSource* pDragSource);
+ virtual void deregisterDragSource(QtDragSource const* pDragSource);
+ virtual void registerDropTarget(QtDropTarget* pDropTarget);
+ virtual void deregisterDropTarget(QtDropTarget const* pDropTarget);
+
+ void handleDragLeave();
+ void handleDragMove(QDragMoveEvent* pEvent);
+ void handleDrop(QDropEvent* pEvent);
+
+ virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
+ virtual void Show(bool bVisible, bool bNoActivate = false) override;
+ virtual void SetMinClientSize(tools::Long nWidth, tools::Long nHeight) override;
+ virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override;
+ virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
+ sal_uInt16 nFlags) override;
+ virtual void GetClientSize(tools::Long& rWidth, tools::Long& rHeight) override;
+ virtual void GetWorkArea(tools::Rectangle& rRect) override;
+ virtual SalFrame* GetParent() const override;
+ virtual void SetModal(bool bModal) override;
+ virtual bool GetModal() const override;
+ virtual void SetWindowState(const SalFrameState* pState) override;
+ virtual bool GetWindowState(SalFrameState* pState) override;
+ virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override;
+ virtual void StartPresentation(bool bStart) override;
+ virtual void SetAlwaysOnTop(bool bOnTop) override;
+ virtual void ToTop(SalFrameToTop nFlags) override;
+ virtual void SetPointer(PointerStyle ePointerStyle) override;
+ virtual void CaptureMouse(bool bMouse) override;
+ virtual void SetPointerPos(tools::Long nX, tools::Long nY) override;
+ virtual bool ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpArea) override;
+ using SalFrame::Flush;
+ virtual void Flush() override;
+ virtual void SetInputContext(SalInputContext* pContext) override;
+ virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override;
+ virtual OUString GetKeyName(sal_uInt16 nKeyCode) override;
+ virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType,
+ vcl::KeyCode& rKeyCode) override;
+ virtual LanguageType GetInputLanguage() override;
+ virtual void UpdateSettings(AllSettings& rSettings) override;
+ virtual void Beep() override;
+ virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; }
+ virtual SalPointerState GetPointerState() override;
+ virtual KeyIndicatorState GetIndicatorState() override;
+ virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override;
+ virtual void SetParent(SalFrame* pNewParent) override;
+ virtual void SetPluginParent(SystemParentData* pNewParent) override;
+ virtual void ResetClipRegion() override;
+ virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
+ virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth,
+ tools::Long nHeight) override;
+ virtual void EndSetClipRegion() override;
+
+ virtual void SetScreenNumber(unsigned int) override;
+ virtual void SetApplicationID(const OUString&) override;
+ virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
+
+ inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
+
+ void setInputLanguage(LanguageType);
+ inline bool isPopup() const;
+ static void FillSystemEnvData(SystemEnvData&, sal_IntPtr pWindow, QWidget* pWidget);
+};
+
+inline bool QtFrame::CallCallback(SalEvent nEvent, const void* pEvent) const
+{
+ SolarMutexGuard aGuard;
+ return SalFrame::CallCallback(nEvent, pEvent);
+}
+
+inline bool QtFrame::isPopup() const
+{
+ return ((m_nStyle & SalFrameStyleFlags::FLOAT)
+ && !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx
new file mode 100644
index 000000000..fed7c2cb8
--- /dev/null
+++ b/vcl/inc/qt5/QtGraphics.hxx
@@ -0,0 +1,251 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <salgdi.hxx>
+
+#include <memory>
+
+#include <QtGui/QPainter>
+#include <QtGui/QPainterPath>
+#include <QtGui/QRegion>
+
+#include "QtGraphicsBase.hxx"
+
+namespace vcl::font
+{
+class PhysicalFontCollection;
+}
+class QImage;
+class QPushButton;
+class QtFont;
+class QtFontFace;
+class QtFrame;
+class QtPainter;
+
+class QtGraphicsBackend final : public SalGraphicsImpl, public QtGraphicsBase
+{
+ friend class QtPainter;
+
+ QtFrame* m_pFrame;
+ QImage* m_pQImage;
+ QRegion m_aClipRegion;
+ QPainterPath m_aClipPath;
+ Color m_aLineColor;
+ Color m_aFillColor;
+ QPainter::CompositionMode m_eCompositionMode;
+
+public:
+ QtGraphicsBackend(QtFrame* pFrame, QImage* pQImage);
+ ~QtGraphicsBackend() override;
+
+ void Init() override {}
+
+ QImage* getQImage() { return m_pQImage; }
+
+ void setQImage(QImage* pQImage) { m_pQImage = pQImage; }
+
+ void freeResources() override {}
+
+ OUString getRenderBackendName() const override { return "qt5"; }
+
+ bool setClipRegion(vcl::Region const& rRegion) override;
+ void ResetClipRegion() override;
+
+ sal_uInt16 GetBitCount() const override;
+
+ tools::Long GetGraphicsWidth() const override;
+
+ void SetLineColor() override;
+ void SetLineColor(Color nColor) override;
+ void SetFillColor() override;
+ void SetFillColor(Color nColor) override;
+ void SetXORMode(bool bSet, bool bInvertOnly) override;
+ void SetROPLineColor(SalROPColor nROPColor) override;
+ void SetROPFillColor(SalROPColor nROPColor) override;
+
+ void drawPixel(tools::Long nX, tools::Long nY) override;
+ void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override;
+
+ void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override;
+ void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override;
+ void drawPolyLine(sal_uInt32 nPoints, const Point* pPointArray) override;
+ void drawPolygon(sal_uInt32 nPoints, const Point* pPointArray) override;
+ void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+ const Point** pPointArray) override;
+
+ bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
+ const basegfx::B2DPolyPolygon&, double fTransparency) override;
+
+ bool drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolygon&,
+ double fTransparency, double fLineWidth, const std::vector<double>* pStroke,
+ basegfx::B2DLineJoin, css::drawing::LineCap, double fMiterMinimumAngle,
+ bool bPixelSnapHairline) override;
+
+ bool drawPolyLineBezier(sal_uInt32 nPoints, const Point* pPointArray,
+ const PolyFlags* pFlagArray) override;
+
+ bool drawPolygonBezier(sal_uInt32 nPoints, const Point* pPointArray,
+ const PolyFlags* pFlagArray) override;
+
+ bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+ const Point* const* pPointArray,
+ const PolyFlags* const* pFlagArray) override;
+
+ void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY,
+ tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate) override;
+
+ void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
+
+ void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override;
+
+ void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+ const SalBitmap& rMaskBitmap) override;
+
+ void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+ Color nMaskColor) override;
+
+ std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth,
+ tools::Long nHeight) override;
+
+ Color getPixel(tools::Long nX, tools::Long nY) override;
+
+ void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
+ SalInvert nFlags) override;
+
+ void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override;
+
+ bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
+ void* pPtr, sal_uInt32 nSize) override;
+
+ bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override;
+
+ bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
+ const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override;
+
+ bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap,
+ const SalBitmap& rAlphaBitmap) override;
+
+ bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX,
+ const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
+ const SalBitmap* pAlphaBitmap, double fAlpha) override;
+
+ bool hasFastDrawTransformedBitmap() const override;
+
+ bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
+ sal_uInt8 nTransparency) override;
+
+ bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override;
+ bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon,
+ SalGradient const& rGradient) override;
+
+ bool supportsOperation(OutDevSupportType eType) const override;
+
+private:
+ void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage);
+};
+
+class QtGraphics final : public SalGraphicsAutoDelegateToImpl, public QtGraphicsBase
+{
+ friend class QtBitmap;
+
+ std::unique_ptr<QtGraphicsBackend> m_pBackend;
+
+ QtFrame* m_pFrame;
+
+ rtl::Reference<QtFont> m_pTextStyle[MAX_FALLBACK];
+ Color m_aTextColor;
+
+ QtGraphics(QtFrame* pFrame, QImage* pQImage);
+
+ void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage);
+
+ void handleDamage(const tools::Rectangle&) override;
+
+public:
+ QtGraphics(QtFrame* pFrame)
+ : QtGraphics(pFrame, nullptr)
+ {
+ }
+ QtGraphics(QImage* pQImage)
+ : QtGraphics(nullptr, pQImage)
+ {
+ }
+ virtual ~QtGraphics() override;
+
+ QImage* getQImage() { return m_pBackend->getQImage(); }
+
+ void ChangeQImage(QImage* pImage);
+
+ virtual SalGraphicsImpl* GetImpl() const override;
+ virtual SystemGraphicsData GetGraphicsData() const override;
+ virtual OUString getRenderBackendName() const override
+ {
+ return m_pBackend->getRenderBackendName();
+ }
+
+#if ENABLE_CAIRO_CANVAS
+ virtual bool SupportsCairo() const override;
+ virtual cairo::SurfaceSharedPtr
+ CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
+ virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y,
+ int width, int height) const override;
+ virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice,
+ const BitmapSystemData& rData,
+ const Size& rSize) const override;
+ virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface,
+ const basegfx::B2ISize& rSize) const override;
+#endif // ENABLE_CAIRO_CANVAS
+
+ // GDI
+
+ virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
+
+ // Text rendering + font support
+
+ virtual void SetTextColor(Color nColor) override;
+ virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
+ virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override;
+ virtual FontCharMapRef GetFontCharMap() const override;
+ virtual bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const override;
+ virtual void GetDevFontList(vcl::font::PhysicalFontCollection*) override;
+ virtual void ClearDevFontCache() override;
+ virtual bool AddTempDevFont(vcl::font::PhysicalFontCollection*, const OUString& rFileURL,
+ const OUString& rFontName) override;
+ virtual bool CreateFontSubset(const OUString& rToFile, const vcl::font::PhysicalFontFace* pFont,
+ const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding,
+ sal_Int32* pWidths, int nGlyphs,
+ FontSubsetInfo& rInfo // out parameter
+ ) override;
+
+ virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*,
+ tools::Long* pDataLen) override;
+ virtual void FreeEmbedFontData(const void* pData, tools::Long nDataLen) override;
+
+ virtual void GetGlyphWidths(const vcl::font::PhysicalFontFace*, bool bVertical,
+ std::vector<sal_Int32>& rWidths, Ucs2UIntMap& rUnicodeEnc) override;
+
+ virtual std::unique_ptr<GenericSalLayout> GetTextLayout(int nFallbackLevel) override;
+ virtual void DrawTextLayout(const GenericSalLayout&) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtGraphicsBase.hxx b/vcl/inc/qt5/QtGraphicsBase.hxx
new file mode 100644
index 000000000..73c39fb5b
--- /dev/null
+++ b/vcl/inc/qt5/QtGraphicsBase.hxx
@@ -0,0 +1,29 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <QtWidgets/QApplication>
+
+class QtGraphicsBase
+{
+ qreal m_fDPR;
+
+public:
+ QtGraphicsBase()
+ : m_fDPR(qApp ? qApp->devicePixelRatio() : 1.0)
+ {
+ }
+
+ void setDevicePixelRatioF(qreal fDPR) { m_fDPR = fDPR; }
+
+ qreal devicePixelRatioF() const { return m_fDPR; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtGraphics_Controls.hxx b/vcl/inc/qt5/QtGraphics_Controls.hxx
new file mode 100644
index 000000000..17039f9d6
--- /dev/null
+++ b/vcl/inc/qt5/QtGraphics_Controls.hxx
@@ -0,0 +1,99 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+#include <WidgetDrawInterface.hxx>
+
+#include <memory>
+
+#include <QtGui/QImage>
+#include <QtGui/QPainter>
+#include <QtGui/QRegion>
+#include <QtWidgets/QPushButton>
+#include <QtWidgets/QStyle>
+#include <QtWidgets/QStyleOption>
+
+class QtGraphicsBase;
+
+class QtGraphics_Controls final : public vcl::WidgetDrawInterface
+{
+ std::unique_ptr<QImage> m_image;
+ QRect m_lastPopupRect;
+ QtGraphicsBase const& m_rGraphics;
+
+public:
+ QtGraphics_Controls(const QtGraphicsBase& rGraphics);
+
+ QImage* getImage() { return m_image.get(); }
+
+ bool isNativeControlSupported(ControlType nType, ControlPart nPart) override;
+ bool hitTestNativeControl(ControlType nType, ControlPart nPart,
+ const tools::Rectangle& rControlRegion, const Point& aPos,
+ bool& rIsInside) override;
+ bool drawNativeControl(ControlType nType, ControlPart nPart,
+ const tools::Rectangle& rControlRegion, ControlState nState,
+ const ImplControlValue& aValue, const OUString& aCaption,
+ const Color& rBackgroundColor) override;
+ bool getNativeControlRegion(ControlType nType, ControlPart nPart,
+ const tools::Rectangle& rControlRegion, ControlState nState,
+ const ImplControlValue& aValue, const OUString& aCaption,
+ tools::Rectangle& rNativeBoundingRegion,
+ tools::Rectangle& rNativeContentRegion) override;
+
+private:
+ static int pixelMetric(QStyle::PixelMetric metric, const QStyleOption* option = nullptr);
+ static QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption* option,
+ const QSize& contentsSize);
+ static QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex* option,
+ QStyle::SubControl subControl);
+ static QRect subElementRect(QStyle::SubElement element, const QStyleOption* option);
+
+ void draw(QStyle::ControlElement element, QStyleOption& rOption, QImage* image,
+ const Color& rBackgroundColor, QStyle::State const state = QStyle::State_None,
+ QRect rect = QRect());
+ void draw(QStyle::PrimitiveElement element, QStyleOption& rOption, QImage* image,
+ const Color& rBackgroundColor, QStyle::State const state = QStyle::State_None,
+ QRect rect = QRect());
+ void draw(QStyle::ComplexControl element, QStyleOptionComplex& rOption, QImage* image,
+ const Color& rBackgroundColor, QStyle::State const state = QStyle::State_None);
+ void drawFrame(QStyle::PrimitiveElement element, QImage* image, const Color& rBackGroundColor,
+ QStyle::State const& state, bool bClip = true,
+ QStyle::PixelMetric eLineMetric = QStyle::PM_DefaultFrameWidth);
+
+ static void fillQStyleOptionTab(const ImplControlValue& value, QStyleOptionTab& sot);
+ void fullQStyleOptionTabWidgetFrame(QStyleOptionTabWidgetFrame& option, bool bDownscale);
+
+ enum class Round
+ {
+ Floor,
+ Ceil,
+ };
+
+ int downscale(int value, Round eRound);
+ int upscale(int value, Round eRound);
+ QRect downscale(const QRect& rect);
+ QRect upscale(const QRect& rect);
+ QSize downscale(const QSize& size, Round eRound);
+ QSize upscale(const QSize& size, Round eRound);
+ QPoint upscale(const QPoint& point, Round eRound);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
new file mode 100644
index 000000000..df6c4ec5a
--- /dev/null
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -0,0 +1,190 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+#include <unx/geninst.h>
+#include <salusereventlist.hxx>
+#include <vcl/timer.hxx>
+
+#include <osl/conditn.hxx>
+
+#include <QtCore/QObject>
+
+#include <cstdlib>
+#include <functional>
+#include <memory>
+#include <vector>
+
+#include "QtFilePicker.hxx"
+
+class QtFrame;
+class QtTimer;
+
+class QApplication;
+class SalYieldMutex;
+class SalFrame;
+
+struct StdFreeCStr
+{
+ void operator()(char* arg) const noexcept { std::free(arg); }
+};
+using FreeableCStr = std::unique_ptr<char[], StdFreeCStr>;
+
+class VCLPLUG_QT_PUBLIC QtInstance : public QObject,
+ public SalGenericInstance,
+ public SalUserEventList
+{
+ Q_OBJECT
+
+ osl::Condition m_aWaitingYieldCond;
+ const bool m_bUseCairo;
+ QtTimer* m_pTimer;
+ bool m_bSleeping;
+ std::unordered_map<OUString, css::uno::Reference<css::uno::XInterface>> m_aClipboards;
+
+ std::unique_ptr<QApplication> m_pQApplication;
+ std::vector<FreeableCStr> m_pFakeArgvFreeable;
+ std::unique_ptr<char* []> m_pFakeArgv;
+ std::unique_ptr<int> m_pFakeArgc;
+
+ Timer m_aUpdateStyleTimer;
+ bool m_bUpdateFonts;
+
+ QtFrame* m_pActivePopup;
+
+ DECL_DLLPRIVATE_LINK(updateStyleHdl, Timer*, void);
+ void AfterAppInit() override;
+
+private Q_SLOTS:
+ bool ImplYield(bool bWait, bool bHandleAllCurrentEvents);
+ static void deleteObjectLater(QObject* pObject);
+ static void localeChanged();
+
+ void orientationChanged(Qt::ScreenOrientation);
+ void primaryScreenChanged(QScreen*);
+ void screenAdded(QScreen*);
+ void screenRemoved(QScreen*);
+ void virtualGeometryChanged(const QRect&);
+
+Q_SIGNALS:
+ bool ImplYieldSignal(bool bWait, bool bHandleAllCurrentEvents);
+ void deleteObjectLaterSignal(QObject* pObject);
+
+protected:
+ virtual rtl::Reference<QtFilePicker>
+ createPicker(css::uno::Reference<css::uno::XComponentContext> const& context,
+ QFileDialog::FileMode);
+ bool useCairo() const { return m_bUseCairo; }
+ // encodes cairo usage and Qt platform name into the ToolkitName
+ OUString constructToolkitID(std::u16string_view sTKname);
+ void connectQScreenSignals(const QScreen*);
+ void notifyDisplayChanged();
+
+public:
+ explicit QtInstance(std::unique_ptr<QApplication>& pQApp, bool bUseCairo = false);
+ virtual ~QtInstance() override;
+
+ // handle common SalInstance setup
+ static void AllocFakeCmdlineArgs(std::unique_ptr<char* []>& rFakeArgv,
+ std::unique_ptr<int>& rFakeArgc,
+ std::vector<FreeableCStr>& rFakeArgvFreeable);
+ void MoveFakeCmdlineArgs(std::unique_ptr<char* []>& rFakeArgv, std::unique_ptr<int>& rFakeArgc,
+ std::vector<FreeableCStr>& rFakeArgvFreeable);
+ static std::unique_ptr<QApplication> CreateQApplication(int& nArgc, char** pArgv);
+
+ void RunInMainThread(std::function<void()> func);
+
+ virtual SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override;
+ virtual SalFrame* CreateChildFrame(SystemParentData* pParent,
+ SalFrameStyleFlags nStyle) override;
+ virtual void DestroyFrame(SalFrame* pFrame) override;
+
+ virtual SalObject* CreateObject(SalFrame* pParent, SystemWindowData* pWindowData,
+ bool bShow) override;
+ virtual void DestroyObject(SalObject* pObject) override;
+
+ virtual std::unique_ptr<SalVirtualDevice>
+ CreateVirtualDevice(SalGraphics& rGraphics, tools::Long& nDX, tools::Long& nDY,
+ DeviceFormat eFormat, const SystemGraphicsData* pData = nullptr) override;
+
+ virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
+ ImplJobSetup* pSetupData) override;
+ virtual void DestroyInfoPrinter(SalInfoPrinter* pPrinter) override;
+ virtual std::unique_ptr<SalPrinter> CreatePrinter(SalInfoPrinter* pInfoPrinter) override;
+ virtual void GetPrinterQueueInfo(ImplPrnQueueList* pList) override;
+ virtual void GetPrinterQueueState(SalPrinterQueueInfo* pInfo) override;
+ virtual OUString GetDefaultPrinter() override;
+ virtual void PostPrintersChanged() override;
+
+ virtual std::unique_ptr<SalMenu> CreateMenu(bool, Menu*) override;
+ virtual std::unique_ptr<SalMenuItem> CreateMenuItem(const SalItemParams&) override;
+
+ virtual SalTimer* CreateSalTimer() override;
+ virtual SalSystem* CreateSalSystem() override;
+ virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override;
+
+ virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override;
+ virtual bool AnyInput(VclInputFlags nType) override;
+
+// so we fall back to the default abort, instead of duplicating it...
+#ifndef EMSCRIPTEN
+ virtual OpenGLContext* CreateOpenGLContext() override;
+#endif
+
+ virtual OUString GetConnectionIdentifier() override;
+
+ virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType,
+ const OUString& rDocumentService) override;
+
+ virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override;
+
+ virtual bool IsMainThread() const override;
+
+ virtual void TriggerUserEventProcessing() override;
+ virtual void ProcessEvent(SalUserEvent aEvent) override;
+
+ bool hasNativeFileSelection() const override { return true; }
+ css::uno::Reference<css::ui::dialogs::XFilePicker2>
+ createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&) override;
+ css::uno::Reference<css::ui::dialogs::XFolderPicker2>
+ createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&) override;
+
+ virtual css::uno::Reference<css::uno::XInterface>
+ CreateClipboard(const css::uno::Sequence<css::uno::Any>& i_rArguments) override;
+ virtual css::uno::Reference<css::uno::XInterface>
+ ImplCreateDragSource(const SystemEnvData*) override;
+ virtual css::uno::Reference<css::uno::XInterface>
+ ImplCreateDropTarget(const SystemEnvData*) override;
+
+ void UpdateStyle(bool bFontsChanged);
+
+ void* CreateGStreamerSink(const SystemChildWindow*) override;
+
+ bool DoExecute(int& nExitCode) override;
+ void DoQuit() override;
+
+ QtFrame* activePopup() const { return m_pActivePopup; }
+ void setActivePopup(QtFrame*);
+};
+
+inline QtInstance* GetQtInstance() { return static_cast<QtInstance*>(GetSalInstance()); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtMainWindow.hxx b/vcl/inc/qt5/QtMainWindow.hxx
new file mode 100644
index 000000000..29621310b
--- /dev/null
+++ b/vcl/inc/qt5/QtMainWindow.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <QtWidgets/QWidget>
+#include <QtWidgets/QMainWindow>
+
+#include "QtFrame.hxx"
+
+class QtMainWindow final : public QMainWindow
+{
+ Q_OBJECT
+
+ QtFrame& m_rFrame;
+
+ virtual void closeEvent(QCloseEvent* pEvent) override;
+ void moveEvent(QMoveEvent*) override;
+
+public:
+ QtMainWindow(QtFrame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
new file mode 100644
index 000000000..a1b77687c
--- /dev/null
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -0,0 +1,132 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <salmenu.hxx>
+
+#include <QtCore/QObject>
+
+#include <memory>
+
+class MenuItemList;
+class QAbstractButton;
+class QAction;
+class QActionGroup;
+class QButtonGroup;
+class QMenu;
+class QMenuBar;
+class QPushButton;
+class QtMenuItem;
+class QtFrame;
+
+/*
+ * QtMenu can represent
+ * (1) the top-level menu of a menubar, in which case 'mbMenuBar' is true and
+ * 'mpQMenuBar' refers to the corresponding QMenuBar
+ * (2) another kind of menu (like a PopupMenu), in which case the corresponding QMenu
+ * object is instantiated and owned by this QtMenu (held in 'mpOwnedQMenu').
+ * (3) a "submenu" in an existing menu (like (1)), in which case the corresponding
+ * QMenu object is owned by the corresponding QtMenuItem.
+ *
+ * For (2) and (3), member 'mpQMenu' points to the corresponding QMenu object.
+ */
+class QtMenu : public QObject, public SalMenu
+{
+ Q_OBJECT
+private:
+ std::vector<QtMenuItem*> maItems;
+ VclPtr<Menu> mpVCLMenu;
+ QtMenu* mpParentSalMenu;
+ QtFrame* mpFrame;
+ bool mbMenuBar;
+ QMenuBar* mpQMenuBar;
+ // self-created QMenu that this QtMenu represents, if applicable (s. comment for class)
+ std::unique_ptr<QMenu> mpOwnedQMenu;
+ // pointer to QMenu owned by the corresponding QtMenuItem or self (-> mpOwnedQMenu)
+ QMenu* mpQMenu;
+ QButtonGroup* m_pButtonGroup;
+
+ void DoFullMenuUpdate(Menu* pMenuBar);
+ static void NativeItemText(OUString& rItemText);
+
+ void InsertMenuItem(QtMenuItem* pSalMenuItem, unsigned nPos);
+
+ void ReinitializeActionGroup(unsigned nPos);
+ void ResetAllActionGroups();
+ void UpdateActionGroupItem(const QtMenuItem* pSalMenuItem);
+ bool validateQMenuBar() const;
+ QPushButton* ImplAddMenuBarButton(const QIcon& rIcon, const QString& rToolTip, int nId);
+ void ImplRemoveMenuBarButton(int nId);
+ void adjustButtonSizes();
+
+public:
+ QtMenu(bool bMenuBar);
+
+ virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars
+
+ virtual void InsertItem(SalMenuItem* pSalMenuItem, unsigned nPos) override;
+ virtual void RemoveItem(unsigned nPos) override;
+ virtual void SetSubMenu(SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos) override;
+ virtual void SetFrame(const SalFrame* pFrame) override;
+ const QtFrame* GetFrame() const;
+ virtual void ShowMenuBar(bool bVisible) override;
+ virtual bool ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& rRect,
+ FloatWinPopupFlags nFlags) override;
+ QtMenu* GetTopLevel();
+ virtual void SetItemBits(unsigned nPos, MenuItemBits nBits) override;
+ virtual void CheckItem(unsigned nPos, bool bCheck) override;
+ virtual void EnableItem(unsigned nPos, bool bEnable) override;
+ virtual void ShowItem(unsigned nPos, bool bShow) override;
+ virtual void SetItemText(unsigned nPos, SalMenuItem* pSalMenuItem,
+ const OUString& rText) override;
+ virtual void SetItemImage(unsigned nPos, SalMenuItem* pSalMenuItem,
+ const Image& rImage) override;
+ virtual void SetAccelerator(unsigned nPos, SalMenuItem* pSalMenuItem,
+ const vcl::KeyCode& rKeyCode, const OUString& rKeyName) override;
+ virtual void GetSystemMenuData(SystemMenuData* pData) override;
+ virtual void ShowCloseButton(bool bShow) override;
+ virtual bool AddMenuBarButton(const SalMenuButtonItem&) override;
+ virtual void RemoveMenuBarButton(sal_uInt16 nId) override;
+ virtual tools::Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId, SalFrame*) override;
+ virtual int GetMenuBarHeight() const override;
+
+ void SetMenu(Menu* pMenu) { mpVCLMenu = pMenu; }
+ Menu* GetMenu() { return mpVCLMenu; }
+ unsigned GetItemCount() const { return maItems.size(); }
+ QtMenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; }
+
+private slots:
+ static void slotMenuTriggered(QtMenuItem* pQItem);
+ static void slotMenuAboutToShow(QtMenuItem* pQItem);
+ static void slotMenuAboutToHide(QtMenuItem* pQItem);
+ void slotCloseDocument();
+ void slotMenuBarButtonClicked(QAbstractButton*);
+};
+
+class QtMenuItem : public SalMenuItem
+{
+public:
+ QtMenuItem(const SalItemParams*);
+
+ QAction* getAction() const;
+
+ QtMenu* mpParentMenu; // The menu into which this menu item is inserted
+ QtMenu* mpSubMenu; // Submenu of this item (if defined)
+ std::unique_ptr<QAction> mpAction; // action corresponding to this item
+ std::unique_ptr<QMenu> mpMenu; // menu corresponding to this item
+ std::shared_ptr<QActionGroup> mpActionGroup; // empty if it's a separator element
+ sal_uInt16 mnId; // Item ID
+ MenuItemType mnType; // Item type
+ bool mbVisible; // Item visibility.
+ bool mbEnabled; // Item active.
+ Image maImage; // Item image
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtObject.hxx b/vcl/inc/qt5/QtObject.hxx
new file mode 100644
index 000000000..bc5a8e584
--- /dev/null
+++ b/vcl/inc/qt5/QtObject.hxx
@@ -0,0 +1,86 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <salobj.hxx>
+#include <vcl/sysdata.hxx>
+
+#include <QtCore/QObject>
+#include <QtGui/QRegion>
+#include <QtWidgets/QWidget>
+
+class QtFrame;
+class QtObjectWidget;
+class QWindow;
+
+class QtObject final : public QObject, public SalObject
+{
+ Q_OBJECT
+
+ SystemEnvData m_aSystemData;
+ QtFrame* m_pParent;
+ QtObjectWidget* m_pQWidget;
+ QRegion m_pRegion;
+ bool m_bForwardKey;
+
+public:
+ QtObject(QtFrame* pParent, bool bShow);
+ ~QtObject() override;
+
+ QtFrame* frame() const { return m_pParent; }
+ inline QWidget* widget() const;
+ QWindow* windowHandle() const;
+ bool forwardKey() const { return m_bForwardKey; }
+
+ virtual void ResetClipRegion() override;
+ virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
+ virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth,
+ tools::Long nHeight) override;
+ virtual void EndSetClipRegion() override;
+
+ virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth,
+ tools::Long nHeight) override;
+ virtual void Show(bool bVisible) override;
+
+ virtual void SetForwardKey(bool bEnable) override;
+
+ virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; }
+
+ virtual void Reparent(SalFrame* pFrame) override;
+};
+
+class QtObjectWidget final : public QWidget
+{
+ QtObject& m_rParent;
+
+ void focusInEvent(QFocusEvent*) override;
+ void focusOutEvent(QFocusEvent*) override;
+ void mousePressEvent(QMouseEvent*) override;
+ void mouseReleaseEvent(QMouseEvent*) override;
+ void keyPressEvent(QKeyEvent*) override;
+ void keyReleaseEvent(QKeyEvent*) override;
+
+public:
+ explicit QtObjectWidget(QtObject& rParent);
+};
+
+QWidget* QtObject::widget() const { return m_pQWidget; }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtOpenGLContext.hxx b/vcl/inc/qt5/QtOpenGLContext.hxx
new file mode 100644
index 000000000..8036d5077
--- /dev/null
+++ b/vcl/inc/qt5/QtOpenGLContext.hxx
@@ -0,0 +1,50 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/opengl/OpenGLContext.hxx>
+
+class QWindow;
+class QOpenGLContext;
+
+class QtOpenGLContext final : public OpenGLContext
+{
+public:
+ virtual void initWindow() override;
+
+private:
+ virtual const GLWindow& getOpenGLWindow() const override { return m_aGLWin; }
+ virtual GLWindow& getModifiableOpenGLWindow() override { return m_aGLWin; }
+ virtual bool ImplInit() override;
+
+ virtual void makeCurrent() override;
+ virtual void destroyCurrentContext() override;
+ virtual bool isCurrent() override;
+ virtual bool isAnyCurrent() override;
+ virtual void resetCurrent() override;
+ virtual void swapBuffers() override;
+
+ static bool g_bAnyCurrent;
+
+ GLWindow m_aGLWin;
+
+ QWindow* m_pWindow;
+ QOpenGLContext* m_pContext;
+};
diff --git a/vcl/inc/qt5/QtPainter.hxx b/vcl/inc/qt5/QtPainter.hxx
new file mode 100644
index 000000000..9702a19bd
--- /dev/null
+++ b/vcl/inc/qt5/QtPainter.hxx
@@ -0,0 +1,68 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <QtCore/QRectF>
+#include <QtGui/QPainter>
+#include <QtWidgets/QWidget>
+
+#include "QtFrame.hxx"
+#include "QtGraphics.hxx"
+
+class QtPainter final : public QPainter
+{
+ QtGraphicsBackend& m_rGraphics;
+ QRegion m_aRegion;
+
+public:
+ QtPainter(QtGraphicsBackend& rGraphics, bool bPrepareBrush = false,
+ sal_uInt8 nTransparency = 255);
+ ~QtPainter()
+ {
+ if (m_rGraphics.m_pFrame && !m_aRegion.isEmpty())
+ m_rGraphics.m_pFrame->GetQWidget()->update(m_aRegion);
+ }
+
+ void update(int nx, int ny, int nw, int nh)
+ {
+ if (m_rGraphics.m_pFrame)
+ m_aRegion += scaledQRect({ nx, ny, nw, nh }, 1 / m_rGraphics.devicePixelRatioF());
+ }
+
+ void update(const QRect& rRect)
+ {
+ if (m_rGraphics.m_pFrame)
+ m_aRegion += scaledQRect(rRect, 1 / m_rGraphics.devicePixelRatioF());
+ }
+
+ void update(const QRectF& rRectF)
+ {
+ if (m_rGraphics.m_pFrame)
+ update(scaledQRect(rRectF.toAlignedRect(), 1 / m_rGraphics.devicePixelRatioF()));
+ }
+
+ void update()
+ {
+ if (m_rGraphics.m_pFrame)
+ m_aRegion += m_rGraphics.m_pFrame->GetQWidget()->rect();
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtPrinter.hxx b/vcl/inc/qt5/QtPrinter.hxx
new file mode 100644
index 000000000..5aacfd44e
--- /dev/null
+++ b/vcl/inc/qt5/QtPrinter.hxx
@@ -0,0 +1,32 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <unx/genprn.h>
+
+class SalFrame;
+
+class QtPrinter final : public PspSalPrinter
+{
+public:
+ QtPrinter(SalInfoPrinter* pInfoPrinter);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtSvpGraphics.hxx b/vcl/inc/qt5/QtSvpGraphics.hxx
new file mode 100644
index 000000000..da3786eee
--- /dev/null
+++ b/vcl/inc/qt5/QtSvpGraphics.hxx
@@ -0,0 +1,54 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+#include <headless/svpgdi.hxx>
+
+#include "QtGraphicsBase.hxx"
+
+class QtFrame;
+
+class VCLPLUG_QT_PUBLIC QtSvpGraphics final : public SvpSalGraphics, public QtGraphicsBase
+{
+ QtFrame* const m_pFrame;
+
+ void handleDamage(const tools::Rectangle&) override;
+
+public:
+ QtSvpGraphics(QtFrame* pFrame);
+ ~QtSvpGraphics() override;
+
+ void updateQWidget() const;
+
+#if ENABLE_CAIRO_CANVAS
+ bool SupportsCairo() const override;
+ cairo::SurfaceSharedPtr
+ CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
+ cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width,
+ int height) const override;
+#endif // ENABLE_CAIRO_CANVAS
+
+ virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
+
+ virtual OUString getRenderBackendName() const override { return "qt5svp"; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtSvpSurface.hxx b/vcl/inc/qt5/QtSvpSurface.hxx
new file mode 100644
index 000000000..2c2b29cff
--- /dev/null
+++ b/vcl/inc/qt5/QtSvpSurface.hxx
@@ -0,0 +1,44 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <vcl/cairo.hxx>
+
+class QtSvpGraphics;
+class OutputDevice;
+
+namespace cairo
+{
+class QtSvpSurface final : public Surface
+{
+ const QtSvpGraphics* m_pGraphics;
+ cairo_t* const m_pCairoContext;
+ CairoSurfaceSharedPtr m_pSurface;
+
+public:
+ /// takes over ownership of passed cairo_surface
+ explicit QtSvpSurface(const CairoSurfaceSharedPtr& pSurface);
+ /// create surface on subarea of given drawable
+ explicit QtSvpSurface(const QtSvpGraphics* pGraphics, int x, int y, int width, int height);
+ ~QtSvpSurface() override;
+
+ // Surface interface
+ CairoSharedPtr getCairo() const override;
+ CairoSurfaceSharedPtr getCairoSurface() const override { return m_pSurface; }
+ SurfaceSharedPtr getSimilar(int nContentType, int width, int height) const override;
+
+ VclPtr<VirtualDevice> createVirtualDevice() const override;
+ void flush() const override;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtSystem.hxx b/vcl/inc/qt5/QtSystem.hxx
new file mode 100644
index 000000000..6992e381c
--- /dev/null
+++ b/vcl/inc/qt5/QtSystem.hxx
@@ -0,0 +1,23 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <unx/gensys.h>
+
+class QtSystem final : public SalGenericSystem
+{
+public:
+ 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;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtTimer.hxx b/vcl/inc/qt5/QtTimer.hxx
new file mode 100644
index 000000000..204b1bfe4
--- /dev/null
+++ b/vcl/inc/qt5/QtTimer.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <saltimer.hxx>
+#include <QtCore/QTimer>
+
+class QtTimer final : public QObject, public SalTimer
+{
+ Q_OBJECT
+
+ QTimer m_aTimer;
+
+private Q_SLOTS:
+ void timeoutActivated();
+ void startTimer(int);
+ void stopTimer();
+
+Q_SIGNALS:
+ void startTimerSignal(int);
+ void stopTimerSignal();
+
+public:
+ QtTimer();
+
+ int remainingTime() const { return m_aTimer.remainingTime(); }
+
+ virtual void Start(sal_uInt64 nMS) override;
+ virtual void Stop() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx
new file mode 100644
index 000000000..ecaa7075a
--- /dev/null
+++ b/vcl/inc/qt5/QtTools.hxx
@@ -0,0 +1,188 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <QtCore/QPoint>
+#include <QtCore/QRect>
+#include <QtCore/QSize>
+#include <QtCore/QString>
+#include <QtGui/QImage>
+
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <vcl/bitmap/BitmapTypes.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+
+#include <memory>
+
+class Image;
+class QImage;
+
+inline OUString toOUString(const QString& s)
+{
+ // QString stores UTF16, just like OUString
+ return OUString(reinterpret_cast<const sal_Unicode*>(s.data()), s.length());
+}
+
+inline QString toQString(const OUString& s)
+{
+ return QString::fromUtf16(s.getStr(), s.getLength());
+}
+
+inline QRect toQRect(const tools::Rectangle& rRect)
+{
+ return QRect(rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight());
+}
+
+inline QRect toQRect(const tools::Rectangle& rRect, const qreal fScale)
+{
+ return QRect(floor(rRect.Left() * fScale), floor(rRect.Top() * fScale),
+ ceil(rRect.GetWidth() * fScale), ceil(rRect.GetHeight() * fScale));
+}
+
+inline QRect scaledQRect(const QRect& rRect, const qreal fScale)
+{
+ return QRect(floor(rRect.x() * fScale), floor(rRect.y() * fScale), ceil(rRect.width() * fScale),
+ ceil(rRect.height() * fScale));
+}
+
+inline tools::Rectangle toRectangle(const QRect& rRect)
+{
+ return tools::Rectangle(rRect.left(), rRect.top(), rRect.right(), rRect.bottom());
+}
+
+inline QSize toQSize(const Size& rSize) { return QSize(rSize.Width(), rSize.Height()); }
+
+inline Size toSize(const QSize& rSize) { return Size(rSize.width(), rSize.height()); }
+
+inline Point toPoint(const QPoint& rPoint) { return Point(rPoint.x(), rPoint.y()); }
+
+inline QColor toQColor(const Color& rColor)
+{
+ return QColor(rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue(), rColor.GetAlpha());
+}
+
+Qt::DropActions toQtDropActions(sal_Int8 dragOperation);
+sal_Int8 toVclDropActions(Qt::DropActions dragOperation);
+sal_Int8 toVclDropAction(Qt::DropAction dragOperation);
+Qt::DropAction getPreferredDropAction(sal_Int8 dragOperation);
+
+inline QList<int> toQList(const css::uno::Sequence<sal_Int32>& aSequence)
+{
+ QList<int> aList;
+ for (sal_Int32 i : aSequence)
+ {
+ aList.append(i);
+ }
+ return aList;
+}
+
+constexpr QImage::Format Qt_DefaultFormat32 = QImage::Format_ARGB32;
+
+inline QImage::Format getBitFormat(vcl::PixelFormat ePixelFormat)
+{
+ switch (ePixelFormat)
+ {
+ case vcl::PixelFormat::N1_BPP:
+ return QImage::Format_Mono;
+ case vcl::PixelFormat::N8_BPP:
+ return QImage::Format_Indexed8;
+ case vcl::PixelFormat::N24_BPP:
+ return QImage::Format_RGB888;
+ case vcl::PixelFormat::N32_BPP:
+ return Qt_DefaultFormat32;
+ default:
+ std::abort();
+ break;
+ }
+ return QImage::Format_Invalid;
+}
+
+inline sal_uInt16 getFormatBits(QImage::Format eFormat)
+{
+ switch (eFormat)
+ {
+ case QImage::Format_Mono:
+ return 1;
+ case QImage::Format_Indexed8:
+ return 8;
+ case QImage::Format_RGB888:
+ return 24;
+ case Qt_DefaultFormat32:
+ case QImage::Format_ARGB32_Premultiplied:
+ return 32;
+ default:
+ std::abort();
+ return 0;
+ }
+}
+
+typedef struct _cairo_surface cairo_surface_t;
+struct CairoDeleter
+{
+ void operator()(cairo_surface_t* pSurface) const;
+};
+
+typedef std::unique_ptr<cairo_surface_t, CairoDeleter> UniqueCairoSurface;
+
+sal_uInt16 GetKeyModCode(Qt::KeyboardModifiers eKeyModifiers);
+sal_uInt16 GetMouseModCode(Qt::MouseButtons eButtons);
+
+QImage toQImage(const Image& rImage);
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+ const QString& rString)
+{
+ return stream << toOUString(rString);
+}
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+ const QRect& rRect)
+{
+ return stream << toRectangle(rRect);
+}
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+ const QSize& rSize)
+{
+ return stream << toSize(rSize);
+}
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
+ const QPoint& rPoint)
+{
+ return stream << toPoint(rPoint);
+}
+
+#define CHECK_QT5_USING_X11 (QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11)
+
+#define CHECK_QT6_USING_X11 (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT6_USING_X11)
+
+#define CHECK_ANY_QT_USING_X11 CHECK_QT5_USING_X11 || CHECK_QT6_USING_X11
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtTransferable.hxx b/vcl/inc/qt5/QtTransferable.hxx
new file mode 100644
index 000000000..5f1533dd5
--- /dev/null
+++ b/vcl/inc/qt5/QtTransferable.hxx
@@ -0,0 +1,128 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include <cppuhelper/compbase.hxx>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+
+#include <QtCore/QMimeData>
+#include <QtCore/QStringList>
+#include <QtGui/QClipboard>
+
+/**
+ * QtTransferable classes are used to read QMimeData via the XTransferable
+ * interface. All the functionality is already implemented in the QtTransferable.
+ *
+ * The specialisations map to the two users, which provide QMimeData: the Clipboard
+ * and the Drag'n'Drop functionality.
+ *
+ * LO itself seem to just accept "text/plain;charset=utf-16", so it relies on the
+ * backend to convert to this charset, but still offers "text/plain" itself.
+ *
+ * It's the "mirror" interface of the QtMimeData, which is defined below.
+ **/
+class QtTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransferable>
+{
+ QtTransferable(const QtTransferable&) = delete;
+
+ const QMimeData* m_pMimeData;
+ osl::Mutex m_aMutex;
+ bool m_bProvideUTF16FromOtherEncoding;
+ css::uno::Sequence<css::datatransfer::DataFlavor> m_aMimeTypeSeq;
+
+public:
+ QtTransferable(const QMimeData* pMimeData);
+ const QMimeData* mimeData() const { return m_pMimeData; }
+
+ css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors() override;
+ sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override;
+ css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
+};
+
+/**
+ * The QClipboard's QMimeData is volatile. As written in the QClipboard::mimeData
+ * documentation, "the pointer returned might become invalidated when the contents
+ * of the clipboard changes". Therefore it can just be accessed reliably inside
+ * the QClipboard's object thread, which is the QApplication's thread, so all of
+ * the access has to go through RunInMainThread().
+ *
+ * If we detect a QMimeData change, we simply drop reporting any content. In theory
+ * we can recover in the case where there hadn't been any calls of the XTransferable
+ * interface, but currently we don't. But we ensure to never report mixed content,
+ * so we'll just cease operation on QMimeData change.
+ **/
+class QtClipboardTransferable final : public QtTransferable
+{
+ // to detect in-flight QMimeData changes
+ const QClipboard::Mode m_aMode;
+
+ bool hasInFlightChanged() const;
+
+public:
+ explicit QtClipboardTransferable(const QClipboard::Mode aMode, const QMimeData* pMimeData);
+
+ // these are the same then QtTransferable, except they go through RunInMainThread
+ css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors() override;
+ sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override;
+ css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
+};
+
+/**
+ * Convenience typedef for better code readability
+ *
+ * This just uses the QMimeData provided by the QWidgets D'n'D events.
+ **/
+typedef QtTransferable QtDnDTransferable;
+
+/**
+ * A lazy loading QMimeData for XTransferable reads
+ *
+ * This is an interface class to make a XTransferable read accessible as a
+ * QMimeData. The mime data is just stored inside the XTransferable, never
+ * in the QMimeData itself! It's objects are just used for QClipboard to read
+ * the XTransferable data.
+ *
+ * Like XTransferable itself, this class should be considered an immutable
+ * container for mime data. There is no need to ever set any of its data.
+ *
+ * LO will offer at least UTF-16, if there is a viable text representation.
+ * If LO misses to offer a UTF-8 or a locale encoded string, these objects
+ * will offer them themselves and convert from UTF-16 on demand.
+ *
+ * It's the "mirror" interface of the QtTransferable.
+ **/
+class QtMimeData final : public QMimeData
+{
+ friend class QtClipboardTransferable;
+
+ const css::uno::Reference<css::datatransfer::XTransferable> m_aContents;
+ mutable bool m_bHaveNoCharset; // = uses the locale charset
+ mutable bool m_bHaveUTF8;
+ mutable QStringList m_aMimeTypeList;
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QVariant retrieveData(const QString& mimeType, QVariant::Type type) const override;
+#else
+ QVariant retrieveData(const QString& mimeType, QMetaType type) const override;
+#endif
+
+public:
+ explicit QtMimeData(const css::uno::Reference<css::datatransfer::XTransferable>& aContents);
+
+ bool hasFormat(const QString& mimeType) const override;
+ QStringList formats() const override;
+
+ bool deepCopy(QMimeData** const) const;
+
+ css::datatransfer::XTransferable* xTransferable() const { return m_aContents.get(); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtVirtualDevice.hxx b/vcl/inc/qt5/QtVirtualDevice.hxx
new file mode 100644
index 000000000..2481f63d0
--- /dev/null
+++ b/vcl/inc/qt5/QtVirtualDevice.hxx
@@ -0,0 +1,56 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <salvd.hxx>
+
+#include <memory>
+#include <vector>
+
+#include <QtCore/QSize>
+
+class QtGraphics;
+class QImage;
+enum class DeviceFormat;
+
+class QtVirtualDevice final : public SalVirtualDevice
+{
+ std::vector<QtGraphics*> m_aGraphics;
+ std::unique_ptr<QImage> m_pImage;
+ QSize m_aFrameSize;
+ double m_fScale;
+
+public:
+ QtVirtualDevice(double fScale);
+
+ // SalVirtualDevice
+ virtual SalGraphics* AcquireGraphics() override;
+ virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
+
+ virtual bool SetSize(tools::Long nNewDX, tools::Long nNewDY) override;
+ virtual bool SetSizeUsingBuffer(tools::Long nNewDX, tools::Long nNewDY,
+ sal_uInt8* pBuffer) override;
+
+ // SalGeometryProvider
+ virtual tools::Long GetWidth() const override;
+ virtual tools::Long GetHeight() const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
new file mode 100644
index 000000000..e644e7f70
--- /dev/null
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -0,0 +1,123 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <QtCore/QRect>
+#include <QtWidgets/QWidget>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+
+class QInputEvent;
+class QtFrame;
+class QtObject;
+struct SalAbstractMouseEvent;
+
+class QtWidget : public QWidget
+{
+ Q_OBJECT
+
+ QtFrame& m_rFrame;
+ bool m_bNonEmptyIMPreeditSeen;
+ mutable bool m_bInInputMethodQueryCursorRectangle;
+ mutable QRect m_aImCursorRectangle;
+ int m_nDeltaX;
+ int m_nDeltaY;
+
+ enum class ButtonKeyState
+ {
+ Pressed,
+ Released
+ };
+
+ static void commitText(QtFrame&, const QString& aText);
+ static void deleteReplacementText(QtFrame& rFrame, int nReplacementStart,
+ int nReplacementLength);
+ static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*, const ButtonKeyState);
+ static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*, const ButtonKeyState);
+ static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*);
+ static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const QInputEvent* pQEvent,
+ const QPoint& rPos, Qt::MouseButtons eButtons, int nWidth,
+ SalAbstractMouseEvent& aSalEvent);
+
+ virtual bool event(QEvent*) override;
+
+ virtual void focusInEvent(QFocusEvent*) override;
+ virtual void focusOutEvent(QFocusEvent*) override;
+ // keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment
+ virtual void keyReleaseEvent(QKeyEvent*) override;
+ virtual void mouseMoveEvent(QMouseEvent*) override;
+ virtual void mousePressEvent(QMouseEvent*) override;
+ virtual void mouseReleaseEvent(QMouseEvent*) override;
+ virtual void dragEnterEvent(QDragEnterEvent*) override;
+ virtual void dragLeaveEvent(QDragLeaveEvent*) override;
+ virtual void dragMoveEvent(QDragMoveEvent*) override;
+ virtual void dropEvent(QDropEvent*) override;
+ virtual void moveEvent(QMoveEvent*) override;
+ virtual void paintEvent(QPaintEvent*) override;
+ virtual void resizeEvent(QResizeEvent*) override;
+ virtual void showEvent(QShowEvent*) override;
+ virtual void hideEvent(QHideEvent*) override;
+ virtual void wheelEvent(QWheelEvent*) override;
+ virtual void closeEvent(QCloseEvent*) override;
+ virtual void changeEvent(QEvent*) override;
+ virtual void leaveEvent(QEvent*) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ virtual void enterEvent(QEnterEvent*) override;
+#else
+ virtual void enterEvent(QEvent*) override;
+#endif
+
+ void inputMethodEvent(QInputMethodEvent*) override;
+ QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
+ static void closePopup();
+
+public:
+ QtWidget(QtFrame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
+
+ QtFrame& frame() const { return m_rFrame; }
+ void endExtTextInput();
+ void fakeResize();
+
+ static bool handleEvent(QtFrame&, QWidget&, QEvent*);
+ // key events might be propagated further down => call base on false
+ static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, QKeyEvent*);
+ // mouse events are always accepted
+ static inline void handleMousePressEvent(const QtFrame&, const QMouseEvent*);
+ static inline void handleMouseReleaseEvent(const QtFrame&, const QMouseEvent*);
+};
+
+bool QtWidget::handleKeyReleaseEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent* pEvent)
+{
+ return handleKeyEvent(rFrame, rWidget, pEvent, ButtonKeyState::Released);
+}
+
+void QtWidget::handleMousePressEvent(const QtFrame& rFrame, const QMouseEvent* pEvent)
+{
+ handleMouseButtonEvent(rFrame, pEvent, ButtonKeyState::Pressed);
+}
+
+void QtWidget::handleMouseReleaseEvent(const QtFrame& rFrame, const QMouseEvent* pEvent)
+{
+ handleMouseButtonEvent(rFrame, pEvent, ButtonKeyState::Released);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtXAccessible.hxx b/vcl/inc/qt5/QtXAccessible.hxx
new file mode 100644
index 000000000..4f4285e80
--- /dev/null
+++ b/vcl/inc/qt5/QtXAccessible.hxx
@@ -0,0 +1,34 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+
+#include <QtCore/QObject>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+#include <vcl/window.hxx>
+
+class QtFrame;
+class QtWidget;
+
+// Wrapper class to hold a css::accessibility::XAccessible object
+// while being able to pass it as a QObject
+class QtXAccessible : public QObject
+{
+ Q_OBJECT
+
+public:
+ QtXAccessible(css::uno::Reference<css::accessibility::XAccessible> xAccessible);
+ css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */