示例#1
0
        public void GoodMultiUnicodeTest()
        {
            // Start with expected information.
            Assert.AreEqual(0, Cache.LangProject.MainCountry.StringCount, "Wrong number of alternatives for Cache.LangProject.MainCountryAccessor");

            // Create a good string.
            var           english = Cache.LangProject.CurrentAnalysisWritingSystems.First();
            ITsIncStrBldr tisb    = TsStringUtils.MakeIncStrBldr();

            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, english.Handle);
            tisb.Append("Mexico");
            Cache.LangProject.MainCountry.set_String(english.Handle, tisb.GetString());

            // Make sure it is in there now.
            Assert.AreEqual(1, Cache.LangProject.MainCountry.StringCount, "Wrong number of alternatives for Cache.LangProject.MainCountryAccessor");
            int ws;
            var mexico = Cache.LangProject.MainCountry.GetStringFromIndex(0, out ws);

            Assert.AreEqual(english.Handle, ws, "Wrong writing system.");
            Assert.AreEqual("Mexico", mexico.Text, "Wrong text.");

            // Add the same ws string, but with different text.
            tisb = TsStringUtils.MakeIncStrBldr();
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, english.Handle);
            tisb.Append("Guatemala");
            Cache.LangProject.MainCountry.set_String(english.Handle, tisb.GetString());

            // Make sure it is in there now.
            Assert.AreEqual(1, Cache.LangProject.MainCountry.StringCount, "Wrong number of alternatives for Cache.LangProject.MainCountryAccessor");
            var guatemala = Cache.LangProject.MainCountry.GetStringFromIndex(0, out ws);

            Assert.AreEqual(english.Handle, ws, "Wrong writing system.");
            Assert.AreEqual("Guatemala", guatemala.Text, "Wrong text.");
        }
示例#2
0
        public void UpdateUserPrompt_Vern_Typing()
        {
            // Set up section head with an empty paragraph
            IScrSection section = AddSectionToMockedBook(m_book);
            IStTxtPara  para    = AddSectionHeadParaToSection(section, "",
                                                              ScrStyleNames.SectionHead);

            IVwRootBox   rootb;
            IVwSelection vwsel;
            IVwRootSite  rootsite;

            SetUpResultsForUpdateUserPromptTests(4, "t", out rootb, out vwsel, out rootsite);

            int defVernWs = Cache.DefaultVernWs;

            DummyTeStVc   stVc    = new DummyTeStVc(Cache, defVernWs, rootb);
            ITsIncStrBldr strBdlr = TsIncStrBldrClass.Create();

            strBdlr.SetIntPropValues(SimpleRootSite.ktptUserPrompt, (int)FwTextPropVar.ktpvDefault, 1);
            strBdlr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, Cache.DefaultUserWs);
            strBdlr.Append("t");
            ITsString tssTyped    = strBdlr.GetString();
            ITsString tssExpected = TsStringUtils.MakeTss("t", defVernWs);

            // Now simulate the user typing over the user prompt
            stVc.UpdateProp(vwsel, para.Hvo, SimpleRootSite.kTagUserPrompt, 0, tssTyped);

            // verify that the text is in the paragraph and that there is no longer a user prompt.
            string diff;

            Assert.IsTrue(TsStringHelper.TsStringsAreEqual(tssExpected, para.Contents, out diff), diff);

            m_vwenvMock.VerifyAllExpectations();
            VerifyArgsSentToRequestSelectionAtEndOfUow(rootsite, rootb, 0, 4, StTxtParaTags.kflidContents, "t");
        }
示例#3
0
 /// <summary>
 /// This method will use the current homograph-number settings to insert the homograph number into the string
 /// </summary>
 public static void InsertHomographNumber(ITsIncStrBldr tisb, int nHomograph, HomographConfiguration hc,
                                          HomographConfiguration.HeadwordVariant hv, LcmCache cache)
 {
     if (nHomograph > 0 && hc.ShowHomographNumber(hv))
     {
         tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, HomographConfiguration.ksHomographNumberStyle);
         if (!string.IsNullOrEmpty(hc.WritingSystem))
         {
             tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.WritingSystemFactory.GetWsFromStr(hc.WritingSystem));
         }
         else
         {
             tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.DefaultVernWs);
         }
         var hnString = nHomograph.ToString();
         if (hc.CustomHomographNumbers.Count == 10)
         {
             for (var i = 0; i < 10; ++i)
             {
                 hnString = hnString.Replace(i.ToString(), hc.CustomHomographNumbers[i]);
             }
         }
         tisb.Append(hnString);
         tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null);
     }
 }
示例#4
0
        public void AppendAlternativesTest()
        {
            var           english = Cache.LangProject.CurrentAnalysisWritingSystems.ElementAt(0);
            var           spanish = Cache.LangProject.CurrentAnalysisWritingSystems.ElementAt(1);
            ITsIncStrBldr tisb    = TsStringUtils.MakeIncStrBldr();

            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, english.Handle);
            tisb.Append("Mexico");
            Cache.LangProject.MainCountry.set_String(english.Handle, tisb.GetString());

            tisb = TsStringUtils.MakeIncStrBldr();
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, spanish.Handle);
            tisb.Append("Mejico");
            Cache.LangProject.MainCountry.set_String(spanish.Handle, tisb.GetString());

            tisb = TsStringUtils.MakeIncStrBldr();
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, english.Handle);
            tisb.Append("Saltillo");
            Cache.LangProject.FieldWorkLocation.set_String(english.Handle, tisb.GetString());

            Cache.LangProject.FieldWorkLocation.AppendAlternatives(Cache.LangProject.MainCountry);
            Assert.AreEqual("Saltillo Mexico", Cache.LangProject.FieldWorkLocation.get_String(english.Handle).Text);
            Assert.AreEqual("Mejico", Cache.LangProject.FieldWorkLocation.get_String(spanish.Handle).Text);

            tisb = TsStringUtils.MakeIncStrBldr();
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, spanish.Handle);
            tisb.Append("Saltillo");
            Cache.LangProject.FieldWorkLocation.set_String(spanish.Handle, tisb.GetString());

            ((ITsMultiString)Cache.LangProject.MainCountry).set_String(english.Handle, null);

            Cache.LangProject.FieldWorkLocation.AppendAlternatives(Cache.LangProject.MainCountry);
            Assert.AreEqual("Saltillo Mexico", Cache.LangProject.FieldWorkLocation.get_String(english.Handle).Text);
            Assert.AreEqual("Saltillo Mejico", Cache.LangProject.FieldWorkLocation.get_String(spanish.Handle).Text);
        }
示例#5
0
        private static void AddHeadwordForWsAndHn(ILexEntry entry, int wsVern, int nHomograph, HomographConfiguration.HeadwordVariant hv,
                                                  ITsIncStrBldr tisb, string citationForm, LcmCache cache)
        {
            var ws = cache?.WritingSystemFactory?.get_EngineOrNull(wsVern);

            // Audio writing systems actually store a filename and should not have homograph numbers attached
            if (IsAudioWritingSystem(ws))
            {
                tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, wsVern);
                tisb.Append(citationForm);
                return;
            }
            var hc = entry.Services.GetInstance <HomographConfiguration>();

            if (hc.HomographNumberBefore)
            {
                InsertHomographNumber(tisb, nHomograph, hc, hv, cache);
            }
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, wsVern);
            tisb.Append(citationForm);

            if (!hc.HomographNumberBefore)
            {
                InsertHomographNumber(tisb, nHomograph, hc, hv, cache);
            }
        }
        /// <summary>
        /// This method is called when a user selects Delete Relation on a Lexical Relation slice.
        /// For: Pair relation (eg. Antonym)
        ///     tree relation (parts/whole when deleting a Parts slice)
        /// </summary>
        /// <param name="hvo"></param>
        public void DeleteReference(int hvo)
        {
            CheckDisposed();
            if (hvo <= 0)
            {
                throw new ConfigurationException("Slice:GetObjectHvoForMenusToOperateOn is either messed up or should not have been called, because it could not find the object to be deleted.", m_configurationNode);
            }
            else
            {
                Form mainWindow = (Form)Mediator.PropertyTable.GetValue("window");
                mainWindow.Cursor = Cursors.WaitCursor;
                using (ConfirmDeleteObjectDlg dlg = new ConfirmDeleteObjectDlg())
                {
                    CmObjectUi    ui = CmObjectUi.MakeUi(m_cache, hvo);
                    ILexReference lr = LexReference.CreateFromDBObject(m_cache, hvo);

                    //We need this to determine which kind of relation we are deleting
                    LexRefType lrtOwner =
                        (LexRefType)CmObject.CreateFromDBObject(m_cache, lr.OwnerHVO);

                    int           analWs = m_cache.DefaultAnalWs;
                    int           userWs = m_cache.DefaultUserWs;
                    ITsIncStrBldr tisb   = TsIncStrBldrClass.Create();
                    tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, userWs);

                    switch ((LexRefType.MappingTypes)lrtOwner.MappingType)
                    {
                    case LexRefType.MappingTypes.kmtSenseTree:
                    case LexRefType.MappingTypes.kmtEntryTree:
                    case LexRefType.MappingTypes.kmtEntryOrSenseTree:
                        tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, userWs);
                        tisb.Append(String.Format(LexEdStrings.ksDeleteLexTree, "\x2028"));
                        dlg.SetDlgInfo(ui, m_cache, Mediator, tisb.GetString());
                        break;

                    default:
                        dlg.SetDlgInfo(ui, m_cache, Mediator);
                        break;
                    }

                    if (DialogResult.Yes == dlg.ShowDialog(mainWindow))
                    {
                        lr.DeleteUnderlyingObject();
                        //Update the display because we have removed this slice from the Lexical entry.
                        UpdateForDelete(hvo);

                        mainWindow.Cursor = Cursors.Default;
                    }
                    else                     //If the user selected Cancel in the delete dialog do nothing
                    {
                        mainWindow.Cursor = Cursors.Default;
                        return;
                    }
                }
            }
        }
示例#7
0
        /// <summary>
        /// Returns a TsString with the entry headword and a sense number if there
        /// are more than one senses.
        /// </summary>
        public ITsString OwnerOutlineNameForWs(ILexSense sense, int wsVern, HomographConfiguration.HeadwordVariant hv)
        {
            var entry = sense.Entry;
            int hn;

            if (!m_homographNumbers.TryGetValue(entry.Hvo, out hn))
            {
                hn = entry.HomographNumber;                 // unknown entry, use its own HN instead of our override
            }
            ITsIncStrBldr tisb = TsIncStrBldrClass.Create();

            tisb.AppendTsString(StringServices.HeadWordForWsAndHn(entry, wsVern, hn, "", hv));
            var hc = sense.Services.GetInstance <HomographConfiguration>();

            if (hc.ShowSenseNumber(hv) && HasMoreThanOneSense(entry))
            {
                // These int props may not be needed, but they're safe.
                tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0,
                                      Cache.DefaultAnalWs);
                tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                     HomographConfiguration.ksSenseReferenceNumberStyle);
                tisb.Append(" ");
                tisb.Append(GetSenseNumber(sense));
            }
            return(tisb.GetString());
        }
示例#8
0
        private static void AddHeadwordForWsAndHn(ILexEntry entry, int wsVern, int nHomograph,
                                                  HomographConfiguration.HeadwordVariant hv, ITsIncStrBldr tisb, string citationForm)
        {
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, wsVern);
            var hc = entry.Services.GetInstance <HomographConfiguration>();

            if (hc.HomographNumberBefore)
            {
                InsertHomographNumber(tisb, nHomograph, hc, hv);
            }
            tisb.Append(citationForm);

            // (EricP) Tried to automatically update the homograph number, but doing that here will
            // steal away manual changes to the HomographNumber column. Also suppressing PropChanged
            // is necessary when HomographNumber column is enabled, otherwise changing the entry index can hang.
            //using (new IgnorePropChanged(cache, PropChangedHandling.SuppressView))
            //{
            //	  ValidateExistingHomographs(CollectHomographs(cache, ShortName1StaticForWs(cache, hvo, wsVern), 0, morphType));
            //}

            if (!hc.HomographNumberBefore)
            {
                InsertHomographNumber(tisb, nHomograph, hc, hv);
            }
        }
示例#9
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the a text run from a string representation.
        /// </summary>
        /// <param name="owner">The owner of the paragraph (book).</param>
        /// <param name="strBldr">The structured string builder.</param>
        /// <param name="textNode">The text node which describes runs to be added to the
        /// paragraph or to the translation for a particular writing system</param>
        /// ------------------------------------------------------------------------------------
        private static void CreateRunFromStringRep(CmObject owner, ITsIncStrBldr strBldr,
                                                   XmlNode textNode)
        {
            XmlNode charStyle = textNode.Attributes.GetNamedItem("CS");

            if (charStyle != null)
            {
                strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                        charStyle.Value);
            }
            else
            {
                strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                        null);
            }

            XmlNode wsICULocale = textNode.Attributes.GetNamedItem("WS");

            if (wsICULocale != null)
            {
                ILgWritingSystemFactory wsf = owner.Cache.LanguageWritingSystemFactoryAccessor;
                int ws = wsf.GetWsFromStr(wsICULocale.Value);
                if (ws <= 0)
                {
                    throw new ArgumentException("Unknown ICU locale encountered: '" + wsICULocale.Value + "'");
                }
                strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                         (int)FwTextPropVar.ktpvDefault, wsf.GetWsFromStr(wsICULocale.Value));
            }
            else
            {
                throw new ArgumentException("Required attribute WS missing from RUN element.");
            }
        }
示例#10
0
        public void GetTextRepresentation_MultiCharStylePara()
        {
            ITsIncStrBldr strBldr = m_footnotePara.Contents.GetIncBldr();

            // run 1
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Emphasis");
            strBldr.Append("Test Text");

            // run 2
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    null);
            strBldr.Append("No char style");

            // run 3
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Quoted Text");
            strBldr.Append("Ahh!!!!!!");

            // run 4
            strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_wsDe);
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Untranslated Word");
            strBldr.Append(" untranslated");

            m_footnotePara.Contents = strBldr.GetString();

            string result = m_footnote.TextRepresentation;

            Assert.AreEqual("<FN><M>a</M><P><PS>Note General Paragraph</PS>" +
                            "<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" +
                            "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" +
                            "<RUN WS='de' CS='Untranslated Word'> untranslated</RUN></P></FN>", result);
        }
示例#11
0
 public void DontShowMessageBoxForAsserts()
 {
     using (DebugProcs debugProcs = new DebugProcs(false))
     {
         ITsIncStrBldr bldr = TsIncStrBldrClass.Create();
         // asserts - this brings up a message box if ShowAssertMessageBox doesn't work
         bldr.SetIntPropValues(1, 0, 0);
     }
 }
示例#12
0
        public ITsString CreateFromAStr(XmlNode aStrNode, out int wsAStr)
        {
            wsAStr = m_wsCache[aStrNode.Attributes["ws"].Value];
            ITsIncStrBldr tisb = TsStringUtils.MakeIncStrBldr();

            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, wsAStr);
            ProcessRunElements(aStrNode.ChildNodes, tisb);

            return(tisb.GetString());
        }
        public void FullTextSearchTest()
        {
            var searcher = new StringSearcher <int>(SearchType.FullText, m_wsManager);

            searcher.Add(0, 0, m_tsf.MakeString("test", m_enWs));
            searcher.Add(1, 0, m_tsf.MakeString("c'est une phrase", m_frWs));
            ITsIncStrBldr tisb = m_tsf.GetIncBldr();

            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_frWs);
            tisb.Append("C'est une sentence. ");
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_enWs);
            tisb.Append("We use it for testing purposes.");
            searcher.Add(2, 0, tisb.GetString());
            searcher.Add(3, 0, m_tsf.MakeString("Hello, how are you doing? I am doing fine. That is good to know.", m_enWs));

            CheckSearch(searcher, m_tsf.MakeString("test", m_enWs), new[] { 0, 2 });
            CheckSearch(searcher, m_tsf.MakeString("c'est une", m_frWs), new[] { 1, 2 });
            CheckSearch(searcher, m_tsf.MakeString("t", m_enWs), new[] { 0, 2, 3 });
            CheckSearch(searcher, m_tsf.MakeString("testing purpose", m_enWs), new[] { 2 });
        }
示例#14
0
        public void ReportHook()
        {
            using (DummyDebugProcs debugProcs = new DummyDebugProcs(false))
            {
                ITsIncStrBldr bldr = TsIncStrBldrClass.Create();
                // next line asserts
                bldr.SetIntPropValues(1, 0, 0);

                Assert.IsTrue(debugProcs.m_fHandlerCalled);
            }
        }
        public static ITsString SpanStrToTsString(string source, int mainWs, ILgWritingSystemFactory wsf)
        {
            // How to build up an ITsString via an ITsIncStrBldr -
            // 1. Use SetIntPropValues or SetStrPropValues to set a property "to be applied to any subsequent append operations".
            // 2. THEN use Append(string s) to add a string, which will "pick up" the properties set in step 1.
            // See ScrFootnoteFactory.CreateRunFromStringRep() in FdoFactoryAdditions.cs for a good example.
            if (source == null)
            {
                return(null);
            }
            List <Run>    runs    = GetSpanRuns(source);
            ITsIncStrBldr builder = TsIncStrBldrClass.Create();

            // Will become: ITsIncStrBldr builder = TsStringUtils.MakeIncStrBldr();  // Add "using SIL.CoreImpl;" when this line is uncommented.
            foreach (Run run in runs)
            {
                builder.ClearProps();                 // Make sure there aren't leftover properties from previous run
                // To remove a string property, you set it to null, so we can just use StyleName directly whether or not it's null.
                builder.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, run.StyleName);
                int runWs = (run.Lang == null) ? mainWs : wsf.GetWsFromStr(run.Lang);
                builder.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, runWs);
                // We don't care about Guids in this function, so run.Guid is ignored
                // But we do need to set any other int or string properties that were in the original
                if (run.IntProperties != null)
                {
                    foreach (KeyValuePair <int, IntProperty> prop in run.IntProperties)
                    {
                        builder.SetIntPropValues(prop.Key, prop.Value.Variation, prop.Value.Value);
                    }
                }
                if (run.StringProperties != null)
                {
                    foreach (KeyValuePair <int, string> prop in run.StringProperties)
                    {
                        builder.SetStrPropValue(prop.Key, prop.Value);
                    }
                }
                builder.Append(run.Content);
            }
            return(builder.GetString());
        }
示例#16
0
        public void GetTextRepresentation_MultiCharStylePara()
        {
            CheckDisposed();

            ITsIncStrBldr strBldr = TsIncStrBldrClass.Create();

            strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_vernWs);

            // run 1
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Emphasis");
            strBldr.Append("Test Text");

            // run 2
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    null);
            strBldr.Append("No char style");

            // run 3
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Quoted Text");
            strBldr.Append("Ahh!!!!!!");

            // run 4
            strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_wsDe);
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Untranslated Word");
            strBldr.Append(" untranslated");

            m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString();

            string result = m_footnote.GetTextRepresentation();

            Assert.AreEqual(@"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                            @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" +
                            "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" +
                            "<RUN WS='de' CS='Untranslated Word'> untranslated</RUN></P></FN>", result);
        }
示例#17
0
        /// <summary>
        /// Method to insert the homograph number with settings into the Text
        /// </summary>
        private void InsertHomographNumber(IVwEnv vwenv, HomographConfiguration hc, int nHomograph, int defUserWs)
        {
            if (nHomograph <= 0)
            {
                return;
            }

            // Use a string builder to embed the properties in with the TsString.
            // this allows our TsStringCollectorEnv to properly encode the superscript.
            // ideally, TsStringCollectorEnv could be made smarter to handle SetIntPropValues
            // since AppendTss treats the given Tss as atomic.
            ITsIncStrBldr tsBldr = TsStringUtils.MakeIncStrBldr();

            tsBldr.SetIntPropValues((int)FwTextPropType.ktptSuperscript,
                                    (int)FwTextPropVar.ktpvEnum,
                                    (int)FwSuperscriptVal.kssvSub);
            tsBldr.SetIntPropValues((int)FwTextPropType.ktptBold,
                                    (int)FwTextPropVar.ktpvEnum,
                                    (int)FwTextToggleVal.kttvForceOn);
            tsBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                    (int)FwTextPropVar.ktpvDefault, defUserWs);
            StringServices.InsertHomographNumber(tsBldr, nHomograph, hc, HomographConfiguration.HeadwordVariant.Main, m_cache);
            vwenv.AddString(tsBldr.GetString());
        }
示例#18
0
        public void CountTest()
        {
            // Start with expected information.
            Assert.AreEqual(2, Cache.LangProject.Description.StringCount, "Wrong number of alternatives for Cache.LangProject.DescriptionAccessor");

            // Create a good string.
            CoreWritingSystemDefinition german = Cache.ServiceLocator.WritingSystemManager.Get("de");

            ITsIncStrBldr tisb = TsStringUtils.MakeIncStrBldr();

            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, german.Handle);
            tisb.Append("Deutchland");
            Cache.LangProject.Description.set_String(german.Handle, tisb.GetString());
            //// Make sure it is in there now.
            Assert.AreEqual(3, Cache.LangProject.Description.StringCount, "Wrong number of alternatives for Cache.LangProject.DescriptionAccessor");

            //// Add the same ws string, but with different text.
            tisb = TsStringUtils.MakeIncStrBldr();
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, german.Handle);
            tisb.Append("heilige");
            Cache.LangProject.Description.set_String(german.Handle, tisb.GetString());
            //// Make sure it is in there now.
            Assert.AreEqual(3, Cache.LangProject.Description.StringCount, "Wrong number of alternatives for Cache.LangProject.DescriptionAccessor");
        }
示例#19
0
        private static void AddHeadwordForWsAndHn(ILexEntry entry, int wsVern, int nHomograph, HomographConfiguration.HeadwordVariant hv,
                                                  ITsIncStrBldr tisb, string citationForm, LcmCache cache)
        {
            var hc = entry.Services.GetInstance <HomographConfiguration>();

            if (hc.HomographNumberBefore)
            {
                InsertHomographNumber(tisb, nHomograph, hc, hv, cache);
            }
            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, wsVern);
            tisb.Append(citationForm);

            if (!hc.HomographNumberBefore)
            {
                InsertHomographNumber(tisb, nHomograph, hc, hv, cache);
            }
        }
示例#20
0
        public void GetTextRepresentation_charStylePara()
        {
            CheckDisposed();

            ITsIncStrBldr strBldr = TsIncStrBldrClass.Create();

            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Emphasis");
            strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_vernWs);
            strBldr.Append("Test Text");
            m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString();
            string result = m_footnote.GetTextRepresentation();

            Assert.AreEqual(@"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                            "<RUN WS='fr' CS='Emphasis'>Test Text</RUN></P></FN>", result);
        }
示例#21
0
        public void GetTextRepresentation_BT_MultiCharStylePara()
        {
            CheckDisposed();
            SetupBackTrans();

            ITsIncStrBldr strBldr = TsIncStrBldrClass.Create();

            strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_vernWs);

            // run 1
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Emphasis");
            strBldr.Append("Test Text");

            // run 2
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    null);
            strBldr.Append("No char style");

            // run 3
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                    "Quoted Text");
            strBldr.Append("Ahh!!!!!!");

            m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString();

            // Now add back translations with and without character styles.
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, "Spanish", null);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, m_vernWs, " back ", ScrStyleNames.UntranslatedWord);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, " translation!", "Emphasis");

            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, "German!", "Emphasis");
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, m_vernWs, " back ", ScrStyleNames.UntranslatedWord);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, " translation", null);

            string result = m_footnote.GetTextRepresentation();

            Assert.AreEqual(@"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                            @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" +
                            "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" +
                            "<TRANS WS='es'><RUN WS='es'>Spanish</RUN><RUN WS='fr' CS='Untranslated Word'> back </RUN><RUN WS='es' CS='Emphasis'> translation!</RUN></TRANS>" +
                            "<TRANS WS='de'><RUN WS='de' CS='Emphasis'>German!</RUN><RUN WS='fr' CS='Untranslated Word'> back </RUN><RUN WS='de'> translation</RUN></TRANS>" +
                            "</P></FN>", result);
        }
示例#22
0
        public void CreateFromStringRep_BT_MultiCharStylePara()
        {
            CheckDisposed();
            SetupBackTrans();

            ITsIncStrBldr strBldr = TsIncStrBldrClass.Create();

            strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_vernWs);

            // Setup expected results for the footnote
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis");       // run 1
            strBldr.Append("Test Text");
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null);             // run 2
            strBldr.Append("No char style");
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Quoted Text");    // run 3
            strBldr.Append("Ahh!!!!!!");
            m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString();

            // ... and now set up the expected results for the back translations of the footnote.
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, "Spanish", null);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, m_vernWs, " back ", ScrStyleNames.UntranslatedWord);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, " translation!", "Emphasis");

            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, "German!", "Emphasis");
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, m_vernWs, " back ", ScrStyleNames.UntranslatedWord);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, " translation", null);

            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" +
                                 "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" +
                                 "<TRANS WS='es'><RUN WS='es'>Spanish</RUN><RUN WS='fr' CS='Untranslated Word'> back </RUN>" +
                                 "<RUN WS='es' CS='Emphasis'> translation!</RUN></TRANS>" +
                                 "<TRANS WS='de'><RUN WS='de' CS='Emphasis'>German!</RUN>" +
                                 "<RUN WS='fr' CS='Untranslated Word'> back </RUN><RUN WS='de'> translation</RUN></TRANS></P></FN>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
示例#23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="captionText">The BT caption text (can be null).</param>
		/// <param name="sCopyright">The BT copyright text (can be null).</param>
		/// <param name="ws">The writing system of the BT.</param>
		/// <param name="filename">The name of the file being imported.</param>
		/// <param name="lineNumber">The line number of the first BT segment encountered for
		/// this picture.</param>
		/// <param name="segment">The first BT segment encountered for this picture.</param>
		/// <param name="reference">The Scripture reference.</param>
		/// ------------------------------------------------------------------------------------
		public BTPictureInfo(string captionText, string sCopyright, int ws, string filename,
			int lineNumber, string segment, BCVRef reference)
		{
			m_strbldrCaption = TsIncStrBldrClass.Create();
			m_strbldrCaption.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, ws);
			if (!String.IsNullOrEmpty(captionText))
				m_strbldrCaption.Append(captionText);
			m_copyright = sCopyright;
			m_ws = ws;
			m_filename = filename;
			m_lineNumber = lineNumber;
			m_segment = segment;
			m_ref = new BCVRef(reference);
		}
示例#24
0
        /// <summary>
        /// Initialize the dialog before showing it.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="entry"></param>
        /// <param name="titleForEdit">Edit title appropriate to the button's context.</param>
        public void SetDlgInfo(FdoCache cache, IPersistenceProvider persistProvider,
                               Mediator mediator, ILexEntry entry, SandboxGenericMSA sandboxMsa, int hvoOriginalMsa,
                               bool useForEdit, string titleForEdit)
        {
            CheckDisposed();

            Debug.Assert(m_cache == null);
            MsaType msaType = sandboxMsa.MsaType;

            m_cache    = cache;
            m_mediator = mediator;

            if (useForEdit)
            {
                // Change the window title and the OK button text.
                Text        = titleForEdit;
                s_helpTopic = "khtpEditGrammaticalFunction";
                btnOk.Text  = LexText.Controls.LexTextControls.ks_OK;
            }
            helpProvider.HelpNamespace = mediator.HelpTopicProvider.HelpFile;
            helpProvider.SetHelpKeyword(this, mediator.HelpTopicProvider.GetHelpString(s_helpTopic));
            helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);

            // Set font, writing system factory, and code for the edit box.
            float          fntSize   = label1.Font.Size * 2.0F;
            IWritingSystem defVernWs = m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem;

            m_fwtbCitationForm.Font = new Font(defVernWs.DefaultFontName, fntSize);
            m_fwtbCitationForm.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_fwtbCitationForm.WritingSystemCode    = defVernWs.Handle;
            m_fwtbCitationForm.AdjustForStyleSheet(this, null, mediator);
            m_fwtbCitationForm.AdjustStringHeight = false;
            m_fwtbCitationForm.Tss       = entry.HeadWord;
            m_fwtbCitationForm.HasBorder = false;

            m_fwtbSenses.Font = new Font(defVernWs.DefaultFontName, fntSize);
            m_fwtbSenses.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_fwtbSenses.WritingSystemCode    = defVernWs.Handle;
            m_fwtbSenses.AdjustForStyleSheet(this, null, mediator);
            m_fwtbSenses.AdjustStringHeight = false;

            ITsIncStrBldr tisb = TsIncStrBldrClass.Create();

            tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, m_cache.DefaultAnalWs);
            var msaRepository = m_cache.ServiceLocator.GetInstance <IMoMorphSynAnalysisRepository>();

            if (hvoOriginalMsa != 0)
            {
                foreach (var sense in entry.AllSenses)
                {
                    if (sense.MorphoSyntaxAnalysisRA != null)
                    {
                        if (sense.MorphoSyntaxAnalysisRA == msaRepository.GetObject(hvoOriginalMsa))
                        {
                            if (tisb.Text != null)
                            {
                                tisb.Append(", ");                                      // REVIEW: IS LOCALIZATION NEEDED FOR BUILDING THIS LIST?
                            }
                            tisb.AppendTsString(sense.ShortNameTSS);
                        }
                    }
                }
            }
            m_fwtbSenses.Tss       = tisb.GetString();
            m_fwtbSenses.HasBorder = false;

            m_msaGroupBox.Initialize(m_cache, m_mediator, this, sandboxMsa);
            int oldHeight = m_msaGroupBox.Height;
            int newHeight = Math.Max(oldHeight, m_msaGroupBox.PreferredHeight);
            int delta     = newHeight - oldHeight;

            if (delta > 0)
            {
                m_msaGroupBox.AdjustInternalControlsAndGrow();
                Debug.Assert(m_msaGroupBox.Height == m_msaGroupBox.PreferredHeight);
                FontHeightAdjuster.GrowDialogAndAdjustControls(this, delta, m_msaGroupBox);
            }

            if (mediator != null)
            {
                // Reset window location.
                // Get location to the stored values, if any.
                object locWnd = m_mediator.PropertyTable.GetValue("msaCreatorDlgLocation");
                // JohnT: this dialog can't be resized. So it doesn't make sense to
                // remember a size. If we do, we need to override OnLoad (as in SimpleListChooser)
                // to prevent the dialog growing every time at 120 dpi. But such an override
                // makes it too small to show all the controls at the default size.
                // It's better just to use the default size until it's resizeable for some reason.
                //m_mediator.PropertyTable.GetValue("msaCreatorDlgSize");
                object szWnd = this.Size;
                if (locWnd != null && szWnd != null)
                {
                    Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
                    ScreenUtils.EnsureVisibleRect(ref rect);
                    DesktopBounds = rect;
                    StartPosition = FormStartPosition.Manual;
                }
            }
        }
示例#25
0
        private void AddHeadwordWithHomograph(IVwEnv vwenv, int hvo)
        {
            ISilDataAccess sda   = vwenv.DataAccess;
            int            hvoLf = sda.get_ObjectProp(hvo,
                                                      LexEntryTags.kflidLexemeForm);
            int hvoType = 0;

            if (hvoLf != 0)
            {
                hvoType = sda.get_ObjectProp(hvoLf,
                                             MoFormTags.kflidMorphType);
            }

            // If we have a type of morpheme, show the appropriate prefix that indicates it.
            // We want vernacular so it will match the point size of any aligned vernacular text.
            // (The danger is that the vernacular font doesn't have these characters...not sure what
            // we can do about that, but most do, and it looks awful in analysis if that is a
            // much different size from vernacular.)
            string sPrefix = null;

            if (hvoType != 0)
            {
                sPrefix = sda.get_UnicodeProp(hvoType, MoMorphTypeTags.kflidPrefix);
            }

            // LexEntry.ShortName1; basically tries for form of the lexeme form, then the citation form.
            bool fGotLabel = false;
            int  wsActual  = 0;

            if (hvoLf != 0)
            {
                // if we have a lexeme form and its label is non-empty, use it.
                if (TryMultiStringAlt(sda, hvoLf, MoFormTags.kflidForm, out wsActual))
                {
                    m_wsActual = wsActual;
                    fGotLabel  = true;
                    if (sPrefix != null)
                    {
                        vwenv.AddString(TsStringUtils.MakeTss(sPrefix, wsActual));
                    }
                    vwenv.AddObjProp(LexEntryTags.kflidLexemeForm, this, kfragFormForm);
                }
            }
            if (!fGotLabel)
            {
                // If we didn't get a useful form from the lexeme form try the citation form.
                if (TryMultiStringAlt(sda, hvo, LexEntryTags.kflidCitationForm, out wsActual))
                {
                    m_wsActual = wsActual;
                    if (sPrefix != null)
                    {
                        vwenv.AddString(TsStringUtils.MakeTss(sPrefix, wsActual));
                    }
                    vwenv.AddStringAltMember(LexEntryTags.kflidCitationForm, wsActual, this);
                    fGotLabel = true;
                }
            }
            int defUserWs = m_cache.WritingSystemFactory.UserWs;

            if (!fGotLabel)
            {
                // If that fails just show two questions marks.
                if (sPrefix != null)
                {
                    vwenv.AddString(TsStringUtils.MakeTss(sPrefix, wsActual));
                }
                vwenv.AddString(m_cache.TsStrFactory.MakeString(FdoUiStrings.ksQuestions, defUserWs));                                  // was "??", not "???"
            }

            // If we have a lexeme form type show the appropriate postfix.
            if (hvoType != 0)
            {
                vwenv.AddString(TsStringUtils.MakeTss(
                                    sda.get_UnicodeProp(hvoType, MoMorphTypeTags.kflidPostfix), wsActual));
            }

            // Show homograph number if non-zero.
            int nHomograph = sda.get_IntProp(hvo,
                                             LexEntryTags.kflidHomographNumber);

            vwenv.NoteDependency(new[] { hvo }, new[] { LexEntryTags.kflidHomographNumber }, 1);
            if (nHomograph > 0)
            {
                // Use a string builder to embed the properties in with the TsString.
                // this allows our TsStringCollectorEnv to properly encode the superscript.
                // ideally, TsStringCollectorEnv could be made smarter to handle SetIntPropValues
                // since AppendTss treats the given Tss as atomic.
                ITsIncStrBldr tsBldr = TsIncStrBldrClass.Create();
                tsBldr.SetIntPropValues((int)FwTextPropType.ktptSuperscript,
                                        (int)FwTextPropVar.ktpvEnum,
                                        (int)FwSuperscriptVal.kssvSub);
                tsBldr.SetIntPropValues((int)FwTextPropType.ktptBold,
                                        (int)FwTextPropVar.ktpvEnum,
                                        (int)FwTextToggleVal.kttvForceOn);
                tsBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                        (int)FwTextPropVar.ktpvDefault, defUserWs);
                var hc = m_cache.ServiceLocator.GetInstance <HomographConfiguration>();
                StringServices.InsertHomographNumber(tsBldr, nHomograph, hc, HomographConfiguration.HeadwordVariant.Main, m_cache);
                vwenv.AddString(tsBldr.GetString());
            }
        }
示例#26
0
		/// <summary>
		/// Append to the string builder text equivalent to CitationFormWithAffixTypeStatic, but
		/// with the correct writing systems.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="hvo"></param>
		/// <param name="tsb"></param>
		public static void CitationFormWithAffixTypeTss(FdoCache cache, int hvo, ITsIncStrBldr tsb)
		{
			ISilDataAccess sda = cache.MainCacheAccessor;
			int hvoType = 0;
			int hvoLexForm = sda.get_ObjectProp(hvo, (int)LexEntry.LexEntryTags.kflidLexemeForm);
			if (hvoLexForm != 0)
			{
				hvoType = sda.get_ObjectProp(hvoLexForm, (int)MoForm.MoFormTags.kflidMorphType);
			}
			else
			{
				// No type info...return simpler version of name.
				ShortName1Static(cache, hvo, tsb);
				return;
			}
			string prefix = string.Empty;
			string postfix = string.Empty;
			if (hvoType > 0) // It may be null.
			{
				prefix = sda.get_UnicodeProp(hvoType, (int)MoMorphType.MoMorphTypeTags.kflidPrefix);
				postfix = sda.get_UnicodeProp(hvoType, (int)MoMorphType.MoMorphTypeTags.kflidPostfix);
			}
			// The following code for setting Ws and FontFamily are to fix LT-6238.
			if (!String.IsNullOrEmpty(prefix))
			{
				tsb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.DefaultVernWs);
				tsb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Doulos SIL");
				tsb.Append(prefix);
			}
			ShortName1Static(cache, hvo, tsb);
			if (!String.IsNullOrEmpty(postfix))
			{
				tsb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.DefaultVernWs);
				tsb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Doulos SIL");
				tsb.Append(postfix);
			}
		}
		private void AddChooserName(ITsIncStrBldr tisb)
		{
			var analWs = Cache.DefaultAnalWs;
			var pos = PartOfSpeechRA;
			tisb.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, analWs);
			if (pos != null)
				tisb.Append(pos.Abbreviation.AnalysisDefaultWritingSystem.Text);
			else
				tisb.Append(Strings.ksQuestions);
		}
示例#28
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds a size property to the specified props builder with the specified prop type.
		/// </summary>
		/// <param name="propsBldr">The props builder.</param>
		/// <param name="value">The string representation of the size value.</param>
		/// <param name="proptype">The property type.</param>
		/// <param name="unitAttr">The attribute containing the size unit (can be null).</param>
		/// <param name="typeAttr">The attribute containing the size type (can be null).</param>
		/// ------------------------------------------------------------------------------------
		private static void AddSizePropertyToBldr(ITsIncStrBldr propsBldr, string value, int proptype,
			XAttribute unitAttr, XAttribute typeAttr)
		{
			int var;
			int intValue = GetSizeValue(value, unitAttr, typeAttr, false, out var);
			propsBldr.SetIntPropValues(proptype, var, intValue);
		}
示例#29
0
        private void SetupLexRelsForEntry(int[] lexrels)
        {
            m_cdaTemp.CacheVecProp(m_hvoEntry, RelatedWordsVc.ktagLexRels,
                                   lexrels, lexrels.Length);
            // This query does not find subsenses.
            string sSql = String.Format(
                "SELECT tar.Src, tar.Dst, tar.Ord, tar2.Ord, lrt.MappingType, cf.Txt, mff.Txt, le.HomographNumber"
                + " FROM LexRefType lrt"
                + " JOIN LexRefType_Members mem ON mem.Src=lrt.Id"
                + " JOIN LexReference_Targets tar ON tar.Src=mem.Dst"
                + " JOIN LexReference_Targets tar2 ON tar2.Src=tar.Src AND (tar2.Dst={0} OR tar2.Dst IN (SELECT Dst FROM LexEntry_Senses WHERE Src={0}))"
                + " JOIN CmObject co ON co.Id=tar.Dst AND co.Id != {0} AND co.Id NOT IN (SELECT Dst FROM LexEntry_Senses WHERE Src={0})"
                + " JOIN LexEntry le ON le.Id IN (co.Id, co.Owner$)"
                + " LEFT OUTER JOIN LexEntry_CitationForm cf ON cf.Obj=le.Id"
                + " LEFT OUTER JOIN MoForm_ mf ON mf.Owner$=le.Id AND mf.OwnFlid$={1}"
                + " LEFT OUTER JOIN MoForm_Form mff ON mff.Obj=mf.Id AND mff.Ws={2}"
                + " ORDER BY tar.Src, tar.Ord",
                m_hvoEntry, (int)LexEntry.LexEntryTags.kflidLexemeForm, m_cache.DefaultVernWs);
            IOleDbCommand odc = DbOps.MakeRowSet(m_cache, sSql, null);

            try
            {
                bool       fMoreRows;
                int        hvoOldLexRef = 0;           // to trigger change of lexical relation on first iteration
                List <int> refs         = new List <int>();
                for (odc.NextRow(out fMoreRows); fMoreRows; odc.NextRow(out fMoreRows))
                {
                    int hvoLexRef = DbOps.ReadInt(odc, 0);
                    if (hvoLexRef != hvoOldLexRef)
                    {
                        if (hvoOldLexRef != 0)
                        {
                            m_cdaTemp.CacheVecProp(hvoOldLexRef, RelatedWordsVc.ktagWords,
                                                   refs.ToArray(), refs.Count);
                            refs.Clear();
                        }
                        hvoOldLexRef = hvoLexRef;
                    }
                    int hvoRef = DbOps.ReadInt(odc, 1);
                    if (refs.Contains(hvoRef))
                    {
                        continue;
                    }
                    refs.Add(hvoRef);
                    int ordRef   = DbOps.ReadInt(odc, 2);
                    int ordEntry = DbOps.ReadInt(odc, 3);
                    int type     = DbOps.ReadInt(odc, 4);
                    if (type == (int)LexRefType.MappingTypes.kmtEntryOrSenseTree ||
                        type == (int)LexRefType.MappingTypes.kmtEntryTree ||
                        type == (int)LexRefType.MappingTypes.kmtSenseTree)
                    {
                        if (ordRef != 0 && ordEntry != 0)
                        {
                            continue;                                           // one of them has to be the root of the tree!
                        }
                    }
                    if (type == (int)LexRefType.MappingTypes.kmtEntryOrSenseSequence ||
                        type == (int)LexRefType.MappingTypes.kmtEntrySequence ||
                        type == (int)LexRefType.MappingTypes.kmtSenseSequence)
                    {
                        // Do we need to include the word itself in a sequence type relation for
                        // this dialog?
                    }
                    ITsString tss = DbOps.ReadTss(odc, 5, m_cache.DefaultVernWs);
                    if (tss == null || tss.Length == 0)
                    {
                        tss = DbOps.ReadTss(odc, 6, m_cache.DefaultVernWs);
                    }
                    if (tss == null || tss.Length == 0)
                    {
                        continue;
                    }
                    int homograph = DbOps.ReadInt(odc, 7);
                    if (homograph > 0)
                    {
                        ITsIncStrBldr tisb = tss.GetIncBldr();
                        tisb.SetIntPropValues((int)FwTextPropType.ktptSuperscript,
                                              (int)FwTextPropVar.ktpvEnum, (int)FwSuperscriptVal.kssvSub);
                        tisb.SetIntPropValues((int)FwTextPropType.ktptBold,
                                              (int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
                        tisb.SetIntPropValues((int)FwTextPropType.ktptWs,
                                              (int)FwTextPropVar.ktpvDefault, m_cache.DefaultUserWs);
                        tisb.Append(homograph.ToString());
                        tss = tisb.GetString();
                    }
                    m_cdaTemp.CacheStringProp(hvoRef, RelatedWordsVc.ktagName, tss);
                }
                if (hvoOldLexRef != 0)
                {
                    m_cdaTemp.CacheVecProp(hvoOldLexRef, RelatedWordsVc.ktagWords,
                                           refs.ToArray(), refs.Count);
                    refs.Clear();
                }
            }
            finally
            {
                DbOps.ShutdownODC(ref odc);
            }
        }
		/// <summary>
		/// This method is overridden in order to use the TsIncStrBldr passed
		/// to it instead of creating another builder. (See LT-13728 for performance issues.)
		/// </summary>
		/// <param name="tisb"></param>
		internal override void AddChooserNameInItalics(ITsIncStrBldr tisb)
		{
			tisb.SetIntPropValues((int)FwTextPropType.ktptItalic,
				(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
			AddChooserName(tisb);
		}
示例#31
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the a text run from a string representation.
		/// </summary>
		/// <param name="wsf">The writing system factory.</param>
		/// <param name="strBldr">The structured string builder.</param>
		/// <param name="textNode">The text node which describes runs to be added to the
		/// paragraph or to the translation for a particular writing system</param>
		/// ------------------------------------------------------------------------------------
		private void CreateRunFromStringRep(ILgWritingSystemFactory wsf, ITsIncStrBldr strBldr,
			XmlNode textNode)
		{
			XmlNode charStyle = textNode.Attributes.GetNamedItem("CS");
			if (charStyle != null)
				strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, charStyle.Value);
			else
				strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null);

			XmlNode wsICULocale = textNode.Attributes.GetNamedItem("WS");
			if (wsICULocale != null)
			{
				int ws = wsf.GetWsFromStr(wsICULocale.Value);
				if (ws <= 0)
					throw new ArgumentException("Unknown ICU locale encountered: '" + wsICULocale.Value + "'");
				strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
					(int)FwTextPropVar.ktpvDefault, wsf.GetWsFromStr(wsICULocale.Value));
			}
			else
				throw new ArgumentException("Required attribute WS missing from RUN element.");
		}
示例#32
0
 /// <summary>
 /// Sets the specified property to the specified int value.
 /// </summary>
 public static void SetIntValue(this ITsIncStrBldr tisb, FwTextPropType tpt, FwTextPropVar var, int value)
 {
     tisb.SetIntPropValues((int)tpt, (int)var, value);
 }
示例#33
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:TsStringCollectorEnv"/> class.
		/// </summary>
		/// <param name="baseEnv">The base env.</param>
		/// <param name="sda">Date access to get prop values etc.</param>
		/// <param name="hvoRoot">The root object to display, if m_baseEnv is null.
		/// If baseEnv is not null, hvoRoot is ignored.</param>
		/// ------------------------------------------------------------------------------------
		public TsStringCollectorEnv(IVwEnv baseEnv, ISilDataAccess sda, int hvoRoot):
			base(baseEnv, sda, hvoRoot)
		{
			m_builder = TsIncStrBldrClass.Create();
			// In case we add some raw strings, typically numbers, satisfy the constraints of string
			// builders by giving it SOME writing system.
			m_builder.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault,
				sda.WritingSystemFactory.UserWs);
		}
