// Does the paragraph fit into one line? bool SwTextFrameInfo::IsOneLine() const
{ const SwLineLayout *pLay = m_pFrame->GetPara(); if( !pLay ) returnfalse;
// For follows false of course if( m_pFrame->GetFollow() ) returnfalse;
pLay = pLay->GetNext(); while( pLay )
{ if( pLay->GetLen() ) returnfalse;
pLay = pLay->GetNext();
} returntrue;
}
// Is the line filled for X percent? bool SwTextFrameInfo::IsFilled( const sal_uInt8 nPercent ) const
{ const SwLineLayout *pLay = m_pFrame->GetPara(); if( !pLay ) returnfalse;
// Where does the text start (without whitespace)? (relative in the Frame)
SwTwips SwTextFrameInfo::GetLineStart() const
{
SwTextSizeInfo aInf( const_cast<SwTextFrame*>(m_pFrame) );
SwTextCursor aLine( const_cast<SwTextFrame*>(m_pFrame), &aInf ); return GetLineStart( aLine ) - m_pFrame->getFrameArea().Left() - m_pFrame->getFramePrintArea().Left();
}
// Calculates the character's position and returns the middle position
SwTwips SwTextFrameInfo::GetCharPos(TextFrameIndex const nChar, bool bCenter) const
{
SwRectFnSet aRectFnSet(m_pFrame);
SwFrameSwapper aSwapper( m_pFrame, true );
// Accumulates the whitespace at line start and end in the vector void SwTextFrameInfo::GetSpaces(
std::vector<std::pair<TextFrameIndex, TextFrameIndex>> & rRanges, boolconst bWithLineBreak) const
{
SwTextSizeInfo aInf( const_cast<SwTextFrame*>(m_pFrame) );
SwTextMargin aLine( const_cast<SwTextFrame*>(m_pFrame), &aInf ); bool bFirstLine = true; do {
if( aLine.GetCurr()->GetLen() )
{
TextFrameIndex nPos = aLine.GetTextStart(); // Do NOT include the blanks/tabs from the first line // in the selection if( !bFirstLine && nPos > aLine.GetStart() )
AddRange( rRanges, aLine.GetStart(), nPos - aLine.GetStart() );
// Do NOT include the blanks/tabs from the last line // in the selection if( aLine.GetNext() )
{
TextFrameIndex const nEndPos{aLine.GetTextEnd()};
// Is there a bullet/symbol etc. at the text position? // Fonts: CharSet, SYMBOL and DONTKNOW bool SwTextFrameInfo::IsBullet(TextFrameIndex const nTextStart) const
{
SwTextSizeInfo aInf( const_cast<SwTextFrame*>(m_pFrame) );
SwTextMargin aLine( const_cast<SwTextFrame*>(m_pFrame), &aInf );
aInf.SetIdx( nTextStart ); return aLine.IsSymbol( nTextStart );
}
// Get first line indent // The precondition for a positive or negative first line indent: // All lines (except for the first one) have the same left margin. // We do not want to be so picky and work with a tolerance of TOLERANCE twips.
SwTwips SwTextFrameInfo::GetFirstIndent() const
{
SwTextSizeInfo aInf( const_cast<SwTextFrame*>(m_pFrame) );
SwTextCursor aLine( const_cast<SwTextFrame*>(m_pFrame), &aInf ); const SwTwips nFirst = GetLineStart( aLine ); const SwTwips TOLERANCE = 20;
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.