incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1386501 [6/10] - in /incubator/ooo/branches/writer001: ./ ext_libraries/ratscan/ ext_sources/ main/ main/autodoc/source/display/html/ main/basegfx/inc/basegfx/numeric/ main/basegfx/source/numeric/ main/basegfx/source/tools/ main/basic/sour...
Date Mon, 17 Sep 2012 08:06:23 GMT
Modified: incubator/ooo/branches/writer001/main/sc/source/core/tool/rangenam.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/tool/rangenam.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/tool/rangenam.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/tool/rangenam.cxx Mon Sep 17 08:06:09 2012
@@ -52,7 +52,7 @@ using namespace formula;
 // Interner ctor fuer das Suchen nach einem Index
 
 ScRangeData::ScRangeData( sal_uInt16 n )
-           : pCode( NULL ), nIndex( n ), bModified( sal_False ), mnMaxRow(-1), mnMaxCol(-1)
+           : pCode( NULL ), nIndex( n ), bModified( sal_False ), mnMaxRow(-1), mnMaxCol(-1), aRangeNameScope( MAXTABCOUNT )
 {}
 
 ScRangeData::ScRangeData( ScDocument* pDok,
@@ -70,7 +70,8 @@ ScRangeData::ScRangeData( ScDocument* pD
 				nIndex		( 0 ),
                 bModified	( sal_False ),
                 mnMaxRow    (-1),
-                mnMaxCol    (-1)
+                mnMaxCol    (-1),
+				aRangeNameScope( MAXTABCOUNT )
 {
 	if (rSymbol.Len() > 0)
 	{
@@ -118,7 +119,8 @@ ScRangeData::ScRangeData( ScDocument* pD
 				nIndex		( 0 ),
                 bModified	( sal_False ),
                 mnMaxRow    (-1),
-                mnMaxCol    (-1)
+                mnMaxCol    (-1),
+				aRangeNameScope( MAXTABCOUNT )
 {
 	if( !pCode->GetCodeError() )
 	{
@@ -155,7 +157,8 @@ ScRangeData::ScRangeData( ScDocument* pD
 				nIndex		( 0 ),
                 bModified	( sal_False ),
                 mnMaxRow    (-1),
-                mnMaxCol    (-1)
+                mnMaxCol    (-1),
+				aRangeNameScope( MAXTABCOUNT )
 {
 	ScSingleRefData aRefData;
 	aRefData.InitAddress( rTarget );
@@ -179,7 +182,8 @@ ScRangeData::ScRangeData(const ScRangeDa
 	nIndex   	(rScRangeData.nIndex),
     bModified	(rScRangeData.bModified),
     mnMaxRow    (rScRangeData.mnMaxRow),
-    mnMaxCol    (rScRangeData.mnMaxCol)
+    mnMaxCol    (rScRangeData.mnMaxCol),
+	aRangeNameScope (rScRangeData.aRangeNameScope)
 {}
 
 ScRangeData::~ScRangeData()
@@ -340,7 +344,7 @@ sal_Bool ScRangeData::operator== (const 
 	if ( nIndex	!= rData.nIndex	||
 		 aName	!= rData.aName	||
 		 aPos	!= rData.aPos	||
-		 eType	!= rData.eType     ) return sal_False;
+		 eType	!= rData.eType   || aRangeNameScope  != rData.aRangeNameScope  ) return sal_False;
 
 	sal_uInt16 nLen = pCode->GetLen();
 	if ( nLen != rData.pCode->GetLen() ) return sal_False;
@@ -408,6 +412,7 @@ sal_Bool ScRangeData::IsValidReference( 
     return sal_False;
 }
 
+/* modification to update named range scope */
 void ScRangeData::UpdateTabRef(SCTAB nOldTable, sal_uInt16 nFlag, SCTAB nNewTable)
 {
 	pCode->Reset();
@@ -420,16 +425,40 @@ void ScRangeData::UpdateTabRef(SCTAB nOl
 		switch (nFlag)
 		{
 			case 1:										// einfache InsertTab (doc.cxx)
-				pRangeData = aComp.UpdateInsertTab(nOldTable, sal_True );	// und CopyTab (doc2.cxx)
+			case 4:	
+			       pRangeData = aComp.UpdateInsertTab(nOldTable, true );	// und CopyTab (doc2.cxx)
+				if ( (aRangeNameScope != MAXTABCOUNT) && ( aRangeNameScope >= nOldTable) && ( aRangeNameScope != MAXTAB ) )
+					aRangeNameScope ++;
 				break;
 			case 2:										// einfaches delete (doc.cxx)
-				pRangeData = aComp.UpdateDeleteTab(nOldTable, sal_False, sal_True, bChanged);
+				pRangeData = aComp.UpdateDeleteTab(nOldTable, false, true, bChanged);
+				if  ( aRangeNameScope != MAXTABCOUNT && aRangeNameScope > nOldTable )
+                                    aRangeNameScope --;
 				break;
 			case 3:										// move (doc2.cxx)
 			{
-				pRangeData = aComp.UpdateMoveTab(nOldTable, nNewTable, sal_True );
+				pRangeData = aComp.UpdateMoveTab(nOldTable, nNewTable, true );
+				if ( aRangeNameScope != MAXTABCOUNT )
+				{
+					if ( aRangeNameScope == nOldTable )
+						aRangeNameScope = nNewTable;
+					else if ( (aRangeNameScope > nOldTable) && (aRangeNameScope <= nNewTable) )
+						aRangeNameScope--;
+					else if ( (aRangeNameScope >= nNewTable) && (aRangeNameScope < nOldTable) )
+						aRangeNameScope++;
+				}
 			}
-				break;
+			break;
+			case 5:										
+			{
+                                //when copying a sheet, this will be invoked to update the new name range's address in the new sheet 
+                                //only need to update the address if the address's tab same as the range scope. because if they are different, the address's tab have been updated in ScRangeName::UpdateTabRef()  
+                                //for example, in sheet5(scope is sheet5), there are two name range, one address is sheet5, the other is sheet4, if copy sheet5 to sheet1
+                                //only need to change the first one's address to sheet1
+				pRangeData = aComp.UpdateMoveTab(nOldTable, nNewTable, true , true);
+				aRangeNameScope = nNewTable;
+			}
+			break;
 			default:
 			{
 				DBG_ERROR("ScRangeName::UpdateTabRef: Unknown Flag");
@@ -536,6 +565,33 @@ SCCOL ScRangeData::GetMaxCol() const
     return mnMaxCol >= 0 ? mnMaxCol : MAXCOL;
 }
 
+/* MAXTABCOUNT - Global, 0 - sheet1, 1 - sheet2, ...		*/
+/*	MAXTABCOUNT -- Global				*/
+/*	return value: FALSE -- set fail		 	*/
+/*			      TRUE  -- set successfully	*/
+bool ScRangeData::SetRangeScope( SCTAB Scope )
+{
+	 if ( Scope <= MAXTABCOUNT && Scope >=0 )
+	 {
+		aRangeNameScope = Scope;
+	        return true;
+	 }
+         return false;
+	
+}
+
+ String ScRangeData::GetScopeSheetName() const
+{
+	if ( aRangeNameScope != MAXTABCOUNT )
+	{
+            String aTableName;
+            pDoc->GetName( aRangeNameScope, aTableName );
+            return aTableName;
+	}
+        return EMPTY_STRING;
+}
+/* end add */
+
 
 sal_uInt16 ScRangeData::GetErrCode()
 {
@@ -700,29 +756,86 @@ short ScRangeName::Compare(ScDataObject*
 	return (short) i1 - (short) i2;
 }
 
-sal_Bool ScRangeName::SearchNameUpper( const String& rUpperName, sal_uInt16& rIndex ) const
+/* added  for scope support */
+bool ScRangeName::HasRangeinSheetScope(SCTAB Scope)
+{
+    for (sal_uInt16 i = 0; i < nCount; i++)
+        if  (((*this)[i])->GetRangeScope() == Scope) 
+            return true;
+
+    return false;
+}
+/* if Scope is global, no range will be removed */
+/* if no range is removed, return value is false */
+bool ScRangeName::RemoveRangeinScope(SCTAB Scope)
+{
+     bool bRemoved = false;
+	
+     if ( Scope == MAXTABCOUNT )
+         return bRemoved;
+
+     sal_uInt16 i = 0;
+     while (i < nCount)
+     {
+          if  (((*this)[i])->GetRangeScope() == Scope) 
+          {
+               Free( (*this)[i] );
+               bRemoved = true;		
+          }
+          else
+               i++;
+     }
+
+     return bRemoved;
+}
+/* it's designed for "Copy Sheet" action. So no name conflict check when copy range to new scope */
+/* if the old scope or the new scope is global, no range will be copied */
+/* if no range is copied, the return value is false */
+bool ScRangeName::CopyRangeinScope(SCTAB oldScope, SCTAB newScope)
+{
+       bool bCopied = false;
+
+       if ( (oldScope == MAXTABCOUNT)||(newScope ==MAXTABCOUNT) )
+           return bCopied;
+
+       sal_uInt16 originalCount = nCount;
+       for ( sal_uInt16 i = 0; i < originalCount; i++)
+           if ( ((*this)[i])->GetRangeScope() == oldScope) 
+           {
+                 ScRangeData * aCopiedRange = (ScRangeData *)(*this)[i]->Clone();
+                 aCopiedRange->UpdateTabRef(oldScope, 5 , newScope);
+                 aCopiedRange->SetIndex(GetEntryIndex());
+                 Insert( aCopiedRange );
+                 bCopied = true;		
+           }
+
+       return bCopied;
+}
+/* end add */
+bool ScRangeName::SearchNameUpper( const String& rUpperName, sal_uInt16& rIndex, SCTAB Scope ) const
 {
     // SearchNameUpper must be called with an upper-case search string
 
     sal_uInt16 i = 0;
     while (i < nCount)
     {
-        if ( ((*this)[i])->GetUpperName() == rUpperName )
+        if ( (((*this)[i])->GetUpperName() == rUpperName) 
+			&& (((*this)[i])->GetRangeScope() == Scope ))
         {
             rIndex = i;
-            return sal_True;
+            return true;
         }
         i++;
     }
-    return sal_False;
+    return false;
 }
 
-sal_Bool ScRangeName::SearchName( const String& rName, sal_uInt16& rIndex ) const
+bool ScRangeName::SearchName( const String& rName, sal_uInt16& rIndex, SCTAB Scope ) const
 {
     if ( nCount > 0 )
-        return SearchNameUpper( ScGlobal::pCharClass->upper( rName ), rIndex );
+        return SearchNameUpper( ScGlobal::pCharClass->upper( rName ), rIndex, Scope );
     else
-        return sal_False;
+        return false;
 }
 
 void ScRangeName::UpdateReference(	UpdateRefMode eUpdateRefMode,
@@ -811,10 +924,18 @@ ScRangeData* ScRangeName::GetRangeAtBloc
 
 void ScRangeName::UpdateTabRef(SCTAB nOldTable, sal_uInt16 nFlag, SCTAB nNewTable)
 {
-	for (sal_uInt16 i=0; i<nCount; i++)
-		((ScRangeData*)pItems[i])->UpdateTabRef(nOldTable, nFlag, nNewTable);
-}
+       if (nFlag == 2)
+           RemoveRangeinScope( nOldTable );
 
+       for (sal_uInt16 i=0; i<nCount; i++)
+            ((ScRangeData*)pItems[i])->UpdateTabRef(nOldTable, nFlag, nNewTable);
+
+       if (nFlag ==4)
+       {
+            SCTAB copyScope = nOldTable > nNewTable ? nNewTable : nNewTable+1;
+            CopyRangeinScope( copyScope, nOldTable);
+       }
+}
 
 
 

Modified: incubator/ooo/branches/writer001/main/sc/source/core/tool/scmatrix.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/tool/scmatrix.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/tool/scmatrix.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/tool/scmatrix.cxx Mon Sep 17 08:06:09 2012
@@ -853,3 +853,31 @@ double ScMatrix::Or()
 	return bOr;
 }
 
+// @Author Marina Plakalovic
+// Computes the logical XOR of elements
+double ScMatrix::Xor()
+{
+    SCSIZE n = nColCount * nRowCount;
+    bool bXor = false;
+    if ( mnValType )
+    {
+        for ( SCSIZE j=0; j<n; j++ )
+            if ( !IsValueType( mnValType[j]) )
+            {   // assuming a CompareMat this is an error
+                return CreateDoubleError( errIllegalArgument );
+            }
+            else if ( ::rtl::math::isFinite( pMat[j].fVal))
+                bXor ^= (pMat[j].fVal != 0.0);
+            else
+                return pMat[j].fVal;    // DoubleError
+    }
+    else
+    {
+        for ( SCSIZE j=0; j<n; j++ )
+            if ( ::rtl::math::isFinite( pMat[j].fVal))
+                bXor ^= (pMat[j].fVal != 0.0);
+            else
+                return pMat[j].fVal;    // DoubleError
+    }
+    return bXor;
+}

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform.cxx Mon Sep 17 08:06:09 2012
@@ -202,7 +202,8 @@ ConvErr ExcelToSc::Convert( const ScToke
 	TokenId			nMerk0;
 	const sal_Bool		bRangeName = eFT == FT_RangeName;
 	const sal_Bool		bSharedFormula = eFT == FT_SharedFormula;
-	const sal_Bool		bRNorSF = bRangeName || bSharedFormula;
+	const sal_Bool		bConditional = eFT == FT_Conditional;
+	const sal_Bool		bRNorSF = bRangeName || bSharedFormula || bConditional;
 
 	ScSingleRefData		aSRD;
 	ScComplexRefData		aCRD;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform8.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform8.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform8.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/excform8.cxx Mon Sep 17 08:06:09 2012
@@ -101,7 +101,8 @@ ConvErr ExcelToSc8::Convert( const ScTok
 	TokenId					nMerk0;
 	const sal_Bool				bRangeName = eFT == FT_RangeName;
 	const sal_Bool				bSharedFormula = eFT == FT_SharedFormula;
-	const sal_Bool				bRNorSF = bRangeName || bSharedFormula;
+	const sal_Bool		        bConditional = eFT == FT_Conditional;
+	const sal_Bool				bRNorSF = bRangeName || bSharedFormula || bConditional;
 
 	ScSingleRefData			aSRD;
 	ScComplexRefData			aCRD;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/excimp8.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/excimp8.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/excimp8.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/excimp8.cxx Mon Sep 17 08:06:09 2012
@@ -173,6 +173,10 @@ void ImportExcel8::Boundsheet( void )
         pD->MakeTable( nScTab );
 	}
 
+	//assume pending row heights true here. Only optimize the excel8 type for now. i120586
+	//if the sheet contain sdrobject, will set false then.
+	pD->SetPendingRowHeights( nScTab, true );
+	//end i120586
 	if( ( nGrbit & 0x0001 ) || ( nGrbit & 0x0002 ) )
         pD->SetVisible( nScTab, sal_False );
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/impop.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/impop.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/impop.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/impop.cxx Mon Sep 17 08:06:09 2012
@@ -1203,8 +1203,26 @@ void ImportExcel::AdjustRowHeight()
         update row heights (here), last load all charts -> do not any longer
         update inside of ScDocShell::ConvertFrom() (causes update of existing
         charts during each and every change of row height). */
-    if( ScModelObj* pDocObj = GetDocModelObj() )
-        pDocObj->UpdateAllRowHeights();
+    	/*if( ScModelObj* pDocObj = GetDocModelObj() )
+         pDocObj->UpdateAllRowHeights();*/
+
+       //just update row heights for : 1. visible sheet, 2. sheet containing sdrobject. i120586
+	SCTAB nCount = GetDoc().GetTableCount();
+	SCTAB nVisible = GetDocViewSettings().GetDisplScTab();
+
+	GetDoc().SetPendingRowHeights(nVisible, false);
+
+	ScMarkData aUpdateSheets;
+	for (SCTAB nTab=0; nTab<nCount; ++nTab)
+	{
+		if ( false == GetDoc().IsPendingRowHeights(nTab)) 
+			aUpdateSheets.SelectTable( nTab, true );
+	}
+
+	ScModelObj* pDocObj = GetDocModelObj();
+	if (pDocObj && (aUpdateSheets.GetSelectCount()))
+		pDocObj->UpdateAllRowHeights(&aUpdateSheets);	
+     //end i120586
 }
 
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/read.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/read.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/read.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/read.cxx Mon Sep 17 08:06:09 2012
@@ -19,13 +19,9 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sc.hxx"
 
-
-
 //------------------------------------------------------------------------
 
 #include <stdlib.h>
@@ -1017,7 +1013,7 @@ FltError ImportExcel8::Read( void )
                         {
                             rNumFmtBfr.CreateScFormats();
                             rXFBfr.CreateUserStyles();
-                            rPTableMgr.ReadPivotCaches( maStrm );
+                            //rPTableMgr.ReadPivotCaches( maStrm );
                             eAkt = EXC_STATE_BEFORE_SHEET;
                         }
                     break;
@@ -1203,8 +1199,15 @@ FltError ImportExcel8::Read( void )
         // #i45843# Convert pivot tables before calculation, so they are available
         // for the GETPIVOTDATA function.
         if( GetBiff() == EXC_BIFF8 )
-            GetPivotTableManager().ConvertPivotTables();
+//            GetPivotTableManager().ConvertPivotTables();
+        {
+            SCTAB nTabCount = GetDoc().GetTableCount();
+
+            GetPivotTableManager().ConvertPivotTables( maStrm );
 
+            for( SCTAB nDummyTab = GetDoc().GetTableCount() - 1; nDummyTab >= nTabCount; nDummyTab-- )
+                GetDoc().DeleteTab( nDummyTab );
+        }
         pProgress.reset();
 
         if (pD->IsAdjustHeightEnabled())
@@ -1226,8 +1229,9 @@ FltError ImportExcel8::Read( void )
         else if( rAddrConv.IsColTruncated() )
             eLastErr = SCWARN_IMPORT_COLUMN_OVERFLOW;
 
-        if( GetBiff() == EXC_BIFF8 )                         
-            GetPivotTableManager().MaybeRefreshPivotTables();
+// Refreshing pivot tables moves to the end of converting every table
+//        if( GetBiff() == EXC_BIFF8 )                         
+//            GetPivotTableManager().MaybeRefreshPivotTables();
     }
 
 	return eLastErr;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xeformula.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xeformula.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xeformula.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xeformula.cxx Mon Sep 17 08:06:09 2012
@@ -210,11 +210,14 @@ void XclExpFuncData::IncParamInfoIdx()
     if( mpParamInfo )
     {
         // move pointer to next entry, if something explicit follows
-        if( (static_cast<size_t>(mpParamInfo - mrFuncInfo.mpParamInfos + 1) < EXC_FUNCINFO_PARAMINFO_COUNT) && (mpParamInfo[ 1 ].meValid != EXC_PARAM_NONE) )
+        if( (static_cast< size_t >( mpParamInfo - mrFuncInfo.mpParamInfos + 1 ) < EXC_FUNCINFO_PARAMINFO_COUNT) && (mpParamInfo[ 1 ].meValid != EXC_PARAM_NONE) )
             ++mpParamInfo;
         // if last parameter type is 'Excel-only' or 'Calc-only', do not repeat it
         else if( IsExcelOnlyParam() || IsCalcOnlyParam() )
             mpParamInfo = 0;
+        // points to last info, but parameter pairs expected, move to previous info
+        else if( mrFuncInfo.IsParamPairs() )
+            --mpParamInfo;
         // otherwise: repeat last parameter class
     }
 }

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xename.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xename.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xename.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xename.cxx Mon Sep 17 08:06:09 2012
@@ -87,6 +87,9 @@ public:
     inline bool         IsGlobal() const { return mnXclTab == EXC_NAME_GLOBAL; }
     /** Returns the Calc sheet of a local defined name. */
     inline SCTAB        GetScTab() const { return mnScTab; }
+	// 
+	/** Set name range flag value */
+	void				SetScTab( sal_uInt16 nXclTab ) { mnXclTab = nXclTab; }
 
     /** Returns true, if this defined name is volatile. */
     bool                IsVolatile() const;
@@ -548,6 +551,8 @@ sal_uInt16 XclExpNameManagerImpl::Create
     size_t nOldListSize = maNameList.GetSize();
     XclExpNameRef xName( new XclExpName( GetRoot(), rName ) );
     sal_uInt16 nNameIdx = Append( xName );
+	// 
+    xName->SetScTab( rRangeData.GetRangeScope() == MAXTABCOUNT ? EXC_NAME_GLOBAL : rRangeData.GetRangeScope()+1 );
     // store the index of the NAME record in the lookup map
     maNameMap[ rRangeData.GetIndex() ] = nNameIdx;
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xestyle.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xestyle.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xestyle.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xestyle.cxx Mon Sep 17 08:06:09 2012
@@ -1896,18 +1896,43 @@ void XclExpXFId::ConvertXFIndex( const X
 
 XclExpXF::XclExpXF(
         const XclExpRoot& rRoot, const ScPatternAttr& rPattern, sal_Int16 nScript,
-        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) :
-    XclXFBase( true ),
-    XclExpRoot( rRoot )
+        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) 
+:   XclXFBase(true),
+    XclExpRecord(),
+    XclExpRoot(rRoot),
+    mpItemSet(0),
+    maProtection(),
+    maAlignment(),
+    maBorder(),
+    maArea(),
+    mnParentXFId(),
+    mnScNumFmt(),
+    mnXclFont(),
+    mnXclNumFmt(),
+    mnBorderId(),
+    mnFillId(),
+    mnIndexInXFList(0)
 {
     mnParentXFId = GetXFBuffer().InsertStyle( rPattern.GetStyleSheet() );
     Init( rPattern.GetItemSet(), nScript, nForceScNumFmt, nForceXclFont, bForceLineBreak, false );
 }
 
-XclExpXF::XclExpXF( const XclExpRoot& rRoot, const SfxStyleSheetBase& rStyleSheet ) :
-    XclXFBase( false ),
-    XclExpRoot( rRoot ),
-    mnParentXFId( XclExpXFBuffer::GetXFIdFromIndex( EXC_XF_STYLEPARENT ) )
+XclExpXF::XclExpXF( const XclExpRoot& rRoot, const SfxStyleSheetBase& rStyleSheet ) 
+:   XclXFBase(false),
+    XclExpRecord(),
+    XclExpRoot(rRoot),
+    mpItemSet(0),
+    maProtection(),
+    maAlignment(),
+    maBorder(),
+    maArea(),
+    mnParentXFId(XclExpXFBuffer::GetXFIdFromIndex(EXC_XF_STYLEPARENT)),
+    mnScNumFmt(),
+    mnXclFont(),
+    mnXclNumFmt(),
+    mnBorderId(),
+    mnFillId(),
+    mnIndexInXFList(0)
 {
     bool bDefStyle = (rStyleSheet.GetName() == ScGlobal::GetRscString( STR_STYLENAME_STANDARD ));
     sal_Int16 nScript = bDefStyle ? GetDefApiScript() : ::com::sun::star::i18n::ScriptType::WEAK;
@@ -1915,10 +1940,22 @@ XclExpXF::XclExpXF( const XclExpRoot& rR
         NUMBERFORMAT_ENTRY_NOT_FOUND, EXC_FONT_NOTFOUND, false, bDefStyle );
 }
 
-XclExpXF::XclExpXF( const XclExpRoot& rRoot, bool bCellXF ) :
-    XclXFBase( bCellXF ),
-    XclExpRoot( rRoot ),
-    mnParentXFId( XclExpXFBuffer::GetXFIdFromIndex( EXC_XF_STYLEPARENT ) )
+XclExpXF::XclExpXF( const XclExpRoot& rRoot, bool bCellXF ) 
+:   XclXFBase(bCellXF),
+    XclExpRecord(),
+    XclExpRoot(rRoot),
+    mpItemSet(0),
+    maProtection(),
+    maAlignment(),
+    maBorder(),
+    maArea(),
+    mnParentXFId(XclExpXFBuffer::GetXFIdFromIndex(EXC_XF_STYLEPARENT)),
+    mnScNumFmt(),
+    mnXclFont(),
+    mnXclNumFmt(),
+    mnBorderId(),
+    mnFillId(),
+    mnIndexInXFList(0)
 {
     InitDefault();
 }
@@ -2323,8 +2360,21 @@ bool XclExpFillPred::operator()( const X
         mrFill.mnBackColorId    == rFill.mnBackColorId;
 }
 
-XclExpXFBuffer::XclExpXFBuffer( const XclExpRoot& rRoot ) :
-    XclExpRoot( rRoot )
+static bool XclExpXFBuffer_mbUseMultimapBuffer = true;
+
+XclExpXFBuffer::XclExpXFBuffer( const XclExpRoot& rRoot ) 
+:   XclExpRecordBase(),
+    XclExpRoot(rRoot),
+    maXFList(),
+    maStyleList(),
+    maBuiltInMap(),
+    maXFIndexVec(),
+    maStyleIndexes(),
+    maCellIndexes(),
+    maSortedXFList(),
+    maBorders(),
+    maFills(),
+    maXclExpXFMap()
 {
 }
 
@@ -2603,20 +2653,90 @@ void XclExpXFBuffer::SaveXFXml( XclExpXm
     rXF.SaveXml( rStrm );
 }
 
-sal_uInt32 XclExpXFBuffer::FindXF( const ScPatternAttr& rPattern,
-        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const
+void XclExpXFBuffer::impAddMissingValuesFromXFListToXclExpXFMap()
 {
-    for( size_t nPos = 0, nSize = maXFList.GetSize(); nPos < nSize; ++nPos )
-        if( maXFList.GetRecord( nPos )->Equals( rPattern, nForceScNumFmt, nForceXclFont, bForceLineBreak ) )
-            return static_cast< sal_uInt32 >( nPos );
-    return EXC_XFID_NOTFOUND;
+    for(size_t nPos(maXclExpXFMap.size()); nPos < maXFList.GetSize(); ++nPos)
+    {
+        XclExpXF* pValue = maXFList.GetRecord(nPos).get();
+
+        if(pValue)
+        {
+            const SfxItemSet* pKey = maXFList.GetRecord(nPos)->getItemSet();
+
+            maXclExpXFMap.insert(std::pair< const SfxItemSet*, XclExpXF* >(pKey, pValue));
+            pValue->setIndexInXFList(nPos);
+        }
+        else
+        {
+            OSL_ENSURE(false, "maXFList has empty entries (!)");
+        }
+    }
+}
+
+sal_uInt32 XclExpXFBuffer::FindXF(const ScPatternAttr& rPattern, sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak) const
+{
+    // define return value
+    sal_uInt32 nXFId(EXC_XFID_NOTFOUND);
+
+    if(XclExpXFBuffer_mbUseMultimapBuffer)
+    {
+        // add values from maXFList which are not yet in maXclExpXFMap
+        const_cast< XclExpXFBuffer* >(this)->impAddMissingValuesFromXFListToXclExpXFMap();
+
+        // get the full range for the pattern set
+        typedef std::multimap< const SfxItemSet*, XclExpXF* >::const_iterator CIT;
+        typedef std::pair< CIT, CIT > Range;
+        const SfxItemSet* pPatternSet = &(rPattern.GetItemSet());
+        const Range range(maXclExpXFMap.equal_range(pPatternSet));
+
+        // iterate over evtl. multiple candidates using the pattern set
+        for(CIT ite(range.first); ite != range.second; ++ite) 
+        {
+            XclExpXF* pIte = ite->second;
+
+            if(pIte->Equals(rPattern, nForceScNumFmt, nForceXclFont, bForceLineBreak))
+            {
+                nXFId = pIte->getIndexInXFList();
+                break;
+            }
+        }
+    }
+    else
+    {
+        // old, unbuffered implementation
+        for( size_t nPos = 0, nSize = maXFList.GetSize(); nPos < nSize; ++nPos )
+            if( maXFList.GetRecord( nPos )->Equals( rPattern, nForceScNumFmt, nForceXclFont, bForceLineBreak ) )
+                return static_cast< sal_uInt32 >( nPos );
+    }
+
+    return nXFId;
 }
 
 sal_uInt32 XclExpXFBuffer::FindXF( const SfxStyleSheetBase& rStyleSheet ) const
 {
-    for( size_t nPos = 0, nSize = maXFList.GetSize(); nPos < nSize; ++nPos )
-        if( maXFList.GetRecord( nPos )->Equals( rStyleSheet ) )
-            return static_cast< sal_uInt32 >( nPos );
+    if(XclExpXFBuffer_mbUseMultimapBuffer)
+    {
+        // add values from maXFList which are not yet in maXclExpXFMap
+        const_cast< XclExpXFBuffer* >(this)->impAddMissingValuesFromXFListToXclExpXFMap();
+
+        // find entry with given ItemSet (by StyleSheet)
+        const SfxItemSet& rItemSet = const_cast< SfxStyleSheetBase& >(rStyleSheet).GetItemSet();
+        typedef std::multimap< const SfxItemSet*, XclExpXF* >::const_iterator CIT;
+        const CIT aFound(maXclExpXFMap.find(&rItemSet));
+
+        if(aFound != maXclExpXFMap.end())
+        {
+            return aFound->second->getIndexInXFList();
+        }
+    }
+    else
+    {
+        // old, unbuffered implementation
+        for( size_t nPos = 0, nSize = maXFList.GetSize(); nPos < nSize; ++nPos )
+            if( maXFList.GetRecord( nPos )->Equals( rStyleSheet ) )
+                return static_cast< sal_uInt32 >( nPos );
+    }
+
     return EXC_XFID_NOTFOUND;
 }
 
@@ -2647,6 +2767,13 @@ sal_uInt32 XclExpXFBuffer::InsertCellXF(
             // replace default cell pattern
             XclExpXFRef xNewXF( new XclExpXF( GetRoot(), *pPattern, nScript ) );
             maXFList.ReplaceRecord( xNewXF, EXC_XF_DEFAULTCELL );
+
+            // need to clear the multimap buffer to force reinsertin of the new element
+            if(XclExpXFBuffer_mbUseMultimapBuffer)
+            {
+                    maXclExpXFMap.clear();
+            }
+
             rbPredefined = false;
         }
         return GetDefCellXFId();
@@ -2698,6 +2825,13 @@ sal_uInt32 XclExpXFBuffer::InsertStyleXF
             {
                 // replace predefined built-in style (ReplaceRecord() deletes old record)
                 maXFList.ReplaceRecord( XclExpXFRef( new XclExpXF( GetRoot(), rStyleSheet ) ), nXFId );
+
+                // need to clear the multimap buffer to force reinsertin of the new element
+                if(XclExpXFBuffer_mbUseMultimapBuffer)
+                {
+                    maXclExpXFMap.clear();
+                }
+
                 rbPredefined = false;
             }
         }

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xicontent.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xicontent.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xicontent.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xicontent.cxx Mon Sep 17 08:06:09 2012
@@ -614,7 +614,7 @@ void XclImpCondFormat::ReadCF( XclImpStr
     {
         const ScTokenArray* pTokArr = 0;
         rFmlaConv.Reset( rPos );
-        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_RangeName );
+        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_Conditional );
         // formula converter owns pTokArr -> create a copy of the token array
         if( pTokArr )
             xTokArr1.reset( pTokArr->Clone() );
@@ -625,7 +625,7 @@ void XclImpCondFormat::ReadCF( XclImpStr
     {
         const ScTokenArray* pTokArr = 0;
         rFmlaConv.Reset( rPos );
-        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_RangeName );
+        rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_Conditional );
         // formula converter owns pTokArr -> create a copy of the token array
         if( pTokArr )
             pTokArr2.reset( pTokArr->Clone() );
@@ -748,7 +748,7 @@ void XclImpValidation::ReadDV( XclImpStr
         {
             const ScTokenArray* pTokArr = 0;
             rFmlaConv.Reset();
-            rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName );
+            rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_Conditional );
             // formula converter owns pTokArr -> create a copy of the token array
             if( pTokArr )
                 xTokArr1.reset( pTokArr->Clone() );
@@ -763,7 +763,7 @@ void XclImpValidation::ReadDV( XclImpStr
         {
             const ScTokenArray* pTokArr = 0;
             rFmlaConv.Reset();
-            rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName );
+            rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_Conditional );
             // formula converter owns pTokArr -> create a copy of the token array
             if( pTokArr )
                 xTokArr2.reset( pTokArr->Clone() );

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=1386501&r1=1386500&r2=1386501&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 Sep 17 08:06:09 2012
@@ -200,6 +200,9 @@ XclImpDrawObjBase::XclImpDrawObjBase( co
     mbInsertSdr( true ),
     mbCustomDff( false )
 {
+	//  if this sheet(ScTab) have an xclimpdrawobjbase (i.e. it contain sdrobject), 
+	//  then the sheet should be 'updaterowheights' in loading procedure. i120586
+	GetDoc().SetPendingRowHeights( rRoot.GetCurrScTab(), false );
 }
 
 XclImpDrawObjBase::~XclImpDrawObjBase()
@@ -455,11 +458,15 @@ 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);
+    SdrModel * pModel = rSdrObj.GetModel();
+    if ( pModel ) {
+        const bool bEnableUndo = pModel->IsUndoEnabled();
+        pModel->EnableUndo(false);
+        // set object name (GetObjName() will always return a non-empty name)
+        rSdrObj.SetName( GetObjName() );
+        pModel->EnableUndo(bEnableUndo);
+    } else
+        rSdrObj.SetName( GetObjName() );
     // #i39167# full width for all objects regardless of horizontal alignment
     rSdrObj.SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
 
@@ -2734,7 +2741,7 @@ XclImpPictureObj::XclImpPictureObj( cons
     mbUseCtlsStrm( false )
 {
     SetAreaObj( true );
-    SetSimpleMacro( false );
+    SetSimpleMacro( true );
     SetCustomDffObj( true );
 }
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiname.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiname.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiname.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xiname.cxx Mon Sep 17 08:06:09 2012
@@ -138,10 +138,8 @@ XclImpName::XclImpName( XclImpStream& rS
 
     // find an unused name
     String aOrigName( maScName );
-    sal_Int32 nCounter = 0;
-    sal_uInt16 nDummy;
-    while( rRangeNames.SearchName( maScName, nDummy ) )
-        maScName.Assign( aOrigName ).Append( ' ' ).Append( String::CreateFromInt32( ++nCounter ) );
+    //while( rRangeNames.SearchName( maScName, nDummy ) )
+        //maScName.Assign( aOrigName ).Append( ' ' ).Append( String::CreateFromInt32( ++nCounter ) );
 
     // 3) *** convert the name definition formula *** -------------------------
 
@@ -212,6 +210,7 @@ XclImpName::XclImpName( XclImpStream& rS
     {
         // create the Calc name data
         ScRangeData* pData = new ScRangeData( GetDocPtr(), maScName, *pTokArr, ScAddress(), nNameType );
+	 pData->SetRangeScope(nXclTab == EXC_NAME_GLOBAL ?  MAXTABCOUNT : mnScTab);
         pData->GuessPosition();             // calculate base position for relative refs
         pData->SetIndex( nXclNameIdx );     // used as unique identifier in formulas
         rRangeNames.Insert( pData );        // takes ownership of pData

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xipivot.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xipivot.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xipivot.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xipivot.cxx Mon Sep 17 08:06:09 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sc.hxx"
 
@@ -1420,6 +1418,8 @@ void XclImpPivotTable::Convert()
     mpDPObj = pDPObj;
 
     ApplyMergeFlags(aOutRange, aSaveData);
+    MaybeRefresh();	// refresh after convert immediately
+    mxPCache = XclImpPivotCacheRef();	// release memory
 }
 
 void XclImpPivotTable::MaybeRefresh()
@@ -1612,23 +1612,48 @@ void XclImpPivotTableManager::ReadSxView
 
 // ----------------------------------------------------------------------------
 
-void XclImpPivotTableManager::ReadPivotCaches( XclImpStream& rStrm )
+// Reading all used pivot caches at one time and then converting all pivot tables together will consume too much memory, forbid this action
+// ConvertPivotTables will change to read cache one by one and convert it then release the memory
+/*void XclImpPivotTableManager::ReadPivotCaches( XclImpStream& rStrm )
 {
     for( XclImpPivotCacheVec::iterator aIt = maPCaches.begin(), aEnd = maPCaches.end(); aIt != aEnd; ++aIt )
         (*aIt)->ReadPivotCacheStream( rStrm );
-}
+}*/
 
-void XclImpPivotTableManager::ConvertPivotTables()
+void XclImpPivotTableManager::ConvertPivotTables( XclImpStream & rStm/* guoyanp: for DP memory */ )
 {
+//    for( XclImpPivotTableVec::iterator aIt = maPTables.begin(), aEnd = maPTables.end(); aIt != aEnd; ++aIt )
+//        (*aIt)->Convert();
+
+    std::map< sal_uInt16, std::list< XclImpPivotTableRef > > aMap;
+
     for( XclImpPivotTableVec::iterator aIt = maPTables.begin(), aEnd = maPTables.end(); aIt != aEnd; ++aIt )
-        (*aIt)->Convert();
+        aMap[(*aIt)->GetCacheId()].push_back( *aIt );
+
+    size_t iCache = 0;
+
+    for( std::map< sal_uInt16, std::list< XclImpPivotTableRef > >::iterator i = aMap.begin(); i != aMap.end(); i++, iCache++ )
+    {
+        if( i->first >= maPCaches.size() ) continue;
+
+        maPCaches[iCache]->ReadPivotCacheStream( rStm );
+
+        for( std::list< XclImpPivotTableRef >::iterator j = i->second.begin(); j != i->second.end(); j++ )
+            (*j)->Convert();
+
+        maPCaches[iCache] = XclImpPivotCacheRef();
+    }
 }
 
-void XclImpPivotTableManager::MaybeRefreshPivotTables()
+// Reading all used pivot caches at one time and then converting all pivot tables together will consume too much memory, forbid that action
+// ConvertPivotTables will change to read cache one by one and convert it then release the memory
+// So refreshing all pivot tables at one time is forbidden too because the cache already released
+// Need to refresh one by one after convert every pivot table
+/*void XclImpPivotTableManager::MaybeRefreshPivotTables()
 {
     for( XclImpPivotTableVec::iterator aIt = maPTables.begin(), aEnd = maPTables.end(); aIt != aEnd; ++aIt )
         (*aIt)->MaybeRefresh();
-}
+}*/
 
 // ============================================================================
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/excel/xlformula.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/excel/xlformula.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/excel/xlformula.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/excel/xlformula.cxx Mon Sep 17 08:06:09 2012
@@ -359,6 +359,19 @@ static const XclFunctionInfo saFuncTable
     { ocEuroConvert,        255,    4,  6,  V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, "EUROCONVERT" }
 };
 
+/** Functions new in OOXML. */
+static const XclFunctionInfo saFuncTable_Oox[] =
+{
+    { ocCountIfs,           NOID,   2,  MX, V, { RO, VR }, EXC_FUNCFLAG_IMPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "COUNTIFS" ) },
+    { ocCountIfs,           255,    3,  MX, V, { RO_E, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "COUNTIFS" ) },
+    { ocSumIfs,             NOID,   3,  MX, V, { RO, RO, VR }, EXC_FUNCFLAG_IMPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "SUMIFS" ) },
+    { ocSumIfs,             255,    4,  MX, V, { RO_E, RO, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "SUMIFS" ) },
+    { ocAverageIf,          NOID,   2,  3,  V, { RO, VR, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "AVERAGEIF" ) },
+    { ocAverageIf,          255,    3,  4,  V, { RO_E, RO, VR, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "AVERAGEIF" ) },
+    { ocAverageIfs,         NOID,   3,  MX, V, { RO, RO, VR }, EXC_FUNCFLAG_IMPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "AVERAGEIFS" ) },
+    { ocAverageIfs,         255,    4,  MX, V, { RO_E, RO, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "AVERAGEIFS" ) }
+};
+
 #define EXC_FUNCENTRY_ODF( opcode, minparam, maxparam, flags, asciiname ) \
     { opcode, NOID, minparam,     maxparam,     V, { VR },       EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME_ODF( asciiname ) }, \
     { opcode,  255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME_ODF( asciiname ) }
@@ -398,7 +411,7 @@ static const XclFunctionInfo saFuncTable
     EXC_FUNCENTRY_ODF( ocNoName,        1,  MX, 0,  "SKEWP" ),
     EXC_FUNCENTRY_ODF( ocUnichar,       1,  1,  0,  "UNICHAR" ),
     EXC_FUNCENTRY_ODF( ocUnicode,       1,  1,  0,  "UNICODE" ),
-    EXC_FUNCENTRY_ODF( ocNoName,        1,  MX, 0,  "XOR" )
+    EXC_FUNCENTRY_ODF( ocXor,           1,  MX, 0,  "XOR" )
 };
 
 #undef EXC_FUNCENTRY_ODF
@@ -424,6 +437,7 @@ XclFunctionProvider::XclFunctionProvider
         (this->*pFillFunc)( saFuncTable_5, STATIC_ARRAY_END( saFuncTable_5 ) );
     if( eBiff >= EXC_BIFF8 )
         (this->*pFillFunc)( saFuncTable_8, STATIC_ARRAY_END( saFuncTable_8 ) );
+    (this->*pFillFunc)( saFuncTable_Oox, STATIC_ARRAY_END( saFuncTable_Oox ) );
     (this->*pFillFunc)( saFuncTable_Odf, STATIC_ARRAY_END( saFuncTable_Odf ) );
 }
 
@@ -457,7 +471,8 @@ void XclFunctionProvider::FillXclFuncMap
     {
         if( !::get_flag( pIt->mnFlags, EXC_FUNCFLAG_EXPORTONLY ) )
         {
-            maXclFuncMap[ pIt->mnXclFunc ] = pIt;
+            if( pIt->mnXclFunc != NOID )
+                maXclFuncMap[ pIt->mnXclFunc ] = pIt;
             if( pIt->IsMacroFunc() )
                 maXclMacroNameMap[ pIt->GetMacroFuncName() ] = pIt;
         }

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/formel.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/formel.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/formel.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/formel.hxx Mon Sep 17 08:06:09 2012
@@ -60,7 +60,8 @@ enum FORMULA_TYPE
 {
 	FT_CellFormula,
 	FT_RangeName,
-	FT_SharedFormula
+	FT_SharedFormula,
+	FT_Conditional
 };
 
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/xestyle.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/xestyle.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/xestyle.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/xestyle.hxx Mon Sep 17 08:06:09 2012
@@ -512,6 +512,11 @@ public:
 
     virtual void        SaveXml( XclExpXmlStream& rStrm );
 
+    // for buffered FindXF
+    const SfxItemSet* getItemSet() const { return mpItemSet; }
+    sal_uInt32 getIndexInXFList() const { return mnIndexInXFList; }
+    void setIndexInXFList(sal_uInt32 nNew) { mnIndexInXFList = nNew; }
+
 protected:
     explicit            XclExpXF( const XclExpRoot& rRoot, bool bCellXF );
 
@@ -523,12 +528,15 @@ protected:  // access for XclExpDefaultX
     XclExpCellBorder    maBorder;           /// Border line style.
     XclExpCellArea      maArea;             /// Background area style.
     sal_uInt32          mnParentXFId;       /// XF ID of parent XF record.
-    sal_uLong               mnScNumFmt;         /// Calc number format index.
+    sal_uLong           mnScNumFmt;         /// Calc number format index.
     sal_uInt16          mnXclFont;          /// Excel font index.
     sal_uInt16          mnXclNumFmt;        /// Excel number format index.
     sal_Int32           mnBorderId;         /// OOXML Border Index
     sal_Int32           mnFillId;           /// OOXML Fill Index
 
+    // for buffered FindXF, holds the index in XclExpXFBuffer::maXFList when object is added to maXclExpXFMap
+    sal_uInt32          mnIndexInXFList;
+
 private:
     using               XclXFBase::Equals;
 
@@ -695,6 +703,9 @@ private:
     typedef XclExpRecordList< XclExpStyle > XclExpStyleList;
 
 private:
+    // helper to update the buffer for maXFList
+    void impAddMissingValuesFromXFListToXclExpXFMap();
+
     /** Returns the XF ID of the cell XF containing the passed format. */
     sal_uInt32          FindXF( const ScPatternAttr& rPattern, sal_uLong nForceScNumFmt,
                             sal_uInt16 nForceXclFont, bool bForceLineBreak ) const;
@@ -758,6 +769,8 @@ private:
     XclExpBorderList    maBorders;          /// List of borders used by XF records
     XclExpFillList      maFills;            /// List of fills used by XF records
 
+    // for optimized FindXF, buffered version of maXFList for fast access
+    std::multimap< const SfxItemSet*, XclExpXF* > maXclExpXFMap;
 };
 
 // ============================================================================

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/xipivot.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/xipivot.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/xipivot.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/xipivot.hxx Mon Sep 17 08:06:09 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_XIPIVOT_HXX
 #define SC_XIPIVOT_HXX
 
@@ -358,6 +356,8 @@ public:
 
     void                ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveData& rSaveData);
 
+    sal_uInt16          GetCacheId() const { return maPTInfo.mnCacheIdx; };
+
     // ------------------------------------------------------------------------
 private:
     typedef ::std::vector< XclImpPTFieldRef > XclImpPTFieldVec;
@@ -433,11 +433,11 @@ public:
     // ------------------------------------------------------------------------
 
     /** Reads all used pivot caches and creates additional sheets for external data sources. */
-    void                ReadPivotCaches( XclImpStream& rStrm );
+//    void                ReadPivotCaches( XclImpStream& rStrm );
     /** Inserts all pivot tables into the Calc document. */
-    void                ConvertPivotTables();
-
-    void                MaybeRefreshPivotTables();
+//    void                ConvertPivotTables();
+    void                ConvertPivotTables( XclImpStream & );
+//    void                MaybeRefreshPivotTables();
 
 private:
     typedef ::std::vector< XclImpPivotCacheRef >    XclImpPivotCacheVec;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlformula.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlformula.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlformula.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/inc/xlformula.hxx Mon Sep 17 08:06:09 2012
@@ -287,6 +287,7 @@ const size_t EXC_FUNCINFO_PARAMINFO_COUN
 const sal_uInt8 EXC_FUNCFLAG_VOLATILE       = 0x01;     /// Result is volatile (e.g. NOW() function).
 const sal_uInt8 EXC_FUNCFLAG_IMPORTONLY     = 0x02;     /// Only used in import filter.
 const sal_uInt8 EXC_FUNCFLAG_EXPORTONLY     = 0x04;     /// Only used in export filter.
+const sal_uInt8 EXC_FUNCFLAG_PARAMPAIRS     = 0x08;     /// Optional parameters are expected to appear in pairs.
 
 // selected function IDs
 const sal_uInt16 EXC_FUNCID_IF              = 1;
@@ -317,6 +318,8 @@ struct XclFunctionInfo
 
     /** Returns true, if the function is volatile. */
     inline bool         IsVolatile() const { return ::get_flag( mnFlags, EXC_FUNCFLAG_VOLATILE ); }
+    /** Returns true, if optional parameters are expected to appear in pairs. */
+    inline bool         IsParamPairs() const { return ::get_flag( mnFlags, EXC_FUNCFLAG_PARAMPAIRS ); }
     /** Returns true, if the function parameter count is fixed. */
     inline bool         IsFixedParamCount() const { return (mnXclFunc != EXC_FUNCID_EXTERNCALL) && (mnMinParamCount == mnMaxParamCount); }
     /** Returns true, if the function is simulated by a macro call. */

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlbodyi.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlbodyi.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlbodyi.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlbodyi.cxx Mon Sep 17 08:06:09 2012
@@ -192,6 +192,7 @@ SvXMLImportContext *ScXMLBodyContext::Cr
 	case XML_TOK_BODY_NAMED_EXPRESSIONS:
 		pContext = new ScXMLNamedExpressionsContext ( GetScImport(), nPrefix, rLocalName,
 														xAttrList );
+		static_cast<ScXMLNamedExpressionsContext*>(pContext)->SetScope( MAXTABCOUNT );//workbookname
 		break;
 	case XML_TOK_BODY_DATABASE_RANGES:
 		pContext = new ScXMLDatabaseRangesContext ( GetScImport(), nPrefix, rLocalName,

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.cxx Mon Sep 17 08:06:09 2012
@@ -113,8 +113,8 @@
 #include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/sheet/XLabelRanges.hpp>
 #include <com/sun/star/sheet/XLabelRange.hpp>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
-#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <com/sun/star/sheet/XNamedRanges2.hpp>
+#include <com/sun/star/sheet/XNamedRange2.hpp>
 #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
 #include <com/sun/star/container/XNamed.hpp>
@@ -1833,16 +1833,19 @@ void ScXMLExport::_ExportContent()
                         }
                         else
                             ExportFormatRanges(0, 0, pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable);
-                        CloseRow(pSharedData->GetLastRow(nTable));
-                        nEqualCells = 0;
-                    }
-                }
-            }
-            IncrementProgressBar(sal_False);
+
+						CloseRow(pSharedData->GetLastRow(nTable));
+						WriteNamedExpressions(xSpreadDoc, nTable);
+						nEqualCells = 0;
+					}
+				}
+			}
+			
+			IncrementProgressBar(sal_False);
         }
     }
     WriteExternalRefCaches();
