diff options
-rw-r--r-- | sw/inc/PostItMgr.hxx | 2 | ||||
-rw-r--r-- | sw/inc/SidebarWin.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 31 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarWin.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 16 |
5 files changed, 59 insertions, 0 deletions
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index dbf4ce38d1b6..7427c7ad23e2 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -234,6 +234,8 @@ class SwPostItMgr: public SfxListener Rectangle GetTopScrollRect(const unsigned long aPage) const; bool IsHit(const Point &aPointPixel); + /// Get the matching window that is responsible for handling mouse events of rPointLogic, if any. + vcl::Window* IsHitSidebarWindow(const Point& rPointLogic); Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const; sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pField) const; diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx index fb47322ee696..f42bcb38309f 100644 --- a/sw/inc/SidebarWin.hxx +++ b/sw/inc/SidebarWin.hxx @@ -178,6 +178,8 @@ class SwSidebarWin : public vcl::Window virtual void Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override; void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); + /// Get the matching sub-widget inside this sidebar widget for rPointLogic, if any. + vcl::Window* IsHitWindow(const Point& rPointLogic); protected: virtual void DataChanged( const DataChangedEvent& aEvent) override; diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index b0f62a09a27b..9622a108423c 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1706,6 +1706,37 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel) } return false; } + +vcl::Window* SwPostItMgr::IsHitSidebarWindow(const Point& rPointLogic) +{ + vcl::Window* pRet = 0; + + if (HasNotes() && ShowNotes()) + { + bool bEnableMapMode = !mpEditWin->IsMapModeEnabled(); + if (bEnableMapMode) + mpEditWin->EnableMapMode(); + + for (SwSidebarItem* pItem : mvPostItFields) + { + SwSidebarWin* pPostIt = pItem->pPostIt; + if (!pPostIt) + continue; + + if (vcl::Window* pWindow = pPostIt->IsHitWindow(rPointLogic)) + { + pRet = pWindow; + break; + } + } + + if (bEnableMapMode) + mpEditWin->EnableMapMode(false); + } + + return pRet; +} + Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const { SwRect aPageRect = mPages[aPage-1]->mPageRect; diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 414f3aadfe94..ee2ed58b4277 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -279,6 +279,14 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle rRenderContext.Push(PushFlags::NONE); } +vcl::Window* SwSidebarWin::IsHitWindow(const Point& rPointLogic) +{ + Rectangle aRectangleLogic(EditWin().PixelToLogic(GetPosPixel()), EditWin().PixelToLogic(GetSizePixel())); + if (aRectangleLogic.IsInside(rPointLogic)) + return mpSidebarTextControl; + return 0; +} + void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, DrawFlags nInFlags) { if (mpMetadataAuthor->IsVisible() ) diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 498771aa7d95..a33257ce69d1 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -2764,6 +2764,22 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if (m_rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel())) return; + if (comphelper::LibreOfficeKit::isActive()) + { + if (vcl::Window* pWindow = m_rView.GetPostItMgr()->IsHitSidebarWindow(rMEvt.GetPosPixel())) + { + bool bDisableMapMode = pWindow->IsMapModeEnabled(); + if (bDisableMapMode) + pWindow->EnableMapMode(false); + + pWindow->MouseButtonDown(rMEvt); + + if (bDisableMapMode) + pWindow->EnableMapMode(); + return; + } + } + m_rView.GetPostItMgr()->SetActiveSidebarWin(nullptr); GrabFocus(); |