diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-06-17 19:55:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-18 08:23:06 +0200 |
commit | 20b8c7f38ae1c03dc0405a2da006ab6b2dbf3627 (patch) | |
tree | dbdef33c3fe95d50f969690d7755ae2b0a02567e /sc/inc | |
parent | ca47989ad60b1414f92be22a1fbf4c1d1a92dd97 (diff) |
create getter for ScCellValue::mpFormula
so we can assert that it has the correct tag type
Change-Id: Iab13a6d6ea1783c69395f06f28732769e5fe8b18
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136059
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/cellvalue.hxx | 13 | ||||
-rw-r--r-- | sc/inc/dociter.hxx | 4 |
2 files changed, 13 insertions, 4 deletions
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 192e499bbb25..1095d32a3d39 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -41,7 +41,7 @@ public: double mfValue1; svl::SharedString* mpString; EditTextObject* mpEditText1; - ScFormulaCell* mpFormula; + ScFormulaCell* mpFormula1; }; ScCellValue(); @@ -72,6 +72,14 @@ public: mpEditText1 = nullptr; return p; } + ScFormulaCell* getFormula() const { assert(meType == CELLTYPE_FORMULA); return mpFormula1; } + ScFormulaCell* releaseFormula() + { + assert(meType == CELLTYPE_FORMULA); + auto p = mpFormula1; + mpFormula1 = nullptr; + return p; + } /** * Take cell value from specified position in specified document. @@ -124,7 +132,7 @@ public: double mfValue1; const svl::SharedString* mpString; const EditTextObject* mpEditText1; - ScFormulaCell* mpFormula; + ScFormulaCell* mpFormula1; }; ScRefCellValue(); @@ -145,6 +153,7 @@ public: double getDouble() const { assert(meType == CELLTYPE_VALUE); return mfValue1; } const svl::SharedString* getSharedString() const { assert(meType == CELLTYPE_STRING); return mpString; } const EditTextObject* getEditText() const { assert(meType == CELLTYPE_EDIT); return mpEditText1; } + ScFormulaCell* getFormula() const { assert(meType == CELLTYPE_FORMULA); return mpFormula1; } /** * Take cell value from specified position in specified document. diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index fc1609d6daab..ff58a4181e12 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -235,8 +235,8 @@ public: CellType getType() const { return maCurCell.getType();} OUString getString() const; const EditTextObject* getEditText() const { return maCurCell.getEditText();} - ScFormulaCell* getFormulaCell() { return maCurCell.mpFormula;} - const ScFormulaCell* getFormulaCell() const { return maCurCell.mpFormula;} + ScFormulaCell* getFormulaCell() { return maCurCell.getFormula();} + const ScFormulaCell* getFormulaCell() const { return maCurCell.getFormula();} ScCellValue getCellValue() const; const ScRefCellValue& getRefCellValue() const { return maCurCell;} |