openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1526954 [28/34] - in /openoffice/branches/l10n40: ./ ext_sources/ extras/l10n/source/ast/ extras/l10n/source/cs/ extras/l10n/source/de/ extras/l10n/source/el/ extras/l10n/source/en-GB/ extras/l10n/source/es/ extras/l10n/source/eu/ extras/l...
Date Fri, 27 Sep 2013 15:26:50 GMT
Modified: openoffice/branches/l10n40/main/sc/inc/dbcolect.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/inc/dbcolect.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/inc/dbcolect.hxx (original)
+++ openoffice/branches/l10n40/main/sc/inc/dbcolect.hxx Fri Sep 27 15:26:24 2013
@@ -136,9 +136,11 @@ 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);
+
+            bool IsInternalUnnamed() const;
+            bool IsInternalForAutoFilter() const;
+
+            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; }
 			sal_Bool		HasHeader() const 				{ return bHasHeader; }
@@ -216,9 +218,13 @@ public:
 	virtual	short		Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
 	virtual	sal_Bool		IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const;
 			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* GetDBAtArea(
+                const SCTAB nTab,
+                const SCCOL nCol1,
+                const SCROW nRow1,
+                const SCCOL nCol2,
+                const 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;
 

Modified: openoffice/branches/l10n40/main/sc/inc/document.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/inc/document.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/inc/document.hxx (original)
+++ openoffice/branches/l10n40/main/sc/inc/document.hxx Fri Sep 27 15:26:24 2013
@@ -505,10 +505,7 @@ public:
 										sal_Bool bStartOnly = sal_False) const;
 	ScDBData*		GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
     ScDBData*       GetFilterDBAtTable(SCTAB nTab) const;
-//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;
@@ -1514,7 +1511,10 @@ public:
 								TypedScStrCollection& rStrings, sal_Bool bLimit = sal_False );
 	sal_Bool			GetFormulaEntries( TypedScStrCollection& rStrings );
 
-	sal_Bool			HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
+	sal_Bool			HasAutoFilter(
+        const SCCOL nCol,
+        const SCROW nRow,
+        const SCTAB nTab );
 
 	SC_DLLPUBLIC sal_Bool			HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
 									SCTAB nTab );

Modified: openoffice/branches/l10n40/main/sc/inc/global.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/inc/global.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/inc/global.hxx (original)
+++ openoffice/branches/l10n40/main/sc/inc/global.hxx Fri Sep 27 15:26:24 2013
@@ -404,13 +404,10 @@ enum ScAnchorType 					// Verankerung ei
 
 enum ScGetDBMode
 {
-	SC_DB_MAKE,		// wenn noetig, "unbenannt" anlegen
-	SC_DB_IMPORT,	// wenn noetig, "Importx" 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
+    SC_DB_MAKE,             // if needed create database range with name $STR_DB_NONAME
+    SC_DB_IMPORT,           // if needed create database range with name $STR_DBNAME_IMPORT[X]
+    SC_DB_OLD,              // do not create new database range, provide only existing one
+    SC_DB_MAKE_AUTOFILTER   // if needed create database range with name $SC_DBNAME_UNNAMED[X]
 };
 
 /// For ScDBFunc::GetDBData()

Modified: openoffice/branches/l10n40/main/sc/inc/patattr.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/inc/patattr.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/inc/patattr.hxx (original)
+++ openoffice/branches/l10n40/main/sc/inc/patattr.hxx Fri Sep 27 15:26:24 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_SCPATATR_HXX
 #define SC_SCPATATR_HXX
 
@@ -38,7 +36,6 @@ class ScStyleSheet;
 class SvNumberFormatter;
 class ScDocument;
 
-
 //	how to treat COL_AUTO in GetFont:
 
 enum ScAutoFontColorMode
@@ -125,6 +122,7 @@ public:
 
 	sal_Bool					IsVisible() const;
 	sal_Bool					IsVisibleEqual( const ScPatternAttr& rOther ) const;
+	sal_Bool					IsEqual( const ScPatternAttr& rOther ) const;
 
                             /** If font is an old symbol font StarBats/StarMath
                                 with text encoding RTL_TEXTENC_SYMBOL */

Modified: openoffice/branches/l10n40/main/sc/inc/rangeutl.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/inc/rangeutl.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/inc/rangeutl.hxx (original)
+++ openoffice/branches/l10n40/main/sc/inc/rangeutl.hxx Fri Sep 27 15:26:24 2013
@@ -302,7 +302,6 @@ private:
 	ScDBCollection*	pDBCollection;
 	sal_Bool			bFirstPass;
 	sal_uInt16			nPos;
-	String			aStrNoName;
 
 public:
 			ScAreaNameIterator( ScDocument* pDoc );

Modified: openoffice/branches/l10n40/main/sc/source/core/data/attarray.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/core/data/attarray.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/core/data/attarray.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/core/data/attarray.cxx Fri Sep 27 15:26:24 2013
@@ -1927,21 +1927,38 @@ sal_Bool ScAttrArray::GetLastAttr( SCROW
         rLastRow = MAXROW;
         return sal_True;
     }
-	sal_Bool bFound = sal_False;
-    SCSIZE nEndPos = nCount - 1;
-    SCSIZE nStartPos = nEndPos;
-    while ( nStartPos > 0 && pData[nStartPos-1].nRow > nLastData &&
-            !pData[nStartPos].pPattern->IsVisible() )
-        --nStartPos;
-	if(nStartPos == 0 && !pData[nStartPos].pPattern->IsVisible()) // add this condition for handle only default pattern in one colume
-		rLastRow = nLastData;
-	else if(nStartPos >= 0 && pData[nStartPos].nRow > nLastData)
-	{
-		bFound = sal_True;
-		rLastRow = pData[nStartPos].nRow;
-	}
-	else
-		rLastRow = nLastData;
+
+    sal_Bool bFound = sal_False;
+
+    // Loop backwards from the end instead of using Search, assuming that
+    // there usually aren't many attributes below the last cell.
+    SCSIZE nPos = nCount;
+    while ( nPos > 0 && pData[nPos - 1].nRow > nLastData )
+    {
+        SCSIZE nEndPos = nPos - 1;
+        SCSIZE nStartPos = nEndPos;
+        while ( nStartPos > 0 && pData[nStartPos - 1].nRow > nLastData &&
+                pData[nStartPos - 1].pPattern->IsEqual( *pData[nStartPos].pPattern ) )
+            --nStartPos;
+
+        SCROW nAttrStartRow = ( nStartPos > 0 ) ? ( pData[nStartPos - 1].nRow + 1 ) : 0;
+        if ( nAttrStartRow <= nLastData )
+            nAttrStartRow = nLastData + 1;
+        SCROW nAttrSize = pData[nEndPos].nRow + 1 - nAttrStartRow;
+        if ( nAttrSize >= SC_VISATTR_STOP )
+        {
+            bFound = sal_False;
+        }
+        else if ( !bFound )
+        {
+            rLastRow = pData[nEndPos].nRow;
+            bFound = sal_True;
+        }
+
+        // look further from the top of the range.
+        nPos = nStartPos;
+    }
+
     return bFound;
 }
 

Modified: openoffice/branches/l10n40/main/sc/source/core/data/documen3.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/core/data/documen3.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/core/data/documen3.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/core/data/documen3.cxx Fri Sep 27 15:26:24 2013
@@ -192,13 +192,6 @@ 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
 {
@@ -1296,10 +1289,12 @@ sal_Bool ScDocument::CreateQueryParam(SC
 	return sal_False;
 }
 
-sal_Bool ScDocument::HasAutoFilter( SCCOL /*nCurCol*/, SCROW /*nCurRow*/, SCTAB nCurTab )
+sal_Bool ScDocument::HasAutoFilter(
+    const SCCOL nCurCol,
+    const SCROW nCurRow,
+    const SCTAB nCurTab )
 {
-	//ScDBData*		pDBData			= GetDBAtCursor( nCurCol, nCurRow, nCurTab );
-	ScDBData*		pDBData			= GetDBAtTable(nCurTab, SC_DB_OLD_FILTER);
+	ScDBData*		pDBData			= GetDBAtCursor( nCurCol, nCurRow, nCurTab );
 	sal_Bool			bHasAutoFilter	= ( pDBData != NULL );
 
 	if ( pDBData )

Modified: openoffice/branches/l10n40/main/sc/source/core/data/patattr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/core/data/patattr.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/core/data/patattr.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/core/data/patattr.cxx Fri Sep 27 15:26:24 2013
@@ -1144,6 +1144,19 @@ sal_Bool ScPatternAttr::IsVisibleEqual( 
 	//!		auch hier nur wirklich sichtbare Werte testen !!!
 }
 
+sal_Bool ScPatternAttr::IsEqual( const ScPatternAttr& rOther ) const
+{
+	const SfxItemSet& rThisSet = GetItemSet();
+	const SfxItemSet& rOtherSet = rOther.GetItemSet();
+
+	return OneEqual( rThisSet, rOtherSet, ATTR_BACKGROUND ) &&
+			OneEqual( rThisSet, rOtherSet, ATTR_BORDER ) &&
+			OneEqual( rThisSet, rOtherSet, ATTR_BORDER_TLBR ) &&
+			OneEqual( rThisSet, rOtherSet, ATTR_BORDER_BLTR ) &&
+			OneEqual( rThisSet, rOtherSet, ATTR_VALUE_FORMAT ) &&
+			OneEqual( rThisSet, rOtherSet, ATTR_SHADOW );
+}
+
 const String* ScPatternAttr::GetStyleName() const
 {
 	return pName ? pName : ( pStyle ? &pStyle->GetName() : NULL );

Modified: openoffice/branches/l10n40/main/sc/source/core/tool/cellform.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/core/tool/cellform.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/core/tool/cellform.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/core/tool/cellform.cxx Fri Sep 27 15:26:24 2013
@@ -28,6 +28,7 @@
 #include <sfx2/objsh.hxx>
 #include <svl/smplhint.hxx>
 #include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
 
 #include "cellform.hxx"
 #include "cell.hxx"
@@ -129,7 +130,9 @@ void ScCellFormat::GetString( ScBaseCell
                             rString.Erase();
 						else if ( pFCell->IsValue() )
 						{
-							if(pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL)
+                            const SvNumberformat* pNumFmt = rFormatter.GetEntry( nFormat );
+                            const bool bHasTextFormatCode = pNumFmt != NULL && pNumFmt->HasTextFormatCode();
+                            if( pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL && bHasTextFormatCode )
 							{
 								String aCellString;
 								double fValue = pFCell->GetValue();

Modified: openoffice/branches/l10n40/main/sc/source/core/tool/dbcolect.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/core/tool/dbcolect.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/core/tool/dbcolect.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/core/tool/dbcolect.cxx Fri Sep 27 15:26:24 2013
@@ -691,11 +691,18 @@ ScDataObject*	ScDBData::Clone() const
 {
 	return new ScDBData(*this);
 }
-sal_Bool    ScDBData::IsBuildin()
+
+
+bool ScDBData::IsInternalUnnamed() const
 {
-    String  aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED);
-    String  aBeginName = aName.Copy(0,22);
-    return  (sal_Bool)(!ScGlobal::GetpTransliteration()->compareString( aNoName, aBeginName ));
+    return GetName() == ScGlobal::GetRscString( STR_DB_NONAME );
+}
+
+bool ScDBData::IsInternalForAutoFilter() const
+{
+    const String aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED);
+    const String aBeginName = aName.Copy( 0, aNoName.Len() );
+    return aBeginName == aNoName;
 }
 
 //---------------------------------------------------------------------------------------
@@ -717,40 +724,50 @@ sal_Bool ScDBCollection::IsEqual(ScDataO
 
 ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const
 {
-	ScDBData* pNoNameData = NULL;
-	if (pItems)
-	{
+    ScDBData* pInternalDBData = NULL;
+    if (pItems)
+    {
 
-		for (sal_uInt16 i = 0; i < nCount; i++)
-			if (((ScDBData*)pItems[i])->IsDBAtCursor(nCol, nRow, nTab, bStartOnly))
-			{
-				ScDBData* pDB = (ScDBData*)pItems[i];
-                if ( pDB->IsBuildin() )
-					pNoNameData = pDB;
-				else
-					return pDB;
-			}
-	}
-	return pNoNameData;				// "unbenannt" nur zurueck, wenn sonst nichts gefunden
+        for (sal_uInt16 i = 0; i < nCount; i++)
+            if (((ScDBData*)pItems[i])->IsDBAtCursor(nCol, nRow, nTab, bStartOnly))
+            {
+                ScDBData* pDB = (ScDBData*)pItems[i];
+                if ( pDB->IsInternalUnnamed()
+                     || pDB->IsInternalForAutoFilter() )
+                {
+                    pInternalDBData = pDB;
+                }
+                else
+                {
+                    return pDB;
+                }
+            }
+    }
+    return pInternalDBData;
 }
 
-ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
+ScDBData* ScDBCollection::GetDBAtArea(
+    const SCTAB nTab,
+    const SCCOL nCol1,
+    const SCROW nRow1,
+    const SCCOL nCol2,
+    const SCROW nRow2 ) const
 {
-	ScDBData* pNoNameData = NULL;
-	if (pItems)
-	{
-
-		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->IsBuildin() )
-					pNoNameData = pDB;
-				else
-					return pDB;
-			}
-	}
-	return pNoNameData;				// "unbenannt" nur zurueck, wenn sonst nichts gefunden
+    ScDBData* pInternalDBData = NULL;
+    if (pItems)
+    {
+        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->IsInternalUnnamed()
+                     || pDB->IsInternalForAutoFilter() )
+                    pInternalDBData = pDB;
+                else
+                    return pDB;
+            }
+    }
+    return pInternalDBData;
 }
 
 ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB nTab) const
@@ -920,54 +937,3 @@ String ScDBCollection::GetNewDefaultDBNa
     }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: openoffice/branches/l10n40/main/sc/source/core/tool/rangeutl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/core/tool/rangeutl.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/core/tool/rangeutl.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/core/tool/rangeutl.cxx Fri Sep 27 15:26:24 2013
@@ -997,8 +997,7 @@ sal_Bool ScArea::operator==( const ScAre
 
 //------------------------------------------------------------------------
 
-ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc ) :
-	aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) )
+ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc )
 {
 	pRangeName = pDoc->GetRangeName();
 	pDBCollection = pDoc->GetDBCollection();
@@ -1008,42 +1007,43 @@ ScAreaNameIterator::ScAreaNameIterator( 
 
 sal_Bool ScAreaNameIterator::Next( String& rName, ScRange& rRange )
 {
-	for (;;)
-	{
-		if ( bFirstPass )									// erst Bereichsnamen
-		{
-			if ( pRangeName && nPos < pRangeName->GetCount() )
-			{
-				ScRangeData* pData = (*pRangeName)[nPos++];
-				if ( pData && pData->IsValidReference(rRange) )
-				{
-					rName = pData->GetName();
-					return sal_True;							// gefunden
-				}
-			}
-			else
-			{
-				bFirstPass = sal_False;
-				nPos = 0;
-			}
-		}
-		if ( !bFirstPass )									// dann DB-Bereiche
-		{
-			if ( pDBCollection && nPos < pDBCollection->GetCount() )
-			{
-				ScDBData* pData = (*pDBCollection)[nPos++];
-//				if (pData && pData->GetName() != aStrNoName)
-				if (pData && !pData->IsBuildin())
-				{
-					pData->GetArea( rRange );
-					rName = pData->GetName();
-					return sal_True;							// gefunden
-				}
-			}
-			else
-				return sal_False;								// gibt nichts mehr
-		}
-	}
+    for (;;)
+    {
+        if ( bFirstPass )									// erst Bereichsnamen
+        {
+            if ( pRangeName && nPos < pRangeName->GetCount() )
+            {
+                ScRangeData* pData = (*pRangeName)[nPos++];
+                if ( pData && pData->IsValidReference(rRange) )
+                {
+                    rName = pData->GetName();
+                    return sal_True;							// gefunden
+                }
+            }
+            else
+            {
+                bFirstPass = sal_False;
+                nPos = 0;
+            }
+        }
+        if ( !bFirstPass )									// dann DB-Bereiche
+        {
+            if ( pDBCollection && nPos < pDBCollection->GetCount() )
+            {
+                ScDBData* pData = (*pDBCollection)[nPos++];
+                if ( pData
+                     && !pData->IsInternalUnnamed()
+                     && !pData->IsInternalForAutoFilter() )
+                {
+                    pData->GetArea( rRange );
+                    rName = pData->GetName();
+                    return sal_True;							// gefunden
+                }
+            }
+            else
+                return sal_False;								// gibt nichts mehr
+        }
+    }
 }
 
 

Modified: openoffice/branches/l10n40/main/sc/source/filter/lotus/lotimpop.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/filter/lotus/lotimpop.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/filter/lotus/lotimpop.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/filter/lotus/lotimpop.cxx Fri Sep 27 15:26:24 2013
@@ -55,9 +55,10 @@ LOTUS_ROOT::LOTUS_ROOT( ScDocument* pDoc
         eFirstType( Lotus_X),
         eActType( Lotus_X),
         pRngNmBffWK3( new RangeNameBufferWK3),
-        pFontBuff( new LotusFontBuffer),
-        pAttrTable( new LotAttrTable)
+        pFontBuff( new LotusFontBuffer)
 {
+	pLotusRoot = this; // #122841# the singleton global var is already needed for LotAttrTable
+	pAttrTable = new LotAttrTable;
 }
 
 

Modified: openoffice/branches/l10n40/main/sc/source/filter/xml/xmlimprt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/filter/xml/xmlimprt.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/filter/xml/xmlimprt.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/filter/xml/xmlimprt.cxx Fri Sep 27 15:26:24 2013
@@ -2749,9 +2749,9 @@ void ScXMLImport::SetNamedRanges()
                         try
                         {
                             //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) );							
+                            String sTabName;
+                            GetDocument()->GetName( (*aItr)->nNameScope, sTabName);
+                            xNamedRanges->addNewByScopeName( sTabName, (*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType) );
                         }
                         catch( uno::RuntimeException& )
                         {
@@ -2790,12 +2790,11 @@ void ScXMLImport::SetNamedRanges()
                     if (ScRangeStringConverter::GetAddressFromString(
                         aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
                     {
-						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);
+                        String sTableName;
+                        GetDocument()->GetName( (*aItr)->nNameScope,  sTableName );
+                        rtl::OUString sRangeScope( sTableName);
+                        uno::Reference <sheet::XNamedRange2> xNamedRange(xNamedRanges->getByScopeName( sRangeScope,(*aItr)->sName), uno::UNO_QUERY);
                         if (xNamedRange.is())
                         {
                             LockSolarMutex();

Modified: openoffice/branches/l10n40/main/sc/source/ui/dbgui/dbnamdlg.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/dbgui/dbnamdlg.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/dbgui/dbnamdlg.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/dbgui/dbnamdlg.cxx Fri Sep 27 15:26:24 2013
@@ -160,7 +160,6 @@ ScDbNameDlg::ScDbNameDlg( SfxBindings* p
 
 		aStrAdd			( ScResId( STR_ADD ) ),
 		aStrModify		( ScResId( STR_MODIFY ) ),
-		aStrNoName		( ScGlobal::GetRscString(STR_DB_NONAME) ),
 		aStrInvalid		( ScResId( STR_DB_INVALID ) ),
 		//
 		pViewData		( ptrViewData ),
@@ -205,87 +204,91 @@ __EXPORT ScDbNameDlg::~ScDbNameDlg()
 
 void ScDbNameDlg::Init()
 {
-	aBtnHeader.Check( sal_True );		// Default: mit Spaltenkoepfen
+    aBtnHeader.Check( sal_True );		// Default: mit Spaltenkoepfen
 
     aBtnMore.AddWindow( &aFlOptions );
-	aBtnMore.AddWindow( &aBtnHeader );
-	aBtnMore.AddWindow( &aBtnDoSize );
-	aBtnMore.AddWindow( &aBtnKeepFmt );
-	aBtnMore.AddWindow( &aBtnStripData );
-	aBtnMore.AddWindow( &aFTSource );
-	aBtnMore.AddWindow( &aFTOperations );
-
-	String	theAreaStr;
-	SCCOL	nStartCol 	= 0;
-	SCROW	nStartRow 	= 0;
-	SCTAB	nStartTab 	= 0;
-	SCCOL	nEndCol 	= 0;
-	SCROW	nEndRow		= 0;
-	SCTAB	nEndTab 	= 0;
-
-	aBtnOk.SetClickHdl		( LINK( this, ScDbNameDlg, OkBtnHdl ) );
-	aBtnCancel.SetClickHdl	( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
-	aBtnAdd.SetClickHdl		( LINK( this, ScDbNameDlg, AddBtnHdl ) );
-	aBtnRemove.SetClickHdl	( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
-	aEdName.SetModifyHdl	( LINK( this, ScDbNameDlg, NameModifyHdl ) );
-	aEdAssign.SetModifyHdl	( LINK( this, ScDbNameDlg, AssModifyHdl ) );
-	UpdateNames();
-
-	if ( pViewData && pDoc )
-	{
-		ScDBCollection*	pDBColl	= pDoc->GetDBCollection();
-		ScDBData*		pDBData = NULL;
-
-		pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
-								  nEndCol,	 nEndRow,  nEndTab );
-
-		theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
-							  ScAddress( nEndCol,   nEndRow,   nEndTab ) );
-
-		theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails );
-
-		if ( pDBColl )
-		{
-			// Feststellen, ob definierter DB-Bereich markiert wurde:
-			pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, sal_True );
-			if ( pDBData )
-			{
-				String		theDbName;
-				ScAddress&	rStart = theCurArea.aStart;
-				ScAddress&	rEnd   = theCurArea.aEnd;
+    aBtnMore.AddWindow( &aBtnHeader );
+    aBtnMore.AddWindow( &aBtnDoSize );
+    aBtnMore.AddWindow( &aBtnKeepFmt );
+    aBtnMore.AddWindow( &aBtnStripData );
+    aBtnMore.AddWindow( &aFTSource );
+    aBtnMore.AddWindow( &aFTOperations );
+
+    String	theAreaStr;
+    SCCOL	nStartCol 	= 0;
+    SCROW	nStartRow 	= 0;
+    SCTAB	nStartTab 	= 0;
+    SCCOL	nEndCol 	= 0;
+    SCROW	nEndRow		= 0;
+    SCTAB	nEndTab 	= 0;
+
+    aBtnOk.SetClickHdl		( LINK( this, ScDbNameDlg, OkBtnHdl ) );
+    aBtnCancel.SetClickHdl	( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
+    aBtnAdd.SetClickHdl		( LINK( this, ScDbNameDlg, AddBtnHdl ) );
+    aBtnRemove.SetClickHdl	( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
+    aEdName.SetModifyHdl	( LINK( this, ScDbNameDlg, NameModifyHdl ) );
+    aEdAssign.SetModifyHdl	( LINK( this, ScDbNameDlg, AssModifyHdl ) );
+    UpdateNames();
+
+    if ( pViewData && pDoc )
+    {
+        ScDBCollection*	pDBColl	= pDoc->GetDBCollection();
+        ScDBData*		pDBData = NULL;
+
+        pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
+            nEndCol,	 nEndRow,  nEndTab );
+
+        theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
+            ScAddress( nEndCol,   nEndRow,   nEndTab ) );
+
+        theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails );
+
+        if ( pDBColl )
+        {
+            // Feststellen, ob definierter DB-Bereich markiert wurde:
+            pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, sal_True );
+            if ( pDBData )
+            {
+                String		theDbName;
+                ScAddress&	rStart = theCurArea.aStart;
+                ScAddress&	rEnd   = theCurArea.aEnd;
                 SCCOL nCol1;
                 SCCOL  nCol2;
                 SCROW  nRow1;
                 SCROW  nRow2;
                 SCTAB  nTab;
 
-				pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
+                pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
 
-				if (   (rStart.Tab() == nTab)
-					&& (rStart.Col() == nCol1) && (rStart.Row() == nRow1)
-					&& (rEnd.Col()   == nCol2) && (rEnd.Row()   == nRow2 ) )
-				{
-					pDBData->GetName( theDbName );
-					//if ( theDbName != aStrNoName )
-					if ( !pDBData->IsBuildin() )
-						aEdName.SetText( theDbName );
-					else
-						aEdName.SetText( EMPTY_STRING );
-					aBtnHeader.Check( pDBData->HasHeader() );
-					aBtnDoSize.Check( pDBData->IsDoSize() );
-					aBtnKeepFmt.Check( pDBData->IsKeepFmt() );
-					aBtnStripData.Check( pDBData->IsStripData() );
-					SetInfoStrings( pDBData );
-				}
-			}
-		}
-	}
-
-	aEdAssign.SetText( theAreaStr );
-	aEdName.GrabFocus();
-	bSaved=sal_True;
-	pSaveObj->Save();
-	NameModifyHdl( 0 );
+                if (   (rStart.Tab() == nTab)
+                    && (rStart.Col() == nCol1) && (rStart.Row() == nRow1)
+                    && (rEnd.Col()   == nCol2) && (rEnd.Row()   == nRow2 ) )
+                {
+                    pDBData->GetName( theDbName );
+                    if ( !pDBData->IsInternalUnnamed()
+                         && !pDBData->IsInternalForAutoFilter() )
+                    {
+                        aEdName.SetText( theDbName );
+                    }
+                    else
+                    {
+                        aEdName.SetText( EMPTY_STRING );
+                    }
+                    aBtnHeader.Check( pDBData->HasHeader() );
+                    aBtnDoSize.Check( pDBData->IsDoSize() );
+                    aBtnKeepFmt.Check( pDBData->IsKeepFmt() );
+                    aBtnStripData.Check( pDBData->IsStripData() );
+                    SetInfoStrings( pDBData );
+                }
+            }
+        }
+    }
+
+    aEdAssign.SetText( theAreaStr );
+    aEdName.GrabFocus();
+    bSaved=sal_True;
+    pSaveObj->Save();
+    NameModifyHdl( 0 );
 }
 
 
@@ -361,39 +364,39 @@ void ScDbNameDlg::SetActive()
 
 void ScDbNameDlg::UpdateNames()
 {
-	sal_uInt16	nNameCount = aLocalDbCol.GetCount();
-
-	aEdName.SetUpdateMode( sal_False );
-	//-----------------------------------------------------------
-	aEdName.Clear();
-	aEdAssign.SetText( EMPTY_STRING );
-
-	if ( nNameCount > 0 )
-	{
-		ScDBData*	pDbData = NULL;
-		String		aString;
+    sal_uInt16	nNameCount = aLocalDbCol.GetCount();
 
-		for ( sal_uInt16 i=0; i<nNameCount; i++ )
-		{
-			pDbData = (ScDBData*)(aLocalDbCol.At( i ));
-			if ( pDbData )
-			{
-				pDbData->GetName( aString );
-				//if ( aString != aStrNoName )
-				if ( !pDbData->IsBuildin() )
-					aEdName.InsertEntry( aString );
-			}
-		}
-	}
-	else
-	{
-		aBtnAdd.SetText( aStrAdd );
-		aBtnAdd.Disable();
-		aBtnRemove.Disable();
-	}
-	//-----------------------------------------------------------
-	aEdName.SetUpdateMode( sal_True );
-	aEdName.Invalidate();
+    aEdName.SetUpdateMode( sal_False );
+    //-----------------------------------------------------------
+    aEdName.Clear();
+    aEdAssign.SetText( EMPTY_STRING );
+
+    if ( nNameCount > 0 )
+    {
+        ScDBData*	pDbData = NULL;
+        String		aString;
+
+        for ( sal_uInt16 i=0; i<nNameCount; i++ )
+        {
+            pDbData = (ScDBData*)(aLocalDbCol.At( i ));
+            if ( pDbData )
+            {
+                pDbData->GetName( aString );
+                if ( !pDbData->IsInternalUnnamed()
+                     && !pDbData->IsInternalForAutoFilter() )
+                    aEdName.InsertEntry( aString );
+            }
+        }
+    }
+    else
+    {
+        aBtnAdd.SetText( aStrAdd );
+        aBtnAdd.Disable();
+        aBtnRemove.Disable();
+    }
+    //-----------------------------------------------------------
+    aEdName.SetUpdateMode( sal_True );
+    aEdName.Invalidate();
 }
 
 //------------------------------------------------------------------------

Modified: openoffice/branches/l10n40/main/sc/source/ui/dbgui/foptmgr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/dbgui/foptmgr.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/dbgui/foptmgr.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/dbgui/foptmgr.cxx Fri Sep 27 15:26:24 2013
@@ -174,24 +174,24 @@ void ScFilterOptionsMgr::Init()
 
 		theDbArea = theAreaStr;
 
-		if ( pDBColl )
-		{
-			ScAddress&	rStart	= theCurArea.aStart;
-			ScAddress&	rEnd	= theCurArea.aEnd;
-			ScDBData*	pDBData = pDBColl->GetDBAtArea(	rStart.Tab(),
-														rStart.Col(), rStart.Row(),
-														rEnd.Col(),   rEnd.Row() );
-			if ( pDBData )
-			{
-				rBtnHeader.Check( pDBData->HasHeader() );
-				pDBData->GetName( theDbName );
-
-                if ( !pDBData->IsBuildin() )
-				{
-					rBtnHeader.Disable();
-				}
-			}
-		}
+        if ( pDBColl )
+        {
+            ScAddress&	rStart	= theCurArea.aStart;
+            ScAddress&	rEnd	= theCurArea.aEnd;
+            ScDBData*	pDBData = pDBColl->GetDBAtArea(
+                rStart.Tab(), rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() );
+            if ( pDBData )
+            {
+                rBtnHeader.Check( pDBData->HasHeader() );
+                pDBData->GetName( theDbName );
+
+                if ( !pDBData->IsInternalUnnamed()
+                     && !pDBData->IsInternalForAutoFilter() )
+                {
+                    rBtnHeader.Disable();
+                }
+            }
+        }
 
 		theDbArea.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
 		theDbArea += theDbName;

Modified: openoffice/branches/l10n40/main/sc/source/ui/docshell/dbdocfun.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/docshell/dbdocfun.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/docshell/dbdocfun.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/docshell/dbdocfun.cxx Fri Sep 27 15:26:24 2013
@@ -592,7 +592,7 @@ sal_Bool ScDBDocFunc::Sort( SCTAB nTab, 
 		if (pDestData)
 			pNewData = pDestData;				// Bereich vorhanden -> anpassen
 		else									// Bereich ab Cursor/Markierung wird angelegt
-			pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE_SORT, SC_DBSEL_FORCE_MARK );
+			pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );
 		if (pNewData)
 		{
 			pNewData->SetArea( nTab,
@@ -919,7 +919,7 @@ sal_Bool ScDBDocFunc::Query( SCTAB nTab,
 			pNewData = rDocShell.GetDBData(
 							ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
 									 aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ),
-							SC_DB_MAKE_FILTER, SC_DBSEL_FORCE_MARK );
+							SC_DB_MAKE, SC_DBSEL_FORCE_MARK );
 
 		if (pNewData)
 		{

Modified: openoffice/branches/l10n40/main/sc/source/ui/docshell/docsh5.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/docshell/docsh5.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/docshell/docsh5.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/docshell/docsh5.cxx Fri Sep 27 15:26:24 2013
@@ -111,94 +111,101 @@ void ScDocShell::DBAreaDeleted( SCTAB nT
     aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
 }
 
-ScDBData* lcl_GetDBNearCursor( ScDBCollection* pColl, SCCOL nCol, SCROW nRow, SCTAB nTab )
-{
-	//!	nach document/dbcolect verschieben
-
-	if (!pColl)
-		return NULL;
 
-	ScDBData* pNoNameData = NULL;
-	ScDBData* pNearData = NULL;
-	sal_uInt16 nCount = pColl->GetCount();
-	String aNoName = ScGlobal::GetRscString( STR_DB_NONAME );
-	SCTAB nAreaTab;
-	SCCOL nStartCol, nEndCol;
-	SCROW nStartRow, nEndRow;
-	for (sal_uInt16 i = 0; i < nCount; i++)
-	{
-		ScDBData* pDB = (*pColl)[i];
-		pDB->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
-		if ( nTab == nAreaTab && nCol+1 >= nStartCol && nCol <= nEndCol+1 &&
-								 nRow+1 >= nStartRow && nRow <= nEndRow+1 )
-		{
-			if ( pDB->GetName() == aNoName )
-				pNoNameData = pDB;
-			else if ( nCol < nStartCol || nCol > nEndCol || nRow < nStartRow || nRow > nEndRow )
-			{
-				if (!pNearData)
-					pNearData = pDB;	// ersten angrenzenden Bereich merken
-			}
-			else
-				return pDB;				// nicht "unbenannt" und Cursor steht wirklich drin
-		}
-	}
-	if (pNearData)
-		return pNearData;				// angrenzender, wenn nichts direkt getroffen
-	return pNoNameData;					// "unbenannt" nur zurueck, wenn sonst nichts gefunden
+ScDBData* lcl_GetDBNearCursor(
+    const ScDBCollection* pColl,
+    const SCCOL nCol,
+    const SCROW nRow,
+    const SCTAB nTab )
+{
+    //!	nach document/dbcolect verschieben
+
+    if (!pColl)
+        return NULL;
+
+    ScDBData* pInternalDBData = NULL;
+    ScDBData* pNearData = NULL;
+    sal_uInt16 nCount = pColl->GetCount();
+    SCTAB nAreaTab;
+    SCCOL nStartCol, nEndCol;
+    SCROW nStartRow, nEndRow;
+    for (sal_uInt16 i = 0; i < nCount; i++)
+    {
+        ScDBData* pDB = (*pColl)[i];
+        pDB->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
+        if ( nTab == nAreaTab
+             && nCol+1 >= nStartCol
+             && nCol <= nEndCol+1
+             && nRow+1 >= nStartRow
+             && nRow <= nEndRow+1 )
+        {
+            if ( pDB->IsInternalUnnamed()
+                 || pDB->IsInternalForAutoFilter() )
+            {
+                pInternalDBData = pDB;
+            }
+            else if ( nCol < nStartCol || nCol > nEndCol || nRow < nStartRow || nRow > nEndRow )
+            {
+                if ( !pNearData )
+                    pNearData = pDB;	// ersten angrenzenden Bereich merken
+            }
+            else
+                return pDB;				// nicht "unbenannt" und Cursor steht wirklich drin
+        }
+    }
+    if (pNearData)
+        return pNearData;				// angrenzender, wenn nichts direkt getroffen
+    return pInternalDBData;
 }
 
 ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel )
 {
-    if ( eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_MAKE_SORT || eMode == SC_DB_MAKE_SUBTOTAL || eMode == SC_DB_OLD_FILTER )
-        return GetDBDataAdd(rMarked, eMode, eSel);
-	SCCOL nCol = rMarked.aStart.Col();
-	SCROW nRow = rMarked.aStart.Row();
-	SCTAB nTab = rMarked.aStart.Tab();
-
-	SCCOL nStartCol = nCol;
-	SCROW nStartRow = nRow;
-	SCTAB nStartTab = nTab;
-	SCCOL nEndCol = rMarked.aEnd.Col();
-	SCROW nEndRow = rMarked.aEnd.Row();
-	SCTAB nEndTab = rMarked.aEnd.Tab();
-
-	//	Wegen #49655# nicht einfach GetDBAtCursor: Der zusammenhaengende Datenbereich
-	//	fuer "unbenannt" (GetDataArea) kann neben dem Cursor legen, also muss auch ein
-	//	benannter DB-Bereich dort gesucht werden.
-
-	ScDBData* pData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
-	if (!pData)
-		pData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab );
-
-	sal_Bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK ||
-            (rMarked.aStart != rMarked.aEnd && eSel != SC_DBSEL_ROW_DOWN) );
-    bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row());
+    const SCCOL nCol = rMarked.aStart.Col();
+    const SCROW nRow = rMarked.aStart.Row();
+    const SCTAB nTab = rMarked.aStart.Tab();
 
-	sal_Bool bUseThis = sal_False;
-	if (pData)
-	{
-		//		Bereich nehmen, wenn nichts anderes markiert
+    SCCOL nStartCol = nCol;
+    SCROW nStartRow = nRow;
+    SCCOL nEndCol = rMarked.aEnd.Col();
+    SCROW nEndRow = rMarked.aEnd.Row();
+
+    ScDBData* pFoundDBData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
+    if ( pFoundDBData == NULL )
+    {
+        pFoundDBData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab );
+    }
 
-		SCTAB nDummy;
-		SCCOL nOldCol1;
-		SCROW nOldRow1;
-		SCCOL nOldCol2;
-		SCROW nOldRow2;
-		pData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 );
-//		sal_Bool bIsNoName = ( pData->GetName() == ScGlobal::GetRscString( STR_DB_NONAME ) );
-		sal_Bool bIsNoName = pData->IsBuildin();
+    const bool bSelected =
+        ( eSel == SC_DBSEL_FORCE_MARK
+          || ( rMarked.aStart != rMarked.aEnd
+               && eSel != SC_DBSEL_ROW_DOWN ) );
+    const bool bOnlyDown = ( !bSelected
+                             && eSel == SC_DBSEL_ROW_DOWN
+                             && rMarked.aStart.Row() == rMarked.aEnd.Row());
 
-		if (!bSelected)
-		{
-			bUseThis = sal_True;
-			if ( bIsNoName && eMode == SC_DB_MAKE )
-			{
-                // If nothing marked or only one row marked, adapt 
-                // "unbenannt"/"unnamed" to contiguous area.
+    bool bUseFoundDBData = false;
+    if ( pFoundDBData )
+    {
+        // check, if found database range can be used
+        SCTAB nDummy;
+        SCCOL nOldCol1;
+        SCROW nOldRow1;
+        SCCOL nOldCol2;
+        SCROW nOldRow2;
+        pFoundDBData->GetArea( nDummy, nOldCol1, nOldRow1, nOldCol2, nOldRow2 );
+
+        const bool bIsUnnamedOne = pFoundDBData->IsInternalUnnamed();
+        const bool bIsInternalForAutoFilter = pFoundDBData->IsInternalForAutoFilter();
+        if ( !bSelected )
+        {
+            bUseFoundDBData = true;
+            if ( ( bIsUnnamedOne || bIsInternalForAutoFilter )
+                 && ( eMode == SC_DB_MAKE || eMode == SC_DB_MAKE_AUTOFILTER ) )
+            {
+                // If nothing marked or only one row marked, adapt found database range to contiguous area.
                 nStartCol = nCol;
                 nStartRow = nRow;
-                if (bOnlyDown)
+                if ( bOnlyDown )
                 {
                     nEndCol = rMarked.aEnd.Col();
                     nEndRow = rMarked.aEnd.Row();
@@ -208,54 +215,67 @@ ScDBData* ScDocShell::GetDBData( const S
                     nEndCol = nStartCol;
                     nEndRow = nStartRow;
                 }
-				aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
-				if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow )
-					bUseThis = sal_False;				// passt gar nicht
-				else if ( nOldRow2 != nEndRow )
-				{
-					//	Bereich auf neue End-Zeile erweitern
-					pData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow );
-				}
-			}
-		}
-		else
-		{
-			if ( nOldCol1 == nStartCol && nOldRow1 == nStartRow &&
-				 nOldCol2 == nEndCol && nOldRow2 == nEndRow )				// genau markiert?
-				bUseThis = sal_True;
-			else
-				bUseThis = sal_False;			// immer Markierung nehmen (Bug 11964)
-		}
+                aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
+                if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow )
+                {
+                    bUseFoundDBData = false;
+                }
+                else if ( nOldRow2 != nEndRow )
+                {
+                    // adapt found internal database range to new end row
+                    pFoundDBData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow );
+                }
+            }
+        }
+        else
+        {
+            if ( nOldCol1 == nStartCol
+                 && nOldRow1 == nStartRow
+                 && nOldCol2 == nEndCol
+                 && nOldRow2 == nEndRow )
+            {
+                bUseFoundDBData = true;
+            }
+            else
+            {
+                bUseFoundDBData = false;
+            }
+        }
 
-		//		fuer Import nie "unbenannt" nehmen
+        // adapt internal unnamed database range to an auto filter one
+        // otherwise the auto filter is lost when the internal unnamed one is changed/reused/deleted
+        if ( bUseFoundDBData
+             && eMode == SC_DB_MAKE_AUTOFILTER
+             && bIsUnnamedOne )
+        {
+            pFoundDBData->SetName( aDocument.GetDBCollection()->GetNewDefaultDBName() );
+        }
 
-		if ( bUseThis && eMode == SC_DB_IMPORT && bIsNoName )
-			bUseThis = sal_False;
-	}
+        // no internal database range for Import
+        if ( bUseFoundDBData
+             && eMode == SC_DB_IMPORT
+             && ( bIsUnnamedOne || bIsInternalForAutoFilter ) )
+        {
+            bUseFoundDBData = false;
+        }
+    }
 
-	if ( bUseThis )
-	{
-		pData->GetArea( nStartTab, nStartCol,nStartRow, nEndCol,nEndRow );
-		nEndTab = nStartTab;
-	}
-	else if ( eMode == SC_DB_OLD )
-	{
-		pData = NULL;							// nichts gefunden
-		nStartCol = nEndCol = nCol;
-		nStartRow = nEndRow = nRow;
-		nStartTab = nEndTab = nTab;
-//		bMark = sal_False;							// nichts zu markieren
-	}
-	else
-	{
-		if ( bSelected )
-		{
-//			bMark = sal_False;
-		}
-		else
-		{										// zusammenhaengender Bereich
-			nStartCol = nCol;
-			nStartRow = nRow;
+    if ( bUseFoundDBData )
+    {
+        return pFoundDBData;
+    }
+
+    if ( eMode == SC_DB_OLD )
+    {
+        // no existing database range found
+        return NULL;
+    }
+    else // eMode == SC_DB_MAKE||SC_DB_IMPORT||SC_DB_MAKE_AUTOFILTER
+    {
+        if ( !bSelected )
+        {
+            nStartCol = nCol;
+            nStartRow = nRow;
             if (bOnlyDown)
             {
                 nEndCol = rMarked.aEnd.Col();
@@ -266,255 +286,112 @@ ScDBData* ScDocShell::GetDBData( const S
                 nEndCol = nStartCol;
                 nEndRow = nStartRow;
             }
-			aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
-		}
+            aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
+        }
 
-		sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
+        const sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
 
-		ScDBData* pNoNameData;
-		sal_uInt16 nNoNameIndex;
-		ScDBCollection* pColl = aDocument.GetDBCollection();
-		if ( eMode != SC_DB_IMPORT &&
-				pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nNoNameIndex ) )
-		{
-			pNoNameData = (*pColl)[nNoNameIndex];
+        ScDBData* pDBData = NULL;
+        sal_uInt16 nUnnamedDBIndex;
+        ScDBCollection* pColl = aDocument.GetDBCollection();
+        if ( eMode == SC_DB_MAKE &&
+             pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nUnnamedDBIndex ) )
+        {
+            // adapt existing unnamed database range
+            pDBData = (*pColl)[nUnnamedDBIndex];
 
             if ( !pOldAutoDBRange )
             {
                 // store the old unnamed database range with its settings for undo
                 // (store at the first change, get the state before all changes)
-                pOldAutoDBRange = new ScDBData( *pNoNameData );
+                pOldAutoDBRange = new ScDBData( *pDBData );
             }
 
-			SCCOL nOldX1;									// alten Bereich sauber wegnehmen
-			SCROW nOldY1;									//! (UNDO ???)
-			SCCOL nOldX2;
-			SCROW nOldY2;
-			SCTAB nOldTab;
-			pNoNameData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
-			DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
-
-			pNoNameData->SetSortParam( ScSortParam() ); 			// Parameter zuruecksetzen
-			pNoNameData->SetQueryParam( ScQueryParam() );
-			pNoNameData->SetSubTotalParam( ScSubTotalParam() );
-
-			pNoNameData->SetArea( nTab, nStartCol,nStartRow, nEndCol,nEndRow ); 	// neu setzen
-			pNoNameData->SetByRow( sal_True );
-			pNoNameData->SetHeader( bHasHeader );
-			pNoNameData->SetAutoFilter( sal_False );
-		}
-		else
-		{
-			ScDBCollection* pUndoColl = NULL;
-
-			String aNewName;
-			if (eMode==SC_DB_IMPORT)
-			{
-				aDocument.CompileDBFormula( sal_True );			// CreateFormulaString
-				pUndoColl = new ScDBCollection( *pColl );	// Undo fuer Import1-Bereich
-
-				String aImport = ScGlobal::GetRscString( STR_DBNAME_IMPORT );
-				long nCount = 0;
-				sal_uInt16 nDummy;
-				do
-				{
-					++nCount;
-					aNewName = aImport;
-					aNewName += String::CreateFromInt32( nCount );
-				}
-				while (pColl->SearchName( aNewName, nDummy ));
-			}
-			else
-				//aNewName = ScGlobal::GetRscString( STR_DB_NONAME );
-				aNewName = pColl->GetNewDefaultDBName();
-
-			pNoNameData = new ScDBData( aNewName, nTab,
-								nStartCol,nStartRow, nEndCol,nEndRow,
-								sal_True, bHasHeader );
-			pColl->Insert( pNoNameData );
-
-			if ( pUndoColl )
-			{
-				aDocument.CompileDBFormula( sal_False );		// CompileFormulaString
-
-				ScDBCollection* pRedoColl = new ScDBCollection( *pColl );
-				GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) );
-			}
-
-			//	neuen Bereich am Sba anmelden nicht mehr noetig
-
-			//	"Import1" etc am Navigator bekanntmachen
-			if (eMode==SC_DB_IMPORT)
-				SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
-		}
-		pData = pNoNameData;
-	}
-
-//	if (bMark)
-//		MarkRange( ScRange( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ), sal_False );
-
-	return pData;
-}
-
-ScDBData* ScDocShell::GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel )
-{
-    SCCOL nCol = rMarked.aStart.Col();
-    SCROW nRow = rMarked.aStart.Row();
-    SCTAB nTab = rMarked.aStart.Tab();
-
-    SCCOL nStartCol = nCol;
-    SCROW nStartRow = nRow;
-    SCCOL nEndCol = rMarked.aEnd.Col();
-    SCROW nEndRow = rMarked.aEnd.Row();
-
-    ScDBData* pData = NULL;
-    ScDBData* pCursorData;
-    pCursorData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
-    if ( !pCursorData )
-        pCursorData = aDocument.GetDBAtCursor( nStartCol, nStartRow, nTab );
-
-    //Get DBData at current table
-    ScDBData* pTableData = aDocument.GetDBAtTable( nTab, eMode );
-
-    if ( eMode == SC_DB_OLD_FILTER )
-        return pTableData;
-
-    sal_Bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK || rMarked.aStart != rMarked.aEnd ); 
-    bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row());
-
-	sal_Bool bUseThis = sal_False;
-    if (pCursorData)
-    {
-        SCTAB nDummy;
-        SCCOL nOldCol1;
-        SCROW nOldRow1;
-        SCCOL nOldCol2;
-        SCROW nOldRow2;
-        pCursorData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 );
-        if ( !bSelected )
-        {    
-              ScRange tmpRange;
-              if ( !pCursorData->IsBuildin() && pCursorData->GetAdvancedQuerySource(tmpRange))	 
-                   bUseThis = sal_True;			   
-              else
-             {  
-                 nStartCol = nCol;
-                 nStartRow = nRow;
-                 nEndCol = nStartCol;
-                 nEndRow = nStartRow;
-				aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
-                 if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow )
-                     bUseThis = sal_False;
-                 else
-                 {
-                     bUseThis = sal_True;
-                     if ( nOldRow2 != nEndRow )// Range of new end-line expand
-                     pCursorData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow );
-                 }
-            }
-
-        }
-        else
-        {
-            if ( nOldCol1 == nStartCol && nOldRow1 == nStartRow && nOldCol2 == nEndCol && nOldRow2 == nEndRow )
-				bUseThis = sal_True;
-            else
-				bUseThis = sal_False;			// Always take mark (Bug 11964)
-        }
-    }
-
-    if ( bUseThis )
-    {
-        pData = pCursorData;
-        if ( pTableData && eMode == SC_DB_MAKE_FILTER && !(*pTableData == *pCursorData ) )
-        {
-            if ( !pOldAutoDBRange )
-                pOldAutoDBRange = new ScDBData(*pTableData);
             SCCOL nOldX1;
             SCROW nOldY1;
             SCCOL nOldX2;
             SCROW nOldY2;
             SCTAB nOldTab;
-            pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
-
-            if (pTableData->HasQueryParam())
-            {
-                ScQueryParam    aParam;
-                pTableData->GetQueryParam(aParam);
-                SCSIZE nEC = aParam.GetEntryCount();
-                for (SCSIZE i=0; i<nEC; i++)
-                    aParam.GetEntry(i).bDoQuery = sal_False;
-                aParam.bDuplicate = sal_True;
-                ScDBDocFunc aDBDocFunc( *this );
-                aDBDocFunc.Query( nTab, aParam, NULL, sal_False, sal_False );
-            }
-
+            pDBData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
             DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
-            pTableData->SetQueryParam( ScQueryParam() );
-            pTableData->SetAutoFilter( sal_False );
-        }
 
-    }
-    else
-    {
-        if ( bSelected )
-        {
-//			bMark = sal_False;
+            pDBData->SetSortParam( ScSortParam() );
+            pDBData->SetQueryParam( ScQueryParam() );
+            pDBData->SetSubTotalParam( ScSubTotalParam() );
+
+            pDBData->SetArea( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+            pDBData->SetByRow( sal_True );
+            pDBData->SetHeader( bHasHeader );
+            pDBData->SetAutoFilter( sal_False );
         }
         else
         {
-            nStartCol = nCol;
-            nStartRow = nRow;
-            nEndCol = nStartCol;
-            nEndRow = nStartRow;
-			aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
-        }
-        sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
-        ScDBCollection* pColl = aDocument.GetDBCollection();
-        if ( pTableData )
-        {
-            if ( !pOldAutoDBRange )
-                pOldAutoDBRange = new ScDBData(*pTableData);
-            SCCOL nOldX1;
-            SCROW nOldY1;
-            SCCOL nOldX2;
-            SCROW nOldY2;
-            SCTAB nOldTab;
-            pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
+            ScDBCollection* pUndoColl = NULL;
 
-            if (pTableData->HasQueryParam())
+            String aNewName;
+            switch ( eMode )
+            {
+            case SC_DB_IMPORT:
             {
-                ScQueryParam    aParam;
-                pTableData->GetQueryParam(aParam);
-                SCSIZE nEC = aParam.GetEntryCount();
-                for (SCSIZE i=0; i<nEC; i++)
-                    aParam.GetEntry(i).bDoQuery = sal_False;
-                aParam.bDuplicate = sal_True;
-                ScDBDocFunc aDBDocFunc( *this );
-                aDBDocFunc.Query( nTab, aParam, NULL, sal_False, sal_False );
+                aDocument.CompileDBFormula( sal_True );
+                pUndoColl = new ScDBCollection( *pColl );
+
+                String aImport = ScGlobal::GetRscString( STR_DBNAME_IMPORT );
+                long nCount = 0;
+                sal_uInt16 nDummy;
+                do
+                {
+                    ++nCount;
+                    aNewName = aImport;
+                    aNewName += String::CreateFromInt32( nCount );
+                }
+                while (pColl->SearchName( aNewName, nDummy ));
             }
+            break;
 
-                DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
+            case SC_DB_MAKE_AUTOFILTER:
+            {
+                aDocument.CompileDBFormula( sal_True );
+                pUndoColl = new ScDBCollection( *pColl );
 
-            pTableData->SetSortParam( ScSortParam() );
-            pTableData->SetQueryParam( ScQueryParam() );
-            pTableData->SetSubTotalParam( ScSubTotalParam() );
-
-            pTableData->SetArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
-            pTableData->SetByRow( sal_True );
-            pTableData->SetHeader( bHasHeader );
-            pTableData->SetAutoFilter( sal_False );
-        }
-        else
-        {
-            String aNewName = pColl->GetNewDefaultDBName();
-            pTableData = new ScDBData( aNewName, nTab, nStartCol,nStartRow, nEndCol,nEndRow, sal_True, bHasHeader );
-            pColl->Insert( pTableData );
+                aNewName = pColl->GetNewDefaultDBName();
+            }
+            break;
+
+            case SC_DB_MAKE:
+            {
+                aNewName = ScGlobal::GetRscString( STR_DB_NONAME );
+            }
+            break;
+
+            default:
+                DBG_ERROR( "<ScDocShell::GetDBData(..)> - unexcepted <eMode>" );
+                break;
+            }
+
+            pDBData = new ScDBData(
+                aNewName, nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_True, bHasHeader );
+            pColl->Insert( pDBData );
+
+            if ( pUndoColl )
+            {
+                aDocument.CompileDBFormula( sal_False );
+
+                ScDBCollection* pRedoColl = new ScDBCollection( *pColl );
+                GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) );
+            }
+
+            // notify Navigator about database range "Import[X]"
+            if ( eMode==SC_DB_IMPORT )
+            {
+                SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
+            }
         }
-        pData = pTableData;
+
+        return pDBData;
     }
 
-    return pData;
+    return NULL; // never reached
 }
 
 
@@ -656,21 +533,22 @@ void ScDocShell::RefreshPivotTables( con
 
 String lcl_GetAreaName( ScDocument* pDoc, ScArea* pArea )
 {
-	String aName;
-	sal_Bool bOk = sal_False;
-	ScDBData* pData = pDoc->GetDBAtArea( pArea->nTab, pArea->nColStart, pArea->nRowStart,
-														pArea->nColEnd, pArea->nRowEnd );
-	if (pData)
-	{
-		pData->GetName( aName );
-		if ( aName != ScGlobal::GetRscString( STR_DB_NONAME ) )
-			bOk = sal_True;
-	}
+    String aName;
+    bool bOk = false;
+    ScDBData* pData = pDoc->GetDBAtArea( pArea->nTab, pArea->nColStart, pArea->nRowStart, pArea->nColEnd, pArea->nRowEnd );
+    if (pData)
+    {
+        pData->GetName( aName );
+        if ( !pData->IsInternalUnnamed() )
+            bOk = true;
+    }
 
-	if (!bOk)
-		pDoc->GetName( pArea->nTab, aName );
+    if (!bOk)
+    {
+        pDoc->GetName( pArea->nTab, aName );
+    }
 
-	return aName;
+    return aName;
 }
 
 void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, sal_Bool bRecord )

Modified: openoffice/branches/l10n40/main/sc/source/ui/inc/dbfunc.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/inc/dbfunc.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/inc/dbfunc.hxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/inc/dbfunc.hxx Fri Sep 27 15:26:24 2013
@@ -75,7 +75,6 @@ public:
 					// DB-Bereich vom Cursor
 	ScDBData* 		GetDBData( sal_Bool bMarkArea = sal_True, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP );
 
-    //ScRange         GetDBRange( BOOL bMark, bool bIgnoreNotes );
 	void			NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList );
 
 	void			Consolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = sal_True );

Modified: openoffice/branches/l10n40/main/sc/source/ui/inc/docsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/inc/docsh.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/inc/docsh.hxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/inc/docsh.hxx Fri Sep 27 15:26:24 2013
@@ -158,7 +158,6 @@ class SC_DLLPUBLIC ScDocShell: public Sf
 
     SC_DLLPRIVATE void          EnableSharedSettings( bool bEnable );
     SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument();
-	ScDBData*		GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel );
 
     SC_DLLPRIVATE void          UseSheetSaveEntries();
 
@@ -307,7 +306,6 @@ public:
 	ScDBData*		GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel );
     ScDBData*       GetOldAutoDBRange();    // has to be deleted by caller!
     void            CancelAutoDBRange();    // called when dialog is cancelled
-	ScDBCollection* GetDBCollection(){ return aDocument.GetDBCollection();}
 
 	void			UpdateLinks();			// Link-Eintraege aktuallisieren
 	sal_Bool			ReloadTabLinks();		// Links ausfuehren (Inhalt aktualisieren)

Modified: openoffice/branches/l10n40/main/sc/source/ui/inc/output.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/inc/output.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/inc/output.hxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/inc/output.hxx Fri Sep 27 15:26:24 2013
@@ -245,7 +245,7 @@ public:
 	void	DrawSelectiveObjects(const sal_uInt16 nLayer);
 
 	sal_Bool	SetChangedClip();		// sal_False = nix
-    PolyPolygon GetChangedArea();
+    Region      GetChangedAreaRegion();
 
 	void	FindChanged();
 	void	SetPagebreakMode( ScPageBreakData* pPageData );

Modified: openoffice/branches/l10n40/main/sc/source/ui/navipi/content.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/navipi/content.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/navipi/content.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/navipi/content.cxx Fri Sep 27 15:26:24 2013
@@ -718,27 +718,28 @@ void ScContentTree::GetAreaNames()
 
 void ScContentTree::GetDbNames()
 {
-	if ( nRootType && nRootType != SC_CONTENT_DBAREA )		// ausgeblendet ?
-		return;
+    if ( nRootType && nRootType != SC_CONTENT_DBAREA )		// ausgeblendet ?
+        return;
 
-	ScDocument* pDoc = GetSourceDocument();
-	if (!pDoc)
-		return;
-
-	ScDBCollection*	pDbNames = pDoc->GetDBCollection();
-	sal_uInt16 nCount = pDbNames->GetCount();
-	if ( nCount > 0 )
-	{
-		String aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) );
-		for ( sal_uInt16 i=0; i<nCount; i++ )
-		{
-			ScDBData* pData = (*pDbNames)[i];
-			String aStrName = pData->GetName();
-			//if ( aStrName != aStrNoName )
-			if ( !pData->IsBuildin() )
-				InsertContent( SC_CONTENT_DBAREA, aStrName );
-		}
-	}
+    ScDocument* pDoc = GetSourceDocument();
+    if (!pDoc)
+        return;
+
+    ScDBCollection*	pDbNames = pDoc->GetDBCollection();
+    sal_uInt16 nCount = pDbNames->GetCount();
+    if ( nCount > 0 )
+    {
+        for ( sal_uInt16 i=0; i<nCount; i++ )
+        {
+            ScDBData* pData = (*pDbNames)[i];
+            String aStrName = pData->GetName();
+            if ( !pData->IsInternalUnnamed()
+                 && !pData->IsInternalForAutoFilter() )
+            {
+                InsertContent( SC_CONTENT_DBAREA, aStrName );
+            }
+        }
+    }
 }
 
 bool ScContentTree::IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier )  // static

Modified: openoffice/branches/l10n40/main/sc/source/ui/undo/undoutil.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/undo/undoutil.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/undo/undoutil.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/undo/undoutil.cxx Fri Sep 27 15:26:24 2013
@@ -82,38 +82,49 @@ void ScUndoUtil::MarkSimpleBlock( ScDocS
 
 
 ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab,
-									SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
+                                   SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
 {
-	ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 );
+    ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 );
 
-	if (!pRet)
-	{
-		sal_Bool bWasTemp = sal_False;
-		if ( pUndoData )
-		{
-			String aName;
-			pUndoData->GetName( aName );
-//			if ( aName == ScGlobal::GetRscString( STR_DB_NONAME ) )
-			if (pUndoData->IsBuildin())
-				bWasTemp = sal_True;
-		}
-        DBG_ASSERT(bWasTemp, "Undo: didn't find database range");
-
-		sal_uInt16 nIndex;
-		ScDBCollection* pColl = pDoc->GetDBCollection();
-		if (pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex ))
-			pRet = (*pColl)[nIndex];
-		else
-		{
-            String	aNoNamed = pColl->GetNewDefaultDBName();
-			pRet = new ScDBData( aNoNamed/*ScGlobal::GetRscString( STR_DB_NONAME )*/, nTab,
-								nCol1,nRow1, nCol2,nRow2, sal_True,
-								pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) );
-			pColl->Insert( pRet );
-		}
-	}
+    if (!pRet)
+    {
+        bool bWasInternalUnnamed = false;
+        bool bWasInternalForAutoFilter = false;
+        if ( pUndoData )
+        {
+            String aName;
+            pUndoData->GetName( aName );
+            if ( pUndoData->IsInternalUnnamed() )
+            {
+                bWasInternalUnnamed = true;
+            }
+            else if (pUndoData->IsInternalForAutoFilter())
+            {
+                bWasInternalForAutoFilter = true;
+            }
+        }
+        DBG_ASSERT( bWasInternalUnnamed || bWasInternalForAutoFilter, "Undo: didn't find database range");
+
+        sal_uInt16 nIndex;
+        ScDBCollection* pColl = pDoc->GetDBCollection();
+        if ( bWasInternalUnnamed
+             && pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex ))
+        {
+            pRet = (*pColl)[nIndex];
+        }
+        else
+        {
+            String aNewNamed = bWasInternalForAutoFilter
+                               ? pColl->GetNewDefaultDBName()
+                               : ScGlobal::GetRscString( STR_DB_NONAME );
+            pRet = new ScDBData(
+                aNewNamed, nTab, nCol1,nRow1, nCol2,nRow2, sal_True,
+                pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) );
+            pColl->Insert( pRet );
+        }
+    }
 
-	return pRet;
+    return pRet;
 }
 
 

Modified: openoffice/branches/l10n40/main/sc/source/ui/unoobj/chart2uno.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/unoobj/chart2uno.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/unoobj/chart2uno.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/unoobj/chart2uno.cxx Fri Sep 27 15:26:24 2013
@@ -2534,6 +2534,7 @@ void ScChart2DataSequence::BuildDataCach
 
             SCCOL nLastCol = -1;
             SCROW nLastRow = -1;
+
             for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); ++nTab)
             {
                 for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); ++nCol)
@@ -2563,6 +2564,7 @@ void ScChart2DataSequence::BuildDataCach
                             continue;
     
                         if (pCell->HasStringData())
+
                             rItem.maString = pCell->GetStringData();
                         else
                         {    
@@ -3018,51 +3020,12 @@ uno::Sequence< double > SAL_CALL ScChart
     ::rtl::math::setNan(&fNAN);
 
     sal_Int32 nCount = m_aDataArray.size();
-    // i121058: if there's too many points need to be painted, it doens't need to get all points for performance consideration
-    // and so many points are not useful for users to understand the chart. So only picked some points to paint
-    sal_Int32 nStep = nCount >= 10000 ? 50 : 1;
-    nCount = nCount >= 10000 ? ((nCount - nCount % nStep) / nStep) : nCount;
-    sal_Int32 nRealCount = nStep == 1 ? nCount : nCount * 2;
-    uno::Sequence<double> aSeq(nRealCount);
-    double* pArr = aSeq.getArray();
-    ::std::list<Item>::const_iterator itr = m_aDataArray.begin(), itrEnd = m_aDataArray.end();
-    for (sal_Int32 i = 0; i < nCount; i++)
-    {
-        if (nStep == 1)
-        {
-            *pArr++ = itr->mbIsValue ? itr->mfValue : fNAN;
-            itr++;
-        }
-        else
-        {
-            sal_Int32 nMax = 0, nMin = 0, nMaxStep = 0, nMinStep = 0;
-            for (sal_Int32 j = 0; j < nStep; j++)
-            {
-                sal_Int32 nValue = itr->mbIsValue ? itr->mfValue : fNAN;
-                if (nValue > nMax)
-                {
-                    nMax = nValue;
-                    nMaxStep = j;
-                }
-                if (nValue < nMin)
-                {
-                    nMin = nValue;
-                    nMinStep = j;
-                }
-                itr++;
-            }
-            if (nMaxStep > nMinStep)
-            {
-                *pArr++ = nMin;
-                *pArr++ = nMax;
-            }
-            else
-            {
-                *pArr++ = nMax;
-                *pArr++ = nMin;
-            }
-        }
-    }
+    uno::Sequence<double> aSeq(nCount);
+     double* pArr = aSeq.getArray();
+     ::std::list<Item>::const_iterator itr = m_aDataArray.begin(), itrEnd = m_aDataArray.end();
+    for (; itr != itrEnd; ++itr, ++pArr)
+        *pArr = itr->mbIsValue ? itr->mfValue : fNAN;
+
     return aSeq;
 }
 

Modified: openoffice/branches/l10n40/main/sc/source/ui/view/cellsh2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/view/cellsh2.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/view/cellsh2.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/view/cellsh2.cxx Fri Sep 27 15:26:24 2013
@@ -357,8 +357,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
 					ScSubTotalParam aSubTotalParam;
 					SfxItemSet		aArgSet( GetPool(), SCITEM_SUBTDATA, SCITEM_SUBTDATA );
 
-					//ScDBData* pDBData = pTabViewShell->GetDBData();
-                    ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SUBTOTAL);
+                    ScDBData* pDBData = pTabViewShell->GetDBData();
 					pDBData->GetSubTotalParam( aSubTotalParam );
 					aSubTotalParam.bRemoveOnly = sal_False;
 
@@ -412,7 +411,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
                 //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
                 //the patch comes from maoyg
                 ScSortParam aSortParam;
-                ScDBData*	pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
+                ScDBData*	pDBData = pTabViewShell->GetDBData();
                 ScViewData* pData   = GetViewData();
 
                 pDBData->GetSortParam( aSortParam );
@@ -463,7 +462,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
                 if ( pArgs )		// Basic
                 {
                     ScSortParam aSortParam;
-                    ScDBData*	pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
+                    ScDBData*	pDBData = pTabViewShell->GetDBData();
                     ScViewData* pData   = GetViewData();
 
                     pDBData->GetSortParam( aSortParam );
@@ -526,7 +525,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
                 else
                 {
                     ScSortParam aSortParam;
-                    ScDBData*	pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
+                    ScDBData*	pDBData = pTabViewShell->GetDBData();
                     ScViewData* pData   = GetViewData();
 
                     pDBData->GetSortParam( aSortParam );
@@ -681,7 +680,7 @@ void ScCellShell::ExecuteDB( SfxRequest&
 		case SID_UNFILTER:
 			{
 				ScQueryParam aParam;
-				ScDBData*	 pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_OLD_FILTER);
+				ScDBData*	 pDBData = pTabViewShell->GetDBData();
 
 				pDBData->GetQueryParam( aParam );
 				SCSIZE nEC = aParam.GetEntryCount();
@@ -945,7 +944,6 @@ void ScCellShell::ExecuteDB( SfxRequest&
 
 					if ( pDBCol )
 					{
-						const String	aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) );
 						List			aList;
 						sal_uInt16			nDBCount = pDBCol->GetCount();
 						ScDBData*		pDbData  = NULL;
@@ -959,18 +957,13 @@ void ScCellShell::ExecuteDB( SfxRequest&
 								pDBName = new String;
 								pDbData->GetName( *pDBName );
 
-								if ( *pDBName != aStrNoName )
+								if ( !pDbData->IsInternalUnnamed() )
 									aList.Insert( pDBName );
 								else
 									DELETEZ(pDBName);
 							}
 						}
 
-//CHINA001						ScSelEntryDlg* pDlg =
-//CHINA001						new ScSelEntryDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_SELECTDB,
-//CHINA001						String(ScResId(SCSTR_SELECTDB)),
-//CHINA001						String(ScResId(SCSTR_AREAS)),
-//CHINA001						aList );
 						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
 						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
 

Modified: openoffice/branches/l10n40/main/sc/source/ui/view/dbfunc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/view/dbfunc.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/view/dbfunc.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/view/dbfunc.cxx Fri Sep 27 15:26:24 2013
@@ -332,127 +332,127 @@ void ScDBFunc::ToggleAutoFilter()
     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     ScDocShellModificator aModificator( *pDocSh );
 
-	ScQueryParam	aParam;
-	ScDocument*		pDoc	= GetViewData()->GetDocument();
-	ScDBData*		pDBData = GetDBData( sal_False, SC_DB_OLD_FILTER, SC_DBSEL_ROW_DOWN );
-
-	
-
-
-	SCCOL  nCol;
-	SCROW  nRow;
-	SCTAB  nTab = GetViewData()->GetTabNo();
-	sal_Int16   nFlag;
-	//sal_Bool	bHasAuto = sal_True;
-	sal_Bool	bHeader;
-	sal_Bool	bPaint   = sal_False;
-
-	//!		stattdessen aus DB-Bereich abfragen?
-
-	/*for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++)
-	{
-		nFlag = ((ScMergeFlagAttr*) pDoc->
-				GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
-
-		if ( (nFlag & SC_MF_AUTO) == 0 )
-			bHasAuto = sal_False;
-	}*/
-
-	if (pDBData && pDBData->HasAutoFilter())								// aufheben
-	{
-		//	Filterknoepfe ausblenden
-		pDBData->SetByRow( sal_True );				//! Undo, vorher abfragen ??
-		pDBData->GetQueryParam( aParam );
-		nRow = aParam.nRow1;
-        bHeader = pDBData->HasHeader();
-		for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
-		{
-			nFlag = ((ScMergeFlagAttr*) pDoc->
-					GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
-			pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
-		}
-
-        // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation
-
-        String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY );
-        pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
+    ScDBData* pDBData = GetDBData( sal_False, SC_DB_MAKE_AUTOFILTER, SC_DBSEL_ROW_DOWN );
+    if ( pDBData == NULL )
+    {
+        return;
+    }
+
+    // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation
+    const String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY );
+    pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
+
+    pDBData->SetByRow( sal_True );
+    ScQueryParam aParam;
+    pDBData->GetQueryParam( aParam );
+
+    ScDocument* pDoc = GetViewData()->GetDocument();
+
+    bool bHasAutoFilter = true;
+    const SCROW  nRow = aParam.nRow1;
+    const SCTAB  nTab = GetViewData()->GetTabNo();
+    for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAutoFilter; ++nCol )
+    {
+        const sal_Int16 nFlag =
+            ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
+
+        if ( (nFlag & SC_MF_AUTO) == 0 )
+            bHasAutoFilter = false;
+    }
+
+    bool bPaint = false;
+
+    if ( bHasAutoFilter )
+    {
+        // switch filter buttons
+        for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2; ++nCol )
+        {
+            const sal_Int16 nFlag =
+                ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
+            pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
+        }
 
         ScRange aRange;
         pDBData->GetArea( aRange );
-        pDocSh->GetUndoManager()->AddUndoAction(
-            new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
-
-		pDBData->SetAutoFilter(sal_False);
+        pDocSh->GetUndoManager()->AddUndoAction( new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
 
-		//	Filter aufheben (incl. Paint / Undo)
+        pDBData->SetAutoFilter(sal_False);
 
-		SCSIZE nEC = aParam.GetEntryCount();
-		for (SCSIZE i=0; i<nEC; i++)
-			aParam.GetEntry(i).bDoQuery = sal_False;
-		aParam.bDuplicate = sal_True;
-		Query( aParam, NULL, sal_True );
-
-        pDocSh->GetUndoManager()->LeaveListAction();
-
-		bPaint = sal_True;
-	}
-	else									// Filterknoepfe einblenden
-	{
-        pDBData = GetDBData(sal_False, SC_DB_MAKE_FILTER);
-        pDBData->SetByRow(sal_True);
-        pDBData->GetQueryParam(aParam);
-        nRow = aParam.nRow1;
-        bHeader = pDBData->HasHeader();
-	
-		if ( !pDoc->IsBlockEmpty( nTab,
-								  aParam.nCol1, aParam.nRow1,
-								  aParam.nCol2, aParam.nRow2 ) )
-		{
-			if (!bHeader)
-			{
-				if ( MessBox( GetViewData()->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
-						ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),		// "StarCalc"
-						ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) 	// Koepfe aus erster Zeile?
-					).Execute() == RET_YES )
-				{
-					pDBData->SetHeader( sal_True ); 	//! Undo ??
-					bHeader = sal_True;
-				}
-			}
+        //	switch off filter
+        const SCSIZE nEC = aParam.GetEntryCount();
+        for ( SCSIZE i=0; i<nEC; ++i )
+        {
+            aParam.GetEntry(i).bDoQuery = sal_False;
+        }
+        aParam.bDuplicate = sal_True;
+        Query( aParam, NULL, sal_True );
+
+        // delete internal database range for auto filter
+        if ( pDBData->IsInternalForAutoFilter() )
+        {
+            ScDBDocFunc aFunc(*pDocSh);
+            aFunc.DeleteDBRange( pDBData->GetName(), sal_False );
+        }
+        pDBData = NULL;
+
+        bPaint = true;
+    }
+    else
+    {
+        if ( !pDoc->IsBlockEmpty(
+                nTab,
+                aParam.nCol1,
+                aParam.nRow1,
+                aParam.nCol2,
+                aParam.nRow2 ) )
+        {
+            if ( !pDBData->HasHeader() )
+            {
+                if ( MessBox(
+                        GetViewData()->GetDialogParent(),
+                        WinBits(WB_YES_NO | WB_DEF_YES),
+                        ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
+                        ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) ).Execute() == RET_YES )
+                {
+                    pDBData->SetHeader( sal_True );
+                }
+            }
 
             ScRange aRange;
             pDBData->GetArea( aRange );
-            pDocSh->GetUndoManager()->AddUndoAction(
-                new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_True ) );
-
-			pDBData->SetAutoFilter(sal_True);
-
-			for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
-			{
-				nFlag = ((ScMergeFlagAttr*) pDoc->
-						GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
-				pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) );
-			}
-			pDocSh->PostPaint( aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab,
-													 PAINT_GRID );
-			bPaint = sal_True;
-		}
-		else
-		{
-			ErrorBox aErrorBox( GetViewData()->GetDialogParent(), WinBits( WB_OK | WB_DEF_OK ),
-								ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) );
-			aErrorBox.Execute();
-		}
-	}
+            pDocSh->GetUndoManager()->AddUndoAction( new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_True ) );
 
-	if ( bPaint )
-	{
-		aModificator.SetDocumentModified();
+            pDBData->SetAutoFilter(sal_True);
 
-		SfxBindings& rBindings = GetViewData()->GetBindings();
-		rBindings.Invalidate( SID_AUTO_FILTER );
-		rBindings.Invalidate( SID_AUTOFILTER_HIDE );
-	}
+            for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2; ++nCol )
+            {
+                const sal_Int16 nFlag =
+                    ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
+                pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) );
+            }
+            pDocSh->PostPaint( aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab, PAINT_GRID );
+            bPaint = true;
+        }
+        else
+        {
+            ErrorBox aErrorBox(
+                GetViewData()->GetDialogParent(),
+                WinBits( WB_OK | WB_DEF_OK ),
+                ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) );
+            aErrorBox.Execute();
+        }
+    }
+
+    pDocSh->GetUndoManager()->LeaveListAction();
+
+    if ( bPaint )
+    {
+        aModificator.SetDocumentModified();
+
+        SfxBindings& rBindings = GetViewData()->GetBindings();
+        rBindings.Invalidate( SID_AUTO_FILTER );
+        rBindings.Invalidate( SID_AUTOFILTER_HIDE );
+    }
 }
 
 //		nur ausblenden, keine Daten veraendern
@@ -462,37 +462,48 @@ void ScDBFunc::HideAutoFilter()
     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     ScDocShellModificator aModificator( *pDocSh );
 
-	ScDocument* pDoc = pDocSh->GetDocument();
-
-	ScQueryParam aParam;
-	//ScDBData* pDBData = GetDBData( FALSE );
-    ScDBData* pDBData = GetDBData(sal_False, SC_DB_OLD_FILTER);
-
-	SCTAB nTab;
-	SCCOL nCol1, nCol2;
-	SCROW nRow1, nRow2;
-	pDBData->GetArea(nTab, nCol1, nRow1, nCol2, nRow2);
-
-	for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++)
-	{
-		sal_Int16 nFlag = ((ScMergeFlagAttr*) pDoc->
-								GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue();
-		pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
-	}
+    ScDBData* pDBData = GetDBData( sal_False );
+    SCTAB nTab;
+    SCCOL nCol1, nCol2;
+    SCROW nRow1, nRow2;
+    pDBData->GetArea(nTab, nCol1, nRow1, nCol2, nRow2);
+
+    {
+        ScDocument* pDoc = pDocSh->GetDocument();
+        for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++)
+        {
+            const sal_Int16 nFlag =
+                ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue();
+            pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
+        }
+    }
+
+    const String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY );
+    pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
+    {
+        ScRange aRange;
+        pDBData->GetArea( aRange );
+        pDocSh->GetUndoManager()->AddUndoAction(
+            new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
 
-    ScRange aRange;
-    pDBData->GetArea( aRange );
-    pDocSh->GetUndoManager()->AddUndoAction(
-        new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
+        pDBData->SetAutoFilter(sal_False);
 
-	pDBData->SetAutoFilter(sal_False);
+        // delete internal database range for auto filter
+        if ( pDBData->IsInternalForAutoFilter() )
+        {
+            ScDBDocFunc aFunc(*pDocSh);
+            aFunc.DeleteDBRange( pDBData->GetName(), sal_False );
+        }
+        pDBData = NULL;
+    }
+    pDocSh->GetUndoManager()->LeaveListAction();
 
-	pDocSh->PostPaint( nCol1,nRow1,nTab, nCol2,nRow1,nTab, PAINT_GRID );
+    pDocSh->PostPaint( nCol1,nRow1,nTab, nCol2,nRow1,nTab, PAINT_GRID );
     aModificator.SetDocumentModified();
 
-	SfxBindings& rBindings = GetViewData()->GetBindings();
-	rBindings.Invalidate( SID_AUTO_FILTER );
-	rBindings.Invalidate( SID_AUTOFILTER_HIDE );
+    SfxBindings& rBindings = GetViewData()->GetBindings();
+    rBindings.Invalidate( SID_AUTO_FILTER );
+    rBindings.Invalidate( SID_AUTOFILTER_HIDE );
 }
 
 //		Re-Import

Modified: openoffice/branches/l10n40/main/sc/source/ui/view/gridwin.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/view/gridwin.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/view/gridwin.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/view/gridwin.cxx Fri Sep 27 15:26:24 2013
@@ -4449,10 +4449,12 @@ void ScGridWindow::UpdateFormulas()
 
     aOutputData.FindChanged();
 
-    PolyPolygon aChangedPoly( aOutputData.GetChangedArea() );   // logic (PixelToLogic)
-    if ( aChangedPoly.Count() )
+    // #122149# do not use old GetChangedArea() which used polygon-based Regions, but use
+    // the region-band based new version; anyways, only rectangles are added
+    Region aChangedRegion( aOutputData.GetChangedAreaRegion() );   // logic (PixelToLogic)
+    if(!aChangedRegion.IsEmpty())
     {
-        Invalidate( aChangedPoly );
+        Invalidate(aChangedRegion);
     }
 
     CheckNeedsRepaint();    // #i90362# used to be called via Draw() - still needed here

Modified: openoffice/branches/l10n40/main/sc/source/ui/view/output.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sc/source/ui/view/output.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sc/source/ui/view/output.cxx (original)
+++ openoffice/branches/l10n40/main/sc/source/ui/view/output.cxx Fri Sep 27 15:26:24 2013
@@ -1685,42 +1685,46 @@ void ScOutputData::DrawRotatedFrame( con
 
 //	Drucker
 
-PolyPolygon ScOutputData::GetChangedArea()
+Region ScOutputData::GetChangedAreaRegion()
 {
-	PolyPolygon aPoly;
+    Region aRegion;
+    Rectangle aDrawingRect;
+    bool bHad(false);
+    long nPosY = nScrY;
+    SCSIZE nArrY;
 
-	Rectangle aDrawingRect;
-	aDrawingRect.Left() = nScrX;
-	aDrawingRect.Right() = nScrX+nScrW-1;
+    aDrawingRect.Left() = nScrX;
+    aDrawingRect.Right() = nScrX+nScrW-1;
 
-	sal_Bool	bHad	= sal_False;
-	long	nPosY	= nScrY;
-	SCSIZE	nArrY;
-	for (nArrY=1; nArrY+1<nArrCount; nArrY++)
-	{
-		RowInfo* pThisRowInfo = &pRowInfo[nArrY];
+    for(nArrY=1; nArrY+1<nArrCount; nArrY++)
+    {
+        RowInfo* pThisRowInfo = &pRowInfo[nArrY];
 
-		if ( pThisRowInfo->bChanged )
-		{
-			if (!bHad)
-			{
-				aDrawingRect.Top() = nPosY;
-				bHad = sal_True;
-			}
-			aDrawingRect.Bottom() = nPosY + pRowInfo[nArrY].nHeight - 1;
-		}
-		else if (bHad)
-		{
-			aPoly.Insert( Polygon( pDev->PixelToLogic(aDrawingRect) ) );
-			bHad = sal_False;
-		}
-		nPosY += pRowInfo[nArrY].nHeight;
-	}
+        if(pThisRowInfo->bChanged)
+        {
+            if(!bHad)
+            {
+                aDrawingRect.Top() = nPosY;
+                bHad = true;
+            }
 
-	if (bHad)
-		aPoly.Insert( Polygon( pDev->PixelToLogic(aDrawingRect) ) );
+            aDrawingRect.Bottom() = nPosY + pRowInfo[nArrY].nHeight - 1;
+        }
+        else if(bHad)
+        {
+            aRegion.Union(pDev->PixelToLogic(aDrawingRect));
+            bHad = false;
+        }
+
+        nPosY += pRowInfo[nArrY].nHeight;
+    }
+
+    if(bHad)
+    {
+        aRegion.Union(pDev->PixelToLogic(aDrawingRect));
+    }
 
-    return aPoly;
+    return aRegion;
 }
 
 sal_Bool ScOutputData::SetChangedClip()



Mime
View raw message