Пример #1
0
   /**
     <summary>Swaps contents between this object and the other one.</summary>
     <param name="other">Object whose contents have to be swapped with this one's.</param>
     <returns>This object.</returns>
   */
   public abstract PdfObject Swap(
 PdfObject other
 );
Пример #2
0
   /**
     <summary>Gets the clone of the specified object, registered inside the specified file context.</summary>
     <param name="object">Object to clone into the specified file context.</param>
     <param name="context">File context of the cloning.</param>
   */
   public static PdfObject Clone(
 PdfObject @object,
 File context
 )
   {
       return @object == null ? null : @object.Clone(context);
   }
Пример #3
0
   /**
     <summary>Ensures an indirect reference to be resolved into its corresponding data object.</summary>
     <param name="object">Object to resolve.</param>
   */
   public static PdfDataObject Resolve(
 PdfObject @object
 )
   {
       return @object == null ? null : @object.Resolve();
   }
Пример #4
0
     public override void AfterClone(
 Cloner cloner,
 PdfObject clone,
 PdfObject source
 )
     {
         /*
           NOTE: Inheritable attributes have to be consolidated into the cloned page dictionary in
           order to ensure its consistency.
         */
         PdfDictionary cloneDictionary = (PdfDictionary)clone;
         PdfDictionary sourceDictionary = (PdfDictionary)source;
         foreach(PdfName key in Page.InheritableAttributeKeys)
         {
           if(!sourceDictionary.ContainsKey(key))
           {
         PdfDirectObject sourceValue = Page.GetInheritableAttribute(sourceDictionary, key);
         if(sourceValue != null)
         {cloneDictionary[key] = (PdfDirectObject)sourceValue.Accept(cloner, null);}
           }
         }
     }
Пример #5
0
     public override bool Matches(
 Cloner cloner,
 PdfObject obj
 )
     {
         return obj is PdfDictionary
           && PdfName.Page.Equals(((PdfDictionary)obj)[PdfName.Type]);
     }
Пример #6
0
     /**
     <summary>Gets whether this filter can deal with the given object.</summary>
     <param name="cloner">Object cloner.</param>
     <param name="source">Source object.</param>
       */
     public virtual bool Matches(
 Cloner cloner,
 PdfObject source
 )
     {
         return true;
     }
Пример #7
0
     public override bool Matches(
 Cloner cloner,
 PdfObject obj
 )
     {
         if(obj is PdfArray)
         {
           PdfArray array = (PdfArray)obj;
           if(array.Count > 0)
           {
         PdfDataObject arrayItem = array.Resolve(0);
         if(arrayItem is PdfDictionary)
         {
           PdfDictionary arrayItemDictionary = (PdfDictionary)arrayItem;
           return arrayItemDictionary.ContainsKey(PdfName.Subtype)
         && arrayItemDictionary.ContainsKey(PdfName.Rect);
         }
           }
         }
         return false;
     }
Пример #8
0
   private Filter MatchFilter(
 PdfObject obj
 )
   {
       Filter cloneFilter = NullFilter;
         foreach(Filter filter in filters)
         {
       if(filter.Matches(this, obj))
       {
         cloneFilter = filter;
         break;
       }
         }
         return cloneFilter;
   }
Пример #9
0
     /**
     <summary>Notifies a complete clone operation on an object.</summary>
     <param name="cloner">Object cloner.</param>
     <param name="clone">Clone object.</param>
     <param name="source">Source object.</param>
       */
     public virtual void AfterClone(
 Cloner cloner,
 PdfObject clone,
 PdfObject source
 )
     {
         /* NOOP */
     }
Пример #10
0
   public override PdfObject Swap(
 PdfObject other
 )
   {
       PdfIndirectObject otherObject = (PdfIndirectObject)other;
         PdfDataObject otherDataObject = otherObject.dataObject;
         // Update the other!
         otherObject.DataObject = dataObject;
         // Update this one!
         this.DataObject = otherDataObject;
         return this;
   }
Пример #11
0
 public override PdfObject Swap(
     PdfObject other
     )
 {
     PdfStream otherStream = (PdfStream)other;
       PdfDictionary otherHeader = otherStream.header;
       IBuffer otherBody = otherStream.body;
       // Update the other!
       otherStream.header = this.header;
       otherStream.body = this.body;
       otherStream.Update();
       // Update this one!
       this.header = otherHeader;
       this.body = otherBody;
       this.Update();
       return this;
 }
Пример #12
0
 /**
  * <summary>Ensures an indirect reference to be resolved into its corresponding data object.</summary>
  * <param name="object">Object to resolve.</param>
  */
 public static PdfDataObject Resolve(
     PdfObject @object
     )
 {
     return(@object == null ? null : @object.Resolve());
 }
Пример #13
0
 /**
  * <summary>Swaps contents between this object and the other one.</summary>
  * <param name="other">Object whose contents have to be swapped with this one's.</param>
  * <returns>This object.</returns>
  */
 public abstract PdfObject Swap(
     PdfObject other
     );
Пример #14
0
 public override PdfObject Swap(
     PdfObject other
     )
 {
     return IndirectObject.Swap(((PdfReference)other).IndirectObject).Reference;
 }