[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Fri Mar 22 17:11:09 PDT 2013
sc/inc/document.hxx | 4 ++--
sc/source/core/data/column.cxx | 2 +-
sc/source/core/data/column2.cxx | 6 +++---
sc/source/core/data/documen6.cxx | 12 ++++--------
sc/source/filter/html/htmlexp.cxx | 2 +-
sc/source/ui/view/output2.cxx | 2 +-
sc/source/ui/view/viewfunc.cxx | 8 +++-----
sc/source/ui/view/viewutil.cxx | 2 +-
8 files changed, 16 insertions(+), 22 deletions(-)
New commits:
commit cef2ba8c77c2a265dbd44c99f30734bb61f4884f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Mar 22 20:10:36 2013 -0400
More on reducing direct use of ScBaseCell.
Change-Id: Ic59376eea086802f173e590faf2693b646db3feb
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 742bfc9..70c5620 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1228,8 +1228,8 @@ public:
SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
bool HasStringWeakCharacters( const rtl::OUString& rString );
SC_DLLPUBLIC sal_uInt8 GetStringScriptType( const rtl::OUString& rString );
- SC_DLLPUBLIC sal_uInt8 GetCellScriptType( const ScAddress& rPos, ScBaseCell* pCell, sal_uLong nNumberFormat );
- SC_DLLPUBLIC sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell );
+ SC_DLLPUBLIC sal_uInt8 GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat );
+ SC_DLLPUBLIC sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab );
bool HasDetectiveOperations() const;
void AddDetectiveOperation( const ScDetOpData& rData );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 13287de..5607211 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2371,7 +2371,7 @@ bool ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const
ScBaseCell* pCell = maItems[nIndex].pCell;
CellType eCellType = pCell->GetCellType();
if ( eCellType == CELLTYPE_EDIT ||
- IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab, pCell) ) ||
+ IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab) ) ||
((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) )
{
rFirst = nRow;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index e2792de..4108cdc 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -214,7 +214,7 @@ long ScColumn::GetNeededSize(
nIndent = ((const SfxUInt16Item&)pPattern->GetItem(ATTR_INDENT)).GetValue();
}
- sal_uInt8 nScript = pDocument->GetScriptType( nCol, nRow, nTab, pCell );
+ sal_uInt8 nScript = pDocument->GetScriptType(nCol, nRow, nTab);
if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
// also call SetFont for edit cells, because bGetFont may be set only once
@@ -603,7 +603,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
{
SCROW nRow = maItems[nIndex].nRow;
- sal_uInt8 nScript = pDocument->GetScriptType( nCol, nRow, nTab, maItems[nIndex].pCell );
+ sal_uInt8 nScript = pDocument->GetScriptType(nCol, nRow, nTab);
if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
const ScPatternAttr* pPattern = GetPattern( nRow );
@@ -772,7 +772,7 @@ void ScColumn::GetOptimalHeight(
Search(nStart,nIndex);
while ( nIndex < maItems.size() && (nRow=maItems[nIndex].nRow) <= nEnd )
{
- sal_uInt8 nScript = pDocument->GetScriptType( nCol, nRow, nTab, maItems[nIndex].pCell );
+ sal_uInt8 nScript = pDocument->GetScriptType(nCol, nRow, nTab);
if ( nScript != nDefScript )
{
if ( nScript == SCRIPTTYPE_ASIAN )
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index 507f7f9..055598c 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -114,18 +114,14 @@ sal_uInt8 ScDocument::GetStringScriptType( const rtl::OUString& rString )
return nRet;
}
-sal_uInt8 ScDocument::GetCellScriptType( const ScAddress& rPos, ScBaseCell* pCell, sal_uLong nNumberFormat )
+sal_uInt8 ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat )
{
- if ( !pCell )
- return 0; // empty
-
sal_uInt8 nStored = GetScriptType(rPos);
if ( nStored != SC_SCRIPTTYPE_UNKNOWN ) // stored value valid?
return nStored; // use stored value
- rtl::OUString aStr;
Color* pColor;
- ScCellFormat::GetString( pCell, nNumberFormat, aStr, &pColor, *xPoolHelper->GetFormTable() );
+ OUString aStr = ScCellFormat::GetString(*this, rPos, nNumberFormat, &pColor, *xPoolHelper->GetFormTable());
sal_uInt8 nRet = GetStringScriptType( aStr );
@@ -134,7 +130,7 @@ sal_uInt8 ScDocument::GetCellScriptType( const ScAddress& rPos, ScBaseCell* pCel
return nRet;
}
-sal_uInt8 ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell )
+sal_uInt8 ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab )
{
// if script type is set, don't have to get number formats
@@ -153,7 +149,7 @@ sal_uInt8 ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseC
sal_uLong nFormat = pPattern->GetNumberFormat( xPoolHelper->GetFormTable(), pCondSet );
- return GetCellScriptType(aPos, pCell, nFormat);
+ return GetCellScriptType(aPos, nFormat);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 06c48c8..4dafed6 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -883,7 +883,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
if ( pCell )
{
bValueData = pCell->HasValueData();
- nScriptType = pDoc->GetScriptType( nCol, nRow, nTab, pCell );
+ nScriptType = pDoc->GetScriptType(nCol, nRow, nTab);
}
else
{
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 2f53d18..449f9de 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1598,7 +1598,7 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
}
sal_uInt8 nScript = mpDoc->GetCellScriptType(
- ScAddress(nCellX, nCellY, nTab), pCell,
+ ScAddress(nCellX, nCellY, nTab),
pPattern->GetNumberFormat(mpDoc->GetFormatTable(), pCondSet));
if (nScript == 0)
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 1283ddd..e7ff91d 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -817,7 +817,7 @@ sal_uInt8 ScViewFunc::GetSelectionScriptType()
// no selection -> cursor
nScript = pDoc->GetScriptType( GetViewData()->GetCurX(),
- GetViewData()->GetCurY(), GetViewData()->GetTabNo(), NULL );
+ GetViewData()->GetCurY(), GetViewData()->GetTabNo());
}
else
{
@@ -828,12 +828,10 @@ sal_uInt8 ScViewFunc::GetSelectionScriptType()
{
ScRange aRange = *aRanges[i];
ScCellIterator aIter( pDoc, aRange );
- ScBaseCell* pCell = aIter.GetFirst();
- while ( pCell )
+ for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
{
nScript |= pDoc->GetScriptType(
- aIter.GetPos().Col(), aIter.GetPos().Row(), aIter.GetPos().Tab(), pCell);
- pCell = aIter.GetNext();
+ aIter.GetPos().Col(), aIter.GetPos().Row(), aIter.GetPos().Tab());
}
}
}
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 9aa5068..d055ced 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -72,7 +72,7 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
{
// used for thesaurus
- sal_uInt8 nScript = pDoc->GetScriptType( rPos.Col(), rPos.Row(), rPos.Tab(), NULL );
+ sal_uInt8 nScript = pDoc->GetScriptType(rPos.Col(), rPos.Row(), rPos.Tab());
sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE :
( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE );
const SfxPoolItem* pItem = pDoc->GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), nWhich);
More information about the Libreoffice-commits
mailing list