diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-06-06 16:49:17 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-06-06 16:49:44 +0200 |
commit | 37183595bb3b4d58682f90fd9f6713bedcb852a2 (patch) | |
tree | 1ac1fd9d69c0d09ea204173bd77721dc01bbddeb /lotuswordpro/source/filter/lwppagelayout.cxx | |
parent | 7abe976be5166845c5f43b70a0dfb38608d31356 (diff) |
Fix memory leaks, by refcounting LwpObject
Change-Id: I1539597cd5bcabcbf0295d1acc320c503ad53604
Diffstat (limited to 'lotuswordpro/source/filter/lwppagelayout.cxx')
-rw-r--r-- | lotuswordpro/source/filter/lwppagelayout.cxx | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index ec388047bcdc..631a1ad033a6 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -123,8 +123,8 @@ void LwpPageLayout::Read() void LwpPageLayout::Parse(IXFStream* pOutputStream) { //Only parse this layout - LwpObject* pStory = m_Content.obj(); - if(pStory) + rtl::Reference<LwpObject> pStory = m_Content.obj(); + if(pStory.is()) { pStory->SetFoundry(m_pFoundry); pStory->Parse(pOutputStream); //Do not parse the next story @@ -272,7 +272,7 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1) { LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts(); - LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast<LwpFootnoteOptions*>(pFontnodeId->obj()) : NULL; + LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast<LwpFootnoteOptions*>(pFontnodeId->obj().get()) : NULL; if(pFootnoteOpts) { LwpFootnoteSeparatorOptions* pFootnoteSep = pFootnoteOpts->GetFootnoteSeparator(); @@ -482,8 +482,8 @@ void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont) { //get filerpage story from division info LwpDocument* pDoc = m_pFoundry->GetDocument(); - LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID()->obj()); - LwpStory* pStory = dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID()->obj().get()); + LwpStory* pStory = dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID()->obj().get()); //parse fillerpage story if(pStory) @@ -506,24 +506,24 @@ void LwpPageLayout::ResetXFColumns() LwpHeaderLayout* LwpPageLayout::GetHeaderLayout() { - LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj()); + LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj().get()); while(pLay) { if( pLay->GetLayoutType() == LWP_HEADER_LAYOUT ) return ( static_cast<LwpHeaderLayout*> (pLay) ); - pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj()); + pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj().get()); } return NULL; } LwpFooterLayout* LwpPageLayout::GetFooterLayout() { - LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj()); + LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj().get()); while(pLay) { if( pLay->GetLayoutType() == LWP_FOOTER_LAYOUT ) return ( static_cast<LwpFooterLayout*> (pLay) ); - pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj()); + pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj().get()); } return NULL; } @@ -536,7 +536,7 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout() { if(IsComplex()) { - LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj()); + LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj().get()); while(pLay) { if( pLay->GetLayoutType() == LWP_PAGE_LAYOUT ) @@ -548,7 +548,7 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout() return pPageLayout; } } - pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj()); + pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj().get()); } } return NULL; @@ -580,11 +580,11 @@ sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber) sal_Int16 nPageNumber = -1; LwpFoundry* pFoundry = this->GetFoundry(); LwpDocument* pDoc = pFoundry->GetDocument(); - LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDoc->GetPageHintsID()->obj()); + LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDoc->GetPageHintsID()->obj().get()); if(!pHeadTail) return nPageNumber; //get first pagehint - LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetHead()->obj()); + LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetHead()->obj().get()); while(pPageHint) { if(*(this->GetObjectID()) == *(pPageHint->GetPageLayoutID())) @@ -614,7 +614,7 @@ sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber) } } - pPageHint = dynamic_cast<LwpPageHint*>(pPageHint->GetNext()->obj()); + pPageHint = dynamic_cast<LwpPageHint*>(pPageHint->GetNext()->obj().get()); } if(nPageNumber>=0) { @@ -715,7 +715,7 @@ bool LwpPageLayout::operator<(LwpPageLayout& Other) */ LwpPara* LwpPageLayout::GetPagePosition() { - LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition()->obj()); + LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition()->obj().get()); if(pPara) return pPara; //Get the position from its related section @@ -726,7 +726,7 @@ LwpPara* LwpPageLayout::GetPagePosition() while( (pSection = pFoundry->EnumSections(pSection)) ) { if(pSection->GetPageLayout() == this) - return dynamic_cast<LwpPara*>(pSection->GetPosition()->obj()); + return dynamic_cast<LwpPara*>(pSection->GetPosition()->obj().get()); } } @@ -788,7 +788,7 @@ void LwpHeaderLayout::ParseMargins(XFHeaderStyle* ph1) } //Set left,right,bottom margins - LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent()->obj()); + LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent()->obj().get()); //left margin in SODC: the space from the left edge of body to the left edge of header double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0); if(left<=0) //The left margin in SODC can not be minus value @@ -875,8 +875,8 @@ void LwpHeaderLayout::ParseWaterMark(XFHeaderStyle * pHeaderStyle) void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1) { XFHeader* pHeader = new XFHeader(); - LwpObject* pStory = m_Content.obj(); - if(pStory) + rtl::Reference<LwpObject> pStory = m_Content.obj(); + if(pStory.is()) { LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr(); @@ -954,7 +954,7 @@ void LwpFooterLayout::ParseMargins(XFFooterStyle* pFooterStyle) } //Set left,right,top margins - LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent()->obj()); + LwpMiddleLayout* parent = dynamic_cast<LwpMiddleLayout*> (GetParent()->obj().get()); double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0); if(left<=0) //The left margin in SODC can not be minus value { @@ -1028,9 +1028,9 @@ void LwpFooterLayout::ParseBackColor(XFFooterStyle* pFooterStyle) void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1) { XFFooter* pFooter = new XFFooter(); - LwpObject* pStory = m_Content.obj(VO_STORY); + rtl::Reference<LwpObject> pStory = m_Content.obj(VO_STORY); //Call the RegisterStyle first to register the styles in footer paras, and then XFConvert() - if(pStory) + if(pStory.is()) { LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr(); |