本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.GetOwnerOfObject方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.GetOwnerOfObject方法的具体用法?C# FdoCache.GetOwnerOfObject怎么用?C# FdoCache.GetOwnerOfObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.GetOwnerOfObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWfiAnalysisFromWficInstanceOf
private static int GetWfiAnalysisFromWficInstanceOf(FdoCache cache, int hvoInstanceOf, out int hvoWordform)
{
hvoWordform = 0;
int hvoWfiAnalysis = 0;
int classid = cache.GetClassOfObject(hvoInstanceOf);
switch (classid)
{
case WfiWordform.kclsidWfiWordform:
hvoWordform = hvoInstanceOf;
return 0; // need use or make a guess for analysis
case WfiAnalysis.kclsidWfiAnalysis:
hvoWfiAnalysis = hvoInstanceOf;
break;
case WfiGloss.kclsidWfiGloss:
hvoWfiAnalysis = cache.GetOwnerOfObject(hvoInstanceOf);
break;
default:
throw new ArgumentException("cba.InstanceOf(" + hvoInstanceOf + ") class(" +
classid + ") is not WfiWordform, WfiAnalysis, or WfiGloss.");
}
return hvoWfiAnalysis;
}
示例2: RefreshCacheForParagraph
/// ------------------------------------------------------------------------------------
/// <summary>
/// Refreshes cache for all footnotes in the StText containing the paragraph. We only
/// use this method when verses of a paragraph are changed - this will only happen on
/// content paragraphs of a ScrSection.
/// </summary>
/// <param name="cache"></param>
/// <param name="hvoObj"></param>
/// ------------------------------------------------------------------------------------
internal static void RefreshCacheForParagraph(FdoCache cache, int hvoObj)
{
int hvoPara = hvoObj;
if (cache.GetClassOfObject(hvoObj) == CmTranslation.kClassId)
hvoPara = cache.GetOwnerOfObject(hvoObj);
int hvoText = cache.GetOwnerOfObject(hvoPara);
IStText text = new StText(cache, hvoText);
ScrSection section = new ScrSection(cache, text.OwnerHVO);
BCVRef verseRef = new BCVRef(section.VerseRefStart);
Dictionary<int, FootnoteHashEntry> dict;
// Don't bother on empty cache - it will be created when needed. Need to use HVO to get GUID so we
// don't create the book and potentially cause the refresh routine to be called.
Guid bookGuid = cache.GetGuidFromId(section.OwnerHVO);
if (!cache.TryGetHashtable<int, FootnoteHashEntry>(bookGuid, out dict) ||
dict.Count == 0)
{
return;
}
AddFootnoteRefsInText(text, dict, ref verseRef);
}
示例3: GetWordformFromWag
/// <summary>
/// Get a wordform from an HVO that may be a WfiWordform, WfiAnalysis, or WfiGloss (or 0).
/// Answer 0 if arguent is zero, fail if it is some other class.
/// </summary>
public static int GetWordformFromWag(FdoCache cache, int cbaInstanceOf)
{
int hvoWordform = 0;
if (cbaInstanceOf != 0)
{
int classid = cache.GetClassOfObject(cbaInstanceOf);
switch (classid)
{
case WfiWordform.kclsidWfiWordform:
hvoWordform = cbaInstanceOf;
break;
case WfiAnalysis.kclsidWfiAnalysis:
hvoWordform = cache.GetOwnerOfObject(cbaInstanceOf);
break;
case WfiGloss.kclsidWfiGloss:
int hvoAnalysis = cache.GetOwnerOfObject(cbaInstanceOf);
hvoWordform = cache.GetOwnerOfObject(hvoAnalysis);
break;
default:
Debug.Fail("Actual cba (" + cbaInstanceOf + "): Class of InstanceOf (" +
classid + ") is not WfiWordform, WfiAnalysis, or WfiGloss.");
break;
}
}
return hvoWordform;
}
示例4: CheckAndReportBadDiscourseTemplateMove
/// <summary>
/// Checks for and reports any disallowed discourse template moves.
/// </summary>
/// <param name="cache"></param>
/// <param name="movingColumn">The proposed possibility item (template column) to move.</param>
/// <param name="hvoTemplate">The hvo of the affected Chart Template (only 'default' exists so far).</param>
/// <param name="hvoTemplateList">The hvo of the Template List.</param>
/// <param name="hvoDest">The hvo of the destination item.</param>
/// <returns>true means we found and reported a bad move.</returns>
private bool CheckAndReportBadDiscourseTemplateMove(FdoCache cache, CmPossibility movingColumn, int hvoTemplate,
int hvoTemplateList, int hvoDest)
{
// First, check whether we're allowed to manipulate this column at all. This is the same check as
// whether we're allowed to delete it.
if (movingColumn.CheckAndReportProtectedChartColumn())
return true;
// Other things being equal, we now need to make sure we aren't messing up the chart levels
// Unless something is badly wrong, the destination is either the root template,
// a column group one level down from the root template, a column two levels down,
// or the base list.
if (hvoDest == hvoTemplateList)
{
MessageBox.Show(m_tree, xWorksStrings.ksCantPromoteGroupToTemplate,
xWorksStrings.ksProhibitedMovement, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return true;
}
// if the destination IS the root, that's fine...anything can move there.
if (hvoDest == hvoTemplate)
return false;
// It's OK to move a leaf to a group (one level down from the root, as long as
// the destination 'group' isn't a column that's in use.
bool moveColumnIsLeaf = movingColumn.SubPossibilitiesOS.Count == 0;
if (cache.GetOwnerOfObject(hvoDest) == hvoTemplate && moveColumnIsLeaf)
{
CmPossibility dest = (CmPossibility.CreateFromDBObject(cache, hvoDest))
as CmPossibility;
// If it isn't already a group, we can only turn it into one if it's empty
if (dest.SubPossibilitiesOS.Count == 0)
return dest.CheckAndReportProtectedChartColumn();
// If it's already a group it should be fine as a destination.
return false;
}
// Anything else represents an attempt to make the tree too deep, e.g., moving a
// column into child column, or a group into another group.
MessageBox.Show(m_tree, xWorksStrings.ksTemplateTooDeep,
xWorksStrings.ksProhibitedMovement, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return true;
}
示例5: FullyAnalyzed
// Is hvoAnn, currently analyzed as hvoAnalysis, fully analyzed?
// This means:
// -- it isn't a default (property InterlinVc.m_vc.ktagTwficDefault isn't cached)
// -- It's a WfiGloss, with non-empty form.
// -- Owner is a WfiAnalysis with non-empty Category.
// -- Owner has at least one WfiMorphBundle.
// -- For each WfiMorphBundle, Form, Msa, and Sense are all filled in.
// Alternatively, if hvoAnalysis is zero, the annotation is punctuation, which we don't analyze further;
// so return true to indicate that it needs no further attention.
internal bool FullyAnalyzed(FdoCache fdoCache, WsListManager listman, int hvoAnn, int hvoAnalysis)
{
int ktagTwficDefault = StTxtPara.TwficDefaultFlid(fdoCache);
if (hvoAnalysis == 0)
return true; // punctuation, treat as fully analyzed.
ISilDataAccess sda = fdoCache.MainCacheAccessor;
// Check for default. If the analysis we're showing is a default it needs at least confirmation.
if (sda.get_IsPropInCache(hvoAnn, ktagTwficDefault, (int)CellarModuleDefns.kcptReferenceAtom, 0)
&& sda.get_ObjectProp(hvoAnn, ktagTwficDefault) != 0)
return false;
int analysisClass = fdoCache.GetClassOfObject(hvoAnalysis);
if (analysisClass != (int)WfiGloss.kclsidWfiGloss && analysisClass != (int)WfiAnalysis.kclsidWfiAnalysis)
return false; // Has to BE an analysis...unless pathologically everything is off? Too bad if so...
int hvoWfiAnalysis = fdoCache.GetOwnerOfObject(hvoAnalysis);
int hvoWordform;
if (analysisClass == (int)WfiAnalysis.kclsidWfiAnalysis)
{
hvoWordform = hvoWfiAnalysis;
hvoWfiAnalysis = hvoAnalysis;
}
else
{
hvoWordform = fdoCache.GetOwnerOfObject(hvoWfiAnalysis);
}
foreach (InterlinLineSpec spec in m_vc.LineChoices)
{
// see if the information required for this linespec is present.
switch (spec.Flid)
{
case InterlinLineChoices.kflidWord:
int ws = m_vc.GetRealWs(hvoWordform, spec);
if (sda.get_MultiStringAlt(hvoWordform, (int)WfiWordform.WfiWordformTags.kflidForm, ws).Length == 0)
return false;
break;
case InterlinLineChoices.kflidLexEntries:
if (!CheckPropSetForAllMorphs(sda, hvoWfiAnalysis, (int)WfiMorphBundle.WfiMorphBundleTags.kflidMorph))
return false;
break;
case InterlinLineChoices.kflidMorphemes:
if (!CheckPropSetForAllMorphs(sda, hvoWfiAnalysis, (int)WfiMorphBundle.WfiMorphBundleTags.kflidMorph))
return false;
break;
case InterlinLineChoices.kflidLexGloss:
if (!CheckPropSetForAllMorphs(sda, hvoWfiAnalysis, (int)WfiMorphBundle.WfiMorphBundleTags.kflidSense))
return false;
break;
case InterlinLineChoices.kflidLexPos:
if (!CheckPropSetForAllMorphs(sda, hvoWfiAnalysis, (int)WfiMorphBundle.WfiMorphBundleTags.kflidMsa))
return false;
break;
case InterlinLineChoices.kflidWordGloss:
// If it isn't a WfiGloss the user needs a chance to supply a word gloss.
if (analysisClass != WfiGloss.kclsidWfiGloss)
return false;
// If it is empty for the (possibly magic) ws specified here, it needs filling in.
int ws1 = m_vc.GetRealWs(hvoAnalysis, spec);
if (sda.get_MultiStringAlt(hvoAnalysis, (int)WfiGloss.WfiGlossTags.kflidForm, ws1).Length == 0)
return false;
break;
case InterlinLineChoices.kflidWordPos:
if (sda.get_ObjectProp(hvoWfiAnalysis, (int)WfiAnalysis.WfiAnalysisTags.kflidCategory) == 0)
return false;
break;
case InterlinLineChoices.kflidFreeTrans:
case InterlinLineChoices.kflidLitTrans:
case InterlinLineChoices.kflidNote:
default:
// unrecognized or non-word-level annotation, nothing required.
break;
}
}
return true; // If we can't find anything to complain about, it's fully analyzed.
}
示例6: GetSomeSlots
/// <summary>
/// Get a set of inflectional affix slots which can be prefixal or suffixal
/// </summary>
/// <param name="cache"></param>
/// <param name="allSlots">Original set of all slots</param>
/// <param name="fLookForPrefixes">whether to look for prefixal slots</param>
/// <returns>subset of slots that are either prefixal or suffixal</returns>
public static Set<int> GetSomeSlots(FdoCache cache, Set<int> allSlots, bool fLookForPrefixes)
{
Set<int> set = new Set<int>();
//Set<int> allSlots = GetAllSlots();
foreach (int hvoSlot in allSlots)
{
MoInflAffixSlot slot = CmObject.CreateFromDBObject(cache, hvoSlot) as MoInflAffixSlot;
if (slot == null)
continue;
bool fStopLooking = false;
List<int> hvosAffixes = slot.Affixes;
if (hvosAffixes.Count == 0)
{ // no affixes in this slot, so include it
set.Add(hvoSlot);
continue;
}
foreach (int hvoMsa in hvosAffixes)
{
int hvoLex = cache.GetOwnerOfObject(hvoMsa);
LexEntry lex = CmObject.CreateFromDBObject(cache, hvoLex) as LexEntry;
List<IMoMorphType> morphTypes = lex.MorphTypes;
foreach (IMoMorphType morphType in morphTypes)
{
bool fIsCorrectType;
if (fLookForPrefixes)
fIsCorrectType = MoMorphType.IsPrefixishType(cache, morphType.Hvo);
else
fIsCorrectType = MoMorphType.IsSuffixishType(cache, morphType.Hvo);
if (fIsCorrectType)
{
set.Add(hvoSlot);
fStopLooking = true;
break;
}
}
if (fStopLooking)
break;
}
}
return set;
}
示例7: CheckAndReportBadTagListMove
/// <summary>
/// Checks for and reports any disallowed tag list moves.
/// </summary>
/// <param name="cache"></param>
/// <param name="movingTagItem">The proposed tag item to move.</param>
/// <param name="hvoSubListRoot">The hvo of the top-level Tag Type Possibility containing the moving item.</param>
/// <param name="hvoMainTagList">The hvo of the main PossiblityList grouping all TextMarkup Tags.</param>
/// <param name="hvoDest">The hvo of the destination tag item.</param>
/// <returns>true if we found and reported a bad move.</returns>
private bool CheckAndReportBadTagListMove(FdoCache cache, CmPossibility movingTagItem, int hvoSubListRoot,
int hvoMainTagList, int hvoDest)
{
// Check if movingTagItem is a top-level Tag Type.
if (movingTagItem.Hvo == hvoSubListRoot)
{
if (hvoDest == hvoMainTagList) // top-level Tag Type can move to main list (probably already there)
return false;
// The moving item is a top-level Tag Type, it cannot be demoted.
MessageBox.Show(m_tree, xWorksStrings.ksCantDemoteTagList,
xWorksStrings.ksProhibitedMovement, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return true;
}
// Unless something is badly wrong, the destination is either the tag type root,
// a tag one level down from the root, or the base list.
if (cache.GetOwnerOfObject(hvoDest) == hvoMainTagList)
{
// Destination is Tag Type root, not a problem
return false;
}
if (hvoDest == hvoMainTagList)
{
// Can't promote tag to Tag Type root
MessageBox.Show(m_tree, xWorksStrings.ksCantPromoteTag,
xWorksStrings.ksProhibitedMovement, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return true;
}
// This would give us hierarchy too deep (at least for now)
MessageBox.Show(m_tree, xWorksStrings.ksTagListTooDeep,
xWorksStrings.ksProhibitedMovement, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return true;
}
示例8: GetParentOfClass
public static int GetParentOfClass(FdoCache m_cache, int hvo, int classIdOfParentToSearchFor)
{
//save the caller the need to see if this property was empty or not
if(hvo <1)
return -1;
int classId = m_cache.GetClassOfObject(hvo) ;
while((!m_cache.IsSameOrSubclassOf(classId,classIdOfParentToSearchFor))
&& (classId != FDO.LangProj.LangProject.kClassId))
{
hvo = m_cache.GetOwnerOfObject(hvo);
classId = m_cache.GetClassOfObject(hvo) ;
}
if((!m_cache.IsSameOrSubclassOf(classId,classIdOfParentToSearchFor)))
return -1;
else
return hvo;
}
示例9: IsScripturePara
/// <summary>
/// Test whether a particular StTxtPara is part of Scripture.
/// </summary>
/// <param name="hvoPara"></param>
/// <param name="cache"></param>
/// <returns></returns>
public static bool IsScripturePara(int hvoPara, FdoCache cache)
{
int flidOfOwnerOfSttext = cache.GetOwningFlidOfObject(cache.GetOwnerOfObject(hvoPara));
return Scripture.Scripture.IsScriptureTextFlid(flidOfOwnerOfSttext);
}
示例10: GetPrimaryOrOwningEntry
/// <summary>
/// for variant relationships, return the primary entry
/// (of which this morph is a variant). Otherwise,
/// return the owning entry of the morph.
/// </summary>
/// <param name="cache"></param>
/// <returns></returns>
public int GetPrimaryOrOwningEntry(FdoCache cache)
{
int hvoMorphEntryReal;
if (m_hvoEntry != 0)
{
// for variant relationships, we want to allow trying to create a
// new sense on the entry of which we are a variant.
hvoMorphEntryReal = m_hvoEntry;
}
else
{
hvoMorphEntryReal = cache.GetOwnerOfObject(m_hvoMorph);
}
return hvoMorphEntryReal;
}
示例11: CheckAndReportBadDiscourseTemplateAdd
private static bool CheckAndReportBadDiscourseTemplateAdd(FdoCache cache, int hvoItem, int hvoRootItem, int hvoList)
{
if (cache.GetOwningFlidOfObject(hvoList) != (int)DsDiscourseData.DsDiscourseDataTags.kflidConstChartTempl)
return false; // some other list we don't care about.
// We can't turn a column into a group if it's in use.
CmPossibility col = CmPossibility.CreateFromDBObject(cache, hvoItem) as CmPossibility;
// If the item doesn't already have children, we can only add them if it isn't already in use
// as a column: we don't want to change a column into a group. Thus, if there are no
// children, we generally call the same routine as when deleting.
// However, that routine has a special case to prevent deletion of the default template even
// if NOT in use...and we must not prevent adding to that when it is empty! Indeed any
// empty CHART can always be added to, so only if col's owner is a CmPossibility (it's not a root
// item in the templates list) do we need to check for it being in use.
if (col.SubPossibilitiesOS.Count == 0 && col.Owner is CmPossibility && col.CheckAndReportProtectedChartColumn())
return true;
// Finally, we have to confirm the two-level rule.
if (hvoItem != hvoRootItem && cache.GetOwnerOfObject(hvoItem) != hvoRootItem)
{
MessageBox.Show(FdoUiStrings.ksTemplateTooDeep,
FdoUiStrings.ksHierarchyLimit, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return true;
}
return false;
}
示例12: MakeAnalysisStringRep
// Make a string representing a WfiAnalysis, suitable for use in a combo box item.
static internal ITsString MakeAnalysisStringRep(int hvoWa, FdoCache fdoCache, bool fUseStyleSheet, int wsVern)
{
// ITsTextProps boldItalicAnalysis = BoldItalicAnalysis(fdoCache);
// ITsTextProps italicAnalysis = ItalicAnalysis(fdoCache, Sandbox.SandboxVc.krgbRed);
ITsTextProps posTextProperties = PartOfSpeechTextProperties(fdoCache, true, fUseStyleSheet);
ITsTextProps formTextProperties = FormTextProperties(fdoCache, fUseStyleSheet, wsVern);
ITsTextProps glossTextProperties = GlossTextProperties(fdoCache, true, fUseStyleSheet);
ITsStrBldr tsb = TsStrBldrClass.Create();
ISilDataAccess sda = fdoCache.MainCacheAccessor;
int cmorph = fdoCache.GetVectorSize(hvoWa,
(int)WfiAnalysis.WfiAnalysisTags.kflidMorphBundles);
if (cmorph == 0)
return fdoCache.MakeUserTss(ITextStrings.ksNoMorphemes);
bool fRtl = fdoCache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(wsVern).RightToLeft;
int start = 0;
int lim = cmorph;
int increment = 1;
if (fRtl)
{
start = cmorph - 1;
lim = -1;
increment = -1;
}
for (int i = start; i != lim; i += increment)
{
int hvoMb = fdoCache.GetVectorItem(hvoWa,
(int)WfiAnalysis.WfiAnalysisTags.kflidMorphBundles, i);
int hvoMf = fdoCache.GetObjProperty(hvoMb,
(int)WfiMorphBundle.WfiMorphBundleTags.kflidMorph);
ITsString tssForm = null;
if (hvoMf != 0)
{
int hvoEntry = fdoCache.GetOwnerOfObject(hvoMf);
int hvoLexemeForm = sda.get_ObjectProp(hvoEntry, (int) LexEntry.LexEntryTags.kflidLexemeForm);
if (hvoLexemeForm != 0)
{
tssForm = sda.get_MultiStringAlt(hvoLexemeForm, (int) MoForm.MoFormTags.kflidForm, wsVern);
}
if (tssForm == null || tssForm.Length == 0)
{
tssForm = fdoCache.MainCacheAccessor.get_MultiStringAlt(hvoEntry,
(int)LexEntry.LexEntryTags.kflidCitationForm, wsVern);
}
if (tssForm.Length == 0)
{
// If there isn't a lexeme form OR citation form use the form of the morph.
tssForm = fdoCache.MainCacheAccessor.get_MultiStringAlt(hvoMf,
(int)MoForm.MoFormTags.kflidForm, wsVern);
}
}
else // no MoForm linked to this bundle, use its own form.
{
tssForm = fdoCache.MainCacheAccessor.get_MultiStringAlt(hvoMb,
(int)WfiMorphBundle.WfiMorphBundleTags.kflidForm, wsVern);
}
int ichForm = tsb.Length;
tsb.ReplaceTsString(ichForm, ichForm, tssForm);
tsb.SetProperties(ichForm, tsb.Length,formTextProperties);
// add category (part of speech)
int hvoMsa = fdoCache.GetObjProperty(hvoMb,
(int)WfiMorphBundle.WfiMorphBundleTags.kflidMsa);
tsb.Replace(tsb.Length, tsb.Length, " ", null);
int ichMinMsa = tsb.Length;
string interlinName = ksMissingString;
if (hvoMsa != 0)
{
IMoMorphSynAnalysis msa =
MoMorphSynAnalysis.CreateFromDBObject(fdoCache, hvoMsa);
interlinName = msa.InterlinearAbbr;
}
tsb.Replace(ichMinMsa, ichMinMsa, interlinName, posTextProperties);
//add sense
int hvoSense = fdoCache.GetObjProperty(hvoMb,
(int)WfiMorphBundle.WfiMorphBundleTags.kflidSense);
tsb.Replace(tsb.Length, tsb.Length, " ", null);
int ichMinSense = tsb.Length;
if (hvoSense != 0)
{
ITsString tssGloss = fdoCache.MainCacheAccessor.get_MultiStringAlt(hvoSense,
(int)LexSense.LexSenseTags.kflidGloss, fdoCache.DefaultAnalWs);
tsb.Replace(ichMinSense, ichMinSense, tssGloss.Text, glossTextProperties);
}
else
tsb.Replace(ichMinSense, ichMinSense, ksMissingString, glossTextProperties);
// Enhance JohnT: use proper seps.
tsb.Replace(tsb.Length, tsb.Length, ksPartSeparator, null);
}
// Delete the final separator. (Enhance JohnT: this needs to get smarter when we do
// real seps.)
int ichFrom = tsb.Length - ksPartSeparator.Length;
if (ichFrom < 0)
ichFrom = 0;
tsb.Replace(ichFrom, tsb.Length, "", null);
return tsb.GetString();
}
示例13: MakeGlossStringRep
// Generate a suitable string representation of a WfiGloss.
// Todo: finish implementing (add the gloss!)
static internal ITsString MakeGlossStringRep(int hvoGloss, FdoCache fdoCache, bool fUseStyleSheet)
{
ITsStrBldr tsb = TsStrBldrClass.Create();
int hvoWa = fdoCache.GetOwnerOfObject(hvoGloss);
int hvoCategory = fdoCache.GetObjProperty(hvoWa,
(int)WfiAnalysis.WfiAnalysisTags.kflidCategory);
if(hvoCategory > 0)
{
ITsString tssPos = fdoCache.MainCacheAccessor.get_MultiStringAlt(hvoCategory,
(int)CmPossibility.CmPossibilityTags.kflidAbbreviation,
fdoCache.DefaultAnalWs);
tsb.Replace(0, 0, tssPos.Text,
PartOfSpeechTextProperties(fdoCache,false, fUseStyleSheet));
}
else
{
tsb.Replace(0, 0, ksMissingString,
PartOfSpeechTextProperties(fdoCache,false, fUseStyleSheet));
}
tsb.Replace(tsb.Length, tsb.Length, " ", null);
tsb.Replace(tsb.Length, tsb.Length,
fdoCache.MainCacheAccessor.get_MultiStringAlt(hvoGloss,
(int)WfiGloss.WfiGlossTags.kflidForm, fdoCache.DefaultAnalWs).Text,
GlossTextProperties(fdoCache, false, fUseStyleSheet));
//indent
tsb.Replace(0,0, " ", null);
return tsb.GetString();
}
示例14: GetParagraphIndexForAnnotation
static internal int GetParagraphIndexForAnnotation(FdoCache cache, int annHvo)
{
int hvoPara = cache.MainCacheAccessor.get_ObjectProp(annHvo, (int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginObject);
int hvoStText = cache.GetOwnerOfObject(hvoPara);
return GetParagraphIndexForPara(cache, hvoStText, hvoPara);
}
示例15: IndexOfChildOf
/// <summary>
/// get the index of an item in the list that has a root object that is owned by hvo
/// </summary>
/// <param name="hvo"></param>
/// <returns>-1 if the object is not in the list</returns>
public int IndexOfChildOf(int hvoTarget, FdoCache cache)
{
CheckDisposed();
int i = 0;
foreach (ManyOnePathSortItem item in SortedObjects)
{
ICmObject orange = item.RootObject;
for (int hvoOwner = cache.GetOwnerOfObject(orange.Hvo);
hvoOwner != 0;
hvoOwner = cache.GetOwnerOfObject(hvoOwner))
{
if (hvoOwner == hvoTarget)
return i;
}
++i;
}
return -1;
}