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

guard against missing Foundry

Change-Id: Id15a2692f8aa572c0b5db87f04761ca3eac0249e
(cherry picked from commit ed09d4f5)
üst 84e15f7b
...@@ -233,7 +233,9 @@ void LwpDocument::RegisterStyle() ...@@ -233,7 +233,9 @@ void LwpDocument::RegisterStyle()
void LwpDocument::RegisterTextStyles() void LwpDocument::RegisterTextStyles()
{ {
//Register all text styles: para styles, character styles //Register all text styles: para styles, character styles
LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead().obj().get()); LwpDLVListHeadHolder* pParaStyleHolder = m_pFoundry
? dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead().obj().get())
: nullptr;
if(pParaStyleHolder) if(pParaStyleHolder)
{ {
LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get()); LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
...@@ -252,12 +254,15 @@ void LwpDocument::RegisterTextStyles() ...@@ -252,12 +254,15 @@ void LwpDocument::RegisterTextStyles()
*/ */
void LwpDocument::RegisterLayoutStyles() void LwpDocument::RegisterLayoutStyles()
{ {
//Register all layout styles, before register all styles in para if (m_pFoundry)
m_pFoundry->RegisterAllLayouts(); {
//Register all layout styles, before register all styles in para
m_pFoundry->RegisterAllLayouts();
}
//set initial pagelayout in story for parsing pagelayout //set initial pagelayout in story for parsing pagelayout
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get()); LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get());
if(pDivInfo) if (pDivInfo)
{ {
LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get()); LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
if(pPageLayout) if(pPageLayout)
...@@ -279,8 +284,10 @@ void LwpDocument::RegisterLayoutStyles() ...@@ -279,8 +284,10 @@ void LwpDocument::RegisterLayoutStyles()
void LwpDocument::RegisterStylesInPara() void LwpDocument::RegisterStylesInPara()
{ {
//Register all automatic styles in para //Register all automatic styles in para
LwpHeadContent* pContent = dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager().GetContentList().obj().get()); LwpHeadContent* pContent = m_pFoundry
if(pContent) ? dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager().GetContentList().obj().get())
: nullptr;
if (pContent)
{ {
LwpStory* pStory = dynamic_cast<LwpStory*>(pContent->GetChildHead().obj(VO_STORY).get()); LwpStory* pStory = dynamic_cast<LwpStory*>(pContent->GetChildHead().obj(VO_STORY).get());
while(pStory) while(pStory)
...@@ -297,19 +304,20 @@ void LwpDocument::RegisterStylesInPara() ...@@ -297,19 +304,20 @@ void LwpDocument::RegisterStylesInPara()
*/ */
void LwpDocument::RegisterBulletStyles() void LwpDocument::RegisterBulletStyles()
{ {
if (!m_pFoundry)
return;
//Register bullet styles //Register bullet styles
LwpDLVListHeadHolder* mBulletHead = dynamic_cast<LwpDLVListHeadHolder*> LwpDLVListHeadHolder* mBulletHead = dynamic_cast<LwpDLVListHeadHolder*>
(m_pFoundry->GetBulletManagerID().obj(VO_HEADHOLDER).get()); (m_pFoundry->GetBulletManagerID().obj(VO_HEADHOLDER).get());
if( mBulletHead ) if (!mBulletHead)
return;
LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
(mBulletHead->GetHeadID().obj().get());
while(pBullet)
{ {
LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*> pBullet->SetFoundry(m_pFoundry);
(mBulletHead->GetHeadID().obj().get()); pBullet->RegisterStyle();
while(pBullet) pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext().obj().get());
{
pBullet->SetFoundry(m_pFoundry);
pBullet->RegisterStyle();
pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext().obj().get());
}
} }
} }
/** /**
...@@ -317,13 +325,14 @@ void LwpDocument::RegisterBulletStyles() ...@@ -317,13 +325,14 @@ void LwpDocument::RegisterBulletStyles()
*/ */
void LwpDocument::RegisterGraphicsStyles() void LwpDocument::RegisterGraphicsStyles()
{ {
if (!m_pFoundry)
return;
//Register all graphics styles, the first object should register the next; //Register all graphics styles, the first object should register the next;
rtl::Reference<LwpObject> pGraphic = m_pFoundry->GetGraphicListHead().obj(VO_GRAPHIC); rtl::Reference<LwpObject> pGraphic = m_pFoundry->GetGraphicListHead().obj(VO_GRAPHIC);
if(pGraphic.is()) if (!pGraphic.is())
{ return;
pGraphic->SetFoundry(m_pFoundry); pGraphic->SetFoundry(m_pFoundry);
pGraphic->DoRegisterStyle(); pGraphic->DoRegisterStyle();
}
} }
/** /**
* @descr Register line number styles * @descr Register line number styles
......
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