ooo-build r12514 - in trunk: . patches/dev300 patches/test



Author: kyoshida
Date: Sat May 10 16:06:38 2008
New Revision: 12514
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12514&view=rev

Log:
2008-05-10  Kohei Yoshida  <kyoshida novell com>

	* patches/dev300/sc-sheet-name-special-chars.diff: modified to allow 
	all characters in sheet names, even those characters that are not 
	allowed in Excel.
	
	* patches/test/sc-sheet-name-disallow-dos-chars.diff: the part removed
	from the above patch.  May become useful when converting offending 
	sheet names during Excel file export.


Added:
   trunk/patches/test/sc-sheet-name-disallow-dos-chars.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/sc-sheet-name-special-chars.diff

Modified: trunk/patches/dev300/sc-sheet-name-special-chars.diff
==============================================================================
--- trunk/patches/dev300/sc-sheet-name-special-chars.diff	(original)
+++ trunk/patches/dev300/sc-sheet-name-special-chars.diff	Sat May 10 16:06:38 2008
@@ -26,10 +26,10 @@
      friend struct Convention;
  
 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
-index e9c4a7c..e8b18e9 100644
+index bb570e6..2b21e30 100644
 --- sc/inc/document.hxx
 +++ sc/inc/document.hxx
-@@ -567,7 +567,6 @@ SC_DLLPUBLIC	ScDBCollection*	GetDBCollection() const;
+@@ -570,7 +570,6 @@ SC_DLLPUBLIC	ScDBCollection*	GetDBCollection() const;
  	void			SnapVisArea( Rectangle& rRect ) const;			// 1/100 mm
  
  	SC_DLLPUBLIC BOOL			ValidTabName( const String& rName ) const;
@@ -38,10 +38,10 @@
  	SC_DLLPUBLIC void			CreateValidTabName(String& rName) const;
  	BOOL			InsertTab( SCTAB nPos, const String& rName,
 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
-index dbe6130..372fb72 100644
+index dbe6130..b3d0607 100644
 --- sc/source/core/data/document.cxx
 +++ sc/source/core/data/document.cxx
-@@ -193,40 +193,34 @@ BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
+@@ -193,40 +193,7 @@ BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
  
  BOOL ScDocument::ValidTabName( const String& rName ) const
  {
@@ -68,41 +68,18 @@
 -    String aContChars( RTL_CONSTASCII_USTRINGPARAM(" ") );
 -    sal_Int32 nStartPos = 0;
 -    while( nStartPos < rName.Len() )
-+    xub_StrLen nLen = rName.Len();
-+    if (!nLen)
-+        return false;
-+
-+    for (xub_StrLen i = 0; i < nLen; ++i)
-     {
+-    {
 -        ParseResult aRes = ScGlobal::pCharClass->parsePredefinedToken( KParseType::IDENTNAME,
 -            rName, nStartPos, nStartFlags, aStartChars, nContFlags, aContChars );
 -        if( aRes.EndPos < rName.Len() )
-+        const sal_Unicode c = rName.GetChar(i);
-+        switch (c)
-         {
+-        {
 -            rName.SetChar( static_cast< xub_StrLen >( aRes.EndPos ), cReplaceChar );
 -            nStartFlags = nContFlags;
 -            aStartChars = aContChars;
-+            case ':':
-+            case '\\':
-+            case '/':
-+            case '?':
-+            case '*':
-+            case '[':
-+            case ']':
-+                // these characters are not allowed to match XL's convention.
-+                return false;
-+            case '\'':
-+                if (i == 0 || i == nLen - 1)
-+                    // single quote is not allowed at the first or last 
-+                    // character position.
-+                    return false;
-+            break;
-         }
+-        }
 -        nStartPos = aRes.EndPos + 1;
-     }
-+
-+    return true;
+-    }
++    return rName.Len() > 0;
  }
  
  

Added: trunk/patches/test/sc-sheet-name-disallow-dos-chars.diff
==============================================================================
--- (empty file)
+++ trunk/patches/test/sc-sheet-name-disallow-dos-chars.diff	Sat May 10 16:06:38 2008
@@ -0,0 +1,40 @@
+diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
+index b3d0607..372fb72 100644
+--- sc/source/core/data/document.cxx
++++ sc/source/core/data/document.cxx
+@@ -193,7 +193,34 @@ BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
+ 
+ BOOL ScDocument::ValidTabName( const String& rName ) const
+ {
+-    return rName.Len() > 0;
++    xub_StrLen nLen = rName.Len();
++    if (!nLen)
++        return false;
++
++    for (xub_StrLen i = 0; i < nLen; ++i)
++    {
++        const sal_Unicode c = rName.GetChar(i);
++        switch (c)
++        {
++            case ':':
++            case '\\':
++            case '/':
++            case '?':
++            case '*':
++            case '[':
++            case ']':
++                // these characters are not allowed to match XL's convention.
++                return false;
++            case '\'':
++                if (i == 0 || i == nLen - 1)
++                    // single quote is not allowed at the first or last 
++                    // character position.
++                    return false;
++            break;
++        }
++    }
++
++    return true;
+ }
+ 
+ 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]