[Libreoffice-commits] core.git: 3 commits - sw/inc sw/source

Jan Holesovsky kendy at collabora.com
Wed Jun 25 11:03:49 PDT 2014


 sw/inc/doc.hxx                      |    6 ++----
 sw/source/core/attr/swatrset.cxx    |    6 ++----
 sw/source/core/doc/docdesc.cxx      |   34 +++++-----------------------------
 sw/source/core/doc/docfmt.cxx       |    5 ++---
 sw/source/core/doc/docnew.cxx       |   10 ++++++----
 sw/source/core/doc/poolfmt.cxx      |    4 +---
 sw/source/core/frmedt/fedesc.cxx    |    2 +-
 sw/source/core/unocore/unostyle.cxx |    5 ++---
 sw/source/core/view/vprint.cxx      |    2 +-
 sw/source/filter/ww1/fltshell.cxx   |    8 +++-----
 sw/source/filter/ww8/rtfexport.cxx  |    3 +--
 sw/source/filter/ww8/ww8par.cxx     |    3 +--
 sw/source/filter/xml/xmlfmt.cxx     |    2 +-
 sw/source/uibase/app/docstyle.cxx   |   22 +++++++++-------------
 sw/source/uibase/dbui/dbmgr.cxx     |   11 +++++------
 15 files changed, 42 insertions(+), 81 deletions(-)

New commits:
commit e7441f2e19dbfbc28438badb59d107f0e3068390
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Jun 24 19:40:25 2014 +0200

    pagedesc: We have DelPageDesc() that takes OUString as param directly.
    
    Change-Id: I616f89716a6e337c647cfb880a4e675cd1b65993

diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index fa169f2..1ca2960 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -2301,9 +2301,7 @@ void SwDocStyleSheetPool::Remove( SfxStyleSheetBase* pStyle)
         break;
     case SFX_STYLE_FAMILY_PAGE :
         {
-            sal_uInt16 nPos;
-            if (rDoc.FindPageDesc(sName, &nPos))
-                rDoc.DelPageDesc(nPos);
+            rDoc.DelPageDesc(sName);
         }
         break;
 
commit c1be76ec98cb465e07df961843134147100beaa9
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Jun 24 17:32:28 2014 +0200

    pagedesc: Consolidate FindPageDescByName() and FindPageDesc().
    
    Change-Id: I18d570509cd3f3b65a19a12a9df0b1d5db901d04

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 95eda38..75eac11 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 37cbe3b..6d2eef2 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 63174e0..108dae5 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 50c7571..c2b16d6 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 5e2ba64..f79beed 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 ce5f4dc..392eec5 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 e725b7e..7b0f746 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 c1b2c7e..aed5824 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 4caf10b..fa169f2 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;
commit f246ac13bd1a12e11eba03cbe3c62ea77293e02e
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Jun 24 13:09:14 2014 +0200

    pagedesc: It's better when MakePageDesc returns a pointer.
    
    This removes many uses of GetPageDesc(sal_uInt16).
    
    Change-Id: I9660e30d7fccd4336422ba03b19087321a7ae973

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 6948b7e..95eda38 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 073abb7..37cbe3b 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 bb8dd2d..63174e0 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 39515ae..312c6c5 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 0ac491b..b327449 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 b6330c5..c3d6b30 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 a77f06f..9d2cd56 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 0eaf995..e0074f1 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 aea1897..4caf10b 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 b44f857..3bd6a15 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);
     }
 }
 


More information about the Libreoffice-commits mailing list