2018-11-25 03:02:06 +08:00
|
|
|
|
namespace UglyToad.PdfPig.CrossReference
|
2017-11-10 03:14:09 +08:00
|
|
|
|
{
|
|
|
|
|
using System.Collections.Generic;
|
2020-01-05 18:07:01 +08:00
|
|
|
|
using Core;
|
2018-11-17 04:00:12 +08:00
|
|
|
|
using Tokens;
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
internal class CrossReferenceTablePartBuilder
|
|
|
|
|
{
|
2018-01-14 22:48:54 +08:00
|
|
|
|
private readonly Dictionary<IndirectReference, long> objects = new Dictionary<IndirectReference, long>();
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
public long Offset { get; set; }
|
|
|
|
|
|
|
|
|
|
public long Previous { get; set; }
|
|
|
|
|
|
2024-03-18 02:51:40 +08:00
|
|
|
|
public DictionaryToken? Dictionary { get; set; }
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
public CrossReferenceType XRefType { get; set; }
|
2022-04-03 03:58:22 +08:00
|
|
|
|
|
|
|
|
|
public long? TiedToPreviousAtOffset { get; set; }
|
|
|
|
|
|
2017-11-10 03:14:09 +08:00
|
|
|
|
public void Add(long objectId, int generationNumber, long offset)
|
|
|
|
|
{
|
2018-01-14 22:48:54 +08:00
|
|
|
|
IndirectReference objKey = new IndirectReference(objectId, generationNumber);
|
2017-11-10 03:14:09 +08:00
|
|
|
|
|
|
|
|
|
if (!objects.ContainsKey(objKey))
|
|
|
|
|
{
|
|
|
|
|
objects[objKey] = offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-05 05:09:47 +08:00
|
|
|
|
public CrossReferenceTablePart Build()
|
2017-11-10 03:14:09 +08:00
|
|
|
|
{
|
2024-03-18 02:51:40 +08:00
|
|
|
|
return new CrossReferenceTablePart(objects, Offset, Previous, Dictionary!, XRefType, TiedToPreviousAtOffset);
|
2017-11-10 03:14:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|