summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2022-12-06 22:48:58 -0900
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-12-08 08:03:51 +0000
commit26b64750ea15812de172985b50e6f22c2c71a60d (patch)
tree10efc6aee4dcffe43e902cab3f0d03fa177c8661
parent8dbb69bcee477886fab752f9bd158cf54951b827 (diff)
tdf#152029 Bring tables, frames, images, and ole objects to
attention in the document view when the mouse pointer is over these content type and content entries in the Navigator content tree Change-Id: I9493203c2011a2f02fb6ddb6741992d43eaf4ddd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143763 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/uibase/inc/conttree.hxx1
-rw-r--r--sw/source/uibase/utlui/content.cxx87
2 files changed, 82 insertions, 6 deletions
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index fc7f506b5128..03f331c2584f 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -137,6 +137,7 @@ class SwContentTree final : public SfxListener
std::unique_ptr<sdr::overlay::OverlayObject> m_xOverlayObject;
void BringHeadingsToAttention(const SwOutlineNodes& rOutlineNodesArr);
+ void BringFramesToAttention(const std::vector<const SwFrameFormat*>& rFrameFormats);
void BringBookmarksToAttention(const std::vector<OUString>& rNames);
void BringURLFieldsToAttention(const SwGetINetAttrs& rINetAttrsArr);
void BringReferencesToAttention(std::vector<const SwTextAttr*>& rTextAttrsArr);
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 7c4761bb365e..1033c63c84e3 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1164,9 +1164,12 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
{
SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry));
const ContentTypeId nType = pCnt->GetParent()->GetType();
- bRemoveOverlayObject = nType != ContentTypeId::OUTLINE &&
- nType != ContentTypeId::BOOKMARK && nType != ContentTypeId::URLFIELD &&
- nType != ContentTypeId::REFERENCE && nType != ContentTypeId::TEXTFIELD;
+ bRemoveOverlayObject =
+ nType != ContentTypeId::OUTLINE && nType != ContentTypeId::TABLE &&
+ nType != ContentTypeId::FRAME && nType != ContentTypeId::GRAPHIC &&
+ nType != ContentTypeId::OLE && nType != ContentTypeId::BOOKMARK &&
+ nType != ContentTypeId::URLFIELD && nType != ContentTypeId::REFERENCE &&
+ nType != ContentTypeId::TEXTFIELD;
if (!bRemoveOverlayObject && (rMEvt.IsEnterWindow() ||
m_xTreeView->iter_compare(*xEntry, *m_xOverlayCompareEntry) != 0))
{
@@ -1177,6 +1180,26 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
GetOutLineNds()[static_cast<SwOutlineContent*>(pCnt)->GetOutlinePos()]);
BringHeadingsToAttention(aOutlineNodes);
}
+ else if (nType == ContentTypeId::TABLE)
+ {
+ if (const SwFrameFormats* pFrameFormats =
+ m_pActiveShell->GetDoc()->GetTableFrameFormats())
+ if (const SwFrameFormat* pFrameFormat =
+ pFrameFormats->FindFormatByName(pCnt->GetName()))
+ BringFramesToAttention(std::vector<const SwFrameFormat*> {pFrameFormat});
+ }
+ else if (nType == ContentTypeId::FRAME || nType == ContentTypeId::GRAPHIC ||
+ nType == ContentTypeId::OLE)
+ {
+ SwNodeType eNodeType = SwNodeType::Text;
+ if(nType == ContentTypeId::GRAPHIC)
+ eNodeType = SwNodeType::Grf;
+ else if(nType == ContentTypeId::OLE)
+ eNodeType = SwNodeType::Ole;
+ if (const SwFrameFormat* pFrameFormat =
+ m_pActiveShell->GetDoc()->FindFlyByName(pCnt->GetName(), eNodeType))
+ BringFramesToAttention(std::vector<const SwFrameFormat*> {pFrameFormat});
+ }
else if (nType == ContentTypeId::BOOKMARK)
{
BringBookmarksToAttention(std::vector<OUString> {pCnt->GetName()});
@@ -1210,9 +1233,12 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
{
const ContentTypeId nType =
weld::fromId<SwContentType*>(m_xTreeView->get_id(*xEntry))->GetType();
- bRemoveOverlayObject = nType != ContentTypeId::OUTLINE &&
- nType != ContentTypeId::BOOKMARK && nType != ContentTypeId::URLFIELD &&
- nType != ContentTypeId::REFERENCE && nType != ContentTypeId::TEXTFIELD;
+ bRemoveOverlayObject =
+ nType != ContentTypeId::OUTLINE && nType != ContentTypeId::TABLE &&
+ nType != ContentTypeId::FRAME && nType != ContentTypeId::GRAPHIC &&
+ nType != ContentTypeId::OLE && nType != ContentTypeId::BOOKMARK &&
+ nType != ContentTypeId::URLFIELD && nType != ContentTypeId::REFERENCE &&
+ nType != ContentTypeId::TEXTFIELD;
if (!bRemoveOverlayObject && (rMEvt.IsEnterWindow() ||
m_xTreeView->iter_compare(*xEntry, *m_xOverlayCompareEntry) != 0))
{
@@ -1220,6 +1246,38 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool)
{
BringHeadingsToAttention(m_pActiveShell->GetNodes().GetOutLineNds());
}
+ else if (nType == ContentTypeId::TABLE)
+ {
+ std::vector<const SwFrameFormat*> aTableFormatsArr;
+ const size_t nCount = m_pActiveShell->GetTableFrameFormatCount(true);
+ const SwFrameFormats* pFrameFormats =
+ m_pActiveShell->GetDoc()->GetTableFrameFormats();
+ SwAutoFormatGetDocNode aGetHt(&m_pActiveShell->GetNodes());
+ for(size_t n = 0, i = 0; i < nCount + n; ++i)
+ {
+ if (const SwTableFormat* pTableFormat =
+ static_cast<SwTableFormat*>(pFrameFormats->GetFormat(i)))
+ {
+ if (pTableFormat->GetInfo(aGetHt)) // skip deleted tables
+ {
+ n++;
+ continue;
+ }
+ aTableFormatsArr.push_back(pTableFormat);
+ }
+ }
+ BringFramesToAttention(aTableFormatsArr);
+ }
+ else if (nType == ContentTypeId::FRAME || nType == ContentTypeId::GRAPHIC ||
+ nType == ContentTypeId::OLE)
+ {
+ FlyCntType eType = FLYCNTTYPE_FRM;
+ if(nType == ContentTypeId::GRAPHIC)
+ eType = FLYCNTTYPE_GRF;
+ else if(nType == ContentTypeId::OLE)
+ eType = FLYCNTTYPE_OLE;
+ BringFramesToAttention(m_pActiveShell->GetFlyFrameFormats(eType, true));
+ }
else if (nType == ContentTypeId::BOOKMARK)
{
Reference<frame::XModel> xModel =
@@ -5623,6 +5681,23 @@ void SwContentTree::BringHeadingsToAttention(const SwOutlineNodes& rOutlineNodes
m_aOverlayObjectDelayTimer.Start();
}
+void SwContentTree::BringFramesToAttention(const std::vector<const SwFrameFormat*>& rFrameFormats)
+{
+ std::vector<basegfx::B2DRange> aRanges;
+ for (const SwFrameFormat* pFrameFormat : rFrameFormats)
+ {
+ SwRect aFrameRect = pFrameFormat->FindLayoutRect();
+ aRanges.emplace_back(aFrameRect.Left(), aFrameRect.Top(),
+ aFrameRect.Right(), aFrameRect.Bottom());
+ }
+ if (m_xOverlayObject && m_xOverlayObject->getOverlayManager())
+ m_xOverlayObject->getOverlayManager()->remove(*m_xOverlayObject);
+ m_xOverlayObject.reset(new sdr::overlay::OverlaySelection(sdr::overlay::OverlayType::Invert,
+ Color(), std::move(aRanges),
+ true /*unused for Invert type*/));
+ m_aOverlayObjectDelayTimer.Start();
+}
+
void SwContentTree::BringBookmarksToAttention(const std::vector<OUString>& rNames)
{
std::vector<basegfx::B2DRange> aRanges;