Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Finds or creates an annotation.
        /// </summary>
        /// <param name="info">The information about a annotation being imported.</param>
        /// <param name="annotatedObjGuid">The annotated obj GUID.</param>
        /// <returns>
        /// The annotation (whether created or found)
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public static IScrScriptureNote FindOrCreateAnnotation(ScrAnnotationInfo info,
                                                               Guid annotatedObjGuid)
        {
            IScrScriptureNote ann;

            // If an identical note is not found...
            if (!s_existingAnnotations.TryGetValue(info.Key, out ann))
            {
                ICmObject annotatedObj = null;
                if (annotatedObjGuid != Guid.Empty)
                {
                    s_scr.Cache.ServiceLocator.GetInstance <ICmObjectRepository>().TryGetObject(annotatedObjGuid, out annotatedObj);
                }
                ann = s_annotationList.InsertImportedNote(info.startReference, info.endReference,
                                                          annotatedObj, annotatedObj, info.guidAnnotationType, null);

                ann.BeginOffset = ann.EndOffset = info.ichOffset;

                if (ann.CitedText != null)
                {
                    ann.EndOffset += ann.CitedText.Length;
                }
            }

            return(ann);
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Inserts a Scriture annotation for the book currently being imported.
        /// </summary>
        /// <param name="bcvStartReference">The starting BCV reference.</param>
        /// <param name="bcvEndReference">The ending BCV reference.</param>
        /// <param name="obj">The object being annotated (either a paragraph or a ScrBook)</param>
        /// <param name="bldr">The paragraph builder containing the guts of the annotation
        /// description</param>
        /// <param name="guidNoteType">The GUID representing the CmAnnotationDefn to use for
        /// the type</param>
        /// <returns>The newly created annotation</returns>
        /// ------------------------------------------------------------------------------------
        public IScrScriptureNote InsertNote(int bcvStartReference, int bcvEndReference,
                                            ICmObject obj, StTxtParaBldr bldr, Guid guidNoteType)
        {
            IScrScriptureNote note = m_annotations.InsertImportedNote(
                bcvStartReference, bcvEndReference, obj, obj, guidNoteType, bldr);

            return(note);
        }