summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-06-24 17:32:28 +0200
committerJan Holesovsky <kendy@collabora.com>2014-06-25 20:03:19 +0200
commitc1be76ec98cb465e07df961843134147100beaa9 (patch)
tree3fafb3d147e4ab48d0cc814804bba3f36140ce62
parentf246ac13bd1a12e11eba03cbe3c62ea77293e02e (diff)
pagedesc: Consolidate FindPageDescByName() and FindPageDesc().
Change-Id: I18d570509cd3f3b65a19a12a9df0b1d5db901d04
-rw-r--r--sw/inc/doc.hxx4
-rw-r--r--sw/source/core/attr/swatrset.cxx3
-rw-r--r--sw/source/core/doc/docdesc.cxx30
-rw-r--r--sw/source/core/frmedt/fedesc.cxx2
-rw-r--r--sw/source/core/unocore/unostyle.cxx5
-rw-r--r--sw/source/core/view/vprint.cxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx3
-rw-r--r--sw/source/filter/xml/xmlfmt.cxx2
-rw-r--r--sw/source/uibase/app/docstyle.cxx19
9 files changed, 20 insertions, 50 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 95eda380d00b..75eac111ab24 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1170,8 +1170,7 @@ public:
sal_uInt16 GetPageDescCnt() const { return maPageDescs.size(); }
const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *maPageDescs[i]; }
SwPageDesc& GetPageDesc( sal_uInt16 i ) { return *maPageDescs[i]; }
- SwPageDesc* FindPageDescByName( const OUString& rName,
- sal_uInt16* pPos = 0 ) const;
+ SwPageDesc* FindPageDesc(const OUString& rName, sal_uInt16* pPos = NULL) const;
/** Copy the complete PageDesc - beyond document and "deep"!
Optionally copying of PoolFmtId, -HlpId can be prevented. */
@@ -1192,7 +1191,6 @@ public:
SwPageDesc * GetPageDesc( const OUString & rName );
void ChgPageDesc( const OUString & rName, const SwPageDesc& );
void ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
- bool FindPageDesc( const OUString & rName, sal_uInt16 * pFound );
void DelPageDesc( const OUString & rName, bool bBroadcast = false);
void DelPageDesc( sal_uInt16 i, bool bBroadcast = false );
void PreDelPageDesc(SwPageDesc * pDel);
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 37cbe3b18b73..6d2eef2f088b 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -386,8 +386,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
{
SfxItemSet aTmpSet( *this );
- SwPageDesc* pDstPgDesc = pDstDoc->FindPageDescByName(
- pPgDesc->GetName() );
+ SwPageDesc* pDstPgDesc = pDstDoc->FindPageDesc(pPgDesc->GetName());
if( !pDstPgDesc )
{
pDstPgDesc = pDstDoc->MakePageDesc(pPgDesc->GetName());
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 63174e0cc8be..108dae512080 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -632,9 +632,9 @@ SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy,
return pNew;
}
-SwPageDesc* SwDoc::FindPageDescByName( const OUString& rName, sal_uInt16* pPos ) const
+SwPageDesc* SwDoc::FindPageDesc(const OUString& rName, sal_uInt16* pPos) const
{
- SwPageDesc* pRet = 0;
+ SwPageDesc* pRet = NULL;
if( pPos ) *pPos = USHRT_MAX;
for( sal_uInt16 n = 0, nEnd = maPageDescs.size(); n < nEnd; ++n )
@@ -774,33 +774,9 @@ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, )
return 0;
}
-bool SwDoc::FindPageDesc( const OUString & rName, sal_uInt16 * pFound)
-{
- bool bResult = false;
- sal_uInt16 nI;
- for (nI = 0; nI < maPageDescs.size(); nI++)
- {
- if (maPageDescs[nI]->GetName() == rName)
- {
- *pFound = nI;
- bResult = true;
- break;
- }
- }
-
- return bResult;
-}
-
SwPageDesc * SwDoc::GetPageDesc( const OUString & rName )
{
- SwPageDesc * aResult = NULL;
-
- sal_uInt16 nI;
-
- if (FindPageDesc(rName, &nI))
- aResult = maPageDescs[nI];
-
- return aResult;
+ return FindPageDesc(rName);
}
void SwDoc::DelPageDesc( const OUString & rName, bool bBroadcast )
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index 50c757141d77..c2b16d60ee23 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -124,7 +124,7 @@ SwPageDesc* SwFEShell::FindPageDescByName( const OUString& rName,
bool bGetFromPool,
sal_uInt16* pPos )
{
- SwPageDesc* pDesc = GetDoc()->FindPageDescByName( rName, pPos );
+ SwPageDesc* pDesc = GetDoc()->FindPageDesc(rName, pPos);
if( !pDesc && bGetFromPool )
{
sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 5e2ba64e9267..f79beed7e57c 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -2922,8 +2922,7 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >&
case SFX_STYLE_FAMILY_FRAME: pTargetFmt = xStyle->GetFrmFmt(); break;
case SFX_STYLE_FAMILY_PAGE:
{
- sal_uInt16 nPgDscPos = USHRT_MAX;
- SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
+ SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName());
if( pDesc )
pTargetFmt = &pDesc->GetMaster();
}
@@ -3008,7 +3007,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( )
break;
case SFX_STYLE_FAMILY_PAGE:
{
- SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
+ SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName(), &nPgDscPos);
if( pDesc )
{
pTargetFmt = &pDesc->GetMaster();
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index ce5f4dc7d0d1..392eec5f6cb5 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -372,7 +372,7 @@ SwDoc * SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
OSL_ENSURE( pPage, "no page found!" );
// get page descriptor - fall back to the first one if pPage could not be found
- const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDescByName(
+ const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDesc(
pPage->GetPageDesc()->GetName() ) : &pPrtDoc->GetPageDesc( (sal_uInt16)0 );
if( !pFESh->IsTableMode() && pActCrsr && pActCrsr->HasMark() )
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index e725b7e61905..7b0f746b48ea 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -584,8 +584,7 @@ void RtfExport::ExportDocument_Impl()
pSttPgDsc = (SwFmtPageDesc*)&pSet->Get(RES_PAGEDESC);
if (!pSttPgDsc->GetPageDesc())
pSttPgDsc = 0;
- else if (pDoc->FindPageDescByName(pSttPgDsc->
- GetPageDesc()->GetName(), &nPosInDoc))
+ else if (pDoc->FindPageDesc(pSttPgDsc->GetPageDesc()->GetName(), &nPosInDoc))
{
Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCNO);
OutULong(nPosInDoc).WriteChar('}');
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index c1b2c7ec3d72..aed582410b20 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -632,7 +632,7 @@ void SwXMLItemSetStyleContext_Impl::ConnectPageDesc()
sName,
nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC,
true);
- SwPageDesc *pPageDesc = pDoc->FindPageDescByName( sName );
+ SwPageDesc *pPageDesc = pDoc->FindPageDesc(sName);
if( !pPageDesc )
{
// If the page style is a pool style, then we maybe have to create it
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 4caf10bda244..fa169f2026a0 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -232,7 +232,7 @@ static const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc,
if (!rName.isEmpty())
{
- pDesc = rDoc.FindPageDescByName( rName );
+ pDesc = rDoc.FindPageDesc(rName);
if( !pDesc && bCreate )
{
sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
@@ -528,7 +528,7 @@ void SwDocStyleSheet::SetHidden( bool bValue )
case SFX_STYLE_FAMILY_PAGE:
{
- SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+ SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
if ( pPgDesc )
{
pPgDesc->SetHidden( bValue );
@@ -584,7 +584,7 @@ bool SwDocStyleSheet::IsHidden( ) const
case SFX_STYLE_FAMILY_PAGE:
{
- SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+ SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
bRet = pPgDesc && pPgDesc->IsHidden( );
}
break;
@@ -1074,8 +1074,7 @@ bool SwDocStyleSheet::SetFollow( const OUString& rStr)
? lcl_FindPageDesc(rDoc, rStr)
: 0;
sal_uInt16 nId = 0;
- if( pFollowDesc != pDesc->GetFollow() &&
- rDoc.FindPageDescByName( pDesc->GetName(), &nId ) )
+ if (pFollowDesc != pDesc->GetFollow() && rDoc.FindPageDesc(pDesc->GetName(), &nId))
{
SwPageDesc aDesc( *pDesc );
aDesc.SetFollow( pFollowDesc );
@@ -1390,7 +1389,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
{
OSL_ENSURE(pDesc, "Where's PageDescriptor");
- if( rDoc.FindPageDescByName( pDesc->GetName(), &nPgDscPos ))
+ if (rDoc.FindPageDesc(pDesc->GetName(), &nPgDscPos))
{
pNewDsc = new SwPageDesc( *pDesc );
// #i48949# - no undo actions for the
@@ -2225,7 +2224,7 @@ void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
break;
case SFX_STYLE_FAMILY_PAGE:
{
- SwPageDesc *pDesc = rDoc.FindPageDescByName(
+ SwPageDesc *pDesc = rDoc.FindPageDesc(
((SwDocStyleSheet&)rTarget).GetPageDesc()->GetName(),
&nPgDscPos );
@@ -2303,8 +2302,8 @@ void SwDocStyleSheetPool::Remove( SfxStyleSheetBase* pStyle)
case SFX_STYLE_FAMILY_PAGE :
{
sal_uInt16 nPos;
- if( rDoc.FindPageDescByName( sName, &nPos ))
- rDoc.DelPageDesc( nPos );
+ if (rDoc.FindPageDesc(sName, &nPos))
+ rDoc.DelPageDesc(nPos);
}
break;
@@ -2925,7 +2924,7 @@ void SwStyleSheetIterator::AppendStyleList(const ::std::vector<OUString>& rList,
case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
{
bUsed = rDoc.IsPoolPageDescUsed( nId );
- SwPageDesc* pPgDesc = rDoc.FindPageDescByName( rList[i] );
+ SwPageDesc* pPgDesc = rDoc.FindPageDesc(rList[i]);
bHidden = pPgDesc && pPgDesc->IsHidden( );
}
break;