summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/doc.hxx2
-rw-r--r--sw/source/core/attr/swatrset.cxx3
-rw-r--r--sw/source/core/doc/docdesc.cxx4
-rw-r--r--sw/source/core/doc/docfmt.cxx5
-rw-r--r--sw/source/core/doc/docnew.cxx10
-rw-r--r--sw/source/core/doc/poolfmt.cxx4
-rw-r--r--sw/source/filter/ww1/fltshell.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par.cxx3
-rw-r--r--sw/source/uibase/app/docstyle.cxx3
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx11
10 files changed, 23 insertions, 30 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 6948b7ea01f7..95eda380d00b 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1196,7 +1196,7 @@ public:
void DelPageDesc( const OUString & rName, bool bBroadcast = false);
void DelPageDesc( sal_uInt16 i, bool bBroadcast = false );
void PreDelPageDesc(SwPageDesc * pDel);
- sal_uInt16 MakePageDesc( const OUString &rName, const SwPageDesc* pCpy = 0,
+ SwPageDesc* MakePageDesc(const OUString &rName, const SwPageDesc* pCpy = 0,
bool bRegardLanguage = true,
bool bBroadcast = false);
void BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 073abb76a44b..37cbe3b18b73 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -390,8 +390,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
pPgDesc->GetName() );
if( !pDstPgDesc )
{
- pDstPgDesc = &pDstDoc->GetPageDesc(
- pDstDoc->MakePageDesc( pPgDesc->GetName() ));
+ pDstPgDesc = pDstDoc->MakePageDesc(pPgDesc->GetName());
pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc );
}
SwFmtPageDesc aDesc( pDstPgDesc );
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index bb8dd2df340f..63174e0cc8be 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -587,7 +587,7 @@ void SwDoc::DelPageDesc( sal_uInt16 i, bool bBroadcast )
SetModified();
}
-sal_uInt16 SwDoc::MakePageDesc( const OUString &rName, const SwPageDesc *pCpy,
+SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy,
bool bRegardLanguage, bool bBroadcast)
{
SwPageDesc *pNew;
@@ -629,7 +629,7 @@ sal_uInt16 SwDoc::MakePageDesc( const OUString &rName, const SwPageDesc *pCpy,
}
SetModified();
- return (maPageDescs.size()-1);
+ return pNew;
}
SwPageDesc* SwDoc::FindPageDescByName( const OUString& rName, sal_uInt16* pPos ) const
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 39515aefa85f..312c6c50446f 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1982,7 +1982,7 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr,
SwPageDesc* pPageDesc = ::lcl_FindPageDesc( maPageDescs, rNm );
if( !pPageDesc )
{
- pPageDesc = maPageDescs[ MakePageDesc( rNm ) ];
+ pPageDesc = MakePageDesc(rNm);
}
aPageDesc.RegisterToPageDesc( *pPageDesc );
SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
@@ -2111,8 +2111,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
if( !pFollow )
{
// copy
- sal_uInt16 nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() );
- pFollow = maPageDescs[ nPos ];
+ pFollow = MakePageDesc(rSrcDesc.GetFollow()->GetName());
CopyPageDesc( *rSrcDesc.GetFollow(), *pFollow );
}
rDstDesc.SetFollow( pFollow );
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 0ac491be141b..b32744938215 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -714,8 +714,7 @@ void SwDoc::ClearDoc()
InitTOXTypes();
// create a dummy pagedesc for the layout
- sal_uInt16 nDummyPgDsc = MakePageDesc(OUString("?DUMMY?"));
- SwPageDesc* pDummyPgDsc = maPageDescs[ nDummyPgDsc ];
+ SwPageDesc* pDummyPgDsc = MakePageDesc("?DUMMY?");
SwNodeIndex aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
// create the first one over and over again (without attributes/style etc.
@@ -763,8 +762,11 @@ void SwDoc::ClearDoc()
// Counting of phantoms depends on <IsOldNumbering()>
mpOutlineRule->SetCountPhantoms( !GetDocumentSettingManager().get(IDocumentSettingAccess::OLD_NUMBERING) );
- // remove the dummy pagedec from the array and delete all the old ones
- maPageDescs.erase( maPageDescs.begin() + nDummyPgDsc );
+ // remove the dummy pagedesc from the array and delete all the old ones
+ sal_uInt16 nDummyPgDsc = 0;
+ if (FindPageDesc(pDummyPgDsc->GetName(), &nDummyPgDsc))
+ maPageDescs.erase(maPageDescs.begin() + nDummyPgDsc);
+
BOOST_FOREACH(SwPageDesc *pPageDesc, maPageDescs)
delete pPageDesc;
maPageDescs.clear();
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index b6330c54ca71..c3d6b30a206a 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1480,13 +1480,11 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
const OUString aNm( aResId );
const bool bIsModified = IsModified();
- sal_uInt16 nPageDescIdx = 0;
{
::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
- nPageDescIdx = MakePageDesc( aNm, 0, bRegardLanguage );
+ pNewPgDsc = MakePageDesc(aNm, 0, bRegardLanguage);
}
- pNewPgDsc = maPageDescs[ nPageDescIdx ];
pNewPgDsc->SetPoolFmtId( nId );
if ( !bIsModified )
{
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index a77f06f94216..9d2cd5663a6f 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -2076,17 +2076,15 @@ SwPageDesc* SwFltShell::MakePageDesc(SwPageDesc* pFirstPageDesc)
bool bFollow = (pFirstPageDesc != 0);
SwPageDesc* pNewPD;
- sal_uInt16 nPos;
if (bFollow && pFirstPageDesc->GetFollow() != pFirstPageDesc)
return pFirstPageDesc; // Error: already has Follow
// Detection of duplicate names still missing (low probability of this
// actually occurring)
- nPos = GetDoc().MakePageDesc( SwViewShell::GetShellRes()->GetPageDescName(
- GetDoc().GetPageDescCnt(), bFollow ? ShellResource::FOLLOW_PAGE : ShellResource::NORMAL_PAGE),
- pFirstPageDesc, false );
+ pNewPD = GetDoc().MakePageDesc(
+ SwViewShell::GetShellRes()->GetPageDescName(GetDoc().GetPageDescCnt(), bFollow ? ShellResource::FOLLOW_PAGE : ShellResource::NORMAL_PAGE),
+ pFirstPageDesc, false);
- pNewPD = &GetDoc().GetPageDesc(nPos);
if (bFollow)
{
// This one follows pPageDesc
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 0eaf995c4cb3..e0074f10dd04 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4355,10 +4355,9 @@ SwFmtPageDesc wwSectionManager::SetSwFmtPageDesc(mySegIter &rIter,
}
else
{
- sal_uInt16 nPos = mrReader.rDoc.MakePageDesc(
+ rIter->mpPage = mrReader.rDoc.MakePageDesc(
SwViewShell::GetShellRes()->GetPageDescName(mnDesc, ShellResource::NORMAL_PAGE),
0, false);
- rIter->mpPage = &mrReader.rDoc.GetPageDesc(nPos);
}
OSL_ENSURE(rIter->mpPage, "no page!");
if (!rIter->mpPage)
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index aea1897ed552..4caf10bda244 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1854,8 +1854,7 @@ void SwDocStyleSheet::Create()
pDesc = lcl_FindPageDesc( rDoc, aName );
if( !pDesc )
{
- sal_uInt16 nId = rDoc.MakePageDesc(aName);
- pDesc = &rDoc.GetPageDesc(nId);
+ pDesc = rDoc.MakePageDesc(aName);
}
break;
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index b44f8576a130..3bd6a15d6729 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -780,13 +780,12 @@ static void lcl_CopyFollowPageDesc(
{
SwDoc* pTargetDoc = rTargetShell.GetDoc();
OUString sNewFollowPageDesc = lcl_FindUniqueName(&rTargetShell, sFollowPageDesc, nDocNo );
- sal_uInt16 nNewDesc = pTargetDoc->MakePageDesc( sNewFollowPageDesc );
- SwPageDesc& rTargetFollowPageDesc = pTargetDoc->GetPageDesc( nNewDesc );
+ SwPageDesc* pTargetFollowPageDesc = pTargetDoc->MakePageDesc(sNewFollowPageDesc);
- pTargetDoc->CopyPageDesc( *pFollowPageDesc, rTargetFollowPageDesc, false );
- SwPageDesc aDesc( rTargetPageDesc );
- aDesc.SetFollow( &rTargetFollowPageDesc );
- pTargetDoc->ChgPageDesc( rTargetPageDesc.GetName(), aDesc );
+ pTargetDoc->CopyPageDesc(*pFollowPageDesc, *pTargetFollowPageDesc, false);
+ SwPageDesc aDesc(rTargetPageDesc);
+ aDesc.SetFollow(pTargetFollowPageDesc);
+ pTargetDoc->ChgPageDesc(rTargetPageDesc.GetName(), aDesc);
}
}