diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-06-17 16:00:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-17 17:00:11 +0200 |
commit | c78193b32152122e9b71151b1b463b2dff99f42f (patch) | |
tree | 72dcf399927ea7b4dd0bcb53829f31301272f3f8 /sc | |
parent | 69e5d752ef20f5cd5b3a429a3546ae46bbb5f62a (diff) |
create getter for ScCellValue::mpEditText
so we can assert that it has the correct tag type
Change-Id: I984c22ae2527d652f2d4194227dc1173793300c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136054
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
37 files changed, 97 insertions, 89 deletions
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 643889e2c154..192e499bbb25 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -40,7 +40,7 @@ public: union { double mfValue1; svl::SharedString* mpString; - EditTextObject* mpEditText; + EditTextObject* mpEditText1; ScFormulaCell* mpFormula; }; @@ -64,6 +64,14 @@ public: CellType getType() const { return meType; } double getDouble() const { assert(meType == CELLTYPE_VALUE); return mfValue1; } svl::SharedString* getSharedString() const { assert(meType == CELLTYPE_STRING); return mpString; } + EditTextObject* getEditText() const { assert(meType == CELLTYPE_EDIT); return mpEditText1; } + EditTextObject* releaseEditText() + { + assert(meType == CELLTYPE_EDIT); + auto p = mpEditText1; + mpEditText1 = nullptr; + return p; + } /** * Take cell value from specified position in specified document. @@ -115,7 +123,7 @@ public: union { double mfValue1; const svl::SharedString* mpString; - const EditTextObject* mpEditText; + const EditTextObject* mpEditText1; ScFormulaCell* mpFormula; }; @@ -136,6 +144,7 @@ public: CellType getType() const { return meType; } 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; } /** * Take cell value from specified position in specified document. diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 622d36332d97..fc1609d6daab 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -234,7 +234,7 @@ public: CellType getType() const { return maCurCell.getType();} OUString getString() const; - const EditTextObject* getEditText() const { return maCurCell.mpEditText;} + const EditTextObject* getEditText() const { return maCurCell.getEditText();} ScFormulaCell* getFormulaCell() { return maCurCell.mpFormula;} const ScFormulaCell* getFormulaCell() const { return maCurCell.mpFormula;} ScCellValue getCellValue() const; diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 38884685ae9c..87fa2c11ccf1 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -401,20 +401,20 @@ void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow, { ScAddress aPos(nCol, nRow, nTab); ScRefCellValue aCell(rDocument, aPos, blockPos); - if (aCell.getType() != CELLTYPE_EDIT || !aCell.mpEditText) + if (aCell.getType() != CELLTYPE_EDIT || !aCell.getEditText()) continue; std::unique_ptr<EditTextObject> pOldData; if (pDataArray) - pOldData = aCell.mpEditText->Clone(); + pOldData = aCell.getEditText()->Clone(); // Direct modification of cell content - something to watch out for if // we decide to share edit text instances in the future. - ScEditUtil::RemoveCharAttribs(const_cast<EditTextObject&>(*aCell.mpEditText), *pPattern); + ScEditUtil::RemoveCharAttribs(const_cast<EditTextObject&>(*aCell.getEditText()), *pPattern); if (pDataArray) { - std::unique_ptr<EditTextObject> pNewData = aCell.mpEditText->Clone(); + std::unique_ptr<EditTextObject> pNewData = aCell.getEditText()->Clone(); pDataArray->AddItem(nTab, nCol, nRow, std::move(pOldData), std::move(pNewData)); } } diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index cfc879802446..6de2a253d72f 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -43,12 +43,12 @@ OUString getString( const T& rVal ) if (rVal.getType() == CELLTYPE_EDIT) { OUStringBuffer aRet; - sal_Int32 n = rVal.mpEditText->GetParagraphCount(); + sal_Int32 n = rVal.mpEditText1->GetParagraphCount(); for (sal_Int32 i = 0; i < n; ++i) { if (i > 0) aRet.append('\n'); - aRet.append(rVal.mpEditText->GetText(i)); + aRet.append(rVal.mpEditText1->GetText(i)); } return aRet.makeStringAndClear(); } @@ -115,7 +115,7 @@ void commitToColumn( const ScCellValue& rCell, ScColumn& rColumn, SCROW nRow ) rColumn.SetRawString(nRow, *rCell.mpString); break; case CELLTYPE_EDIT: - rColumn.SetEditText(nRow, ScEditUtil::Clone(*rCell.mpEditText, rColumn.GetDoc())); + rColumn.SetEditText(nRow, ScEditUtil::Clone(*rCell.mpEditText1, rColumn.GetDoc())); break; case CELLTYPE_VALUE: rColumn.SetValue(nRow, rCell.getDouble()); @@ -168,8 +168,8 @@ OUString getStringImpl( const CellT& rCell, const ScDocument* pDoc ) case CELLTYPE_STRING: return rCell.mpString->getString(); case CELLTYPE_EDIT: - if (rCell.mpEditText) - return ScEditUtil::GetString(*rCell.mpEditText, pDoc); + if (rCell.mpEditText1) + return ScEditUtil::GetString(*rCell.mpEditText1, pDoc); break; case CELLTYPE_FORMULA: return rCell.mpFormula->GetString().getString(); @@ -189,8 +189,8 @@ OUString getRawStringImpl( const CellT& rCell, const ScDocument& rDoc ) case CELLTYPE_STRING: return rCell.mpString->getString(); case CELLTYPE_EDIT: - if (rCell.mpEditText) - return ScEditUtil::GetString(*rCell.mpEditText, &rDoc); + if (rCell.mpEditText1) + return ScEditUtil::GetString(*rCell.mpEditText1, &rDoc); break; case CELLTYPE_FORMULA: return rCell.mpFormula->GetRawString().getString(); @@ -212,7 +212,7 @@ ScCellValue::ScCellValue( const ScRefCellValue& rCell ) : meType(rCell.getType() mpString = new svl::SharedString(*rCell.mpString); break; case CELLTYPE_EDIT: - mpEditText = rCell.mpEditText->Clone().release(); + mpEditText1 = rCell.mpEditText1->Clone().release(); break; case CELLTYPE_FORMULA: mpFormula = rCell.mpFormula->Clone(); @@ -226,7 +226,7 @@ ScCellValue::ScCellValue( double fValue ) : meType(CELLTYPE_VALUE), mfValue1(fVa 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( std::unique_ptr<EditTextObject> xEdit ) : meType(CELLTYPE_EDIT), mpEditText1(xEdit.release()) {} ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), mfValue1(r.mfValue1) { @@ -236,7 +236,7 @@ ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), mfValue1(r. mpString = new svl::SharedString(*r.mpString); break; case CELLTYPE_EDIT: - mpEditText = r.mpEditText->Clone().release(); + mpEditText1 = r.mpEditText1->Clone().release(); break; case CELLTYPE_FORMULA: mpFormula = r.mpFormula->Clone(); @@ -256,7 +256,7 @@ ScCellValue::ScCellValue(ScCellValue&& r) noexcept mpString = r.mpString; break; case CELLTYPE_EDIT: - mpEditText = r.mpEditText; + mpEditText1 = r.mpEditText1; break; case CELLTYPE_FORMULA: mpFormula = r.mpFormula; @@ -280,7 +280,7 @@ void ScCellValue::clear() noexcept delete mpString; break; case CELLTYPE_EDIT: - delete mpEditText; + delete mpEditText1; break; case CELLTYPE_FORMULA: delete mpFormula; @@ -312,14 +312,14 @@ void ScCellValue::set( const EditTextObject& rEditText ) { clear(); meType = CELLTYPE_EDIT; - mpEditText = rEditText.Clone().release(); + mpEditText1 = rEditText.Clone().release(); } void ScCellValue::set( std::unique_ptr<EditTextObject> xEditText ) { clear(); meType = CELLTYPE_EDIT; - mpEditText = xEditText.release(); + mpEditText1 = xEditText.release(); } void ScCellValue::set( ScFormulaCell* pFormula ) @@ -342,8 +342,8 @@ void ScCellValue::assign( const ScDocument& rDoc, const ScAddress& rPos ) mpString = new svl::SharedString(*aRefVal.mpString); break; case CELLTYPE_EDIT: - if (aRefVal.mpEditText) - mpEditText = aRefVal.mpEditText->Clone().release(); + if (aRefVal.mpEditText1) + mpEditText1 = aRefVal.mpEditText1->Clone().release(); break; case CELLTYPE_VALUE: mfValue1 = aRefVal.mfValue1; @@ -370,22 +370,22 @@ void ScCellValue::assign(const ScCellValue& rOther, ScDocument& rDestDoc, ScClon { // Switch to the pool of the destination document. ScFieldEditEngine& rEngine = rDestDoc.GetEditEngine(); - if (rOther.mpEditText->HasOnlineSpellErrors()) + if (rOther.mpEditText1->HasOnlineSpellErrors()) { EEControlBits nControl = rEngine.GetControlWord(); const EEControlBits nSpellControl = EEControlBits::ONLINESPELLING | EEControlBits::ALLOWBIGOBJS; bool bNewControl = ((nControl & nSpellControl) != nSpellControl); if (bNewControl) rEngine.SetControlWord(nControl | nSpellControl); - rEngine.SetTextCurrentDefaults(*rOther.mpEditText); - mpEditText = rEngine.CreateTextObject().release(); + rEngine.SetTextCurrentDefaults(*rOther.mpEditText1); + mpEditText1 = rEngine.CreateTextObject().release(); if (bNewControl) rEngine.SetControlWord(nControl); } else { - rEngine.SetTextCurrentDefaults(*rOther.mpEditText); - mpEditText = rEngine.CreateTextObject().release(); + rEngine.SetTextCurrentDefaults(*rOther.mpEditText1); + mpEditText1 = rEngine.CreateTextObject().release(); } } break; @@ -413,7 +413,7 @@ void ScCellValue::commit( ScDocument& rDoc, const ScAddress& rPos ) const } break; case CELLTYPE_EDIT: - rDoc.SetEditText(rPos, mpEditText->Clone()); + rDoc.SetEditText(rPos, mpEditText1->Clone()); break; case CELLTYPE_VALUE: rDoc.SetValue(rPos, mfValue1); @@ -446,7 +446,7 @@ void ScCellValue::release( ScDocument& rDoc, const ScAddress& rPos ) break; case CELLTYPE_EDIT: // Cell takes the ownership of the text object. - rDoc.SetEditText(rPos, std::unique_ptr<EditTextObject>(mpEditText)); + rDoc.SetEditText(rPos, std::unique_ptr<EditTextObject>(mpEditText1)); break; case CELLTYPE_VALUE: rDoc.SetValue(rPos, mfValue1); @@ -476,7 +476,7 @@ void ScCellValue::release( ScColumn& rColumn, SCROW nRow, sc::StartListeningType break; case CELLTYPE_EDIT: // Cell takes the ownership of the text object. - rColumn.SetEditText(nRow, std::unique_ptr<EditTextObject>(mpEditText)); + rColumn.SetEditText(nRow, std::unique_ptr<EditTextObject>(mpEditText1)); break; case CELLTYPE_VALUE: rColumn.SetValue(nRow, mfValue1); @@ -527,7 +527,7 @@ ScCellValue& ScCellValue::operator=(ScCellValue&& rCell) noexcept mpString = rCell.mpString; break; case CELLTYPE_EDIT: - mpEditText = rCell.mpEditText; + mpEditText1 = rCell.mpEditText1; break; case CELLTYPE_FORMULA: mpFormula = rCell.mpFormula; @@ -535,7 +535,7 @@ ScCellValue& ScCellValue::operator=(ScCellValue&& rCell) noexcept default: ; } - //we don't need to reset mpString/mpEditText/mpFormula if we + //we don't need to reset mpString/mpEditText1/mpFormula if we //set meType to NONE as the ScCellValue dtor keys off the meType rCell.meType = CELLTYPE_NONE; @@ -561,7 +561,7 @@ void ScCellValue::swap( ScCellValue& r ) ScRefCellValue::ScRefCellValue() : meType(CELLTYPE_NONE), mfValue1(0.0) {} ScRefCellValue::ScRefCellValue( double fValue ) : meType(CELLTYPE_VALUE), mfValue1(fValue) {} ScRefCellValue::ScRefCellValue( const svl::SharedString* pString ) : meType(CELLTYPE_STRING), mpString(pString) {} -ScRefCellValue::ScRefCellValue( const EditTextObject* pEditText ) : meType(CELLTYPE_EDIT), mpEditText(pEditText) {} +ScRefCellValue::ScRefCellValue( const EditTextObject* pEditText ) : meType(CELLTYPE_EDIT), mpEditText1(pEditText) {} ScRefCellValue::ScRefCellValue( ScFormulaCell* pFormula ) : meType(CELLTYPE_FORMULA), mpFormula(pFormula) {} ScRefCellValue::ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos ) @@ -603,7 +603,7 @@ void ScRefCellValue::commit( ScDocument& rDoc, const ScAddress& rPos ) const } break; case CELLTYPE_EDIT: - rDoc.SetEditText(rPos, ScEditUtil::Clone(*mpEditText, rDoc)); + rDoc.SetEditText(rPos, ScEditUtil::Clone(*mpEditText1, rDoc)); break; case CELLTYPE_VALUE: rDoc.SetValue(rPos, mfValue1); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index ca5535811789..208b8dac5fe3 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -458,7 +458,7 @@ tools::Long ScColumn::GetNeededSize( if (aCell.getType() == CELLTYPE_EDIT) { - pEngine->SetTextNewDefaults(*aCell.mpEditText, std::move(aSet)); + pEngine->SetTextNewDefaults(*aCell.getEditText(), std::move(aSet)); } else { diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 6c710d9ed22e..7fd63d2dfa27 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -307,7 +307,7 @@ void ScColumn::CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1, std::vector<EditTextObject*> aStrs; aStrs.reserve(nDestSize); for (size_t i = 0; i < nDestSize; ++i) - aStrs.push_back(rSrcCell.mpEditText->Clone().release()); + aStrs.push_back(rSrcCell.getEditText()->Clone().release()); pBlockPos->miCellPos = maCells.set(pBlockPos->miCellPos, nRow1, aStrs.begin(), aStrs.end()); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 90ea65ba1b0c..7a421292e661 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -747,8 +747,8 @@ static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rAr bVal = false; if (rCell.getType() == CELLTYPE_STRING) rArgStr = rCell.getSharedString()->getString(); - else if (rCell.mpEditText) - rArgStr = ScEditUtil::GetString(*rCell.mpEditText, pDoc); + else if (rCell.getEditText()) + rArgStr = ScEditUtil::GetString(*rCell.getEditText(), pDoc); break; default: ; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 3eb95c8eaeb9..1563a6af7e9f 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -978,7 +978,7 @@ ScCellValue ScCellIterator::getCellValue() const return ScCellValue(maCurCell.getSharedString()); break; case CELLTYPE_EDIT: - return ScCellValue(maCurCell.mpEditText->Clone()); + return ScCellValue(maCurCell.getEditText()->Clone()); break; case CELLTYPE_VALUE: return ScCellValue(maCurCell.getDouble()); diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 2da4ddfa53fb..94072cd2931f 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -1263,8 +1263,8 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, Transliteratio pEngine->SetDefaults( std::move(aDefaults) ); if (aCell.getType() == CELLTYPE_STRING) pEngine->SetTextCurrentDefaults(aCell.getSharedString()->getString()); - else if (aCell.mpEditText) - pEngine->SetTextCurrentDefaults(*aCell.mpEditText); + else if (aCell.getEditText()) + pEngine->SetTextCurrentDefaults(*aCell.getEditText()); pEngine->ClearModifyFlag(); diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index b091b99ff152..6134a53d032d 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -228,8 +228,7 @@ void ScDocumentImport::setAutoInput(const ScAddress& rPos, const OUString& rStr, break; case CELLTYPE_EDIT: // Cell takes the ownership of the text object. - pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rPos.Row(), aCell.mpEditText); - aCell.mpEditText = nullptr; + pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rPos.Row(), aCell.releaseEditText()); break; case CELLTYPE_VALUE: pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rPos.Row(), aCell.getDouble()); diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index f1027716f03e..5e7e58d0184f 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -736,7 +736,7 @@ void fillSortedColumnArray( break; case CELLTYPE_EDIT: assert(rCell.mpAttr); - rCellStore.push_back(rCell.maCell.mpEditText->Clone().release()); + rCellStore.push_back(rCell.maCell.getEditText()->Clone().release()); break; case CELLTYPE_FORMULA: { diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 8877e90d20e0..71e2c6aba984 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1918,7 +1918,7 @@ void ScTable::FillAutoSimple( if (aSrcCell.getType() == CELLTYPE_STRING) aValue = aSrcCell.getSharedString()->getString(); else - aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, &rDocument); + aValue = ScEditUtil::GetString(*aSrcCell.getEditText(), &rDocument); if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered ) { nCellDigits = 0; // look at each source cell individually @@ -2462,7 +2462,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (eCellType == CELLTYPE_STRING) aValue = aSrcCell.getSharedString()->getString(); else - aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, &rDocument); + aValue = ScEditUtil::GetString(*aSrcCell.getEditText(), &rDocument); sal_Int32 nStringValue; sal_uInt16 nMinDigits = nArgMinDigits; short nHeadNoneTail = lcl_DecompValueString( aValue, nStringValue, &nMinDigits ); diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index b478364ec871..29f7d7ef886b 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -90,7 +90,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum if ( eCellType == CELLTYPE_FORMULA ) aString = aCell.mpFormula->GetFormula(rDocument.GetGrammar()); else if ( eCellType == CELLTYPE_EDIT ) - bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, &rDocument, aString); + bMultiLine = lcl_GetTextWithBreaks(*aCell.getEditText(), &rDocument, aString); else { if( !bSearchFormatted ) @@ -102,7 +102,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum } case SvxSearchCellType::VALUE: if ( eCellType == CELLTYPE_EDIT ) - bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, &rDocument, aString); + bMultiLine = lcl_GetTextWithBreaks(*aCell.getEditText(), &rDocument, aString); else { if( !bSearchFormatted ) diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 4c8617a47c9e..3140a01c3978 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -583,8 +583,8 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos bIsVal = false; break; case CELLTYPE_EDIT: - if (rCell.mpEditText) - aString = ScEditUtil::GetString(*rCell.mpEditText, GetDocument()); + if (rCell.getEditText()) + aString = ScEditUtil::GetString(*rCell.getEditText(), GetDocument()); bIsVal = false; break; case CELLTYPE_FORMULA: diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index 7e75ced777ab..6c06d2e279f1 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -191,7 +191,7 @@ OUString ScCellFormat::GetOutputString( ScDocument& rDoc, const ScAddress& rPos, { // GetString converts line breaks into spaces in EditCell, // but here we need the line breaks - const EditTextObject* pData = rCell.mpEditText; + const EditTextObject* pData = rCell.getEditText(); if (pData) { ScFieldEditEngine& rEngine = rDoc.GetEditEngine(); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index d89f38dbb06d..d78070de6569 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -1566,8 +1566,8 @@ OUString ScChangeActionContent::GetStringOfCell( case CELLTYPE_STRING: return rCell.getSharedString()->getString(); case CELLTYPE_EDIT: - if (rCell.mpEditText) - return ScEditUtil::GetString(*rCell.mpEditText, pDoc); + if (rCell.getEditText()) + return ScEditUtil::GetString(*rCell.getEditText(), pDoc); return OUString(); case CELLTYPE_FORMULA: return rCell.mpFormula->GetFormula(); @@ -1707,8 +1707,8 @@ OUString ScChangeActionContent::GetValueString( case CELLTYPE_STRING : return rCell.getSharedString()->getString(); case CELLTYPE_EDIT : - if (rCell.mpEditText) - return ScEditUtil::GetString(*rCell.mpEditText, pDoc); + if (rCell.getEditText()) + return ScEditUtil::GetString(*rCell.getEditText(), pDoc); return OUString(); case CELLTYPE_VALUE : // Is always in rValue return rValue; diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 0df688d335bd..c2b7138f6d60 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2674,7 +2674,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : { XclExpHyperlinkHelper aLinkHelper( GetRoot(), aScPos ); xCell = new XclExpLabelCell( - GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpEditText, aLinkHelper); + GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.getEditText(), aLinkHelper); // add a single created HLINK record to the record list if( aLinkHelper.HasLinkRecord() ) diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index f4b68f471cc8..ac7141280a1f 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -177,7 +177,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, SCCOL nScCol, SCROW if( aCell.getType() == CELLTYPE_EDIT ) { - const EditTextObject* pEditObj = aCell.mpEditText; + const EditTextObject* pEditObj = aCell.getEditText(); rEE.SetTextCurrentDefaults( *pEditObj ); rEE.QuickInsertField( SvxFieldItem( aUrlField, EE_FEATURE_FIELD ), ESelection( 0, 0, EE_PARA_ALL, 0 ) ); } diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index eac7155dd2cc..d7e8ea2c7339 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1203,7 +1203,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC switch (aCell.getType()) { case CELLTYPE_EDIT : - bFieldText = WriteFieldText(aCell.mpEditText); + bFieldText = WriteFieldText(aCell.getEditText()); if ( bFieldText ) break; [[fallthrough]]; diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx index 685dcac9f348..7129049475e6 100644 --- a/sc/source/filter/rtf/rtfexp.cxx +++ b/sc/source/filter/rtf/rtfexp.cxx @@ -168,7 +168,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol ) case CELLTYPE_EDIT: { bValueData = false; - const EditTextObject* pObj = aCell.mpEditText; + const EditTextObject* pObj = aCell.getEditText(); EditEngine& rEngine = GetEditEngine(); rEngine.SetText(*pObj); aContent = rEngine.GetText(); // LineFeed in between paragraphs! diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index ed0a8c94a7c8..3ab4836a0b4b 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -877,11 +877,11 @@ void XclExpChTrCellContent::GetCellData( else { XclExpHyperlinkHelper aLinkHelper( rRoot, aPosition ); - if (rScCell.mpEditText) + if (rScCell.getEditText()) { - sCellStr = ScEditUtil::GetString(*rScCell.mpEditText, &GetDoc()); + sCellStr = ScEditUtil::GetString(*rScCell.getEditText(), &GetDoc()); rpData->mpFormattedString = XclExpStringHelper::CreateCellString( - rRoot, *rScCell.mpEditText, nullptr, aLinkHelper); + rRoot, *rScCell.getEditText(), nullptr, aLinkHelper); } else { diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx index 843b9a0a3d21..c3356ea79dff 100644 --- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx @@ -277,16 +277,16 @@ void ScChangeTrackingExportHelper::WriteEditCell(const ScCellValue& rCell) assert(rCell.getType() == CELLTYPE_EDIT); OUString sString; - if (rCell.mpEditText) - sString = ScEditUtil::GetString(*rCell.mpEditText, rExport.GetDocument()); + if (rCell.getEditText()) + sString = ScEditUtil::GetString(*rCell.getEditText(), rExport.GetDocument()); rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING); SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_CHANGE_TRACK_TABLE_CELL, true, true); - if (rCell.mpEditText && !sString.isEmpty()) + if (rCell.getEditText() && !sString.isEmpty()) { if (!pEditTextObj) pEditTextObj = new ScEditEngineTextObj(); - pEditTextObj->SetText(*rCell.mpEditText); + pEditTextObj->SetText(*rCell.getEditText()); rExport.GetTextParagraphExport()->exportText(pEditTextObj, false, false); } } @@ -591,7 +591,7 @@ void ScChangeTrackingExportHelper::CollectCellAutoStyles(const ScCellValue& rCel if (!pEditTextObj) pEditTextObj = new ScEditEngineTextObj(); - pEditTextObj->SetText(*rCell.mpEditText); + pEditTextObj->SetText(*rCell.getEditText()); rExport.GetTextParagraphExport()->collectTextAutoStyles(pEditTextObj, false, false); } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 6abd9a73a325..ea5a463b9ab5 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1275,7 +1275,7 @@ OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos ) { // GetString on EditCell replaces linebreaks with spaces; // however here we need line breaks - const EditTextObject* pData = aCell.mpEditText; + const EditTextObject* pData = aCell.getEditText(); EditEngine& rEngine = pDoc->GetEditEngine(); rEngine.SetText(*pData); return rEngine.GetText(); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index d896d7900403..7c69587ddb46 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -226,7 +226,7 @@ OUString lcl_GetFormattedString(ScDocument* pDoc, const ScRefCellValue& rCell, c } case CELLTYPE_EDIT: { - const EditTextObject* pData = rCell.mpEditText; + const EditTextObject* pData = rCell.getEditText(); if (!pData) return OUString(); @@ -3260,7 +3260,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) { if (aCell.maBaseCell.getType() == CELLTYPE_EDIT) { - WriteEditCell(aCell.maBaseCell.mpEditText); + WriteEditCell(aCell.maBaseCell.getEditText()); } else if (aCell.maBaseCell.getType() == CELLTYPE_FORMULA && aCell.maBaseCell.mpFormula->IsMultilineResult()) { diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 58723e438c72..3eb6f4f143e6 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -314,7 +314,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ScRefCellValue aCell(*m_pDoc, aPos); if (aCell.getType() == CELLTYPE_EDIT) { - const EditTextObject* pObj = aCell.mpEditText; + const EditTextObject* pObj = aCell.getEditText(); aEngine.SetTextCurrentDefaults(*pObj); } else diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 644afc8d14e6..23c43335365c 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2175,7 +2175,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt, break; case CELLTYPE_EDIT : { - const EditTextObject* pObj = pCell->mpEditText; + const EditTextObject* pObj = pCell->getEditText(); EditEngine& rEngine = m_pDocument->GetEditEngine(); rEngine.SetText( *pObj); aString = rEngine.GetText(); // including LF diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 7974eb330d74..b4b4282fe432 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -706,10 +706,10 @@ void lcl_GetColumnTypes( void lcl_getLongVarCharEditString( OUString& rString, const ScRefCellValue& rCell, ScFieldEditEngine& rEditEngine ) { - if (!rCell.mpEditText) + if (!rCell.getEditText()) return; - rEditEngine.SetTextCurrentDefaults(*rCell.mpEditText); + rEditEngine.SetTextCurrentDefaults(*rCell.getEditText()); rString = rEditEngine.GetText( LINEEND_CRLF ); } diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 6690c05c5a3b..80f4298ce1bb 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -468,7 +468,7 @@ void ScUndoSetCell::SetValue( const ScCellValue& rVal ) } break; case CELLTYPE_EDIT: - rDoc.SetEditText(maPos, rVal.mpEditText->Clone()); + rDoc.SetEditText(maPos, rVal.getEditText()->Clone()); break; case CELLTYPE_FORMULA: rDoc.SetFormulaCell(maPos, rVal.mpFormula->Clone()); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 14974b4beea3..1d30e76aa6ee 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1347,7 +1347,7 @@ static OUString lcl_GetInputString( ScDocument& rDoc, const ScAddress& rPos, boo { // GetString on EditCell turns breaks into spaces, // but we need the breaks here - const EditTextObject* pData = aCell.mpEditText; + const EditTextObject* pData = aCell.getEditText(); if (pData) { EditEngine& rEngine = rDoc.GetEditEngine(); diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 413bb3e3685e..a0afb447c464 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -817,7 +817,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() ScRefCellValue aCell(rDoc, aCellPos); if (aCell.getType() == CELLTYPE_EDIT) { - const EditTextObject* pObj = aCell.mpEditText; + const EditTextObject* pObj = aCell.getEditText(); pEditEngine->SetTextNewDefaults(*pObj, aDefaults); } else diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 753b79763038..3bab80f8e94e 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5720,8 +5720,8 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, std::unique_ptr<EditTextObject> pTextObj; if (aCell.getType() == CELLTYPE_EDIT) { - if (aCell.mpEditText) - pEngine->SetTextCurrentDefaults(*aCell.mpEditText); + if (aCell.getEditText()) + pEngine->SetTextCurrentDefaults(*aCell.getEditText()); } else // Not an Edit cell and is a formula cell with 'Hyperlink' // function if we have no URL, otherwise it could be a formula diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index a879923f9ca4..64bb99ffc098 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -2380,7 +2380,7 @@ bool ScOutputData::DrawEditParam::readCellContent( { if (maCell.getType() == CELLTYPE_EDIT) { - const EditTextObject* pData = maCell.mpEditText; + const EditTextObject* pData = maCell.getEditText(); if (pData) { mpEngine->SetTextCurrentDefaults(*pData); @@ -2699,7 +2699,7 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() // We need to synchronize the vertical mode in the EditTextObject // instance too. No idea why we keep this state in two separate // instances. - const EditTextObject* pData = maCell.mpEditText; + const EditTextObject* pData = maCell.getEditText(); if (pData) const_cast<EditTextObject*>(pData)->SetVertical(mbAsianVertical); } @@ -4732,8 +4732,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) if (aCell.getType() == CELLTYPE_EDIT) { - if (aCell.mpEditText) - pEngine->SetTextCurrentDefaults(*aCell.mpEditText); + if (aCell.getEditText()) + pEngine->SetTextCurrentDefaults(*aCell.getEditText()); else { OSL_FAIL("pData == 0"); diff --git a/sc/source/ui/view/spellcheckcontext.cxx b/sc/source/ui/view/spellcheckcontext.cxx index 1b29c17371af..b18483aa8817 100644 --- a/sc/source/ui/view/spellcheckcontext.cxx +++ b/sc/source/ui/view/spellcheckcontext.cxx @@ -330,7 +330,7 @@ void SpellCheckContext::ensureResults(SCCOL nCol, SCROW nRow) if (eType == CELLTYPE_STRING) mpEngine->SetText(aCell.getSharedString()->getString()); else - mpEngine->SetText(*aCell.mpEditText); + mpEngine->SetText(*aCell.getEditText()); // it has to happen after we set text mpEngine->SetDefaultItem(SvxLanguageItem(eCellLang, EE_CHAR_LANGUAGE)); diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index db5fa22303f4..1ce5cb65fdd1 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -291,7 +291,7 @@ void ScConversionEngineBase::FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) break; case CELLTYPE_EDIT: { - const EditTextObject* pNewEditObj = aCell.mpEditText; + const EditTextObject* pNewEditObj = aCell.getEditText(); SetTextCurrentDefaults(*pNewEditObj); } break; diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index f02c0dec9aa6..461f31ff7d08 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -712,7 +712,7 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt } else if (rCell.getType() == CELLTYPE_EDIT) { - pObject = rCell.mpEditText; + pObject = rCell.getEditText(); } else { diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index afc5dd00e1d7..8db1f1e2c85b 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -371,7 +371,7 @@ void ScViewFunc::DoThesaurus() } if (aOldText.getType() == CELLTYPE_EDIT) - pThesaurusEngine->SetTextCurrentDefaults(*aOldText.mpEditText); + pThesaurusEngine->SetTextCurrentDefaults(*aOldText.getEditText()); else pThesaurusEngine->SetTextCurrentDefaults(aOldText.getString(rDoc)); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 4046b212120f..c1c003205828 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1266,7 +1266,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor ScRefCellValue aCell(rDoc, aPos); if (aCell.getType() == CELLTYPE_EDIT) { - const EditTextObject* pEditObj = aCell.mpEditText; + const EditTextObject* pEditObj = aCell.getEditText(); pOldEditData = pEditObj->Clone(); rDoc.RemoveEditTextCharAttribs(aPos, rAttr); pEditObj = rDoc.GetEditText(aPos); |