/** <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 );
/** <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); }
/** <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(); }
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);} } } }
public override bool Matches( Cloner cloner, PdfObject obj ) { return obj is PdfDictionary && PdfName.Page.Equals(((PdfDictionary)obj)[PdfName.Type]); }
/** <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; }
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; }
private Filter MatchFilter( PdfObject obj ) { Filter cloneFilter = NullFilter; foreach(Filter filter in filters) { if(filter.Matches(this, obj)) { cloneFilter = filter; break; } } return cloneFilter; }
/** <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 */ }
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; }
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; }
/** * <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()); }
/** * <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 );
public override PdfObject Swap( PdfObject other ) { return IndirectObject.Swap(((PdfReference)other).IndirectObject).Reference; }