Exemplo n.º 1
0
        public void ODFFormattedTextTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            // Create a new paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create the formatted text control. Possible value range is 0-100
            ODFFormattedText ft = new ODFFormattedText(main_form, p.Content, "ft1", "5mm", "5mm", "5cm", "1cm");

            ft.MaxValue   = 100;
            ft.MinValue   = 0;
            ft.Validation = XmlBoolean.True;
            ft.Title      = "A very good FT control";
            ft.Name       = "formatted_text";
            main_form.Controls.Add(ft);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "formatted_text_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "formatted_text_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "formatted_text_test2.odt");
        }
Exemplo n.º 2
0
        public void ODFFileTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            // Create a new paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create an ODFFile
            ODFFile file = new ODFFile(main_form, p.Content, "file", "5mm", "5mm", "5cm", "1cm");

            file.Title = "File control";
            // This control will not be printable!
            file.Printable = XmlBoolean.False;
            main_form.Controls.Add(file);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "file_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "file_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "file_test2.odt");
        }
Exemplo n.º 3
0
        public void ODFGridTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            // Create a new paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create an ODFGrid
            ODFGrid grd = new ODFGrid(main_form, p.Content, "grd", "5mm", "5mm", "7cm", "5cm");

            grd.Columns.Add(new ODFGridColumn(document, "col1", "One"));
            grd.Columns.Add(new ODFGridColumn(document, "col1", "Two"));
            grd.Columns.Add(new ODFGridColumn(document, "col1", "Three"));
            main_form.Controls.Add(grd);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "grid_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "grid_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "grid_test2.odt");
        }
Exemplo n.º 4
0
        public void ODFTextAreaTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            // Create a new paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create the text area control
            ODFTextArea ta = new ODFTextArea(main_form, p.Content, "ft1", "5mm", "5mm", "7cm", "4cm");

            ta.Title = "Some text area";
            main_form.Controls.Add(ta);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "textarea_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "textarea_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "textarea_test2.odt");
        }
Exemplo n.º 5
0
        public void SaveLoadTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            Paragraph p = new Paragraph(document);

            p.StyleName = "Standard";
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;
            ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");

            frm.Label = "Save and Load test";
            main_form.Controls.Add(frm);

            ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");

            butt.Label = "A simple button :)";
            main_form.Controls.Add(butt);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "saveload.odt");

            document.Load(AARunMeFirstAndOnce.outPutFolder + "saveload.odt");
            ODFButton bt = document.FindControlById("butt") as ODFButton;

            Assert.IsNotNull(bt, "Could not find control with >butt< ID");
            bt.Label = "This label has chanhed";
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "saveload2.odt");
        }
Exemplo n.º 6
0
        public void ODFImageTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            // Create a new paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create an ODFGrid
            ODFImage img = new ODFImage(main_form, p.Content, "grd", "5mm", "5mm", "10cm", "6cm");

            img.ImageData = AARunMeFirstAndOnce.inPutFolder + "Eclipse_add_new_Class.jpg";
            main_form.Controls.Add(img);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "image_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "image_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "image_test2.odt");
        }
Exemplo n.º 7
0
        public void GenericPropertiesTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            Paragraph p = new Paragraph(document);

            p.StyleName = "Standard";
            ODFForm main_form = new ODFForm(document, "mainform");

            // add form:properties to the form
            main_form.Properties.Add(new SingleFormProperty(document, PropertyValueType.String, "name", "Oleg Yegorov"));
            main_form.Properties.Add(new SingleFormProperty(document, PropertyValueType.String, "comment", "ODF rulezz!"));
            main_form.Properties.Add(new SingleFormProperty(document, PropertyValueType.Boolean, "some_bool_value", "true"));
            // please check content.xml file to see that they were really added :)

            main_form.Method = Method.Get;
            ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "7cm");

            frm.Label = "Generic properties test.";
            main_form.Controls.Add(frm);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "generic_prop.odt");
        }
Exemplo n.º 8
0
        /// <summary>
        /// Adds new form to the forms collection
        /// </summary>
        /// <param name="name">Form name</param>
        /// <returns></returns>
        public ODFForm AddNewForm(string name)
        {
            ODFForm f = new ODFForm(Document, name);

            Forms.Add(f);
            return(f);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Adds new form to the forms collection
        /// </summary>
        /// <param name="name">Form name</param>
        /// <returns></returns>
        public ODFForm AddNewForm(string name)
        {
            ODFForm f = new ODFForm(this, name);

            Forms.Add(f);
            return(f);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Creates the document forms.
        /// </summary>
        /// <param name="node">The node.</param>
        private void CreateDocumentForms(XmlNode node)
        {
            /// TODO: ADD IMPLEMENTATION!

            try
            {
                XmlNode nodeOfficeForms;
                nodeOfficeForms = node.SelectSingleNode("office:forms", _document.NamespaceManager);

                if (nodeOfficeForms != null)
                {
                    foreach (XmlNode nodeChild in nodeOfficeForms)
                    {
                        if (this._document is TextDocument)
                        {
                            ODFForm f = CreateForm(nodeChild);
                            (this._document as TextDocument).Forms.Add(f);
                        }
                    }
                    nodeOfficeForms.RemoveAll();
                }
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while processing forms.", ex);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Creates the document forms.
        /// </summary>
        /// <param name="node">The node.</param>
        public void CreateCellForms(Table table)
        {
            /// TODO: ADD IMPLEMENTATION!

            try
            {
                XmlNode nodeOfficeForms;
                nodeOfficeForms = table.Node.SelectSingleNode("office:forms", _document.NamespaceManager);

                if (nodeOfficeForms != null)
                {
                    foreach (XmlNode nodeChild in nodeOfficeForms)
                    {
                        if (this._document is SpreadsheetDocument)
                        {
                            ODFForm f = CreateForm(nodeChild);
                            table.Forms.Add(f);
                        }
                    }
                    nodeOfficeForms.RemoveAll();
                }
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while processing forms.", ex);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Creates the document forms.
        /// </summary>
        /// <param name="node">The node.</param>
        private void CreateDocumentForms(XContainer node)
        {
            /// TODO: ADD IMPLEMENTATION!

            try
            {
                XElement nodeOfficeForms = node.Element(Ns.Office + "forms");

                if (nodeOfficeForms != null)
                {
                    if (_document is TextDocument)
                    {
                        foreach (XElement nodeChild in nodeOfficeForms.Elements())
                        {
                            ODFForm f = CreateForm(nodeChild);
                            (_document as TextDocument).Forms.Add(f);
                        }
                    }
                    nodeOfficeForms.RemoveAll();
                }
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while processing forms.", ex);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Creates the document forms.
        /// </summary>
        /// <param name="table">The table.</param>
        public void CreateCellForms(Table table)
        {
            /// TODO: ADD IMPLEMENTATION!

            try
            {
                XElement nodeOfficeForms = table.Node.Element(Ns.Office + "forms");

                if (nodeOfficeForms != null)
                {
                    if (_document is SpreadsheetDocument)
                    {
                        foreach (XElement nodeChild in nodeOfficeForms.Elements())
                        {
                            ODFForm f = CreateForm(nodeChild);
                            table.Forms.Add(f);
                        }
                    }
                    nodeOfficeForms.RemoveAll();
                }
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while processing forms.", ex);
            }
        }
Exemplo n.º 14
0
 private void FormsCollection_Clear()
 {
     for (int i = 0; i < _formCollection.Count; i++)
     {
         ODFForm f = _formCollection[i];
         f.Controls.Clear();
     }
 }
Exemplo n.º 15
0
        private void FormCollection_Removed(int index, object value)
        {
            ODFForm child = (value as ODFForm);

            if (child != null)
            {
                child.Controls.Clear();
            }
        }
Exemplo n.º 16
0
        public void SpreadSheetFormsTest()
        {
            //Create new spreadsheet document
            SpreadsheetDocument spreadsheetDocument = new SpreadsheetDocument();

            spreadsheetDocument.New();
            //Create a new table
            Table table = new Table(spreadsheetDocument, "First", "tablefirst");
            //Create a new cell, without any extra styles
            Cell cell = new Cell(spreadsheetDocument, "cell001");

            cell.OfficeValueType = "string";
            //Set full border
            cell.CellStyle.CellProperties.Border = Border.NormalSolid;
            //Add a paragraph to this cell
            Paragraph paragraph = ParagraphBuilder.CreateSpreadsheetParagraph(
                spreadsheetDocument);

            //Add some text content
            paragraph.TextContent.Add(new SimpleText(spreadsheetDocument, "Some text"));
            //Add paragraph to the cell
            cell.Content.Add(paragraph);
            //Insert the cell at row index 2 and column index 3
            //All need rows, columns and cells below the given
            //indexes will be build automatically.
            table.Rows.Add(new Row(table, "Standard"));
            table.Rows.Add(new Row(table, "Standard"));
            table.Rows.Add(new Row(table, "Standard"));
            table.InsertCellAt(3, 2, cell);
            //Insert table into the spreadsheet document

            ODFForm main_form = new ODFForm(spreadsheetDocument, "mainform");

            main_form.Method = Method.Get;
            ODFButton butt = new ODFButton(main_form, cell.Content, "butt", "0cm", "0cm", "15mm", "8mm");

            butt.Label = "test :)";
            main_form.Controls.Add(butt);
            spreadsheetDocument.TableCollection.Add(table);
            table.Forms.Add(main_form);

            spreadsheetDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder + "spreadsheet_forms.ods");

            SpreadsheetDocument spreadsheetDocument2 = new SpreadsheetDocument();

            spreadsheetDocument2.Load(AARunMeFirstAndOnce.outPutFolder + "spreadsheet_forms.ods");
            ODFButton b = spreadsheetDocument2.TableCollection[0].FindControlById("butt") as ODFButton;

            Assert.IsNotNull(b);
            b.Label = "it works!";
            spreadsheetDocument2.SaveTo(AARunMeFirstAndOnce.outPutFolder + "spreadsheet_forms2.ods");
        }
Exemplo n.º 17
0
        protected ODFFormControl(ODFForm ParentForm, XmlNode node)
        {
            _document   = ParentForm.Document;
            _parentForm = ParentForm;
            Node        = node;

            _contentCollection = null;
            _controlRef        = null;

            _properties           = new FormPropertyCollection();
            _properties.Inserted += PropertyCollection_Inserted;
            _properties.Removed  += PropertyCollection_Removed;
        }
Exemplo n.º 18
0
        public void SpreadSheetImportExportTest()
        {
            //Create new spreadsheet document
            SpreadsheetDocument spreadsheetDocument = new SpreadsheetDocument();

            spreadsheetDocument.Load(AARunMeFirstAndOnce.inPutFolder + @"bigtable.ods");
            ODFForm   f    = new ODFForm(spreadsheetDocument, "mainform");
            ODFButton butt = new ODFButton(f, spreadsheetDocument.TableCollection[0].Rows[1].Cells[1].Content, "butt", "5mm", "15mm", "4cm", "1cm");

            f.Controls.Add(butt);
            spreadsheetDocument.TableCollection[0].Forms.Add(f);
            spreadsheetDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder + "bigtable2.ods");
        }
Exemplo n.º 19
0
        protected ODFFormControl(ODFForm parentForm, XElement node)
        {
            _document  = parentForm.Document;
            ParentForm = parentForm;
            Node       = node;

            _contentCollection = null;
            _controlRef        = null;

            Properties           = new FormPropertyCollection();
            Properties.Inserted += PropertyCollection_Inserted;
            Properties.Removed  += PropertyCollection_Removed;
        }
Exemplo n.º 20
0
        public void ODFComboBoxTest()
        {
            // Create a new document
            TextDocument document = new TextDocument();

            document.New();

            // Create a main paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create a first combo box - a drop down one
            ODFComboBox cb = new ODFComboBox(main_form, p.Content, "cb1", "0cm", "0mm", "4cm", "6mm");

            cb.AutoComplete = XmlBoolean.True;
            cb.DropDown     = XmlBoolean.True;
            cb.Title        = "A test combobox number one";
            cb.Items.Add(new ODFItem(document, "Bill"));
            cb.Items.Add(new ODFItem(document, "Gates"));
            cb.Items.Add(new ODFItem(document, "Melinda"));
            cb.Items.Add(new ODFItem(document, "Gilbert"));
            cb.Items.Add(new ODFItem(document, "Bates"));
            cb.CurrentValue = "Select an item...";
            main_form.Controls.Add(cb);

            // Second combo box
            cb = new ODFComboBox(main_form, p.Content, "cb2", "0cm", "10mm", "4cm", "25mm");
            cb.AutoComplete = XmlBoolean.False;
            cb.DropDown     = XmlBoolean.False;
            cb.CurrentValue = "Alt";
            cb.Title        = "A test combobox number two";
            cb.Items.Add(new ODFItem(document, "Control"));
            cb.Items.Add(new ODFItem(document, "Alt"));
            cb.Items.Add(new ODFItem(document, "Delete"));
            cb.Items.Add(new ODFItem(document, "Enter"));
            cb.Items.Add(new ODFItem(document, "Escape"));
            main_form.Controls.Add(cb);


            document.Forms.Add(main_form);
            document.Content.Add(p);

            // Button import/export test
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "combobox_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "combobox_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "combobox_test2.odt");
        }
Exemplo n.º 21
0
        protected ODFFormControl(ODFForm ParentForm, ContentCollection contentCollection, string id, string x, string y, string width, string height)         //: base (document, ContentCollection, id, x, y, width, height)
        {
            _document          = ParentForm.Document;
            _parentForm        = ParentForm;
            Node               = ParentForm.Node;
            _contentCollection = contentCollection;
            CreateBasicNode();
            ID          = id;
            _controlRef = new ODFControlRef(_document, id, x, y, width, height);

            _properties           = new FormPropertyCollection();
            _properties.Inserted += PropertyCollection_Inserted;
            _properties.Removed  += PropertyCollection_Removed;
        }
Exemplo n.º 22
0
        public void ODFCheckBoxTest()
        {
            // Create a new document
            TextDocument document = new TextDocument();

            document.New();

            // Create a main paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            ODFCheckBox cb = new ODFCheckBox(main_form, p.Content, "cb1", "0cm", "0mm", "4cm", "5mm");

            cb.Label        = "Checkbox 1 (flat)";
            cb.VisualEffect = VisualEffect.Flat;
            cb.IsTristate   = XmlBoolean.True;
            cb.Value        = "some_value";
            cb.Title        = "The first checkbox";
            main_form.Controls.Add(cb);

            cb              = new ODFCheckBox(main_form, p.Content, "cb2", "0cm", "5mm", "4cm", "5mm");
            cb.Label        = "Checkbox 2 (3d)";
            cb.VisualEffect = VisualEffect.ThreeD;
            cb.IsTristate   = XmlBoolean.False;
            cb.Value        = "some_value_number_two";
            cb.Title        = "The second checkbox";
            cb.CurrentState = State.Checked;
            main_form.Controls.Add(cb);

            cb              = new ODFCheckBox(main_form, p.Content, "cb3", "0cm", "10mm", "4cm", "5mm");
            cb.Label        = "Checkbox 3 (grayed)";
            cb.VisualEffect = VisualEffect.Flat;
            cb.IsTristate   = XmlBoolean.True;
            cb.Value        = "some_value_three";
            cb.Title        = "The third checkbox";
            cb.CurrentState = State.Unknown;
            main_form.Controls.Add(cb);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            // Button import/export test
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "checkbox_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "checkbox_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "checkbox_test2.odt");
        }
Exemplo n.º 23
0
        public void HTMLExportTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            Paragraph p         = new Paragraph(document);
            ODFForm   main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;
            main_form.Href   = "http://hello.foo.com";

            ODFComboBox ccb = new ODFComboBox(main_form, p.Content, "ccb", "0mm", "0mm", "3cm", "1cm");

            ccb.Size     = 5;
            ccb.DropDown = XmlBoolean.True;
            ccb.Items.Add(new ODFItem(document, "Charlie"));
            ccb.Items.Add(new ODFItem(document, "John"));
            ccb.Items.Add(new ODFItem(document, "Dieter"));
            ccb.Items.Add(new ODFItem(document, "Bill"));
            ccb.Items.Add(new ODFItem(document, "Oleg"));
            ccb.Items.Add(new ODFItem(document, "Lars"));
            main_form.Controls.Add(ccb);

            ODFButton butt = new ODFButton(main_form, p.Content, "butt", "5mm", "15mm", "4cm", "1cm");

            butt.Label = "A simple button :)";
            main_form.Controls.Add(butt);

            ODFCheckBox cb = new ODFCheckBox(main_form, p.Content, "cbx", "5mm", "25mm", "4cm", "5mm");

            cb.Label = "check it!";
            cb.Name  = "cbx";
            cb.Value = "cbx_value";

            main_form.Controls.Add(cb);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            Paragraph text_p = new Paragraph(document);

            text_p.TextContent.Add(new SimpleText(document, "This is a simple text content that is located in the next paragraph after the form!"));
            document.Content.Add(text_p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "html_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "html_test.html");
        }
Exemplo n.º 24
0
        public void FormsRemoveTest()
        {
            // Create a new document
            TextDocument document = new TextDocument();

            document.New();

            // Create a main paragraph
            Paragraph p = new Paragraph(document);

            p.TextContent.Add(new SimpleText(document, "This document should contain no forms!"));

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // The first button. It doesn't get a focus on click
            ODFButton butt = new ODFButton(main_form, p.Content, "butt1", "0cm", "0mm", "4cm", "1cm");

            butt.Label        = "Button one";
            butt.Title        = "First button.";
            butt.FocusOnClick = XmlBoolean.False;
            butt.ButtonType   = ButtonType.Push;
            main_form.Controls.Add(butt);

            // The second button. It is disabled
            butt              = new ODFButton(main_form, p.Content, "butt2", "0cm", "2cm", "4cm", "1cm");
            butt.Label        = "Button two";
            butt.Title        = "Second button.";
            butt.FocusOnClick = XmlBoolean.True;
            butt.Disabled     = XmlBoolean.True;
            main_form.Controls.Add(butt);

            // The third button with "toggle" behaviour
            butt        = new ODFButton(main_form, p.Content, "butt3", "0cm", "4cm", "4cm", "1cm");
            butt.Label  = "Button three";
            butt.Title  = "Third button.";
            butt.Toggle = XmlBoolean.True;
            main_form.Controls.Add(butt);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            // Remove the form from the document!
            document.Forms.RemoveAt(0);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "no_forms.odt");
        }
Exemplo n.º 25
0
        protected ODFFormControl(ODFForm parentForm, ContentCollection contentCollection, string id)
        {
            _document          = parentForm.Document;
            ParentForm         = parentForm;
            Node               = parentForm.Node;
            _contentCollection = contentCollection;
            CreateBasicNode();
            Id = id;
            ControlImplementation = "ooo:com.sun.star.form.component.TextField";
            _controlRef           = new ODFControlRef(_document, id);

            Properties           = new FormPropertyCollection();
            Properties.Inserted += PropertyCollection_Inserted;
            Properties.Removed  += PropertyCollection_Removed;
        }
Exemplo n.º 26
0
        public void ODFListBoxAndComboBoxTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            Paragraph p = new Paragraph(document);

            p.StyleName = "Standard";
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "7cm");

            frm.Label = "List- and ComboBox test";
            main_form.Controls.Add(frm);

            ODFListBox lb = new ODFListBox(main_form, p.Content, "lb", "1cm", "15mm", "4cm", "5cm");

            lb.Options.Add(new ODFOption(document, "Charlie"));
            lb.Options.Add(new ODFOption(document, "John"));
            lb.Options.Add(new ODFOption(document, "Dieter"));
            lb.Options.Add(new ODFOption(document, "Bill"));
            lb.Options.Add(new ODFOption(document, "Oleg"));
            lb.Options.Add(new ODFOption(document, "Lars"));
            main_form.Controls.Add(lb);

            ODFComboBox cb = new ODFComboBox(main_form, p.Content, "cb", "1cm", "65mm", "4cm", "6mm");

            cb.Items.Add(new ODFItem(document, "Charlie"));
            cb.Items.Add(new ODFItem(document, "John"));
            cb.Items.Add(new ODFItem(document, "Dieter"));
            cb.Items.Add(new ODFItem(document, "Bill"));
            cb.Items.Add(new ODFItem(document, "Oleg"));
            cb.Items.Add(new ODFItem(document, "Lars"));
            cb.CurrentValue = "Please select a value...";
            cb.DropDown     = XmlBoolean.True;

            main_form.Controls.Add(cb);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "listbox_combobox.odt");
        }
Exemplo n.º 27
0
        public void ODFButtonTest()
        {
            // Create a new document
            TextDocument document = new TextDocument();

            document.New();

            // Create a main paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // The first button. It doesn't get a focus on click
            ODFButton butt = new ODFButton(main_form, p.Content, "butt1", "0cm", "0mm", "4cm", "1cm");

            butt.Label        = "Button one";
            butt.Title        = "First button.";
            butt.FocusOnClick = XmlBoolean.False;
            butt.ButtonType   = ButtonType.Push;
            main_form.Controls.Add(butt);

            // The second button. It is disabled
            butt              = new ODFButton(main_form, p.Content, "butt2", "0cm", "2cm", "4cm", "1cm");
            butt.Label        = "Button two";
            butt.Title        = "Second button.";
            butt.FocusOnClick = XmlBoolean.True;
            butt.Disabled     = XmlBoolean.True;
            main_form.Controls.Add(butt);

            // The third button with "toggle" behaviour
            butt        = new ODFButton(main_form, p.Content, "butt3", "0cm", "4cm", "4cm", "1cm");
            butt.Label  = "Button three";
            butt.Title  = "Third button.";
            butt.Toggle = XmlBoolean.True;
            main_form.Controls.Add(butt);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            // Button import/export test
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "button_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "button_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "button_test2.odt");
        }
Exemplo n.º 28
0
        public void ODFListBoxTest()
        {
            // Create a new document
            TextDocument document = new TextDocument();

            document.New();

            // Create a main paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            ODFListBox lb = new ODFListBox(main_form, p.Content, "lb1", "0cm", "0mm", "4cm", "6mm");

            lb.DropDown = XmlBoolean.True;
            lb.Title    = "A test listbox number one";
            lb.Options.Add(new ODFOption(document, "Bill"));
            lb.Options.Add(new ODFOption(document, "Gates"));
            lb.Options.Add(new ODFOption(document, "Melinda"));
            lb.Options.Add(new ODFOption(document, "Bates"));
            lb.Options.Add(new ODFOption(document, "Gilbert"));
            main_form.Controls.Add(lb);

            lb          = new ODFListBox(main_form, p.Content, "lb2", "0cm", "10mm", "4cm", "25mm");
            lb.DropDown = XmlBoolean.False;
            lb.Title    = "A test listbox number two";
            lb.Options.Add(new ODFOption(document, "Bill"));
            lb.Options.Add(new ODFOption(document, "Gates"));
            lb.Options.Add(new ODFOption(document, "Melinda"));
            lb.Options.Add(new ODFOption(document, "Bates"));
            lb.Options.Add(new ODFOption(document, "Gilbert"));
            main_form.Controls.Add(lb);


            document.Forms.Add(main_form);
            document.Content.Add(p);

            // Button import/export test
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "listbox_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "listbox_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "listbox_test2.odt");
        }
Exemplo n.º 29
0
        public void ODFValueRangeTest()
        {
            //Create a new text document
            TextDocument document = new TextDocument();

            document.New();

            // Create a new paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create the ODFValueRange as a scroll bar(see the contol implementation)
            ODFValueRange vr = new ODFValueRange(main_form, p.Content, "vr1", "5mm", "5mm", "7cm", "5mm");

            vr.ControlImplementation = "ooo:com.sun.star.form.component.ScrollBar";
            vr.Orientation           = Orientation.Horizontal;
            vr.RepeatDelay           = "PT0.50S";
            vr.MinValue = 0;
            vr.MaxValue = 100;
            vr.Title    = "A scroll bar";
            vr.Properties.Add(new SingleFormProperty(document, PropertyValueType.Boolean, "LiveScroll", "true"));
            main_form.Controls.Add(vr);

            // Create the ODFValueRange as a spin button(see the contol implementation)
            vr = new ODFValueRange(main_form, p.Content, "vr2", "5mm", "2cm", "8mm", "15mm");
            vr.ControlImplementation = "ooo:com.sun.star.form.component.SpinButton";
            vr.Orientation           = Orientation.Vertical;
            vr.RepeatDelay           = "PT0.50S";
            vr.MinValue = 0;
            vr.MaxValue = 100;
            vr.Title    = "A scroll bar";
            main_form.Controls.Add(vr);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "valuerange_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "valuerange_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "valuerange_test2.odt");
        }
Exemplo n.º 30
0
        public void ODFRadioButtonTest()
        {
            // Create a new document
            TextDocument document = new TextDocument();

            document.New();

            // Create a main paragraph
            Paragraph p = new Paragraph(document);

            // Create a main form
            ODFForm main_form = new ODFForm(document, "mainform");

            main_form.Method = Method.Get;

            // Create two radio buttons with the same name - they will be in one "group"
            ODFRadioButton rb = new ODFRadioButton(main_form, p.Content, "rb1", "0cm", "0mm", "4cm", "5mm");

            rb.Label           = "Radio Button One";
            rb.VisualEffect    = VisualEffect.Flat;
            rb.CurrentSelected = XmlBoolean.True;
            rb.Name            = "radio";
            main_form.Controls.Add(rb);

            rb                 = new ODFRadioButton(main_form, p.Content, "rb2", "0cm", "1cm", "4cm", "5mm");
            rb.Label           = "Radio Button Two";
            rb.VisualEffect    = VisualEffect.ThreeD;
            rb.CurrentSelected = XmlBoolean.False;
            rb.Name            = "radio";
            main_form.Controls.Add(rb);

            document.Forms.Add(main_form);
            document.Content.Add(p);

            // Button import/export test
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "radio_test.odt");
            document.Load(AARunMeFirstAndOnce.outPutFolder + "radio_test.odt");
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "radio_test2.odt");
        }