예제 #1
0
 /// <summary>
 /// :&gt; ENHANCE JohnT: VwLength is used only in three places now. Would it be better to
 ///             :&gt; just have an int plus a FwTextPropVar?
 ///              Start a table.
 /// </summary>
 /// <param name="cCols">The number of columns the table will have. </param><param name="vlWidth">The width of whole table. If the unit is percent, it is relative
 ///              to the available width for laying out the table. </param><param name="mpBorder">The thickness of the border drawn around the whole table.
 ///              This can be overridden by individual cells which explicitly set a border on the
 ///              relevant side. </param><param name="vwalign">Default alignment for text in the table (not implemented, I think) </param><param name="frmpos">Indicates which sides of the table to draw a border all around it. </param><param name="vwrule">Indicates where to draw lines between cells. </param><param name="mpSpacing">between cells </param><param name="mpPadding">between cell border and contents </param><param name="fSelectOneCol">true to keep the selection in one column, false to use normal
 ///              selections. </param>
 public void OpenTable(int cCols, VwLength vlWidth, int mpBorder, VwAlignment vwalign, VwFramePosition frmpos, VwRule vwrule, int mpSpacing, int mpPadding, bool fSelectOneCol)
 {
     throw new NotImplementedException();
 }
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Nothing to do here.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void OpenTable(int cCols, VwLength vlWidth, int mpBorder,
			VwAlignment vwalign, VwFramePosition frmpos, VwRule vwrule,
			int mpSpacing, int mpPadding, bool fSelectOneCol)
		{
			OpenFlowObject();
		}
예제 #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Nothing to do here. None of our collectors cares about flow object organization.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void MakeColumnGroup(int nColSpan, VwLength vlWidth)
		{
		}
예제 #4
0
		public void OpenTable(int cCols, VwLength vlWidth, int mpBorder, VwAlignment vwalign, VwFramePosition frmpos, VwRule vwrule, int mpSpacing, int mpPadding, bool fSelectOneCol)
		{
			throw new NotImplementedException();
		}
예제 #5
0
		public void MakeColumnGroup(int nColSpan, VwLength vlWidth)
		{
			throw new NotImplementedException();
		}
예제 #6
0
		/// <summary>
		/// Make a 'standard' row. Used for both header and body.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="fHeader">true if it is a header; hvo is a chart instead of a row.</param>
		private void MakeTableAndRowWithStdWidths(IVwEnv vwenv, int hvo, bool fHeader)
		{
			IConstChartRow row = null;
			if (!fHeader)
				row = m_rowRepo.GetObject(hvo);
			var tableWidth = new VwLength();
			if (m_colWidths == null)
			{
				tableWidth.nVal = 10000; // 100%
				tableWidth.unit = VwUnit.kunPercent100;
			}
			else
			{
				tableWidth.nVal = 0;
				foreach (var w in m_colWidths)
					tableWidth.nVal += w.nVal;
				tableWidth.unit = VwUnit.kunPoint1000;
			}
			if (!fHeader)
				SetRowStyle(vwenv, row);

			var fpos = VwFramePosition.kvfpVsides;
			if (fHeader)
			{
				fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
			}
			else
			{
				int hvoOuter, tagOuter, ihvoRow;
				vwenv.GetOuterObject(0, out hvoOuter, out tagOuter, out ihvoRow);
				if (ihvoRow == 0)
				{
					fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
				}
				if (ihvoRow == vwenv.DataAccess.get_VecSize(hvoOuter, tagOuter) - 1
					|| row.EndParagraph)
				{
					fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpBelow);
				}
			}
			// We seem to typically inherit a white background as a side effect of setting our stylesheet,
			// but borders on table rows don't show through if backcolor is set to white, because the
			// cells entirely cover the row (LT-9068). So force the back color to be transparent, and allow
			// the row border to show through the cell.
			var fRtL = m_chart.IsRightToLeft;
			vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
				(int)FwTextPropVar.ktpvDefault,
				(int)FwTextColor.kclrTransparent);
			vwenv.OpenTable(m_chart.AllColumns.Length + ConstituentChartLogic.NumberOfExtraColumns,
				tableWidth,
				1500, // borderWidth
				fRtL ? VwAlignment.kvaRight : VwAlignment.kvaLeft, // Handle RTL
				fpos,
				VwRule.kvrlNone,
				0, // cell spacing
				2000, // cell padding
				true); // selections limited to one cell.
			if (m_colWidths == null)
			{
				if (fRtL)
				{
					MakeColumnsOtherThanRowNum(vwenv);
					MakeRowNumColumn(vwenv);
				}
				else
				{
					MakeRowNumColumn(vwenv);
					MakeColumnsOtherThanRowNum(vwenv);
				}
			}
			else
			{
				foreach (var colWidth in m_colWidths)
					vwenv.MakeColumns(1, colWidth);
			}
			// Set row bottom border color and size of table body rows
			if (!fHeader)
			{
				if (row.EndSentence)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
						(int)FwTextPropVar.ktpvDefault,
						(int)ColorUtil.ConvertColorToBGR(Color.Black));
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 1000);
				}
				else
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
						(int)FwTextPropVar.ktpvDefault,
						(int)ColorUtil.ConvertColorToBGR(Color.LightGray));
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 500);
				}
			}

			vwenv.OpenTableRow();
		}
예제 #7
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			var tsf = m_cache.TsStrFactory;
			var userWs = m_cache.DefaultUserWs;
			switch (frag)
			{
				case kfragRule:
					m_rule = m_cache.ServiceLocator.GetInstance<IMoAffixProcessRepository>().GetObject(hvo);

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

					VwLength inputLen;
					inputLen.nVal = 0;
					inputLen.unit = VwUnit.kunPoint1000;

					int indexWidth = GetStrWidth(m_indexStr, m_headerProps, vwenv);
					int inputWidth = GetStrWidth(m_inputStr, m_headerProps, vwenv);
					VwLength headerLen;
					headerLen.nVal = Math.Max(indexWidth, inputWidth) + 8000;
					headerLen.unit = VwUnit.kunPoint1000;
					inputLen.nVal += headerLen.nVal;

					VwLength leftEmptyLen;
					leftEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 2000;
					leftEmptyLen.unit = VwUnit.kunPoint1000;
					inputLen.nVal += leftEmptyLen.nVal;

					var ctxtLens = new VwLength[m_rule.InputOS.Count];
					vwenv.NoteDependency(new[] {m_rule.Hvo}, new[] {MoAffixProcessTags.kflidInput}, 1 );
					for (int i = 0; i < m_rule.InputOS.Count; i++)
					{
						int idxWidth = GetStrWidth(tsf.MakeString(Convert.ToString(i + 1), userWs), m_indexProps, vwenv);
						int ctxtWidth = GetWidth(m_rule.InputOS[i], vwenv);
						ctxtLens[i].nVal = Math.Max(idxWidth, ctxtWidth) + 8000 + 1000;
						ctxtLens[i].unit = VwUnit.kunPoint1000;
						inputLen.nVal += ctxtLens[i].nVal;
					}

					VwLength rightEmptyLen;
					rightEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 1000;
					rightEmptyLen.unit = VwUnit.kunPoint1000;
					inputLen.nVal += rightEmptyLen.nVal;

					vwenv.MakeColumns(1, inputLen);

					VwLength arrowLen;
					arrowLen.nVal = GetStrWidth(m_doubleArrow, m_arrowProps, vwenv) + 8000;
					arrowLen.unit = VwUnit.kunPoint1000;
					vwenv.MakeColumns(1, arrowLen);

					VwLength outputLen;
					outputLen.nVal = 1;
					outputLen.unit = VwUnit.kunRelative;
					vwenv.MakeColumns(1, outputLen);

					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

					// input table cell
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenTable(m_rule.InputOS.Count + 3, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
					vwenv.MakeColumns(1, headerLen);
					vwenv.MakeColumns(1, leftEmptyLen);
					foreach (VwLength ctxtLen in ctxtLens)
						vwenv.MakeColumns(1, ctxtLen);
					vwenv.MakeColumns(1, rightEmptyLen);

					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

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

					// input left empty cell
					vwenv.Props = m_ctxtProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					OpenContextPile(vwenv, false);
					vwenv.Props = m_bracketProps;
					vwenv.AddProp(ktagLeftEmpty, this, kfragEmpty);
					CloseContextPile(vwenv, false);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					// input context cells
					vwenv.AddObjVec(MoAffixProcessTags.kflidInput, this, kfragInput);

					// input right empty cell
					vwenv.Props = m_ctxtProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					OpenContextPile(vwenv, false);
					vwenv.Props = m_bracketProps;
					vwenv.AddProp(ktagRightEmpty, this, kfragEmpty);
					CloseContextPile(vwenv, false);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();
					vwenv.OpenTableRow();

					// index header cell
					vwenv.Props = m_headerProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_indexStr);
					vwenv.CloseTableCell();

					// index left empty cell
					vwenv.Props = m_indexProps;
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
					vwenv.OpenTableCell(1, 1);
					vwenv.CloseTableCell();

					// index cells
					for (int i = 0; i < m_rule.InputOS.Count; i++)
					{
						vwenv.Props = m_indexProps;
						vwenv.OpenTableCell(1, 1);
						vwenv.AddString(tsf.MakeString(Convert.ToString(i + 1), userWs));
						vwenv.CloseTableCell();
					}

					// index right empty cell
					vwenv.Props = m_indexProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();
					vwenv.CloseTableBody();
					vwenv.CloseTable();
					vwenv.CloseTableCell();

					// double arrow cell
					vwenv.Props = m_arrowProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.AddString(m_doubleArrow);
					vwenv.CloseTableCell();

					// result table cell
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenTable(1, tableLen, 0, VwAlignment.kvaLeft, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
					vwenv.MakeColumns(1, outputLen);

					vwenv.OpenTableBody();
					vwenv.OpenTableRow();

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

					vwenv.CloseTableRow();
					vwenv.OpenTableRow();

					// result cell
					vwenv.Props = m_resultProps;
					vwenv.OpenTableCell(1, 1);
					vwenv.OpenParagraph();
					if (m_rule.OutputOS.Count == 0)
						vwenv.AddProp(MoAffixProcessTags.kflidOutput, this, kfragEmpty);
					else
						vwenv.AddObjVecItems(MoAffixProcessTags.kflidOutput, this, kfragRuleMapping);
					vwenv.CloseParagraph();
					vwenv.CloseTableCell();

					vwenv.CloseTableRow();
					vwenv.CloseTableBody();
					vwenv.CloseTable();

					vwenv.CloseTableCell();
					vwenv.CloseTableRow();
					vwenv.CloseTableBody();
					vwenv.CloseTable();
					break;

				case kfragRuleMapping:
					var mapping = m_cache.ServiceLocator.GetInstance<IMoRuleMappingRepository>().GetObject(hvo);
					switch (mapping.ClassID)
					{
						case MoCopyFromInputTags.kClassId:
							var copy = (IMoCopyFromInput) mapping;
							OpenIndexPile(vwenv);
							if (copy.ContentRA == null)
								vwenv.AddProp(ktagIndex, this, 0);
							else
								vwenv.AddProp(ktagIndex, this, copy.ContentRA.IndexInOwner + 1);
							CloseIndexPile(vwenv);
							break;

						case MoInsertPhonesTags.kClassId:
							OpenIndexPile(vwenv);
							vwenv.AddObjVecItems(MoInsertPhonesTags.kflidContent, this, kfragTerminalUnit);
							CloseIndexPile(vwenv);
							break;

						case MoModifyFromInputTags.kClassId:
							var modify = (IMoModifyFromInput) mapping;
							var numLines = modify.ModificationRA.FeaturesOA.FeatureSpecsOC.Count;
							// left bracket pile
							vwenv.set_IntProperty((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN);
							vwenv.OpenInnerPile();

							vwenv.Props = m_bracketProps;
							vwenv.AddProp(ktagLeftBoundary, this, kfragZeroWidthSpace);

							// put index in the left bracket pile
							if (modify.ContentRA == null)
								vwenv.AddProp(ktagIndex, this, 0);
							else
								vwenv.AddProp(ktagIndex, this, modify.ContentRA.IndexInOwner + 1);
							// right align brackets in left bracket pile, since the index could have a greater width, then the bracket
							if (numLines > 1)
							{
								vwenv.Props = m_bracketProps;
								vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
								vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketUpHook);
								for (int i = 1; i < numLines - 1; i++)
								{
									vwenv.Props = m_bracketProps;
									vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
									vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketExt);
								}
								vwenv.Props = m_bracketProps;
								vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
								vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketLowHook);
							}
							else
							{
								vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
								vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracket);
							}
							vwenv.CloseInnerPile();

							// feature pile
							vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalLeft);
							vwenv.OpenInnerPile();
							AddExtraLines(1, vwenv);
							if (numLines == 0)
								vwenv.AddProp(MoModifyFromInputTags.kflidModification, this, kfragQuestions);
							else
								vwenv.AddObjProp(MoModifyFromInputTags.kflidModification, this, kfragFeatNC);
							vwenv.CloseInnerPile();

							// right bracket pile
							vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN);
							vwenv.OpenInnerPile();
							vwenv.Props = m_bracketProps;
							vwenv.AddProp(ktagRightBoundary, this, kfragSpace);
							if (numLines > 1)
							{
								vwenv.Props = m_bracketProps;
								vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketUpHook);
								for (int i = 1; i < numLines - 1; i++)
								{
									vwenv.Props = m_bracketProps;
									vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketExt);
								}
								vwenv.Props = m_bracketProps;
								vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketLowHook);
							}
							else
							{
								vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracket);
							}
							vwenv.CloseInnerPile();
							break;
					}
					break;

				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
예제 #8
0
		/// <summary>
		/// Make a 'standard' row. Used for both header and body.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="fHeader">true if it is a header; hvo is a chart instead of a row.</param>
		private void MakeTableAndRowWithStdWidths(IVwEnv vwenv, int hvo, bool fHeader)
		{
			VwLength tableWidth = new VwLength();
			if (m_colWidths == null)
			{
				tableWidth.nVal = 10000; // 100%
				tableWidth.unit = VwUnit.kunPercent100;
			}
			else
			{
				tableWidth.nVal = 0;
				foreach (VwLength w in m_colWidths)
					tableWidth.nVal += w.nVal;
				tableWidth.unit = VwUnit.kunPoint1000;
			}
			if (!fHeader)
				SetRowStyle(vwenv, hvo);

			VwFramePosition fpos = VwFramePosition.kvfpVsides;
			if (fHeader)
			{
				fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
			}
			else
			{
				int hvoOuter, tagOuter, ihvoRow;
				vwenv.GetOuterObject(0, out hvoOuter, out tagOuter, out ihvoRow);
				if (ihvoRow == 0)
				{
					fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
				}
				if (ihvoRow == vwenv.DataAccess.get_VecSize(hvoOuter, tagOuter) - 1
					|| ConstituentChartLogic.GetFeature(vwenv.DataAccess, hvo, "endPara"))
				{
					fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpBelow);
				}
			}
			// We seem to typically inherit a white background as a side effect of setting our stylesheet,
			// but borders on table rows don't show through if backcolor is set to white, because the
			// cells entirely cover the row (LT-9068). So force the back color to be transparent, and allow
			// the row border to show through the cell.
			vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
				(int)FwTextPropVar.ktpvDefault,
				(int)FwTextColor.kclrTransparent);
			vwenv.OpenTable(m_chart.AllColumns.Length + ConstituentChartLogic.NumberOfExtraColumns,
				tableWidth,
				1500, // borderWidth
				VwAlignment.kvaLeft, // Todo: handle RTL
				fpos,
				VwRule.kvrlNone,
				0, // cell spacing
				2000, // cell padding
				true); // selections limited to one cell.
			if (m_colWidths == null)
			{
				VwLength numColWidth = new VwLength();
				numColWidth.nVal = NumColWidth;
				numColWidth.unit = VwUnit.kunPoint1000;
				vwenv.MakeColumns(1, numColWidth);
				VwLength colWidth = new VwLength();
				colWidth.nVal = 1;
				colWidth.unit = VwUnit.kunRelative;
				int followingCols = ConstituentChartLogic.NumberOfExtraColumns -
					ConstituentChartLogic.IndexOfFirstTemplateColumn;
				vwenv.MakeColumns(m_chart.AllColumns.Length + followingCols, colWidth);
			}
			else
			{
				foreach (VwLength colWidth in m_colWidths)
				{
					vwenv.MakeColumns(1, colWidth);
				}
			}
			// Set row bottom border color and size of table body rows
			if (!fHeader)
			{
				if (ConstituentChartLogic.GetFeature(vwenv.DataAccess, hvo, "endSent"))
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
						(int)FwTextPropVar.ktpvDefault,
						(int)ColorUtil.ConvertColorToBGR(Color.Black));
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 1000);
				}
				else
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
						(int)FwTextPropVar.ktpvDefault,
						(int)ColorUtil.ConvertColorToBGR(Color.LightGray));
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
						(int)FwTextPropVar.ktpvMilliPoint, 500);
				}
			}

			vwenv.OpenTableRow();
		}
예제 #9
0
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            int userWs = m_cache.DefaultUserWs;

            switch (frag)
            {
            case kfragRule:
                m_rule = m_cache.ServiceLocator.GetInstance <IMoAffixProcessRepository>().GetObject(hvo);

                int maxNumLines = GetMaxNumLines();

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

                VwLength inputLen;
                inputLen.nVal = 0;
                inputLen.unit = VwUnit.kunPoint1000;

                int      indexWidth = GetStrWidth(m_indexStr, m_headerProps, vwenv);
                int      inputWidth = GetStrWidth(m_inputStr, m_headerProps, vwenv);
                VwLength headerLen;
                headerLen.nVal = Math.Max(indexWidth, inputWidth) + 8000;
                headerLen.unit = VwUnit.kunPoint1000;
                inputLen.nVal += headerLen.nVal;

                VwLength leftEmptyLen;
                leftEmptyLen.nVal = 8000 + (PileMargin * 2) + 2000;
                leftEmptyLen.unit = VwUnit.kunPoint1000;
                inputLen.nVal    += leftEmptyLen.nVal;

                var ctxtLens = new VwLength[m_rule.InputOS.Count];
                vwenv.NoteDependency(new[] { m_rule.Hvo }, new[] { MoAffixProcessTags.kflidInput }, 1);
                for (int i = 0; i < m_rule.InputOS.Count; i++)
                {
                    int idxWidth  = GetStrWidth(TsStringUtils.MakeString(Convert.ToString(i + 1), userWs), m_indexProps, vwenv);
                    int ctxtWidth = GetWidth(m_rule.InputOS[i], vwenv);
                    ctxtLens[i].nVal = Math.Max(idxWidth, ctxtWidth) + 8000 + 1000;
                    ctxtLens[i].unit = VwUnit.kunPoint1000;
                    inputLen.nVal   += ctxtLens[i].nVal;
                }

                VwLength rightEmptyLen;
                rightEmptyLen.nVal = 8000 + (PileMargin * 2) + 1000;
                rightEmptyLen.unit = VwUnit.kunPoint1000;
                inputLen.nVal     += rightEmptyLen.nVal;

                vwenv.MakeColumns(1, inputLen);

                VwLength arrowLen;
                arrowLen.nVal = GetStrWidth(m_doubleArrow, m_arrowProps, vwenv) + 8000;
                arrowLen.unit = VwUnit.kunPoint1000;
                vwenv.MakeColumns(1, arrowLen);

                VwLength outputLen;
                outputLen.nVal = 1;
                outputLen.unit = VwUnit.kunRelative;
                vwenv.MakeColumns(1, outputLen);

                vwenv.OpenTableBody();
                vwenv.OpenTableRow();

                // input table cell
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenTable(m_rule.InputOS.Count + 3, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
                vwenv.MakeColumns(1, headerLen);
                vwenv.MakeColumns(1, leftEmptyLen);
                foreach (VwLength ctxtLen in ctxtLens)
                {
                    vwenv.MakeColumns(1, ctxtLen);
                }
                vwenv.MakeColumns(1, rightEmptyLen);

                vwenv.OpenTableBody();
                vwenv.OpenTableRow();

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

                // input left empty cell
                vwenv.Props = m_ctxtProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                OpenSingleLinePile(vwenv, maxNumLines, false);
                vwenv.Props = m_bracketProps;
                vwenv.AddProp(ktagLeftEmpty, this, kfragEmpty);
                CloseSingleLinePile(vwenv, false);
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                // input context cells
                vwenv.AddObjVec(MoAffixProcessTags.kflidInput, this, kfragInput);

                // input right empty cell
                vwenv.Props = m_ctxtProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                OpenSingleLinePile(vwenv, maxNumLines, false);
                vwenv.Props = m_bracketProps;
                vwenv.AddProp(ktagRightEmpty, this, kfragEmpty);
                CloseSingleLinePile(vwenv, false);
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();
                vwenv.OpenTableRow();

                // index header cell
                vwenv.Props = m_headerProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_indexStr);
                vwenv.CloseTableCell();

                // index left empty cell
                vwenv.Props = m_indexProps;
                vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
                vwenv.OpenTableCell(1, 1);
                vwenv.CloseTableCell();

                // index cells
                for (int i = 0; i < m_rule.InputOS.Count; i++)
                {
                    vwenv.Props = m_indexProps;
                    vwenv.OpenTableCell(1, 1);
                    vwenv.AddString(TsStringUtils.MakeString(Convert.ToString(i + 1), userWs));
                    vwenv.CloseTableCell();
                }

                // index right empty cell
                vwenv.Props = m_indexProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();
                vwenv.CloseTableBody();
                vwenv.CloseTable();
                vwenv.CloseTableCell();

                // double arrow cell
                vwenv.Props = m_arrowProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.AddString(m_doubleArrow);
                vwenv.CloseTableCell();

                // result table cell
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenTable(1, tableLen, 0, VwAlignment.kvaLeft, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
                vwenv.MakeColumns(1, outputLen);

                vwenv.OpenTableBody();
                vwenv.OpenTableRow();

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

                vwenv.CloseTableRow();
                vwenv.OpenTableRow();

                // result cell
                vwenv.Props = m_resultProps;
                vwenv.OpenTableCell(1, 1);
                vwenv.OpenParagraph();
                if (m_rule.OutputOS.Count == 0)
                {
                    vwenv.AddProp(MoAffixProcessTags.kflidOutput, this, kfragEmpty);
                }
                else
                {
                    vwenv.AddObjVecItems(MoAffixProcessTags.kflidOutput, this, kfragRuleMapping);
                }
                vwenv.CloseParagraph();
                vwenv.CloseTableCell();

                vwenv.CloseTableRow();
                vwenv.CloseTableBody();
                vwenv.CloseTable();

                vwenv.CloseTableCell();
                vwenv.CloseTableRow();
                vwenv.CloseTableBody();
                vwenv.CloseTable();
                break;

            case kfragRuleMapping:
                var mapping = m_cache.ServiceLocator.GetInstance <IMoRuleMappingRepository>().GetObject(hvo);
                switch (mapping.ClassID)
                {
                case MoCopyFromInputTags.kClassId:
                    var copy = (IMoCopyFromInput)mapping;
                    OpenSingleLinePile(vwenv, GetOutputMaxNumLines());
                    if (copy.ContentRA == null)
                    {
                        vwenv.AddProp(ktagIndex, this, 0);
                    }
                    else
                    {
                        vwenv.AddProp(ktagIndex, this, copy.ContentRA.IndexInOwner + 1);
                    }
                    CloseSingleLinePile(vwenv);
                    break;

                case MoInsertPhonesTags.kClassId:
                    OpenSingleLinePile(vwenv, GetOutputMaxNumLines());
                    vwenv.AddObjVecItems(MoInsertPhonesTags.kflidContent, this, kfragTerminalUnit);
                    CloseSingleLinePile(vwenv);
                    break;

                case MoModifyFromInputTags.kClassId:
                    var modify            = (IMoModifyFromInput)mapping;
                    int outputMaxNumLines = GetOutputMaxNumLines();
                    int numLines          = modify.ModificationRA.FeaturesOA.FeatureSpecsOC.Count;

                    // index pile
                    vwenv.set_IntProperty((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint, PileMargin);
                    vwenv.OpenInnerPile();
                    AddExtraLines(outputMaxNumLines - 1, vwenv);
                    vwenv.OpenParagraph();
                    vwenv.Props = m_bracketProps;
                    vwenv.AddProp(ktagLeftBoundary, this, kfragZeroWidthSpace);
                    if (modify.ContentRA == null)
                    {
                        vwenv.AddProp(ktagIndex, this, 0);
                    }
                    else
                    {
                        vwenv.AddProp(ktagIndex, this, modify.ContentRA.IndexInOwner + 1);
                    }
                    vwenv.CloseParagraph();
                    vwenv.CloseInnerPile();

                    // left bracket pile
                    // right align brackets in left bracket pile, since the index could have a greater width, then the bracket
                    if (numLines == 1)
                    {
                        vwenv.OpenInnerPile();
                        AddExtraLines(outputMaxNumLines - 1, vwenv);
                        vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
                        vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracket);
                        vwenv.CloseInnerPile();
                    }
                    else
                    {
                        vwenv.OpenInnerPile();
                        vwenv.Props = m_bracketProps;
                        vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
                        vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketUpHook);
                        for (int i = 1; i < numLines - 1; i++)
                        {
                            vwenv.Props = m_bracketProps;
                            vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
                            vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketExt);
                        }
                        vwenv.Props = m_bracketProps;
                        vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
                        vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftBracketLowHook);
                        vwenv.CloseInnerPile();
                    }

                    // feature pile
                    vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalLeft);
                    vwenv.OpenInnerPile();
                    AddExtraLines(outputMaxNumLines - numLines, vwenv);
                    if (numLines == 0)
                    {
                        vwenv.AddProp(MoModifyFromInputTags.kflidModification, this, kfragQuestions);
                    }
                    else
                    {
                        vwenv.AddObjProp(MoModifyFromInputTags.kflidModification, this, kfragFeatNC);
                    }
                    vwenv.CloseInnerPile();

                    // right bracket pile
                    if (numLines == 1)
                    {
                        vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PileMargin);
                        AddExtraLines(outputMaxNumLines - 1, vwenv);
                        vwenv.OpenInnerPile();
                        vwenv.AddProp(ktagRightBoundary, this, kfragRightBracket);
                        vwenv.CloseInnerPile();
                    }
                    else
                    {
                        vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PileMargin);
                        vwenv.OpenInnerPile();
                        AddExtraLines(outputMaxNumLines - numLines, vwenv);
                        vwenv.Props = m_bracketProps;
                        vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketUpHook);
                        for (int i = 1; i < numLines - 1; i++)
                        {
                            vwenv.Props = m_bracketProps;
                            vwenv.AddProp(ktagRightNonBoundary, this, kfragRightBracketExt);
                        }
                        vwenv.Props = m_bracketProps;
                        vwenv.AddProp(ktagRightBoundary, this, kfragRightBracketLowHook);
                        vwenv.CloseInnerPile();
                    }
                    break;
                }
                break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }
예제 #10
0
		public void SetColWidths(int[] widths)
		{
			int ccol = widths.Length;
			VwLength[] lengths = new VwLength[ccol];
			for (int icol = 0; icol < ccol; icol++)
			{
				VwLength len = new VwLength();
				len.nVal = widths[icol];
				len.unit = VwUnit.kunPoint1000;
				lengths[icol] = len;
			}
			// We seem to need to tweak the first width to make things line up,
			// possibly because of the left border.
			lengths[0].nVal -= 1000;
			if (RootBox != null)
				RootBox.SetTableColWidths(lengths, ccol);
			m_vc.SetColWidths(lengths);
		}
예제 #11
0
		/// <summary>
		/// Set the column widths (in millipoints).
		/// </summary>
		/// <param name="widths"></param>
		public void SetColWidths(VwLength[] widths)
		{
			m_colWidths = widths;
		}
예제 #12
0
		public void SetColWidths(int[] widths)
		{
			var ccol = widths.Length;
			var lengths = new VwLength[ccol];
			for (var icol = 0; icol < ccol; icol++)
			{
				var len = new VwLength();
				len.nVal = widths[icol];
				len.unit = VwUnit.kunPoint1000;
				lengths[icol] = len;
			}
			// We seem to need to tweak the first width to make things line up,
			// possibly because of the left border.
			lengths[0].nVal -= 1000;
			if (RootBox != null)
				RootBox.SetTableColWidths(lengths, ccol);
			// TODO: fix this properly - why is m_vc null?
			if (m_vc != null)
				m_vc.SetColWidths(lengths);
		}
예제 #13
0
		private void MakeRowNumColumn(IVwEnv vwenv)
		{
			var numColWidth = new VwLength();
			numColWidth.nVal = NumColWidth;
			numColWidth.unit = VwUnit.kunPoint1000;
			vwenv.MakeColumns(1, numColWidth);
		}
예제 #14
0
		private void MakeColumnsOtherThanRowNum(IVwEnv vwenv)
		{
			var colWidth = new VwLength();
			colWidth.nVal = 1;
			colWidth.unit = VwUnit.kunRelative;
			var followingCols = ConstituentChartLogic.NumberOfExtraColumns -
								ConstituentChartLogic.indexOfFirstTemplateColumn;
			vwenv.MakeColumns(m_chart.AllColumns.Length + followingCols, colWidth);
		}
예제 #15
0
 /// <summary>
 /// This is like <c>MakeColumns</c>, except that a "group" of columns ends after the
 ///              last one whose width is specified using this method. Groups are significant
 ///              for some options regarding drawing rules between cells; see the vwrule parameter
 ///              of <c>OpenTable</c>.
 /// </summary>
 /// <param name="nColSpan"/><param name="vlWidth"/>
 public void MakeColumnGroup(int nColSpan, VwLength vlWidth)
 {
     throw new NotImplementedException();
 }
예제 #16
0
		public void SetTableColWidths(VwLength[] _rgvlen, int cvlen)
		{
			throw new Exception("The method or operation is not implemented.");
		}
		public void SetTableColWidths(VwLength[] _rgvlen, int cvlen)
		{
			throw new NotImplementedException();
		}
예제 #18
0
		/// <summary>
		/// Add a new table/row to the view for one existing object.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		protected virtual void AddTableRow(IVwEnv vwenv, int hvo, int frag)
		{
			// set the border color
			vwenv.set_IntProperty((int )FwTextPropType.ktptBorderColor,
				(int)FwTextPropVar.ktpvDefault,
				(int)RGB(m_BorderColor));

			// If we're using this special mode where just one column is editable, we need to make
			// sure as far as possible that everything else is not.
			if (OverrideAllowEditColumn >= 0)
				vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int) FwTextPropVar.ktpvEnum,
					(int)TptEditable.ktptNotEditable);

			int index, hvoDummy, tagDummy;
			int clev = vwenv.EmbeddingLevel;
			vwenv.GetOuterObject(clev - 2, out hvoDummy, out tagDummy, out index);
			if (index >= Cache.MainCacheAccessor.get_VecSize(hvoDummy, tagDummy))
				return; // something to fix.

			if (index == m_xbv.SelectedIndex && m_xbv.SelectedRowHighlighting != XmlBrowseViewBase.SelectionHighlighting.none)
			{
				vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
					(int)FwTextPropVar.ktpvDefault,
					//	(int)RGB(Color.FromKnownColor(KnownColor.Highlight)));
					SelectedRowBackgroundColor(hvo));
				if (m_xbv.SelectedRowHighlighting == XmlBrowseViewBase.SelectionHighlighting.border)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
						(int)FwTextPropVar.ktpvMilliPoint,
						3000);
					vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
						(int)FwTextPropVar.ktpvDefault,
						(int)RGB(Color.FromKnownColor(KnownColor.Highlight)));
				}
			}

			// Make a table.
			VwLength[] rglength = m_xbv.GetColWidthInfo();
			int colCount = m_columns.Count;
			if (m_fShowSelected)
				colCount++;

			// LT-7014, 7058: add the additional columns that are needed
			if (rglength.Length < colCount)
			{
				VwLength[] rglengthNEW = new VwLength[colCount];
				for (int ii = 0; ii < colCount; ii++)
				{
					if (ii < rglength.Length)
						rglengthNEW[ii] = rglength[ii];
					else
						rglengthNEW[ii] = rglength[0];
				}
				rglength = rglengthNEW;
			}

			// If the only columns specified are custom fields which have been deleted,
			// we can't show anything!  (and we don't want to crash -- see LT-6449)
			if (rglength.Length == 0)
				return;

			VwLength vl100; // Length representing 100% of the table width.
			vl100.unit = rglength[0].unit;
			vl100.nVal = 1;
			for (int i = 0; i < colCount; ++i)
			{
				Debug.Assert(vl100.unit == rglength[i].unit);
				vl100.nVal += rglength[i].nVal;
			}

			vwenv.OpenTable(colCount, // this many columns
				vl100, // using 100% of available space
				72000 / 96, //0, // no border
				VwAlignment.kvaLeft, // cells by default left aligned
				//	VwFramePosition.kvfpBelow, //.kvfpBox, //.kvfpVoid, // no frame
				VwFramePosition.kvfpBelow | VwFramePosition.kvfpRhs,
				VwRule.kvrlCols, // vertical lines between columns
				0, // no space between cells
				0, // no padding within cell.
				false);
			// Set column widths.
			for (int i = 0; i < colCount; ++i)
				vwenv.MakeColumns(1, rglength[i]);
			// the table only has a body (no header or footer), and only one row.
			vwenv.OpenTableBody();
			vwenv.OpenTableRow();

			if (m_fShowSelected)
				AddSelectionCell(vwenv, hvo);
			// Make the cells.
			int hvoRoot, tagDummy2, ihvoDummy;
			vwenv.GetOuterObject(0, out hvoRoot, out tagDummy2, out ihvoDummy);
			int icolActive = GetActiveColumn(vwenv, hvoRoot);
			// if m_fShowSelected is true, we get an extra column of checkmarks that gives us
			// a different index into the columns. This allows the one-based indexing to work
			// in the call to ColumnSortedFromEnd. Without this, the one-based indexing has to
			// be adjusted to zero-based indexing.
			int cAdjCol = m_fShowSelected ? 0 : 1;
			if (m_fShowColumnsRTL)
			{
				for (int icol = m_columns.Count; icol > 0; --icol)
					AddTableCell(vwenv, hvo, index, hvoRoot, icolActive, cAdjCol, icol);
			}
			else
			{
				for (int icol = 1; icol <= m_columns.Count; ++icol)
					AddTableCell(vwenv, hvo, index, hvoRoot, icolActive, cAdjCol, icol);
			}
			vwenv.CloseTableRow();
			vwenv.CloseTableBody();
			vwenv.CloseTable();
		}