summaryrefslogtreecommitdiffstats
path: root/src/activeqt/container/qaxwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/activeqt/container/qaxwidget.cpp')
-rw-r--r--src/activeqt/container/qaxwidget.cpp187
1 files changed, 69 insertions, 118 deletions
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index c7f2609..76ac6d9 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the ActiveQt framework of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "qaxwidget.h"
#include "qaxwidget_p.h"
@@ -72,6 +25,7 @@
#include <quuid.h>
#include <qwhatsthis.h>
#include <qabstractnativeeventfilter.h>
+#include <private/qpixmap_win_p.h>
#include <windowsx.h>
#include <ocidl.h>
@@ -238,7 +192,7 @@ public:
// IUnknown
unsigned long WINAPI AddRef() override;
unsigned long WINAPI Release() override;
- STDMETHOD(QueryInterface)(REFIID iid, void **iface);
+ STDMETHOD(QueryInterface)(REFIID iid, void **iface) override;
// IDispatch
HRESULT __stdcall GetTypeInfoCount(unsigned int *) override
@@ -255,149 +209,149 @@ public:
void emitAmbientPropertyChange(DISPID dispid);
// IOleClientSite
- STDMETHOD(SaveObject)();
- STDMETHOD(GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk);
- STDMETHOD(GetContainer)(LPOLECONTAINER FAR* ppContainer);
- STDMETHOD(ShowObject)();
- STDMETHOD(OnShowWindow)(BOOL fShow);
- STDMETHOD(RequestNewObjectLayout)();
+ STDMETHOD(SaveObject)() override;
+ STDMETHOD(GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk) override;
+ STDMETHOD(GetContainer)(LPOLECONTAINER FAR* ppContainer) override;
+ STDMETHOD(ShowObject)() override;
+ STDMETHOD(OnShowWindow)(BOOL fShow) override;
+ STDMETHOD(RequestNewObjectLayout)() override;
// IOleControlSite
- STDMETHOD(OnControlInfoChanged)();
- STDMETHOD(LockInPlaceActive)(BOOL fLock);
- STDMETHOD(GetExtendedControl)(IDispatch** ppDisp);
- STDMETHOD(TransformCoords)(POINTL* pPtlHimetric, POINTF* pPtfContainer, DWORD dwFlags);
- STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, DWORD grfModifiers);
- STDMETHOD(OnFocus)(BOOL fGotFocus);
- STDMETHOD(ShowPropertyFrame)();
+ STDMETHOD(OnControlInfoChanged)() override;
+ STDMETHOD(LockInPlaceActive)(BOOL fLock) override;
+ STDMETHOD(GetExtendedControl)(IDispatch** ppDisp) override;
+ STDMETHOD(TransformCoords)(POINTL* pPtlHimetric, POINTF* pPtfContainer, DWORD dwFlags) override;
+ STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, DWORD grfModifiers) override;
+ STDMETHOD(OnFocus)(BOOL fGotFocus) override;
+ STDMETHOD(ShowPropertyFrame)() override;
// IOleWindow
- STDMETHOD(GetWindow)(HWND *phwnd);
- STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
+ STDMETHOD(GetWindow)(HWND *phwnd) override;
+ STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) override;
// IOleInPlaceSite
- STDMETHOD(CanInPlaceActivate)();
- STDMETHOD(OnInPlaceActivate)();
- STDMETHOD(OnUIActivate)();
- STDMETHOD(GetWindowContext)(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
- STDMETHOD(Scroll)(SIZE scrollExtant);
- STDMETHOD(OnUIDeactivate)(BOOL fUndoable);
- STDMETHOD(OnInPlaceDeactivate)();
- STDMETHOD(DiscardUndoState)();
- STDMETHOD(DeactivateAndUndo)();
- STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect);
+ STDMETHOD(CanInPlaceActivate)() override;
+ STDMETHOD(OnInPlaceActivate)() override;
+ STDMETHOD(OnUIActivate)() override;
+ STDMETHOD(GetWindowContext)(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo) override;
+ STDMETHOD(Scroll)(SIZE scrollExtant) override;
+ STDMETHOD(OnUIDeactivate)(BOOL fUndoable) override;
+ STDMETHOD(OnInPlaceDeactivate)() override;
+ STDMETHOD(DiscardUndoState)() override;
+ STDMETHOD(DeactivateAndUndo)() override;
+ STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect) override;
#ifdef QAX_SUPPORT_WINDOWLESS
// IOleInPlaceSiteEx ###
- STDMETHOD(OnInPlaceActivateEx)(BOOL* /*pfNoRedraw*/, DWORD /*dwFlags*/)
+ STDMETHOD(OnInPlaceActivateEx)(BOOL* /*pfNoRedraw*/, DWORD /*dwFlags*/) override
{
return S_OK;
}
- STDMETHOD(OnInPlaceDeactivateEx)(BOOL /*fNoRedraw*/)
+ STDMETHOD(OnInPlaceDeactivateEx)(BOOL /*fNoRedraw*/) override
{
return S_OK;
}
- STDMETHOD(RequestUIActivate)()
+ STDMETHOD(RequestUIActivate)() override
{
return S_OK;
}
// IOleInPlaceSiteWindowless ###
- STDMETHOD(CanWindowlessActivate)()
+ STDMETHOD(CanWindowlessActivate)() override
{
return S_OK;
}
- STDMETHOD(GetCapture)()
+ STDMETHOD(GetCapture)() override
{
return S_FALSE;
}
- STDMETHOD(SetCapture)(BOOL /*fCapture*/)
+ STDMETHOD(SetCapture)(BOOL /*fCapture*/) override
{
return S_FALSE;
}
- STDMETHOD(GetFocus)()
+ STDMETHOD(GetFocus)() override
{
return S_FALSE;
}
- STDMETHOD(SetFocus)(BOOL /*fCapture*/)
+ STDMETHOD(SetFocus)(BOOL /*fCapture*/) override
{
return S_FALSE;
}
- STDMETHOD(GetDC)(LPCRECT /*pRect*/, DWORD /*grfFlags*/, HDC *phDC)
+ STDMETHOD(GetDC)(LPCRECT /*pRect*/, DWORD /*grfFlags*/, HDC *phDC) override
{
*phDC = 0;
return S_OK;
}
- STDMETHOD(ReleaseDC)(HDC hDC)
+ STDMETHOD(ReleaseDC)(HDC hDC) override
{
::ReleaseDC((HWND)widget->winId(), hDC);
return S_OK;
}
- STDMETHOD(InvalidateRect)(LPCRECT pRect, BOOL fErase)
+ STDMETHOD(InvalidateRect)(LPCRECT pRect, BOOL fErase) override
{
::InvalidateRect((HWND)host->winId(), pRect, fErase);
return S_OK;
}
- STDMETHOD(InvalidateRgn)(HRGN hRGN, BOOL fErase)
+ STDMETHOD(InvalidateRgn)(HRGN hRGN, BOOL fErase) override
{
::InvalidateRgn((HWND)host->winId(), hRGN, fErase);
return S_OK;
}
- STDMETHOD(ScrollRect)(int /*dx*/, int /*dy*/, LPCRECT /*pRectScroll*/, LPCRECT /*pRectClip*/)
+ STDMETHOD(ScrollRect)(int /*dx*/, int /*dy*/, LPCRECT /*pRectScroll*/, LPCRECT /*pRectClip*/) override
{
return S_OK;
}
- STDMETHOD(AdjustRect)(LPRECT /*prc*/)
+ STDMETHOD(AdjustRect)(LPRECT /*prc*/) override
{
return S_OK;
}
#ifdef Q_CC_GNU // signature incorrect in win32api
- STDMETHOD(AdjustRect)(LPCRECT /*prc*/)
+ STDMETHOD(AdjustRect)(LPCRECT /*prc*/) override
{
RECT rect;
return AdjustRect(&rect);
}
#endif
- STDMETHOD(OnDefWindowMessage)(UINT /*msg*/, WPARAM /*wPara*/, LPARAM /*lParam*/, LRESULT* /*plResult*/)
+ STDMETHOD(OnDefWindowMessage)(UINT /*msg*/, WPARAM /*wPara*/, LPARAM /*lParam*/, LRESULT* /*plResult*/) override
{
return S_FALSE;
}
#endif
// IOleInPlaceFrame
- STDMETHOD(InsertMenus(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths));
- STDMETHOD(SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject));
- STDMETHOD(RemoveMenus(HMENU hmenuShared));
- STDMETHOD(SetStatusText(LPCOLESTR pszStatusText));
- STDMETHOD(EnableModeless(BOOL fEnable));
- STDMETHOD(TranslateAccelerator(LPMSG lpMsg, WORD grfModifiers));
+ STDMETHOD(InsertMenus(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)) override;
+ STDMETHOD(SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)) override;
+ STDMETHOD(RemoveMenus(HMENU hmenuShared)) override;
+ STDMETHOD(SetStatusText(LPCOLESTR pszStatusText)) override;
+ STDMETHOD(EnableModeless(BOOL fEnable)) override;
+ STDMETHOD(TranslateAccelerator(LPMSG lpMsg, WORD grfModifiers)) override;
// IOleInPlaceUIWindow
- STDMETHOD(GetBorder(LPRECT lprectBorder));
- STDMETHOD(RequestBorderSpace(LPCBORDERWIDTHS pborderwidths));
- STDMETHOD(SetBorderSpace(LPCBORDERWIDTHS pborderwidths));
- STDMETHOD(SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName));
+ STDMETHOD(GetBorder(LPRECT lprectBorder)) override;
+ STDMETHOD(RequestBorderSpace(LPCBORDERWIDTHS pborderwidths)) override;
+ STDMETHOD(SetBorderSpace(LPCBORDERWIDTHS pborderwidths)) override;
+ STDMETHOD(SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)) override;
// IOleDocumentSite
- STDMETHOD(ActivateMe(IOleDocumentView *pViewToActivate));
+ STDMETHOD(ActivateMe(IOleDocumentView *pViewToActivate)) override;
// IAdviseSink
- STDMETHOD_(void, OnDataChange)(FORMATETC* /*pFormatetc*/, STGMEDIUM* /*pStgmed*/)
+ STDMETHOD_(void, OnDataChange)(FORMATETC* /*pFormatetc*/, STGMEDIUM* /*pStgmed*/) override
{
AX_DEBUG(QAxClientSite::OnDataChange);
}
- STDMETHOD_(void, OnViewChange)(DWORD /*dwAspect*/, LONG /*lindex*/)
+ STDMETHOD_(void, OnViewChange)(DWORD /*dwAspect*/, LONG /*lindex*/) override
{
AX_DEBUG(QAxClientSite::OnViewChange);
}
- STDMETHOD_(void, OnRename)(IMoniker* /*pmk*/)
+ STDMETHOD_(void, OnRename)(IMoniker* /*pmk*/) override
{
}
- STDMETHOD_(void, OnSave)()
+ STDMETHOD_(void, OnSave)() override
{
}
- STDMETHOD_(void, OnClose)()
+ STDMETHOD_(void, OnClose)() override
{
}
@@ -462,9 +416,9 @@ static const ushort mouseTbl[] = {
WM_RBUTTONDOWN, QEvent::MouseButtonPress, Qt::RightButton,
WM_RBUTTONUP, QEvent::MouseButtonRelease, Qt::RightButton,
WM_RBUTTONDBLCLK, QEvent::MouseButtonDblClick, Qt::RightButton,
- WM_MBUTTONDOWN, QEvent::MouseButtonPress, Qt::MidButton,
- WM_MBUTTONUP, QEvent::MouseButtonRelease, Qt::MidButton,
- WM_MBUTTONDBLCLK, QEvent::MouseButtonDblClick, Qt::MidButton,
+ WM_MBUTTONDOWN, QEvent::MouseButtonPress, Qt::MiddleButton,
+ WM_MBUTTONUP, QEvent::MouseButtonRelease, Qt::MiddleButton,
+ WM_MBUTTONDBLCLK, QEvent::MouseButtonDblClick, Qt::MiddleButton,
0, 0, 0
};
@@ -474,7 +428,7 @@ static Qt::MouseButtons translateMouseButtonState(int s)
if (s & MK_LBUTTON)
bst |= Qt::LeftButton;
if (s & MK_MBUTTON)
- bst |= Qt::MidButton;
+ bst |= Qt::MiddleButton;
if (s & MK_RBUTTON)
bst |= Qt::RightButton;
@@ -1238,11 +1192,11 @@ HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPW
}
}
if (fileMenu)
- lpMenuWidths->width[0] = fileMenu->actions().count();
+ lpMenuWidths->width[0] = fileMenu->actions().size();
if (viewMenu)
- lpMenuWidths->width[2] = viewMenu->actions().count();
+ lpMenuWidths->width[2] = viewMenu->actions().size();
if (windowMenu)
- lpMenuWidths->width[4] = windowMenu->actions().count();
+ lpMenuWidths->width[4] = windowMenu->actions().size();
return S_OK;
}
@@ -1847,9 +1801,6 @@ void QAxHostWidget::focusOutEvent(QFocusEvent *e)
axhost->m_spInPlaceObject->UIDeactivate();
}
-Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0);
-Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0);
-
void QAxHostWidget::paintEvent(QPaintEvent*)
{
// QWidget having redirected paint device indicates non-regular paint, which implies
@@ -1883,7 +1834,7 @@ void QAxHostWidget::paintEvent(QPaintEvent*)
QPainter painter(this);
QPixmap pixmap = qt_pixmapFromWinHBITMAP(hBmp);
- pixmap.setDevicePixelRatio(devicePixelRatioF());
+ pixmap.setDevicePixelRatio(devicePixelRatio());
painter.drawPixmap(0, 0, pixmap);
SelectObject(hBmp_hdc, old_hBmp);