editeng/inc/ContentNode.hxx            |    1 +
 editeng/inc/editattr.hxx               |    2 ++
 editeng/source/editeng/ContentNode.cxx |   13 +++++++++++++
 editeng/source/editeng/impedit3.cxx    |    6 +++++-
 sc/inc/fstalgorithm.hxx                |    2 +-
 5 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 5276aa03fa94e4c6b3e42c33647e649bb5d7c64f
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Jan 16 09:05:49 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Jan 16 12:06:58 2024 +0100

    cid#1586339 COPY_INSTEAD_OF_MOVE
    
    Change-Id: I18109124eb1e78260b7cef8f809012118698e5c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162160
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/inc/fstalgorithm.hxx b/sc/inc/fstalgorithm.hxx
index 8cab1187d1e0..4d46cfaaa28c 100644
--- a/sc/inc/fstalgorithm.hxx
+++ b/sc/inc/fstalgorithm.hxx
@@ -64,7 +64,7 @@ void buildSpanWithValue(
         }
 
         nLastPos = nThisPos;
-        nLastVal = nThisVal;
+        nLastVal = std::move(nThisVal);
     }
 }
 
commit acd3f201a93ddac406a1e86f8b055fdbd2a64400
Author:     Attila Szűcs <[email protected]>
AuthorDate: Tue Jan 9 17:45:19 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Jan 16 12:06:45 2024 +0100

    tdf#154248 Impress: fix color of hyperlink
    
    Added a new FindAttrib method that searches in the attribs
    a bit different.
    The original FindAttrib searches in attribs as if their position
    intervals are closed from both side [Start,End].
    However, the actual attribs array was created using PaMs as positions,
    and these are right-opened intervals [Start,End)
    
    Change-Id: I9a46b6b27ce447366fc20af1b46fd60b5c745359
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161836
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162158
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/editeng/inc/ContentNode.hxx b/editeng/inc/ContentNode.hxx
index 391953d7f4ae..308d3ef9d1e0 100644
--- a/editeng/inc/ContentNode.hxx
+++ b/editeng/inc/ContentNode.hxx
@@ -77,6 +77,7 @@ public:
 
     const EditCharAttrib* FindAttrib(sal_uInt16 nWhich, sal_Int32 nPos) const;
     EditCharAttrib* FindAttrib(sal_uInt16 nWhich, sal_Int32 nPos);
+    EditCharAttrib* FindAttribRightOpen(sal_uInt16 nWhich, sal_Int32 nPos);
     const EditCharAttrib* FindNextAttrib(sal_uInt16 nWhich, sal_Int32 
nFromPos) const;
     EditCharAttrib* FindEmptyAttrib(sal_uInt16 nWhich, sal_Int32 nPos);
     const EditCharAttrib* FindFeature(sal_Int32 nPos) const;
diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx
index 3a619a5e85b8..985a586c7fe3 100644
--- a/editeng/inc/editattr.hxx
+++ b/editeng/inc/editattr.hxx
@@ -105,6 +105,8 @@ public:
 
     bool    IsIn( sal_Int32 nIndex ) const
                 { return ( ( nStart <= nIndex ) && ( nEnd >= nIndex ) ); }
+    bool    IsInLeftClosedRightOpen( sal_Int32 nIndex ) const
+                { return ( ( nStart <= nIndex ) && ( nEnd > nIndex ) ); }
     bool    IsInside( sal_Int32 nIndex ) const
                 { return ( ( nStart < nIndex ) && ( nEnd > nIndex ) ); }
     bool        IsEmpty() const
diff --git a/editeng/source/editeng/ContentNode.cxx 
b/editeng/source/editeng/ContentNode.cxx
index 0cc3a72da65c..a02a3fde0d39 100644
--- a/editeng/source/editeng/ContentNode.cxx
+++ b/editeng/source/editeng/ContentNode.cxx
@@ -849,6 +849,19 @@ EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 
nWhich, sal_Int32 nPos )
     return nullptr;
 }
 
+EditCharAttrib* CharAttribList::FindAttribRightOpen( sal_uInt16 nWhich, 
sal_Int32 nPos )
+{
+    AttribsType::reverse_iterator it = std::find_if(maAttribs.rbegin(), 
maAttribs.rend(),
+        [&nWhich, &nPos](AttribsType::value_type& rxAttr) {
+            return rxAttr->Which() == nWhich && 
rxAttr->IsInLeftClosedRightOpen(nPos); });
+    if (it != maAttribs.rend())
+    {
+        EditCharAttrib& rAttr = **it;
+        return &rAttr;
+    }
+    return nullptr;
+}
+
 const EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, 
sal_Int32 nFromPos ) const
 {
     assert(nWhich);
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 350a533eb147..30462d21b169 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2948,7 +2948,11 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, 
sal_Int32 nPos, SvxFont& rFo
                     // #i1550# hard color attrib should win over text color 
from field
                     if ( pAttrib->Which() == EE_FEATURE_FIELD )
                     {
-                        EditCharAttrib* pColorAttr = 
pNode->GetCharAttribs().FindAttrib( EE_CHAR_COLOR, nPos );
+                        // These Attribs positions come from PaMs, so their 
interval is right-open and left-closed
+                        // when SeekCursor is called, nPos is incremented by 
1. I do not know why...
+                        // probably designed to be a nEndPos, and like in a 
PaM, it is the position after the actual character.
+                        sal_Int32 nPosActual = nPos > 0 ? nPos - 1 : 0;
+                        EditCharAttrib* pColorAttr = 
pNode->GetCharAttribs().FindAttribRightOpen( EE_CHAR_COLOR, nPosActual );
                         if ( pColorAttr )
                             pColorAttr->SetFont( rFont, pOut );
                     }

Reply via email to