/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// #i31698# - notify anchored objects also for page frames. // Remove code above for special handling of page frames if ( !GetDrawObjs() ) return;
const SwSortedObjs *pObjs = GetDrawObjs(); const size_t nCnt = pObjs->size(); for ( size_t i = 0; i < nCnt; ++i )
{
SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; if( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() )
pFlyFrame->CheckDirChange(); else
{ // OD 2004-04-06 #i26791# - direct object // positioning no longer needed. Instead // invalidate
pAnchoredObj->InvalidateObjPos();
} // #i31698# - update layout direction of // anchored object
{
::setContextWritingMode( pAnchoredObj->DrawObj(), pAnchoredObj->GetAnchorFrameContainingAnchPos() );
pAnchoredObj->UpdateLayoutDir();
}
}
}
/// returns the position for anchors based on frame direction // OD 2004-03-10 #i11860# - consider lower space and line spacing of // previous frame according to new option 'Use former object positioning'
Point SwFrame::GetFrameAnchorPos( bool bIgnoreFlysAnchoredAtThisFrame ) const
{
Point aAnchor = getFrameArea().Pos();
// OD 2004-03-10 #i11860# - if option 'Use former object positioning' // is OFF, consider the lower space and the line spacing of the // previous frame and the spacing considered for the page grid const SwTextFrame* pThisTextFrame = static_cast<const SwTextFrame*>(this); const SwTwips nUpperSpaceAmountConsideredForPrevFrameAndPageGrid =
pThisTextFrame->GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid(); if ( IsVertical() )
{
aAnchor.AdjustX( -nUpperSpaceAmountConsideredForPrevFrameAndPageGrid );
} else
{
aAnchor.AdjustY(nUpperSpaceAmountConsideredForPrevFrameAndPageGrid );
}
}
return aAnchor;
}
void SwFrame::DestroyImpl()
{
mbInDtor = true;
// 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()); constbool bInDocDtor = IsTabFrame() && static_cast<SwTabFrame*>(this)->GetFormat()->GetDoc().IsInDtor();
SwRootFrame *pRootFrame = getRootFrame(); if( !bInDocDtor && pRootFrame && pRootFrame->IsAnyShellAccessible() )
{
SwViewShell *pVSh = pRootFrame->GetCurrShell(); if( pVSh && pVSh->Imp() )
{
OSL_ENSURE( !GetLower(), "Lowers should be dispose already!" );
pVSh->Imp()->DisposeAccessibleFrame( this );
}
}
} #endif
if (!m_pDrawObjs) return;
for (size_t i = m_pDrawObjs->size(); i; )
{
SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i]; if ( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() )
{
SwFrame::DestroyFrame(pFlyFrame);
} else
{
SdrObject* pSdrObj = pAnchoredObj->DrawObj();
SwDrawContact* pContact = static_cast<SwDrawContact*>(pSdrObj->GetUserCall());
OSL_ENSURE( pContact, " - missing contact for drawing object" ); if ( pContact )
{
pContact->DisconnectObjFromLayout( pSdrObj );
}
}
}
m_pDrawObjs.reset();
}
SwFrame::~SwFrame()
{
assert(m_isInDestroy); // check that only DestroySwFrame does "delete"
assert(!IsDeleteForbidden()); // check that it's not deleted while deletes are forbidden #if OSL_DEBUG_LEVEL > 0 // JP 15.10.2001: for detection of access to deleted frames
mpRoot = reinterpret_cast<SwRootFrame*>(0x33333333); #endif
}
void SwFrame::DestroyFrame(SwFrame *const pFrame)
{ if (pFrame)
{
pFrame->m_isInDestroy = true;
pFrame->DestroyImpl();
assert(pFrame->mbInDtor); // check that nobody forgot to call base class delete pFrame;
}
}
if( GetFormat() && !GetFormat()->GetDoc().IsInDtor() )
{ while ( pFrame )
{ //First delete the Objs of the Frame because they can't unregister //from the page after remove. //We don't want to create an endless loop only because one couldn't //unregister.
/** |* The paintarea is the area, in which the content of a frame is allowed |* to be displayed. This region could be larger than the printarea (getFramePrintArea()) |* of the upper, it includes e.g. often the margin of the page.
|*/
SwRect SwFrame::GetPaintArea() const
{ // NEW TABLES // Cell frames may not leave their upper:
SwRect aRect = IsRowFrame() ? GetUpper()->getFrameArea() : getFrameArea();
SwRectFnSet aRectFnSet(this);
tools::Long nRight = aRectFnSet.GetRight(aRect);
tools::Long nLeft = aRectFnSet.GetLeft(aRect); const SwFrame* pTmp = this; bool bLeft = true; bool bRight = true;
tools::Long nRowSpan = 0; while( pTmp )
{ if( pTmp->IsCellFrame() && pTmp->GetUpper() &&
pTmp->GetUpper()->IsVertical() != pTmp->IsVertical() )
nRowSpan = static_cast<const SwCellFrame*>(pTmp)->GetTabBox()->getRowSpan();
tools::Long nTmpRight = aRectFnSet.GetRight(pTmp->getFrameArea());
tools::Long nTmpLeft = aRectFnSet.GetLeft(pTmp->getFrameArea()); if( pTmp->IsRowFrame() && nRowSpan > 1 )
{ const SwFrame* pNxt = pTmp; while( --nRowSpan > 0 && pNxt->GetNext() )
pNxt = pNxt->GetNext(); if( pTmp->IsVertical() )
nTmpLeft = aRectFnSet.GetLeft(pNxt->getFrameArea()); else
{ // pTmp is a row frame, but it's not vertical. if (IsVertLRBT())
{ // This frame cell is OK to expand towards the physical down direction. // Physical down is left.
nTmpLeft = aRectFnSet.GetLeft(pNxt->getFrameArea());
} else
{
nTmpRight = aRectFnSet.GetRight(pNxt->getFrameArea());
}
}
}
OSL_ENSURE( pTmp, "GetPaintArea lost in time and space" ); if( pTmp->IsPageFrame() || pTmp->IsFlyFrame() ||
pTmp->IsCellFrame() || pTmp->IsRowFrame() || //nobody leaves a table!
pTmp->IsRootFrame() )
{ // 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; if( pTmp->IsPageFrame() || pTmp->IsFlyFrame() || pTmp->IsRootFrame() ) break;
bLeft = false;
bRight = false;
} elseif( pTmp->IsColumnFrame() ) // nobody enters neighbour columns
{ bool bR2L = pTmp->IsRightToLeft(); // the first column has _no_ influence to the left range if( bR2L ? pTmp->GetNext() : pTmp->GetPrev() )
{ if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 )
nLeft = nTmpLeft;
bLeft = false;
} // the last column has _no_ influence to the right range if( bR2L ? pTmp->GetPrev() : pTmp->GetNext() )
{ if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 )
nRight = nTmpRight;
bRight = false;
}
} elseif (aRectFnSet.IsVert() && pTmp->IsBodyFrame())
{ // Header and footer frames have always horizontal direction and // limit the body frame. // A previous frame of a body frame must be a header, // the next frame of a body frame may be a footnotecontainer or // a footer. The footnotecontainer has the same direction like // the body frame. if( pTmp->GetPrev() && ( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 ) )
{
nLeft = nTmpLeft;
bLeft = false;
} if( pTmp->GetNext() &&
( pTmp->GetNext()->IsFooterFrame() || pTmp->GetNext()->GetNext() )
&& ( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 ) )
{
nRight = nTmpRight;
bRight = false;
}
}
pTmp = pTmp->GetUpper();
}
aRectFnSet.SetLeft(aRect, nLeft);
aRectFnSet.SetRight(aRect, nRight); return aRect;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.