diff --git a/Src/Common/RootSite/CollectorEnv.cs b/Src/Common/RootSite/CollectorEnv.cs index 003356ea74..3a719844a7 100644 --- a/Src/Common/RootSite/CollectorEnv.cs +++ b/Src/Common/RootSite/CollectorEnv.cs @@ -92,6 +92,8 @@ public class StackItem public int m_tag; /// Index of the current item public int m_ihvo; + /// String properties of the current item + public Dictionary m_stringProps; /// Handles counting of previous occurrences of properties public PrevPropCounter m_cpropPrev = new PrevPropCounter(); @@ -111,6 +113,7 @@ public StackItem(int hvoOuter, int hvo, int tag, int ihvo) m_hvo = hvo; m_tag = tag; m_ihvo = ihvo; + m_stringProps = new Dictionary(); } /// -------------------------------------------------------------------------------- @@ -333,6 +336,10 @@ protected static SelLevInfo[] ConvertVwEnvStackToSelLevInfo(IList loc protected IFwMetaDataCache m_mdc = null; /// This is used to find virtual property handlers in setting notifiers. See LT-8245 protected IVwCacheDa m_cda = null; + /// + /// This is used to store string props for the next object added. + /// + protected Dictionary m_stringProps = new Dictionary(); #endregion #region Constructor @@ -843,11 +850,12 @@ public int CurrentObject() /// ------------------------------------------------------------------------------------ /// - /// Nothing to do here. None of our collectors cares about string properties (yet). + /// Save string property for the next object. /// /// ------------------------------------------------------------------------------------ public virtual void set_StringProperty(int sp, string bstrValue) { + m_stringProps[sp] = bstrValue; } /// ------------------------------------------------------------------------------------ @@ -1319,6 +1327,12 @@ public virtual void AddObj(int hvoItem, IVwViewConstructor vc, int frag) else ihvo = 0; // not a vector item. OpenTheObject(hvoItem, ihvo); + // Add any pending string props. + StackItem top = PeekStack; + if (top != null) + top.m_stringProps = m_stringProps; + // Clear pending string props. + m_stringProps = new Dictionary(); vc.Display(this, hvoItem, frag); CloseTheObject(); if (!wasPropOpen) diff --git a/Src/LexText/Interlinear/InterlinVc.cs b/Src/LexText/Interlinear/InterlinVc.cs index e756c655ff..63c24c24b2 100644 --- a/Src/LexText/Interlinear/InterlinVc.cs +++ b/Src/LexText/Interlinear/InterlinVc.cs @@ -101,7 +101,7 @@ public class InterlinVc : FwBaseVc, IDisposable internal const int ktagSegmentFree = -61; internal const int ktagSegmentLit = -62; internal const int ktagSegmentNote = -63; - internal const int ktagGuessedAnalysis = -64; + internal const int ktagAnalysisStatus = -64; // flids for paragraph annotation sequences. internal int ktagSegmentForms; @@ -1822,7 +1822,7 @@ private void DisplayMorphemes() (int) AnalysisGuessServices.OpinionAgent.Parser; m_this.SetGuessing(m_vwenv, isHumanGuess ? ApprovedGuessColor : MachineGuessColor); // Let the exporter know that this is a guessed analysis. - m_vwenv.AddProp(ktagGuessedAnalysis, m_this, 0); + m_vwenv.set_StringProperty(ktagAnalysisStatus, "guess"); } m_vwenv.AddObj(m_hvoDefault, m_this, kfragAnalysisMorphs); } @@ -1838,7 +1838,7 @@ private void DisplayMorphemes() // Real analysis is just word, one we're displaying is a default m_this.SetGuessing(m_vwenv); // Let the exporter know that this is a guessed analysis. - m_vwenv.AddProp(ktagGuessedAnalysis, m_this, 0); + m_vwenv.set_StringProperty(ktagAnalysisStatus, "guess"); } m_vwenv.AddObj(m_hvoWfiAnalysis, m_this, kfragAnalysisMorphs); } diff --git a/Src/LexText/Interlinear/InterlinearExporter.cs b/Src/LexText/Interlinear/InterlinearExporter.cs index 9d7c4b8e6b..e0524ff75c 100644 --- a/Src/LexText/Interlinear/InterlinearExporter.cs +++ b/Src/LexText/Interlinear/InterlinearExporter.cs @@ -33,7 +33,6 @@ public class InterlinearExporter : CollectorEnv bool m_fDoingInterlinName = false; // true during MSA bool m_fDoingGlossPrepend = false; // true after special AddProp bool m_fDoingGlossAppend = false; // true after special AddProp - bool m_fDoingGuessedAnalysis = false; // true after special AddProp string m_sPendingPrefix; // got a prefix, need the ws from the form itself before we write it. string m_sFreeAnnotationType; ITsString m_tssPendingHomographNumber; @@ -389,11 +388,6 @@ public override void AddObj(int hvoItem, IVwViewConstructor vc, int frag) public override void AddProp(int tag, IVwViewConstructor vc, int frag) { - if (tag == InterlinVc.ktagGuessedAnalysis) - { - m_fDoingGuessedAnalysis = true; - return; - } if (tag == InterlinVc.ktagGlossPrepend) { m_fDoingGlossPrepend = true; @@ -608,16 +602,15 @@ public override void AddObjVecItems(int tag, IVwViewConstructor vc, int frag) break; case InterlinVc.kfragMorphBundle: m_writer.WriteStartElement("morphemes"); - if (m_fDoingGuessedAnalysis) + StackItem top = this.PeekStack; + if (top != null && top.m_stringProps.ContainsKey(InterlinVc.ktagAnalysisStatus)) { - m_writer.WriteAttributeString("analysisStatus", "guess"); + m_writer.WriteAttributeString("analysisStatus", top.m_stringProps[InterlinVc.ktagAnalysisStatus]); } break; default: break; } - // Clear here instead of above just to make sure it gets cleared. - m_fDoingGuessedAnalysis = false; base.AddObjVecItems (tag, vc, frag); switch(frag) {