sw/inc/doc.hxx | 4 - sw/inc/pagedesc.hxx | 10 ++- sw/source/core/doc/docdesc.cxx | 98 +++++++++++++++++++++++++-------- sw/source/core/doc/docfmt.cxx | 20 +++++- sw/source/core/doc/poolfmt.cxx | 5 + sw/source/core/inc/frmtool.hxx | 3 - sw/source/core/layout/flycnt.cxx | 33 +++++------ sw/source/core/layout/frmtool.cxx | 37 ++---------- sw/source/core/layout/pagedesc.cxx | 23 +++++-- sw/source/core/layout/trvlfrm.cxx | 16 ++--- sw/source/core/undo/SwUndoPageDesc.cxx | 46 ++++++++++++++- 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 +- 16 files changed, 208 insertions(+), 111 deletions(-)
New commits: commit 899538a155b0d58f3a864dbc26d0dc7c37386807 Author: Michael Stahl <mst...@redhat.com> Date: Fri Dec 20 21:24:37 2013 +0100 fdo#71429: sw: fix crashes when changing header first sharing Copy some nutso code in SwUndoPageDesc::ExchangeContentNodes() to work on the un-shared First header/footer too, which apparently avoids the crash. It's not like Undo of header/footer isn't already a house of cards anyway. Change-Id: Ie6593c4784ce9d368a5098ffb3aa4dec536d250e diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index b60c18b..5246c6f 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -248,6 +248,27 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } + if (!rDest.IsFirstShared()) + { + // Same procedure for unshared header.. + const SwFmtHeader& rSourceFirstMasterHead = rSource.GetFirstMaster().GetHeader(); + rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_HEADER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); +#if OSL_DEBUG_LEVEL > 1 + const SwFmtCntnt& rSourceCntnt1 = rSourceFirstMasterHead.GetHeaderFmt()->GetCntnt(); + (void)rSourceCntnt1; + const SwFmtCntnt& rDestCntnt1 = rDest.GetFirstMaster().GetHeader().GetHeaderFmt()->GetCntnt(); + (void)rDestCntnt1; +#endif + pNewFmt->SetFmtAttr( rSourceFirstMasterHead.GetHeaderFmt()->GetCntnt() ); + delete pNewItem; + rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_HEADER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pNewFmt->SetFmtAttr( SwFmtCntnt() ); + delete pNewItem; + } } // Same procedure for footers... const SwFmtFooter& rDestFoot = rDest.GetMaster().GetFooter(); @@ -294,6 +315,27 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes pNewFmt->SetFmtAttr( SwFmtCntnt() ); delete pNewItem; } + if (!rDest.IsFirstShared()) + { + const SwFmtFooter& rSourceFirstMasterFoot = rSource.GetFirstMaster().GetFooter(); +#if OSL_DEBUG_LEVEL > 1 + const SwFmtCntnt& rFooterSourceCntnt2 = rSourceFirstMasterFoot.GetFooterFmt()->GetCntnt(); + const SwFmtCntnt& rFooterDestCntnt2 = + rDest.GetFirstMaster().GetFooter().GetFooterFmt()->GetCntnt(); + (void)rFooterSourceCntnt2; + (void)rFooterDestCntnt2; +#endif + rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt->SetFmtAttr( rSourceFirstMasterFoot.GetFooterFmt()->GetCntnt() ); + delete pNewItem; + rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, sal_False, &pItem ); + pNewItem = pItem->Clone(); + pNewFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pNewFmt->SetFmtAttr( SwFmtCntnt() ); + delete pNewItem; + } } } commit e936ecc92a7e362f57ce72a955697840920636b8 Author: Michael Stahl <mst...@redhat.com> Date: Fri Dec 20 17:58:12 2013 +0100 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. Change-Id: I0889a4ab5959b5a71172203bb64d185960a07d73 diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 217590c..80e6ae4 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -2093,9 +2093,9 @@ public: private: /// 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 4fa0449..b0bccec 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -135,7 +135,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. @@ -190,10 +192,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 3f1d636..c84a5d2 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -58,7 +58,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. @@ -114,6 +115,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, @@ -162,10 +167,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, 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 @@ -225,12 +244,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, @@ -251,16 +283,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 @@ -309,7 +344,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() ) @@ -349,8 +386,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. @@ -365,8 +403,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() ); @@ -407,7 +446,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()) ) @@ -421,7 +461,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(); @@ -442,6 +485,14 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE ); 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. @@ -552,7 +603,7 @@ sal_uInt16 SwDoc::MakePageDesc( const OUString &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()) @@ -560,7 +611,8 @@ sal_uInt16 SwDoc::MakePageDesc( const OUString &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 ); @@ -853,7 +905,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 e2e671f..561cb0f 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -2157,18 +2157,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 18d8a4c..55f5012 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -1632,9 +1632,12 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) if( aSet.Count() ) { 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 631a60c..d3aebaf 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -2695,18 +2695,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 0cfe870..c450a8c 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -50,7 +50,8 @@ SwPageDesc::SwPageDesc( const OUString& 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 ), @@ -68,7 +69,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() ), @@ -86,7 +88,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; @@ -244,7 +247,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() ) @@ -349,14 +360,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 cfe930b..df5249d 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -3418,7 +3418,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 454bf2e..e131dab 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1730,7 +1730,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 96975cf..bab4497 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -372,7 +372,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 8c91d52..ce10d21 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2337,7 +2337,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; @@ -2352,7 +2352,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 @@ -2364,7 +2364,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()); } @@ -4198,7 +4198,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 4c35f4e..7283840 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()); } } commit 94c772adc2e8d8af468f3996527c84bf7704103f Author: Michael Stahl <mst...@redhat.com> Date: Fri Dec 20 11:24:48 2013 +0100 fdo#70232: sw: brown paper-bag fix for header sharing mangling footers Stupid copy/paste error in SwDoc::CopyMasterFooter() checks IsHeaderShared(). (regression from e1a9a348a519a69f898c9c1e6d87a5837b8267f9) Change-Id: I0c0bc16a8c581cd05ed206a0de79c7983204165b diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 413a00d..3f1d636 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -258,7 +258,7 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, // 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())) + ((bLeft) ? pDesc->IsFooterShared() : pDesc->IsFirstShared())) { SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), (bLeft ? "Left footer" : "First footer"), GetDfltFrmFmt() ); commit f0c03edd639fd792b36d1bfc5fe54a52d67c9dee Author: Michael Stahl <mst...@redhat.com> Date: Thu Dec 19 21:44:27 2013 +0100 sw: remove silly BigInt based SqRt Change-Id: I0a23682998fcf23f917289a0137d137b240a9d92 diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 3304351..e44862c 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -35,7 +35,6 @@ class SwRootFrm; class SwDoc; class SwAttrSet; class SdrObject; -class BigInt; class SvxBrushItem; class XFillStyleItem; class XFillGradientItem; @@ -82,8 +81,6 @@ void PaintCharacterBorder( // Implementation in feshview.cxx SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, SwViewShell *pSh ); -sal_uLong SqRt( BigInt nX ); - SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart = NULL ); void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow ); diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 7b7ef16..06c6885 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -877,7 +877,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet, return 0; } -static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, +static sal_uInt64 lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, const SwCntntFrm *& rpCnt, const bool bBody, const sal_Bool bFtn ) { @@ -890,8 +890,8 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, #endif rpCnt = 0; - sal_uLong nDistance = ULONG_MAX; - sal_uLong nNearest = ULONG_MAX; + sal_uInt64 nDistance = SAL_MAX_UINT64; + sal_uInt64 nNearest = SAL_MAX_UINT64; const SwCntntFrm *pCnt = pLay->ContainsCntnt(); while ( pCnt && (bBody != pCnt->IsInDocBody() || bFtn != pCnt->IsInFtn())) @@ -907,13 +907,12 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, { //Calculate the distance between those two points. //'delta' X^2 + 'delta' Y^2 = 'distance'^2 - sal_uInt32 dX = std::max( pCnt->Frm().Left(), rPt.X() ) - + sal_uInt64 dX = std::max( pCnt->Frm().Left(), rPt.X() ) - std::min( pCnt->Frm().Left(), rPt.X() ), dY = std::max( pCnt->Frm().Top(), rPt.Y() ) - std::min( pCnt->Frm().Top(), rPt.Y() ); - BigInt dX1( dX ), dY1( dY ); - dX1 *= dX1; dY1 *= dY1; - const sal_uLong nDiff = ::SqRt( dX1 + dY1 ); + // square of the difference will do fine here + const sal_uInt64 nDiff = (dX * dX) + (dY * dY); if ( pCnt->Frm().Top() <= rPt.Y() ) { if ( nDiff < nDistance ) @@ -935,7 +934,7 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay, } while ( pCnt && pLay->IsAnLower( pCnt ) ); } - if ( nDistance == ULONG_MAX ) + if (nDistance == SAL_MAX_UINT64) { rpCnt = pNearest; return nNearest; } @@ -955,26 +954,26 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt, //above the point. const SwCntntFrm *pRet, *pNew; const SwLayoutFrm *pLay = pCnt->FindPageFrm(); - sal_uLong nDist; + sal_uInt64 nDist; // not sure if a sal_Int32 would be enough? nDist = ::lcl_FindCntDiff( rPt, pLay, pNew, bBody, bFtn ); if ( pNew ) pRet = pNew; else { pRet = pCnt; - nDist = ULONG_MAX; + nDist = SAL_MAX_UINT64; } const SwCntntFrm *pNearest = pRet; - sal_uLong nNearest = nDist; + sal_uInt64 nNearest = nDist; if ( pLay ) { const SwLayoutFrm *pPge = pLay; - sal_uLong nOldNew = ULONG_MAX; + sal_uInt64 nOldNew = SAL_MAX_UINT64; for ( sal_uInt16 i = 0; pPge->GetPrev() && (i < 3); ++i ) { pPge = (SwLayoutFrm*)pPge->GetPrev(); - const sal_uLong nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); + const sal_uInt64 nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); if ( nNew < nDist ) { if ( pNew->Frm().Top() <= rPt.Y() ) @@ -988,18 +987,18 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt, nNearest = nNew; } } - else if ( nOldNew != ULONG_MAX && nNew > nOldNew ) + else if (nOldNew != SAL_MAX_UINT64 && nNew > nOldNew) break; else nOldNew = nNew; } pPge = pLay; - nOldNew = ULONG_MAX; + nOldNew = SAL_MAX_UINT64; for ( sal_uInt16 j = 0; pPge->GetNext() && (j < 3); ++j ) { pPge = (SwLayoutFrm*)pPge->GetNext(); - const sal_uLong nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); + const sal_uInt64 nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); if ( nNew < nDist ) { if ( pNew->Frm().Top() <= rPt.Y() ) @@ -1013,7 +1012,7 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt, nNearest = nNew; } } - else if ( nOldNew != ULONG_MAX && nNew > nOldNew ) + else if (nOldNew != SAL_MAX_UINT64 && nNew > nOldNew) break; else nOldNew = nNew; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index ac95bf8..631a60c 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/bigint.hxx> #include <svx/svdmodel.hxx> #include <svx/svdpage.hxx> #include <editeng/brushitem.hxx> @@ -2683,29 +2682,6 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGro pParent->Grow( nGrowVal ); } -/************************************************************************* -|* -|* SqRt() Berechnung der Quadratwurzel, damit die math.lib -|* nicht auch noch dazugelinkt werden muss. -|* -|*************************************************************************/ - -sal_uLong SqRt( BigInt nX ) -{ - BigInt nErg = 1; - - if ( !nX.IsNeg() ) - { - BigInt nOldErg = 1; - for ( int i = 0; i <= 5; i++ ) - { - nErg = (nOldErg + (nX / nOldErg)) / BigInt(2); - nOldErg = nErg; - } - } - return nErg >= BigInt(SAL_MAX_UINT32) ? ULONG_MAX : (sal_uLong)nErg; -} - /*************************************************************************/ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index c67008d..f33cfcb 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1142,17 +1142,15 @@ sal_Bool GetFrmInPage( const SwCntntFrm *pCnt, SwWhichPage fnWhichPage, } } -sal_uLong CalcDiff( const Point &rPt1, const Point &rPt2 ) +static sal_uInt64 CalcDiff(const Point &rPt1, const Point &rPt2) { //Calculate the distance between the two points. //'delta' X^2 + 'delta'Y^2 = 'distance'^2 - sal_uInt32 dX = std::max( rPt1.X(), rPt2.X() ) - + sal_uInt64 dX = std::max( rPt1.X(), rPt2.X() ) - std::min( rPt1.X(), rPt2.X() ), dY = std::max( rPt1.Y(), rPt2.Y() ) - std::min( rPt1.Y(), rPt2.Y() ); - BigInt dX1( dX ), dY1( dY ); - dX1 *= dX1; dY1 *= dY1; - return ::SqRt( dX1 + dY1 ); + return (dX * dX) + (dY * dY); } /** Check if the point lies inside the page part in wich also the CntntFrame lies. @@ -1209,7 +1207,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint, const SwLayoutFrm *pInside = NULL; sal_uInt16 nMaxPage = GetPhyPageNum() + (bDefaultExpand ? 1 : 0); Point aPoint = rPoint; - sal_uLong nDistance = ULONG_MAX; + sal_uInt64 nDistance = SAL_MAX_UINT64; while ( true ) //A loop to be sure we always find one. { @@ -1262,7 +1260,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint, if( !pInside || ( pInside->IsAnLower( pCntnt ) && ( !pCntnt->IsInFtn() || pInside->IsFtnContFrm() ) ) ) { - const sal_uLong nDiff = ::CalcDiff( aCntntPoint, rPoint ); + const sal_uInt64 nDiff = ::CalcDiff(aCntntPoint, rPoint); sal_Bool bBetter = nDiff < nDistance; // This one is nearer if( !pInside ) { @@ -1406,7 +1404,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const const SwCntntFrm *pAct = pCntnt; Point aAct = rPt; - sal_uLong nDist = ULONG_MAX; + sal_uLong nDist = SAL_MAX_UINT64; while ( pCntnt ) { @@ -1433,7 +1431,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const else if ( aCntFrm.Right() < rPt.X() ) aPoint.X() = aCntFrm.Right(); - const sal_uLong nDiff = ::CalcDiff( aPoint, rPt ); + const sal_uInt64 nDiff = ::CalcDiff( aPoint, rPt ); if ( nDiff < nDist ) { aAct = aPoint; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits