Load() public method

Loads the document by using the specified importer.
public Load ( string file ) : void
file string The the file.
return void
Example #1
0
		public void MetaDataDisplay()
		{
			TextDocument document		= null;
			
			document				= new TextDocument();
			document.Load(AARunMeFirstAndOnce.inPutFolder+"ProgrammaticControlOfMenuAndToolbarItems.odt");

			Console.WriteLine(document.DocumentMetadata.InitialCreator);
			Console.WriteLine(document.DocumentMetadata.LastModified);
			Console.WriteLine(document.DocumentMetadata.CreationDate);
			Console.WriteLine(document.DocumentMetadata.CharacterCount);
			Console.WriteLine(document.DocumentMetadata.ImageCount);
			Console.WriteLine(document.DocumentMetadata.Keywords);
			Console.WriteLine(document.DocumentMetadata.Language);
			Console.WriteLine(document.DocumentMetadata.ObjectCount);
			Console.WriteLine(document.DocumentMetadata.PageCount);
			Console.WriteLine(document.DocumentMetadata.ParagraphCount);
			Console.WriteLine(document.DocumentMetadata.Subject);
			Console.WriteLine(document.DocumentMetadata.TableCount);
			Console.WriteLine(document.DocumentMetadata.Title);
			Console.WriteLine(document.DocumentMetadata.WordCount);

			document.DocumentMetadata.SetUserDefinedInfo(UserDefinedInfo.Info1, "Nothing");
			Console.WriteLine(document.DocumentMetadata.GetUserDefinedInfo(UserDefinedInfo.Info1));
		}
Example #2
0
		public void ODFFrameTest()
		{
			//Create a new text 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 frame
			ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");
			frm.Label = "ODFFrame test";
			// Add the frame to the form control list
			main_form.Controls.Add (frm);
			
			// Create a button
			ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");
			butt.Label = "A simple button :)";
			// Add the button to the form control list
			main_form.Controls.Add (butt);

			// Add the forms to the document!
			document.Forms.Add(main_form);
			// Add the paragraph to the content list
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"frame_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"frame_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"frame_test2.odt");
		}
		public void ImportTest1 ()
		{
			string file = AARunMeFirstAndOnce.inPutFolder+"pagestyles.odt";
			TextDocument textDocument = new TextDocument();
			textDocument.Load(file);
			TextMasterPage txtMP = textDocument.TextMasterPageCollection.GetDefaultMasterPage();
			Assert.IsNotNull(txtMP, "The default text mast page style must exists.");
		}
Example #4
0
 public void HTMLExportTest2()
 {
     string file							= AARunMeFirstAndOnce.inPutFolder+@"OpenOffice.net.odt";
     FileInfo fInfo						= new FileInfo(file);
     //Load a text document
     TextDocument textDocument			= new TextDocument();
     textDocument.Load(file);
     //Save it back again
     textDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".html");
 }
		public void FooterContentsTest()
		{
			string file = AARunMeFirstAndOnce.inPutFolder+"pagestyles.odt";
			TextDocument textDocument = new TextDocument();
			textDocument.Load(file);
			TextMasterPage txtMP = textDocument.TextMasterPageCollection.GetDefaultMasterPage();
			Assert.IsNotNull(txtMP.TextPageFooter, "The page header must exist.");
			Assert.IsNotNull(txtMP.TextPageFooter.ContentCollection, "Content collection must exist.");
			Assert.IsTrue(txtMP.TextPageFooter.ContentCollection.Count > 0, "There must be content in the page footers content collection.");
		}
		public void SimpleTocLoadTest()
		{
			string file							= AARunMeFirstAndOnce.inPutFolder+@"simple_toc.odt";
			FileInfo fInfo						= new FileInfo(file);
			//Load a text document
			TextDocument textDocument			= new TextDocument();
			textDocument.Load(file);
			//Save it back again
			textDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".rel.odt");
		}
Example #7
0
		public void LoadDocument_With_PageBreak()
		{
			string file = AARunMeFirstAndOnce.inPutFolder + @"paragraph_with_page_break.odt";
			TextDocument textDocument = new TextDocument();
			textDocument.Load(file);

			Assert.AreEqual(3, textDocument.Content.Count);
			Paragraph paragraph = textDocument.Content[2] as Paragraph;
			Assert.IsNotNull(paragraph);
			Assert.AreEqual("page", paragraph.ParagraphStyle.ParagraphProperties.BreakBefore );
			
		}
