Exemplo n.º 1
0
/*----------------------------------------------------------------------------------------------
	Open a main window on a particular object in a particular database on a particular field
	in a particular object using a particular view.
	Will fail if the specified tool cannot handle the specified top-level object.
	Returns a value which can be used to identify the particular window in subsequent calls.
	@param bstrServerName Name of the MSDE/SQLServer computer.
	@param bstrDbName Name of the database.
	@param hvoLangProj Which languate project within the database.
	@param hvoMainObj The top-level object on which to open the window.
	@param encUi The user-interface writing system.
	@param nTool A tool-dependent identifier of which tool to use.
	@param nParam Another tool-dependent parameter.
	@param prghvo Pointer to an array of object ids.
	@param chvo Number of object ids in prghvo.
	@param prgflid Pointer to an array of flids.
	@param cflid Number of flids in prgflid.
	@param ichCur Cursor offset from beginning of field.
	@param nView The view to display when showing the first object. Use -1 to use the first
		data entry view.
	@param ppidNew Process id of the new main window's process.
	@param phtool Handle to the newly created window.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP AfFwTool::NewMainWndWithSel(BSTR bstrServerName, BSTR bstrDbName, int hvoLangProj,
	int hvoMainObj, int encUi, int nTool, int nParam, const HVO * prghvo, int chvo,
		const int * prgflid, int cflid, int ichCur, int nView, int * ppidNew, long * phtool)
{
	BEGIN_COM_METHOD
	ChkComBstrArg(bstrServerName);
	ChkComBstrArg(bstrDbName);
	ChkComArrayArg(prghvo, chvo);
	ChkComArrayArg(prgflid, cflid);
	ChkComOutPtr(ppidNew);
	ChkComOutPtr(phtool);

	const CLSID * pclsid = AfApp::Papp()->GetAppClsid();
	DWORD dwRegister = 0;
	if (pclsid)
	{
		// Check to see if the application is already running.
		IRunningObjectTablePtr qrot;
		CheckHr(::GetRunningObjectTable(0, &qrot));
		IMonikerPtr qmnk;
		CheckHr(::CreateClassMoniker(*pclsid, &qmnk));
		IUnknownPtr qunk;
		IFwToolPtr qtool;
		if (SUCCEEDED(qrot->GetObject(qmnk, &qunk)))
		{
			if (SUCCEEDED(qunk->QueryInterface(IID_IFwTool, (void **)&qtool)) &&
				qtool.Ptr() != this)
			{
				// The document is already open in another process, so create a new
				// window in that process.
				qtool->NewMainWndWithSel(bstrServerName, bstrDbName, hvoLangProj, hvoMainObj,
					encUi, nTool, nParam, prghvo, chvo, prgflid, cflid, ichCur, nView,
					ppidNew, phtool);
				// After we create the new window in the other process, we exit here.
				// When the IFwTool pointer pointing to 'this' goes out of scope, the
				// second process (if it was launched from Windows Explorer or the
				// command line) will shut down automatically.
				return S_OK;
			}
		}
		else
		{
			// Note: ROTFLAGS_ALLOWANYCLIENT causes an error on Win2K (The class is
			// configured to run as a security ID different from the caller).
			CheckHr(qrot->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, this, qmnk,
				&dwRegister));
		}
	}
	AfApp::Papp()->NewMainWndWithSel(bstrServerName, bstrDbName, hvoLangProj, hvoMainObj,
		encUi, nTool, nParam, prghvo, chvo, prgflid, cflid, ichCur, nView, dwRegister);
	// The handle we return is actually the hwnd of the top-level window.
	// ENHANCE JohnT: we should probably make htool a long...
	*phtool = (long)(AfApp::Papp()->GetCurMainWnd()->Hwnd());
	if (ppidNew)
		*ppidNew = (int)::GetCurrentProcessId();

	return S_OK;

	END_COM_METHOD(g_fact, IID_IFwTool);
}
Exemplo n.º 2
0
STDMETHODIMP LgLanguageEnumerator::Next(int * pnLoc, BSTR * pbstrName)
{
    BEGIN_COM_METHOD
    ChkComOutPtr(pnLoc);
    ChkComOutPtr(pbstrName);
    if (!m_prgLangIds)
        ThrowHr(WarnHr(E_UNEXPECTED));
    if (m_iLangId >= m_ulCount)
        return S_OK; // past end, leave *pnLoc 0 and *pbstrName null.

    wchar   szLangName[MAX_PATH];

    //Get the language name and print it to the debug window.
    if( 0 == GetLocaleInfoW(MAKELCID(m_prgLangIds[m_iLangId], SORT_DEFAULT),
                            LOCALE_SLANGUAGE,
                            szLangName,
                            MAX_PATH))
    {
        //InKey can give values that are not supported by the operating system.
        //Return the bad id with an error message
        *pnLoc = m_prgLangIds[m_iLangId++];
        return E_FAIL;
    }

    *pbstrName = SysAllocString(szLangName);
    if (!*pbstrName)
        ThrowHr(WarnHr(E_OUTOFMEMORY));
    *pnLoc = m_prgLangIds[m_iLangId++];

    END_COM_METHOD(g_factLang, IID_ILgLanguageEnumerator);
}
Exemplo n.º 3
0
/*----------------------------------------------------------------------------------------------
	Return a list of recognized values for the given feature. If cfvalMax is zero,
	pcfval returns the total number of values. Otherwise, it returns the number entered into
	the array.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwGrEngine::GetFeatureValues(int fid, int cfvalMax,
	int * prgfval, int * pcfval, int * pfvalDefault)
{
	BEGIN_COM_METHOD;
	ChkComOutPtr(pcfval);
	ChkComOutPtr(pfvalDefault);
	ChkComArrayArg(prgfval, cfvalMax);

	if (!m_pfont)
	{
		Assert(false);
		return E_UNEXPECTED;
	}

	FeatureIterator fit = m_pfont->featureWithID(fid);
	std::pair<FeatureSettingIterator, FeatureSettingIterator> pairIt
		= m_pfont->getFeatureSettings(fit);

	FeatureSettingIterator fsit = pairIt.first;
	FeatureSettingIterator fsitEnd = pairIt.second;
	int cfval = fsitEnd - fsit;
	if (cfvalMax == 0)
	{
		*pcfval = cfval;
		return S_OK;
	}

	*pcfval = min(cfvalMax, cfval);
	for (int i = 0;
		fsit != pairIt.second;
		++fsit, i++)
	{
		if (i >= *pcfval)
			break;
		prgfval[i] = (*fsit);
	}

	FeatureSettingIterator fsitDefault = m_pfont->getDefaultFeatureValue(fit);
	*pfvalDefault = *fsitDefault;
	for (int ifeat = 0; ifeat < m_cfeatWDefaults; ifeat++)
	{
		if (m_rgfsetDefaults[ifeat].id == fid)
		{
			*pfvalDefault = m_rgfsetDefaults[ifeat].value;
			break;
		}
	}

	END_COM_METHOD(g_fact, IID_IRenderingFeatures);
}
Exemplo n.º 4
0
/*----------------------------------------------------------------------------------------------
 Gets the whether the property should be computed every time it is needed.
---------------------------------------------------------------------------------------------*/
STDMETHODIMP VwBaseVirtualHandler::get_ComputeEveryTime(ComBool * pf)
{
    BEGIN_COM_METHOD;
    ChkComOutPtr(pf); // makes it false which is the default
    *pf = m_fComputeEveryTime;
    END_COM_METHOD(g_fact, IID_IVwVirtualHandler);
}
Exemplo n.º 5
0
/*----------------------------------------------------------------------------------------------
 Gets the whether the property can accept a write request.

 Default impl says it cannot. If you override this you must also override Write().
---------------------------------------------------------------------------------------------*/
STDMETHODIMP VwBaseVirtualHandler::get_Writeable(ComBool * pf)
{
    BEGIN_COM_METHOD;
    ChkComOutPtr(pf); // Also sets to false.
    *pf = m_fWriteable;
    END_COM_METHOD(g_fact, IID_IVwVirtualHandler);
}
Exemplo n.º 6
0
/*----------------------------------------------------------------------------------------------
 Gets the type of the property.
---------------------------------------------------------------------------------------------*/
STDMETHODIMP VwBaseVirtualHandler::get_Type(int * pcpt)
{
    BEGIN_COM_METHOD;
    ChkComOutPtr(pcpt);
    *pcpt = m_cpt;
    END_COM_METHOD(g_fact, IID_IVwVirtualHandler);
}
Exemplo n.º 7
0
/*----------------------------------------------------------------------------------------------
 Gets the identifier of the property (the value passed as tag to various methods
 of ISilDataAccess and IVwCacheDa).
---------------------------------------------------------------------------------------------*/
STDMETHODIMP VwBaseVirtualHandler::get_Tag(PropTag * ptag)
{
    BEGIN_COM_METHOD;
    ChkComOutPtr(ptag);
    *ptag = m_tag;
    END_COM_METHOD(g_fact, IID_IVwVirtualHandler);
}
Exemplo n.º 8
0
/*----------------------------------------------------------------------------------------------
	Return the support script directions. For the Roman renderer, this is simply horizontal
	left-to-right.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP RomRenderEngine::get_ScriptDirection(int * pgrfsdc)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(pgrfsdc);
	*pgrfsdc = kfsdcHorizLtr;
	END_COM_METHOD(g_fact, IID_IRenderEngine);
}
Exemplo n.º 9
0
/*----------------------------------------------------------------------------------------------
	Give the maximum length of information that this renderer might want to pass
	from one segment to another in SimpleBreakPoint>>pbNextSegDat.
	RRS never passes info from one segment to another.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP RomRenderEngine::get_SegDatMaxLength(int * cb)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(cb);
	*cb = 0;
	END_COM_METHOD(g_fact, IID_IRenderEngine);
}
Exemplo n.º 10
0
/*----------------------------------------------------------------------------------------------
	Do a direct string comparison.
	Note that, contrary to what the contract implies, this routine is not more
	efficient than the client just retrieving the keys and comparing them.
	OPTIMIZE: would we benefit significantly by implementing this using CompareString?
	Unfortunately, it is hard to avoid the need to do the WideCharToMultiByte conversion
	for the whole of both strings...
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgIcuCollator::Compare(BSTR bstrValue1, BSTR bstrValue2,
	LgCollatingOptions colopt, int * pnVal)
{
	BEGIN_COM_METHOD
	ChkComBstrArgN(bstrValue1);
	ChkComBstrArgN(bstrValue2);
	ChkComOutPtr(pnVal);

	EnsureCollator();

	int32_t cbKey1 = keySize;
	byte rgbKey1[keySize+1];
	Vector<byte> vbKey1;
	byte * pbKey1 = GetSortKey(bstrValue1, rgbKey1, &cbKey1, vbKey1);

	int32_t cbKey2 = keySize;
	byte rgbKey2[keySize+1];
	Vector<byte> vbKey2;
	byte * pbKey2 = GetSortKey(bstrValue2, rgbKey2, &cbKey2, vbKey2);

	*pnVal = strcmp((char *)pbKey1, (char *)pbKey2);

	return S_OK;

	END_COM_METHOD(g_fact, IID_ILgCollatingEngine);
}
Exemplo n.º 11
0
/*----------------------------------------------------------------------------------------------
	Generate the sort key as a BSTR
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgUnicodeCollater::get_SortKey(BSTR bstrValue, LgCollatingOptions colopt,
	BSTR * pbstrKey)
{
	BEGIN_COM_METHOD
	ChkComBstrArg(bstrValue);
	ChkComOutPtr(pbstrKey);

	HRESULT hr;
	int cchw;
	*pbstrKey = NULL;
	// Passing 0 and null just produces a length
	IgnoreHr(hr = SortKeyRgch(bstrValue, BstrLen(bstrValue), colopt, 0, NULL, &cchw));
	if (FAILED(hr))
		return hr;

	BSTR bstrOut;
	bstrOut = SysAllocStringLen(NULL, cchw);
	if (!bstrOut)
		return E_OUTOFMEMORY;
	IgnoreHr(hr = SortKeyRgch(bstrValue, BstrLen(bstrValue), colopt, cchw, bstrOut, &cchw));
	if (FAILED(hr))
	{
		SysFreeString(bstrOut);
		return hr;
	}
	*pbstrKey = bstrOut;
	END_COM_METHOD(g_fact, IID_ILgCollatingEngine);
}
Exemplo n.º 12
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);
}
Exemplo n.º 13
0
/*----------------------------------------------------------------------------------------------
	This method may be implemented to inform callers that the results computed by
	a virtual handler are affected by a property change. (Many implementers do not
	implement this comprehensively and just return false.)
	This default implementation just answers false for everything.
---------------------------------------------------------------------------------------------*/
STDMETHODIMP VwBaseVirtualHandler::DoesResultDependOnProp(HVO hvoObj, HVO hvoChange,
        PropTag tag, int ws, ComBool * pfDepends)
{
    BEGIN_COM_METHOD;
    ChkComOutPtr(pfDepends);
    END_COM_METHOD(g_fact, IID_IVwVirtualHandler);
}
Exemplo n.º 14
0
/*----------------------------------------------------------------------------------------------
 Gets the name of the class that this is a virtual property of.
---------------------------------------------------------------------------------------------*/
STDMETHODIMP VwBaseVirtualHandler::get_ClassName(BSTR * pbstr)
{
    BEGIN_COM_METHOD;
    ChkComOutPtr(pbstr);
    m_stuClass.GetBstr(pbstr);
    END_COM_METHOD(g_fact, IID_IVwVirtualHandler);
}
Exemplo n.º 15
0
// Get the size of the bundle. (Icu getSize.)
STDMETHODIMP LgIcuResourceBundle::get_Size(int * pcrb)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(pcrb);
	*pcrb = m_rb.getSize();
	END_COM_METHOD(g_factRb, IID_ILgIcuResourceBundle);
}
Exemplo n.º 16
0
// Determine whether the bundle has more sub-resources accessible through get_Next.
// (Icu hasNext.)
STDMETHODIMP LgIcuResourceBundle::get_HasNext(ComBool * pfHasNext)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(pfHasNext);
	*pfHasNext = m_rb.hasNext();
	END_COM_METHOD(g_factRb, IID_ILgIcuResourceBundle);
}
Exemplo n.º 17
0
/*----------------------------------------------------------------------------------------------
	Return a list of the feature IDs. If cMax is zero, pcfid returns the number of features
	supported. Otherwise it contains the number put into the array.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwGrEngine::GetFeatureIDs(int cMax, int * prgFids, int * pcfid)
{
	BEGIN_COM_METHOD;
	ChkComOutPtr(pcfid);
	ChkComArrayArg(prgFids, cMax);

	if (!m_pfont)
	{
		Assert(false);
		return E_UNEXPECTED;
	}

	std::pair<FeatureIterator, FeatureIterator> pairIt = m_pfont->getFeatures();
	int cfid = pairIt.second - pairIt.first;
	FeatureIterator fit = pairIt.first;
	if (cMax == 0)
	{
		*pcfid = cfid;
		return S_OK;
	}

	*pcfid = min(cMax, cfid);
	for (int i = 0;
		fit != pairIt.second;
		++fit, i++)
	{
		if (i >= *pcfid)
			break;
		prgFids[i] = (*fit);
	}

	END_COM_METHOD(g_fact, IID_IRenderingFeatures);
}
Exemplo n.º 18
0
/*----------------------------------------------------------------------------------------------
	Create a property with the given writing system, old writing system, and named style (ktptNamedStyle).
	Note that ktptCharStyle (which this used to use) is effectively obsolete.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP TsPropsFact::MakePropsRgch(const OLECHAR * prgch, int cch,	int ws, int ows,
	ITsTextProps ** ppttp)
{
	BEGIN_COM_METHOD;
	ChkComArrayArg(prgch, cch);
	ChkComOutPtr(ppttp);
	if ((uint)ws > kwsLim)
		ThrowInternalError(E_INVALIDARG, "Magic writing system invalid in string");

	TsIntProp tip;
	TsStrProp tsp;
	int ctip = 0;
	int ctsp = 0;

	tip.m_nVal = ws;
	tip.m_nVar = ows;
	tip.m_tpt = ktptWs;
	ctip = 1;
	if (cch)
	{
		StrUni stu(prgch, cch);
		TsStrHolder * ptsh = TsStrHolder::GetStrHolder();
		tsp.m_hstuVal = ptsh->GetCookieFromString(stu);
		tsp.m_tpt = ktptNamedStyle;
		ctsp = 1;
	}
	TsTextProps::Create(ctip ? &tip : NULL, ctip, ctsp ? &tsp : NULL, ctsp, ppttp);

	END_COM_METHOD(g_factPropsFact, IID_ITsPropsFactory);
}
Exemplo n.º 19
0
// Get the name of the bundle. (Icu getName.) Note that the Key and String of the
// bundle are often more useful.
STDMETHODIMP LgIcuResourceBundle::get_Name(BSTR * pbstrName)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(pbstrName);
	*pbstrName = AsciiToBstr(m_rb.getName());
	END_COM_METHOD(g_factRb, IID_ILgIcuResourceBundle);
}
Exemplo n.º 20
0
// Get the count of available converters.
STDMETHODIMP LgIcuLocaleEnumerator::get_Count(int * pclocale)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(pclocale);
	*pclocale = m_clocale;
	END_COM_METHOD(g_factLocEnum, IID_ILgIcuLocaleEnumerator);
}
Exemplo n.º 21
0
/*----------------------------------------------------------------------------------------------
Creates a new stream object with its own seek pointer that references the same bytes
as the original stream.
The m_qstrmBase member in the clone is set to the IStream interface pointer of the original
FileStream object for ${#AddRef} and ${#Release} calls which are used to prevent that object
from being deleted until after all clones have been deleted.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FileStream::Clone(IStream ** ppstm)
{
	BEGIN_COM_METHOD;
	ChkComOutPtr(ppstm);

	FileStream * pfist;

	pfist = NewObj FileStream;
	if (!pfist)
		ThrowHr(WarnHr(STG_E_INSUFFICIENTMEMORY));

	pfist->m_staPath = m_staPath;

	// If this is the first clone, a pointer to the current object is fine. Otherwise (if we
	// are making a clone from a clone) copy the current pointer.
	if (!m_qstrmBase)
	{
		pfist->m_qstrmBase = this;
	}
	else
	{
		pfist->m_qstrmBase = m_qstrmBase;
	}

	pfist->m_hfile = m_hfile;
	pfist->m_ibFilePos = m_ibFilePos;
	pfist->m_grfstgm = m_grfstgm;
	*ppstm = pfist;

	END_COM_METHOD(g_fact, IID_IStream);
}
Exemplo n.º 22
0
/*----------------------------------------------------------------------------------------------
	Return the number of outstanding Redoable sequences. This is the number of
	times the user could issue the Redo command.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::get_RedoableSequenceCount(int * pcAct)
{
	BEGIN_COM_METHOD;
	ChkComOutPtr(pcAct);
	*pcAct = m_viSeqStart.Size() - m_iCurrSeq - 1;
	END_COM_METHOD(g_factActh, IID_IActionHandler);
}
Exemplo n.º 23
0
/*----------------------------------------------------------------------------------------------
	Return the number of outstanding Undoable sequences. This is the number of
	times the user could issue the Undo command.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::get_UndoableSequenceCount(int * pcAct)
{
	BEGIN_COM_METHOD;
	ChkComOutPtr(pcAct);
	*pcAct = m_iCurrSeq + 1;
	END_COM_METHOD(g_factActh, IID_IActionHandler);
}
Exemplo n.º 24
0
STDMETHODIMP ActionHandler::get_SuppressSelections(ComBool * pfSupressSel)
{
	BEGIN_COM_METHOD;
	ChkComOutPtr(pfSupressSel);
	*pfSupressSel = false;
	END_COM_METHOD(g_factActh, IID_IActionHandler);
}
Exemplo n.º 25
0
STDMETHODIMP ActionHandler::get_IsUndoOrRedoInProgress(ComBool * pfInProgress)
{
	BEGIN_COM_METHOD;
	ChkComOutPtr(pfInProgress);
	*pfInProgress = m_fUndoOrRedoInProgress;
	END_COM_METHOD(g_factActh, IID_IActionHandler);
}
Exemplo n.º 26
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)
}
Exemplo n.º 27
0
STDMETHODIMP LgIcuConverterEnumerator::get_Count(int * pcconv)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(pcconv);
	StrUtil::InitIcuDataDir();
	*pcconv = ucnv_countAvailable();
	END_COM_METHOD(g_fact, IID_ILgIcuConverterEnumerator);
}
Exemplo n.º 28
0
/*----------------------------------------------------------------------------------------------
	Return the writing system factory for this database (or the registry, as the case may be).

	@param ppwsf Address of the pointer for returning the writing system factory.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwGrEngine::get_WritingSystemFactory(ILgWritingSystemFactory ** ppwsf)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(ppwsf);
	*ppwsf = m_qwsf;
	(*ppwsf)->AddRef();
	END_COM_METHOD(g_fact, IID_IRenderEngine)
}
Exemplo n.º 29
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);
}
Exemplo n.º 30
0
// Get the key of the bundle. (Icu getKey.)
STDMETHODIMP LgIcuResourceBundle::get_Key(BSTR * pbstrKey)
{
	BEGIN_COM_METHOD
	ChkComOutPtr(pbstrKey);

	*pbstrKey = AsciiToBstr(m_rb.getKey());

	END_COM_METHOD(g_factRb, IID_ILgIcuResourceBundle);
}