");
}
else
{
shapeBuilder.Append("
");
}
int newTop = par.getSpaceBeforePoints();
int left = 0;
List textElements = new List();
if (par.RunPropList == null || par.RunPropList.Count == 0 && par.defaultRunProperties != null) //Only paragraph!
{
float points = float.Parse(par.defaultRunProperties.FontSize.ToString()) * 72.0F / 96.0F;
Font font = new System.Drawing.Font(par.defaultRunProperties.FontFamily.ToString(), points);
newTop = font.Height;
}
List processedElements = new List();
foreach (var text in breakTextsToShape(par))
{
float points = float.Parse(text.FontSize.ToString()) * 72.0F / 96.0F;
Font font = new System.Drawing.Font(text.FontFamily.ToString(), points);
if (text.Bold) font = new System.Drawing.Font(text.FontFamily.ToString(), points, FontStyle.Bold);
else if (text.Italic)
font = new System.Drawing.Font(text.FontFamily.ToString(), points, FontStyle.Italic);
else if (text.Underline != null && text.Underline.Equals("Single"))
font = new System.Drawing.Font(text.FontFamily.ToString(), points, FontStyle.Underline);
newTop = font.Height > newTop ? font.Height : newTop;
newTop = par.getLineSpacingInPointsFromFont(newTop);
if (text.isBreak)
{
top += newTop;
left = 0;
fixLeftSpacingForAlignment(processedElements, par,font);
processedElements.Clear();
continue;
}
String currentString = text.Text.TrimEnd()+ getStringFromTextElements(processedElements);
//Text must already be broken to lines
//Size size = MeasureString(currentString, font);
// if (size.Width > this.width - par.Indent - par.marginLeft - par.marginRight)
// {
// top += newTop;
// left = 0;
// fixLeftSpacingForAlignment(processedElements, par, font);
// processedElements.Clear();
// }
HtmlText t1 = new HtmlText(left: left,
top: top,
fontFamily: text.FontFamily,
fontColor: text.FontColor,
fontSize: text.FontSize,
isBullet: text.isBullet,
bold: text.Bold,
italic: text.Italic,
underline: text.Underline,
id: id,
slideIndex: slideIndex)
{
Rotate = Rotate
};
t1.width = MeasureString(text.Text, font);
if (text.isBullet && text.Text != null && text.Text.Contains("rId"))
{
t1.PictureBullet = true;
t1.width = text.bulletSize;
t1.bulletSize = text.bulletSize;
newTop = text.bulletSize;
}
t1.Text = text.Text;
textElements.Add(t1);
processedElements.Add(t1);
}
fixLeftSpacingForAlignment(processedElements, par);
HtmlText lastTxt = null;
List mergedTextElements = new List();
foreach (HtmlText textElement in textElements)
{
if (lastTxt == null || !lastTxt.sameProps(textElement))
mergedTextElements.Add(textElement);
else
mergedTextElements[mergedTextElements.Count - 1].Text += textElement.Text;
lastTxt = textElement;
}
foreach (HtmlText textElement in mergedTextElements)
shapeBuilder.Append(textElement.DrawElement());
top += newTop;
top += par.getSpaceAfterPoints(newTop);
top += par.getSpaceBeforePoints(newTop);
shapeBuilder.Append("
");
if (par.Animatable)
shapeBuilder.Append("
");
}
}
private String getStringFromTextElements(List