Related: tdf#132466 Relative address parsing needs current position

For the bug doc example the #C target lead to always column 1
(A,0) being selected. Instead, the column of the current cell
cursor position should be selected as C is the short notation for
C[0] in R1C1 address syntax.

This does not "fix" the alleged bug but would yield the desired
behaviour if there was no sheet C where the intention was to jump
to.

Change-Id: Ibaed0250b9fb2cbc7f15a4b22404c48b39d41ff8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126496
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 2fa44e4..d8c65f9 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -86,22 +86,24 @@ namespace
    };

    ScRefFlagsAndType lcl_ParseRangeOrAddress(ScRange& rScRange, ScAddress& rScAddress,
                                              const OUString& aAddress, const ScDocument& rDoc)
                                              const OUString& aAddress, const ScDocument& rDoc,
                                              SCCOL nCurCol, SCROW nCurRow)
    {
        ScRefFlagsAndType aRet;

        formula::FormulaGrammar::AddressConvention eConv;
        // Relative address parsing needs current position.
        // row,col parameters, not col,row!
        ScAddress::Details aDetails( rDoc.GetAddressConvention(), nCurRow, nCurCol);

        // start with the address convention set in the document
        eConv = rDoc.GetAddressConvention();
        aRet.nResult = rScRange.Parse(aAddress, rDoc, eConv);
        aRet.nResult = rScRange.Parse(aAddress, rDoc, aDetails);
        if (aRet.nResult & ScRefFlags::VALID)
        {
            aRet.eDetected = DetectFlags::RANGE;
            return aRet;
        }

        aRet.nResult = rScAddress.Parse(aAddress, rDoc, eConv);
        aRet.nResult = rScAddress.Parse(aAddress, rDoc, aDetails);
        if (aRet.nResult & ScRefFlags::VALID)
        {
            aRet.eDetected = DetectFlags::ADDRESS;
@@ -140,14 +142,15 @@ namespace
        }

        // try Excel R1C1 address convention
        aRet.nResult = rScRange.Parse(aAddress, rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
        aDetails.eConv = formula::FormulaGrammar::CONV_XL_R1C1;
        aRet.nResult = rScRange.Parse(aAddress, rDoc, aDetails);
        if (aRet.nResult & ScRefFlags::VALID)
        {
            aRet.eDetected = DetectFlags::RANGE;
            return aRet;
        }

        aRet.nResult = rScAddress.Parse(aAddress, rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
        aRet.nResult = rScAddress.Parse(aAddress, rDoc, aDetails);
        if (aRet.nResult & ScRefFlags::VALID)
        {
            aRet.eDetected = DetectFlags::ADDRESS;
@@ -330,7 +333,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                ScMarkData& rMark     = rViewData.GetMarkData();
                ScRange     aScRange;
                ScAddress   aScAddress;
                ScRefFlagsAndType aResult = lcl_ParseRangeOrAddress(aScRange, aScAddress, aAddress, rDoc);
                ScRefFlagsAndType aResult = lcl_ParseRangeOrAddress(aScRange, aScAddress, aAddress, rDoc,
                        rViewData.GetCurX(), rViewData.GetCurY());
                ScRefFlags  nResult = aResult.nResult;
                SCTAB       nTab = rViewData.GetTabNo();
                bool        bMark = true;