示例#34
0
		private void ProcessRunElement(XmlNode runNode, ITsIncStrBldr tisb)
		{
			/*
(From DTD, as of 9/18/2006)
<!ELEMENT Run (#PCDATA)>
<!ATTLIST Run
	type (chars | picture) #IMPLIED
	ownlink CDATA #IMPLIED
	contextString CDATA #IMPLIED
	backcolor CDATA #IMPLIED
	bold (invert | off | on) #IMPLIED
	ws CDATA #REQUIRED
	wsBase CDATA #IMPLIED
	externalLink CDATA #IMPLIED
	fontFamily CDATA #IMPLIED
	fontsize CDATA #IMPLIED
	fontsizeUnit CDATA #IMPLIED
	forecolor CDATA #IMPLIED
	italic (invert | off | on) #IMPLIED
	link CDATA #IMPLIED
	namedStyle CDATA #IMPLIED
	offset CDATA #IMPLIED
	offsetUnit CDATA #IMPLIED
	superscript (sub | super) #IMPLIED
	tabList CDATA #IMPLIED
	tags IDREFS #IMPLIED
	undercolor CDATA #IMPLIED
	underline (dashed | dotted | double | none | single | squiggle | strikethrough) #IMPLIED
>
Stephen McCon...	The relevant source file is FwXmlString.cpp in {FW}/Src/Cellar.  Unfortunately, this area is somewhat of a mess.
Stephen McCon...	The attr list is probably found in FwDatabase.dtd, without explanation.
Randy Regnier		If I understand it right, the various attrs will control some properties for the ts string, such as ws, bold, etc, right?
Stephen McCon...	that's correct.
Stephen McCon...	You could look at FwXmlImportData::ProcessStringStartTag(const XML_Char *, const XML_Char **) in FwXmlString.cpp to see how the attributes are scanned and stored when reading in a string in the various C++ XML parsers.
Stephen McCon...	(Of course, that calls all sorts of other methods to do the work, which you may have to look at as well)
			*/
			// Process all of the properties, before adding the string (says JohnT, personal communication).
			foreach (XmlAttribute attr in runNode.Attributes)
			{
				switch (attr.Name)
				{
					case "ws":
						// ws CDATA #REQUIRED
						tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, m_wsCache[attr.Value]);
						break;
					case "type":
						// type (chars | picture) #IMPLIED
						// <Run ws=\"en\"
						break;
					case "ownlink":
						// ownlink CDATA #IMPLIED
						// <Run ws=\"xkal\" ownlink=\"993DA544-3B38-4AB0-BFDE-9AF884571A2D\"></Run>
						break;
					case "contextString":
						// contextString CDATA #IMPLIED
						// <Run ws=\"en\" contextString=\"85EE15C6-0799-46C6-8769-F9B3CE313AE2\"></Run>
						break;
					case "backcolor":
						// backcolor CDATA #IMPLIED
						break;
					case "bold":
						// bold (invert | off | on) #IMPLIED
						break;
					case "wsBase":
						// wsBase CDATA #IMPLIED
						break;
					case "externalLink":
						// externalLink CDATA #IMPLIED
						break;
					case "fontFamily":
						// fontFamily CDATA #IMPLIED
						// <Run ws=\"en\" fontsize=\"16000\" forecolor=\"blue\" fontFamily=\"SILDoulos PigLatinDemo\">Welcome to WorldPad!</Run>
						break;
					case "fontsize":
						// fontsize CDATA #IMPLIED
						break;
					case "fontsizeUnit":
						// fontsizeUnit CDATA #IMPLIED
						break;
					case "forecolor":
						// forecolor CDATA #IMPLIED
						// <Run ws=\"en\" fontsize=\"20000\" forecolor=\"red\">French IPA: </Run>
						// <Run ws=\"xsta\" fontsize=\"20000\" forecolor=\"007f00\">We</Run>
						break;
					case "italic":
						// italic (invert | off | on) #IMPLIED
						// <Run ws=\"en\" italic=\"on\">man</Run>
						break;
					case "link":
						// link CDATA #IMPLIED
						// <Run ws=\"en\" link=\"6EBC80F8-9CE0-45D9-BB49-3869591FB1FF\"></Run>
						break;
					case "namedStyle":
						// <Run ws=\"en\" namedStyle=\"Emphasized Text\">pirana</Run>
						break;
					case "offset":
						// offset CDATA #IMPLIED
						break;
					case "offsetUnit":
						// offsetUnit CDATA #IMPLIED
						break;
					case "superscript":
						// superscript (sub | super) #IMPLIED
						break;
					case "tabList":
						// tabList CDATA #IMPLIED
						break;
					case "tags":
						// tags IDREFS #IMPLIED
						// <Run ws=\"en\" tags=\"I2BDD0E8D-F9B2-11D3-977B-00C04F186933\">Tiga</Run>
						break;
					case "undercolor":
						// undercolor CDATA #IMPLIED
						break;
					case "underline":
						// underline (dashed | dotted | double | none | single | squiggle | strikethrough) #IMPLIED
						break;
					default:
						// Unrecognized attr, so do nothing.
						Debug.WriteLine(String.Format("Unrecognized <Run> element attribute: {0}", attr.Name));
						break;
				}
			}
			tisb.Append(runNode.InnerText);
		}
示例#35
0
		private static void AddHeadwordForWsAndHn(ILexEntry entry, int wsVern, int nHomograph,
			HomographConfiguration.HeadwordVariant hv, ITsIncStrBldr tisb, string citationForm)
		{
			tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, wsVern);
			var hc = entry.Services.GetInstance<HomographConfiguration>();
			if (hc.HomographNumberBefore)
				InsertHomographNumber(tisb, nHomograph, hc, hv);
			tisb.Append(citationForm);

			// (EricP) Tried to automatically update the homograph number, but doing that here will
			// steal away manual changes to the HomographNumber column. Also suppressing PropChanged
			// is necessary when HomographNumber column is enabled, otherwise changing the entry index can hang.
			//using (new IgnorePropChanged(cache, PropChangedHandling.SuppressView))
			//{
			//	  ValidateExistingHomographs(CollectHomographs(cache, ShortName1StaticForWs(cache, hvo, wsVern), 0, morphType));
			//}

			if (!hc.HomographNumberBefore)
				InsertHomographNumber(tisb, nHomograph, hc, hv);
		}
示例#36
0
        private void ProcessRunElement(XmlNode runNode, ITsIncStrBldr tisb)
        {
            /*
             * (From DTD, as of 9/18/2006)
             * <!ELEMENT Run (#PCDATA)>
             * <!ATTLIST Run
             * type (chars | picture) #IMPLIED
             * ownlink CDATA #IMPLIED
             * contextString CDATA #IMPLIED
             * backcolor CDATA #IMPLIED
             * bold (invert | off | on) #IMPLIED
             * ws CDATA #REQUIRED
             * wsBase CDATA #IMPLIED
             * externalLink CDATA #IMPLIED
             * fontFamily CDATA #IMPLIED
             * fontsize CDATA #IMPLIED
             * fontsizeUnit CDATA #IMPLIED
             * forecolor CDATA #IMPLIED
             * italic (invert | off | on) #IMPLIED
             * link CDATA #IMPLIED
             * namedStyle CDATA #IMPLIED
             * offset CDATA #IMPLIED
             * offsetUnit CDATA #IMPLIED
             * superscript (sub | super) #IMPLIED
             * tabList CDATA #IMPLIED
             * tags IDREFS #IMPLIED
             * undercolor CDATA #IMPLIED
             * underline (dashed | dotted | double | none | single | squiggle | strikethrough) #IMPLIED
             * >
             * Stephen McCon...	The relevant source file is FwXmlString.cpp in {FW}/Src/Cellar.  Unfortunately, this area is somewhat of a mess.
             * Stephen McCon...	The attr list is probably found in FwDatabase.dtd, without explanation.
             * Randy Regnier		If I understand it right, the various attrs will control some properties for the ts string, such as ws, bold, etc, right?
             * Stephen McCon...	that's correct.
             * Stephen McCon...	You could look at FwXmlImportData::ProcessStringStartTag(const XML_Char *, const XML_Char **) in FwXmlString.cpp to see how the attributes are scanned and stored when reading in a string in the various C++ XML parsers.
             * Stephen McCon...	(Of course, that calls all sorts of other methods to do the work, which you may have to look at as well)
             */
            // Process all of the properties, before adding the string (says JohnT, personal communication).
            foreach (XmlAttribute attr in runNode.Attributes)
            {
                switch (attr.Name)
                {
                case "ws":
                    // ws CDATA #REQUIRED
                    tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, m_wsCache[attr.Value]);
                    break;

                case "type":
                    // type (chars | picture) #IMPLIED
                    // <Run ws=\"en\"
                    break;

                case "ownlink":
                    // ownlink CDATA #IMPLIED
                    // <Run ws=\"xkal\" ownlink=\"993DA544-3B38-4AB0-BFDE-9AF884571A2D\"></Run>
                    break;

                case "contextString":
                    // contextString CDATA #IMPLIED
                    // <Run ws=\"en\" contextString=\"85EE15C6-0799-46C6-8769-F9B3CE313AE2\"></Run>
                    break;

                case "backcolor":
                    // backcolor CDATA #IMPLIED
                    break;

                case "bold":
                    // bold (invert | off | on) #IMPLIED
                    break;

                case "wsBase":
                    // wsBase CDATA #IMPLIED
                    break;

                case "externalLink":
                    // externalLink CDATA #IMPLIED
                    break;

                case "fontFamily":
                    // fontFamily CDATA #IMPLIED
                    // <Run ws=\"en\" fontsize=\"16000\" forecolor=\"blue\" fontFamily=\"SILDoulos PigLatinDemo\">Welcome to WorldPad!</Run>
                    break;

                case "fontsize":
                    // fontsize CDATA #IMPLIED
                    break;

                case "fontsizeUnit":
                    // fontsizeUnit CDATA #IMPLIED
                    break;

                case "forecolor":
                    // forecolor CDATA #IMPLIED
                    // <Run ws=\"en\" fontsize=\"20000\" forecolor=\"red\">French IPA: </Run>
                    // <Run ws=\"xsta\" fontsize=\"20000\" forecolor=\"007f00\">We</Run>
                    break;

                case "italic":
                    // italic (invert | off | on) #IMPLIED
                    // <Run ws=\"en\" italic=\"on\">man</Run>
                    break;

                case "link":
                    // link CDATA #IMPLIED
                    // <Run ws=\"en\" link=\"6EBC80F8-9CE0-45D9-BB49-3869591FB1FF\"></Run>
                    break;

                case "namedStyle":
                    // <Run ws=\"en\" namedStyle=\"Emphasized Text\">pirana</Run>
                    break;

                case "offset":
                    // offset CDATA #IMPLIED
                    break;

                case "offsetUnit":
                    // offsetUnit CDATA #IMPLIED
                    break;

                case "superscript":
                    // superscript (sub | super) #IMPLIED
                    break;

                case "tabList":
                    // tabList CDATA #IMPLIED
                    break;

                case "tags":
                    // tags IDREFS #IMPLIED
                    // <Run ws=\"en\" tags=\"I2BDD0E8D-F9B2-11D3-977B-00C04F186933\">Tiga</Run>
                    break;

                case "undercolor":
                    // undercolor CDATA #IMPLIED
                    break;

                case "underline":
                    // underline (dashed | dotted | double | none | single | squiggle | strikethrough) #IMPLIED
                    break;

                default:
                    // Unrecognized attr, so do nothing.
                    Debug.WriteLine(String.Format("Unrecognized <Run> element attribute: {0}", attr.Name));
                    break;
                }
            }
            tisb.Append(runNode.InnerText);
        }
示例#37
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the prop attributes for element and applies them to a string builder
		/// (to take effect on the next string added).
		/// </summary>
		/// <param name="xml">The XML.</param>
		/// <param name="lgwsf">The writing system factory.</param>
		/// <param name="strBldr"></param>
		/// <returns>Rather strangely, it returns a boolean indicating whether an ORC is needed if the
		/// text of the run is empty, that is, whether we set an objdata property</returns>
		/// ------------------------------------------------------------------------------------
		internal static bool GetPropAttributesForElement(XElement xml, ILgWritingSystemFactory lgwsf, ITsIncStrBldr strBldr)
		{
			bool isOrcNeeded = false;
			strBldr.ClearProps();
			foreach (XAttribute attr in xml.Attributes())
			{
				switch (attr.Name.LocalName)
				{
					case "align":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum,
							GetAlignValueForStr(attr.Value));
						break;
					case "backcolor":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBackColor, 0,
							GetColorValueForStr(attr.Value));
						break;
					case "bold":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBold, (int)FwTextPropVar.ktpvEnum,
							GetToggleValueForStr(attr.Value));
						break;
					case "borderBottom":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "borderColor":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderColor, 0,
							GetColorValueForStr(attr.Value));
						break;
					case "borderLeading":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "borderTop":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "borderTrailing":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "bulNumScheme":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBulNumScheme, (int)FwTextPropVar.ktpvEnum,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "bulNumStartAt":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBulNumStartAt, 0,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "bulNumTxtAft":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptBulNumTxtAft, attr.Value);
						break;
					case "bulNumTxtBef":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptBulNumTxtBef, attr.Value);
						break;
					case "charStyle":
						Debug.Fail("We don't support the old charStyle attribute!");
						break;
					case "contextString":
						AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtContextString);
						isOrcNeeded = true;
						break;
					case "embedded":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptObjData,
							(char)FwObjDataTypes.kodtEmbeddedObjectData + attr.Value);
						break;
					case "externalLink":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptObjData,
							(char)FwObjDataTypes.kodtExternalPathName + attr.Value);
						break;
					case "firstIndent":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptFirstIndent, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, true));
						break;
					case "fontFamily":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptFontFamily, attr.Value);
						break;
					case "fontsize":
						AddSizePropertyToBldr(strBldr, attr.Value, (int)FwTextPropType.ktptFontSize,
							xml.Attribute("fontsizeUnit"), null);
						break;
					case "fontsizeUnit":
						break; // Ignore. Its handled in the fontsize.
					case "fontVariations":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptFontVariations, attr.Value);
						break;
					case "forecolor":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptForeColor, 0,
							GetColorValueForStr(attr.Value));
						break;
					case "italic":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptItalic, (int)FwTextPropVar.ktpvEnum,
							GetToggleValueForStr(attr.Value));
						break;
					case "keepTogether":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptKeepTogether, (int)FwTextPropVar.ktpvEnum,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "keepWithNext":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptKeepWithNext, (int)FwTextPropVar.ktpvEnum,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "leadingIndent":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptLeadingIndent, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "lineHeight":
						AddSizePropertyToBldr(strBldr, attr.Value, (int)FwTextPropType.ktptLineHeight,
							xml.Attribute("lineHeightUnit"), xml.Attribute("lineHeightType"));
						break;
					case "lineHeightType":
						break; // Ignore. Its handled in the lineHeight
					case "lineHeightUnit":
						break; // Ignore. Its handled in the lineHeight
					case "link":
						AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtNameGuidHot);
						isOrcNeeded = true;
						break;
					case "marginBottom":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginBottom, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "marginLeading":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "marginTop":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginTop, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "marginTrailing":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "moveableObj":
						AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtGuidMoveableObjDisp);
						isOrcNeeded = true;
						break;
					case "namedStyle":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, attr.Value);
						break;
					case "offset":
						AddSizePropertyToBldr(strBldr, attr.Value, (int)FwTextPropType.ktptOffset,
							xml.Attribute("offsetUnit"), null);
						break;
					case "offsetUnit":
						break; // Ignore. Its handled in the offset
					case "ownlink":
						AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtOwnNameGuidHot);
						isOrcNeeded = true;
						break;
					case "padBottom":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptPadBottom, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "padLeading":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "padTop":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "padTrailing":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptPadTrailing, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "paracolor":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptParaColor, 0,
							GetColorValueForStr(attr.Value));
						break;
					case "paraStyle":
						Debug.Fail("We don't support the old paraStyle attribute!");
						break;
					case "rightToLeft":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptRightToLeft, (int)FwTextPropVar.ktpvEnum,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "spaceAfter":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptSpaceAfter, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, true));
						break;
					case "spaceBefore":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptSpaceBefore, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, true));
						break;
					case "spellcheck":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
							GetSpellCheckValueForStr(attr.Value));
						break;
					case "superscript":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptSuperscript, (int)FwTextPropVar.ktpvEnum,
							GetSuperscriptValueForStr(attr.Value));
						break;
					case "tabDef":
						Debug.Fail("We don't support the tabDef property!");
						break;
					case "tabList":
						Debug.Fail("We don't support the tabList property!");
						break;
					case "tags":
						strBldr.SetStrPropValue((int)FwTextPropType.ktptTags,
							GetGuidValuesForStr(attr.Value));
						break;
					case "trailingIndent":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptTrailingIndent, (int)FwTextPropVar.ktpvMilliPoint,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "type":
						Debug.Assert(attr.Value == "chars", "Embedded pictures are not supported!");
						break;
					case "undercolor":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptUnderColor, 0,
							GetColorValueForStr(attr.Value));
						break;
					case "underline":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptUnderline, (int)FwTextPropVar.ktpvEnum,
							GetUnderlineTypeForStr(attr.Value));
						break;
					case "widowOrphan":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptWidowOrphanControl, (int)FwTextPropVar.ktpvEnum,
							GetIntValueFromStr(attr.Value, false));
						break;
					case "ws":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0,
							TsStringSerializer.GetWsForId(attr.Value, lgwsf));
						break;
					case "wsBase":
						strBldr.SetIntPropValues((int)FwTextPropType.ktptBaseWs, 0,
							TsStringSerializer.GetWsForId(attr.Value, lgwsf));
						break;
					case "wsStyle":
						Debug.Fail("We don't support the old wsStyle attribute!");
						break;
					case "space":
					case "editable":
						break;
					default:
						throw new XmlSchemaException("Unknown Prop attribute: " + attr.Name.LocalName);
				}
			}
			return isOrcNeeded;
		}