Ejemplo n.º 1
0
        /// <summary>
        /// Gets the known PDF name for the specified action. Only the supported named actions will return a value.
        /// Other action types with throw an ArgumentOutOfRange excpetion
        /// </summary>
        /// <param name="linkAction"></param>
        /// <returns></returns>
        private string GetNameForAction(LinkAction linkAction)
        {
            string name;

            switch (linkAction)
            {
            case LinkAction.Undefined:
            case LinkAction.Uri:
            case LinkAction.Destination:
            case LinkAction.ExternalDestination:
            case LinkAction.Launch:
                throw RecordAndRaise.ArgumentOutOfRange("linkAction");

            case LinkAction.NextPage:
                name = "NextPage";
                break;

            case LinkAction.PrevPage:
                name = "PrevPage";
                break;

            case LinkAction.FirstPage:
                name = "FirstPage";
                break;

            case LinkAction.LastPage:
                name = "LastPage";
                break;

            default:
                throw RecordAndRaise.ArgumentOutOfRange("linkAction");
            }
            return(name);
        }
Ejemplo n.º 2
0
        internal object Push(PDFOutlineRef outlineref)
        {
            if (null == outlineref)
            {
                throw RecordAndRaise.ArgumentNull("outlineref");
            }
            if (null == outlineref.Outline)
            {
                throw RecordAndRaise.ArgumentNull("outlineref.Outline");
            }
            if (null == outlineref.Outline.BelongsTo)
            {
                throw RecordAndRaise.ArgumentNull("outlineref.Outline.BelongsTo");
            }

            if (_stack.Count == 0)
            {
                _roots.Add(outlineref);
            }
            else
            {
                _stack.Peek().AddChild(outlineref);
            }

            _stack.Push(outlineref);

            return(outlineref.Outline.BelongsTo);
        }
Ejemplo n.º 3
0
        internal void Pop(IPDFComponent comp)
        {
            PDFOutlineRef last = _stack.Pop();

            if (last.Outline.BelongsTo != comp)
            {
                throw RecordAndRaise.Operation(Errors.UnbalancedOutlineStack);
            }
        }
Ejemplo n.º 4
0
        public bool Remove(string name)
        {
            if (null == name)
            {
                throw RecordAndRaise.ArgumentNull("name");
            }

            return(this._artefacts.Remove(name));
        }
Ejemplo n.º 5
0
        public bool Contains(string name)
        {
            if (null == name)
            {
                throw RecordAndRaise.ArgumentNull("name");
            }

            return(this._artefacts.ContainsKey(name));
        }
Ejemplo n.º 6
0
        internal PDFOutlineRef(PDFOutline outline, OutlineStyle style)
        {
            if (null == outline)
            {
                throw RecordAndRaise.ArgumentNull("outline");
            }

            _outline = outline;
            _style   = style;
        }
Ejemplo n.º 7
0
 object IArtefactCollection.Register(IArtefactEntry entry)
 {
     if (entry is PDFOutlineRef)
     {
         return(this.Push((PDFOutlineRef)entry));
     }
     else
     {
         throw RecordAndRaise.InvalidCast(Errors.CannotConvertObjectToType, entry, typeof(PDFOutlineRef).FullName);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a new instance of the PDFDestination that represents a spcific location within the current PDF Document
        /// </summary>
        /// <param name="component"></param>
        /// <param name="fit"></param>
        /// <param name="extension">Any required label extension to guaruntee uniqueness of the destination within the documents name dictionary</param>
        public PDFDestination(Component component, OutlineFit fit, string extension)
        {
            if (null == component)
            {
                throw RecordAndRaise.ArgumentNull("component");
            }

            this.Component = component;
            this.Fit       = fit;
            this.Extension = extension;
        }
Ejemplo n.º 9
0
        object IArtefactCollection.Register(IArtefactEntry catalogobject)
        {
            if (null == catalogobject)
            {
                throw RecordAndRaise.ArgumentNull("catalogobject");
            }

            if (!(catalogobject is PDFAnnotationEntry))
            {
                throw RecordAndRaise.InvalidCast(Errors.CannotConvertObjectToType, catalogobject.GetType(), typeof(PDFAnnotationEntry));
            }

            _annots.Add((PDFAnnotationEntry)catalogobject);
            return(catalogobject);
        }