-    WriteNamedExpressions(xSpreadDoc);
+    WriteNamedExpressions(xSpreadDoc, MAXTABCOUNT);
     aExportDatabaseRanges.WriteDatabaseRanges(xSpreadDoc);
     ScXMLExportDataPilot aExportDataPilot(*this);
     aExportDataPilot.WriteDataPilots(xSpreadDoc);
@@ -2955,7 +2958,7 @@ void ScXMLExport::WriteCell(ScMyCell& aC
 				{
                     const formula::FormulaGrammar::Grammar eGrammar = pDoc->GetStorageGrammar();
                     sal_uInt16 nNamespacePrefix = (eGrammar == formula::FormulaGrammar::GRAM_ODFF ? XML_NAMESPACE_OF : XML_NAMESPACE_OOOC);
-					pFormulaCell->GetFormula(sFormula, eGrammar);
+					pFormulaCell->GetFormula(sFormula, eGrammar);//ange scope name support
 					rtl::OUString sOUFormula(sFormula.makeStringAndClear());
 					if (!bIsMatrix)
                     {
@@ -3886,16 +3889,16 @@ void ScXMLExport::WriteLabelRanges( cons
 	}
 }
 
-void ScXMLExport::WriteNamedExpressions(const com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc)
+void ScXMLExport::WriteNamedExpressions(const com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc, sal_Int16 nWhichTable)
 {
 	uno::Reference <beans::XPropertySet> xPropertySet (xSpreadDoc, uno::UNO_QUERY);
 	if (xPropertySet.is())
 	{
-        uno::Reference <sheet::XNamedRanges> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_NAMEDRANGES))), uno::UNO_QUERY);
+        uno::Reference <sheet::XNamedRanges2> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_NAMEDRANGES))), uno::UNO_QUERY);
 		CheckAttrList();
 		if (xNamedRanges.is())
 		{
-			uno::Sequence <rtl::OUString> aRangesNames(xNamedRanges->getElementNames());
+			uno::Sequence <sheet::RangeScopeName> aRangesNames(xNamedRanges->getElementScopeNames());//modified 20091211, range scope name support
 			sal_Int32 nNamedRangesCount(aRangesNames.getLength());
 			if (nNamedRangesCount > 0)
 			{
@@ -3906,8 +3909,21 @@ void ScXMLExport::WriteNamedExpressions(
 					for (sal_Int32 i = 0; i < nNamedRangesCount; ++i)
 					{
 						CheckAttrList();
-						rtl::OUString sNamedRange(aRangesNames[i]);
-                        uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName(sNamedRange), uno::UNO_QUERY);
+						//range scope name support -start
+						rtl::OUString sNamedRange(aRangesNames[i].RangeName);
+						rtl::OUString sRangeScope(aRangesNames[i].ScopeName);
+						SCTAB nScopeNumber = MAXTABCOUNT;
+						String sScopeStr(sRangeScope);
+						if(sScopeStr !=EMPTY_STRING)
+						{
+							pDoc->GetTable(sScopeStr,nScopeNumber);
+							if( nWhichTable != nScopeNumber || nScopeNumber ==MAXTABCOUNT)
+								continue;
+						}
+						else if( nWhichTable !=MAXTABCOUNT)
+							continue;
+                        uno::Reference <sheet::XNamedRange2> xNamedRange(xNamedRanges->getByScopeName(sRangeScope,sNamedRange), uno::UNO_QUERY);
+						//range scope name support 
 						if (xNamedRange.is())
 						{
 							uno::Reference <container::XNamed> xNamed (xNamedRange, uno::UNO_QUERY);
@@ -3915,8 +3931,9 @@ void ScXMLExport::WriteNamedExpressions(
 							if (xNamed.is() && xCellRangeReferrer.is())
 							{
 								rtl::OUString sOUName(xNamed->getName());
+							
 								AddAttribute(sAttrName, sOUName);
-
+								
 								OUString sOUBaseCellAddress;
 								ScRangeStringConverter::GetStringFromAddress( sOUBaseCellAddress,
 									xNamedRange->getReferencePosition(), pDoc, FormulaGrammar::CONV_OOO, ' ', sal_False, SCA_ABS_3D );
@@ -3924,7 +3941,15 @@ void ScXMLExport::WriteNamedExpressions(
 
 								sal_uInt16 nRangeIndex;
 								String sName(sOUName);
-								pNamedRanges->SearchName(sName, nRangeIndex);
+								//range scope name support -start
+								SCTAB nScopeName = MAXTABCOUNT;
+								String sScopeName(sRangeScope);
+								if(sScopeName !=EMPTY_STRING)
+								{
+									pDoc->GetTable(sScopeName,nScopeName);
+								}
+								pNamedRanges->SearchName(sName, nRangeIndex,nScopeName);
+								//range scope name support - end
 								ScRangeData* pNamedRange((*pNamedRanges)[nRangeIndex]); //should get directly and not with ScDocument
 								String sContent;
 								pNamedRange->GetSymbol(sContent, pDoc->GetStorageGrammar());

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlexprt.hxx Mon Sep 17 08:06:09 2012
@@ -201,7 +201,7 @@ class ScXMLExport : public SvXMLExport
 	void WriteScenario();	// core implementation
 	void WriteTheLabelRanges(const com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument >& xSpreadDoc);
 	void WriteLabelRanges( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xRangesIAccess, sal_Bool bColumn );
-	void WriteNamedExpressions(const com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc);
+	void WriteNamedExpressions(const com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc, sal_Int16 nWhichTable);
     void WriteExternalRefCaches();
 	void WriteConsolidation();	// core implementation
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.cxx Mon Sep 17 08:06:09 2012
@@ -84,9 +84,9 @@
 #include <com/sun/star/util/NumberFormat.hpp>
 #include <com/sun/star/util/XNumberFormatTypes.hpp>
 #include <tools/urlobj.hxx>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/sheet/XNamedRanges2.hpp>
 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
-#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <com/sun/star/sheet/XNamedRange2.hpp>
 #include <com/sun/star/sheet/XLabelRanges.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
 
@@ -640,6 +640,7 @@ const SvXMLTokenMap& ScXMLImport::GetTab
             { XML_NAMESPACE_TABLE,	XML_TABLE_ROW,					XML_TOK_TABLE_ROW			},
             { XML_NAMESPACE_TABLE,	XML_TABLE_SOURCE,				XML_TOK_TABLE_SOURCE		},
             { XML_NAMESPACE_TABLE,	XML_SCENARIO,					XML_TOK_TABLE_SCENARIO		},
+            { XML_NAMESPACE_TABLE,	XML_NAMED_EXPRESSIONS,			XML_TOK_TABLE_NAMED_EXPRESSIONS			},
             { XML_NAMESPACE_TABLE,	XML_SHAPES, 					XML_TOK_TABLE_SHAPES		},
             { XML_NAMESPACE_OFFICE,	XML_FORMS,						XML_TOK_TABLE_FORMS			},
             { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS,            XML_TOK_TABLE_EVENT_LISTENERS },
@@ -2732,7 +2733,7 @@ void ScXMLImport::SetNamedRanges()
         uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
         if (xPropertySet.is())
         {
-            uno::Reference <sheet::XNamedRanges> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NAMEDRANGES))), uno::UNO_QUERY);
+            uno::Reference <sheet::XNamedRanges2> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NAMEDRANGES))), uno::UNO_QUERY);
             if (xNamedRanges.is())
             {
                 ScMyNamedExpressions::iterator aItr(pNamedExpressions->begin());
@@ -2747,7 +2748,10 @@ void ScXMLImport::SetNamedRanges()
                     {
                         try
                         {
-                            xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
+                            //xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));//String::CreateFromInt32( (*aItr)->nNameScope)
+							String sTabName;
+							GetDocument()->GetName( (*aItr)->nNameScope, sTabName);
+							xNamedRanges->addNewByScopeName( sTabName, (*aItr)->sName, (*aItr)->sContent, aCellAddress, GetRangeType((*aItr)->sRangeType) );							
                         }
                         catch( uno::RuntimeException& )
                         {
@@ -2786,7 +2790,12 @@ void ScXMLImport::SetNamedRanges()
                     if (ScRangeStringConverter::GetAddressFromString(
                         aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
                     {
-                        uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY);
+						String sTableName;
+						GetDocument()->GetName( (*aItr)->nNameScope,  sTableName );
+						rtl::OUString sRangeScope( sTableName);
+                        //uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY);
+						//getByScopeName
+						uno::Reference <sheet::XNamedRange2> xNamedRange(xNamedRanges->getByScopeName( sRangeScope,(*aItr)->sName), uno::UNO_QUERY);
                         if (xNamedRange.is())
                         {
                             LockSolarMutex();

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlimprt.hxx Mon Sep 17 08:06:09 2012
@@ -171,6 +171,7 @@ enum ScXMLTableTokens
 	XML_TOK_TABLE_SCENARIO,
 	XML_TOK_TABLE_SHAPES,
     XML_TOK_TABLE_FORMS,
+    XML_TOK_TABLE_NAMED_EXPRESSIONS,
     XML_TOK_TABLE_EVENT_LISTENERS,
     XML_TOK_TABLE_EVENT_LISTENERS_EXT
 };
@@ -614,6 +615,7 @@ struct ScMyNamedExpression
     rtl::OUString      sRangeType;
     formula::FormulaGrammar::Grammar eGrammar;
     sal_Bool           bIsExpression;
+   SCTAB nNameScope;
 };
 
 typedef std::list<const ScMyNamedExpression*> ScMyNamedExpressions;

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.cxx Mon Sep 17 08:06:09 2012
@@ -49,7 +49,8 @@ ScXMLNamedExpressionsContext::ScXMLNamed
 									  const ::rtl::OUString& rLName,
 									  const ::com::sun::star::uno::Reference<
                                       ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ ) :
-	SvXMLImportContext( rImport, nPrfx, rLName )
+	SvXMLImportContext( rImport, nPrfx, rLName ),
+	nScopeOfNameRange( MAXTABCOUNT )	//aRangeNameScope( MAXTABCOUNT )
 {
 /*	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
 	for( sal_Int16 i=0; i < nAttrCount; ++i )
@@ -86,13 +87,13 @@ SvXMLImportContext *ScXMLNamedExpression
 	{
 	case XML_TOK_NAMED_EXPRESSIONS_NAMED_RANGE:
 		pContext = new ScXMLNamedRangeContext( GetScImport(), nPrefix,
-													  rLName, xAttrList//,
+													  rLName, xAttrList,nScopeOfNameRange//,
 													  //this
 													  );
 		break;
 	case XML_TOK_NAMED_EXPRESSIONS_NAMED_EXPRESSION:
 		pContext = new ScXMLNamedExpressionContext( GetScImport(), nPrefix,
-													  rLName, xAttrList//,
+													  rLName, xAttrList, nScopeOfNameRange//,
 													  //this
 													  );
 		break;
@@ -114,10 +115,11 @@ ScXMLNamedRangeContext::ScXMLNamedRangeC
 									  sal_uInt16 nPrfx,
 									  const ::rtl::OUString& rLName,
 									  const ::com::sun::star::uno::Reference<
-									  ::com::sun::star::xml::sax::XAttributeList>& xAttrList) :
+									  ::com::sun::star::xml::sax::XAttributeList>& xAttrList, SCTAB nScopeOfNameRange) :
 	SvXMLImportContext( rImport, nPrfx, rLName )
 {
 	ScMyNamedExpression* pNamedExpression(new ScMyNamedExpression);
+	pNamedExpression->nNameScope = nScopeOfNameRange;
     // A simple table:cell-range-address is not a formula expression, stored
     // without [] brackets but with dot, .A1
     pNamedExpression->eGrammar = formula::FormulaGrammar::mergeToGrammar(
@@ -185,10 +187,11 @@ ScXMLNamedExpressionContext::ScXMLNamedE
 									  sal_uInt16 nPrfx,
 									  const ::rtl::OUString& rLName,
 									  const ::com::sun::star::uno::Reference<
-									  ::com::sun::star::xml::sax::XAttributeList>& xAttrList) :
+									  ::com::sun::star::xml::sax::XAttributeList>& xAttrList, SCTAB nScopeOfNameRange) :
 	SvXMLImportContext( rImport, nPrfx, rLName )
 {
 	ScMyNamedExpression* pNamedExpression(new ScMyNamedExpression);
+	pNamedExpression->nNameScope = nScopeOfNameRange;
 	sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
 	const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetNamedExpressionAttrTokenMap());
 	for( sal_Int16 i=0; i < nAttrCount; ++i )

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmlnexpi.hxx Mon Sep 17 08:06:09 2012
@@ -25,6 +25,7 @@
 
 #include <xmloff/xmlictxt.hxx>
 #include <xmloff/xmlimp.hxx>
+#include "address.hxx"
 
 class ScXMLImport;
 
@@ -32,7 +33,7 @@ class ScXMLNamedExpressionsContext : pub
 {
 	const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
 	ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
-
+	SCTAB nScopeOfNameRange;
 public:
 
 	ScXMLNamedExpressionsContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
@@ -48,6 +49,9 @@ public:
 									  	::com::sun::star::xml::sax::XAttributeList>& xAttrList );
 
 	virtual void EndElement();
+	void SetScope( SCTAB n ){ nScopeOfNameRange = n;}
+	SCTAB GetScope(){ return nScopeOfNameRange;}
+		
 };
 
 class ScXMLNamedRangeContext : public SvXMLImportContext
@@ -60,7 +64,7 @@ public:
 	ScXMLNamedRangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
 						const ::rtl::OUString& rLName,
 						const ::com::sun::star::uno::Reference<
-										::com::sun::star::xml::sax::XAttributeList>& xAttrList);
+										::com::sun::star::xml::sax::XAttributeList>& xAttrList,SCTAB nScopeOfNameRange);
 
 	virtual ~ScXMLNamedRangeContext();
 
@@ -82,7 +86,7 @@ public:
 	ScXMLNamedExpressionContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
 						const ::rtl::OUString& rLName,
 						const ::com::sun::star::uno::Reference<
-										::com::sun::star::xml::sax::XAttributeList>& xAttrList);
+										::com::sun::star::xml::sax::XAttributeList>& xAttrList,SCTAB nScopeOfNameRange);
 
 	virtual ~ScXMLNamedExpressionContext();
 

Modified: incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmltabi.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmltabi.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmltabi.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/filter/xml/xmltabi.cxx Mon Sep 17 08:06:09 2012
@@ -44,6 +44,7 @@
 #include "rangeutl.hxx"
 #include "externalrefmgr.hxx"
 #include "sheetdata.hxx"
+#include "xmlnexpi.hxx"
 
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/nmspmap.hxx>
@@ -324,6 +325,13 @@ SvXMLImportContext *ScXMLTableContext::C
 			pContext = GetScImport().GetFormImport()->createOfficeFormsContext( GetScImport(), nPrefix, rLName );
 		}
 		break;
+	case XML_TOK_TABLE_NAMED_EXPRESSIONS:
+		{
+			SCTAB nCurrentSheet = static_cast<SCTAB>(GetScImport().GetTables().GetCurrentSheet());
+			pContext = new ScXMLNamedExpressionsContext ( GetScImport(), nPrefix, rLName, xAttrList );//worksheetname
+			static_cast<ScXMLNamedExpressionsContext*>(pContext)->SetScope( nCurrentSheet );
+		}
+		break;
     case XML_TOK_TABLE_EVENT_LISTENERS:
     case XML_TOK_TABLE_EVENT_LISTENERS_EXT:
         {

Modified: incubator/ooo/branches/writer001/main/sc/source/ui/formdlg/dwfunctr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/formdlg/dwfunctr.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/formdlg/dwfunctr.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/formdlg/dwfunctr.cxx Mon Sep 17 08:06:09 2012
@@ -912,10 +912,16 @@ void ScFunctionDockWin::DoEnter(sal_Bool
 				aFirstArgStr.EraseLeadingAndTrailingChars();
                 aFirstArgStr.SearchAndReplaceAll(' ', '_');
 				aArgStr = aFirstArgStr;
-				if ( nArgs != VAR_ARGS )
+				if ( nArgs != VAR_ARGS && nArgs != PAIRED_VAR_ARGS )
 				{	// no VarArgs or Fix plus VarArgs, but not VarArgs only
 					String aArgSep = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "; " ));
-					sal_uInt16 nFix = ( nArgs < VAR_ARGS ? nArgs : nArgs - VAR_ARGS + 1 );
+					sal_uInt16 nFix;
+					if (nArgs >= PAIRED_VAR_ARGS)
+					    nFix = nArgs - PAIRED_VAR_ARGS + 2;
+					else if (nArgs >= VAR_ARGS)
+					    nFix = nArgs - VAR_ARGS + 1;
+					else
+					    nFix = nArgs;
 					for ( sal_uInt16 nArg = 1;
 							nArg < nFix && !pDesc->pDefArgFlags[nArg].bOptional; nArg++ )
 					{

Modified: incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hrc
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hrc?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hrc (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hrc Mon Sep 17 08:06:09 2012
@@ -33,6 +33,7 @@
 #define FL_NAME         11
 #define ED_NAME			12
 #define FL_ASSIGN       13
+#define LB_NAMES        14
 #define ED_ASSIGN		15
 #define RB_ASSIGN		16
 //

Modified: incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/inc/namedlg.hxx Mon Sep 17 08:06:09 2012
@@ -34,6 +34,8 @@
 #include <vcl/group.hxx>
 #endif
 #include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/edit.hxx>
 #include "rangenam.hxx"
 #include "anyrefdg.hxx"
 
@@ -47,7 +49,9 @@ class ScNameDlg : public ScAnyRefDlg
 {
 private:
     FixedLine       aFlName;
-	ComboBox		aEdName;
+	//ComboBox		aEdName;
+	Edit                       aEdName;
+	ListBox     aLBNames;
 
     FixedLine       aFlAssign;
 	formula::RefEdit		aEdAssign;
@@ -76,6 +80,7 @@ private:
 	ScRangeName		aLocalRangeName;
 	const ScAddress	theCursorPos;
 	Selection		theCurSel;
+	SCTAB           aSelectedRangeScope;
 
 #ifdef _NAMEDLG_CXX
 private:

Modified: incubator/ooo/branches/writer001/main/sc/source/ui/namedlg/namedlg.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/namedlg/namedlg.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/namedlg/namedlg.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/namedlg/namedlg.cxx Mon Sep 17 08:06:09 2012
@@ -54,6 +54,7 @@
 #define ABS_SREF3D		ABS_SREF | SCA_TAB_3D
 #define ABS_DREF3D		ABS_DREF | SCA_TAB_3D
 
+const sal_uInt16  SHEETNAMEPOS = 33;
 
 //============================================================================
 // Hilfsklasse: Merken der aktuellen Bereichsoptionen,
@@ -119,6 +120,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, S
 		//
         aFlName         ( this, ScResId( FL_NAME ) ),
 		aEdName 		( this, ScResId( ED_NAME ) ),
+		aLBNames 		( this, ScResId( LB_NAMES ) ),
 		//
         aFlAssign       ( this, ScResId( FL_ASSIGN ) ),
         aEdAssign       ( this, this, ScResId( ED_ASSIGN ) ),
@@ -145,7 +147,8 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, S
 		pViewData		( ptrViewData ),
 		pDoc			( ptrViewData->GetDocument() ),
 		aLocalRangeName ( *(pDoc->GetRangeName()) ),
-		theCursorPos	( aCursorPos )  // zum Berechnen der Referenzen
+		theCursorPos	( aCursorPos ),  // zum Berechnen der Referenzen
+		aSelectedRangeScope(MAXTABCOUNT)
 {
 	pSaveObj = new SaveData;
 	Init();
@@ -179,7 +182,7 @@ void __EXPORT ScNameDlg::Init()
 	aEdAssign.SetGetFocusHdl( LINK( this, ScNameDlg, AssignGetFocusHdl ) );
 	aEdAssign.SetModifyHdl	( LINK( this, ScNameDlg, EdModifyHdl ) );
 	aEdName.SetModifyHdl 	( LINK( this, ScNameDlg, EdModifyHdl ) );
-	aEdName.SetSelectHdl 	( LINK( this, ScNameDlg, NameSelectHdl ) );
+	aLBNames.SetSelectHdl 	( LINK( this, ScNameDlg, NameSelectHdl ) );
 
 	aBtnCriteria .Hide();
 	aBtnPrintArea.Hide();
@@ -206,7 +209,8 @@ void __EXPORT ScNameDlg::Init()
 
 	aBtnAdd.Disable();
 	aBtnRemove.Disable();
-	if ( aEdName.GetEntryCount() > 0 )
+	//if ( aEdName.GetEntryCount() > 0 )
+	if ( aLBNames.GetEntryCount() > 0 )
 		aBtnAdd.SetText( aStrAdd );
 	UpdateChecks();
 	EdModifyHdl( 0 );
@@ -270,7 +274,7 @@ void __EXPORT ScNameDlg::UpdateChecks()
 {
 	sal_uInt16		 nCurPos=0;
 
-	if(aLocalRangeName.SearchName( aEdName.GetText(), nCurPos))
+	if(aLocalRangeName.SearchName( aEdName.GetText(), nCurPos, aSelectedRangeScope))
 	{
 		ScRangeData* pData=(ScRangeData*)(aLocalRangeName.At( nCurPos ));
 		aBtnCriteria .Check( pData->HasType( RT_CRITERIA ) );
@@ -285,26 +289,26 @@ void __EXPORT ScNameDlg::UpdateChecks()
 	{
 		if ( !aFlType.IsEnabled() )
 		{
-			aFlType 	 .Enable();
+			aFlType.Enable();
 			aBtnCriteria .Enable();
 			aBtnPrintArea.Enable();
 			aBtnColHeader.Enable();
 			aBtnRowHeader.Enable();
-            aFlAssign    .Enable();
-			aEdAssign    .Enable();
-			aRbAssign    .Enable();
+                        aFlAssign.Enable();
+			aEdAssign.Enable();
+			aRbAssign.Enable();
 		}
 	}
 	else if ( aFlType.IsEnabled() )
 	{
-		aFlType 	 .Disable();
-		aBtnCriteria .Disable();
+		aFlType.Disable();
+		aBtnCriteria.Disable();
 		aBtnPrintArea.Disable();
 		aBtnColHeader.Disable();
 		aBtnRowHeader.Disable();
-        aFlAssign    .Disable();
-		aEdAssign    .Disable();
-		aRbAssign    .Disable();
+                aFlAssign.Disable();
+		aEdAssign.Disable();
+		aRbAssign.Disable();
 	}
 }
 
@@ -315,10 +319,13 @@ void __EXPORT ScNameDlg::UpdateNames()
 {
 	sal_uInt16	nRangeCount = aLocalRangeName.GetCount();
 
-	aEdName.SetUpdateMode( sal_False );
+	//aEdName.SetUpdateMode( FALSE );
+	aLBNames.SetUpdateMode( false );
 	//-----------------------------------------------------------
-	sal_uInt16  nNamePos = aEdName.GetTopEntry();
-	aEdName.Clear();
+	//USHORT  nNamePos = aEdName.GetTopEntry();
+	//aEdName.Clear();
+	sal_uInt16  nNamePos = aLBNames.GetTopEntry();
+	aLBNames.Clear();
 
 	aEdAssign.SetText( EMPTY_STRING );
 
@@ -326,6 +333,7 @@ void __EXPORT ScNameDlg::UpdateNames()
 	{
 		ScRangeData*	pRangeData = NULL;
 		String			aString;
+                SCTAB tabIndex = 0;
 
 		for ( sal_uInt16 i=0; i<nRangeCount; i++ )
 		{
@@ -336,7 +344,21 @@ void __EXPORT ScNameDlg::UpdateNames()
 					&& !pRangeData->HasType( RT_SHARED ) )
 				{
 					pRangeData->GetName( aString );
-					aEdName.InsertEntry( aString );
+					if ( (tabIndex = pRangeData->GetRangeScope() ) != MAXTABCOUNT)
+					{
+                                                 String tabName;
+							pDoc->GetName(tabIndex,tabName);
+							if (aString.Len() < SHEETNAMEPOS)
+								aString.Expand(SHEETNAMEPOS);
+							else
+								aString.AppendAscii( " ");
+							aString.AppendAscii( "(");
+							aString += tabName;
+							aString.AppendAscii( ")"); 
+					}
+					
+					//aEdName.InsertEntry( aString );
+                                   aLBNames.InsertEntry( aString );
 				}
 			}
 		}
@@ -348,9 +370,12 @@ void __EXPORT ScNameDlg::UpdateNames()
 		aBtnRemove.Disable();
 	}
 	//-----------------------------------------------------------
-	aEdName.SetUpdateMode( sal_True );
-	aEdName.SetTopEntry(nNamePos);
-	aEdName.Invalidate();
+	//aEdName.SetUpdateMode( TRUE );
+	//aEdName.SetTopEntry(nNamePos);
+	//aEdName.Invalidate();
+	aLBNames.SetUpdateMode( true );
+	aLBNames.SetTopEntry(nNamePos);
+	aLBNames.Invalidate();	
 }
 
 
@@ -409,7 +434,8 @@ IMPL_LINK( ScNameDlg, AddBtnHdl, void *,
 {
 	sal_Bool	bAdded	  = sal_False;
 	String	aNewEntry = aEdName.GetText();
-	sal_uInt16  nNamePos = aEdName.GetTopEntry();
+	//USHORT  nNamePos = aEdName.GetTopEntry();
+        sal_uInt16  nNamePos = aLBNames.GetTopEntry();
 	aNewEntry.EraseLeadingChars( ' ' );
 	aNewEntry.EraseTrailingChars( ' ' );
 
@@ -431,6 +457,10 @@ IMPL_LINK( ScNameDlg, AddBtnHdl, void *,
 											 theSymbol,
 											 theCursorPos,
 											 nType );
+				if (aBtnAdd.GetText() == aStrModify)
+					pNewEntry->SetRangeScope(aSelectedRangeScope); 
+				else
+					aSelectedRangeScope = MAXTABCOUNT;
 				if (pNewEntry)
 				{
 					nType = nType
@@ -447,7 +477,7 @@ IMPL_LINK( ScNameDlg, AddBtnHdl, void *,
 				if ( 0 == pNewEntry->GetErrCode() )
 				{
 					// Eintrag bereits vorhanden? Dann vorher entfernen (=Aendern)
-					if ( aLocalRangeName.SearchName( aNewEntry, nFoundAt ) )
+					if ( aLocalRangeName.SearchName( aNewEntry, nFoundAt, aSelectedRangeScope ) )
 					{									// alten Index uebernehmen
 						pNewEntry->SetIndex(
 							((ScRangeData*)(aLocalRangeName.At(nFoundAt)))->GetIndex() );
@@ -491,7 +521,8 @@ IMPL_LINK( ScNameDlg, AddBtnHdl, void *,
 		}
 	}
 
-    aEdName.SetTopEntry(nNamePos);
+    //aEdName.SetTopEntry(nNamePos);
+	aLBNames.SetTopEntry(nNamePos);
 	return bAdded;
 }
 
@@ -503,7 +534,7 @@ IMPL_LINK( ScNameDlg, RemoveBtnHdl, void
 	sal_uInt16		 nRemoveAt = 0;
 	const String aStrEntry = aEdName.GetText();
 
-	if ( aLocalRangeName.SearchName( aStrEntry, nRemoveAt ) )
+	if ( aLocalRangeName.SearchName( aStrEntry, nRemoveAt, aSelectedRangeScope ) )
 	{
 		String aStrDelMsg = ScGlobal::GetRscString( STR_QUERY_DELENTRY );
 		String aMsg		  = aStrDelMsg.GetToken( 0, '#' );
@@ -520,6 +551,7 @@ IMPL_LINK( ScNameDlg, RemoveBtnHdl, void
 			bSaved=sal_False;
 			RESTORE_DATA()
 			theCurSel = Selection( 0, SELECTION_MAX );
+			aEdName.SetText(EMPTY_STRING);
 			aBtnAdd.SetText( aStrAdd );
 			aBtnAdd.Disable();
 			aBtnRemove.Disable();
@@ -534,8 +566,21 @@ IMPL_LINK( ScNameDlg, RemoveBtnHdl, void
 IMPL_LINK( ScNameDlg, NameSelectHdl, void *, EMPTYARG )
 {
 	sal_uInt16 nAtPos;
+       String rangeName = aLBNames.GetSelectEntry();
+       if ( ')' == rangeName.GetChar(rangeName.Len()-1) )
+       {
+            xub_StrLen sheetNamePos = rangeName.Search('(');
+	     String sheetName(rangeName, sheetNamePos+1, rangeName.Len()-2-sheetNamePos);
+            pDoc->GetTable(sheetName,aSelectedRangeScope);
+	     rangeName.Erase(sheetNamePos);
+	     rangeName.EraseTrailingChars();
+            
+	}
+	else   
+           aSelectedRangeScope = MAXTABCOUNT;
 
-	if ( aLocalRangeName.SearchName( aEdName.GetText(), nAtPos ) )
+	//if ( aLocalRangeName.SearchName( aEdName.GetText(), nAtPos ) )	
+	if ( aLocalRangeName.SearchName( rangeName, nAtPos, aSelectedRangeScope ) )
 	{
 		String		 aSymbol;
 		ScRangeData* pData	= (ScRangeData*)(aLocalRangeName.At( nAtPos ));
@@ -544,9 +589,13 @@ IMPL_LINK( ScNameDlg, NameSelectHdl, voi
 		{
 			pData->GetSymbol( aSymbol );
 			CalcCurTableAssign( aSymbol, nAtPos );
-			aEdAssign.SetText( aSymbol );
+	   		aEdAssign.SetText( aSymbol );
 			aBtnAdd.SetText( aStrModify );
+			aEdName.SetText(rangeName);
 			theCurSel = Selection( 0, SELECTION_MAX );
+			aBtnAdd.SetText( aStrModify );
+			aBtnAdd.Enable();
+			aBtnRemove.Enable();
 		}
 	}
 	UpdateChecks();
@@ -560,8 +609,8 @@ IMPL_LINK( ScNameDlg, EdModifyHdl, Edit 
 {
 	String	theName 	= aEdName.GetText();
 	String	theSymbol	= aEdAssign.GetText();
-	sal_Bool	bNameFound	= (COMBOBOX_ENTRY_NOTFOUND
-						   != aEdName.GetEntryPos( theName ));
+ bool	bNameFound	= (LISTBOX_ENTRY_NOTFOUND
+						   != aLBNames.GetEntryPos( theName ));
 
 	if ( pEd == &aEdName )
 	{
@@ -579,6 +628,7 @@ IMPL_LINK( ScNameDlg, EdModifyHdl, Edit 
 		}
 		else
 		{
+		 /*      
 			if ( bNameFound )
 			{
 				if ( aBtnAdd.GetText() != aStrModify )
@@ -588,7 +638,7 @@ IMPL_LINK( ScNameDlg, EdModifyHdl, Edit 
 
 				if(!bSaved)
 				{
-					bSaved=sal_True;
+					bSaved=TRUE;
 					SAVE_DATA()
 				}
 				NameSelectHdl( 0 );
@@ -599,9 +649,13 @@ IMPL_LINK( ScNameDlg, EdModifyHdl, Edit 
 					aBtnAdd.SetText( aStrAdd );
 				aBtnRemove.Disable();
 
-				bSaved=sal_False;
+				bSaved=FALSE;
 				RESTORE_DATA()
 			}
+			*/
+
+		       if ( aBtnAdd.GetText() != aStrAdd )
+			    aBtnAdd.SetText( aStrAdd );
 			theSymbol = aEdAssign.GetText();
 
 			if ( theSymbol.Len() > 0 )
@@ -612,6 +666,7 @@ IMPL_LINK( ScNameDlg, EdModifyHdl, Edit 
             aFlAssign.Enable();
 			aEdAssign.Enable();
 			aRbAssign.Enable();
+			aBtnRemove.Disable();
 			//@BugID 54702 raus mit dem Sch.
 			//SFX_APPWINDOW->Enable();
 		}

Modified: incubator/ooo/branches/writer001/main/sc/source/ui/src/namedlg.src
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/src/namedlg.src?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/src/namedlg.src (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/src/namedlg.src Mon Sep 17 08:06:09 2012
@@ -75,15 +75,33 @@ ModelessDialog RID_SCDLG_NAMES
 		Size = MAP_APPFONT ( 154 , 8 ) ;
 		Text [ en-US ] = "Name" ;
 	};
+/*	
 	ComboBox ED_NAME
 	{
-	    HelpID = "sc:ComboBox:RID_SCDLG_NAMES:ED_NAME";
         Pos = MAP_APPFONT ( 12 , 14 ) ;
         Size = MAP_APPFONT ( 145 , 92 ) ;
 		TabStop = TRUE ;
 		VScroll = TRUE ;
 		Sort = TRUE ;
 	};
+*/
+        Edit ED_NAME
+	{
+	Border = TRUE ;
+        Pos = MAP_APPFONT ( 12 , 14 ) ;
+        Size = MAP_APPFONT ( 145 , 11 ) ;
+	};
+	
+	ListBox LB_NAMES
+	{
+	Border = TRUE ;
+        Pos = MAP_APPFONT ( 12 , 25 ) ;
+		Size = MAP_APPFONT ( 145 , 84 ) ;
+		TabStop = TRUE ;
+		VScroll = TRUE ;
+		AutoHScroll = TRUE ;
+		Sort = TRUE ;
+	};
     FixedLine FL_ASSIGN
 	{
         Pos = MAP_APPFONT ( 6 , 112 ) ;

Modified: incubator/ooo/branches/writer001/main/sc/source/ui/src/scfuncs.src
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/ui/src/scfuncs.src?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/ui/src/scfuncs.src (original)
+++ incubator/ooo/branches/writer001/main/sc/source/ui/src/scfuncs.src Mon Sep 17 08:06:09 2012
@@ -47,7 +47,9 @@
  *
  *          Number of parameters. VAR_ARGS if variable number, or
  *          VAR_ARGS+number if number of fixed parameters and variable
- *          arguments following.
+ *          arguments following. Or PAIRED_VAR_ARGS if variable number of
+ *          paired parameters, or PAIRED_VAR_ARGS+number if number of fixed
+ *          parameters and variable paired arguments following.
  *
  *          For every parameter:
  *
@@ -2656,7 +2658,32 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
 			Text [ en-US ] = "Logical value 1, logical value 2;...are 1 to 30 conditions to be tested and each returns either TRUE or FALSE." ;
 		};
 	};
-	 // -=*# Resource for function ABS #*=-
+
+	// -=*# Resource for function XOR #*=-
+	Resource SC_OPCODE_XOR
+	{
+		String 1 // Description
+		{
+			Text [ en-US ] = "Returns TRUE if exactly one of the arguments is TRUE." ;
+		};
+		ExtraData =
+		{
+            0;
+			ID_FUNCTION_GRP_LOGIC;
+			U2S( HID_FUNC_XOR );
+			VAR_ARGS;	0;
+            0;
+		};
+		String 2 // Name of Parameter 1
+		{
+			Text [ en-US ] = "Logical value " ;
+		};
+		String 3 // Description of Parameter 1
+		{
+			Text [ en-US ] = "Logical value 1, logical value 2,... are 1 to 30 conditions to be tested and which return either TRUE or FALSE." ;
+		};
+	};
+     // -=*# Resource for function ABS #*=-
 	Resource SC_OPCODE_ABS
 	{
 		String 1 // Description
@@ -2864,6 +2891,162 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
 			Text [ en-US ] = "The range from which the values are to be totalled." ;
 		};
 	};
+
+	// -=*# Resource for function AVERAGEIF #*=-
+	Resource SC_OPCODE_AVERAGE_IF
+	{
+		String 1 // Description
+		{
+			Text [ en-US ] = "Averages the arguments that meet the conditions." ;
+		};
+		ExtraData =
+		{
+            0;
+			ID_FUNCTION_GRP_MATH;
+			U2S( HID_FUNC_AVERAGEIF );
+			3;	0;	0;	1;
+            0;
+		};
+		String 2 // Name of Parameter 1
+		{
+			Text [ en-US ] = "range" ;
+		};
+		String 3 // Description of Parameter 1
+		{
+			Text [ en-US ] = "The range to be evaluated by the criteria given." ;
+		};
+		String 4 // Name of Parameter 2
+		{
+			Text [ en-US ] = "criteria" ;
+		};
+		String 5 // Description of Parameter 2
+		{
+			Text [ en-US ] = "The cell range in which the search criteria are given." ;
+		};
+		String 6 // Name of Parameter 3
+		{
+			Text [ en-US ] = "average_range" ;
+		};
+		String 7 // Description of Parameter 3
+		{
+			Text [ en-US ] = "The range from which the values are to be averaged." ;
+		};
+	};
+
+	Resource SC_OPCODE_SUM_IFS
+	{
+		String 1 // Description
+		{
+			Text [ en-US ] = "Totals the values of cells in a range that meet multiple criteria in multiple ranges." ;
+		};
+		ExtraData =
+		{
+            0;
+			ID_FUNCTION_GRP_MATH;
+			U2S( HID_FUNC_SUMIFS );
+			PAIRED_VAR_ARGS+1;	0;	0;	0;
+            0;
+		};
+		String 2 // Name of Parameter 1
+		{
+			Text [ en-US ] = "sum_range" ;
+		};
+		String 3 // Description of Parameter 1
+		{
+			Text [ en-US ] = "The range from which the values are to be totalled." ;
+		};
+		String 4 // Name of Parameter 2
+		{
+			Text [ en-US ] = "range " ;
+		};
+		String 5 // Description of Parameter 2
+		{
+			Text [ en-US ] = "Range 1, range 2,... are the ranges to be evaluated by the criteria given." ;
+		};
+		String 6 // Name of Parameter 3
+		{
+			Text [ en-US ] = "criteria " ;
+		};
+		String 7 // Description of Parameter 3
+		{
+			Text [ en-US ] = "Criteria 1, criteria 2,... are the cell ranges in which the search criteria are given." ;
+		};
+	};
+
+	// -=*# Resource for function AVERAGEIFS #*=-
+	Resource SC_OPCODE_AVERAGE_IFS
+	{
+		String 1 // Description
+		{
+			Text [ en-US ] = "Averages the value of the cells that meet multiple criteria in multiple ranges." ;
+		};
+		ExtraData =
+		{
+            0;
+			ID_FUNCTION_GRP_MATH;
+			U2S( HID_FUNC_AVERAGEIFS );
+			PAIRED_VAR_ARGS+1;	0;	0;	0;
+            0;
+		};
+		String 2 // Name of Parameter 1
+		{
+			Text [ en-US ] = "average_range" ;
+		};
+		String 3 // Description of Parameter 1
+		{
+			Text [ en-US ] = "The range from which the values are to be averaged." ;
+		};
+		String 4 // Name of Parameter 2
+		{
+			Text [ en-US ] = "range " ;
+		};
+		String 5 // Description of Parameter 2
+		{
+			Text [ en-US ] = "Range 1, range 2,... are the ranges to be evaluated by the criteria given." ;
+		};
+		String 6 // Name of Parameter 3
+		{
+			Text [ en-US ] = "criteria " ;
+		};
+		String 7 // Description of Parameter 3
+		{
+			Text [ en-US ] = "Criteria 1, criteria 2,... are the cell ranges in which the search criteria are given." ;
+		};
+	};
+
+	// -=*# Resource for function COUNTIFS #*=-
+	Resource SC_OPCODE_COUNT_IFS
+	{
+		String 1 // Description
+		{
+			Text [ en-US ] = "Counts the cells that meet multiple criteria in multiple ranges." ;
+		};
+		ExtraData =
+		{
+            0;
+			ID_FUNCTION_GRP_MATH;
+			U2S( HID_FUNC_COUNTIFS );
+			PAIRED_VAR_ARGS;	0;	0;
+            0;
+		};
+		String 2 // Name of Parameter 1
+		{
+			Text [ en-US ] = "range " ;
+		};
+		String 3 // Description of Parameter 1
+		{
+			Text [ en-US ] = "Range 1, range 2,... are the ranges to be evaluated by the criteria given." ;
+		};
+		String 4 // Name of Parameter 2
+		{
+			Text [ en-US ] = "criteria " ;
+		};
+		String 5 // Description of Parameter 2
+		{
+			Text [ en-US ] = "Criteria 1, criteria 2,... are the cell ranges in which the search criteria are given." ;
+		};
+	};
+
 	 // -=*# Resource for function ZÄHLENWENN #*=-
 	Resource SC_OPCODE_COUNT_IF
 	{



Mime
View raw message