[Libreoffice-commits] core.git: Branch 'distro/collabora/cd-5.3-3.2' - 2 commits - lotuswordpro/qa lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Wed May 23 12:18:41 UTC 2018
lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp |binary
lotuswordpro/source/filter/lwpfrib.cxx | 2 +-
lotuswordpro/source/filter/lwplayout.cxx | 5 +++--
lotuswordpro/source/filter/lwplayout.hxx | 14 ++++++++++++--
lotuswordpro/source/filter/lwppagelayout.cxx | 4 ++--
5 files changed, 18 insertions(+), 7 deletions(-)
New commits:
commit fd96a5f499b0ca4b9d8118fedaae6a3222162353
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 13 14:33:27 2018 +0100
ofz#7648 Bad-cast
Change-Id: I21aaf36f3d6b6c3054649208de809b99aa384c01
Reviewed-on: https://gerrit.libreoffice.org/52836
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 1db17a71b028c392a00393cdf313e1720b93fd2e)
(cherry picked from commit 20bf87c6a3a076fe78f938b7a3086146336976e7)
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index ed7db90da9df..1e1505f88f0a 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -249,7 +249,7 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
XFTextStyle* pNamedStyle = nullptr;
if (m_pModifiers->HasCharStyle && pFoundry)
{
- pNamedStyle = static_cast<XFTextStyle*>
+ pNamedStyle = dynamic_cast<XFTextStyle*>
(pFoundry->GetStyleManager()->GetStyle(m_pModifiers->CharStyleID));
}
if (pNamedStyle)
commit 1948aa5649c114aa570c215d460578a6cc6c3866
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Mar 25 14:01:25 2018 +0100
ofz#7109 infinite regress
Change-Id: Iac0bd81c9b0e3ac6b005bb0065895ca1b4ca4233
Reviewed-on: https://gerrit.libreoffice.org/51828
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
(cherry picked from commit e4308d4b3638d52ca70778565ba2541e9f3f0ff2)
(cherry picked from commit 79bb8c64b633f9397601df4e73f09d7fef066c2b)
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp
new file mode 100644
index 000000000000..f48c5bb718a4
Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp differ
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 75524aaf4f64..3f7aeda23cd4 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -78,6 +78,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
, m_bGettingMarginsSameAsParent(false)
, m_bGettingHasProtection(false)
, m_bGettingIsProtected(false)
+ , m_bGettingIsAutoGrowDown(false)
, m_bGettingMarginsValue(false)
, m_bGettingExtMarginsValue(false)
, m_nAttributes(0)
@@ -391,7 +392,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
*/
bool LwpVirtualLayout::IsFitGraphic()
{
- return IsAutoGrowRight() && !IsAutoGrowLeft() && IsAutoGrowDown();
+ return IsAutoGrowRight() && !IsAutoGrowLeft() && GetIsAutoGrowDown();
}
/**
@@ -1174,7 +1175,7 @@ bool LwpMiddleLayout::IsAutoGrowDown()
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
{
- return pLay->IsAutoGrowDown();
+ return pLay->GetIsAutoGrowDown();
}
}
return LwpVirtualLayout::IsAutoGrowDown();
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 8d2e47dd9016..346d52bc9213 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -103,7 +103,6 @@ public:
virtual double GetColGap(sal_uInt16 nIndex);
virtual bool IsAutoGrow(){ return false;}
virtual bool IsAutoGrowUp(){ return false;}
- virtual bool IsAutoGrowDown(){ return false;}
virtual bool IsAutoGrowLeft(){ return false;}
virtual bool IsAutoGrowRight(){ return false;}
bool IsFitGraphic();
@@ -137,6 +136,15 @@ public:
m_bGettingIsProtected = false;
return bRet;
}
+ bool GetIsAutoGrowDown()
+ {
+ if (m_bGettingIsAutoGrowDown)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingIsAutoGrowDown = true;
+ bool bRet = IsAutoGrowDown();
+ m_bGettingIsAutoGrowDown = false;
+ return bRet;
+ }
bool GetHasProtection()
{
if (m_bGettingHasProtection)
@@ -216,6 +224,7 @@ protected:
bool HasProtection();
virtual bool HonorProtection();
virtual bool IsProtected();
+ virtual bool IsAutoGrowDown(){ return false;}
virtual double MarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
virtual double ExtMarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
virtual bool MarginsSameAsParent();
@@ -224,6 +233,7 @@ protected:
bool m_bGettingMarginsSameAsParent;
bool m_bGettingHasProtection;
bool m_bGettingIsProtected;
+ bool m_bGettingIsAutoGrowDown;
bool m_bGettingMarginsValue;
bool m_bGettingExtMarginsValue;
sal_uInt32 m_nAttributes;
@@ -351,7 +361,6 @@ public:
LwpColor* GetBackColor();
virtual bool IsAutoGrow() override;
virtual bool IsAutoGrowUp() override;
- virtual bool IsAutoGrowDown() override;
virtual bool IsAutoGrowLeft() override;
virtual bool IsAutoGrowRight() override;
virtual sal_uInt8 GetContentOrientation() override;
@@ -389,6 +398,7 @@ protected:
virtual bool MarginsSameAsParent() override;
virtual double MarginsValue(sal_uInt8 nWhichSide) override;
virtual double ExtMarginsValue(sal_uInt8 nWhichSide) override;
+ virtual bool IsAutoGrowDown() override;
private:
LwpObjectID m_BasedOnStyle;
LwpLayoutGeometry* Geometry();
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index 2d95ac70a288..c8ac3ee2aa9a 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -480,7 +480,7 @@ void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
//get fillerpage story from division info
LwpDocument* pDoc = m_pFoundry->GetDocument();
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID().obj().get());
- LwpStory* pStory = dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get());
+ LwpStory* pStory = pDivInfo ? dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get()) : nullptr;
//parse fillerpage story
if(pStory)
@@ -777,7 +777,7 @@ void LwpHeaderLayout::ParseMargins(XFHeaderStyle* ph1)
{
//Set height: from top of header to top of body, including the spacing between header and body
double height = GetGeometryHeight()- GetMarginsValue(MARGIN_TOP);
- if( IsAutoGrowDown() )
+ if (GetIsAutoGrowDown())
{
ph1->SetMinHeight(height);
}
More information about the Libreoffice-commits
mailing list