This class exists to be the argument to RemoveObjectSideEffects, and possibly eventually to events which deal with removing objects to sequences and collections. It provides the information we have so far found to be useful, but can readily be enhanced with more. We are considering the possibility of merging this class with one of the FdoStateChange classes so that they can share all the information required to Undo the change, and thus everything required to inform anyone of what changed. We may also end up with a proper class hierarchy, too; there is a good deal of overlap with AddObjectEventArgs.
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			base.RemoveObjectSideEffectsInternal(e);
			if (!Cache.ObjectsBeingDeleted.Contains(this) &&
				e.Flid == ConstChartRowTags.kflidCells && (e.DelaySideEffects || e.ForDeletion))
			{
				DeleteMyselfIfEmpty();
			}
		}
Beispiel #2
0
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			if (e.Flid == RnResearchNbkTags.kflidRecords)
			{
				//var rec = e.ObjectRemoved as IRnGenericRec;
				//if (rec != null && rec.TextOA != null)
				//{
				//    MoveTextToLangProject(rec);
				//}
				UpdateAllRecords();
			}

			base.RemoveObjectSideEffectsInternal(e);
		}
Beispiel #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This version overrides the CmObject version. Handles various Scripture side effects
		/// and TagsOC modifications.
		/// </summary>
		/// <param name="e"></param>
		/// ------------------------------------------------------------------------------------
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			base.RemoveObjectSideEffectsInternal(e);

			//if (e.Flid == StTextTags.kflidTags)
			//    TextTagCollectionChanges(false, e.ObjectRemoved);

			if (e.Flid == StTextTags.kflidParagraphs)
			{
				if (e.ObjectRemoved is IScrTxtPara)
				{
					IScrSection section = OwnerOfClass<IScrSection>();
					if (section != null)
						((ScrSection)section).AdjustReferences((IScrTxtPara)e.ObjectRemoved);
				}

				if (e.Index == ParagraphsOS.Count - 1 && e.Index > 0)
				{
					int flid = Services.GetInstance<Virtuals>().StParaIsFinalParaInText;
					Services.GetInstance<IUnitOfWorkService>().RegisterVirtualAsModified(
						ParagraphsOS[e.Index - 1], flid, false, true);
				}
			}
		}
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			base.RemoveObjectSideEffectsInternal(e);
			if (e.Flid == ConstChartTagTags.kflidTag && e.ForDeletion)
				DeleteMyself();
		}
		/// <summary>
		/// Fixes features in dependent clauses in preparation for deleting a row.
		/// Caller guarantees that the Clause Marker pointed to more than one row, since Markers
		/// go away automatically when their 'last' row is deleted.
		/// </summary>
		/// <param name="marker"></param>
		/// <param name="e">RemoveObjectEventArgs</param>
		private static void FixAffectedClauseMarker(IConstChartClauseMarker marker, RemoveObjectEventArgs e)
		{
			// Enhance GordonM: This is another place that will need to change in the unlikely event that
			// dependent clauses can someday be non-contiguous.
			var arrayMax = marker.DependentClausesRS.Count - 1; // the new array limit
			var idelRow = e.Index;

			// Of the 2 following conditionals, only one should match, if any.

			// If the deleted reference was the first in the property,
			// move the firstDep feature to the next row in the list.
			if (idelRow == 0)
				marker.DependentClausesRS[0].StartDependentClauseGroup = true;

			// If delRow was the last reference in the property,
			// move the endDep feature to the previous row in the list.
			if (idelRow > arrayMax)
				marker.DependentClausesRS[arrayMax].EndDependentClauseGroup = true;
		}
		private void HandleDepClauseChanges(RemoveObjectEventArgs e)
		{
			var crows = DependentClausesRS.Count; // Count is after we remove this row
			if (crows == 0)
				// Not referencing anymore rows, delete self!
				((IConstChartRow) Owner).CellsOS.Remove(this);
			else
				FixAffectedClauseMarker(this, e);
		}
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			if (!Cache.ObjectsBeingDeleted.Contains(this) &&
				e.Flid == ConstChartClauseMarkerTags.kflidDependentClauses)
				HandleDepClauseChanges(e);
			base.RemoveObjectSideEffectsInternal(e);
		}
		/// <summary>
		/// Need this version, because the ICmObjectInternal.RemoveObjectSideEffects version
		/// can't be virtual, and we want subclasses to be able to override the method.
		/// </summary>
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			switch (e.Flid)
			{
				default:
					return;
				case FDO.MoMorphAdhocProhibTags.kflidRestOfMorphs: // Fall through.
				case FDO.MoMorphAdhocProhibTags.kflidMorphemes:
					break;
			}

			var gonerMsa = (IMoMorphSynAnalysis)e.ObjectRemoved;
			if (gonerMsa.CanDelete)
				((ILexEntry)gonerMsa.Owner).MorphoSyntaxAnalysesOC.Remove(gonerMsa);
		}
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			base.RemoveObjectSideEffectsInternal(e);
			if (e.Flid == MoAffixProcessTags.kflidInput && e.ForDeletion)
			{
				var ctxtOrVar = e.ObjectRemoved as IPhContextOrVar;
				foreach (var mapping in OutputOS.ToArray())
				{
					switch (mapping.ClassID)
					{
						case MoCopyFromInputTags.kClassId:
							var copy = mapping as IMoCopyFromInput;
							if (copy.ContentRA == ctxtOrVar)
								OutputOS.Remove(copy);
							break;

						case MoModifyFromInputTags.kClassId:
							var modify = mapping as IMoModifyFromInput;
							if (modify.ContentRA == ctxtOrVar)
								OutputOS.Remove(modify);
							break;
					}
				}
			}
		}
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			switch (e.Flid)
			{
				case MoInflAffMsaTags.kflidSlots:
					var target = ((IMoInflAffixSlot)e.ObjectRemoved);
					var flid = m_cache.MetaDataCache.GetFieldId2(MoInflAffixSlotTags.kClassId, "Affixes", false);

					var newGuids = (from msa in target.Affixes select msa.Guid).ToArray();

					m_cache.ServiceLocator.GetInstance<IUnitOfWorkService>().RegisterVirtualAsModified(target, flid,
						new Guid[0], newGuids);
					break;
				default:
					base.RemoveObjectSideEffectsInternal(e);
					break;
			}
		}
		/// <summary>
		/// Need this version, because the ICmObjectInternal.RemoveObjectSideEffects version
		/// can't be virtual, and we want subclasses to be able to override the method.
		/// </summary>
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			if (e.Flid != (int) FDO.MoMorphSynAnalysisTags.kflidComponents) return;

			var gonerMsa = (IMoMorphSynAnalysis)e.ObjectRemoved;
			if (gonerMsa.CanDelete)
				((ILexEntry) Owner).MorphoSyntaxAnalysesOC.Remove(gonerMsa);
		}
Beispiel #12
0
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			if (e.Flid == RnGenericRecTags.kflidSubRecords)
			{
				var notebook = OwnerOfClass<RnResearchNbk>();
				notebook.UpdateAllRecords();

				int flid = m_cache.MetaDataCache.GetFieldId2(RnGenericRecTags.kClassId, "IndexInOwnerTSS", false);
				ITsString dummy = m_cache.TsStrFactory.MakeString("", m_cache.DefaultAnalWs);
				RegisterAllSubrecordIndexTSSChanged(this.SubRecordsOS, flid, dummy);
				NoteSubrecordOfChanges(this, e.Index);
			}
			base.RemoveObjectSideEffectsInternal(e);
		}
Beispiel #13
0
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
		}
Beispiel #14
0
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			switch (e.Flid)
			{
				case TextTags.kflidGenres:
					if (ContentsOA != null)
						InternalServices.UnitOfWorkService.RegisterVirtualAsModified(ContentsOA, "GenreCategories", GenresRC.Cast<ICmObject>());
					return; // still do the default thing, base class has this property too.
			} base.RemoveObjectSideEffectsInternal(e);
		}
Beispiel #15
0
		protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
		{
			switch (e.Flid)
			{
				case WfiAnalysisTags.kflidEvaluations:
					AdjustApprovalLists((IWfiWordform)Owner);
					return;
			}
			base.RemoveObjectSideEffectsInternal(e);
		}