Kaydet (Commit) fdf12237 authored tarafından Caolán McNamara's avatar Caolán McNamara

deploy references to keep layout alive long enough

Change-Id: Icac22d3c179eca42e01a724f7592ee4b34dd45e3
üst a1426bc5
...@@ -646,7 +646,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() ...@@ -646,7 +646,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
LwpDocument *pLastDoc = pRoot ? pRoot->GetLastDivisionWithContents() : nullptr; LwpDocument *pLastDoc = pRoot ? pRoot->GetLastDivisionWithContents() : nullptr;
while (pLastDoc) while (pLastDoc)
{ {
if(pLastDoc->GetEnSuperTableLayout()) if (pLastDoc->GetEnSuperTableLayout().is())
return pLastDoc; return pLastDoc;
pLastDoc = pLastDoc->GetPreviousDivisionWithContents(); pLastDoc = pLastDoc->GetPreviousDivisionWithContents();
} }
...@@ -656,14 +656,14 @@ LwpDocument* LwpDocument::GetPreviousDivision() ...@@ -656,14 +656,14 @@ LwpDocument* LwpDocument::GetPreviousDivision()
/** /**
* @descr Get endnote supertable layout, every division has only one endnote supertable layout. * @descr Get endnote supertable layout, every division has only one endnote supertable layout.
*/ */
LwpVirtualLayout* LwpDocument::GetEnSuperTableLayout() rtl::Reference<LwpVirtualLayout> LwpDocument::GetEnSuperTableLayout()
{ {
LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout().obj().get()); LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout().obj().get());
if(pHeadLayout) if(pHeadLayout)
{ {
return pHeadLayout->FindEnSuperTableLayout(); return pHeadLayout->FindEnSuperTableLayout();
} }
return nullptr; return rtl::Reference<LwpVirtualLayout>();
} }
/** /**
......
...@@ -159,7 +159,7 @@ public: ...@@ -159,7 +159,7 @@ public:
LwpDocument* GetLastDivision(); LwpDocument* GetLastDivision();
LwpDocument* GetFirstDivision(); LwpDocument* GetFirstDivision();
LwpVirtualLayout* GetEnSuperTableLayout(); rtl::Reference<LwpVirtualLayout> GetEnSuperTableLayout();
bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount); bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount);
sal_uInt16 GetNumberOfPagesBefore(); sal_uInt16 GetNumberOfPagesBefore();
......
...@@ -499,18 +499,18 @@ void LwpHeadLayout::RegisterStyle() ...@@ -499,18 +499,18 @@ void LwpHeadLayout::RegisterStyle()
* @descr find endnote supertable layout from the child layout list. Suppose that there is only one endnote supertablelayout in one division * @descr find endnote supertable layout from the child layout list. Suppose that there is only one endnote supertablelayout in one division
* @return pointer to endnote supertable layout * @return pointer to endnote supertable layout
*/ */
LwpVirtualLayout* LwpHeadLayout::FindEnSuperTableLayout() rtl::Reference<LwpVirtualLayout> LwpHeadLayout::FindEnSuperTableLayout()
{ {
LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()); rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
while(pLayout) while (xLayout.get())
{ {
if(pLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT) if (xLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT)
{ {
return pLayout; return xLayout;
} }
pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get()); xLayout.set(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
} }
return nullptr; return rtl::Reference<LwpVirtualLayout>();
} }
LwpLayoutStyle::LwpLayoutStyle() LwpLayoutStyle::LwpLayoutStyle()
......
...@@ -266,7 +266,7 @@ public: ...@@ -266,7 +266,7 @@ public:
LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm); LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
virtual ~LwpHeadLayout(){} virtual ~LwpHeadLayout(){}
void RegisterStyle() override; void RegisterStyle() override;
LwpVirtualLayout* FindEnSuperTableLayout(); rtl::Reference<LwpVirtualLayout> FindEnSuperTableLayout();
protected: protected:
void Read() override; void Read() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HEAD_LAYOUT;} virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HEAD_LAYOUT;}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment