You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2012/08/20 13:46:47 UTC

svn commit: r1374979 [21/29] - in /incubator/ooo/branches/writer001: ./ ext_libraries/apr-util/ ext_libraries/apr-util/prj/ ext_libraries/apr/ ext_libraries/coinmp/ ext_libraries/hunspell/ ext_libraries/serf/ ext_libraries/serf/prj/ ext_sources/ extras...

Modified: incubator/ooo/branches/writer001/main/pyuno/source/module/unohelper.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/source/module/unohelper.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/source/module/unohelper.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/source/module/unohelper.py Mon Aug 20 11:46:19 2012
@@ -72,7 +72,7 @@ def _propertymode_to_str( mode ):
     if PROP_ATTR_MAYBEVOID & mode:
         ret = ret + "maybevoid "
     return ret.rstrip()
-    
+
 def inspect( obj , out ):
     if isinstance( obj, uno.Type ) or \
        isinstance( obj, uno.Char ) or \
@@ -102,7 +102,7 @@ def inspect( obj , out ):
             out.write( "  " + ii.typeName + "\n" )
     else:
         out.write( "  unknown\n" )
-        
+
     access = introspection.inspect( obj )
     methods = access.getMethods( METHOD_CONCEPT_ALL )
     out.write( "Methods:\n" )
