bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / qt5 / Qt5Frame.hxx
blobed82c2a7a8fb844de2bb1da716c1dd5ca5fbb020
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <config_vclplug.h>
24 #include <salframe.hxx>
25 #include <vclpluginapi.h>
27 #include "Qt5Tools.hxx"
29 #include <headless/svpgdi.hxx>
30 #include <vcl/svapp.hxx>
31 #include <vcl/sysdata.hxx>
33 #include <QtCore/QObject>
35 #if QT5_USING_X11
36 #include <unx/screensaverinhibitor.hxx>
37 // any better way to get rid of the X11 / Qt type clashes?
38 #undef Bool
39 #undef CursorShape
40 #undef Expose
41 #undef KeyPress
42 #undef KeyRelease
43 #undef FocusIn
44 #undef FocusOut
45 #undef FontChange
46 #undef None
47 #undef Status
48 #undef Unsorted
49 #endif
51 class Qt5DragSource;
52 class Qt5DropTarget;
53 class Qt5Graphics;
54 class Qt5Instance;
55 class Qt5MainWindow;
56 class Qt5Menu;
57 class Qt5SvpGraphics;
59 class QDragMoveEvent;
60 class QDropEvent;
61 class QImage;
62 class QMimeData;
63 class QPaintDevice;
64 class QScreen;
65 class QWidget;
67 class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
69 Q_OBJECT
71 friend class Qt5Widget;
73 QWidget* m_pQWidget;
74 Qt5MainWindow* m_pTopLevel;
76 const bool m_bUseCairo;
77 std::unique_ptr<QImage> m_pQImage;
78 std::unique_ptr<Qt5Graphics> m_pQt5Graphics;
79 UniqueCairoSurface m_pSurface;
80 std::unique_ptr<Qt5SvpGraphics> m_pSvpGraphics;
81 DamageHandler m_aDamageHandler;
82 QRegion m_aRegion;
83 bool m_bNullRegion;
85 bool m_bGraphicsInUse;
86 SalFrameStyleFlags m_nStyle;
87 Qt5Frame* m_pParent;
88 PointerStyle m_ePointerStyle;
90 SystemEnvData m_aSystemData;
92 Qt5DragSource* m_pDragSource;
93 Qt5DropTarget* m_pDropTarget;
94 bool m_bInDrag;
96 bool m_bDefaultSize;
97 bool m_bDefaultPos;
98 bool m_bFullScreen;
99 bool m_bFullScreenSpanAll;
100 sal_uInt32 m_nRestoreScreen;
101 QRect m_aRestoreGeometry;
103 #if QT5_USING_X11
104 ScreenSaverInhibitor m_ScreenSaverInhibitor;
105 ModKeyFlags m_nKeyModifiers;
106 #endif
108 LanguageType m_nInputLanguage;
110 void SetDefaultPos();
111 Size CalcDefaultSize();
112 void SetDefaultSize();
114 bool isChild(bool bPlug = true, bool bSysChild = true) const
116 SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE;
117 if (bPlug)
118 nMask |= SalFrameStyleFlags::PLUG;
119 if (bSysChild)
120 nMask |= SalFrameStyleFlags::SYSTEMCHILD;
121 return bool(m_nStyle & nMask);
124 bool isWindow() const;
125 QWindow* windowHandle() const;
126 QScreen* screen() const;
127 bool isMinimized() const;
128 bool isMaximized() const;
129 void SetWindowStateImpl(Qt::WindowStates eState);
131 void fixICCCMwindowGroup();
133 public:
134 Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo);
135 virtual ~Qt5Frame() override;
137 QWidget* GetQWidget() const { return m_pQWidget; }
138 Qt5MainWindow* GetTopLevelWindow() const { return m_pTopLevel; }
139 QWidget* asChild() const;
140 qreal devicePixelRatioF() const;
142 void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
143 sal_Int32 nExtentsHeight) const;
145 virtual SalGraphics* AcquireGraphics() override;
146 virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
148 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
150 virtual void SetTitle(const OUString& rTitle) override;
151 virtual void SetIcon(sal_uInt16 nIcon) override;
152 virtual void SetMenu(SalMenu* pMenu) override;
153 virtual void DrawMenuBar() override;
155 virtual void registerDragSource(Qt5DragSource* pDragSource);
156 virtual void deregisterDragSource(Qt5DragSource const* pDragSource);
157 virtual void registerDropTarget(Qt5DropTarget* pDropTarget);
158 virtual void deregisterDropTarget(Qt5DropTarget const* pDropTarget);
160 void handleDragLeave();
161 void handleDragMove(QDragMoveEvent* pEvent);
162 void handleDrop(QDropEvent* pEvent);
164 virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
165 virtual void Show(bool bVisible, bool bNoActivate = false) override;
166 virtual void SetMinClientSize(tools::Long nWidth, tools::Long nHeight) override;
167 virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override;
168 virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
169 sal_uInt16 nFlags) override;
170 virtual void GetClientSize(tools::Long& rWidth, tools::Long& rHeight) override;
171 virtual void GetWorkArea(tools::Rectangle& rRect) override;
172 virtual SalFrame* GetParent() const override;
173 virtual void SetModal(bool bModal) override;
174 virtual bool GetModal() const override;
175 virtual void SetWindowState(const SalFrameState* pState) override;
176 virtual bool GetWindowState(SalFrameState* pState) override;
177 virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override;
178 virtual void StartPresentation(bool bStart) override;
179 virtual void SetAlwaysOnTop(bool bOnTop) override;
180 virtual void ToTop(SalFrameToTop nFlags) override;
181 virtual void SetPointer(PointerStyle ePointerStyle) override;
182 virtual void CaptureMouse(bool bMouse) override;
183 virtual void SetPointerPos(tools::Long nX, tools::Long nY) override;
184 virtual bool ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpArea) override;
185 using SalFrame::Flush;
186 virtual void Flush() override;
187 virtual void SetInputContext(SalInputContext* pContext) override;
188 virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override;
189 virtual OUString GetKeyName(sal_uInt16 nKeyCode) override;
190 virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType,
191 vcl::KeyCode& rKeyCode) override;
192 virtual LanguageType GetInputLanguage() override;
193 virtual void UpdateSettings(AllSettings& rSettings) override;
194 virtual void Beep() override;
195 virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; }
196 virtual SalPointerState GetPointerState() override;
197 virtual KeyIndicatorState GetIndicatorState() override;
198 virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override;
199 virtual void SetParent(SalFrame* pNewParent) override;
200 virtual void SetPluginParent(SystemParentData* pNewParent) override;
201 virtual void ResetClipRegion() override;
202 virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
203 virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth,
204 tools::Long nHeight) override;
205 virtual void EndSetClipRegion() override;
207 virtual void SetScreenNumber(unsigned int) override;
208 virtual void SetApplicationID(const OUString&) override;
210 inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
212 void setInputLanguage(LanguageType);
215 inline bool Qt5Frame::CallCallback(SalEvent nEvent, const void* pEvent) const
217 SolarMutexGuard aGuard;
218 return SalFrame::CallCallback(nEvent, pEvent);
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */