sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / vcl / inc / qt5 / QtFrame.hxx
blob4d1c0fd02cd517c3ad4d689646ef63870baff5dc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 "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>
36 #if !defined EMSCRIPTEN
37 #include <unx/sessioninhibitor.hxx>
38 #endif
39 #if CHECK_ANY_QT_USING_X11
40 // any better way to get rid of the X11 / Qt type clashes?
41 #undef Bool
42 #undef CursorShape
43 #undef Expose
44 #undef KeyPress
45 #undef KeyRelease
46 #undef FocusIn
47 #undef FocusOut
48 #undef FontChange
49 #undef None
50 #undef Status
51 #undef Unsorted
52 #endif
54 class QtDragSource;
55 class QtDropTarget;
56 class QtGraphics;
57 class QtInstance;
58 class QtMainWindow;
59 class QtMenu;
60 class QtSvpGraphics;
62 class QDragMoveEvent;
63 class QDropEvent;
64 class QImage;
65 class QMimeData;
66 class QPaintDevice;
67 class QScreen;
68 class QWidget;
70 class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame
72 Q_OBJECT
74 friend class QtWidget;
76 QtWidget* m_pQWidget;
77 QtMainWindow* m_pTopLevel;
79 const bool m_bUseCairo;
80 std::unique_ptr<QImage> m_pQImage;
81 std::unique_ptr<QtGraphics> m_pQtGraphics;
82 UniqueCairoSurface m_pSurface;
83 std::unique_ptr<QtSvpGraphics> m_pSvpGraphics;
84 DamageHandler m_aDamageHandler;
85 QRegion m_aRegion;
86 bool m_bNullRegion;
88 bool m_bGraphicsInUse;
89 SalFrameStyleFlags m_nStyle;
90 QtFrame* m_pParent;
91 PointerStyle m_ePointerStyle;
93 SystemEnvData m_aSystemData;
95 QtDragSource* m_pDragSource;
96 QtDropTarget* m_pDropTarget;
97 bool m_bInDrag;
99 bool m_bDefaultSize;
100 bool m_bDefaultPos;
101 bool m_bFullScreen;
102 bool m_bFullScreenSpanAll;
103 sal_uInt32 m_nRestoreScreen;
104 QRect m_aRestoreGeometry;
106 #if !defined EMSCRIPTEN
107 SessionManagerInhibitor m_SessionManagerInhibitor;
108 #endif
109 #if CHECK_ANY_QT_USING_X11
110 ModKeyFlags m_nKeyModifiers;
111 #endif
113 LanguageType m_nInputLanguage;
115 OUString m_aTooltipText;
116 QRect m_aTooltipArea;
118 void SetDefaultPos();
119 Size CalcDefaultSize();
120 void SetDefaultSize();
122 bool isChild(bool bPlug = true, bool bSysChild = true) const
124 SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE;
125 if (bPlug)
126 nMask |= SalFrameStyleFlags::PLUG;
127 if (bSysChild)
128 nMask |= SalFrameStyleFlags::SYSTEMCHILD;
129 return bool(m_nStyle & nMask);
132 bool isWindow() const;
133 QWindow* windowHandle() const;
134 QScreen* screen() const;
135 sal_Int32 screenNumber() const;
136 bool isMinimized() const;
137 bool isMaximized() const;
138 void SetWindowStateImpl(Qt::WindowStates eState);
140 private Q_SLOTS:
141 void screenChanged(QScreen*);
143 public:
144 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo);
145 virtual ~QtFrame() override;
147 QWidget* GetQWidget() const { return m_pQWidget; }
148 QtMainWindow* GetTopLevelWindow() const { return m_pTopLevel; }
149 QWidget* asChild() const;
150 qreal devicePixelRatioF() const;
152 void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
153 sal_Int32 nExtentsHeight) const;
155 virtual SalGraphics* AcquireGraphics() override;
156 virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
158 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
160 virtual void SetTitle(const OUString& rTitle) override;
161 virtual void SetIcon(sal_uInt16 nIcon) override;
162 virtual void SetMenu(SalMenu* pMenu) override;
164 virtual void registerDragSource(QtDragSource* pDragSource);
165 virtual void deregisterDragSource(QtDragSource const* pDragSource);
166 virtual void registerDropTarget(QtDropTarget* pDropTarget);
167 virtual void deregisterDropTarget(QtDropTarget const* pDropTarget);
169 void handleDragLeave();
170 void handleDragMove(QDragMoveEvent* pEvent);
171 void handleDrop(QDropEvent* pEvent);
172 void handleMoveEvent(QMoveEvent* pEvent);
173 void handlePaintEvent(QPaintEvent* pEvent, QWidget* pWidget);
174 void handleResizeEvent(QResizeEvent* pEvent);
176 virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
177 virtual void Show(bool bVisible, bool bNoActivate = false) override;
178 virtual void SetMinClientSize(tools::Long nWidth, tools::Long nHeight) override;
179 virtual void SetMaxClientSize(tools::Long nWidth, tools::Long nHeight) override;
180 virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
181 sal_uInt16 nFlags) override;
182 virtual void GetClientSize(tools::Long& rWidth, tools::Long& rHeight) override;
183 SalFrameGeometry GetUnmirroredGeometry() const override;
184 virtual void GetWorkArea(AbsoluteScreenPixelRectangle& rRect) override;
185 virtual SalFrame* GetParent() const override;
186 virtual void SetModal(bool bModal) override;
187 virtual void SetWindowState(const vcl::WindowData*) override;
188 virtual bool GetWindowState(vcl::WindowData*) override;
189 virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override;
190 virtual void StartPresentation(bool bStart) override;
191 virtual void SetAlwaysOnTop(bool bOnTop) override;
192 virtual void ToTop(SalFrameToTop nFlags) override;
193 virtual void SetPointer(PointerStyle ePointerStyle) override;
194 virtual void CaptureMouse(bool bMouse) override;
195 virtual void SetPointerPos(tools::Long nX, tools::Long nY) override;
196 virtual bool ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpArea) override;
197 using SalFrame::Flush;
198 virtual void Flush() override;
199 virtual void SetInputContext(SalInputContext* pContext) override;
200 virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override;
201 virtual OUString GetKeyName(sal_uInt16 nKeyCode) override;
202 virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType,
203 vcl::KeyCode& rKeyCode) override;
204 virtual LanguageType GetInputLanguage() override;
205 virtual void UpdateSettings(AllSettings& rSettings) override;
206 virtual void Beep() override;
207 virtual const SystemEnvData& GetSystemData() const override { return m_aSystemData; }
208 virtual SalPointerState GetPointerState() override;
209 virtual KeyIndicatorState GetIndicatorState() override;
210 virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override;
211 virtual void SetParent(SalFrame* pNewParent) override;
212 virtual void SetPluginParent(SystemParentData* pNewParent) override;
213 virtual void ResetClipRegion() override;
214 virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
215 virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth,
216 tools::Long nHeight) override;
217 virtual void EndSetClipRegion() override;
219 virtual void SetScreenNumber(unsigned int) override;
220 virtual void SetApplicationID(const OUString&) override;
221 virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
222 virtual bool GetUseDarkMode() const override;
223 virtual bool GetUseReducedAnimation() const override;
225 inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
227 void setInputLanguage(LanguageType);
228 inline bool isPopup() const;
229 static void FillSystemEnvData(SystemEnvData&, sal_IntPtr pWindow, QWidget* pWidget);
232 inline bool QtFrame::CallCallback(SalEvent nEvent, const void* pEvent) const
234 SolarMutexGuard aGuard;
235 return SalFrame::CallCallback(nEvent, pEvent);
238 inline bool QtFrame::isPopup() const
240 return ((m_nStyle & SalFrameStyleFlags::FLOAT)
241 && !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION));
244 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */