Example #1
0
int CContentCtrl::GetContent(CBinaryData& content) const
{
	int nLenBytes = 0;
	content.Empty();
	
	if (m_pContentCtrl)
	{
		nLenBytes = m_pContentCtrl->GetContent(NULL);
		
		if (nLenBytes) // excludes NULL
		{
			unsigned char* szContent = content.GetBuffer(nLenBytes);
			nLenBytes = m_pContentCtrl->GetContent(szContent);
			content.ReleaseBuffer(nLenBytes);
		}
	}
	
	return nLenBytes;
}
Example #2
0
BOOL CContentMgr::ConvertContentToHtml(const CBinaryData& content, CString& sHtml, LPCTSTR szID, LPCTSTR szCharSet, LPCTSTR szImageDir)
{
	Initialize(); // initialize on demand

	int nContent = FindContent(szID);

	if (nContent == -1)
		return FALSE;

	IContent* pContent = m_aContent[nContent];
	ASSERT (pContent);

	LPTSTR szHtml = NULL;
	int nHtmlLen = pContent->ConvertToHtml(content.Get(), content.GetLength(), szCharSet, szHtml, szImageDir);

	if (nHtmlLen)
		sHtml = szHtml;

	pContent->FreeHtmlBuffer(szHtml); // cleanup
	
	return (nHtmlLen > 0);
}
Example #3
0
BOOL CContentCtrl::SetContent(const CBinaryData& content, BOOL bResetSelection)
{
	return SetContent(content.Get(), content.GetLength(), bResetSelection);
}