From 5d8449cd14aa3d08929bb25626ab54aa7515f47d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 13 Dec 2015 10:24:33 +0000 Subject: need more dynamic casts here Change-Id: Idf84ababeeb109a411c03a18d3a9aa6e136c7ef4 --- lotuswordpro/source/filter/lwpcelllayout.cxx | 5 +---- lotuswordpro/source/filter/lwpfootnote.cxx | 2 +- lotuswordpro/source/filter/lwptable.hxx | 2 +- lotuswordpro/source/filter/lwptablelayout.cxx | 1 + 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'lotuswordpro/source') diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index da49507105c8..76faa62786af 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -422,10 +422,7 @@ LwpObjectID * LwpCellLayout::GetPreviousCellStory() LwpCellBorderType LwpCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout) { if (!pTableLayout) - { - assert(false); return enumWholeBorder; - } // get left cell and judge if neighbour border is different XFBorders * pBorders = GetXFBorders(); @@ -664,7 +661,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID) { // judge whole table LwpTable * pTable = dynamic_cast(aTableID.obj().get()); - LwpTableLayout * pTableLayout = pTable ? static_cast(pTable->GetTableLayout()) : nullptr; + LwpTableLayout * pTableLayout = pTable ? dynamic_cast(pTable->GetTableLayout()) : nullptr; LwpSuperTableLayout * pSuper = pTableLayout ? pTableLayout->GetSuperTableLayout() : nullptr; if (pSuper && pSuper->IsProtected()) { diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx index 49b608347701..0da512ee7edb 100644 --- a/lotuswordpro/source/filter/lwpfootnote.cxx +++ b/lotuswordpro/source/filter/lwpfootnote.cxx @@ -199,7 +199,7 @@ LwpCellLayout* LwpFootnote::GetCellLayout() LwpEnSuperTableLayout* pEnSuperLayout = FindFootnoteTableLayout(); if(pEnSuperLayout) { - LwpTableLayout* pTableLayout = static_cast(pEnSuperLayout->GetMainTableLayout()); + LwpTableLayout* pTableLayout = dynamic_cast(pEnSuperLayout->GetMainTableLayout()); if(pTableLayout) { LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow); diff --git a/lotuswordpro/source/filter/lwptable.hxx b/lotuswordpro/source/filter/lwptable.hxx index c9fa7dabfc50..f4fa01303629 100644 --- a/lotuswordpro/source/filter/lwptable.hxx +++ b/lotuswordpro/source/filter/lwptable.hxx @@ -119,7 +119,7 @@ public: LwpObjectID& GetDefaultCellStyle() {return m_DefaultCellStyle;} sal_uInt16 GetRow() {return m_nRow;} sal_uInt16 GetColumn() {return m_nColumn;} - LwpTableLayout * GetTableLayout(){return static_cast(GetLayout(nullptr));} + LwpTableLayout * GetTableLayout(){return dynamic_cast(GetLayout(nullptr));} bool IsNumberDown(); virtual bool IsTable() override { return true;} LwpSuperTableLayout* GetSuperTableLayout(); diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index 735dd3edf247..e5b16c7c7c88 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -448,6 +448,7 @@ LwpCellLayout * LwpTableLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol return m_WordProCellsMap[static_cast(nRow)*m_nCols + nCol]; } + /** * @short traverse all table cells * @param -- cgit