Kaydet (Commit) f5bafb29 authored tarafından Laurent Godard's avatar Laurent Godard Kaydeden (comit) Kohei Yoshida

clean obsolete parts of ScMyCell

Change-Id: Ic7775d376a6089d7795514081ca4f912e4228f73
Reviewed-on: https://gerrit.libreoffice.org/5674Reviewed-by: 's avatarKohei Yoshida <kohei.yoshida@suse.de>
Tested-by: 's avatarKohei Yoshida <kohei.yoshida@suse.de>
üst 8acb68ba
...@@ -597,7 +597,6 @@ void ScMyDetectiveOpContainer::Sort() ...@@ -597,7 +597,6 @@ void ScMyDetectiveOpContainer::Sort()
ScMyCell::ScMyCell() : ScMyCell::ScMyCell() :
aShapeList(), aShapeList(),
aDetectiveObjVec(), aDetectiveObjVec(),
fValue(0.0),
nValidationIndex(-1), nValidationIndex(-1),
bIsAutoStyle( false ), bIsAutoStyle( false ),
bHasShape( false ), bHasShape( false ),
...@@ -607,10 +606,6 @@ ScMyCell::ScMyCell() : ...@@ -607,10 +606,6 @@ ScMyCell::ScMyCell() :
bHasEmptyDatabase( false ), bHasEmptyDatabase( false ),
bHasDetectiveObj( false ), bHasDetectiveObj( false ),
bHasDetectiveOp( false ), bHasDetectiveOp( false ),
bIsEditCell( false ),
bHasStringValue( false ),
bHasDoubleValue( false ),
bHasXText( false ),
bIsMatrixBase( false ), bIsMatrixBase( false ),
bIsMatrixCovered( false ), bIsMatrixCovered( false ),
bHasAnnotation( false ) bHasAnnotation( false )
...@@ -683,10 +678,7 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, table::CellAddre ...@@ -683,10 +678,7 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, table::CellAddre
{ {
rMyCell.maBaseCell.clear(); rMyCell.maBaseCell.clear();
rMyCell.aCellAddress = rAddress; rMyCell.aCellAddress = rAddress;
rMyCell.bHasStringValue = false;
rMyCell.bHasDoubleValue = false;
rMyCell.bHasXText = false;
rMyCell.bIsEditCell = false;
if( (nCellCol == rAddress.Column) && (nCellRow == rAddress.Row) ) if( (nCellCol == rAddress.Column) && (nCellRow == rAddress.Row) )
{ {
mpCell = mpCellItr->GetNext(nCellCol, nCellRow); mpCell = mpCellItr->GetNext(nCellCol, nCellRow);
...@@ -738,8 +730,7 @@ void ScMyNotEmptyCellsIterator::HasAnnotation(ScMyCell& aCell) ...@@ -738,8 +730,7 @@ void ScMyNotEmptyCellsIterator::HasAnnotation(ScMyCell& aCell)
uno::Reference<text::XSimpleText> xSimpleText(aCell.xAnnotation, uno::UNO_QUERY); uno::Reference<text::XSimpleText> xSimpleText(aCell.xAnnotation, uno::UNO_QUERY);
if (aCell.xAnnotation.is() && xSimpleText.is()) if (aCell.xAnnotation.is() && xSimpleText.is())
{ {
aCell.sAnnotationText = xSimpleText->getString(); if (!xSimpleText->getString().isEmpty())
if (!aCell.sAnnotationText.isEmpty())
aCell.bHasAnnotation = true; aCell.bHasAnnotation = true;
} }
aAnnotations.erase(aItr); aAnnotations.erase(aItr);
......
...@@ -300,15 +300,11 @@ struct ScMyCell ...@@ -300,15 +300,11 @@ struct ScMyCell
com::sun::star::table::CellRangeAddress aMergeRange; com::sun::star::table::CellRangeAddress aMergeRange;
com::sun::star::table::CellRangeAddress aMatrixRange; com::sun::star::table::CellRangeAddress aMatrixRange;
OUString sStringValue;
OUString sAnnotationText;
ScMyAreaLink aAreaLink; ScMyAreaLink aAreaLink;
ScMyShapeList aShapeList; ScMyShapeList aShapeList;
ScMyDetectiveObjVec aDetectiveObjVec; ScMyDetectiveObjVec aDetectiveObjVec;
ScMyDetectiveOpVec aDetectiveOpVec; ScMyDetectiveOpVec aDetectiveOpVec;
double fValue;
sal_Int32 nValidationIndex; sal_Int32 nValidationIndex;
sal_Int32 nStyleIndex; sal_Int32 nStyleIndex;
sal_Int32 nNumberFormat; sal_Int32 nNumberFormat;
...@@ -326,11 +322,6 @@ struct ScMyCell ...@@ -326,11 +322,6 @@ struct ScMyCell
bool bHasDetectiveObj; bool bHasDetectiveObj;
bool bHasDetectiveOp; bool bHasDetectiveOp;
bool bIsEditCell;
bool bHasStringValue;
bool bHasDoubleValue;
bool bHasXText;
bool bIsMatrixBase; bool bIsMatrixBase;
bool bIsMatrixCovered; bool bIsMatrixCovered;
bool bHasAnnotation; bool bHasAnnotation;
......
...@@ -2864,15 +2864,6 @@ bool ScXMLExport::IsMatrix (const ScAddress& aCell, ...@@ -2864,15 +2864,6 @@ bool ScXMLExport::IsMatrix (const ScAddress& aCell,
return false; return false;
} }
void ScXMLExport::GetCellText (ScMyCell& rMyCell, const ScAddress& aPos) const
{
if (!rMyCell.bHasStringValue)
{
rMyCell.sStringValue = ScCellObj::GetOutputString_Impl(pDoc, aPos);
rMyCell.bHasStringValue = true;
}
}
void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadsheet>& xTable) void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadsheet>& xTable)
{ {
if (!xTable.is()) if (!xTable.is())
...@@ -3223,37 +3214,30 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) ...@@ -3223,37 +3214,30 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
break; break;
case table::CellContentType_VALUE : case table::CellContentType_VALUE :
{ {
if (!aCell.bHasDoubleValue)
{
aCell.fValue = pDoc->GetValue( aCellPos );
aCell.bHasDoubleValue = true;
}
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, aCell.fValue); aCell.nNumberFormat, aCell.maBaseCell.mfValue);
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, aCell.fValue, false, XML_NAMESPACE_CALC_EXT, false); aCell.nNumberFormat, aCell.maBaseCell.mfValue, false, XML_NAMESPACE_CALC_EXT, false);
} }
break; break;
case table::CellContentType_TEXT : case table::CellContentType_TEXT :
{ {
GetCellText(aCell, aCellPos);
OUString sFormula(lcl_GetRawString(pDoc, aCellPos)); OUString sFormula(lcl_GetRawString(pDoc, aCellPos));
OUString sCellString = aCell.maBaseCell.getString(pDoc);
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
sFormula, aCell.sStringValue, true, true); sFormula, sCellString, true, true);
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
sFormula, aCell.sStringValue, false, true, XML_NAMESPACE_CALC_EXT); sFormula, sCellString, false, true, XML_NAMESPACE_CALC_EXT);
} }
break; break;
case table::CellContentType_FORMULA : case table::CellContentType_FORMULA :
{ {
ScRefCellValue aCellVal; if (aCell.maBaseCell.meType == CELLTYPE_FORMULA)
aCellVal.assign(*pDoc, aCellPos);
if (aCellVal.meType == CELLTYPE_FORMULA)
{ {
OUStringBuffer sFormula; OUStringBuffer sFormula;
ScFormulaCell* pFormulaCell = aCellVal.mpFormula; ScFormulaCell* pFormulaCell = aCell.maBaseCell.mpFormula;
if (!bIsMatrix || (bIsMatrix && bIsFirstMatrixCell)) if (!bIsMatrix || (bIsMatrix && bIsFirstMatrixCell))
{ {
const formula::FormulaGrammar::Grammar eGrammar = pDoc->GetStorageGrammar(); const formula::FormulaGrammar::Grammar eGrammar = pDoc->GetStorageGrammar();
...@@ -3271,9 +3255,8 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) ...@@ -3271,9 +3255,8 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
} }
if (pFormulaCell->GetErrCode()) if (pFormulaCell->GetErrCode())
{ {
GetCellText(aCell, aCellPos);
AddAttribute(sAttrValueType, XML_STRING); AddAttribute(sAttrValueType, XML_STRING);
AddAttribute(sAttrStringValue, aCell.sStringValue); AddAttribute(sAttrStringValue, aCell.maBaseCell.getString(pDoc));
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
{ {
//export calcext:value-type="error" //export calcext:value-type="error"
...@@ -3298,11 +3281,10 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) ...@@ -3298,11 +3281,10 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
} }
else else
{ {
GetCellText(aCell, aCellPos); if (!aCell.maBaseCell.getString(pDoc).isEmpty())
if (!aCell.sStringValue.isEmpty())
{ {
AddAttribute(sAttrValueType, XML_STRING); AddAttribute(sAttrValueType, XML_STRING);
AddAttribute(sAttrStringValue, aCell.sStringValue); AddAttribute(sAttrStringValue, aCell.maBaseCell.getString(pDoc));
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
{ {
AddAttribute(XML_NAMESPACE_CALC_EXT,XML_VALUE_TYPE, XML_STRING); AddAttribute(XML_NAMESPACE_CALC_EXT,XML_VALUE_TYPE, XML_STRING);
...@@ -3354,8 +3336,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) ...@@ -3354,8 +3336,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{ {
SvXMLElementExport aElemP(*this, sElemP, true, false); SvXMLElementExport aElemP(*this, sElemP, true, false);
bool bPrevCharWasSpace(true); bool bPrevCharWasSpace(true);
GetCellText(aCell, aCellPos); GetTextParagraphExport()->exportText(aCell.maBaseCell.getString(pDoc), bPrevCharWasSpace);
GetTextParagraphExport()->exportText(aCell.sStringValue, bPrevCharWasSpace);
} }
} }
WriteShapes(aCell); WriteShapes(aCell);
...@@ -3836,20 +3817,10 @@ bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2) ...@@ -3836,20 +3817,10 @@ bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2)
break; break;
case table::CellContentType_VALUE : case table::CellContentType_VALUE :
{ {
if(!aCell1.bHasDoubleValue)
{
aCell1.fValue = pDoc->GetValue( aCellPos1 );
aCell1.bHasDoubleValue = true;
}
if (!aCell2.bHasDoubleValue)
{
aCell2.fValue = pDoc->GetValue( aCellPos2 );
aCell2.bHasDoubleValue = true;
}
// #i29101# number format may be different from column default styles, // #i29101# number format may be different from column default styles,
// but can lead to different value types, so it must also be compared // but can lead to different value types, so it must also be compared
bIsEqual = (aCell1.nNumberFormat == aCell2.nNumberFormat) && bIsEqual = (aCell1.nNumberFormat == aCell2.nNumberFormat) &&
(aCell1.fValue == aCell2.fValue); (aCell1.maBaseCell.mfValue == aCell2.maBaseCell.mfValue);
} }
break; break;
case table::CellContentType_TEXT : case table::CellContentType_TEXT :
...@@ -3858,10 +3829,7 @@ bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2) ...@@ -3858,10 +3829,7 @@ bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2)
bIsEqual = false; bIsEqual = false;
else else
{ {
GetCellText(aCell1, aCellPos1); bIsEqual = (aCell1.maBaseCell.getString(pDoc) == aCell2.maBaseCell.getString(pDoc));
GetCellText(aCell2, aCellPos2);
bIsEqual = (aCell1.sStringValue == aCell2.sStringValue) &&
(lcl_GetRawString(pDoc, aCellPos1) == lcl_GetRawString(pDoc, aCellPos2));
} }
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment