diff --git a/CHANGELOG.md b/CHANGELOG.md index 391d360e..7fd38515 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added +- [SIL.LCModel] Add SpecificItemAndFieldName() to ISenseOrEntry - [SIL.LCModel] Added a parameter to GetBestGuess() and TryGetBestGuess() to do lowercase matching regardless of the occurrence index - [SIL.LCModel] Add GetCaptionOrHeadword() to CmPicture - [SIL.LCModel] `LCModelStrings.NotSure` to allow clients to know if a grammatical category is the placeholder diff --git a/src/SIL.LCModel/DomainImpl/OverridesLing_Lex.cs b/src/SIL.LCModel/DomainImpl/OverridesLing_Lex.cs index 1a0802ec..798fc3b3 100644 --- a/src/SIL.LCModel/DomainImpl/OverridesLing_Lex.cs +++ b/src/SIL.LCModel/DomainImpl/OverridesLing_Lex.cs @@ -10065,5 +10065,31 @@ public ILcmReferenceSequence DialectLabelsRS return sense.DialectLabelsSenseOrEntry; } } + + /// + /// There are some special cases where the value of a field cannot be obtained + /// by getting the value of fieldName on the SenseOrEntry.Item. This method accounts for + /// those special cases and returns the Item and fieldName that will need to be used to + /// get the value. If it is not a special case then the default is to return SenseOrEntry.Item + /// for specificItem and return fieldName for specificFieldName. + /// + /// The general fieldName associated with this SenseOrEntry object. + /// The specific LexSense or LexEntry item that will contain a + /// value for specificFieldName. + /// The specific field name that will need to be used to get + /// the value from the specificItem. + public void SpecificItemAndFieldName(string fieldName, out ICmObject specificObject, out string specificFieldName) + { + specificObject = Item; + specificFieldName = fieldName; + if (fieldName == "HeadWordRef" && Item is ILexSense) + { + specificFieldName = "MLOwnerOutlineName"; + } + else if (fieldName == "EntryRefsOS" && Item is ILexSense sense) + { + specificObject = sense.Entry; + } + } } } diff --git a/src/SIL.LCModel/InterfaceAdditions.cs b/src/SIL.LCModel/InterfaceAdditions.cs index 73f5835e..d23a3cc9 100644 --- a/src/SIL.LCModel/InterfaceAdditions.cs +++ b/src/SIL.LCModel/InterfaceAdditions.cs @@ -5992,5 +5992,19 @@ public interface ISenseOrEntry /// Returns the dialect labels for the entry or sense /// ILcmReferenceSequence DialectLabelsRS { get; } + + /// + /// There are some special cases where the value of a field cannot be obtained + /// by getting the value of fieldName on the SenseOrEntry.Item. This method accounts for + /// those special cases and returns the Item and fieldName that will need to be used to + /// get the value. If it is not a special case then the default is to return SenseOrEntry.Item + /// for specificItem and return fieldName for specificFieldName. + /// + /// The general fieldName associated with this SenseOrEntry object. + /// The specific LexSense or LexEntry item that will contain a + /// value for specificFieldName. + /// The specific field name that will need to be used to get + /// the value from the specificItem. + void SpecificItemAndFieldName(string fieldName, out ICmObject specificItem, out string specificFieldName); } }