include/vcl/InterimItemWindow.hxx | 7 +++++++ sw/source/uibase/docvw/AnnotationWin2.cxx | 5 +++++ vcl/source/control/InterimItemWindow.cxx | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+)
New commits: commit 0659c488efb00e2a87fa98edf498288470688a9a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 15 17:27:58 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Nov 16 11:26:33 2021 +0100 Resolves: tdf#143511 SysObj is clipped out if the widget is out of view so the sizes and relative positions are invalid under gtk, unclip the SysObj when using get_extents_relative_to Change-Id: Ibdaff20531a2a40b3b9b7dc9ac880d014db07d5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125272 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/InterimItemWindow.hxx b/include/vcl/InterimItemWindow.hxx index 3fc0903b110f..4cf4dd4ebeca 100644 --- a/include/vcl/InterimItemWindow.hxx +++ b/include/vcl/InterimItemWindow.hxx @@ -51,6 +51,13 @@ protected: virtual void Layout(); + // unclip a "SysObj" which is a native window element hosted in a vcl::Window + // if the SysObj is logically "visible" in the vcl::Window::IsVisible sense but + // is partially or wholly clipped out due to being overlapped or scrolled out + // of view. The clip state is flagged as dirty after this and vcl will restore + // the clip state the next time it evaluates the clip status + void UnclipVisibleSysObj(); + std::unique_ptr<weld::Builder> m_xBuilder; VclPtr<vcl::Window> m_xVclContentArea; std::unique_ptr<weld::Container> m_xContainer; diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 47d0cdd7bb6f..33dc2cb54b5b 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -152,6 +152,10 @@ void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt) { + // tdf#143511 unclip SysObj so get_extents_relative_to of children + // of the SysObj can provide meaningful results + UnclipVisibleSysObj(); + pDev->Push(); pDev->SetFillColor(mColorDark); @@ -163,6 +167,7 @@ void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt) pDev->SetFont(aFont); Size aSz = PixelToLogic(GetSizePixel()); + pDev->DrawRect(tools::Rectangle(rPt, aSz)); if (mxMetadataAuthor->get_visible()) diff --git a/vcl/source/control/InterimItemWindow.cxx b/vcl/source/control/InterimItemWindow.cxx index d47da4a02d19..0017065d7ddb 100644 --- a/vcl/source/control/InterimItemWindow.cxx +++ b/vcl/source/control/InterimItemWindow.cxx @@ -9,6 +9,8 @@ #include <vcl/InterimItemWindow.hxx> #include <vcl/layout.hxx> +#include <salobj.hxx> +#include <window.h> InterimItemWindow::InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, bool bAllowCycleFocusOut, @@ -69,6 +71,24 @@ void InterimItemWindow::queue_resize(StateChangedType eReason) void InterimItemWindow::Resize() { Layout(); } +void InterimItemWindow::UnclipVisibleSysObj() +{ + if (!IsVisible()) + return; + vcl::Window* pChild = m_xVclContentArea->GetWindow(GetWindowType::FirstChild); + if (!pChild) + return; + WindowImpl* pWindowImpl = pChild->ImplGetWindowImpl(); + if (!pWindowImpl) + return; + if (!pWindowImpl->mpSysObj) + return; + pWindowImpl->mpSysObj->Show(true); + pWindowImpl->mpSysObj->ResetClipRegion(); + // flag that sysobj clip is dirty and needs to be recalculated on next use + pWindowImpl->mbInitWinClipRegion = true; +} + IMPL_LINK_NOARG(InterimItemWindow, DoLayout, Timer*, void) { Layout(); } void InterimItemWindow::Layout()