summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 20:21:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-22 07:43:22 +0100
commit968b64d054eb164cee9fb92b6bf7dd93f478bf24 (patch)
tree80d92181e4796cf77b37b1faa03a3ccf106aef22 /lotuswordpro
parent1d21a51d814b39711cb1cc7f925b0c620b42eaa7 (diff)
loplugin:flatten in l10ntools..lotuswordpro
Change-Id: Ie6de142db1987094fdf538148ac5ee33379a3e4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx43
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx77
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx33
3 files changed, 74 insertions, 79 deletions
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index b5c65fc411a3..c0f2e7e720de 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -713,30 +713,29 @@ bool LwpFrame::IsLeftWider()
{
rtl::Reference<LwpVirtualLayout> xLayout(m_pLayout->GetContainerLayout());
LwpVirtualLayout* pParent = xLayout.get();
- if (pParent)
+ if (!pParent)
+ return false;
+ LwpPoint aPoint = m_pLayout->GetOrigin();
+ double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
+ double fWidth = m_pLayout->GetWidth();
+ double fWrapLeft = m_pLayout->GetExtMarginsValue(MARGIN_LEFT);
+ double fWrapRight = m_pLayout->GetExtMarginsValue(MARGIN_RIGHT);
+
+ //LwpPoint aParentPoint = pParent->GetOrigin();
+ //double fParentXOffset = LwpTools::ConvertFromUnitsToMetric(aParentPoint.GetX());
+ double fParentWidth = pParent->GetWidth();
+ if (pParent->IsCell())
{
- LwpPoint aPoint = m_pLayout->GetOrigin();
- double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
- double fWidth = m_pLayout->GetWidth();
- double fWrapLeft = m_pLayout->GetExtMarginsValue(MARGIN_LEFT);
- double fWrapRight = m_pLayout->GetExtMarginsValue(MARGIN_RIGHT);
-
- //LwpPoint aParentPoint = pParent->GetOrigin();
- //double fParentXOffset = LwpTools::ConvertFromUnitsToMetric(aParentPoint.GetX());
- double fParentWidth = pParent->GetWidth();
- if (pParent->IsCell())
- {
- //Get actual width of this cell layout
- fParentWidth = static_cast<LwpCellLayout*>(pParent)->GetActualWidth();
- }
- double fParentMarginLeft = pParent->GetMarginsValue(MARGIN_LEFT);
- double fParentMarginRight = pParent->GetMarginsValue(MARGIN_RIGHT);
-
- double fLeft = fXOffset - fWrapLeft - fParentMarginLeft;
- double fRight = fParentWidth - fParentMarginRight - (fXOffset + fWidth + fWrapRight);
- if (fLeft > fRight)
- return true;
+ //Get actual width of this cell layout
+ fParentWidth = static_cast<LwpCellLayout*>(pParent)->GetActualWidth();
}
+ double fParentMarginLeft = pParent->GetMarginsValue(MARGIN_LEFT);
+ double fParentMarginRight = pParent->GetMarginsValue(MARGIN_RIGHT);
+
+ double fLeft = fXOffset - fWrapLeft - fParentMarginLeft;
+ double fRight = fParentWidth - fParentMarginRight - (fXOffset + fWidth + fWrapRight);
+ if (fLeft > fRight)
+ return true;
return false;
}
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 881b35d8dc48..6405e2277e79 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1862,49 +1862,46 @@ LwpShadow* LwpLayout::GetShadow()
XFShadow* LwpLayout::GetXFShadow()
{
LwpShadow* pShadow = GetShadow();
- if (pShadow)
- {
- LwpColor color = pShadow->GetColor();
- double offsetX = pShadow->GetOffsetX();
- double offsetY = pShadow->GetOffsetY();
+ if (!pShadow)
+ return nullptr;
+ LwpColor color = pShadow->GetColor();
+ double offsetX = pShadow->GetOffsetX();
+ double offsetY = pShadow->GetOffsetY();
- if (offsetX && offsetY && color.IsValidColor())
- {
- XFShadow* pXFShadow = new XFShadow();
- enumXFShadowPos eXFShadowPos = enumXFShadowLeftTop;
- double fOffset = 0;
-
- bool left = false;
- bool top = false;
- if (offsetX < 0)
- left = true;
- if (offsetY < 0)
- top = true;
- if (left)
- {
- fOffset = -offsetX;
- if (top)
- eXFShadowPos = enumXFShadowLeftTop;
- else
- eXFShadowPos = enumXFShadowLeftBottom;
- }
- else
- {
- fOffset = offsetX;
- if (top)
- eXFShadowPos = enumXFShadowRightTop;
- else
- eXFShadowPos = enumXFShadowRightBottom;
- }
+ if (!offsetX || !offsetY || !color.IsValidColor())
+ return nullptr;
+ XFShadow* pXFShadow = new XFShadow();
+ enumXFShadowPos eXFShadowPos = enumXFShadowLeftTop;
+ double fOffset = 0;
+
+ bool left = false;
+ bool top = false;
+ if (offsetX < 0)
+ left = true;
+ if (offsetY < 0)
+ top = true;
+ if (left)
+ {
+ fOffset = -offsetX;
+ if (top)
+ eXFShadowPos = enumXFShadowLeftTop;
+ else
+ eXFShadowPos = enumXFShadowLeftBottom;
+ }
+ else
+ {
+ fOffset = offsetX;
+ if (top)
+ eXFShadowPos = enumXFShadowRightTop;
+ else
+ eXFShadowPos = enumXFShadowRightBottom;
+ }
- pXFShadow->SetPosition(eXFShadowPos);
- pXFShadow->SetOffset(fOffset);
- pXFShadow->SetColor(XFColor(color.To24Color()));
+ pXFShadow->SetPosition(eXFShadowPos);
+ pXFShadow->SetOffset(fOffset);
+ pXFShadow->SetColor(XFColor(color.To24Color()));
- return pXFShadow;
- }
- }
- return nullptr;
+ return pXFShadow;
}
/**
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index 822d82866de2..69e25d0299bc 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -545,28 +545,27 @@ LwpFooterLayout* LwpPageLayout::GetFooterLayout()
*/
LwpPageLayout* LwpPageLayout::GetOddChildLayout()
{
- if (IsComplex())
+ if (!IsComplex())
+ return nullptr;
+ rtl::Reference<LwpVirtualLayout> xLay(
+ dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
+ while (xLay.is())
{
- rtl::Reference<LwpVirtualLayout> xLay(
- dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
- o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
- while (xLay.is())
- {
- bool bAlreadySeen = !aSeen.insert(xLay.get()).second;
- if (bAlreadySeen)
- throw std::runtime_error("loop in conversion");
+ bool bAlreadySeen = !aSeen.insert(xLay.get()).second;
+ if (bAlreadySeen)
+ throw std::runtime_error("loop in conversion");
- if (xLay->GetLayoutType() == LWP_PAGE_LAYOUT)
+ if (xLay->GetLayoutType() == LWP_PAGE_LAYOUT)
+ {
+ LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(xLay.get());
+ LwpUseWhen* pUseWhen = pPageLayout->GetUseWhen();
+ if (pUseWhen && pUseWhen->IsUseOnAllOddPages())
{
- LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(xLay.get());
- LwpUseWhen* pUseWhen = pPageLayout->GetUseWhen();
- if (pUseWhen && pUseWhen->IsUseOnAllOddPages())
- {
- return pPageLayout;
- }
+ return pPageLayout;
}
- xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
}
+ xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
}
return nullptr;
}