Beispiel #1
0
/*----------------------------------------------------------------------------------------------
	Relase all smart pointers.
----------------------------------------------------------------------------------------------*/
void AfDeFeCliRef::OnReleasePtr()
{
	PossListInfoPtr qpli;
	if (GetLpInfo()->GetPossList(m_hvoPssl, m_wsMagic, &qpli))
	{
		AssertPtr(qpli);
		qpli->RemoveNotify(this);
	}
	SuperClass::OnReleasePtr();
}
Beispiel #2
0
/*----------------------------------------------------------------------------------------------
	Release all smart pointers.
----------------------------------------------------------------------------------------------*/
void RnDeFeRoleParts::OnReleasePtr()
{
	// Remove the notifier for the role list.
	if (m_psslRole)
	{
		PossListInfoPtr qpli;
		// Note: We need to use GetPossList here rather than LoadPossList since the
		// latter will try to reload the list if not present. During shutdown, the
		// possibility lists have already been cleared from AfLpInfo before we reach
		// this, so we want to quitely shut down. Using LoadPossList here produces a
		// massive memory leak.
		if (GetLpInfo()->GetPossList(m_psslRole, m_wsMagic, &qpli))
		{
			AssertPtr(qpli);
			qpli->RemoveNotify(this);
		}
		m_psslRole = 0;
	}

	SuperClass::OnReleasePtr();
}
Beispiel #3
0
/*----------------------------------------------------------------------------------------------
	Something has changed in the possibility list.
----------------------------------------------------------------------------------------------*/
void RnDeFeRoleParts::ListChanged(int nAction, HVO hvoPssl, HVO hvoSrc, HVO hvoDst, int ipssSrc,
	int ipssDst)
{
	if (hvoPssl != m_psslRole)
	{
		// Process changes for people lists.
		SuperClass::ListChanged(nAction, hvoPssl, hvoSrc, hvoDst, ipssSrc, ipssDst);
		return;
	}

	// If someone deleted the role we are interested in we need to clean up.
	if (hvoSrc == m_pssRole && nAction == kplnaDelete)
	{
		// Remove the notifier for the role list.
		Assert(m_psslRole);
		PossListInfoPtr qpli;
		GetLpInfo()->LoadPossList(m_psslRole, m_wsMagic, &qpli);
		AssertPtr(qpli);
		qpli->RemoveNotify(this);
		m_psslRole = 0;
		m_pssRole = 0;
	}
	// At this point we are not getting kplnaMerged at all since we are just deleting all
	// fields and recreating new ones. But at some point down the road we may want to switch
	// to where we don't delete and recreate. This would be the right action to take then.
	if (hvoSrc == m_pssRole && nAction == kplnaMerged)
	{
		// Switch to the new role.
		m_pssRole = hvoDst;
	}
	// Now reset the label in case we changed.
	// Use Participants for the unspecified editor label.
	ITsStringPtr qtssName;
	int wsUser = GetLpInfo()->GetDbInfo()->UserWs();
	AfUtil::GetResourceTss(kstidTlsOptParticipants, wsUser, &qtssName);
	ITsStringPtr qtssHelp = m_qfsp->m_qtssHelp;
	ITsStrFactoryPtr qtsf;
	qtsf.CreateInstance(CLSID_TsStrFactory);
	if (m_pssRole)
	{
		PossItemInfo * ppii;
		GetLpInfo()->GetPossListAndItem(m_pssRole, wsUser, &ppii, NULL);
		StrUni stuName;  // the Role's name
		ppii->GetName(stuName, m_pnt);
		qtsf->MakeStringRgch(stuName.Chars(), stuName.Length(), wsUser, &qtssName);

		ITsIncStrBldrPtr qtisb;
		qtisb.CreateInstance(CLSID_TsIncStrBldr);

		// Add the first substring.
		qtisb->AppendTsString(m_qfsp->m_qtssHelp);

		// Add the second substring.
		StrUni stuTemp;
		stuTemp.Load(kstidRnRoledPartic_HelpA);
		qtisb->AppendRgch(stuTemp.Chars(), stuTemp.Length());

		// Turn bold on.
		qtisb->SetIntPropValues(ktptBold, ktpvEnum, kttvForceOn);
		// Add the Role's name
		qtisb->AppendRgch(stuName.Chars(), stuName.Length());
		// Turn bold off.
		qtisb->SetIntPropValues(ktptBold, ktpvEnum, kttvOff);

		// Add the third substring.
		stuTemp.Load(kstidRnRoledPartic_HelpB);
		qtisb->AppendRgch(stuTemp.Chars(), stuTemp.Length());

		// Get the completed TsString.
		qtisb->GetString(&qtssHelp);
	}
	m_qtssLabel = qtssName;
	m_qtssHelp = qtssHelp;

	// Force the label to redraw.
	Rect rcLabel;
	::GetClientRect(m_qadsc->Hwnd(),&rcLabel);
	Rect rcEdit(m_rcClip);
	if (m_hwnd)
	{
		// We have an open edit box, so get the correct coordinates for the client window.
		::GetClientRect(m_hwnd, &rcEdit);
		::MapWindowPoints(m_hwnd, m_qadsc->Hwnd(), (POINT *)&rcEdit, 2);
	}
	rcLabel.top = rcEdit.top;
	rcLabel.bottom = rcEdit.bottom;
	rcLabel.right = m_qadsc->GetTreeWidth();
	::InvalidateRect(m_qadsc->Hwnd(), &rcLabel, false);
}