[Libreoffice-commits] core.git: Branch 'feature/inherited-number-format-removal' - sc/inc sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Sat May 25 06:52:07 PDT 2013
sc/inc/formulacell.hxx | 4 ----
sc/source/core/data/formulacell.cxx | 15 +--------------
sc/source/core/tool/cellform.cxx | 5 -----
sc/source/filter/xml/xmlexprt.cxx | 28 +++++-----------------------
sc/source/ui/app/transobj.cxx | 12 ------------
sc/source/ui/unoobj/funcuno.cxx | 24 ------------------------
sc/source/ui/view/tabvwsha.cxx | 7 -------
7 files changed, 6 insertions(+), 89 deletions(-)
New commits:
commit 245fb6e3fa6302abaafbcfa28b7922427cea2564
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 25 15:12:24 2013 +0200
all formula cells have now an explicit number format
Remove ScFormulaCell::GetStandardFormat
Change-Id: I0b19f572cfcf5c08c81009b0f10e7cc44a1aa2f4
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index cd9767c..54aac68 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -236,10 +236,6 @@ public:
void SetInChangeTrack( bool bVal ) { bInChangeTrack = bVal; }
bool IsInChangeTrack() const { return bInChangeTrack; }
- // standard format for type and format
- // for format "Standard" possibly the format used in the formula cell
- sal_uLong GetStandardFormat( SvNumberFormatter& rFormatter, sal_uLong nFormat ) const;
-
// For import filters!
void AddRecalcMode( formula::ScRecalcMode );
/** For import only: set a double result. */
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index d5651c7..291769d 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1492,16 +1492,6 @@ void ScFormulaCell::GetMatColsRows( SCCOL & nCols, SCROW & nRows ) const
}
-sal_uLong ScFormulaCell::GetStandardFormat( SvNumberFormatter& rFormatter, sal_uLong nFormat ) const
-{
- //! not ScFormulaCell::IsValue(), that could reinterpret the formula again.
- if ( aResult.IsValue() )
- return ScGlobal::GetStandardFormat( aResult.GetDouble(), rFormatter, nFormat, nFormatType );
- else
- return ScGlobal::GetStandardFormat( rFormatter, nFormat, nFormatType );
-}
-
-
void ScFormulaCell::Notify( SvtBroadcaster&, const SfxHint& rHint)
{
if ( !pDocument->IsInDtorClear() && !pDocument->GetHardRecalcState() )
@@ -1649,10 +1639,7 @@ void ScFormulaCell::GetURLResult( OUString& rURL, OUString& rCellText )
sal_uLong nCellFormat = pDocument->GetNumberFormat( aPos );
SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
- if ( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- nCellFormat = GetStandardFormat( *pFormatter,nCellFormat );
-
- sal_uLong nURLFormat = ScGlobal::GetStandardFormat( *pFormatter,nCellFormat, NUMBERFORMAT_NUMBER);
+ sal_uLong nURLFormat = ScGlobal::GetStandardFormat( *pFormatter, nCellFormat, NUMBERFORMAT_NUMBER);
if ( IsValue() )
{
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 6846874..a33405f 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -101,11 +101,6 @@ void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString
{
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() )
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index c78c4df..d39900f 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2936,33 +2936,15 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
bool bIsStandard;
OUString sCurrency;
GetNumberFormatAttributesExportHelper()->GetCellType(aCell.nNumberFormat, sCurrency, bIsStandard);
- if (bIsStandard)
+ if (pDoc)
{
- if (pDoc)
- {
- GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
- pFormulaCell->GetStandardFormat(*pDoc->GetFormatTable(), 0),
- pDoc->GetValue( aCellPos ));
- if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
- {
- GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
- pFormulaCell->GetStandardFormat(*pDoc->GetFormatTable(), 0),
- pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT);
- }
- }
- }
- else
- {
- if (pDoc)
+ GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
+ aCell.nNumberFormat, pDoc->GetValue( aCellPos ));
+ if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
{
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
- aCell.nNumberFormat, pDoc->GetValue( aCellPos ));
- if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
- {
- GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
- aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT );
+ aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT );
- }
}
}
}
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 6bf6d93..d5ea43e 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -831,18 +831,6 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
pDestDoc->SetString(aPos, aStr);
}
}
-
- // number formats
-
- sal_uLong nOldFormat = ((const SfxUInt32Item*)
- pDestDoc->GetAttr(nCol,nRow,nDestTab, ATTR_VALUE_FORMAT))->GetValue();
- if ( (nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- {
- sal_uLong nNewFormat = pFCell->GetStandardFormat( *pFormatter,
- nOldFormat );
- pDestDoc->ApplyAttr( nCol,nRow,nDestTab,
- SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat) );
- }
}
}
}
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 22fbf0e..7c57ee9 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -173,30 +173,6 @@ static sal_Bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange,
pClipDoc->ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nSrcTab, aPattern );
}
- // If the range contains formula cells with default number format,
- // apply a number format for the formula result
- ScCellIterator aIter( pClipDoc, rSrcRange );
- for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
- {
- if (aIter.getType() != CELLTYPE_FORMULA)
- continue;
-
- ScAddress aCellPos = aIter.GetPos();
- sal_uInt32 nFormat = pClipDoc->GetNumberFormat(aCellPos);
- if ( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- {
- ScFormulaCell* pFCell = aIter.getFormulaCell();
- sal_uInt16 nErrCode = pFCell->GetErrCode();
- if ( nErrCode == 0 && pFCell->IsValue() )
- {
- sal_uInt32 nNewFormat = pFCell->GetStandardFormat( *pClipDoc->GetFormatTable(), nFormat );
- if ( nNewFormat != nFormat )
- pClipDoc->ApplyAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(),
- SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
- }
- }
- }
-
ScMarkData aDestMark;
aDestMark.SelectOneTable( nDestTab );
aDestMark.SetMarkArea( aNewRange );
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 1cc39fd..4e2d645 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -112,13 +112,6 @@ sal_Bool ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode )
{
// Zahlformat aus Attributen oder Formel
pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt );
- if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- {
- ScRefCellValue aCell;
- aCell.assign(*pDoc, aCursor);
- if (aCell.meType == CELLTYPE_FORMULA)
- nNumFmt = aCell.mpFormula->GetStandardFormat(*pFormatter, nNumFmt);
- }
}
String aValStr;
More information about the Libreoffice-commits
mailing list