incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1367992 - /incubator/ooo/trunk/main/sc/source/core/data/validat.cxx
Date Wed, 01 Aug 2012 13:47:34 GMT
Author: hdu
Date: Wed Aug  1 13:47:33 2012
New Revision: 1367992

URL: http://svn.apache.org/viewvc?rev=1367992&view=rev
Log:
#i93128# fix data validity check for criteria "Allow text length" and numeric cells

Patch-by: Zhang Lu
Reported-by: amy2008, eberlein
Review-by: Herbert Duerr

Modified:
    incubator/ooo/trunk/main/sc/source/core/data/validat.cxx

Modified: incubator/ooo/trunk/main/sc/source/core/data/validat.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/validat.cxx?rev=1367992&r1=1367991&r2=1367992&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/validat.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/validat.cxx Wed Aug  1 13:47:33 2012
@@ -441,19 +441,18 @@ sal_Bool ScValidationData::DoError( Wind
 sal_Bool ScValidationData::IsDataValid( const String& rTest, const ScPatternAttr&
rPattern,
 									const ScAddress& rPos ) const
 {
-	if ( eDataMode == SC_VALID_ANY )
-		return sal_True;						// alles erlaubt
+	if ( eDataMode == SC_VALID_ANY ) // check if any cell content is allowed
+		return sal_True;
 
-	if ( rTest.GetChar(0) == '=' )
-		return sal_False;						// Formeln sind sonst immer ungueltig
+	if ( rTest.GetChar(0) == '=' )   // formulas do not pass the validity test
+		return sal_False;
 
-	if ( !rTest.Len() )
-		return IsIgnoreBlank();				// leer: wie eingestellt
+	if ( !rTest.Len() )              // check whether empty cells are allowed
+		return IsIgnoreBlank();
 
 	SvNumberFormatter* pFormatter = GetDocument()->GetFormatTable();
 
-	//	Test, was es denn ist - wie in ScColumn::SetString
-
+	// get the value if any
 	sal_uInt32 nFormat = rPattern.GetNumberFormat( pFormatter );
 
 	double nVal;
@@ -464,7 +463,15 @@ sal_Bool ScValidationData::IsDataValid( 
 	else
 		pCell = new ScStringCell( rTest );
 
-	sal_Bool bRet = IsDataValid( pCell, rPos );
+	sal_Bool bRet;
+	if (SC_VALID_TEXTLEN == eDataMode)
+	{
+		const double nLenVal = static_cast<double>( rTest.Len() );
+		ScValueCell aTmpCell( nLenVal );
+		bRet = IsCellValid( &aTmpCell, rPos );
+	}
+	else
+		bRet = IsDataValid( pCell, rPos );
 
 	pCell->Delete();
 	return bRet;



Mime
View raw message