loplugin:flatten in lotuswordpro

Change-Id: I8b86d54c1c2706fde8b4288bb3349e2ed89d3c95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91798
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-04-07 10:06:09 +02:00
parent 320563f857
commit 9f424bf2d7
18 changed files with 588 additions and 593 deletions

View File

@@ -131,8 +131,9 @@ void LwpBorderStuff::Read(LwpObjectStream *pStrm)
m_nValid = pStrm->QuickReaduInt16();
pStrm->SkipExtra();
if( LwpFileHeader::m_nFileRevision < 0x0010 )
{
if( LwpFileHeader::m_nFileRevision >= 0x0010 )
return;
if( m_nBorderGroupIDLeft&EXTERNAL_ID )
{
m_nBorderGroupIDLeft = BGRP_SOLID;
@@ -150,7 +151,6 @@ void LwpBorderStuff::Read(LwpObjectStream *pStrm)
m_nBorderGroupIDBottom = BGRP_SOLID;
}
}
}
bool LwpBorderStuff::HasSide(sal_uInt16 side)
{

View File

@@ -260,8 +260,9 @@ void LwpDocument::RegisterLayoutStyles()
//set initial pagelayout in story for parsing pagelayout
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get());
if (pDivInfo)
{
if (!pDivInfo)
return;
LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
if(pPageLayout)
{
@@ -275,7 +276,6 @@ void LwpDocument::RegisterLayoutStyles()
}
}
}
}
/**
* @descr Register all styles used in para
*/
@@ -285,8 +285,9 @@ void LwpDocument::RegisterStylesInPara()
rtl::Reference<LwpHeadContent> xContent(m_xOwnedFoundry
? dynamic_cast<LwpHeadContent*> (m_xOwnedFoundry->GetContentManager().GetContentList().obj().get())
: nullptr);
if (xContent.is())
{
if (!xContent.is())
return;
rtl::Reference<LwpStory> xStory(dynamic_cast<LwpStory*>(xContent->GetChildHead().obj(VO_STORY).get()));
o3tl::sorted_vector<LwpStory*> aSeen;
while (xStory.is())
@@ -300,7 +301,6 @@ void LwpDocument::RegisterStylesInPara()
throw std::runtime_error("loop in conversion");
}
}
}
/**
* @descr Register all bullet styles used in this division
*/
@@ -368,11 +368,13 @@ void LwpDocument::RegisterFootnoteStyles()
//Register endnote page style for endnote configuration, use the last division that has endnote for the endnote page style
//This page style must register after its division default styles have registered
LwpDocument* pEndnoteDiv = GetLastDivisionThatHasEndnote();
if(this == pEndnoteDiv)
{
if(this != pEndnoteDiv)
return;
LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID().obj().get());
if(pHeadTail)
{
if(!pHeadTail)
return;
LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
{
@@ -384,16 +386,15 @@ void LwpDocument::RegisterFootnoteStyles()
}
}
}
}
}
/**
* @descr Register default para styles
*/
void LwpDocument::RegisterDefaultParaStyles()
{
if(!IsChildDoc())
{
if(IsChildDoc())
return;
//Get First Division
//LwpDocument* pFirstDoc = GetFirstDivision();
LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
@@ -405,8 +406,6 @@ void LwpDocument::RegisterDefaultParaStyles()
pVerDoc->RegisterStyle();
}
}
}
}
/**

View File

@@ -102,8 +102,9 @@ void LwpFribFootnote::RegisterNewStyle()
void LwpFribFootnote::XFConvert(XFContentContainer* pCont)
{
LwpFootnote* pFootnote = GetFootnote();
if(pFootnote)
{
if(!pFootnote)
return;
rtl::Reference<XFContentContainer> xContent;
if(pFootnote->GetType() == FN_FOOTNOTE)
{
@@ -128,7 +129,6 @@ void LwpFribFootnote::XFConvert(XFContentContainer* pCont)
pCont->Add(xContent.get());
}
}
}
/**
* @descr Get foonote object

View File

@@ -792,8 +792,9 @@ void LwpFrameLayout::Read()
*/
void LwpFrameLayout::XFConvert(XFContentContainer* pCont)
{
if(m_pFrame)
{
if(!m_pFrame)
return;
//parse the frame which anchor to paragraph
if(IsRelativeAnchored())
{
@@ -803,8 +804,6 @@ void LwpFrameLayout::Read()
{
m_pFrame->XFConvert(pCont);
}
}
}
/**
* @descr create a xfframe and add into content container, called by XFConvert
@@ -814,8 +813,9 @@ void LwpFrameLayout::Read()
*/
void LwpFrameLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart , sal_Int32 nEnd, bool bAll )
{
if(m_pFrame)
{
if(!m_pFrame)
return;
rtl::Reference<XFFrame> xXFFrame;
if(nEnd < nStart)
{
@@ -840,7 +840,6 @@ void LwpFrameLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
}
pCont->Add(xXFFrame.get());
}
}
/**
* @descr register frame style
*
@@ -985,9 +984,10 @@ double LwpFrameLayout::GetMaxWidth()
void LwpFrameLayout::ApplyGraphicSize(XFFrame * pXFFrame)
{
rtl::Reference<LwpObject> content = m_Content.obj();
if(content.is() && (content->GetTag() == VO_GRAPHIC
|| content->GetTag() == VO_OLEOBJECT ))
{
if(!(content.is() && (content->GetTag() == VO_GRAPHIC
|| content->GetTag() == VO_OLEOBJECT )))
return;
LwpGraphicOleObject* pGraOle = static_cast<LwpGraphicOleObject*>(content.get());
//Get frame geometry size
double fWidth = 0;
@@ -1017,7 +1017,6 @@ void LwpFrameLayout::ApplyGraphicSize(XFFrame * pXFFrame)
pXFFrame->SetWidth(fWidth);
pXFFrame->SetHeight(fHeight);
}
}
LwpGroupLayout::LwpGroupLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
: LwpPlacableLayout(objHdr, pStrm)
@@ -1061,8 +1060,9 @@ void LwpGroupLayout::RegisterStyle()
*/
void LwpGroupLayout::XFConvert(XFContentContainer *pCont)
{
if(m_pFrame)
{
if(!m_pFrame)
return;
//parse the frame which anchor to paragraph
if(IsRelativeAnchored())
{
@@ -1072,8 +1072,6 @@ void LwpGroupLayout::XFConvert(XFContentContainer *pCont)
{
m_pFrame->XFConvert(pCont);
}
}
}
/**
* @descr create a xfframe and add into content container, called by XFConvert
@@ -1083,8 +1081,9 @@ void LwpGroupLayout::XFConvert(XFContentContainer *pCont)
*/
void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart , sal_Int32 nEnd, bool bAll)
{
if(m_pFrame)
{
if(!m_pFrame)
return;
rtl::Reference<XFFrame> xXFFrame;
if(nEnd < nStart)
{
@@ -1108,7 +1107,6 @@ void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
pCont->Add(xXFFrame.get());
}
}
LwpGroupFrame::LwpGroupFrame(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
:LwpContent(objHdr, pStrm)

View File

@@ -291,8 +291,9 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
}
}
if (m_pModifiers->HasHighlight)
{
if (!m_pModifiers->HasHighlight)
return;
XFColor aColor = GetHighlightColor();//right yellow
if (pStyle)//change the style directly
pStyle->GetFont()->SetBackColor(aColor);
@@ -315,7 +316,6 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
m_StyleName = pXFStyleManager->AddStyle(std::move(pNewStyle)).m_pStyle->GetStyleName();
}
}
}
void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo)
{

View File

@@ -1213,8 +1213,9 @@ void LwpFribField::ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark
break;
}
}
if (pContent)
{
if (!pContent)
return;
if (m_ModFlag)//(m_pModifiers)
{
XFTextSpanStart* pSpan = new XFTextSpanStart;
@@ -1226,7 +1227,6 @@ void LwpFribField::ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark
else
pXFPara->Add(pContent);
}
}
void LwpFribField::ConvertDocFieldEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
{
@@ -1299,8 +1299,9 @@ void LwpFribField::ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark
default:
break;
}
if (pContent)
{
if (!pContent)
return;
if (m_ModFlag)
{
XFTextSpanStart* pSpan = new XFTextSpanStart;
@@ -1311,7 +1312,6 @@ void LwpFribField::ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark
}
else
pXFPara->Add(pContent);
}
}

View File

@@ -304,8 +304,9 @@ void LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
//register section style here
if(m_bNewSection)
{
if(!m_bNewSection)
return;
std::unique_ptr<XFSectionStyle> pSectStyle(new XFSectionStyle());
//set margin
pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
@@ -325,7 +326,6 @@ void LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
}
m_SectionStyleName = pXFStyleManager->AddStyle(std::move(pSectStyle)).m_pStyle->GetStyleName();
}
}
/**
* @descr: Whether it needs to create a new section

View File

@@ -83,8 +83,9 @@ LwpFribText::LwpFribText( LwpPara *pPara, bool bNoUnicode )
void LwpFribText::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
{
if( len>=1 )
{
if( len<1 )
return;
rtl_TextEncoding rEncode;
if(m_bNoUnicode)
{
@@ -100,7 +101,6 @@ void LwpFribText::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
}
LwpTools::QuickReadUnicode(pObjStrm, m_Content, len, rEncode);
}
}
void LwpFribText::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
{

View File

@@ -638,8 +638,9 @@ void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont)
{
std::unique_ptr<sal_uInt8[]> pGrafData;
sal_uInt32 nDataLen = GetGrafData(pGrafData);
if(pGrafData)
{
if(!pGrafData)
return;
//convert equation
XFParagraph* pXFPara = new XFParagraph;
pXFPara->Add("Formula:");
@@ -681,7 +682,6 @@ void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont)
pXFPara->Add(pXFNote);
pCont->Add(pXFPara);
}
}
void LwpGraphicObject::GetGrafOrgSize(double & rWidth, double & rHeight)
{

View File

@@ -210,8 +210,9 @@ LwpExternalBorder::~LwpExternalBorder()
void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
{
if( LwpFileHeader::m_nFileRevision >= 0x000F )
{
if( LwpFileHeader::m_nFileRevision < 0x000F )
return;
//enum {BORDER,JOIN};
m_LeftName.Read(pStrm);
m_TopName.Read(pStrm);
@@ -224,7 +225,6 @@ void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
pStrm->SkipExtra();
}
}
LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
: LwpVirtualPiece(objHdr, pStrm)

View File

@@ -99,8 +99,9 @@ void LwpFribNote::RegisterNewStyle()
void LwpFribNote::XFConvert(XFContentContainer* pCont)
{
LwpNoteLayout* pLayout = dynamic_cast<LwpNoteLayout*>(m_Layout.obj().get());
if(pLayout)
{
if(!pLayout)
return;
XFAnnotation* pXFNote = new XFAnnotation;
pXFNote->SetAuthor(pLayout->GetAuthor());
LtTm aTm;
@@ -122,7 +123,6 @@ void LwpFribNote::XFConvert(XFContentContainer* pCont)
{
pCont->Add(pXFNote);
}
}
}

View File

@@ -232,8 +232,9 @@ void LwpNumericFormat::GetCurrencyStr(LwpNumericFormatSubset aNumber, OUString&
}
}
}
if ( aNumber.IsDefaultSuffix())
{
if ( !aNumber.IsDefaultSuffix())
return;
if (bPost)
{
aSuffix = aSymbol;
@@ -249,7 +250,6 @@ void LwpNumericFormat::GetCurrencyStr(LwpNumericFormatSubset aNumber, OUString&
aSuffix += ")";
}
}
}
void LwpNumericFormat::SetNumberType(XFNumberStyle* pStyle)
{
switch(cFormat)

View File

@@ -258,13 +258,15 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1)
{
//Get the footnoteoptions for the root document
LwpDocument* pDocument = m_pFoundry ? m_pFoundry->GetDocument() : nullptr;
if (pDocument)
{
if (!pDocument)
return;
LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts();
LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast<LwpFootnoteOptions*>(pFontnodeId->obj().get()) : nullptr;
if(pFootnoteOpts)
{
if(!pFootnoteOpts)
return;
LwpFootnoteSeparatorOptions& rFootnoteSep = pFootnoteOpts->GetFootnoteSeparator();
//set length
sal_uInt32 nLengthPercent = 100;
@@ -304,8 +306,6 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1)
pm1->SetFootNoteSeparator(eAlignType,fWidth, nLengthPercent, fAbove, fBelow, aXFColor);
}
}
}
}
/**
* @descr: Register master page and page master style
@@ -469,8 +469,9 @@ bool LwpPageLayout::HasFillerPageText(LwpFoundry const * pFoundry)
*/
void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
{
if(HasFillerPageText(m_pFoundry))
{
if(!HasFillerPageText(m_pFoundry))
return;
//get fillerpage story from division info
LwpDocument* pDoc = m_pFoundry->GetDocument();
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID().obj().get());
@@ -482,7 +483,6 @@ void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
pStory->XFConvert(pCont);
}
}
}
/**
* @descr: Clear columns style in page layout
*

View File

@@ -264,8 +264,9 @@ void LwpPara::RegisterMasterPage(XFParaStyle const * pBaseStyle)
//get story
LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
//if pagelayout is modified, register the pagelayout
if(pStory && pStory->IsPMModified())
{
if(!(pStory && pStory->IsPMModified()))
return;
bool bNewSection = pStory->IsNeedSection();
LwpPageLayout* pLayout = pStory->GetCurrentLayout();
if(bNewSection)
@@ -283,7 +284,6 @@ void LwpPara::RegisterMasterPage(XFParaStyle const * pBaseStyle)
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
}
}
/**
* @short register paragraph style
*/

View File

@@ -326,8 +326,9 @@ void LwpParaStyle::ApplyParaBorder(XFParaStyle* pParaStyle, LwpParaBorderOverrid
//convert to XFBorders object:
LwpBorderStuff *pBorderStuff = pBorder->GetBorderStuff();
if( pBorderStuff && pBorderStuff->GetSide() != 0 )
{
if( !(pBorderStuff && pBorderStuff->GetSide() != 0) )
return;
XFBorders *pXFBorders = new XFBorders();
pParaStyle->SetBorders(pXFBorders);
@@ -355,8 +356,6 @@ void LwpParaStyle::ApplyParaBorder(XFParaStyle* pParaStyle, LwpParaBorderOverrid
//apply border spacing to text content
pParaStyle->SetPadding(pMarginValue[0], pMarginValue[1], pMarginValue[2], pMarginValue[3]);
}
}
void LwpParaStyle::ApplyBreaks(XFParaStyle* pParaStyle, const LwpBreaksOverride* pBreaks)

View File

@@ -81,8 +81,9 @@ void LwpSdwFileLoader::CreateDrawObjects(std::vector< rtl::Reference<XFFrame> >*
unsigned char BinSignature[2];
m_pStream->ReadBytes(BinSignature, 2);
if (BinSignature[0] == 'S' && BinSignature[1] == 'M')
{
if (!(BinSignature[0] == 'S' && BinSignature[1] == 'M'))
return;
unsigned short nVersion;
m_pStream->ReadUInt16(nVersion);
@@ -97,5 +98,4 @@ void LwpSdwFileLoader::CreateDrawObjects(std::vector< rtl::Reference<XFFrame> >*
sdwGroupLoader.BeginDrawObjects(pDrawObjVector);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -381,8 +381,9 @@ void LwpSuperTableLayout::XFConvert(XFContentContainer* pCont)
*/
void LwpSuperTableLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart, sal_Int32 nEnd, bool bAll)
{
if(m_pFrame)
{
if(!m_pFrame)
return;
rtl::Reference<XFFrame> xXFFrame;
if(nEnd < nStart)
{
@@ -402,7 +403,6 @@ void LwpSuperTableLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 n
}
//add frame to the container
pCont->Add(xXFFrame.get());
}
}
/**
@@ -1190,17 +1190,16 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
sal_uInt16 nColID = pCellList->GetColumnID();
XFCell* pCell = GetCellsMap(nRowID,static_cast<sal_uInt8>(nColID));
if (pCell)
if (!pCell)
{
throw std::runtime_error("Hidden cell would not be in cellsmap");
}
pCellList->Convert(pCell, this);
//process paragraph
PostProcessParagraph(pCell, nRowID, nColID);
}
else
{
throw std::runtime_error("Hidden cell would not be in cellsmap");
}
}
pCellList = dynamic_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
if (aSeen.find(pCellList) != aSeen.end())
@@ -1227,8 +1226,9 @@ void LwpTableLayout::PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_
{
// if number right, set alignment to right
LwpCellLayout * pCellLayout = GetCellByRowCol(nRowID, nColID);
if(pCellLayout)
{
if(!pCellLayout)
return;
rtl::Reference<XFContent> first(
pCell->FindFirstContent(enumXFContentPara));
XFParagraph * pXFPara = static_cast<XFParagraph*>(first.get());
@@ -1249,8 +1249,9 @@ void LwpTableLayout::PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_
}
XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName());
if ((pStyle && pStyle->GetNumberRight()) || bColorMod)
{
if (!((pStyle && pStyle->GetNumberRight()) || bColorMod))
return;
std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
if (pStyle)
@@ -1283,8 +1284,6 @@ void LwpTableLayout::PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_
pXFPara->SetStyleName(StyleName);
}
}
}
/**
* @short Parse all cols of table

View File

@@ -261,8 +261,9 @@ void LwpTocSuperLayout::XFConvert(XFContentContainer* pCont)
*/
void LwpTocSuperLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart, sal_Int32 nEnd, bool bAll)
{
if (m_pFrame)
{
if (!m_pFrame)
return;
rtl::Reference<XFFrame> xXFFrame;
if(nEnd < nStart)
{
@@ -277,8 +278,9 @@ void LwpTocSuperLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nSt
//parse table, and add table to frame or TOC
LwpTableLayout * pTableLayout = GetTableLayout();
if (pTableLayout)
{
if (!pTableLayout)
return;
XFContentContainer* pTableContainer = xXFFrame.get();
// if *this is a TOCSuperTableLayout and it's located in a cell
// add the frame to upper level and add TOCSuperTableLayout into the frame
@@ -297,8 +299,6 @@ void LwpTocSuperLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nSt
pCont->Add(xXFFrame.get());
}
pTableLayout->XFConvert(pTableContainer);
}
}
}
@@ -318,8 +318,9 @@ void LwpTocSuperLayout::AddSourceStyle(XFIndex* pToc, LwpTocLevelData * pLevel,
OUString sLwpStyleName = pLevel->GetSearchStyle();
if (pFoundry)
{
if (!pFoundry)
return;
LwpDocument * pDoc = pFoundry->GetDocument();
if (pDoc && pDoc->IsChildDoc())
{
@@ -336,7 +337,6 @@ void LwpTocSuperLayout::AddSourceStyle(XFIndex* pToc, LwpTocLevelData * pLevel,
}
}
}
}
/**
* @short Get whether page number is right alignment