Commits

Anonymous committed 154b912

calcdatatables: prevent modification of DataTable ranges properties

Comments (0)

Files changed (4)

sc/inc/dbcolect.hxx

 	USHORT			nIndex; 			// eindeutiger Index fuer Formeln
 	BOOL			bAutoFilter;		// AutoFilter? (nicht gespeichert)
 	BOOL			bModified;			// wird bei UpdateReference gesetzt/geloescht
+    // DataTable
+    sal_uInt32      mnDataTable;        // >0 in case this is a DataTable range
 
     using ScRefreshTimer::operator==;
 
 			BOOL		IsByRow() const 				{ return bByRow; }
 			void		SetByRow(BOOL bByR) 			{ bByRow = bByR; }
 			BOOL		HasHeader() const 				{ return bHasHeader; }
-			void		SetHeader(BOOL bHasH) 			{ bHasHeader = bHasH; }
+			void		SetHeader(BOOL bHasH) 			{ bHasHeader = (bHasH || mnDataTable != 0); }
             void        SetIndex(USHORT nInd)           { nIndex = nInd; }
 			USHORT		GetIndex() const				{ return nIndex; }
 			BOOL		IsDoSize() const				{ return bDoSize; }
-			void		SetDoSize(BOOL bSet)			{ bDoSize = bSet; }
+			void		SetDoSize(BOOL bSet)			{ bDoSize = (bSet || mnDataTable != 0); }
 			BOOL		IsKeepFmt() const				{ return bKeepFmt; }
-			void		SetKeepFmt(BOOL bSet)			{ bKeepFmt = bSet; }
+			void		SetKeepFmt(BOOL bSet)			{ bKeepFmt = (bSet || mnDataTable != 0); }
 			BOOL		IsStripData() const				{ return bStripData; }
 			void		SetStripData(BOOL bSet)			{ bStripData = bSet; }
 
 
 			BOOL		IsModified() const			{ return bModified; }
 			void		SetModified(BOOL bMod)		{ bModified = bMod; }
+
+            sal_uInt32  GetDataTable() const        { return mnDataTable; }
+            void        SetDataTable( sal_uInt32 nKey )
+                            {
+                                mnDataTable = nKey;
+                                if (nKey)
+                                    bHasHeader = bDoSize = bKeepFmt = true;
+                            }
 };
 
 

sc/source/core/tool/dbcolect.cxx

 	bDBSelection(FALSE),
 	nIndex 		(0),
 	bAutoFilter (FALSE),
-	bModified	(FALSE)
+	bModified	(FALSE),
+    mnDataTable (0)
 {
 	USHORT i;
 
 	nDBType				(rData.nDBType),
 	nIndex   			(rData.nIndex),
 	bAutoFilter			(rData.bAutoFilter),
-	bModified			(rData.bModified)
+	bModified			(rData.bModified),
+    mnDataTable         (rData.mnDataTable)
 {
 	USHORT i;
 	USHORT j;
 	nDBType				= rData.nDBType;
 	nIndex   			= rData.nIndex;
     bAutoFilter         = rData.bAutoFilter;
+    mnDataTable         = rData.mnDataTable;
 
 	for (i=0; i<MAXSORT; i++)
 	{
 		 bKeepFmt	!= rData.bKeepFmt	||
 		 bIsAdvanced!= rData.bIsAdvanced||
 		 bStripData	!= rData.bStripData ||
+         mnDataTable!= rData.mnDataTable||
 //       SAB: I think this should be here, but I don't want to break something
 //         bAutoFilter!= rData.bAutoFilter||
-		 ScRefreshTimer::operator!=( rData )
+         ScRefreshTimer::operator!=( rData )
 		)
 		return FALSE;
 

sc/source/ui/dbgui/dbnamdlg.cxx

 	aEdAssign.SetModifyHdl	( LINK( this, ScDbNameDlg, AssModifyHdl ) );
 	UpdateNames();
 
+    ScDBData* pDBData = NULL;
 	if ( pViewData && pDoc )
 	{
 		ScDBCollection*	pDBColl	= pDoc->GetDBCollection();
-		ScDBData*		pDBData = NULL;
 
 		pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
 								  nEndCol,	 nEndRow,  nEndTab );
 	aLocalDbCol.SearchName( rStrName, nAt );
 	pData = (ScDBData*)(aLocalDbCol.At( nAt ));
 
+    mbDataTable = (pData && pData->GetDataTable());
 	if ( pData )
 	{
 		SCCOL nColStart = 0;
 	return bRefInputMode;
 }
 
+
 //------------------------------------------------------------------------
 // Handler:
 // ========
 	String	theName		= aEdName.GetText();
 	BOOL	bNameFound  = (COMBOBOX_ENTRY_NOTFOUND
 						   != aEdName.GetEntryPos( theName ));
+    mbDataTable = false;
 
 	if ( theName.Len() == 0 )
 	{
 			aBtnRemove.Disable();
 		}
 
-        aFlAssign.Enable();
-		aEdAssign.Enable();
-		aRbAssign.Enable();
+        if (mbDataTable)
+        {
+            aBtnRemove.Disable();
+            aBtnHeader.Disable();
+            aBtnDoSize.Disable();
+            aBtnKeepFmt.Disable();
+            aFlAssign.Disable();
+            aEdAssign.Disable();
+            aRbAssign.Disable();
+        }
+        else
+        {
+            aFlAssign.Enable();
+            aEdAssign.Enable();
+            aRbAssign.Enable();
+        }
 
 		//@BugID 54702 Enablen/Disablen nur noch in Basisklasse
 		//SFX_APPWINDOW->Enable();

sc/source/ui/inc/dbnamdlg.hxx

 	PushButton		aBtnRemove;
 	MoreButton		aBtnMore;
 
+    bool            mbDataTable;
+
 	BOOL			bSaved;
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.