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()
ScMyCell::ScMyCell() :
aShapeList(),
aDetectiveObjVec(),
fValue(0.0),
nValidationIndex(-1),
bIsAutoStyle( false ),
bHasShape( false ),
......@@ -607,10 +606,6 @@ ScMyCell::ScMyCell() :
bHasEmptyDatabase( false ),
bHasDetectiveObj( false ),
bHasDetectiveOp( false ),
bIsEditCell( false ),
bHasStringValue( false ),
bHasDoubleValue( false ),
bHasXText( false ),
bIsMatrixBase( false ),
bIsMatrixCovered( false ),
bHasAnnotation( false )
......@@ -683,10 +678,7 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, table::CellAddre
{
rMyCell.maBaseCell.clear();
rMyCell.aCellAddress = rAddress;
rMyCell.bHasStringValue = false;
rMyCell.bHasDoubleValue = false;
rMyCell.bHasXText = false;
rMyCell.bIsEditCell = false;
if( (nCellCol == rAddress.Column) && (nCellRow == rAddress.Row) )
{
mpCell = mpCellItr->GetNext(nCellCol, nCellRow);
......@@ -738,8 +730,7 @@ void ScMyNotEmptyCellsIterator::HasAnnotation(ScMyCell& aCell)
uno::Reference<text::XSimpleText> xSimpleText(aCell.xAnnotation, uno::UNO_QUERY);
if (aCell.xAnnotation.is() && xSimpleText.is())
{
aCell.sAnnotationText = xSimpleText->getString();
if (!aCell.sAnnotationText.isEmpty())
if (!xSimpleText->getString().isEmpty())
aCell.bHasAnnotation = true;
}
aAnnotations.erase(aItr);
......
......@@ -300,15 +300,11 @@ struct ScMyCell
com::sun::star::table::CellRangeAddress aMergeRange;
com::sun::star::table::CellRangeAddress aMatrixRange;
OUString sStringValue;
OUString sAnnotationText;
ScMyAreaLink aAreaLink;
ScMyShapeList aShapeList;
ScMyDetectiveObjVec aDetectiveObjVec;
ScMyDetectiveOpVec aDetectiveOpVec;
double fValue;
sal_Int32 nValidationIndex;
sal_Int32 nStyleIndex;
sal_Int32 nNumberFormat;
......@@ -326,11 +322,6 @@ struct ScMyCell
bool bHasDetectiveObj;
bool bHasDetectiveOp;
bool bIsEditCell;
bool bHasStringValue;
bool bHasDoubleValue;
bool bHasXText;
bool bIsMatrixBase;
bool bIsMatrixCovered;
bool bHasAnnotation;
......
......@@ -2864,15 +2864,6 @@ bool ScXMLExport::IsMatrix (const ScAddress& aCell,
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)
{
if (!xTable.is())
......@@ -3223,37 +3214,30 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
break;
case table::CellContentType_VALUE :
{
if (!aCell.bHasDoubleValue)
{
aCell.fValue = pDoc->GetValue( aCellPos );
aCell.bHasDoubleValue = true;
}
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, aCell.fValue);
aCell.nNumberFormat, aCell.maBaseCell.mfValue);
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, aCell.fValue, false, XML_NAMESPACE_CALC_EXT, false);
aCell.nNumberFormat, aCell.maBaseCell.mfValue, false, XML_NAMESPACE_CALC_EXT, false);
}
break;
case table::CellContentType_TEXT :
{
GetCellText(aCell, aCellPos);
OUString sFormula(lcl_GetRawString(pDoc, aCellPos));
OUString sCellString = aCell.maBaseCell.getString(pDoc);
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
sFormula, aCell.sStringValue, true, true);
sFormula, sCellString, true, true);
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
sFormula, aCell.sStringValue, false, true, XML_NAMESPACE_CALC_EXT);
sFormula, sCellString, false, true, XML_NAMESPACE_CALC_EXT);
}
break;
case table::CellContentType_FORMULA :
{
ScRefCellValue aCellVal;
aCellVal.assign(*pDoc, aCellPos);
if (aCellVal.meType == CELLTYPE_FORMULA)
if (aCell.maBaseCell.meType == CELLTYPE_FORMULA)
{
OUStringBuffer sFormula;
ScFormulaCell* pFormulaCell = aCellVal.mpFormula;
ScFormulaCell* pFormulaCell = aCell.maBaseCell.mpFormula;
if (!bIsMatrix || (bIsMatrix && bIsFirstMatrixCell))
{
const formula::FormulaGrammar::Grammar eGrammar = pDoc->GetStorageGrammar();
......@@ -3271,9 +3255,8 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
}
if (pFormulaCell->GetErrCode())
{
GetCellText(aCell, aCellPos);
AddAttribute(sAttrValueType, XML_STRING);
AddAttribute(sAttrStringValue, aCell.sStringValue);
AddAttribute(sAttrStringValue, aCell.maBaseCell.getString(pDoc));
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
{
//export calcext:value-type="error"
......@@ -3298,11 +3281,10 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
}
else
{
GetCellText(aCell, aCellPos);
if (!aCell.sStringValue.isEmpty())
if (!aCell.maBaseCell.getString(pDoc).isEmpty())
{
AddAttribute(sAttrValueType, XML_STRING);
AddAttribute(sAttrStringValue, aCell.sStringValue);
AddAttribute(sAttrStringValue, aCell.maBaseCell.getString(pDoc));
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
{
AddAttribute(XML_NAMESPACE_CALC_EXT,XML_VALUE_TYPE, XML_STRING);
......@@ -3354,8 +3336,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
SvXMLElementExport aElemP(*this, sElemP, true, false);
bool bPrevCharWasSpace(true);
GetCellText(aCell, aCellPos);
GetTextParagraphExport()->exportText(aCell.sStringValue, bPrevCharWasSpace);
GetTextParagraphExport()->exportText(aCell.maBaseCell.getString(pDoc), bPrevCharWasSpace);
}
}
WriteShapes(aCell);
......@@ -3836,20 +3817,10 @@ bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2)
break;
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,
// but can lead to different value types, so it must also be compared
bIsEqual = (aCell1.nNumberFormat == aCell2.nNumberFormat) &&
(aCell1.fValue == aCell2.fValue);
(aCell1.maBaseCell.mfValue == aCell2.maBaseCell.mfValue);
}
break;
case table::CellContentType_TEXT :
......@@ -3858,10 +3829,7 @@ bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2)
bIsEqual = false;
else
{
GetCellText(aCell1, aCellPos1);
GetCellText(aCell2, aCellPos2);
bIsEqual = (aCell1.sStringValue == aCell2.sStringValue) &&
(lcl_GetRawString(pDoc, aCellPos1) == lcl_GetRawString(pDoc, aCellPos2));
bIsEqual = (aCell1.maBaseCell.getString(pDoc) == aCell2.maBaseCell.getString(pDoc));
}
}
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