Example #8
0
		public void LoadGraphichAndSearchForAlternateText()
		{
			TextDocument document = new TextDocument();
			document.Load(AARunMeFirstAndOnce.inPutFolder + "ImageDocument.odt");
			Assert.AreEqual(3, document.Content.Count);
			Assert.AreEqual(true, document.Content[2] is Paragraph);
			Paragraph par = document.Content[2] as Paragraph;
			Assert.AreEqual(true, par.Content[0] is Frame);
			Frame frame = par.Content[0] as Frame;
			
			Assert.AreEqual("<alternative AODL text>", frame.AlternateText);
		}
		public void SimpleLoadTest()
		{
			string file							= AARunMeFirstAndOnce.inPutFolder+@"hallo.odt";
			FileInfo fInfo						= new FileInfo(file);
			//Load a text document
			TextDocument textDocument			= new TextDocument();
			textDocument.Load(file);
			Assert.IsTrue(textDocument.CommonStyles.Count > 0, "Common Styles must be read!");
			Console.WriteLine("Common styles: {0}", textDocument.CommonStyles.Count);
			//Save it back again
			textDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".rel.odt");
		}
Example #10
0
        public void MetaDataDisplay()
        {
            TextDocument document		= null;
            try
            {
                document				= new TextDocument();
                document.Load(AARunMeFirstAndOnce.inPutFolder+"ProgrammaticControlOfMenuAndToolbarItems.odt");
            }
            catch(Exception ex)
            {
                if(ex is AODLException)
                {
                    if(((AODLException)ex).OriginalException != null)
                        Console.WriteLine("Org ex: {0}", ((AODLException)ex).OriginalException.Message+"\r\n"
                            +((AODLException)ex).OriginalException.StackTrace);
                    if(((AODLException)ex).Node != null)
                        Console.WriteLine("Node: {0}", ((AODLException)ex).Node.OuterXml);
                }
                else throw ex;
            }

            Console.WriteLine(document.DocumentMetadata.InitialCreator);
            Console.WriteLine(document.DocumentMetadata.LastModified);
            Console.WriteLine(document.DocumentMetadata.CreationDate);
            Console.WriteLine(document.DocumentMetadata.CharacterCount);
            Console.WriteLine(document.DocumentMetadata.ImageCount);
            Console.WriteLine(document.DocumentMetadata.Keywords);
            Console.WriteLine(document.DocumentMetadata.Language);
            Console.WriteLine(document.DocumentMetadata.ObjectCount);
            Console.WriteLine(document.DocumentMetadata.PageCount);
            Console.WriteLine(document.DocumentMetadata.ParagraphCount);
            Console.WriteLine(document.DocumentMetadata.Subject);
            Console.WriteLine(document.DocumentMetadata.TableCount);
            Console.WriteLine(document.DocumentMetadata.Title);
            Console.WriteLine(document.DocumentMetadata.WordCount);

            document.DocumentMetadata.SetUserDefinedInfo(UserDefinedInfo.Info1, "Nothing");
            Console.WriteLine(document.DocumentMetadata.GetUserDefinedInfo(UserDefinedInfo.Info1));
        }
Example #11
0
		public void StyleTest()
		{
			// Create a new document
			TextDocument document	= new TextDocument();
			document.New();
			
			// Create a main paragraph
			Paragraph p =new Paragraph(document);
			
			ParagraphStyle ps1 = new ParagraphStyle(document, "style1");
			ps1.Family = "paragraph";
			ps1.TextProperties.FontName = FontFamilies.Arial;
			ps1.TextProperties.FontColor = AODL.Document.Helper.Colors.GetColor(System.Drawing.Color.Blue);
			ps1.TextProperties.Bold = "bold";
			ps1.TextProperties.FontSize = "18pt";
			document.Styles.Add(ps1);
			
			ParagraphStyle ps2 = new ParagraphStyle(document, "style2");
			ps2.Family = "paragraph";
			ps2.TextProperties.FontName = FontFamilies.CourierNew;
			ps2.TextProperties.Italic = "italic";
			ps2.TextProperties.FontSize = "14pt";
			ps2.TextProperties.Underline = "dotted";
			document.Styles.Add(ps2);

			ParagraphStyle ps3 = new ParagraphStyle(document, "style3");
			ps3.Family = "paragraph";
			ps3.TextProperties.FontName = FontFamilies.Wingdings;
			ps3.TextProperties.FontColor = AODL.Document.Helper.Colors.GetColor(System.Drawing.Color.Red);
			ps3.TextProperties.FontSize = "16pt";
			document.Styles.Add(ps3);

			// 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", "7cm", "1cm");
			butt.TextStyle = ps1;
			butt.Label = "Button one";
			butt.Title = "This button uses Arial font.";
			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", "7cm", "1cm");
			butt.Label = "Button two";
			butt.Title = "Second button.";
			butt.FocusOnClick = XmlBoolean.True;
			butt.Disabled = XmlBoolean.True;
			butt.TextStyle = ps2;
			main_form.Controls.Add (butt);

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


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

	
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"style_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"style_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"style_test2.odt");
		}
Example #12
0
		public void NestedFormTest()
		{
			//Create a new text 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");
			ODFForm child_form = new ODFForm(document, "childform");

			main_form.Method = Method.Get;
			main_form.Method = Method.Get;
			
			// Create a frame
			ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");
			frm.Label = "Main form";
			// Add the frame to the form control list
			main_form.Controls.Add (frm);
			
			// Create a button
			ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");
			butt.Label = "This is a main form";
			// Add the button to the form control list
			main_form.Controls.Add (butt);

			// Add the forms to the main form!
			document.Forms.Add(main_form);
			// Add the paragraph to the content list
			document.Content.Add(p);

			
			// adding controls to the nested form
			ODFFrame frm_child = new ODFFrame(child_form, p.Content, "frm_child", "5mm", "35mm", "5cm", "3cm");
			frm_child.Label = "Child form";
			child_form.Controls.Add (frm_child);
			
			ODFButton butt_child = new ODFButton(child_form, p.Content, "butt_child", "1cm", "45mm", "4cm", "1cm");
			butt_child.Label = "This is a child form";
			child_form.Controls.Add (butt_child);
			main_form.ChildForms.Add(child_form);

			ODFButton b = document.FindControlById("butt_child") as ODFButton;
			Assert.IsNotNull(b, "Error! could not find the specified control");
			b.Label = "Child form:)";

			
			// Add the forms to the main form!
			document.Forms.Add(main_form);
            // Add the paragraph to the content list
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test2.odt");
		}
Example #13
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");
			
		}
Example #14
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");
		}
		public void TextDocumentWithImgMapReload()
		{
			string file							= AARunMeFirstAndOnce.inPutFolder+@"imgmap.odt";
			FileInfo fInfo						= new FileInfo(file);
			//Load the text document
			TextDocument document				= new TextDocument();
			document.Load(file);
			IContent iContent					= document.Content[2];
			Assert.IsNotNull(iContent, "Must exist!");
			Assert.IsTrue(iContent is Paragraph, "iContent have to be a paragraph! But is :"+iContent.GetType().Name);
			Assert.IsTrue(((Paragraph)iContent).Content[0] is Frame, "Must be a frame! But is :"+((Paragraph)iContent).Content[0].GetType().Name);
			Frame frame							= ((Paragraph)iContent).Content[0] as Frame;
			Assert.IsTrue(frame.Content[1] is ImageMap, "Must be a ImageMap! But is :"+frame.Content[1].GetType().Name);
			ImageMap imageMap					= frame.Content[1] as ImageMap;
			Assert.IsTrue(imageMap.Content[0] is DrawAreaRectangle, "Must be a DrawAreaRectangle! But is :"
			              +imageMap.Content[0].GetType().Name);
			//Save it back again
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".rel.odt");
		}
Example #16
0
		public void LoadFileDeleteGraphic()
		{
			string fileName					= "hallo_rem_graphic.odt";
			string graphicFile				= "";
			TextDocument document			= new TextDocument();
			document.Load(AARunMeFirstAndOnce.inPutFolder+"hallo.odt");
			foreach(IContent iContent in document.Content)
			{
				if (iContent is Paragraph && ((Paragraph)iContent).Content.Count > 0
					&& ((Paragraph)iContent).Content[0] is Frame)
				{
					Frame frame				= ((Paragraph)iContent).Content[0] as Frame;
					Assert.IsTrue(frame.Content[0] is Graphic, "Must be a graphic!");
					Graphic graphic			= frame.Content[0] as Graphic;
					//now access the full qualified graphic path
					Assert.IsNotNull(graphic.GraphicRealPath, "The graphic real path must exist!");
					Assert.IsTrue(File.Exists(graphic.GraphicRealPath));
					graphicFile				= graphic.GraphicRealPath;
					//Delete the graphic
					frame.Content.Remove(graphic);
				}
			}
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+fileName);
			//Special case, only for this test neccessary
			document.Dispose();
			//Load file again
			TextDocument documentRel		= new TextDocument();
			documentRel.Load(AARunMeFirstAndOnce.outPutFolder+fileName);
			Assert.IsFalse(File.Exists(graphicFile), "This file must be removed from this file!");
		}
Example #17
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");
		}
