diff options
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 16 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.hxx | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index b746a2d94c1e..33301a77ab26 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1916,6 +1916,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout() LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm ) : LwpLayout(objHdr, pStrm) , m_bGettingWrapType(false) + , m_bGettingLayoutRelativity(false) , m_nWrapType(0) , m_nBuoyancy(0) , m_nBaseLineOffset(0) @@ -1995,11 +1996,15 @@ sal_uInt8 LwpPlacableLayout::GetWrapType() */ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() { - if(!m_LayRelativity.IsNull()) + if (m_bGettingLayoutRelativity) + throw std::runtime_error("recursion in layout"); + m_bGettingLayoutRelativity = true; + LwpLayoutRelativity* pRet = nullptr; + if (!m_LayRelativity.IsNull()) { - if(m_nOverrideFlag & OVER_PLACEMENT) + if (m_nOverrideFlag & OVER_PLACEMENT) { - return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get()); + pRet = dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get()); } } else @@ -2007,10 +2012,11 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get())) { - return pLay->GetRelativityPiece(); + pRet = pLay->GetRelativityPiece(); } } - return nullptr; + m_bGettingLayoutRelativity = false; + return pRet; } /** * @descr: Get relative type diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index 387d68488fd5..3c900b4d8a6d 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -494,6 +494,7 @@ protected: void Read() override; protected: bool m_bGettingWrapType; + bool m_bGettingLayoutRelativity; sal_uInt8 m_nWrapType; sal_uInt8 m_nBuoyancy; sal_Int32 m_nBaseLineOffset; |