summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/reftokenhelper.cxx
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@suse.com>2011-10-03 16:28:59 +0530
committerMuthu Subramanian <sumuthu@suse.com>2011-10-03 16:32:35 +0530
commit15202ad5b26ff48dc937ed12b57d53108c2731e4 (patch)
tree4182e2233a50e8e2847b0216a2983dbdb994ce7d /sc/source/core/tool/reftokenhelper.cxx
parent08d15d0bcb1f6521469fa4ffc684ea1f37065eb2 (diff)
n717290: Feature to allow string constants in chart ranges.
Chart ranges specifically for labels can now be of the form ="Label1". This allows labels to be picked from chart data (from UI) rather than from the sheet.
Diffstat (limited to 'sc/source/core/tool/reftokenhelper.cxx')
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index f4f09d635575..5d6cbfbd84b7 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -46,11 +46,23 @@ using ::std::vector;
using ::std::auto_ptr;
using ::rtl::OUString;
+static bool lcl_mayBeRangeConstString( const OUString &aRangeStr )
+{
+ if( aRangeStr.getLength() >= 3 && aRangeStr.endsWithAsciiL( "\"", 1 ) )
+ if( aRangeStr[0] == '"' )
+ return true;
+ else if( aRangeStr[0] == '=' && aRangeStr[1] == '"' )
+ return true;
+
+ return false;
+}
+
void ScRefTokenHelper::compileRangeRepresentation(
vector<ScTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc,
const sal_Unicode cSep, FormulaGrammar::Grammar eGrammar)
{
const sal_Unicode cQuote = '\'';
+ bool bMayBeConstString = lcl_mayBeRangeConstString( rRangeStr );
// #i107275# ignore parentheses
OUString aRangeStr = rRangeStr;
@@ -80,7 +92,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
else
{
pArray->Reset();
- const FormulaToken* p = pArray->GetNextReference();
+ const FormulaToken* p = pArray->Next();
if (!p)
bFailure = true;
else
@@ -104,8 +116,14 @@ void ScRefTokenHelper::compileRangeRepresentation(
if (!pT->GetDoubleRef().ValidExternal())
bFailure = true;
break;
+ case svString:
+ if (!bMayBeConstString)
+ bFailure = true;
+ bMayBeConstString = false;
+ break;
default:
- ;
+ bFailure = true;
+ break;
}
if (!bFailure)
rRefTokens.push_back(