tdf#129993 broken tables opening LWP file

regression from
    commit e2080e70fe
    new compilerplugin returnbyref

The parts that fix this specific bug are in lwprowlayout.cxx and
lwprowlayout.cxx, but fix the other parts I messed up but not
understanding the semantics of assigning to reference variables.

Change-Id: I064cdd108c5b05da6092da0297dc7bcf487c7702
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87686
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-01-29 16:04:27 +02:00
parent 41a83d3207
commit 0b113d6ebb
6 changed files with 80 additions and 80 deletions

View File

@@ -114,15 +114,15 @@ void LwpFnRowLayout::Read()
void LwpFnRowLayout::RegisterStyle() void LwpFnRowLayout::RegisterStyle()
{ {
// register cells' style // register cells' style
LwpObjectID& rCellID = GetChildHead(); LwpObjectID* pCellID = &GetChildHead();
LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
while(pCellLayout) while(pCellLayout)
{ {
pCellLayout->SetFoundry(m_pFoundry); pCellLayout->SetFoundry(m_pFoundry);
pCellLayout->RegisterStyle(); pCellLayout->RegisterStyle();
rCellID = pCellLayout->GetNext(); pCellID = &pCellLayout->GetNext();
pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
} }
} }
@@ -194,15 +194,15 @@ void LwpEndnoteLayout::Read()
void LwpEndnoteLayout::RegisterStyle() void LwpEndnoteLayout::RegisterStyle()
{ {
// register style of rows // register style of rows
LwpObjectID& rRowID = GetChildHead(); LwpObjectID* pRowID = &GetChildHead();
LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
while (pRowLayout) while (pRowLayout)
{ {
pRowLayout->SetFoundry(m_pFoundry); pRowLayout->SetFoundry(m_pFoundry);
pRowLayout->RegisterStyle(); pRowLayout->RegisterStyle();
rRowID = pRowLayout->GetNext(); pRowID = &pRowLayout->GetNext();
pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
} }
} }
@@ -254,12 +254,12 @@ void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
*/ */
LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout() LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout()
{ {
LwpObjectID& rID = GetChildTail(); LwpObjectID *pID = &GetChildTail();
LwpVirtualLayout *pPrevLayout = nullptr; LwpVirtualLayout *pPrevLayout = nullptr;
while(!rID.IsNull()) while(!pID->IsNull())
{ {
LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(rID.obj().get()); LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get());
if (!pLayout || pLayout == pPrevLayout) if (!pLayout || pLayout == pPrevLayout)
{ {
break; break;
@@ -268,7 +268,7 @@ LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout()
{ {
return pLayout; return pLayout;
} }
rID = pLayout->GetPrevious(); pID = &pLayout->GetPrevious();
pPrevLayout = pLayout; pPrevLayout = pLayout;
} }
@@ -312,11 +312,11 @@ void LwpFnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
*/ */
LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout() LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
{ {
LwpObjectID& rID = GetChildTail(); LwpObjectID *pID = &GetChildTail();
while(!rID.IsNull()) while(pID && !pID->IsNull())
{ {
LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get()); LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get());
if(!pLayout) if(!pLayout)
{ {
break; break;
@@ -325,7 +325,7 @@ LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
{ {
return pLayout; return pLayout;
} }
rID = pLayout->GetPrevious(); pID = &pLayout->GetPrevious();
} }
return nullptr; return nullptr;

View File

@@ -216,15 +216,15 @@ LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker)
if (!pHeadHolder) if (!pHeadHolder)
return nullptr; return nullptr;
LwpObjectID& rObjID = pHeadHolder->GetHeadID(); LwpObjectID* pObjID = &pHeadHolder->GetHeadID();
LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get()); LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(pObjID->obj().get());
while (pBookMark) while (pBookMark)
{ {
if (pBookMark->IsRightMarker(objMarker)) if (pBookMark->IsRightMarker(objMarker))
return pBookMark; return pBookMark;
rObjID = pBookMark->GetNext(); pObjID = &pBookMark->GetNext();
pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get()); pBookMark = dynamic_cast<LwpBookMark*>(pObjID->obj().get());
} }
return nullptr; return nullptr;
} }

View File

@@ -383,12 +383,12 @@ bool LwpVirtualLayout::IsStyleLayout()
*/ */
LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType) LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
{ {
LwpObjectID& rID = GetChildHead(); LwpObjectID *pID = &GetChildHead();
LwpVirtualLayout* pPrevLayout = nullptr; LwpVirtualLayout* pPrevLayout = nullptr;
while(!rID.IsNull()) while(pID && !pID->IsNull())
{ {
LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get()); LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get());
if (!pLayout) if (!pLayout)
break; break;
@@ -403,7 +403,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
if (pLayout->GetLayoutType() == eType) if (pLayout->GetLayoutType() == eType)
return pLayout; return pLayout;
rID = pLayout->GetNext(); pID = &pLayout->GetNext();
} }
return nullptr; return nullptr;

View File

@@ -93,8 +93,8 @@ LwpRowLayout::~LwpRowLayout()
*/ */
void LwpRowLayout::SetRowMap() void LwpRowLayout::SetRowMap()
{ {
LwpObjectID& rCellID= GetChildHead(); LwpObjectID *pCellID= &GetChildHead();
LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
std::set<LwpCellLayout*> aSeen; std::set<LwpCellLayout*> aSeen;
while(pCellLayout) while(pCellLayout)
@@ -102,8 +102,8 @@ void LwpRowLayout::SetRowMap()
aSeen.insert(pCellLayout); aSeen.insert(pCellLayout);
pCellLayout->SetCellMap(); pCellLayout->SetCellMap();
rCellID = pCellLayout->GetNext(); pCellID = &pCellLayout->GetNext();
pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
if (aSeen.find(pCellLayout) != aSeen.end()) if (aSeen.find(pCellLayout) != aSeen.end())
throw std::runtime_error("loop in conversion"); throw std::runtime_error("loop in conversion");
} }
@@ -137,8 +137,8 @@ void LwpRowLayout::RegisterStyle()
pTableLayout->GetTable(); pTableLayout->GetTable();
} }
// register cells' style // register cells' style
LwpObjectID& rCellID= GetChildHead(); LwpObjectID *pCellID= &GetChildHead();
LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
std::set<LwpCellLayout*> aSeen; std::set<LwpCellLayout*> aSeen;
while (pCellLayout) while (pCellLayout)
@@ -147,8 +147,8 @@ void LwpRowLayout::RegisterStyle()
pCellLayout->SetFoundry(m_pFoundry); pCellLayout->SetFoundry(m_pFoundry);
pCellLayout->RegisterStyle(); pCellLayout->RegisterStyle();
rCellID = pCellLayout->GetNext(); pCellID = &pCellLayout->GetNext();
pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
if (aSeen.find(pCellLayout) != aSeen.end()) if (aSeen.find(pCellLayout) != aSeen.end())
throw std::runtime_error("loop in conversion"); throw std::runtime_error("loop in conversion");
@@ -387,8 +387,8 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
for (sal_uInt8 i = nStartCol; i < nEndCol ; i++) for (sal_uInt8 i = nStartCol; i < nEndCol ; i++)
{ {
// add row to table // add row to table
LwpObjectID& rCellID= GetChildHead(); LwpObjectID *pCellID= &GetChildHead();
LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
nCellStartCol = i;//mark the begin position of cell nCellStartCol = i;//mark the begin position of cell
nCellEndCol = i;//mark the end position of cell nCellEndCol = i;//mark the end position of cell
rtl::Reference<XFCell> xCell; rtl::Reference<XFCell> xCell;
@@ -405,8 +405,8 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
xCell = pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i); xCell = pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i);
break; break;
} }
rCellID = pCellLayout->GetNext(); pCellID = &pCellLayout->GetNext();
pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
} }
if (!pCellLayout) if (!pCellLayout)
{ {
@@ -436,8 +436,8 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
*/ */
void LwpRowLayout::CollectMergeInfo() void LwpRowLayout::CollectMergeInfo()
{ {
LwpObjectID& rCellID= GetChildHead(); LwpObjectID *pCellID= &GetChildHead();
LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
while(pCellLayout) while(pCellLayout)
{ {
@@ -446,8 +446,8 @@ void LwpRowLayout::CollectMergeInfo()
LwpConnectedCellLayout* pConnCell = static_cast<LwpConnectedCellLayout*>(pCellLayout); LwpConnectedCellLayout* pConnCell = static_cast<LwpConnectedCellLayout*>(pCellLayout);
m_ConnCellList.push_back(pConnCell); m_ConnCellList.push_back(pConnCell);
} }
rCellID = pCellLayout->GetNext(); pCellID = &pCellLayout->GetNext();
pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get());
} }
} }
/** /**

View File

@@ -109,11 +109,11 @@ void LwpSuperTableLayout::Read()
*/ */
LwpTableLayout* LwpSuperTableLayout::GetTableLayout() LwpTableLayout* LwpSuperTableLayout::GetTableLayout()
{ {
LwpObjectID& rID = GetChildTail(); LwpObjectID *pID = &GetChildTail();
while(!rID.IsNull()) while(pID && !pID->IsNull())
{ {
LwpLayout* pLayout = dynamic_cast<LwpLayout*>(rID.obj().get()); LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pID->obj().get());
if (!pLayout) if (!pLayout)
{ {
break; break;
@@ -122,7 +122,7 @@ LwpTableLayout* LwpSuperTableLayout::GetTableLayout()
{ {
return dynamic_cast<LwpTableLayout *>(pLayout); return dynamic_cast<LwpTableLayout *>(pLayout);
} }
rID = pLayout->GetPrevious(); pID = &pLayout->GetPrevious();
} }
return nullptr; return nullptr;
@@ -133,11 +133,11 @@ LwpTableLayout* LwpSuperTableLayout::GetTableLayout()
*/ */
LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout() LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout()
{ {
LwpObjectID& rID = GetChildTail(); LwpObjectID *pID = &GetChildTail();
while(!rID.IsNull()) while(pID && !pID->IsNull())
{ {
LwpLayout * pLayout = dynamic_cast<LwpLayout *>(rID.obj().get()); LwpLayout * pLayout = dynamic_cast<LwpLayout *>(pID->obj().get());
if (!pLayout) if (!pLayout)
{ {
break; break;
@@ -147,7 +147,7 @@ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout()
{ {
return dynamic_cast<LwpTableHeadingLayout *>(pLayout); return dynamic_cast<LwpTableHeadingLayout *>(pLayout);
} }
rID = pLayout->GetPrevious(); pID = &pLayout->GetPrevious();
} }
return nullptr; return nullptr;
@@ -229,8 +229,8 @@ double LwpSuperTableLayout::GetTableWidth()
for(sal_uInt16 i =0; i< nCol; i++) for(sal_uInt16 i =0; i< nCol; i++)
{ {
LwpObjectID& rColumnID = pTableLayout->GetColumnLayoutHead(); LwpObjectID *pColumnID = &pTableLayout->GetColumnLayoutHead();
LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
double dColumnWidth = dDefaultWidth; double dColumnWidth = dDefaultWidth;
std::set<LwpColumnLayout*> aSeen; std::set<LwpColumnLayout*> aSeen;
while (pColumnLayout) while (pColumnLayout)
@@ -241,8 +241,8 @@ double LwpSuperTableLayout::GetTableWidth()
dColumnWidth = pColumnLayout->GetWidth(); dColumnWidth = pColumnLayout->GetWidth();
break; break;
} }
rColumnID = pColumnLayout->GetNext(); pColumnID = &pColumnLayout->GetNext();
pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
if (aSeen.find(pColumnLayout) != aSeen.end()) if (aSeen.find(pColumnLayout) != aSeen.end())
throw std::runtime_error("loop in conversion"); throw std::runtime_error("loop in conversion");
} }
@@ -450,8 +450,8 @@ void LwpTableLayout::TraverseTable()
m_WordProCellsMap.insert(m_WordProCellsMap.end(), nCount, m_pDefaultCellLayout); m_WordProCellsMap.insert(m_WordProCellsMap.end(), nCount, m_pDefaultCellLayout);
// set value // set value
LwpObjectID& rRowID = GetChildHead(); LwpObjectID* pRowID = &GetChildHead();
LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
std::set<LwpRowLayout*> aSeen; std::set<LwpRowLayout*> aSeen;
while (pRowLayout) while (pRowLayout)
{ {
@@ -464,8 +464,8 @@ void LwpTableLayout::TraverseTable()
pRowLayout->CollectMergeInfo(); pRowLayout->CollectMergeInfo();
// end for 's analysis // end for 's analysis
rRowID = pRowLayout->GetNext(); pRowID = &pRowLayout->GetNext();
pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
if (aSeen.find(pRowLayout) != aSeen.end()) if (aSeen.find(pRowLayout) != aSeen.end())
throw std::runtime_error("loop in conversion"); throw std::runtime_error("loop in conversion");
} }
@@ -569,8 +569,8 @@ void LwpTableLayout::RegisterColumns()
// Get total width of justifiable columns // Get total width of justifiable columns
// NOTICE: all default columns are regarded as justifiable columns // NOTICE: all default columns are regarded as justifiable columns
LwpObjectID& rColumnID = GetColumnLayoutHead(); LwpObjectID* pColumnID = &GetColumnLayoutHead();
LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
std::set<LwpColumnLayout*> aSeen; std::set<LwpColumnLayout*> aSeen;
while (pColumnLayout) while (pColumnLayout)
{ {
@@ -589,8 +589,8 @@ void LwpTableLayout::RegisterColumns()
nJustifiableColumn --; nJustifiableColumn --;
} }
rColumnID = pColumnLayout->GetNext(); pColumnID = &pColumnLayout->GetNext();
pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get());
if (aSeen.find(pColumnLayout) != aSeen.end()) if (aSeen.find(pColumnLayout) != aSeen.end())
throw std::runtime_error("loop in conversion"); throw std::runtime_error("loop in conversion");
@@ -670,15 +670,15 @@ void LwpTableLayout::RegisterRows()
m_DefaultRowStyleName = pXFStyleManager->AddStyle(std::move(xRowStyle)).m_pStyle->GetStyleName(); m_DefaultRowStyleName = pXFStyleManager->AddStyle(std::move(xRowStyle)).m_pStyle->GetStyleName();
// register style of rows // register style of rows
LwpObjectID& rRowID = GetChildHead(); LwpObjectID * pRowID = &GetChildHead();
LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
while (pRowLayout) while (pRowLayout)
{ {
pRowLayout->SetFoundry(m_pFoundry); pRowLayout->SetFoundry(m_pFoundry);
pRowLayout->RegisterStyle(); pRowLayout->RegisterStyle();
rRowID = pRowLayout->GetNext(); pRowID = &pRowLayout->GetNext();
pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
} }
} }
/** /**
@@ -1274,8 +1274,8 @@ void LwpTableLayout::ConvertColumn(rtl::Reference<XFTable> const & pXFTable, sal
for (sal_uInt32 iLoop = 0; iLoop < static_cast<sal_uInt32>(nEndCol)-nStartCol; ++iLoop) for (sal_uInt32 iLoop = 0; iLoop < static_cast<sal_uInt32>(nEndCol)-nStartCol; ++iLoop)
{ {
// add row to table // add row to table
LwpObjectID& rColID = GetColumnLayoutHead(); LwpObjectID *pColID = &GetColumnLayoutHead();
LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColID.obj().get()); LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj().get());
while (pColumnLayout) while (pColumnLayout)
{ {
if (pColumnLayout->GetColumnID() == (iLoop+nStartCol)) if (pColumnLayout->GetColumnID() == (iLoop+nStartCol))
@@ -1283,8 +1283,8 @@ void LwpTableLayout::ConvertColumn(rtl::Reference<XFTable> const & pXFTable, sal
pXFTable->SetColumnStyle(iLoop+1, pColumnLayout->GetStyleName()); pXFTable->SetColumnStyle(iLoop+1, pColumnLayout->GetStyleName());
break; break;
} }
rColID = pColumnLayout->GetNext(); pColID = &pColumnLayout->GetNext();
pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColID.obj().get()); pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj().get());
} }
if (!pColumnLayout) if (!pColumnLayout)
{ {
@@ -1417,15 +1417,15 @@ XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol)
*/ */
LwpRowLayout* LwpTableLayout::GetRowLayout(sal_uInt16 nRow) LwpRowLayout* LwpTableLayout::GetRowLayout(sal_uInt16 nRow)
{ {
LwpObjectID& rRowID = GetChildHead(); LwpObjectID *pRowID = &GetChildHead();
LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
while (pRowLayout) while (pRowLayout)
{ {
if(pRowLayout->GetRowID() == nRow) if(pRowLayout->GetRowID() == nRow)
return pRowLayout; return pRowLayout;
rRowID = pRowLayout->GetNext(); pRowID = &pRowLayout->GetNext();
pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get());
} }
return nullptr; return nullptr;
} }

View File

@@ -393,8 +393,8 @@ sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index)
*/ */
LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index)
{ {
LwpObjectID& rID = m_SearchItems.GetHead(); LwpObjectID * pID = &m_SearchItems.GetHead(); // not necessary to check pID NULL or not
LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
while(pObj) while(pObj)
{ {
@@ -403,8 +403,8 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index)
return pObj; return pObj;
} }
rID = pObj->GetNext(); pID = &pObj->GetNext(); // not necessary to check pID NULL or not
pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
} }
return nullptr; return nullptr;
@@ -417,8 +417,8 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index)
*/ */
LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData) LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData)
{ {
LwpObjectID& rID = pCurData->GetNext(); LwpObjectID * pID = &pCurData->GetNext();
LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
while(pObj) while(pObj)
{ {
@@ -427,8 +427,8 @@ LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, Lwp
return pObj; return pObj;
} }
rID = pObj->GetNext(); pID = &pObj->GetNext(); // not necessary to check pID NULL or not
pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get());
} }
return nullptr; return nullptr;