Exemplo n.º 1
0
 public EditorForm(int SlideNumber)
 {
     RTF     = string.Empty;
     DocText = string.Empty;
     synth   = new SpeechSynthesizer();
     InitializeComponent();
     DocList = new List <DOCData>();
     textControl1.CreateControl();
     Text   = string.Format("Memo Editor [Slide {0}]", SlideNumber);
     Height = SystemInformation.VirtualScreen.Height - 60;
     Top    = 10;
 }
Exemplo n.º 2
0
        /*-------------------------------------------------------------------------------------------------------
        ** CreateFootnotes method
        *
        * This method loops through all pages in order to check whether there are
        * footnote TextFields on that page. If yes, the footnote text is collected in
        * a temporary TextControl instance.
        * If there are footnotes on that page, a TextFrame is created which contains
        * the collected footnote texts.
        **-----------------------------------------------------------------------------------------------------*/
        public void CreateFootnotes()
        {
            RemoveFootnoteFrames();

            // loop through all pages
            foreach (TXTextControl.Page page in textControl1.GetPages())
            {
                TXTextControl.TextControl tempTX = new TextControl();
                tempTX.CreateControl();
                tempTX.Font     = new Font("Arial", 7F);
                tempTX.ViewMode = ViewMode.Normal;

                TXTextControl.TextFieldCollection.TextFieldEnumerator fieldEnum = textControl1.TextFields.GetEnumerator();
                int fieldCounter = textControl1.TextFields.Count;

                // loop through all TextFields
                for (int i = 0; i <= fieldCounter; i++)
                {
                    fieldEnum.MoveNext();
                    TXTextControl.TextField curField = (TXTextControl.TextField)fieldEnum.Current;

                    // use field only, if it is a footnote field (starts with "FN:")
                    // and if the field contains formatted text
                    if (curField.Name.StartsWith("FN:") == false || curField.Name.Length <= 3)
                    {
                        continue;
                    }

                    // check whether the field is on the current page
                    if (GetPageOfField(curField) == page.Number)
                    {
                        // add the formatted text to the temporary TextControl
                        int startPos = tempTX.Selection.Start;
                        tempTX.Selection.Load(curField.Name.Substring(3, curField.Name.Length - 3), StringStreamType.RichTextFormat);
                        tempTX.Selection.Start = startPos;
                        tempTX.Selection.Text  = curField.Text + ") ";
                        tempTX.Selection.Start = -1;
                    }
                }

                if (tempTX.Text == "")
                {
                    continue;
                }

                // insert a top frame border
                tempTX.Selection.Start = 0;
                tempTX.Selection.Text  = "\r\n";
                tempTX.Selection.Start = 0;
                tempTX.Selection.ParagraphFormat.RightIndent = 5000;
                tempTX.Selection.ParagraphFormat.Frame       = Frame.TopLine;

                // measure the used text height
                int textHeight = tempTX.Lines[tempTX.Lines.Count].Baseline + 200;

                // create a new TextFrame based on the used text height
                TXTextControl.TextFrame frame = new TextFrame(new Size(page.TextBounds.Width, textHeight));
                frame.Sizeable        = false;
                frame.Moveable        = false;
                frame.BorderWidth     = 0;
                frame.Name            = "FN";
                frame.InternalMargins = new int[] { 0, 0, 0, 0 };

                // add the TextFrame at the bottom border of the page
                textControl1.TextFrames.Add(
                    frame,
                    page.Number,
                    new Point((int)(textControl1.Sections[page.Section].Format.PageMargins.Left * iDpi - 55),
                              (int)textControl1.Sections[page.Section].Format.PageSize.Height * iDpi - (int)textControl1.Sections[page.Section].Format.PageMargins.Top * iDpi - 576 - frame.Size.Height),
                    TextFrameInsertionMode.DisplaceCompleteLines);

                byte[] data = null;

                // save the formatted text from the temporary TextControl
                tempTX.Save(out data, BinaryStreamType.InternalUnicodeFormat);
                // and load it into the TextFrame
                frame.Selection.Load(data, BinaryStreamType.InternalUnicodeFormat);
            }
        }