sw: prefix members of SwXCell

See tdf#94879 for motivation.

Change-Id: I209fe0474fc9275052da389455cca26cd4c9f47a
Reviewed-on: https://gerrit.libreoffice.org/75609
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 07d525a..a18ff25 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -65,12 +65,12 @@ class SwXCell final : public SwXCellBaseClass,
    friend void   sw_setValue( SwXCell &rCell, double nVal );

    const SfxItemPropertySet*   m_pPropSet;
    SwTableBox*                 pBox;       // only set in non-XML import
    const SwStartNode*      pStartNode; // only set in XML import
    SwTableBox*                 m_pBox;       // only set in non-XML import
    const SwStartNode*      m_pStartNode; // only set in XML import
    SwFrameFormat* m_pTableFormat;

    // table position where pBox was found last
    size_t nFndPos;
    size_t m_nFndPos;
    css::uno::Reference<css::text::XText> m_xParentText;
    static size_t const NOTFOUND = SAL_MAX_SIZE;

@@ -140,7 +140,7 @@ public:
    virtual css::uno::Type SAL_CALL getElementType(  ) override;
    virtual sal_Bool SAL_CALL hasElements(  ) override;

    SwTableBox* GetTableBox() const { return pBox; }
    SwTableBox* GetTableBox() const { return m_pBox; }
    static SwXCell* CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr );
    SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox);
    SwFrameFormat* GetFrameFormat() const { return m_pTableFormat; }
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 3fdb6fa..06afc42 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -688,7 +688,7 @@ void sw_setString( SwXCell &rCell, const OUString &rText,
{
    if(rCell.IsValid())
    {
        SwFrameFormat* pBoxFormat = rCell.pBox->ClaimFrameFormat();
        SwFrameFormat* pBoxFormat = rCell.m_pBox->ClaimFrameFormat();
        pBoxFormat->LockModify();
        pBoxFormat->ResetFormatAttr( RES_BOXATR_FORMULA );
        pBoxFormat->ResetFormatAttr( RES_BOXATR_VALUE );
@@ -706,12 +706,12 @@ void sw_setValue( SwXCell &rCell, double nVal )
    if(!rCell.IsValid())
        return;
    // first this text (maybe) needs to be deleted
    sal_uLong nNdPos = rCell.pBox->IsValidNumTextNd();
    sal_uLong nNdPos = rCell.m_pBox->IsValidNumTextNd();
    if(ULONG_MAX != nNdPos)
        sw_setString( rCell, OUString(), true );   // true == keep number format
    SwDoc* pDoc = rCell.GetDoc();
    UnoActionContext aAction(pDoc);
    SwFrameFormat* pBoxFormat = rCell.pBox->ClaimFrameFormat();
    SwFrameFormat* pBoxFormat = rCell.m_pBox->ClaimFrameFormat();
    SfxItemSet aSet(pDoc->GetAttrPool(), svl::Items<RES_BOXATR_FORMAT, RES_BOXATR_VALUE>{});
    const SfxPoolItem* pItem;

@@ -726,7 +726,7 @@ void sw_setValue( SwXCell &rCell, double nVal )

    SwTableBoxValue aVal(nVal);
    aSet.Put(aVal);
    pDoc->SetTableBoxFormulaAttrs( *rCell.pBox, aSet );
    pDoc->SetTableBoxFormulaAttrs( *rCell.m_pBox, aSet );
    // update table
    SwTableFormulaUpdate aTableUpdate( SwTable::FindTable( rCell.GetFrameFormat() ));
    pDoc->getIDocumentFieldsAccess().UpdateTableFields( &aTableUpdate );
@@ -736,10 +736,10 @@ void sw_setValue( SwXCell &rCell, double nVal )
SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos) :
    SwXText(pTableFormat->GetDoc(), CursorType::TableText),
    m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
    pBox(pBx),
    pStartNode(nullptr),
    m_pBox(pBx),
    m_pStartNode(nullptr),
    m_pTableFormat(pTableFormat),
    nFndPos(nPos)
    m_nFndPos(nPos)
{
    StartListening(pTableFormat->GetNotifier());
}
@@ -747,10 +747,10 @@ SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos
SwXCell::SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode) :
    SwXText(pTableFormat->GetDoc(), CursorType::TableText),
    m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
    pBox(nullptr),
    pStartNode(&rStartNode),
    m_pBox(nullptr),
    m_pStartNode(&rStartNode),
    m_pTableFormat(pTableFormat),
    nFndPos(NOTFOUND)
    m_nFndPos(NOTFOUND)
{
    StartListening(pTableFormat->GetNotifier());
}
@@ -820,8 +820,8 @@ const SwStartNode *SwXCell::GetStartNode() const
{
    const SwStartNode* pSttNd = nullptr;

    if( pStartNode || IsValid() )
        pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
    if( m_pStartNode || IsValid() )
        pSttNd = m_pStartNode ? m_pStartNode : m_pBox->GetSttNd();

    return pSttNd;
}
@@ -836,22 +836,22 @@ bool SwXCell::IsValid() const
{
    // FIXME: this is now a const method, to make SwXText::IsValid invisible
    // but the const_cast here are still ridiculous. TODO: find a better way.
    SwFrameFormat* pTableFormat = pBox ? GetFrameFormat() : nullptr;
    SwFrameFormat* pTableFormat = m_pBox ? GetFrameFormat() : nullptr;
    if(!pTableFormat)
    {
        const_cast<SwXCell*>(this)->pBox = nullptr;
        const_cast<SwXCell*>(this)->m_pBox = nullptr;
    }
    else
    {
        SwTable* pTable = SwTable::FindTable( pTableFormat );
        SwTableBox const*const pFoundBox =
            const_cast<SwXCell*>(this)->FindBox(pTable, pBox);
            const_cast<SwXCell*>(this)->FindBox(pTable, m_pBox);
        if (!pFoundBox)
        {
            const_cast<SwXCell*>(this)->pBox = nullptr;
            const_cast<SwXCell*>(this)->m_pBox = nullptr;
        }
    }
    return nullptr != pBox;
    return nullptr != m_pBox;
}

OUString SwXCell::getFormula()
@@ -859,7 +859,7 @@ OUString SwXCell::getFormula()
    SolarMutexGuard aGuard;
    if(!IsValid())
        return OUString();
    SwTableBoxFormula aFormula( pBox->GetFrameFormat()->GetTableBoxFormula() );
    SwTableBoxFormula aFormula( m_pBox->GetFrameFormat()->GetTableBoxFormula() );
    SwTable* pTable = SwTable::FindTable( GetFrameFormat() );
    aFormula.PtrToBoxNm( pTable );
    return aFormula.GetFormula();
@@ -872,7 +872,7 @@ void SwXCell::setFormula(const OUString& rFormula)
    if(!IsValid())
        return;
    // first this text (maybe) needs to be deleted
    sal_uInt32 nNdPos = pBox->IsValidNumTextNd();
    sal_uInt32 nNdPos = m_pBox->IsValidNumTextNd();
    if(USHRT_MAX == nNdPos)
        sw_setString( *this, OUString(), true );
    OUString sFormula(comphelper::string::stripStart(rFormula, ' '));
@@ -883,14 +883,14 @@ void SwXCell::setFormula(const OUString& rFormula)
    UnoActionContext aAction(pMyDoc);
    SfxItemSet aSet(pMyDoc->GetAttrPool(), svl::Items<RES_BOXATR_FORMAT, RES_BOXATR_FORMULA>{});
    const SfxPoolItem* pItem;
    SwFrameFormat* pBoxFormat = pBox->GetFrameFormat();
    SwFrameFormat* pBoxFormat = m_pBox->GetFrameFormat();
    if(SfxItemState::SET != pBoxFormat->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, true, &pItem)
        ||  pMyDoc->GetNumberFormatter()->IsTextFormat(static_cast<const SwTableBoxNumFormat*>(pItem)->GetValue()))
    {
        aSet.Put(SwTableBoxNumFormat(0));
    }
    aSet.Put(aFormula);
    GetDoc()->SetTableBoxFormulaAttrs( *pBox, aSet );
    GetDoc()->SetTableBoxFormulaAttrs( *m_pBox, aSet );
    // update table
    SwTableFormulaUpdate aTableUpdate( SwTable::FindTable( GetFrameFormat() ));
    pMyDoc->getIDocumentFieldsAccess().UpdateTableFields( &aTableUpdate );
