/*---------------------------------------------------------------------------------------------- This initializes the string based after the pssl and pss have been set. It takes into account whether the view is hierarchical or not. @param fHier @param pnt ----------------------------------------------------------------------------------------------*/ void AfDeFeCliRef::InitContents(bool fHier, PossNameType pnt) { Assert(m_hvoPssl); // This must be set prior to calling this method. Assert(pnt < kpntLim); SuperClass::Init(); // Initialize the superclass. m_fHier = fHier; m_pnt = pnt; if (!m_pss) return; // If the reference isn't set, we don't have anything to display. ITsStringPtr qtss; ITsStrFactoryPtr qtsf; StrUni stu; PossListInfoPtr qpli; PossItemInfo * ppii; int ipss; qtsf.CreateInstance(CLSID_TsStrFactory); GetLpInfo()->LoadPossList(m_hvoPssl, m_wsMagic, &qpli); AssertPtr(qpli); ipss = qpli->GetIndexFromId(m_pss); ppii = qpli->GetPssFromIndex(ipss); AssertPtr(ppii); if (m_fHier) ppii->GetHierName(qpli, stu, m_pnt); else ppii->GetName(stu, m_pnt); int ws = ppii->GetWs(); qtsf->MakeStringRgch(stu.Chars(), stu.Length(), ws, &qtss); m_qtss = qtss; qpli->AddNotify(this); }
/*---------------------------------------------------------------------------------------------- Complete initialization of the property by storing the appropriate items, names, and lists. @param pssl The id for the People possibility list we are showing in this field. @param hvoOwner The owner of the RnRoledPartic we are displaying in this field. @param flid The flid in hvoOwner owning the RnRoledPartic we are displaying. @param pssRole The id of the CmPossibility from the Role list that we are using to display the label. (May be NULL for the unspecified item). @param fHier True if item names include parent items in the hierarchy. @param pnt Indicates whether we show name, abbr, or both for each item. ----------------------------------------------------------------------------------------------*/ void RnDeFeRoleParts::Init(HVO pssl, HVO hvoOwner, int flid, HVO pssRole, bool fHier, PossNameType pnt) { Assert(m_flid); // Don't call this until Initialize has been called. Assert(pssl); Assert(hvoOwner); Assert(flid); Assert((uint)pnt < (uint)kpntLim); // Save the list id. m_vpssl.Push(pssl); m_fHier = fHier; m_pnt = pnt; m_hvoOwner = hvoOwner; m_flidOwner = flid; m_pssRole = pssRole; // Set the proper m_wsMagic value for the People possibility list. m_wsMagic = kwsVernAnals; // Set up a notifier for the people list. PossListInfoPtr qpli; GetLpInfo()->LoadPossList(pssl, m_wsMagic, &qpli); AssertPtr(qpli); qpli->AddNotify(this); // Set up a notifier for the role list. if (pssRole) { GetLpInfo()->LoadPossListForItem(pssRole, m_wsMagic, &qpli); AssertPtr(qpli); qpli->AddNotify(this); m_psslRole = qpli->GetPsslId(); } // Create the display cache. m_qvcd.CreateInstance(CLSID_VwCacheDa); // Create the view constructor. m_qtgvc.Attach(NewObj TagsVc(m_qfsp->m_stuSty.Chars(), m_chrp.clrBack)); // Set the writing system info (especially for Right-To-Left handling). ILgWritingSystemFactoryPtr qwsf; GetLpInfo()->GetDbInfo()->GetLgWritingSystemFactory(&qwsf); m_qtgvc->SetWritingSystemInfo(m_ws, qwsf); // Add information to the display cache. FillDisplayCache(); }