sc/source/core/tool/compiler.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit fbf053ac8f6983116014d8f24e153304794d1021
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Feb 27 16:25:51 2025 +0100
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Thu Feb 27 18:20:46 2025 +0100

    Resolves: tdf#165383 Write range reference also if absolute/relative differ
    
    ... and top left / bottom right point to a single cell, so $K$9:K9
    remains expandable to $K$9:K10
    
    Change-Id: Ibafd1f715ae72de21d268e934ffd82df9a48f625
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182313
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index b302da6ed9c9..147c2220e039 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1430,7 +1430,9 @@ struct ConventionXL_A1 : public Convention_A1, public 
ConventionXL
         }
 
         makeSingleCellStr(rLimits, rBuf, aRef.Ref1, aAbs1);
-        if (!bSingleRef && (aAbs1.Row() != aAbs2.Row() || aAbs1.Col() != 
aAbs2.Col()))
+        if (!bSingleRef &&
+                (aAbs1.Row() != aAbs2.Row() || aRef.Ref1.IsRowRel() != 
aRef.Ref2.IsRowRel() ||
+                 aAbs1.Col() != aAbs2.Col() || aRef.Ref1.IsColRel() != 
aRef.Ref2.IsColRel()))
         {
             rBuf.append( ':' );
             makeSingleCellStr(rLimits, rBuf, aRef.Ref2, aAbs2);
@@ -1778,7 +1780,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, 
public ConventionXL
         // additional condition similar to ConventionXL_A1::makeRefStr() could
         // be
         //
-        //   && (aAbsRef.aStart.Row() != aAbsRef.aEnd.Row() || 
aAbsRef.aStart.Col() != aAbsRef.aEnd.Col())
+        //   && (aAbsRef.aStart.Row() != aAbsRef.aEnd.Row() || 
rRef.Ref1.IsRowRel() != rRef.Ref2.IsRowRel() ||
+        //       aAbsRef.aStart.Col() != aAbsRef.aEnd.Col() || 
rRef.Ref1.IsColRel() != rRef.Ref2.IsColRel())
         if (!bSingleRef)
         {
             rBuf.append( ':' );

Reply via email to