summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 10:06:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 11:19:13 +0200
commit9f424bf2d71abcb7d30f2a4539169c4c10ffeb8c (patch)
treedc5f06d5d4d60a4c58e2a18850b99bb7406f51dd
parent320563f857b564e44615e88013f7a53a480beb2b (diff)
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>
-rw-r--r--lotuswordpro/source/filter/lwpborderstuff.cxx34
-rw-r--r--lotuswordpro/source/filter/lwpdoc.cxx95
-rw-r--r--lotuswordpro/source/filter/lwpfootnote.cxx48
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx184
-rw-r--r--lotuswordpro/source/filter/lwpfrib.cxx40
-rw-r--r--lotuswordpro/source/filter/lwpfribmark.cxx44
-rw-r--r--lotuswordpro/source/filter/lwpfribsection.cxx36
-rw-r--r--lotuswordpro/source/filter/lwpfribtext.cxx28
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx76
-rw-r--r--lotuswordpro/source/filter/lwplaypiece.cxx28
-rw-r--r--lotuswordpro/source/filter/lwpnotes.cxx42
-rw-r--r--lotuswordpro/source/filter/lwpnumericfmt.cxx24
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx110
-rw-r--r--lotuswordpro/source/filter/lwppara.cxx34
-rw-r--r--lotuswordpro/source/filter/lwpparastyle.cxx43
-rw-r--r--lotuswordpro/source/filter/lwpsdwfileloader.cxx28
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx147
-rw-r--r--lotuswordpro/source/filter/lwptoc.cxx96
18 files changed, 566 insertions, 571 deletions
diff --git a/lotuswordpro/source/filter/lwpborderstuff.cxx b/lotuswordpro/source/filter/lwpborderstuff.cxx
index 89cc11ac8f82..d3aebcdabdb7 100644
--- a/lotuswordpro/source/filter/lwpborderstuff.cxx
+++ b/lotuswordpro/source/filter/lwpborderstuff.cxx
@@ -131,24 +131,24 @@ 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 )
{
- if( m_nBorderGroupIDLeft&EXTERNAL_ID )
- {
- m_nBorderGroupIDLeft = BGRP_SOLID;
- }
- if( m_nBorderGroupIDRight&EXTERNAL_ID )
- {
- m_nBorderGroupIDRight = BGRP_SOLID;
- }
- if( m_nBorderGroupIDTop&EXTERNAL_ID )
- {
- m_nBorderGroupIDTop = BGRP_SOLID;
- }
- if( m_nBorderGroupIDBottom&EXTERNAL_ID )
- {
- m_nBorderGroupIDBottom = BGRP_SOLID;
- }
+ m_nBorderGroupIDLeft = BGRP_SOLID;
+ }
+ if( m_nBorderGroupIDRight&EXTERNAL_ID )
+ {
+ m_nBorderGroupIDRight = BGRP_SOLID;
+ }
+ if( m_nBorderGroupIDTop&EXTERNAL_ID )
+ {
+ m_nBorderGroupIDTop = BGRP_SOLID;
+ }
+ if( m_nBorderGroupIDBottom&EXTERNAL_ID )
+ {
+ m_nBorderGroupIDBottom = BGRP_SOLID;
}
}
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index fd6e567ee030..f42a510fef5e 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -260,19 +260,19 @@ 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)
{
- LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
- if(pPageLayout)
+ //In Ole division, the content of pagelayout is VO_OLEOBJECT
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent().obj(VO_STORY).get());
+ if(pStory)
{
- //In Ole division, the content of pagelayout is VO_OLEOBJECT
- LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent().obj(VO_STORY).get());
- if(pStory)
- {
- //add all the pagelayout in order into the pagelayout list;
- pStory->SortPageLayout();
- pStory->SetCurrentLayout(pPageLayout);
- }
+ //add all the pagelayout in order into the pagelayout list;
+ pStory->SortPageLayout();
+ pStory->SetCurrentLayout(pPageLayout);
}
}
}
@@ -285,20 +285,20 @@ 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())
{
- rtl::Reference<LwpStory> xStory(dynamic_cast<LwpStory*>(xContent->GetChildHead().obj(VO_STORY).get()));
- o3tl::sorted_vector<LwpStory*> aSeen;
- while (xStory.is())
- {
- aSeen.insert(xStory.get());
- //Register the child para
- xStory->SetFoundry(m_xOwnedFoundry.get());
- xStory->DoRegisterStyle();
- xStory.set(dynamic_cast<LwpStory*>(xStory->GetNext().obj(VO_STORY).get()));
- if (aSeen.find(xStory.get()) != aSeen.end())
- throw std::runtime_error("loop in conversion");
- }
+ aSeen.insert(xStory.get());
+ //Register the child para
+ xStory->SetFoundry(m_xOwnedFoundry.get());
+ xStory->DoRegisterStyle();
+ xStory.set(dynamic_cast<LwpStory*>(xStory->GetNext().obj(VO_STORY).get()));
+ if (aSeen.find(xStory.get()) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
}
}
/**
@@ -368,21 +368,21 @@ 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)
+ return;
+
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
+ if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
{
- LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID().obj().get());
- if(pHeadTail)
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID().obj().get());
+ if(pPageLayout)
{
- LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
- if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
- {
- LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID().obj().get());
- if(pPageLayout)
- {
- pPageLayout->SetFoundry(GetFoundry());
- pPageLayout->RegisterEndnoteStyle();
- }
- }
+ pPageLayout->SetFoundry(GetFoundry());
+ pPageLayout->RegisterEndnoteStyle();
}
}
}
@@ -392,20 +392,19 @@ void LwpDocument::RegisterFootnoteStyles()
*/
void LwpDocument::RegisterDefaultParaStyles()
{
- if(!IsChildDoc())
+ if(IsChildDoc())
+ return;
+
+ //Get First Division
+ //LwpDocument* pFirstDoc = GetFirstDivision();
+ LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
+ if(pFirstDoc)
{
- //Get First Division
- //LwpDocument* pFirstDoc = GetFirstDivision();
- LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
- if(pFirstDoc)
+ LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc().obj().get());
+ if(pVerDoc)
{
- LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc().obj().get());
- if(pVerDoc)
- {
- pVerDoc->RegisterStyle();
- }
+ pVerDoc->RegisterStyle();
}
-
}
}
diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx
index 7ae711e30b1e..17567226326f 100644
--- a/lotuswordpro/source/filter/lwpfootnote.cxx
+++ b/lotuswordpro/source/filter/lwpfootnote.cxx
@@ -102,31 +102,31 @@ 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)
{
- rtl::Reference<XFContentContainer> xContent;
- if(pFootnote->GetType() == FN_FOOTNOTE)
- {
- xContent.set(new XFFootNote);
- }
- else
- {
- xContent.set(new XFEndNote);
- }
- pFootnote->XFConvert(xContent.get());
- if (m_ModFlag)
- {
- //set footnote number font style
- rtl::Reference<XFTextSpan> xSpan(new XFTextSpan);
- xSpan->SetStyleName(GetStyleName());
- //add the xffootnote into the content container
- xSpan->Add(xContent.get());
- pCont->Add(xSpan.get());
- }
- else
- {
- pCont->Add(xContent.get());
- }
+ xContent.set(new XFFootNote);
+ }
+ else
+ {
+ xContent.set(new XFEndNote);
+ }
+ pFootnote->XFConvert(xContent.get());
+ if (m_ModFlag)
+ {
+ //set footnote number font style
+ rtl::Reference<XFTextSpan> xSpan(new XFTextSpan);
+ xSpan->SetStyleName(GetStyleName());
+ //add the xffootnote into the content container
+ xSpan->Add(xContent.get());
+ pCont->Add(xSpan.get());
+ }
+ else
+ {
+ pCont->Add(xContent.get());
}
}
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index 6f7a77e77b5f..570366f3793d 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -792,18 +792,17 @@ void LwpFrameLayout::Read()
*/
void LwpFrameLayout::XFConvert(XFContentContainer* pCont)
{
- if(m_pFrame)
- {
- //parse the frame which anchor to paragraph
- if(IsRelativeAnchored())
- {
- XFConvertFrame(pCont);
- }
- else
- {
- m_pFrame->XFConvert(pCont);
- }
+ if(!m_pFrame)
+ return;
+ //parse the frame which anchor to paragraph
+ if(IsRelativeAnchored())
+ {
+ XFConvertFrame(pCont);
+ }
+ else
+ {
+ m_pFrame->XFConvert(pCont);
}
}
/**
@@ -814,32 +813,32 @@ 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)
{
- rtl::Reference<XFFrame> xXFFrame;
- if(nEnd < nStart)
- {
- xXFFrame.set(new XFFrame);
- }
- else
- {
- xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
- }
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
- m_pFrame->Parse(xXFFrame.get(), nStart);
- //if it is a link frame, parse contents only once
- if(!HasPreviousLinkLayout())
+ m_pFrame->Parse(xXFFrame.get(), nStart);
+ //if it is a link frame, parse contents only once
+ if(!HasPreviousLinkLayout())
+ {
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ if (content.is())
{
- rtl::Reference<LwpObject> content = m_Content.obj();
- if (content.is())
- {
- content->DoXFConvert(xXFFrame.get());
- //set frame size according to ole size
- ApplyGraphicSize(xXFFrame.get());
- }
+ content->DoXFConvert(xXFFrame.get());
+ //set frame size according to ole size
+ ApplyGraphicSize(xXFFrame.get());
}
- pCont->Add(xXFFrame.get());
}
+ pCont->Add(xXFFrame.get());
}
/**
* @descr register frame style
@@ -985,38 +984,38 @@ 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;
+ double fHeight = 0;
+ pGraOle->GetGrafScaledSize(fWidth, fHeight);
+ if( IsFitGraphic())
{
- LwpGraphicOleObject* pGraOle = static_cast<LwpGraphicOleObject*>(content.get());
- //Get frame geometry size
- double fWidth = 0;
- double fHeight = 0;
- pGraOle->GetGrafScaledSize(fWidth, fHeight);
- if( IsFitGraphic())
- {
- //graphic scaled sze
- fWidth += GetMarginsValue(MARGIN_LEFT) + GetMarginsValue(MARGIN_RIGHT);
- fHeight += GetMarginsValue(MARGIN_TOP) + GetMarginsValue(MARGIN_BOTTOM);
- }
- else if(IsAutoGrowDown() || IsAutoGrowUp())
- {
- fWidth = GetWidth();
- fHeight += GetMarginsValue(MARGIN_TOP) + GetMarginsValue(MARGIN_BOTTOM);
- }
- else if( IsAutoGrowLeft() || IsAutoGrowRight())
- {
- fHeight = GetHeight();
- fWidth += GetMarginsValue(MARGIN_LEFT) + GetMarginsValue(MARGIN_RIGHT);
- }
- else
- {
- fWidth = GetWidth();
- fHeight = GetHeight();
- }
- pXFFrame->SetWidth(fWidth);
- pXFFrame->SetHeight(fHeight);
+ //graphic scaled sze
+ fWidth += GetMarginsValue(MARGIN_LEFT) + GetMarginsValue(MARGIN_RIGHT);
+ fHeight += GetMarginsValue(MARGIN_TOP) + GetMarginsValue(MARGIN_BOTTOM);
+ }
+ else if(IsAutoGrowDown() || IsAutoGrowUp())
+ {
+ fWidth = GetWidth();
+ fHeight += GetMarginsValue(MARGIN_TOP) + GetMarginsValue(MARGIN_BOTTOM);
+ }
+ else if( IsAutoGrowLeft() || IsAutoGrowRight())
+ {
+ fHeight = GetHeight();
+ fWidth += GetMarginsValue(MARGIN_LEFT) + GetMarginsValue(MARGIN_RIGHT);
}
+ else
+ {
+ fWidth = GetWidth();
+ fHeight = GetHeight();
+ }
+ pXFFrame->SetWidth(fWidth);
+ pXFFrame->SetHeight(fHeight);
}
LwpGroupLayout::LwpGroupLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
@@ -1061,18 +1060,17 @@ void LwpGroupLayout::RegisterStyle()
*/
void LwpGroupLayout::XFConvert(XFContentContainer *pCont)
{
- if(m_pFrame)
- {
- //parse the frame which anchor to paragraph
- if(IsRelativeAnchored())
- {
- XFConvertFrame(pCont);
- }
- else
- {
- m_pFrame->XFConvert(pCont);
- }
+ if(!m_pFrame)
+ return;
+ //parse the frame which anchor to paragraph
+ if(IsRelativeAnchored())
+ {
+ XFConvertFrame(pCont);
+ }
+ else
+ {
+ m_pFrame->XFConvert(pCont);
}
}
/**
@@ -1083,31 +1081,31 @@ void LwpGroupLayout::XFConvert(XFContentContainer *pCont)
*/
void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart , sal_Int32 nEnd, bool bAll)
{
- if(m_pFrame)
- {
- rtl::Reference<XFFrame> xXFFrame;
- if(nEnd < nStart)
- {
- xXFFrame.set(new XFFrame);
- }
- else
- {
- xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
- }
+ if(!m_pFrame)
+ return;
- m_pFrame->Parse(xXFFrame.get(), nStart);
+ rtl::Reference<XFFrame> xXFFrame;
+ if(nEnd < nStart)
+ {
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
- //add child frame into group
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
+ m_pFrame->Parse(xXFFrame.get(), nStart);
- while (pLayout && pLayout != this)
- {
- pLayout->DoXFConvert(xXFFrame.get());
- pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
- }
+ //add child frame into group
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- pCont->Add(xXFFrame.get());
+ while (pLayout && pLayout != this)
+ {
+ pLayout->DoXFConvert(xXFFrame.get());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
}
+
+ pCont->Add(xXFFrame.get());
}
LwpGroupFrame::LwpGroupFrame(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index cb14d3a4324d..37684d7d703e 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -291,29 +291,29 @@ 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);
+ else //register a new style
{
- XFColor aColor = GetHighlightColor();//right yellow
- if (pStyle)//change the style directly
- pStyle->GetFont()->SetBackColor(aColor);
- else //register a new style
- {
- std::unique_ptr<XFTextStyle> pNewStyle(new XFTextStyle());
+ std::unique_ptr<XFTextStyle> pNewStyle(new XFTextStyle());
- if (!m_StyleName.isEmpty())
- {
- XFTextStyle* pOldStyle = pXFStyleManager->FindTextStyle(m_StyleName);
- *pNewStyle = *pOldStyle;
- pNewStyle->GetFont()->SetBackColor(aColor);
- }
- else
- {
- pFont = new XFFont;
- pFont->SetBackColor(aColor);
- pNewStyle->SetFont(pFont);
- }
- m_StyleName = pXFStyleManager->AddStyle(std::move(pNewStyle)).m_pStyle->GetStyleName();
+ if (!m_StyleName.isEmpty())
+ {
+ XFTextStyle* pOldStyle = pXFStyleManager->FindTextStyle(m_StyleName);
+ *pNewStyle = *pOldStyle;
+ pNewStyle->GetFont()->SetBackColor(aColor);
+ }
+ else
+ {
+ pFont = new XFFont;
+ pFont->SetBackColor(aColor);
+ pNewStyle->SetFont(pFont);
}
+ m_StyleName = pXFStyleManager->AddStyle(std::move(pNewStyle)).m_pStyle->GetStyleName();
}
}
diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
index 74f95a956e3c..9ee9fb9c3e58 100644
--- a/lotuswordpro/source/filter/lwpfribmark.cxx
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -1213,19 +1213,19 @@ void LwpFribField::ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark
break;
}
}
- if (pContent)
+ if (!pContent)
+ return;
+
+ if (m_ModFlag)//(m_pModifiers)
{
- if (m_ModFlag)//(m_pModifiers)
- {
- XFTextSpanStart* pSpan = new XFTextSpanStart;
- pSpan->SetStyleName(GetStyleName());
- pSpan->Add(pContent);
- pXFPara->Add(pSpan);
- pFieldMark->SetStyleFlag(true);
- }
- else
- pXFPara->Add(pContent);
+ XFTextSpanStart* pSpan = new XFTextSpanStart;
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pContent);
+ pXFPara->Add(pSpan);
+ pFieldMark->SetStyleFlag(true);
}
+ else
+ pXFPara->Add(pContent);
}
void LwpFribField::ConvertDocFieldEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
@@ -1299,19 +1299,19 @@ void LwpFribField::ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark
default:
break;
}
- if (pContent)
+ if (!pContent)
+ return;
+
+ if (m_ModFlag)
{
- if (m_ModFlag)
- {
- XFTextSpanStart* pSpan = new XFTextSpanStart;
- pSpan->SetStyleName(GetStyleName());
- pSpan->Add(pContent);
- pXFPara->Add(pSpan);
- pFieldMark->SetStyleFlag(true);
- }
- else
- pXFPara->Add(pContent);
+ XFTextSpanStart* pSpan = new XFTextSpanStart;
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pContent);
+ pXFPara->Add(pSpan);
+ pFieldMark->SetStyleFlag(true);
}
+ else
+ pXFPara->Add(pContent);
}
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index 3cd68fca4647..a3ada1578e01 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -304,27 +304,27 @@ 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());
+ LwpPageLayout* pCurrentLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
+ if (pCurrentLayout)
{
- std::unique_ptr<XFSectionStyle> pSectStyle(new XFSectionStyle());
- //set margin
- pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
- LwpPageLayout* pCurrentLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
- if (pCurrentLayout)
- {
- double fLeft = m_pLayout->GetMarginsValue(MARGIN_LEFT) - pCurrentLayout->GetMarginsValue(MARGIN_LEFT);
- double fRight = m_pLayout->GetMarginsValue(MARGIN_RIGHT) - pCurrentLayout->GetMarginsValue(MARGIN_RIGHT);
- pSectStyle->SetMarginLeft(fLeft);
- pSectStyle->SetMarginRight(fRight);
- }
+ double fLeft = m_pLayout->GetMarginsValue(MARGIN_LEFT) - pCurrentLayout->GetMarginsValue(MARGIN_LEFT);
+ double fRight = m_pLayout->GetMarginsValue(MARGIN_RIGHT) - pCurrentLayout->GetMarginsValue(MARGIN_RIGHT);
+ pSectStyle->SetMarginLeft(fLeft);
+ pSectStyle->SetMarginRight(fRight);
+ }
- XFColumns* pColumns = m_pLayout->GetXFColumns();
- if(pColumns)
- {
- pSectStyle->SetColumns(pColumns);
- }
- m_SectionStyleName = pXFStyleManager->AddStyle(std::move(pSectStyle)).m_pStyle->GetStyleName();
+ XFColumns* pColumns = m_pLayout->GetXFColumns();
+ if(pColumns)
+ {
+ pSectStyle->SetColumns(pColumns);
}
+ m_SectionStyleName = pXFStyleManager->AddStyle(std::move(pSectStyle)).m_pStyle->GetStyleName();
}
/**
diff --git a/lotuswordpro/source/filter/lwpfribtext.cxx b/lotuswordpro/source/filter/lwpfribtext.cxx
index fab2252cb24a..0ba910ab7da3 100644
--- a/lotuswordpro/source/filter/lwpfribtext.cxx
+++ b/lotuswordpro/source/filter/lwpfribtext.cxx
@@ -83,23 +83,23 @@ 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)
{
- rtl_TextEncoding rEncode;
- if(m_bNoUnicode)
- {
- rEncode = RTL_TEXTENCODING_ISO_8859_1;
- }
+ rEncode = RTL_TEXTENCODING_ISO_8859_1;
+ }
+ else
+ {
+ if (m_pModifiers && m_pModifiers->CodePage)
+ rEncode = LwpCharSetMgr::GetInstance()->
+ GetTextCharEncoding(m_pModifiers->CodePage);
else
- {
- if (m_pModifiers && m_pModifiers->CodePage)
- rEncode = LwpCharSetMgr::GetInstance()->
- GetTextCharEncoding(m_pModifiers->CodePage);
- else
- rEncode = LwpCharSetMgr::GetTextCharEncoding();
- }
- LwpTools::QuickReadUnicode(pObjStrm, m_Content, len, rEncode);
+ rEncode = LwpCharSetMgr::GetTextCharEncoding();
}
+ LwpTools::QuickReadUnicode(pObjStrm, m_Content, len, rEncode);
}
void LwpFribText::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 13745c206740..efb93ab32f72 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -638,49 +638,49 @@ void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont)
{
std::unique_ptr<sal_uInt8[]> pGrafData;
sal_uInt32 nDataLen = GetGrafData(pGrafData);
- if(pGrafData)
- {
- //convert equation
- XFParagraph* pXFPara = new XFParagraph;
- pXFPara->Add("Formula:");
- //add notes
- XFAnnotation* pXFNote = new XFAnnotation;
- //add equation to comment notes
- XFParagraph* pXFNotePara = new XFParagraph;
- //equation header text: Times New Roman,
- // 18,12,0,0,0,0,0.
- // .TCIformat{2}
- //total head length = 45
- bool bOk = true;
- sal_uInt32 nBegin = 45;
- sal_uInt32 nEnd = 0;
- if (nDataLen >= 1)
- nEnd = nDataLen - 1;
- else
- bOk = false;
+ if(!pGrafData)
+ return;
- if (bOk && pGrafData[nEnd] == '$' && nEnd > 0 && pGrafData[nEnd-1] != '\\')
- {
- //equation body is contained by '$';
- nBegin++;
- nEnd--;
- }
+ //convert equation
+ XFParagraph* pXFPara = new XFParagraph;
+ pXFPara->Add("Formula:");
+ //add notes
+ XFAnnotation* pXFNote = new XFAnnotation;
+ //add equation to comment notes
+ XFParagraph* pXFNotePara = new XFParagraph;
+ //equation header text: Times New Roman,
+ // 18,12,0,0,0,0,0.
+ // .TCIformat{2}
+ //total head length = 45
+ bool bOk = true;
+ sal_uInt32 nBegin = 45;
+ sal_uInt32 nEnd = 0;
+ if (nDataLen >= 1)
+ nEnd = nDataLen - 1;
+ else
+ bOk = false;
+
+ if (bOk && pGrafData[nEnd] == '$' && nEnd > 0 && pGrafData[nEnd-1] != '\\')
+ {
+ //equation body is contained by '$';
+ nBegin++;
+ nEnd--;
+ }
- bOk &= nEnd >= nBegin;
- if (bOk)
+ bOk &= nEnd >= nBegin;
+ if (bOk)
+ {
+ std::unique_ptr<sal_uInt8[]> pEquData( new sal_uInt8[nEnd - nBegin + 1] );
+ for(sal_uInt32 nIndex = 0; nIndex < nEnd - nBegin +1 ; nIndex++)
{
- std::unique_ptr<sal_uInt8[]> pEquData( new sal_uInt8[nEnd - nBegin + 1] );
- for(sal_uInt32 nIndex = 0; nIndex < nEnd - nBegin +1 ; nIndex++)
- {
- pEquData[nIndex] = pGrafData[nBegin + nIndex];
- }
- pXFNotePara->Add(OUString(reinterpret_cast<char*>(pEquData.get()), (nEnd - nBegin + 1), osl_getThreadTextEncoding()));
+ pEquData[nIndex] = pGrafData[nBegin + nIndex];
}
- pXFNote->Add(pXFNotePara);
-
- pXFPara->Add(pXFNote);
- pCont->Add(pXFPara);
+ pXFNotePara->Add(OUString(reinterpret_cast<char*>(pEquData.get()), (nEnd - nBegin + 1), osl_getThreadTextEncoding()));
}
+ pXFNote->Add(pXFNotePara);
+
+ pXFPara->Add(pXFNote);
+ pCont->Add(pXFPara);
}
void LwpGraphicObject::GetGrafOrgSize(double & rWidth, double & rHeight)
diff --git a/lotuswordpro/source/filter/lwplaypiece.cxx b/lotuswordpro/source/filter/lwplaypiece.cxx
index 1922e1543a6e..22651e2de1cf 100644
--- a/lotuswordpro/source/filter/lwplaypiece.cxx
+++ b/lotuswordpro/source/filter/lwplaypiece.cxx
@@ -210,20 +210,20 @@ LwpExternalBorder::~LwpExternalBorder()
void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
{
- if( LwpFileHeader::m_nFileRevision >= 0x000F )
- {
- //enum {BORDER,JOIN};
- m_LeftName.Read(pStrm);
- m_TopName.Read(pStrm);
- m_RightName.Read(pStrm);
- m_BottomName.Read(pStrm);
- // TODO: Do not know what it is for
- /*cLeftName = CStyleMgr::GetUniqueMetaFileName(cLeftName,BORDER);
- cRightName = CStyleMgr::GetUniqueMetaFileName(cRightName,BORDER);
- cTopName = CStyleMgr::GetUniqueMetaFileName(cTopName,BORDER);
- cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
- pStrm->SkipExtra();
- }
+ if( LwpFileHeader::m_nFileRevision < 0x000F )
+ return;
+
+ //enum {BORDER,JOIN};
+ m_LeftName.Read(pStrm);
+ m_TopName.Read(pStrm);
+ m_RightName.Read(pStrm);
+ m_BottomName.Read(pStrm);
+ // TODO: Do not know what it is for
+ /*cLeftName = CStyleMgr::GetUniqueMetaFileName(cLeftName,BORDER);
+ cRightName = CStyleMgr::GetUniqueMetaFileName(cRightName,BORDER);
+ cTopName = CStyleMgr::GetUniqueMetaFileName(cTopName,BORDER);
+ cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
+ pStrm->SkipExtra();
}
LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx
index dba6ea0da974..db25f3e3afb4 100644
--- a/lotuswordpro/source/filter/lwpnotes.cxx
+++ b/lotuswordpro/source/filter/lwpnotes.cxx
@@ -99,29 +99,29 @@ 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;
+ long nTime = pLayout->GetTime();
+ if(LtgLocalTime(nTime, aTm))
{
- XFAnnotation* pXFNote = new XFAnnotation;
- pXFNote->SetAuthor(pLayout->GetAuthor());
- LtTm aTm;
- long nTime = pLayout->GetTime();
- if(LtgLocalTime(nTime, aTm))
- {
- pXFNote->SetDate(LwpTools::DateTimeToOUString(aTm));
- }
+ pXFNote->SetDate(LwpTools::DateTimeToOUString(aTm));
+ }
- pLayout->XFConvert(pXFNote);
- if(m_pModifiers)
- {
- XFTextSpan *pSpan = new XFTextSpan();
- pSpan->SetStyleName(GetStyleName());
- pSpan->Add(pXFNote);
- pCont->Add(pSpan);
- }
- else
- {
- pCont->Add(pXFNote);
- }
+ pLayout->XFConvert(pXFNote);
+ if(m_pModifiers)
+ {
+ XFTextSpan *pSpan = new XFTextSpan();
+ pSpan->SetStyleName(GetStyleName());
+ pSpan->Add(pXFNote);
+ pCont->Add(pSpan);
+ }
+ else
+ {
+ pCont->Add(pXFNote);
}
}
diff --git a/lotuswordpro/source/filter/lwpnumericfmt.cxx b/lotuswordpro/source/filter/lwpnumericfmt.cxx
index 871dd56ab4f0..1826482edac0 100644
--- a/lotuswordpro/source/filter/lwpnumericfmt.cxx
+++ b/lotuswordpro/source/filter/lwpnumericfmt.cxx
@@ -232,22 +232,22 @@ void LwpNumericFormat::GetCurrencyStr(LwpNumericFormatSubset aNumber, OUString&
}
}
}
- if ( aNumber.IsDefaultSuffix())
+ if ( !aNumber.IsDefaultSuffix())
+ return;
+
+ if (bPost)
{
- if (bPost)
+ aSuffix = aSymbol;
+ if (bShowSpace)
{
- aSuffix = aSymbol;
- if (bShowSpace)
- {
- aSuffix = " " + aSuffix;
- }
-
+ aSuffix = " " + aSuffix;
}
- if (bNegtive)
- {
- aSuffix += ")";
- }
+ }
+
+ if (bNegtive)
+ {
+ aSuffix += ")";
}
}
void LwpNumericFormat::SetNumberType(XFNumberStyle* pStyle)
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index ac829d5df905..8210582dc52a 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -258,52 +258,52 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1)
{
//Get the footnoteoptions for the root document
LwpDocument* pDocument = m_pFoundry ? m_pFoundry->GetDocument() : nullptr;
- if (pDocument)
- {
- LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts();
+ if (!pDocument)
+ return;
- LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast<LwpFootnoteOptions*>(pFontnodeId->obj().get()) : nullptr;
- if(pFootnoteOpts)
- {
- LwpFootnoteSeparatorOptions& rFootnoteSep = pFootnoteOpts->GetFootnoteSeparator();
- //set length
- sal_uInt32 nLengthPercent = 100;
- double fWidth = 0;
- if(rFootnoteSep.HasSeparator())
- {
- fWidth = rFootnoteSep.GetTopBorderWidth();
- }
- if(rFootnoteSep.HasCustomLength())
- {
- const double fMarginWidth = GetMarginWidth();
- if (fMarginWidth == 0.0)
- throw o3tl::divide_by_zero();
+ LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts();
- nLengthPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetLength()) / fMarginWidth);
- if (nLengthPercent > 100)
- nLengthPercent = 100;
- }
- double fAbove = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetAbove());
- double fBelow = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetBelow());
- LwpColor aColor = rFootnoteSep.GetTopBorderColor();
- enumXFAlignType eAlignType = enumXFAlignStart;
- if(rFootnoteSep.GetIndent() > 0)
- {
- const double fMarginWidth = GetMarginWidth();
- if (fMarginWidth == 0.0)
- throw o3tl::divide_by_zero();
-
- //SODC don't support indent
- sal_uInt32 nIndentPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetIndent()) / fMarginWidth);
- if (nIndentPercent + nLengthPercent >= 100)
- eAlignType = enumXFAlignEnd;
- }
- if(aColor.IsValidColor())
- {
- XFColor aXFColor(aColor.To24Color());
- pm1->SetFootNoteSeparator(eAlignType,fWidth, nLengthPercent, fAbove, fBelow, aXFColor);
- }
- }
+ LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast<LwpFootnoteOptions*>(pFontnodeId->obj().get()) : nullptr;
+ if(!pFootnoteOpts)
+ return;
+
+ LwpFootnoteSeparatorOptions& rFootnoteSep = pFootnoteOpts->GetFootnoteSeparator();
+ //set length
+ sal_uInt32 nLengthPercent = 100;
+ double fWidth = 0;
+ if(rFootnoteSep.HasSeparator())
+ {
+ fWidth = rFootnoteSep.GetTopBorderWidth();
+ }
+ if(rFootnoteSep.HasCustomLength())
+ {
+ const double fMarginWidth = GetMarginWidth();
+ if (fMarginWidth == 0.0)
+ throw o3tl::divide_by_zero();
+
+ nLengthPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetLength()) / fMarginWidth);
+ if (nLengthPercent > 100)
+ nLengthPercent = 100;
+ }
+ double fAbove = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetAbove());
+ double fBelow = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetBelow());
+ LwpColor aColor = rFootnoteSep.GetTopBorderColor();
+ enumXFAlignType eAlignType = enumXFAlignStart;
+ if(rFootnoteSep.GetIndent() > 0)
+ {
+ const double fMarginWidth = GetMarginWidth();
+ if (fMarginWidth == 0.0)
+ throw o3tl::divide_by_zero();
+
+ //SODC don't support indent
+ sal_uInt32 nIndentPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetIndent()) / fMarginWidth);
+ if (nIndentPercent + nLengthPercent >= 100)
+ eAlignType = enumXFAlignEnd;
+ }
+ if(aColor.IsValidColor())
+ {
+ XFColor aXFColor(aColor.To24Color());
+ pm1->SetFootNoteSeparator(eAlignType,fWidth, nLengthPercent, fAbove, fBelow, aXFColor);
}
}
@@ -469,18 +469,18 @@ bool LwpPageLayout::HasFillerPageText(LwpFoundry const * pFoundry)
*/
void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
{
- if(HasFillerPageText(m_pFoundry))
- {
- //get fillerpage story from division info
- LwpDocument* pDoc = m_pFoundry->GetDocument();
- LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID().obj().get());
- LwpStory* pStory = pDivInfo ? dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get()) : nullptr;
+ if(!HasFillerPageText(m_pFoundry))
+ return;
- //parse fillerpage story
- if(pStory)
- {
- pStory->XFConvert(pCont);
- }
+ //get fillerpage story from division info
+ LwpDocument* pDoc = m_pFoundry->GetDocument();
+ LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID().obj().get());
+ LwpStory* pStory = pDivInfo ? dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get()) : nullptr;
+
+ //parse fillerpage story
+ if(pStory)
+ {
+ pStory->XFConvert(pCont);
}
}
/**
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index b60f34354141..ff17248ac03e 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -264,25 +264,25 @@ 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())
- {
- bool bNewSection = pStory->IsNeedSection();
- LwpPageLayout* pLayout = pStory->GetCurrentLayout();
- if(bNewSection)
- {
- RegisterNewSectionStyle(pLayout);
- }
+ if(!(pStory && pStory->IsPMModified()))
+ return;
- //register master page style
- std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
- *xOverStyle = *pBaseStyle;
- xOverStyle->SetStyleName( "");
- xOverStyle->SetMasterPage(pLayout->GetStyleName());
- if (!m_ParentStyleName.isEmpty())
- xOverStyle->SetParentStyleName(m_ParentStyleName);
- XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
- m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+ bool bNewSection = pStory->IsNeedSection();
+ LwpPageLayout* pLayout = pStory->GetCurrentLayout();
+ if(bNewSection)
+ {
+ RegisterNewSectionStyle(pLayout);
}
+
+ //register master page style
+ std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
+ *xOverStyle = *pBaseStyle;
+ xOverStyle->SetStyleName( "");
+ xOverStyle->SetMasterPage(pLayout->GetStyleName());
+ if (!m_ParentStyleName.isEmpty())
+ xOverStyle->SetParentStyleName(m_ParentStyleName);
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
}
/**
* @short register paragraph style
diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx
index 3ae8b69e578f..33b6cc37c77b 100644
--- a/lotuswordpro/source/filter/lwpparastyle.cxx
+++ b/lotuswordpro/source/filter/lwpparastyle.cxx
@@ -326,37 +326,36 @@ void LwpParaStyle::ApplyParaBorder(XFParaStyle* pParaStyle, LwpParaBorderOverrid
//convert to XFBorders object:
LwpBorderStuff *pBorderStuff = pBorder->GetBorderStuff();
- if( pBorderStuff && pBorderStuff->GetSide() != 0 )
- {
- XFBorders *pXFBorders = new XFBorders();
- pParaStyle->SetBorders(pXFBorders);
+ if( !(pBorderStuff && pBorderStuff->GetSide() != 0) )
+ return;
+
+ XFBorders *pXFBorders = new XFBorders();
+ pParaStyle->SetBorders(pXFBorders);
- LwpMargins* pMargins = pBorder->GetMargins();
+ LwpMargins* pMargins = pBorder->GetMargins();
- // apply 4 borders respectively
- LwpBorderStuff::BorderType pType[] = { LwpBorderStuff::LEFT, LwpBorderStuff::RIGHT,
- LwpBorderStuff::TOP, LwpBorderStuff::BOTTOM };
- float pMarginValue[4] = { 0.0, 0.0, 0.0, 0.0 };
+ // apply 4 borders respectively
+ LwpBorderStuff::BorderType pType[] = { LwpBorderStuff::LEFT, LwpBorderStuff::RIGHT,
+ LwpBorderStuff::TOP, LwpBorderStuff::BOTTOM };
+ float pMarginValue[4] = { 0.0, 0.0, 0.0, 0.0 };
- for (sal_uInt8 nC = 0; nC < 4; nC++)
+ for (sal_uInt8 nC = 0; nC < 4; nC++)
+ {
+ if (pBorderStuff->HasSide(pType[nC]))
{
- if (pBorderStuff->HasSide(pType[nC]))
- {
- ApplySubBorder(pBorderStuff, pType[nC], pXFBorders);
+ ApplySubBorder(pBorderStuff, pType[nC], pXFBorders);
- //get border spacing to text content
- if (pMargins)
- {
- pMarginValue[nC] = static_cast<float>(pMargins->GetMarginsValue(nC));
- }
+ //get border spacing to text content
+ if (pMargins)
+ {
+ pMarginValue[nC] = static_cast<float>(pMargins->GetMarginsValue(nC));
}
-
}
- //apply border spacing to text content
- pParaStyle->SetPadding(pMarginValue[0], pMarginValue[1], pMarginValue[2], pMarginValue[3]);
-
}
+
+ //apply border spacing to text content
+ pParaStyle->SetPadding(pMarginValue[0], pMarginValue[1], pMarginValue[2], pMarginValue[3]);
}
void LwpParaStyle::ApplyBreaks(XFParaStyle* pParaStyle, const LwpBreaksOverride* pBreaks)
diff --git a/lotuswordpro/source/filter/lwpsdwfileloader.cxx b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
index 804060e018bc..0c19b3569a5d 100644
--- a/lotuswordpro/source/filter/lwpsdwfileloader.cxx
+++ b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
@@ -81,21 +81,21 @@ void LwpSdwFileLoader::CreateDrawObjects(std::vector< rtl::Reference<XFFrame> >*
unsigned char BinSignature[2];
m_pStream->ReadBytes(BinSignature, 2);
- if (BinSignature[0] == 'S' && BinSignature[1] == 'M')
- {
- unsigned short nVersion;
- m_pStream->ReadUInt16(nVersion);
+ if (!(BinSignature[0] == 'S' && BinSignature[1] == 'M'))
+ return;
+
+ unsigned short nVersion;
+ m_pStream->ReadUInt16(nVersion);
- m_pStream->Seek(0);
- if (nVersion<0x0102)
- {
- assert(false);
- }
- if (nVersion>=0x0102)
- {
- LwpSdwGroupLoaderV0102 sdwGroupLoader(m_pStream, m_pGraphicObj);
- sdwGroupLoader.BeginDrawObjects(pDrawObjVector);
- }
+ m_pStream->Seek(0);
+ if (nVersion<0x0102)
+ {
+ assert(false);
+ }
+ if (nVersion>=0x0102)
+ {
+ LwpSdwGroupLoaderV0102 sdwGroupLoader(m_pStream, m_pGraphicObj);
+ sdwGroupLoader.BeginDrawObjects(pDrawObjVector);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 3191374b35b0..c97fb250dc6a 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -381,28 +381,28 @@ 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)
{
- rtl::Reference<XFFrame> xXFFrame;
- if(nEnd < nStart)
- {
- xXFFrame.set(new XFFrame);
- }
- else
- {
- xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
- }
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
- m_pFrame->Parse(xXFFrame.get(), static_cast<sal_uInt16>(nStart));
- //parse table, and add table to frame
- LwpTableLayout * pTableLayout = GetTableLayout();
- if (pTableLayout)
- {
- pTableLayout->XFConvert(xXFFrame.get());
- }
- //add frame to the container
- pCont->Add(xXFFrame.get());
+ m_pFrame->Parse(xXFFrame.get(), static_cast<sal_uInt16>(nStart));
+ //parse table, and add table to frame
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ if (pTableLayout)
+ {
+ pTableLayout->XFConvert(xXFFrame.get());
}
+ //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)
- {
- pCellList->Convert(pCell, this);
-
- //process paragraph
- PostProcessParagraph(pCell, nRowID, nColID);
- }
- else
+ if (!pCell)
{
throw std::runtime_error("Hidden cell would not be in cellsmap");
}
+
+ pCellList->Convert(pCell, this);
+
+ //process paragraph
+ PostProcessParagraph(pCell, nRowID, nColID);
+
}
pCellList = dynamic_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
if (aSeen.find(pCellList) != aSeen.end())
@@ -1227,63 +1226,63 @@ 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());
+ if (!pXFPara)
+ return;
+ XFColor aNullColor;
+
+ OUString sNumfmt = pCellLayout->GetNumfmtName();
+ bool bColorMod = false;
+ XFNumberStyle* pNumStyle = nullptr;
+ XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+ if (!sNumfmt.isEmpty())
{
- rtl::Reference<XFContent> first(
- pCell->FindFirstContent(enumXFContentPara));
- XFParagraph * pXFPara = static_cast<XFParagraph*>(first.get());
- if (!pXFPara)
- return;
- XFColor aNullColor;
+ pNumStyle = static_cast<XFNumberStyle*>(pXFStyleManager->FindStyle(sNumfmt));
+ XFColor aColor = pNumStyle->GetColor();
+ if ( aColor != aNullColor )
+ bColorMod = true;//end
+ }
- OUString sNumfmt = pCellLayout->GetNumfmtName();
- bool bColorMod = false;
- XFNumberStyle* pNumStyle = nullptr;
- XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
- if (!sNumfmt.isEmpty())
- {
- pNumStyle = static_cast<XFNumberStyle*>(pXFStyleManager->FindStyle(sNumfmt));
- XFColor aColor = pNumStyle->GetColor();
- if ( aColor != aNullColor )
- bColorMod = true;//end
- }
+ XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName());
+ if (!((pStyle && pStyle->GetNumberRight()) || bColorMod))
+ return;
- XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName());
- if ((pStyle && pStyle->GetNumberRight()) || bColorMod)
- {
- std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
+ std::unique_ptr<XFParaStyle> 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<XFFont> xFont = xOverStyle->GetFont();
+ if (xFont.is())
+ {
+ XFColor aColor = xFont->GetColor();
+ if (aColor == aNullColor)
{
- rtl::Reference<XFFont> xFont = xOverStyle->GetFont();
- if (xFont.is())
- {
- XFColor aColor = xFont->GetColor();
- if (aColor == aNullColor)
- {
- rtl::Reference<XFFont> pNewFont(new XFFont);
- aColor = pNumStyle->GetColor();
- pNewFont->SetColor(aColor);
- xOverStyle->SetFont(pNewFont);
- }
- }
+ rtl::Reference<XFFont> pNewFont(new XFFont);
+ aColor = pNumStyle->GetColor();
+ pNewFont->SetColor(aColor);
+ xOverStyle->SetFont(pNewFont);
}
-
- xOverStyle->SetStyleName("");
- OUString StyleName
- = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
-
- pXFPara->SetStyleName(StyleName);
}
}
+
+ xOverStyle->SetStyleName("");
+ OUString StyleName
+ = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName();
+
+ pXFPara->SetStyleName(StyleName);
}
/**
diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx
index e81bf7039be4..8888e6af9619 100644
--- a/lotuswordpro/source/filter/lwptoc.cxx
+++ b/lotuswordpro/source/filter/lwptoc.cxx
@@ -261,44 +261,44 @@ 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)
{
- rtl::Reference<XFFrame> xXFFrame;
- if(nEnd < nStart)
- {
- xXFFrame.set(new XFFrame);
- }
- else
- {
- xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
- }
+ xXFFrame.set(new XFFrame);
+ }
+ else
+ {
+ xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
+ }
- m_pFrame->Parse(xXFFrame.get(), static_cast<sal_uInt16>(nStart));
+ m_pFrame->Parse(xXFFrame.get(), static_cast<sal_uInt16>(nStart));
- //parse table, and add table to frame or TOC
- LwpTableLayout * pTableLayout = GetTableLayout();
- if (pTableLayout)
- {
- 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
- rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout());
- if (!xContainer.is())
- return;
- if (xContainer->IsCell())
- {
- pTableContainer = pCont; // TOC contain table directly
- xXFFrame->Add(pCont);
- m_pCont->Add(xXFFrame.get());
- }
- else
- {
- //add frame to the container
- pCont->Add(xXFFrame.get());
- }
- pTableLayout->XFConvert(pTableContainer);
- }
+ //parse table, and add table to frame or TOC
+ LwpTableLayout * pTableLayout = GetTableLayout();
+ 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
+ rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout());
+ if (!xContainer.is())
+ return;
+ if (xContainer->IsCell())
+ {
+ pTableContainer = pCont; // TOC contain table directly
+ xXFFrame->Add(pCont);
+ m_pCont->Add(xXFFrame.get());
}
+ else
+ {
+ //add frame to the container
+ pCont->Add(xXFFrame.get());
+ }
+ pTableLayout->XFConvert(pTableContainer);
}
@@ -318,22 +318,22 @@ void LwpTocSuperLayout::AddSourceStyle(XFIndex* pToc, LwpTocLevelData * pLevel,
OUString sLwpStyleName = pLevel->GetSearchStyle();
- if (pFoundry)
+ if (!pFoundry)
+ return;
+
+ LwpDocument * pDoc = pFoundry->GetDocument();
+ if (pDoc && pDoc->IsChildDoc())
{
- LwpDocument * pDoc = pFoundry->GetDocument();
- if (pDoc && pDoc->IsChildDoc())
- {
- OUString sSodcStyleName = pFoundry->FindActuralStyleName(sLwpStyleName);
- pToc->AddTocSource(pLevel->GetLevel(), sSodcStyleName);
- }
- else
+ OUString sSodcStyleName = pFoundry->FindActuralStyleName(sLwpStyleName);
+ pToc->AddTocSource(pLevel->GetLevel(), sSodcStyleName);
+ }
+ else
+ {
+ pDoc = pDoc->GetFirstDivision();
+ while (pDoc)
{
- pDoc = pDoc->GetFirstDivision();
- while (pDoc)
- {
- AddSourceStyle(pToc, pLevel, pDoc->GetFoundry() );
- pDoc = pDoc->GetNextDivision();
- }
+ AddSourceStyle(pToc, pLevel, pDoc->GetFoundry() );
+ pDoc = pDoc->GetNextDivision();
}
}
}