Commits

Anonymous committed 8a0ddb9 Merge

CWS-TOOLING: integrate CWS calc62

Comments (0)

Files changed (2)

sc/source/core/data/dptablecache.cxx

 	ScBaseCell* pCell = pDoc->GetCell( aPos );
 
 	if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetErrCode() )
+    {
         SetString ( aDocStr );      //[SODC_19347] add liyi
         //bErr = TRUE;              //[SODC_19347] del liyi
+        mbFlag |= MK_ERR;
+    }
 	else if ( pDoc->HasValueData( nCol, nRow, nDocTab ) )
 	{
 		double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nDocTab));
 		{
 			ScQueryEntry& rEntry = rParam.GetEntry(i);
 			// we can only handle one single direct query
-			SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE ); 
-			const ScDPItemData* pCellData = GetItemDataById(  (SCCOL)rEntry.nField, nId); 
+            // #i115431# nField in QueryParam is the sheet column, not the field within the source range
+            SCCOL nQueryCol = (SCCOL)rEntry.nField;
+            if ( nQueryCol < rParam.nCol1 )
+                nQueryCol = rParam.nCol1;
+            if ( nQueryCol > rParam.nCol2 )
+                nQueryCol = rParam.nCol2;
+            SCCOL nSourceField = nQueryCol - rParam.nCol1;
+            SCROW nId = GetItemDataId( nSourceField, nRow, FALSE ); 
+            const ScDPItemData* pCellData = GetItemDataById( nSourceField, nId ); 
 
 			BOOL bOk = FALSE;
 			BOOL bTestEqual = FALSE;

sc/source/ui/view/output2.cxx

         // must be a value or formula cell.
         return;
 
-    if (eType == CELLTYPE_FORMULA && !static_cast<ScFormulaCell*>(pCell)->IsValue())
+    if (eType == CELLTYPE_FORMULA)
+    {
+        ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
+        if (pFCell->GetErrCode() != 0)
+        {
+            SetHashText();      // If the error string doesn't fit, always use "###"
+            return;
+        }
         // If it's formula, the result must be a value.
-        return;
+        if (!pFCell->IsValue())
+            return;
+    }
 
     ULONG nFormat = GetValueFormat();
     if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0)