[Libreoffice-commits] core.git: sc/source

Laurent Godard lgodard.libre at laposte.net
Thu Aug 29 13:27:59 PDT 2013


 sc/source/filter/xml/XMLExportIterator.cxx |   13 +-----
 sc/source/filter/xml/XMLExportIterator.hxx |    9 ----
 sc/source/filter/xml/xmlexprt.cxx          |   58 ++++++-----------------------
 3 files changed, 15 insertions(+), 65 deletions(-)

New commits:
commit f5bafb295559bc3e673ab2aa35e84cb42b9e5f1e
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Thu Aug 29 10:24:14 2013 +0200

    clean obsolete parts of ScMyCell
    
    Change-Id: Ic7775d376a6089d7795514081ca4f912e4228f73
    Reviewed-on: https://gerrit.libreoffice.org/5674
    Reviewed-by: Kohei Yoshida <kohei.yoshida at suse.de>
    Tested-by: Kohei Yoshida <kohei.yoshida at suse.de>

diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx
index df6c2f0..976f387 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -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);
diff --git a/sc/source/filter/xml/XMLExportIterator.hxx b/sc/source/filter/xml/XMLExportIterator.hxx
index 6433510..9fa520d 100644
--- a/sc/source/filter/xml/XMLExportIterator.hxx
+++ b/sc/source/filter/xml/XMLExportIterator.hxx
@@ -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;
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 873da75..8873238 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -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;


More information about the Libreoffice-commits mailing list