@@ -126,56 +126,56 @@ def createSingleServiceFactory( clazz, i
     return _FactoryHelper_( clazz, implementationName, serviceNames )
 
 class _ImplementationHelperEntry:
-      def __init__(self, ctor,serviceNames):
-	  self.ctor = ctor
-	  self.serviceNames = serviceNames
-	  
+    def __init__(self, ctor,serviceNames):
+        self.ctor = ctor
+        self.serviceNames = serviceNames
+
 class ImplementationHelper:
-      def __init__(self):
-	  self.impls = {}
-	  
-      def addImplementation( self, ctor, implementationName, serviceNames ):
-          self.impls[implementationName] =  _ImplementationHelperEntry(ctor,serviceNames)
-	  
-      def writeRegistryInfo( self, regKey, smgr ):
-          for i in self.impls.items():
-	      keyName = "/"+ i[0] + "/UNO/SERVICES"
-	      key = regKey.createKey( keyName )
-	      for serviceName in i[1].serviceNames:
-		  key.createKey( serviceName )
-          return 1
-
-      def getComponentFactory( self, implementationName , regKey, smgr ):
-	  entry = self.impls.get( implementationName, None )
-	  if entry == None:
-	     raise RuntimeException( implementationName + " is unknown" , None )
-	  return createSingleServiceFactory( entry.ctor, implementationName, entry.serviceNames )
-
-      def getSupportedServiceNames( self, implementationName ):
-	  entry = self.impls.get( implementationName, None )
-	  if entry == None:
-	     raise RuntimeException( implementationName + " is unknown" , None )
-	  return entry.serviceNames	     
-	  
-      def supportsService( self, implementationName, serviceName ):
-	  entry = self.impls.get( implementationName,None )
-	  if entry == None:
-	     raise RuntimeException( implementationName + " is unknown", None )
-          return serviceName in entry.serviceNames	     
+    def __init__(self):
+        self.impls = {}
+
+    def addImplementation( self, ctor, implementationName, serviceNames ):
+        self.impls[implementationName] =  _ImplementationHelperEntry(ctor,serviceNames)
+
+    def writeRegistryInfo( self, regKey, smgr ):
+        for i in list(self.impls.items()):
+            keyName = "/"+ i[0] + "/UNO/SERVICES"
+            key = regKey.createKey( keyName )
+            for serviceName in i[1].serviceNames:
+                key.createKey( serviceName )
+        return 1
+
+    def getComponentFactory( self, implementationName , regKey, smgr ):
+        entry = self.impls.get( implementationName, None )
+        if entry == None:
+            raise RuntimeException( implementationName + " is unknown" , None )
+        return createSingleServiceFactory( entry.ctor, implementationName, entry.serviceNames )
+
+    def getSupportedServiceNames( self, implementationName ):
+        entry = self.impls.get( implementationName, None )
+        if entry == None:
+            raise RuntimeException( implementationName + " is unknown" , None )
+        return entry.serviceNames
+
+    def supportsService( self, implementationName, serviceName ):
+        entry = self.impls.get( implementationName,None )
+        if entry == None:
+            raise RuntimeException( implementationName + " is unknown", None )
+        return serviceName in entry.serviceNames
+
 
-	  
 class ImplementationEntry:
-      def __init__(self, implName, supportedServices, clazz ):
-	  self.implName = implName
-	  self.supportedServices = supportedServices
-	  self.clazz = clazz
+    def __init__(self, implName, supportedServices, clazz ):
+        self.implName = implName
+        self.supportedServices = supportedServices
+        self.clazz = clazz
 
 def writeRegistryInfoHelper( smgr, regKey, seqEntries ):
     for entry in seqEntries:
         keyName = "/"+ entry.implName + "/UNO/SERVICES"
-	key = regKey.createKey( keyName )
-	for serviceName in entry.supportedServices:
-	    key.createKey( serviceName )
+        key = regKey.createKey( keyName )
+        for serviceName in entry.supportedServices:
+            key.createKey( serviceName )
 
 def systemPathToFileUrl( systemPath ):
     "returns a file-url for the given system path"
@@ -188,11 +188,11 @@ def fileUrlToSystemPath( url ):
 def absolutize( path, relativeUrl ):
     "returns an absolute file url from the given urls"
     return pyuno.absolutize( path, relativeUrl )
-        
+
 def getComponentFactoryHelper( implementationName, smgr, regKey, seqEntries ):
     for x in seqEntries:
-	if x.implName == implementationName:
-	   return createSingleServiceFactory( x.clazz, implementationName, x.supportedServices )
+        if x.implName == implementationName:
+            return createSingleServiceFactory( x.clazz, implementationName, x.supportedServices )
 
 def addComponentsToContext( toBeExtendedContext, contextRuntime, componentUrls, loaderName ):
     smgr = contextRuntime.ServiceManager
@@ -204,56 +204,56 @@ def addComponentsToContext( toBeExtended
     #   create a temporary registry
     for componentUrl in componentUrls:
         reg = smgr.createInstanceWithContext( "com.sun.star.registry.SimpleRegistry", contextRuntime )
-	reg.open( "", 0, 1 )
+        reg.open( "", 0, 1 )
         if not isWin and componentUrl.endswith( ".uno" ):  # still allow platform independent naming
             if isMac:
-               componentUrl = componentUrl + ".dylib"
+                componentUrl = componentUrl + ".dylib"
             else:
-               componentUrl = componentUrl + ".so"
+                componentUrl = componentUrl + ".so"
+
+        implReg.registerImplementation( loaderName,componentUrl, reg )
+        rootKey = reg.getRootKey()
+        implementationKey = rootKey.openKey( "IMPLEMENTATIONS" )
+        implNames = implementationKey.getKeyNames()
+        extSMGR = toBeExtendedContext.ServiceManager
+        for x in implNames:
+            fac = loader.activate( max(x.split("/")),"",componentUrl,rootKey)
+            extSMGR.insert( fac )
+        reg.close()
 
-	implReg.registerImplementation( loaderName,componentUrl, reg )
-	rootKey = reg.getRootKey()
-	implementationKey = rootKey.openKey( "IMPLEMENTATIONS" )
-	implNames = implementationKey.getKeyNames()
-	extSMGR = toBeExtendedContext.ServiceManager
-	for x in implNames:
-	    fac = loader.activate( max(x.split("/")),"",componentUrl,rootKey)
-	    extSMGR.insert( fac )
-	reg.close()
-	    	    
 # never shrinks !
 _g_typeTable = {}
 def _unohelper_getHandle( self):
-   ret = None
-   if _g_typeTable.has_key( self.__class__ ):
-     ret = _g_typeTable[self.__class__]
-   else:
-     names = {}
-     traverse = list(self.__class__.__bases__)
-     while len( traverse ) > 0:
-         item = traverse.pop()
-         bases = item.__bases__
-         if uno.isInterface( item ):
-             names[item.__pyunointerface__] = None
-         elif len(bases) > 0:
-             # the "else if", because we only need the most derived interface
-             traverse = traverse + list(bases)#
-
-     lst = names.keys()
-     types = []
-     for x in lst:
-         t = uno.getTypeByName( x )
-         types.append( t )
-         
-     ret = tuple(types) , uno.generateUuid()
-     _g_typeTable[self.__class__] = ret
-   return ret
-  
+    ret = None
+    if self.__class__ in _g_typeTable:
+        ret = _g_typeTable[self.__class__]
+    else:
+        names = {}
+        traverse = list(self.__class__.__bases__)
+        while len( traverse ) > 0:
+            item = traverse.pop()
+            bases = item.__bases__
+            if uno.isInterface( item ):
+                names[item.__pyunointerface__] = None
+            elif len(bases) > 0:
+                # the "else if", because we only need the most derived interface
+                traverse = traverse + list(bases)#
+
+        lst = list(names.keys())
+        types = []
+        for x in lst:
+            t = uno.getTypeByName( x )
+            types.append( t )
+
+        ret = tuple(types) , uno.generateUuid()
+        _g_typeTable[self.__class__] = ret
+    return ret
+
 class Base(XTypeProvider):
-      def getTypes( self ):
-	  return _unohelper_getHandle( self )[0]
-      def getImplementationId(self):
-	  return _unohelper_getHandle( self )[1]
+    def getTypes( self ):
+        return _unohelper_getHandle( self )[0]
+    def getImplementationId(self):
+        return _unohelper_getHandle( self )[1]
 
 class CurrentContext(XCurrentContext, Base ):
     """a current context implementation, which first does a lookup in the given
@@ -271,28 +271,27 @@ class CurrentContext(XCurrentContext, Ba
             return self.oldContext.getValueByName( name )
         else:
             return None
-        
+
 # -------------------------------------------------
 # implementation details
 # -------------------------------------------------
 class _FactoryHelper_( XSingleComponentFactory, XServiceInfo, Base ):
-      def __init__( self, clazz, implementationName, serviceNames ):
-	  self.clazz = clazz
-	  self.implementationName = implementationName
-	  self.serviceNames = serviceNames
-	  
-      def getImplementationName( self ):
-	  return self.implementationName
-
-      def supportsService( self, ServiceName ):
-	  return ServiceName in self.serviceNames
-
-      def getSupportedServiceNames( self ):
-	  return self.serviceNames
-
-      def createInstanceWithContext( self, context ):
-	  return self.clazz( context )
-	      
-      def createInstanceWithArgumentsAndContext( self, args, context ):
-	  return self.clazz( context, *args )
-      
+    def __init__( self, clazz, implementationName, serviceNames ):
+        self.clazz = clazz
+        self.implementationName = implementationName
+        self.serviceNames = serviceNames
+
+    def getImplementationName( self ):
+        return self.implementationName
+
+    def supportsService( self, ServiceName ):
+        return ServiceName in self.serviceNames
+
+    def getSupportedServiceNames( self ):
+        return self.serviceNames
+
+    def createInstanceWithContext( self, context ):
+        return self.clazz( context )
+
+    def createInstanceWithArgumentsAndContext( self, args, context ):
+        return self.clazz( context, *args )

Modified: incubator/ooo/branches/writer001/main/pyuno/zipcore/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/zipcore/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/zipcore/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/pyuno/zipcore/makefile.mk Mon Aug 20 11:46:19 2012
@@ -54,9 +54,14 @@ FINDLIBFILES_TMP:=$(subst,/,$/ \
 	$(shell @$(FIND) $(SOLARLIBDIR)$/python -type f| $(GREP) -v "\.pyc" |$(GREP) -v "\.py~" |$(GREP) -v .orig | $(GREP) -v _failed))
 FINDLIBFILES=$(subst,$(SOLARLIBDIR)$/python, $(FINDLIBFILES_TMP))
 
+FINDINCFILES_TMP:=$(subst,/,$/ \
+	$(shell @$(FIND) $(SOLARINCDIR)$/python -type f| $(GREP) -v "\.h~" | $(GREP) -v _failed))
+FINDINCFILES=$(subst,$(SOLARINCDIR)$/python, $(FINDINCFILES_TMP))
+
 FILES=\
 	$(PYTHONBINARY)	\
-	$(foreach,i,$(FINDLIBFILES) $(DESTROOT)$/lib$(i)) 
+	$(foreach,i,$(FINDLIBFILES) $(DESTROOT)$/lib$(i)) \
+	$(foreach,i,$(FINDINCFILES) $(DESTROOT)$/include$/python$(PYMAJOR).$(PYMINOR)$(i))
 
 .IF "$(OS)" == "WNT"
 APP1TARGET = python
@@ -101,6 +106,11 @@ $(DESTROOT)$/lib$/% : $(SOLARLIBDIR)$/py
 	-rm -f $@
 	cat $< > $@
 
+$(DESTROOT)$/include$/python$(PYMAJOR).$(PYMINOR)%: $(SOLARINCDIR)$/python$/%
+	-$(MKDIRHIER) $(@:d)
+	-rm -f $@
+	cat $< > $@
+
 .IF "$(GUI)"== "UNX"
 $(BIN)$/python$(EXECPOST).bin : $(SOLARBINDIR)$/python$(EXECPOST)
 	-$(MKDIRHIER) $(@:d)

Modified: incubator/ooo/branches/writer001/main/rat-excludes
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/rat-excludes?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/rat-excludes (original)
+++ incubator/ooo/branches/writer001/main/rat-excludes Mon Aug 20 11:46:19 2012
@@ -4,6 +4,7 @@
 #
 
 ext_sources/
+ext_libraries/
 
 
 ##############################################################################
@@ -459,6 +460,7 @@ main/xmlsecurity/test_docs/certs/p12/*.p
 # (133) Diverse patches used to allow building external libraries with the contained
 # needed changes
 **/*.patch
+**/*.patch.fixes
 
 # all part of SGA
 # packaging information (used to build install sets)

Modified: incubator/ooo/branches/writer001/main/redland/raptor/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/redland/raptor/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/redland/raptor/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/redland/raptor/makefile.mk Mon Aug 20 11:46:19 2012
@@ -52,7 +52,7 @@ OOO_PATCH_FILES= \
     $(TARFILE_NAME).patch.ooo_build \
     $(TARFILE_NAME).patch.dmake \
     $(TARFILE_NAME).patch.win32 \
-
+    $(TARFILE_NAME).patch.fixes
 
 PATCH_FILES=$(OOO_PATCH_FILES)
 

Modified: incubator/ooo/branches/writer001/main/sal/inc/sal/mathconf.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sal/inc/sal/mathconf.h?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sal/inc/sal/mathconf.h (original)
+++ incubator/ooo/branches/writer001/main/sal/inc/sal/mathconf.h Mon Aug 20 11:46:19 2012
@@ -57,10 +57,7 @@ extern "C" {
 #if defined( WNT)
 #define SAL_MATH_FINITE(d) _finite(d)
 #elif defined OS2
-#define SAL_MATH_FINITE(x) 				\
-    ((sizeof (x) == sizeof (float)) ? __isfinitef(x)	\
-    : (sizeof (x) == sizeof (double)) ? __isfinite(x)	\
-    : __isfinitel(x))
+#define SAL_MATH_FINITE(d) finite(d)
 #elif defined LINUX || defined UNX
 #define SAL_MATH_FINITE(d) finite(d)
 #else /* WNT, LINUX, UNX */

Modified: incubator/ooo/branches/writer001/main/sal/osl/os2/module.c
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sal/osl/os2/module.c?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sal/osl/os2/module.c (original)
+++ incubator/ooo/branches/writer001/main/sal/osl/os2/module.c Mon Aug 20 11:46:19 2012
@@ -103,34 +103,28 @@ oslModule SAL_CALL osl_loadModule(rtl_uS
 			}
 			_makepath( buffer, drive, dir, fname, ext);
 
-#if OSL_DEBUG_LEVEL>0
+#if OSL_DEBUG_LEVEL>10
 			debug_printf("osl_loadModule module %s", buffer);
 #endif
-            //rc = _DosLoadModule( szErrorMessage, sizeof( szErrorMessage), (PCSZ)buffer, &hModule);
-	    //if (rc == NO_ERROR )
 			hModule = dlopen( buffer, RTLD_LOCAL);
 			if (hModule != NULL )
 				pModule = (oslModule)hModule;
 			else
 			{
-				if (rc == NO_ERROR )
-					pModule = (oslModule)hModule;
-				else
-				{
 					sal_Char szError[ PATH_MAX*2 ];
-					sprintf( szError, "Module: %s; rc: %d;\nReason: %s;\n"
+					sprintf( szError, "Module: %s; errno: %d;\n"
 							"Please contact technical support and report above informations.\n\n", 
-							buffer, rc, szErrorMessage );
+							buffer, errno );
 #if OSL_DEBUG_LEVEL>0
 					fprintf( stderr, szError);
 #endif
-					//OSL_TRACE(szError);
+					debug_printf("osl_loadModule error %s", szError);
+
 #ifndef OSL_DEBUG_LEVEL
 					WinMessageBox(HWND_DESKTOP,HWND_DESKTOP,
 						szError, "Critical error: DosLoadModule failed",
 						0, MB_ERROR | MB_OK | MB_MOVEABLE);
 #endif
-				}
 			}
 		}
     }

Modified: incubator/ooo/branches/writer001/main/sc/inc/dbcolect.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/dbcolect.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/dbcolect.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/dbcolect.hxx Mon Aug 20 11:46:19 2012
@@ -136,6 +136,8 @@ public:
 			void		GetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const;
 			SC_DLLPUBLIC void		GetArea(ScRange& rRange) const;
 			void		SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
+            //If the name of DBData is started with "unnamed", it will be recognized as build in DBData
+            sal_Bool        IsBuildin();
 			void		MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
 			sal_Bool		IsByRow() const 				{ return bByRow; }
 			void		SetByRow(sal_Bool bByR) 			{ bByRow = bByR; }
@@ -216,6 +218,7 @@ public:
 			ScDBData*	GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const;
 			ScDBData*	GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
 			ScDBData*       GetFilterDBAtTable(SCTAB nTab) const;
+            ScDBData*	GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const;
 
 	sal_Bool	SearchName( const String& rName, sal_uInt16& rIndex ) const;
 
@@ -234,6 +237,8 @@ public:
 	void			SetRefreshHandler( const Link& rLink )
 						{ aRefreshHandler = rLink; }
 	const Link&		GetRefreshHandler() const	{ return aRefreshHandler; }
+    String      GetNewDefaultDBName();
+    /*sal_Bool        IsFiltered(SCTAB nTab, SCROW nRow);*/
 };
 
 #endif

Modified: incubator/ooo/branches/writer001/main/sc/inc/document.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/document.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/document.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/document.hxx Mon Aug 20 11:46:19 2012
@@ -505,6 +505,7 @@ public:
 //UNUSED2008-05  ScRangeData*	GetRangeAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
 //UNUSED2008-05                                      sal_Bool bStartOnly = sal_False) const;
 	SC_DLLPUBLIC ScRangeData*	GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const;
+    ScDBData*       GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const;
 
 	SC_DLLPUBLIC ScDPCollection*		GetDPCollection();
 	ScDPObject*			GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;

Modified: incubator/ooo/branches/writer001/main/sc/inc/global.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/global.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/global.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/global.hxx Mon Aug 20 11:46:19 2012
@@ -406,7 +406,11 @@ enum ScGetDBMode
 {
 	SC_DB_MAKE,		// wenn noetig, "unbenannt" anlegen
 	SC_DB_IMPORT,	// wenn noetig, "Importx" anlegen
-	SC_DB_OLD		// nicht neu anlegen
+	SC_DB_OLD,		// nicht neu anlegen
+	SC_DB_MAKE_FILTER,   // to create a new filter/sort/subtotal
+	SC_DB_MAKE_SORT,
+	SC_DB_MAKE_SUBTOTAL,
+    SC_DB_OLD_FILTER   //to find a existed filter
 };
 
 /// For ScDBFunc::GetDBData()

Modified: incubator/ooo/branches/writer001/main/sc/inc/sc.hrc
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/sc.hrc?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/sc.hrc (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/sc.hrc Mon Aug 20 11:46:19 2012
@@ -1062,7 +1062,10 @@
 #define SCSTR_SET_TAB_BG_COLOR  (STR_START + 403)
 #define SCSTR_NO_TAB_BG_COLOR   (STR_START + 404)
 
-#define STR_END                 (SCSTR_NO_TAB_BG_COLOR)
+#define SCSTR_FIELDSEP_TAB      (STR_START + 405)
+#define SCSTR_FIELDSEP_SPACE    (STR_START + 406)
+
+#define STR_END                 (SCSTR_FIELDSEP_SPACE)
 
 #define BMP_START				(STR_END)
 

Modified: incubator/ooo/branches/writer001/main/sc/inc/tabprotection.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/tabprotection.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/tabprotection.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/tabprotection.hxx Mon Aug 20 11:46:19 2012
@@ -31,7 +31,7 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 
-#define ENABLE_SHEET_PROTECTION 0
+#define ENABLE_SHEET_PROTECTION 1
 
 class ScDocument;
 class ScTableProtectionImpl;

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/documen3.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/documen3.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/documen3.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/documen3.cxx Mon Aug 20 11:46:19 2012
@@ -192,6 +192,13 @@ ScDBData* ScDocument::GetDBAtArea(SCTAB 
 	else
 		return NULL;
 }
+ScDBData* ScDocument::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const
+{
+	if (pDBCollection)
+		return pDBCollection->GetDBAtTable(nTab, eMode);
+	else
+		return NULL;
+}
 
 ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const
 {
@@ -1291,7 +1298,8 @@ sal_Bool ScDocument::CreateQueryParam(SC
 
 sal_Bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab )
 {
-	ScDBData*		pDBData			= GetDBAtCursor( nCurCol, nCurRow, nCurTab );
+	//ScDBData*		pDBData			= GetDBAtCursor( nCurCol, nCurRow, nCurTab );
+	ScDBData*		pDBData			= GetDBAtTable(nCurTab, SC_DB_OLD_FILTER);
 	sal_Bool			bHasAutoFilter	= ( pDBData != NULL );
 
 	if ( pDBData )

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx Mon Aug 20 11:46:19 2012
@@ -45,6 +45,7 @@
 #include <unotools/charclass.hxx>
 #include <unotools/transliterationwrapper.hxx>
 #include <tools/tenccvt.hxx>
+#include <svx/sdrundomanager.hxx>
 
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -5290,7 +5291,11 @@ sal_Bool ScDocument::NeedPageResetAfterT
 SfxUndoManager* ScDocument::GetUndoManager()
 {
 	if (!mpUndoManager)
-		mpUndoManager = new SfxUndoManager;
+    {
+        // to support enhanced text edit for draw objects, use an SdrUndoManager
+		mpUndoManager = new SdrUndoManager;
+    }
+
 	return mpUndoManager;
 }
 

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx Mon Aug 20 11:46:19 2012
@@ -1194,9 +1194,8 @@ void ScPatternAttr::UpdateStyleSheet()
 		//!	es wird vorausgesetzt, dass "Standard" immer der erste Eintrag ist!
 		if (!pStyle)
 		{
-			SfxStyleSheetIterator* pIter = pDoc->GetStyleSheetPool()->CreateIterator(
-													SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
-			pStyle = (ScStyleSheet*)pIter->First();
+			SfxStyleSheetIteratorPtr pIter = pDoc->GetStyleSheetPool()->CreateIterator( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
+			pStyle = dynamic_cast< ScStyleSheet* >(pIter->First());
 		}
 
 		if (pStyle)

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/stlsheet.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/stlsheet.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/stlsheet.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/stlsheet.cxx Mon Aug 20 11:46:19 2012
@@ -119,7 +119,7 @@ sal_Bool __EXPORT ScStyleSheet::SetParen
 	SfxStyleSheetBase* pStyle = rPool.Find( aEffName, nFamily );
 	if (!pStyle)
 	{
-		SfxStyleSheetIterator* pIter = rPool.CreateIterator( nFamily, SFXSTYLEBIT_ALL );
+		SfxStyleSheetIteratorPtr pIter = rPool.CreateIterator( nFamily, SFXSTYLEBIT_ALL );
 		pStyle = pIter->First();
 		if (pStyle)
 			aEffName = pStyle->GetName();

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/table3.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/table3.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/table3.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/table3.cxx Mon Aug 20 11:46:19 2012
@@ -1693,7 +1693,7 @@ sal_Bool ScTable::CreateExcelQuery(SCCOL
 			while (nCol <= nCol2)
 			{
                 GetInputString( nCol, nRow, aCellStr );
-                ScGlobal::pCharClass->toUpper( aCellStr );
+//                ScGlobal::pCharClass->toUpper( aCellStr ); // #i119637
 				if (aCellStr.Len() > 0)
 				{
 					if (nIndex < nNewEntries)

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/validat.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/validat.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/validat.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/validat.cxx Mon Aug 20 11:46:19 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;

Modified: incubator/ooo/branches/writer001/main/sc/source/core/tool/dbcolect.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/tool/dbcolect.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/tool/dbcolect.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/tool/dbcolect.cxx Mon Aug 20 11:46:19 2012
@@ -36,6 +36,7 @@
 #include "queryparam.hxx"
 #include "globstr.hrc"
 
+#define SC_DBNAME_UNNAMED "__Anonymous_Sheet_DB__"
 
 //---------------------------------------------------------------------------------------
 
@@ -690,7 +691,12 @@ ScDataObject*	ScDBData::Clone() const
 {
 	return new ScDBData(*this);
 }
-
+sal_Bool    ScDBData::IsBuildin()
+{
+    String  aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED);
+    String  aBeginName = aName.Copy(0,22);
+    return  (sal_Bool)(!ScGlobal::GetpTransliteration()->compareString( aNoName, aBeginName ));
+}
 
 //---------------------------------------------------------------------------------------
 //	Compare zum Sortieren
@@ -714,13 +720,12 @@ ScDBData* ScDBCollection::GetDBAtCursor(
 	ScDBData* pNoNameData = NULL;
 	if (pItems)
 	{
-		const String& rNoName = ScGlobal::GetRscString( STR_DB_NONAME );
 
 		for (sal_uInt16 i = 0; i < nCount; i++)
 			if (((ScDBData*)pItems[i])->IsDBAtCursor(nCol, nRow, nTab, bStartOnly))
 			{
 				ScDBData* pDB = (ScDBData*)pItems[i];
-				if ( pDB->GetName() == rNoName )
+                if ( pDB->IsBuildin() )
 					pNoNameData = pDB;
 				else
 					return pDB;
@@ -734,13 +739,12 @@ ScDBData* ScDBCollection::GetDBAtArea(SC
 	ScDBData* pNoNameData = NULL;
 	if (pItems)
 	{
-		const String& rNoName = ScGlobal::GetRscString( STR_DB_NONAME );
 
 		for (sal_uInt16 i = 0; i < nCount; i++)
 			if (((ScDBData*)pItems[i])->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2))
 			{
 				ScDBData* pDB = (ScDBData*)pItems[i];
-				if ( pDB->GetName() == rNoName )
+				if ( pDB->IsBuildin() )
 					pNoNameData = pDB;
 				else
 					return pDB;
@@ -903,6 +907,67 @@ sal_Bool ScDBCollection::Insert(ScDataOb
 	return bInserted;
 }
 
+String ScDBCollection::GetNewDefaultDBName()
+{
+    String  aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED);
+    String  aNewName;
+    unsigned short  nDummy;
+    int     i = 1;
+    do
+    {
+        aNewName = aNoName;
+        aNewName += String::CreateFromInt32( i++ );
+    }while(SearchName(aNewName,nDummy));
+    return  aNewName;
+}
+/*
+sal_Bool ScDBCollection::IsFiltered(SCTAB nTab, SCROW nRow)
+{
+    SCCOL	nLastCol;
+    SCROW	nLastRow;
+    pDoc->GetLastAttrCellArea(nTab, nLastCol, nLastRow);
 
+    if ( pItems )
+    {
+        for (unsigned short i = 0; i < nCount; i++)
+        {
+            ScDBData*   pData = (ScDBData*)pItems[i];
+            if ( pData->nTable == nTab && pData->HasQueryParam() && pData->bQueryInplace )
+                if ( nRow >= (pData->nStartRow + (pData->HasHeader()?1:0)) && nRow <= pData->nEndRow && nRow <= nLastRow )
+                    return sal_True;
+        }
+    }
+    return sal_False;
+}
+*/
+ScDBData* ScDBCollection::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const
+{
+    ScDBData* pDataEmpty = NULL;
+    if (pItems)
+    {
+        for (unsigned short i = 0; i < nCount; i++)
+        {
+            ScDBData* pDBTemp = (ScDBData*)pItems[i];
+            if ( pDBTemp->nTable == nTab )						//Sym2_7885 mod
+            {
+                sal_Bool bImport = pDBTemp->HasImportParam();
+                sal_Bool bFilter = pDBTemp->HasAutoFilter() || pDBTemp->HasQueryParam();
+                sal_Bool bSort = pDBTemp->HasSortParam();
+                sal_Bool bSubtotal = pDBTemp->HasSubTotalParam();
+                sal_Bool bAnyParam = bImport || bFilter || bSort || bSubtotal;
+                if ( ((eMode == SC_DB_MAKE_SORT)    && bSort && !bFilter) ||      //Sym2_7334 mod 20100420
+                    ((eMode == SC_DB_MAKE_SUBTOTAL) && bSubtotal && !bFilter ) ||
+                    ((eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_OLD_FILTER) && bFilter ) )
+                {
+                    return pDBTemp;
+                }
+                else if ( pDBTemp->IsBuildin() && !bAnyParam )	//Sym2_7885 mod
+                {
+                    pDataEmpty = pDBTemp;
+                }
+            }
+        }
+    }
 
-
+    return pDataEmpty;
+}

Modified: incubator/ooo/branches/writer001/main/sc/source/core/tool/rangeutl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/tool/rangeutl.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/tool/rangeutl.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/tool/rangeutl.cxx Mon Aug 20 11:46:19 2012
@@ -1032,7 +1032,8 @@ sal_Bool ScAreaNameIterator::Next( Strin
 			if ( pDBCollection && nPos < pDBCollection->GetCount() )
 			{
 				ScDBData* pData = (*pDBCollection)[nPos++];
-				if (pData && pData->GetName() != aStrNoName)
+//				if (pData && pData->GetName() != aStrNoName)
+				if (pData && !pData->IsBuildin())
 				{
 					pData->GetArea( rRange );
 					rName = pData->GetName();

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/fontbuff.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/fontbuff.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/fontbuff.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/fontbuff.cxx Mon Aug 20 11:46:19 2012
@@ -44,8 +44,6 @@
 #include "patattr.hxx"
 #include "ftools.hxx"
 
-const sal_uInt16	LotusFontBuffer::nSize = 8;
-
 void LotusFontBuffer::Fill( const sal_uInt8 nIndex, SfxItemSet& rItemSet )
 {
 	sal_uInt8	nIntIndex = nIndex & 0x07;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/tokstack.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/tokstack.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/tokstack.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/tokstack.cxx Mon Aug 20 11:46:19 2012
@@ -118,42 +118,30 @@ TokenPool::TokenPool( void )
 
 TokenPool::~TokenPool()
 {
-	sal_uInt16	n;
+    sal_uInt16	n;
 
-	delete[] pP_Id;
-	delete[] pElement;
-	delete[] pType;
-	delete[] pSize;
-	delete[] pP_Dbl;
+    delete[] pP_Id;
+    delete[] pElement;
+    delete[] pType;
+    delete[] pSize;
+    delete[] pP_Dbl;
     delete[] pP_Err;
 
-	for( n = 0 ; n < nP_RefTr ; n++/*, pAktTr++*/ )
-	{
-		if( ppP_RefTr[ n ] )
-			delete ppP_RefTr[ n ];
-	}
-	delete[] ppP_RefTr;
-
-	for( n = 0 ; n < nP_Str ; n++/*, pAktStr++*/ )
-	{
-		if( ppP_Str[ n ] )
-			delete ppP_Str[ n ];
-	}
-	delete[] ppP_Str;
-
-	for( n = 0 ; n < nP_Ext ; n++ )
-	{
-		if( ppP_Ext[ n ] )
-			delete ppP_Ext[ n ];
-	}
-	delete[] ppP_Ext;
-
-	for( n = 0 ; n < nP_Nlf ; n++ )
-	{
-		if( ppP_Nlf[ n ] )
-			delete ppP_Nlf[ n ];
-	}
-	delete[] ppP_Nlf;
+    for( n = 0 ; n < nP_RefTr ; n++ )
+        delete ppP_RefTr[ n ];
+    delete[] ppP_RefTr;
+
+    for( n = 0 ; n < nP_Str ; n++ )
+        delete ppP_Str[ n ];
+    delete[] ppP_Str;
+
+    for( n = 0 ; n < nP_Ext ; n++ )
+        delete ppP_Ext[ n ];
+    delete[] ppP_Ext;
+
+    for( n = 0 ; n < nP_Nlf ; n++ )
+        delete ppP_Nlf[ n ];
+    delete[] ppP_Nlf;
 
     for( n = 0 ; n < nP_Matrix ; n++ )
     {
@@ -162,16 +150,38 @@ TokenPool::~TokenPool()
     }
     delete[] ppP_Matrix;
 
-	delete pScToken;
+    delete pScToken;
 }
 
 
-void TokenPool::GrowString( void )
+/** Returns the new number of elements, or 0 if overflow. */
+static sal_uInt16 lcl_canGrow( sal_uInt16 nOld, sal_uInt16 nByMin = 1 )
 {
-	sal_uInt16		nP_StrNew = nP_Str * 2;
+    if (!nOld)
+        return nByMin ? nByMin : 1;
+    if (nOld == SAL_MAX_UINT16)
+        return 0;
+    sal_uInt32 nNew = ::std::max( static_cast<sal_uInt32>(nOld) * 2, 
+            static_cast<sal_uInt32>(nOld) + nByMin);
+    if (nNew > SAL_MAX_UINT16)
+        nNew = SAL_MAX_UINT16;
+    if (nNew - nByMin < nOld)
+        nNew = 0;
+    return static_cast<sal_uInt16>(nNew);
+}
+
+
+bool TokenPool::GrowString( void )
+{
+    sal_uInt16 nP_StrNew = lcl_canGrow( nP_Str);
+    if (!nP_StrNew)
+        return false;
+
 	sal_uInt16		nL;
 
-	String**	ppP_StrNew = new String *[ nP_StrNew ];
+	String**	ppP_StrNew = new (::std::nothrow) String *[ nP_StrNew ];
+    if (!ppP_StrNew)
+        return false;
 
 	for( nL = 0 ; nL < nP_Str ; nL++ )
 		ppP_StrNew[ nL ] = ppP_Str[ nL ];
@@ -182,14 +192,20 @@ void TokenPool::GrowString( void )
 
 	delete[]	ppP_Str;
 	ppP_Str = ppP_StrNew;
+    return true;
 }
 
 
-void TokenPool::GrowDouble( void )
+bool TokenPool::GrowDouble( void )
 {
-	sal_uInt16		nP_DblNew = nP_Dbl * 2;
+    sal_uInt16 nP_DblNew = lcl_canGrow( nP_Dbl);
+    if (!nP_DblNew)
+        return false;
+
 
-	double*		pP_DblNew = new double[ nP_DblNew ];
+	double*		pP_DblNew = new (::std::nothrow) double[ nP_DblNew ];
+    if (!pP_DblNew)
+        return false;
 
 	for( sal_uInt16 nL = 0 ; nL < nP_Dbl ; nL++ )
 		pP_DblNew[ nL ] = pP_Dbl[ nL ];
@@ -198,31 +214,46 @@ void TokenPool::GrowDouble( void )
 
 	delete[] pP_Dbl;
 	pP_Dbl = pP_DblNew;
+    return true;
 }
 
 
-//UNUSED2009-05 void TokenPool::GrowError( void )
-//UNUSED2009-05 {
-//UNUSED2009-05     sal_uInt16      nP_ErrNew = nP_Err * 2;
-//UNUSED2009-05 
-//UNUSED2009-05     sal_uInt16*     pP_ErrNew = new sal_uInt16[ nP_ErrNew ];
-//UNUSED2009-05 
-//UNUSED2009-05     for( sal_uInt16 nL = 0 ; nL < nP_Err ; nL++ )
-//UNUSED2009-05         pP_ErrNew[ nL ] = pP_Err[ nL ];
-//UNUSED2009-05 
-//UNUSED2009-05     nP_Err = nP_ErrNew;
-//UNUSED2009-05 
-//UNUSED2009-05     delete[] pP_Err;
-//UNUSED2009-05     pP_Err = pP_ErrNew;
-//UNUSED2009-05 }
+/* TODO: in case we had FormulaTokenArray::AddError() */
+#if 0
+void TokenPool::GrowError( void )
+{
+    sal_uInt16 nP_ErrNew = lcl_canGrow( nP_Err);
+    if (!nP_ErrNew)
+        return false;
+
+
+    sal_uInt16*     pP_ErrNew = new (::std::nothrow) sal_uInt16[ nP_ErrNew ];
+    if (!pP_ErrNew)
+        return false;
 
+    for( sal_uInt16 nL = 0 ; nL < nP_Err ; nL++ )
+        pP_ErrNew[ nL ] = pP_Err[ nL ];
 
-void TokenPool::GrowTripel( void )
+    nP_Err = nP_ErrNew;
+
+    delete[] pP_Err;
+    pP_Err = pP_ErrNew;
+    return true;
+}
+#endif
+
+
+bool TokenPool::GrowTripel( sal_uInt16 nByMin )
 {
-	sal_uInt16			nP_RefTrNew = nP_RefTr * 2;
+    sal_uInt16 nP_RefTrNew = lcl_canGrow( nP_RefTr, nByMin);
+    if (!nP_RefTrNew)
+        return false;
+
 	sal_uInt16			nL;
 
-	ScSingleRefData**	ppP_RefTrNew = new ScSingleRefData *[ nP_RefTrNew ];
+	ScSingleRefData**	ppP_RefTrNew = new (::std::nothrow) ScSingleRefData *[ nP_RefTrNew ];
+    if (!ppP_RefTrNew)
+        return false;
 
 	for( nL = 0 ; nL < nP_RefTr ; nL++ )
 		ppP_RefTrNew[ nL ] = ppP_RefTr[ nL ];
@@ -233,14 +264,20 @@ void TokenPool::GrowTripel( void )
 
 	delete[] ppP_RefTr;
 	ppP_RefTr = ppP_RefTrNew;
+    return true;
 }
 
 
-void TokenPool::GrowId( void )
+bool TokenPool::GrowId( void )
 {
-	sal_uInt16	nP_IdNew = nP_Id * 2;
+    sal_uInt16 nP_IdNew = lcl_canGrow( nP_Id);
+    if (!nP_IdNew)
+        return false;
 
-	sal_uInt16*	pP_IdNew = new sal_uInt16[ nP_IdNew ];
+
+	sal_uInt16*	pP_IdNew = new (::std::nothrow) sal_uInt16[ nP_IdNew ];
+    if (!pP_IdNew)
+        return false;
 
 	for( sal_uInt16 nL = 0 ; nL < nP_Id ; nL++ )
 		pP_IdNew[ nL ] = pP_Id[ nL ];
@@ -249,16 +286,27 @@ void TokenPool::GrowId( void )
 
 	delete[] pP_Id;
 	pP_Id = pP_IdNew;
+    return true;
 }
 
 
-void TokenPool::GrowElement( void )
+bool TokenPool::GrowElement( void )
 {
-	sal_uInt16	nElementNew = nElement * 2;
+    sal_uInt16 nElementNew = lcl_canGrow( nElement);
+    if (!nElementNew)
+        return false;
+
 
-	sal_uInt16*	pElementNew = new sal_uInt16[ nElementNew ];
-	E_TYPE*	pTypeNew = new E_TYPE[ nElementNew ];
-	sal_uInt16*	pSizeNew = new sal_uInt16[ nElementNew ];
+	sal_uInt16*	pElementNew = new (::std::nothrow) sal_uInt16[ nElementNew ];
+	E_TYPE*	pTypeNew = new (::std::nothrow) E_TYPE[ nElementNew ];
+	sal_uInt16*	pSizeNew = new (::std::nothrow) sal_uInt16[ nElementNew ];
+    if (!pElementNew || !pTypeNew || !pSizeNew)
+    {
+        delete [] pElementNew;
+        delete [] pTypeNew;
+        delete [] pSizeNew;
+        return false;
+    }
 
 	for( sal_uInt16 nL = 0 ; nL < nElement ; nL++ )
 	{
@@ -275,14 +323,19 @@ void TokenPool::GrowElement( void )
 	pElement = pElementNew;
 	pType = pTypeNew;
 	pSize = pSizeNew;
+    return true;
 }
 
 
-void TokenPool::GrowExt( void )
+bool TokenPool::GrowExt( void )
 {
-	sal_uInt16		nNewSize = nP_Ext * 2;
+    sal_uInt16 nNewSize = lcl_canGrow( nP_Ext);
+    if (!nNewSize)
+        return false;
 
-	EXTCONT**	ppNew = new EXTCONT*[ nNewSize ];
+	EXTCONT**	ppNew = new (::std::nothrow) EXTCONT*[ nNewSize ];
+    if (!ppNew)
+        return false;
 
     memset( ppNew, 0, sizeof( EXTCONT* ) * nNewSize );
 	memcpy( ppNew, ppP_Ext, sizeof( EXTCONT* ) * nP_Ext );
@@ -290,14 +343,19 @@ void TokenPool::GrowExt( void )
 	delete[] ppP_Ext;
 	ppP_Ext = ppNew;
 	nP_Ext = nNewSize;
+    return true;
 }
 
 
-void TokenPool::GrowNlf( void )
+bool TokenPool::GrowNlf( void )
 {
-	sal_uInt16		nNewSize = nP_Nlf * 2;
+    sal_uInt16 nNewSize = lcl_canGrow( nP_Nlf);
+    if (!nNewSize)
+        return false;
 
-	NLFCONT**	ppNew = new NLFCONT*[ nNewSize ];
+	NLFCONT**	ppNew = new (::std::nothrow) NLFCONT*[ nNewSize ];
+    if (!ppNew)
+        return false;
 
     memset( ppNew, 0, sizeof( NLFCONT* ) * nNewSize );
 	memcpy( ppNew, ppP_Nlf, sizeof( NLFCONT* ) * nP_Nlf );
@@ -305,14 +363,19 @@ void TokenPool::GrowNlf( void )
 	delete[] ppP_Nlf;
     ppP_Nlf = ppNew;
 	nP_Nlf = nNewSize;
+    return true;
 }
 
 
-void TokenPool::GrowMatrix( void )
+bool TokenPool::GrowMatrix( void )
 {
-    sal_uInt16      nNewSize = nP_Matrix * 2;
+    sal_uInt16 nNewSize = lcl_canGrow( nP_Matrix);
+    if (!nNewSize)
+        return false;
 
-    ScMatrix**  ppNew = new ScMatrix*[ nNewSize ];
+    ScMatrix**  ppNew = new (::std::nothrow) ScMatrix*[ nNewSize ];
+    if (!ppNew)
+        return false;
 
     memset( ppNew, 0, sizeof( ScMatrix* ) * nNewSize );
     memcpy( ppNew, ppP_Matrix, sizeof( ScMatrix* ) * nP_Matrix );
@@ -320,230 +383,230 @@ void TokenPool::GrowMatrix( void )
     delete[] ppP_Matrix;
     ppP_Matrix = ppNew;
     nP_Matrix = nNewSize;
+    return true;
 }
 
-void TokenPool::GetElement( const sal_uInt16 nId )
+bool TokenPool::GetElement( const sal_uInt16 nId )
 {
-	DBG_ASSERT( nId < nElementAkt, "*TokenPool::GetElement(): Id zu gross!?" );
+	DBG_ASSERT( nId < nElementAkt, "*TokenPool::GetElement(): Id too large!?" );
+    if (nId >= nElementAkt)
+        return false;
 
+    bool bRet = true;
 	if( pType[ nId ] == T_Id )
-		GetElementRek( nId );
+		bRet = GetElementRek( nId );
 	else
 	{
 		switch( pType[ nId ] )
 		{
-#ifdef DBG_UTIL
-			case T_Id:
-				DBG_ERROR( "-TokenPool::GetElement(): hier hast Du nichts zu suchen!" );
-				break;
-#endif
 			case T_Str:
-				pScToken->AddString( ppP_Str[ pElement[ nId ] ]->GetBuffer() );
+                {
+                    sal_uInt16 n = pElement[ nId ];
+                    String* p = ( n < nP_Str )? ppP_Str[ n ] : NULL;
+                    if (p)
+                        pScToken->AddString( *p );
+                    else
+                        bRet = false;
+                }
 				break;
 			case T_D:
-				pScToken->AddDouble( pP_Dbl[ pElement[ nId ] ] );
+                {
+                    sal_uInt16 n = pElement[ nId ];
+                    if (n < nP_Dbl)
+                        pScToken->AddDouble( pP_Dbl[ n ] );
+                    else
+                        bRet = false;
+                }
 				break;
             case T_Err:
-#if 0   // erAck
-                pScToken->AddError( pP_Err[ pElement[ nId ] ] );
+/* TODO: in case we had FormulaTokenArray::AddError() */
+#if 0
+                {
+                    sal_uInt16 n = pElement[ nId ];
+                    if (n < nP_Err)
+                        pScToken->AddError( pP_Err[ n ] );
+                    else
+                        bRet = false;
+                }
 #endif
                 break;
 			case T_RefC:
-				pScToken->AddSingleReference( *ppP_RefTr[ pElement[ (sal_uInt16) nId ] ] );
+                {
+                    sal_uInt16 n = pElement[ nId ];
+                    ScSingleRefData* p = ( n < nP_RefTr )? ppP_RefTr[ n ] : NULL;
+                    if (p)
+                        pScToken->AddSingleReference( *p );
+                    else
+                        bRet = false;
+                }
 				break;
 			case T_RefA:
 				{
-				ScComplexRefData	aScComplexRefData;
-				aScComplexRefData.Ref1 = *ppP_RefTr[ pElement[ nId ] ];
-				aScComplexRefData.Ref2 = *ppP_RefTr[ pElement[ nId ] + 1 ];
-				pScToken->AddDoubleReference( aScComplexRefData );
+                    sal_uInt16 n = pElement[ nId ];
+                    if (n < nP_RefTr && ppP_RefTr[ n ] && n+1 < nP_RefTr && ppP_RefTr[ n + 1 ])
+                    {
+                        ScComplexRefData	aScComplexRefData;
+                        aScComplexRefData.Ref1 = *ppP_RefTr[ n ];
+                        aScComplexRefData.Ref2 = *ppP_RefTr[ n + 1 ];
+                        pScToken->AddDoubleReference( aScComplexRefData );
+                    }
+                    else
+                        bRet = false;
 				}
 				break;
 			case T_RN:
 				pScToken->AddName( pElement[ nId ] );
 				break;
 			case T_Ext:
-				{
-				sal_uInt16			n = pElement[ nId ];
-				EXTCONT*		p = ( n < nP_Ext )? ppP_Ext[ n ] : NULL;
-
-				if( p )
                 {
-                    if( p->eId == ocEuroConvert )
-                        pScToken->AddOpCode( p->eId );
+                    sal_uInt16			n = pElement[ nId ];
+                    EXTCONT*		p = ( n < nP_Ext )? ppP_Ext[ n ] : NULL;
+
+                    if( p )
+                    {
+                        if( p->eId == ocEuroConvert )
+                            pScToken->AddOpCode( p->eId );
+                        else
+                            pScToken->AddExternal( p->aText, p->eId );
+                    }
                     else
-						pScToken->AddExternal( p->aText, p->eId );
+                        bRet = false;
                 }
-				}
 				break;
 			case T_Nlf:
-				{
-				sal_uInt16			n = pElement[ nId ];
-				NLFCONT*		p = ( n < nP_Nlf )? ppP_Nlf[ n ] : NULL;
+                {
+                    sal_uInt16			n = pElement[ nId ];
+                    NLFCONT*		p = ( n < nP_Nlf )? ppP_Nlf[ n ] : NULL;
 
-				if( p )
-						pScToken->AddColRowName( p->aRef );
-				}
+                    if( p )
+                        pScToken->AddColRowName( p->aRef );
+                    else
+                        bRet = false;
+                }
 				break;
             case T_Matrix:
                 {
-                sal_uInt16          n = pElement[ nId ];
-                ScMatrix*       p = ( n < nP_Matrix )? ppP_Matrix[ n ] : NULL;
+                    sal_uInt16          n = pElement[ nId ];
+                    ScMatrix*       p = ( n < nP_Matrix )? ppP_Matrix[ n ] : NULL;
 
-                if( p )
+                    if( p )
                         pScToken->AddMatrix( p );
+                    else
+                        bRet = false;
                 }
                 break;
             case T_ExtName:
-            {
-                sal_uInt16 n = pElement[nId];
-                if (n < maExtNames.size())
                 {
-                    const ExtName& r = maExtNames[n];
-                    pScToken->AddExternalName(r.mnFileId, r.maName);
+                    sal_uInt16 n = pElement[nId];
+                    if (n < maExtNames.size())
+                    {
+                        const ExtName& r = maExtNames[n];
+                        pScToken->AddExternalName(r.mnFileId, r.maName);
+                    }
+                    else
+                        bRet = false;
                 }
-            }
+                break;
             case T_ExtRefC:
-            {
-                sal_uInt16 n = pElement[nId];
-                if (n < maExtCellRefs.size())
                 {
-                    const ExtCellRef& r = maExtCellRefs[n];
-                    pScToken->AddExternalSingleReference(r.mnFileId, r.maTabName, r.maRef);
+                    sal_uInt16 n = pElement[nId];
+                    if (n < maExtCellRefs.size())
+                    {
+                        const ExtCellRef& r = maExtCellRefs[n];
+                        pScToken->AddExternalSingleReference(r.mnFileId, r.maTabName, r.maRef);
+                    }
+                    else
+                        bRet = false;
                 }
-            }
+                break;
             case T_ExtRefA:
-            {
-                sal_uInt16 n = pElement[nId];
-                if (n < maExtAreaRefs.size())
                 {
-                    const ExtAreaRef& r = maExtAreaRefs[n];
-                    pScToken->AddExternalDoubleReference(r.mnFileId, r.maTabName, r.maRef);
+                    sal_uInt16 n = pElement[nId];
+                    if (n < maExtAreaRefs.size())
+                    {
+                        const ExtAreaRef& r = maExtAreaRefs[n];
+                        pScToken->AddExternalDoubleReference(r.mnFileId, r.maTabName, r.maRef);
+                    }
+                    else
+                        bRet = false;
                 }
-            }
-            break;
+                break;
 			default:
-				DBG_ERROR("-TokenPool::GetElement(): Zustand undefiniert!?");
+				DBG_ERROR("-TokenPool::GetElement(): undefined state!?");
+                bRet = false;
 		}
 	}
+    return bRet;
 }
 
 
-void TokenPool::GetElementRek( const sal_uInt16 nId )
+bool TokenPool::GetElementRek( const sal_uInt16 nId )
 {
 #ifdef DBG_UTIL
 	nRek++;
-	DBG_ASSERT( nRek <= nP_Id, "*TokenPool::GetElement(): Rekursion loopt!?" );
+	DBG_ASSERT( nRek <= nP_Id, "*TokenPool::GetElement(): recursion loops" );
 #endif
 
-	DBG_ASSERT( nId < nElementAkt, "*TokenPool::GetElementRek(): Id zu gross!?" );
+    if (nId >= nElementAkt)
+    {
+        DBG_ERRORFILE( "*TokenPool::GetElementRek(): nId >= nElementAkt" );
+#ifdef DBG_UTIL
+        nRek--;
+#endif
+        return false;
+    }
 
-	DBG_ASSERT( pType[ nId ] == T_Id, "-TokenPool::GetElementRek(): nId nicht Id-Folge!" );
+    if (pType[ nId ] != T_Id)
+    {
+        DBG_ERRORFILE( "-TokenPool::GetElementRek(): pType[ nId ] != T_Id" );
+#ifdef DBG_UTIL
+        nRek--;
+#endif
+        return false;
+    }
 
 
-	sal_uInt16		nAnz = pSize[ nId ];
-	sal_uInt16*		pAkt = &pP_Id[ pElement[ nId ] ];
+    bool bRet = true;
+	sal_uInt16 nAnz = pSize[ nId ];
+    sal_uInt16 nFirstId = pElement[ nId ];
+    if (nFirstId >= nP_Id)
+    {
+        DBG_ERRORFILE( "TokenPool::GetElementRek: nFirstId >= nP_Id");
+        nAnz = 0;
+        bRet = false;
+    }
+	sal_uInt16* pAkt = nAnz ? &pP_Id[ nFirstId ] : NULL;
+    if (nAnz > nP_Id - nFirstId)
+    {
+        DBG_ERRORFILE( "TokenPool::GetElementRek: nAnz > nP_Id - nFirstId");
+        nAnz = nP_Id - nFirstId;
+        bRet = false;
+    }
 	for( ; nAnz > 0 ; nAnz--, pAkt++ )
 	{
 		if( *pAkt < nScTokenOff )
 		{// Rekursion oder nicht?
-			switch( pType[ *pAkt ] )
-			{
-				case T_Id:
-					GetElementRek( *pAkt );
-					break;
-				case T_Str:
-					pScToken->AddString( ppP_Str[ pElement[ *pAkt ] ]->GetBuffer() );
-					break;
-				case T_D:
-					pScToken->AddDouble( pP_Dbl[ pElement[ *pAkt ] ] );
-					break;
-                case T_Err:
-#if 0   // erAck
-                    pScToken->AddError( pP_Err[ pElement[ *pAkt ] ] );
-#endif
-                    break;
-				case T_RefC:
-					pScToken->AddSingleReference( *ppP_RefTr[ pElement[ *pAkt ] ] );
-					break;
-				case T_RefA:
-					{
-					ScComplexRefData	aScComplexRefData;
-					aScComplexRefData.Ref1 = *ppP_RefTr[ pElement[ *pAkt ] ];
-					aScComplexRefData.Ref2 = *ppP_RefTr[ pElement[ *pAkt ] + 1 ];
-					pScToken->AddDoubleReference( aScComplexRefData );
-					}
-					break;
-				case T_RN:
-					pScToken->AddName( pElement[ *pAkt ] );
-					break;
-				case T_Ext:
-					{
-					sal_uInt16		n = pElement[ *pAkt ];
-					EXTCONT*	p = ( n < nP_Ext )? ppP_Ext[ n ] : NULL;
-
-					if( p )
-						pScToken->AddExternal( p->aText, p->eId );
-					}
-					break;
-				case T_Nlf:
-					{
-					sal_uInt16		n = pElement[ *pAkt ];
-					NLFCONT*	p = ( n < nP_Nlf )? ppP_Nlf[ n ] : NULL;
-
-					if( p )
-						pScToken->AddColRowName( p->aRef );
-					}
-					break;
-                case T_Matrix:
-                    {
-                    sal_uInt16          n = pElement[ *pAkt ];
-                    ScMatrix*       p = ( n < nP_Matrix )? ppP_Matrix[ n ] : NULL;
-
-                    if( p )
-                            pScToken->AddMatrix( p );
-                    }
-                    break;
-                case T_ExtName:
-                {
-                    sal_uInt16 n = pElement[*pAkt];
-                    if (n < maExtNames.size())
-                    {
-                        const ExtName& r = maExtNames[n];
-                        pScToken->AddExternalName(r.mnFileId, r.maName);
-                    }
-                }
-                case T_ExtRefC:
-                {
-                    sal_uInt16 n = pElement[*pAkt];
-                    if (n < maExtCellRefs.size())
-                    {
-                        const ExtCellRef& r = maExtCellRefs[n];
-                        pScToken->AddExternalSingleReference(r.mnFileId, r.maTabName, r.maRef);
-                    }
-                }
-                case T_ExtRefA:
-                {
-                    sal_uInt16 n = pElement[*pAkt];
-                    if (n < maExtAreaRefs.size())
-                    {
-                        const ExtAreaRef& r = maExtAreaRefs[n];
-                        pScToken->AddExternalDoubleReference(r.mnFileId, r.maTabName, r.maRef);
-                    }
-                }
-                break;
-				default:
-					DBG_ERROR("-TokenPool::GetElementRek(): Zustand undefiniert!?");
-			}
+            if (*pAkt >= nElementAkt)
+            {
+                DBG_ERRORFILE( "TokenPool::GetElementRek: *pAkt >= nElementAkt");
+                bRet = false;
+            }
+            else
+            {
+                if (pType[ *pAkt ] == T_Id)
+                    bRet = GetElementRek( *pAkt );
+                else
+                    bRet = GetElement( *pAkt );
+            }
 		}
 		else	// elementarer SC_Token
 			pScToken->AddOpCode( ( DefTokenId ) ( *pAkt - nScTokenOff ) );
 	}
 
-
 #ifdef DBG_UTIL
 	nRek--;
 #endif
+    return bRet;
 }
 
 
@@ -552,7 +615,8 @@ void TokenPool::operator >>( TokenId& rI
 	rId = ( TokenId ) ( nElementAkt + 1 );
 
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return;
 
 	pElement[ nElementAkt ] = nP_IdLast;	// Start der Token-Folge
 	pType[ nElementAkt ] = T_Id;			// Typinfo eintragen
@@ -567,10 +631,12 @@ void TokenPool::operator >>( TokenId& rI
 const TokenId TokenPool::Store( const double& rDouble )
 {
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
 	if( nP_DblAkt >= nP_Dbl )
-		GrowDouble();
+		if (!GrowDouble())
+            return (const TokenId) nElementAkt+1;
 
 	pElement[ nElementAkt ] = nP_DblAkt;	// Index in Double-Array
 	pType[ nElementAkt ] = T_D;				// Typinfo Double eintragen
@@ -589,7 +655,8 @@ const TokenId TokenPool::Store( const do
 const TokenId TokenPool::Store( const sal_uInt16 nIndex )
 {
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
 	pElement[ nElementAkt ] = nIndex;			// Daten direkt im Index!
 	pType[ nElementAkt ] = T_RN;				// Typinfo Range Name eintragen
@@ -604,10 +671,12 @@ const TokenId TokenPool::Store( const St
 	// weitgehend nach Store( const sal_Char* ) kopiert, zur Vermeidung
 	//  eines temporaeren Strings in "
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
 	if( nP_StrAkt >= nP_Str )
-		GrowString();
+		if (!GrowString())
+            return (const TokenId) nElementAkt+1;
 
 	pElement[ nElementAkt ] = nP_StrAkt;	// Index in String-Array
 	pType[ nElementAkt ] = T_Str;			// Typinfo String eintragen
@@ -615,14 +684,16 @@ const TokenId TokenPool::Store( const St
 	// String anlegen
 	if( !ppP_Str[ nP_StrAkt ] )
 		//...aber nur, wenn noch nicht vorhanden
-		ppP_Str[ nP_StrAkt ] = new String( rString );
+		ppP_Str[ nP_StrAkt ] = new (::std::nothrow) String( rString );
 	else
 		//...ansonsten nur kopieren
 		*ppP_Str[ nP_StrAkt ] = rString;
 
-	DBG_ASSERT( sizeof( xub_StrLen ) <= 2, "*TokenPool::Store(): StrLen doesn't match!" );
-
-	pSize[ nElementAkt ] = ( sal_uInt16 ) ppP_Str[ nP_StrAkt ]->Len();
+    if (ppP_Str[ nP_StrAkt ])
+    {
+        DBG_ASSERT( sizeof( xub_StrLen ) <= 2, "*TokenPool::Store(): StrLen doesn't match!" );
+        pSize[ nElementAkt ] = ( sal_uInt16 ) ppP_Str[ nP_StrAkt ]->Len();
+    }
 
 	nElementAkt++;
 	nP_StrAkt++;
@@ -634,10 +705,12 @@ const TokenId TokenPool::Store( const St
 const TokenId TokenPool::Store( const ScSingleRefData& rTr )
 {
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
 	if( nP_RefTrAkt >= nP_RefTr )
-		GrowTripel();
+		if (!GrowTripel())
+            return (const TokenId) nElementAkt+1;
 
 	pElement[ nElementAkt ] = nP_RefTrAkt;
 	pType[ nElementAkt ] = T_RefC;			// Typinfo Cell-Reff eintragen
@@ -657,10 +730,12 @@ const TokenId TokenPool::Store( const Sc
 const TokenId TokenPool::Store( const ScComplexRefData& rTr )
 {
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
 	if( nP_RefTrAkt + 1 >= nP_RefTr )
-		GrowTripel();
+		if (!GrowTripel( 2))
+            return (const TokenId) nElementAkt+1;
 
 	pElement[ nElementAkt ] = nP_RefTrAkt;
 	pType[ nElementAkt ] = T_RefA;			// Typinfo Area-Reff eintragen
@@ -686,10 +761,12 @@ const TokenId TokenPool::Store( const Sc
 const TokenId TokenPool::Store( const DefTokenId e, const String& r )
 {
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
 	if( nP_ExtAkt >= nP_Ext )
-        GrowExt();
+        if (!GrowExt())
+            return (const TokenId) nElementAkt+1;
 
 	pElement[ nElementAkt ] = nP_ExtAkt;
 	pType[ nElementAkt ] = T_Ext;			// Typinfo String eintragen
@@ -712,10 +789,12 @@ const TokenId TokenPool::Store( const De
 const TokenId TokenPool::StoreNlf( const ScSingleRefData& rTr )
 {
 	if( nElementAkt >= nElement )
-		GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
 	if( nP_NlfAkt >= nP_Nlf )
-		GrowNlf();
+		if (!GrowNlf())
+            return (const TokenId) nElementAkt+1;
 
 	pElement[ nElementAkt ] = nP_NlfAkt;
 	pType[ nElementAkt ] = T_Nlf;
@@ -738,10 +817,12 @@ const TokenId TokenPool::StoreMatrix()
     ScMatrix* pM;
 
     if( nElementAkt >= nElement )
-        GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
     if( nP_MatrixAkt >= nP_Matrix )
-        GrowMatrix();
+        if (!GrowMatrix())
+            return (const TokenId) nElementAkt+1;
 
     pElement[ nElementAkt ] = nP_MatrixAkt;
     pType[ nElementAkt ] = T_Matrix;
@@ -759,7 +840,8 @@ const TokenId TokenPool::StoreMatrix()
 const TokenId TokenPool::StoreExtName( sal_uInt16 nFileId, const String& rName )
 {
     if ( nElementAkt >= nElement )
-        GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
     pElement[nElementAkt] = static_cast<sal_uInt16>(maExtNames.size());
     pType[nElementAkt] = T_ExtName;
@@ -777,7 +859,8 @@ const TokenId TokenPool::StoreExtName( s
 const TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef )
 {
     if ( nElementAkt >= nElement )
-        GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
     pElement[nElementAkt] = static_cast<sal_uInt16>(maExtCellRefs.size());
     pType[nElementAkt] = T_ExtRefC;
@@ -796,7 +879,8 @@ const TokenId TokenPool::StoreExtRef( sa
 const TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef )
 {
     if ( nElementAkt >= nElement )
-        GrowElement();
+		if (!GrowElement())
+            return (const TokenId) nElementAkt+1;
 
     pElement[nElementAkt] = static_cast<sal_uInt16>(maExtAreaRefs.size());
     pType[nElementAkt] = T_ExtRefA;
@@ -831,11 +915,15 @@ sal_Bool TokenPool::IsSingleOp( const To
 		{// Tokenfolge?
 			if( pSize[ nId ] == 1 )
 			{// GENAU 1 Token
-				sal_uInt16	nSecId = pP_Id[ pElement[ nId ] ];
-				if( nSecId >= nScTokenOff )
-				{// Default-Token?
-					return ( DefTokenId ) ( nSecId - nScTokenOff ) == eId;	// Gesuchter?
-				}
+                sal_uInt16 nPid = pElement[ nId ];
+                if (nPid < nP_Id)
+                {
+                    sal_uInt16	nSecId = pP_Id[ nPid ];
+                    if( nSecId >= nScTokenOff )
+                    {// Default-Token?
+                        return ( DefTokenId ) ( nSecId - nScTokenOff ) == eId;	// Gesuchter?
+                    }
+                }
 			}
 		}
 	}
@@ -851,28 +939,17 @@ const String* TokenPool::GetExternal( co
 	if( n && n <= nElementAkt )
 	{
 		n--;
-        if( (pType[ n ] == T_Ext) && ppP_Ext[ pElement[ n ] ] )
-            p = &ppP_Ext[ pElement[ n ] ]->aText;
+        if( (pType[ n ] == T_Ext) )
+        {
+            sal_uInt16 nExt = pElement[ n ];
+            if ( nExt < nP_Ext && ppP_Ext[ nExt ] )
+                p = &ppP_Ext[ nExt ]->aText;
+        }
 	}
 
     return p;
 }
 
-
-//UNUSED2008-05  const String* TokenPool::GetString( const TokenId& r ) const
-//UNUSED2008-05  {
-//UNUSED2008-05      const String*   p = NULL;
-//UNUSED2008-05      sal_uInt16 n = (sal_uInt16) r;
-//UNUSED2008-05      if( n && n <= nElementAkt )
-//UNUSED2008-05      {
-//UNUSED2008-05          n--;
-//UNUSED2008-05          if( pType[ n ] == T_Str )
-//UNUSED2008-05              p = ppP_Str[ pElement[ n ] ];
-//UNUSED2008-05      }
-//UNUSED2008-05  
-//UNUSED2008-05      return p;
-//UNUSED2008-05  }
-
 ScMatrix* TokenPool::GetMatrix( unsigned int n ) const
 {
     if( n < nP_MatrixAkt )

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xichart.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xichart.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xichart.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xichart.cxx Mon Aug 20 11:46:19 2012
@@ -2401,6 +2401,7 @@ void XclImpChChart3d::Convert( ScfProper
     }
 
     // properties
+    rPropSet.SetProperty( EXC_CHPROP_3DRELATIVEHEIGHT, (sal_Int32)(maData.mnRelHeight / 2)); // seems to be 200%, cange to 100%
     rPropSet.SetProperty( EXC_CHPROP_ROTATIONVERTICAL, nRotationY );
     rPropSet.SetProperty( EXC_CHPROP_ROTATIONHORIZONTAL, nRotationX );
     rPropSet.SetProperty( EXC_CHPROP_PERSPECTIVE, nPerspective );

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiescher.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiescher.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiescher.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiescher.cxx Mon Aug 20 11:46:19 2012
@@ -319,53 +319,61 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
     {
         sal_uInt16 nSubRecId, nSubRecSize, nObjType;
         rStrm >> nSubRecId >> nSubRecSize >> nObjType;
-        DBG_ASSERT( nSubRecId == EXC_ID_OBJCMO, "XclImpDrawObjBase::ReadObj8 - OBJCMO subrecord expected" );
-        if( (nSubRecId == EXC_ID_OBJCMO) && (nSubRecSize >= 6) )
+        
+        if(EXC_ID_OBJCMO == nSubRecId)
         {
-            switch( nObjType )
+            if( (nSubRecSize >= 6) )
             {
-                // in BIFF8, all simple objects support text
-                case EXC_OBJTYPE_LINE:
-                case EXC_OBJTYPE_ARC:
-                    xDrawObj.reset( new XclImpTextObj( rRoot ) );
-                    // lines and arcs may be 2-dimensional
-                    xDrawObj->SetAreaObj( false );
-                break;
-
-                // in BIFF8, all simple objects support text
-                case EXC_OBJTYPE_RECTANGLE:
-                case EXC_OBJTYPE_OVAL:
-                case EXC_OBJTYPE_POLYGON:
-                case EXC_OBJTYPE_DRAWING:
-                case EXC_OBJTYPE_TEXT:
-                    xDrawObj.reset( new XclImpTextObj( rRoot ) );
-                break;
-
-                case EXC_OBJTYPE_GROUP:         xDrawObj.reset( new XclImpGroupObj( rRoot ) );          break;
-                case EXC_OBJTYPE_CHART:         xDrawObj.reset( new XclImpChartObj( rRoot ) );          break;
-                case EXC_OBJTYPE_BUTTON:        xDrawObj.reset( new XclImpButtonObj( rRoot ) );         break;
-                case EXC_OBJTYPE_PICTURE:       xDrawObj.reset( new XclImpPictureObj( rRoot ) );        break;
-                case EXC_OBJTYPE_CHECKBOX:      xDrawObj.reset( new XclImpCheckBoxObj( rRoot ) );       break;
-                case EXC_OBJTYPE_OPTIONBUTTON:  xDrawObj.reset( new XclImpOptionButtonObj( rRoot ) );   break;
-                case EXC_OBJTYPE_EDIT:          xDrawObj.reset( new XclImpEditObj( rRoot ) );           break;
-                case EXC_OBJTYPE_LABEL:         xDrawObj.reset( new XclImpLabelObj( rRoot ) );          break;
-                case EXC_OBJTYPE_DIALOG:        xDrawObj.reset( new XclImpDialogObj( rRoot ) );         break;
-                case EXC_OBJTYPE_SPIN:          xDrawObj.reset( new XclImpSpinButtonObj( rRoot ) );     break;
-                case EXC_OBJTYPE_SCROLLBAR:     xDrawObj.reset( new XclImpScrollBarObj( rRoot ) );      break;
-                case EXC_OBJTYPE_LISTBOX:       xDrawObj.reset( new XclImpListBoxObj( rRoot ) );        break;
-                case EXC_OBJTYPE_GROUPBOX:      xDrawObj.reset( new XclImpGroupBoxObj( rRoot ) );       break;
-                case EXC_OBJTYPE_DROPDOWN:      xDrawObj.reset( new XclImpDropDownObj( rRoot ) );       break;
-                case EXC_OBJTYPE_NOTE:          xDrawObj.reset( new XclImpNoteObj( rRoot ) );           break;
-
-                default:
-                    DBG_ERROR1( "XclImpDrawObjBase::ReadObj8 - unknown object type 0x%04hX", nObjType );
-                    rRoot.GetTracer().TraceUnsupportedObjects();
-                    xDrawObj.reset( new XclImpPhObj( rRoot ) );
+                switch( nObjType )
+                {
+                    // in BIFF8, all simple objects support text
+                    case EXC_OBJTYPE_LINE:
+                    case EXC_OBJTYPE_ARC:
+                        xDrawObj.reset( new XclImpTextObj( rRoot ) );
+                        // lines and arcs may be 2-dimensional
+                        xDrawObj->SetAreaObj( false );
+                    break;
+
+                    // in BIFF8, all simple objects support text
+                    case EXC_OBJTYPE_RECTANGLE:
+                    case EXC_OBJTYPE_OVAL:
+                    case EXC_OBJTYPE_POLYGON:
+                    case EXC_OBJTYPE_DRAWING:
+                    case EXC_OBJTYPE_TEXT:
+                        xDrawObj.reset( new XclImpTextObj( rRoot ) );
+                    break;
+
+                    case EXC_OBJTYPE_GROUP:         xDrawObj.reset( new XclImpGroupObj( rRoot ) );          break;
+                    case EXC_OBJTYPE_CHART:         xDrawObj.reset( new XclImpChartObj( rRoot ) );          break;
+                    case EXC_OBJTYPE_BUTTON:        xDrawObj.reset( new XclImpButtonObj( rRoot ) );         break;
+                    case EXC_OBJTYPE_PICTURE:       xDrawObj.reset( new XclImpPictureObj( rRoot ) );        break;
+                    case EXC_OBJTYPE_CHECKBOX:      xDrawObj.reset( new XclImpCheckBoxObj( rRoot ) );       break;
+                    case EXC_OBJTYPE_OPTIONBUTTON:  xDrawObj.reset( new XclImpOptionButtonObj( rRoot ) );   break;
+                    case EXC_OBJTYPE_EDIT:          xDrawObj.reset( new XclImpEditObj( rRoot ) );           break;
+                    case EXC_OBJTYPE_LABEL:         xDrawObj.reset( new XclImpLabelObj( rRoot ) );          break;
+                    case EXC_OBJTYPE_DIALOG:        xDrawObj.reset( new XclImpDialogObj( rRoot ) );         break;
+                    case EXC_OBJTYPE_SPIN:          xDrawObj.reset( new XclImpSpinButtonObj( rRoot ) );     break;
+                    case EXC_OBJTYPE_SCROLLBAR:     xDrawObj.reset( new XclImpScrollBarObj( rRoot ) );      break;
+                    case EXC_OBJTYPE_LISTBOX:       xDrawObj.reset( new XclImpListBoxObj( rRoot ) );        break;
+                    case EXC_OBJTYPE_GROUPBOX:      xDrawObj.reset( new XclImpGroupBoxObj( rRoot ) );       break;
+                    case EXC_OBJTYPE_DROPDOWN:      xDrawObj.reset( new XclImpDropDownObj( rRoot ) );       break;
+                    case EXC_OBJTYPE_NOTE:          xDrawObj.reset( new XclImpNoteObj( rRoot ) );           break;
+
+                    default:
+                        DBG_ERROR1( "XclImpDrawObjBase::ReadObj8 - unknown object type 0x%04hX", nObjType );
+                        rRoot.GetTracer().TraceUnsupportedObjects();
+                        xDrawObj.reset( new XclImpPhObj( rRoot ) );
+                }
             }
+
+            xDrawObj->ImplReadObj8( rStrm );
+        }
+        else
+        {
+            DBG_ASSERT(false, "XclImpDrawObjBase::ReadObj8 - OBJCMO subrecord expected" );
         }
     }
 
-    xDrawObj->ImplReadObj8( rStrm );
     return xDrawObj;
 }
 
@@ -447,10 +455,11 @@ void XclImpDrawObjBase::PreProcessSdrObj
 {
     // default: front layer, derived classes may have to set other layer in DoPreProcessSdrObj()
     rSdrObj.NbcSetLayer( SC_LAYER_FRONT );
-
+    const bool bEnableUndo = rSdrObj.GetModel()->IsUndoEnabled();
+    rSdrObj.GetModel()->EnableUndo(false);
     // set object name (GetObjName() will always return a non-empty name)
     rSdrObj.SetName( GetObjName() );
-
+    rSdrObj.GetModel()->EnableUndo(bEnableUndo);
     // #i39167# full width for all objects regardless of horizontal alignment
     rSdrObj.SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
 
@@ -3865,9 +3874,17 @@ void XclImpDrawing::ReadDffRecord( XclIm
 void XclImpDrawing::ReadObj8( XclImpStream& rStrm )
 {
     XclImpDrawObjRef xDrawObj = XclImpDrawObjBase::ReadObj8( GetRoot(), rStrm );
-    // store the new object in the internal containers
-    maObjMap[ maDffStrm.Tell() ] = xDrawObj;
-    maObjMapId[ xDrawObj->GetObjId() ] = xDrawObj;
+    
+    if(xDrawObj.is())
+    {
+        // store the new object in the internal containers
+        maObjMap[ maDffStrm.Tell() ] = xDrawObj;
+        maObjMapId[ xDrawObj->GetObjId() ] = xDrawObj;
+    }
+    else
+    {
+        OSL_ENSURE(false, "DrawObj could not be loaded (!)");
+    }
 }
 
 void XclImpDrawing::ReadTxo( XclImpStream& rStrm )

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/ftools/ftools.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/ftools/ftools.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/ftools/ftools.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/ftools/ftools.cxx Mon Aug 20 11:46:19 2012
@@ -273,13 +273,17 @@ ByteString ScfTools::ReadCString( SvStre
 {
     ByteString aRet;
     sal_Char cChar;
-
+    
+    sal_uInt32 nLen = 0;
     rStrm >> cChar;
-    while( cChar )
+    while( cChar && nLen++ < STRING_MAXLEN )
     {
         aRet += cChar;
         rStrm >> cChar;
     }
+    // Callers assume that a 0-byte was read and may advance their book keeping 
+    // counters by String.Len()+1, don't put back cChar!=0 if STRING_MAXLEN was 
+    // reached.
     return aRet;
 }
 
@@ -288,9 +292,10 @@ ByteString ScfTools::ReadCString( SvStre
     ByteString aRet;
     sal_Char cChar;
 
+    sal_uInt32 nLen = 0;
     rStrm >> cChar;
     rnBytesLeft--;
-    while( cChar )
+    while( cChar && nLen++ < STRING_MAXLEN )
     {
         aRet += cChar;
         rStrm >> cChar;
@@ -300,12 +305,12 @@ ByteString ScfTools::ReadCString( SvStre
     return aRet;
 }
 
-void ScfTools::AppendCString( SvStream& rStrm, ByteString& rString )
+void ScfTools::AppendCStringWithLen( SvStream& rStrm, ByteString& rString, sal_uInt32 nLen )
 {
     sal_Char cChar;
 
     rStrm >> cChar;
-    while( cChar )
+    while( cChar && nLen++ < STRING_MAXLEN )
     {
         rString += cChar;
         rStrm >> cChar;
@@ -315,7 +320,7 @@ void ScfTools::AppendCString( SvStream& 
 void ScfTools::AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc )
 {
     ByteString aByteString;
-    AppendCString( rStrm, aByteString );
+    AppendCStringWithLen( rStrm, aByteString, rString.Len() );
     rString += String( aByteString, eTextEnc );
 }
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/ftools.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/ftools.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/ftools.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/ftools.hxx Mon Aug 20 11:46:19 2012
@@ -359,8 +359,13 @@ public:
     inline static String ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc )
                             { return String( ReadCString( rStrm, rnBytesLeft ), eTextEnc ); }
 
-    /** Appends a zero terminted byte string. */
-    static void         AppendCString( SvStream& rStrm, ByteString& rString );
+    /** Appends a zero terminted byte string.
+        @param nLen
+               The previous length of the string, usually rString.Len(), but 
+               necessary as this may be called from within AppendCString() 
+               where rString is a temporary ByteString to be appended to 
+               UniString. */
+    static void         AppendCStringWithLen( SvStream& rStrm, ByteString& rString, sal_uInt32 nLen );
     /** Appends a zero terminted byte string. */
     static void         AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc );
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotfntbf.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotfntbf.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotfntbf.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotfntbf.hxx Mon Aug 20 11:46:19 2012
@@ -92,14 +92,15 @@ private:
 		inline void			Type( const sal_uInt16 nNew )		{ nType = nNew; }
 	};
 
-	ENTRY					pData[ 8 ];
-	const static sal_uInt16		nSize;
 	void					MakeFont( ENTRY* pEntry );
 public:
+	const static sal_uInt16	nSize = 8;
 	void					Fill( const sal_uInt8 nIndex, SfxItemSet& rItemSet );
 	void					SetName( const sal_uInt16 nIndex, const String& rName );
 	void					SetHeight( const sal_uInt16 nIndex, const sal_uInt16 nHeight );
 	void					SetType( const sal_uInt16 nIndex, const sal_uInt16 nType );
+private:
+	ENTRY					pData[ nSize ];
 };
 
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotimpop.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotimpop.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotimpop.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/lotimpop.hxx Mon Aug 20 11:46:19 2012
@@ -41,7 +41,6 @@ class ImportLotus : public ImportTyp
 {
 private:
 	SvStream*			pIn;			// benoetigt wegen multiplem Read()!
-	LotusFontBuffer*	pFontBuff;
 	LotusToSc			aConv;
     sal_uInt16              nTab;           // z.Zt. bearbeitete Tabelle
 	sal_Int32				nExtTab;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/op.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/op.h?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/op.h (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/op.h Mon Aug 20 11:46:19 2012
@@ -35,7 +35,6 @@ void OP_EOF( SvStream &aStream, sal_uInt
 void OP_Integer( SvStream &aStream, sal_uInt16 nLaenge );
 void OP_Number( SvStream &aStream, sal_uInt16 nLaenge );
 void OP_Label( SvStream &aStream, sal_uInt16 nLaenge );
-//UNUSED2009-05 void OP_Text( SvStream &aStream, sal_uInt16 nLaenge );		// WK3
 void OP_Integer3( SvStream &aStream, sal_uInt16 nLaenge );	// WK3
 void OP_Number3( SvStream &aStream, sal_uInt16 nLaenge );	// WK3
 void OP_Formula( SvStream &aStream, sal_uInt16 nLaenge );

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/root.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/root.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/root.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/root.hxx Mon Aug 20 11:46:19 2012
@@ -105,6 +105,9 @@ struct LOTUS_ROOT
 	RangeNameBufferWK3*	pRngNmBffWK3;
 	LotusFontBuffer*	pFontBuff;
 	LotAttrTable*		pAttrTable;
+
+                        LOTUS_ROOT( ScDocument* pDocP, CharSet eQ );
+                        ~LOTUS_ROOT();
 };
 
 extern LOTUS_ROOT*		pLotusRoot;	// -> Inkarn. in filter.cxx

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/scflt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/scflt.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/scflt.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/scflt.hxx Mon Aug 20 11:46:19 2012
@@ -412,6 +412,7 @@ struct Sc10ColAttr
 	Sc10ColData*	pData;
 
 	Sc10ColAttr() : pData(NULL) {}
+    ~Sc10ColAttr() { delete [] pData; }
 };
 
 // GraphHeader

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/tokstack.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/tokstack.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/tokstack.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/tokstack.hxx Mon Aug 20 11:46:19 2012
@@ -170,17 +170,20 @@ class TokenPool
 #endif
 		ScTokenArray*				pScToken;	// Tokenbastler
 
-		void						GrowString( void );
-		void						GrowDouble( void );
-//UNUSED2009-05 void                        GrowError( void );
-		void						GrowTripel( void );
-		void						GrowId( void );
-		void						GrowElement( void );
-		void						GrowExt( void );
-		void						GrowNlf( void );
-		void						GrowMatrix( void );
-		void						GetElement( const sal_uInt16 nId );
-		void						GetElementRek( const sal_uInt16 nId );
+		bool						GrowString( void );
+		bool						GrowDouble( void );
+/* TODO: in case we had FormulaTokenArray::AddError() */
+#if 0
+        bool                        GrowError( void );
+#endif
+		bool						GrowTripel( sal_uInt16 nByMin = 1 );
+		bool						GrowId( void );
+		bool						GrowElement( void );
+		bool						GrowExt( void );
+		bool						GrowNlf( void );
+		bool						GrowMatrix( void );
+		bool						GetElement( const sal_uInt16 nId );
+		bool						GetElementRek( const sal_uInt16 nId );
 	public:
 									TokenPool( void );
 									~TokenPool();
@@ -214,7 +217,6 @@ class TokenPool
 		inline E_TYPE				GetType( const TokenId& nId ) const;
 		sal_Bool						IsSingleOp( const TokenId& nId, const DefTokenId eId ) const;
         const String*               GetExternal( const TokenId& nId ) const;
-//UNUSED2008-05  const String*               GetString( const TokenId& nId ) const;
 		ScMatrix*					GetMatrix( unsigned int n ) const;
 };
 
@@ -305,7 +307,8 @@ inline TokenPool& TokenPool::operator <<
 		"-TokenPool::operator <<: TokenId im DefToken-Bereich!" );
 
 	if( nP_IdAkt >= nP_Id )
-		GrowId();
+		if (!GrowId())
+            return *this;
 
 	pP_Id[ nP_IdAkt ] = ( ( sal_uInt16 ) nId ) - 1;
 	nP_IdAkt++;
@@ -320,7 +323,8 @@ inline TokenPool& TokenPool::operator <<
 		"-TokenPool::operator<<: enmum zu gross!" );
 
 	if( nP_IdAkt >= nP_Id )
-		GrowId();
+		if (!GrowId())
+            return *this;
 
 	pP_Id[ nP_IdAkt ] = ( ( sal_uInt16 ) eId ) + nScTokenOff;
 	nP_IdAkt++;
@@ -332,7 +336,8 @@ inline TokenPool& TokenPool::operator <<
 inline TokenPool& TokenPool::operator <<( TokenStack& rStack )
 {
 	if( nP_IdAkt >= nP_Id )
-		GrowId();
+		if (!GrowId())
+            return *this;
 
 	pP_Id[ nP_IdAkt ] = ( ( sal_uInt16 ) rStack.Get() ) - 1;
 	nP_IdAkt++;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlchart.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlchart.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlchart.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlchart.hxx Mon Aug 20 11:46:19 2012
@@ -127,6 +127,7 @@ class XclRoot;
 #define EXC_CHPROP_ROLE                     CREATE_OUSTRING( "Role" )
 #define EXC_CHPROP_ROTATIONHORIZONTAL       CREATE_OUSTRING( "RotationHorizontal" )
 #define EXC_CHPROP_ROTATIONVERTICAL         CREATE_OUSTRING( "RotationVertical" )
+#define EXC_CHPROP_3DRELATIVEHEIGHT         CREATE_OUSTRING( "3DRelativeHeight" )
 #define EXC_CHPROP_SHOW                     CREATE_OUSTRING( "Show" )
 #define EXC_CHPROP_SHOWCORRELATION          CREATE_OUSTRING( "ShowCorrelationCoefficient" )
 #define EXC_CHPROP_SHOWEQUATION             CREATE_OUSTRING( "ShowEquation" )

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/lotus/filter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/lotus/filter.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/lotus/filter.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/lotus/filter.cxx Mon Aug 20 11:46:19 2012
@@ -60,9 +60,6 @@ WKTYP				eTyp;
 extern sal_Bool			bEOF;			// zeigt Ende der Datei
 sal_Bool				bEOF;
 
-extern CharSet		eCharNach;		// Zeichenkonvertierung von->nach
-CharSet				eCharNach;
-
 extern CharSet		eCharVon;
 CharSet				eCharVon;
 
@@ -70,16 +67,11 @@ extern ScDocument*	pDoc;			// Aufhaenger
 ScDocument*			pDoc;
 
 
-extern sal_Char*	pPuffer;		// -> memory.cxx
-extern sal_Char*	pDummy1;		// -> memory.cxx
-
 extern OPCODE_FKT	pOpFkt[ FKT_LIMIT ];
 									// -> optab.cxx, Tabelle moeglicher Opcodes
 extern OPCODE_FKT	pOpFkt123[ FKT_LIMIT123 ];
 									// -> optab.cxx, Table of possible Opcodes
 
-extern long			nDateiLaenge;	// -> datei.cpp, ...der gerade offenen Datei
-
 LOTUS_ROOT*			pLotusRoot = NULL;
 
 
@@ -193,9 +185,10 @@ WKTYP ScanVersion( SvStream& aStream )
 			aStream >> nVersNr;
 			if( aStream.IsEof() ) return eWK_Error;
 			if( nVersNr == 0x0004 && nRecLen == 26 )
-			{	// 4 Bytes von 26 gelesen->22 ueberlesen
-				aStream.Read( pDummy1, 22 );
-				return eWK3;
+			{	// 4 bytes of 26 read => skip 22 (read instead of seek to make IsEof() work just in case)
+                sal_Char aDummy[22];
+                aStream.Read( aDummy, 22 );
+                return aStream.IsEof() ? eWK_Error : eWK3;
 			}
 			break;
 		case 0x1003:

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/lotus/lotattr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/lotus/lotattr.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/lotus/lotattr.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/lotus/lotattr.cxx Mon Aug 20 11:46:19 2012
@@ -68,7 +68,7 @@ void LotAttrCache::LotusToScBorderLine( 
 const SvxColorItem& LotAttrCache::GetColorItem( const sal_uInt8 nLotIndex ) const
 {
 	DBG_ASSERT( nLotIndex > 0 && nLotIndex < 7,
-		"-LotAttrCache::GetColorItem(): so nicht!" );
+		"-LotAttrCache::GetColorItem(): caller hast to check index!" );
 
 	return *ppColorItems[ nLotIndex - 1 ];
 }
@@ -77,7 +77,7 @@ const SvxColorItem& LotAttrCache::GetCol
 const Color& LotAttrCache::GetColor( const sal_uInt8 nLotIndex ) const
 {
 	// Farbe <-> Index passt fuer Background, nicht aber fuer Fonts (0 <-> 7)!
-	DBG_ASSERT( nLotIndex < 8, "*LotAttrCache::GetColor(): Index > 7!" );
+	DBG_ASSERT( nLotIndex < 8, "*LotAttrCache::GetColor(): Index > 7, caller hast to check index!" );
 	return pColTab[ nLotIndex ];
 }
 
@@ -208,6 +208,8 @@ LotAttrCol::~LotAttrCol()
 
 void LotAttrCol::SetAttr( const SCROW nRow, const ScPatternAttr& rAttr )
 {
+    // Actually with the current implementation of MAXROWCOUNT>=64k and nRow 
+    // being read as sal_uInt16 there's no chance that nRow would be invalid..
 	DBG_ASSERT( ValidRow(nRow), "*LotAttrCol::SetAttr(): ... und rums?!" );
 
 	ENTRY*		pAkt = ( ENTRY* ) List::Last();
@@ -275,6 +277,9 @@ LotAttrTable::~LotAttrTable()
 void LotAttrTable::SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow,
 							const LotAttrWK3& rAttr )
 {
+    // With the current implementation of MAXCOLCOUNT>=1024 and nColFirst and 
+    // nColLast being calculated as sal_uInt8+sal_uInt8 there's no chance that 
+    // they would be invalid.
 	const ScPatternAttr&	rPattAttr = aAttrCache.GetPattAttr( rAttr );
 	SCCOL					nColCnt;