summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-12-08 00:26:06 +0100
committerEike Rathke <erack@redhat.com>2021-12-08 12:39:18 +0100
commit155024040de888270bf90bdd200799cea7d73e4e (patch)
tree612ac9943ce801a1203b6a6d84f3a209ae408df2 /sc
parent829510594b394d00ca2b4acb0ed64c6bda0f311c (diff)
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
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 2fa44e4233b4..d8c65f902a83 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;