sc/inc/cellvalue.hxx                                   |    9 +++
 sc/inc/dociter.hxx                                     |    2 
 sc/qa/unit/subsequent_export_test.cxx                  |    6 +-
 sc/qa/unit/subsequent_filters_test.cxx                 |    2 
 sc/qa/unit/ucalc.cxx                                   |    8 +--
 sc/qa/unit/ucalc_sharedformula.cxx                     |    2 
 sc/source/core/data/attarray.cxx                       |    2 
 sc/source/core/data/cellvalue.cxx                      |   22 ++++----
 sc/source/core/data/clipcontext.cxx                    |    2 
 sc/source/core/data/column.cxx                         |   17 +-----
 sc/source/core/data/column2.cxx                        |   14 ++---
 sc/source/core/data/column3.cxx                        |   12 ++--
 sc/source/core/data/column4.cxx                        |    4 -
 sc/source/core/data/conditio.cxx                       |    6 +-
 sc/source/core/data/dociter.cxx                        |   21 +++-----
 sc/source/core/data/documen8.cxx                       |    8 +--
 sc/source/core/data/document.cxx                       |    2 
 sc/source/core/data/documentimport.cxx                 |    4 -
 sc/source/core/data/fillinfo.cxx                       |    2 
 sc/source/core/data/queryevaluator.cxx                 |   17 +++---
 sc/source/core/data/queryiter.cxx                      |    4 -
 sc/source/core/data/table2.cxx                         |    4 -
 sc/source/core/data/table3.cxx                         |    6 +-
 sc/source/core/data/table4.cxx                         |   44 ++++++++---------
 sc/source/core/data/table5.cxx                         |    4 -
 sc/source/core/data/table6.cxx                         |    2 
 sc/source/core/data/validat.cxx                        |    8 +--
 sc/source/core/tool/cellform.cxx                       |    6 +-
 sc/source/core/tool/chartarr.cxx                       |    2 
 sc/source/core/tool/chgtrack.cxx                       |   29 +++++------
 sc/source/core/tool/detfunc.cxx                        |    6 +-
 sc/source/core/tool/interpr1.cxx                       |   26 +++++-----
 sc/source/core/tool/interpr4.cxx                       |   26 +++++-----
 sc/source/core/tool/interpr5.cxx                       |    6 +-
 sc/source/core/tool/interpr6.cxx                       |    2 
 sc/source/core/tool/rangeseq.cxx                       |    2 
 sc/source/filter/dif/difexp.cxx                        |    2 
 sc/source/filter/excel/xetable.cxx                     |    2 
 sc/source/filter/excel/xicontent.cxx                   |    4 -
 sc/source/filter/html/htmlexp.cxx                      |    6 +-
 sc/source/filter/oox/worksheethelper.cxx               |    2 
 sc/source/filter/rtf/rtfexp.cxx                        |    2 
 sc/source/filter/xcl97/XclExpChangeTrack.cxx           |    4 -
 sc/source/filter/xcl97/XclImpChangeTrack.cxx           |   15 +----
 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |   12 ++--
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |    8 +--
 sc/source/filter/xml/XMLExportIterator.cxx             |    4 -
 sc/source/filter/xml/XMLTrackedChangesContext.cxx      |    9 +--
 sc/source/filter/xml/xmlcelli.cxx                      |    6 +-
 sc/source/filter/xml/xmlexprt.cxx                      |   10 +--
 sc/source/ui/Accessibility/AccessibleCell.cxx          |    2 
 sc/source/ui/app/transobj.cxx                          |    2 
 sc/source/ui/docshell/docsh.cxx                        |    4 -
 sc/source/ui/docshell/docsh3.cxx                       |    2 
 sc/source/ui/docshell/docsh8.cxx                       |    4 -
 sc/source/ui/docshell/externalrefmgr.cxx               |    6 +-
 sc/source/ui/docshell/impex.cxx                        |    4 -
 sc/source/ui/undo/undocell.cxx                         |    2 
 sc/source/ui/unoobj/cellsuno.cxx                       |   14 ++---
 sc/source/ui/unoobj/chart2uno.cxx                      |    2 
 sc/source/ui/unoobj/textuno.cxx                        |    2 
 sc/source/ui/view/cellsh1.cxx                          |    2 
 sc/source/ui/view/gridwin.cxx                          |   16 +++---
 sc/source/ui/view/output.cxx                           |    4 -
 sc/source/ui/view/output2.cxx                          |   30 +++++------
 sc/source/ui/view/spellcheckcontext.cxx                |    8 +--
 sc/source/ui/view/spelleng.cxx                         |    2 
 sc/source/ui/view/tabvwsh.cxx                          |    2 
 sc/source/ui/view/tabvwsh5.cxx                         |    2 
 sc/source/ui/view/tabvwsha.cxx                         |    6 +-
 sc/source/ui/view/viewfun2.cxx                         |    2 
 sc/source/ui/view/viewfun4.cxx                         |    6 +-
 sc/source/ui/view/viewfunc.cxx                         |    2 
 73 files changed, 269 insertions(+), 282 deletions(-)

New commits:
commit 3d2e26d8b7a99d0a622741ef4327e8cbc93bbe02
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Jun 16 14:09:43 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Jun 16 15:26:14 2022 +0200

    make meType in ScCellValue private
    
    as a first step to wrapping up the internals of this class and adding
    some asserts
    
    Change-Id: Ic13ddd917948dbf3fd6d73f44b8efcc727726baf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135994
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 3cd1bb8710cf..5876f9584a4f 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -34,7 +34,9 @@ class SharedString;
  */
 struct SC_DLLPUBLIC ScCellValue
 {
+private:
     CellType meType;
+public:
     union {
         double mfValue;
         svl::SharedString* mpString;
@@ -46,6 +48,7 @@ struct SC_DLLPUBLIC ScCellValue
     ScCellValue( const ScRefCellValue& rCell );
     ScCellValue( double fValue );
     ScCellValue( const svl::SharedString& rString );
+    ScCellValue( std::unique_ptr<EditTextObject> );
     ScCellValue( const ScCellValue& r );
     ScCellValue(ScCellValue&& r) noexcept;
     ~ScCellValue();
@@ -58,6 +61,8 @@ struct SC_DLLPUBLIC ScCellValue
     void set( EditTextObject* pEditText );
     void set( ScFormulaCell* pFormula );
 
+    CellType getType() const { return meType; }
+
     /**
      * Take cell value from specified position in specified document.
      */
@@ -102,7 +107,9 @@ struct SC_DLLPUBLIC ScCellValue
  */
 struct SC_DLLPUBLIC ScRefCellValue
 {
+private:
     CellType meType;
+public:
     union {
         double mfValue;
         const svl::SharedString* mpString;
@@ -124,6 +131,8 @@ struct SC_DLLPUBLIC ScRefCellValue
 
     void clear();
 
+    CellType getType() const { return meType; }
+
     /**
      * Take cell value from specified position in specified document.
      */
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 90fbd614b8bd..622d36332d97 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -232,7 +232,7 @@ public:
 
     const ScAddress& GetPos() const { return maCurPos; }
 
-    CellType getType() const { return maCurCell.meType;}
+    CellType getType() const { return maCurCell.getType();}
     OUString getString() const;
     const EditTextObject* getEditText() const { return maCurCell.mpEditText;}
     ScFormulaCell* getFormulaCell() { return maCurCell.mpFormula;}
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index d543cd692af0..15155636d2a1 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -2295,15 +2295,15 @@ void ScExportTest::testCellValuesExportODS()
     // check string
     ScRefCellValue aCell;
     aCell.assign(rDoc, ScAddress(0, 2, 0));
-    CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, aCell.getType());
 
     // check for an empty cell
     aCell.assign(rDoc, ScAddress(0, 3, 0));
-    CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, aCell.getType());
 
     // check a digit string
     aCell.assign(rDoc, ScAddress(0, 4, 0));
-    CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, aCell.getType());
 
     //check contiguous values
     CPPUNIT_ASSERT_EQUAL(12.0, rDoc.GetValue(0, 5, 0));
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index 9f02b7799c1d..c1dd83f791a2 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -583,7 +583,7 @@ void ScFiltersTest::testBasicCellContentODS()
     ScRefCellValue aCell;
     aCell.assign(rDoc, ScAddress(1,4,0)); // B5
     CPPUNIT_ASSERT_EQUAL_MESSAGE(
-        "This cell must be numeric.", CELLTYPE_VALUE, aCell.meType);
+        "This cell must be numeric.", CELLTYPE_VALUE, aCell.getType());
     CPPUNIT_ASSERT_EQUAL(0.0, aCell.mfValue);
 
     xDocSh->DoClose();
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a83b5482647f..d5c983190b98 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6093,13 +6093,13 @@ void Test::testColumnFindEditCells()
     m_pDoc->SetValue(ScAddress(0,2,0), 1.0);
     ScRefCellValue aCell;
     aCell.assign(*m_pDoc, ScAddress(0,0,0));
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a string cell.", 
CELLTYPE_STRING, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a string cell.", 
CELLTYPE_STRING, aCell.getType());
     aCell.assign(*m_pDoc, ScAddress(0,1,0));
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be an empty cell.", 
CELLTYPE_NONE, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be an empty cell.", 
CELLTYPE_NONE, aCell.getType());
     aCell.assign(*m_pDoc, ScAddress(0,2,0));
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a numeric cell.", 
CELLTYPE_VALUE, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a numeric cell.", 
CELLTYPE_VALUE, aCell.getType());
     aCell.assign(*m_pDoc, ScAddress(0,3,0));
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be an empty cell.", 
CELLTYPE_NONE, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be an empty cell.", 
CELLTYPE_NONE, aCell.getType());
 
     aRange.aStart.SetRow(1);
     aRange.aEnd.SetRow(1);
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx 
b/sc/qa/unit/ucalc_sharedformula.cxx
index 7099b933dff8..64f248c91cf8 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -282,7 +282,7 @@ void TestSharedFormula::testSharedFormulas()
     // Set string value to B16 to make B17:B18 shared.
     aPos.SetRow(15);
     ScCellValue aCell(svl::SharedString("Test"));
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a string value.", 
CELLTYPE_STRING, aCell.meType);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a string value.", 
CELLTYPE_STRING, aCell.getType());
     aCell.commit(*m_pDoc, aPos);
     CPPUNIT_ASSERT_EQUAL(aCell.mpString->getString(), m_pDoc->GetString(aPos));
     aPos.SetRow(16);
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index d5eaa1906d01..38884685ae9c 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -401,7 +401,7 @@ void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, 
SCROW nEndRow,
     {
         ScAddress aPos(nCol, nRow, nTab);
         ScRefCellValue aCell(rDocument, aPos, blockPos);
-        if (aCell.meType != CELLTYPE_EDIT || !aCell.mpEditText)
+        if (aCell.getType() != CELLTYPE_EDIT || !aCell.mpEditText)
             continue;
 
         std::unique_ptr<EditTextObject> pOldData;
diff --git a/sc/source/core/data/cellvalue.cxx 
b/sc/source/core/data/cellvalue.cxx
index 64cd34e3215f..ca8c8e78c954 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -37,10 +37,10 @@ CellType adjustCellType( CellType eOrig )
 template<typename T>
 OUString getString( const T& rVal )
 {
-    if (rVal.meType == CELLTYPE_STRING)
+    if (rVal.getType() == CELLTYPE_STRING)
         return rVal.mpString->getString();
 
-    if (rVal.meType == CELLTYPE_EDIT)
+    if (rVal.getType() == CELLTYPE_EDIT)
     {
         OUStringBuffer aRet;
         sal_Int32 n = rVal.mpEditText->GetParagraphCount();
@@ -82,8 +82,8 @@ bool equalsFormulaCells( const ScFormulaCell* p1, const 
ScFormulaCell* p2 )
 template<typename T>
 bool equalsWithoutFormatImpl( const T& left, const T& right )
 {
-    CellType eType1 = adjustCellType(left.meType);
-    CellType eType2 = adjustCellType(right.meType);
+    CellType eType1 = adjustCellType(left.getType());
+    CellType eType2 = adjustCellType(right.getType());
     if (eType1 != eType2)
         return false;
 
@@ -109,7 +109,7 @@ bool equalsWithoutFormatImpl( const T& left, const T& right 
)
 
 void commitToColumn( const ScCellValue& rCell, ScColumn& rColumn, SCROW nRow )
 {
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_STRING:
             rColumn.SetRawString(nRow, *rCell.mpString);
@@ -161,7 +161,7 @@ bool hasNumericImpl( CellType eType, ScFormulaCell* 
pFormula )
 template<typename CellT>
 OUString getStringImpl( const CellT& rCell, const ScDocument* pDoc )
 {
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
             return OUString::number(rCell.mfValue);
@@ -182,7 +182,7 @@ OUString getStringImpl( const CellT& rCell, const 
ScDocument* pDoc )
 template<typename CellT>
 OUString getRawStringImpl( const CellT& rCell, const ScDocument& rDoc )
 {
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
             return OUString::number(rCell.mfValue);
@@ -204,9 +204,9 @@ OUString getRawStringImpl( const CellT& rCell, const 
ScDocument& rDoc )
 
 ScCellValue::ScCellValue() : meType(CELLTYPE_NONE), mfValue(0.0) {}
 
-ScCellValue::ScCellValue( const ScRefCellValue& rCell ) : 
meType(rCell.meType), mfValue(rCell.mfValue)
+ScCellValue::ScCellValue( const ScRefCellValue& rCell ) : 
meType(rCell.getType()), mfValue(rCell.mfValue)
 {
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_STRING:
             mpString = new svl::SharedString(*rCell.mpString);
@@ -226,6 +226,8 @@ ScCellValue::ScCellValue( double fValue ) : 
meType(CELLTYPE_VALUE), mfValue(fVal
 
 ScCellValue::ScCellValue( const svl::SharedString& rString ) : 
meType(CELLTYPE_STRING), mpString(new svl::SharedString(rString)) {}
 
+ScCellValue::ScCellValue( std::unique_ptr<EditTextObject> xEdit ) : 
meType(CELLTYPE_EDIT), mpEditText(xEdit.release()) {}
+
 ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), 
mfValue(r.mfValue)
 {
     switch (r.meType)
@@ -333,7 +335,7 @@ void ScCellValue::assign( const ScDocument& rDoc, const 
ScAddress& rPos )
 
     ScRefCellValue aRefVal(const_cast<ScDocument&>(rDoc), rPos);
 
-    meType = aRefVal.meType;
+    meType = aRefVal.getType();
     switch (meType)
     {
         case CELLTYPE_STRING:
diff --git a/sc/source/core/data/clipcontext.cxx 
b/sc/source/core/data/clipcontext.cxx
index 70f2319a185f..8b4f72d73c5e 100644
--- a/sc/source/core/data/clipcontext.cxx
+++ b/sc/source/core/data/clipcontext.cxx
@@ -170,7 +170,7 @@ void CopyFromClipContext::setSingleCell( const ScAddress& 
rSrcPos, const ScColum
     bool bBoolean  = (nFlags & InsertDeleteFlags::SPECIAL_BOOLEAN) != 
InsertDeleteFlags::NONE;
     bool bFormula  = (nFlags & InsertDeleteFlags::FORMULA) != 
InsertDeleteFlags::NONE;
 
-    switch (rSrcCell.meType)
+    switch (rSrcCell.getType())
     {
         case CELLTYPE_VALUE:
         {
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 06bbe0cf3e70..7ebba48b5792 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -667,34 +667,27 @@ ScRefCellValue ScColumn::GetCellValue( 
sc::ColumnBlockConstPosition& rBlockPos,
 
 ScRefCellValue ScColumn::GetCellValue( const 
sc::CellStoreType::const_iterator& itPos, size_t nOffset )
 {
-    ScRefCellValue aVal; // Defaults to empty cell.
     switch (itPos->type)
     {
         case sc::element_type_numeric:
             // Numeric cell
-            aVal.mfValue = sc::numeric_block::at(*itPos->data, nOffset);
-            aVal.meType = CELLTYPE_VALUE;
+            return ScRefCellValue(sc::numeric_block::at(*itPos->data, 
nOffset));
         break;
         case sc::element_type_string:
             // String cell
-            aVal.mpString = &sc::string_block::at(*itPos->data, nOffset);
-            aVal.meType = CELLTYPE_STRING;
+            return ScRefCellValue(&sc::string_block::at(*itPos->data, 
nOffset));
         break;
         case sc::element_type_edittext:
             // Edit cell
-            aVal.mpEditText = sc::edittext_block::at(*itPos->data, nOffset);
-            aVal.meType = CELLTYPE_EDIT;
+            return ScRefCellValue(sc::edittext_block::at(*itPos->data, 
nOffset));
         break;
         case sc::element_type_formula:
             // Formula cell
-            aVal.mpFormula = sc::formula_block::at(*itPos->data, nOffset);
-            aVal.meType = CELLTYPE_FORMULA;
+            return ScRefCellValue(sc::formula_block::at(*itPos->data, 
nOffset));
         break;
         default:
-            ;
+            return ScRefCellValue(); // empty cell
     }
-
-    return aVal;
 }
 
 const sc::CellTextAttr* ScColumn::GetCellTextAttr( SCROW nRow ) const
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 9d93bc6fd032..ca5535811789 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -138,7 +138,7 @@ tools::Long ScColumn::GetNeededSize(
     const SfxItemSet* pCondSet = rDocument.GetCondResult( nCol, nRow, nTab );
 
     //The pPattern may change in GetCondResult
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
     {
         pPattern = pAttrArray->GetPattern( nRow );
         if (ppPatternChange)
@@ -166,8 +166,8 @@ tools::Long ScColumn::GetNeededSize(
 
     // get "cell is value" flag
     // Must be synchronized with ScOutputData::LayoutStrings()
-    bool bCellIsValue = (aCell.meType == CELLTYPE_VALUE);
-    if (aCell.meType == CELLTYPE_FORMULA)
+    bool bCellIsValue = (aCell.getType() == CELLTYPE_VALUE);
+    if (aCell.getType() == CELLTYPE_FORMULA)
     {
         ScFormulaCell* pFCell = aCell.mpFormula;
         bCellIsValue = pFCell->IsRunning() || pFCell->IsValue();
@@ -180,7 +180,7 @@ tools::Long ScColumn::GetNeededSize(
         // to determine the type, the pattern may get invalidated because the
         // result may set a number format. In which case there's also the
         // General format not set anymore...
-        bool bMayInvalidatePattern = (aCell.meType == CELLTYPE_FORMULA);
+        bool bMayInvalidatePattern = (aCell.getType() == CELLTYPE_FORMULA);
         const ScPatternAttr* pOldPattern = pPattern;
         bool bNumeric = aCell.hasNumeric();
         if (bMayInvalidatePattern)
@@ -277,7 +277,7 @@ tools::Long ScColumn::GetNeededSize(
     }
 
     bool bAddMargin = true;
-    CellType eCellType = aCell.meType;
+    CellType eCellType = aCell.getType();
 
     bool bEditEngine = (eCellType == CELLTYPE_EDIT ||
                         eOrient == SvxCellOrientation::Stacked ||
@@ -456,7 +456,7 @@ tools::Long ScColumn::GetNeededSize(
         }
         pEngine->SetPaperSize(aPaper);
 
-        if (aCell.meType == CELLTYPE_EDIT)
+        if (aCell.getType() == CELLTYPE_EDIT)
         {
             pEngine->SetTextNewDefaults(*aCell.mpEditText, std::move(aSet));
         }
@@ -664,7 +664,7 @@ class MaxStrLenFinder
         if (aValStr.getLength() <= mnMaxLen)
             return;
 
-        switch (rCell.meType)
+        switch (rCell.getType())
         {
             case CELLTYPE_NONE:
             case CELLTYPE_VALUE:
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 786fc2387139..8511c5bed016 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2115,7 +2115,7 @@ bool ScColumn::ParseString(
                 if (bForceFormatDate)
                 {
                     ScRefCellValue aCell = GetCellValue(nRow);
-                    if (aCell.meType == CELLTYPE_VALUE)
+                    if (aCell.getType() == CELLTYPE_VALUE)
                     {
                         // Only for an actual date (serial number), not an
                         // arbitrary string or formula or empty cell.
@@ -2225,7 +2225,7 @@ bool ScColumn::ParseString(
         }
         while (false);
 
-        if (rCell.meType == CELLTYPE_NONE)
+        if (rCell.getType() == CELLTYPE_NONE)
         {
             // If we reach here with ScSetStringParam::SpecialNumberOnly it
             // means a simple number was not detected above, so test for
@@ -2554,7 +2554,7 @@ class FilterEntriesHandler
 
         double fVal = 0.0;
 
-        switch (rCell.meType)
+        switch (rCell.getType())
         {
             case CELLTYPE_VALUE:
                 fVal = rCell.mfValue;
@@ -2879,7 +2879,7 @@ public:
 
         for (const Entry& r : maEntries)
         {
-            switch (r.maValue.meType)
+            switch (r.maValue.getType())
             {
                 case CELLTYPE_VALUE:
                     rColumn.SetValue(aBlockPos, r.mnRow, r.maValue.mfValue, 
false);
@@ -3029,7 +3029,7 @@ void ScColumn::SetValue(
 OUString ScColumn::GetString( const ScRefCellValue& aCell, SCROW nRow, const 
ScInterpreterContext* pContext ) const
 {
     // ugly hack for ordering problem with GetNumberFormat and missing 
inherited formats
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
         aCell.mpFormula->MaybeInterpret();
 
     sal_uInt32 nFormat = GetNumberFormat( pContext ? *pContext : 
GetDoc().GetNonThreadedContext(), nRow);
@@ -3343,7 +3343,7 @@ class MaxNumStringLenHandler
     void processCell(size_t nRow, ScRefCellValue& rCell)
     {
         sal_uInt16 nCellPrecision = mnMaxGeneralPrecision;
-        if (rCell.meType == CELLTYPE_FORMULA)
+        if (rCell.getType() == CELLTYPE_FORMULA)
         {
             if (!rCell.mpFormula->IsValue())
                 return;
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 3314ed5f5f51..bae865233180 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -255,7 +255,7 @@ void ScColumn::CopyOneCellFromClip( 
sc::CopyFromClipContext& rCxt, SCROW nRow1,
 
     if ((nFlags & InsertDeleteFlags::ATTRIB) != InsertDeleteFlags::NONE)
     {
-        if (!rCxt.isSkipEmptyCells() || rSrcCell.meType != CELLTYPE_NONE)
+        if (!rCxt.isSkipEmptyCells() || rSrcCell.getType() != CELLTYPE_NONE)
         {
             const ScPatternAttr* pAttr = (bSameDocPool ? 
rCxt.getSingleCellPattern(nColOffset) :
                     rCxt.getSingleCellPattern(nColOffset)->PutInPool( 
&rDocument, rCxt.getClipDoc()));
@@ -273,7 +273,7 @@ void ScColumn::CopyOneCellFromClip( 
sc::CopyFromClipContext& rCxt, SCROW nRow1,
     {
         std::vector<sc::CellTextAttr> aTextAttrs(nDestSize, rSrcAttr);
 
-        switch (rSrcCell.meType)
+        switch (rSrcCell.getType())
         {
             case CELLTYPE_VALUE:
             {
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index ab5bfce9814a..61fb80669574 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -728,7 +728,7 @@ static bool lcl_GetCellContent( ScRefCellValue& rCell, bool 
bIsStr1, double& rAr
 
     bool bVal = true;
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
             rArg = rCell.mfValue;
@@ -745,7 +745,7 @@ static bool lcl_GetCellContent( ScRefCellValue& rCell, bool 
bIsStr1, double& rAr
         case CELLTYPE_STRING:
         case CELLTYPE_EDIT:
             bVal = false;
-            if (rCell.meType == CELLTYPE_STRING)
+            if (rCell.getType() == CELLTYPE_STRING)
                 rArgStr = rCell.mpString->getString();
             else if (rCell.mpEditText)
                 rArgStr = ScEditUtil::GetString(*rCell.mpEditText, pDoc);
@@ -950,7 +950,7 @@ bool ScConditionEntry::IsError( const ScAddress& rPos ) 
const
 {
     ScRefCellValue rCell(*mpDoc, rPos);
 
-    if (rCell.meType == CELLTYPE_FORMULA)
+    if (rCell.getType() == CELLTYPE_FORMULA)
     {
         if (rCell.mpFormula->GetErrCode() != FormulaError::NONE)
             return true;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index c11ca75f05e2..c82838d34cfe 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -401,7 +401,7 @@ bool 
ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue)
         {
             if (!pCell)
                 aCell = sc::toRefCell(maCurPos.first, maCurPos.second);
-            switch (aCell.meType)
+            switch (aCell.getType())
             {
                 case CELLTYPE_VALUE:
                 {
@@ -972,28 +972,23 @@ OUString ScCellIterator::getString() const
 
 ScCellValue ScCellIterator::getCellValue() const
 {
-    ScCellValue aRet;
-    aRet.meType = maCurCell.meType;
-
-    switch (maCurCell.meType)
+    switch (maCurCell.getType())
     {
         case CELLTYPE_STRING:
-            aRet.mpString = new svl::SharedString(*maCurCell.mpString);
+            return ScCellValue(new svl::SharedString(*maCurCell.mpString));
         break;
         case CELLTYPE_EDIT:
-            aRet.mpEditText = maCurCell.mpEditText->Clone().release();
+            return ScCellValue(maCurCell.mpEditText->Clone());
         break;
         case CELLTYPE_VALUE:
-            aRet.mfValue = maCurCell.mfValue;
+            return ScCellValue(maCurCell.mfValue);
         break;
         case CELLTYPE_FORMULA:
-            aRet.mpFormula = maCurCell.mpFormula->Clone();
+            return ScCellValue(maCurCell.mpFormula->Clone());
         break;
         default:
-            ;
+            return ScCellValue();
     }
-
-    return aRet;
 }
 
 bool ScCellIterator::hasString() const
@@ -1311,7 +1306,7 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, 
FormulaError& rErr )
             else
                 return false;
         }
-        switch (pCell->meType)
+        switch (pCell->getType())
         {
             case CELLTYPE_VALUE:
                 {
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index e0abb1d3b8ea..c09bd16d3dc8 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1239,8 +1239,8 @@ void ScDocument::TransliterateText( const ScMarkData& 
rMultiMark, Transliteratio
                 // fdo#32786 TITLE_CASE/SENTENCE_CASE need the extra handling 
in EditEngine (loop over words/sentences).
                 // Still use TransliterationWrapper directly for text cells 
with other transliteration types,
                 // for performance reasons.
-                if (aCell.meType == CELLTYPE_EDIT ||
-                    (aCell.meType == CELLTYPE_STRING &&
+                if (aCell.getType() == CELLTYPE_EDIT ||
+                    (aCell.getType() == CELLTYPE_STRING &&
                      ( nType == TransliterationFlags::SENTENCE_CASE || nType 
== TransliterationFlags::TITLE_CASE)))
                 {
                     if (!pEngine)
@@ -1261,7 +1261,7 @@ void ScDocument::TransliterateText( const ScMarkData& 
rMultiMark, Transliteratio
                         pPattern->FillEditItemSet( &aDefaults, pFontSet );
                     }
                     pEngine->SetDefaults( std::move(aDefaults) );
-                    if (aCell.meType == CELLTYPE_STRING)
+                    if (aCell.getType() == CELLTYPE_STRING)
                         
pEngine->SetTextCurrentDefaults(aCell.mpString->getString());
                     else if (aCell.mpEditText)
                         pEngine->SetTextCurrentDefaults(*aCell.mpEditText);
@@ -1296,7 +1296,7 @@ void ScDocument::TransliterateText( const ScMarkData& 
rMultiMark, Transliteratio
                     }
                 }
 
-                else if (aCell.meType == CELLTYPE_STRING)
+                else if (aCell.getType() == CELLTYPE_STRING)
                 {
                     OUString aOldStr = aCell.mpString->getString();
                     sal_Int32 nOldLen = aOldStr.getLength();
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index cb3cc34c3a48..15058251b83a 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3604,7 +3604,7 @@ FormulaError ScDocument::GetStringForFormula( const 
ScAddress& rPos, OUString& r
     FormulaError nErr = FormulaError::NONE;
     OUString aStr;
     SvNumberFormatter* pFormatter = GetFormatTable();
-    switch (aCell.meType)
+    switch (aCell.getType())
     {
         case CELLTYPE_STRING:
         case CELLTYPE_EDIT:
diff --git a/sc/source/core/data/documentimport.cxx 
b/sc/source/core/data/documentimport.cxx
index 68b02a0e7666..cdb7cc2d91ff 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -220,7 +220,7 @@ void ScDocumentImport::setAutoInput(const ScAddress& rPos, 
const OUString& rStr,
         aCell, rPos.Row(), rPos.Tab(), rStr, 
mpImpl->mrDoc.GetAddressConvention(), pStringParam);
 
     sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
-    switch (aCell.meType)
+    switch (aCell.getType())
     {
         case CELLTYPE_STRING:
             // string is copied.
@@ -572,7 +572,7 @@ void ScDocumentImport::fillDownCells(const ScAddress& rPos, 
SCROW nFillSize)
     sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
     ScRefCellValue aRefCell = pTab->aCol[rPos.Col()].GetCellValue(*pBlockPos, 
rPos.Row());
 
-    switch (aRefCell.meType)
+    switch (aRefCell.getType())
     {
         case CELLTYPE_VALUE:
         {
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index e76ef808b8b6..b1b3fcad209f 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -571,7 +571,7 @@ void ScDocument::FillInfo(
                                             bHidden, bHideFormula, 
bTabProtect);
                                 }
 
-                                if (bHidden || (bFormulaMode && bHideFormula 
&& pInfo->maCell.meType == CELLTYPE_FORMULA))
+                                if (bHidden || (bFormulaMode && bHideFormula 
&& pInfo->maCell.getType() == CELLTYPE_FORMULA))
                                     pBasicInfo->bEmptyCellText = true;
 
                                 ++nArrRow;
diff --git a/sc/source/core/data/queryevaluator.cxx 
b/sc/source/core/data/queryevaluator.cxx
index 0d55c226bc62..695921ab6d73 100644
--- a/sc/source/core/data/queryevaluator.cxx
+++ b/sc/source/core/data/queryevaluator.cxx
@@ -158,7 +158,7 @@ bool ScQueryEvaluator::isQueryByValue(const ScQueryEntry& 
rEntry, const ScQueryE
 
 bool ScQueryEvaluator::isQueryByValueForCell(const ScRefCellValue& rCell)
 {
-    if (rCell.meType == CELLTYPE_FORMULA && rCell.mpFormula->GetErrCode() != 
FormulaError::NONE)
+    if (rCell.getType() == CELLTYPE_FORMULA && rCell.mpFormula->GetErrCode() 
!= FormulaError::NONE)
         // Error values are compared as string.
         return false;
 
@@ -202,7 +202,7 @@ std::pair<bool, bool> 
ScQueryEvaluator::compareByValue(const ScRefCellValue& rCe
     // reason.
     sal_uInt32 nNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND;
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
             nCellVal = rCell.mfValue;
@@ -218,7 +218,7 @@ std::pair<bool, bool> 
ScQueryEvaluator::compareByValue(const ScRefCellValue& rCe
         nNumFmt = getNumFmt(nCol, nRow);
         if (nNumFmt)
         {
-            switch (rCell.meType)
+            switch (rCell.getType())
             {
                 case CELLTYPE_VALUE:
                 case CELLTYPE_FORMULA:
@@ -301,7 +301,7 @@ OUString ScQueryEvaluator::getCellString(const 
ScRefCellValue& rCell, SCROW nRow
                                          const ScQueryEntry& rEntry,
                                          const svl::SharedString** 
sharedString)
 {
-    if (rCell.meType == CELLTYPE_FORMULA && rCell.mpFormula->GetErrCode() != 
FormulaError::NONE)
+    if (rCell.getType() == CELLTYPE_FORMULA && rCell.mpFormula->GetErrCode() 
!= FormulaError::NONE)
     {
         // Error cell is evaluated as string (for now).
         const FormulaError error = rCell.mpFormula->GetErrCode();
@@ -316,7 +316,7 @@ OUString ScQueryEvaluator::getCellString(const 
ScRefCellValue& rCell, SCROW nRow
         *sharedString = &it->second;
         return OUString();
     }
-    else if (rCell.meType == CELLTYPE_STRING)
+    else if (rCell.getType() == CELLTYPE_STRING)
     {
         *sharedString = rCell.mpString;
         return OUString();
@@ -684,7 +684,8 @@ std::pair<bool, bool> 
ScQueryEvaluator::compareByRangeLookup(const ScRefCellValu
 
     if (rItem.meType == ScQueryEntry::ByString)
     {
-        if (rCell.meType == CELLTYPE_FORMULA && rCell.mpFormula->GetErrCode() 
!= FormulaError::NONE)
+        if (rCell.getType() == CELLTYPE_FORMULA
+            && rCell.mpFormula->GetErrCode() != FormulaError::NONE)
             // Error values are compared as string.
             return std::pair<bool, bool>(false, bTestEqual);
 
@@ -720,9 +721,9 @@ std::pair<bool, bool> ScQueryEvaluator::processEntry(SCROW 
nRow, SCCOL nCol, ScR
         // For ScQueryEntry::ByValue check that the cell either is a value or 
is a formula
         // that has a value and is not an error (those are compared as 
strings). This
         // is basically simplified isQueryByValue().
-        if (aCell.meType == CELLTYPE_VALUE)
+        if (aCell.getType() == CELLTYPE_VALUE)
             value = aCell.mfValue;
-        else if (aCell.meType == CELLTYPE_FORMULA
+        else if (aCell.getType() == CELLTYPE_FORMULA
                  && aCell.mpFormula->GetErrCode() != FormulaError::NONE
                  && aCell.mpFormula->IsValue())
         {
diff --git a/sc/source/core/data/queryiter.cxx 
b/sc/source/core/data/queryiter.cxx
index 345cd1ec4916..ed1a9251544c 100644
--- a/sc/source/core/data/queryiter.cxx
+++ b/sc/source/core/data/queryiter.cxx
@@ -432,7 +432,7 @@ bool ScQueryCellIteratorBase< accessType, queryType 
>::BinarySearch( SCCOL col,
     }
     else
     {
-        switch (aCell.meType)
+        switch (aCell.getType())
         {
             case CELLTYPE_VALUE :
                 fLastInRangeValue = aCell.mfValue;
@@ -466,7 +466,7 @@ bool ScQueryCellIteratorBase< accessType, queryType 
>::BinarySearch( SCCOL col,
         if (!bStr && !bByString)
         {
             double nCellVal;
-            switch (aCell.meType)
+            switch (aCell.getType())
             {
                 case CELLTYPE_VALUE :
                 case CELLTYPE_FORMULA :
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index f213fea6c6ea..6ee8d4237356 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -4116,7 +4116,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW 
nStartRow, SCCOL nEndCol, SC
         {
             ScRefCellValue aCell = aCol[nCol].GetCellValue(nRow);
 
-            if (aCell.meType != CELLTYPE_FORMULA)
+            if (aCell.getType() != CELLTYPE_FORMULA)
                 continue;
 
             if (!aCell.mpFormula->HasRefListExpressibleAsOneReference(aRef))
@@ -4171,7 +4171,7 @@ void ScTable::CopyData( SCCOL nStartCol, SCROW nStartRow, 
SCCOL nEndCol, SCROW n
             ScCellValue aCell;
             aCell.assign(rDocument, ScAddress(nCol, nRow, nTab));
 
-            if (aCell.meType == CELLTYPE_FORMULA)
+            if (aCell.getType() == CELLTYPE_FORMULA)
             {
                 sc::RefUpdateContext aCxt(rDocument);
                 aCxt.meMode = URM_COPY;
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index c30032582c14..6bcf75225f7c 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -724,7 +724,7 @@ void fillSortedColumnArray(
             if (!bOnlyDataAreaExtras)
             {
                 sc::CellStoreType& rCellStore = aSortedCols.at(j)->maCells;
-                switch (rCell.maCell.meType)
+                switch (rCell.maCell.getType())
                 {
                     case CELLTYPE_STRING:
                         assert(rCell.mpAttr);
@@ -1529,7 +1529,7 @@ short ScTable::CompareCell(
 {
     short nRes = 0;
 
-    CellType eType1 = rCell1.meType, eType2 = rCell2.meType;
+    CellType eType1 = rCell1.getType(), eType2 = rCell2.getType();
 
     if (!rCell1.isEmpty())
     {
@@ -2608,7 +2608,7 @@ SCSIZE ScTable::Query(const ScQueryParam& rParamOrg, bool 
bKeepSub)
             for (SCCOL nCol=aParam.nCol1; nCol<=aParam.nCol2 && !bValid; 
nCol++)
             {
                 ScRefCellValue aCell = GetCellValue(nCol, j);
-                if (aCell.meType != CELLTYPE_FORMULA)
+                if (aCell.getType() != CELLTYPE_FORMULA)
                     continue;
 
                 if (!aCell.mpFormula->IsSubTotal())
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 41250d5e2871..e16e93ae19f9 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -273,7 +273,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
             if (bOverlapped)
                 bHasOverlappedCells = true;
 
-            if (!bOverlapped || GetCellValue(nColCurr, nRowCurr).meType != 
CELLTYPE_NONE)
+            if (!bOverlapped || GetCellValue(nColCurr, nRowCurr).getType() != 
CELLTYPE_NONE)
             {
                 rNonOverlappedCellIdx[nValueCount++] = i;
                 // if there is at least 1 non empty overlapped cell, then no 
cell should be skipped
@@ -300,7 +300,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
             nRowCurr = nRow1 + rNonOverlappedCellIdx[0] * nAddY;
             ScRefCellValue aPrevCell, aCurrCell;
             aCurrCell = GetCellValue(nColCurr, nRowCurr);
-            CellType eCellType = aCurrCell.meType;
+            CellType eCellType = aCurrCell.getType();
             if (eCellType == CELLTYPE_VALUE)
             {
                 bool bVal = true;
@@ -324,7 +324,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
                             nColCurr = nCol1 + rNonOverlappedCellIdx[i] * 
nAddX;
                             nRowCurr = nRow1 + rNonOverlappedCellIdx[i] * 
nAddY;
                             aCurrCell = GetCellValue(nColCurr, nRowCurr);
-                            if (aCurrCell.meType == CELLTYPE_VALUE)
+                            if (aCurrCell.getType() == CELLTYPE_VALUE)
                             {
                                 aCurrDate = aNullDate + 
static_cast<sal_Int32>(aCurrCell.mfValue);
                                 if (eType != FILL_DAY) {
@@ -397,7 +397,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
                         nColCurr = nCol1 + rNonOverlappedCellIdx[i] * nAddX;
                         nRowCurr = nRow1 + rNonOverlappedCellIdx[i] * nAddY;
                         aCurrCell = GetCellValue(nColCurr, nRowCurr);
-                        if (aCurrCell.meType == CELLTYPE_VALUE)
+                        if (aCurrCell.getType() == CELLTYPE_VALUE)
                         {
                             double nDiff = approxDiff(aCurrCell.mfValue, 
aPrevCell.mfValue);
                             if (i == 1)
@@ -471,7 +471,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
                         nColCurr = nCol1 + rNonOverlappedCellIdx[i] * nAddX;
                         nRowCurr = nRow1 + rNonOverlappedCellIdx[i] * nAddY;
                         ScRefCellValue aCell = GetCellValue(nColCurr, 
nRowCurr);
-                        CellType eType = aCell.meType;
+                        CellType eType = aCell.getType();
                         if (eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT)
                         {
                             aStr2 = aCell.getString(&rDocument);
@@ -509,7 +509,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
     SCROW nRow = nRow1;
 
     ScRefCellValue aFirstCell = GetCellValue(nCol, nRow);
-    CellType eCellType = aFirstCell.meType;
+    CellType eCellType = aFirstCell.getType();
 
     if (eCellType == CELLTYPE_VALUE)
     {
@@ -559,7 +559,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
                     for (SCSIZE i=1; i<nCount && bVal; i++)
                     {
                         ScRefCellValue aCell = GetCellValue(nCol,nRow);
-                        if (aCell.meType == CELLTYPE_VALUE)
+                        if (aCell.getType() == CELLTYPE_VALUE)
                         {
                             nVal = aCell.mfValue;
                             aDate2 = aNullDate + static_cast<sal_Int32>(nVal);
@@ -629,7 +629,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
                 for (SCSIZE i=1; i<nCount && bVal; i++)
                 {
                     ScRefCellValue aCell = GetCellValue(nCol,nRow);
-                    if (aCell.meType == CELLTYPE_VALUE)
+                    if (aCell.getType() == CELLTYPE_VALUE)
                     {
                         nVal2 = aCell.mfValue;
                         double nDiff = approxDiff( nVal2, nVal1);
@@ -711,7 +711,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
                     for (SCSIZE i=1; i<nCount && bVal; i++)
                     {
                         ScRefCellValue aCell = GetCellValue(nCol, nRow);
-                        CellType eType = aCell.meType;
+                        CellType eType = aCell.getType();
                         if ( eType == CELLTYPE_STRING || eType == 
CELLTYPE_EDIT )
                         {
                             aStr = aCell.getString(&rDocument);
@@ -1397,7 +1397,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& 
rSource, SCCOL nEndX, SCROW
                 else
                     nDelta = ( nIndex - nSrcCount + 1 ) / nSrcCount;    // -1 
-> -1
 
-                CellType eType = aCell.meType;
+                CellType eType = aCell.getType();
                 switch ( eType )
                 {
                     case CELLTYPE_STRING:
@@ -1477,7 +1477,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& 
rSource, SCCOL nEndX, SCROW
             ScRefCellValue aCell = GetCellValue(nCol1, nRow1);
             if (!aCell.isEmpty())
             {
-                CellType eType = aCell.meType;
+                CellType eType = aCell.getType();
                 switch ( eType )
                 {
                     case CELLTYPE_STRING:
@@ -1761,7 +1761,7 @@ void ScTable::FillSeriesSimple(
 
     if (bVertical)
     {
-        switch (rSrcCell.meType)
+        switch (rSrcCell.getType())
         {
             case CELLTYPE_FORMULA:
             {
@@ -1793,7 +1793,7 @@ void ScTable::FillSeriesSimple(
     }
     else
     {
-        switch (rSrcCell.meType)
+        switch (rSrcCell.getType())
         {
             case CELLTYPE_FORMULA:
             {
@@ -1888,7 +1888,7 @@ void ScTable::FillAutoSimple(
                 if (bVertical)      // rInner&:=nRow, rOuter&:=nCol
                 {
                     aSrcCell = GetCellValue(rCol, nSource);
-                    if (nISrcStart == nISrcEnd && aSrcCell.meType == 
CELLTYPE_FORMULA)
+                    if (nISrcStart == nISrcEnd && aSrcCell.getType() == 
CELLTYPE_FORMULA)
                     {
                         FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, 
nIStart, nIEnd, pProgress, rProgress);
                         return;
@@ -1911,11 +1911,11 @@ void ScTable::FillAutoSimple(
                 bGetCell = false;
                 if (!aSrcCell.isEmpty())
                 {
-                    switch (aSrcCell.meType)
+                    switch (aSrcCell.getType())
                     {
                         case CELLTYPE_STRING:
                         case CELLTYPE_EDIT:
-                            if (aSrcCell.meType == CELLTYPE_STRING)
+                            if (aSrcCell.getType() == CELLTYPE_STRING)
                                 aValue = aSrcCell.mpString->getString();
                             else
                                 aValue = 
ScEditUtil::GetString(*aSrcCell.mpEditText, &rDocument);
@@ -1937,7 +1937,7 @@ void ScTable::FillAutoSimple(
                 }
             }
 
-            switch (aSrcCell.meType)
+            switch (aSrcCell.getType())
             {
                 case CELLTYPE_VALUE:
                     {
@@ -1965,7 +1965,7 @@ void ScTable::FillAutoSimple(
                             setSuffixCell(
                                 aCol[rCol], rRow,
                                 nNextValue, nCellDigits, aValue,
-                                aSrcCell.meType, bIsOrdinalSuffix);
+                                aSrcCell.getType(), bIsOrdinalSuffix);
                         }
                         else
                         {
@@ -2033,7 +2033,7 @@ void ScTable::FillAutoSimple(
         //  and even then not individually for each one
 
         ++rProgress;
-        if ( pProgress && (aSrcCell.meType == CELLTYPE_FORMULA || 
aSrcCell.meType == CELLTYPE_EDIT) )
+        if ( pProgress && (aSrcCell.getType() == CELLTYPE_FORMULA || 
aSrcCell.getType() == CELLTYPE_EDIT) )
             pProgress->SetStateOnPercent( rProgress );
 
     }
@@ -2230,10 +2230,10 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, 
SCCOL nCol2, SCROW nRow2,
         else
             aSrcCell = GetCellValue(static_cast<SCCOL>(nISource), 
static_cast<SCROW>(nOStart));
         // Same logic as for the actual series.
-        if (!aSrcCell.isEmpty() && (aSrcCell.meType == CELLTYPE_VALUE || 
aSrcCell.meType == CELLTYPE_FORMULA))
+        if (!aSrcCell.isEmpty() && (aSrcCell.getType() == CELLTYPE_VALUE || 
aSrcCell.getType() == CELLTYPE_FORMULA))
         {
             double nStartVal;
-            if (aSrcCell.meType == CELLTYPE_VALUE)
+            if (aSrcCell.getType() == CELLTYPE_VALUE)
                 nStartVal = aSrcCell.mfValue;
             else
                 nStartVal = aSrcCell.mpFormula->GetValue();
@@ -2354,7 +2354,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 
         if (!aSrcCell.isEmpty())
         {
-            CellType eCellType = aSrcCell.meType;
+            CellType eCellType = aSrcCell.getType();
 
             if (eFillCmd == FILL_SIMPLE)                // copy
             {
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index cddb28e6e1da..5de4908ee226 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -1232,7 +1232,7 @@ void ScTable::InvalidateTextWidth(const ScAddress* 
pAdrFrom, const ScAddress* pA
 
         if (bBroadcast)
         { // Only with CalcAsShown
-            switch (aCell.meType)
+            switch (aCell.getType())
             {
                 case CELLTYPE_VALUE:
                     rCol.Broadcast(nRow);
@@ -1274,7 +1274,7 @@ void ScTable::InvalidateTextWidth(const ScAddress* 
pAdrFrom, const ScAddress* pA
 
             if (bBroadcast)
             { // Only with CalcAsShown
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     case CELLTYPE_VALUE:
                         aCol[nCol].Broadcast(nRow);
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 966b4491c348..b478364ec871 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -82,7 +82,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, 
SCCOL nCol, sc::Colum
     }
 
     bool bMultiLine = false;
-    CellType eCellType = aCell.meType;
+    CellType eCellType = aCell.getType();
     switch (rSearchItem.GetCellType())
     {
         case SvxSearchCellType::FORMULA:
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 688007885792..cc3cff507bf8 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -449,14 +449,12 @@ bool ScValidationData::IsDataValidCustom(
     svl::SharedString aSS;
     if (bIsVal)
     {
-        aTmpCell.meType = CELLTYPE_VALUE;
-        aTmpCell.mfValue = nVal;
+        aTmpCell = ScRefCellValue(nVal);
     }
     else
     {
-        aTmpCell.meType = CELLTYPE_STRING;
         aSS = mpDoc->GetSharedStringPool().intern(rTest);
-        aTmpCell.mpString = &aSS;
+        aTmpCell = ScRefCellValue(&aSS);
     }
 
     ScCellValue aOriginalCellValue(ScRefCellValue(*GetDocument(), rPos));
@@ -575,7 +573,7 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, 
const ScAddress& rPos
     OUString aString;
     bool bIsVal = true;
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
             nVal = rCell.mfValue;
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 0dc6f03de4df..3a8b21a435ff 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -34,7 +34,7 @@ OUString ScCellFormat::GetString( const ScRefCellValue& 
rCell, sal_uInt32 nForma
 {
     *ppColor = nullptr;
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_STRING:
         {
@@ -132,7 +132,7 @@ OUString ScCellFormat::GetInputString(
 {
     if(pShared != nullptr)
         *pShared = nullptr;
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_STRING:
         case CELLTYPE_EDIT:
@@ -187,7 +187,7 @@ OUString ScCellFormat::GetOutputString( ScDocument& rDoc, 
const ScAddress& rPos,
     if (rCell.isEmpty())
         return OUString();
 
-    if (rCell.meType == CELLTYPE_EDIT)
+    if (rCell.getType() == CELLTYPE_EDIT)
     {
         //  GetString converts line breaks into spaces in EditCell,
         //  but here we need the line breaks
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index 13e5df2501ad..ba2c30b17941 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -80,7 +80,7 @@ double getCellValue( ScDocument& rDoc, const ScAddress& rPos, 
double fDefault, b
     double fRet = fDefault;
 
     ScRefCellValue aCell(rDoc, rPos);
-    switch (aCell.meType)
+    switch (aCell.getType())
     {
         case CELLTYPE_VALUE:
         {
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 55530e494fb0..2efd4d6edec1 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1365,10 +1365,9 @@ void ScChangeActionContent::SetValueString(
     if ( rStr.getLength() > 1 && rStr[0] == '=' )
     {
         rValue.clear();
-        rCell.meType = CELLTYPE_FORMULA;
-        rCell.mpFormula = new ScFormulaCell(
+        rCell = ScCellValue(new ScFormulaCell(
             *pDoc, aBigRange.aStart.MakeAddress(*pDoc), rStr,
-            pDoc->GetGrammar() );
+            pDoc->GetGrammar() ));
         rCell.mpFormula->SetInChangeTrack(true);
     }
     else
@@ -1556,7 +1555,7 @@ OUString ScChangeActionContent::GetStringOfCell(
     if (!GetContentCellType(rCell))
         return OUString();
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
         {
@@ -1579,7 +1578,7 @@ OUString ScChangeActionContent::GetStringOfCell(
 
 ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const 
ScCellValue& rCell )
 {
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE :
         case CELLTYPE_STRING :
@@ -1603,7 +1602,7 @@ ScChangeActionContentCellType 
ScChangeActionContent::GetContentCellType( const S
 
 ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const 
ScRefCellValue& rCell )
 {
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
         case CELLTYPE_STRING:
@@ -1632,7 +1631,7 @@ ScChangeActionContentCellType 
ScChangeActionContent::GetContentCellType( const S
 
 bool ScChangeActionContent::NeedsNumberFormat( const ScCellValue& rVal )
 {
-    return rVal.meType == CELLTYPE_VALUE;
+    return rVal.getType() == CELLTYPE_VALUE;
 }
 
 void ScChangeActionContent::SetValue(
@@ -1652,7 +1651,7 @@ void ScChangeActionContent::SetValue(
     if (GetContentCellType(rOrgCell))
     {
         rCell.assign(rOrgCell, *pToDoc);
-        switch (rOrgCell.meType)
+        switch (rOrgCell.getType())
         {
             case CELLTYPE_VALUE :
             {   // E.g.: Remember date as such
@@ -1679,7 +1678,7 @@ void ScChangeActionContent::SetCell( OUString& rStr, 
ScCellValue& rCell, sal_uLo
     if (rCell.isEmpty())
         return;
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE :
             // e.g. remember date as date string
@@ -1703,7 +1702,7 @@ OUString ScChangeActionContent::GetValueString(
         return rValue;
     }
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_STRING :
             return rCell.mpString->getString();
@@ -1769,7 +1768,7 @@ void ScChangeActionContent::PutValueToDoc(
         return;
     }
 
-    if (rCell.meType == CELLTYPE_VALUE)
+    if (rCell.getType() == CELLTYPE_VALUE)
     {
         pDoc->SetString( aPos.Col(), aPos.Row(), aPos.Tab(), rValue );
         return;
@@ -1853,8 +1852,8 @@ void ScChangeActionContent::UpdateReference( const 
ScChangeTrack* pTrack,
     if ( pTrack->IsInDelete() && !pTrack->IsInDeleteTop() )
         return ; // Formula only update whole range
 
-    bool bOldFormula = maOldCell.meType == CELLTYPE_FORMULA;
-    bool bNewFormula = maNewCell.meType == CELLTYPE_FORMULA;
+    bool bOldFormula = maOldCell.getType() == CELLTYPE_FORMULA;
+    bool bNewFormula = maNewCell.getType() == CELLTYPE_FORMULA;
     if ( !(bOldFormula || bNewFormula) )
         return;
 
@@ -2538,10 +2537,10 @@ bool ScChangeTrack::IsMatrixFormulaRangeDifferent(
     nC1 = nC2 = 0;
     nR1 = nR2 = 0;
 
-    if (rOldCell.meType == CELLTYPE_FORMULA && 
rOldCell.mpFormula->GetMatrixFlag() == ScMatrixMode::Formula)
+    if (rOldCell.getType() == CELLTYPE_FORMULA && 
rOldCell.mpFormula->GetMatrixFlag() == ScMatrixMode::Formula)
         rOldCell.mpFormula->GetMatColsRows(nC1, nR1);
 
-    if (rNewCell.meType == CELLTYPE_FORMULA && 
rNewCell.mpFormula->GetMatrixFlag() == ScMatrixMode::Formula)
+    if (rNewCell.getType() == CELLTYPE_FORMULA && 
rNewCell.mpFormula->GetMatrixFlag() == ScMatrixMode::Formula)
         rNewCell.mpFormula->GetMatColsRows(nC1, nR1);
 
     return nC1 != nC2 || nR1 != nR2;
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 9e700f41184e..8cabace6a55c 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -808,7 +808,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, 
SCROW nRow, ScDetective
                                             sal_uInt16 nLevel )
 {
     ScRefCellValue aCell(rDoc, ScAddress(nCol, nRow, nTab));
-    if (aCell.meType != CELLTYPE_FORMULA)
+    if (aCell.getType() != CELLTYPE_FORMULA)
         return DET_INS_EMPTY;
 
     ScFormulaCell* pFCell = aCell.mpFormula;
@@ -896,7 +896,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, 
SCROW nRow, sal_uInt16 nL
     OSL_ENSURE( nLevel<1000, "Level" );
 
     ScRefCellValue aCell(rDoc, ScAddress(nCol, nRow, nTab));
-    if (aCell.meType != CELLTYPE_FORMULA)
+    if (aCell.getType() != CELLTYPE_FORMULA)
         return nLevel;
 
     ScFormulaCell* pFCell = aCell.mpFormula;
@@ -953,7 +953,7 @@ sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, 
SCROW nRow, ScDetectiv
                                             sal_uInt16 nLevel )
 {
     ScRefCellValue aCell(rDoc, ScAddress(nCol, nRow, nTab));
-    if (aCell.meType != CELLTYPE_FORMULA)
+    if (aCell.getType() != CELLTYPE_FORMULA)
         return DET_INS_EMPTY;
 
     ScFormulaCell* pFCell = aCell.mpFormula;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0b3592976a71..b41bec6b7c3b 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1999,7 +1999,7 @@ void ScInterpreter::ScIsEmpty()
             // may treat ="" in the referenced cell as blank for Excel
             // interoperability.
             ScRefCellValue aCell(mrDoc, aAdr);
-            if (aCell.meType == CELLTYPE_NONE)
+            if (aCell.getType() == CELLTYPE_NONE)
                 nRes = 1;
         }
         break;
@@ -2050,7 +2050,7 @@ bool ScInterpreter::IsString()
             ScRefCellValue aCell(mrDoc, aAdr);
             if (GetCellErrCode(aCell) == FormulaError::NONE)
             {
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     case CELLTYPE_STRING :
                     case CELLTYPE_EDIT :
@@ -2164,7 +2164,7 @@ void ScInterpreter::ScType()
             ScRefCellValue aCell(mrDoc, aAdr);
             if (GetCellErrCode(aCell) == FormulaError::NONE)
             {
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     // NOTE: this is Xcl nonsense!
                     case CELLTYPE_STRING :
@@ -2648,7 +2648,7 @@ void ScInterpreter::ScIsValue()
             ScRefCellValue aCell(mrDoc, aAdr);
             if (GetCellErrCode(aCell) == FormulaError::NONE)
             {
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     case CELLTYPE_VALUE :
                         bRes = true;
@@ -2741,7 +2741,7 @@ void ScInterpreter::ScIsFormula()
                     {
                         aAdr.SetRow(nRow);
                         ScRefCellValue aCell(mrDoc, aAdr);
-                        pResMat->PutBoolean( (aCell.meType == 
CELLTYPE_FORMULA), i,j);
+                        pResMat->PutBoolean( (aCell.getType() == 
CELLTYPE_FORMULA), i,j);
                         ++j;
                     }
                     ++i;
@@ -2803,7 +2803,7 @@ void ScInterpreter::ScFormula()
                     {
                         aAdr.SetRow(nRow);
                         ScRefCellValue aCell(mrDoc, aAdr);
-                        switch (aCell.meType)
+                        switch (aCell.getType())
                         {
                             case CELLTYPE_FORMULA :
                                 aFormula = 
aCell.mpFormula->GetFormula(formula::FormulaGrammar::GRAM_UNSPECIFIED, 
&mrContext);
@@ -2829,7 +2829,7 @@ void ScInterpreter::ScFormula()
                 break;
 
             ScRefCellValue aCell(mrDoc, aAdr);
-            switch (aCell.meType)
+            switch (aCell.getType())
             {
                 case CELLTYPE_FORMULA :
                     aFormula = 
aCell.mpFormula->GetFormula(formula::FormulaGrammar::GRAM_UNSPECIFIED, 
&mrContext);
@@ -3045,7 +3045,7 @@ bool ScInterpreter::IsEven()
                 SetError(nErr);
             else
             {
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     case CELLTYPE_VALUE :
                         fVal = GetCellValue(aAdr, aCell);
@@ -3228,7 +3228,7 @@ void ScInterpreter::ScT()
             ScRefCellValue aCell(mrDoc, aAdr);
             if (GetCellErrCode(aCell) == FormulaError::NONE)
             {
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     case CELLTYPE_VALUE :
                         bValue = true;
@@ -5097,7 +5097,7 @@ namespace {
 
 bool isCellContentEmpty( const ScRefCellValue& rCell )
 {
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
         case CELLTYPE_STRING:
@@ -5290,7 +5290,7 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf 
eFunc )
                 }
 
                 ScRefCellValue aCell(mrDoc, aAdr);
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     case CELLTYPE_VALUE :
                         fVal = GetCellValue(aAdr, aCell);
@@ -5644,7 +5644,7 @@ void ScInterpreter::ScCountIf()
                 return ;
             }
             ScRefCellValue aCell(mrDoc, aAdr);
-            switch (aCell.meType)
+            switch (aCell.getType())
             {
                 case CELLTYPE_VALUE :
                     fVal = GetCellValue(aAdr, aCell);
@@ -5914,7 +5914,7 @@ void ScInterpreter::IterateParametersIfs( 
double(*ResultFunc)( const sc::ParamIf
                     }
 
                     ScRefCellValue aCell(mrDoc, aAdr);
-                    switch (aCell.meType)
+                    switch (aCell.getType())
                     {
                         case CELLTYPE_VALUE :
                             fVal = GetCellValue(aAdr, aCell);
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 540928f0bee6..faab8bd4832e 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -132,7 +132,7 @@ sal_uInt32 ScInterpreter::GetCellNumberFormat( const 
ScAddress& rPos, ScRefCellV
     }
     else
     {
-        if (rCell.meType == CELLTYPE_FORMULA)
+        if (rCell.getType() == CELLTYPE_FORMULA)
             nErr = rCell.mpFormula->GetErrCode();
         else
             nErr = FormulaError::NONE;
@@ -156,7 +156,7 @@ double ScInterpreter::GetValueCellValue( const ScAddress& 
rPos, double fOrig )
 
 FormulaError ScInterpreter::GetCellErrCode( const ScRefCellValue& rCell )
 {
-    return rCell.meType == CELLTYPE_FORMULA ? rCell.mpFormula->GetErrCode() : 
FormulaError::NONE;
+    return rCell.getType() == CELLTYPE_FORMULA ? rCell.mpFormula->GetErrCode() 
: FormulaError::NONE;
 }
 
 double ScInterpreter::ConvertStringToValue( const OUString& rStr )
@@ -188,7 +188,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& 
rPos, ScRefCellValue&
 {
     double fValue = 0.0;
 
-    CellType eType = rCell.meType;
+    CellType eType = rCell.getType();
     switch (eType)
     {
         case CELLTYPE_FORMULA:
@@ -245,7 +245,7 @@ void ScInterpreter::GetCellString( svl::SharedString& rStr, 
ScRefCellValue& rCel
 {
     FormulaError nErr = FormulaError::NONE;
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_STRING:
         case CELLTYPE_EDIT:
@@ -317,7 +317,7 @@ bool ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW 
nRow1, SCTAB nTab1,
                     FormulaError  nErr = FormulaError::NONE;
                     double  nVal = 0.0;
                     bool    bOk = true;
-                    switch (aCell.meType)
+                    switch (aCell.getType())
                     {
                         case CELLTYPE_VALUE :
                             nVal = GetValueCellValue(aAdr, aCell.mfValue);
@@ -396,7 +396,7 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW 
nRow1, SCTAB nTab1,
                     OUString  aStr;
                     FormulaError  nErr = FormulaError::NONE;
                     bool    bOk = true;
-                    switch (aCell.meType)
+                    switch (aCell.getType())
                     {
                         case CELLTYPE_STRING:
                         case CELLTYPE_EDIT:
@@ -500,7 +500,7 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, 
SCTAB nTab1,
                     double  nVal = 0.0;
                     OUString  aStr;
                     bool    bOk = true;
-                    switch (aCell.meType)
+                    switch (aCell.getType())
                     {
                         case CELLTYPE_STRING :
                         case CELLTYPE_EDIT :
@@ -689,7 +689,7 @@ void ScInterpreter::PushCellResultToken( bool 
bDisplayEmptyAsString,
     ScRefCellValue aCell(mrDoc, rAddress);
     if (aCell.hasEmptyValue())
     {
-        bool bInherited = (aCell.meType == CELLTYPE_FORMULA);
+        bool bInherited = (aCell.getType() == CELLTYPE_FORMULA);
         if (pRetTypeExpr && pRetIndexExpr)
             mrDoc.GetNumberFormatInfo(mrContext, *pRetTypeExpr, 
*pRetIndexExpr, rAddress);
         PushTempToken( new ScEmptyCellToken( bInherited, 
bDisplayEmptyAsString));
@@ -697,7 +697,7 @@ void ScInterpreter::PushCellResultToken( bool 
bDisplayEmptyAsString,
     }
 
     FormulaError nErr = FormulaError::NONE;
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
         nErr = aCell.mpFormula->GetErrCode();
 
     if (nErr != FormulaError::NONE)
@@ -3543,7 +3543,7 @@ bool ScInterpreter::SetSbxVariable( SbxVariable* pVar, 
const ScAddress& rPos )
     {
         FormulaError nErr;
         double nVal;
-        switch (aCell.meType)
+        switch (aCell.getType())
         {
             case CELLTYPE_VALUE :
                 nVal = GetValueCellValue(rPos, aCell.mfValue);
@@ -3613,7 +3613,7 @@ void ScInterpreter::ScTableOp()
         for ( const auto& rPos : aTableOp.aNotifiedFormulaPos )
         {   // emulate broadcast and indirectly collect cell pointers
             ScRefCellValue aCell(mrDoc, rPos);
-            if (aCell.meType == CELLTYPE_FORMULA)
+            if (aCell.getType() == CELLTYPE_FORMULA)
                 aCell.mpFormula->SetTableOpDirty();
         }
     }
@@ -3626,7 +3626,7 @@ void ScInterpreter::ScTableOp()
     aTableOp.bCollectNotifications = false;
 
     ScRefCellValue aCell(mrDoc, aTableOp.aFormulaPos);
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
         aCell.mpFormula->SetDirtyVar();
     if (aCell.hasNumeric())
     {
@@ -3656,7 +3656,7 @@ void ScInterpreter::ScTableOp()
     if ( !bReuseLastParams )
         mrDoc.aLastTableOpParams = aTableOp;
 
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
     {
         aCell.mpFormula->SetDirtyVar();
         aCell.mpFormula->GetErrCode();     // recalculate original
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index fc192bfbdbd9..f3905eedc665 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -433,7 +433,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const 
FormulaToken* pToken
             {
                 double fVal = aCell.getValue();
                 // CELLTYPE_FORMULA already stores the rounded value.
-                if (aCell.meType == CELLTYPE_VALUE)
+                if (aCell.getType() == CELLTYPE_VALUE)
                 {
                     // TODO: this could be moved to ScCellIterator to take
                     // advantage of the faster ScAttrArray_IterGetNumberFormat.
@@ -648,7 +648,7 @@ void ScInterpreter::ScMatValue()
             ScAddress aAdr;
             PopSingleRef( aAdr );
             ScRefCellValue aCell(mrDoc, aAdr);
-            if (aCell.meType == CELLTYPE_FORMULA)
+            if (aCell.getType() == CELLTYPE_FORMULA)
             {
                 FormulaError nErrCode = aCell.mpFormula->GetErrCode();
                 if (nErrCode != FormulaError::NONE)
@@ -3217,7 +3217,7 @@ void ScInterpreter::ScMatRef()
 
     ScRefCellValue aCell(mrDoc, aAdr);
 
-    if (aCell.meType != CELLTYPE_FORMULA)
+    if (aCell.getType() != CELLTYPE_FORMULA)
     {
         PushError( FormulaError::NoRef );
         return;
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 0d80a8842566..91219f96e4b2 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -629,7 +629,7 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, 
bool bTextAsZero )
                 {
                     if( eFunc == ifCOUNT2 )
                     {
-                        CellType eCellType = aCell.meType;
+                        CellType eCellType = aCell.getType();
                         if ( eCellType != CELLTYPE_NONE )
                             nCount++;
                         if ( nGlobalError != FormulaError::NONE )
diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx
index 978f75b4475a..a014705026ce 100644
--- a/sc/source/core/tool/rangeseq.cxx
+++ b/sc/source/core/tool/rangeseq.cxx
@@ -266,7 +266,7 @@ bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, 
ScDocument& rDoc, const
                 continue;
             }
 
-            if (aCell.meType == CELLTYPE_FORMULA && 
aCell.mpFormula->GetErrCode() != FormulaError::NONE)
+            if (aCell.getType() == CELLTYPE_FORMULA && 
aCell.mpFormula->GetErrCode() != FormulaError::NONE)
             {
                 // if NV is allowed, leave empty for errors
                 bHasErrors = true;
diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx
index 89bafd754114..cff9ad812ce8 100644
--- a/sc/source/filter/dif/difexp.cxx
+++ b/sc/source/filter/dif/difexp.cxx
@@ -156,7 +156,7 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, 
ScDocument* pDoc,
             bool bWriteStringData = false;
             ScRefCellValue aCell(*pDoc, ScAddress(nColCnt, nRowCnt, nTab));
 
-            switch (aCell.meType)
+            switch (aCell.getType())
             {
                 case CELLTYPE_NONE:
                     aOS.append(pEmptyData);
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 83c7f5048d6a..713a6c6b3c38 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2624,7 +2624,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot 
) :
 
         OUString aAddNoteText;    // additional text to be appended to a note
 
-        switch (rScCell.meType)
+        switch (rScCell.getType())
         {
             case CELLTYPE_VALUE:
             {
diff --git a/sc/source/filter/excel/xicontent.cxx 
b/sc/source/filter/excel/xicontent.cxx
index 872632a1c061..f4b68f471cc8 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -159,7 +159,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, 
SCCOL nScCol, SCROW
     ScDocumentImport& rDoc = rRoot.GetDocImport();
     ScAddress aScPos( nScCol, nScRow, nScTab );
     ScRefCellValue aCell(rDoc.getDoc(), aScPos);
-    switch( aCell.meType )
+    switch( aCell.getType() )
     {
         // #i54261# hyperlinks in string cells
         case CELLTYPE_STRING:
@@ -175,7 +175,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, 
SCCOL nScCol, SCROW
             ScEditEngineDefaulter& rEE = rRoot.GetEditEngine();
             SvxURLField aUrlField( rUrl, aDisplText, SvxURLFormat::AppDefault 
);
 
-            if( aCell.meType == CELLTYPE_EDIT )
+            if( aCell.getType() == CELLTYPE_EDIT )
             {
                 const EditTextObject* pEditObj = aCell.mpEditText;
                 rEE.SetTextCurrentDefaults( *pEditObj );
diff --git a/sc/source/filter/html/htmlexp.cxx 
b/sc/source/filter/html/htmlexp.cxx
index 9c9f8745fac0..e8696478e5ad 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -1088,7 +1088,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& 
rBlockPos, SCCOL nCol, SC
     double fVal = 0.0;
     if ( bValueData )
     {
-        switch (aCell.meType)
+        switch (aCell.getType())
         {
             case CELLTYPE_VALUE:
                 fVal = aCell.mfValue;
@@ -1178,7 +1178,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& 
rBlockPos, SCCOL nCol, SC
 
     OUString aURL;
     bool bWriteHyperLink(false);
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
     {
         ScFormulaCell* pFCell = aCell.mpFormula;
         if (pFCell->IsHyperLinkCell())
@@ -1200,7 +1200,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& 
rBlockPos, SCCOL nCol, SC
     bool bFieldText = false;
 
     const Color* pColor;
-    switch (aCell.meType)
+    switch (aCell.getType())
     {
         case CELLTYPE_EDIT :
             bFieldText = WriteFieldText(aCell.mpEditText);
diff --git a/sc/source/filter/oox/worksheethelper.cxx 
b/sc/source/filter/oox/worksheethelper.cxx
index 0d0aa8ce795a..af0c4649d723 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1062,7 +1062,7 @@ void WorksheetGlobals::insertHyperlink( const ScAddress& 
rAddress, const OUStrin
     ScDocumentImport& rDoc = getDocImport();
     ScRefCellValue aCell(rDoc.getDoc(), rAddress);
 
-    if (aCell.meType == CELLTYPE_STRING || aCell.meType == CELLTYPE_EDIT)
+    if (aCell.getType() == CELLTYPE_STRING || aCell.getType() == CELLTYPE_EDIT)
     {
         OUString aStr = aCell.getString(&rDoc.getDoc());
         ScFieldEditEngine& rEE = rDoc.getDoc().GetEditEngine();
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index b8e4015fde1c..685dcac9f348 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -160,7 +160,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL 
nCol )
     OUString aContent;
     ScAddress aPos(nCol, nRow, nTab);
     ScRefCellValue aCell(*pDoc, aPos);
-    switch (aCell.meType)
+    switch (aCell.getType())
     {
         case CELLTYPE_NONE:
             bValueData = false;
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx 
b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 2ef1b5bce3e2..1c7ffcbf8489 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -843,7 +843,7 @@ void XclExpChTrCellContent::GetCellData(
         return;
     }
 
-    switch (rScCell.meType)
+    switch (rScCell.getType())
     {
         case CELLTYPE_VALUE:
         {
@@ -868,7 +868,7 @@ void XclExpChTrCellContent::GetCellData(
         case CELLTYPE_EDIT:
         {
             OUString sCellStr;
-            if (rScCell.meType == CELLTYPE_STRING)
+            if (rScCell.getType() == CELLTYPE_STRING)
             {
                 sCellStr = rScCell.mpString->getString();
                 rpData->mpFormattedString = 
XclExpStringHelper::CreateCellString(
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx 
b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index 7c183da240a5..6bbd4c2e18aa 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -228,8 +228,7 @@ void XclImpChangeTrack::ReadCell(
             double fValue = XclTools::GetDoubleFromRK( pStrm->ReadInt32() );
             if( pStrm->IsValid() )
             {
-                rCell.meType = CELLTYPE_VALUE;
-                rCell.mfValue = fValue;
+                rCell.set(fValue);
             }
         }
         break;
@@ -238,8 +237,7 @@ void XclImpChangeTrack::ReadCell(
             double fValue = pStrm->ReadDouble();
             if( pStrm->IsValid() )
             {
-                rCell.meType = CELLTYPE_VALUE;
-                rCell.mfValue = fValue;
+                rCell.set(fValue);
             }
         }
         break;
@@ -248,8 +246,7 @@ void XclImpChangeTrack::ReadCell(
             OUString sString = pStrm->ReadUniString();
             if( pStrm->IsValid() )
             {
-                rCell.meType = CELLTYPE_STRING;
-                rCell.mpString = new 
svl::SharedString(GetDoc().GetSharedStringPool().intern(sString));
+                rCell.set(GetDoc().GetSharedStringPool().intern(sString));
             }
         }
         break;
@@ -258,8 +255,7 @@ void XclImpChangeTrack::ReadCell(
             double fValue = static_cast<double>(pStrm->ReaduInt16() != 0);
             if( pStrm->IsValid() )
             {
-                rCell.meType = CELLTYPE_VALUE;
-                rCell.mfValue = fValue;
+                rCell.set(fValue);
                 rFormat = GetFormatter().GetStandardFormat( 
SvNumFormatType::LOGICAL, ScGlobal::eLnge );
             }
         }
@@ -270,8 +266,7 @@ void XclImpChangeTrack::ReadCell(
             ReadFormula( pTokenArray, rPosition );
             if( pStrm->IsValid() && pTokenArray )
             {
-                rCell.meType = CELLTYPE_FORMULA;
-                rCell.mpFormula = new ScFormulaCell(GetDoc(), rPosition, 
std::move(pTokenArray));
+                rCell.set(new ScFormulaCell(GetDoc(), rPosition, 
std::move(pTokenArray)));
             }
         }
         break;
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx 
b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 6195b95a7ed7..a9dd5a5e7fc5 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -252,7 +252,7 @@ void ScChangeTrackingExportHelper::SetValueAttributes(const 
double& fValue, cons
 
 void ScChangeTrackingExportHelper::WriteValueCell(const ScCellValue& rCell, 
const OUString& sValue)
 {
-    assert(rCell.meType == CELLTYPE_VALUE);
+    assert(rCell.getType() == CELLTYPE_VALUE);
 
     SetValueAttributes(rCell.mfValue, sValue);
     SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, 
XML_CHANGE_TRACK_TABLE_CELL, true, true);
@@ -260,7 +260,7 @@ void ScChangeTrackingExportHelper::WriteValueCell(const 
ScCellValue& rCell, cons
 
 void ScChangeTrackingExportHelper::WriteStringCell(const ScCellValue& rCell)
 {
-    assert(rCell.meType == CELLTYPE_STRING);
+    assert(rCell.getType() == CELLTYPE_STRING);
 
     rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING);
     SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, 
XML_CHANGE_TRACK_TABLE_CELL, true, true);
@@ -274,7 +274,7 @@ void ScChangeTrackingExportHelper::WriteStringCell(const 
ScCellValue& rCell)
 
 void ScChangeTrackingExportHelper::WriteEditCell(const ScCellValue& rCell)
 {
-    assert(rCell.meType == CELLTYPE_EDIT);
+    assert(rCell.getType() == CELLTYPE_EDIT);
 
     OUString sString;
     if (rCell.mpEditText)
@@ -293,7 +293,7 @@ void ScChangeTrackingExportHelper::WriteEditCell(const 
ScCellValue& rCell)
 
 void ScChangeTrackingExportHelper::WriteFormulaCell(const ScCellValue& rCell, 
const OUString& sValue)
 {
-    assert(rCell.meType == CELLTYPE_FORMULA);
+    assert(rCell.getType() == CELLTYPE_FORMULA);
 
     ScFormulaCell* pFormulaCell = rCell.mpFormula;
     OUString sAddress;
@@ -354,7 +354,7 @@ void ScChangeTrackingExportHelper::WriteCell(const 
ScCellValue& rCell, const OUS
         return;
     }
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_VALUE:
             WriteValueCell(rCell, sValue);
@@ -585,7 +585,7 @@ void ScChangeTrackingExportHelper::WriteRejection(const 
ScChangeAction* pAction)
 
 void ScChangeTrackingExportHelper::CollectCellAutoStyles(const ScCellValue& 
rCell)
 {
-    if (rCell.meType != CELLTYPE_EDIT)
+    if (rCell.getType() != CELLTYPE_EDIT)
         return;
 
     if (!pEditTextObj)
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx 
b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index 9ae06a72072d..13d5a4906375 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -59,8 +59,7 @@ const ScCellValue& ScMyCellInfo::CreateCell(ScDocument& rDoc)
         ScAddress aPos;
         sal_Int32 nOffset(0);
         ScRangeStringConverter::GetAddressFromString(aPos, sFormulaAddress, 
rDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset);
-        maCell.meType = CELLTYPE_FORMULA;
-        maCell.mpFormula = new ScFormulaCell(rDoc, aPos, sFormula, eGrammar, 
nMatrixFlag);
+        maCell.set(new ScFormulaCell(rDoc, aPos, sFormula, eGrammar, 
nMatrixFlag));
         maCell.mpFormula->SetMatColsRows(static_cast<SCCOL>(nMatrixCols), 
static_cast<SCROW>(nMatrixRows));
     }
 
@@ -664,7 +663,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(const 
ScMyContentAction* pActio
         if (!aCell.isEmpty())
         {
             ScCellValue aNewCell;
-            if (aCell.meType != CELLTYPE_FORMULA)
+            if (aCell.getType() != CELLTYPE_FORMULA)
             {
                 aNewCell = aCell;
                 pChangeActionContent->SetNewCell(aNewCell, &rDoc, OUString());
@@ -692,8 +691,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(const 
ScMyContentAction* pActio
                     sFormula2 = sFormula.copy( 1 );
                 }
 
-                aNewCell.meType = CELLTYPE_FORMULA;
-                aNewCell.mpFormula = new ScFormulaCell(rDoc, aAddress, 
sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
+                aNewCell.set(new ScFormulaCell(rDoc, aAddress, 
sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag));
                 if (nMatrixFlag == ScMatrixMode::Formula)
                 {
                     SCCOL nCols;
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx 
b/sc/source/filter/xml/XMLExportIterator.cxx
index f0032b22e5fb..6d8c408f19ec 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -589,7 +589,7 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& 
rMyCell, const ScAddress&
     rMyCell.bIsMatrixCovered = false;
     rMyCell.bIsMatrixBase = false;
 
-    switch (rMyCell.maBaseCell.meType)
+    switch (rMyCell.maBaseCell.getType())
     {
         case CELLTYPE_VALUE:
             rMyCell.nType = table::CellContentType_VALUE;
@@ -605,7 +605,7 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& 
rMyCell, const ScAddress&
             rMyCell.nType = table::CellContentType_EMPTY;
     }
 
-    if (rMyCell.maBaseCell.meType == CELLTYPE_FORMULA)
+    if (rMyCell.maBaseCell.getType() == CELLTYPE_FORMULA)
     {
         bool bIsMatrixBase = false;
         if (rExport.IsMatrix(rMyCell.maCellAddress, rMyCell.aMatrixRange, 
bIsMatrixBase))
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index b3dfb353c068..d478a8af0ba9 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -860,8 +860,7 @@ void SAL_CALL ScXMLChangeCellContext::endFastElement( 
sal_Int32 /*nElement*/ )
             }
 
             // The cell will own the text object instance.
-            mrOldCell.meType = CELLTYPE_EDIT;
-            mrOldCell.mpEditText = mpEditTextObj->CreateTextObject().release();
+            mrOldCell.set(mpEditTextObj->CreateTextObject().release());
             GetScImport().GetTextImport()->ResetCursor();
             mpEditTextObj.clear();
         }
@@ -871,13 +870,11 @@ void SAL_CALL ScXMLChangeCellContext::endFastElement( 
sal_Int32 /*nElement*/ )
             {
                 if (!sText.isEmpty() && bString)
                 {
-                    mrOldCell.meType = CELLTYPE_STRING;
-                    mrOldCell.mpString = new 
svl::SharedString(pDoc->GetSharedStringPool().intern(sText));
+                    mrOldCell.set(pDoc->GetSharedStringPool().intern(sText));
                 }
                 else
                 {
-                    mrOldCell.meType = CELLTYPE_VALUE;
-                    mrOldCell.mfValue = fValue;
+                    mrOldCell.set(fValue);
                 }
                 if (rType == css::util::NumberFormat::DATE || rType == 
css::util::NumberFormat::TIME)
                     rInputString = sText;
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 0d0a81ebade6..6abd9a73a325 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1026,7 +1026,7 @@ void ScXMLTableRowCellContext::PutTextCell( const 
ScAddress& rCurrentPos,
     if( pDoc && rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
     {
         ScRefCellValue aCell(*pDoc, rCurrentPos);
-        bDoIncrement = aCell.meType == CELLTYPE_FORMULA;
+        bDoIncrement = aCell.getType() == CELLTYPE_FORMULA;
         if ( bDoIncrement )
         {
             ScFormulaCell* pFCell = aCell.mpFormula;
@@ -1120,7 +1120,7 @@ void ScXMLTableRowCellContext::PutValueCell( const 
ScAddress& rCurrentPos )
     if( rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
     {
         ScRefCellValue aCell(*rXMLImport.GetDocument(), rCurrentPos);
-        if (aCell.meType == CELLTYPE_FORMULA)
+        if (aCell.getType() == CELLTYPE_FORMULA)
         {
             ScFormulaCell* pFCell = aCell.mpFormula;
             SetFormulaCell(pFCell);
@@ -1267,7 +1267,7 @@ OUString getOutputString( ScDocument* pDoc, const 
ScAddress& aCellPos )
         return OUString();
 
     ScRefCellValue aCell(*pDoc, aCellPos);
-    switch (aCell.meType)
+    switch (aCell.getType())
     {
         case CELLTYPE_NONE:
             return OUString();
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 023165f56c95..529b34388f18 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -214,7 +214,7 @@ OUString lcl_GetFormattedString(ScDocument* pDoc, const 
ScRefCellValue& rCell, c
     if (!pDoc)
         return OUString();
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_STRING:
         {
@@ -3166,7 +3166,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 
nEqualCellCount)
             break;
         case table::CellContentType_FORMULA :
             {
-                if (aCell.maBaseCell.meType == CELLTYPE_FORMULA)
+                if (aCell.maBaseCell.getType() == CELLTYPE_FORMULA)
                 {
                     const bool bIsMatrix(bIsFirstMatrixCell || 
aCell.bIsMatrixCovered);
                     ScFormulaCell* pFormulaCell = aCell.maBaseCell.mpFormula;
@@ -3258,11 +3258,11 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 
nEqualCellCount)
 
     if (!bIsEmpty)
     {
-        if (aCell.maBaseCell.meType == CELLTYPE_EDIT)
+        if (aCell.maBaseCell.getType() == CELLTYPE_EDIT)
         {
             WriteEditCell(aCell.maBaseCell.mpEditText);
         }
-        else if (aCell.maBaseCell.meType == CELLTYPE_FORMULA && 
aCell.maBaseCell.mpFormula->IsMultilineResult())
+        else if (aCell.maBaseCell.getType() == CELLTYPE_FORMULA && 
aCell.maBaseCell.mpFormula->IsMultilineResult())
         {
             WriteMultiLineFormulaResult(aCell.maBaseCell.mpFormula);
         }
@@ -3796,7 +3796,7 @@ void ScXMLExport::SetRepeatAttribute(sal_Int32 
nEqualCellCount, bool bIncProgres
 
 bool ScXMLExport::IsEditCell(const ScMyCell& rCell)
 {
-    return rCell.maBaseCell.meType == CELLTYPE_EDIT;
+    return rCell.maBaseCell.getType() == CELLTYPE_EDIT;
 }
 
 bool ScXMLExport::IsCellEqual (const ScMyCell& aCell1, const ScMyCell& aCell2)
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx 
b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 392eb4b9af2a..0e9c174251c1 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -428,7 +428,7 @@ void 
ScAccessibleCell::FillPrecedents(utl::AccessibleRelationSetHelper* pRelatio
         return;
 
     ScRefCellValue aCell(*mpDoc, maCellAddress);
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
     {
         ScFormulaCell* pCell = aCell.mpFormula;
         ScDetectiveRefIter aIter(*mpDoc, pCell);
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index d0be7e0aecc2..58723e438c72 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -312,7 +312,7 @@ bool ScTransferObj::GetData( const 
datatransfer::DataFlavor& rFlavor, const OUSt
             const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, 
nTab );
             ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), 
m_pDoc.get() );
             ScRefCellValue aCell(*m_pDoc, aPos);
-            if (aCell.meType == CELLTYPE_EDIT)
+            if (aCell.getType() == CELLTYPE_EDIT)
             {
                 const EditTextObject* pObj = aCell.mpEditText;
                 aEngine.SetTextCurrentDefaults(*pObj);
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index e46c3df81742..a5935402ba1d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2003,7 +2003,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const 
ScImportOptions& rAsciiOpt,
         // empty to fiddle with "sep=".
         if ((pCell = aIter.GetNext( nCol, nRow)) != nullptr && nCol == 
nStartCol && !aIter.GetNext( nCol, nRow))
         {
-            if (pCell->meType == CELLTYPE_STRING)
+            if (pCell->getType() == CELLTYPE_STRING)
             {
                 aString = pCell->mpString->getString();
                 if (aString.getLength() <= 5 && 
aString.startsWithIgnoreAsciiCase("sep="))
@@ -2101,7 +2101,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const 
ScImportOptions& rAsciiOpt,
         else
             nNextCol = nCol + 1;
 
-        CellType eType = pCell->meType;
+        CellType eType = pCell->getType();
         ScAddress aPos(nCol, nRow, nTab);
         if ( bTabProtect )
         {
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index edab7a5304b0..7ea21893a425 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -984,7 +984,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool 
bShared, bool bCheck
                             OUString aValue = static_cast<const 
ScChangeActionContent*>(pSourceAction)->GetNewString( m_pDocument.get() );
                             ScMatrixMode eMatrix = ScMatrixMode::NONE;
                             const ScCellValue& rCell = static_cast<const 
ScChangeActionContent*>(pSourceAction)->GetNewCell();
-                            if (rCell.meType == CELLTYPE_FORMULA)
+                            if (rCell.getType() == CELLTYPE_FORMULA)
                                 eMatrix = rCell.mpFormula->GetMatrixFlag();
                             switch ( eMatrix )
                             {
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 683ac2cbe349..7974eb330d74 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -903,7 +903,7 @@ ErrCode ScDocShell::DBaseExport( const OUString& 
rFullFileName, rtl_TextEncoding
                         ScRefCellValue aCell(*m_pDocument, ScAddress(nDocCol, 
nDocRow, nTab));
                         if (!aCell.isEmpty())
                         {
-                            if (aCell.meType == CELLTYPE_EDIT)
+                            if (aCell.getType() == CELLTYPE_EDIT)
                             {   // preserve paragraphs
                                 lcl_getLongVarCharEditString(aString, aCell, 
aEditEngine);
                             }
@@ -1009,7 +1009,7 @@ ErrCode ScDocShell::DBaseExport( const OUString& 
rFullFileName, rtl_TextEncoding
                 {
                     case sdbc::DataType::LONGVARCHAR:
                         {
-                            if (pCell->meType == CELLTYPE_EDIT)
+                            if (pCell->getType() == CELLTYPE_EDIT)
                                 lcl_getLongVarCharEditString(aString, *pCell, 
aEditEngine);
                             else
                                 lcl_getLongVarCharString(
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index a0f93781b0f5..6b9920245706 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1504,11 +1504,11 @@ static FormulaToken* convertToToken( ScDocument& 
rHostDoc, const ScDocument& rSr
 {
     if (rCell.hasEmptyValue())
     {
-        bool bInherited = (rCell.meType == CELLTYPE_FORMULA);
+        bool bInherited = (rCell.getType() == CELLTYPE_FORMULA);
         return new ScEmptyCellToken(bInherited, false);
     }
 
-    switch (rCell.meType)
+    switch (rCell.getType())
     {
         case CELLTYPE_EDIT:
         case CELLTYPE_STRING:
@@ -2933,7 +2933,7 @@ public:
         {
             ScExternalRefCache::TokenRef pTok;
             ScRefCellValue aCell = mpCurCol->GetCellValue(maBlockPos, nRow);
-            switch (aCell.meType)
+            switch (aCell.getType())
             {
                 case CELLTYPE_STRING:
                 case CELLTYPE_EDIT:
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 6e6c57f44683..78fbe41cdd6d 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1942,7 +1942,7 @@ bool ScImportExport::Doc2Text( SvStream& rStrm )
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
 
                 ScRefCellValue aCell(rDoc, aPos, blockPos[ nCol - nStartCol ]);
-                switch (aCell.meType)
+                switch (aCell.getType())
                 {
                     case CELLTYPE_FORMULA:
                     {
@@ -2382,7 +2382,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
             SCROW r = nRow - nStartRow + 1;
             SCCOL c = nCol - nStartCol + 1;
             ScRefCellValue aCell(rDoc, ScAddress(nCol, nRow, 
aRange.aStart.Tab()));
-            CellType eType = aCell.meType;
+            CellType eType = aCell.getType();
             switch( eType )
             {
                 case CELLTYPE_FORMULA:
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 8323cd824612..ff9520c47768 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -449,7 +449,7 @@ void ScUndoSetCell::SetValue( const ScCellValue& rVal )
 {
     ScDocument& rDoc = pDocShell->GetDocument();
 
-    switch (rVal.meType)
+    switch (rVal.getType())
     {
         case CELLTYPE_NONE:
             // empty cell
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index b2117cefccf8..14974b4beea3 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1329,7 +1329,7 @@ static OUString lcl_GetInputString( ScDocument& rDoc, 
const ScAddress& rPos, boo
 
     OUString aVal;
 
-    CellType eType = aCell.meType;
+    CellType eType = aCell.getType();
     if (eType == CELLTYPE_FORMULA)
     {
         ScFormulaCell* pForm = aCell.mpFormula;
@@ -4800,7 +4800,7 @@ OUString SAL_CALL ScCellRangeObj::getArrayFormula()
     ScDocument& rDoc = pDocSh->GetDocument();
     ScRefCellValue aCell1(rDoc, aRange.aStart);
     ScRefCellValue aCell2(rDoc, aRange.aEnd);
-    if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
+    if (aCell1.getType() == CELLTYPE_FORMULA && aCell2.getType() == 
CELLTYPE_FORMULA)
     {
         const ScFormulaCell* pFCell1 = aCell1.mpFormula;
         const ScFormulaCell* pFCell2 = aCell2.mpFormula;
@@ -4864,7 +4864,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL 
ScCellRangeObj::getArrayTokens()
     ScDocument& rDoc = pDocSh->GetDocument();
     ScRefCellValue aCell1(rDoc, aRange.aStart);
     ScRefCellValue aCell2(rDoc, aRange.aEnd);
-    if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
+    if (aCell1.getType() == CELLTYPE_FORMULA && aCell2.getType() == 
CELLTYPE_FORMULA)
     {
         const ScFormulaCell* pFCell1 = aCell1.mpFormula;
         const ScFormulaCell* pFCell2 = aCell2.mpFormula;
@@ -6159,7 +6159,7 @@ void SAL_CALL ScCellObj::setFormulaResult( double nValue )
     if (pDocSh)
     {
         ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
-        if (aCell.meType == CELLTYPE_FORMULA)
+        if (aCell.getType() == CELLTYPE_FORMULA)
         {
             ScFormulaCell* pCell = aCell.mpFormula;
             pCell->SetHybridDouble( nValue );
@@ -6243,7 +6243,7 @@ table::CellContentType ScCellObj::GetContentType_Impl()
     if ( pDocSh )
     {
         ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
-        if (aCell.meType == CELLTYPE_FORMULA)
+        if (aCell.getType() == CELLTYPE_FORMULA)
         {
             bool bValue = aCell.mpFormula->IsValue();
             return bValue ? table::CellContentType_VALUE : 
table::CellContentType_TEXT;
@@ -6264,7 +6264,7 @@ sal_Int32 SAL_CALL ScCellObj::getError()
 
     FormulaError nError = FormulaError::NONE;
     ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
         nError = aCell.mpFormula->GetErrCode();
 
     return static_cast<sal_Int32>(nError);
@@ -6282,7 +6282,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL 
ScCellObj::getTokens()
 
     ScDocument& rDoc = pDocSh->GetDocument();
     ScRefCellValue aCell(rDoc, aCellPos);
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
     {
         ScTokenArray* pTokenArray = aCell.mpFormula->GetCode();
         if (pTokenArray)
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index d2fec774e125..50ee015adfb1 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2550,7 +2550,7 @@ void ScChart2DataSequence::BuildDataCache()
                         aItem.maString = m_pDocument->GetString(aAdr);
 
                         ScRefCellValue aCell(*m_pDocument, aAdr, hint);
-                        switch (aCell.meType)
+                        switch (aCell.getType())
                         {
                             case CELLTYPE_VALUE:
                                 aItem.mfValue = aCell.getValue();
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 46ec6dbf2fbd..413bb3e3685e 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -815,7 +815,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
         }
 
         ScRefCellValue aCell(rDoc, aCellPos);
-        if (aCell.meType == CELLTYPE_EDIT)
+        if (aCell.getType() == CELLTYPE_EDIT)
         {
             const EditTextObject* pObj = aCell.mpEditText;
             pEditEngine->SetTextNewDefaults(*pObj, aDefaults);
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 17c4936567f9..30a796e9f646 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -3428,7 +3428,7 @@ void ScCellShell::ExecuteFillSingleEdit()
         aPrevPos.IncRow(-1);
         ScRefCellValue aCell(rDoc, aPrevPos);
 
-        if (aCell.meType == CELLTYPE_FORMULA)
+        if (aCell.getType() == CELLTYPE_FORMULA)
         {
             aInit = "=";
             const ScTokenArray* pCode = aCell.mpFormula->GetCode();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0a5a8454c8ec..753b79763038 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -288,7 +288,7 @@ static bool lcl_IsEditableMatrix( ScDocument& rDoc, const 
ScRange& rRange )
 
     ScRefCellValue aCell(rDoc, rRange.aEnd);
     ScAddress aPos;
-    return (aCell.meType == CELLTYPE_FORMULA && 
aCell.mpFormula->GetMatrixOrigin(rDoc, aPos) && aPos == rRange.aStart);
+    return (aCell.getType() == CELLTYPE_FORMULA && 
aCell.mpFormula->GetMatrixOrigin(rDoc, aPos) && aPos == rRange.aStart);
 }
 
 static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, const 
ScViewData& rViewData )
@@ -333,9 +333,9 @@ static bool lcl_GetHyperlinkCell(
                 rURL = pPattern->GetItem(ATTR_HYPERLINK).GetValue();
                 bFound = true;
             }
-            else if (rCell.meType == CELLTYPE_EDIT)
+            else if (rCell.getType() == CELLTYPE_EDIT)
                 bFound = true;
-            else if (rCell.meType == CELLTYPE_FORMULA && 
rCell.mpFormula->IsHyperLinkCell())
+            else if (rCell.getType() == CELLTYPE_FORMULA && 
rCell.mpFormula->IsHyperLinkCell())
                 bFound = true;
             else
                 return false;                               // other cell
@@ -3236,7 +3236,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
             // Find the first string to the left for spell checking in case 
the current cell is empty.
             ScAddress aPos(nCellX, nCellY, nTab);
             ScRefCellValue aSpellCheckCell(rDoc, aPos);
-            while (!bPosIsInEditView && aSpellCheckCell.meType == 
CELLTYPE_NONE)
+            while (!bPosIsInEditView && aSpellCheckCell.getType() == 
CELLTYPE_NONE)
             {
                 // Loop until we get the first non-empty cell in the row.
                 aPos.IncCol(-1);
@@ -3246,7 +3246,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
                 aSpellCheckCell.assign(rDoc, aPos);
             }
 
-            if (aPos.Col() >= 0 && (aSpellCheckCell.meType == CELLTYPE_STRING 
|| aSpellCheckCell.meType == CELLTYPE_EDIT))
+            if (aPos.Col() >= 0 && (aSpellCheckCell.getType() == 
CELLTYPE_STRING || aSpellCheckCell.getType() == CELLTYPE_EDIT))
                 nColSpellError = aPos.Col();
 
             // Is there a misspelled word somewhere in the cell?
@@ -5704,7 +5704,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
     tools::Rectangle aLogicEdit = PixelToLogic( aEditRect, aEditMode );
     tools::Long nThisColLogic = aLogicEdit.Right() - aLogicEdit.Left() + 1;
     Size aPaperSize( 1000000, 1000000 );
-    if (aCell.meType == CELLTYPE_FORMULA)
+    if (aCell.getType() == CELLTYPE_FORMULA)
     {
         tools::Long nSizeX  = 0;
         tools::Long nSizeY  = 0;
@@ -5718,7 +5718,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
     pEngine->SetPaperSize( aPaperSize );
 
     std::unique_ptr<EditTextObject> pTextObj;
-    if (aCell.meType == CELLTYPE_EDIT)
+    if (aCell.getType() == CELLTYPE_EDIT)
     {
         if (aCell.mpEditText)
             pEngine->SetTextCurrentDefaults(*aCell.mpEditText);
@@ -5736,7 +5736,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
             // TODO: text content of formatted numbers can be different
             if (aCell.hasNumeric())
                 aRepres = OUString::number(aCell.getValue());
-            else if (aCell.meType == CELLTYPE_FORMULA)
+            else if (aCell.getType() == CELLTYPE_FORMULA)
                 aRepres = aCell.mpFormula->GetString().getString();
 
             pTextObj = ScEditUtil::CreateURLObjectFromURL(rDoc, sURL, aRepres);
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 38417d000be5..a9bdc4c3baef 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1834,7 +1834,7 @@ void ScOutputData::FindChanged()
         {
             const ScRefCellValue& rCell = pThisRowInfo->cellInfo(nX).maCell;
 
-            if (rCell.meType != CELLTYPE_FORMULA)
+            if (rCell.getType() != CELLTYPE_FORMULA)
                 continue;
 
             ScFormulaCell* pFCell = rCell.mpFormula;
@@ -1883,7 +1883,7 @@ void ScOutputData::FindChanged()
             {
                 const ScRefCellValue& rCell = 
pThisRowInfo->cellInfo(nX).maCell;
 
-                if (rCell.meType != CELLTYPE_FORMULA)
+                if (rCell.getType() != CELLTYPE_FORMULA)
                     continue;
 
                 ScFormulaCell* pFCell = rCell.mpFormula;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index cdd9329d3fcb..a66ce5b80d78 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -491,7 +491,7 @@ void ScDrawStringsVars::SetPatternSimple( const 
ScPatternAttr* pNew, const SfxIt
 
 static bool SameValue( const ScRefCellValue& rCell, const ScRefCellValue& 
rOldCell )
 {
-    return rOldCell.meType == CELLTYPE_VALUE && rCell.meType == CELLTYPE_VALUE 
&&
+    return rOldCell.getType() == CELLTYPE_VALUE && rCell.getType() == 
CELLTYPE_VALUE &&
         rCell.mfValue == rOldCell.mfValue;
 }
 
@@ -604,7 +604,7 @@ void ScDrawStringsVars::SetTextToWidthOrHash( 
ScRefCellValue& rCell, tools::Long
     if (bPixelToLogic)
         nWidth = pOutput->mpRefDevice->PixelToLogic(Size(nWidth,0)).Width();
 
-    CellType eType = rCell.meType;
+    CellType eType = rCell.getType();
     if (eType != CELLTYPE_VALUE && eType != CELLTYPE_FORMULA)
         // must be a value or formula cell.
         return;

... etc. - the rest is truncated

Reply via email to