protected override CmObject GetObjectToMonitor(int hvo) { if (m_cache.GetClassOfObject(hvo) != CmTranslation.kclsidCmTranslation) { return(null); } // Return result unless it is disqualified somehow. CmTranslation result = CmObject.CreateFromDBObject(m_cache, hvo) as CmTranslation; StTxtPara para = result.Owner as StTxtPara; if (para == null) { return(null); // not a translation of Scripture...unlikely unless this is hooked up to some unexpected view. } // Make sure the paragraph belongs to Scripture. if (!ScrTxtPara.IsScripturePara(para.Hvo, m_cache)) { return(null); // not Scripture } return(result); // finally! }
// If hvo is an CmIndirectAnnotation that is the free translation of a segment of Scripture, return the // annotation; otherwise return null. CmIndirectAnnotation GetAnnotation(int hvo) { if (m_cache.GetClassOfObject(hvo) != CmIndirectAnnotation.kclsidCmIndirectAnnotation) { return(null); } // Return result unless it is disqualified somehow. CmIndirectAnnotation result = CmObject.CreateFromDBObject(m_cache, hvo) as CmIndirectAnnotation; if (result.AnnotationTypeRAHvo != m_hvoFtDefn) { return(null); // not a free translation } if (result.AppliesToRS.Count == 0) { return(null); // huh? all FTs should applyTo their segment. } CmBaseAnnotation cbaSeg = result.AppliesToRS[0] as CmBaseAnnotation; if (cbaSeg == null) { return(null); // huh? again for same reason } StTxtPara para = cbaSeg.BeginObjectRA as StTxtPara; if (para == null) { return(null); // also unlikely, a segment should link to a paragraph } // Make sure the paragraph belongs to Scripture. if (!ScrTxtPara.IsScripturePara(para.Hvo, m_cache)) { return(null); // not Scripture } return(result); // finally! }