예제 #1
0
        /// <summary/>
        public void ShowSummaryDialog(IWin32Window owner, ITsString tssWf,
                                      IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet)
        {
            CheckDisposed();

            bool otherButtonClicked = false;

            using (SummaryDialogForm form =
                       new SummaryDialogForm(this, tssWf, helpProvider, helpFileKey, styleSheet))
            {
                form.ShowDialog(owner);
                if (form.ShouldLink)
                {
                    form.LinkToLexicon();
                }
                otherButtonClicked = form.OtherButtonClicked;
            }
            if (otherButtonClicked)
            {
                var entry = ShowFindEntryDialog(Object.Cache, Mediator, m_propertyTable, tssWf, owner);
                if (entry != null)
                {
                    using (var leuiNew = new LexEntryUi(entry))
                    {
                        leuiNew.ShowSummaryDialog(owner, entry.HeadWord, helpProvider, helpFileKey, styleSheet);
                    }
                }
                else
                {
                    // redisplay the original entry (recursively)
                    ShowSummaryDialog(owner, tssWf, helpProvider, helpFileKey, styleSheet);
                }
            }
        }
예제 #2
0
        internal static void DisplayEntries(FdoCache cache, IWin32Window owner, Mediator mediatorIn,
                                            IHelpTopicProvider helpProvider, string helpFileKey, ITsString tssWfIn)
        {
            ITsString  tssWf = tssWfIn;
            List <int> rghvo = LexEntryUi.FindEntriesForWordform(cache, tssWf);

            // if we do not find a match for the word then try converting it to lowercase and see if there
            // is an entry in the lexicon for the Wordform in lowercase. This is needed for occurences of
            // words which are capitalized at the beginning of sentences.  LT-7444 RickM
            if (rghvo == null || rghvo.Count == 0)
            {
                //We need to be careful when converting to lowercase therefore use Icu.ToLower()
                //get the WS of the tsString
                int wsWf = StringUtils.GetWsAtOffset(tssWf, 0);
                //use that to get the locale for the WS, which is used for
                string        wsLocale = cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(wsWf).IcuLocale;
                string        sLower   = Icu.ToLower(tssWf.Text, wsLocale);
                ITsTextProps  ttp      = tssWf.get_PropertiesAt(0);
                ITsStrFactory tsf      = TsStrFactoryClass.Create();
                tssWf = tsf.MakeStringWithPropsRgch(sLower, sLower.Length, ttp);
                rghvo = LexEntryUi.FindEntriesForWordform(cache, tssWf);
            }

            StringTable   stOrig;
            Mediator      mediator;
            IVwStylesheet styleSheet;
            bool          fRestore = EnsureFlexTypeSetup(cache, mediatorIn, out stOrig, out mediator, out styleSheet);

            if (rghvo == null || rghvo.Count == 0)
            {
                int hvoLe = ShowFindEntryDialog(cache, mediator, tssWf, owner);
                if (hvoLe == 0)
                {
                    // Restore the original string table in the mediator if needed.
                    if (fRestore)
                    {
                        mediator.StringTbl = stOrig;
                    }
                    return;
                }
                rghvo = new List <int>(1);
                rghvo.Add(hvoLe);
            }
            using (SummaryDialogForm form =
                       new SummaryDialogForm(rghvo, tssWf, helpProvider, helpFileKey, styleSheet, cache, mediator))
            {
                form.ShowDialog(owner);
                if (form.ShouldLink)
                {
                    form.LinkToLexicon();
                }
            }
            // Restore the original string table in the mediator if needed.
            if (fRestore)
            {
                mediator.StringTbl = stOrig;
            }
        }
예제 #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="tssWf"></param>
        /// <param name="helpProvider"></param>
        /// <param name="helpFileKey">string key to get the help file name</param>
        /// ------------------------------------------------------------------------------------
        public void ShowSummaryDialog(IWin32Window owner, ITsString tssWf,
                                      IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet)
        {
            CheckDisposed();

            EnsureFlexVirtuals(m_cache, null);
            using (SummaryDialogForm form =
                       new SummaryDialogForm(this, tssWf, helpProvider, helpFileKey, styleSheet))
            {
                form.ShowDialog(owner);
                if (form.ShouldLink)
                {
                    form.LinkToLexicon();
                }
            }
        }
