summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/cellvalue.hxx2
-rw-r--r--sc/source/core/data/cellvalue.cxx48
2 files changed, 50 insertions, 0 deletions
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 430212245870..153411c2b63e 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -44,6 +44,7 @@ struct SC_DLLPUBLIC ScCellValue
ScCellValue( double fValue );
ScCellValue( const svl::SharedString& rString );
ScCellValue( const ScCellValue& r );
+ ScCellValue( ScCellValue&& r );
~ScCellValue();
void clear();
@@ -84,6 +85,7 @@ struct SC_DLLPUBLIC ScCellValue
bool equalsWithoutFormat( const ScCellValue& r ) const;
ScCellValue& operator= ( const ScCellValue& r );
+ ScCellValue& operator= ( ScCellValue&& r );
ScCellValue& operator= ( const ScRefCellValue& r );
void swap( ScCellValue& r );
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 81c2cdc267b7..abaaad5e8cb6 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -244,6 +244,27 @@ ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), mfValue(r.m
}
}
+ScCellValue::ScCellValue(ScCellValue&& r)
+ : meType(r.meType)
+ , mfValue(r.mfValue)
+{
+ switch (r.meType)
+ {
+ case CELLTYPE_STRING:
+ mpString = r.mpString;
+ break;
+ case CELLTYPE_EDIT:
+ mpEditText = r.mpEditText;
+ break;
+ case CELLTYPE_FORMULA:
+ mpFormula = r.mpFormula;
+ break;
+ default:
+ ;
+ }
+ r.meType = CELLTYPE_NONE;
+}
+
ScCellValue::~ScCellValue()
{
clear();
@@ -492,6 +513,33 @@ ScCellValue& ScCellValue::operator= ( const ScCellValue& r )
return *this;
}
+ScCellValue& ScCellValue::operator=(ScCellValue&& rCell)
+{
+ clear();
+
+ meType = rCell.meType;
+ mfValue = rCell.mfValue;
+ switch (rCell.meType)
+ {
+ case CELLTYPE_STRING:
+ mpString = rCell.mpString;
+ break;
+ case CELLTYPE_EDIT:
+ mpEditText = rCell.mpEditText;
+ break;
+ case CELLTYPE_FORMULA:
+ mpFormula = rCell.mpFormula;
+ break;
+ default:
+ ;
+ }
+ //we don't need to reset mpString/mpEditText/mpFormula if we
+ //set meType to NONE as the ScCellValue dtor keys off the meType
+ rCell.meType = CELLTYPE_NONE;
+
+ return *this;
+}
+
ScCellValue& ScCellValue::operator= ( const ScRefCellValue& r )
{
ScCellValue aTmp(r);