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

Caolán McNamara caolanm at redhat.com
Sun Dec 13 02:26:04 PST 2015


 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(-)

New commits:
commit a505944f54421ed112f594ea14d29b6ea7a47f85
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 13 10:24:33 2015 +0000

    need more dynamic casts here
    
    Change-Id: Idf84ababeeb109a411c03a18d3a9aa6e136c7ef4
    (cherry picked from commit 5d8449cd14aa3d08929bb25626ab54aa7515f47d)

diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index da49507..76faa62 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<LwpTable *>(aTableID.obj().get());
-            LwpTableLayout * pTableLayout = pTable ? static_cast<LwpTableLayout *>(pTable->GetTableLayout()) : nullptr;
+            LwpTableLayout * pTableLayout = pTable ? dynamic_cast<LwpTableLayout *>(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 49b6083..0da512e 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<LwpTableLayout*>(pEnSuperLayout->GetMainTableLayout());
+        LwpTableLayout* pTableLayout = dynamic_cast<LwpTableLayout*>(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 c9fa7da..f4fa013 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<LwpTableLayout *>(GetLayout(nullptr));}
+    LwpTableLayout * GetTableLayout(){return dynamic_cast<LwpTableLayout *>(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 735dd3e..e5b16c7 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<size_t>(nRow)*m_nCols + nCol];
 }
+
 /**
  * @short   traverse all table cells
  * @param


More information about the Libreoffice-commits mailing list