SIL.FieldWorks.Common.Framework.FwEditingHelper.ValidToReplaceSelWithTss C# (CSharp) Méthode

ValidToReplaceSelWithTss() protected méthode

Determines whether the given TsString can be pasted in the context of the target selection. An old DN-style embedded picture can only be pasted into paragraph contents.
protected ValidToReplaceSelWithTss ( IVwSelection vwselTargetLocation, ITsString tss ) : bool
vwselTargetLocation IVwSelection selection to be replaced by paste operation
tss ITsString The TsString from the clipboard
Résultat bool
		protected override bool ValidToReplaceSelWithTss(IVwSelection vwselTargetLocation, ITsString tss)
		{
			// REVIEW (EberhardB): Do we still support DN-style embedded pictures?
			//+ Begin fix for Raid bug 897B
			// Check for an embedded picture.
			int crun = tss.RunCount;
			bool fHasPicture = false;
			ITsTextProps ttp;
			for (int irun = 0; irun < crun; ++irun)
			{
				ttp = tss.get_Properties(irun);
				string str = ttp.GetStrPropValue((int)FwTextStringProp.kstpObjData);
				if (str != null)
				{
					char chType = str[0];
					if (chType == (int)FwObjDataTypes.kodtPictOddHot ||
						chType == (int)FwObjDataTypes.kodtPictEvenHot)
					{
						fHasPicture = true;
						break;
					}
				}
			}

			if (fHasPicture)
			{
				// Vars to call TextSelInfo and find out whether it is a structured
				// text field.
				ITsString tssDummy;
				int ich;
				bool fAssocPrev;
				int hvoObj;
				int tag;
				int wsTmp;
				vwselTargetLocation.TextSelInfo(false, out tssDummy, out ich, out fAssocPrev,
					out hvoObj, out tag, out wsTmp);
				if (tag != StTxtParaTags.kflidContents)
				{
					// TODO (EberhardB): This seems to be Notebook specific!
					MessageBox.Show(ResourceHelper.GetResourceString("kstidPicsMultiPara"));
					return false;
				}
			}
			//- End fix for Raid bug 897B
			return base.ValidToReplaceSelWithTss(vwselTargetLocation, tss);
		}
		#endregion