Kaydet (Commit) 6fcb52aa authored tarafından Matteo Casalin's avatar Matteo Casalin

Group common code

Change-Id: I9ad05054d40b283042b9775333f8e103668ae7a6
üst 6106d7a2
...@@ -146,6 +146,30 @@ namespace ...@@ -146,6 +146,30 @@ namespace
{ {
return IDocumentMarkAccess::GetType(*rpMark) == IDocumentMarkAccess::MarkType::BOOKMARK; return IDocumentMarkAccess::GetType(*rpMark) == IDocumentMarkAccess::MarkType::BOOKMARK;
} }
sal_uInt16 lcl_InsertURLFieldContent(
SwContentArr *pMember,
SwWrtShell* pWrtShell,
const SwContentType *pCntType)
{
SwGetINetAttrs aArr;
const sal_uInt16 nCount = pWrtShell->GetINetAttrs( aArr );
for( sal_uInt16 n = 0; n < nCount; ++n )
{
SwGetINetAttr* p = &aArr[ n ];
SwURLFieldContent* pCnt = new SwURLFieldContent(
pCntType,
p->sText,
INetURLObject::decode(
p->rINetAttr.GetINetFmt().GetValue(),
INetURLObject::DECODE_UNAMBIGUOUS,
RTL_TEXTENCODING_UTF8 ),
&p->rINetAttr,
n );
pMember->insert( pCnt );
}
return nCount;
}
} }
// Content, contains names and reference at the content type. // Content, contains names and reference at the content type.
...@@ -354,22 +378,8 @@ void SwContentType::Init(bool* pbInvalidateWindow) ...@@ -354,22 +378,8 @@ void SwContentType::Init(bool* pbInvalidateWindow)
else if(!pMember->empty()) else if(!pMember->empty())
pMember->DeleteAndDestroyAll(); pMember->DeleteAndDestroyAll();
SwGetINetAttrs aArr; nMemberCount = lcl_InsertURLFieldContent(pMember, pWrtShell, this);
nMemberCount = pWrtShell->GetINetAttrs( aArr );
for( sal_uInt16 n = 0; n < nMemberCount; ++n )
{
SwGetINetAttr* p = &aArr[ n ];
SwURLFieldContent* pCnt = new SwURLFieldContent(
this,
p->sText,
INetURLObject::decode(
p->rINetAttr.GetINetFmt().GetValue(),
INetURLObject::DECODE_UNAMBIGUOUS,
RTL_TEXTENCODING_UTF8 ),
&p->rINetAttr,
n );
pMember->insert( pCnt );
}
bEdit = true; bEdit = true;
nOldMemberCount = nMemberCount; nOldMemberCount = nMemberCount;
bDelete = false; bDelete = false;
...@@ -657,24 +667,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) ...@@ -657,24 +667,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
} }
break; break;
case CONTENT_TYPE_URLFIELD: case CONTENT_TYPE_URLFIELD:
{ nMemberCount = lcl_InsertURLFieldContent(pMember, pWrtShell, this);
SwGetINetAttrs aArr;
nMemberCount = pWrtShell->GetINetAttrs( aArr );
for( sal_uInt16 n = 0; n < nMemberCount; ++n )
{
SwGetINetAttr* p = &aArr[ n ];
SwURLFieldContent* pCnt = new SwURLFieldContent(
this,
p->sText,
INetURLObject::decode(
p->rINetAttr.GetINetFmt().GetValue(),
INetURLObject::DECODE_UNAMBIGUOUS,
RTL_TEXTENCODING_UTF8 ),
&p->rINetAttr,
n );
pMember->insert( pCnt );
}
}
break; break;
case CONTENT_TYPE_INDEX: case CONTENT_TYPE_INDEX:
{ {
......
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