+
+ internal override void SelectWord ()
+ {
+ document.ExpandSelection(CaretSelection.Word, false);
+ }
+
+ private class RtfSectionStyle : ICloneable {
+ internal Color rtf_color;
+ internal RTF.Font rtf_rtffont;
+ internal int rtf_rtffont_size;
+ internal FontStyle rtf_rtfstyle;
+ internal HorizontalAlignment rtf_rtfalign;
+ internal int rtf_par_line_left_indent;
+
+ public object Clone ()
+ {
+ RtfSectionStyle new_style = new RtfSectionStyle ();
+
+ new_style.rtf_color = rtf_color;
+ new_style.rtf_par_line_left_indent = rtf_par_line_left_indent;
+ new_style.rtf_rtfalign = rtf_rtfalign;
+ new_style.rtf_rtffont = rtf_rtffont;
+ new_style.rtf_rtffont_size = rtf_rtffont_size;
+ new_style.rtf_rtfstyle = rtf_rtfstyle;
+
+ return new_style;
+ }
+ }
+
+ // To allow us to keep track of the sections and revert formatting
+ // as we go in and out of sections of the document.
+ private void HandleGroup (RTF.RTF rtf)
+ {
+ //start group - save the current formatting on to a stack
+ //end group - go back to the formatting at the current group
+ if (rtf_section_stack == null) {
+ rtf_section_stack = new Stack ();
+ }
+
+ if (rtf.Major == RTF.Major.BeginGroup) {
+ rtf_section_stack.Push (rtf_style.Clone ());
+ } else if (rtf.Major == RTF.Major.EndGroup) {
+ if (rtf_section_stack.Count > 0) {
+ FlushText (rtf, false);
+
+ rtf_style = (RtfSectionStyle) rtf_section_stack.Pop ();
+ }
+ }
+ }
+
+ [MonoTODO("Add QuadJust support for justified alignment")]