public virtual void CloseSpan()
 {
     if (!IsRtL)
     {
         m_vwEnv.CloseSpan();
         return;
     }
     m_calledMethods.Add(new StoredMethod(DecoratorMethodTypes.CloseSpan, new object[] { }));
     m_numOfCalls++;
 }
示例#2
0
        /// <summary>
        /// Add to the current display (a paragraph should be open) a label followed by colon, in the standard style,
        /// that identifies a particular writing system from the current list.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="iws"></param>
        public void AddWsLabel(IVwEnv vwenv, int iws)
        {
            CheckDisposed();

            if (m_tssColon == null)
            {
                m_tssColon = TsStringUtils.MakeString(": ", m_lp.Cache.DefaultUserWs);
            }
            if (m_ttpLabelStyle == null)
            {
                m_ttpLabelStyle = LanguageCodeStyle;
            }
            vwenv.Props = m_ttpLabelStyle;
            vwenv.OpenSpan();
            vwenv.AddString(AnalysisWsLabels[iws]);
            vwenv.AddString(m_tssColon);
            vwenv.CloseSpan();
        }
示例#3
0
        /// <summary>
        /// Add to the current display (a paragraph should be open) a label followed by colon, in the standard style,
        /// that identifies a particular writing system from the current list.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="iws"></param>
        public void AddWsLabel(IVwEnv vwenv, int iws)
        {
            CheckDisposed();

            if (m_tssColon == null)
            {
                ITsStrFactory tsf = TsStrFactoryClass.Create();
                m_tssColon = tsf.MakeString(": ", m_lp.Cache.DefaultUserWs);
            }
            if (m_ttpLabelStyle == null)
            {
                ITsPropsFactory tpf = TsPropsFactoryClass.Create();
                // Get a ttp invoking the style "Language Code" style for the writing system
                // which corresponds to the user's environment.
                m_ttpLabelStyle = tpf.MakeProps("Language Code", m_lp.Cache.DefaultUserWs, 0);
            }
            vwenv.Props = m_ttpLabelStyle;
            vwenv.OpenSpan();
            vwenv.AddString(AnalysisWsLabels[iws]);
            vwenv.AddString(m_tssColon);
            vwenv.CloseSpan();
        }
示例#4
0
		/// <summary>
		/// Add to the current display (a paragraph should be open) a label followed by colon, in the standard style,
		/// that identifies a particular writing system from the current list.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="iws"></param>
		public void AddWsLabel(IVwEnv vwenv, int iws)
		{
			CheckDisposed();

			if (m_tssColon == null)
			{
				ITsStrFactory tsf = TsStrFactoryClass.Create();
				m_tssColon = tsf.MakeString(": ", m_lp.Cache.DefaultUserWs);
			}
			if (m_ttpLabelStyle == null)
			{
				m_ttpLabelStyle = LanguageCodeStyle;
			}
			vwenv.Props = m_ttpLabelStyle;
			vwenv.OpenSpan();
			vwenv.AddString(AnalysisWsLabels[iws]);
			vwenv.AddString(m_tssColon);
			vwenv.CloseSpan();
		}
示例#5
0
		private void DisplayClausePlaceholder(IVwEnv vwenv, int hvoClause)
		{
			string clauseType = GetRowStyleName(vwenv, hvoClause) + "Mkr";
			ApplyFormatting(vwenv, clauseType);
			vwenv.OpenSpan();
			InsertOpenBracket(vwenv, clauseType);
			vwenv.AddObjVec(kflidAppliesTo, this, kfragClauseLabels);
			InsertCloseBracket(vwenv, clauseType);
			vwenv.CloseSpan();
		}
示例#6
0
		private void DisplayMovedTextTag(int hvo, IVwEnv vwenv)
		{
			string formatTag1 = m_chart.Logic.MovedTextTag(vwenv.DataAccess.get_VecItem(hvo,
																						kflidAppliesTo, 0)) + "Mkr";
			ApplyFormatting(vwenv, formatTag1);
			vwenv.OpenSpan();
			InsertOpenBracket(vwenv, formatTag1);
			vwenv.AddStringAltMember((int)CmAnnotation.CmAnnotationTags.kflidComment,
									 m_cache.DefaultUserWs, this); // Enhance JohnT: what if that has changed??
			InsertCloseBracket(vwenv, formatTag1);
			vwenv.CloseSpan();
		}
示例#7
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragPrintChart: // the whole chart with headings for printing.
					if (hvo == 0)
						return;
					PrintColumnGroupHeaders(hvo, vwenv);
					PrintIndividualColumnHeaders(hvo, vwenv);
					// Rest is same as kfragChart
					DisplayChartBody(vwenv);
					break;
				case kfragTemplateHeader: // Display the template as group headers.
					vwenv.AddObjVecItems((int)CmPossibility.CmPossibilityTags.kflidSubPossibilities, this, kfragColumnGroupHeader);
					break;

					// This is only used for printing, the headers in the screen version are a separate control.
				case kfragColumnGroupHeader:
					int ccols = vwenv.DataAccess.get_VecSize(hvo, (int)CmPossibility.CmPossibilityTags.kflidSubPossibilities);
					// If there are no subitems, we still want a blank cell as a placeholder.
					MakeCellsMethod.OpenStandardCell(vwenv, Math.Max(ccols, 1), true);
					if (ccols > 0)
					{
						// It's a group, include its name
						vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum,
							(int)FwTextAlign.ktalCenter);
						vwenv.OpenParagraph();
						vwenv.AddString(CmPossibility.BestAnalysisName(m_cache, hvo));
						vwenv.CloseParagraph();
					}
					vwenv.CloseTableCell();
					break;
				case kfragChart: // the whole chart, a DsConstChart.
					if (hvo == 0)
						return;
					DisplayChartBody(vwenv);
					break;
				case kfragChartRow: // one row, a CmIndirectAnnotation
					{
						MakeTableAndRowWithStdWidths(vwenv, hvo, false);

						MakeCells(vwenv, hvo);
						vwenv.CloseTableRow();
						vwenv.CloseTable();
					}
					break;
				case kfragCca: // a single group of words, the contents of one cell.
					if (ConstituentChartLogic.IsWficGroup(m_cache, hvo))
						vwenv.AddObjVec(kflidAppliesTo, this, kfragBundleVec);
					else
					{
						// it's a moved text or missing-item placeholder.
						int hvoClause;
						if (m_chart.Logic.IsClausePlaceholder(hvo, out hvoClause))
							DisplayClausePlaceholder(vwenv, hvoClause);
						else if (vwenv.DataAccess.get_VecSize(hvo, kflidAppliesTo) == 0)
							DisplayMissingMarker(vwenv);
						else
							DisplayMovedTextTag(hvo, vwenv);
					}
					break;
				case kfragCcaMoved: // a single group of words, the contents of one cell, which is considered moved-within-line.
					// can't be a placeholder.
					string formatTag = m_chart.Logic.MovedTextTag(hvo);
					ApplyFormatting(vwenv, formatTag);
					vwenv.OpenSpan();
					InsertOpenBracket(vwenv, formatTag);
					vwenv.AddObjVec(kflidAppliesTo, this, kfragBundleVec);
					InsertCloseBracket(vwenv, formatTag);
					vwenv.CloseSpan();
					break;
				case kfragCcaListItem: // a single CCA, referring to a list item.
					// can't be a placeholder.
					ApplyFormatting(vwenv, "marker");
					vwenv.OpenSpan();
					InsertOpenBracket(vwenv, "marker");
					vwenv.AddObjProp((int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginObject,
						this, kfragPossibility);
					InsertCloseBracket(vwenv, "marker");
					vwenv.CloseSpan();
					break;
				case kfragPossibility: // A CmPossibility, show it's abbreviation
					int flid = (int)CmPossibility.CmPossibilityTags.kflidAbbreviation;
					int retWs;
					m_cache.LangProject.GetMagicStringAlt(LangProject.kwsFirstAnal, hvo, flid, false, out retWs);
					// If we didn't find an abbreviation try for the name
					ITsString tss = null;
					if (retWs != 0)
						tss = m_cache.GetMultiStringAlt(hvo, flid, retWs);
					if (tss == null || string.IsNullOrEmpty(tss.Text))
					{
						flid = (int)CmPossibility.CmPossibilityTags.kflidName;
						m_cache.LangProject.GetMagicStringAlt(LangProject.kwsFirstAnal, hvo, flid, false, out retWs);
					}
					// Unless we didn't get anything, go ahead and insert the best option we found.
					if (retWs != 0)
						vwenv.AddStringAltMember(flid, retWs, this);
					// retWS was m_cache.DefaultAnalWs, this fixes LT-7838
					break;
				case kfragBundle: // One annotated word bundle; hvo is CmBaseAnnotation. Overrides behavior of InterlinVc
					{
						SetupForTwfic(hvo);
						// Make an 'inner pile' to contain the wordform and annotations.
						// 10 points below also helps space out the paragraph.
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
							(int)FwTextPropVar.ktpvMilliPoint, 5000);
						vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum,
							(int)FwTextAlign.ktalLeading);
						vwenv.OpenInnerPile();
						// Get the instanceOf property of the annotation and see whether it exists. If not it is
						// just a punctuation annotation, and we just insert the form.
						vwenv.NoteDependency(new int[] { hvo }, new int[] { InterlinDocChild.TagAnalysis }, 1);
						int hvoInstanceOf = vwenv.DataAccess.get_ObjectProp(hvo, InterlinDocChild.TagAnalysis);
						if (hvoInstanceOf == 0)
						{
							vwenv.AddStringProp(m_flidStringValue, this);
						}
						else
						{
							// It's a full Twfic annotation, display the full bundle.
							vwenv.AddObjProp(InterlinDocChild.TagAnalysis, this, kfragTwficAnalysis);
						}
						//vwenv.AddObjProp(ktagTwficDefault, this, kfragTwficAnalysis);
						vwenv.CloseInnerPile();
						// revert back to the paragraph vernWs.
						SetupForTwfic(0);
					}
					break;
				case kfragNotesText: // notes structured text
					vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this, kfragNotesPara);
					break;
				case kfragNotesPara:
					vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, this);
					break;
				case kfragComment: // hvo is a CmAnnotation, a row
					vwenv.AddStringAltMember((int)CmAnnotation.CmAnnotationTags.kflidComment, m_chart.Logic.WsLineNumber, this);
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
示例#8
0
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragPrintChart: // the whole chart with headings for printing.
					if (hvo == 0)
						return;
					PrintColumnGroupHeaders(hvo, vwenv);
					PrintIndividualColumnHeaders(hvo, vwenv);
					// Rest is same as kfragChart
					DisplayChartBody(vwenv);
					break;
				case kfragTemplateHeader: // Display the template as group headers.
					vwenv.AddObjVecItems(CmPossibilityTags.kflidSubPossibilities, this, kfragColumnGroupHeader);
					break;

					// This is only used for printing, the headers in the screen version are a separate control.
				case kfragColumnGroupHeader:
					var ccols = vwenv.DataAccess.get_VecSize(hvo, CmPossibilityTags.kflidSubPossibilities);
					// If there are no subitems, we still want a blank cell as a placeholder.
					MakeCellsMethod.OpenStandardCell(vwenv, Math.Max(ccols, 1), true);
					if (ccols > 0)
					{
						// It's a group, include its name
						var possGroup = m_cache.ServiceLocator.GetInstance<ICmPossibilityRepository>().GetObject(hvo);
						vwenv.set_IntProperty((int) FwTextPropType.ktptAlign, (int) FwTextPropVar.ktpvEnum,
											(int) FwTextAlign.ktalCenter);
						vwenv.OpenParagraph();
						vwenv.AddString(possGroup.Name.BestAnalysisAlternative);
						vwenv.CloseParagraph();
					}
					vwenv.CloseTableCell();
					break;
				case kfragChart: // the whole chart, a DsConstChart.
					if (hvo == 0)
						return;
					DisplayChartBody(vwenv);
					break;
				case kfragChartRow: // one row, a ConstChartRow
					{
						MakeTableAndRowWithStdWidths(vwenv, hvo, false);

						MakeCells(vwenv, hvo);
						vwenv.CloseTableRow();
						vwenv.CloseTable();
					}
					break;
				case kfragCellPart: // a single group of words, the contents of one cell.
					if (m_chart.Logic.IsWordGroup(hvo))
						DisplayWordforms(vwenv, hvo);
					else
					{
						// it's a moved text or clause reference placeholder.
						int hvoClause;
						if (m_chart.Logic.IsClausePlaceholder(hvo, out hvoClause))
							DisplayClausePlaceholder(vwenv, hvoClause);
						else
							DisplayMovedTextTag(hvo, vwenv);
					}
					break;
				case kfragMovedTextCellPart: // a single group of words (ConstChartWordGroup),
					// the contents of one cell, which is considered moved-within-line.
					// Can't be a placeholder.
					var formatTag = m_chart.Logic.MovedTextTag(hvo);
					ApplyFormatting(vwenv, formatTag);
					vwenv.OpenSpan();
					InsertOpenBracket(vwenv, formatTag);
					DisplayWordforms(vwenv, hvo);
					InsertCloseBracket(vwenv, formatTag);
					vwenv.CloseSpan();
					break;
				case kfragChartListItem: // a single ConstChartTag, referring to a list item.
					// can't be a placeholder.
					ApplyFormatting(vwenv, "marker");
					vwenv.OpenSpan();
					InsertOpenBracket(vwenv, "marker");
					vwenv.AddObjProp(ConstChartTagTags.kflidTag, this, kfragPossibility);
					InsertCloseBracket(vwenv, "marker");
					vwenv.CloseSpan();
					break;
				case kfragPossibility: // A CmPossibility, show it's abbreviation
					var flid = CmPossibilityTags.kflidAbbreviation;
					var retWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsFirstAnal, hvo, flid);
					if (retWs == 0)
					{
						// No Abbreviation! Switch to Name
						flid = CmPossibilityTags.kflidName;
						retWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsFirstAnal, hvo, flid);
					}
					// Unless we didn't get anything, go ahead and insert the best option we found.
					if (retWs != 0)
						vwenv.AddStringAltMember(flid, retWs, this);
					break;
				case kfragBundle: // One annotated word bundle; hvo is IAnalysis object. Overrides behavior of InterlinVc
					AddWordBundleInternal(hvo, vwenv);
					break;
				case kfragNotesString: // notes text
					vwenv.AddStringProp(ConstChartRowTags.kflidNotes, this);
					break;
				case kfragComment: // hvo is a ConstChartRow
					vwenv.AddStringProp(ConstChartRowTags.kflidLabel, this);
					break;
				case kfragMTMarker:
					var mtt = m_partRepo.GetObject(vwenv.OpenObject) as IConstChartMovedTextMarker;
					Debug.Assert(mtt != null, "Invalid MovedTextMarker?");
					vwenv.AddString(mtt.Preposed ? m_sMovedTextBefore : m_sMovedTextAfter);
					// Need to regenerate this if the row my WordGroup is in changes.
					vwenv.NoteDependency(new[] {mtt.WordGroupRA.Owner.Hvo}, new int[] {ConstChartRowTags.kflidCells}, 1);
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
示例#9
0
		private void DisplayMovedTextTag(int hvo, IVwEnv vwenv)
		{
			// hvo is a ConstChartMovedTextMarker
			var mtt = m_partRepo.GetObject(hvo) as IConstChartMovedTextMarker;
			Debug.Assert(mtt != null, "Hvo is not for a MovedText Marker.");
			var formatTag1 = m_chart.Logic.MovedTextTag(mtt.WordGroupRA.Hvo) + "Mkr";
			ApplyFormatting(vwenv, formatTag1);
			vwenv.OpenSpan();
			InsertOpenBracket(vwenv, formatTag1);
			vwenv.AddObj(hvo, this, kfragMTMarker);
			InsertCloseBracket(vwenv, formatTag1);
			vwenv.CloseSpan();
		}
示例#10
0
		/// <summary>
		/// Add to the current display (a paragraph should be open) a label followed by colon, in the standard style,
		/// that identifies a particular writing system from the current list.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="iws"></param>
		public void AddWsLabel(IVwEnv vwenv, int iws)
		{
			CheckDisposed();

			if (m_tssColon == null)
			{
				ITsStrFactory tsf = TsStrFactoryClass.Create();
				m_tssColon = tsf.MakeString(": ", m_lp.Cache.DefaultUserWs);
			}
			if (m_ttpLabelStyle == null)
			{
				ITsPropsFactory tpf = TsPropsFactoryClass.Create();
				// Get a ttp invoking the style "Language Code" style for the writing system
				// which corresponds to the user's environment.
				m_ttpLabelStyle = tpf.MakeProps("Language Code", m_lp.Cache.DefaultUserWs, 0);
			}
			vwenv.Props = m_ttpLabelStyle;
			vwenv.OpenSpan();
			vwenv.AddString(AnalysisWsLabels[iws]);
			vwenv.AddString(m_tssColon);
			vwenv.CloseSpan();
		}