Tag: cws_oog680_c21v001
User: nn      
Date: 2008-01-16 19:44:58+0000
Modified:
   dba/connectivity/source/drivers/calc/CTable.cxx

Log:
 #i35178# merge change from osfme01

File Changes:

Directory: /dba/connectivity/source/drivers/calc/
=================================================

File [changed]: CTable.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/calc/CTable.cxx?r1=1.31&r2=1.31.92.1
Delta lines:  +35 -4
--------------------
--- CTable.cxx  2007-06-12 05:27:25+0000        1.31
+++ CTable.cxx  2008-01-16 19:44:56+0000        1.31.92.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: CTable.cxx,v $
  *
- *  $Revision: 1.31 $
+ *  $Revision: 1.31.92.1 $
  *
- *  last change: $Author: obo $ $Date: 2007/06/12 05:27:25 $
+ *  last change: $Author: nn $ $Date: 2008/01/16 19:44:56 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -78,6 +78,9 @@
 #ifndef _COM_SUN_STAR_SHEET_CELLFLAGS_HPP_
 #include <com/sun/star/sheet/CellFlags.hpp>
 #endif
+#ifndef _COM_SUN_STAR_SHEET_FORMULARESULT_HPP_
+#include <com/sun/star/sheet/FormulaResult.hpp>
+#endif
 #ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_
 #include <com/sun/star/util/NumberFormat.hpp>
 #endif
@@ -275,6 +278,33 @@
        return xCell;
 }
 
+bool lcl_HasTextInColumn( const Reference<XSpreadsheet>& xSheet, sal_Int32 
nDocColumn, sal_Int32 nDocRow )
+{
+    // look for any text cell or text result in the column
+
+    Reference<XCellRangeAddressable> xAddr( xSheet, UNO_QUERY );
+    if (xAddr.is())
+    {
+        CellRangeAddress aTotalRange = xAddr->getRangeAddress();
+        sal_Int32 nLastRow = aTotalRange.EndRow;
+        Reference<XCellRangesQuery> xQuery( xSheet->getCellRangeByPosition( 
nDocColumn, nDocRow, nDocColumn, nLastRow ), UNO_QUERY );
+        if (xQuery.is())
+        {
+            // are there text cells in the column?
+            Reference<XSheetCellRanges> xTextContent = 
xQuery->queryContentCells( CellFlags::STRING );
+            if ( xTextContent.is() && xTextContent->hasElements() )
+                return true;
+
+            // are there formulas with text results in the column?
+            Reference<XSheetCellRanges> xTextFormula = 
xQuery->queryFormulaCells( FormulaResult::STRING );
+            if ( xTextFormula.is() && xTextFormula->hasElements() )
+                return true;
+        }
+    }
+
+    return false;
+}
+
 void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const 
Reference<XNumberFormats>& xFormats,
                                                sal_Int32 nDocColumn, sal_Int32 
nStartRow, sal_Bool bHasHeaders,
                                                ::rtl::OUString& rName, 
sal_Int32& rDataType, sal_Bool& rCurrency )
@@ -303,7 +333,8 @@
                rCurrency = sal_False;                  // set to true for 
currency below
 
                CellContentType eCellType = lcl_GetContentOrResultType( 
xDataCell );
-               if ( eCellType == CellContentType_TEXT )
+        // #i35178# use "text" type if there is any text cell in the column
+        if ( eCellType == CellContentType_TEXT || lcl_HasTextInColumn( xSheet, 
nDocColumn, nDataRow ) )
                        rDataType = DataType::VARCHAR;
                else if ( eCellType == CellContentType_VALUE )
                {




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to