Esempio n. 1
0
        protected InterlinearExporter(FdoCache cache, XmlWriter writer, int hvoRoot, InterlinLineChoices lineChoices, InterlinVc vc, ITsString tssTextName, ITsString tssTextAbbreviation)
            : base(null, cache.MainCacheAccessor, hvoRoot)
        {
            m_cache                = cache;
            m_writer               = writer;
            ktagParaSegments       = InterlinVc.ParaSegmentTag(cache);
            ktagSegmentForms       = InterlinVc.SegmentFormsTag(cache);
            m_flidStringValue      = CmBaseAnnotation.StringValuePropId(cache);
            m_lineChoices          = lineChoices;
            m_defaultGlossVirtFlid = BaseVirtualHandler.GetInstalledHandlerTag(m_cache, "WfiMorphBundle", "DefaultSense");
            m_vc = vc;
            m_tssPendingTitle      = tssTextName;
            m_tssTitleAbbreviation = tssTextAbbreviation;

            // Get morphtype information that we need later.  (plus stuff we don't...)  See LT-8288.
            IMoMorphType mmtStem;
            IMoMorphType mmtPrefix;
            IMoMorphType mmtSuffix;
            IMoMorphType mmtInfix;
            IMoMorphType mmtBoundStem;
            IMoMorphType mmtSimulfix;
            IMoMorphType mmtSuprafix;

            MoMorphType.GetMajorMorphTypes(cache, out mmtStem, out mmtPrefix, out mmtSuffix, out mmtInfix,
                                           out mmtBoundStem, out m_mmtProclitic, out m_mmtEnclitic, out mmtSimulfix, out mmtSuprafix);
        }
Esempio n. 2
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);
        }