@@ -902,7 +902,7 @@ double SwXCell::getValue()
    // #i112652# a table cell may contain NaN as a value, do not filter that
    double fRet;
    if(IsValid() && !getString().isEmpty())
        fRet = pBox->GetFrameFormat()->GetTableBoxValue().GetValue();
        fRet = m_pBox->GetFrameFormat()->GetTableBoxValue().GetValue();
    else
        ::rtl::math::setNan( &fRet );
    return fRet;
@@ -919,7 +919,7 @@ table::CellContentType SwXCell::getType()
    SolarMutexGuard aGuard;

    table::CellContentType nRes = table::CellContentType_EMPTY;
    sal_uInt32 nNdPos = pBox->IsFormulaOrValueBox();
    sal_uInt32 nNdPos = m_pBox->IsFormulaOrValueBox();
    switch (nNdPos)
    {
        case 0 :                    nRes = table::CellContentType_TEXT; break;
@@ -948,9 +948,9 @@ sal_Int32 SwXCell::getError()
uno::Reference<text::XTextCursor> SwXCell::createTextCursor()
{
    SolarMutexGuard aGuard;
    if(!pStartNode && !IsValid())
    if(!m_pStartNode && !IsValid())
        throw uno::RuntimeException();
    const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
    const SwStartNode* pSttNd = m_pStartNode ? m_pStartNode : m_pBox->GetSttNd();
    SwPosition aPos(*pSttNd);
    SwXTextCursor* const pXCursor =
        new SwXTextCursor(*GetDoc(), this, CursorType::TableText, aPos);
@@ -963,9 +963,9 @@ uno::Reference<text::XTextCursor> SwXCell::createTextCursorByRange(const uno::Re
{
    SolarMutexGuard aGuard;
    SwUnoInternalPaM aPam(*GetDoc());
    if((!pStartNode && !IsValid()) || !::sw::XTextRangeToSwPaM(aPam, xTextPosition))
    if((!m_pStartNode && !IsValid()) || !::sw::XTextRangeToSwPaM(aPam, xTextPosition))
        throw uno::RuntimeException();
    const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
    const SwStartNode* pSttNd = m_pStartNode ? m_pStartNode : m_pBox->GetSttNd();
    // skip sections
    SwStartNode* p1 = aPam.GetNode().StartOfSectionNode();
    while(p1->IsSectionNode())
@@ -994,7 +994,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
        SvxFrameDirection eDir = SvxFrameDirection::Environment;
        SvxFrameDirectionItem aItem(eDir, RES_FRAMEDIR);
        aItem.PutValue(aValue, 0);
        pBox->GetFrameFormat()->SetFormatAttr(aItem);
        m_pBox->GetFrameFormat()->SetFormatAttr(aItem);
    }
    else if(rPropertyName == "TableRedlineParams")
    {
@@ -1006,7 +1006,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
            throw beans::UnknownPropertyException("No redline type property: ", static_cast<cppu::OWeakObject*>(this));

        // Create a 'Table Cell Redline' object
        SwUnoCursorHelper::makeTableCellRedline(*pBox, sRedlineType, tableCellProperties);
        SwUnoCursorHelper::makeTableCellRedline(*m_pBox, sRedlineType, tableCellProperties);


    }
@@ -1047,13 +1047,13 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
            throw beans::UnknownPropertyException(rPropertyName, static_cast<cppu::OWeakObject*>(this));
        if(pEntry->nWID != FN_UNO_CELL_ROW_SPAN)
        {
            SwFrameFormat* pBoxFormat = pBox->ClaimFrameFormat();
            SwFrameFormat* pBoxFormat = m_pBox->ClaimFrameFormat();
            SwAttrSet aSet(pBoxFormat->GetAttrSet());
            m_pPropSet->setPropertyValue(rPropertyName, aValue, aSet);
            pBoxFormat->GetDoc()->SetAttr(aSet, *pBoxFormat);
        }
        else if(aValue.isExtractableTo(cppu::UnoType<sal_Int32>::get()))
            pBox->setRowSpan(aValue.get<sal_Int32>());
            m_pBox->setRowSpan(aValue.get<sal_Int32>());
    }
}

@@ -1068,7 +1068,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
    switch(pEntry->nWID)
    {
        case FN_UNO_CELL_ROW_SPAN:
            return uno::makeAny(pBox->getRowSpan());
            return uno::makeAny(m_pBox->getRowSpan());
        break;
        case FN_UNO_TEXT_SECTION:
        {
@@ -1083,7 +1083,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
        }
        break;
        case FN_UNO_CELL_NAME:
            return uno::makeAny(pBox->GetName());
            return uno::makeAny(m_pBox->GetName());
        break;
        case FN_UNO_REDLINE_NODE_START:
        case FN_UNO_REDLINE_NODE_END:
@@ -1096,7 +1096,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
        {
            if (!m_xParentText.is())
            {
                const SwStartNode* pSttNd = pBox->GetSttNd();
                const SwStartNode* pSttNd = m_pBox->GetSttNd();
                if (!pSttNd)
                    return uno::Any();

@@ -1117,7 +1117,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
        break;
        default:
        {
            const SwAttrSet& rSet = pBox->GetFrameFormat()->GetAttrSet();
            const SwAttrSet& rSet = m_pBox->GetFrameFormat()->GetAttrSet();
            uno::Any aResult;
            m_pPropSet->getPropertyValue(rPropertyName, rSet, aResult);
            return aResult;
@@ -1142,7 +1142,7 @@ uno::Reference<container::XEnumeration> SwXCell::createEnumeration()
    SolarMutexGuard aGuard;
    if(!IsValid())
        return uno::Reference<container::XEnumeration>();
    const SwStartNode* pSttNd = pBox->GetSttNd();
    const SwStartNode* pSttNd = m_pBox->GetSttNd();
    SwPosition aPos(*pSttNd);
    auto pUnoCursor(GetDoc()->CreateUnoCursor(aPos));
    pUnoCursor->Move(fnMoveForward, GoInNode);
@@ -1199,20 +1199,20 @@ SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwT
SwTableBox* SwXCell::FindBox(SwTable* pTable, SwTableBox* pBox2)
{
    // check if nFndPos happens to point to the right table box
    if( nFndPos < pTable->GetTabSortBoxes().size() &&
        pBox2 == pTable->GetTabSortBoxes()[ nFndPos ] )
    if( m_nFndPos < pTable->GetTabSortBoxes().size() &&
        pBox2 == pTable->GetTabSortBoxes()[ m_nFndPos ] )
        return pBox2;

    // if not, seek the entry (and return, if successful)
    SwTableSortBoxes::const_iterator it = pTable->GetTabSortBoxes().find( pBox2 );
    if( it != pTable->GetTabSortBoxes().end() )
    {
        nFndPos = it - pTable->GetTabSortBoxes().begin();
        m_nFndPos = it - pTable->GetTabSortBoxes().begin();
        return pBox2;
    }

    // box not found: reset nFndPos pointer
    nFndPos = NOTFOUND;
    m_nFndPos = NOTFOUND;
    return nullptr;
}

@@ -1260,10 +1260,10 @@ double SwXCell::GetForcedNumericalValue() const

uno::Any SwXCell::GetAny() const
{
    if(!pBox)
    if(!m_pBox)
        throw uno::RuntimeException();
    // check if table box value item is set
    auto pBoxFormat(pBox->GetFrameFormat());
    auto pBoxFormat(m_pBox->GetFrameFormat());
    const bool bIsNum = pBoxFormat->GetItemState(RES_BOXATR_VALUE, false) == SfxItemState::SET;
    return bIsNum ? uno::makeAny(getValue()) : uno::makeAny(const_cast<SwXCell*>(this)->getString());
}