summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-06-24 17:32:28 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2014-08-20 10:13:47 +0200
commitd8da9dc0c606d6bd7a27e65287859fac71e656f3 (patch)
tree1361e71bb4df9769cff43ec10be38e49fb89af5e
parent55ed342c133fc117899be0d8bd288c66498fa448 (diff)
pagedesc: Consolidate FindPageDescByName() and FindPageDesc().
(cherry picked from commit c1be76ec98cb465e07df961843134147100beaa9) Conflicts: sw/inc/doc.hxx sw/source/core/doc/docdesc.cxx sw/source/filter/ww8/rtfexport.cxx sw/source/uibase/app/docstyle.cxx 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.cxx2
-rw-r--r--sw/source/filter/xml/xmlfmt.cxx2
-rw-r--r--sw/source/ui/app/docstyle.cxx19
9 files changed, 20 insertions, 49 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 23791acdd33c..f11a7488097c 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1344,8 +1344,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 String& rName,
- sal_uInt16* pPos = 0 ) const;
+ SwPageDesc* FindPageDesc( const String& rName, sal_uInt16* pPos = NULL) const;
/** Copy the complete PageDesc - beyond document and "deep"!
Optionally copying of PoolFmtId, -HlpId can be prevented. */
@@ -1367,7 +1366,6 @@ public:
SwPageDesc * GetPageDesc( const String & rName );
void ChgPageDesc( const String & rName, const SwPageDesc& );
void ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
- bool FindPageDesc( const String & rName, sal_uInt16 * pFound );
void DelPageDesc( const String & 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 f190cb483b6e..dbb28e700267 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -307,8 +307,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 2a755697f9aa..adab6e4c0f43 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -630,9 +630,9 @@ SwPageDesc* SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
return pNew;
}
-SwPageDesc* SwDoc::FindPageDescByName( const String& rName, sal_uInt16* pPos ) const
+SwPageDesc* SwDoc::FindPageDesc( const String& 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 )
@@ -838,33 +838,9 @@ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, )
return 0;
}
-bool SwDoc::FindPageDesc( const String & 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 String & rName )
{
- SwPageDesc * aResult = NULL;
-
- sal_uInt16 nI;
-
- if (FindPageDesc(rName, &nI))
- aResult = maPageDescs[nI];
-
- return aResult;
+ return FindPageDesc(rName);
}
void SwDoc::DelPageDesc( const String & rName, bool bBroadcast )
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index 3d99e05f6e0e..4993336c2862 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -149,7 +149,7 @@ SwPageDesc* SwFEShell::FindPageDescByName( const String& rName,
sal_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 47b1acb14ed9..0411ec675eb0 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -2659,8 +2659,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();
}
@@ -2745,7 +2744,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 6cea260e3b43..d582d1044815 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -372,7 +372,7 @@ SwDoc * ViewShell::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->HasMark() )
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index c98b78020505..ac20270adec1 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -564,7 +564,7 @@ void RtfExport::ExportDocument_Impl()
pSttPgDsc = (SwFmtPageDesc*)&pSet->Get( RES_PAGEDESC );
if( !pSttPgDsc->GetPageDesc() )
pSttPgDsc = 0;
- else if( pDoc->FindPageDescByName( pSttPgDsc->
+ else if( pDoc->FindPageDesc( pSttPgDsc->
GetPageDesc()->GetName(), &nPosInDoc ))
{
Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_PGDSCNO;
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 452271c6e75f..ee7dfccd778b 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -647,7 +647,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/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 927f8eaff7e2..6053d644832d 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -229,7 +229,7 @@ static const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc,
if( rName.Len() )
{
- pDesc = rDoc.FindPageDescByName( rName );
+ pDesc = rDoc.FindPageDesc(rName);
if( !pDesc && bCreate )
{
sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
@@ -453,7 +453,7 @@ void SwDocStyleSheet::SetHidden( sal_Bool bValue )
case SFX_STYLE_FAMILY_PAGE:
{
- SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+ SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
if ( pPgDesc )
{
pPgDesc->SetHidden( bValue );
@@ -509,7 +509,7 @@ sal_Bool SwDocStyleSheet::IsHidden( ) const
case SFX_STYLE_FAMILY_PAGE:
{
- SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+ SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
bRet = pPgDesc && pPgDesc->IsHidden( );
}
break;
@@ -1004,8 +1004,7 @@ bool SwDocStyleSheet::SetFollow( const String& rStr)
? lcl_FindPageDesc(rDoc, rStr)
: 0;
sal_uInt16 nId;
- if( pFollowDesc != pDesc->GetFollow() &&
- rDoc.FindPageDescByName( pDesc->GetName(), &nId ) )
+ if (pFollowDesc != pDesc->GetFollow() && rDoc.FindPageDesc(pDesc->GetName(), &nId))
{
SwPageDesc aDesc( *pDesc );
aDesc.SetFollow( pFollowDesc );
@@ -1304,7 +1303,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
@@ -2145,7 +2144,7 @@ void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
pSourceFmt = &((SwDocStyleSheet&)rSource).GetPageDesc()
->GetMaster();
{
- SwPageDesc *pDesc = rDoc.FindPageDescByName(
+ SwPageDesc *pDesc = rDoc.FindPageDesc(
((SwDocStyleSheet&)rTarget).GetPageDesc()->GetName(),
&nPgDscPos );
@@ -2223,8 +2222,8 @@ void SwDocStyleSheetPool::Remove( SfxStyleSheetBase* pStyle)
case SFX_STYLE_FAMILY_PAGE :
{
sal_uInt16 nPos;
- if( rDoc.FindPageDescByName( rName, &nPos ))
- rDoc.DelPageDesc( nPos );
+ if (rDoc.FindPageDesc(rName, &nPos))
+ rDoc.DelPageDesc(nPos);
}
break;
@@ -2846,7 +2845,7 @@ void SwStyleSheetIterator::AppendStyleList(const boost::ptr_vector<String>& rLis
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;