public override void Init(FdoCache cache, Mediator mediator, XmlNode recordListNode) { CheckDisposed(); // <recordList owner="ReversalIndex" property="AllEntries" assemblyPath="RBRExtensions.dll" class="RBRExtensions.AllReversalEntriesRecordList"/> BaseInit(cache, mediator, recordListNode); //string owner = XmlUtils.GetOptionalAttributeValue(recordListNode, "owner"); IVwVirtualHandler vh = cache.VwCacheDaAccessor.GetVirtualHandlerName("ReversalIndex", "AllEntries"); if (vh == null) { vh = new AllReversalEntriesVh(null, cache); cache.VwCacheDaAccessor.InstallVirtual(vh); } m_flid = vh.Tag; int rih = GetReversalIndexHvo(mediator); if (rih > 0) { IReversalIndex ri = ReversalIndex.CreateFromDBObject(cache, rih); m_owningObject = ri; m_fontName = ri.WritingSystemRA.DefaultSerif; } m_oldLength = 0; }
private void AddEditCell(IVwEnv vwenv, IVwCacheDa cda, int i) { string sField = ksEditColumnBaseName + i; XmlNode node = m_columns[i - 1] as XmlNode; // Make a cell and embed an editable virtual string for the column. vwenv.OpenTableCell(1, 1); // Initialize the virtual property. IVwVirtualHandler vh = cda.GetVirtualHandlerName(EditRowModelClass, sField); Debug.Assert(vh != null); int flid = (int)m_mdc.GetFieldId(EditRowModelClass, sField, false); int ws = LangProject.GetWritingSystem(node, m_cache, null, m_cache.DefaultAnalWs); // Paragraph directionality must be set before the paragraph is opened. bool fRTL = IsWsRTL(ws); vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft, (int)FwTextPropVar.ktpvEnum, fRTL ? -1 : 0); vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, fRTL ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft); vh.Load(khvoNewItem, flid, ws, cda); // Fill in the cell with the virtual property. vwenv.OpenParagraph(); vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptIsEditable); vwenv.AddStringAltMember(flid, ws, this); vwenv.CloseParagraph(); vwenv.CloseTableCell(); }
/// <summary> /// Create the ordered vector of writing sytems to try for displaying names. /// </summary> protected void EstablishWritingSystemsToTry(string sDisplayWs) { if (m_writingSystemIds != null || m_cache == null || m_obj == null) { return; } if (string.IsNullOrEmpty(sDisplayWs)) { sDisplayWs = "analysis vernacular"; // very general default. } int flid = 0; if (!string.IsNullOrEmpty(m_displayNameProperty)) { #if WANTPORT // (FWR-2786 to investigate this)(FLEx) Needs replacement for virtual property handler CmObject obj = m_cache.GetObject(Hvo); string className = m_cache.MetaDataCache.GetClassName(obj.ClassID); IVwVirtualHandler vh = m_cache.VwCacheDaAccessor.GetVirtualHandlerName(className, m_displayNameProperty); if (vh != null) { flid = vh.Tag; } #endif } m_writingSystemIds = WritingSystemServices.GetWritingSystemIdsFromLabel(m_cache, sDisplayWs, m_cache.ServiceLocator.WritingSystemManager.UserWritingSystem, m_obj.Hvo, flid, null); }
private void CreateVirtualProperties() { m_virtualName = m_fieldName + "_" + "TypeAhead"; IVwCacheDa cda = m_sda as IVwCacheDa; IVwVirtualHandler vh = cda.GetVirtualHandlerName(m_className, m_virtualName); if (vh == null) { // Need to create virtual property. switch (m_type) { case (int)CellarModuleDefns.kcptReferenceAtom: vh = new TypeAheadAtomVh(m_tag); vh.ClassName = m_className; vh.FieldName = m_virtualName; vh.Type = m_type; cda.InstallVirtual(vh); break; case (int)CellarModuleDefns.kcptReferenceSequence: case (int)CellarModuleDefns.kcptReferenceCollection: vh = new TypeAheadSeqVh(m_tag); vh.ClassName = m_className; vh.FieldName = m_virtualName; vh.Type = (int)CellarModuleDefns.kcptReferenceSequence; cda.InstallVirtual(vh); break; default: throw new Exception("unsupported property type for type-ahead chooser"); } } m_virtualTagObj = vh.Tag; // Make the virtual handler for type-ahead names if it doesn't already exist. vh = cda.GetVirtualHandlerName("CmObject", kstrTaName); if (vh == null) { vh = new TypeAheadShortNameStringVh(m_cache); vh.ClassName = m_className; vh.FieldName = kstrTaName; vh.Type = (int)CellarModuleDefns.kcptString; cda.InstallVirtual(vh); } m_taTagName = vh.Tag; // And the general-purpose Shortname one. vh = cda.GetVirtualHandlerName("CmObject", kstrSnName); if (vh == null) { vh = new TypeAheadShortNameStringVh(m_cache); vh.ClassName = m_className; vh.FieldName = kstrSnName; vh.Type = (int)CellarModuleDefns.kcptString; cda.InstallVirtual(vh); } m_snTagName = vh.Tag; }
private void ReloadListIfPossible() { IVwVirtualHandler handler = (m_cache.MainCacheAccessor as IVwCacheDa).GetVirtualHandlerId(m_flid); if (handler != null) { ReloadList(); } }
/// <summary> /// Make one AND make the change to the cache. /// </summary> /// <param name="cache">The cache.</param> /// <param name="fForUndo"><c>true</c> for Undo, <c>false</c> for Redo.</param> /// <param name="vh">The vh.</param> /// <param name="hvo">The hvo.</param> /// <param name="tag">The tag.</param> /// <param name="ws">The ws.</param> public ReloadVirtualHandlerUndoAction(FdoCache cache, bool fForUndo, IVwVirtualHandler vh, int hvo, int tag, int ws) { m_cache = cache; m_fForUndo = fForUndo; m_vh = vh; m_hvo = hvo; m_tag = tag; m_ws = ws; }
/// <summary> /// Gets an installed IVwVirtualHandler tag (the virtual flid) from the cache. /// </summary> /// <param name="cache"></param> /// <param name="modelclass"></param> /// <param name="virtualfield"></param> /// <returns>The installed IVwVirtualHandler handler's flid (virtual flid).</returns> public static int GetInstalledHandlerTag(FdoCache cache, string modelclass, string virtualfield) { IVwVirtualHandler handler = cache.VwCacheDaAccessor.GetVirtualHandlerName(modelclass, virtualfield); if (handler != null) { return(handler.Tag); } return(0); }
/// <summary> /// Gets an installed IVwVirtualHandler from the cache. /// </summary> /// <param name="cache"></param> /// <param name="modelclass"></param> /// <param name="virtualfield"></param> /// <returns>The installed IVwVirtualHandler handler.</returns> /// <exception cref="ArgumentException"> /// Thrown if the IVwVirtualHandler IVwVirtualHandler by the two parameters is not found in the givan cache. /// </exception> public static IVwVirtualHandler GetInstalledHandler(FdoCache cache, string modelclass, string virtualfield) { IVwVirtualHandler vh = cache.VwCacheDaAccessor.GetVirtualHandlerName(modelclass, virtualfield); if (vh == null) { throw new ArgumentException(String.Format("Virtual handler '{0}/{1}' not installed.", modelclass, virtualfield)); } return(vh); }
protected virtual void ReallyDeleteReversalIndex(IReversalIndex ri) { try { Debug.Assert(ri.Hvo == m_list.OwningObject.Hvo); m_list.ListModificationInProgress = true; // can't reload deleted list! (LT-5353) // Clear out any virtual data stored in the cache for this reversal index. IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa; IVwVirtualHandler vh = cda.GetVirtualHandlerName("LexSense", LexSenseReversalEntriesTextHandler.StandardFieldName); if (vh != null) { int wsDel = ri.WritingSystemRAHvo; IEnumerator <IReversalIndexEntry> erie = ri.EntriesOC.GetEnumerator(); while (erie.MoveNext()) { foreach (LinkedObjectInfo loi in erie.Current.BackReferences) { if (loi.RelObjClass == (int)LexSense.kClassId) { vh.Load(loi.RelObjId, vh.Tag, wsDel, cda); } } } } m_cache.BeginUndoTask(LexEdStrings.ksUndoDelete, LexEdStrings.ksRedoDelete); int cobjOld = m_cache.LangProject.LexDbOA.ReversalIndexesOC.Count; ri.DeleteUnderlyingObject(); int cobjNew; int hvoIdxNew = ReversalIndexAfterDeletion(m_cache, out cobjNew); m_cache.EndUndoTask(); SetReversalIndexHvo(hvoIdxNew); // Without this, switching to the ReversalEntries tool can crash if it was // displaying data from the deleted reversal entry. m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, m_cache.LangProject.LexDbOAHvo, (int)LexDb.LexDbTags.kflidReversalIndexes, 0, cobjNew, cobjOld); } finally { m_list.ListModificationInProgress = false; } // Can't do this until ListModificationInProgress flag is cleared because it // redisplays everything after reloading the list: if the list isn't actually // reloaded, it tries to display a deleted object -- CRASH! ChangeOwningObjectIfPossible(); // Without this, stale data can still display in the BulkEditSenses tool if you // recreate the deleted reversal index. m_mediator.SendMessage("MasterRefresh", null); }
/// <summary> /// Install a virtual property (often a subclass implementation) from specified XML. Return the tag. /// </summary> public static int InstallVirtual(FdoCache cache, string source) { XmlDocument doc = new XmlDocument(); doc.LoadXml(source); XmlNode virtualNode = doc.DocumentElement; // This one is used so widely we will create it here if not already done. IVwVirtualHandler vh = (IVwVirtualHandler)DynamicLoader.CreateObject( virtualNode.SelectSingleNode("dynamicloaderinfo"), new object[] { virtualNode, cache }); cache.VwCacheDaAccessor.InstallVirtual(vh); return(vh.Tag); }
public override void Init(FdoCache cache, Mediator mediator, XmlNode recordListNode) { CheckDisposed(); // <recordList class="WfiWordform" field="OccurrencesInTexts"/> BaseInit(cache, mediator, recordListNode); //string owner = XmlUtils.GetOptionalAttributeValue(recordListNode, "owner"); IVwVirtualHandler vh = BaseVirtualHandler.GetInstalledHandler(cache, "WfiWordform", "OccurrencesInTexts"); Debug.Assert(vh != null); m_flid = vh.Tag; Sorter = new OccurrenceSorter(); Sorter.Cache = cache; }
protected override FdoObjectSet <ICmObject> GetObjectSet() { IVwVirtualHandler handler = (m_cache.MainCacheAccessor as IVwCacheDa).GetVirtualHandlerId(m_flid); Debug.Assert(handler != null); IReversalIndex ri = m_owningObject as IReversalIndex; Debug.Assert(ri != null && ri.IsValidObject(), "The owning ReversalIndex object is invalid!?"); // Force the handler to (re)load the property. handler.Load(ri.Hvo, m_flid, ri.WritingSystemRAHvo, m_cache.MainCacheAccessor as IVwCacheDa); int[] items = m_cache.GetVectorProperty(ri.Hvo, m_flid, true); return(new FdoObjectSet <ICmObject>(m_cache, items, true)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a view with multiple LexEntry objects. /// </summary> /// <param name="rghvoEntries"></param> /// <param name="cache"></param> /// <param name="styleSheet"></param> /// <returns></returns> /// ------------------------------------------------------------------------------------ private XmlView CreateSummaryView(List <int> rghvoEntries, FdoCache cache, IVwStylesheet styleSheet) { IVwVirtualHandler vh = DummyVirtualHandler.InstallDummyHandler(cache.VwCacheDaAccessor, "LexDb", "EntriesFound", (int)FieldType.kcptReferenceSequence); m_flidDummy = vh.Tag; cache.VwCacheDaAccessor.CacheVecProp(cache.LangProject.LexDbOAHvo, m_flidDummy, rghvoEntries.ToArray(), rghvoEntries.Count); XmlView xv = new XmlView(cache.LangProject.LexDbOAHvo, "publishFound", null, false); xv.LoadFlexLayouts = true; xv.Cache = cache; xv.StyleSheet = styleSheet; return(xv); }
/// <summary> /// Looks for a node called "virtuals" and under it collects nodes of type "virtual", /// each having at least "modelclass", "virtualfield", "assemblyPath", and "class". /// Here 'class' is the name of the C# class that implements the VH, while 'modelclass' /// is the name of the virtual property. The node is passed to the VH as a constructor /// argument, so other attributes may be required. /// </summary> /// <returns>the list of installed virtual handlers</returns> public static List <IVwVirtualHandler> InstallVirtuals(XmlNode virtualsNode, FdoCache cache, bool okToFail) { List <IVwVirtualHandler> installedHandlers = new List <IVwVirtualHandler>(); foreach (XmlNode virtualNode in virtualsNode.SelectNodes("virtual")) { IVwCacheDa cda = cache.MainCacheAccessor as IVwCacheDa; IVwVirtualHandler vh = cda.GetVirtualHandlerName( XmlUtils.GetManditoryAttributeValue(virtualNode, "modelclass"), XmlUtils.GetManditoryAttributeValue(virtualNode, "virtualfield")); if (vh != null && vh is BaseVirtualHandler) { // already exists, hope it's the same one. Make sure its cache is valid. (vh as BaseVirtualHandler).Reinitialize(virtualNode, cache); installedHandlers.Add(vh); continue; } try { vh = (IVwVirtualHandler)DynamicLoader.CreateObject( virtualNode.SelectSingleNode("dynamicloaderinfo"), new object[] { virtualNode, cache }); } catch (Exception err) { if (!okToFail) { throw err; } // Otherwise we're in some special test situation or really just want the IText ones // and we ignore the problem. continue; } try { cda.InstallVirtual(vh); } catch (Exception err) { Debug.WriteLine(err.Message); throw err; } installedHandlers.Add(vh); } return(installedHandlers); }
protected override FdoObjectSet <ICmObject> GetObjectSet() { IVwVirtualHandler handler = BaseVirtualHandler.GetInstalledHandler(m_cache, "WfiWordform", "OccurrencesInTexts"); Debug.Assert(handler != null); IWfiWordform wf = m_owningObject as IWfiWordform; List <int> occurrences = wf.OccurrencesInTexts; IVwVirtualHandler vh = m_cache.VwCacheDaAccessor.GetVirtualHandlerName("WfiWordform", "OccurrencesInCaptions"); if (vh != null) { occurrences.AddRange(m_cache.GetVectorProperty(wf.Hvo, vh.Tag, true)); } return(new FdoObjectSet <ICmObject>(m_cache, occurrences.ToArray(), true)); }
public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (DesignMode) { return; } m_fdoCache.CreateDummyID(out m_hvoRoot); // Pretend it is of our expected destination class. Very few things should care about this, // but it allows IsValidObject to return true for it, which is important when reconstructing // the root box, as happens during Refresh. m_fdoCache.VwCacheDaAccessor.CacheIntProp(m_hvoRoot, (int)CmObjectFields.kflidCmObject_Class, (int)m_clidDst); // Review JohnT: why doesn't the base class do this?? m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_sda = m_fdoCache.MainCacheAccessor; IVwCacheDa cda = m_sda as IVwCacheDa; IVwVirtualHandler vh = cda.GetVirtualHandlerName(GhostStringVirtualHandler.GhostClassName, GhostStringVirtualHandler.FieldNameForWs(m_wsToCreate)); if (vh == null) { vh = new GhostStringVirtualHandler(m_wsToCreate); cda.InstallVirtual(vh); } m_flidGhost = vh.Tag; m_rootb.DataAccess = m_sda; m_vc = new GhostStringSliceVc(m_flidGhost); // arg3 is a meaningless initial fragment, since this VC only displays one thing. m_rootb.SetRootObject(m_hvoRoot, m_vc, 1, m_styleSheet); }
/// <summary> /// Merge the underling objects. This method handles the transaction, then delegates /// the actual merge to MergeObject. If the flag is true, we merge /// strings and owned atomic objects; otherwise, we don't change any that aren't null /// to begin with. /// </summary> /// <param name="fLoseNoTextData"></param> protected override void ReallyMergeUnderlyingObject(int survivorHvo, bool fLoseNoTextData) { ICmObject survivor = CmObject.CreateFromDBObject(m_cache, survivorHvo); base.ReallyMergeUnderlyingObject(survivorHvo, fLoseNoTextData); // Update virtual prop on survivor, so it is displayed properly. // Reloading the VH and calling PropChanged fixes LT-6274. IVwVirtualHandler vh = BaseVirtualHandler.GetInstalledHandler(m_cache, "ReversalIndexEntry", "ReferringSenses"); int flid = vh.Tag; vh.Load(survivor.Hvo, flid, 0, m_cache.VwCacheDaAccessor); m_cache.MainCacheAccessor.PropChanged( null, (int)PropChangeType.kpctNotifyAll, survivor.Hvo, flid, 0, 0, 0); }
protected override void ReallyDeleteUnderlyingObject() { IReversalIndexEntry rei = Object as IReversalIndexEntry; int hvoGoner = rei.Hvo; int hvoIndex = rei.ReversalIndex.Hvo; IVwVirtualHandler vh = BaseVirtualHandler.GetInstalledHandler(m_cache, "ReversalIndex", "AllEntries"); int flid = vh.Tag; base.ReallyDeleteUnderlyingObject(); // Remove goner from the cache. vh.Load(hvoIndex, flid, 0, m_cache.VwCacheDaAccessor); m_cache.MainCacheAccessor.PropChanged( null, (int)PropChangeType.kpctNotifyAll, hvoIndex, flid, 0, 0, 1); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a call to MakeSubordinateView, to add a view containing footnotes. /// </summary> /// <param name="div">The PrintLayout manager object</param> /// ------------------------------------------------------------------------------------ public override void ConfigureSubordinateViews(DivisionLayoutMgr div) { int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOAHvo; BtFootnotePrintLayoutSideBySideVc footnoteVc = new BtFootnotePrintLayoutSideBySideVc( TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, m_fdoCache, m_ws); NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor, hvoScripture); IVwVirtualHandler vh = FilteredScrBooks.GetFilterInstance(m_fdoCache, div.FilterInstance); if (vh != null) { ownerSvd.AddTagLookup((int)Scripture.ScriptureTags.kflidScriptureBooks, vh.Tag); } div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture, footnoteVc, ownerSvd); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a call to MakeSubordinateView, to add a view containing footnotes. /// </summary> /// <param name="div">The division layout manager</param> /// ------------------------------------------------------------------------------------ public virtual void ConfigureSubordinateViews(DivisionLayoutMgr div) { int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOAHvo; int wsDefault = ((m_viewType & TeViewType.BackTranslation) != 0 ? m_fdoCache.DefaultAnalWs : m_fdoCache.DefaultVernWs); NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor, hvoScripture); IVwVirtualHandler vh = FilteredScrBooks.GetFilterInstance(m_fdoCache, div.FilterInstance); if (vh != null) { ownerSvd.AddTagLookup((int)Scripture.ScriptureTags.kflidScriptureBooks, vh.Tag); } if (m_sharedStream == null) { FootnoteVc footnoteVc = new FootnoteVc(div.FilterInstance, TeStVc.LayoutViewTarget.targetPrint, wsDefault); footnoteVc.Cache = m_fdoCache; footnoteVc.DisplayTranslation = (m_viewType & TeViewType.BackTranslation) != 0; div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture, footnoteVc, ownerSvd); } else { int hvoRoot; IVwViewConstructor vc; int frag; IVwStylesheet stylesheet; ((IVwRootBox)m_sharedStream).GetRootObject(out hvoRoot, out vc, out frag, out stylesheet); div.AddSharedSubordinateStream(m_sharedStream, vc, ownerSvd); } }
/// <summary> /// Handle a change by adding a record to the database (only if the /// change does not arise directly out of processing a sync record from elsewhere). /// </summary> /// <param name="hvo"></param> /// <param name="tag"></param> /// <param name="ivMin"></param> /// <param name="cvIns"></param> /// <param name="cvDel"></param> public void PropChanged(int hvo, int tag, int ivMin, int cvIns, int cvDel) { CheckDisposed(); if (hvo == m_hvoIgnore && tag == m_flidIgnore) { return; } if (tag < 0) { return; // common for fake properties } // If it's a virtual property we don't want to make a sync record. IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa; IVwVirtualHandler vh = cda.GetVirtualHandlerId(tag); if (vh != null) { return; } // (CLE-76) Topics List Editor needs to be sync'd with the database when // we make certain changes to possibility lists, especially structural ones // like adding/removing/moving/promoting possibilities. The simplest thing // to do for now, is to indicate a full refresh is needed when any of these // properties are being altered (even if it turns out to be minor). SyncMsg msg = SyncMsg.ksyncSimpleEdit; if (tag == (int)CmPossibility.CmPossibilityTags.kflidName || tag == (int)CmPossibility.CmPossibilityTags.kflidAbbreviation || tag == (int)CmPossibilityList.CmPossibilityListTags.kflidPossibilities || tag == (int)CmPossibility.CmPossibilityTags.kflidSubPossibilities) { // NOTE: assume that apps that watch for ksyncFullRefresh will only // refresh once, and not multiple times if multiple refreshes get posted. // This is how Topic List Editor currently behaves. msg = SyncMsg.ksyncFullRefresh; } m_cache.StoreSync(m_appGuid, new SyncInfo(msg, hvo, tag)); }
/// <summary> /// This will install a virtual handler for getting and setting temporary strings in each column. /// </summary> private void InstallVirtualHandlersForColumns() { // handle editableRow attributes Debug.Assert(m_xbv != null); FdoCache cache = m_xbv.Cache; Debug.Assert(cache != null); IVwCacheDa cda = cache.MainCacheAccessor as IVwCacheDa; // install a handler for each column for (int i = 1; i <= m_columns.Count; ++i) { string sField = ksEditColumnBaseName + i; IVwVirtualHandler vh = cda.GetVirtualHandlerName( EditRowModelClass, sField); if (vh == null) { MultiStringVirtualHandler msvh = new MultiStringVirtualHandler(EditRowModelClass, sField); cda.InstallVirtual(msvh); } } }
/// <summary> /// Create the ordered vector of writing sytems to try for displaying names. /// </summary> protected void EstablishWritingSystemsToTry(string sDisplayWs) { if (m_cache == null || m_writingSystemIds != null) { return; } if (sDisplayWs == null || sDisplayWs == String.Empty) { sDisplayWs = "analysis vernacular"; // very general default. } int flid = 0; if (!string.IsNullOrEmpty(m_displayNameProperty)) { string className = m_cache.GetClassName((uint)m_cache.GetClassOfObject(Hvo)); IVwVirtualHandler vh = m_cache.VwCacheDaAccessor.GetVirtualHandlerName(className, m_displayNameProperty); if (vh != null) { flid = vh.Tag; } } m_writingSystemIds = LangProject.GetWritingSystemIdsFromLabel(m_cache, sDisplayWs, m_cache.DefaultUserWs, m_hvo, flid, null); }
/// <summary> /// /// </summary> /// <param name="_vh"></param> public void InstallVirtual(IVwVirtualHandler _vh) { (m_sda as IVwCacheDa).InstallVirtual(_vh); }
/// <summary> /// Member InstallVirtual /// </summary> /// <param name="vh">vh</param> public void InstallVirtual(IVwVirtualHandler vh) { m_cache.InstallVirtual(vh); }
/// <summary>Member InstallVirtual</summary> /// <param name='vh'>vh</param> public void InstallVirtual(IVwVirtualHandler vh) { CheckDisposed(); throw new NotImplementedException("'InstallVirtual' not implemented yet."); }
protected virtual void ForceReloadVirtualProperty(IVwVirtualHandler handler) { handler.Load(m_owningObject.Hvo, m_flid, 0, m_cache.MainCacheAccessor as IVwCacheDa); }
static internal int InsertObjectIntoVirtualBackref(FdoCache cache, Mediator mediator, IVwVirtualHandler vh, int hvoSlice, uint clidNewObj, uint clidOwner, uint flid) { if (vh != null) { int clidSlice = cache.GetClassOfObject(hvoSlice); if (clidNewObj == LexEntry.kclsidLexEntry && clidSlice == LexEntry.kclsidLexEntry && clidOwner == LexDb.kclsidLexDb) { if (vh.FieldName == "VariantFormEntryBackRefs") { using (InsertVariantDlg dlg = new InsertVariantDlg()) { ILexEntry entOld = LexEntry.CreateFromDBObject(cache, hvoSlice); dlg.SetHelpTopic("khtpInsertVariantDlg"); dlg.SetDlgInfo(cache, mediator, entOld as IVariantComponentLexeme); if (dlg.ShowDialog() == DialogResult.OK && dlg.NewlyCreatedVariantEntryRefResult) { int insertPos = cache.GetVectorSize(hvoSlice, (int)flid); cache.PropChanged(hvoSlice, (int)flid, insertPos, 1, 0); return insertPos; } // say we've handled this. return -2; } } } } return -1; }
/// <summary> /// If object hvo has no cached value for the property flidVirtual, do nothing. /// Otherwise, compute a new value for the property, and issue a PropChanged. (Currently only string type supported) /// If it has owning properties of type clidVirtual, do the same for all their items. /// </summary> /// <param name="hvo"></param> /// <param name="flidVirtual"></param> /// <param name="mdc"></param> /// <param name="sda"></param> private void RecomputeVirtuals(int hvo, uint clidVirtual, int flidVirtual, int typeVirtual, IFwMetaDataCache mdc, ISilDataAccess sda, IVwVirtualHandler vh) { if (Cache.GetClassOfObject(hvo) != clidVirtual) return; // Unless it's a computeEveryTime property, we don't need to worry if it's not already cached. if (vh.ComputeEveryTime || sda.get_IsPropInCache(hvo, flidVirtual, typeVirtual, 0)) { vh.Load(hvo, flidVirtual, 0, Cache.VwCacheDaAccessor); switch (typeVirtual) { case (int)CellarModuleDefns.kcptString: sda.PropChanged(null, (int)PropChangeType.kpctNotifyAll, hvo, flidVirtual, 0, 0, 0); break; default: Debug.WriteLine("RecomputeVirtuals: unimplemented prop type"); break; } } uint[] flids = DbOps.GetFieldsInClassOfType(mdc, (int)clidVirtual, FieldType.kgrfcptOwning); foreach (uint flid in flids) { int type = mdc.GetFieldType(flid); if (type == (int)CellarModuleDefns.kfcptOwningAtom) { RecomputeVirtuals(sda.get_ObjectProp(hvo, (int)flid), clidVirtual, flidVirtual, typeVirtual, mdc, sda, vh); } else { // must be owning sequence or collection; do them all. int chvo = sda.get_VecSize(hvo, (int)flid); for (int i = 0; i < chvo; i++) RecomputeVirtuals(sda.get_VecItem(hvo, (int)flid, i), clidVirtual, flidVirtual, typeVirtual, mdc, sda, vh); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Implement virtual properties /// </summary> /// <param name="vh"></param> /// ------------------------------------------------------------------------------------ public void InstallVirtual(IVwVirtualHandler vh) { CheckDisposed(); vh.Tag = ++m_NextTag; string key = vh.ClassName + ':' + vh.FieldName; m_htVirtualProps.Add(key, vh); m_mdc.AddVirtualProp(vh.ClassName, vh.FieldName, (uint)vh.Tag, vh.Type); }
protected override void ForceReloadVirtualProperty(IVwVirtualHandler handler) { OccurrencesOfSelectedUnit clerk = Clerk as OccurrencesOfSelectedUnit; clerk.ConcordanceControl.LoadMatches(); }
public void InstallVirtual(IVwVirtualHandler _vh) { throw new NotImplementedException(); }