Пример #1
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Convert each of the child paragraphs into an ITsString object, and add that object
        /// to the given list. If the paragraph's writing system cannot be found, then the
        /// specified default writing system is used.
        /// </summary>
        /// -----------------------------------------------------------------------------------
        public StTxtParaBldr BuildParagraph(FwStyleSheet styleSheet, int wsDefault)
        {
            StTxtParaBldr bldr;
            int           wsPara = (string.IsNullOrEmpty(IcuLocale) ?
                                    wsDefault : ScrNoteImportManager.GetWsForLocale(IcuLocale));

            bldr = new StTxtParaBldr(styleSheet.Cache);
            string stylename = (string.IsNullOrEmpty(StyleName) ?
                                ScrStyleNames.Remark : StyleName);

            bldr.ParaStylePropsProxy = StyleProxyListManager.GetXmlParaStyleProxy(
                stylename, ContextValues.Annotation, wsDefault);

            foreach (XmlTextRun run in Runs)
            {
                int ws = (string.IsNullOrEmpty(run.IcuLocale) ?
                          wsPara : ScrNoteImportManager.GetWsForLocale(run.IcuLocale));

                run.AddToParaBldr(bldr, ws, styleSheet);
            }

            // OXES supports mixed text so this is designed to handle text that
            // is found in the "para" tag but not in any "span" or "a" tag.
            if (!string.IsNullOrEmpty(m_text))
            {
                XmlTextRun extraText = new XmlTextRun();
                extraText.Text = m_text;
                extraText.AddToParaBldr(bldr, wsPara, styleSheet);
            }

            return(bldr);
        }
Пример #2
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Convert each of the child paragraphs into an ITsString object, and add that object
		/// to the given list. If the paragraph's writing system cannot be found, then the
		/// specified default writing system is used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public StTxtParaBldr BuildParagraph(FwStyleSheet styleSheet, int wsDefault)
		{
			StTxtParaBldr bldr;
			int wsPara = (string.IsNullOrEmpty(IcuLocale) ?
				wsDefault : ScrNoteImportManager.GetWsForLocale(IcuLocale));

			bldr = new StTxtParaBldr(styleSheet.Cache);
			string stylename = (string.IsNullOrEmpty(StyleName) ?
				ScrStyleNames.Remark : StyleName);

			bldr.ParaStylePropsProxy = StyleProxyListManager.GetXmlParaStyleProxy(
				stylename, ContextValues.Annotation, wsDefault);

			foreach (XmlTextRun run in Runs)
			{
				int ws = (string.IsNullOrEmpty(run.IcuLocale) ?
					wsPara : ScrNoteImportManager.GetWsForLocale(run.IcuLocale));

				run.AddToParaBldr(bldr, ws, styleSheet);
			}

			// OXES supports mixed text so this is designed to handle text that
			// is found in the "para" tag but not in any "span" or "a" tag.
			if (!string.IsNullOrEmpty(m_text))
			{
				XmlTextRun extraText = new XmlTextRun();
				extraText.Text = m_text;
				extraText.AddToParaBldr(bldr, wsPara, styleSheet);
			}

			return bldr;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the specified text to a new paragraph (where each string is the text of a new
		/// paragraph)
		/// </summary>
		/// <param name="paraList">The list of paragraphs to add to</param>
		/// <param name="paras">The text of the paragraphs to add</param>
		/// ------------------------------------------------------------------------------------
		private void AddParasTo(List<XmlNotePara> paraList, params string[] paras)
		{
			foreach (string paraText in paras)
			{
				XmlNotePara newPara = new XmlNotePara();
				XmlTextRun run = new XmlTextRun();
				run.Text = paraText;
				newPara.Runs.Add(run);
				paraList.Add(newPara);
			}
		}