From 283b76abeafe28c335de2d7cdc2fde04a55d4192 Mon Sep 17 00:00:00 2001
From: Michael Stahl <mstahl@redhat.com>
Date: Fri, 20 Dec 2013 17:58:12 +0100
Subject: [PATCH 078/109] fdo#69065: sw: fix mirrored page style with
first-page
If a mirrored page style is used with first-page on both a right page
and a left page the current design cannot work because the margins in
the SwPageDesc::aFirst cannot be right for both cases.
So split that up so we get a first-master and first-left format and
copy the headers/footers and margins as appropriate... which is really
adding epicycles to a flawed design; probably this would be better with
just a single SwFrmFmt that has different items for master/left/first
headers.
(cherry picked from commit e936ecc92a7e362f57ce72a955697840920636b8)
Conflicts:
sw/source/core/doc/docdesc.cxx
sw/source/core/doc/poolfmt.cxx
Change-Id: I0889a4ab5959b5a71172203bb64d185960a07d73
Reviewed-on: https://gerrit.libreoffice.org/7158
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
---
sw/inc/doc.hxx | 4 +-
sw/inc/pagedesc.hxx | 10 ++--
sw/source/core/doc/docdesc.cxx | 97 ++++++++++++++++++++++++++--------
sw/source/core/doc/docfmt.cxx | 20 +++++--
sw/source/core/doc/poolfmt.cxx | 5 +-
sw/source/core/layout/frmtool.cxx | 13 ++---
sw/source/core/layout/pagedesc.cxx | 23 +++++---
sw/source/core/undo/SwUndoPageDesc.cxx | 4 +-
sw/source/core/unocore/unostyle.cxx | 4 +-
sw/source/filter/ww8/wrtw8sty.cxx | 2 +-
sw/source/filter/ww8/ww8atr.cxx | 2 +-
sw/source/filter/ww8/ww8par.cxx | 8 +--
sw/source/filter/ww8/ww8par6.cxx | 8 +--
13 files changed, 142 insertions(+), 58 deletions(-)
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 12ab476..ff372aa 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -2080,9 +2080,9 @@ private:
/// method to set new graphics pool defaults, must only be called by SetDrawDefaults!
void UpdateDrawDefaults();
/// Copies master header to left / first one, if necessary - used by ChgPageDesc().
- void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft);
+ void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft, bool bFirst);
/// Copies master footer to left / first one, if necessary - used by ChgPageDesc().
- void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft);
+ void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft, bool bFirst);
/** continue computing a chunk of document statistics
* \param nChars number of characters to count before exiting
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 45ca5df..a4a74a2 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -136,7 +136,9 @@ class SW_DLLPUBLIC SwPageDesc : public SwModify
SvxNumberType aNumType;
SwFrmFmt aMaster;
SwFrmFmt aLeft;
- SwFrmFmt aFirst;
+ // FIXME epicycles growing here - page margins need to be stored differently
+ SwFrmFmt m_FirstMaster;
+ SwFrmFmt m_FirstLeft;
SwDepend aDepend; ///< Because of grid alignment (Registerhaltigkeit).
SwPageDesc *pFollow;
sal_uInt16 nRegHeight; ///< Sentence spacing and fontascent of style.
@@ -191,10 +193,12 @@ public:
SwFrmFmt &GetMaster() { return aMaster; }
SwFrmFmt &GetLeft() { return aLeft; }
- SwFrmFmt &GetFirst() { return aFirst; }
+ SwFrmFmt &GetFirstMaster() { return m_FirstMaster; }
+ SwFrmFmt &GetFirstLeft() { return m_FirstLeft; }
const SwFrmFmt &GetMaster() const { return aMaster; }
const SwFrmFmt &GetLeft() const { return aLeft; }
- const SwFrmFmt &GetFirst() const { return aFirst; }
+ const SwFrmFmt &GetFirstMaster() const { return m_FirstMaster; }
+ const SwFrmFmt &GetFirstLeft() const { return m_FirstLeft; }
/** Reset all attrs of the format but keep the ones a pagedesc
cannot live without. */
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 7bbecfa..9694337 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -59,7 +59,8 @@ using namespace com::sun::star;
static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
SwFrmFmt &rFmt1,
SwFrmFmt &rFmt2,
- SwFrmFmt &rFmt3 )
+ SwFrmFmt &rFmt3,
+ SwFrmFmt &rFmt4)
{
// --> #i41075# Printer on demand
// This function does not require a printer anymore.
@@ -115,6 +116,10 @@ static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
rFmt3.SetFmtAttr( aFrmSize );
rFmt3.SetFmtAttr( aLR );
rFmt3.SetFmtAttr( aUL );
+
+ rFmt4.SetFmtAttr( aFrmSize );
+ rFmt4.SetFmtAttr( aLR );
+ rFmt4.SetFmtAttr( aUL );
}
static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,
@@ -163,10 +168,21 @@ static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,
rDest.SetPoolHlpFileId( rSource.GetPoolHlpFileId() );
}
-void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft)
+void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft, bool bFirst)
{
- SwFrmFmt& rDescFrmFmt = (bLeft ? pDesc->GetLeft() : pDesc->GetFirst());
- if ( (bLeft ? rChged.IsHeaderShared() : rChged.IsFirstShared() ) || !rHead.IsActive() )
+ assert(bLeft || bFirst);
+ SwFrmFmt& rDescFrmFmt = (bFirst)
+ ? (bLeft) ? pDesc->GetFirstLeft() : pDesc->GetFirstMaster()
+ : pDesc->GetLeft();
+ if (bFirst && bLeft)
+ {
+ // special case: always shared with something
+ rDescFrmFmt.SetFmtAttr( rChged.IsFirstShared()
+ ? pDesc->GetLeft().GetHeader()
+ : pDesc->GetFirstMaster().GetHeader());
+ }
+ else if ((bFirst ? rChged.IsFirstShared() : rChged.IsHeaderShared())
+ || !rHead.IsActive())
{
// Left or first shares the header with the Master.
rDescFrmFmt.SetFmtAttr( pDesc->GetMaster().GetHeader() );
@@ -191,16 +207,19 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead,
const SwFmtCntnt &aCnt = rFmtHead.GetHeaderFmt()->GetCntnt();
if( !aCnt.GetCntntIdx() )
{
- const SwFrmFmt& rChgedFrmFmt = (bLeft ? rChged.GetLeft() : rChged.GetFirst());
+ const SwFrmFmt& rChgedFrmFmt = (bFirst)
+ ? (bLeft) ? rChged.GetFirstLeft() : rChged.GetFirstMaster()
+ : rChged.GetLeft();
rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetHeader() );
}
else if ((*aRCnt.GetCntntIdx() == *aCnt.GetCntntIdx()) ||
// The CntntIdx is _always_ different when called from
// SwDocStyleSheet::SetItemSet, because it deep-copies the
// PageDesc. So check if it was previously shared.
- ((bLeft) ? pDesc->IsHeaderShared() : pDesc->IsFirstShared()))
+ ((bFirst) ? pDesc->IsFirstShared() : pDesc->IsHeaderShared()))
{
- SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), (bLeft ? "Left header" : "First header"),
+ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(),
+ (bFirst) ? "First header" : "Left header",
GetDfltFrmFmt() );
::lcl_DescSetAttr( *pRight, *pFmt, false );
// The section which the right header attribute is pointing
@@ -226,12 +245,25 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead,
}
}
-void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft)
+void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft, bool bFirst)
{
- SwFrmFmt& rDescFrmFmt = (bLeft ? pDesc->GetLeft() : pDesc->GetFirst());
- if ( (bLeft ? rChged.IsFooterShared() : rChged.IsFirstShared() ) || !rFoot.IsActive() )
+ assert(bLeft || bFirst);
+ SwFrmFmt& rDescFrmFmt = (bFirst)
+ ? (bLeft) ? pDesc->GetFirstLeft() : pDesc->GetFirstMaster()
+ : pDesc->GetLeft();
+ if (bFirst && bLeft)
+ {
+ // special case: always shared with something
+ rDescFrmFmt.SetFmtAttr( rChged.IsFirstShared()
+ ? pDesc->GetLeft().GetFooter()
+ : pDesc->GetFirstMaster().GetFooter());
+ }
+ else if ((bFirst ? rChged.IsFirstShared() : rChged.IsFooterShared())
+ || !rFoot.IsActive())
+ {
// Left or first shares the Header with the Master.
rDescFrmFmt.SetFmtAttr( pDesc->GetMaster().GetFooter() );
+ }
else if ( rFoot.IsActive() )
{ // Left or first gets its own Footer if the Format does not already have one.
// If the Format already has a Footer and it points to the same section as the Right one,
@@ -252,16 +284,19 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot,
const SwFmtCntnt &aLCnt = rFmtFoot.GetFooterFmt()->GetCntnt();
if( !aLCnt.GetCntntIdx() )
{
- const SwFrmFmt& rChgedFrmFmt = (bLeft ? rChged.GetLeft() : rChged.GetFirst());
+ const SwFrmFmt& rChgedFrmFmt = (bFirst)
+ ? (bLeft) ? rChged.GetFirstLeft() : rChged.GetFirstMaster()
+ : rChged.GetLeft();
rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetFooter() );
}
else if ((*aRCnt.GetCntntIdx() == *aLCnt.GetCntntIdx()) ||
// The CntntIdx is _always_ different when called from
// SwDocStyleSheet::SetItemSet, because it deep-copies the
// PageDesc. So check if it was previously shared.
- ((bLeft) ? pDesc->IsFooterShared() : pDesc->IsFirstShared()))
+ ((bFirst) ? pDesc->IsFirstShared() : pDesc->IsFooterShared()))
{
- SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), (bLeft ? "Left footer" : "First footer"),
+ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(),
+ (bFirst) ? "First footer" : "Left footer",
GetDfltFrmFmt() );
::lcl_DescSetAttr( *pRight, *pFmt, false );
// The section to which the right footer attribute is pointing
@@ -310,7 +345,9 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
const_cast<SwPageDesc&>(rChged).GetLeft());
}
::lcl_DescSetAttr(rChged.GetMaster(),
- const_cast<SwPageDesc&>(rChged).GetFirst());
+ const_cast<SwPageDesc&>(rChged).GetFirstMaster());
+ ::lcl_DescSetAttr(rChged.GetLeft(),
+ const_cast<SwPageDesc&>(rChged).GetFirstLeft());
// Take over NumType.
if( rChged.GetNumType().GetNumberingType() != pDesc->GetNumType().GetNumberingType() )
@@ -350,8 +387,9 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
rChged.IsFirstShared() != pDesc->IsFirstShared() );
}
pDesc->GetMaster().SetFmtAttr( rHead );
- CopyMasterHeader(rChged, rHead, pDesc, true); // Copy left header
- CopyMasterHeader(rChged, rHead, pDesc, false); // Copy first header
+ CopyMasterHeader(rChged, rHead, pDesc, true, false); // Copy left header
+ CopyMasterHeader(rChged, rHead, pDesc, false, true); // Copy first master
+ CopyMasterHeader(rChged, rHead, pDesc, true, true); // Copy first left
pDesc->ChgHeaderShare( rChged.IsHeaderShared() );
// Synch Footer.
@@ -366,8 +404,9 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
rChged.IsFooterShared() != pDesc->IsFooterShared() );
}
pDesc->GetMaster().SetFmtAttr( rFoot );
- CopyMasterFooter(rChged, rFoot, pDesc, true); // Copy left footer
- CopyMasterFooter(rChged, rFoot, pDesc, false); // Copy first footer
+ CopyMasterFooter(rChged, rFoot, pDesc, true, false); // Copy left footer
+ CopyMasterFooter(rChged, rFoot, pDesc, false, true); // Copy first master
+ CopyMasterFooter(rChged, rFoot, pDesc, true, true); // Copy first left
pDesc->ChgFooterShare( rChged.IsFooterShared() );
// there is just one first shared flag for both header and footer?
pDesc->ChgFirstShare( rChged.IsFirstShared() );
@@ -408,7 +447,8 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
// Take over the page attributes.
::lcl_DescSetAttr( rChged.GetMaster(), pDesc->GetMaster() );
::lcl_DescSetAttr( rChged.GetLeft(), pDesc->GetLeft() );
- ::lcl_DescSetAttr( rChged.GetFirst(), pDesc->GetFirst() );
+ ::lcl_DescSetAttr( rChged.GetFirstMaster(), pDesc->GetFirstMaster() );
+ ::lcl_DescSetAttr( rChged.GetFirstLeft(), pDesc->GetFirstLeft() );
// If the FootnoteInfo changes, the pages are triggered.
if( !(pDesc->GetFtnInfo() == rChged.GetFtnInfo()) )
@@ -422,7 +462,10 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
pDesc->GetLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
}
{
- pDesc->GetFirst().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
+ pDesc->GetFirstMaster().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
+ }
+ {
+ pDesc->GetFirstLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) );
}
}
SetModified();
@@ -444,6 +487,13 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
}
+ //h/f of first-left page must not be unique but same as first master or left
+ assert((pDesc->IsFirstShared())
+ ? pDesc->GetFirstLeft().GetHeader().GetHeaderFmt() == pDesc->GetLeft().GetHeader().GetHeaderFmt()
+ : pDesc->GetFirstLeft().GetHeader().GetHeaderFmt() == pDesc->GetFirstMaster().GetHeader().GetHeaderFmt());
+ assert((pDesc->IsFirstShared())
+ ? pDesc->GetFirstLeft().GetFooter().GetFooterFmt() == pDesc->GetLeft().GetFooter().GetFooterFmt()
+ : pDesc->GetFirstLeft().GetFooter().GetFooterFmt() == pDesc->GetFirstMaster().GetFooter().GetFooterFmt());
}
/// All descriptors whose Follow point to the to-be-deleted have to be adapted.
@@ -554,7 +604,7 @@ sal_uInt16 SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
{
pNew = new SwPageDesc( rName, GetDfltFrmFmt(), this );
// Set the default page format.
- lcl_DefaultPageFmt( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(), pNew->GetFirst() );
+ lcl_DefaultPageFmt( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(), pNew->GetFirstMaster(), pNew->GetFirstLeft() );
SvxFrameDirection aFrameDirection = bRegardLanguage ?
GetDefaultFrameDirection(GetAppLanguage())
@@ -562,7 +612,8 @@ sal_uInt16 SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
pNew->GetMaster().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
pNew->GetLeft().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
- pNew->GetFirst().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
+ pNew->GetFirstMaster().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
+ pNew->GetFirstLeft().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
}
maPageDescs.push_back( pNew );
@@ -855,7 +906,7 @@ void SwDoc::CheckDefaultPageFmt()
LONG_MAX == rLeftSize.GetHeight();
if ( bSetSize )
- lcl_DefaultPageFmt( rDesc.GetPoolFmtId(), rDesc.GetMaster(), rDesc.GetLeft(), rDesc.GetFirst() );
+ lcl_DefaultPageFmt( rDesc.GetPoolFmtId(), rDesc.GetMaster(), rDesc.GetLeft(), rDesc.GetFirstMaster(), rDesc.GetFirstLeft() );
}
}
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index c94b913..78e347b 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -2156,18 +2156,30 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
else
rDstDesc.GetLeft().SetFmtAttr( rDstDesc.GetMaster().GetHeader() );
if( !rDstDesc.IsFirstShared() )
- CopyHeader( rSrcDesc.GetFirst(), rDstDesc.GetFirst() );
+ {
+ CopyHeader( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
+ rDstDesc.GetFirstLeft().SetFmtAttr(rDstDesc.GetFirstMaster().GetHeader());
+ }
else
- rDstDesc.GetFirst().SetFmtAttr( rDstDesc.GetMaster().GetHeader() );
+ {
+ rDstDesc.GetFirstMaster().SetFmtAttr( rDstDesc.GetMaster().GetHeader() );
+ rDstDesc.GetFirstLeft().SetFmtAttr(rDstDesc.GetLeft().GetHeader());
+ }
if( !rDstDesc.IsFooterShared() )
CopyFooter( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
else
rDstDesc.GetLeft().SetFmtAttr( rDstDesc.GetMaster().GetFooter() );
if( !rDstDesc.IsFirstShared() )
- CopyFooter( rSrcDesc.GetFirst(), rDstDesc.GetFirst() );
+ {
+ CopyFooter( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
+ rDstDesc.GetFirstLeft().SetFmtAttr(rDstDesc.GetFirstMaster().GetFooter());
+ }
else
- rDstDesc.GetFirst().SetFmtAttr( rDstDesc.GetMaster().GetFooter() );
+ {
+ rDstDesc.GetFirstMaster().SetFmtAttr( rDstDesc.GetMaster().GetFooter() );
+ rDstDesc.GetFirstLeft().SetFmtAttr(rDstDesc.GetLeft().GetFooter());
+ }
if( bNotifyLayout && pTmpRoot )
{
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index f0ee570..b6494f5 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1591,9 +1591,12 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
{
{
if( bSetLeft )
+ {
pNewPgDsc->GetLeft().SetFmtAttr( aSet );
+ pNewPgDsc->GetFirstLeft().SetFmtAttr( aSet );
+ }
pNewPgDsc->GetMaster().SetFmtAttr( aSet );
- pNewPgDsc->GetFirst().SetFmtAttr( aSet );
+ pNewPgDsc->GetFirstMaster().SetFmtAttr( aSet );
}
}
return pNewPgDsc;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 06dc22c..8245f14 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2719,18 +2719,19 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
if (rDesc.IsFirstShared())
{
// We need to fallback to left or right page format, decide it now.
+ // FIXME: is this still needed?
if (bOdd)
{
- rDesc.GetFirst().SetFmtAttr( rDesc.GetMaster().GetHeader() );
- rDesc.GetFirst().SetFmtAttr( rDesc.GetMaster().GetFooter() );
+ rDesc.GetFirstMaster().SetFmtAttr( rDesc.GetMaster().GetHeader() );
+ rDesc.GetFirstMaster().SetFmtAttr( rDesc.GetMaster().GetFooter() );
// fdo#60250 copy margins for mirrored pages
- rDesc.GetFirst().SetFmtAttr( rDesc.GetMaster().GetLRSpace() );
+ rDesc.GetFirstMaster().SetFmtAttr( rDesc.GetMaster().GetLRSpace() );
}
else
{
- rDesc.GetFirst().SetFmtAttr( rDesc.GetLeft().GetHeader() );
- rDesc.GetFirst().SetFmtAttr( rDesc.GetLeft().GetFooter() );
- rDesc.GetFirst().SetFmtAttr( rDesc.GetLeft().GetLRSpace() );
+ rDesc.GetFirstLeft().SetFmtAttr( rDesc.GetLeft().GetHeader() );
+ rDesc.GetFirstLeft().SetFmtAttr( rDesc.GetLeft().GetFooter() );
+ rDesc.GetFirstLeft().SetFmtAttr( rDesc.GetLeft().GetLRSpace() );
}
}
}
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 1b248f1..05a24d1 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -49,7 +49,8 @@ SwPageDesc::SwPageDesc( const String& rName, SwFrmFmt *pFmt, SwDoc *pDc ) :
aDescName( rName ),
aMaster( pDc->GetAttrPool(), rName, pFmt ),
aLeft( pDc->GetAttrPool(), rName, pFmt ),
- aFirst( pDc->GetAttrPool(), rName, pFmt ),
+ m_FirstMaster( pDc->GetAttrPool(), rName, pFmt ),
+ m_FirstLeft( pDc->GetAttrPool(), rName, pFmt ),
aDepend( this, 0 ),
pFollow( this ),
nRegHeight( 0 ),
@@ -67,7 +68,8 @@ SwPageDesc::SwPageDesc( const SwPageDesc &rCpy ) :
aNumType( rCpy.GetNumType() ),
aMaster( rCpy.GetMaster() ),
aLeft( rCpy.GetLeft() ),
- aFirst( rCpy.GetFirst() ),
+ m_FirstMaster( rCpy.GetFirstMaster() ),
+ m_FirstLeft( rCpy.GetFirstLeft() ),
aDepend( this, (SwModify*)rCpy.aDepend.GetRegisteredIn() ),
pFollow( rCpy.pFollow ),
nRegHeight( rCpy.GetRegHeight() ),
@@ -85,7 +87,8 @@ SwPageDesc & SwPageDesc::operator = (const SwPageDesc & rSrc)
aNumType = rSrc.aNumType;
aMaster = rSrc.aMaster;
aLeft = rSrc.aLeft;
- aFirst = rSrc.aFirst;
+ m_FirstMaster = rSrc.m_FirstMaster;
+ m_FirstLeft = rSrc.m_FirstLeft;
if (rSrc.pFollow == &rSrc)
pFollow = this;
@@ -243,7 +246,15 @@ void SwPageDesc::RegisterChange()
}
}
{
- SwIterator<SwFrm,SwFmt> aIter( GetFirst() );
+ SwIterator<SwFrm,SwFmt> aIter( GetFirstMaster() );
+ for( SwFrm* pLast = aIter.First(); pLast; pLast = aIter.Next() )
+ {
+ if( pLast->IsPageFrm() )
+ ((SwPageFrm*)pLast)->PrepareRegisterChg();
+ }
+ }
+ {
+ SwIterator<SwFrm,SwFmt> aIter( GetFirstLeft() );
for( SwFrm* pLast = aIter.First(); pLast; pLast = aIter.Next() )
{
if( pLast->IsPageFrm() )
@@ -348,14 +359,14 @@ sal_Bool SwPageDesc::IsFollowNextPageOfNode( const SwNode& rNd ) const
SwFrmFmt *SwPageDesc::GetLeftFmt(bool const bFirst)
{
return (nsUseOnPage::PD_LEFT & eUse)
- ? ((bFirst) ? &aFirst : &aLeft)
+ ? ((bFirst) ? &m_FirstLeft : &aLeft)
: 0;
}
SwFrmFmt *SwPageDesc::GetRightFmt(bool const bFirst)
{
return (nsUseOnPage::PD_RIGHT & eUse)
- ? ((bFirst) ? &aFirst : &aMaster)
+ ? ((bFirst) ? &m_FirstMaster : &aMaster)
: 0;
}
diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx
index 6962684..b60c18b 100644
--- a/sw/source/core/undo/SwUndoPageDesc.cxx
+++ b/sw/source/core/undo/SwUndoPageDesc.cxx
@@ -157,7 +157,7 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld,
}
if( !rNewDesc.IsFirstShared() )
{
- pFormat = new SwFrmFmt( *rNewDesc.GetFirst().GetHeader().GetHeaderFmt() );
+ pFormat = new SwFrmFmt( *rNewDesc.GetFirstMaster().GetHeader().GetHeaderFmt() );
// The Ctor of this object will remove the duplicate!
SwFmtHeader aFormatHeader( pFormat );
}
@@ -176,7 +176,7 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld,
}
if( !rNewDesc.IsFirstShared() )
{
- pFormat = new SwFrmFmt( *rNewDesc.GetFirst().GetFooter().GetFooterFmt() );
+ pFormat = new SwFrmFmt( *rNewDesc.GetFirstMaster().GetFooter().GetFooterFmt() );
// The Ctor of this object will remove the duplicate!
SwFmtFooter aFormatFooter( pFormat );
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index a7d3b17..0e090be 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -3411,7 +3411,9 @@ MakeObject:
}
else if (bFirst && !bShareFirst)
{
- pFrmFmt = &rDesc.GetFirst();
+ pFrmFmt = &rDesc.GetFirstMaster();
+ // no need to make GetFirstLeft() accessible
+ // since it is always shared
}
else
{
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 097a8a7..bc08a72 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1614,7 +1614,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
// The latter method was previously used by the doc/docx import filter.
// In both of these cases, we emit a single Word section with different
// first page header/footer.
- const SwFrmFmt* pPdFirstPgFmt = &pPd->GetFirst();
+ const SwFrmFmt* pPdFirstPgFmt = &pPd->GetFirstMaster();
bool titlePage = !pPd->IsFirstShared();
if ( bOutPgDscSet )
{
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d2dae7c..d211344 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -371,7 +371,7 @@ bool MSWordExportBase::SetAktPageDescFromNode(const SwNode &rNd)
bNewPageDesc = true;
else
{
- const SwFrmFmt& rTitleFmt = pAktPageDesc->GetFirst();
+ const SwFrmFmt& rTitleFmt = pAktPageDesc->GetFirstMaster();
const SwFrmFmt& rFollowFmt = pCurrent->GetMaster();
bNewPageDesc = !IsPlausableSingleWordSection(rTitleFmt,
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 223de68..b34b966 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2001,7 +2001,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
= (nI & ( WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST )) ? true: false;
SwFrmFmt& rFmt = bUseLeft ? pPD->GetLeft()
- : bUseFirst ? pPD->GetFirst()
+ : bUseFirst ? pPD->GetFirstMaster()
: pPD->GetMaster();
SwFrmFmt* pHdFtFmt;
@@ -2016,7 +2016,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
if (bUseLeft)
pPD->GetLeft().SetFmtAttr(SwFmtFooter(true));
if (bUseFirst || (rSection.maSep.fTitlePage && bNoFirst))
- pPD->GetFirst().SetFmtAttr(SwFmtFooter(true));
+ pPD->GetFirstMaster().SetFmtAttr(SwFmtFooter(true));
pHdFtFmt = const_cast<SwFrmFmt*>(rFmt.GetFooter().GetFooterFmt());
}
else
@@ -2028,7 +2028,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
if (bUseLeft)
pPD->GetLeft().SetFmtAttr(SwFmtHeader(true));
if (bUseFirst || (rSection.maSep.fTitlePage && bNoFirst))
- pPD->GetFirst().SetFmtAttr(SwFmtHeader(true));
+ pPD->GetFirstMaster().SetFmtAttr(SwFmtHeader(true));
pHdFtFmt = const_cast<SwFrmFmt*>(rFmt.GetHeader().GetHeaderFmt());
}
@@ -3853,7 +3853,7 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection,
if (!(rSection.maSep.pgbApplyTo & 1))
mrReader.SetPageBorder(rFmt, rSection);
if (!(rSection.maSep.pgbApplyTo & 2))
- mrReader.SetPageBorder(rPage.GetFirst(), rSection);
+ mrReader.SetPageBorder(rPage.GetFirstMaster(), rSection);
mrReader.SetDocumentGrid(rFmt, rSection);
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 0d9a638..49fd40e 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -1183,14 +1183,14 @@ void SwWW8ImplReader::CopyPageDescHdFt(const SwPageDesc* pOrgPageDesc,
// copy first page header content section
if( nCode & WW8_HEADER_FIRST )
{
- rDoc.CopyHeader(pOrgPageDesc->GetFirst(),
- pNewPageDesc->GetFirst());
+ rDoc.CopyHeader(pOrgPageDesc->GetFirstMaster(),
+ pNewPageDesc->GetFirstMaster());
}
// copy first page footer content section
if( nCode & WW8_FOOTER_FIRST )
{
- rDoc.CopyFooter(pOrgPageDesc->GetFirst(),
- pNewPageDesc->GetFirst());
+ rDoc.CopyFooter(pOrgPageDesc->GetFirstMaster(),
+ pNewPageDesc->GetFirstMaster());
}
}
--
1.8.4.2