LibreOffice Module vcl (master) 1
qt5/QtFrame.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
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 http://mozilla.org/MPL/2.0/.
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 http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <config_vclplug.h>
23
24#include <salframe.hxx>
25#include <vclpluginapi.h>
26
27#include "QtTools.hxx"
28#include "QtWidget.hxx"
29
30#include <headless/svpgdi.hxx>
31#include <vcl/svapp.hxx>
32#include <vcl/sysdata.hxx>
33
34#include <QtCore/QObject>
35
36#if CHECK_ANY_QT_USING_X11
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
50#endif
51
52class QtDragSource;
53class QtDropTarget;
54class QtGraphics;
55class QtInstance;
56class QtMainWindow;
57class QtMenu;
58class QtSvpGraphics;
59
60class QDragMoveEvent;
61class QDropEvent;
62class QImage;
63class QMimeData;
64class QPaintDevice;
65class QScreen;
66class QWidget;
67
68class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame
69{
70 Q_OBJECT
71
72 friend class QtWidget;
73
76
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;
85
90
92
96
103
104#if CHECK_ANY_QT_USING_X11
105 SessionManagerInhibitor m_SessionManagerInhibitor;
106 ModKeyFlags m_nKeyModifiers;
107#endif
108
110
113
117
118 bool isChild(bool bPlug = true, bool bSysChild = true) const
119 {
121 if (bPlug)
123 if (bSysChild)
125 return bool(m_nStyle & nMask);
126 }
127
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);
134
136
137private Q_SLOTS:
138 void screenChanged(QScreen*);
139
140public:
141 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo);
142 virtual ~QtFrame() override;
143
144 QWidget* GetQWidget() const { return m_pQWidget; }
145 QtMainWindow* GetTopLevelWindow() const { return m_pTopLevel; }
146 QWidget* asChild() const;
147 qreal devicePixelRatioF() const;
148 int menuBarOffset() const;
149
150 void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
151 sal_Int32 nExtentsHeight) const;
152
153 virtual SalGraphics* AcquireGraphics() override;
154 virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
155
156 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
157
158 virtual void SetTitle(const OUString& rTitle) override;
159 virtual void SetIcon(sal_uInt16 nIcon) override;
160 virtual void SetMenu(SalMenu* pMenu) override;
161
162 virtual void registerDragSource(QtDragSource* pDragSource);
163 virtual void deregisterDragSource(QtDragSource const* pDragSource);
164 virtual void registerDropTarget(QtDropTarget* pDropTarget);
165 virtual void deregisterDropTarget(QtDropTarget const* pDropTarget);
166
168 void handleDragMove(QDragMoveEvent* pEvent);
169 void handleDrop(QDropEvent* pEvent);
170
171 virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
172 virtual void Show(bool bVisible, bool bNoActivate = false) override;
173 virtual void SetMinClientSize(tools::Long nWidth, tools::Long nHeight) override;
174 virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override;
175 virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
176 sal_uInt16 nFlags) override;
177 virtual void GetClientSize(tools::Long& rWidth, tools::Long& rHeight) override;
178 virtual void GetWorkArea(tools::Rectangle& rRect) override;
179 virtual SalFrame* GetParent() const override;
180 virtual void SetModal(bool bModal) override;
181 virtual bool GetModal() const override;
182 virtual void SetWindowState(const vcl::WindowData*) override;
183 virtual bool GetWindowState(vcl::WindowData*) override;
184 virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override;
185 virtual void StartPresentation(bool bStart) override;
186 virtual void SetAlwaysOnTop(bool bOnTop) override;
187 virtual void ToTop(SalFrameToTop nFlags) override;
188 virtual void SetPointer(PointerStyle ePointerStyle) override;
189 virtual void CaptureMouse(bool bMouse) override;
190 virtual void SetPointerPos(tools::Long nX, tools::Long nY) override;
191 virtual bool ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpArea) override;
192 using SalFrame::Flush;
193 virtual void Flush() override;
194 virtual void SetInputContext(SalInputContext* pContext) override;
195 virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override;
196 virtual OUString GetKeyName(sal_uInt16 nKeyCode) override;
197 virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType,
198 vcl::KeyCode& rKeyCode) override;
199 virtual LanguageType GetInputLanguage() override;
200 virtual void UpdateSettings(AllSettings& rSettings) override;
201 virtual void Beep() override;
202 virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; }
205 virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override;
206 virtual void SetParent(SalFrame* pNewParent) override;
207 virtual void SetPluginParent(SystemParentData* pNewParent) override;
208 virtual void ResetClipRegion() override;
209 virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
211 tools::Long nHeight) override;
212 virtual void EndSetClipRegion() override;
213
214 virtual void SetScreenNumber(unsigned int) override;
215 virtual void SetApplicationID(const OUString&) override;
216 virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
217 virtual bool GetUseReducedAnimation() const override;
218
219 inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
220
222 inline bool isPopup() const;
223 static void FillSystemEnvData(SystemEnvData&, sal_IntPtr pWindow, QWidget* pWidget);
224};
225
226inline bool QtFrame::CallCallback(SalEvent nEvent, const void* pEvent) const
227{
228 SolarMutexGuard aGuard;
229 return SalFrame::CallCallback(nEvent, pEvent);
230}
231
232inline bool QtFrame::isPopup() const
233{
236}
237
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
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
virtual bool GetUseReducedAnimation() const 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
int menuBarOffset() const
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
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:309
KeyIndicatorState
Definition: keycodes.hxx:187
ModKeyFlags
Definition: keycodes.hxx:166
long Long
PointerStyle
Definition: ptrstyle.hxx:26
std::unique_ptr< cairo_surface_t, CairoDeleter > UniqueCairoSurface
sal_uInt64 SalExtStyle
Definition: salframe.hxx:95
SalFrameToTop
Definition: salframe.hxx:43
SalFrameStyleFlags
Definition: salframe.hxx:65
SalEvent
Definition: salwtype.hxx:46
sal_uInt16 sal_Unicode
#define VCLPLUG_QT_PUBLIC
Definition: vclpluginapi.h:53
EndExtTextInputFlags
Definition: window.hxx:346