/// <summary>Handle possible homograph number changes:
        /// 1. Possibly remove homograph from original citation form.
        /// 2. Possibly add homograph for new citation form.
        /// </summary>
        public void Fixup(bool fRefreshList)
        {
            CheckDisposed();

            Debug.Assert(m_rie != null);

            if (!m_rie.IsValidObject)
            {
                // If our old entry isn't even valid any more, something has deleted it,
                // and whatever did so should have fixed up the list. We really don't want
                // to reload the whole thing if we don't need to (takes ages in a big lexicon),
                // so do nothing...JohnT
                return;
            }

            int    ws          = m_rie.Services.WritingSystemManager.GetWsFromStr(m_rie.ReversalIndex.WritingSystem);
            string currentForm = m_rie.ReversalForm.get_String(ws).Text;

            if (currentForm == m_originalForm)
            {
                return;                 // No relevant changes, so do nothing.
            }
            // Fix it so that another call will do the right thing.
            m_originalForm = currentForm;

            if (fRefreshList && m_rlu != null)
            {
                m_rlu.UpdateList(false);
            }
        }
        /// <summary></summary>
        public void Setup(object o, IRecordListUpdater rlu)
        {
            CheckDisposed();

            Debug.Assert(o != null && o is IReversalIndexEntry);
            IReversalIndexEntry rie = o as IReversalIndexEntry;

            if (m_rlu == null && rlu != null && m_rie == rie)
            {
                m_rlu = rlu;
                m_rlu.RecordChangeHandler = this;
                m_rlu.UpdateList(true);
            }
            else
            {
                m_rie = rie;
                Debug.Assert(m_rie != null);
                int ws = m_rie.Services.WritingSystemManager.GetWsFromStr(m_rie.ReversalIndex.WritingSystem);
                m_originalForm = m_rie.ReversalForm.get_String(ws).Text;
                if (rlu != null)
                {
                    m_rlu = rlu;
                    m_rlu.RecordChangeHandler = this;
                }
            }
        }
        /// <summary></summary>
        public void Setup(object o, IRecordListUpdater rlu)
        {
            CheckDisposed();

            Debug.Assert(o != null && o is ReversalIndexEntry);
            ReversalIndexEntry rie = o as ReversalIndexEntry;

            if (m_rlu == null && rlu != null && m_rie == rie)
            {
                m_rlu = rlu;
                m_rlu.RecordChangeHandler = this;
                m_rlu.UpdateList(true);
            }
            else
            {
                m_rie = rie;
                Debug.Assert(m_rie != null);
                int ws = m_rie.ReversalIndex.WritingSystemRAHvo;
                m_originalForm = m_rie.ReversalForm.GetAlternative(ws);
                if (rlu != null)
                {
                    m_rlu = rlu;
                    m_rlu.RecordChangeHandler = this;
                }
            }
        }
        /// <summary>Handle possible homograph number changes:
        /// 1. Possibly remove homograph from original citation form.
        /// 2. Possibly add homograph for new citation form.
        /// </summary>
        public void Fixup(bool fRefreshList)
        {
            CheckDisposed();

            Debug.Assert(m_le != null);
            if (m_le.IsValidObject())
            {
                string currentHomographForm = m_le.HomographForm;
                int    currentMorphType     = m_le.MorphType;
                if (currentHomographForm == m_originalHomographForm &&
                    currentMorphType == m_originalMorphType)
                {
                    // No relevant changes, so do nothing.
                    return;
                }

                List <ILexEntry> ieAllEntries = new List <ILexEntry>(m_le.Cache.LangProject.LexDbOA.EntriesOC.ToArray());
                // Reset any homograph numbers associated with the old form.
                // This version of CollectHomographs will exclude m_le,
                // which means all the old homographs of the entry will be renumbered.
                List <ILexEntry> homographs = LexEntry.CollectHomographs(m_originalHomographForm,
                                                                         0, // Collect all of them.
                                                                         ieAllEntries,
                                                                         m_originalMorphType);
                LexEntry.ValidateExistingHomographs(homographs);
                // Set any homograph numbers associated with the new form,
                // and include m_le in the renumbering.
                homographs = LexEntry.CollectHomographs(currentHomographForm,
                                                        0, // Collect all of them.
                                                        ieAllEntries,
                                                        currentMorphType);
                LexEntry.ValidateExistingHomographs(homographs);

                // Fix it so that another call will do the right thing.
                m_originalHomographForm = currentHomographForm;
                m_originalMorphType     = currentMorphType;
            }
            else
            {
                // If our old entry isn't even valid any more, something has deleted it,
                // and whatever did so should have fixed up the list. We really don't want
                // to reload the whole thing if we don't need to (takes ages in a big lexicon),
                // so do nothing...JohnT
                return;
            }
            if (fRefreshList && m_rlu != null)
            {
                m_rlu.UpdateList(false);
            }
        }
		/// <summary></summary>
		public void Setup(object o, IRecordListUpdater rlu)
		{
			CheckDisposed();

			Debug.Assert(o != null && o is IReversalIndexEntry);
			IReversalIndexEntry rie = o as IReversalIndexEntry;
			if (m_rlu == null && rlu != null && m_rie == rie)
			{
				m_rlu = rlu;
				m_rlu.RecordChangeHandler = this;
				m_rlu.UpdateList(true);
			}
			else
			{
				m_rie = rie;
				Debug.Assert(m_rie != null);
				int ws = m_rie.Services.WritingSystemManager.GetWsFromStr(m_rie.ReversalIndex.WritingSystem);
				m_originalForm = m_rie.ReversalForm.get_String(ws).Text;
				if (rlu != null)
				{
					m_rlu = rlu;
					m_rlu.RecordChangeHandler = this;
				}
			}
		}
		/// <summary></summary>
		public void Setup(object o, IRecordListUpdater rlu)
		{
			CheckDisposed();

			Debug.Assert(o != null && o is ReversalIndexEntry);
			ReversalIndexEntry rie = o as ReversalIndexEntry;
			if (m_rlu == null && rlu != null && m_rie == rie)
			{
				m_rlu = rlu;
				m_rlu.RecordChangeHandler = this;
				m_rlu.UpdateList(true);
			}
			else
			{
				m_rie = rie;
				Debug.Assert(m_rie != null);
				int ws = m_rie.ReversalIndex.WritingSystemRAHvo;
				m_originalForm = m_rie.ReversalForm.GetAlternative(ws);
				if (rlu != null)
				{
					m_rlu = rlu;
					m_rlu.RecordChangeHandler = this;
				}
			}
		}