summaryrefslogtreecommitdiff
path: root/sc/source/core/data/dptablecache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/dptablecache.cxx')
-rw-r--r--sc/source/core/data/dptablecache.cxx44
1 files changed, 27 insertions, 17 deletions
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index 3cf40a7ab6dc..4a80f742769b 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -210,13 +210,13 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, sal_uInt16 nCol, sal_u
else if ( pDoc->HasValueData( nCol, nRow, nDocTab ) )
{
double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nDocTab));
+ nNumFormat = pDoc->GetNumberFormat( ScAddress( nCol, nRow, nDocTab ) );
sal_uLong nFormat = NUMBERFORMAT_NUMBER;
if ( pFormatter )
- nFormat = pFormatter->GetType( pDoc->GetNumberFormat( ScAddress( nCol, nRow, nDocTab ) ) );
+ nFormat = pFormatter->GetType( nNumFormat );
aString = aDocStr;
fValue = fVal;
mbFlag |= MK_VAL|MK_DATA;
- nNumFormat = pDoc->GetNumberFormat( ScAddress( nCol, nRow, nDocTab ) );
lcl_isDate( nFormat ) ? ( mbFlag |= MK_DATE ) : (mbFlag &= ~MK_DATE);
}
else if ( pDoc->HasData( nCol,nRow, nDocTab ) )
@@ -938,23 +938,28 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
//reset name if needed
String strNewName = pData->aString;
- sal_Bool bFound = sal_False;
- long nIndex = 1;
- do
+
+ // #i116457# don't modify empty column titles
+ if ( strNewName.Len() )
{
- for ( long i= mrLabelNames.size()-1; i>=0; i-- )
+ sal_Bool bFound = sal_False;
+ long nIndex = 1;
+ do
{
- if( mrLabelNames[i]->aString == strNewName )
+ for ( long i= mrLabelNames.size()-1; i>=0; i-- )
{
- strNewName = pData->aString;
- strNewName += String::CreateFromInt32( nIndex );
- nIndex ++ ;
- bFound = sal_True;
+ if( mrLabelNames[i]->aString == strNewName )
+ {
+ strNewName = pData->aString;
+ strNewName += String::CreateFromInt32( nIndex );
+ nIndex ++ ;
+ bFound = sal_True;
+ }
}
+ bFound = !bFound;
}
- bFound = !bFound;
+ while ( !bFound );
}
- while ( !bFound );
pData->aString = strNewName;
mrLabelNames.push_back( pData );
@@ -1021,10 +1026,15 @@ sal_uLong ScDPTableDataCache::GetNumberFormat( long nDim ) const
{
if ( nDim >= mnColumnCount )
return 0;
- if ( mpTableDataValues[nDim].size()==0 )
- return 0;
- else
- return mpTableDataValues[nDim][0]->nNumFormat;
+
+ // #i113411# take the number format from the first value entry
+ size_t nSize = mpTableDataValues[nDim].size();
+ size_t nPos = 0;
+ while ( nPos < nSize && mpTableDataValues[nDim][nPos]->GetType() != SC_VALTYPE_VALUE )
+ ++nPos;
+ if ( nPos < nSize )
+ return mpTableDataValues[nDim][nPos]->nNumFormat;
+ return 0;
}
sal_Bool ScDPTableDataCache::IsDateDimension( long nDim ) const