• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IVwSelection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IVwSelection的典型用法代码示例。如果您正苦于以下问题:C# IVwSelection类的具体用法?C# IVwSelection怎么用?C# IVwSelection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IVwSelection类属于命名空间,在下文中一共展示了IVwSelection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetParaPropStores

			/// ------------------------------------------------------------------------------------
			/// <summary>
			/// Gets an array of property stores, one for each paragraph in the given selection.
			/// </summary>
			/// <param name="vwsel">The selection.</param>
			/// <param name="vqvps">The property stores.</param>
			/// ------------------------------------------------------------------------------------
			protected override void GetParaPropStores(IVwSelection vwsel,
				out IVwPropertyStore[] vqvps)
			{
				if (m_fOverrideGetParaPropStores)
					vqvps = new IVwPropertyStore[1];
				else
					base.GetParaPropStores(vwsel, out vqvps);
			}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:15,代码来源:DummyBasicView.cs


示例2: SelectionBeginningGrowToWord

		/// <summary>
		/// Return a word selection based on the beginning of the current selection.
		/// Here the "beginning" of the selection is the offset corresponding to word order,
		/// not the selection anchor.
		/// </summary>
		/// <returns>null if we couldn't handle the selection</returns>
		private static IVwSelection SelectionBeginningGrowToWord(IVwSelection sel)
		{
			if (sel == null)
				return null;
			var sel2 = sel.EndBeforeAnchor ? sel.EndPoint(true) : sel.EndPoint(false);
			if (sel2 == null)
				return null;
			var sel3 = sel2.GrowToWord();
			return sel3;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:16,代码来源:StTextSlice.cs


示例3: AllTextSelInfo

		/// <summary>
		/// Get an array of SelLevInfo structs from the given selection.
		/// </summary>
		/// <param name="vwsel"></param>
		/// <param name="cvsli"></param>
		/// <param name="ihvoRoot"></param>
		/// <param name="tagTextProp"></param>
		/// <param name="cpropPrevious"></param>
		/// <param name="ichAnchor"></param>
		/// <param name="ichEnd"></param>
		/// <param name="ws"></param>
		/// <param name="fAssocPrev"></param>
		/// <param name="ihvoEnd"></param>
		/// <param name="ttp"></param>
		/// <returns></returns>
		public static SelLevInfo[] AllTextSelInfo(IVwSelection vwsel, int cvsli,
			out int ihvoRoot, out int tagTextProp, out int cpropPrevious, out int ichAnchor,
			out int ichEnd, out int ws, out bool fAssocPrev, out int ihvoEnd, out ITsTextProps ttp)
		{
			Debug.Assert(vwsel != null);

			using (ArrayPtr rgvsliPtr = MarshalEx.ArrayToNative<SelLevInfo>(cvsli))
			{
				vwsel.AllTextSelInfo(out ihvoRoot, cvsli, rgvsliPtr,
					out tagTextProp, out cpropPrevious, out ichAnchor, out ichEnd,
					out ws, out fAssocPrev, out ihvoEnd, out ttp);
				return MarshalEx.NativeToArray<SelLevInfo>(rgvsliPtr, cvsli);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:29,代码来源:ComUtils.cs


示例4: HandleSelectionChange

		protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew)
		{
			CheckDisposed();

			if (m_handlingSelectionChanged)
				return;

			m_handlingSelectionChanged = true;
			try
			{
				m_selectedSenseHvo = 0;
				if (vwselNew == null)
					return;
				base.HandleSelectionChange(rootb, vwselNew);

				// Get the Id of the selected snes, and store it.
				int cvsli = vwselNew.CLevels(false);
				// CLevels includes the string property itself, but AllTextSelInfo doesn't need it.
				cvsli--;
				if (cvsli == 0)
				{
					// No objects in selection: don't allow a selection.
					m_rootb.DestroySelection();
					// Enhance: invoke launcher's selection dialog.
					return;
				}
				ITsString tss;
				int ichAnchor;
				int ichEnd;
				bool fAssocPrev;
				int hvoObj;
				int hvoObjEnd;
				int tag;
				int ws;
				vwselNew.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoObj,
					out tag, out ws);
				vwselNew.TextSelInfo(true, out tss, out ichEnd, out fAssocPrev, out hvoObjEnd,
					out tag, out ws);
				if (hvoObj != hvoObjEnd)
					return;
				m_selectedSenseHvo = hvoObj;
			}
			finally
			{
				m_handlingSelectionChanged = false;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:47,代码来源:RevEntrySensesCollectionReferenceView.cs


示例5: SelPositionInfo

		private IVwSelection m_sel;		// the selection.
		#endregion

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Construct and save info about selection at top left of rootSite.
		/// </summary>
		/// <param name="rootSite">rootSite</param>
		/// ------------------------------------------------------------------------------------
		public SelPositionInfo(SimpleRootSite rootSite)
		{
			m_rootSite = rootSite;
			if (rootSite == null)
				return;

			int xdLeft = m_rootSite.ClientRectangle.X;
			int ydTop = m_rootSite.ClientRectangle.Y;

			Rectangle rcSrcRoot, rcDstRoot;
			m_rootSite.GetCoordRects(out rcSrcRoot, out rcDstRoot);
			m_sel = m_rootSite.RootBox.MakeSelAt(xdLeft + 1,ydTop + 1, rcSrcRoot, rcDstRoot, false);
			if (m_sel != null)
			{
				bool fEndBeforeAnchor;
				m_rootSite.SelectionRectangle(m_sel, out m_rcPrimaryOld, out fEndBeforeAnchor);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:27,代码来源:SelPositionInfo.cs


示例6: FindInDictionary

		public void FindInDictionary(IOleDbEncap ode, IFwMetaDataCache mdc, IVwOleDbDa oleDbAccess, IVwSelection sel)
		{
			using (FdoCache cache = new FdoCache(ode, mdc, oleDbAccess))
			{
				if (sel == null)
					return;
				IVwSelection sel2 = sel.EndPoint(false);
				if (sel2 == null)
					return;
				IVwSelection sel3 = sel2.GrowToWord();
				if (sel3 == null)
					return;
				ITsString tss;
				int ichMin, ichLim, hvo, tag, ws;
				bool fAssocPrev;
				sel3.TextSelInfo(false, out tss, out ichMin, out fAssocPrev, out hvo, out tag, out ws);
				sel3.TextSelInfo(true, out tss, out ichLim, out fAssocPrev, out hvo, out tag, out ws);
				// TODO (TimS): need to supply help information (last 2 params)
				LexEntryUi.DisplayOrCreateEntry(cache, hvo, tag, ws, ichMin, ichLim, null, null, null, string.Empty);
				return;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:22,代码来源:DictionaryFinder.cs


示例7: OnProblemDeletion

		/// <summary>
		/// This handles deleting the "owning" sense or entry from a calendar type lex
		/// reference by posting a message instead of simply removing the sense or entry from
		/// the reference vector.  This keeps things nice and tidy on the screen, and behaving
		/// like users would (or ought to) expect.  See LT-4114.
		/// </summary>
		/// <param name="sel"></param>
		/// <param name="dpt"></param>
		/// <returns></returns>
		public override VwDelProbResponse OnProblemDeletion(IVwSelection sel,
			VwDelProbType dpt)
		{
			CheckDisposed();

			int cvsli;
			int hvoObj;
			if (!CheckForValidDelete(sel, out cvsli, out hvoObj))
			{
				return VwDelProbResponse.kdprAbort;
			}
			else if (hvoObj == m_hvoDisplayParent)
			{
				// We need to handle this the same way as the delete command in the slice menu,
				// but can't do it directly because we've stacked up an undo handler.
				m_mediator.PostMessage("DataTreeDelete", null);
				return VwDelProbResponse.kdprDone;
			}
			else
			{
				return DeleteObjectFromVector(sel, cvsli, hvoObj);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:32,代码来源:LexReferenceSequenceView.cs


示例8: HandleSelectionChange

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Handle a selection changed event.
		/// </summary>
		/// <param name="rootb">root box that has the selection change</param>
		/// <param name="vwselNew">Selection</param>
		/// -----------------------------------------------------------------------------------
		protected override void HandleSelectionChange(IVwRootBox rootb, IVwSelection vwselNew)
		{
			CheckDisposed();

			base.HandleSelectionChange(rootb, vwselNew);

			// It's possible that the base either changed the selection or invalidated it in
			// calling commit and made this selection no longer useable.
			SelectionHelper helper = EditingHelper.CurrentSelection;
			if (helper == null || !helper.Selection.IsValid)
				return;

			// scroll the footnote pane to be in synch with the draft view
			// (TimS): Focused was taken out because it was causing selection changes that
			// happended from a menu item wouldn't scroll to the footnote.
			if (TheDraftViewWrapper != null && TheDraftViewWrapper.FootnoteViewShowing &&
				Options.FootnoteSynchronousScrollingSetting)
			{
				// For performance on typing, don't try to scroll footnote pane on every update
				SelLevInfo paraInfo;
				if (helper.GetLevelInfoForTag(StTextTags.kflidParagraphs, out paraInfo))
				{
					IStTxtPara para = m_fdoCache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraInfo.hvo);
					ITsString tss = para.Contents;
					if (helper.IchAnchor <= tss.Length)
					{
						int iRun = (helper.IchAnchor >= 0) ? tss.get_RunAt(helper.IchAnchor) : -1;
						if (iRun != -1 && (m_prevSelectedParagraph != paraInfo.hvo ||
						iRun != m_prevAnchorPosition))
						{
							SynchFootnoteView(helper);
							// Save selection information
							m_prevSelectedParagraph = paraInfo.hvo;
							m_prevAnchorPosition = iRun;
						}
					}
				}
			}

			// Debug code was taken out. It was put in to help with testing using TestLangProj.
			// Most of our tests are using the InMemoryCache so this information is almost useless.
			// If you need it, just change the "DEBUG_not_exist" to "DEBUG" and then compile.
			#region Debug code
#if DEBUG_not_exist
			// This section of code will display selection information in the status bar when the
			// program is compiled in Debug mode. The information shown in the status bar is useful
			// when you want to make selections in tests.
			try
			{
				string text;
				SelLevInfo paraInfo = helper.GetLevelInfoForTag(StTextTags.kflidParagraphs);
				SelLevInfo secInfo = helper.GetLevelInfoForTag(ScrBookTags.kflidSections);
				SelLevInfo bookInfo = helper.GetLevelInfoForTag(BookFilter.Tag);

				bool inBookTitle = TeEditingHelper.InBookTitle;
				bool inSectionHead = TeEditingHelper.InSectionHead;

				text = "Book: " + bookInfo.ihvo +
					"  Section: " + (inBookTitle ? "Book Title" : secInfo.ihvo.ToString()) +
					"  Paragraph: " + paraInfo.ihvo +
					"  Anchor: " + helper.IchAnchor + "  End: " + helper.IchEnd +
					" AssocPrev: " + helper.AssocPrev;

				if (!inBookTitle && bookInfo.ihvo >= 0)
				{
					IStTxtPara para = m_fdoCache.ServiceLocator.GetInstance<IStTxtParaRepository>().GetObject(paraInfo.hvo);
					ITsString tss = para.Contents;
					if (helper.IchAnchor <= tss.Length)
						text += "  Run No.: " + tss.get_RunAt(helper.IchAnchor);
				}

				if (TheMainWnd != null)
					TheMainWnd.StatusStrip.Items[0].Text = text;
			}
			catch
			{
			}
#endif
			#endregion
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:87,代码来源:DraftView.cs


示例9: GetSandboxSelLocation

		/// summary>
		/// Get the location of the given selection, presumably that of a Sandbox.
		/// /summary>
		Point GetSandboxSelLocation(IVwSelection sel)
		{
			Debug.Assert(sel != null);
			Rect rcPrimary = GetPrimarySelRect(sel);
			// The location includes margins, so for RTL we need to adjust the
			// Sandbox so it isn't hard up against the next word.
			// Enhance JohnT: ideally we would probably figure this margin
			// to exactly match the margin between words set by the VC.
			int left = rcPrimary.left;
			if (m_vc.RightToLeft)
				left += 8;
			return new Point(left, rcPrimary.top);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:16,代码来源:InterlinDocForAnalysis.cs


示例10: HandleClickSelection

		/// <summary>
		/// Handles a view selection produced by a click. Return true to suppress normal
		/// mouse down handling, indicating that an interlinear bundle has been clicked and the Sandbox
		/// moved.
		/// </summary>
		/// <param name="vwselNew"></param>
		/// <param name="fBundleOnly"></param>
		/// <param name="fSaveGuess">if true, saves guesses; if false, skips guesses but still saves edits.</param>
		/// <returns></returns>
		protected virtual bool HandleClickSelection(IVwSelection vwselNew, bool fBundleOnly, bool fSaveGuess)
		{
			if (vwselNew == null)
				return false; // couldn't select a bundle!
			// The basic idea is to find the level at which we are displaying the TagAnalysis property.
			int cvsli = vwselNew.CLevels(false);
			cvsli--; // CLevels includes the string property itself, but AllTextSelInfo doesn't need it.

			// Out variables for AllTextSelInfo.
			int ihvoRoot;
			int tagTextProp;
			int cpropPrevious;
			int ichAnchor;
			int ichEnd;
			int ws;
			bool fAssocPrev;
			int ihvoEnd;
			ITsTextProps ttpBogus;
			// Main array of information retrived from sel that made combo.
			SelLevInfo[] rgvsli = SelLevInfo.AllTextSelInfo(vwselNew, cvsli,
				out ihvoRoot, out tagTextProp, out cpropPrevious, out ichAnchor, out ichEnd,
				out ws, out fAssocPrev, out ihvoEnd, out ttpBogus);

			if (tagTextProp == SegmentTags.kflidFreeTranslation || tagTextProp == SegmentTags.kflidLiteralTranslation
				|| tagTextProp == NoteTags.kflidContent)
			{
				bool fWasFocusBoxInstalled = IsFocusBoxInstalled;
				Rect oldSelLoc = GetPrimarySelRect(vwselNew);
				if (!fBundleOnly)
				{
					if (IsFocusBoxInstalled)
						FocusBox.UpdateRealFromSandbox(null, fSaveGuess, null);
					TryHideFocusBoxAndUninstall();
				}

				// If the selection resulting from the click is still valid, and we just closed the focus box, go ahead and install it;
				// continuing to process the click may not produce the intended result, because
				// removing the focus box can re-arrange things substantially (LT-9220).
				// (However, if we didn't change anything it is necesary to process it normally, otherwise, dragging
				// and shift-clicking in the free translation don't work.)
				if (!vwselNew.IsValid || !fWasFocusBoxInstalled)
					return false;
				// We have destroyed a focus box...but we may not have moved the free translation we clicked enough
				// to cause problems. If not, we'd rather do a normal click, because installing a selection that
				// the root box doesn't think is from mouse down does not allow dragging.
				Rect selLoc = GetPrimarySelRect(vwselNew);
				if (selLoc.top == oldSelLoc.top)
					return false;
				//The following line could quite possibly invalidate the selection as in the case where it creates
				//a translation prompt.
				vwselNew.Install();
				//scroll the current selection into view (don't use vwselNew, it might be invalid now)
				ScrollSelectionIntoView(this.RootBox.Selection, VwScrollSelOpts.kssoDefault);
				return true;
			}

			// Identify the analysis, and the position in m_rgvsli of the property holding it.
			// It is also possible that the analysis is the root object.
			// This is important because although we are currently displaying just an StTxtPara,
			// eventually it might be part of a higher level structure. We want to be able to
			// reproduce everything that gets us down to the analysis.
			int itagAnalysis = -1;
			for (int i = rgvsli.Length; --i >= 0; )
			{
				if (rgvsli[i].tag == SegmentTags.kflidAnalyses)
				{
					itagAnalysis = i;
					break;
				}
			}
			if (itagAnalysis < 0)
			{
				if (!fBundleOnly)
				{
					if (IsFocusBoxInstalled)
						FocusBox.UpdateRealFromSandbox(null, fSaveGuess, null);
					TryHideFocusBoxAndUninstall();
				}

				return false; // Selection is somewhere we can't handle.
			}
			int ianalysis = rgvsli[itagAnalysis].ihvo;
			Debug.Assert(itagAnalysis < rgvsli.Length - 1); // Need different approach if the analysis is the root.
			int hvoSeg = rgvsli[itagAnalysis + 1].hvo;
			var seg = Cache.ServiceLocator.GetObject(hvoSeg) as ISegment;
			Debug.Assert(seg != null);
			// If the mouse click lands on a punctuation form, move to the preceding
			// wordform (if any).  See FWR-815.
			while (seg.AnalysesRS[ianalysis] is IPunctuationForm && ianalysis > 0)
				--ianalysis;
			if (ianalysis == 0 && seg.AnalysesRS[0] is IPunctuationForm)
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:InterlinDocForAnalysis.cs


示例11: GetTagAndObjForOnePropSelection

		/// <summary>
		///  Answer true if the indicated selection is within a single note we can delete. Also obtain
		/// the object and property.
		/// </summary>
		private bool GetTagAndObjForOnePropSelection(IVwSelection sel, out int hvoObj, out int tagAnchor)
		{
			hvoObj = tagAnchor = 0;
			if (sel == null)
				return false;
			ITsString tss;
			int ichEnd, hvoEnd, tagEnd, wsEnd;
			bool fAssocPrev;
			sel.TextSelInfo(true, out tss, out ichEnd, out fAssocPrev, out hvoEnd, out tagEnd, out wsEnd);
			int ichAnchor, hvoAnchor, wsAnchor;
			sel.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoAnchor, out tagAnchor, out wsAnchor);
			if (hvoEnd != hvoAnchor || tagEnd != tagAnchor || wsEnd != wsAnchor)
				return false; // must be a one-property selection
			hvoObj = hvoAnchor;
			return true;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:20,代码来源:InterlinDocForAnalysis.cs


示例12: DeleteNote

		private void DeleteNote(IVwSelection sel)
		{
			int hvoNote;
			if (!CanDeleteNote(sel, out hvoNote))
				return;
			var note = Cache.ServiceLocator.GetInstance<INoteRepository>().GetObject(hvoNote);
			var segment = (ISegment)note.Owner;
			segment.NotesOS.Remove(note);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:9,代码来源:InterlinDocForAnalysis.cs


示例13: HandleClickSelection

		/// <summary>
		/// Suppress the special behavior that produces a Sandbox when a click happens.
		/// </summary>
		/// <param name="vwselNew"></param>
		/// <param name="fBundleOnly"></param>
		/// <param name="fConfirm"></param>
		protected override bool HandleClickSelection(IVwSelection vwselNew, bool fBundleOnly, bool fConfirm)
		{
			return false;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:10,代码来源:InterlinTaggingChild.cs


示例14: GetSelLevInfoFromSelection

		/// <summary>
		/// Gets the sel lev info from selection.
		/// </summary>
		/// <param name="vwsel">The vwsel.</param>
		/// <returns></returns>
		private SelLevInfo[] GetSelLevInfoFromSelection(IVwSelection vwsel)
		{
			SelectionHelper helper = SelectionHelper.Create(vwsel, this);
			if (helper == null)
				return null;
			return helper.LevelInfo;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:12,代码来源:InterlinTaggingChild.cs


示例15: SelectionChanged

		public override void SelectionChanged(IVwRootBox rootb, IVwSelection vwselNew)
		{
			CheckDisposed();
			if (vwselNew == null)
				return;
			bool hasFoc = Focused;

			base.SelectionChanged(rootb, vwselNew);

			ITsString tss;
			int ichAnchor;
			bool fAssocPrev;
			int hvoObj;
			int tag;
			int ws; // NB: This will be 0 after each call, since the string does
			// not have alternatives. Ws would be the WS of an alternative,
			// if there were any.
			vwselNew.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoObj,
				out tag, out ws);

			int ichEnd;
			int hvoObjEnd;
			vwselNew.TextSelInfo(true, out tss, out ichEnd, out fAssocPrev, out hvoObjEnd,
				out tag, out ws);

			if (hvoObjEnd != hvoObj)
			{
				CheckHeight();
				return;
			}
			if (m_hvoOldSelection > 0 && hvoObj != m_hvoOldSelection)
			{
				// Try to validate previously selected string rep.
				if (m_silCache.get_StringProp(m_hvoOldSelection, kEnvStringRep).Length==0)
				{
					// Remove it from the dummy cache, since its length is 0.
					int limit = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
					for (int i = 0; i < limit; ++i)
					{
						if (m_hvoOldSelection ==
							m_silCache.get_VecItem(m_rootObj.Hvo, kMainObjEnvironments, i))
						{
							RemoveFromDummyCache(i);
							break;
						}
					}
				}
				else // Validate previously selected string rep.
				{
					ValidateStringRep(m_hvoOldSelection);
				}
			}
			if (hvoObj != kDummyPhoneEnvID)
			{
				m_hvoOldSelection = hvoObj;
				CheckHeight();
				return;
			}
			if (tss.Length == 0)
			{
				CheckHeight();
				return;
			}
			// Create a new object, and recreate a new empty object. Make this part of the Undo
			// Task with the character we typed.
			m_silCache.GetActionHandler().ContinueUndoTask();
			int count = m_silCache.get_VecSize(m_rootObj.Hvo, kMainObjEnvironments);
			int hvoNew = InsertNewEnv(count - 1);
			m_silCache.SetString(hvoNew, kEnvStringRep, tss);
			m_silCache.SetString(kDummyPhoneEnvID, kEnvStringRep, DummyString);
			m_silCache.EndUndoTask();
			// Refresh
			m_silCache.PropChanged(null, (int)PropChangeType.kpctNotifyAll,
				m_rootObj.Hvo, kMainObjEnvironments, count - 1, 2, 1);

			// Reset selection.
			SelLevInfo[] rgvsli = new SelLevInfo[1];
			rgvsli[0].cpropPrevious = 0;
			rgvsli[0].tag = kMainObjEnvironments;
			rgvsli[0].ihvo = count - 1;
			m_rootb.MakeTextSelection(0, rgvsli.Length, rgvsli, tag, 0, ichAnchor, ichEnd, ws,
				fAssocPrev, -1, null, true);

			m_hvoOldSelection = hvoNew;
			CheckHeight();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:86,代码来源:PhoneEnvReferenceView.cs


示例16: GetSelectedStringRep

		/// <summary>
		/// Get the string representation of the current selection in the environment list,
		/// plus the selection object and some of its internal information.
		/// </summary>
		/// <param name="tss"></param>
		/// <param name="vwsel"></param>
		/// <param name="hvoDummyObj"></param>
		/// <param name="ichAnchor"></param>
		/// <param name="ichEnd"></param>
		/// <returns>false if selection spans two or more objects, true otherwise</returns>
		internal bool GetSelectedStringRep(out ITsString tss, out IVwSelection vwsel,
			out int hvoDummyObj, out int ichAnchor, out int ichEnd)
		{
			CheckDisposed();
			tss = null;
			vwsel = null;
			hvoDummyObj = 0;
			ichAnchor = 0;
			ichEnd = 0;
			try
			{
				ITsString tss2;
				bool fAssocPrev;
				int hvoObjEnd;
				int tag1;
				int tag2;
				int ws1;
				int ws2;
				vwsel = m_rootb.Selection;
				vwsel.TextSelInfo(false, out tss, out ichAnchor, out fAssocPrev, out hvoDummyObj,
					out tag1, out ws1);
				vwsel.TextSelInfo(true, out tss2, out ichEnd, out fAssocPrev, out hvoObjEnd,
					out tag2, out ws2);
				if (hvoDummyObj != hvoObjEnd)
					return false;
			}
			catch
			{
				vwsel = null;
				tss = null;
				return true;
			}
			return true;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:44,代码来源:PhoneEnvReferenceView.cs


示例17: MakeRangeSelection

		public IVwSelection MakeRangeSelection(IVwSelection _selAnchor, IVwSelection _selEnd,
			bool fInstall)
		{
			m_dummySelection = new DummyVwSelection(this,
				(_selAnchor as DummyVwSelection).Anchor, (_selEnd as DummyVwSelection).End);
			return m_dummySelection;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:IbusRootSiteEventHandlerTests.cs


示例18: CanDeleteNote

		/// <summary>
		///  Answer true if the indicated selection is within a single note we can delete.
		/// </summary>
		/// <param name="sel"></param>
		/// <returns></returns>
		private bool CanDeleteNote(IVwSelection sel, out int hvoNote)
		{
			hvoNote = 0;
			int tagAnchor, hvoObj;
			if (!GetTagAndObjForOnePropSelection(sel, out hvoObj, out tagAnchor))
				return false;
			if (tagAnchor != NoteTags.kflidContent)
				return false; // must be a selection in a note to be deletable.
			hvoNote = hvoObj;
			return true;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:16,代码来源:InterlinDocForAnalysis.cs


示例19: MakeSelInBox

		public IVwSelection MakeSelInBox(IVwSelection _selInit, bool fEndPoint, int iLevel, int iBox,
			bool fInitial, bool fRange, bool fInstall)
		{
			throw new NotImplementedException();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:5,代码来源:IbusRootSiteEventHandlerTests.cs


示例20: HandleSelectionChange

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Notifies the site that something about the selection has changed.
		/// </summary>
		/// <param name="prootb"></param>
		/// <param name="vwselNew">Selection</param>
		/// <remarks>When overriding you should call the base class first.</remarks>
		/// -----------------------------------------------------------------------------------
		protected override void HandleSelectionChange(IVwRootBox prootb, IVwSelection vwselNew)
		{
			if (m_fInSelectionChanged)
				return; // don't need to reprocess our own changes.
			m_fInSelectionChanged = true;
			try
			{
				base.HandleSelectionChange(prootb, vwselNew);
				IVwSelection sel = vwselNew;
				if (!sel.IsValid)
					sel = prootb.Selection;
				if (sel == null)
					return;
				SelectionHelper helper = SelectionHelper.Create(sel, prootb.Site);
				// Check whether the selection is on the proper line of a multilingual
				// annotation and, if not, fix it.  See LT-9421.
				if (m_cpropPrevForInsert > 0 && !sel.IsRange &&
					(helper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.Anchor) == 0 ||
					 helper.GetNumberOfPreviousProps(SelectionHelper.SelLimitType.End) == 0))
				{
					try
					{
						helper.SetNumberOfPreviousProps(SelectionHelper.SelLimitType.Anchor, m_cpropPrevForInsert);
						helper.SetNumberOfPreviousProps(SelectionHelper.SelLimitType.End, m_cpropPrevForInsert);
						helper.MakeBest(true);
						m_cpropPrevForInsert = -1;	// we've used this the one time it was needed.
					}
					catch (Exception exc)
					{
						if (exc != null)
							Debug.WriteLine(String.Format(
								"InterlinDocChild.SelectionChanged() trying to display prompt in proper line of annotation: {0}", exc.Message));
					}
				}
				int flid = helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor);
				//If the flid is -2 and it is an insertion point then we may have encountered a case where the selection has landed at the boundary between our (possibly empty)
				//translation field and a literal string containing our magic Bidi marker character that helps keep things in the right order.
				//Sometimes AssocPrev gets set so that we read the (non-existent) flid of the literal string and miss the fact that on the other side
				//of the insertion point is the field we're looking for. The following code will attempt to make a selection that associates in
				//the other direction to see if the flid we want is on the other side. [LT-10568]
				if (flid == -2 && !sel.IsRange && sel.SelType == VwSelType.kstText)
				{
					helper.AssocPrev = !helper.AssocPrev;
					try
					{
						var newSel = helper.MakeRangeSelection(this.RootBox, false);
						helper = SelectionHelper.Create(newSel, this);
						flid = helper.GetTextPropId(SelectionHelper.SelLimitType.Anchor);
					}
					catch (COMException)
					{
						// Ignore HResult E_Fail caused by Extended Keys (PgUp/PgDown) in non-editable text (LT-13500)
					}
				}
				//Fixes LT-9884 Crash when clicking on the blank space in Text & Words--->Print view area!
				if (helper.LevelInfo.Length == 0)
					return;
				int hvo = helper.LevelInfo[0].hvo;

				// If the selection is in a freeform or literal translation that is empty, display the prompt.
				if (SelIsInEmptyTranslation(helper, flid, hvo) && !m_rootb.IsCompositionInProgress)
				{
					var handlerExtensions = Cache.ActionHandlerAccessor as IActionHandlerExtensions;
					if (handlerExtensions != null && handlerExtensions.IsUndoTaskActive)
					{
						// Wait to make the changes until the task (typically typing backspace) completes.
						m_setupPromptHelper = helper;
						m_setupPromptFlid = flid;
						handlerExtensions.DoAtEndOfPropChanged(handlerExtensions_PropChangedCompleted);
					}
					else
					{
						// No undo task to tag on the end of, so do it now.
						SetupTranslationPrompt(helper, flid);
					}
				}
				else if (flid != kTagUserPrompt)
				{
					m_vc.SetActiveFreeform(0, 0, 0, 0); // clear any current prompt.
				}
				// do not extend the selection for a user prompt if the user is currently entering an IME composition,
				// since we are about to switch the prompt to a real comment field
				else if (helper.GetTextPropId(SelectionHelper.SelLimitType.End) == SimpleRootSite.kTagUserPrompt
					&& !m_rootb.IsCompositionInProgress)
				{
					// If the selection is entirely in a user prompt then extend the selection to cover the
					// entire prompt. This covers changes within the prompt, like clicking within it or continuing
					// a drag while making it.
					sel.ExtendToStringBoundaries();
					EditingHelper.SetKeyboardForSelection(sel);
				}
			}
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:InterlinDocForAnalysis.cs



注:本文中的IVwSelection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVwStylesheet类代码示例发布时间:2022-05-24
下一篇:
C# IVwRootBox类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap