Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize a new note.
        /// </summary>
        /// <param name="guidAnnotationType">GUID representing the type of annotation.</param>
        /// <param name="startRef">beginning reference note refers to</param>
        /// <param name="endRef">ending reference note refers to</param>
        /// <param name="beginObj">beginning object note refers to</param>
        /// <param name="endObj">ending object note refers to</param>
        /// <param name="wsSelector">The writing system selector.</param>
        /// <param name="startOffset">The starting character offset.</param>
        /// <param name="endOffset">The ending character offset.</param>
        /// <param name="bldrQuote">Para builder to use to build the Quote paragraph</param>
        /// <param name="bldrDiscussion">Para builder to use to build the Discussion
        /// paragraph</param>
        /// <param name="bldrRecommendation">Para builder to use to build the
        /// Recommendation paragraph</param>
        /// <param name="bldrResolution">Para builder to use to build the Resolution
        /// paragraph</param>
        /// ------------------------------------------------------------------------------------
        public void InitializeNote(Guid guidAnnotationType, BCVRef startRef, BCVRef endRef,
                                   ICmObject beginObj, ICmObject endObj, int wsSelector, int startOffset, int endOffset,
                                   StTxtParaBldr bldrQuote, StTxtParaBldr bldrDiscussion, StTxtParaBldr bldrRecommendation,
                                   StTxtParaBldr bldrResolution)
        {
            AnnotationTypeRA = new CmAnnotationDefn(Cache, guidAnnotationType);
            BeginObjectRA    = beginObj;
            EndObjectRA      = endObj;
            BeginRef         = startRef;
            EndRef           = endRef;
            WsSelector       = wsSelector;
            BeginOffset      = startOffset;
            EndOffset        = endOffset;

            // Now, initialize all the texts
            QuoteOA = new StJournalText();
            InitializeText(bldrQuote, QuoteOA);

            DiscussionOA = new StJournalText();
            InitializeText(bldrDiscussion, DiscussionOA);

            RecommendationOA = new StJournalText();
            InitializeText(bldrRecommendation, RecommendationOA);

            ResolutionOA = new StJournalText();
            InitializeText(bldrResolution, ResolutionOA);
        }
Пример #2
0
        /// <summary>
        /// Select the word indicated by the text-wordform-in-context (twfic) annotation.
        /// This ignores the Sandbox! This is 'public' because it overrides a public method.
        /// </summary>
        /// <param name="hvoAnn"></param>
        public override void SelectAnnotation(int hvoAnn)
        {
            ISilDataAccess sda = Cache.MainCacheAccessor;
            // We should assert that ann is Twfic
            int twficType = CmAnnotationDefn.Twfic(Cache).Hvo;
            int annoType  = sda.get_ObjectProp(hvoAnn, (int)CmAnnotation.CmAnnotationTags.kflidAnnotationType);

            Debug.Assert(annoType == twficType, "Given annotation type should be twfic("
                         + twficType + ") but was " + annoType + ".");

            // The following will select the Twfic, ... I hope!
            // Scroll to selection into view
            IVwSelection sel = SelectWficInIText(hvoAnn);

            if (sel == null)
            {
                return;
            }
            if (!this.Focused)
            {
                this.Focus();
            }
            this.ScrollSelectionIntoView(sel, VwScrollSelOpts.kssoTop);
            Update();
        }
Пример #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create and Check an Annotation
        /// </summary>
        /// <param name="hvoParaStart">The hvo para start.</param>
        /// <param name="hvoParaEnd">The hvo para end.</param>
        /// <param name="startRef">The start ref.</param>
        /// <param name="endRef">The end ref.</param>
        /// <param name="startOffset">The start offset.</param>
        /// <param name="endOffset">The end offset.</param>
        /// <param name="tssQuote">The text in the quote.</param>
        /// <param name="sel">selection in main window</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        private IScrScriptureNote CreateAndCheckAnnotation(int hvoObjStart, int hvoObjEnd,
                                                           int startRef, int endRef, int startOffset, int endOffset, string strQuote)
        {
            ILangProject     lp = Cache.LangProject;
            CmAnnotationDefn transNoteAnnDefn = new CmAnnotationDefn(Cache,
                                                                     LangProject.kguidAnnTranslatorNote);

            // Get information from the selection about the location of the annotation.
            CmObject   topObj       = (CmObject)CmObject.CreateFromDBObject(m_inMemoryCache.Cache, hvoObjStart);
            CmObject   bottomObj    = (CmObject)CmObject.CreateFromDBObject(m_inMemoryCache.Cache, hvoObjEnd);
            int        wsSelector   = -1;
            ITsStrBldr tssBldrQuote = TsStrBldrClass.Create();

            tssBldrQuote.Replace(0, 0, strQuote, StyleUtils.ParaStyleTextProps(ScrStyleNames.Remark));

            IScrScriptureNote ann =
                m_notesEditingHelper.InsertNote(transNoteAnnDefn, startRef, endRef,
                                                topObj, bottomObj, wsSelector, startOffset, endOffset, tssBldrQuote.GetString());

            Assert.IsNotNull(ann);
            Assert.AreEqual(transNoteAnnDefn.Hvo, ann.AnnotationTypeRAHvo, "Wrong type of note created");
            Assert.AreEqual(hvoObjStart, ann.BeginObjectRAHvo, "Wrong paragraph annotated");
            Assert.AreEqual(hvoObjEnd, ann.EndObjectRAHvo, "Wrong paragraph annotated");
            Assert.AreEqual(startRef, ann.BeginRef, "Should have the correct start para reference");
            Assert.AreEqual(endRef, ann.EndRef, "Should have the correct end para reference");
            Assert.AreEqual(startOffset, ann.BeginOffset, "Should have the correct starting char offset");
            Assert.AreEqual(endOffset, ann.EndOffset, "Should have the correct ending char offset");
            Assert.AreEqual(lp.DefaultUserAgent.Hvo, ann.SourceRAHvo, "Wrong agent");
            VerifyInitializedText(ann.DiscussionOA, "Discussion");
            Assert.AreEqual(tssBldrQuote.Text, ((StTxtPara)ann.QuoteOA.ParagraphsOS[0]).Contents.Text);
            VerifyInitializedText(ann.RecommendationOA, "Recommendation");
            VerifyInitializedText(ann.ResolutionOA, "Resolution");
            return(ann);
        }
Пример #4
0
        private void MakeAnnDefn(ICmPossibilityList defns, string guid)
        {
            CmAnnotationDefn defn = new CmAnnotationDefn();

            defns.PossibilitiesOS.Append(defn);
            Cache.VwCacheDaAccessor.CacheGuidProp(defn.Hvo, (int)CmObjectFields.kflidCmObject_Guid,
                                                  new Guid(guid));
        }
Пример #5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the exceeded error message when a check has more identical errors than
        /// specified for the check.
        /// </summary>
        /// <param name="checkId">The GUID which uniquely identifies the Scripture check.</param>
        /// <returns>error message</returns>
        /// ------------------------------------------------------------------------------------
        private string GetExceededErrorMsg(Guid checkId)
        {
            CmAnnotationDefn checkDef = new CmAnnotationDefn(Cache, checkId);

            return(string.Format(StringUtils.GetUiString(ScrFdoResources.ResourceManager,
                                                         "kstidExceededMaxNumberIdenticalChecks"), checkDef != null ?
                                 checkDef.Name.UserDefaultWritingSystem : string.Empty));
        }
Пример #6
0
        public override void FixtureSetup()
        {
            CheckDisposed();
            base.FixtureSetup();

            m_textsDefn       = new XmlDocument();
            s_kTextTagAnnType = CmAnnotationDefn.TextMarkupTag(Cache).Hvo;
        }
Пример #7
0
        public void CreateFromGuid()
        {
            CheckDisposed();

            ICmAnnotationDefn cad = CmAnnotationDefn.TextSegment(Cache);

            Assert.AreEqual("Text Segment", cad.Name.UserDefaultWritingSystem);
        }
Пример #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the scripture checks and updates the annotation definitions by checking
        /// that for each check we have a corresponding annotation definition in the database.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        /// ------------------------------------------------------------------------------------
        private static SortedList <ScrCheckKey, IScriptureCheck> InstantiateChecks(
            ScrChecksDataSource dataSource)
        {
            FdoCache cache = dataSource.Cache;

            SortedList <ScrCheckKey, IScriptureCheck> scriptureChecks =
                new SortedList <ScrCheckKey, IScriptureCheck>();

            using (new SuppressSubTasks(cache))
            {
                Dictionary <Guid, ICmAnnotationDefn> errorTypes =
                    new Dictionary <Guid, ICmAnnotationDefn>();

                ICmAnnotationDefn annDefnChkError = new CmAnnotationDefn(cache,
                                                                         LangProject.kguidAnnCheckingError);

                foreach (ICmAnnotationDefn errorType in annDefnChkError.SubPossibilitiesOS)
                {
                    errorTypes[errorType.Guid] = errorType;
                }

                foreach (Type type in s_scrCheckList)
                {
                    IScriptureCheck scrCheck =
                        (IScriptureCheck)Activator.CreateInstance(type, dataSource);

                    if (scrCheck == null)
                    {
                        continue;
                    }

                    // Get the localized version of the check name
                    string scrCheckName = GetCheckProperty(ScrFdoResources.ResourceManager,
                                                           scrCheck.CheckId, "Name", scrCheck.CheckName);
                    scriptureChecks.Add(new ScrCheckKey(scrCheck.RelativeOrder, scrCheckName), scrCheck);

                    ICmAnnotationDefn chkType;
                    if (!errorTypes.TryGetValue(scrCheck.CheckId, out chkType))
                    {
                        chkType = new CmAnnotationDefn();
                        annDefnChkError.SubPossibilitiesOS.Append(chkType);
                        chkType.Guid        = scrCheck.CheckId;
                        chkType.IsProtected = true;
                        chkType.Name.UserDefaultWritingSystem = scrCheckName;
                        chkType.Description.UserDefaultWritingSystem.UnderlyingTsString =
                            StringUtils.MakeTss(scrCheck.Description, cache.DefaultUserWs);
                        chkType.HelpId = scrCheck.CheckName.Replace(' ', '_');
                        InheritAttributes(annDefnChkError, chkType);
                    }
                    else if (chkType.Name.UserDefaultWritingSystem != scrCheckName)
                    {
                        // Store the localized version of the check name as the current UI name.
                        chkType.Name.UserDefaultWritingSystem = scrCheckName;
                    }
                }
            }
            return(scriptureChecks);
        }
Пример #9
0
        internal CmIndirectAnnotation MakeRow(DsConstChart chart, string lineNo)
        {
            CmIndirectAnnotation row = MakeIndirectAnnotation();

            chart.RowsRS.Append(row);
            row.Comment.SetAnalysisDefaultWritingSystem(lineNo);
            row.AnnotationTypeRA = CmAnnotationDefn.ConstituentChartRow(Cache);
            return(row);
        }
Пример #10
0
        /// <summary>
        /// Verify that the specified row of the chart exists and has the expected row-number comment and number of rows.
        /// Also that it is a CCR.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="rowNumber"></param>
        /// <param name="cAppliesTo"></param>
        internal void VerifyRow(int index, string rowNumber, int cAppliesTo)
        {
            int crows = m_chart.RowsRS.Count;

            Assert.IsTrue(index <= crows);
            CmIndirectAnnotation row = (CmIndirectAnnotation)m_chart.RowsRS[index];

            Assert.AreEqual(rowNumber, row.Comment.AnalysisDefaultWritingSystem.Text);
            Assert.AreEqual(cAppliesTo, row.AppliesToRS.Count);
            Assert.AreEqual(CmAnnotationDefn.ConstituentChartRow(Cache), row.AnnotationTypeRA);
        }
Пример #11
0
        /// <summary>
        /// Verify that there is a row with the specified index that has a cell with the specified
        /// index which belongs to the specified column (instanceOf) and appliesTo the specified words
        /// and has the specified marker (if any).
        /// </summary>
        /// <param name="rowIndex"></param>
        /// <param name="cellIndex"></param>
        /// <param name="hvoColumn"></param>
        /// <param name="words"></param>
        /// <param name="marker"></param>
        internal void VerifyCca(int rowIndex, int ccaIndex, int hvoColumn, int[] words, string marker)
        {
            ICmIndirectAnnotation cca = VerifyCcaBasic(rowIndex, ccaIndex, hvoColumn) as ICmIndirectAnnotation;

            Assert.IsNotNull(cca, "Cca should be indirect annotation");
            Assert.AreEqual(words, cca.AppliesToRS.HvoArray);
            string comment = cca.Comment.AnalysisDefaultWritingSystem.Text;

            if (comment == null)
            {
                comment = "";
            }
            Assert.AreEqual(marker, comment);
            Assert.AreEqual(CmAnnotationDefn.ConstituentChartAnnotation(Cache), cca.AnnotationTypeRA);
        }
Пример #12
0
        private ICmAnnotation VerifyCcaBasic(int rowIndex, int ccaIndex, int hvoColumn)
        {
            int crows = m_chart.RowsRS.Count;

            Assert.IsTrue(rowIndex <= crows);
            CmIndirectAnnotation row = (CmIndirectAnnotation)m_chart.RowsRS[rowIndex];
            int cCells = row.AppliesToRS.Count;

            Assert.IsTrue(ccaIndex < cCells);
            ICmAnnotation cca = row.AppliesToRS[ccaIndex];

            Assert.AreEqual(hvoColumn, cca.InstanceOfRAHvo);
            Assert.AreEqual(CmAnnotationDefn.ConstituentChartAnnotation(Cache), cca.AnnotationTypeRA);
            return(cca);
        }
Пример #13
0
        // Make some sort of wfics for the text of the specified paragraph. Assumes no double spaces!
        // Caches results and does not repeat on same para
        internal int[] MakeAnnotations(StTxtPara para)
        {
            int[] previous;
            if (m_annotations.TryGetValue(para.Hvo, out previous))
            {
                return(previous);
            }
            string contents = para.Contents.Text;

            string[]          words    = contents.Split(new char[] { ' ', '.' });
            int               ich      = 0;
            List <int>        results  = new List <int>();
            ICmAnnotationDefn WficType = CmAnnotationDefn.Twfic(Cache);

            foreach (string word in words)
            {
                if (word == "")
                {
                    ich++;
                    continue;
                }
                WfiWordform wordform = new WfiWordform();
                Cache.LangProject.WordformInventoryOA.WordformsOC.Add(wordform);
                wordform.Form.SetAlternative(word, Cache.DefaultVernWs);
                // JohnT: This should ideally use CmBaseAnnotation.CreateUnownedCba. But most or all uses of this
                // method are memory-only tests, and that method requires a database.
                CmBaseAnnotation cba = new CmBaseAnnotation();
                Cache.LangProject.AnnotationsOC.Add(cba);
                cba.BeginOffset = ich;
                ich            += word.Length;
                cba.EndOffset   = ich;
                ich++;                 // past space or dot
                cba.BeginObjectRA    = para;
                cba.AnnotationTypeRA = WficType;
                //cba.AnnotationTypeRA = ?? can we get CmAnnotationDefn.Twfic(Cache) with a non-database cache?
                WfiAnalysis analysis = new WfiAnalysis();
                wordform.AnalysesOC.Add(analysis);
                WfiGloss gloss = new WfiGloss();
                analysis.MeaningsOC.Add(gloss);
                gloss.Form.SetAlternative(word + "Gloss" + ich, Cache.DefaultAnalWs);
                cba.InstanceOfRA = gloss;
                results.Add(cba.Hvo);
            }
            int[] result = results.ToArray();
            m_annotations[para.Hvo] = result;
            return(result);
        }
Пример #14
0
        /// <summary>
        /// Return the next wfics that have not yet been added to the chart (up to maxContext of them).
        /// </summary>
        /// <param name="maxContext"></param>
        /// <returns></returns>
        public static int[] NextUnusedInput(FdoCache cache, int hvoStText, int maxContext, int hvoChart)
        {
            int hvoWficDefn = CmAnnotationDefn.Twfic(cache).Hvo;
            int hvoCcaDefn  = CmAnnotationDefn.ConstituentChartAnnotation(cache).Hvo;
            // First two lines yield annotations on the right text of the right type (wfics).
            // balance further limits it to uncharted ones
            string sql =
                "select top(" + maxContext + ") cba.id, stp.owner$ from CmBaseAnnotation_ cba"
                + " join StTxtPara_ stp on cba.BeginObject = stp.id and cba.AnnotationType = " + hvoWficDefn
                + " and stp.OwnFlid$ = 14001 and stp.Owner$ = " + hvoStText
                + " where not exists(Select * from DsConstChart_Rows row"
                + " join CmIndirectAnnotation_AppliesTo row_cca on row_cca.src = row.Dst and row.Src = " + hvoChart
                + " join CmIndirectAnnotation_AppliesTo cca_cba on cca_cba.src = row_cca.dst and cca_cba.Dst = cba.id)"
                + " order by stp.OwnOrd$, cba.BeginOffset";

            return(DbOps.ReadIntArrayFromCommand(cache, sql, null));
        }
Пример #15
0
        /// <summary>
        /// Convenient for ensuring any annotation defns we need have been created.
        /// </summary>
        protected int EnsureAnnDefn(string guid)
        {
            int result = Cache.GetIdFromGuid(guid);

            if (result == 0)
            {
                if (Cache.LangProject.AnnotationDefsOA == null)
                {
                    CmPossibilityList annDefs = new CmPossibilityList();
                    Cache.LangProject.AnnotationDefsOA = annDefs;
                }
                CmAnnotationDefn annotationDefn = new CmAnnotationDefn();
                Cache.LangProject.AnnotationDefsOA.PossibilitiesOS.Append(annotationDefn);
                m_inMemoryCache.CacheAccessor.CacheGuidProp(annotationDefn.Hvo, (int)CmObjectFields.kflidCmObject_Guid,
                                                            new Guid(guid));
                return(annotationDefn.Hvo);
            }
            return(result);
        }
Пример #16
0
 public override void Initialize()
 {
     CheckDisposed();
     base.Initialize();
     InstallVirtuals(@"Language Explorer\Configuration\Words\AreaConfiguration.xml",
                     new string[] { "SIL.FieldWorks.IText.ParagraphSegmentsVirtualHandler", "SIL.FieldWorks.IText.OccurrencesInTextsVirtualHandler" });
     m_wsVern  = Cache.DefaultVernWs;
     m_wsTrans = Cache.DefaultAnalWs;
     m_book    = new ScrBook();
     Cache.LangProject.TranslatedScriptureOA.ScriptureBooksOS.Append(m_book);
     m_section = new ScrSection();
     m_book.SectionsOS.Append(m_section);
     m_para = new StTxtPara();
     m_text = new StText();
     m_section.ContentOA = m_text;
     m_text.ParagraphsOS.Append(m_para);
     m_hvoSegDefn  = CmAnnotationDefn.TextSegment(Cache).Hvo;
     m_hvoFtDefn   = Cache.GetIdFromGuid(new Guid(LangProject.kguidAnnFreeTranslation));
     kflidFT       = StTxtPara.SegmentFreeTranslationFlid(Cache);
     kflidSegments = StTxtPara.SegmentsFlid(Cache);
 }
Пример #17
0
        /// <summary>
        /// Return the hvo for theCmBaseAnnotation that
        /// matches the given boundaries in an StTxtPara object.
        /// If no exact match is found, return the nearest segment (preferably the following word).
        /// </summary>
        /// <param name="hvoStTxtPara"></param>
        /// <param name="ichMin"></param>
        /// <param name="ichLim"></param>
        /// <param name="fOnlyTWFIC">true, if restricted to TWFIC</param>
        /// <param name="fExactMatch"> true if we return an exact match, false otherwise.</param>
        /// <returns>hvo is 0 if not found.</returns>
        static internal int FindAnnotationHvoForStTxtPara(FdoCache cache, int hvoStTxtPara, int ichMin, int ichLim, bool fOnlyTWFIC, out bool fExactMatch)
        {
            int twficType   = CmAnnotationDefn.Twfic(cache).Hvo;
            int textSegType = CmAnnotationDefn.TextSegment(cache).Hvo;

            fExactMatch = false;
            int clsid = cache.GetClassOfObject(hvoStTxtPara);

            if (clsid != StTxtPara.kClassId)
            {
                Debug.Assert(clsid != StTxtPara.kClassId, "hvoStTxtPara should be of class StTxtPara.");
                return(0);
            }
            int            kflidParaSegment = InterlinVc.ParaSegmentTag(cache);
            ISilDataAccess sda = cache.MainCacheAccessor;

            // first find the closest segment.
            int[]             segments      = cache.GetVectorProperty(hvoStTxtPara, kflidParaSegment, true);
            ICmBaseAnnotation cbaClosestSeg = FindClosestAnnotation(cache, segments, textSegType, ichMin, ichLim, out fExactMatch);

            if (cbaClosestSeg == null)
            {
                return(0);
            }
            // if it was an exact match for a segment, return it.
            if (cbaClosestSeg != null && fExactMatch && !fOnlyTWFIC)
            {
                return(cbaClosestSeg.Hvo);
            }
            // otherwise, see if we can find a closer wordform
            int[]             segmentForms = cache.GetVectorProperty(cbaClosestSeg.Hvo, InterlinVc.SegmentFormsTag(cache), true);
            ICmBaseAnnotation cbaClosestWf = FindClosestAnnotation(cache, segmentForms, twficType, ichMin, ichLim, out fExactMatch);

            if (cbaClosestWf == null)
            {
                return(fOnlyTWFIC ? 0 : cbaClosestSeg.Hvo);
            }
            return(cbaClosestWf.Hvo);
        }
Пример #18
0
 private void InitializeCca(ICmAnnotation cca, int icol, ICmIndirectAnnotation row)
 {
     cca.InstanceOfRAHvo = m_allColumns[icol];
     row.AppliesToRS.Append(cca);
     cca.AnnotationTypeRA = CmAnnotationDefn.ConstituentChartAnnotation(Cache);
 }
Пример #19
0
        protected void CreateTestData()
        {
            // Create required virtual properties
            XmlDocument doc = new XmlDocument();

            // Subset of Flex virtuals required for parsing paragraphs etc.
            doc.LoadXml(
                "<virtuals>"
                + "<virtual modelclass=\"StTxtPara\" virtualfield=\"Segments\">"
                + "<dynamicloaderinfo assemblyPath=\"ITextDll.dll\" class=\"SIL.FieldWorks.IText.ParagraphSegmentsVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"OccurrencesInTexts\" destinationClass=\"CmBaseAnnotation\">"
                + "<dynamicloaderinfo assemblyPath=\"ITextDll.dll\" class=\"SIL.FieldWorks.IText.OccurrencesInTextsVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"HumanApprovedAnalyses\" computeeverytime=\"true\">"
                + "<dynamicloaderinfo assemblyPath=\"FDO.dll\" class=\"SIL.FieldWorks.FDO.FDOSequencePropertyVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"HumanNoOpinionParses\" computeeverytime=\"true\" requiresRealParserGeneratedData=\"true\">"
                + "<dynamicloaderinfo assemblyPath=\"FDO.dll\" class=\"SIL.FieldWorks.FDO.FDOSequencePropertyVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"HumanDisapprovedParses\" computeeverytime=\"true\">"
                + "<dynamicloaderinfo assemblyPath=\"FDO.dll\" class=\"SIL.FieldWorks.FDO.FDOSequencePropertyVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"FullConcordanceCount\" depends=\"OccurrencesInTexts\" computeeverytime=\"true\">"
                + "<dynamicloaderinfo assemblyPath=\"FDO.dll\" class=\"SIL.FieldWorks.FDO.IntegerPropertyVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"UserCount\" bulkLoadMethod=\"LoadAllUserCounts\" computeeverytime=\"true\">"
                + "<dynamicloaderinfo assemblyPath=\"FDO.dll\" class=\"SIL.FieldWorks.FDO.IntegerPropertyVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"ParserCount\" bulkLoadMethod=\"LoadAllParserCounts\" computeeverytime=\"true\" requiresRealParserGeneratedData=\"true\">"
                + "<dynamicloaderinfo assemblyPath=\"FDO.dll\" class=\"SIL.FieldWorks.FDO.IntegerPropertyVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WfiWordform\" virtualfield=\"ConflictCount\" computeeverytime=\"true\" requiresRealParserGeneratedData=\"true\">"
                + "<dynamicloaderinfo assemblyPath=\"FDO.dll\" class=\"SIL.FieldWorks.FDO.IntegerPropertyVirtualHandler\"/>"
                + "</virtual>"
                + "<virtual modelclass=\"WordformInventory\" virtualfield=\"ConcordanceWords\" destinationClass=\"WfiWordform\">"
                + "<dynamicloaderinfo assemblyPath=\"ITextDll.dll\" class=\"SIL.FieldWorks.IText.ConcordanceWordsVirtualHandler\"/>"
                + "</virtual>"
                + "</virtuals>");
            BaseVirtualHandler.InstallVirtuals(doc.DocumentElement, Cache);

            m_text = new Text();
            Cache.LangProject.TextsOC.Add(m_text);
            string para1 = "Axx simplexx testxx withxx axx lotxx ofxx wordsxx endingxx inxx xx";
            string para2 = "axx sentencexx axx havingxx axx lotxx ofxx axx";

            m_para1           = new StTxtPara();
            m_stText          = new StText();
            m_text.ContentsOA = m_stText;
            m_para1           = MakePara(para1);
            m_para2           = MakePara(para2);
            m_wfAxx           = WfiWordform.CreateFromDBObject(Cache,
                                                               WfiWordform.FindOrCreateWordform(Cache, "axx", Cache.DefaultVernWs, true));
            // Make one real annotation, which also serves to link the Axx to this.
            m_cbaAxx = CmBaseAnnotation.CreateUnownedCba(Cache);
            m_cbaAxx.InstanceOfRA     = m_wfAxx;
            m_cbaAxx.BeginObjectRA    = m_para1;
            m_cbaAxx.BeginOffset      = 0;
            m_cbaAxx.EndOffset        = 3;
            m_cbaAxx.Flid             = (int)StTxtPara.StTxtParaTags.kflidContents;
            m_cbaAxx.AnnotationTypeRA = CmAnnotationDefn.Twfic(Cache);

            // Make another real annotation, which should get updated during Apply.
            IWfiWordform wf2 = WfiWordform.CreateFromDBObject(Cache,
                                                              WfiWordform.FindOrCreateWordform(Cache, "lotxx", Cache.DefaultVernWs, true));

            m_cba2 = CmBaseAnnotation.CreateUnownedCba(Cache);
            m_cba2.InstanceOfRA     = wf2;
            m_cba2.BeginObjectRA    = m_para2;
            m_cba2.BeginOffset      = "axx sentencexx axx havingxx axx ".Length;
            m_cba2.EndOffset        = m_cba2.BeginOffset + "lotxx".Length;
            m_cba2.AnnotationTypeRA = CmAnnotationDefn.Twfic(Cache);
            m_cba2.Flid             = (int)StTxtPara.StTxtParaTags.kflidContents;

            ParagraphParser.ConcordTexts(Cache, new int[] { m_stText.Hvo }, new NullProgressState());
            m_axxOccurrences   = m_wfAxx.ConcordanceIds;
            m_para1Occurrences = OccurrencesInPara(m_para1.Hvo, m_axxOccurrences);
            m_para2Occurrences = OccurrencesInPara(m_para2.Hvo, m_axxOccurrences);

            // to improve test isolation, be sure to null things not always initialized.
            m_wfaAxe    = m_wfaCut = m_wfaCutIt = m_wfaNotRude = null;
            m_cAnalyses = 0;
        }
Пример #20
0
 public TestTaggingChild(FdoCache cache)
 {
     Cache            = cache;
     m_textTagAnnDefn = CmAnnotationDefn.TextMarkupTag(Cache).Hvo;
     m_twficAnnDefn   = CmAnnotationDefn.Twfic(Cache).Hvo;
 }
Пример #21
0
		ICmAnnotationDefn ICmAnnotationDefnFactoryInternal.Create(Guid guid, int hvo, ICmPossibility owner, int index)
		{
			if (owner == null) throw new ArgumentNullException("owner");

			var retval = new CmAnnotationDefn(
				m_cache,
				hvo,
				guid);
			owner.SubPossibilitiesOS.Insert(index, retval);
			return retval;
		}
Пример #22
0
		ICmAnnotationDefn ICmAnnotationDefnFactory.Create(Guid guid, ICmAnnotationDefn owner)
		{
			if (owner == null) throw new ArgumentNullException("owner");

			int hvo = ((IDataReader)m_cache.ServiceLocator.GetInstance<IDataSetup>()).GetNextRealHvo();

			var retval = new CmAnnotationDefn(m_cache, hvo, guid);
			owner.SubPossibilitiesOS.Add(retval);
			return retval;
		}
Пример #23
0
 protected internal InterlinearExporterForElan(FdoCache cache, XmlWriter writer, int hvoRoot, InterlinLineChoices lineChoices, InterlinVc vc, ITsString tssTextName, ITsString tssTextAbbreviation)
     : base(cache, writer, hvoRoot, lineChoices, vc, tssTextName, tssTextAbbreviation)
 {
     kPunctuationAnnType = CmAnnotationDefn.Punctuation(cache).Hvo;
 }