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 0866a9e92ff0d301632d0600d6178c2fc2080f48 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 15 17:27:58 2021 +0000 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Nov 16 15:59:04 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/+/125141 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/include/vcl/InterimItemWindow.hxx b/include/vcl/InterimItemWindow.hxx index 08860c50244a..8c5a6d4e418f 100644 --- a/include/vcl/InterimItemWindow.hxx +++ b/include/vcl/InterimItemWindow.hxx @@ -50,6 +50,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 2ae806b5316b..606945672144 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -153,6 +153,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); @@ -164,6 +168,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 3817e01893f1..33c508cd7dad 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()