Ejemplo n.º 1
0
        public void ImageMapTest()
        {
            string       imagePath = @"D:\OpenDocument\AODL\AODLTest\bin\Debug\Files\Eclipse_add_new_Class.jpg";
            TextDocument document  = new TextDocument();

            document.New();
            //Create standard paragraph
            Paragraph paragraphOuter = ParagraphBuilder.CreateStandardTextParagraph(document);
            //Create the frame with graphic
            Frame frame = new Frame(document, "frame1", "graphic1", imagePath);
            //Create a Draw Area Rectangle
            DrawAreaRectangle drawAreaRec = new DrawAreaRectangle(
                document, "0cm", "0cm", "1.5cm", "2.5cm", null);

            drawAreaRec.Href = "http://OpenDocument4all.com";
            //Create a Draw Area Circle
            DrawAreaCircle drawAreaCircle = new DrawAreaCircle(
                document, "4cm", "4cm", "1.5cm", null);

            drawAreaCircle.Href = "http://AODL.OpenDocument4all.com";
            DrawArea[] drawArea = new DrawArea[2] {
                drawAreaRec, drawAreaCircle
            };
            //Create a Image Map
            ImageMap imageMap = new ImageMap(document, drawArea);

            //Add Image Map to the frame
            frame.Content.Add(imageMap);
            //Add frame to paragraph
            paragraphOuter.Content.Add(frame);
            //Add paragraph to document
            document.Content.Add(paragraphOuter);
            //Save the document
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "simpleImageMap.odt");
        }
Ejemplo n.º 2
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (!isDrawRectAreaCreated && e.Button == MouseButtons.Left)
            {
                if (this.firstStartPoint.X == e.X || this.firstStartPoint.Y == e.Y)
                {
                    return;
                }

                firstEndPoint = new Point(e.X, e.Y);
                drawRect      = new DrawAreaRectangle(firstStartPoint.X, firstStartPoint.Y, firstEndPoint.X - firstStartPoint.X, firstEndPoint.Y - firstStartPoint.Y);
                drawRect.Draw(g);
                drawRect.Selected = true;
                drawRect.DrawTracker(g);

                isDrawRectAreaCreated = true;

                this.Refresh();
            }

            if (HasDrawRectangleArea)
            {
                ResizeDrawArea();
                this.toolStripPanel.Visible = true;
                this.myColorPicker.Visible  = IsCurrentCommandNeedColorPicker();
            }

            base.OnMouseUp(e);
        }
Ejemplo n.º 3
0
        public void FrameWriteTest()
        {
            try
            {
                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();
            }
            catch (Exception ex)
            {
                //Console.Write(ex.Message);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        public void ImageMapTest()
        {
            TextDocument document = new TextDocument();

            document.New();
            //Create standard paragraph
            Paragraph paragraphOuter = ParagraphBuilder.CreateStandardTextParagraph(document);
            //Create the frame with graphic
            Frame frame = new Frame(document, "frame1", "graphic1", new DiskFile(_imagefile));
            //Create a Draw Area Rectangle
            DrawAreaRectangle drawAreaRec = new DrawAreaRectangle(
                document, "0cm", "0cm", "1.5cm", "2.5cm", null);

            drawAreaRec.Href = "http://OpenDocument4all.com";
            //Create a Draw Area Circle
            DrawAreaCircle drawAreaCircle = new DrawAreaCircle(
                document, "4cm", "4cm", "1.5cm", null);

            drawAreaCircle.Href = "http://AODL.OpenDocument4all.com";
            DrawArea[] drawArea = new DrawArea[2] {
                drawAreaRec, drawAreaCircle
            };
            //Create a Image Map
            ImageMap imageMap = new ImageMap(document, drawArea);

            //Add Image Map to the frame
            frame.Content.Add(imageMap);
            //Add frame to paragraph
            paragraphOuter.Content.Add(frame);
            //Add paragraph to document
            document.Content.Add(paragraphOuter);
            //Save the document
            using (IPackageWriter writer = new OnDiskPackageWriter())
            {
                document.Save(AARunMeFirstAndOnce.outPutFolder + "simpleImageMap.odt", new OpenDocumentTextExporter(writer));
            }
        }
Ejemplo n.º 6
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (!isDrawRectAreaCreated && e.Button == MouseButtons.Left)
            {
                if (this.firstStartPoint.X == e.X || this.firstStartPoint.Y == e.Y)
                {
                    return;
                }

                firstEndPoint = new Point(e.X, e.Y);
                drawRect = new DrawAreaRectangle(firstStartPoint.X, firstStartPoint.Y, firstEndPoint.X - firstStartPoint.X, firstEndPoint.Y - firstStartPoint.Y);
                drawRect.Draw(g);
                drawRect.Selected = true;
                drawRect.DrawTracker(g);

                isDrawRectAreaCreated = true;

                this.Refresh();
            }

            if (HasDrawRectangleArea)
            {
                ResizeDrawArea();
                this.toolStripPanel.Visible = true;
                this.myColorPicker.Visible = IsCurrentCommandNeedColorPicker();
            }

            base.OnMouseUp(e);
        }