[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Sat Dec 12 13:21:52 PST 2015


 lotuswordpro/source/filter/lwpdivinfo.cxx     |    4 +-
 lotuswordpro/source/filter/lwpfnlayout.cxx    |   10 +++---
 lotuswordpro/source/filter/lwpfoundry.cxx     |   18 +++++------
 lotuswordpro/source/filter/lwpframelayout.cxx |    9 ++---
 lotuswordpro/source/filter/lwpfrib.cxx        |    2 -
 lotuswordpro/source/filter/lwpfribbreaks.cxx  |    3 -
 lotuswordpro/source/filter/lwpfribsection.cxx |   41 ++++++++++----------------
 lotuswordpro/source/filter/lwpnotes.cxx       |    4 +-
 lotuswordpro/source/filter/lwpproplist.cxx    |    4 +-
 lotuswordpro/source/filter/lwptablelayout.cxx |   16 +++++-----
 lotuswordpro/source/filter/lwptblcell.cxx     |    2 -
 lotuswordpro/source/filter/lwptblcell.hxx     |    2 -
 lotuswordpro/source/filter/lwptblformula.cxx  |    2 -
 13 files changed, 52 insertions(+), 65 deletions(-)

New commits:
commit f38183ea98331ac037a6ca7bf0d8f30dbdcb3f1b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Dec 12 21:20:40 2015 +0000

    check all obj().get() casts with dynamic_cast
    
    Change-Id: I763aa5874d0c1f977decff88414eea6247f96405
    (cherry picked from commit 411dc2058d222a5c2f9b8b159b9384086c9219a5)

diff --git a/lotuswordpro/source/filter/lwpdivinfo.cxx b/lotuswordpro/source/filter/lwpdivinfo.cxx
index 6694be1..2f9a6cf 100644
--- a/lotuswordpro/source/filter/lwpdivinfo.cxx
+++ b/lotuswordpro/source/filter/lwpdivinfo.cxx
@@ -162,10 +162,10 @@ sal_uInt16 LwpDivInfo::GetMaxNumberOfPages()
     LwpDocument* pDiv = GetDivision();
     if(!pDiv)
         return 0;
-    LwpDLVListHeadTailHolder* pHeadTail = static_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID().obj().get());
+    LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID().obj().get());
     if(pHeadTail)
     {
-        LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
+        LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
         if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
         {
             return pPageHint->GetPageNumber();
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx
index 3ba3795..13c505d 100644
--- a/lotuswordpro/source/filter/lwpfnlayout.cxx
+++ b/lotuswordpro/source/filter/lwpfnlayout.cxx
@@ -115,14 +115,14 @@ void LwpFnRowLayout::RegisterStyle()
 {
     // register cells' style
     LwpObjectID& rCellID = GetChildHead();
-    LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(rCellID.obj().get());
+    LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
 
     while(pCellLayout)
     {
         pCellLayout->SetFoundry(m_pFoundry);
         pCellLayout->RegisterStyle();
         rCellID = pCellLayout->GetNext();
-        pCellLayout = static_cast<LwpCellLayout *>(rCellID.obj().get());
+        pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
     }
 }
 
@@ -195,14 +195,14 @@ void LwpEndnoteLayout::RegisterStyle()
 {
     // register style of rows
     LwpObjectID& rRowID = GetChildHead();
-    LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(rRowID.obj().get());
+    LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
     while (pRowLayout)
     {
         pRowLayout->SetFoundry(m_pFoundry);
         pRowLayout->RegisterStyle();
 
         rRowID = pRowLayout->GetNext();
-        pRowLayout = static_cast<LwpRowLayout *>(rRowID.obj().get());
+        pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
     }
 }
 
@@ -314,7 +314,7 @@ LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
 
     while(!rID.IsNull())
     {
-        LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(rID.obj().get());
+        LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get());
         if(!pLayout)
         {
             break;
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 74bfded..f59395e 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -262,7 +262,7 @@ LwpSection* LwpFoundry::EnumSections(LwpSection * pSection)
 */
 LwpObjectID * LwpFoundry::GetDefaultTextStyle()
 {
-    LwpVersionedPointer * pPointer = static_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
+    LwpVersionedPointer * pPointer = dynamic_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
     if (!pPointer)
         return nullptr;
 
@@ -276,16 +276,16 @@ LwpObjectID * LwpFoundry::GetDefaultTextStyle()
 LwpObjectID * LwpFoundry::FindParaStyleByName(const OUString& name)
 {
     //Register all text styles: para styles, character styles
-    LwpDLVListHeadHolder* pParaStyleHolder = static_cast<LwpDLVListHeadHolder*>(GetTextStyleHead().obj().get());
+    LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(GetTextStyleHead().obj().get());
     if(pParaStyleHolder)
     {
-        LwpTextStyle* pParaStyle = static_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
+        LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
         while(pParaStyle)
         {
             OUString strName = pParaStyle->GetName().str();
             if(strName == name)
                 return &pParaStyle->GetObjectID();
-            pParaStyle = static_cast<LwpTextStyle*>(pParaStyle->GetNext().obj().get());
+            pParaStyle = dynamic_cast<LwpTextStyle*>(pParaStyle->GetNext().obj().get());
         }
     }
 
@@ -394,8 +394,8 @@ LwpContent* LwpContentManager::EnumContents(LwpContent* pContent)
 {
     if(pContent)
         return pContent->GetNextEnumerated();
-    LwpVersionedPointer* pPointer = static_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
-    return pPointer ? static_cast<LwpContent*>(pPointer->GetPointer().obj().get()) : nullptr;
+    LwpVersionedPointer* pPointer = dynamic_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
+    return pPointer ? dynamic_cast<LwpContent*>(pPointer->GetPointer().obj().get()) : nullptr;
 }
 
 void LwpPieceManager::Read(LwpObjectStream *pStrm)
@@ -446,14 +446,14 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
 {
     // If Last has a next, return it.
     if(pLast && !pLast->GetNext().IsNull())
-        return static_cast<LwpOrderedObject*>(pLast->GetNext().obj().get());
+        return dynamic_cast<LwpOrderedObject*>(pLast->GetNext().obj().get());
 
     LwpListList* pList = nullptr;
     if(pLast)
     {
         // We're at the end of Last's list (not Liszt's list).
         // Start with the next active list
-        pList = static_cast<LwpListList*>(pLast->GetListList().obj().get());
+        pList = dynamic_cast<LwpListList*>(pLast->GetListList().obj().get());
         pList= GetNextActiveListList(pList);
     }
     else
@@ -464,7 +464,7 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
 
     if(pList)
     {
-        return static_cast<LwpOrderedObject*>(pList->GetHead().obj().get());
+        return dynamic_cast<LwpOrderedObject*>(pList->GetHead().obj().get());
     }
 
     return nullptr;
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index 8d743a0..165d9e5 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -687,7 +687,6 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
 
             //because of the different feature between Word Pro and SODC, I simulate the vertical base offset
             //between anchor and frame origin using the font height.
-            //LwpPara* pPara = static_cast<LwpPara*>(m_pLayout->GetPosition()->obj());
             rtl::Reference<XFFont> pFont = m_pLayout->GetFont();
             if(pFont.is())
             {
@@ -1096,11 +1095,11 @@ void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
         m_pFrame->Parse(pXFFrame, nStart);
 
         //add child frame into group
-        LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
+        LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
         while(pLayout)
         {
             pLayout->XFConvert(pXFFrame);
-            pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+            pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
         }
 
         pCont ->Add(pXFFrame);
@@ -1179,12 +1178,12 @@ void LwpDropcapLayout::RegisterStyle(LwpFoundry* pFoundry)
     {
         pStory->SetDropcapFlag(true);
         pStory->SetFoundry(pFoundry);
-        LwpPara* pPara = static_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
+        LwpPara* pPara = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
         while(pPara)
         {
             pPara->SetFoundry(pFoundry);
             pPara->RegisterStyle();
-            pPara = static_cast<LwpPara*>(pPara->GetNext().obj().get());
+            pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
         }
     }
 }
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index d61360a..d9ae6f0 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -257,7 +257,7 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
         {
             pStyle = new XFTextStyle();
             *pStyle = *pNamedStyle;
-            LwpCharacterStyle* pCharStyle = static_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
+            LwpCharacterStyle* pCharStyle = dynamic_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
 
             pStyle->SetStyleName("");
             pFont = pFoundry->GetFontManger().CreateOverrideFont(pCharStyle->GetFinalFontID(),m_pModifiers->FontID);
diff --git a/lotuswordpro/source/filter/lwpfribbreaks.cxx b/lotuswordpro/source/filter/lwpfribbreaks.cxx
index fa94993..6538d68 100644
--- a/lotuswordpro/source/filter/lwpfribbreaks.cxx
+++ b/lotuswordpro/source/filter/lwpfribbreaks.cxx
@@ -77,9 +77,6 @@ void LwpFribColumnBreak::RegisterBreakStyle(LwpPara * pPara)
     *pOverStyle = *pBaseStyle;
     pOverStyle->SetStyleName("");
 
-    //Old code
-    //if (static_cast<LwpStory*>(pPara->GetStoryID()->obj())
-    //  ->GetCurrentLayout()->GetNumCols() == 1)
     //New code
     LwpStory* pStory = dynamic_cast<LwpStory*>(pPara->GetStoryID().obj().get());
     LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index 899461a..d6ee8a5 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -99,7 +99,7 @@ void LwpFribSection::Read(LwpObjectStream *pObjStrm, sal_uInt16 /*len*/)
  */
 LwpSection* LwpFribSection::GetSection()
 {
-    return static_cast<LwpSection*>(m_Section.obj().get());
+    return dynamic_cast<LwpSection*>(m_Section.obj().get());
 }
 
 /**
@@ -123,11 +123,12 @@ void LwpFribSection::RegisterSectionStyle()
 void LwpFribSection::SetSectionName()
 {
     LwpSection* pSection = GetSection();
-    if(pSection)
-    {
-        LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
-        pStory->SetSectionName(pSection->GetSectionName());
-    }
+    if (!pSection)
+        return;
+    LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+    if (!pStory)
+        return;
+    pStory->SetSectionName(pSection->GetSectionName());
 }
 
 /**
@@ -161,7 +162,7 @@ void LwpFribSection::ParseSection()
             m_pMasterPage->ParseSection(this);
         }
     }
-    else if (LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get()))
+    else if (LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get()))
     {
         rtl::Reference<LwpObject> xObj(m_Section.obj());
         if (xObj.is() && xObj->GetTag() == VO_INDEXSECTION)
@@ -169,16 +170,6 @@ void LwpFribSection::ParseSection()
             //create a new section and add it to container
             XFIndex* pIndex = new XFIndex;
             pIndex->SetIndexType(enumXFIndexAlphabetical);
-            /*
-            sal_Bool bRunin = sal_False;
-            sal_Bool bSeparator = sal_False;
-            LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj());
-            if (pIndexSection->IsFormatRunin())
-                bRunin = sal_True;
-            if (pIndexSection->IsFormatSeparator())
-                bSeparator = sal_True;
-            pIndex->SetDefaultAlphaIndex("",bRunin,bSeparator);
-            */
             SetDefaultAlphaIndex(pIndex);
 
             pStory->AddXFContent( pIndex );
@@ -197,7 +188,7 @@ void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
     LwpFoundry* pFoundry = m_pPara->GetFoundry();
     OUString styleName = pFoundry->FindActuralStyleName("Separator");
 
-    LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj().get());
+    LwpIndexSection* pIndexSection = dynamic_cast<LwpIndexSection*>(m_Section.obj().get());
     XFIndexTemplate * pTemplateSep = new XFIndexTemplate();
     if (pIndexSection->IsFormatSeparator())
     {
@@ -256,7 +247,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
     //if there is no other frib after current frib, register master page in starting para of next page
     if(IsNextPageType()&&(!pFrib->HasNextFrib()))
     {
-        LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+        LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
         pStory->SetCurrentLayout(m_pLayout);
         RegisterFillerPageStyle();
         return false;
@@ -287,7 +278,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
         case LwpLayout::StartOnOddPage: //fall through
         case LwpLayout::StartOnEvenPage:
         {
-            LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+            LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
             pStory->SetCurrentLayout(m_pLayout);
             //get odd page layout when the current pagelayout is mirror
             m_pLayout = pStory->GetCurrentLayout();
@@ -302,7 +293,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
     }
 
     //register tab style;
-    LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+    LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
     pStory->SetTabLayout(m_pLayout);
     m_pPara->RegisterTabStyle(pOverStyle);
 
@@ -313,7 +304,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
     {
         XFSectionStyle* pSectStyle= new XFSectionStyle();
         //set margin
-        pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+        pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
         if(pStory)
         {
             LwpPageLayout* pCurrentLayout = pStory->GetCurrentLayout();
@@ -345,7 +336,7 @@ bool LwpMasterPage::IsNeedSection()
 {
     bool bNewSection = false;
     //get story
-    LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+    LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
     //if pagelayout is modified, register the pagelayout
     if(pStory->IsPMModified())
     {
@@ -393,7 +384,7 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
     XFContentContainer* pContent = CreateXFSection();
     if(pContent)
     {
-        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+        LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
         //delete the additional blank para
         XFParagraph* pCurrPara = rFribPtr.GetXFPara();
         if(!pCurrPara->HasContents())
@@ -408,7 +399,7 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
     }
     else
     {
-        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+        LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
         pContent = pStory->GetXFContent();
     }
     if(pContent)
diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx
index e203d42..1da5922 100644
--- a/lotuswordpro/source/filter/lwpnotes.cxx
+++ b/lotuswordpro/source/filter/lwpnotes.cxx
@@ -214,10 +214,10 @@ OUString LwpNoteLayout::GetAuthor()
     LwpNoteHeaderLayout* pTextLayout = static_cast<LwpNoteHeaderLayout*>(FindChildByType(LWP_NOTEHEADER_LAYOUT));
     if(pTextLayout)
     {
-        LwpStory* pStory = static_cast<LwpStory*>(pTextLayout->GetContent().obj().get());
+        LwpStory* pStory = dynamic_cast<LwpStory*>(pTextLayout->GetContent().obj().get());
         if(pStory)
         {
-            LwpPara* pFirst = static_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
+            LwpPara* pFirst = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
             if(pFirst)
                 return pFirst->GetContentText(true);
         }
diff --git a/lotuswordpro/source/filter/lwpproplist.cxx b/lotuswordpro/source/filter/lwpproplist.cxx
index 475bf4c..a0a59f1 100644
--- a/lotuswordpro/source/filter/lwpproplist.cxx
+++ b/lotuswordpro/source/filter/lwpproplist.cxx
@@ -67,7 +67,7 @@ LwpPropListElement::LwpPropListElement(LwpObjectHeader &objHdr, LwpSvStream *pSt
 
 LwpPropListElement* LwpPropListElement::GetNext()
 {
-    return static_cast<LwpPropListElement*>(LwpDLVList::GetNext().obj().get());
+    return dynamic_cast<LwpPropListElement*>(LwpDLVList::GetNext().obj().get());
 }
 
 void LwpPropListElement::Read()
@@ -113,7 +113,7 @@ void LwpPropList::Read(LwpObjectStream* pObjStrm)
 
 LwpPropListElement* LwpPropList::GetFirst()
 {
-    return static_cast<LwpPropListElement*>(LwpDLVListHead::GetFirst().obj().get());
+    return dynamic_cast<LwpPropListElement*>(LwpDLVListHead::GetFirst().obj().get());
 }
 
 OUString LwpPropList::EnumNamedProperty(OUString& name,OUString& value)
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 439ff50..829501a 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -1107,9 +1107,9 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
 
     try{
 
-        LwpDLVListHeadHolder* pHolder = static_cast<LwpDLVListHeadHolder*>(pFoundry->GetNumberManager().GetTableRangeID().obj().get());
+        LwpDLVListHeadHolder* pHolder = dynamic_cast<LwpDLVListHeadHolder*>(pFoundry->GetNumberManager().GetTableRangeID().obj().get());
 
-        LwpTableRange* pTableRange = pHolder ? static_cast<LwpTableRange*>(pHolder->GetHeadID().obj().get()) : nullptr;
+        LwpTableRange* pTableRange = pHolder ? dynamic_cast<LwpTableRange*>(pHolder->GetHeadID().obj().get()) : nullptr;
 
         //Look up the table
         while (nullptr!=pTableRange)
@@ -1125,23 +1125,23 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
         if (!pTableRange)
             return;
 
-        LwpCellRange* pRange = static_cast<LwpCellRange*>(pTableRange->GetCellRangeID().obj().get());
+        LwpCellRange* pRange = dynamic_cast<LwpCellRange*>(pTableRange->GetCellRangeID().obj().get());
         if (!pRange)
             return;
 
-        LwpFolder* pFolder = static_cast<LwpFolder*>(pRange->GetFolderID().obj().get());
+        LwpFolder* pFolder = dynamic_cast<LwpFolder*>(pRange->GetFolderID().obj().get());
         if (!pFolder)
             return;
 
         LwpObjectID aRowListID = pFolder->GetChildHeadID();
-        LwpRowList* pRowList = static_cast<LwpRowList*>(aRowListID.obj().get());
+        LwpRowList* pRowList = dynamic_cast<LwpRowList*>(aRowListID.obj().get());
 
         //loop the rowlist
         while( nullptr!=pRowList)
         {
             sal_uInt16 nRowID =  pRowList->GetRowID();
             {
-                LwpCellList* pCellList = static_cast<LwpCellList*>(pRowList->GetChildHeadID().obj().get());
+                LwpCellList* pCellList = dynamic_cast<LwpCellList*>(pRowList->GetChildHeadID().obj().get());
                 //loop the cellList
                 while( nullptr!=pCellList)
                 {
@@ -1162,10 +1162,10 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
                             assert(false);
                         }
                     }
-                    pCellList = static_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
+                    pCellList = dynamic_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
                 }
             }
-            pRowList = static_cast<LwpRowList*>(pRowList->GetNextID().obj().get());
+            pRowList = dynamic_cast<LwpRowList*>(pRowList->GetNextID().obj().get());
         }
 
     }catch (...) {
diff --git a/lotuswordpro/source/filter/lwptblcell.cxx b/lotuswordpro/source/filter/lwptblcell.cxx
index f74c234..249d610 100644
--- a/lotuswordpro/source/filter/lwptblcell.cxx
+++ b/lotuswordpro/source/filter/lwptblcell.cxx
@@ -103,7 +103,7 @@ void  LwpCellList::Parse(IXFStream* /*pOutputStream*/)
 void LwpCellList::Convert(XFCell * pCell, LwpTableLayout* /*pCellsMap*/)
 {
     LwpObjectID aValueID = GetValueID();
-    LwpNumericValue* pValue = static_cast<LwpNumericValue*>(aValueID.obj().get());
+    LwpNumericValue* pValue = dynamic_cast<LwpNumericValue*>(aValueID.obj().get());
     if (pValue)
     {
         pCell->SetValue( pValue->GetValue() );
diff --git a/lotuswordpro/source/filter/lwptblcell.hxx b/lotuswordpro/source/filter/lwptblcell.hxx
index 8a078a3..99eda42 100644
--- a/lotuswordpro/source/filter/lwptblcell.hxx
+++ b/lotuswordpro/source/filter/lwptblcell.hxx
@@ -148,7 +148,7 @@ public:
     void Parse(IXFStream* pOutputStream) override;
     LwpObjectID GetCellRangeID(){return cpCellRange;}
     LwpObjectID GetTableID(){ return cqTable;}
-    LwpTableRange* GetNext() { return static_cast<LwpTableRange*>(LwpDLVList::GetNext().obj().get());}
+    LwpTableRange* GetNext() { return dynamic_cast<LwpTableRange*>(LwpDLVList::GetNext().obj().get());}
 protected:
     LwpObjectID cqTable;
     LwpObjectID cpCellRange;
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
index 963377e..6f699c5 100644
--- a/lotuswordpro/source/filter/lwptblformula.cxx
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -335,7 +335,7 @@ void LwpFormulaInfo::Read()
 {
     LwpCellList::Read();
     {
-        LwpRowList* pRowList = static_cast<LwpRowList*>(cParent.obj().get());
+        LwpRowList* pRowList = dynamic_cast<LwpRowList*>(cParent.obj().get());
         if (pRowList)
         {
             m_nFormulaRow = pRowList->GetRowID();


More information about the Libreoffice-commits mailing list