Пример #1
0
STDMETHODIMP VwAccessRoot::accLocation(long * pxLeft, long * pyTop, long * pcxWidth,
	long * pcyHeight, VARIANT varID)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pxLeft);
	ChkComArgPtr(pyTop);
	ChkComArgPtr(pcxWidth);
	ChkComArgPtr(pcyHeight);
	if (!m_pbox)
		return CO_E_OBJECTNOTCONNECTED;
	VwRootBox * prootb = m_pbox->Root();
	IVwRootSite * psite = prootb->Site();
	// Rather arbitrarily, use the coordinate transformation at the top left of the box.
	Point pt(m_pbox->LeftToLeftOfDocument(), m_pbox->TopToTopOfDocument());
	HoldGraphicsAtSrc hg(prootb, pt);
	Rect bounds = m_pbox->GetBoundsRect(hg.m_qvg, hg.m_rcSrcRoot, hg.m_rcDstRoot);
	Point ptTl = bounds.TopLeft();
	psite->ClientToScreen(prootb, &ptTl);
	*pxLeft = ptTl.x;
	*pyTop = ptTl.y;
	*pcxWidth = bounds.Width();
	*pcyHeight = bounds.Height();

	END_COM_METHOD(g_fact, IID_IAccessible);
}
Пример #2
0
/*----------------------------------------------------------------------------------------------
	Provides a potentially different but logically equivalent FORMATETC structure.  This
	implementation merely copies the input format to the output format.

	This is a standard COM IDataObject method.

	According to Inside OLE, chapter 10, this method should return DATA_S_SAMEFORMATETC if,
	as in our case, it uses the simplest implementation (for where the implementor does not
	care about the output medium) and copies the input to the output in this method.

	@param pfmteIn Pointer to a FORMATETC structure describing a data format.
	@param pfmteOut Pointer to a FORMATETC structure describing the canonical form of that data
					format.

	@return S_OK, E_INVALIDARG, or E_POINTER.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgTsDataObject::GetCanonicalFormatEtc(FORMATETC * pfmteIn, FORMATETC * pfmteOut)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pfmteIn);
	ChkComArgPtr(pfmteOut);

	memcpy(pfmteOut, pfmteIn, isizeof(FORMATETC));

	return DATA_S_SAMEFORMATETC;

	END_COM_METHOD(g_fact, IID_IDataObject);
}
Пример #3
0
STDMETHODIMP VwBaseVc::GetIdFromGuid(ISilDataAccess * psda, GUID * pguid, HVO * phvo)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(psda);
	ChkComArgPtr(pguid);

	IVwOleDbDaPtr qodd;
	CheckHr(psda->QueryInterface(IID_IVwOleDbDa, (void **)&qodd));
	if (!qodd)
		return S_OK; // Can't do anything; ignore.
	CheckHr(qodd->GetIdFromGuid(pguid, phvo));
	END_COM_METHOD(g_fact, IID_IVwViewConstructor);
}
Пример #4
0
/*----------------------------------------------------------------------------------------------
	Renders the data described in a FORMATETC structure and transfers it through the STGMEDIUM
	structure allocated by the caller.

	This is a standard COM IDataObject method.

	@param pfmte Pointer to a FORMATETC structure describing the desired data format.
	@param pmedium Pointer to a STGMEDIUM structure that defines the output medium.

	@return S_OK, DV_E_DVASPECT, DV_E_FORMATETC, DV_E_LINDEX, DV_E_TYMED, E_FAIL, E_INVALIDARG,
					E_NOTIMPL, E_UNEXPECTED, or possibly some other COM error code.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgTsDataObject::GetDataHere(FORMATETC * pfmte, STGMEDIUM * pmedium)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pfmte);
	ChkComArgPtr(pmedium);
	AssertPtr(m_qtsswss.Ptr());
	if (pfmte->lindex != -1 && pfmte->lindex != 1)
		return DV_E_LINDEX;
	if (pfmte->dwAspect && pfmte->dwAspect != DVASPECT_CONTENT)
		return DV_E_DVASPECT;	// Invalid dwAspect value.

	if (pfmte->cfFormat == LgTsDataObject::s_cfTsString)
	{
		if (pfmte->tymed == TYMED_NULL)
		{
			pmedium->tymed = TYMED_NULL;
			pmedium->pstm = NULL;
			pmedium->pUnkForRelease = NULL;
			return S_OK;
		}
		if (pfmte->tymed & TYMED_ISTORAGE)
		{
			if (pmedium->tymed == TYMED_ISTORAGE && pmedium->pstg)
			{
				CheckHr(m_qtsswss->Serialize(pmedium->pstg));
				CheckHr(pmedium->pstg->Commit(STGC_DEFAULT));
				return S_OK;
			}
			else
			{
				return E_NOTIMPL;
			}
		}
		else
		{
			return DV_E_TYMED;
		}
	}
	else if (pfmte->cfFormat == CF_TEXT || pfmte->cfFormat == CF_OEMTEXT ||
		pfmte->cfFormat == CF_UNICODETEXT)
	{
		// These are better handled by GetData, since the amount of global memory that needs to
		// be allocated is known only internally.
		return E_NOTIMPL;
	}
	else
	{
		return DV_E_FORMATETC;
	}
	END_COM_METHOD(g_fact, IID_IDataObject);
}
Пример #5
0
/*----------------------------------------------------------------------------------------------
	IsValidInsertionPoint
		True if input method considers an IP at the specified index reasonable.
		Note that really useful IPs should also satisfy the Renderer; see
		ILgSegment>>IsValidInsertionPoint.

	 Arguments:
		ich
		ptss
		pfValid

----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgInputMethodEditor::IsValidInsertionPoint(int ich, ITsString * ptss,
														BOOL * pfValid)
// TODO: Shouldn't pfValid be a ComBool?
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(ptss);
	ChkComOutPtr(pfValid);

	int cCh;
	SmartBstr sbstr;
	CheckHr(ptss->get_Length(&cCh));
	if (ich == cCh)
	{
		*pfValid = 1;
	}
	else if ((ich >= 0) && (ich < cCh))
	{
		CheckHr(ptss->GetChars(ich, ich + 1, &sbstr));
		*pfValid = ((sbstr[0] < 0xDC00) || (sbstr[0] > 0xDFFF)) && (ich >= 0) && (ich <= cCh);
	}
	else
	{
		*pfValid = 0;
	}
	END_COM_METHOD(g_fact, IID_ILgFontManager);
}
Пример #6
0
STDMETHODIMP VwAccessRoot::accHitTest(long xLeft, long yTop, VARIANT * pvarID)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pvarID);
	if (!m_pbox)
		return CO_E_OBJECTNOTCONNECTED;
	VwRootBox * prootb = m_pbox->Root();
	IVwRootSite * psite = prootb->Site();
	Point ptTarget;
	ptTarget.x = xLeft;
	ptTarget.y = yTop;
	psite->ScreenToClient(prootb, &ptTarget);
	HoldGraphicsAtDst hg(prootb, ptTarget);
	VwBox * pboxRes = m_pbox->FindBoxContaining(ptTarget, hg.m_qvg, hg.m_rcSrcRoot,
		hg.m_rcDstRoot);
	if (pboxRes == m_pbox)
	{
		// Doc says to return I4 value as follows if not within a child
		pvarID->vt= VT_I4;
		pvarID->intVal = CHILDID_SELF;
		return S_OK;
	}
	if (!pboxRes)
	{
		pvarID->vt = VT_EMPTY;
		return S_OK;
	}

	pvarID->vt = VT_DISPATCH;
	GetAccessFor(pboxRes, &(pvarID->pdispVal));

	END_COM_METHOD(g_fact, IID_IAccessible);
}
Пример #7
0
/*----------------------------------------------------------------------------------------------
	Determines whether the data object is capable of rendering the data described in the
	FORMATETC structure.

	This is a standard COM IDataObject method.

	@param pfmte Pointer to a FORMATETC structure describing the desired data format.

	@return  S_OK, DV_E_DVASPECT, DV_E_FORMATETC, DV_E_LINDEX, DV_E_TYMED, or E_INVALIDARG.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgTsDataObject::QueryGetData(FORMATETC * pfmte)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pfmte);
	if (pfmte->cfFormat != CF_TEXT &&
		pfmte->cfFormat != CF_OEMTEXT &&
		pfmte->cfFormat != CF_UNICODETEXT &&
		pfmte->cfFormat != LgTsDataObject::s_cfTsString)
	{
		return DV_E_FORMATETC;
	}
	if (pfmte->lindex != -1 && pfmte->lindex != 1)
	{
		return DV_E_LINDEX;		// Invalid value for lindex; currently, only -1 is supported.
	}
	if (pfmte->dwAspect && pfmte->dwAspect != DVASPECT_CONTENT)
	{
		return DV_E_DVASPECT;	// Invalid dwAspect value.
	}
	if (pfmte->cfFormat == LgTsDataObject::s_cfTsString)
	{
		if (pfmte->tymed != TYMED_ISTORAGE)
			return DV_E_TYMED;	// Invalid tymed value.
	}
	else if (pfmte->tymed != TYMED_NULL && !(pfmte->tymed & TYMED_HGLOBAL))
	{
		return DV_E_TYMED;		// Invalid tymed value.
	}
	END_COM_METHOD(g_fact, IID_IDataObject);
}
Пример #8
0
/*----------------------------------------------------------------------------------------------
	${IActionHandler#StartSeq}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::StartSeq(BSTR bstrUndo, BSTR bstrRedo, IUndoAction * puact)
{
	BEGIN_COM_METHOD;
	ChkComBstrArg(bstrUndo);
	ChkComBstrArg(bstrRedo);
	ChkComArgPtr(puact);

	if (m_fUndoOrRedoInProgress)
		return S_OK;

	BeginUndoTask(bstrUndo, bstrRedo);
	// Add the current action.
	AddActionAux(puact);
	EndUndoTask();

#ifdef DEBUG_ACTION_HANDLER
	StrAnsi sta(bstrUndo);
	sta.Replace(0, 0, "StartSeq:");
	sta.FormatAppend(" m_iCurrSeq=%d, m_viSeqStart=%d, m_iuactCurr=%d, m_vquact=%d, m_viMarks=%d, m_nDepth=%d\n",
		m_iCurrSeq, m_viSeqStart.Size(), m_iuactCurr, m_vquact.Size(), m_viMarks.Size(), m_nDepth);
	::OutputDebugStringA(sta.Chars());
#endif//DEBUG_ACTION_HANDLER

	END_COM_METHOD(g_factActh, IID_IActionHandler);
}
Пример #9
0
/*----------------------------------------------------------------------------------------------
	Return the class ID for the implementation class.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP RomRenderEngine::get_ClassId(GUID * pguid)
{
	BEGIN_COM_METHOD
	ChkComArgPtr(pguid);
	memcpy(pguid, &CLSID_RomRenderEngine, isizeof(GUID));
	END_COM_METHOD(g_fact, IID_IRenderEngine);
}
Пример #10
0
/*----------------------------------------------------------------------------------------------
	Generate the sort key as a "SAFEARRAY".
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgIcuCollator::get_SortKeyVariant(BSTR bstrValue, LgCollatingOptions colopt,
	VARIANT * psaKey)
{
	BEGIN_COM_METHOD;
	ChkComBstrArgN(bstrValue);
	ChkComArgPtr(psaKey);
	psaKey->vt = VT_NULL;

	EnsureCollator();

	int32_t cbKey = keySize;
	byte rgbKey[keySize+1];
	Vector<byte> vbKey;
	byte * pbKey = GetSortKey(bstrValue, rgbKey, &cbKey, vbKey);

	// Allocate the safe array.
	SAFEARRAYBOUND rgsabound[1];
	rgsabound[0].lLbound = 0;
	rgsabound[0].cElements = cbKey;
	SAFEARRAY FAR * psa = ::SafeArrayCreate(VT_UI1, 1, rgsabound);
	// Copy the key data to the safe array.
	byte * pbOut;
	CheckHr(::SafeArrayAccessData(psa, (void HUGEP **)&pbOut));
	memcpy(pbOut, pbKey, cbKey);
	CheckHr(::SafeArrayUnaccessData(psa));
	// Push the safe array to the output pointer.
	psaKey->vt = VT_UI1 | VT_ARRAY;
	V_ARRAY(psaKey) = psa;

	return S_OK;

	END_COM_METHOD(g_fact, IID_ILgCollatingEngine);
}
Пример #11
0
/*----------------------------------------------------------------------------------------------
	${IActionHandler#AddAction}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::AddAction(IUndoAction * puact)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(puact);

	if (m_fUndoOrRedoInProgress)
		return S_OK;

	if(m_fCreateMarkIfNeeded && m_viMarks.Size() == 0)
	{
		// m_fCreateMarkIfNeeded probably didn't get reset (TE-4856)
		Assert(m_nDepth <= 0 || m_fStartedNext);

		int hmark;
		CheckHr(Mark(&hmark));
		Assert(hmark == 1); // Should only have 1 mark!
	}
	ContinueUndoTask();
	AddActionAux(puact);
	EndUndoTask();

#ifdef DEBUG_ACTION_HANDLER
	StrAnsi sta;
	sta.Format("AddAction:");
	sta.FormatAppend(" m_iCurrSeq=%d, m_viSeqStart=%d, m_iuactCurr=%d, m_vquact=%d, m_viMarks=%d, m_nDepth=%d\n",
		m_iCurrSeq, m_viSeqStart.Size(), m_iuactCurr, m_vquact.Size(), m_viMarks.Size(), m_nDepth);
	::OutputDebugStringA(sta.Chars());
#endif//DEBUG_ACTION_HANDLER

	END_COM_METHOD(g_factActh, IID_IActionHandler);
}
Пример #12
0
// Because selections don't correspond well to boxes (a selection may be part of a box,
// or cross several boxes), we currently don't support this. We might enhance it later,
// at least for special cases like a selection entirely within one paragraph.
STDMETHODIMP VwAccessRoot::get_accFocus(VARIANT * pvarID)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pvarID);
	pvarID->vt = VT_EMPTY;
	END_COM_METHOD(g_fact, IID_IAccessible);
}
Пример #13
0
/*----------------------------------------------------------------------------------------------
	DisplayVariant is used for times and enumerations.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP CleCustDocVc::DisplayVariant(IVwEnv * pvwenv, int tag, VARIANT v, int frag,
	ITsString ** pptss)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pvwenv);
	ChkComOutPtr(pptss);

	ITsStrFactoryPtr qtsf;
	qtsf.CreateInstance(CLSID_TsStrFactory);
	int ws = m_qlpi->GetDbInfo()->UserWs();

	if (tag == kflidCmPerson_Gender || tag == kflidCmPerson_IsResearcher)
	{
		int itss = v.intVal;
		int stid;
		switch (tag)
		{
		case kflidCmPerson_Gender:
			stid = kstidEnumGender;
			break;
		case kflidCmPerson_IsResearcher:
			stid = kstidEnumNoYes;
			if (itss)
				itss = 1;
			break;
		default:
			Assert(false);
			break;
		}
		StrUni stuEnum(stid);
		const wchar * pszEnum = stuEnum.Chars();
		const wchar * pszEnumLim = stuEnum.Chars() + stuEnum.Length();
		ITsStringPtr qtss;
		//ITsStrFactoryPtr qtsf;
		//qtsf.CreateInstance(CLSID_TsStrFactory);
		int itssTry = 0;
		while (pszEnum < pszEnumLim && itssTry <= itss)
		{
			const wchar * pszEnumNl = wcschr(pszEnum, '\n');
			if (!pszEnumNl)
				pszEnumNl = pszEnumLim;
			if (itss == itssTry)
			{
				return qtsf->MakeStringRgch(pszEnum, (pszEnumNl - pszEnum), ws, pptss);
			}
			itssTry++;
			pszEnum = pszEnumNl + 1;
		}
		// Fall-back behavior if we couldn't find a string: use the integer value.
		char rgch[20];
		_itoa_s(itss, rgch, 10);
		StrUni stu(rgch);
		return qtsf->MakeStringRgch(stu.Chars(), stu.Length(), ws, pptss);
	}

	return SuperClass::DisplayVariant(pvwenv, tag, v, frag, pptss);

	END_COM_METHOD(g_fact1, IID_IVwViewConstructor)
}
Пример #14
0
/*----------------------------------------------------------------------------------------------
	Read an array of ITsTextProps from a byte array and return it. If cpttpMax == 0, return
	in cpttpRet the number of items present. Return S_FALSE if the array is not totally
	consumed, but at least one ITsTextProps is successfully read.

	For runs that have duplicate properties (ie, where the offsets into the properties stuff
	are identical), returns duplicate pointers in rgpttp.

	Also return the character counts for each run, so that we can reconstruct the
	run information later on.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP TsPropsFact::DeserializeRgPropsRgb(int cpttpMax, const BYTE * prgb, int * pcb,
		int * pcpttpRet, ITsTextProps ** rgpttp, int * rgich)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pcb);
	ChkComOutPtr(pcpttpRet);
	ChkComArrayArg(prgb, *pcb);
	ChkComArrayArg(rgpttp, cpttpMax);
	ChkComArrayArg(rgich, cpttpMax);

	DataReaderRgb drrHdr(prgb, *pcb);
	int crun;
	drrHdr.ReadInt(&crun);
	if (cpttpMax == 0)
	{
		*pcpttpRet = crun;
	}
	else
	{
		Vector<int> vcbOffsets;
		vcbOffsets.Resize(crun);

		const byte * pbRun0 = prgb + isizeof(int) + (crun * isizeof(int) * 2);

		for (int irun = 0; irun < min(cpttpMax, crun); irun++)
		{
			drrHdr.ReadInt(rgich + irun); // character min
			int cbOffsetThisRun;
			drrHdr.ReadInt(&cbOffsetThisRun);
			vcbOffsets[irun] = cbOffsetThisRun;

			// Check for a duplicate set of properties.
			int irunDup;
			for (irunDup = 0; irunDup < irun; irunDup++)
			{
				if (cbOffsetThisRun == vcbOffsets[irunDup])
				{
					// Duplicate offset: copy the previous ITsTextProps.
					rgpttp[irun] = rgpttp[irunDup];
					rgpttp[irun]->AddRef();
					break;
				}
			}
			if (irunDup >= irun) // didn't find duplicate
			{
				const byte * pbThisRun = pbRun0 + cbOffsetThisRun;
				// Note that the buffer size is provided below simply as a sanity check. The
				// data itself is structured so that the deserialize method knows how much
				// to read for each run.
				DataReaderRgb drr(pbThisRun, (*pcb - (pbThisRun - prgb)));
				TsTextProps::DeserializeDataReader(&drr, rgpttp + irun);
			}
		}
		*pcpttpRet = min(cpttpMax, crun);
	}

	END_COM_METHOD(g_factPropsFact, IID_ITsPropsFactory);
}
Пример #15
0
/*----------------------------------------------------------------------------------------------
	Get the status of an open IStream (file).
	If the caller uses the value STATFLAG_DEFAULT for grfStatFlag then the user must free
	the memory which this method allocates for the file name at pstatstg->pwcsName.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FileStream::Stat(STATSTG * pstatstg, DWORD grfStatFlag)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pstatstg);

	if (m_hfile == NULL)
		ThrowHr(WarnHr(E_UNEXPECTED));

	BY_HANDLE_FILE_INFORMATION bhfi;

	if (!GetFileInformationByHandle(m_hfile, &bhfi))
	{
		// The caller does not have sufficient permissions for accessing statistics for this
		// stream object.
		ThrowHr(WarnHr(STG_E_ACCESSDENIED));
	}

	pstatstg->pwcsName = NULL;

	switch (grfStatFlag)
	{
	case STATFLAG_DEFAULT:
		// Requests that the statistics include the pwcsName member of the STATSTG structure.
		{
			StrUniBufPath stubpName = m_staPath.Chars();

			pstatstg->pwcsName = (wchar *)CoTaskMemAlloc(
				(stubpName.Length() + 1) * isizeof(wchar));
			if (NULL == pstatstg->pwcsName)
				ThrowHr(WarnHr(STG_E_INSUFFICIENTMEMORY));

			memcpy(pstatstg->pwcsName, stubpName.Chars(), stubpName.Length() * isizeof(wchar));
			pstatstg->pwcsName[stubpName.Length()] = 0;
		}
		// Fall Through.
	case STATFLAG_NONAME:
		// Requests that the statistics not include the pwcsName member of the STATSTG
		// structure. If the name is omitted, there is no need for the Stat methods to allocate
		// and free memory for the string value for the name and the method can save an Alloc
		// and the caller a Free operation.
		pstatstg->type = STGTY_STREAM;
		pstatstg->cbSize.HighPart = bhfi.nFileSizeHigh;
		pstatstg->cbSize.LowPart = bhfi.nFileSizeLow;
		pstatstg->mtime = bhfi.ftLastWriteTime;
		pstatstg->ctime = bhfi.ftCreationTime;
		pstatstg->atime = bhfi.ftLastAccessTime;
		pstatstg->grfMode = m_grfstgm;
		pstatstg->grfLocksSupported = 0;
		pstatstg->clsid = CLSID_NULL;
		pstatstg->grfStateBits = 0;
		return S_OK;

	default:
		ThrowHr(WarnHr(STG_E_INVALIDFLAG));
	}
	END_COM_METHOD(g_fact, IID_IStream);
}
Пример #16
0
/*----------------------------------------------------------------------------------------------
	Set the writing system factory.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwCppStylesDlg::putref_WritingSystemFactory(ILgWritingSystemFactory * pwsf)
{
    BEGIN_COM_METHOD;
    ChkComArgPtr(pwsf);

    m_qwsf = pwsf;

    END_COM_METHOD(g_factOPD, IID_IFwCppStylesDlg);
}
Пример #17
0
/*----------------------------------------------------------------------------------------------
	Return the initialization value previously set by InitNew.

	@param pbstr Pointer to a BSTR for returning the initialization data.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgInputMethodEditor::get_InitializationData(BSTR * pbstr)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pbstr);

	*pbstr = NULL;

	END_COM_METHOD(g_fact, IID_ISimpleInit);
}
Пример #18
0
/*----------------------------------------------------------------------------------------------
	Set the style sheet used to initialize the dialog.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwCppStylesDlg::putref_Stylesheet(IVwStylesheet * pvss)
{
    BEGIN_COM_METHOD;
    ChkComArgPtr(pvss);

    m_qvss = pvss;

    END_COM_METHOD(g_factOPD, IID_IFwCppStylesDlg);
}
Пример #19
0
/*----------------------------------------------------------------------------------------------
	${IDebugReport#SetSink}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP DebugReport::SetSink(IDebugReportSink * pSink)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pSink);

	KernelGlobals::s_qReportSink = pSink;
	m_oldAssertProc = ::SetAssertProc(DebugReport::AssertProcWrapper);

	END_COM_METHOD(g_factDbr, IID_IDebugReport);
}
Пример #20
0
/*----------------------------------------------------------------------------------------------
	Return the initialization value previously set by InitNew.

	@param pbstr Pointer to a BSTR for returning the initialization data.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgUnicodeCollater::get_InitializationData(BSTR * pbstr)
{
	BEGIN_COM_METHOD
	ChkComArgPtr(pbstr);

	*pbstr = NULL;
	return S_OK;

	END_COM_METHOD(g_fact, IID_ILgCollatingEngine);
}
Пример #21
0
/*----------------------------------------------------------------------------------------------
	Initialize the LgTsDataObject with its internal ILgTsStringPlusWss value.

	@param ptss Pointer to the ILgTsStringPlusWss COM object which this LgTsDataObject object
					wraps.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgTsDataObject::Init(ILgTsStringPlusWss * ptssencs)
{
	BEGIN_COM_METHOD;

	ChkComArgPtr(ptssencs);

	m_qtsswss = ptssencs;

	END_COM_METHOD(g_fact, IID_ILgTsDataObject);
}
Пример #22
0
STDMETHODIMP VwAccessRoot::get_accState(VARIANT varID, VARIANT * pvarState)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pvarState);
	if (!m_pbox)
		return CO_E_OBJECTNOTCONNECTED;
	pvarState->vt = VT_I4;
	pvarState->intVal = m_pbox->State();
	END_COM_METHOD(g_fact, IID_IAccessible);
}
Пример #23
0
//:>********************************************************************************************
//:>	IAccessibility methods
//:>********************************************************************************************
STDMETHODIMP VwAccessRoot::accNavigate(long navDir, VARIANT varStart, VARIANT * pvarEnd)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pvarEnd);
	if (!m_pbox)
		return CO_E_OBJECTNOTCONNECTED;
	VwGroupBox * pgboxContainer = m_pbox->Container();
	VwGroupBox * pgboxThis = dynamic_cast<VwGroupBox *>(m_pbox);
	VwBox * pboxRes = NULL;
	switch(navDir)
	{
	case NAVDIR_DOWN:
		if (pgboxContainer)
			pboxRes = pgboxContainer->NavDown(m_pbox);
		break;
	case NAVDIR_FIRSTCHILD:
		if (pgboxThis)
			pboxRes = pgboxThis->FirstBox();
		break;
	case NAVDIR_LASTCHILD:
		if (pgboxThis)
			pboxRes = pgboxThis->LastBox();
		break;
	case NAVDIR_LEFT:
		if (pgboxContainer)
			pboxRes = pgboxContainer->NavLeft(m_pbox);
		break;
	case NAVDIR_NEXT:
		if (pgboxContainer)
			pboxRes = m_pbox ->NextOrLazy();
		break;
	case NAVDIR_PREVIOUS:
		if (pgboxContainer)
			pboxRes = pgboxContainer->BoxBefore(m_pbox);
		break;
	case NAVDIR_RIGHT:
		if (pgboxContainer)
			pboxRes = pgboxContainer->NavRight(m_pbox);
		break;
	case NAVDIR_UP:
		if (pgboxContainer)
			pboxRes = pgboxContainer->NavUp(m_pbox);
		break;
	// default: leave pboxRes null, return VT_EMPTY/EUNEXPECTED.
	}
	if (!pboxRes)
	{
		pvarEnd->vt = VT_EMPTY;
		return E_UNEXPECTED;
	}
	pvarEnd->vt = VT_DISPATCH;
	GetAccessFor(pboxRes, &(pvarEnd->pdispVal));

	END_COM_METHOD(g_fact, IID_IAccessible);
}
Пример #24
0
/*----------------------------------------------------------------------------------------------
	Read an ITsTextProps from the stream and return it.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP TsPropsFact::DeserializeProps(IStream * pstrm, ITsTextProps ** ppttp)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pstrm);
	ChkComOutPtr(ppttp);

	DataReaderStrm drs(pstrm);
	TsTextProps::DeserializeDataReader(&drs, ppttp);

	END_COM_METHOD(g_factPropsFact, IID_ITsPropsFactory);
}
Пример #25
0
/*----------------------------------------------------------------------------------------------
	${IDbColSpec#GetTag}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP DbColSpec::GetTag(int iIndex, PropTag * ptag)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(ptag);
	Assert(iIndex >= 0);
	Assert(iIndex < vtag.Size());
	if ((unsigned)iIndex >= (unsigned)vtag.Size())
		return E_INVALIDARG;

	*ptag = vtag[iIndex];

	END_COM_METHOD(g_factDbColSpec, IID_IDbColSpec);
}
Пример #26
0
/*----------------------------------------------------------------------------------------------
	The user clicked on the object.

	@param pguid Pointer to a database object's assigned GUID.
	@param hvoOwner The database ID of the object.
	@param tag Identifier used to select one particular property of the object.
	@param ptss Pointer to an ITsString COM object containing a string that embeds a link to the
					object.
	@param ichObj Offset in the string to the pseudo-character that represents the object link.

	@return S_OK, E_POINTER, E_INVALIDARG, or E_FAIL.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP CleRecVc::DoHotLinkAction(BSTR bstrData, HVO hvoOwner, PropTag tag,
	ITsString * ptss, int ichObj)
{
	BEGIN_COM_METHOD;
	ChkComBstrArg(bstrData);
	ChkComArgPtr(ptss);

	// TODO (DarrellZ): This is currently not called because something else is handling the
	// click.
	return SuperClass::DoHotLinkAction(bstrData, hvoOwner, tag, ptss, ichObj);

	END_COM_METHOD(g_fact2, IID_IVwViewConstructor)
}
Пример #27
0
/*----------------------------------------------------------------------------------------------
	Copy cb bytes from the current position in this stream to the current position in
	the stream *pstm.
	Uses FileStream ${#Read} and ${#Write} methods. Note that though it would be more efficient
	in some	cases to bypass the Read method for several consecutive reads, the case of copying
	to a clone would require special handling.
	There is no check for overlapping read & write areas. REVIEW (JohnL): Should there be?
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FileStream::CopyTo(IStream * pstm, ULARGE_INTEGER cb, ULARGE_INTEGER * pcbRead,
	ULARGE_INTEGER * pcbWritten)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pstm);
	ChkComArgPtrN(pcbRead);
	ChkComArgPtrN(pcbWritten);

	if (cb.HighPart)
		ThrowHr(WarnHr(STG_E_INVALIDPARAMETER)); // handle only 32-bit byte counts
	// REVIEW JohnL: should we nevertheless handle cb == max ULARGE_INTEGER as a special case?
	if (pstm == this)
		ThrowHr(WarnHr(STG_E_INVALIDPARAMETER)); // prevent copy to self
	// REVIEW JohnL: is this correct?

	if (pcbRead)
		(*pcbRead).QuadPart = 0;
	if (pcbWritten)
		(*pcbWritten).QuadPart = 0;

	const ULONG kcbBufferSize = 4096;
	ULONG cbReadTotal;
	ULONG cbWrittenTotal = 0;
	byte prgbBuffer[kcbBufferSize];
	ULONG cbRead = 0;
	ULONG cbWritten;
	ULONG cbr = 0;

	for (cbReadTotal = 0; (cbReadTotal < cb.LowPart) && (cbRead == cbr); )
	{
		cbr = cb.LowPart - cbReadTotal;
		if (cbr > kcbBufferSize)
			cbr = kcbBufferSize;
		CheckHr(Read((void *)prgbBuffer, cbr, &cbRead));
		cbReadTotal += cbRead;
		if (cbRead)
		{
			CheckHr(pstm->Write((void *)prgbBuffer, cbRead, &cbWritten));
			cbWrittenTotal += cbWritten;
		}
	}
	if (pcbRead)
		(*pcbRead).LowPart = cbReadTotal;
	if (pcbWritten)
		(*pcbWritten).LowPart = cbWrittenTotal;

	// REVIEW JohnL: How do we define "success" for CopyTo? Should we return a failure if
	//                 cbWrittenTotal != cbReadTotal?
	END_COM_METHOD(g_fact, IID_IStream);
}
Пример #28
0
/*----------------------------------------------------------------------------------------------
	Read an ITsTextProps from a byte array and return it.  Return S_FALSE if the array is not
	totally consumed, but an ITsTextProps is successfully read.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP TsPropsFact::DeserializePropsRgb(const byte * prgb, int * pcb,
	ITsTextProps ** ppttp)
{
	BEGIN_COM_METHOD;
	ChkComArgPtr(pcb);
	ChkComOutPtr(ppttp);
	ChkComArrayArg(prgb, *pcb);

	DataReaderRgb drr(prgb, *pcb);
	TsTextProps::DeserializeDataReader(&drr, ppttp);
	return drr.IbCur() < drr.Size() ? S_FALSE : S_OK;

	END_COM_METHOD(g_factPropsFact, IID_ITsPropsFactory);
}
Пример #29
0
/*----------------------------------------------------------------------------------------------
	Static method to obtain the clipboard type registered for TsString data.

	@param pType The clipboard type registered for "CF_TsString".
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgTsDataObject::GetClipboardType(UINT* pType)
{
	BEGIN_COM_METHOD;

	ChkComArgPtr(pType);
	*pType = 0;

	if (!LgTsDataObject::s_cfTsString)
		LgTsDataObject::s_cfTsString = ::RegisterClipboardFormat(_T("CF_TsString"));
	Assert(LgTsDataObject::s_cfTsString);
	*pType = LgTsDataObject::s_cfTsString;

	END_COM_METHOD(g_fact, IID_ILgTsDataObject);
}
Пример #30
0
/*----------------------------------------------------------------------------------------------
	Set the system keyboard and TSF language.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgTextServices::SetKeyboard(int lcid, BSTR bstrKeymanKbd, int * pnActiveLangId,
	BSTR * pbstrActiveKeymanKbd, ComBool * pfSelectLangPending)
{
	BEGIN_COM_METHOD;
	ChkComBstrArgN(bstrKeymanKbd);
	ChkComArgPtr(pnActiveLangId);
	ChkComArgPtr(pbstrActiveKeymanKbd);
	ChkComArgPtr(pfSelectLangPending);

	HRESULT hr;
	int nLangId = LANGIDFROMLCID(lcid);

	bool fDoingKeyman = BstrLen(bstrKeymanKbd) > 0;
	bool fSetInputLang = false;
#ifdef ENABLE_TSF
	if (IsKeyboardDifferent(bstrKeymanKbd, *pbstrActiveKeymanKbd) ||
		(LANGID)nLangId != (LANGID)*pnActiveLangId)
	{
		fSetInputLang = SetKeyboard_TSF(fDoingKeyman, lcid, pnActiveLangId);
	}
#endif /*ENABLE_TSF*/

	if (fDoingKeyman)
	{
		hr = SetKeyboard_Keyman(lcid, bstrKeymanKbd, pbstrActiveKeymanKbd, pfSelectLangPending);
	}
	else // no keyman keyboard wanted.
	{
		if (!fSetInputLang)
			SetKeyboard_Windows(lcid);

		TurnOffKeymanKbd(pbstrActiveKeymanKbd);
		*pfSelectLangPending = true;
	}

	END_COM_METHOD(g_fact, IID_ILgTextServices);
}