本文整理汇总了C#中IVwEnv.CloseParagraph方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.CloseParagraph方法的具体用法?C# IVwEnv.CloseParagraph怎么用?C# IVwEnv.CloseParagraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.CloseParagraph方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
default:
break;
case InterlinearView.kfrText:
vwenv.OpenParagraph();
vwenv.AddObjVecItems(InterlinearView.ktagText_Words, this, InterlinearView.kfrWord);
vwenv.CloseParagraph();
break;
case InterlinearView.kfrWord:
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptMarginTrailing,
(int)FwKernelLib.FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.OpenInnerPile();
vwenv.AddStringProp(InterlinearView.ktagWord_Form, this);
vwenv.AddStringProp(InterlinearView.ktagWord_Type, this);
vwenv.CloseInnerPile();
break;
}
}
示例2: AddPreviewPara
/// ------------------------------------------------------------------------------------
/// <summary>
/// Adds a paragraph (gray line) to the preview.
/// </summary>
/// <param name="vwenv">The vwenv.</param>
/// <param name="props">Text props, or <c>null</c>.</param>
/// <param name="fAddSpaceBefore"><c>true</c> to add 6pt space before the paragraph</param>
/// ------------------------------------------------------------------------------------
private void AddPreviewPara(IVwEnv vwenv, ITsTextProps props, bool fAddSpaceBefore)
{
// (width is -1, meaning "use the rest of the line")
if (props != null)
vwenv.Props = props;
else if (fAddSpaceBefore)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptSpaceBefore,
(int)FwTextPropVar.ktpvMilliPoint, 6000);
}
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, m_fRtl ? -1 : 0);
vwenv.OpenParagraph();
vwenv.AddSimpleRect(Color.LightGray.ToArgb(), -1, kdmpFakeHeight, 0);
vwenv.CloseParagraph();
}
示例3: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// Displays the specified vwenv.
/// </summary>
/// <param name="vwenv">The vwenv.</param>
/// <param name="hvo">The hvo.</param>
/// <param name="frag">The frag.</param>
/// ------------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
switch(frag)
{
case kfragLazyScripture:
{
// The configure method insists on trying to make an initial selection.
// If there isn't something selectable there, it expands everything.
vwenv.AddStringProp((int)Scripture.ScriptureTags.kflidChapterVerseSepr, this);
vwenv.AddLazyVecItems((int)Scripture.ScriptureTags.kflidScriptureBooks, this,
kfragLazyBook);
break;
}
case kfragLazyBook:
{
vwenv.AddLazyVecItems((int)ScrBook.ScrBookTags.kflidSections, this,
kfragDummySection);
break;
}
case kfragDummySection:
{
vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidHeading, this,
kfragDummyStText);
vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidContent, this,
kfragDummyStText);
break;
}
case kfragDummyStText:
{
vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
m_fParaWithContent ? kfragDummyParaWithContent : kfragDummyPara);
break;
}
case kfragDummyPara:
{
// Display each dummy paragraph as a rectangle an inch high, which allows us
// to accurately predict the height of a known number of them.
vwenv.AddSimpleRect(0, MiscUtils.kdzmpInch, MiscUtils.kdzmpInch, 0);
break;
}
case kfragDummyParaWithContent:
{
vwenv.OpenMappedTaggedPara();
vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
vwenv.CloseParagraph();
break;
}
}
}
示例4: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case AudioVisualView.kfragPathname:
// Display the filename.
ILgWritingSystemFactory wsf =
m_cache.WritingSystemFactory;
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvDefault,
(int)TptEditable.ktptNotEditable);
ITsString tss;
ITsStrFactory tsf = m_cache.TsStrFactory;
Debug.Assert(hvo != 0);
Debug.Assert(m_cache != null);
var file = m_cache.ServiceLocator.GetInstance<ICmFileRepository>().GetObject(hvo);
Debug.Assert(file != null);
string path = file.AbsoluteInternalPath;
tss = tsf.MakeString(path, m_cache.WritingSystemFactory.UserWs);
vwenv.OpenParagraph();
vwenv.NoteDependency( new [] { m_cache.LangProject.Hvo, file.Hvo},
new [] {LangProjectTags.kflidLinkedFilesRootDir, CmFileTags.kflidInternalPath}, 2);
vwenv.AddString(tss);
vwenv.CloseParagraph();
break;
default:
throw new ArgumentException(
"Don't know what to do with the given frag.", "frag");
}
}
示例5: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch(frag)
{
case 1:
{
// The top-level.
// Enhance JohnT: add a property setting to make the key bold
// Roughly, vwenv.set_IntProperty(ktptBold, ktpvEnum, kttvForceOn);
// If we can get an hvo and flid, display that property of that object.
int flid = 0;
if (hvo != 0)
{
flid = m_cp.FlidFor(m_index, hvo);
}
if (flid != 0)
{
// Warning (JohnT): this option not yet tested...
vwenv.AddStringProp(flid, this);
return;
}
else
{
// Otherwise display a literal string straight from the policy object.
vwenv.AddString(m_cp.KeyFor(m_index, hvo));
}
if (m_fExpanded)
{
vwenv.AddLazyVecItems(m_ni.ListFlid, this, 2);
}
break;
}
case 2:
{
// One line of context.
// Figure the index of this object in the next object out (the root).
int hvoOuter, tagOuter, ihvo;
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1,
out hvoOuter, out tagOuter, out ihvo);
int ichKey = m_ni.ContextStringStartOffset(ihvo, hvo);
int cchKey = m_ni.ContextStringLength(ihvo, hvo);
// Enhance JohnT: make the alignment position a function of window width.
// Enhance JohnT: change background if this is the selected context line.
vwenv.OpenConcPara(ichKey, ichKey + cchKey,
VwConcParaOpts.kcpoDefault,
72 * 2 * 1000); // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
int flidKey = m_ni.ContextStringFlid(ihvo, hvo);
if (flidKey == 0)
{
// Not tested yet.
vwenv.AddString(m_ni.ContextString(ihvo, hvo));
}
else
{
vwenv.AddStringProp(flidKey, this);
}
vwenv.CloseParagraph();
break;
}
}
}
示例6: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// The main method just displays the text with the appropriate properties.
/// </summary>
/// <param name="vwenv">The view environment</param>
/// <param name="hvo">The HVo of the object to display</param>
/// <param name="frag">The fragment to lay out</param>
/// ------------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
switch (frag)
{
case InnerFwListBox.kfragRoot:
Font f = m_listbox.Font;
if (m_listbox.StyleSheet == null)
{
// Try to get items a reasonable size based on whatever font has been set for the
// combo as a whole. We don't want to do this if a stylesheet has been set, because
// it will override the sizes specified in the stylesheet.
// Enhance JohnT: there are several more properties we could readily copy over
// from the font, but this is a good start.
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
(int)FwTextPropVar.ktpvMilliPoint, (int)(f.SizeInPoints * 1000));
}
// Setting the font family here appears to override the fonts associated with the
// TsString data. This causes trouble for non-Microsoft Sans Serif writing systems.
// See LT-551 for the bug report that revealed this problem.
// vwenv.set_StringProperty((int) FwTextPropType.ktptFontFamily,
// f.FontFamily.Name);
vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
(int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(m_listbox.ForeColor));
DisplayList(vwenv);
break;
case InnerFwListBox.kfragItems:
int index, hvoDummy, tagDummy;
int clev = vwenv.EmbeddingLevel;
vwenv.GetOuterObject(clev - 1, out hvoDummy, out tagDummy, out index);
bool fHighlighted = m_listbox.Owner.IsHighlighted(index);
if (fHighlighted && m_listbox.ShowHighlight)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor,
(int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.HighlightText)));
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.Highlight)));
}
vwenv.OpenParagraph();
if (fHighlighted && m_listbox.ShowHighlight)
{
// Insert a string that has the foreground color not set, so the foreground color set above can take effect.
ITsStrBldr bldr = vwenv.DataAccess.get_StringProp(hvo, InnerFwListBox.ktagText).GetBldr();
bldr.SetIntPropValues(0, bldr.Length, (int) FwTextPropType.ktptForeColor, -1, -1);
vwenv.AddString(bldr.GetString());
}
else
{
vwenv.AddStringProp(InnerFwListBox.ktagText, this);
}
vwenv.AddString(m_tssBlanks);
vwenv.CloseParagraph();
break;
}
}
示例7: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
// Enhance JohnT: make the alignment position a function of window width.
// Enhance JohnT: change background if this is the selected context line.
vwenv.OpenConcPara(m_info.ContextStringStartOffset,
m_info.ContextStringStartOffset + m_info.ContextStringLength,
VwConcParaOpts.kcpoDefault,
72 * 2 * 1000); // 72 pts per inch * 2 inches * 1000 -> 2" in millipoints.
if (m_info.Hvo == 0 || m_info.ContentStringFlid == 0)
{
vwenv.AddString(m_info.ContentString);
}
else
{
Debug.Assert(hvo == m_info.Hvo);
vwenv.AddStringProp(m_info.ContentStringFlid, this);
}
vwenv.CloseParagraph();
}
示例8: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
ITsStrFactory tsf = null;
switch (frag)
{
case kfragStText: // The whole text, root object for the InterlinDocChild.
if (hvo == 0)
return; // What if the user deleted all the texts? See LT-6727.
IStText stText = m_coRepository.GetObject(hvo) as IStText;
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvDefault,
(int)TptEditable.ktptNotEditable);
vwenv.OpenDiv();
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, 6000);
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
(int)FwTextPropVar.ktpvMilliPoint, 24000);
// Add both vernacular and analysis if we have them (LT-5561).
bool fAddedVernacular = false;
int wsVernTitle = 0;
//
if (stText.Title.TryWs(WritingSystemServices.kwsFirstVern, out wsVernTitle))
{
vwenv.OpenParagraph();
vwenv.AddStringAltMember(vtagStTextTitle, wsVernTitle, this);
vwenv.CloseParagraph();
fAddedVernacular = true;
}
int wsAnalysisTitle = 0;
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.OpenParagraph();
ITsString tssAnal;
if (stText.Title.TryWs(WritingSystemServices.kwsFirstAnal, out wsAnalysisTitle, out tssAnal) &&
!tssAnal.Equals(stText.Title.BestVernacularAlternative))
{
if (fAddedVernacular)
{
// display analysis title at smaller font size.
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
(int)FwTextPropVar.ktpvMilliPoint, 12000);
}
vwenv.AddStringAltMember(vtagStTextTitle, wsAnalysisTitle, this);
}
else
{
// just add a blank title.
tsf = TsStrFactoryClass.Create();
ITsString blankTitle = tsf.MakeString("", m_wsAnalysis);
vwenv.AddString(blankTitle);
}
vwenv.CloseParagraph();
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
int wsSource = 0;
if (stText.Source.TryWs(WritingSystemServices.kwsFirstVernOrAnal, out wsSource))
{
vwenv.OpenParagraph();
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
(int)FwTextPropVar.ktpvMilliPoint, 12000);
vwenv.AddStringAltMember(vtagStTextSource, wsSource, this);
vwenv.CloseParagraph();
}
else
{
// just add a blank source.
tsf = TsStrFactoryClass.Create();
ITsString tssBlank = tsf.MakeString("", m_wsAnalysis);
vwenv.AddString(tssBlank);
}
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.OpenParagraph();
if (stText.OwningFlid == TextTags.kflidContents)
{
vwenv.AddObjProp((int)CmObjectFields.kflidCmObject_Owner, this, kfragTextDescription);
}
vwenv.CloseParagraph();
base.Display(vwenv, hvo, frag);
vwenv.CloseDiv();
break;
case kfragTextDescription:
vwenv.AddStringAltMember(CmMajorObjectTags.kflidDescription, m_wsAnalysis, this);
break;
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例9: DisplayMorphForm
private void DisplayMorphForm(IVwEnv vwenv, int hvo, int ws)
{
var mf = (IMoForm)m_coRepository.GetObject(hvo);
// The form of an MoForm. Hvo is some sort of MoMorph. Display includes its prefix
// and suffix.
// Todo: make prefix and suffix read-only.
vwenv.OpenParagraph(); // group prefix, form, suffix on one line.
// It may not have a morph type at all.
// RBR says: "So why take the chance of a null ref exception (which I ran into, in my ZPI data, of course)? :-)
// int typeID = mf.MorphTypeRA.Hvo;
var morphType = mf.MorphTypeRA;
if (morphType != null)
vwenv.AddObjProp(MoFormTags.kflidMorphType, this, kfragPrefix);
vwenv.AddStringAltMember(MoFormTags.kflidForm,
ws, this);
if (morphType != null)
vwenv.AddObjProp(MoFormTags.kflidMorphType, this, kfragPostfix);
vwenv.CloseParagraph();
}
示例10: AddLabelPile
/// <summary>
/// Add the pile of labels used to identify the lines in interlinear text.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="tsf"></param>
/// <param name="cache"></param>
/// <param name="wsList">Null if don't want multiple writing systems.</param>
/// <param name="fShowMutlilingGlosses"></param>
public void AddLabelPile(IVwEnv vwenv, ITsStrFactory tsf, FdoCache cache,
bool fWantMultipleSenseGloss, bool fShowMorphemes)
{
CheckDisposed();
int wsUI = cache.DefaultUserWs;
var spaceStr = TsStringUtils.MakeTss(" ", wsUI);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint,
5000); // default spacing is fine for all embedded paragraphs.
vwenv.OpenInnerPile();
for (var i = 0; i < m_lineChoices.Count; i++)
{
InterlinLineSpec spec = m_lineChoices[i];
if (!spec.WordLevel)
break;
SetColor(vwenv, LabelRGBFor(spec));
ITsString tss = MakeUiElementString(m_lineChoices.LabelFor(spec.Flid), wsUI, null);
var bldr = tss.GetBldr();
if (m_lineChoices.RepetitionsOfFlid(spec.Flid) > 1)
{
bldr.Append(spaceStr);
bldr.Append(spec.WsLabel(cache));
AddLineIndexProperty(bldr, i);
// Enhance GJM: Might be able to do without paragraph now?
vwenv.OpenParagraph();
vwenv.AddString(bldr.GetString());
vwenv.CloseParagraph();
}
else
{
AddLineIndexProperty(bldr, i);
vwenv.AddString(bldr.GetString());
}
}
vwenv.CloseInnerPile();
}
示例11: DisplayLexGlossWithInflType
/// <summary>
/// NOTE: this routine is ignorant of calling context, so caller must provide NoteDependency to the possibleVariant and the sense
/// (e.g. vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidSense }, 1);
/// vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidInflType }, 1);
/// </summary>
/// <param name="vwenv"></param>
/// <param name="possibleVariant"></param>
/// <param name="sense"></param>
/// <param name="spec"></param>
/// <param name="inflType"></param>
/// <returns>true if there was anything to display </returns>
internal bool DisplayLexGlossWithInflType(IVwEnv vwenv, ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec,
ILexEntryInflType inflType)
{
int iLineChoice = m_lineChoices.IndexOf(spec);
ILexEntryRef ler;
if (possibleVariant.IsVariantOfSenseOrOwnerEntry(sense, out ler))
{
var wsPreferred = GetRealWsOrBestWsForContext(sense.Hvo, spec);
var wsGloss = Cache.ServiceLocator.WritingSystemManager.Get(wsPreferred);
var wsUser = Cache.ServiceLocator.WritingSystemManager.UserWritingSystem;
var testGloss = sense.Gloss.get_String(wsPreferred);
// don't bother adding anything for an empty gloss.
if (testGloss.Text != null && testGloss.Text.Length >= 0)
{
vwenv.OpenParagraph();
// see if we have an irregularly inflected form type reference
var leitFirst =
ler.VariantEntryTypesRS.Where(
let => let.ClassID == LexEntryInflTypeTags.kClassId).FirstOrDefault();
// add any GlossPrepend info
if (leitFirst != null)
{
vwenv.OpenInnerPile();
// TODO: add dependency to VariantType GlossPrepend/Append names
vwenv.NoteDependency(new[] { ler.Hvo },
new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
vwenv.OpenParagraph();
ITsString tssPrepend = null;
if (inflType != null)
{
tssPrepend = MorphServices.AddTssGlossAffix(null, inflType.GlossPrepend, wsGloss, wsUser);
}
else
{
ITsIncStrBldr sbPrepend;
ITsIncStrBldr sbAppend;
JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
out sbAppend);
if (sbPrepend.Text != null)
tssPrepend = sbPrepend.GetString();
}
if (tssPrepend != null)
vwenv.AddString(tssPrepend);
vwenv.CloseParagraph();
vwenv.CloseInnerPile();
}
// add gloss of main entry or sense
{
vwenv.OpenInnerPile();
// NOTE: remember to NoteDependency from OuterObject
vwenv.AddObj(sense.Hvo, this, kfragLineChoices + iLineChoice);
vwenv.CloseInnerPile();
}
// now add variant type info
if (leitFirst != null)
{
vwenv.OpenInnerPile();
// TODO: add dependency to VariantType GlossPrepend/Append names
vwenv.NoteDependency(new[] { ler.Hvo },
new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
vwenv.OpenParagraph();
ITsString tssAppend = null;
if (inflType != null)
{
tssAppend = MorphServices.AddTssGlossAffix(null, inflType.GlossAppend, wsGloss, wsUser);
}
else
{
ITsIncStrBldr sbPrepend;
ITsIncStrBldr sbAppend;
JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
out sbAppend);
if (sbAppend.Text != null)
tssAppend = sbAppend.GetString();
}
{
// Use AddProp/DisplayVariant to store GlossAppend with m_tssPendingGlossAffix
// this allows InterlinearExporter to know to export a glsAppend item
try
{
if (tssAppend != null)
m_tssPendingGlossAffix = tssAppend;
else
m_tssPendingGlossAffix = m_tssMissingGlossAppend;
vwenv.AddProp(ktagGlossAppend, this, 0);
}
finally
//.........这里部分代码省略.........
示例12: DisplaySingleInterlinearAnalysisWithLabels
private void DisplaySingleInterlinearAnalysisWithLabels(IVwEnv vwenv, int hvo)
{
/*
// Enhance JohnT: determine what the overall direction of the paragraph should
// be and set it.
if (m_mpBundleHeight == 0)
{
// First time...figure it out.
int dmpx, dmpyAnal, dmpyVern;
vwenv.get_StringWidth(m_tssEmptyAnalysis, null, out dmpx, out dmpyAnal);
vwenv.get_StringWidth(m_tssEmptyVern, null, out dmpx, out dmpyVern);
m_mpBundleHeight = dmpyAnal * 4 + dmpyVern * 3;
}
*/
// The interlinear bundle is not editable.
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
(int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
if (m_fRtl)
{
// This must not be on the outer paragraph or we get infinite width.
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
}
vwenv.OpenParagraph();
m_fHaveOpenedParagraph = true;
AddLabelPile(vwenv, m_tsf, m_cache, true, m_fShowMorphBundles);
try
{
// We use this rather than AddObj(hvo) so we can easily identify this object and select
// it using MakeObjSel.
vwenv.AddObjProp(m_selfFlid, this, kfragAnalysisMorphs);
vwenv.CloseParagraph();
}
finally
{
m_fHaveOpenedParagraph = false;
}
/*
// This puts 3 points of margin on the first FF annotation, if any.
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int)FwTextPropVar.ktpvMilliPoint, 0); // 3000
vwenv.AddObjVec(ktagSegFF, this, kfragSegFf);
*/
}
示例13: InsertMissingContentPara
/// ------------------------------------------------------------------------------------
/// <summary>
/// Inserts the missing content paragraph.
/// </summary>
/// <param name="vwenv">The view environment.</param>
/// ------------------------------------------------------------------------------------
private void InsertMissingContentPara(IVwEnv vwenv)
{
vwenv.OpenParagraph();
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int)FwTextPropVar.ktpvDefault, (int)kHighlightColor);
vwenv.set_IntProperty((int)FwTextPropType.ktptBold,
(int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginBottom,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.AddString(TsStringUtils.MakeTss(
TeDiffViewResources.kstidContentMissing, Cache.DefaultUserWs));
vwenv.CloseParagraph();
}
示例14: Display
//.........这里部分代码省略.........
{
CheckDisposed();
ISilDataAccess silDataAccess = vwenv.DataAccess;
int wsUser = Cache.WritingSystemFactory.UserWs;
switch(frag)
{
case (int)FootnoteFrags.kfrBook:
case (int)ScrFrags.kfrBook:
{
vwenv.OpenDiv();
if (m_displayForFootnotes)
{
vwenv.AddObjVecItems(ScrBookTags.kflidFootnotes,
this, (int)FootnoteFrags.kfrFootnoteStyles);
}
else
{
vwenv.AddObjProp(ScrBookTags.kflidTitle, this,
(int)ScrFrags.kfrTextStyles);
vwenv.AddLazyVecItems(ScrBookTags.kflidSections, this,
(int)ScrFrags.kfrSection);
InsertBookSeparator(hvo, vwenv);
}
vwenv.CloseDiv();
break;
}
case (int)ScrFrags.kfrSection:
{
vwenv.OpenDiv();
vwenv.AddObjProp(ScrSectionTags.kflidHeading, this,
(int)ScrFrags.kfrTextStyles);
vwenv.AddObjProp(ScrSectionTags.kflidContent, this,
(int)ScrFrags.kfrTextStyles);
vwenv.CloseDiv();
break;
}
case (int)ScrFrags.kfrTextStyles:
{
// We need to show something, since the current view code can't handle a property
// containing no boxes.
if (HandleEmptyText(vwenv, hvo))
break;
if (m_fLazy)
{
vwenv.AddLazyVecItems(StTextTags.kflidParagraphs, this,
(int)ScrFrags.kfrParaStyles);
}
else
{
vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
(int)ScrFrags.kfrParaStyles);
}
break;
}
case (int)FootnoteFrags.kfrFootnoteStyles:
{
if (HandleEmptyText(vwenv, hvo))
break;
vwenv.AddObjVecItems(StTextTags.kflidParagraphs, this,
(int)ScrFrags.kfrParaStyles);
break;
}
case (int)ScrFrags.kfrParaStyles:
{
var tsTextProps = silDataAccess.get_UnknownProp(hvo, StParaTags.kflidStyleRules)
as ITsTextProps;
string styleName = ScrStyleNames.Normal;
if (tsTextProps != null)
styleName = tsTextProps.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
// To insert it into the view it has to be an ITsString
ITsStrFactory tsStrFactory =
TsStrFactoryClass.Create();
// Last arg is writing system. Should we use English? UI writing system?
// Note that when we support localization of style names this code will need
// to be enhanced as the stylename from the TsTextProps will be a raw name or
// GUID that the user shouldn't see.
ITsString tssStyle = tsStrFactory.MakeStringRgch(styleName,
styleName.Length, wsUser);
// To make the pile align things properly, top and bottom margins for the
// matching boxes must be the same as the original.
// A 'concordance' paragraph is a way of preventing wrapping.
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(tssStyle);
// Since we looked up this property directly rather than going through the vwenv (which
// there seems to be no way to do for Unknown-type properties as yet), we need to tell
// the view to update this paragraph if the properties of the paragraph are changed.
vwenv.NoteDependency(new[] {hvo}, new[] {StParaTags.kflidStyleRules}, 1);
vwenv.CloseParagraph();
break;
}
default:
base.Display(vwenv, hvo, frag);
break;
}
}
示例15: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragRule:
m_rule = m_cache.ServiceLocator.GetInstance<IPhMetathesisRuleRepository>().GetObject(hvo);
if (m_rule.Disabled)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
}
int maxNumLines = GetMaxNumLines();
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(5, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
VwLength ctxtLen;
ctxtLen.nVal = 1;
ctxtLen.unit = VwUnit.kunRelative;
int resultx, inputx, dmpy;
vwenv.get_StringWidth(m_resultStr, m_colHeaderProps, out resultx, out dmpy);
vwenv.get_StringWidth(m_inputStr, m_colHeaderProps, out inputx, out dmpy);
VwLength headerLen;
headerLen.nVal = Math.Max(resultx, inputx) + 8000;
headerLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, headerLen);
vwenv.MakeColumns(4, ctxtLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
vwenv.OpenTableCell(1, 1);
vwenv.CloseTableCell();
// left context header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_leftEnvStr);
vwenv.CloseTableCell();
// switch header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.OpenTableCell(1, 2);
vwenv.AddString(m_switchStr);
vwenv.CloseTableCell();
// right context header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_rightEnvStr);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
vwenv.OpenTableRow();
// input header cell
vwenv.Props = m_rowHeaderProps;
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_inputStr);
vwenv.CloseTableCell();
// input left context cell
vwenv.Props = m_inputCtxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (m_rule.LeftEnvIndex == -1)
{
OpenSingleLinePile(vwenv, maxNumLines, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagLeftEnv, this, kfragEmpty);
CloseSingleLinePile(vwenv, false);
}
else
{
for (int i = 0; i < m_rule.LeftEnvLimit; i++)
vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// input left switch cell
vwenv.Props = m_inputCtxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
//.........这里部分代码省略.........