diff options
Diffstat (limited to 'sw/source/core/layout/ssfrm.cxx')
-rw-r--r-- | sw/source/core/layout/ssfrm.cxx | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 9f0da8f708b6..0c4934cdb495 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -17,10 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_wasm_strip.h> + #include <pagefrm.hxx> #include <rootfrm.hxx> #include <dcontact.hxx> #include <flyfrm.hxx> +#include <tabfrm.hxx> #include <txtfrm.hxx> #include <cellfrm.hxx> #include <swtable.hxx> @@ -28,12 +31,14 @@ #include <editeng/boxitem.hxx> #include <editeng/shaditem.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentMarkAccess.hxx> #include <fmtclds.hxx> #include <viewimp.hxx> #include <sortedobjs.hxx> #include <hints.hxx> #include <frmtool.hxx> #include <ndtxt.hxx> +#include <osl/diagnose.h> // No inline cause we need the function pointers tools::Long SwFrame::GetTopMargin() const @@ -265,7 +270,7 @@ void SwFrame::CheckDirChange() for ( size_t i = 0; i < nCnt; ++i ) { SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; - if( auto pFlyFrame = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) ) + if( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() ) pFlyFrame->CheckDirChange(); else { @@ -327,12 +332,14 @@ void SwFrame::DestroyImpl() // accessible objects for fly and cell frames have been already disposed // by the destructors of the derived classes. +#if !ENABLE_WASM_STRIP_ACCESSIBILITY if (IsAccessibleFrame() && !(IsFlyFrame() || IsCellFrame()) && (GetDep() || IsTextFrame())) // sw_redlinehide: text frame may not have Dep! { assert(!IsTextFrame() || GetDep() || static_cast<SwTextFrame*>(this)->GetMergedPara()); + const bool bInDocDtor = IsTabFrame() && static_cast<SwTabFrame*>(this)->GetFormat()->GetDoc()->IsInDtor(); SwRootFrame *pRootFrame = getRootFrame(); - if( pRootFrame && pRootFrame->IsAnyShellAccessible() ) + if( !bInDocDtor && pRootFrame && pRootFrame->IsAnyShellAccessible() ) { SwViewShell *pVSh = pRootFrame->GetCurrShell(); if( pVSh && pVSh->Imp() ) @@ -342,6 +349,7 @@ void SwFrame::DestroyImpl() } } } +#endif if (!m_pDrawObjs) return; @@ -349,7 +357,7 @@ void SwFrame::DestroyImpl() for (size_t i = m_pDrawObjs->size(); i; ) { SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i]; - if ( auto pFlyFrame = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) ) + if ( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() ) { SwFrame::DestroyFrame(pFlyFrame); } @@ -400,22 +408,21 @@ SwFrameFormat * SwLayoutFrame::GetFormat() return static_cast< SwFrameFormat * >( GetDep() ); } -void SwLayoutFrame::SetFrameFormat( SwFrameFormat *pNew ) +void SwLayoutFrame::SetFrameFormat(SwFrameFormat* pNew) { - if ( pNew != GetFormat() ) - { - SwFormatChg aOldFormat( GetFormat() ); - pNew->Add( this ); - SwFormatChg aNewFormat( pNew ); - ModifyNotification( &aOldFormat, &aNewFormat ); - } + if(pNew == GetFormat()) + return; + const SwFormatChg aOldFormat(GetFormat()); + pNew->Add(*this); + const SwFormatChg aNewFormat(pNew); + SwClientNotify(*pNew, sw::LegacyModifyHint(&aOldFormat, &aNewFormat)); } SwContentFrame::SwContentFrame( SwContentNode * const pContent, SwFrame* pSib ) : SwFrame( pContent, pSib ), SwFlowFrame( static_cast<SwFrame&>(*this) ) { - assert(!getRootFrame()->IsHideRedlines() || pContent->IsCreateFrameWhenHidingRedlines()); + assert(!getRootFrame()->HasMergedParas() || pContent->IsCreateFrameWhenHidingRedlines()); } void SwContentFrame::DestroyImpl() @@ -453,6 +460,13 @@ void SwTextFrame::RegisterToNode(SwTextNode & rNode, bool const isForceNodeAsFir assert(m_pMergedPara->pFirstNode->GetIndex() + 1 == rNode.GetIndex()); assert(rNode.GetDoc().getIDocumentRedlineAccess().GetRedlinePos( *m_pMergedPara->pFirstNode, RedlineType::Delete) == SwRedlineTable::npos); + assert(std::find_if( + rNode.GetDoc().getIDocumentMarkAccess()->getFieldmarksBegin(), + rNode.GetDoc().getIDocumentMarkAccess()->getFieldmarksEnd(), + [this](::sw::mark::IMark const*const pMark) { + return pMark->GetMarkStart().GetNode() == *m_pMergedPara->pFirstNode + && pMark->GetMarkEnd().GetNode() != *m_pMergedPara->pFirstNode; + }) == rNode.GetDoc().getIDocumentMarkAccess()->getFieldmarksEnd()); } assert(&rNode != GetDep()); assert(!m_pMergedPara @@ -466,7 +480,7 @@ void SwTextFrame::RegisterToNode(SwTextNode & rNode, bool const isForceNodeAsFir m_pMergedPara = sw::CheckParaRedlineMerge(*this, rFirstNode, sw::FrameMode::New); if (!m_pMergedPara) { - rNode.Add(this); + rNode.Add(*this); } } @@ -496,7 +510,7 @@ void SwLayoutFrame::DestroyImpl() const size_t nCnt = pFrame->GetDrawObjs()->size(); // #i28701# SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[0]; - if (SwFlyFrame* pFlyFrame = dynamic_cast<SwFlyFrame*>(pAnchoredObj)) + if (SwFlyFrame* pFlyFrame = pAnchoredObj->DynCastFlyFrame()) { SwFrame::DestroyFrame(pFlyFrame); assert(!pFrame->GetDrawObjs() || nCnt > pFrame->GetDrawObjs()->size()); @@ -532,7 +546,7 @@ void SwLayoutFrame::DestroyImpl() // #i28701# SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[0]; - if ( auto pFlyFrame = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) ) + if ( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() ) { SwFrame::DestroyFrame(pFlyFrame); assert(!GetDrawObjs() || nCnt > GetDrawObjs()->size()); @@ -626,7 +640,8 @@ SwRect SwFrame::GetPaintArea() const pTmp->IsCellFrame() || pTmp->IsRowFrame() || //nobody leaves a table! pTmp->IsRootFrame() ) { - if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 ) + // BTLR is OK to expand towards the physical down direction. Physical down is left. + if( bLeft || (aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 && !IsVertLRBT()) ) nLeft = nTmpLeft; if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 ) nRight = nTmpRight; |