summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/CustomTarget_qt5_moc.mk1
-rw-r--r--vcl/CustomTarget_qt6_moc.mk1
-rw-r--r--vcl/Library_vclplug_qt5.mk1
-rw-r--r--vcl/Library_vclplug_qt6.mk1
-rw-r--r--vcl/inc/qt5/QtInstanceDrawingArea.hxx52
-rw-r--r--vcl/inc/qt6/QtInstanceDrawingArea.hxx12
-rw-r--r--vcl/qt5/QtBuilder.cxx4
-rw-r--r--vcl/qt5/QtInstanceBuilder.cxx9
-rw-r--r--vcl/qt5/QtInstanceDrawingArea.cxx77
-rw-r--r--vcl/qt6/QtInstanceDrawingArea.cxx12
10 files changed, 167 insertions, 3 deletions
diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index 0072fa3883ad..672398d4b03f 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -16,6 +16,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceComboBox.moc \
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDialog.moc \
+ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDrawingArea.moc \
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceEntry.moc \
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLevelBar.moc \
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLinkButton.moc \
diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk
index 33e185e4c962..03d3c079771f 100644
--- a/vcl/CustomTarget_qt6_moc.mk
+++ b/vcl/CustomTarget_qt6_moc.mk
@@ -16,6 +16,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceComboBox.moc \
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDialog.moc \
+ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDrawingArea.moc \
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceEntry.moc \
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLevelBar.moc \
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLinkButton.moc \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 8870dfda6f2f..678f69a92088 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -103,6 +103,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/QtInstanceContainer \
vcl/qt5/QtInstanceComboBox \
vcl/qt5/QtInstanceDialog \
+ vcl/qt5/QtInstanceDrawingArea \
vcl/qt5/QtInstanceEntry \
vcl/qt5/QtInstanceFrame \
vcl/qt5/QtInstanceImage \
diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk
index c31efc27a490..f57bcc307157 100644
--- a/vcl/Library_vclplug_qt6.mk
+++ b/vcl/Library_vclplug_qt6.mk
@@ -102,6 +102,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
vcl/qt6/QtInstanceComboBox \
vcl/qt6/QtInstanceContainer \
vcl/qt6/QtInstanceDialog \
+ vcl/qt6/QtInstanceDrawingArea \
vcl/qt6/QtInstanceEntry \
vcl/qt6/QtInstanceFrame \
vcl/qt6/QtInstanceImage \
diff --git a/vcl/inc/qt5/QtInstanceDrawingArea.hxx b/vcl/inc/qt5/QtInstanceDrawingArea.hxx
new file mode 100644
index 000000000000..757174330c13
--- /dev/null
+++ b/vcl/inc/qt5/QtInstanceDrawingArea.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 "QtInstanceWidget.hxx"
+
+#include <QtWidgets/QLabel>
+
+class QtInstanceDrawingArea : public QObject,
+ public QtInstanceWidget,
+ public virtual weld::DrawingArea
+{
+ Q_OBJECT
+
+ QLabel* m_pLabel;
+ ScopedVclPtrInstance<VirtualDevice> m_xDevice;
+
+public:
+ QtInstanceDrawingArea(QLabel* pLabel);
+
+ virtual void queue_draw() override;
+ virtual void queue_draw_area(int x, int y, int width, int height) override;
+
+ virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferable,
+ sal_uInt8 eDNDConstants) override;
+
+ virtual void set_cursor(PointerStyle ePointerStyle) override;
+
+ virtual Point get_pointer_position() const override;
+
+ virtual void set_input_context(const InputContext& rInputContext) override;
+ virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect,
+ int nExtTextInputWidth) override;
+
+ virtual OutputDevice& get_ref_device() override;
+
+ virtual a11yref get_accessible_parent() override;
+ virtual a11yrelationset get_accessible_relation_set() override;
+ virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() override;
+
+private:
+ virtual void click(const Point&) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt6/QtInstanceDrawingArea.hxx b/vcl/inc/qt6/QtInstanceDrawingArea.hxx
new file mode 100644
index 000000000000..00c19b649c0f
--- /dev/null
+++ b/vcl/inc/qt6/QtInstanceDrawingArea.hxx
@@ -0,0 +1,12 @@
+/* -*- 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/.
+ */
+
+#include "../qt5/QtInstanceDrawingArea.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 6529ae653303..73ad72ec424b 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -186,6 +186,10 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons
{
pObject = new QDialog(pParentWidget);
}
+ else if (sName == u"GtkDrawingArea")
+ {
+ pObject = new QLabel(pParentWidget);
+ }
else if (sName == u"GtkEntry")
{
QLineEdit* pLineEdit = new QLineEdit(pParentWidget);
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 8db7c8cd9c6c..82036d43e1c0 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -14,6 +14,7 @@
#include <QtBuilder.hxx>
#include <QtInstanceCheckButton.hxx>
#include <QtInstanceComboBox.hxx>
+#include <QtInstanceDrawingArea.hxx>
#include <QtInstanceEntry.hxx>
#include <QtInstanceFrame.hxx>
#include <QtInstanceImage.hxx>
@@ -317,10 +318,12 @@ std::unique_ptr<weld::Expander> QtInstanceBuilder::weld_expander(const OUString&
}
std::unique_ptr<weld::DrawingArea>
-QtInstanceBuilder::weld_drawing_area(const OUString&, const a11yref&, FactoryFunction, void*)
+QtInstanceBuilder::weld_drawing_area(const OUString& rId, const a11yref&, FactoryFunction, void*)
{
- assert(false && "Not implemented yet");
- return nullptr;
+ QLabel* pLabel = m_xBuilder->get<QLabel>(rId);
+ std::unique_ptr<weld::DrawingArea> xRet(pLabel ? std::make_unique<QtInstanceDrawingArea>(pLabel)
+ : nullptr);
+ return xRet;
}
std::unique_ptr<weld::Menu> QtInstanceBuilder::weld_menu(const OUString&)
diff --git a/vcl/qt5/QtInstanceDrawingArea.cxx b/vcl/qt5/QtInstanceDrawingArea.cxx
new file mode 100644
index 000000000000..0ae6baa2b087
--- /dev/null
+++ b/vcl/qt5/QtInstanceDrawingArea.cxx
@@ -0,0 +1,77 @@
+/* -*- 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/.
+ */
+
+#include <QtInstanceDrawingArea.hxx>
+#include <QtInstanceDrawingArea.moc>
+
+QtInstanceDrawingArea::QtInstanceDrawingArea(QLabel* pLabel)
+ : QtInstanceWidget(pLabel)
+ , m_pLabel(pLabel)
+ , m_xDevice(DeviceFormat::WITHOUT_ALPHA)
+{
+ assert(m_pLabel);
+}
+
+void QtInstanceDrawingArea::queue_draw()
+{
+ SolarMutexGuard g;
+ GetQtInstance().RunInMainThread([&] { getQWidget()->update(); });
+}
+
+void QtInstanceDrawingArea::queue_draw_area(int, int, int, int)
+{
+ assert(false && "Not implemented yet");
+}
+
+void QtInstanceDrawingArea::enable_drag_source(rtl::Reference<TransferDataContainer>&, sal_uInt8)
+{
+ assert(false && "Not implemented yet");
+}
+
+void QtInstanceDrawingArea::set_cursor(PointerStyle) { assert(false && "Not implemented yet"); }
+
+Point QtInstanceDrawingArea::get_pointer_position() const
+{
+ assert(false && "Not implemented yet");
+ return Point();
+}
+
+void QtInstanceDrawingArea::set_input_context(const InputContext&)
+{
+ assert(false && "Not implemented yet");
+}
+
+void QtInstanceDrawingArea::im_context_set_cursor_location(const tools::Rectangle&, int)
+{
+ assert(false && "Not implemented yet");
+}
+
+OutputDevice& QtInstanceDrawingArea::get_ref_device() { return *m_xDevice; }
+
+a11yref QtInstanceDrawingArea::get_accessible_parent()
+{
+ assert(false && "Not implemented yet");
+ return nullptr;
+}
+
+a11yrelationset QtInstanceDrawingArea::get_accessible_relation_set()
+{
+ assert(false && "Not implemented yet");
+ return nullptr;
+}
+
+AbsoluteScreenPixelPoint QtInstanceDrawingArea::get_accessible_location_on_screen()
+{
+ assert(false && "Not implemented yet");
+ return AbsoluteScreenPixelPoint(0, 0);
+}
+
+void QtInstanceDrawingArea::click(const Point&) { assert(false && "Not implemented yet"); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt6/QtInstanceDrawingArea.cxx b/vcl/qt6/QtInstanceDrawingArea.cxx
new file mode 100644
index 000000000000..78b40804dd01
--- /dev/null
+++ b/vcl/qt6/QtInstanceDrawingArea.cxx
@@ -0,0 +1,12 @@
+/* -*- 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/.
+ */
+
+#include "../qt5/QtInstanceDrawingArea.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */