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,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;
}
}

View File

@@ -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())
{
//Get First Division
//LwpDocument* pFirstDoc = GetFirstDivision();
LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
if(pFirstDoc)
{
LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc().obj().get());
if(pVerDoc)
{
pVerDoc->RegisterStyle();
}
}
if(IsChildDoc())
return;
//Get First Division
//LwpDocument* pFirstDoc = GetFirstDivision();
LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
if(pFirstDoc)
{
LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc().obj().get());
if(pVerDoc)
{
pVerDoc->RegisterStyle();
}
}
}

View File

@@ -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());
}
}

View File

@@ -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)
{
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);
//if it is a link frame, parse contents only once
if(!HasPreviousLinkLayout())
{
rtl::Reference<LwpObject> content = m_Content.obj();
if (content.is())
{
content->DoXFConvert(xXFFrame.get());
//set frame size according to ole size
ApplyGraphicSize(xXFFrame.get());
}
}
pCont->Add(xXFFrame.get());
rtl::Reference<XFFrame> xXFFrame;
if(nEnd < nStart)
{
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())
{
rtl::Reference<LwpObject> content = m_Content.obj();
if (content.is())
{
content->DoXFConvert(xXFFrame.get());
//set frame size according to ole size
ApplyGraphicSize(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)
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));
}
m_pFrame->Parse(xXFFrame.get(), nStart);
//add child frame into group
LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
while (pLayout && pLayout != this)
{
pLayout->DoXFConvert(xXFFrame.get());
pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
}
pCont->Add(xXFFrame.get());
xXFFrame.set(new XFFrame);
}
else
{
xXFFrame.set(new XFFloatFrame(nStart, nEnd, bAll));
}
m_pFrame->Parse(xXFFrame.get(), nStart);
//add child frame into group
LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().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)

View File

@@ -291,29 +291,29 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
}
}
if (m_pModifiers->HasHighlight)
{
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());
if (!m_pModifiers->HasHighlight)
return;
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();
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());
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();
}
}

View File

@@ -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);
}

View File

@@ -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)
{
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);
}
if(!m_bNewSection)
return;
XFColumns* pColumns = m_pLayout->GetXFColumns();
if(pColumns)
{
pSectStyle->SetColumns(pColumns);
}
m_SectionStyleName = pXFStyleManager->AddStyle(std::move(pSectStyle)).m_pStyle->GetStyleName();
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);
}
XFColumns* pColumns = m_pLayout->GetXFColumns();
if(pColumns)
{
pSectStyle->SetColumns(pColumns);
}
m_SectionStyleName = pXFStyleManager->AddStyle(std::move(pSectStyle)).m_pStyle->GetStyleName();
}
/**

View File

@@ -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;
}
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 = RTL_TEXTENCODING_ISO_8859_1;
}
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);
}
void LwpFribText::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)

View File

@@ -638,49 +638,49 @@ 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:");
//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] != '\\')
{
//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)
{
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()));
}
pXFNote->Add(pXFNotePara);
pXFPara->Add(pXFNote);
pCont->Add(pXFPara);
//equation body is contained by '$';
nBegin++;
nEnd--;
}
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++)
{
pEquData[nIndex] = pGrafData[nBegin + nIndex];
}
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)

View File

@@ -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)

View File

@@ -99,29 +99,29 @@ void LwpFribNote::RegisterNewStyle()
void LwpFribNote::XFConvert(XFContentContainer* pCont)
{
LwpNoteLayout* pLayout = dynamic_cast<LwpNoteLayout*>(m_Layout.obj().get());
if(pLayout)
{
XFAnnotation* pXFNote = new XFAnnotation;
pXFNote->SetAuthor(pLayout->GetAuthor());
LtTm aTm;
long nTime = pLayout->GetTime();
if(LtgLocalTime(nTime, aTm))
{
pXFNote->SetDate(LwpTools::DateTimeToOUString(aTm));
}
if(!pLayout)
return;
pLayout->XFConvert(pXFNote);
if(m_pModifiers)
{
XFTextSpan *pSpan = new XFTextSpan();
pSpan->SetStyleName(GetStyleName());
pSpan->Add(pXFNote);
pCont->Add(pSpan);
}
else
{
pCont->Add(pXFNote);
}
XFAnnotation* pXFNote = new XFAnnotation;
pXFNote->SetAuthor(pLayout->GetAuthor());
LtTm aTm;
long nTime = pLayout->GetTime();
if(LtgLocalTime(nTime, 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);
}
}

View File

@@ -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)

View File

@@ -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)
if (!pDocument)
return;
LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts();
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())
{
LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts();
fWidth = rFootnoteSep.GetTopBorderWidth();
}
if(rFootnoteSep.HasCustomLength())
{
const double fMarginWidth = GetMarginWidth();
if (fMarginWidth == 0.0)
throw o3tl::divide_by_zero();
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();
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();
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);
}
}
//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);
}
}
/**

View File

@@ -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

View File

@@ -326,37 +326,36 @@ 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);
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 };
for (sal_uInt8 nC = 0; nC < 4; nC++)
{
XFBorders *pXFBorders = new XFBorders();
pParaStyle->SetBorders(pXFBorders);
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 };
for (sal_uInt8 nC = 0; nC < 4; nC++)
if (pBorderStuff->HasSide(pType[nC]))
{
if (pBorderStuff->HasSide(pType[nC]))
ApplySubBorder(pBorderStuff, pType[nC], pXFBorders);
//get border spacing to text content
if (pMargins)
{
ApplySubBorder(pBorderStuff, pType[nC], pXFBorders);
//get border spacing to text content
if (pMargins)
{
pMarginValue[nC] = static_cast<float>(pMargins->GetMarginsValue(nC));
}
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)

View File

@@ -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;
m_pStream->Seek(0);
if (nVersion<0x0102)
{
assert(false);
}
if (nVersion>=0x0102)
{
LwpSdwGroupLoaderV0102 sdwGroupLoader(m_pStream, m_pGraphicObj);
sdwGroupLoader.BeginDrawObjects(pDrawObjVector);
}
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);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -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)
{
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(), 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());
rtl::Reference<XFFrame> xXFFrame;
if(nEnd < nStart)
{
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());
}
/**
@@ -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())
XFParaStyle * pStyle = pXFStyleManager->FindParaStyle(pXFPara->GetStyleName());
if (!((pStyle && pStyle->GetNumberRight()) || bColorMod))
return;
std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
if (pStyle)
{
*xOverStyle = *pStyle;
if (pStyle->GetNumberRight())
xOverStyle->SetAlignType(enumXFAlignEnd);
}
if (bColorMod)
{
rtl::Reference<XFFont> xFont = xOverStyle->GetFont();
if (xFont.is())
{
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)
{
std::unique_ptr<XFParaStyle> xOverStyle(new XFParaStyle);
if (pStyle)
XFColor aColor = xFont->GetColor();
if (aColor == aNullColor)
{
*xOverStyle = *pStyle;
if (pStyle->GetNumberRight())
xOverStyle->SetAlignType(enumXFAlignEnd);
rtl::Reference<XFFont> pNewFont(new XFFont);
aColor = pNumStyle->GetColor();
pNewFont->SetColor(aColor);
xOverStyle->SetFont(pNewFont);
}
if (bColorMod)
{
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);
}
}
}
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);
}
/**

View File

@@ -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));
}
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);
}
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 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
{
pDoc = pDoc->GetFirstDivision();
while (pDoc)
{
OUString sSodcStyleName = pFoundry->FindActuralStyleName(sLwpStyleName);
pToc->AddTocSource(pLevel->GetLevel(), sSodcStyleName);
}
else
{
pDoc = pDoc->GetFirstDivision();
while (pDoc)
{
AddSourceStyle(pToc, pLevel, pDoc->GetFoundry() );
pDoc = pDoc->GetNextDivision();
}
AddSourceStyle(pToc, pLevel, pDoc->GetFoundry() );
pDoc = pDoc->GetNextDivision();
}
}
}