public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            switch (frag)
            {
            case kfragRule:
                m_rule = m_cache.ServiceLocator.GetInstance <IPhMetathesisRuleRepository>().GetObject(hvo);
                if (m_rule.Disabled)
                {
                    vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
                }

                int maxNumLines = GetMaxNumLines();

                VwLength tableLen;
                tableLen.nVal = 10000;
                tableLen.unit = VwUnit.kunPercent100;
                vwenv.OpenTable(5, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);

                VwLength ctxtLen;
                ctxtLen.nVal = 1;
                ctxtLen.unit = VwUnit.kunRelative;

                int resultx, inputx, dmpy;
                vwenv.get_StringWidth(m_resultStr, m_colHeaderProps, out resultx, out dmpy);
                vwenv.get_StringWidth(m_inputStr, m_colHeaderProps, out inputx, out dmpy);
                VwLength headerLen;
                headerLen.nVal = Math.Max(resultx, inputx) + 8000;
                headerLen.unit = VwUnit.kunPoint1000;

                vwenv.MakeColumns(1, headerLen);
                vwenv.MakeColumns(4, ctxtLen);

                vwenv.OpenTableBody();

                vwenv.OpenTableRow();

                vwenv.OpenTableCell(1, 1);
                vwenv.CloseTableCell();

                // left context header cell
                vwenv.Props = m_colHeaderProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_leftEnvStr);
                vwenv.CloseTableCell();

                // switch header cell
                vwenv.Props = m_colHeaderProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.OpenTableCell(1, 2);
                vwenv.AddString(m_switchStr);
                vwenv.CloseTableCell();

                // right context header cell
                vwenv.Props = m_colHeaderProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_rightEnvStr);
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();

                vwenv.OpenTableRow();

                // input header cell
                vwenv.Props = m_rowHeaderProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_inputStr);
                vwenv.CloseTableCell();

                // input left context cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.LeftEnvIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagLeftEnv, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    for (int i = 0; i < m_rule.LeftEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // input left switch cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.LeftSwitchIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagLeftSwitch, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }

                    if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
                    {
                        for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                        {
                            vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                        }
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // input right switch cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightSwitchIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagRightSwitch, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
                    {
                        for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                        {
                            vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                        }
                    }

                    for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // input right context cell
                vwenv.Props = m_inputCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightEnvIndex == -1)
                {
                    OpenSingleLinePile(vwenv, maxNumLines, false);
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagRightEnv, this, kfragEmpty);
                    CloseSingleLinePile(vwenv, false);
                }
                else
                {
                    for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();

                vwenv.OpenTableRow();

                // input result header cell
                vwenv.Props = m_rowHeaderProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_resultStr);
                vwenv.CloseTableCell();

                // result left context cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.LeftEnvIndex != -1)
                {
                    for (int i = 0; i < m_rule.LeftEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // result right switch cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightSwitchIndex != -1)
                {
                    for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
                {
                    for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // result left switch cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();

                if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
                {
                    for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                if (m_rule.LeftSwitchIndex != -1)
                {
                    for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // result right context cell
                vwenv.Props = m_resultCtxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.RightEnvIndex != -1)
                {
                    for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
                    {
                        vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
                    }
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();

                vwenv.CloseTableBody();

                vwenv.CloseTable();
                break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
		protected override void Dispose(bool disposing)
		{
			if (IsDisposed)
				return;

			if (disposing)
			{
			}

			m_rule = null;

			if (m_inputCtxtProps != null)
			{
				Marshal.ReleaseComObject(m_inputCtxtProps);
				m_inputCtxtProps = null;
			}
			if (m_resultCtxtProps != null)
			{
				Marshal.ReleaseComObject(m_resultCtxtProps);
				m_resultCtxtProps = null;
			}
			if (m_colHeaderProps != null)
			{
				Marshal.ReleaseComObject(m_colHeaderProps);
				m_colHeaderProps = null;
			}
			if (m_rowHeaderProps != null)
			{
				Marshal.ReleaseComObject(m_rowHeaderProps);
				m_rowHeaderProps = null;
			}
			if (m_inputStr != null)
			{
				Marshal.ReleaseComObject(m_inputStr);
				m_inputStr = null;
			}
			if (m_resultStr != null)
			{
				Marshal.ReleaseComObject(m_resultStr);
				m_resultStr = null;
			}
			if (m_leftEnvStr != null)
			{
				Marshal.ReleaseComObject(m_leftEnvStr);
				m_leftEnvStr = null;
			}
			if (m_rightEnvStr != null)
			{
				Marshal.ReleaseComObject(m_rightEnvStr);
				m_rightEnvStr = null;
			}
			if (m_switchStr != null)
			{
				Marshal.ReleaseComObject(m_switchStr);
				m_switchStr = null;
			}

			base.Dispose(disposing);
		}
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragRule:
					m_rule = m_cache.ServiceLocator.GetInstance<IPhMetathesisRuleRepository>().GetObject(hvo);
					if (m_rule.Disabled)
					{
						vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
					}

					int maxNumLines = GetMaxNumLines();

					VwLength tableLen;
					tableLen.nVal = 10000;
					tableLen.unit = VwUnit.kunPercent100;
					vwenv.OpenTable(5, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);

					VwLength ctxtLen;
					ctxtLen.nVal = 1;
					ctxtLen.unit = VwUnit.kunRelative;

					int resultx, inputx, dmpy;
					vwenv.get_StringWidth(m_resultStr, m_colHeaderProps, out resultx, out dmpy);
					vwenv.get_StringWidth(m_inputStr, m_colHeaderProps, out inputx, out dmpy);
					VwLength headerLen;
					headerLen.nVal = Math.Max(resultx, inputx) + 8000;
					headerLen.unit = VwUnit.kunPoint1000;

					vwenv.MakeColumns(1, headerLen);
					vwenv.MakeColumns(4, ctxtLen);

					vwenv.OpenTableBody();

					vwenv.OpenTableRow();

					vwenv.OpenTableCell(1, 1);
					vwenv.CloseTableCell();

					// left context header cell
					vwenv.Props = m_colHeaderProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_leftEnvStr);
					vwenv.CloseTableCell();

					// switch header cell
					vwenv.Props = m_colHeaderProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.OpenTableCell(1, 2);
					vwenv.AddString(m_switchStr);
					vwenv.CloseTableCell();

					// right context header cell
					vwenv.Props = m_colHeaderProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_rightEnvStr);
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();

					vwenv.OpenTableRow();

					// input header cell
					vwenv.Props = m_rowHeaderProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_inputStr);
					vwenv.CloseTableCell();

					// input left context cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.LeftEnvIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagLeftEnv, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						for (int i = 0; i < m_rule.LeftEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input left switch cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.LeftSwitchIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagLeftSwitch, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);

						if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
						{
							for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
								vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
						}
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input right switch cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightSwitchIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagRightSwitch, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
						{
							for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
								vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
						}

						for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input right context cell
					vwenv.Props = m_inputCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightEnvIndex == -1)
					{
						OpenSingleLinePile(vwenv, maxNumLines, false);
						vwenv.Props = m_bracketProps;
						vwenv.AddProp(ktagRightEnv, this, kfragEmpty);
						CloseSingleLinePile(vwenv, false);
					}
					else
					{
						for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();

					vwenv.OpenTableRow();

					// input result header cell
					vwenv.Props = m_rowHeaderProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_resultStr);
					vwenv.CloseTableCell();

					// result left context cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.LeftEnvIndex != -1)
					{
						for (int i = 0; i < m_rule.LeftEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// result right switch cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightSwitchIndex != -1)
					{
						for (int i = m_rule.RightSwitchIndex; i < m_rule.RightSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					if (m_rule.MiddleIndex != -1 && m_rule.IsMiddleWithLeftSwitch)
					{
						for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// result left switch cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();

					if (m_rule.MiddleIndex != -1 && !m_rule.IsMiddleWithLeftSwitch)
					{
						for (int i = m_rule.MiddleIndex; i < m_rule.MiddleLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					if (m_rule.LeftSwitchIndex != -1)
					{
						for (int i = m_rule.LeftSwitchIndex; i < m_rule.LeftSwitchLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// result right context cell
					vwenv.Props = m_resultCtxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.RightEnvIndex != -1)
					{
						for (int i = m_rule.RightEnvIndex; i < m_rule.RightEnvLimit; i++)
							vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
					}
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();

					vwenv.CloseTableBody();

					vwenv.CloseTable();
					break;

				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
        protected override void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
            }

            m_rule = null;

            if (m_inputCtxtProps != null)
            {
                Marshal.ReleaseComObject(m_inputCtxtProps);
                m_inputCtxtProps = null;
            }
            if (m_resultCtxtProps != null)
            {
                Marshal.ReleaseComObject(m_resultCtxtProps);
                m_resultCtxtProps = null;
            }
            if (m_colHeaderProps != null)
            {
                Marshal.ReleaseComObject(m_colHeaderProps);
                m_colHeaderProps = null;
            }
            if (m_rowHeaderProps != null)
            {
                Marshal.ReleaseComObject(m_rowHeaderProps);
                m_rowHeaderProps = null;
            }
            if (m_inputStr != null)
            {
                Marshal.ReleaseComObject(m_inputStr);
                m_inputStr = null;
            }
            if (m_resultStr != null)
            {
                Marshal.ReleaseComObject(m_resultStr);
                m_resultStr = null;
            }
            if (m_leftEnvStr != null)
            {
                Marshal.ReleaseComObject(m_leftEnvStr);
                m_leftEnvStr = null;
            }
            if (m_rightEnvStr != null)
            {
                Marshal.ReleaseComObject(m_rightEnvStr);
                m_rightEnvStr = null;
            }
            if (m_switchStr != null)
            {
                Marshal.ReleaseComObject(m_switchStr);
                m_switchStr = null;
            }

            base.Dispose(disposing);
        }