summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-26 21:06:14 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-27 00:07:16 -0400
commit63fb74aead373e62a3be36fde3a81fb08964d3e0 (patch)
tree2176e51a1a09c410f4b519427c3b664898af00d9 /sc
parentConverted the external ref manager code. (diff)
downloadcore-63fb74aead373e62a3be36fde3a81fb08964d3e0.tar.gz
core-63fb74aead373e62a3be36fde3a81fb08964d3e0.zip
Remove variant of GetCellString() that takes ScBaseCell*.
Change-Id: Ide78ab011e1f06bdb61ac2b29bc7c170cdb8d245
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/cellform.hxx6
-rw-r--r--sc/inc/column.hxx3
-rw-r--r--sc/source/core/data/column.cxx11
-rw-r--r--sc/source/core/data/column2.cxx52
-rw-r--r--sc/source/core/data/column3.cxx20
-rw-r--r--sc/source/core/tool/cellform.cxx111
-rw-r--r--sc/source/ui/view/output2.cxx19
7 files changed, 66 insertions, 156 deletions
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index e2935a0bbe11..c7083ec163f0 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -41,12 +41,6 @@ enum ScForceTextFmt {
class SC_DLLPUBLIC ScCellFormat
{
public:
- static void GetString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OUString& rString,
- Color** ppColor, SvNumberFormatter& rFormatter,
- sal_Bool bNullVals = sal_True,
- sal_Bool bFormula = false,
- ScForceTextFmt eForceTextFmt = ftDontForce,
- bool bUseStarFormat = false );
static void GetString(
ScRefCellValue& rCell, sal_uLong nFormat, rtl::OUString& rString,
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index ac329b273ec9..dc81438ededa 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -73,6 +73,8 @@ struct ScSetStringParam;
struct ScColWidthParam;
class ScColumnTextWidthIterator;
struct ScFormulaCellGroup;
+struct ScRefCellValue;
+
typedef ::boost::intrusive_ptr<ScFormulaCellGroup> ScFormulaCellGroupRef;
struct ScNeededSizeOptions
@@ -152,6 +154,7 @@ public:
bool Search( SCROW nRow, SCSIZE& nIndex ) const;
ScBaseCell* GetCell( SCROW nRow ) const;
+ ScRefCellValue GetCellValue( SCROW nRow ) const;
void Insert( SCROW nRow, ScBaseCell* pCell );
void Insert( SCROW nRow, sal_uInt32 nFormatIndex, ScBaseCell* pCell );
void Append( SCROW nRow, ScBaseCell* pCell );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 5607211cdcfe..cf09270876aa 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -30,6 +30,7 @@
#include "detfunc.hxx" // for Notes in Sort/Swap
#include "postit.hxx"
#include "globalnames.hxx"
+#include "cellvalue.hxx"
#include <svl/poolcach.hxx>
#include <svl/zforlist.hxx>
@@ -794,6 +795,16 @@ ScBaseCell* ScColumn::GetCell( SCROW nRow ) const
return NULL;
}
+ScRefCellValue ScColumn::GetCellValue( SCROW nRow ) const
+{
+ ScRefCellValue aVal;
+ SCSIZE nIndex;
+ if (Search(nRow, nIndex))
+ aVal.assign(*maItems[nIndex].pCell);
+
+ return aVal;
+}
+
void ScColumn::ReserveSize( SCSIZE nSize )
{
if (nSize > sal::static_int_cast<SCSIZE>(MAXROWCOUNT))
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 4108cdcc4102..e4a9931a256f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -53,6 +53,7 @@
#include "fillinfo.hxx"
#include "segmenttree.hxx"
#include "docparam.hxx"
+#include "cellvalue.hxx"
#include <math.h>
@@ -97,7 +98,9 @@ long ScColumn::GetNeededSize(
double nPPT = bWidth ? nPPTX : nPPTY;
if (Search(nRow,nIndex))
{
- ScBaseCell* pCell = maItems[nIndex].pCell;
+ ScRefCellValue aCell;
+ aCell.assign(*maItems[nIndex].pCell);
+
const ScPatternAttr* pPattern = rOptions.pPattern;
if (!pPattern)
pPattern = pAttrArray->GetPattern( nRow );
@@ -148,11 +151,11 @@ long ScColumn::GetNeededSize(
SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
sal_uLong nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
// #i111387# disable automatic line breaks only for "General" number format
- if ( bBreak && pCell->HasValueData() && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
+ if (bBreak && aCell.hasNumeric() && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
{
// also take formula result type into account for number format
- if ( pCell->GetCellType() != CELLTYPE_FORMULA ||
- ( static_cast<ScFormulaCell*>(pCell)->GetStandardFormat(*pFormatter, nFormat) % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
+ if (aCell.meType != CELLTYPE_FORMULA ||
+ (aCell.mpFormula->GetStandardFormat(*pFormatter, nFormat) % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
bBreak = false;
}
@@ -229,20 +232,20 @@ long ScColumn::GetNeededSize(
}
bool bAddMargin = true;
- CellType eCellType = pCell->GetCellType();
+ CellType eCellType = aCell.meType;
- bool bEditEngine = ( eCellType == CELLTYPE_EDIT ||
- eOrient == SVX_ORIENTATION_STACKED ||
- IsAmbiguousScript( nScript ) ||
- ((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) );
+ bool bEditEngine = (eCellType == CELLTYPE_EDIT ||
+ eOrient == SVX_ORIENTATION_STACKED ||
+ IsAmbiguousScript(nScript) ||
+ ((eCellType == CELLTYPE_FORMULA) && aCell.mpFormula->IsMultilineResult()));
if (!bEditEngine) // direct output
{
Color* pColor;
rtl::OUString aValStr;
- ScCellFormat::GetString( pCell, nFormat, aValStr, &pColor,
- *pFormatter,
- true, rOptions.bFormula, ftCheck );
+ ScCellFormat::GetString(
+ aCell, nFormat, aValStr, &pColor, *pFormatter, true, rOptions.bFormula, ftCheck);
+
if (!aValStr.isEmpty())
{
// SetFont is moved up
@@ -394,18 +397,18 @@ long ScColumn::GetNeededSize(
}
pEngine->SetPaperSize(aPaper);
- if ( pCell->GetCellType() == CELLTYPE_EDIT )
+ if (aCell.meType == CELLTYPE_EDIT)
{
- const EditTextObject* pData = static_cast<ScEditCell*>(pCell)->GetData();
- pEngine->SetTextNewDefaults(*pData, pSet);
+ pEngine->SetTextNewDefaults(*aCell.mpEditText, pSet);
}
else
{
Color* pColor;
- rtl::OUString aString;
- ScCellFormat::GetString( pCell, nFormat, aString, &pColor,
- *pFormatter,
- true, rOptions.bFormula, ftCheck );
+ OUString aString;
+ ScCellFormat::GetString(
+ aCell, nFormat, aString, &pColor, *pFormatter, true,
+ rOptions.bFormula, ftCheck);
+
if (!aString.isEmpty())
pEngine->SetTextNewDefaults(aString, pSet);
else
@@ -560,9 +563,9 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
Color* pColor;
if (pParam->mnMaxTextRow >= 0)
{
- ScBaseCell* pCell = GetCell(pParam->mnMaxTextRow);
+ ScRefCellValue aCell = GetCellValue(pParam->mnMaxTextRow);
ScCellFormat::GetString(
- pCell, nFormat, aLongStr, &pColor, *pFormatter, true, false, ftCheck );
+ aCell, nFormat, aLongStr, &pColor, *pFormatter, true, false, ftCheck);
}
else
{
@@ -573,10 +576,11 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
// Out-of-bound reached. No need to keep going.
break;
- ScBaseCell* pCell = maItems[nIndex].pCell;
- rtl::OUString aValStr;
+ ScRefCellValue aCell;
+ aCell.assign(*maItems[nIndex].pCell);
+ OUString aValStr;
ScCellFormat::GetString(
- pCell, nFormat, aValStr, &pColor, *pFormatter, true, false, ftCheck );
+ aCell, nFormat, aValStr, &pColor, *pFormatter, true, false, ftCheck);
if (aValStr.getLength() > nLongLen)
{
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 3a591cd9b9ad..8a70ce6c6097 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -45,6 +45,7 @@
#include "stringutil.hxx"
#include "docpool.hxx"
#include "globalnames.hxx"
+#include "cellvalue.hxx"
#include <com/sun/star/i18n/LocaleDataItem.hpp>
@@ -1745,17 +1746,18 @@ void ScColumn::GetString( SCROW nRow, rtl::OUString& rString ) const
Color* pColor;
if (Search(nRow, nIndex))
{
- ScBaseCell* pCell = maItems[nIndex].pCell;
- if (pCell->GetCellType() != CELLTYPE_NOTE)
+ ScRefCellValue aCell;
+ aCell.assign(*maItems[nIndex].pCell);
+ if (aCell.meType != CELLTYPE_NOTE)
{
sal_uLong nFormat = GetNumberFormat( nRow );
- ScCellFormat::GetString( pCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable()) );
+ ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable()));
}
else
- rString = rtl::OUString();
+ rString = EMPTY_OUSTRING;
}
else
- rString = rtl::OUString();
+ rString = EMPTY_OUSTRING;
}
const OUString* ScColumn::GetStringCell( SCROW nRow ) const
@@ -1942,14 +1944,14 @@ sal_Int32 ScColumn::GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCh
Search( nRowStart, nIndex );
while ( nIndex < maItems.size() && (nRow = maItems[nIndex].nRow) <= nRowEnd )
{
- ScBaseCell* pCell = maItems[nIndex].pCell;
- if ( pCell->GetCellType() != CELLTYPE_NOTE )
+ ScRefCellValue aCell;
+ aCell.assign(*maItems[nIndex].pCell);
+ if (aCell.meType != CELLTYPE_NOTE)
{
Color* pColor;
sal_uLong nFormat = (sal_uLong) ((SfxUInt32Item*) GetAttr(
nRow, ATTR_VALUE_FORMAT ))->GetValue();
- ScCellFormat::GetString( pCell, nFormat, aString, &pColor,
- *pNumFmt );
+ ScCellFormat::GetString(aCell, nFormat, aString, &pColor, *pNumFmt);
sal_Int32 nLen;
if (bIsOctetTextEncoding)
{
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 8254a96ca52c..8d0a9038eb8d 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -33,117 +33,6 @@
// Err527 Workaround
const ScFormulaCell* pLastFormulaTreeTop = 0;
-void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, OUString& rString,
- Color** ppColor, SvNumberFormatter& rFormatter,
- sal_Bool bNullVals,
- sal_Bool bFormula,
- ScForceTextFmt eForceTextFmt,
- bool bUseStarFormat )
-{
- *ppColor = NULL;
- if (&rFormatter==NULL)
- {
- rString = OUString();
- return;
- }
-
- CellType eType = pCell->GetCellType();
- switch(eType)
- {
- case CELLTYPE_STRING:
- {
- OUString aCellString = ((ScStringCell*)pCell)->GetString();
- rFormatter.GetOutputString( aCellString, nFormat, rString, ppColor, bUseStarFormat );
- }
- break;
- case CELLTYPE_EDIT:
- {
- OUString aCellString = ((ScEditCell*)pCell)->GetString();
- rFormatter.GetOutputString( aCellString, nFormat, rString, ppColor );
- }
- break;
- case CELLTYPE_VALUE:
- {
- double nValue = ((ScValueCell*)pCell)->GetValue();
- if ( !bNullVals && nValue == 0.0 )
- rString = OUString();
- else
- {
- if( eForceTextFmt == ftCheck )
- {
- if( nFormat && rFormatter.IsTextFormat( nFormat ) )
- eForceTextFmt = ftForce;
- }
- if( eForceTextFmt == ftForce )
- {
- OUString aTemp;
- rFormatter.GetOutputString( nValue, 0, aTemp, ppColor );
- rFormatter.GetOutputString( aTemp, nFormat, rString, ppColor );
- }
- else
- rFormatter.GetOutputString( nValue, nFormat, rString, ppColor, bUseStarFormat );
- }
- }
- break;
- case CELLTYPE_FORMULA:
- {
- ScFormulaCell* pFCell = (ScFormulaCell*)pCell;
- if ( bFormula )
- {
- pFCell->GetFormula( rString );
- }
- else
- {
- // A macro started from the interpreter, which has
- // access to Formular Cells, becomes a CellText, even if
- // that triggers further interpretation, except if those
- // cells are already being interpreted.
- // IdleCalc generally doesn't trigger futher interpretation,
- // as not to get Err522 (circular).
- if ( pFCell->GetDocument()->IsInInterpreter() &&
- (!pFCell->GetDocument()->GetMacroInterpretLevel()
- || pFCell->IsRunning()) )
- {
- rString = OUString("...");
- }
- else
- {
- sal_uInt16 nErrCode = pFCell->GetErrCode();
-
- // get the number format only after interpretation (GetErrCode):
- if ( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- nFormat = pFCell->GetStandardFormat( rFormatter,
- nFormat );
-
- if (nErrCode != 0)
- rString = ScGlobal::GetErrorString(nErrCode);
- else if ( pFCell->IsEmptyDisplayedAsString() )
- rString = OUString();
- else if ( pFCell->IsValue() )
- {
- double fValue = pFCell->GetValue();
- if ( !bNullVals && fValue == 0.0 )
- rString = OUString();
- else if ( pFCell->IsHybridValueCell() )
- rString = pFCell->GetString();
- else
- rFormatter.GetOutputString( fValue, nFormat, rString, ppColor, bUseStarFormat );
- }
- else
- {
- OUString aCellString = pFCell->GetString();
- rFormatter.GetOutputString( aCellString, nFormat, rString, ppColor, bUseStarFormat );
- }
- }
- }
- }
- break;
- default:
- rString = OUString();
- break;
- }
-}
-
void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString,
Color** ppColor, SvNumberFormatter& rFormatter,
bool bNullVals, bool bFormula, ScForceTextFmt eForceTextFmt,
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 449f9de224cd..b9e1201f6e09 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -53,6 +53,7 @@
#include "progress.hxx"
#include "scmod.hxx"
#include "fillinfo.hxx"
+#include "cellvalue.hxx"
#include <com/sun/star/i18n/DirectionProperty.hpp>
#include <comphelper/string.hxx>
@@ -478,7 +479,7 @@ inline sal_Bool SameValue( ScBaseCell* pCell, ScBaseCell* pOldCell ) // pCell
sal_Bool ScDrawStringsVars::SetText( ScBaseCell* pCell )
{
- sal_Bool bChanged = false;
+ bool bChanged = false;
if (pCell)
{
@@ -488,8 +489,10 @@ sal_Bool ScDrawStringsVars::SetText( ScBaseCell* pCell )
Color* pColor;
sal_uLong nFormat = GetValueFormat();
- rtl::OUString aOUString = aString;
- ScCellFormat::GetString( pCell,
+ OUString aOUString = aString;
+ ScRefCellValue aCell;
+ aCell.assign(*pCell);
+ ScCellFormat::GetString( aCell,
nFormat, aOUString, &pColor,
*pOutput->mpDoc->GetFormatTable(),
pOutput->mbShowNullValues,
@@ -2281,9 +2284,11 @@ bool ScOutputData::DrawEditParam::readCellContent(
{
sal_uLong nFormat = mpPattern->GetNumberFormat(
pDoc->GetFormatTable(), mpCondSet );
- rtl::OUString aString;
+ OUString aString;
Color* pColor;
- ScCellFormat::GetString( mpCell,
+ ScRefCellValue aCell;
+ aCell.assign(*mpCell);
+ ScCellFormat::GetString( aCell,
nFormat,aString, &pColor,
*pDoc->GetFormatTable(),
bShowNullValues,
@@ -4993,7 +4998,9 @@ void ScOutputData::DrawRotated(sal_Bool bPixelToLogic)
mpDoc->GetFormatTable(), pCondSet );
rtl::OUString aString;
Color* pColor;
- ScCellFormat::GetString( pCell,
+ ScRefCellValue aCell;
+ aCell.assign(*pCell);
+ ScCellFormat::GetString( aCell,
nFormat,aString, &pColor,
*mpDoc->GetFormatTable(),
mbShowNullValues,