private void DeleteCharts(int hvoStText, Set <int> objectsToDeleteAlso, SIL.FieldWorks.Common.Controls.ProgressState state) { // Enhance GordonM: When we add other subclasses of DsChart, we'll need to delete them too. if (m_cache.LangProject.DiscourseDataOA == null) { return; } if (m_cache.LangProject.DiscourseDataOA.ChartsOC == null) { return; } if (m_cache.LangProject.DiscourseDataOA.ChartsOC.Count == 0) { return; } state.SetMilestone(Strings.ksDeletingCharts); foreach (DsConstChart chart in m_cache.LangProject.DiscourseDataOA.ChartsOC) { if (chart.BasedOnRAHvo == hvoStText) { // We've found a chart on the Text that's going away. foreach (CmIndirectAnnotation ccr in chart.RowsRS) { objectsToDeleteAlso.AddRange(ccr.AppliesToRS.HvoArray); objectsToDeleteAlso.Add(ccr.Hvo); } objectsToDeleteAlso.Add(chart.Hvo); state.Breath(); } } }
/// <summary> /// we want to delete the owning Text if we delete its StText /// </summary> /// <param name="objectsToDeleteAlso"></param> /// <param name="state"></param> public override void DeleteObjectSideEffects(SIL.FieldWorks.Common.Utils.Set <int> objectsToDeleteAlso, SIL.FieldWorks.Common.Controls.ProgressState state) { if (this.OwningFlid == (int)FDO.Ling.Text.TextTags.kflidContents) { objectsToDeleteAlso.Add(this.OwnerHVO); // delete the owning Text as well. DeleteCharts(this.Hvo, objectsToDeleteAlso, state); } // Wasn't sure we wanted to delete the owning ScrSection in this case. if (this.OwningFlid == kflidScrSectContent) { DeleteCharts(this.Hvo, objectsToDeleteAlso, state); } base.DeleteObjectSideEffects(objectsToDeleteAlso, state); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Override to make sure any CmFiles that are only there only for this picture are /// deleted as well /// </summary> /// ------------------------------------------------------------------------------------ public override void DeleteObjectSideEffects(Set <int> objectsToDeleteAlso, SIL.FieldWorks.Common.Controls.ProgressState state) { ICmFile cmFile = PictureFileRA; // Check to make sure there is a picture file associated with this picture and that the only thing that CmFile is // around for is to provide a file for this picture. Checking that the backreference of the file that this picture // uses is 1 is a valid way to make sure of this. // If this CmFile serves no other purpose, we should get rid of it. if (cmFile != null && cmFile.BackReferences.Count == 1) { objectsToDeleteAlso.Add(cmFile.Hvo); } base.DeleteObjectSideEffects(objectsToDeleteAlso, state); }