예제 #4
0
        private static void DisplayEntriesRecursive(LcmCache cache, IWin32Window owner,
                                                    Mediator mediator, PropertyTable propertyTable, IVwStylesheet stylesheet,
                                                    IHelpTopicProvider helpProvider, string helpFileKey,
                                                    List <ILexEntry> entries, ITsString tssWf)
        {
            // Loop showing the SummaryDialogForm as long as the user clicks the Other button
            // in that dialog.
            bool otherButtonClicked = false;

            do
            {
                using (var sdform = new SummaryDialogForm(new List <int>(entries.Select(le => le.Hvo)), tssWf,
                                                          helpProvider, helpFileKey,
                                                          stylesheet, cache, mediator, propertyTable))
                {
                    SetCurrentModalForm(sdform);
                    if (owner == null)
                    {
                        sdform.StartPosition = FormStartPosition.CenterScreen;
                    }
                    sdform.ShowDialog(owner);
                    if (sdform.ShouldLink)
                    {
                        sdform.LinkToLexicon();
                    }
                    otherButtonClicked = sdform.OtherButtonClicked;
                }
                if (otherButtonClicked)
                {
                    // Look for another entry to display.  (If the user doesn't select another
                    // entry, loop back and redisplay the current entry.)
                    var entry = ShowFindEntryDialog(cache, mediator, propertyTable, tssWf, owner);
                    if (entry != null)
                    {
                        // We need a list that contains the entry we found to display on the
                        // next go around of this loop.
                        entries = new List <ILexEntry>();
                        entries.Add(entry);
                        tssWf = entry.HeadWord;
                    }
                }
            } while (otherButtonClicked);
        }
예제 #5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="owner"></param>
		/// <param name="tssWf"></param>
		/// <param name="helpProvider"></param>
		/// <param name="helpFileKey">string key to get the help file name</param>
		/// ------------------------------------------------------------------------------------
		public void ShowSummaryDialog(IWin32Window owner, ITsString tssWf,
			IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet)
		{
			CheckDisposed();

			EnsureFlexVirtuals(m_cache, null);
			using (SummaryDialogForm form =
					   new SummaryDialogForm(this, tssWf, helpProvider, helpFileKey, styleSheet))
			{
				form.ShowDialog(owner);
				if (form.ShouldLink)
					form.LinkToLexicon();
			}
		}
예제 #6
0
		internal static void DisplayEntries(FdoCache cache, IWin32Window owner, Mediator mediatorIn,
			IHelpTopicProvider helpProvider, string helpFileKey, ITsString tssWfIn)
		{
			ITsString tssWf = tssWfIn;
			List<int> rghvo = LexEntryUi.FindEntriesForWordform(cache, tssWf);

			// if we do not find a match for the word then try converting it to lowercase and see if there
			// is an entry in the lexicon for the Wordform in lowercase. This is needed for occurences of
			// words which are capitalized at the beginning of sentences.  LT-7444 RickM
			if (rghvo == null || rghvo.Count == 0)
			{
				//We need to be careful when converting to lowercase therefore use Icu.ToLower()
				//get the WS of the tsString
				int wsWf = StringUtils.GetWsAtOffset(tssWf, 0);
				//use that to get the locale for the WS, which is used for
				string wsLocale = cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(wsWf).IcuLocale;
				string sLower = Icu.ToLower(tssWf.Text, wsLocale);
				ITsTextProps ttp = tssWf.get_PropertiesAt(0);
				ITsStrFactory tsf = TsStrFactoryClass.Create();
				tssWf = tsf.MakeStringWithPropsRgch(sLower, sLower.Length, ttp);
				rghvo = LexEntryUi.FindEntriesForWordform(cache, tssWf);
			}

			StringTable stOrig;
			Mediator mediator;
			IVwStylesheet styleSheet;
			bool fRestore = EnsureFlexTypeSetup(cache, mediatorIn, out stOrig, out mediator, out styleSheet);
			if (rghvo == null || rghvo.Count == 0)
			{
				int hvoLe = ShowFindEntryDialog(cache, mediator, tssWf, owner);
				if (hvoLe == 0)
				{
					// Restore the original string table in the mediator if needed.
					if (fRestore)
						mediator.StringTbl = stOrig;
					return;
				}
				rghvo = new List<int>(1);
				rghvo.Add(hvoLe);
			}
			using (SummaryDialogForm form =
				new SummaryDialogForm(rghvo, tssWf, helpProvider, helpFileKey, styleSheet, cache, mediator))
			{
				form.ShowDialog(owner);
				if (form.ShouldLink)
					form.LinkToLexicon();
			}
			// Restore the original string table in the mediator if needed.
			if (fRestore)
				mediator.StringTbl = stOrig;
		}