Ejemplo n.º 1
0
		int InsertContext(IPhContextOrVar ctxtOrVar, int fsFlid, int fsHvo, SelectionHelper sel, out int cellIndex)
		{
			m_removeColHvo = 0;
			int cellId = GetCell(sel);
			switch (cellId)
			{
				case AffixRuleFormulaVc.ktagLeftEmpty:
					Rule.InputOS.InsertAt(ctxtOrVar, 0);
					if (fsFlid != -1 && fsHvo != 0)
						m_cache.SetObjProperty(ctxtOrVar.Hvo, fsFlid, fsHvo);
					ctxtOrVar.NotifyNew();
					cellIndex = -1;
					return ctxtOrVar.Hvo;

				case AffixRuleFormulaVc.ktagRightEmpty:
					Rule.InputOS.Append(ctxtOrVar);
					if (fsFlid != -1 && fsHvo != 0)
						m_cache.SetObjProperty(ctxtOrVar.Hvo, fsFlid, fsHvo);
					ctxtOrVar.NotifyNew();
					cellIndex = -1;
					return ctxtOrVar.Hvo;

				default:
					if (ctxtOrVar.ClassID == PhVariable.kclsidPhVariable)
					{
						int index = m_cache.GetObjIndex(Rule.Hvo, (int)MoAffixProcess.MoAffixProcessTags.kflidInput, cellId);
						Rule.InputOS.InsertAt(ctxtOrVar, index);
						ctxtOrVar.NotifyNew();
						UpdateMappings(cellId, ctxtOrVar.Hvo);
						Rule.InputOS.Remove(cellId);
						cellIndex = -1;
						return ctxtOrVar.Hvo;
					}
					else
					{
						IPhPhonContext cellCtxt = PhPhonContext.CreateFromDBObject(m_cache, cellId);
						IPhSequenceContext seqCtxt = CreateSeqCtxt(cellCtxt);
						cellIndex = InsertContextInto(ctxtOrVar as IPhSimpleContext, fsFlid, fsHvo, sel, seqCtxt);
						return seqCtxt.Hvo;
					}
			}
		}