Example #1
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);

                float l = Left;
                float t = Top;
                float w = Width;
                float h = Height;
                float a = RotationAngle;

                Rectangle        = null;
                Rectangle.Left   = l;
                Rectangle.Top    = t;
                Rectangle.Width  = w;
                Rectangle.Height = h;
                Rectangle.Angle  = a;

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);
            TextMarkupAnnotation.CopyTo(Dictionary, res, Page, page);

            UnderlineAnnotation annot = new UnderlineAnnotation(res, owner);

            annot.SetPage(page, true);
            return(annot);
        }
Example #2
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            IPDFObject name = Dictionary["Name"];

            if (name != null)
            {
                res.AddItem("Name", name.Clone());
            }

            IPDFObject fs = Dictionary["FS"];

            if (fs != null)
            {
                res.AddItem("FS", fs.Clone());
            }

            FileAttachmentAnnotation annot = new FileAttachmentAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #3
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            IPDFObject name = Dictionary["Name"];

            if (name != null)
            {
                res.AddItem("Name", name.Clone());
            }

            IPDFObject sound = Dictionary["Sound"];

            if (sound != null)
            {
                res.AddItem("Sound", sound);
            }

            SoundAnnotation annot = new SoundAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #4
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            string[] keys = { "RD", "Sy" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            CaretAnnotation annot = new CaretAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #5
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            IPDFObject threeDD = Dictionary["3DD"];

            if (threeDD != null)
            {
                res.AddItem("3DD", ThreeDData.Copy(threeDD));
            }

            string[] keys = { "3DV", "3DA", "3DI", "3DB" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            ThreeDAnnotation annot = new ThreeDAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);

            return(annot);
        }
Example #6
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            Field.CopyTo(Dictionary, res);

            PushButton annot = new PushButton(res, owner, false);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);

            annot._fontColor             = _fontColor;
            annot._font                  = _font;
            annot._font.ChangedFontSize += annot.changedFontSize;

            Field.SetActions(this, annot);

            return(annot);
        }
Example #7
0
        //TODO : IT

        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                PointF[] points = Vertices.ToArray();
                ApplyOwner(owner);
                SetPage(page, true);

                Vertices.Clear();
                Vertices.Page = page;
                Vertices.AddRange(points);

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);
            PolygonPolylineAnnotation.CopyTo(Dictionary, res, Page, page);

            PolylineAnnotation annot = new PolylineAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #8
0
        // TODO:
        //internal PointsArray CoordinatesLines
        //{
        //    get
        //    {
        //        if (m_coordinatesLines == null)
        //        {
        //            PDFArray array = Dictionary["CL"] as PDFArray;
        //            if (array == null)
        //            {
        //                m_coordinatesLines = new PointsArray();
        //                m_coordinatesLines.AddPoint(new PointF(Left, Top + Height / 2));
        //                m_coordinatesLines.AddPoint(new PointF(Left, Top + Height / 2));
        //                Dictionary.AddItem("CL", m_coordinatesLines.Array);
        //            }
        //            else
        //                m_coordinatesLines = new PointsArray(array, Page);
        //        }

        //        return m_coordinatesLines;
        //    }
        //}

        //internal PDFLineEndingStyle EndLineStyle
        //{
        //    get { return TypeConverter.PDFNameToPDFLineEndingStyle(Dictionary["LE"] as PDFName); }
        //    set { Dictionary.AddItem("LE", TypeConverter.PDFLineEndingStyleToPDFName(value)); }
        //}

        //TODO IT

        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            string[] keys = { "DA", "Q", "RC", "DS", "IT", "BE", "RD", "LE" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            PDFArray cl = Dictionary["CL"] as PDFArray;

            if (cl != null)
            {
                RectangleF oldRect;
                if (Page == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = Page.PageRect;
                }

                res.AddItem("CL", CloneUtility.CopyArrayCoordinates(cl, oldRect, page.PageRect, Page == null));
            }

            PDFDictionary bs = Dictionary["BS"] as PDFDictionary;

            if (bs != null)
            {
                res.AddItem("BS", AnnotationBorderStyle.Copy(bs));
            }

            FreeTextAnnotation annot = new FreeTextAnnotation(res, owner, false);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);

            annot._font = _font;
            annot._font.ChangedFontSize += annot.changedFontSize;
            annot._fontColor             = _fontColor;
            annot.setTextAttributes();

            return(annot);
        }
