From 25a42da1f94cfd0555fc83126888eb605a9014f2 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 25 Jul 2024 13:05:30 +0200 Subject: [PATCH] Resolves: tdf#162093 TableRef item specifier may occur standalone This is a combination of 2 commits. Resolves: tdf#162093 TableRef item specifier may occur standalone This is what https://learn.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/3d025add-118d-4413-9856-ab65712ec1b0 specifies as keyword in intra-table-reference = spaced-lbracket inner-reference spaced-rbracket / keyword / ("[" [simple-column-name] "]") with keyword = "[#All]" / "[#Data]" / "[#Headers]" / "[#Totals]" / "[#This Row]" xChange-Id: I52b200aad41d53a49e662d6238576f6f4f0deb37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170986 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit f1f5e9c8d7be16a969e58ebf7cfae99eef5bcb6e) Related: tdf#162093 TableRef item specifier may occur standalone also in lexical canner. xChange-Id: Ic265bbd8a0d9baa81039b8d1748c63ad6686bfc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170989 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 4aa2d5ede17ddf7345804deb200983367990a7e2) Change-Id: I52b200aad41d53a49e662d6238576f6f4f0deb37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170953 Tested-by: Jenkins Reviewed-by: Eike Rathke --- sc/source/core/tool/compiler.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 738ed67fc9b9..d26f07f5c664 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2311,7 +2311,8 @@ Label_MaskStateMachine: else if( nMask & ScCharFlags::CharErrConst ) { *pSym++ = c; - if (!maTableRefs.empty() && maTableRefs.back().mnLevel == 2) + sal_uInt16 nLevel; + if (!maTableRefs.empty() && ((nLevel = maTableRefs.back().mnLevel) == 2 || nLevel == 1)) eState = ssGetTableRefItem; else eState = ssGetErrorConstant; @@ -4564,7 +4565,8 @@ Label_Rewind: if (cSymbol[0] == '#') { // Check for TableRef item specifiers first. - if (!maTableRefs.empty() && maTableRefs.back().mnLevel == 2) + sal_uInt16 nLevel; + if (!maTableRefs.empty() && ((nLevel = maTableRefs.back().mnLevel) == 2 || nLevel == 1)) { if (ParseTableRefItem( aUpper )) return true; -- 2.11.4.GIT