View | Details | Raw Unified | Return to issue 122862
Collapse All | Expand All

(-)a/main/sc/inc/dbcolect.hxx (-5 / +11 lines)
Lines 136-144 public: Link Here
136
			void		GetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const;
136
			void		GetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const;
137
			SC_DLLPUBLIC void		GetArea(ScRange& rRange) const;
137
			SC_DLLPUBLIC void		GetArea(ScRange& rRange) const;
138
			void		SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
138
			void		SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
139
            //If the name of DBData is started with "unnamed", it will be recognized as build in DBData
139
140
            sal_Bool        IsBuildin();
140
            bool IsInternalUnnamed() const;
141
			void		MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
141
            bool IsInternalForAutoFilter() const;
142
143
            void		MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
142
			sal_Bool		IsByRow() const 				{ return bByRow; }
144
			sal_Bool		IsByRow() const 				{ return bByRow; }
143
			void		SetByRow(sal_Bool bByR) 			{ bByRow = bByR; }
145
			void		SetByRow(sal_Bool bByR) 			{ bByRow = bByR; }
144
			sal_Bool		HasHeader() const 				{ return bHasHeader; }
146
			sal_Bool		HasHeader() const 				{ return bHasHeader; }
Lines 216-224 public: Link Here
216
	virtual	short		Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
218
	virtual	short		Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
217
	virtual	sal_Bool		IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const;
219
	virtual	sal_Bool		IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const;
218
			ScDBData*	GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const;
220
			ScDBData*	GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const;
219
			ScDBData*	GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
221
            ScDBData* GetDBAtArea(
222
                const SCTAB nTab,
223
                const SCCOL nCol1,
224
                const SCROW nRow1,
225
                const SCCOL nCol2,
226
                const SCROW nRow2 ) const;
220
			ScDBData*       GetFilterDBAtTable(SCTAB nTab) const;
227
			ScDBData*       GetFilterDBAtTable(SCTAB nTab) const;
221
            ScDBData*	GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const;
222
228
223
	sal_Bool	SearchName( const String& rName, sal_uInt16& rIndex ) const;
229
	sal_Bool	SearchName( const String& rName, sal_uInt16& rIndex ) const;
224
230
(-)a/main/sc/inc/document.hxx (-4 / +4 lines)
Lines 505-514 public: Link Here
505
										sal_Bool bStartOnly = sal_False) const;
505
										sal_Bool bStartOnly = sal_False) const;
506
	ScDBData*		GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
506
	ScDBData*		GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
507
    ScDBData*       GetFilterDBAtTable(SCTAB nTab) const;
507
    ScDBData*       GetFilterDBAtTable(SCTAB nTab) const;
508
//UNUSED2008-05  ScRangeData*	GetRangeAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
509
//UNUSED2008-05                                      sal_Bool bStartOnly = sal_False) const;
510
	SC_DLLPUBLIC ScRangeData*	GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const;
508
	SC_DLLPUBLIC ScRangeData*	GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const;
511
    ScDBData*       GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const;
512
509
513
	SC_DLLPUBLIC ScDPCollection*		GetDPCollection();
510
	SC_DLLPUBLIC ScDPCollection*		GetDPCollection();
514
	ScDPObject*			GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
511
	ScDPObject*			GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
Lines 1514-1520 public: Link Here
1514
								TypedScStrCollection& rStrings, sal_Bool bLimit = sal_False );
1511
								TypedScStrCollection& rStrings, sal_Bool bLimit = sal_False );
1515
	sal_Bool			GetFormulaEntries( TypedScStrCollection& rStrings );
1512
	sal_Bool			GetFormulaEntries( TypedScStrCollection& rStrings );
1516
1513
1517
	sal_Bool			HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
1514
	sal_Bool			HasAutoFilter(
1515
        const SCCOL nCol,
1516
        const SCROW nRow,
1517
        const SCTAB nTab );
1518
1518
1519
	SC_DLLPUBLIC sal_Bool			HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1519
	SC_DLLPUBLIC sal_Bool			HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1520
									SCTAB nTab );
1520
									SCTAB nTab );
(-)a/main/sc/inc/global.hxx (-7 / +4 lines)
Lines 404-416 enum ScAnchorType // Verankerung eines Zeichenobjekts Link Here
404
404
405
enum ScGetDBMode
405
enum ScGetDBMode
406
{
406
{
407
	SC_DB_MAKE,		// wenn noetig, "unbenannt" anlegen
407
    SC_DB_MAKE,             // if needed create database range with name $STR_DB_NONAME
408
	SC_DB_IMPORT,	// wenn noetig, "Importx" anlegen
408
    SC_DB_IMPORT,           // if needed create database range with name $STR_DBNAME_IMPORT[X]
409
	SC_DB_OLD,		// nicht neu anlegen
409
    SC_DB_OLD,              // do not create new database range, provide only existing one
410
	SC_DB_MAKE_FILTER,   // to create a new filter/sort/subtotal
410
    SC_DB_MAKE_AUTOFILTER   // if needed create database range with name $SC_DBNAME_UNNAMED[X]
411
	SC_DB_MAKE_SORT,
412
	SC_DB_MAKE_SUBTOTAL,
413
    SC_DB_OLD_FILTER   //to find a existed filter
414
};
411
};
415
412
416
/// For ScDBFunc::GetDBData()
413
/// For ScDBFunc::GetDBData()
(-)a/main/sc/inc/rangeutl.hxx (-1 lines)
Lines 302-308 private: Link Here
302
	ScDBCollection*	pDBCollection;
302
	ScDBCollection*	pDBCollection;
303
	sal_Bool			bFirstPass;
303
	sal_Bool			bFirstPass;
304
	sal_uInt16			nPos;
304
	sal_uInt16			nPos;
305
	String			aStrNoName;
306
305
307
public:
306
public:
308
			ScAreaNameIterator( ScDocument* pDoc );
307
			ScAreaNameIterator( ScDocument* pDoc );
(-)a/main/sc/source/core/data/documen3.cxx (-10 / +5 lines)
Lines 192-204 ScDBData* ScDocument::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nC Link Here
192
	else
192
	else
193
		return NULL;
193
		return NULL;
194
}
194
}
195
ScDBData* ScDocument::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const
196
{
197
	if (pDBCollection)
198
		return pDBCollection->GetDBAtTable(nTab, eMode);
199
	else
200
		return NULL;
201
}
202
195
203
ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const
196
ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const
204
{
197
{
Lines 1296-1305 sal_Bool ScDocument::CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR Link Here
1296
	return sal_False;
1289
	return sal_False;
1297
}
1290
}
1298
1291
1299
sal_Bool ScDocument::HasAutoFilter( SCCOL /*nCurCol*/, SCROW /*nCurRow*/, SCTAB nCurTab )
1292
sal_Bool ScDocument::HasAutoFilter(
1293
    const SCCOL nCurCol,
1294
    const SCROW nCurRow,
1295
    const SCTAB nCurTab )
1300
{
1296
{
1301
	//ScDBData*		pDBData			= GetDBAtCursor( nCurCol, nCurRow, nCurTab );
1297
	ScDBData*		pDBData			= GetDBAtCursor( nCurCol, nCurRow, nCurTab );
1302
	ScDBData*		pDBData			= GetDBAtTable(nCurTab, SC_DB_OLD_FILTER);
1303
	sal_Bool			bHasAutoFilter	= ( pDBData != NULL );
1298
	sal_Bool			bHasAutoFilter	= ( pDBData != NULL );
1304
1299
1305
	if ( pDBData )
1300
	if ( pDBData )
(-)a/main/sc/source/core/tool/dbcolect.cxx (-85 / +51 lines)
Lines 691-701 ScDataObject* ScDBData::Clone() const Link Here
691
{
691
{
692
	return new ScDBData(*this);
692
	return new ScDBData(*this);
693
}
693
}
694
sal_Bool    ScDBData::IsBuildin()
694
695
696
bool ScDBData::IsInternalUnnamed() const
695
{
697
{
696
    String  aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED);
698
    return GetName() == ScGlobal::GetRscString( STR_DB_NONAME );
697
    String  aBeginName = aName.Copy(0,22);
699
}
698
    return  (sal_Bool)(!ScGlobal::GetpTransliteration()->compareString( aNoName, aBeginName ));
700
701
bool ScDBData::IsInternalForAutoFilter() const
702
{
703
    const String aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED);
704
    const String aBeginName = aName.Copy( 0, aNoName.Len() );
705
    return aBeginName == aNoName;
699
}
706
}
700
707
701
//---------------------------------------------------------------------------------------
708
//---------------------------------------------------------------------------------------
Lines 717-756 sal_Bool ScDBCollection::IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const Link Here
717
724
718
ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const
725
ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const
719
{
726
{
720
	ScDBData* pNoNameData = NULL;
727
    ScDBData* pInternalDBData = NULL;
721
	if (pItems)
728
    if (pItems)
722
	{
729
    {
723
730
724
		for (sal_uInt16 i = 0; i < nCount; i++)
731
        for (sal_uInt16 i = 0; i < nCount; i++)
725
			if (((ScDBData*)pItems[i])->IsDBAtCursor(nCol, nRow, nTab, bStartOnly))
732
            if (((ScDBData*)pItems[i])->IsDBAtCursor(nCol, nRow, nTab, bStartOnly))
726
			{
733
            {
727
				ScDBData* pDB = (ScDBData*)pItems[i];
734
                ScDBData* pDB = (ScDBData*)pItems[i];
728
                if ( pDB->IsBuildin() )
735
                if ( pDB->IsInternalUnnamed()
729
					pNoNameData = pDB;
736
                     || pDB->IsInternalForAutoFilter() )
730
				else
737
                {
731
					return pDB;
738
                    pInternalDBData = pDB;
732
			}
739
                }
733
	}
740
                else
734
	return pNoNameData;				// "unbenannt" nur zurueck, wenn sonst nichts gefunden
741
                {
742
                    return pDB;
743
                }
744
            }
745
    }
746
    return pInternalDBData;
735
}
747
}
736
748
737
ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
749
ScDBData* ScDBCollection::GetDBAtArea(
750
    const SCTAB nTab,
751
    const SCCOL nCol1,
752
    const SCROW nRow1,
753
    const SCCOL nCol2,
754
    const SCROW nRow2 ) const
738
{
755
{
739
	ScDBData* pNoNameData = NULL;
756
    ScDBData* pInternalDBData = NULL;
740
	if (pItems)
757
    if (pItems)
741
	{
758
    {
742
759
        for (sal_uInt16 i = 0; i < nCount; i++)
743
		for (sal_uInt16 i = 0; i < nCount; i++)
760
            if (((ScDBData*)pItems[i])->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2))
744
			if (((ScDBData*)pItems[i])->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2))
761
            {
745
			{
762
                ScDBData* pDB = (ScDBData*)pItems[i];
746
				ScDBData* pDB = (ScDBData*)pItems[i];
763
                if ( pDB->IsInternalUnnamed()
747
				if ( pDB->IsBuildin() )
764
                     || pDB->IsInternalForAutoFilter() )
748
					pNoNameData = pDB;
765
                    pInternalDBData = pDB;
749
				else
766
                else
750
					return pDB;
767
                    return pDB;
751
			}
768
            }
752
	}
769
    }
753
	return pNoNameData;				// "unbenannt" nur zurueck, wenn sonst nichts gefunden
770
    return pInternalDBData;
754
}
771
}
755
772
756
ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB nTab) const
773
ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB nTab) const
Lines 920-973 String ScDBCollection::GetNewDefaultDBName() Link Here
920
    }while(SearchName(aNewName,nDummy));
937
    }while(SearchName(aNewName,nDummy));
921
    return  aNewName;
938
    return  aNewName;
922
}
939
}
923
/*
924
sal_Bool ScDBCollection::IsFiltered(SCTAB nTab, SCROW nRow)
925
{
926
    SCCOL	nLastCol;
927
    SCROW	nLastRow;
928
    pDoc->GetLastAttrCellArea(nTab, nLastCol, nLastRow);
929
930
    if ( pItems )
931
    {
932
        for (unsigned short i = 0; i < nCount; i++)
933
        {
934
            ScDBData*   pData = (ScDBData*)pItems[i];
935
            if ( pData->nTable == nTab && pData->HasQueryParam() && pData->bQueryInplace )
936
                if ( nRow >= (pData->nStartRow + (pData->HasHeader()?1:0)) && nRow <= pData->nEndRow && nRow <= nLastRow )
937
                    return sal_True;
938
        }
939
    }
940
    return sal_False;
941
}
942
*/
943
ScDBData* ScDBCollection::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const
944
{
945
    ScDBData* pDataEmpty = NULL;
946
    if (pItems)
947
    {
948
        for (unsigned short i = 0; i < nCount; i++)
949
        {
950
            ScDBData* pDBTemp = (ScDBData*)pItems[i];
951
            if ( pDBTemp->nTable == nTab )						//Sym2_7885 mod
952
            {
953
                sal_Bool bImport = pDBTemp->HasImportParam();
954
                sal_Bool bFilter = pDBTemp->HasAutoFilter() || pDBTemp->HasQueryParam();
955
                sal_Bool bSort = pDBTemp->HasSortParam();
956
                sal_Bool bSubtotal = pDBTemp->HasSubTotalParam();
957
                sal_Bool bAnyParam = bImport || bFilter || bSort || bSubtotal;
958
                if ( ((eMode == SC_DB_MAKE_SORT)    && bSort && !bFilter) ||      //Sym2_7334 mod 20100420
959
                    ((eMode == SC_DB_MAKE_SUBTOTAL) && bSubtotal && !bFilter ) ||
960
                    ((eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_OLD_FILTER) && bFilter ) )
961
                {
962
                    return pDBTemp;
963
                }
964
                else if ( pDBTemp->IsBuildin() && !bAnyParam )	//Sym2_7885 mod
965
                {
966
                    pDataEmpty = pDBTemp;
967
                }
968
            }
969
        }
970
    }
971
972
    return pDataEmpty;
973
}
(-)a/main/sc/source/core/tool/rangeutl.cxx (-38 / +38 lines)
Lines 997-1004 sal_Bool ScArea::operator==( const ScArea& r ) const Link Here
997
997
998
//------------------------------------------------------------------------
998
//------------------------------------------------------------------------
999
999
1000
ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc ) :
1000
ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc )
1001
	aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) )
1002
{
1001
{
1003
	pRangeName = pDoc->GetRangeName();
1002
	pRangeName = pDoc->GetRangeName();
1004
	pDBCollection = pDoc->GetDBCollection();
1003
	pDBCollection = pDoc->GetDBCollection();
Lines 1008-1049 ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc ) : Link Here
1008
1007
1009
sal_Bool ScAreaNameIterator::Next( String& rName, ScRange& rRange )
1008
sal_Bool ScAreaNameIterator::Next( String& rName, ScRange& rRange )
1010
{
1009
{
1011
	for (;;)
1010
    for (;;)
1012
	{
1011
    {
1013
		if ( bFirstPass )									// erst Bereichsnamen
1012
        if ( bFirstPass )									// erst Bereichsnamen
1014
		{
1013
        {
1015
			if ( pRangeName && nPos < pRangeName->GetCount() )
1014
            if ( pRangeName && nPos < pRangeName->GetCount() )
1016
			{
1015
            {
1017
				ScRangeData* pData = (*pRangeName)[nPos++];
1016
                ScRangeData* pData = (*pRangeName)[nPos++];
1018
				if ( pData && pData->IsValidReference(rRange) )
1017
                if ( pData && pData->IsValidReference(rRange) )
1019
				{
1018
                {
1020
					rName = pData->GetName();
1019
                    rName = pData->GetName();
1021
					return sal_True;							// gefunden
1020
                    return sal_True;							// gefunden
1022
				}
1021
                }
1023
			}
1022
            }
1024
			else
1023
            else
1025
			{
1024
            {
1026
				bFirstPass = sal_False;
1025
                bFirstPass = sal_False;
1027
				nPos = 0;
1026
                nPos = 0;
1028
			}
1027
            }
1029
		}
1028
        }
1030
		if ( !bFirstPass )									// dann DB-Bereiche
1029
        if ( !bFirstPass )									// dann DB-Bereiche
1031
		{
1030
        {
1032
			if ( pDBCollection && nPos < pDBCollection->GetCount() )
1031
            if ( pDBCollection && nPos < pDBCollection->GetCount() )
1033
			{
1032
            {
1034
				ScDBData* pData = (*pDBCollection)[nPos++];
1033
                ScDBData* pData = (*pDBCollection)[nPos++];
1035
//				if (pData && pData->GetName() != aStrNoName)
1034
                if ( pData
1036
				if (pData && !pData->IsBuildin())
1035
                     && !pData->IsInternalUnnamed()
1037
				{
1036
                     && !pData->IsInternalForAutoFilter() )
1038
					pData->GetArea( rRange );
1037
                {
1039
					rName = pData->GetName();
1038
                    pData->GetArea( rRange );
1040
					return sal_True;							// gefunden
1039
                    rName = pData->GetName();
1041
				}
1040
                    return sal_True;							// gefunden
1042
			}
1041
                }
1043
			else
1042
            }
1044
				return sal_False;								// gibt nichts mehr
1043
            else
1045
		}
1044
                return sal_False;								// gibt nichts mehr
1046
	}
1045
        }
1046
    }
1047
}
1047
}
1048
1048
1049
1049
(-)a/main/sc/source/ui/dbgui/dbnamdlg.cxx (-107 / +110 lines)
Lines 160-166 ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, Link Here
160
160
161
		aStrAdd			( ScResId( STR_ADD ) ),
161
		aStrAdd			( ScResId( STR_ADD ) ),
162
		aStrModify		( ScResId( STR_MODIFY ) ),
162
		aStrModify		( ScResId( STR_MODIFY ) ),
163
		aStrNoName		( ScGlobal::GetRscString(STR_DB_NONAME) ),
164
		aStrInvalid		( ScResId( STR_DB_INVALID ) ),
163
		aStrInvalid		( ScResId( STR_DB_INVALID ) ),
165
		//
164
		//
166
		pViewData		( ptrViewData ),
165
		pViewData		( ptrViewData ),
Lines 205-291 __EXPORT ScDbNameDlg::~ScDbNameDlg() Link Here
205
204
206
void ScDbNameDlg::Init()
205
void ScDbNameDlg::Init()
207
{
206
{
208
	aBtnHeader.Check( sal_True );		// Default: mit Spaltenkoepfen
207
    aBtnHeader.Check( sal_True );		// Default: mit Spaltenkoepfen
209
208
210
    aBtnMore.AddWindow( &aFlOptions );
209
    aBtnMore.AddWindow( &aFlOptions );
211
	aBtnMore.AddWindow( &aBtnHeader );
210
    aBtnMore.AddWindow( &aBtnHeader );
212
	aBtnMore.AddWindow( &aBtnDoSize );
211
    aBtnMore.AddWindow( &aBtnDoSize );
213
	aBtnMore.AddWindow( &aBtnKeepFmt );
212
    aBtnMore.AddWindow( &aBtnKeepFmt );
214
	aBtnMore.AddWindow( &aBtnStripData );
213
    aBtnMore.AddWindow( &aBtnStripData );
215
	aBtnMore.AddWindow( &aFTSource );
214
    aBtnMore.AddWindow( &aFTSource );
216
	aBtnMore.AddWindow( &aFTOperations );
215
    aBtnMore.AddWindow( &aFTOperations );
217
216
218
	String	theAreaStr;
217
    String	theAreaStr;
219
	SCCOL	nStartCol 	= 0;
218
    SCCOL	nStartCol 	= 0;
220
	SCROW	nStartRow 	= 0;
219
    SCROW	nStartRow 	= 0;
221
	SCTAB	nStartTab 	= 0;
220
    SCTAB	nStartTab 	= 0;
222
	SCCOL	nEndCol 	= 0;
221
    SCCOL	nEndCol 	= 0;
223
	SCROW	nEndRow		= 0;
222
    SCROW	nEndRow		= 0;
224
	SCTAB	nEndTab 	= 0;
223
    SCTAB	nEndTab 	= 0;
225
224
226
	aBtnOk.SetClickHdl		( LINK( this, ScDbNameDlg, OkBtnHdl ) );
225
    aBtnOk.SetClickHdl		( LINK( this, ScDbNameDlg, OkBtnHdl ) );
227
	aBtnCancel.SetClickHdl	( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
226
    aBtnCancel.SetClickHdl	( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
228
	aBtnAdd.SetClickHdl		( LINK( this, ScDbNameDlg, AddBtnHdl ) );
227
    aBtnAdd.SetClickHdl		( LINK( this, ScDbNameDlg, AddBtnHdl ) );
229
	aBtnRemove.SetClickHdl	( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
228
    aBtnRemove.SetClickHdl	( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
230
	aEdName.SetModifyHdl	( LINK( this, ScDbNameDlg, NameModifyHdl ) );
229
    aEdName.SetModifyHdl	( LINK( this, ScDbNameDlg, NameModifyHdl ) );
231
	aEdAssign.SetModifyHdl	( LINK( this, ScDbNameDlg, AssModifyHdl ) );
230
    aEdAssign.SetModifyHdl	( LINK( this, ScDbNameDlg, AssModifyHdl ) );
232
	UpdateNames();
231
    UpdateNames();
233
232
234
	if ( pViewData && pDoc )
233
    if ( pViewData && pDoc )
235
	{
234
    {
236
		ScDBCollection*	pDBColl	= pDoc->GetDBCollection();
235
        ScDBCollection*	pDBColl	= pDoc->GetDBCollection();
237
		ScDBData*		pDBData = NULL;
236
        ScDBData*		pDBData = NULL;
238
237
239
		pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
238
        pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
240
								  nEndCol,	 nEndRow,  nEndTab );
239
            nEndCol,	 nEndRow,  nEndTab );
241
240
242
		theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
241
        theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
243
							  ScAddress( nEndCol,   nEndRow,   nEndTab ) );
242
            ScAddress( nEndCol,   nEndRow,   nEndTab ) );
244
243
245
		theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails );
244
        theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails );
246
245
247
		if ( pDBColl )
246
        if ( pDBColl )
248
		{
247
        {
249
			// Feststellen, ob definierter DB-Bereich markiert wurde:
248
            // Feststellen, ob definierter DB-Bereich markiert wurde:
250
			pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, sal_True );
249
            pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, sal_True );
251
			if ( pDBData )
250
            if ( pDBData )
252
			{
251
            {
253
				String		theDbName;
252
                String		theDbName;
254
				ScAddress&	rStart = theCurArea.aStart;
253
                ScAddress&	rStart = theCurArea.aStart;
255
				ScAddress&	rEnd   = theCurArea.aEnd;
254
                ScAddress&	rEnd   = theCurArea.aEnd;
256
                SCCOL nCol1;
255
                SCCOL nCol1;
257
                SCCOL  nCol2;
256
                SCCOL  nCol2;
258
                SCROW  nRow1;
257
                SCROW  nRow1;
259
                SCROW  nRow2;
258
                SCROW  nRow2;
260
                SCTAB  nTab;
259
                SCTAB  nTab;
261
260
262
				pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
261
                pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
263
262
264
				if (   (rStart.Tab() == nTab)
263
                if (   (rStart.Tab() == nTab)
265
					&& (rStart.Col() == nCol1) && (rStart.Row() == nRow1)
264
                    && (rStart.Col() == nCol1) && (rStart.Row() == nRow1)
266
					&& (rEnd.Col()   == nCol2) && (rEnd.Row()   == nRow2 ) )
265
                    && (rEnd.Col()   == nCol2) && (rEnd.Row()   == nRow2 ) )
267
				{
266
                {
268
					pDBData->GetName( theDbName );
267
                    pDBData->GetName( theDbName );
269
					//if ( theDbName != aStrNoName )
268
                    if ( !pDBData->IsInternalUnnamed()
270
					if ( !pDBData->IsBuildin() )
269
                         && !pDBData->IsInternalForAutoFilter() )
271
						aEdName.SetText( theDbName );
270
                    {
272
					else
271
                        aEdName.SetText( theDbName );
273
						aEdName.SetText( EMPTY_STRING );
272
                    }
274
					aBtnHeader.Check( pDBData->HasHeader() );
273
                    else
275
					aBtnDoSize.Check( pDBData->IsDoSize() );
274
                    {
276
					aBtnKeepFmt.Check( pDBData->IsKeepFmt() );
275
                        aEdName.SetText( EMPTY_STRING );
277
					aBtnStripData.Check( pDBData->IsStripData() );
276
                    }
278
					SetInfoStrings( pDBData );
277
                    aBtnHeader.Check( pDBData->HasHeader() );
279
				}
278
                    aBtnDoSize.Check( pDBData->IsDoSize() );
280
			}
279
                    aBtnKeepFmt.Check( pDBData->IsKeepFmt() );
281
		}
280
                    aBtnStripData.Check( pDBData->IsStripData() );
282
	}
281
                    SetInfoStrings( pDBData );
283
282
                }
284
	aEdAssign.SetText( theAreaStr );
283
            }
285
	aEdName.GrabFocus();
284
        }
286
	bSaved=sal_True;
285
    }
287
	pSaveObj->Save();
286
288
	NameModifyHdl( 0 );
287
    aEdAssign.SetText( theAreaStr );
288
    aEdName.GrabFocus();
289
    bSaved=sal_True;
290
    pSaveObj->Save();
291
    NameModifyHdl( 0 );
289
}
292
}
290
293
291
294
Lines 361-399 void ScDbNameDlg::SetActive() Link Here
361
364
362
void ScDbNameDlg::UpdateNames()
365
void ScDbNameDlg::UpdateNames()
363
{
366
{
364
	sal_uInt16	nNameCount = aLocalDbCol.GetCount();
367
    sal_uInt16	nNameCount = aLocalDbCol.GetCount();
365
368
366
	aEdName.SetUpdateMode( sal_False );
369
    aEdName.SetUpdateMode( sal_False );
367
	//-----------------------------------------------------------
370
    //-----------------------------------------------------------
368
	aEdName.Clear();
371
    aEdName.Clear();
369
	aEdAssign.SetText( EMPTY_STRING );
372
    aEdAssign.SetText( EMPTY_STRING );
370
373
371
	if ( nNameCount > 0 )
374
    if ( nNameCount > 0 )
372
	{
375
    {
373
		ScDBData*	pDbData = NULL;
376
        ScDBData*	pDbData = NULL;
374
		String		aString;
377
        String		aString;
375
378
376
		for ( sal_uInt16 i=0; i<nNameCount; i++ )
379
        for ( sal_uInt16 i=0; i<nNameCount; i++ )
377
		{
380
        {
378
			pDbData = (ScDBData*)(aLocalDbCol.At( i ));
381
            pDbData = (ScDBData*)(aLocalDbCol.At( i ));
379
			if ( pDbData )
382
            if ( pDbData )
380
			{
383
            {
381
				pDbData->GetName( aString );
384
                pDbData->GetName( aString );
382
				//if ( aString != aStrNoName )
385
                if ( !pDbData->IsInternalUnnamed()
383
				if ( !pDbData->IsBuildin() )
386
                     && !pDbData->IsInternalForAutoFilter() )
384
					aEdName.InsertEntry( aString );
387
                    aEdName.InsertEntry( aString );
385
			}
388
            }
386
		}
389
        }
387
	}
390
    }
388
	else
391
    else
389
	{
392
    {
390
		aBtnAdd.SetText( aStrAdd );
393
        aBtnAdd.SetText( aStrAdd );
391
		aBtnAdd.Disable();
394
        aBtnAdd.Disable();
392
		aBtnRemove.Disable();
395
        aBtnRemove.Disable();
393
	}
396
    }
394
	//-----------------------------------------------------------
397
    //-----------------------------------------------------------
395
	aEdName.SetUpdateMode( sal_True );
398
    aEdName.SetUpdateMode( sal_True );
396
	aEdName.Invalidate();
399
    aEdName.Invalidate();
397
}
400
}
398
401
399
//------------------------------------------------------------------------
402
//------------------------------------------------------------------------
(-)a/main/sc/source/ui/dbgui/foptmgr.cxx (-18 / +18 lines)
Lines 174-197 void ScFilterOptionsMgr::Init() Link Here
174
174
175
		theDbArea = theAreaStr;
175
		theDbArea = theAreaStr;
176
176
177
		if ( pDBColl )
177
        if ( pDBColl )
178
		{
178
        {
179
			ScAddress&	rStart	= theCurArea.aStart;
179
            ScAddress&	rStart	= theCurArea.aStart;
180
			ScAddress&	rEnd	= theCurArea.aEnd;
180
            ScAddress&	rEnd	= theCurArea.aEnd;
181
			ScDBData*	pDBData = pDBColl->GetDBAtArea(	rStart.Tab(),
181
            ScDBData*	pDBData = pDBColl->GetDBAtArea(
182
														rStart.Col(), rStart.Row(),
182
                rStart.Tab(), rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() );
183
														rEnd.Col(),   rEnd.Row() );
183
            if ( pDBData )
184
			if ( pDBData )
184
            {
185
			{
185
                rBtnHeader.Check( pDBData->HasHeader() );
186
				rBtnHeader.Check( pDBData->HasHeader() );
186
                pDBData->GetName( theDbName );
187
				pDBData->GetName( theDbName );
187
188
188
                if ( !pDBData->IsInternalUnnamed()
189
                if ( !pDBData->IsBuildin() )
189
                     && !pDBData->IsInternalForAutoFilter() )
190
				{
190
                {
191
					rBtnHeader.Disable();
191
                    rBtnHeader.Disable();
192
				}
192
                }
193
			}
193
            }
194
		}
194
        }
195
195
196
		theDbArea.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
196
		theDbArea.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
197
		theDbArea += theDbName;
197
		theDbArea += theDbName;
(-)a/main/sc/source/ui/docshell/dbdocfun.cxx (-2 / +2 lines)
Lines 592-598 sal_Bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, Link Here
592
		if (pDestData)
592
		if (pDestData)
593
			pNewData = pDestData;				// Bereich vorhanden -> anpassen
593
			pNewData = pDestData;				// Bereich vorhanden -> anpassen
594
		else									// Bereich ab Cursor/Markierung wird angelegt
594
		else									// Bereich ab Cursor/Markierung wird angelegt
595
			pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE_SORT, SC_DBSEL_FORCE_MARK );
595
			pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );
596
		if (pNewData)
596
		if (pNewData)
597
		{
597
		{
598
			pNewData->SetArea( nTab,
598
			pNewData->SetArea( nTab,
Lines 919-925 sal_Bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, Link Here
919
			pNewData = rDocShell.GetDBData(
919
			pNewData = rDocShell.GetDBData(
920
							ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
920
							ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
921
									 aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ),
921
									 aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ),
922
							SC_DB_MAKE_FILTER, SC_DBSEL_FORCE_MARK );
922
							SC_DB_MAKE, SC_DBSEL_FORCE_MARK );
923
923
924
		if (pNewData)
924
		if (pNewData)
925
		{
925
		{
(-)a/main/sc/source/ui/docshell/docsh5.cxx (-359 / +237 lines)
Lines 111-520 void ScDocShell::DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCR Link Here
111
    aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
111
    aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
112
}
112
}
113
113
114
ScDBData* lcl_GetDBNearCursor( ScDBCollection* pColl, SCCOL nCol, SCROW nRow, SCTAB nTab )
115
{
116
	//!	nach document/dbcolect verschieben
117
118
	if (!pColl)
119
		return NULL;
120
121
	ScDBData* pNoNameData = NULL;
122
	ScDBData* pNearData = NULL;
123
	sal_uInt16 nCount = pColl->GetCount();
124
	String aNoName = ScGlobal::GetRscString( STR_DB_NONAME );
125
	SCTAB nAreaTab;
126
	SCCOL nStartCol, nEndCol;
127
	SCROW nStartRow, nEndRow;
128
	for (sal_uInt16 i = 0; i < nCount; i++)
129
	{
130
		ScDBData* pDB = (*pColl)[i];
131
		pDB->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
132
		if ( nTab == nAreaTab && nCol+1 >= nStartCol && nCol <= nEndCol+1 &&
133
								 nRow+1 >= nStartRow && nRow <= nEndRow+1 )
134
		{
135
			if ( pDB->GetName() == aNoName )
136
				pNoNameData = pDB;
137
			else if ( nCol < nStartCol || nCol > nEndCol || nRow < nStartRow || nRow > nEndRow )
138
			{
139
				if (!pNearData)
140
					pNearData = pDB;	// ersten angrenzenden Bereich merken
141
			}
142
			else
143
				return pDB;				// nicht "unbenannt" und Cursor steht wirklich drin
144
		}
145
	}
146
	if (pNearData)
147
		return pNearData;				// angrenzender, wenn nichts direkt getroffen
148
	return pNoNameData;					// "unbenannt" nur zurueck, wenn sonst nichts gefunden
149
}
150
114
151
ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel )
115
ScDBData* lcl_GetDBNearCursor(
116
    const ScDBCollection* pColl,
117
    const SCCOL nCol,
118
    const SCROW nRow,
119
    const SCTAB nTab )
152
{
120
{
153
    if ( eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_MAKE_SORT || eMode == SC_DB_MAKE_SUBTOTAL || eMode == SC_DB_OLD_FILTER )
121
    //!	nach document/dbcolect verschieben
154
        return GetDBDataAdd(rMarked, eMode, eSel);
122
155
	SCCOL nCol = rMarked.aStart.Col();
123
    if (!pColl)
156
	SCROW nRow = rMarked.aStart.Row();
124
        return NULL;
157
	SCTAB nTab = rMarked.aStart.Tab();
125
158
126
    ScDBData* pInternalDBData = NULL;
159
	SCCOL nStartCol = nCol;
127
    ScDBData* pNearData = NULL;
160
	SCROW nStartRow = nRow;
128
    sal_uInt16 nCount = pColl->GetCount();
161
	SCTAB nStartTab = nTab;
129
    SCTAB nAreaTab;
162
	SCCOL nEndCol = rMarked.aEnd.Col();
130
    SCCOL nStartCol, nEndCol;
163
	SCROW nEndRow = rMarked.aEnd.Row();
131
    SCROW nStartRow, nEndRow;
164
	SCTAB nEndTab = rMarked.aEnd.Tab();
132
    for (sal_uInt16 i = 0; i < nCount; i++)
165
133
    {
166
	//	Wegen #49655# nicht einfach GetDBAtCursor: Der zusammenhaengende Datenbereich
134
        ScDBData* pDB = (*pColl)[i];
167
	//	fuer "unbenannt" (GetDataArea) kann neben dem Cursor legen, also muss auch ein
135
        pDB->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
168
	//	benannter DB-Bereich dort gesucht werden.
136
        if ( nTab == nAreaTab
169
137
             && nCol+1 >= nStartCol
170
	ScDBData* pData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
138
             && nCol <= nEndCol+1
171
	if (!pData)
139
             && nRow+1 >= nStartRow
172
		pData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab );
140
             && nRow <= nEndRow+1 )
173
141
        {
174
	sal_Bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK ||
142
            if ( pDB->IsInternalUnnamed()
175
            (rMarked.aStart != rMarked.aEnd && eSel != SC_DBSEL_ROW_DOWN) );
143
                 || pDB->IsInternalForAutoFilter() )
176
    bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row());
177
178
	sal_Bool bUseThis = sal_False;
179
	if (pData)
180
	{
181
		//		Bereich nehmen, wenn nichts anderes markiert
182
183
		SCTAB nDummy;
184
		SCCOL nOldCol1;
185
		SCROW nOldRow1;
186
		SCCOL nOldCol2;
187
		SCROW nOldRow2;
188
		pData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 );
189
//		sal_Bool bIsNoName = ( pData->GetName() == ScGlobal::GetRscString( STR_DB_NONAME ) );
190
		sal_Bool bIsNoName = pData->IsBuildin();
191
192
		if (!bSelected)
193
		{
194
			bUseThis = sal_True;
195
			if ( bIsNoName && eMode == SC_DB_MAKE )
196
			{
197
                // If nothing marked or only one row marked, adapt 
198
                // "unbenannt"/"unnamed" to contiguous area.
199
                nStartCol = nCol;
200
                nStartRow = nRow;
201
                if (bOnlyDown)
202
                {
203
                    nEndCol = rMarked.aEnd.Col();
204
                    nEndRow = rMarked.aEnd.Row();
205
                }
206
                else
207
                {
208
                    nEndCol = nStartCol;
209
                    nEndRow = nStartRow;
210
                }
211
				aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
212
				if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow )
213
					bUseThis = sal_False;				// passt gar nicht
214
				else if ( nOldRow2 != nEndRow )
215
				{
216
					//	Bereich auf neue End-Zeile erweitern
217
					pData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow );
218
				}
219
			}
220
		}
221
		else
222
		{
223
			if ( nOldCol1 == nStartCol && nOldRow1 == nStartRow &&
224
				 nOldCol2 == nEndCol && nOldRow2 == nEndRow )				// genau markiert?
225
				bUseThis = sal_True;
226
			else
227
				bUseThis = sal_False;			// immer Markierung nehmen (Bug 11964)
228
		}
229
230
		//		fuer Import nie "unbenannt" nehmen
231
232
		if ( bUseThis && eMode == SC_DB_IMPORT && bIsNoName )
233
			bUseThis = sal_False;
234
	}
235
236
	if ( bUseThis )
237
	{
238
		pData->GetArea( nStartTab, nStartCol,nStartRow, nEndCol,nEndRow );
239
		nEndTab = nStartTab;
240
	}
241
	else if ( eMode == SC_DB_OLD )
242
	{
243
		pData = NULL;							// nichts gefunden
244
		nStartCol = nEndCol = nCol;
245
		nStartRow = nEndRow = nRow;
246
		nStartTab = nEndTab = nTab;
247
//		bMark = sal_False;							// nichts zu markieren
248
	}
249
	else
250
	{
251
		if ( bSelected )
252
		{
253
//			bMark = sal_False;
254
		}
255
		else
256
		{										// zusammenhaengender Bereich
257
			nStartCol = nCol;
258
			nStartRow = nRow;
259
            if (bOnlyDown)
260
            {
261
                nEndCol = rMarked.aEnd.Col();
262
                nEndRow = rMarked.aEnd.Row();
263
            }
264
            else
265
            {
144
            {
266
                nEndCol = nStartCol;
145
                pInternalDBData = pDB;
267
                nEndRow = nStartRow;
268
            }
146
            }
269
			aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
147
            else if ( nCol < nStartCol || nCol > nEndCol || nRow < nStartRow || nRow > nEndRow )
270
		}
271
272
		sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
273
274
		ScDBData* pNoNameData;
275
		sal_uInt16 nNoNameIndex;
276
		ScDBCollection* pColl = aDocument.GetDBCollection();
277
		if ( eMode != SC_DB_IMPORT &&
278
				pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nNoNameIndex ) )
279
		{
280
			pNoNameData = (*pColl)[nNoNameIndex];
281
282
            if ( !pOldAutoDBRange )
283
            {
148
            {
284
                // store the old unnamed database range with its settings for undo
149
                if ( !pNearData )
285
                // (store at the first change, get the state before all changes)
150
                    pNearData = pDB;	// ersten angrenzenden Bereich merken
286
                pOldAutoDBRange = new ScDBData( *pNoNameData );
287
            }
151
            }
288
152
            else
289
			SCCOL nOldX1;									// alten Bereich sauber wegnehmen
153
                return pDB;				// nicht "unbenannt" und Cursor steht wirklich drin
290
			SCROW nOldY1;									//! (UNDO ???)
154
        }
291
			SCCOL nOldX2;
155
    }
292
			SCROW nOldY2;
156
    if (pNearData)
293
			SCTAB nOldTab;
157
        return pNearData;				// angrenzender, wenn nichts direkt getroffen
294
			pNoNameData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
158
    return pInternalDBData;
295
			DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
296
297
			pNoNameData->SetSortParam( ScSortParam() ); 			// Parameter zuruecksetzen
298
			pNoNameData->SetQueryParam( ScQueryParam() );
299
			pNoNameData->SetSubTotalParam( ScSubTotalParam() );
300
301
			pNoNameData->SetArea( nTab, nStartCol,nStartRow, nEndCol,nEndRow ); 	// neu setzen
302
			pNoNameData->SetByRow( sal_True );
303
			pNoNameData->SetHeader( bHasHeader );
304
			pNoNameData->SetAutoFilter( sal_False );
305
		}
306
		else
307
		{
308
			ScDBCollection* pUndoColl = NULL;
309
310
			String aNewName;
311
			if (eMode==SC_DB_IMPORT)
312
			{
313
				aDocument.CompileDBFormula( sal_True );			// CreateFormulaString
314
				pUndoColl = new ScDBCollection( *pColl );	// Undo fuer Import1-Bereich
315
316
				String aImport = ScGlobal::GetRscString( STR_DBNAME_IMPORT );
317
				long nCount = 0;
318
				sal_uInt16 nDummy;
319
				do
320
				{
321
					++nCount;
322
					aNewName = aImport;
323
					aNewName += String::CreateFromInt32( nCount );
324
				}
325
				while (pColl->SearchName( aNewName, nDummy ));
326
			}
327
			else
328
				//aNewName = ScGlobal::GetRscString( STR_DB_NONAME );
329
				aNewName = pColl->GetNewDefaultDBName();
330
331
			pNoNameData = new ScDBData( aNewName, nTab,
332
								nStartCol,nStartRow, nEndCol,nEndRow,
333
								sal_True, bHasHeader );
334
			pColl->Insert( pNoNameData );
335
336
			if ( pUndoColl )
337
			{
338
				aDocument.CompileDBFormula( sal_False );		// CompileFormulaString
339
340
				ScDBCollection* pRedoColl = new ScDBCollection( *pColl );
341
				GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) );
342
			}
343
344
			//	neuen Bereich am Sba anmelden nicht mehr noetig
345
346
			//	"Import1" etc am Navigator bekanntmachen
347
			if (eMode==SC_DB_IMPORT)
348
				SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
349
		}
350
		pData = pNoNameData;
351
	}
352
353
//	if (bMark)
354
//		MarkRange( ScRange( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ), sal_False );
355
356
	return pData;
357
}
159
}
358
160
359
ScDBData* ScDocShell::GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel )
161
ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel )
360
{
162
{
361
    SCCOL nCol = rMarked.aStart.Col();
163
    const SCCOL nCol = rMarked.aStart.Col();
362
    SCROW nRow = rMarked.aStart.Row();
164
    const SCROW nRow = rMarked.aStart.Row();
363
    SCTAB nTab = rMarked.aStart.Tab();
165
    const SCTAB nTab = rMarked.aStart.Tab();
364
166
365
    SCCOL nStartCol = nCol;
167
    SCCOL nStartCol = nCol;
366
    SCROW nStartRow = nRow;
168
    SCROW nStartRow = nRow;
367
    SCCOL nEndCol = rMarked.aEnd.Col();
169
    SCCOL nEndCol = rMarked.aEnd.Col();
368
    SCROW nEndRow = rMarked.aEnd.Row();
170
    SCROW nEndRow = rMarked.aEnd.Row();
369
171
370
    ScDBData* pData = NULL;
172
    ScDBData* pFoundDBData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
371
    ScDBData* pCursorData;
173
    if ( pFoundDBData == NULL )
372
    pCursorData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
174
    {
373
    if ( !pCursorData )
175
        pFoundDBData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab );
374
        pCursorData = aDocument.GetDBAtCursor( nStartCol, nStartRow, nTab );
176
    }
375
376
    //Get DBData at current table
377
    ScDBData* pTableData = aDocument.GetDBAtTable( nTab, eMode );
378
379
    if ( eMode == SC_DB_OLD_FILTER )
380
        return pTableData;
381
177
382
    sal_Bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK || rMarked.aStart != rMarked.aEnd ); 
178
    const bool bSelected =
383
    bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row());
179
        ( eSel == SC_DBSEL_FORCE_MARK
180
          || ( rMarked.aStart != rMarked.aEnd
181
               && eSel != SC_DBSEL_ROW_DOWN ) );
182
    const bool bOnlyDown = ( !bSelected
183
                             && eSel == SC_DBSEL_ROW_DOWN
184
                             && rMarked.aStart.Row() == rMarked.aEnd.Row());
384
185
385
	sal_Bool bUseThis = sal_False;
186
    bool bUseFoundDBData = false;
386
    if (pCursorData)
187
    if ( pFoundDBData )
387
    {
188
    {
189
        // check, if found database range can be used
388
        SCTAB nDummy;
190
        SCTAB nDummy;
389
        SCCOL nOldCol1;
191
        SCCOL nOldCol1;
390
        SCROW nOldRow1;
192
        SCROW nOldRow1;
391
        SCCOL nOldCol2;
193
        SCCOL nOldCol2;
392
        SCROW nOldRow2;
194
        SCROW nOldRow2;
393
        pCursorData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 );
195
        pFoundDBData->GetArea( nDummy, nOldCol1, nOldRow1, nOldCol2, nOldRow2 );
196
197
        const bool bIsUnnamedOne = pFoundDBData->IsInternalUnnamed();
198
        const bool bIsInternalForAutoFilter = pFoundDBData->IsInternalForAutoFilter();
394
        if ( !bSelected )
199
        if ( !bSelected )
395
        {    
200
        {
396
              ScRange tmpRange;
201
            bUseFoundDBData = true;
397
              if ( !pCursorData->IsBuildin() && pCursorData->GetAdvancedQuerySource(tmpRange))	 
202
            if ( ( bIsUnnamedOne || bIsInternalForAutoFilter )
398
                   bUseThis = sal_True;			   
203
                 && ( eMode == SC_DB_MAKE || eMode == SC_DB_MAKE_AUTOFILTER ) )
399
              else
204
            {
400
             {  
205
                // If nothing marked or only one row marked, adapt found database range to contiguous area.
401
                 nStartCol = nCol;
206
                nStartCol = nCol;
402
                 nStartRow = nRow;
207
                nStartRow = nRow;
403
                 nEndCol = nStartCol;
208
                if ( bOnlyDown )
404
                 nEndRow = nStartRow;
209
                {
405
				aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
210
                    nEndCol = rMarked.aEnd.Col();
406
                 if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow )
211
                    nEndRow = rMarked.aEnd.Row();
407
                     bUseThis = sal_False;
212
                }
408
                 else
213
                else
409
                 {
214
                {
410
                     bUseThis = sal_True;
215
                    nEndCol = nStartCol;
411
                     if ( nOldRow2 != nEndRow )// Range of new end-line expand
216
                    nEndRow = nStartRow;
412
                     pCursorData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow );
217
                }
413
                 }
218
                aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
219
                if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow )
220
                {
221
                    bUseFoundDBData = false;
222
                }
223
                else if ( nOldRow2 != nEndRow )
224
                {
225
                    // adapt found internal database range to new end row
226
                    pFoundDBData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow );
227
                }
414
            }
228
            }
415
416
        }
229
        }
417
        else
230
        else
418
        {
231
        {
419
            if ( nOldCol1 == nStartCol && nOldRow1 == nStartRow && nOldCol2 == nEndCol && nOldRow2 == nEndRow )
232
            if ( nOldCol1 == nStartCol
420
				bUseThis = sal_True;
233
                 && nOldRow1 == nStartRow
234
                 && nOldCol2 == nEndCol
235
                 && nOldRow2 == nEndRow )
236
            {
237
                bUseFoundDBData = true;
238
            }
421
            else
239
            else
422
				bUseThis = sal_False;			// Always take mark (Bug 11964)
240
            {
241
                bUseFoundDBData = false;
242
            }
423
        }
243
        }
424
    }
425
244
426
    if ( bUseThis )
245
        // adapt internal unnamed database range to an auto filter one
427
    {
246
        // otherwise the auto filter is lost when the internal unnamed one is changed/reused/deleted
428
        pData = pCursorData;
247
        if ( bUseFoundDBData
429
        if ( pTableData && eMode == SC_DB_MAKE_FILTER && !(*pTableData == *pCursorData ) )
248
             && eMode == SC_DB_MAKE_AUTOFILTER
249
             && bIsUnnamedOne )
430
        {
250
        {
431
            if ( !pOldAutoDBRange )
251
            pFoundDBData->SetName( aDocument.GetDBCollection()->GetNewDefaultDBName() );
432
                pOldAutoDBRange = new ScDBData(*pTableData);
252
        }
433
            SCCOL nOldX1;
434
            SCROW nOldY1;
435
            SCCOL nOldX2;
436
            SCROW nOldY2;
437
            SCTAB nOldTab;
438
            pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
439
440
            if (pTableData->HasQueryParam())
441
            {
442
                ScQueryParam    aParam;
443
                pTableData->GetQueryParam(aParam);
444
                SCSIZE nEC = aParam.GetEntryCount();
445
                for (SCSIZE i=0; i<nEC; i++)
446
                    aParam.GetEntry(i).bDoQuery = sal_False;
447
                aParam.bDuplicate = sal_True;
448
                ScDBDocFunc aDBDocFunc( *this );
449
                aDBDocFunc.Query( nTab, aParam, NULL, sal_False, sal_False );
450
            }
451
253
452
            DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
254
        // no internal database range for Import
453
            pTableData->SetQueryParam( ScQueryParam() );
255
        if ( bUseFoundDBData
454
            pTableData->SetAutoFilter( sal_False );
256
             && eMode == SC_DB_IMPORT
257
             && ( bIsUnnamedOne || bIsInternalForAutoFilter ) )
258
        {
259
            bUseFoundDBData = false;
455
        }
260
        }
261
    }
262
263
    if ( bUseFoundDBData )
264
    {
265
        return pFoundDBData;
266
    }
456
267
268
    if ( eMode == SC_DB_OLD )
269
    {
270
        // no existing database range found
271
        return NULL;
457
    }
272
    }
458
    else
273
    else // eMode == SC_DB_MAKE||SC_DB_IMPORT||SC_DB_MAKE_AUTOFILTER
459
    {
274
    {
460
        if ( bSelected )
275
        if ( !bSelected )
461
        {
462
//			bMark = sal_False;
463
        }
464
        else
465
        {
276
        {
466
            nStartCol = nCol;
277
            nStartCol = nCol;
467
            nStartRow = nRow;
278
            nStartRow = nRow;
468
            nEndCol = nStartCol;
279
            if (bOnlyDown)
469
            nEndRow = nStartRow;
280
            {
470
			aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
281
                nEndCol = rMarked.aEnd.Col();
282
                nEndRow = rMarked.aEnd.Row();
283
            }
284
            else
285
            {
286
                nEndCol = nStartCol;
287
                nEndRow = nStartRow;
288
            }
289
            aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown );
471
        }
290
        }
472
        sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
291
292
        const sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
293
294
        ScDBData* pDBData = NULL;
295
        sal_uInt16 nUnnamedDBIndex;
473
        ScDBCollection* pColl = aDocument.GetDBCollection();
296
        ScDBCollection* pColl = aDocument.GetDBCollection();
474
        if ( pTableData )
297
        if ( eMode == SC_DB_MAKE &&
298
             pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nUnnamedDBIndex ) )
475
        {
299
        {
300
            // adapt existing unnamed database range
301
            pDBData = (*pColl)[nUnnamedDBIndex];
302
476
            if ( !pOldAutoDBRange )
303
            if ( !pOldAutoDBRange )
477
                pOldAutoDBRange = new ScDBData(*pTableData);
304
            {
305
                // store the old unnamed database range with its settings for undo
306
                // (store at the first change, get the state before all changes)
307
                pOldAutoDBRange = new ScDBData( *pDBData );
308
            }
309
478
            SCCOL nOldX1;
310
            SCCOL nOldX1;
479
            SCROW nOldY1;
311
            SCROW nOldY1;
480
            SCCOL nOldX2;
312
            SCCOL nOldX2;
481
            SCROW nOldY2;
313
            SCROW nOldY2;
482
            SCTAB nOldTab;
314
            SCTAB nOldTab;
483
            pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
315
            pDBData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
316
            DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
317
318
            pDBData->SetSortParam( ScSortParam() );
319
            pDBData->SetQueryParam( ScQueryParam() );
320
            pDBData->SetSubTotalParam( ScSubTotalParam() );
321
322
            pDBData->SetArea( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
323
            pDBData->SetByRow( sal_True );
324
            pDBData->SetHeader( bHasHeader );
325
            pDBData->SetAutoFilter( sal_False );
326
        }
327
        else
328
        {
329
            ScDBCollection* pUndoColl = NULL;
330
331
            String aNewName;
332
            switch ( eMode )
333
            {
334
            case SC_DB_IMPORT:
335
            {
336
                aDocument.CompileDBFormula( sal_True );
337
                pUndoColl = new ScDBCollection( *pColl );
338
339
                String aImport = ScGlobal::GetRscString( STR_DBNAME_IMPORT );
340
                long nCount = 0;
341
                sal_uInt16 nDummy;
342
                do
343
                {
344
                    ++nCount;
345
                    aNewName = aImport;
346
                    aNewName += String::CreateFromInt32( nCount );
347
                }
348
                while (pColl->SearchName( aNewName, nDummy ));
349
            }
350
            break;
351
352
            case SC_DB_MAKE_AUTOFILTER:
353
            {
354
                aDocument.CompileDBFormula( sal_True );
355
                pUndoColl = new ScDBCollection( *pColl );
356
357
                aNewName = pColl->GetNewDefaultDBName();
358
            }
359
            break;
484
360
485
            if (pTableData->HasQueryParam())
361
            case SC_DB_MAKE:
486
            {
362
            {
487
                ScQueryParam    aParam;
363
                aNewName = ScGlobal::GetRscString( STR_DB_NONAME );
488
                pTableData->GetQueryParam(aParam);
489
                SCSIZE nEC = aParam.GetEntryCount();
490
                for (SCSIZE i=0; i<nEC; i++)
491
                    aParam.GetEntry(i).bDoQuery = sal_False;
492
                aParam.bDuplicate = sal_True;
493
                ScDBDocFunc aDBDocFunc( *this );
494
                aDBDocFunc.Query( nTab, aParam, NULL, sal_False, sal_False );
495
            }
364
            }
365
            break;
496
366
497
                DBAreaDeleted( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 );
367
            default:
368
                DBG_ERROR( "<ScDocShell::GetDBData(..)> - unexcepted <eMode>" );
369
                break;
370
            }
498
371
499
            pTableData->SetSortParam( ScSortParam() );
372
            pDBData = new ScDBData(
500
            pTableData->SetQueryParam( ScQueryParam() );
373
                aNewName, nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_True, bHasHeader );
501
            pTableData->SetSubTotalParam( ScSubTotalParam() );
374
            pColl->Insert( pDBData );
502
375
503
            pTableData->SetArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
376
            if ( pUndoColl )
504
            pTableData->SetByRow( sal_True );
377
            {
505
            pTableData->SetHeader( bHasHeader );
378
                aDocument.CompileDBFormula( sal_False );
506
            pTableData->SetAutoFilter( sal_False );
379
507
        }
380
                ScDBCollection* pRedoColl = new ScDBCollection( *pColl );
508
        else
381
                GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) );
509
        {
382
            }
510
            String aNewName = pColl->GetNewDefaultDBName();
383
511
            pTableData = new ScDBData( aNewName, nTab, nStartCol,nStartRow, nEndCol,nEndRow, sal_True, bHasHeader );
384
            // notify Navigator about database range "Import[X]"
512
            pColl->Insert( pTableData );
385
            if ( eMode==SC_DB_IMPORT )
386
            {
387
                SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
388
            }
513
        }
389
        }
514
        pData = pTableData;
390
391
        return pDBData;
515
    }
392
    }
516
393
517
    return pData;
394
    return NULL; // never reached
518
}
395
}
519
396
520
397
Lines 656-676 void ScDocShell::RefreshPivotTables( const ScRange& rSource ) Link Here
656
533
657
String lcl_GetAreaName( ScDocument* pDoc, ScArea* pArea )
534
String lcl_GetAreaName( ScDocument* pDoc, ScArea* pArea )
658
{
535
{
659
	String aName;
536
    String aName;
660
	sal_Bool bOk = sal_False;
537
    bool bOk = false;
661
	ScDBData* pData = pDoc->GetDBAtArea( pArea->nTab, pArea->nColStart, pArea->nRowStart,
538
    ScDBData* pData = pDoc->GetDBAtArea( pArea->nTab, pArea->nColStart, pArea->nRowStart, pArea->nColEnd, pArea->nRowEnd );
662
														pArea->nColEnd, pArea->nRowEnd );
539
    if (pData)
663
	if (pData)
540
    {
664
	{
541
        pData->GetName( aName );
665
		pData->GetName( aName );
542
        if ( !pData->IsInternalUnnamed() )
666
		if ( aName != ScGlobal::GetRscString( STR_DB_NONAME ) )
543
            bOk = true;
667
			bOk = sal_True;
544
    }
668
	}
669
545
670
	if (!bOk)
546
    if (!bOk)
671
		pDoc->GetName( pArea->nTab, aName );
547
    {
548
        pDoc->GetName( pArea->nTab, aName );
549
    }
672
550
673
	return aName;
551
    return aName;
674
}
552
}
675
553
676
void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, sal_Bool bRecord )
554
void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, sal_Bool bRecord )
(-)a/main/sc/source/ui/inc/dbfunc.hxx (-1 lines)
Lines 75-81 public: Link Here
75
					// DB-Bereich vom Cursor
75
					// DB-Bereich vom Cursor
76
	ScDBData* 		GetDBData( sal_Bool bMarkArea = sal_True, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP );
76
	ScDBData* 		GetDBData( sal_Bool bMarkArea = sal_True, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP );
77
77
78
    //ScRange         GetDBRange( BOOL bMark, bool bIgnoreNotes );
79
	void			NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList );
78
	void			NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList );
80
79
81
	void			Consolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = sal_True );
80
	void			Consolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = sal_True );
(-)a/main/sc/source/ui/inc/docsh.hxx (-2 lines)
Lines 158-164 class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener Link Here
158
158
159
    SC_DLLPRIVATE void          EnableSharedSettings( bool bEnable );
159
    SC_DLLPRIVATE void          EnableSharedSettings( bool bEnable );
160
    SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument();
160
    SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument();
161
	ScDBData*		GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel );
162
161
163
    SC_DLLPRIVATE void          UseSheetSaveEntries();
162
    SC_DLLPRIVATE void          UseSheetSaveEntries();
164
163
Lines 307-313 public: Link Here
307
	ScDBData*		GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel );
306
	ScDBData*		GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel );
308
    ScDBData*       GetOldAutoDBRange();    // has to be deleted by caller!
307
    ScDBData*       GetOldAutoDBRange();    // has to be deleted by caller!
309
    void            CancelAutoDBRange();    // called when dialog is cancelled
308
    void            CancelAutoDBRange();    // called when dialog is cancelled
310
	ScDBCollection* GetDBCollection(){ return aDocument.GetDBCollection();}
311
309
312
	void			UpdateLinks();			// Link-Eintraege aktuallisieren
310
	void			UpdateLinks();			// Link-Eintraege aktuallisieren
313
	sal_Bool			ReloadTabLinks();		// Links ausfuehren (Inhalt aktualisieren)
311
	sal_Bool			ReloadTabLinks();		// Links ausfuehren (Inhalt aktualisieren)
(-)a/main/sc/source/ui/navipi/content.cxx (-19 / +20 lines)
Lines 718-744 void ScContentTree::GetAreaNames() Link Here
718
718
719
void ScContentTree::GetDbNames()
719
void ScContentTree::GetDbNames()
720
{
720
{
721
	if ( nRootType && nRootType != SC_CONTENT_DBAREA )		// ausgeblendet ?
721
    if ( nRootType && nRootType != SC_CONTENT_DBAREA )		// ausgeblendet ?
722
		return;
722
        return;
723
723
724
	ScDocument* pDoc = GetSourceDocument();
724
    ScDocument* pDoc = GetSourceDocument();
725
	if (!pDoc)
725
    if (!pDoc)
726
		return;
726
        return;
727
727
728
	ScDBCollection*	pDbNames = pDoc->GetDBCollection();
728
    ScDBCollection*	pDbNames = pDoc->GetDBCollection();
729
	sal_uInt16 nCount = pDbNames->GetCount();
729
    sal_uInt16 nCount = pDbNames->GetCount();
730
	if ( nCount > 0 )
730
    if ( nCount > 0 )
731
	{
731
    {
732
		String aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) );
732
        for ( sal_uInt16 i=0; i<nCount; i++ )
733
		for ( sal_uInt16 i=0; i<nCount; i++ )
733
        {
734
		{
734
            ScDBData* pData = (*pDbNames)[i];
735
			ScDBData* pData = (*pDbNames)[i];
735
            String aStrName = pData->GetName();
736
			String aStrName = pData->GetName();
736
            if ( !pData->IsInternalUnnamed()
737
			//if ( aStrName != aStrNoName )
737
                 && !pData->IsInternalForAutoFilter() )
738
			if ( !pData->IsBuildin() )
738
            {
739
				InsertContent( SC_CONTENT_DBAREA, aStrName );
739
                InsertContent( SC_CONTENT_DBAREA, aStrName );
740
		}
740
            }
741
	}
741
        }
742
    }
742
}
743
}
743
744
744
bool ScContentTree::IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier )  // static
745
bool ScContentTree::IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier )  // static
(-)a/main/sc/source/ui/undo/undoutil.cxx (-31 / +42 lines)
Lines 82-119 void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell, Link Here
82
82
83
83
84
ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab,
84
ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab,
85
									SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
85
                                   SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
86
{
86
{
87
	ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 );
87
    ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 );
88
88
89
	if (!pRet)
89
    if (!pRet)
90
	{
90
    {
91
		sal_Bool bWasTemp = sal_False;
91
        bool bWasInternalUnnamed = false;
92
		if ( pUndoData )
92
        bool bWasInternalForAutoFilter = false;
93
		{
93
        if ( pUndoData )
94
			String aName;
94
        {
95
			pUndoData->GetName( aName );
95
            String aName;
96
//			if ( aName == ScGlobal::GetRscString( STR_DB_NONAME ) )
96
            pUndoData->GetName( aName );
97
			if (pUndoData->IsBuildin())
97
            if ( pUndoData->IsInternalUnnamed() )
98
				bWasTemp = sal_True;
98
            {
99
		}
99
                bWasInternalUnnamed = true;
100
        DBG_ASSERT(bWasTemp, "Undo: didn't find database range");
100
            }
101
101
            else if (pUndoData->IsInternalForAutoFilter())
102
		sal_uInt16 nIndex;
102
            {
103
		ScDBCollection* pColl = pDoc->GetDBCollection();
103
                bWasInternalForAutoFilter = true;
104
		if (pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex ))
104
            }
105
			pRet = (*pColl)[nIndex];
105
        }
106
		else
106
        DBG_ASSERT( bWasInternalUnnamed || bWasInternalForAutoFilter, "Undo: didn't find database range");
107
		{
107
108
            String	aNoNamed = pColl->GetNewDefaultDBName();
108
        sal_uInt16 nIndex;
109
			pRet = new ScDBData( aNoNamed/*ScGlobal::GetRscString( STR_DB_NONAME )*/, nTab,
109
        ScDBCollection* pColl = pDoc->GetDBCollection();
110
								nCol1,nRow1, nCol2,nRow2, sal_True,
110
        if ( bWasInternalUnnamed
111
								pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) );
111
             && pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex ))
112
			pColl->Insert( pRet );
112
        {
113
		}
113
            pRet = (*pColl)[nIndex];
114
	}
114
        }
115
115
        else
116
	return pRet;
116
        {
117
            String aNewNamed = bWasInternalForAutoFilter
118
                               ? pColl->GetNewDefaultDBName()
119
                               : ScGlobal::GetRscString( STR_DB_NONAME );
120
            pRet = new ScDBData(
121
                aNewNamed, nTab, nCol1,nRow1, nCol2,nRow2, sal_True,
122
                pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) );
123
            pColl->Insert( pRet );
124
        }
125
    }
126
127
    return pRet;
117
}
128
}
118
129
119
130
(-)a/main/sc/source/ui/view/cellsh2.cxx (-13 / +6 lines)
Lines 357-364 void ScCellShell::ExecuteDB( SfxRequest& rReq ) Link Here
357
					ScSubTotalParam aSubTotalParam;
357
					ScSubTotalParam aSubTotalParam;
358
					SfxItemSet		aArgSet( GetPool(), SCITEM_SUBTDATA, SCITEM_SUBTDATA );
358
					SfxItemSet		aArgSet( GetPool(), SCITEM_SUBTDATA, SCITEM_SUBTDATA );
359
359
360
					//ScDBData* pDBData = pTabViewShell->GetDBData();
360
                    ScDBData* pDBData = pTabViewShell->GetDBData();
361
                    ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SUBTOTAL);
362
					pDBData->GetSubTotalParam( aSubTotalParam );
361
					pDBData->GetSubTotalParam( aSubTotalParam );
363
					aSubTotalParam.bRemoveOnly = sal_False;
362
					aSubTotalParam.bRemoveOnly = sal_False;
364
363
Lines 412-418 void ScCellShell::ExecuteDB( SfxRequest& rReq ) Link Here
412
                //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
411
                //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
413
                //the patch comes from maoyg
412
                //the patch comes from maoyg
414
                ScSortParam aSortParam;
413
                ScSortParam aSortParam;
415
                ScDBData*	pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
414
                ScDBData*	pDBData = pTabViewShell->GetDBData();
416
                ScViewData* pData   = GetViewData();
415
                ScViewData* pData   = GetViewData();
417
416
418
                pDBData->GetSortParam( aSortParam );
417
                pDBData->GetSortParam( aSortParam );
Lines 463-469 void ScCellShell::ExecuteDB( SfxRequest& rReq ) Link Here
463
                if ( pArgs )		// Basic
462
                if ( pArgs )		// Basic
464
                {
463
                {
465
                    ScSortParam aSortParam;
464
                    ScSortParam aSortParam;
466
                    ScDBData*	pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
465
                    ScDBData*	pDBData = pTabViewShell->GetDBData();
467
                    ScViewData* pData   = GetViewData();
466
                    ScViewData* pData   = GetViewData();
468
467
469
                    pDBData->GetSortParam( aSortParam );
468
                    pDBData->GetSortParam( aSortParam );
Lines 526-532 void ScCellShell::ExecuteDB( SfxRequest& rReq ) Link Here
526
                else
525
                else
527
                {
526
                {
528
                    ScSortParam aSortParam;
527
                    ScSortParam aSortParam;
529
                    ScDBData*	pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT);
528
                    ScDBData*	pDBData = pTabViewShell->GetDBData();
530
                    ScViewData* pData   = GetViewData();
529
                    ScViewData* pData   = GetViewData();
531
530
532
                    pDBData->GetSortParam( aSortParam );
531
                    pDBData->GetSortParam( aSortParam );
Lines 681-687 void ScCellShell::ExecuteDB( SfxRequest& rReq ) Link Here
681
		case SID_UNFILTER:
680
		case SID_UNFILTER:
682
			{
681
			{
683
				ScQueryParam aParam;
682
				ScQueryParam aParam;
684
				ScDBData*	 pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_OLD_FILTER);
683
				ScDBData*	 pDBData = pTabViewShell->GetDBData();
685
684
686
				pDBData->GetQueryParam( aParam );
685
				pDBData->GetQueryParam( aParam );
687
				SCSIZE nEC = aParam.GetEntryCount();
686
				SCSIZE nEC = aParam.GetEntryCount();
Lines 945-951 void ScCellShell::ExecuteDB( SfxRequest& rReq ) Link Here
945
944
946
					if ( pDBCol )
945
					if ( pDBCol )
947
					{
946
					{
948
						const String	aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) );
949
						List			aList;
947
						List			aList;
950
						sal_uInt16			nDBCount = pDBCol->GetCount();
948
						sal_uInt16			nDBCount = pDBCol->GetCount();
951
						ScDBData*		pDbData  = NULL;
949
						ScDBData*		pDbData  = NULL;
Lines 959-976 void ScCellShell::ExecuteDB( SfxRequest& rReq ) Link Here
959
								pDBName = new String;
957
								pDBName = new String;
960
								pDbData->GetName( *pDBName );
958
								pDbData->GetName( *pDBName );
961
959
962
								if ( *pDBName != aStrNoName )
960
								if ( !pDbData->IsInternalUnnamed() )
963
									aList.Insert( pDBName );
961
									aList.Insert( pDBName );
964
								else
962
								else
965
									DELETEZ(pDBName);
963
									DELETEZ(pDBName);
966
							}
964
							}
967
						}
965
						}
968
966
969
//CHINA001						ScSelEntryDlg* pDlg =
970
//CHINA001						new ScSelEntryDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_SELECTDB,
971
//CHINA001						String(ScResId(SCSTR_SELECTDB)),
972
//CHINA001						String(ScResId(SCSTR_AREAS)),
973
//CHINA001						aList );
974
						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
967
						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
975
						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
968
						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
976
969
(-)a/main/sc/source/ui/view/dbfunc.cxx (-124 / +135 lines)
Lines 332-458 void ScDBFunc::ToggleAutoFilter() Link Here
332
    ScDocShell* pDocSh = GetViewData()->GetDocShell();
332
    ScDocShell* pDocSh = GetViewData()->GetDocShell();
333
    ScDocShellModificator aModificator( *pDocSh );
333
    ScDocShellModificator aModificator( *pDocSh );
334
334
335
	ScQueryParam	aParam;
335
    ScDBData* pDBData = GetDBData( sal_False, SC_DB_MAKE_AUTOFILTER, SC_DBSEL_ROW_DOWN );
336
	ScDocument*		pDoc	= GetViewData()->GetDocument();
336
    if ( pDBData == NULL )
337
	ScDBData*		pDBData = GetDBData( sal_False, SC_DB_OLD_FILTER, SC_DBSEL_ROW_DOWN );
337
    {
338
338
        return;
339
	
339
    }
340
341
340
342
	SCCOL  nCol;
341
    // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation
343
	SCROW  nRow;
342
    const String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY );
344
	SCTAB  nTab = GetViewData()->GetTabNo();
343
    pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
345
	sal_Int16   nFlag;
346
	//sal_Bool	bHasAuto = sal_True;
347
	sal_Bool	bHeader;
348
	sal_Bool	bPaint   = sal_False;
349
344
350
	//!		stattdessen aus DB-Bereich abfragen?
345
    pDBData->SetByRow( sal_True );
346
    ScQueryParam aParam;
347
    pDBData->GetQueryParam( aParam );
351
348
352
	/*for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++)
349
    ScDocument* pDoc = GetViewData()->GetDocument();
353
	{
354
		nFlag = ((ScMergeFlagAttr*) pDoc->
355
				GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
356
350
357
		if ( (nFlag & SC_MF_AUTO) == 0 )
351
    bool bHasAutoFilter = true;
358
			bHasAuto = sal_False;
352
    const SCROW  nRow = aParam.nRow1;
359
	}*/
353
    const SCTAB  nTab = GetViewData()->GetTabNo();
354
    for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAutoFilter; ++nCol )
355
    {
356
        const sal_Int16 nFlag =
357
            ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
360
358
361
	if (pDBData && pDBData->HasAutoFilter())								// aufheben
359
        if ( (nFlag & SC_MF_AUTO) == 0 )
362
	{
360
            bHasAutoFilter = false;
363
		//	Filterknoepfe ausblenden
361
    }
364
		pDBData->SetByRow( sal_True );				//! Undo, vorher abfragen ??
365
		pDBData->GetQueryParam( aParam );
366
		nRow = aParam.nRow1;
367
        bHeader = pDBData->HasHeader();
368
		for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
369
		{
370
			nFlag = ((ScMergeFlagAttr*) pDoc->
371
					GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
372
			pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
373
		}
374
362
375
        // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation
363
    bool bPaint = false;
376
364
377
        String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY );
365
    if ( bHasAutoFilter )
378
        pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
366
    {
367
        // switch filter buttons
368
        for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2; ++nCol )
369
        {
370
            const sal_Int16 nFlag =
371
                ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
372
            pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
373
        }
379
374
380
        ScRange aRange;
375
        ScRange aRange;
381
        pDBData->GetArea( aRange );
376
        pDBData->GetArea( aRange );
382
        pDocSh->GetUndoManager()->AddUndoAction(
377
        pDocSh->GetUndoManager()->AddUndoAction( new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
383
            new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
384
378
385
		pDBData->SetAutoFilter(sal_False);
379
        pDBData->SetAutoFilter(sal_False);
386
380
387
		//	Filter aufheben (incl. Paint / Undo)
381
        //	switch off filter
388
382
        const SCSIZE nEC = aParam.GetEntryCount();
389
		SCSIZE nEC = aParam.GetEntryCount();
383
        for ( SCSIZE i=0; i<nEC; ++i )
390
		for (SCSIZE i=0; i<nEC; i++)
384
        {
391
			aParam.GetEntry(i).bDoQuery = sal_False;
385
            aParam.GetEntry(i).bDoQuery = sal_False;
392
		aParam.bDuplicate = sal_True;
386
        }
393
		Query( aParam, NULL, sal_True );
387
        aParam.bDuplicate = sal_True;
388
        Query( aParam, NULL, sal_True );
394
389
395
        pDocSh->GetUndoManager()->LeaveListAction();
390
        // delete internal database range for auto filter
391
        if ( pDBData->IsInternalForAutoFilter() )
392
        {
393
            ScDBDocFunc aFunc(*pDocSh);
394
            aFunc.DeleteDBRange( pDBData->GetName(), sal_False );
395
        }
396
        pDBData = NULL;
396
397
397
		bPaint = sal_True;
398
        bPaint = true;
398
	}
399
    }
399
	else									// Filterknoepfe einblenden
400
    else
400
	{
401
    {
401
        pDBData = GetDBData(sal_False, SC_DB_MAKE_FILTER);
402
        if ( !pDoc->IsBlockEmpty(
402
        pDBData->SetByRow(sal_True);
403
                nTab,
403
        pDBData->GetQueryParam(aParam);
404
                aParam.nCol1,
404
        nRow = aParam.nRow1;
405
                aParam.nRow1,
405
        bHeader = pDBData->HasHeader();
406
                aParam.nCol2,
406
	
407
                aParam.nRow2 ) )
407
		if ( !pDoc->IsBlockEmpty( nTab,
408
        {
408
								  aParam.nCol1, aParam.nRow1,
409
            if ( !pDBData->HasHeader() )
409
								  aParam.nCol2, aParam.nRow2 ) )
410
            {
410
		{
411
                if ( MessBox(
411
			if (!bHeader)
412
                        GetViewData()->GetDialogParent(),
412
			{
413
                        WinBits(WB_YES_NO | WB_DEF_YES),
413
				if ( MessBox( GetViewData()->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
414
                        ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
414
						ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),		// "StarCalc"
415
                        ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) ).Execute() == RET_YES )
415
						ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) 	// Koepfe aus erster Zeile?
416
                {
416
					).Execute() == RET_YES )
417
                    pDBData->SetHeader( sal_True );
417
				{
418
                }
418
					pDBData->SetHeader( sal_True ); 	//! Undo ??
419
            }
419
					bHeader = sal_True;
420
				}
421
			}
422
420
423
            ScRange aRange;
421
            ScRange aRange;
424
            pDBData->GetArea( aRange );
422
            pDBData->GetArea( aRange );
425
            pDocSh->GetUndoManager()->AddUndoAction(
423
            pDocSh->GetUndoManager()->AddUndoAction( new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_True ) );
426
                new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_True ) );
427
424
428
			pDBData->SetAutoFilter(sal_True);
425
            pDBData->SetAutoFilter(sal_True);
429
426
430
			for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
427
            for ( SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2; ++nCol )
431
			{
428
            {
432
				nFlag = ((ScMergeFlagAttr*) pDoc->
429
                const sal_Int16 nFlag =
433
						GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
430
                    ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue();
434
				pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) );
431
                pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) );
435
			}
432
            }
436
			pDocSh->PostPaint( aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab,
433
            pDocSh->PostPaint( aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab, PAINT_GRID );
437
													 PAINT_GRID );
434
            bPaint = true;
438
			bPaint = sal_True;
435
        }
439
		}
436
        else
440
		else
437
        {
441
		{
438
            ErrorBox aErrorBox(
442
			ErrorBox aErrorBox( GetViewData()->GetDialogParent(), WinBits( WB_OK | WB_DEF_OK ),
439
                GetViewData()->GetDialogParent(),
443
								ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) );
440
                WinBits( WB_OK | WB_DEF_OK ),
444
			aErrorBox.Execute();
441
                ScGlobal::GetRscString( STR_ERR_AUTOFILTER ) );
445
		}
442
            aErrorBox.Execute();
446
	}
443
        }
444
    }
447
445
448
	if ( bPaint )
446
    pDocSh->GetUndoManager()->LeaveListAction();
449
	{
450
		aModificator.SetDocumentModified();
451
447
452
		SfxBindings& rBindings = GetViewData()->GetBindings();
448
    if ( bPaint )
453
		rBindings.Invalidate( SID_AUTO_FILTER );
449
    {
454
		rBindings.Invalidate( SID_AUTOFILTER_HIDE );
450
        aModificator.SetDocumentModified();
455
	}
451
452
        SfxBindings& rBindings = GetViewData()->GetBindings();
453
        rBindings.Invalidate( SID_AUTO_FILTER );
454
        rBindings.Invalidate( SID_AUTOFILTER_HIDE );
455
    }
456
}
456
}
457
457
458
//		nur ausblenden, keine Daten veraendern
458
//		nur ausblenden, keine Daten veraendern
Lines 462-498 void ScDBFunc::HideAutoFilter() Link Here
462
    ScDocShell* pDocSh = GetViewData()->GetDocShell();
462
    ScDocShell* pDocSh = GetViewData()->GetDocShell();
463
    ScDocShellModificator aModificator( *pDocSh );
463
    ScDocShellModificator aModificator( *pDocSh );
464
464
465
	ScDocument* pDoc = pDocSh->GetDocument();
465
    ScDBData* pDBData = GetDBData( sal_False );
466
466
    SCTAB nTab;
467
	ScQueryParam aParam;
467
    SCCOL nCol1, nCol2;
468
	//ScDBData* pDBData = GetDBData( FALSE );
468
    SCROW nRow1, nRow2;
469
    ScDBData* pDBData = GetDBData(sal_False, SC_DB_OLD_FILTER);
469
    pDBData->GetArea(nTab, nCol1, nRow1, nCol2, nRow2);
470
470
471
	SCTAB nTab;
471
    {
472
	SCCOL nCol1, nCol2;
472
        ScDocument* pDoc = pDocSh->GetDocument();
473
	SCROW nRow1, nRow2;
473
        for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++)
474
	pDBData->GetArea(nTab, nCol1, nRow1, nCol2, nRow2);
474
        {
475
            const sal_Int16 nFlag =
476
                ((ScMergeFlagAttr*) pDoc->GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue();
477
            pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
478
        }
479
    }
475
480
476
	for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++)
481
    const String aUndo = ScGlobal::GetRscString( STR_UNDO_QUERY );
477
	{
482
    pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
478
		sal_Int16 nFlag = ((ScMergeFlagAttr*) pDoc->
483
    {
479
								GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue();
484
        ScRange aRange;
480
		pDoc->ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) );
485
        pDBData->GetArea( aRange );
481
	}
486
        pDocSh->GetUndoManager()->AddUndoAction(
487
            new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
482
488
483
    ScRange aRange;
489
        pDBData->SetAutoFilter(sal_False);
484
    pDBData->GetArea( aRange );
485
    pDocSh->GetUndoManager()->AddUndoAction(
486
        new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), sal_False ) );
487
490
488
	pDBData->SetAutoFilter(sal_False);
491
        // delete internal database range for auto filter
492
        if ( pDBData->IsInternalForAutoFilter() )
493
        {
494
            ScDBDocFunc aFunc(*pDocSh);
495
            aFunc.DeleteDBRange( pDBData->GetName(), sal_False );
496
        }
497
        pDBData = NULL;
498
    }
499
    pDocSh->GetUndoManager()->LeaveListAction();
489
500
490
	pDocSh->PostPaint( nCol1,nRow1,nTab, nCol2,nRow1,nTab, PAINT_GRID );
501
    pDocSh->PostPaint( nCol1,nRow1,nTab, nCol2,nRow1,nTab, PAINT_GRID );
491
    aModificator.SetDocumentModified();
502
    aModificator.SetDocumentModified();
492
503
493
	SfxBindings& rBindings = GetViewData()->GetBindings();
504
    SfxBindings& rBindings = GetViewData()->GetBindings();
494
	rBindings.Invalidate( SID_AUTO_FILTER );
505
    rBindings.Invalidate( SID_AUTO_FILTER );
495
	rBindings.Invalidate( SID_AUTOFILTER_HIDE );
506
    rBindings.Invalidate( SID_AUTOFILTER_HIDE );
496
}
507
}
497
508
498
//		Re-Import
509
//		Re-Import
(-)a/main/sc/source/ui/view/tabvwshc.cxx (-2 / +2 lines)
Lines 171-177 SfxModelessDialog* ScTabViewShell::CreateRefDialog( Link Here
171
									 SCITEM_QUERYDATA,
171
									 SCITEM_QUERYDATA,
172
									 SCITEM_QUERYDATA );
172
									 SCITEM_QUERYDATA );
173
173
174
			ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN);
174
			ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN);
175
			pDBData->GetQueryParam( aQueryParam );
175
			pDBData->GetQueryParam( aQueryParam );
176
176
177
			ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam );
177
			ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam );
Lines 196-202 SfxModelessDialog* ScTabViewShell::CreateRefDialog( Link Here
196
									 SCITEM_QUERYDATA,
196
									 SCITEM_QUERYDATA,
197
									 SCITEM_QUERYDATA );
197
									 SCITEM_QUERYDATA );
198
198
199
			ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN);
199
			ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN);
200
			pDBData->GetQueryParam( aQueryParam );
200
			pDBData->GetQueryParam( aQueryParam );
201
201
202
			aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA,
202
			aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA,

Return to issue 122862