Example #9
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);
            IPDFObject    h   = Dictionary["H"];

            if (h != null)
            {
                res.AddItem("H", h.Clone());
            }

            PDFArray quadPoints = Dictionary["QuadPoints"] as PDFArray;

            if (quadPoints != null)
            {
                RectangleF oldRect;
                if (Page == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = Page.PageRect;
                }

                res.AddItem("QuadPoints", CloneUtility.CopyArrayCoordinates(quadPoints, oldRect, page.PageRect, Page == null));
            }

            IPDFObject pa = Dictionary["PA"];

            if (pa != null)
            {
                res.AddItem("PA", pa.Clone());
            }

            LinkAnnotation annot = new LinkAnnotation(res, owner);

            if (_destination != null)
            {
                annot.Destination = Destination;
            }
            if (_action != null)
            {
                annot.Action = _action;
            }

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #10
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            IPDFObject t = Dictionary["T"];

            if (t != null)
            {
                res.AddItem("T", t.Clone());
            }

            PDFDictionary movie = Dictionary["Movie"] as PDFDictionary;

            if (movie != null)
            {
                res.AddItem("Movie", MovieBase.Copy(movie));
            }

            IPDFObject a = Dictionary["A"];

            if (a != null)
            {
                if (a is PDFBoolean)
                {
                    res.AddItem("A", a.Clone());
                }
                else if (a is PDFDictionary)
                {
                    res.AddItem("A", MovieActivationBase.Copy(a as PDFDictionary));
                }
            }

            MovieAnnotation annot = new MovieAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #11
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            IPDFObject t = Dictionary["T"];

            if (t != null)
            {
                res.AddItem("T", t.Clone());
            }

            PDFDictionary mk = Dictionary["MK"] as PDFDictionary;

            if (mk != null)
            {
                res.AddItem("MK", AppearanceCharacteristics.Copy(mk));
            }

            ScreenAnnotation annot = new ScreenAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);

            annot.OnActivated     = OnActivated;
            annot.OnMouseDown     = OnMouseDown;
            annot.OnMouseEnter    = OnMouseEnter;
            annot.OnMouseExit     = OnMouseExit;
            annot.OnMouseUp       = OnMouseUp;
            annot.OnPageClose     = OnPageClose;
            annot.OnPageInvisible = OnPageInvisible;
            annot.OnPageOpen      = OnPageOpen;
            annot.OnPageVisible   = OnPageVisible;

            return(annot);
        }
Example #12
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);
            SquareCircleAnnotation.CopyTo(Dictionary, res);

            SquareAnnotation annot = new SquareAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
Example #13
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            Field.CopyTo(Dictionary, res);

            CheckBox annot = new CheckBox(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);

            Field.SetActions(this, annot);

            return(annot);
        }
Example #14
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                SetPage(page, true);
                ApplyOwner(owner);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            Field.CopyTo(Dictionary, res);

            string[] keys = { "MaxLen", "Q", "RV" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            EditBox annot = new EditBox(res, owner, false);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);

            annot._font = _font;
            annot._font.ChangedFontSize += annot.changedFontSize;
            annot._fontColor             = _fontColor;
            annot.setTextAttributes();

            Field.SetActions(this, annot);

            return(annot);
        }
Example #15
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                SetPage(page, true);
                ApplyOwner(owner);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            Field.CopyTo(Dictionary, res);
            ChoiceField.Copy(Dictionary, res);

            ListBox annot = new ListBox(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);

            annot.SetTextProperties(Font, FontColor);
            Field.SetActions(this, annot);

            return(annot);
        }
Example #16
0
        //TODO: Measure
        //TODO: IT

        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                if (_coordinates == null)
                {
                    initCoordinates();
                }

                PointF[] points = _coordinates.ToArray();
                ApplyOwner(owner);
                SetPage(page, true);

                _coordinates.Clear();
                _coordinates.Page = page;
                _coordinates.AddRange(points);

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            string[] keys = { "LE", "IC", "LL", "LLE", "Cap", "IT", "LLO", "CP", "CO" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            PDFArray l = Dictionary["L"] as PDFArray;

            if (l != null)
            {
                RectangleF oldRect;
                if (Page == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = Page.PageRect;
                }

                res.AddItem("L", CloneUtility.CopyArrayCoordinates(l, oldRect, page.PageRect, Page == null));
            }

            PDFDictionary bs = Dictionary["BS"] as PDFDictionary;

            if (bs != null)
            {
                res.AddItem("BS", AnnotationBorderStyle.Copy(bs));
            }

            PDFDictionary measure = Dictionary["Measure"] as PDFDictionary;

            if (measure != null)
            {
                res.AddItem("Measure", Measure.Copy(measure));
            }

            LineAnnotation annot = new LineAnnotation(res, owner);

            annot.SetPage(page, true);

            return(annot);
        }
Example #17
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                InkList lst = InkList;

                ApplyOwner(owner);
                SetPage(page, true);

                for (int i = 0; i < lst.Count; ++i)
                {
                    PointF[] points = lst[i].ToArray();
                    lst[i].Clear();
                    lst[i].Page = page;
                    lst[i].AddRange(points);
                }
                lst.Page = page;

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            PDFDictionary bs = Dictionary["BS"] as PDFDictionary;

            if (bs != null)
            {
                res.AddItem("BS", AnnotationBorderStyle.Copy(bs));
            }

            PDFArray inkList = Dictionary["InkList"] as PDFArray;

            if (inkList != null)
            {
                PDFArray newInkList = new PDFArray();
                for (int i = 0; i < inkList.Count; ++i)
                {
                    PDFArray points = inkList[i] as PDFArray;
                    if (points != null)
                    {
                        RectangleF oldRect;
                        if (Page == null)
                        {
                            oldRect = new RectangleF();
                        }
                        else
                        {
                            oldRect = Page.PageRect;
                        }

                        newInkList.AddItem(CloneUtility.CopyArrayCoordinates(points, oldRect, page.PageRect, Page == null));
                    }
                }
                res.AddItem("InkList", newInkList);
            }

            InkAnnotation annot = new InkAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }