calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / vcl / inc / qt5 / QtFrame.hxx
blob963572ca819b329a733fd27d80af6e83e03f564a
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 "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 CHECK_ANY_QT_USING_X11
37 #include <unx/screensaverinhibitor.hxx>
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
52 class QtDragSource;
53 class QtDropTarget;
54 class QtGraphics;
55 class QtInstance;
56 class QtMainWindow;
57 class QtMenu;
58 class QtSvpGraphics;
60 class QDragMoveEvent;
61 class QDropEvent;
62 class QImage;
63 class QMimeData;
64 class QPaintDevice;
65 class QScreen;
66 class QWidget;
68 class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame
70 Q_OBJECT
72 friend class QtWidget;
74 QtWidget* m_pQWidget;
75 QtMainWindow* m_pTopLevel;
77 const bool m_bUseCairo;
78 std::unique_ptr<QImage> m_pQImage;
79 std::unique_ptr<QtGraphics> m_pQtGraphics;
80 UniqueCairoSurface m_pSurface;
81 std::unique_ptr<QtSvpGraphics> m_pSvpGraphics;
82 DamageHandler m_aDamageHandler;
83 QRegion m_aRegion;
84 bool m_bNullRegion;
86 bool m_bGraphicsInUse;
87 SalFrameStyleFlags m_nStyle;
88 QtFrame* m_pParent;
89 PointerStyle m_ePointerStyle;
91 SystemEnvData m_aSystemData;
93 QtDragSource* m_pDragSource;
94 QtDropTarget* m_pDropTarget;
95 bool m_bInDrag;
97 bool m_bDefaultSize;
98 bool m_bDefaultPos;
99 bool m_bFullScreen;
100 bool m_bFullScreenSpanAll;
101 sal_uInt32 m_nRestoreScreen;
102 QRect m_aRestoreGeometry;
104 #if CHECK_ANY_QT_USING_X11
105 ScreenSaverInhibitor m_ScreenSaverInhibitor;
106 ModKeyFlags m_nKeyModifiers;
107 #endif
109 LanguageType m_nInputLanguage;
111 OUString m_aTooltipText;
112 QRect m_aTooltipArea;
114 void SetDefaultPos();
115 Size CalcDefaultSize();
116 void SetDefaultSize();
118 bool isChild(bool bPlug = true, bool bSysChild = true) const
120 SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE;
121 if (bPlug)
122 nMask |= SalFrameStyleFlags::PLUG;
123 if (bSysChild)
124 nMask |= SalFrameStyleFlags::SYSTEMCHILD;
125 return bool(m_nStyle & nMask);
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 int menuBarOffset() const;
136 void fixICCCMwindowGroup();
138 private Q_SLOTS:
139 void screenChanged(QScreen*);
141 public:
142 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo);
143 virtual ~QtFrame() override;
145 QWidget* GetQWidget() const { return m_pQWidget; }
146 QtMainWindow* GetTopLevelWindow() const { return m_pTopLevel; }
147 QWidget* asChild() const;
148 qreal devicePixelRatioF() const;
150 void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
151 sal_Int32 nExtentsHeight) const;
153 virtual SalGraphics* AcquireGraphics() override;
154 virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
156 virtual bool PostEvent(std::unique_ptr<ImplSVEvent> pData) override;
158 virtual void SetTitle(const OUString& rTitle) override;
159 virtual void SetIcon(sal_uInt16 nIcon) override;
160 virtual void SetMenu(SalMenu* pMenu) override;
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);
167 void handleDragLeave();
168 void handleDragMove(QDragMoveEvent* pEvent);
169 void handleDrop(QDropEvent* pEvent);
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; }
203 virtual SalPointerState GetPointerState() override;
204 virtual KeyIndicatorState GetIndicatorState() override;
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;
210 virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth,
211 tools::Long nHeight) override;
212 virtual void EndSetClipRegion() override;
214 virtual void SetScreenNumber(unsigned int) override;
215 virtual void SetApplicationID(const OUString&) override;
216 virtual void ResolveWindowHandle(SystemEnvData& rData) const override;
218 inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
220 void setInputLanguage(LanguageType);
221 inline bool isPopup() const;
222 static void FillSystemEnvData(SystemEnvData&, sal_IntPtr pWindow, QWidget* pWidget);
225 inline bool QtFrame::CallCallback(SalEvent nEvent, const void* pEvent) const
227 SolarMutexGuard aGuard;
228 return SalFrame::CallCallback(nEvent, pEvent);
231 inline bool QtFrame::isPopup() const
233 return ((m_nStyle & SalFrameStyleFlags::FLOAT)
234 && !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION));
237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */