Implemented font size/paragraph commands for RTF
This commit is contained in:
parent
b74453497b
commit
e26a58ea0e
@ -150,6 +150,27 @@ namespace UniversalEditor.DataFormats.Text.Formatted.RichText
|
||||
{
|
||||
parent.Items.Add(new RichTextMarkupItemLiteral((item as FormattedTextItemLiteral).Text));
|
||||
}
|
||||
else if (item is FormattedTextItemParagraph)
|
||||
{
|
||||
RichTextMarkupItemGroup group = new RichTextMarkupItemGroup(new RichTextMarkupItemTag("pard"));
|
||||
FormattedTextItemParagraph itm = (item as FormattedTextItemParagraph);
|
||||
foreach (FormattedTextItem item1 in itm.Items)
|
||||
{
|
||||
RenderItem(group, item1);
|
||||
}
|
||||
group.Items.Add(new RichTextMarkupItemTag("par"));
|
||||
parent.Items.Add(group);
|
||||
}
|
||||
else if (item is FormattedTextItemFontSize)
|
||||
{
|
||||
FormattedTextItemFontSize itm = (item as FormattedTextItemFontSize);
|
||||
RichTextMarkupItemGroup group = new RichTextMarkupItemGroup(new RichTextMarkupItemTag("fs" + (itm.Value * 2).ToString()));
|
||||
foreach (FormattedTextItem item1 in itm.Items)
|
||||
{
|
||||
RenderItem(group, item1);
|
||||
}
|
||||
parent.Items.Add(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.Text.Formatted.Items
|
||||
{
|
||||
public class FormattedTextItemFontSize : FormattedTextItemContainer
|
||||
{
|
||||
private int mvarValue = 0;
|
||||
public int Value { get { return mvarValue; } set { mvarValue = value; } }
|
||||
|
||||
public FormattedTextItemFontSize(int value = 0, params FormattedTextItem[] items)
|
||||
{
|
||||
mvarValue = value;
|
||||
foreach (FormattedTextItem item in items)
|
||||
{
|
||||
base.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
FormattedTextItemFontSize clone = new FormattedTextItemFontSize();
|
||||
clone.Value = mvarValue;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace UniversalEditor.ObjectModels.Text.Formatted.Items
|
||||
{
|
||||
public class FormattedTextItemParagraph : FormattedTextItemContainer
|
||||
{
|
||||
public override object Clone()
|
||||
{
|
||||
FormattedTextItemParagraph clone = new FormattedTextItemParagraph();
|
||||
foreach (FormattedTextItem item in Items)
|
||||
{
|
||||
clone.Items.Add(item.Clone() as FormattedTextItem);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,8 +118,10 @@
|
||||
<Compile Include="ObjectModels\Text\Formatted\FormattedTextStyleGroup.cs" />
|
||||
<Compile Include="ObjectModels\Text\Formatted\Items\FormattedTextItemBold.cs" />
|
||||
<Compile Include="ObjectModels\Text\Formatted\Items\FormattedTextItemContainer.cs" />
|
||||
<Compile Include="ObjectModels\Text\Formatted\Items\FormattedTextItemFontSize.cs" />
|
||||
<Compile Include="ObjectModels\Text\Formatted\Items\FormattedTextItemHyperlink.cs" />
|
||||
<Compile Include="ObjectModels\Text\Formatted\Items\FormattedTextItemLiteral.cs" />
|
||||
<Compile Include="ObjectModels\Text\Formatted\Items\FormattedTextItemParagraph.cs" />
|
||||
<Compile Include="ObjectModels\Text\Plain\PlainTextObjectModel.cs" />
|
||||
<Compile Include="ObjectModels\UEPackage\UEPackageObjectModel.cs" />
|
||||
<Compile Include="ProjectTask.cs" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user