Esempio n. 1
0
            public ParagraphIdSnapshotGenerator(
                IParagraphIdCollectionFeature collection,
                ISharedFeature <IParagraphIdCollectionFeature> shared,
                IPackageEventsFeature packageEvents)
            {
                _collection = collection;
                _shared     = shared;
                _events     = packageEvents;

                _events.Change += PackageChangeEvent;
            }
Esempio n. 2
0
        /// <summary>
        /// Registers a document to use a shared paragragraph collection, which potentially may ensure uniqueness among many documents.
        /// </summary>
        /// <param name="shared">Shared collection feature.</param>
        /// <param name="doc">Document to register with shared paragraph collection.</param>
        /// <returns></returns>
        public static ISharedFeature <IParagraphIdCollectionFeature> Add(this ISharedFeature <IParagraphIdCollectionFeature> shared, WordprocessingDocument doc)
        {
            doc.AddPackageEventsFeature();
            doc.AddParagraphIdFeature();

            var paragraphIdCollection = doc.Features.GetRequired <IParagraphIdCollectionFeature>();

            shared.Add(paragraphIdCollection);
            doc.Features.SetDisposable(new ParagraphIdSnapshotGenerator(paragraphIdCollection, shared, doc.Features.GetRequired <IPackageEventsFeature>()));
            doc.Features.Set(shared);
            doc.Features.Set(shared.Composite);

            return(shared);
        }
Esempio n. 3
0
 /// <summary>
 /// Add arbitrary values to be tracked as a shared collection.
 /// </summary>
 /// <param name="shared">Shared collection feature.</param>
 /// <param name="paragraphIds">Paragraph ids to be included with the shared collection.</param>
 /// <returns></returns>
 public static ISharedFeature <IParagraphIdCollectionFeature> Add(this ISharedFeature <IParagraphIdCollectionFeature> shared, IEnumerable <string> paragraphIds)
 {
     shared.Add(new ParagraphIdCollectionFeature(paragraphIds));
     return(shared);
 }