Kaydet (Commit) 0780e58e authored tarafından Noel Grandin's avatar Noel Grandin

Revert "convert MULTILINE constants to scoped enum"

This reverts commit b5e352e5.

GCC4.8 doesn't like the combination of a scoped enum and
storing such a type in a bitfield. And it has a bug
(still present in its current master) which prevents us from
suppressing the warning nicely.

Change-Id: I8c73e4c5175cfc43a1b8251ad85d262ad89c4f4d
üst 4d6bed28
...@@ -47,9 +47,11 @@ struct FormulaResultValue ...@@ -47,9 +47,11 @@ struct FormulaResultValue
and memory consumption. */ and memory consumption. */
class ScFormulaResult class ScFormulaResult
{ {
enum class Multiline { typedef unsigned char Multiline;
Unknown, False, True static const Multiline MULTILINE_UNKNOWN = 0;
}; static const Multiline MULTILINE_FALSE = 1;
static const Multiline MULTILINE_TRUE = 2;
// Clone token if the 16-bit only reference counter is nearing it's // Clone token if the 16-bit only reference counter is nearing it's
// capacity during fill or copy&paste, leaving 4k for temporary passing // capacity during fill or copy&paste, leaving 4k for temporary passing
// around. (That should be enough for all times (TM) ;-) // around. (That should be enough for all times (TM) ;-)
......
...@@ -22,7 +22,7 @@ FormulaResultValue::FormulaResultValue( FormulaError nErr ) : meType(Error), mfV ...@@ -22,7 +22,7 @@ FormulaResultValue::FormulaResultValue( FormulaError nErr ) : meType(Error), mfV
ScFormulaResult::ScFormulaResult() : ScFormulaResult::ScFormulaResult() :
mpToken(nullptr), mnError(FormulaError::NONE), mbToken(true), mpToken(nullptr), mnError(FormulaError::NONE), mbToken(true),
mbEmpty(false), mbEmptyDisplayedAsString(false), mbEmpty(false), mbEmptyDisplayedAsString(false),
meMultiline(Multiline::Unknown) {} meMultiline(MULTILINE_UNKNOWN) {}
ScFormulaResult::ScFormulaResult( const ScFormulaResult & r ) : ScFormulaResult::ScFormulaResult( const ScFormulaResult & r ) :
mnError( r.mnError), mbToken( r.mbToken), mnError( r.mnError), mbToken( r.mbToken),
...@@ -56,7 +56,7 @@ ScFormulaResult::ScFormulaResult( const ScFormulaResult & r ) : ...@@ -56,7 +56,7 @@ ScFormulaResult::ScFormulaResult( const ScFormulaResult & r ) :
ScFormulaResult::ScFormulaResult( const formula::FormulaToken* p ) : ScFormulaResult::ScFormulaResult( const formula::FormulaToken* p ) :
mnError(FormulaError::NONE), mbToken(false), mbEmpty(false), mbEmptyDisplayedAsString(false), mnError(FormulaError::NONE), mbToken(false), mbEmpty(false), mbEmptyDisplayedAsString(false),
meMultiline(Multiline::Unknown) meMultiline(MULTILINE_UNKNOWN)
{ {
SetToken( p); SetToken( p);
} }
...@@ -72,7 +72,7 @@ void ScFormulaResult::ResetToDefaults() ...@@ -72,7 +72,7 @@ void ScFormulaResult::ResetToDefaults()
mnError = FormulaError::NONE; mnError = FormulaError::NONE;
mbEmpty = false; mbEmpty = false;
mbEmptyDisplayedAsString = false; mbEmptyDisplayedAsString = false;
meMultiline = Multiline::Unknown; meMultiline = MULTILINE_UNKNOWN;
} }
void ScFormulaResult::ResolveToken( const formula::FormulaToken * p ) void ScFormulaResult::ResolveToken( const formula::FormulaToken * p )
...@@ -93,20 +93,20 @@ void ScFormulaResult::ResolveToken( const formula::FormulaToken * p ) ...@@ -93,20 +93,20 @@ void ScFormulaResult::ResolveToken( const formula::FormulaToken * p )
mbToken = false; mbToken = false;
// set in case mnError is 0 now, which shouldn't happen but ... // set in case mnError is 0 now, which shouldn't happen but ...
mfValue = 0.0; mfValue = 0.0;
meMultiline = Multiline::False; meMultiline = MULTILINE_FALSE;
break; break;
case formula::svEmptyCell: case formula::svEmptyCell:
mbEmpty = true; mbEmpty = true;
mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString(); mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString();
p->DecRef(); p->DecRef();
mbToken = false; mbToken = false;
meMultiline = Multiline::False; meMultiline = MULTILINE_FALSE;
break; break;
case formula::svDouble: case formula::svDouble:
mfValue = p->GetDouble(); mfValue = p->GetDouble();
p->DecRef(); p->DecRef();
mbToken = false; mbToken = false;
meMultiline = Multiline::False; meMultiline = MULTILINE_FALSE;
break; break;
default: default:
mpToken = p; mpToken = p;
...@@ -212,7 +212,7 @@ void ScFormulaResult::SetDouble( double f ) ...@@ -212,7 +212,7 @@ void ScFormulaResult::SetDouble( double f )
mpToken->DecRef(); mpToken->DecRef();
mfValue = f; mfValue = f;
mbToken = false; mbToken = false;
meMultiline = Multiline::False; meMultiline = MULTILINE_FALSE;
} }
} }
...@@ -300,15 +300,15 @@ bool ScFormulaResult::IsValueNoError() const ...@@ -300,15 +300,15 @@ bool ScFormulaResult::IsValueNoError() const
bool ScFormulaResult::IsMultiline() const bool ScFormulaResult::IsMultiline() const
{ {
if (meMultiline == Multiline::Unknown) if (meMultiline == MULTILINE_UNKNOWN)
{ {
svl::SharedString aStr = GetString(); svl::SharedString aStr = GetString();
if (!aStr.isEmpty() && aStr.getString().indexOf('\n') != -1) if (!aStr.isEmpty() && aStr.getString().indexOf('\n') != -1)
const_cast<ScFormulaResult*>(this)->meMultiline = Multiline::True; const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_TRUE;
else else
const_cast<ScFormulaResult*>(this)->meMultiline = Multiline::False; const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_FALSE;
} }
return meMultiline == Multiline::True; return meMultiline == MULTILINE_TRUE;
} }
bool ScFormulaResult::GetErrorOrDouble( FormulaError& rErr, double& rVal ) const bool ScFormulaResult::GetErrorOrDouble( FormulaError& rErr, double& rVal ) const
...@@ -513,7 +513,7 @@ void ScFormulaResult::SetHybridDouble( double f ) ...@@ -513,7 +513,7 @@ void ScFormulaResult::SetHybridDouble( double f )
{ {
mfValue = f; mfValue = f;
mbToken = false; mbToken = false;
meMultiline = Multiline::False; meMultiline = MULTILINE_FALSE;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment