summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-04-07 22:48:45 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-04-12 22:36:28 +0200
commit6fcb52aa3d8b8f3686ba1dfae03f9d3cc281b5d3 (patch)
treec1bb84934f6911ca97be2f0fc93f602ba18b723b
parent6106d7a2372fbd3030638901874d4cc260c0c521 (diff)
Group common code
Change-Id: I9ad05054d40b283042b9775333f8e103668ae7a6
-rw-r--r--sw/source/uibase/utlui/content.cxx61
1 files changed, 27 insertions, 34 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 35e099df659b..555406271fa6 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -146,6 +146,30 @@ namespace
{
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.
@@ -354,22 +378,8 @@ void SwContentType::Init(bool* pbInvalidateWindow)
else if(!pMember->empty())
pMember->DeleteAndDestroyAll();
- 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 );
- }
+ nMemberCount = lcl_InsertURLFieldContent(pMember, pWrtShell, this);
+
bEdit = true;
nOldMemberCount = nMemberCount;
bDelete = false;
@@ -657,24 +667,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
}
break;
case CONTENT_TYPE_URLFIELD:
- {
- 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 );
- }
- }
+ nMemberCount = lcl_InsertURLFieldContent(pMember, pWrtShell, this);
break;
case CONTENT_TYPE_INDEX:
{