public object Register(IArtefactEntry catalogobject)
        {
            PDFAcrobatFormFieldWidget field = (PDFAcrobatFormFieldWidget)catalogobject;

            this.Fields.Add(field);
            return(field);
        }
Esempio n. 2
0
        //
        // public methods
        //

        #region object IArtefactCollection.Register(IArtefactEntry entry)

        /// <summary>
        /// Registers and begins an artefact in the name dictionary
        /// </summary>
        /// <param name="entry"></param>
        /// <returns></returns>
        object IArtefactCollection.Register(IArtefactEntry entry)
        {
            PDFCategorisedNameTree col;
            object returnValue;

            if (entry is ICategorisedArtefactNamesEntry)
            {
                ICategorisedArtefactNamesEntry catEntry = (ICategorisedArtefactNamesEntry)entry;
                if (_dictionary.TryGetValue(catEntry.NamesCategory, out col) == false)
                {
                    col = CreateTreeForCategory(catEntry.NamesCategory);
                    _dictionary.Add(catEntry.NamesCategory, col);
                }
                returnValue = col.Push(catEntry.FullName, catEntry);
            }
            //else if (entry is PDFDestination) //Default is Destination as this was generated before the Attachments or any other ICategorizedArtefactNameEntry implementation
            //{
            //    PDFDestination dest = (PDFDestination)entry;
            //    if (_dictionary.TryGetValue(DestinationsName, out col) == false)
            //    {
            //        col = CreateTreeForCategory(DestinationsName);
            //        _dictionary.Add(DestinationsName, col);
            //    }
            //    returnValue = col.Push(dest.FullName, dest);
            //}
            else
            {
                throw new PDFException(Errors.UnknownArtefactForNamesDictionary);
            }

            return(returnValue);
        }
        //
        // methods
        //

        #region object IArtefactCollection.Register(IArtefactEntry entry)

        /// <summary>
        /// Implmentation of the IArtefactCollection Register method, to ensure that all names are included in the final PDF docucment. Calls RegisterDestination
        /// </summary>
        /// <param name="entry"></param>
        /// <returns></returns>
        object IArtefactCollection.Register(IArtefactEntry entry)
        {
            if (entry is ICategorisedArtefactNamesEntry)
            {
                ICategorisedArtefactNamesEntry catNameEntry = (ICategorisedArtefactNamesEntry)entry;
            }
            PDFDestination dest = (PDFDestination)entry;

            return(this.RegisterDestination(dest));
        }
Esempio n. 4
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);
     }
 }
Esempio n. 5
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);
        }
Esempio n. 6
0
        public object RegisterPageEntry(PDFLayoutContext context, string artefactType, IArtefactEntry entry)
        {
            IArtefactCollection col;

            if (!Artefacts.TryGetCollection(artefactType, out col))
            {
                col = context.DocumentLayout.CreateArtefactCollection(artefactType);
                _artefacts.Add(col);
            }
            return(col.Register(entry));
        }
 public void Pop(string name, IArtefactEntry entry)
 {
 }
 /// <summary>
 /// Sets an artefact in the collection (sorted based on the name), and pushes it onto this collections current stack
 /// </summary>
 /// <param name="name"></param>
 /// <param name="entry"></param>
 public object Push(string name, IArtefactEntry entry)
 {
     this.InnerEntries[name] = entry;
     return(entry);
 }
        /// <summary>
        /// Registers the IArtefactEntry values with the artefact collection of type 'catalogtype'.
        /// The method returns a reference object that must be passed back to CloseArtefactEntry when the entry should be closed.
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="catalogtype"></param>
        /// <param name="entry"></param>
        /// <returns></returns>
        public virtual object RegisterCatalogEntry(PDFLayoutContext context, string catalogtype, IArtefactEntry entry)
        {
            IArtefactCollection col;

            if (!this._artefacts.TryGetCollection(catalogtype, out col))
            {
                col = this.CreateArtefactCollection(catalogtype);
                _artefacts.Add(col);
            }
            if (context.ShouldLogDebug)
            {
                context.TraceLog.Add(TraceLevel.Debug, "Layout Document", "Registering the artefact '" + entry.ToString() + "' in catalog " + catalogtype);
            }

            return(col.Register(entry));
        }