Example #1
0
/**
Return the horizontal alignment as a @c CParaFormat::TAlignment object. Note that the 
@c CParaFormat::TAlignment class supports the concept of horizontal absolute alignment, 
so left and right alignment will not be swapped.

@return The horizontal alignment, including whether it's absolute or not.
*/
EXPORT_C CParaFormat::TAlignment TGulAlignment::ParaAlign() const
	{
	if(HAlignment() == EHLeft)
		return (HasAbsoluteHAlignment() ? CParaFormat::EAbsoluteLeftAlign : CParaFormat::ELeftAlign);
	else if(HAlignment() == EHRight)
		return (HasAbsoluteHAlignment() ? CParaFormat::EAbsoluteRightAlign : CParaFormat::ERightAlign);
	else 
		return CParaFormat::ECenterAlign;
	}
Example #2
0
/** Gets the co-ordinates of the top left corner of an object of size @c aInnerSize, 
which is placed in the area of the rectangle @c aOuter according to the current 
alignment. 

Note that if RightToLeft language directionality is specified, left and right horizontal 
alignment for the inner object will be swapped.

@param aOuter The outer rectangle.
@param aInnerSize The size of the inner rectangle.
@param aLanguageDirectionality The language directionality to consider when swapping left and right.
@return The inner top left point. */
EXPORT_C TPoint TGulAlignment::InnerTopLeft(const TRect& aOuter, const TSize& aInnerSize, TBidiText::TDirectionality aLanguageDirectionality) const
	{
	TSize delta = aOuter.Size()-aInnerSize;
	switch (HAlignment(aLanguageDirectionality))
		{
	case EHLeft:
		delta.iWidth=0;
		break;
	case EHCenter:
		delta.iWidth>>=1; 	// div 2
		break;
	default:
		break;
		}
		
	switch (VAlignment())
		{
	case EVTop:
		delta.iHeight=0;
		break;
	case EVCenter:
		delta.iHeight>>=1;	// div 2
		break;
	default:
		break;
		}
	
	return(aOuter.iTl+delta);
	}
HAlignment ImplAlignmentVector::getClone() const
{
	return HAlignment( new ImplAlignmentVector( *this ) );
}
//------------------------------------------------------------------------------------------------------------
HAlignment ImplAlignmentVector::getNew() const
{
	return HAlignment( new ImplAlignmentVector() );
}
//------------------------------factory functions -----------------------------
HAlignment makeAlignmentVector()
{
	return HAlignment( new ImplAlignmentVector() );
}
HAlignment ImplAlignmentMatrixDiagonal::getClone() const
{
    return HAlignment( new ImplAlignmentMatrixDiagonal( *this ) );
}
//------------------------------------------------------------------------------------------------------------
HAlignment ImplAlignmentMatrixDiagonal::getNew() const
{
    return HAlignment( new ImplAlignmentMatrixDiagonal() );
}
//------------------------------factory functions -----------------------------
HAlignment makeAlignmentMatrixDiagonal()
{
    return HAlignment( new ImplAlignmentMatrixDiagonal() );
}
Example #9
0
/**
Return the horizontal alignment, relative to the language directionality specified. 
Calling this method will return a horizontal alignment where left and right has 
been swapped for any language with RightToLeft directionality, UNLESS the 
alignment has been set as being absolute, by calling @c SetAbsoluteHAlignment().

@param aLanguageDirectionality The language directionality to consider when swapping left and right.
@return The horizontal alignment, taking language directionlity into account.
*/
EXPORT_C CGraphicsContext::TTextAlign TGulAlignment::TextAlign(TBidiText::TDirectionality aLanguageDirectionality) const
	{
	return static_cast<CGraphicsContext::TTextAlign>(HAlignment(aLanguageDirectionality));
	}