diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-12-06 14:36:50 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-12-06 23:05:11 -0500 |
commit | 65dad3684c609e89b92714e51c914e9b1afa16a3 (patch) | |
tree | 5b1172716ef3e49057c4fc67f435c09c0644b488 /sc | |
parent | 28daebdf085844b8e611a90ece376ac3b19b8b9b (diff) |
bnc#792528: Import static data series labels from xlsx correctly.
Static data series label is a data series label whose value is a
string value rather than a cell reference.
Also, when inputting static string label in the UI, we don't have
to manually check for quotes; the formula compiler will take care
of that later.
Change-Id: I1657fc9879a7f652bba84898e308c3a5d5ba87a3
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/reftokenhelper.cxx | 91 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 1 |
2 files changed, 40 insertions, 52 deletions
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index 2a32e12de85c..1508df7a7cd2 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -44,25 +44,11 @@ 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; @@ -88,48 +74,49 @@ void ScRefTokenHelper::compileRangeRepresentation( if (!nLen) continue; // Should a missing range really be allowed? if (nLen != 1) + { bFailure = true; - else + break; + } + + pArray->Reset(); + const FormulaToken* p = pArray->Next(); + if (!p) { - pArray->Reset(); - const FormulaToken* p = pArray->Next(); - if (!p) + bFailure = true; + break; + } + + const ScToken* pT = static_cast<const ScToken*>(p); + switch (pT->GetType()) + { + case svSingleRef: + if (!pT->GetSingleRef().Valid()) + bFailure = true; + break; + case svDoubleRef: + if (!pT->GetDoubleRef().Valid()) + bFailure = true; + break; + case svExternalSingleRef: + if (!pT->GetSingleRef().ValidExternal()) + bFailure = true; + break; + case svExternalDoubleRef: + if (!pT->GetDoubleRef().ValidExternal()) + bFailure = true; + break; + case svString: + if (!pT->GetString().Len()) + bFailure = true; + break; + default: bFailure = true; - else - { - const ScToken* pT = static_cast<const ScToken*>(p); - switch (pT->GetType()) - { - case svSingleRef: - if (!pT->GetSingleRef().Valid()) - bFailure = true; - break; - case svDoubleRef: - if (!pT->GetDoubleRef().Valid()) - bFailure = true; - break; - case svExternalSingleRef: - if (!pT->GetSingleRef().ValidExternal()) - bFailure = true; - break; - case svExternalDoubleRef: - 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( - ScTokenRef(static_cast<ScToken*>(p->Clone()))); - } + break; } + if (!bFailure) + rRefTokens.push_back( + ScTokenRef(static_cast<ScToken*>(p->Clone()))); } if (bFailure) diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 00cbee882c90..7bf45e1b2992 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2200,6 +2200,7 @@ ScChart2DataProvider::createDataSequenceByFormulaTokens( } } break; + case svString: case svSingleRef: case svDoubleRef: case svExternalSingleRef: |