/* -*- 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 .
*/
// Order is important: only execute FillRegister if GetValue!=0
m_bRegisterOn = pNode->GetSwAttrSet().GetRegister().GetValue()
&& m_pFrame->FillRegister( m_nRegStart, m_nRegDiff );
}
if ( GetInfo().IsMulti() ) // we are inside the GetCharRect recursion for multi portions // we center the portion in its surrounding line
nOfst = ( m_pCurr->Height() - nPorHeight ) / 2 + nPorAscent; else
{ // We have to take care for ruby portions. // The ruby portion is NOT centered
nOfst = nOfst + nPorAscent;
if ( ! pPor || ! pPor->IsMultiPortion() ||
! static_cast<const SwMultiPortion*>(pPor)->IsRuby() )
{ // Portions which are bigger than on grid distance are // centered inside the whole line.
//for text refactor const sal_uInt16 nLineNet = rLine.Height() - nRubyHeight; //const sal_uInt16 nLineNet = ( nPorHeight > nGridWidth ) ? // rLine.Height() - nRubyHeight : // nGridWidth;
nOfst += ( nLineNet - nPorHeight ) / 2; if ( bRubyTop )
nOfst += nRubyHeight;
}
}
} else
{ switch ( GetLineInfo().GetVertAlign() ) { case SvxParaVertAlignItem::Align::Top :
nOfst = nOfst + nPorAscent; break; case SvxParaVertAlignItem::Align::Center :
OSL_ENSURE( rLine.Height() >= nPorHeight, "Portion height > Line height");
nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent; break; case SvxParaVertAlignItem::Align::Bottom :
nOfst += rLine.Height() - nPorHeight + nPorAscent; break; case SvxParaVertAlignItem::Align::Automatic : if ( bAutoToCentered || GetInfo().GetTextFrame()->IsVertical() )
{ // Vertical text has these cases to calculate the baseline: // - Implicitly TB and RL: the origo is the top right corner, offset is the // ascent. // - (Implicitly TB and) LR: the origo is the top left corner, offset is the // descent. // - BT and LR: the origo is the bottom left corner, offset is the ascent. if (GetInfo().GetTextFrame()->IsVertLR() && !GetInfo().GetTextFrame()->IsVertLRBT())
nOfst += rLine.Height() - ( rLine.Height() - nPorHeight ) / 2 - nPorAscent; else
{
SwTwips nLineHeight = 0; bool bHadClearingBreak = false; if (GetInfo().GetTextFrame()->IsVertical())
{ // Ignore the height of clearing break portions in the automatic // alignment case. const SwLinePortion* pLinePor = rLine.GetFirstPortion(); while (pLinePor)
{ bool bClearingBreak = false; if (pLinePor->IsBreakPortion())
{ auto pBreakPortion = static_cast<const SwBreakPortion*>(pLinePor);
bClearingBreak = pBreakPortion->GetClear() != SwLineBreakClear::NONE; if (bClearingBreak)
{
bHadClearingBreak = true;
}
} if (!bClearingBreak && pLinePor->Height() > nLineHeight)
{
nLineHeight = pLinePor->Height();
}
pLinePor = pLinePor->GetNextPortion();
}
}
if (!bHadClearingBreak)
{
nLineHeight = rLine.Height();
}
nOfst += ( nLineHeight - nPorHeight ) / 2 + nPorAscent;
} break;
}
[[fallthrough]]; case SvxParaVertAlignItem::Align::Baseline : // base line if (pPor && pPor->GetHangingBaseline())
{
nOfst += rLine.GetAscent() // Romn baseline of the line.
- rLine.GetHangingBaseline() // Hanging baseline of the line.
+ pPor->GetHangingBaseline(); // Romn baseline of the portion.
} else
nOfst = nOfst + rLine.GetAscent(); break;
}
}
// determine range to be searched for flys anchored as characters while ( pLine )
{
nRangeEnd = nRangeEnd + pLine->GetLen();
pLine = pLine->GetNext();
}
// examine hints in range nEnd - (nEnd + nRangeChar)
SwTextNode const* pNode(nullptr);
sw::MergedAttrIter iter(*GetTextFrame()); for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
{ if( RES_TXTATR_FLYCNT == pHt->Which() )
{ // check if hint is in our range
TextFrameIndex const nTmpPos(
GetTextFrame()->MapModelToView(pNode, pHt->GetStart())); if ( nEnd <= nTmpPos && nTmpPos < nRangeEnd )
pFollow->InvalidateRange_(
SwCharRange( nTmpPos, nTmpPos ) );
}
}
}
} delete pDel;
} if( m_pCurr->IsDummy() &&
!m_pCurr->GetLen() &&
m_nStart < TextFrameIndex(GetTextFrame()->GetText().getLength()))
{
m_pCurr->SetRealHeight( 1 );
} if (MaybeHasHints())
m_pFrame->RemoveFootnote( nEnd );
}
// Change current output device to formatting device, this has to be done before // formatting.
SwHookOut::SwHookOut( SwTextSizeInfo& rInfo ) :
pInf( &rInfo ),
pOut( rInfo.GetOut() ),
bOnWin( rInfo.OnWin() )
{
OSL_ENSURE( rInfo.GetRefDev(), "No reference device for text formatting" );
// set new values
rInfo.SetOut( rInfo.GetRefDev() );
rInfo.SetOnWin( false );
}
SwHookOut::~SwHookOut()
{
pInf->SetOut( pOut );
pInf->SetOnWin( bOnWin );
}
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.