Example #18
0
		public void ODFFixedTextTest()
		{
			//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 three different pieces of text at different positions
			ODFFixedText ft= new ODFFixedText(main_form, p.Content, "ft1", "5mm", "5mm", "5cm", "1cm");
			ft.Label = "Fixed text one";
			ft.Disabled = XmlBoolean.True;
			main_form.Controls.Add (ft);

			ft= new ODFFixedText(main_form, p.Content, "ft2", "15mm", "25mm", "5cm", "1cm");
			ft.Label = "Fixed text two";
			main_form.Controls.Add (ft);

			ft= new ODFFixedText(main_form, p.Content, "ft3", "35mm", "15mm", "5cm", "1cm");
			ft.Label = "Fixed text three";
			main_form.Controls.Add (ft);
			
			document.Forms.Add(main_form);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"fixedtext_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"fixedtext_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"fixedtext_test2.odt");
		}
Example #19
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");
		}
Example #20
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");
		}
Example #21
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");
		}
Example #22
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");
		}
Example #23
0
		public void LoadGraphicAccessGraphic()
		{
			TextDocument document			= new TextDocument();
			document.Load(AARunMeFirstAndOnce.inPutFolder+"hallo.odt");
			foreach(IContent iContent in document.Content)
			{
				if (iContent is Paragraph && ((Paragraph)iContent).Content.Count > 0
					&& ((Paragraph)iContent).Content[0] is Frame)
				{
					Frame frame				= ((Paragraph)iContent).Content[0] as Frame;
					Assert.IsTrue(frame.Content[0] is Graphic, "Must be a graphic!");
					Graphic graphic			= frame.Content[0] as Graphic;
					//now access the full qualified graphic path
					Assert.IsNotNull(graphic.GraphicRealPath, "The graphic real path must exist!");
					Assert.IsTrue(File.Exists(graphic.GraphicRealPath));
				}
			}
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"hallo_rel_graphic_touch.odt");
		}
Example #24
0
		public void ODFHiddenAndFormActionTest()
		{
			//Create a new text document
			TextDocument document					= new TextDocument();
			document.New();
			
			// Create a main paragraph
			Paragraph p =new Paragraph(document);
			// Create a main form
			
			// Create the first form (Method = GET)
			ODFForm form1 = new ODFForm(document, "form1");
			form1.Method = Method.Get;
			form1.Href = "http://foo.foo";
			
			// Create all the controls for form1
			ODFFrame frm1 = new ODFFrame(form1, p.Content, "frm1", "5mm", "5mm", "11cm", "3cm");
			frm1.Label = "Form submission test (Method = GET, Hidden name = hid)";
			form1.Controls.Add (frm1);
			ODFButton butt1 = new ODFButton(form1, p.Content, "butt1", "2cm", "15mm", "8cm", "1cm");
			butt1.Label = "Submit to foo.foo!";
			butt1.ButtonType = ButtonType.Submit;
			butt1.Name = "butt1";
			form1.Controls.Add (butt1);
			ODFHidden hid1 = new ODFHidden(form1, p.Content, "hid1", "0cm", "0cm", "0cm", "0cm");
			hid1.Value = "hello!";
			hid1.Name = "hid1";
			form1.Controls.Add(hid1);

			// Create the second form (Method = POST)
			ODFForm form2 = new ODFForm(document, "form2");
			form2.Method = Method.Post;
			form2.Href = "http://foo.foo.2";
			ODFFrame frm2 = new ODFFrame(form2, p.Content, "frm2", "5mm", "45mm", "11cm", "3cm");
			frm2.Label = "Form submission test (Method = POST, Hidden name = hid)";
			form2.Controls.Add (frm2);
			
			// Create all the controls for form2
			ODFButton butt2 = new ODFButton(form2, p.Content, "butt2", "2cm", "55mm", "8cm", "1cm");
			butt2.Label = "Submit to foo.foo!";
			butt2.ButtonType = ButtonType.Submit;
			butt2.Name = "butt2";
			form2.Controls.Add (butt2);
			ODFHidden hid2 = new ODFHidden(form2, p.Content, "hid2", "0cm", "0cm", "0cm", "0cm");
			hid2.Value = "hello!";
			hid2.Name = "hid2";
			form2.Controls.Add (hid2);

			document.Forms.Add(form1);
			document.Forms.Add(form2);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"hidden_subm_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"hidden_subm_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"hidden_subm_test2.odt");
		}
Example #25
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");
		}
Example #26
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");
		}
		public void TextToOpenDocumentText()
		{
			TextDocument document				= new TextDocument();
			document.Load(AARunMeFirstAndOnce.inPutFolder+"TextToOpenDocument.txt");
			Assert.IsNotNull(document.Content, "Must contain objects.");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"TextToOpenDocument.odt");
		}
Example #28
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");
		}
Example #29
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");
		}
Example #30
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");
		}