diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-04-22 07:03:35 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-04-22 07:03:35 +0200 |
commit | 04b80e1d50430be6ffd8b472623f55ce9bdf4bdd (patch) | |
tree | bababee25b8637b50a08d4fcfb8ac87868c6cbca | |
parent | 6a2f179809ef3669e84663bdbfa52a7f6fc76114 (diff) | |
parent | af0955d600cd3d54d26a87b9ff30e3c402a226dd (diff) |
Merge branch 'libreoffice-7-3'
into distro/lhm/libreoffice-7-3+backports
Change-Id: If18d653bb2e451057f3cf2ea535cc3f47286f202
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/inc/layfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-curl/CurlSession.cxx | 7 | ||||
-rw-r--r-- | vcl/inc/qt5/QtInstance.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/qt5/QtWidget.hxx | 8 | ||||
-rw-r--r-- | vcl/qt5/QtInstance.cxx | 7 | ||||
-rw-r--r-- | vcl/qt5/QtWidget.cxx | 55 |
9 files changed, 103 insertions, 9 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 35d016c93ac0..e3c87f5ea065 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -687,8 +687,9 @@ namespace sw::mark // no special array for these break; } - if (eType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK - || eType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK) + if (eMode == InsertMode::New + && (eType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK + || eType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK)) { // due to SwInsText notifications everything is visible now - tell // layout to hide as appropriate diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index 3f73602e6bfa..b0f981477499 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -100,6 +100,7 @@ public: SwPrintData const*const pPrintData = nullptr ) const override; const SwFrame *Lower() const { return m_pLower; } SwFrame *Lower() { return m_pLower; } + bool ContainsDeleteForbiddenLayFrame() const; const SwContentFrame *ContainsContent() const; inline SwContentFrame *ContainsContent(); const SwCellFrame *FirstCell() const; diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index d100e24526a4..3d92f2a9ce0e 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -165,6 +165,27 @@ const SwFrame *SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForSe return nullptr; } +bool SwLayoutFrame::ContainsDeleteForbiddenLayFrame() const +{ + if (IsDeleteForbidden()) + { + return true; + } + for (SwFrame const* pFrame = Lower(); pFrame; pFrame = pFrame->GetNext()) + { + if (!pFrame->IsLayoutFrame()) + { + continue; + } + SwLayoutFrame const*const pLay(static_cast<SwLayoutFrame const*>(pFrame)); + if (pLay->ContainsDeleteForbiddenLayFrame()) + { + return true; + } + } + return false; +} + const SwFrame* SwFrame::GetLower() const { return IsLayoutFrame() ? static_cast<const SwLayoutFrame*>(this)->Lower() : nullptr; diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index fe84f956a35c..e7a458737d30 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1024,6 +1024,8 @@ bool IsPageFrameEmpty(SwPageFrame const& rPage) rPage.FindFootnoteCont() || (nullptr != (pBody = rPage.FindBodyCont()) && ( pBody->ContainsContent() || + // check for section frames that are being formatted on the stack + rPage.ContainsDeleteForbiddenLayFrame() || // #i47580# // Do not delete page if there's an empty tabframe // left. I think it might be correct to use ContainsAny() diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index 813988c78489..66232a73a15f 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -620,9 +620,10 @@ CurlSession::CurlSession(uno::Reference<uno::XComponentContext> const& xContext, // en.wikipedia.org:80 forces back 403 "Scripts should use an informative // User-Agent string with contact information, or they may be IP-blocked // without notice" otherwise: - OString const useragent(OString::Concat("LibreOffice " LIBO_VERSION_DOTTED " curl/") - + ::std::string_view(pVersion->version, strlen(pVersion->version)) + " " - + pVersion->ssl_version); + OString const useragent( + OString::Concat("LibreOffice " LIBO_VERSION_DOTTED " denylistedbackend/") + + ::std::string_view(pVersion->version, strlen(pVersion->version)) + " " + + pVersion->ssl_version); // looks like an explicit "User-Agent" header in CURLOPT_HTTPHEADER // will override CURLOPT_USERAGENT, see Curl_http_useragent(), so no need // to check anything here diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx index 9a9853a7a2ce..fd111bb22abe 100644 --- a/vcl/inc/qt5/QtInstance.hxx +++ b/vcl/inc/qt5/QtInstance.hxx @@ -35,6 +35,7 @@ #include "QtFilePicker.hxx" +class QtFrame; class QtTimer; class QApplication; @@ -67,6 +68,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject, Timer m_aUpdateStyleTimer; bool m_bUpdateFonts; + QtFrame* m_pActivePopup; + DECL_DLLPRIVATE_LINK(updateStyleHdl, Timer*, void); void AfterAppInit() override; @@ -172,6 +175,9 @@ public: void UpdateStyle(bool bFontsChanged); void* CreateGStreamerSink(const SystemChildWindow*) override; + + QtFrame* activePopup() const { return m_pActivePopup; } + void setActivePopup(QtFrame*); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx index 878c8b1229ce..8f7f6cc319e1 100644 --- a/vcl/inc/qt5/QtWidget.hxx +++ b/vcl/inc/qt5/QtWidget.hxx @@ -51,6 +51,7 @@ class QtWidget : public QWidget static void commitText(QtFrame&, const QString& aText); static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*, const ButtonKeyState); static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*, const ButtonKeyState); + static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*); static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const QInputEvent* pQEvent, const QPoint& rPos, Qt::MouseButtons eButtons, int nWidth, SalAbstractMouseEvent& aSalEvent); @@ -72,9 +73,16 @@ class QtWidget : public QWidget virtual void paintEvent(QPaintEvent*) override; virtual void resizeEvent(QResizeEvent*) override; virtual void showEvent(QShowEvent*) override; + virtual void hideEvent(QHideEvent*) override; virtual void wheelEvent(QWheelEvent*) override; virtual void closeEvent(QCloseEvent*) override; virtual void changeEvent(QEvent*) override; + virtual void leaveEvent(QEvent*) override; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual void enterEvent(QEnterEvent*) override; +#else + virtual void enterEvent(QEvent*) override; +#endif void inputMethodEvent(QInputMethodEvent*) override; QVariant inputMethodQuery(Qt::InputMethodQuery) const override; diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index d252109e122a..247001443020 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -223,6 +223,7 @@ QtInstance::QtInstance(std::unique_ptr<QApplication>& pQApp, bool bUseCairo) , m_pQApplication(std::move(pQApp)) , m_aUpdateStyleTimer("vcl::qt5 m_aUpdateStyleTimer") , m_bUpdateFonts(false) + , m_pActivePopup(nullptr) { ImplSVData* pSVData = ImplGetSVData(); const OUString sToolkit = "qt" + OUString::number(QT_VERSION_MAJOR); @@ -722,6 +723,12 @@ std::unique_ptr<QApplication> QtInstance::CreateQApplication(int& nArgc, char** return pQApp; } +void QtInstance::setActivePopup(QtFrame* pFrame) +{ + assert(!pFrame || pFrame->isPopup()); + m_pActivePopup = pFrame; +} + extern "C" { VCLPLUG_QT_PUBLIC SalInstance* create_SalInstance() { diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 017249b05434..8c545fd13377 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -208,6 +208,41 @@ void QtWidget::mouseMoveEvent(QMouseEvent* pEvent) pEvent->accept(); } +void QtWidget::handleMouseEnterLeaveEvents(const QtFrame& rFrame, QEvent* pQEvent) +{ + const qreal fRatio = rFrame.devicePixelRatioF(); + const QWidget* pWidget = rFrame.GetQWidget(); + const Point aPos = toPoint(pWidget->mapFromGlobal(QCursor::pos()) * fRatio); + + SalMouseEvent aEvent; + aEvent.mnX + = QGuiApplication::isLeftToRight() ? aPos.X() : round(pWidget->width() * fRatio) - aPos.X(); + aEvent.mnY = aPos.Y(); + aEvent.mnTime = 0; + aEvent.mnButton = 0; + aEvent.mnCode = GetKeyModCode(QGuiApplication::keyboardModifiers()) + | GetMouseModCode(QGuiApplication::mouseButtons()); + + SalEvent nEventType; + if (pQEvent->type() == QEvent::Enter) + nEventType = SalEvent::MouseMove; + else + nEventType = SalEvent::MouseLeave; + rFrame.CallCallback(nEventType, &aEvent); + pQEvent->accept(); +} + +void QtWidget::leaveEvent(QEvent* pEvent) { handleMouseEnterLeaveEvents(m_rFrame, pEvent); } + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +void QtWidget::enterEvent(QEnterEvent* pEvent) +#else +void QtWidget::enterEvent(QEvent* pEvent) +#endif +{ + handleMouseEnterLeaveEvents(m_rFrame, pEvent); +} + void QtWidget::wheelEvent(QWheelEvent* pEvent) { SalWheelMouseEvent aEvent; @@ -282,9 +317,21 @@ void QtWidget::showEvent(QShowEvent*) // sequence from QtFrame::SetModal, if the frame was already set visible, // resulting in a hidden / unmapped window SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height()); + if (m_rFrame.isPopup()) + { + auto* pQtInst(static_cast<QtInstance*>(GetSalData()->m_pInstance)); + pQtInst->setActivePopup(&m_rFrame); + } m_rFrame.CallCallback(SalEvent::Paint, &aPaintEvt); } +void QtWidget::hideEvent(QHideEvent*) +{ + auto* pQtInst(static_cast<QtInstance*>(GetSalData()->m_pInstance)); + if (m_rFrame.isPopup() && pQtInst->activePopup() == &m_rFrame) + pQtInst->setActivePopup(nullptr); +} + void QtWidget::closeEvent(QCloseEvent* /*pEvent*/) { m_rFrame.CallCallback(SalEvent::Close, nullptr); @@ -592,11 +639,11 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent) } else if (pEvent->type() == QEvent::ToolTip) { - // Qt's POV on focus is wrong for our fake popup windows, so check LO's state. + // Qt's POV on the active popup is wrong due to our fake popup, so check LO's state. // Otherwise Qt will continue handling ToolTip events from the "parent" window. - const vcl::Window* pFocusWin = Application::GetFocusWindow(); - if (!rFrame.m_aTooltipText.isEmpty() && pFocusWin - && pFocusWin->GetFrameWindow() == rFrame.GetWindow()) + const QtFrame* pPopupFrame + = static_cast<QtInstance*>(GetSalData()->m_pInstance)->activePopup(); + if (!rFrame.m_aTooltipText.isEmpty() && (!pPopupFrame || pPopupFrame == &rFrame)) QToolTip::showText(QCursor::pos(), toQString(rFrame.m_aTooltipText), &rWidget, rFrame.m_aTooltipArea); else |