Summary for EventListener.
Inheritance: IContent, ICloneable
Esempio n. 1
0
		public void FrameWriteTest()
		{
			TextDocument textdocument = new TextDocument();
			textdocument.New();

			// Create a frame incl. graphic file
			Frame frame					= FrameBuilder.BuildStandardGraphicFrame(
				textdocument, "frame1", "graphic1", _imagefile);
			
			// Create some event listeners (using OpenOffice friendly syntax).
			EventListener script1 = new EventListener(textdocument,
			                                          "dom:mouseover", "javascript",
			                                          "vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share");
			EventListener script2 = new EventListener(textdocument,
			                                          "dom:mouseout", "javascript",
			                                          "vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share");
			EventListeners listeners = new EventListeners(textdocument, new EventListener[] { script1, script2 });
			
			// Create and add some area rectangles
			DrawAreaRectangle[] rects = new DrawAreaRectangle[2];
			rects[0] = new DrawAreaRectangle(textdocument, "4cm", "4cm", "2cm", "2cm");
			rects[0].Href = @"http://www.eduworks.com";
			rects[1] = new DrawAreaRectangle(textdocument, "1cm", "1cm", "2cm", "2cm", listeners);

			// Create and add an image map, referencing the area rectangles
			ImageMap map = new ImageMap(textdocument, rects);
			frame.Content.Add(map);

			// Add the frame to the text document
			textdocument.Content.Add(frame);

			// Save the document
			textdocument.SaveTo(_framefile3);
			textdocument.Dispose();
		}
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventListeners"/> class.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="EventListeners">Array of EventListeners.</param>
        public EventListeners(IDocument document, EventListener[] EventListeners)
        {
            this.Document			= document;
            this.InitStandards();
            this.NewXmlNode();

            if (EventListeners != null)
            {
                foreach (EventListener d in EventListeners)
                {
                    _content.Add(d);
                }
            }
        }
		/// <summary>
		/// Creates the event listener.
		/// </summary>
		/// <param name="eventListenerNode">The event listener node.</param>
		/// <returns></returns>
		public EventListener CreateEventListener(XmlNode eventListenerNode)
		{
			try
			{
				EventListener eventListener	= new EventListener(this._document, eventListenerNode);

				return eventListener;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a EventListener.", ex);
			}
		}
Esempio n. 4
0
        /// <summary>
        /// Creates the event listener.
        /// </summary>
        /// <param name="eventListenerNode">The event listener node.</param>
        /// <returns></returns>
        public EventListener CreateEventListener(XmlNode eventListenerNode)
        {
            try
            {
                EventListener eventListener	= new EventListener(this._document, eventListenerNode);

                return eventListener;
            }
            catch(Exception ex)
            {
                AODLException exception		= new AODLException("Exception while trying to create a EventListener.");
                exception.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                exception.Node				= eventListenerNode;
                exception.OriginalException	= ex;

                throw exception;
            }
        }
Esempio n. 5
0
        public void EventListenerTest()
        {
            try
            {
                TextDocument textdocument = new TextDocument();
                textdocument.New();

                // Create a frame (GraphicName == name property of frame)
                Frame frame						= new Frame(textdocument, "frame1", "img1", _imagefile);

                // Create some event listeners (using OpenOffice friendly syntax).
                EventListener script1 = new EventListener(textdocument,
                    "dom:mouseover", "javascript",
                    "vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share");
                EventListener script2 = new EventListener(textdocument,
                    "dom:mouseout", "javascript",
                    "vnd.sun.star.script:HelloWorld.helloworld.js?language=JavaScript&location=share");
                EventListeners listeners = new EventListeners(textdocument, new EventListener[] { script1, script2 });

                // Create and add some area rectangles; reuse event listeners
                DrawAreaRectangle[] rects = new DrawAreaRectangle[2];
                rects[0] = new DrawAreaRectangle(textdocument, "4cm", "4cm", "2cm", "2cm", listeners);
                //Reuse a clone of the EventListener
                rects[1] = new DrawAreaRectangle(textdocument, "1cm", "1cm", "2cm", "2cm", (EventListeners)listeners.Clone());

                // Create and add an image map, referencing the area rectangles
                ImageMap map = new ImageMap(textdocument, rects);
                frame.Content.Add(map);

                // Add the frame to the text document
                textdocument.Content.Add(frame);

                // Save the document
                textdocument.SaveTo(_framefile);
                textdocument.Dispose();
            }
            catch (Exception ex)
            {
                //Console.Write(ex.Message);
            }
        }