LibreOffice Module vcl (master) 1
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at .
18 */
20#pragma once
22#include <config_vclplug.h>
24#include <salframe.hxx>
25#include <vclpluginapi.h>
27#include "QtTools.hxx"
28#include "QtWidget.hxx"
30#include <headless/svpgdi.hxx>
31#include <vcl/svapp.hxx>
32#include <vcl/sysdata.hxx>
34#include <QtCore/QObject>
38// any better way to get rid of the X11 / Qt type clashes?
39#undef Bool
40#undef CursorShape
41#undef Expose
42#undef KeyPress
43#undef KeyRelease
44#undef FocusIn
45#undef FocusOut
46#undef FontChange
47#undef None
48#undef Status
49#undef Unsorted
52class QtDragSource;
53class QtDropTarget;
54class QtGraphics;
55class QtInstance;
56class QtMainWindow;
57class QtMenu;
58class QtSvpGraphics;
60class QDragMoveEvent;
61class QDropEvent;
62class QImage;
63class QMimeData;
64class QPaintDevice;
65class QScreen;
66class QWidget;
68class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame
72 friend class QtWidget;
77 const bool m_bUseCairo;
78 std::unique_ptr<QImage> m_pQImage;
79 std::unique_ptr<QtGraphics> m_pQtGraphics;
81 std::unique_ptr<QtSvpGraphics> m_pSvpGraphics;
83 QRegion m_aRegion;
105 ScreenSaverInhibitor m_ScreenSaverInhibitor;
106 ModKeyFlags m_nKeyModifiers;
118 bool isChild(bool bPlug = true, bool bSysChild = true) const
119 {
121 if (bPlug)
123 if (bSysChild)
125 return bool(m_nStyle & nMask);
126 }
128 bool isWindow() const;
129 QWindow* windowHandle() const;
130 QScreen* screen() const;
131 bool isMinimized() const;
132 bool isMaximized() const;
133 void SetWindowStateImpl(Qt::WindowStates eState);
137private Q_SLOTS:
138 void screenChanged(QScreen*);
141 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo);
142 virtual ~QtFrame() override;
144 QWidget* GetQWidget() const { return m_pQWidget; }
145 QtMainWindow* GetTopLevelWindow() const { return m_pTopLevel; }
146 QWidget* asChild() const;
147 qreal devicePixelRatioF() const;
148 QPoint mapToParent(const QPoint&) const;
149 QPoint mapFromParent(const QPoint&) const;
151 void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
152 sal_Int32 nExtentsHeight) const;
154 virtual SalGraphics* AcquireGraphics() override;
155 virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
157 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
159 virtual void SetTitle(const OUString& rTitle) override;
160 virtual void SetIcon(sal_uInt16 nIcon) override;
161 virtual void SetMenu(SalMenu* pMenu) override;
163 virtual void registerDragSource(QtDragSource* pDragSource);
164 virtual void deregisterDragSource(QtDragSource const* pDragSource);
165 virtual void registerDropTarget(QtDropTarget* pDropTarget);
166 virtual void deregisterDropTarget(QtDropTarget const* pDropTarget);
169 void handleDragMove(QDragMoveEvent* pEvent);
170 void handleDrop(QDropEvent* pEvent);
172 virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
173 virtual void Show(bool bVisible, bool bNoActivate = false) override;
174 virtual void SetMinClientSize(tools::Long nWidth, tools::Long nHeight) override;
175 virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override;
176 virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
177 sal_uInt16 nFlags) override;
178 virtual void GetClientSize(tools::Long& rWidth, tools::Long& rHeight) override;
179 virtual void GetWorkArea(tools::Rectangle& rRect) override;
180 virtual SalFrame* GetParent() const override;
181 virtual void SetModal(bool bModal) override;
182 virtual bool GetModal() const override;
183 virtual void SetWindowState(const vcl::WindowData*) override;
184 virtual bool GetWindowState(vcl::WindowData*) override;
185 virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override;
186 virtual void StartPresentation(bool bStart) override;
187 virtual void SetAlwaysOnTop(bool bOnTop) override;
188 virtual void ToTop(SalFrameToTop nFlags) override;
189 virtual void SetPointer(PointerStyle ePointerStyle) override;
190 virtual void CaptureMouse(bool bMouse) override;
191 virtual void SetPointerPos(tools::Long nX, tools::Long nY) override;
192 virtual bool ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpArea) override;
193 using SalFrame::Flush;
194 virtual void Flush() override;
195 virtual void SetInputContext(SalInputContext* pContext) override;
196 virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override;
197 virtual OUString GetKeyName(sal_uInt16 nKeyCode) override;
198 virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType,
199 vcl::KeyCode& rKeyCode) override;
200 virtual LanguageType GetInputLanguage() override;
201 virtual void UpdateSettings(AllSettings& rSettings) override;
202 virtual void Beep() override;
203 virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; }
206 virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override;
207 virtual void SetParent(SalFrame* pNewParent) override;
208 virtual void SetPluginParent(SystemParentData* pNewParent) override;
209 virtual void ResetClipRegion() override;
210 virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
212 tools::Long nHeight) override;
213 virtual void EndSetClipRegion() override;
215 virtual void SetScreenNumber(unsigned int) override;
216 virtual void SetApplicationID(const OUString&) override;
217 virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
219 inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
222 inline bool isPopup() const;
223 static void FillSystemEnvData(SystemEnvData&, sal_IntPtr pWindow, QWidget* pWidget);
226inline bool QtFrame::CallCallback(SalEvent nEvent, const void* pEvent) const
228 SolarMutexGuard aGuard;
229 return SalFrame::CallCallback(nEvent, pEvent);
232inline bool QtFrame::isPopup() const
238/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SetParent(SalFrame *pNewParent) override
virtual ~QtFrame() override
virtual void SetPointerPos(tools::Long nX, tools::Long nY) override
virtual void deregisterDropTarget(QtDropTarget const *pDropTarget)
virtual void CaptureMouse(bool bMouse) override
virtual void registerDragSource(QtDragSource *pDragSource)
virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override
virtual void UpdateSettings(AllSettings &rSettings) override
bool m_bGraphicsInUse
Definition: qt5/QtFrame.hxx:86
virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode &rKeyCode) override
virtual void SetPointer(PointerStyle ePointerStyle) override
virtual void GetWorkArea(tools::Rectangle &rRect) override
QPoint mapToParent(const QPoint &) const
virtual void SetModal(bool bModal) override
bool CallCallback(SalEvent nEvent, const void *pEvent) const
virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override
void handleDrop(QDropEvent *pEvent)
virtual void SetMenu(SalMenu *pMenu) override
sal_uInt32 m_nRestoreScreen
virtual void Show(bool bVisible, bool bNoActivate=false) override
virtual void SetTitle(const OUString &rTitle) override
virtual void ResetClipRegion() override
virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags) override
QtMainWindow * GetTopLevelWindow() const
bool isWindow() const
virtual void deregisterDragSource(QtDragSource const *pDragSource)
bool isChild(bool bPlug=true, bool bSysChild=true) const
virtual void SetWindowState(const vcl::WindowData *) override
void screenChanged(QScreen *)
qreal devicePixelRatioF() const
virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
QWidget * asChild() const
QWindow * windowHandle() const
QtFrame * m_pParent
Definition: qt5/QtFrame.hxx:88
Size CalcDefaultSize()
bool isMaximized() const
virtual void Flush() override
PointerStyle m_ePointerStyle
Definition: qt5/QtFrame.hxx:89
void handleDragLeave()
virtual bool PostEvent(std::unique_ptr< ImplSVEvent > pData) override
virtual SalFrame * GetParent() const override
virtual const SystemEnvData * GetSystemData() const override
void SetDefaultSize()
virtual bool ShowTooltip(const OUString &rText, const tools::Rectangle &rHelpArea) override
QWidget * GetQWidget() const
QRect m_aRestoreGeometry
std::unique_ptr< QtGraphics > m_pQtGraphics
Definition: qt5/QtFrame.hxx:79
virtual void SetScreenNumber(unsigned int) override
virtual void SetIcon(sal_uInt16 nIcon) override
LanguageType m_nInputLanguage
void fixICCCMwindowGroup()
virtual void SetApplicationID(const OUString &) override
virtual void StartPresentation(bool bStart) override
SalFrameStyleFlags m_nStyle
Definition: qt5/QtFrame.hxx:87
virtual bool GetWindowState(vcl::WindowData *) override
virtual void registerDropTarget(QtDropTarget *pDropTarget)
void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) const
virtual SalPointerState GetPointerState() override
QScreen * screen() const
UniqueCairoSurface m_pSurface
Definition: qt5/QtFrame.hxx:80
bool isPopup() const
virtual bool GetModal() const override
QtWidget * m_pQWidget
Definition: qt5/QtFrame.hxx:74
virtual void SetPluginParent(SystemParentData *pNewParent) override
bool m_bDefaultSize
Definition: qt5/QtFrame.hxx:97
const bool m_bUseCairo
Definition: qt5/QtFrame.hxx:77
QRegion m_aRegion
Definition: qt5/QtFrame.hxx:83
bool m_bFullScreen
Definition: qt5/QtFrame.hxx:99
virtual void SetMinClientSize(tools::Long nWidth, tools::Long nHeight) override
virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override
QtDragSource * m_pDragSource
Definition: qt5/QtFrame.hxx:93
virtual void EndSetClipRegion() override
SystemEnvData m_aSystemData
Definition: qt5/QtFrame.hxx:91
void handleDragMove(QDragMoveEvent *pEvent)
QtFrame(QtFrame *pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo)
virtual void Beep() override
void SetWindowStateImpl(Qt::WindowStates eState)
virtual void ResolveWindowHandle(SystemEnvData &rData) const override
QRect m_aTooltipArea
virtual void ReleaseGraphics(SalGraphics *pGraphics) override
virtual SalGraphics * AcquireGraphics() override
bool m_bFullScreenSpanAll
virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override
bool isMinimized() const
virtual OUString GetKeyName(sal_uInt16 nKeyCode) override
bool m_bNullRegion
Definition: qt5/QtFrame.hxx:84
void SetDefaultPos()
virtual void GetClientSize(tools::Long &rWidth, tools::Long &rHeight) override
QtDropTarget * m_pDropTarget
Definition: qt5/QtFrame.hxx:94
virtual void ToTop(SalFrameToTop nFlags) override
DamageHandler m_aDamageHandler
Definition: qt5/QtFrame.hxx:82
virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override
QtMainWindow * m_pTopLevel
Definition: qt5/QtFrame.hxx:75
std::unique_ptr< QtSvpGraphics > m_pSvpGraphics
Definition: qt5/QtFrame.hxx:81
static void FillSystemEnvData(SystemEnvData &, sal_IntPtr pWindow, QWidget *pWidget)
void setInputLanguage(LanguageType)
virtual void BeginSetClipRegion(sal_uInt32 nRects) override
virtual KeyIndicatorState GetIndicatorState() override
OUString m_aTooltipText
virtual void SetAlwaysOnTop(bool bOnTop) override
std::unique_ptr< QImage > m_pQImage
Definition: qt5/QtFrame.hxx:78
QPoint mapFromParent(const QPoint &) const
virtual LanguageType GetInputLanguage() override
bool m_bInDrag
Definition: qt5/QtFrame.hxx:95
virtual void SetInputContext(SalInputContext *pContext) override
bool m_bDefaultPos
Definition: qt5/QtFrame.hxx:98
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
virtual void Flush()=0
bool CallCallback(SalEvent nEvent, const void *pEvent) const
Definition: salframe.hxx:305
Definition: keycodes.hxx:186
Definition: keycodes.hxx:165
long Long
Definition: ptrstyle.hxx:26
std::unique_ptr< cairo_surface_t, CairoDeleter > UniqueCairoSurface
sal_uInt64 SalExtStyle
Definition: salframe.hxx:95
Definition: salframe.hxx:43
Definition: salframe.hxx:65
Definition: salwtype.hxx:46
sal_uInt16 sal_Unicode
Definition: vclpluginapi.h:53
Definition: window.hxx:346