[Libreoffice-commits] core.git: include/vcl vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 4 06:17:13 UTC 2018


 include/vcl/txtattr.hxx     |    4 ++--
 vcl/source/edit/textdoc.cxx |   26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 86bcedbef057d234be91daeac6d4086efc10ab20
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Oct 3 16:06:46 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 4 08:16:45 2018 +0200

    use regular Set methods in TextCharAttrib
    
    instead of returning a mutable ref, which just reads weird
    
    Change-Id: Ia2e2a7222f6ccd73e1d7f69dd7c2523f3a05ae24
    Reviewed-on: https://gerrit.libreoffice.org/61309
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/txtattr.hxx b/include/vcl/txtattr.hxx
index 7754c061e413..677d5e0c6a5c 100644
--- a/include/vcl/txtattr.hxx
+++ b/include/vcl/txtattr.hxx
@@ -119,10 +119,10 @@ public:
     sal_uInt16          Which() const               { return mpAttr->Which(); }
 
     sal_Int32           GetStart() const            { return mnStart; }
-    sal_Int32&          GetStart()                  { return mnStart; }
+    void                SetStart(sal_Int32 n)       { mnStart = n; }
 
     sal_Int32           GetEnd() const              { return mnEnd; }
-    sal_Int32&          GetEnd()                    { return mnEnd; }
+    void                SetEnd(sal_Int32 n)         { mnEnd = n; }
 
     inline sal_Int32    GetLen() const;
 
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index 4a65d2be31d9..b8908f0ee6c7 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -226,7 +226,7 @@ void TextNode::CollapseAttribs( sal_Int32 nIndex, sal_Int32 nDeleted )
                 // special case: attribute covers the region exactly
                 // => keep as an empty attribute
                 if ( ( rAttrib.GetStart() == nIndex ) && ( rAttrib.GetEnd() == nEndChanges ) )
-                    rAttrib.GetEnd() = nIndex; // empty
+                    rAttrib.SetEnd(nIndex); // empty
                 else
                     bDelAttr = true;
             }
@@ -234,7 +234,7 @@ void TextNode::CollapseAttribs( sal_Int32 nIndex, sal_Int32 nDeleted )
             else if ( ( rAttrib.GetStart() <= nIndex ) && ( rAttrib.GetEnd() > nIndex ) )
             {
                 if ( rAttrib.GetEnd() <= nEndChanges ) // ends inside
-                    rAttrib.GetEnd() = nIndex;
+                    rAttrib.SetEnd(nIndex);
                 else
                     rAttrib.Collaps( nDeleted );       // ends after
             }
@@ -242,7 +242,7 @@ void TextNode::CollapseAttribs( sal_Int32 nIndex, sal_Int32 nDeleted )
             else if ( ( rAttrib.GetStart() >= nIndex ) && ( rAttrib.GetEnd() > nEndChanges ) )
             {
                 // features are not allowed to expand!
-                rAttrib.GetStart() = nEndChanges;
+                rAttrib.SetStart(nEndChanges);
                 rAttrib.MoveBackward( nDeleted );
             }
         }
@@ -306,8 +306,8 @@ std::unique_ptr<TextNode> TextNode::Split( sal_Int32 nPos )
             if ( !pNew->maCharAttribs.FindAttrib( rAttrib.Which(), 0 ) )
             {
                 std::unique_ptr<TextCharAttrib> pNewAttrib(new TextCharAttrib( rAttrib ));
-                pNewAttrib->GetStart() = 0;
-                pNewAttrib->GetEnd() = 0;
+                pNewAttrib->SetStart(0);
+                pNewAttrib->SetEnd(0);
                 pNew->maCharAttribs.InsertAttrib( std::move(pNewAttrib) );
             }
         }
@@ -316,11 +316,11 @@ std::unique_ptr<TextNode> TextNode::Split( sal_Int32 nPos )
             // If cutting at the very beginning, the attribute has to be
             // copied and changed
             std::unique_ptr<TextCharAttrib> pNewAttrib(new TextCharAttrib( rAttrib ));
-            pNewAttrib->GetStart() = 0;
-            pNewAttrib->GetEnd() = rAttrib.GetEnd()-nPos;
+            pNewAttrib->SetStart(0);
+            pNewAttrib->SetEnd(rAttrib.GetEnd()-nPos);
             pNew->maCharAttribs.InsertAttrib( std::move(pNewAttrib) );
             // trim
-            rAttrib.GetEnd() = nPos;
+            rAttrib.SetEnd(nPos);
         }
         else
         {
@@ -328,8 +328,8 @@ std::unique_ptr<TextNode> TextNode::Split( sal_Int32 nPos )
             SAL_WARN_IF( rAttrib.GetEnd() < nPos, "vcl", "End < nPos!" );
             // move all into the new node (this)
             pNew->maCharAttribs.InsertAttrib(maCharAttribs.RemoveAttrib(nAttr));
-            rAttrib.GetStart() = rAttrib.GetStart() - nPos;
-            rAttrib.GetEnd() = rAttrib.GetEnd() - nPos;
+            rAttrib.SetStart( rAttrib.GetStart() - nPos );
+            rAttrib.SetEnd( rAttrib.GetEnd() - nPos );
             nAttr--;
         }
     }
@@ -360,7 +360,7 @@ void TextNode::Append( const TextNode& rNode )
                     if ( ( rTmpAttrib.Which() == rAttrib.Which() ) &&
                          ( rTmpAttrib.GetAttr() == rAttrib.GetAttr() ) )
                     {
-                        rTmpAttrib.GetEnd() = rTmpAttrib.GetEnd() + rAttrib.GetLen();
+                        rTmpAttrib.SetEnd( rTmpAttrib.GetEnd() + rAttrib.GetLen() );
                         bMelted = true;
                         break;  // there can be only one of this type at this position
                     }
@@ -371,8 +371,8 @@ void TextNode::Append( const TextNode& rNode )
         if ( !bMelted )
         {
             std::unique_ptr<TextCharAttrib> pNewAttrib(new TextCharAttrib( rAttrib ));
-            pNewAttrib->GetStart() = pNewAttrib->GetStart() + nOldLen;
-            pNewAttrib->GetEnd() = pNewAttrib->GetEnd() + nOldLen;
+            pNewAttrib->SetStart( pNewAttrib->GetStart() + nOldLen );
+            pNewAttrib->SetEnd( pNewAttrib->GetEnd() + nOldLen );
             maCharAttribs.InsertAttrib( std::move(pNewAttrib) );
         }
     }


More information about the Libreoffice-commits mailing list