if( bFull )
{ // If the line is full, and the character-bound frame is at // the beginning of a line // If it is not possible to side step into a Fly // "Begin of line" criteria ( ! rInf.X() ) has to be extended. // KerningPortions at beginning of line, e.g., for grid layout // must be considered. const SwLinePortion* pLastPor = rInf.GetLast(); constauto nLeft = ( pLastPor &&
( pLastPor->IsKernPortion() ||
pLastPor->IsErgoSumPortion() ) ) ?
pLastPor->Width() : 0;
if( nLeft == rInf.X() && ! rInf.GetFly() )
{
Width( rInf.Width() );
bFull = false; // so that notes can still be placed in this line
} else
{ if( !rInf.GetFly() )
rInf.SetNewLine( true );
Width(0);
SetAscent(0);
SetLen(TextFrameIndex(0)); if( rInf.GetLast() )
rInf.GetLast()->FormatEOL( rInf );
return bFull;
}
}
rInf.GetParaPortion()->SetFly(); return bFull;
}
//TODO: improve documentation /** move character-bound objects inside the given area * *ThisallowsmovingthoseobjectsfromMastertoFollow,orviceversa. * *@parampNew *@paramnStart *@paramnEnd
*/ void SwTextFrame::MoveFlyInCnt(SwTextFrame *pNew,
TextFrameIndex const nStart, TextFrameIndex const nEnd)
{
SwSortedObjs *pObjs = GetDrawObjs(); if ( nullptr == pObjs ) return;
size_t i = 0; while (GetDrawObjs() && i < pObjs->size())
{ // Consider changed type of <SwSortedList> entries
SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; const SwFormatAnchor& rAnch = pAnchoredObj->GetFrameFormat()->GetAnchor(); if (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
{ const SwPosition* pPos = rAnch.GetContentAnchor();
TextFrameIndex const nIndex(MapModelToViewPos(*pPos)); if (nStart <= nIndex && nIndex < nEnd)
{ if ( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() )
{
RemoveFly( pFlyFrame );
pNew->AppendFly( pFlyFrame );
} else
{
RemoveDrawObj( *pAnchoredObj );
pNew->AppendDrawObj( *pAnchoredObj );
} continue; // pObjs shrunk
}
}
++i;
}
}
// GetFlyFrame() may change the layout mode at the output device.
{
SwLayoutModeModifier aLayoutModeModifier(*rInf.GetOut());
m_pFly->PaintSwFrame(const_cast<vcl::RenderContext&>(*rInf.GetOut()), aRect);
// track changes: cross out the image, if it is deleted const SwFrame *pFrame = m_pFly->Lower(); if ( GetAuthor() != std::string::npos && IsDeleted() && pFrame )
{
SwRect aPaintRect( pFrame->GetPaintArea() );
// As the OutputDevice might be anything, the font must be re-selected. // Being in const method should not be a problem. const_cast<SwTextPaintInfo&>(rInf).SelectFont();
void sw::DrawFlyCntPortion::Paint(const SwTextPaintInfo&) const
{ if(!m_pContact->GetAnchorFrame())
{ // No direct positioning of the drawing object is needed
m_pContact->ConnectToLayout();
}
}
SdrObject* sw::DrawFlyCntPortion::GetSdrObj(const SwTextFrame& rFrame)
{
SdrObject* pSdrObj; // Determine drawing object ('master' or 'virtual') by frame
pSdrObj = m_pContact->GetDrawObjectByAnchorFrame(rFrame); if(!pSdrObj)
{
SAL_WARN("sw.core", "SwFlyCntPortion::SetBase(..) - No drawing object found by <GetDrawContact()->GetDrawObjectByAnchorFrame( rFrame )>");
pSdrObj = m_pContact->GetMaster();
}
// Call <SwAnchoredDrawObject::MakeObjPos()> to assure that flag at // the <DrawFrameFormat> and at the <SwAnchoredDrawObject> instance are // correctly set if(pSdrObj)
m_pContact->GetAnchoredObj(pSdrObj)->MakeObjPos(); return pSdrObj;
}
/** *AftersettingtheRefPoints,theascentneedstoberecalculated *becauseitisdependentonRelPos * *@paramrBaseCAUTION:needstobeanabsolutevalue!
*/ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase,
tools::Long nLnAscent, tools::Long nLnDescent,
tools::Long nFlyAsc, tools::Long nFlyDesc,
AsCharFlags nFlags )
{ // Use new class to position object // Determine drawing object
SdrObject* pSdrObj = GetSdrObj(rFrame); if (!pSdrObj) return;
// Scope of local variable <aObjPosInProgress>
{
SwObjPositioningInProgress aObjPosInProgress( *pSdrObj );
aObjPositioning.CalcPosition();
}
if (auto pFormat = FindFrameFormat(pSdrObj))
{ if (pFormat->GetOtherTextBoxFormats()
&& pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
{ // TODO: Improve security with moving this sync call to other place, // where it works for typing but not during layout calc. constbool bModified = pFormat->GetDoc().getIDocumentState().IsEnableSetModified();
pFormat->GetDoc().getIDocumentState().SetEnableSetModified(false);
SwTextBoxHelper::synchronizeGroupTextBoxProperty(SwTextBoxHelper::changeAnchor, pFormat,
pFormat->FindRealSdrObject());
SwTextBoxHelper::synchronizeGroupTextBoxProperty(SwTextBoxHelper::syncTextBoxSize,
pFormat, pFormat->FindRealSdrObject());
pFormat->GetDoc().getIDocumentState().SetEnableSetModified(bModified);
}
}
SetAlign( aObjPositioning.GetLineAlignment() );
m_aRef = aObjPositioning.GetAnchorPos(); if( nFlags & AsCharFlags::Rotate )
SvXSize( aObjPositioning.GetObjBoundRectInclSpacing().SSize() ); else
SvLSize( aObjPositioning.GetObjBoundRectInclSpacing().SSize() ); if( Height() )
{ // GetRelPosY returns the relative position to baseline (if 0, the // upper border of the FlyCnt if on the baseline of a line)
SwTwips nRelPos = aObjPositioning.GetRelPosY(); if ( nRelPos < 0 )
{
mnAscent = -nRelPos; if( mnAscent > Height() )
Height( mnAscent );
} else
{
mnAscent = 0;
Height(Height() + nRelPos);
}
} else
{
Height( 1 );
mnAscent = 0;
}
}
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.