From 628e96ce1fce194b30a5c2912feb8b7ec0328db0 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 4 Nov 2018 17:06:47 +0300 Subject: tdf#120703 PVS: V547 Expression is always true/false Change-Id: I3432afca1ee9bf9e8adce1d55d58d57bf1a09cb4 Reviewed-on: https://gerrit.libreoffice.org/62847 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- lotuswordpro/source/filter/lwptablelayout.cxx | 72 +++++++++++++-------------- 1 file changed, 35 insertions(+), 37 deletions(-) (limited to 'lotuswordpro') diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index b88a23bcdf1b..b595dc152c6a 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -1204,54 +1204,52 @@ void LwpTableLayout::PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_ return; XFColor aNullColor = XFColor(); - if ( pXFPara) + OUString sNumfmt = pCellLayout->GetNumfmtName(); + bool bColorMod = false; + XFNumberStyle* pNumStyle = nullptr; + XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); + if (!sNumfmt.isEmpty()) { - OUString sNumfmt = pCellLayout->GetNumfmtName(); - bool bColorMod = false; - XFNumberStyle* pNumStyle = nullptr; - XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); - if (!sNumfmt.isEmpty()) - { - pNumStyle = static_cast(pXFStyleManager->FindStyle( sNumfmt)); - XFColor aColor = pNumStyle->GetColor(); - if ( aColor != aNullColor ) - bColorMod = true;//end - } + pNumStyle = static_cast(pXFStyleManager->FindStyle(sNumfmt)); + XFColor aColor = pNumStyle->GetColor(); + if ( aColor != aNullColor ) + bColorMod = true;//end + } - XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName()); - if ((pStyle && pStyle->GetNumberRight()) || bColorMod) - { - std::unique_ptr xOverStyle(new XFParaStyle); + XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName()); + if ((pStyle && pStyle->GetNumberRight()) || bColorMod) + { + std::unique_ptr xOverStyle(new XFParaStyle); - if (pStyle) - { - *xOverStyle = *pStyle; + if (pStyle) + { + *xOverStyle = *pStyle; - if (pStyle->GetNumberRight()) - xOverStyle->SetAlignType(enumXFAlignEnd); - } + if (pStyle->GetNumberRight()) + xOverStyle->SetAlignType(enumXFAlignEnd); + } - if (bColorMod) + if (bColorMod) + { + rtl::Reference xFont = xOverStyle->GetFont(); + if (xFont.is()) { - rtl::Reference xFont = xOverStyle->GetFont(); - if (xFont.is()) + XFColor aColor = xFont->GetColor(); + if (aColor == aNullColor) { - XFColor aColor = xFont->GetColor(); - if ( aColor == aNullColor ) - { - rtl::Reference pNewFont(new XFFont); - aColor = pNumStyle->GetColor(); - pNewFont->SetColor(aColor); - xOverStyle->SetFont(pNewFont); - } + rtl::Reference pNewFont(new XFFont); + aColor = pNumStyle->GetColor(); + pNewFont->SetColor(aColor); + xOverStyle->SetFont(pNewFont); } } + } - xOverStyle->SetStyleName(""); - OUString StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName(); + xOverStyle->SetStyleName(""); + OUString StyleName + = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName(); - pXFPara->SetStyleName(StyleName); - } + pXFPara->SetStyleName(StyleName); } } } -- cgit