sw/source/uibase/inc/conttree.hxx  |    1 
 sw/source/uibase/utlui/content.cxx |   85 ++++++++++++++++++++++++++++++++++++-
 vcl/source/treelist/svimpbox.cxx   |    9 ++-
 3 files changed, 91 insertions(+), 4 deletions(-)

New commits:
commit ffd8d368b3a780c7b687512540821ad52f2db457
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Dec 15 21:23:49 2022 -0900
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Dec 20 06:09:49 2022 +0000

    tdf#152517 Fix gen backend treeview ctrl+minus behavior
    
    For gen type backends, makes the cursor node and all sub nodes
    collapsed on ctrl+minus key input.
    
    Change-Id: I53730aca29dd47766cfe8b4cdc81539633ebd8c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144286
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144452
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 63b4d928bfd5..b5efa69aa19d 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -2392,9 +2392,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
 
         case KEY_SUBTRACT:
             if (m_pView->IsExpanded(m_pCursor))
-                m_pView->Collapse(m_pCursor);
-            if (bMod1)
-                CollapseTo(m_pTree->GetRootLevelParent(m_pCursor));
+            {
+                if (bMod1)
+                    CollapseTo(m_pCursor);
+                else
+                    m_pView->Collapse(m_pCursor);
+            }
             break;
 
         case KEY_MULTIPLY:
commit 2ef1800e03890609b24883fa7fd970540280905e
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Mon Dec 12 00:06:48 2022 -0900
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Dec 20 06:09:40 2022 +0000

    tdf#152029 Bring comment fields to attention in the document view
    
    when the mouse pointer is over comment content type and content entries
    in the Navigator content tree
    
    Change-Id: I81f8667231fe0e94f0b81c4c2d4955ba17aaa3da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143979
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144451
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/uibase/inc/conttree.hxx 
b/sw/source/uibase/inc/conttree.hxx
index 3cf671ac1bd9..af39a41cb1ae 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -141,6 +141,7 @@ class SwContentTree final : public SfxListener
     void BringBookmarksToAttention(const std::vector<OUString>& rNames);
     void BringURLFieldsToAttention(const SwGetINetAttrs& rINetAttrsArr);
     void BringReferencesToAttention(std::vector<const SwTextAttr*>& 
rTextAttrsArr);
+    void BringPostItFieldsToAttention(std::vector<const SwTextAttr*>& 
rTextAttrsArr);
     void BringDrawingObjectsToAttention(std::vector<const SdrObject*>& 
rDrawingObjectsArr);
     void BringTextFieldsToAttention(std::vector<const SwTextAttr*>& 
rTextAttrsArr);
     void BringFootnotesToAttention(std::vector<const SwTextAttr*>& 
rTextAttrsArr);
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 37983514e647..7dd41c39b5e0 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -102,6 +102,7 @@
 #include <txtftn.hxx>
 #include <fmtftn.hxx>
 
+#include <txtannotationfld.hxx>
 #include <txtfrm.hxx>
 #include <txtrfmrk.hxx>
 #include <svx/sdr/overlay/overlayselection.hxx>
@@ -1248,6 +1249,15 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const 
MouseEvent&, rMEvt, bool)
                         BringReferencesToAttention(aTextAttrArr);
                     }
                 }
+                else if (nType == ContentTypeId::POSTIT)
+                {
+                    if (const SwTextAttr* pTextAttr =
+                            
static_cast<SwPostItContent*>(pCnt)->GetPostIt()->GetTextField())
+                    {
+                        std::vector<const SwTextAttr*> aTextAttrArr 
{pTextAttr};
+                        BringPostItFieldsToAttention(aTextAttrArr);
+                    }
+                }
                 else if (nType == ContentTypeId::DRAWOBJECT)
                 {
                     if (!pCnt->IsInvisible())
@@ -1372,6 +1382,20 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const 
MouseEvent&, rMEvt, bool)
                     }
                     BringReferencesToAttention(aTextAttrArr);
                 }
+                else if (nType == ContentTypeId::POSTIT)
+                {
+                    std::vector<const SwTextAttr*> aTextAttrArr;
+                    for (size_t i = 0; i < 
m_aActiveContentArr[nType]->GetMemberCount(); i++)
+                    {
+                        const SwPostItContent* pPostItContent = 
static_cast<const SwPostItContent*>(
+                                    m_aActiveContentArr[nType]->GetMember(i));
+                        if (pPostItContent && !pPostItContent->IsInvisible())
+                            if (const SwFormatField* pFormatField = 
pPostItContent->GetPostIt())
+                                if (const SwTextAttr* pTextAttr = 
pFormatField->GetTextField())
+                                    aTextAttrArr.push_back(pTextAttr);
+                    }
+                    BringPostItFieldsToAttention(aTextAttrArr);
+                }
                 else if (nType == ContentTypeId::DRAWOBJECT)
                 {
                     IDocumentDrawModelAccess& rIDDMA = 
m_pActiveShell->getIDocumentDrawModelAccess();
@@ -5944,6 +5968,66 @@ void 
SwContentTree::BringReferencesToAttention(std::vector<const SwTextAttr*>& r
     m_aOverlayObjectDelayTimer.Start();
 }
 
+void SwContentTree::BringPostItFieldsToAttention(std::vector<const 
SwTextAttr*>& rTextAttrsArr)
+{
+    std::vector<basegfx::B2DRange> aRanges;
+    for (const SwTextAttr* p : rTextAttrsArr)
+    {
+        if (!p)
+            continue;
+        // use as a fallback when there is no mark
+        SwTextNode& rTextNode = 
p->GetFormatField().GetTextField()->GetTextNode();
+        if (!rTextNode.getLayoutFrame(m_pActiveShell->GetLayout()))
+            continue;
+        assert(dynamic_cast<const 
SwTextAnnotationField*>(p->GetFormatField().GetTextField()));
+        const SwTextAnnotationField* pTextAnnotationField =
+                static_cast<const 
SwTextAnnotationField*>(p->GetFormatField().GetTextField());
+        if (!pTextAnnotationField)
+            continue;
+        const ::sw::mark::IMark* pAnnotationMark =
+                pTextAnnotationField != nullptr ? 
pTextAnnotationField->GetAnnotationMark()
+                                                : nullptr;
+        const SwPosition aMarkStart = pAnnotationMark ? 
pAnnotationMark->GetMarkStart()
+                                                : SwPosition(rTextNode, 
p->GetStart());
+        const SwPosition aMarkEnd = pAnnotationMark ? 
pAnnotationMark->GetMarkEnd()
+                                              : SwPosition(rTextNode, 
p->GetAnyEnd());
+        const SwTextFrame* pMarkStartFrame = static_cast<SwTextFrame*>(
+                    
aMarkStart.GetNode().GetTextNode()->getLayoutFrame(m_pActiveShell->GetLayout()));
+        const SwTextFrame* pMarkEndFrame = static_cast<SwTextFrame*>(
+                    
aMarkEnd.GetNode().GetTextNode()->getLayoutFrame(m_pActiveShell->GetLayout()));
+        if (!pMarkStartFrame || !pMarkEndFrame)
+            continue;
+        SwRect aStartCharRect;
+        pMarkStartFrame->GetCharRect(aStartCharRect, aMarkStart);
+        SwRect aEndCharRect;
+        pMarkEndFrame->GetCharRect(aEndCharRect, aMarkEnd);
+        if (aStartCharRect.Top() == aEndCharRect.Top())
+        {
+            // single line range
+            aRanges.emplace_back(aStartCharRect.Left(), aStartCharRect.Top(),
+                                 aEndCharRect.Right() + 1, 
aEndCharRect.Bottom() + 1);
+        }
+        else
+        {
+            // multi line range
+            SwRect aFrameRect = pMarkStartFrame->getFrameArea();
+            aRanges.emplace_back(aStartCharRect.Left(), aStartCharRect.Top(),
+                                 aFrameRect.Right(), aStartCharRect.Bottom() + 
1);
+            if (aStartCharRect.Bottom() + 1 != aEndCharRect.Top())
+                aRanges.emplace_back(aFrameRect.Left(), 
aStartCharRect.Bottom() + 1,
+                                     aFrameRect.Right(), aEndCharRect.Top() + 
1);
+            aRanges.emplace_back(aFrameRect.Left(), aEndCharRect.Top() + 1,
+                                 aEndCharRect.Right() + 1, 
aEndCharRect.Bottom() + 1);
+        }
+    }
+    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::BringFootnotesToAttention(std::vector<const SwTextAttr*>& 
rTextAttrsArr)
 {
     std::vector<basegfx::B2DRange> aRanges;
@@ -5987,7 +6071,6 @@ void 
SwContentTree::BringFootnotesToAttention(std::vector<const SwTextAttr*>& rT
     m_aOverlayObjectDelayTimer.Start();
 }
 
-
 void SwContentTree::BringDrawingObjectsToAttention(std::vector<const 
SdrObject*>& rDrawingObjectsArr)
 {
     std::vector<basegfx::B2DRange> aRanges;

Reply via email to