Example #1
0
STDMETHODIMP CTextSearchEngine::Load(LPSTREAM pStm)
{
	if (m_fIsInitialized)
		return E_UNEXPECTED;		// already initialized with InitNew

HRESULT hr = CPropertyAction::Load (pStm);

	if (FAILED(hr)) return hr;

	try {
		TX_ASSERT(sizeof(int) == sizeof(long));
		
		THROW_FAILED_HRESULT(LoadLong(pStm, (long &)m_Status.m_fCapital));
		THROW_FAILED_HRESULT(LoadLong(pStm, (long &)m_Status.m_fPartialMatch));
		THROW_FAILED_HRESULT(LoadLong(pStm, (long &)m_Status.m_fFuzzyMatch));
		THROW_FAILED_HRESULT(LoadLong(pStm, (long &)m_Status.m_fUseRegExpr));

		m_Status.erase();
		THROW_FAILED_HRESULT(LoadString(pStm, m_Status.m_strFindWhat));

	CSearchList::size_type lCnt = 0;

		THROW_FAILED_HRESULT(LoadLong(pStm, (long &)lCnt));
		for (CSearchList::size_type i = 0; i < lCnt; i++) {
		os_string str;

			THROW_FAILED_HRESULT(LoadString(pStm, str));
			m_Status.m_lstFindWhat.push_back(str);
		}

		THROW_FAILED_HRESULT(LoadString(pStm, m_Status.m_strObjProp));

	// folgende Einträge sind optional, da später dazugekommen
		if (FAILED(LoadLong(pStm, (long &)m_Status.m_fTestBOB)))
			m_Status.m_fTestBOB = false;
		if (FAILED(LoadLong(pStm, (long &)m_Status.m_fExistsOnly)))
			m_Status.m_fExistsOnly = false;
		if (FAILED(LoadLong(pStm, (long &)m_Status.m_fNegate)))
			m_Status.m_fNegate = false;

	} catch (_com_error& hr) {
		return _COM_ERROR(hr);
	}

	m_fIsInitialized = true;
	m_fIsDirty = false;

return S_OK;
}
Example #2
0
CTextSearchEngine::CTextSearchEngine (void)
{
	m_pCfgDlg = NULL;
	m_fIsDirty = false;
	m_fIsInitialized = false;

	try {
	ResourceFile RF (g_pDLLName);
	ResString resPropInfo (ResID (IDS_TEXTSEARCHENGINE_DESC, &RF), 64);

		m_strDesc = resPropInfo;
	} catch (...) {
		TX_ASSERT(false);
	}
}
Example #3
0
HRESULT CAuxUIOwner::FinalConstruct (void)
{
	m_pXtsn = NULL;

// alles, was definiert ist, in der map speichern
	for (const UIOWNERDATA *pcData = m_rgUIOwnerData; 
		 pcData -> uiCtrlID != 0L; pcData++)
	{
	pair<UIOwnerData::iterator, bool> p = m_Data.insert (pcData -> uiCtrlID, &pcData -> Procs);

		TX_ASSERT(p.second);		// muß erfolgreich sein
	}

return NOERROR;
}
Example #4
0
///////////////////////////////////////////////////////////////////////////////
// Lesen von MetaDaten
ErrCode DatenBasisObjekt::GetPBDData (HPROJECT hPr, PBDDATA *pData)
{
#if defined(_FORCE_LEGACY_CODE)
	if (!IsTRiASDBBased()) {
	CActDB ActPBD (PbdDB());

		if(!ActPBD) return EC_NOOPEN;
		return PbdDB().GetPBDData (pData);

	} else
#endif // _FORCE_LEGACY_CODE
	{
		TX_ASSERT(IsTRiASDBBased());

#pragma TODO("Metadatenhandling für Relationen implementieren!")
		switch (pData -> pbdTyp) {
		case 'r':
			return EC_NOOPEN;

		case 'm':
			{
			HRESULT hr = GetPBDDataMerkmal (hPr, pData);

				if (S_OK == hr)
					return EC_OKAY;
				else if (S_FALSE == hr)
					return WC_RETURN;
				else if (FACILITY_ERRCODE == HRESULT_FACILITY(hr))
					return ERRCODE_FROM_HRESULT(hr);
				return EC_FAIL;
			}

		case 'i':
			{
			HRESULT hr = GetPBDDataIdent (hPr, pData);

				if (S_OK == hr)
					return EC_OKAY;
				else if (S_FALSE == hr)
					return WC_RETURN;
				else if (FACILITY_ERRCODE == HRESULT_FACILITY(hr))
					return ERRCODE_FROM_HRESULT(hr);
				return EC_FAIL;
			}
		}
	}
	return EC_OKAY;
}
Example #5
0
BOOL CWin32Exception::ResetTranslator (void)
{
	if (m_fInstalled) {
	_se_translator_function pNextProc = m_pNextProc;

		m_pNextProc = NULL;

	_se_translator_function pPrevProc = _set_se_translator (m_pNextProc);

		TX_ASSERT(Translator == pPrevProc);
		m_fInstalled = false;
		return true;
	}

return false;
}
Example #6
0
ErrCode DatenBasisObjekt::EndTransaction(HPROJECT hPr)
{
#if defined(_FORCE_LEGACY_CODE)
	if (!IsTRiASDBBased()) {
	CActDB ActPBD (PbdDB());

		if(!ActPBD) return EC_NOOPEN;
		return PbdDB().EndTransaction();

	} else
#endif // _FORCE_LEGACY_CODE
	{
		TX_ASSERT(IsTRiASDBBased());
	}
	return EC_OKAY;
}
Example #7
0
///////////////////////////////////////////////////////////////////////////////
// IPersistStreamInit
STDMETHODIMP CPropertyActionBase::Load (LPSTREAM pStm)
{
ULONG ulLen = 0;
HRESULT hr = pStm -> Read (&ulLen, sizeof(ULONG), NULL);

	if (S_OK != hr) return hr;

	TX_ASSERT(ulLen <= _MAX_PATH);

char cbBuffer[_MAX_PATH];

	hr = pStm -> Read (cbBuffer, ulLen, NULL);
	if (S_OK != hr) return hr;

return SetPropName (cbBuffer);
}
Example #8
0
STDMETHODIMP CSubIndicator :: ChangeText (PIFLAGS fWhichText, BSTR bstrNewText)
{
    TX_ASSERT (NULL != (IProgressIndicator2 *) m_wPI);

    // erstmal generell die verlangte Aktion ausführen
    HRESULT hr = m_wPI -> ChangeText (fWhichText, bstrNewText);

    // wenn der Statustext geändert wird, dann diesen Text ab sofort von hier aus handeln
    if (fWhichText & PIFLAG_ADJUSTPERCENT || fWhichText & PIFLAG_STATUS)
    {
        USES_CONVERSION;
        m_strPercentText = OLE2A(bstrNewText);
        RETURN_FAILED_HRESULT(SetStatusText());
    }

    return hr;
}
Example #9
0
///////////////////////////////////////////////////////////////////////////////
// Version der MetaDatenBank
long DatenBasisObjekt::GetPBDVersion(HPROJECT hPr)
{
#if defined(_FORCE_LEGACY_CODE)
	if (!IsTRiASDBBased()) {
	CActDB ActPBD (PbdDB());

		if(!ActPBD) return EC_NOOPEN;
		return PbdDB().GetDBVersion();

	} else
#endif // _FORCE_LEGACY_CODE
	{
		TX_ASSERT(IsTRiASDBBased());
		return DB(hPr).GetDBVersion();		// hier wird die Version der GeoDB geliefert
	}
	return 0L;
}
Example #10
0
HRESULT LoadString (IStream *pIStm, string &rStr)
{
long lCnt = 0;
HRESULT hr = pIStm -> Read (&lCnt, sizeof(long), NULL);

	if (FAILED(hr)) return hr;

char cbBuffer[256];

	TX_ASSERT(lCnt < sizeof(cbBuffer));
	ZeroMemory (cbBuffer, sizeof(cbBuffer));

	hr = pIStm -> Read (cbBuffer, lCnt, NULL);
	if (FAILED(hr)) return hr;

	rStr = cbBuffer;
	return S_OK;
}
Example #11
0
BOOL _XTENSN_EXPORT PASCAL EnumDataSources (LPSTR pcPath, BOOL, void *pData)
{
ENUMDATASOURCES *pEDS = (ENUMDATASOURCES *)pData;
HPROJECT hPr = DEX_GetDataSourceHandleEx (pcPath);

	TX_ASSERT(NULL != hPr);
	if (!DEX_GetOpenedEx(hPr))
		return TRUE;		// diese Datenquelle ist nicht geöffnet

os_path path (pEDS -> pcFName);

	if (!path.has_extension())
		path.extension ("txc");

os_string strT;
char cbBuffer[_MAX_PATH];

	DEX_GetDataSourceShortName(hPr, cbBuffer);
	Format (strT, "%s (%s)", path.base().c_str(), cbBuffer);
	path.base (strT);
	return pEDS -> pThis -> ExportDataSourceAsXml (pEDS -> pUnk, hPr, os_string(path).c_str(), pEDS -> ulCnt);
}
Example #12
0
// Finden eines Merkmales im MerkmalsFeld -------------------------------------
char *FindMWert (ULONG lMCode, long pMInfo[], short *plLen, bool fMarkAsWritten)
{
	TX_ASSERT (0 != lMCode);

long *pMK = &pMInfo[2];		// erstes Merkmal

	*plLen = 0;
	while (pMK < &pMInfo[pMInfo[1] + 2]) {	// alle Merkmale ausgeben
		if ((ULONG)pMK[0] == lMCode) {	// MCode gefunden
			if (fMarkAsWritten)
				pMK[0] = 0;		// MWert bereits ausgegeben
			*plLen = (pMK[2]*sizeof(long));
			return (char *)&pMK[3];
		}

		if (pMK[2] == -1L) 	// O_TEXTOBJIND
			pMK = &pMK[4];
		else
			pMK = &pMK[pMK[2] + 3];
	}

return NULL;
}
Example #13
0
///////////////////////////////////////////////////////////////////////////////
// Schreiben von MetaDaten
ErrCode DatenBasisObjekt::ModPBDData (HPROJECT hPr, PBDDATA *pData)
{
#if defined(_FORCE_LEGACY_CODE)
	if (!IsTRiASDBBased()) {
	CActDB ActPBD (PbdDB());

		if(!ActPBD) return EC_NOOPEN;
		return PbdDB().ModPBDData (pData);

	} else
#endif // _FORCE_LEGACY_CODE
	{
		TX_ASSERT(IsTRiASDBBased());

		switch (pData -> pbdTyp) {
		case 'r':
			return EC_NOOPEN;

		case 'm':
			return SUCCEEDED(ModPBDDataMerkmal (hPr, pData)) ? EC_OKAY : EC_FAIL;

		case 'i':
			{
			HRESULT hr = ModPBDDataIdent (hPr, pData);

				if (S_OK == hr)
					return EC_OKAY;
				else if (S_FALSE == hr)
					return WC_RETURN;
				else if (FACILITY_ERRCODE == HRESULT_FACILITY(hr))
					return ERRCODE_FROM_HRESULT(hr);
				return EC_FAIL;
			}
		}
	}
	return EC_OKAY;
}
Example #14
0
bool CreateObject (LONG &rlONr, ULONG lIdent, long sta[], 
		   long mi[], long lgi, double gxi[], double gyi[])
{
HPROJECT hPr = DEX_GetDataSourceHandle();

	_ASSERTE(NULL != hPr);

	if (sta[0] == K_OBJEKT) 
		return r_flag ? CreateKomplexObject (hPr, rlONr, lIdent, mi) : true;

// Objekt erzeugen oder wiederfinden, Geometrie schreiben
long lONr = 0L;
char *pUIdent = NULL;

	TX_ASSERT(!(g_fAbglGeom && g_fAbglAttr));	// nie gleichzeitig Attribs und Geometrie abgleichen!

	if (!m_flag || g_fAbglOks || g_fAbglGeom || g_fAbglAttr || 0 != g_ulOksToAttr) {
	// versuchen über GUID zu finden
		if ('\0' != guid[0]) {
		OBJECTGUID OUID;

			INITSTRUCT (OUID, OBJECTGUID);
			if (SUCCEEDED(CLSIDFromString (WideString(guid), &OUID.guid))) {
				if (SUCCEEDED(DEX_FindObjectFromGuid (OUID)))
					lONr = OUID.lONr;
			}
		}

	// versuchen, über Unique Ident zu finden
		if (0 == lONr && RetrieveText (g_ulUniqueId, mi, &pUIdent, false, !g_fImportObj) > 0) 
			lONr = FindObject (g_ulUniqueId, pUIdent);
	}
	DELETE_OBJ(pUIdent);

TEXTGEOMETRIEEX TG;
OBJGEOMETRIE *pOG = (OBJGEOMETRIE *)&TG;
ULONG lIgnore = 0L;
int iFlags = OGForceGeometry|OGNoMemoryObject|OGConverted;
bool fRet = true;

	if (0 == lONr) {	// nicht wiedergefunden
	// Objekt neu erzeugen
		iFlags |= OGNewObject;
		fRet = ImportGeometry (hPr, pOG, sta, lIdent, gxi, gyi, iFlags, rlONr, lIgnore);
	} else {
	// Abgleich durchführen
		if (g_fAbglGeom) {
		// Geometrie abgleichen
			iFlags |= OGModObject;
			fRet = ImportGeometry (hPr, pOG, sta, lIdent, gxi, gyi, iFlags, rlONr, lIgnore);

		} else { 
		// bisherigen Oks wegschreiben
			if (0 != g_ulOksToAttr) {
			long lOldIdent = DEX_GetObjIdent(lONr);
			char cbOKS[MAX_OKS_LENX+1];
			
				if (S_OK == ClassFromIdentX (lOldIdent, cbOKS)) 
					WriteTextMerkmal (lONr, (ULONG)g_ulOksToAttr, cbOKS, strlen(cbOKS));
			} 
			
		// Oks abgleichen
			if (g_fAbglOks) {
				if (0 == g_ulOksFromAttr) {
				// Oks vom EingabeOks nehmen
				MODOBJIDENT MOI;

					INITSTRUCT(MOI, MODOBJIDENT);
					MOI.lONr = lONr;
					MOI.lNewIdent = lIdent;
					MOI.iMode = GetMOIMode (sta);
					DEX_ModObjectIdent(MOI);
				} else {
				// Oks aus EingabeAttribut verwenden
				char *pOks = NULL;

					if (RetrieveText (g_ulOksFromAttr, mi, &pOks, false, !g_fImportObj) > 0) {
					// Ident über Oks besorgen
					long lNewIdent = 0;
					HRESULT hr = IdentFromClassX (hPr, pOks, (ULONG *)&lNewIdent);

						if (S_FALSE == hr) {
						ErrCode RC = IdentIsDefined(lNewIdent);
						
							if (RC != EC_OKAY && !DEX_isIdentUsedEx(hPr, lNewIdent)) 
							// neu erzeugen, wenn keine Objekte mit diesem Ident existieren
								hr = IdentFromClassX (hPr, pOks, (ULONG *)&lNewIdent, true);
						}

						if (0 != lNewIdent) {
						// jetzt Ident modifizieren
						MODOBJIDENT MOI;

							INITSTRUCT(MOI, MODOBJIDENT);
							MOI.lONr = lONr;
							MOI.lNewIdent = lNewIdent;
							MOI.iMode = GetMOIMode (sta);
							DEX_ModObjectIdent(MOI);

							lIdent = lNewIdent;
						}
					}
					DELETE_OBJ(pOks);
				}
			}

		// evtl. doch noch neues Objekt erzeugen
			if (g_fImportObj) {
				iFlags |= OGNewObject;
				fRet = ImportGeometry (hPr, pOG, sta, lIdent, gxi, gyi, iFlags, rlONr, lIgnore);
			} else
				rlONr = lONr;
		}
	}

	if (!fRet) {
		if (0 == pOG -> lONr) {
			g_lNotImported++;
			return false;
		} else {
			if (pOG -> iFlags & OGObjectHasGeometryErrors)
				g_lWithErrors++;	// mit Fehlern importiert
		}
	} 
	CountObjects (sta[1]);		// Objekte zählen

// Merkmale erzeugen
	if (m_flag || g_fAbglAttr)
		return CreateFeatures (rlONr, mi, lIdent, lIgnore);

	return true;
}
Example #15
0
STDMETHODIMP CSubIndicator :: RetrieveText (PIFLAGS fWichText, BSTR *pbstrText)
{
    TX_ASSERT (NULL != (IProgressIndicator2 *) m_wPI);
    return m_wPI -> RetrieveText (fWichText, pbstrText);
}
Example #16
0
HRESULT DatenBasisObjekt::ModPBDDataMerkmal (HPROJECT hPr, PBDDATA *pData)
{
	TX_ASSERT(IsTRiASDBBased());

	USES_CONVERSION;
	{
	bool fForceTypeChange = (MPForceForTRiASDBs & ((PBDMERKMAL *)pData) -> ipbdMTyp) ? true : false;

	// wenns ein Ansichtsmerkmal sein soll, dann einfach wieder raus
		if ((sizeof(PBDMERKMAL) == pData -> dwSize || sizeof(PBDMERKMALEX) == pData -> dwSize) &&
			(MPViewFeature == (((PBDMERKMAL *)pData) -> ipbdMTyp & 0x7F)) &&
			!fForceTypeChange)
		{
			return S_FALSE;
		}

	// Objekteigenschaft aus globaler Tabelle lesen
	WTRiASFeature Feat;
	HRESULT hr = S_OK;

		if (FAILED(GetFeatureFromMap (pData -> pbdCode, Feat))) {
			TX_ASSERT(sizeof(PBDMERKMALEX) == pData -> dwSize);		// Ident muß gegeben sein

		// Objekteigenschaft existiert nicht, also neu erzeugen
			TX_ASSERT(pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText);	// KurzText muß gegeben sein

		// wiederauffinden des Objects-Objektes
		WTRiASObjects Objs;
		INT_PTR lIdent = ((PBDMERKMALEX *)pData) -> lIdent;

			if (-1 == lIdent) {
			// wenn Ident nicht gegeben ist dann muß DataSource eine GeoDB sein
				TX_ASSERT(DB(hPr).IsTRiASDataSource());
				lIdent = DEX_GetUnknownIdentEx(hPr);		// den erstbesten verwenden
			}

			RETURN_FAILED_HRESULT(GetObjectsFromMap (lIdent, Objs));	// Objektmenge muß existieren
			RETURN_FAILED_HRESULT(Objs -> get_Feature (CComVariant(pData -> pbdCode), VARIANT_TRUE, CComBSTR(g_cbNil), Feat.ppi()));

			if (!fForceTypeChange) {
				RETURN_FAILED_HRESULT(Feat -> put_Name (CComBSTR(pData -> pbdKText)));

			// reales, vergebenes Handle zurückliefern
			INT_PTR lHandle = 0;

				RETURN_FAILED_HRESULT(Feat -> get_Handle (&lHandle));
				if (lHandle != pData -> pbdCode) {
					TX_TRACE2("TRiAS: ModPbdDataMerkmal: Changed FeatureHandle %lx -> %lx !", pData -> pbdCode, lHandle);
					pData -> pbdCode = lHandle;
				}

			// Notifikation rumschicken
				DEXN_FeatureSetModified(lIdent);
			}
		} 
		else if (!fForceTypeChange || (MPObjectFeature == (((PBDMERKMAL *)pData) -> ipbdMTyp & 0x7F))) {
#if defined(_DEBUG)
		// Testen, ob der gegebene MCode zur geforderten Datenquelle paßt
			if (HACTCONNECTION != hPr) {
			HPROJECT hPrTarget = NULL;

				RETURN_FAILED_HRESULT(GetDatabaseOrProjectHandle (Feat, &hPrTarget));
				TX_ASSERT(hPrTarget == hPr);		// Ident aus anderer Datenquelle ?
			}
#endif // defined(_DEBUG)

		// hier nur neuen KurzText (Namen) einstellen
			if (pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText)
				RETURN_FAILED_HRESULT(Feat -> put_Name (CComBSTR(pData -> pbdKText)));

		// Notifikation rumschicken
		INT_PTR lIdent = -1L;

			if (sizeof(PBDMERKMALEX) == pData -> dwSize) {
				lIdent = ((PBDMERKMALEX *)pData) -> lIdent;

			// sicherstellen, daß dieser MCode schon zu dem Ident gehört (#HK030111)
				if (-1 != lIdent) {
				// schlimmstenfalls liefert _Add S_FALSE (wenns schon dazugehört)
				WTRiASObjects Objs;
				WTRiASFeatures Feats;
				WTRiASFeature TestFeat;

					RETURN_FAILED_HRESULT(GetObjectsFromMap (lIdent, Objs));	// Objektmenge muß existieren
					RETURN_FAILED_HRESULT(Objs -> get_Features (Feats.ppi()));

					if (pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText) {
					// über den Namen gehts schneller
						if (S_OK != Feats -> Item (CComVariant(pData -> pbdKText), TestFeat.ppi()))
						{
							RETURN_FAILED_HRESULT(Feats -> _Add(Feat));
						}
					}
					else {
					// kein Name gegeben, also Handle verwenden
						if (S_OK != Feats -> Item (CComVariant(pData -> pbdCode), TestFeat.ppi()))
						{
							RETURN_FAILED_HRESULT(Feats -> _Add(Feat));
						}
					}
				}
			}
			DEXN_FeatureSetModified(lIdent);
		}
		
		if (!fForceTypeChange || (MPObjectFeature == (((PBDMERKMAL *)pData) -> ipbdMTyp & 0x7F))) {
		// LangText (BeschreibungsInfo) einstellen
			if (pData -> pbdLTextLen > 0 && NULL != pData -> pbdLText) {
				RETURN_FAILED_HRESULT(Feat -> put_Description (CComBSTR(pData -> pbdLText)));
			} else {
				RETURN_FAILED_HRESULT(Feat -> put_Description (CComBSTR(g_cbNil)));
			}
		}

	// evtl. zusätzliche Infos speichern
		if (sizeof(PBDMERKMAL) == pData -> dwSize || sizeof(PBDMERKMALEX) == pData -> dwSize) {
		PBDMERKMAL *pPbdM = (PBDMERKMAL *)pData;
		FEATURETYPE rgType = FEATURETYPE_Object;	// Objektmerkmal
		
			if (fForceTypeChange) 
				rgType = FEATURETYPE(pPbdM -> ipbdMTyp & 0x7f);	// ggf. neuer Typ

			if (pPbdM -> ipbdMTyp & PBDMERKMAL_SYSTEMFLAG) 
				rgType = FEATURETYPE(rgType | FEATURETYPE_System);
			if (pPbdM -> ipbdMTyp & PBDMERKMAL_READONLY) 
				rgType = FEATURETYPE(rgType | FEATURETYPE_ReadOnly);

			RETURN_FAILED_HRESULT(Feat -> put_Type (rgType));
		}
	}
	return S_OK;
}
Example #17
0
HRESULT DatenBasisObjekt::ModPBDDataIdent (HPROJECT hPr, PBDDATA *pData)
{
	TX_ASSERT(IsTRiASDBBased());

HRESULT hr = S_OK;

	USES_CONVERSION;
	{
	// wiederauffinden des Objects-Objektes
	WTRiASObjects Objs;

		if (FAILED(GetObjectsFromMap (pData -> pbdCode, Objs))) {
		// Objektklasse existiert nicht, also neu erzeugen
			TX_ASSERT(pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText);	// KurzText muß gegeben sein

		// Objektmenge (Tabelle) muß neu angelegt werden
			if (HACTPROJECT != hPr)	{	// neue Tabelle in einer Datenquelle anlegen
			ErrCode RC = DB(hPr).ModPBDDataIdent (pData);

				return (EC_OKAY == RC) ? S_OK : HRESULT_FROM_ERRCODE(RC);
			}

		// neue übergreifende Objektmenge ggf. erzeugen
			RETURN_FAILED_HRESULT(m_Prj -> get_ObjectsDef (CComVariant(pData -> pbdKText), VARIANT_TRUE, CComBSTR(g_cbNil), Objs.ppi()));

		// das neue Objekt wenigstens von seinem Handle informieren
			if (0 != pData -> pbdCode)
			{
				RETURN_FAILED_HRESULT(Objs -> put_Handle (pData -> pbdCode));
			} 

		// reales, vergebenes Handle zurückliefern
		INT_PTR lHandle = 0;

			RETURN_FAILED_HRESULT(Objs -> get_Handle (&lHandle));
			if (lHandle != pData -> pbdCode) {
				TX_TRACE2("TRiAS: ModPbdDataIdent: Changed IdentHandle %lx -> %lx !", pData -> pbdCode, lHandle);
				pData -> pbdCode = lHandle;

			// Notifikation rumschicken
				DEXN_FeatureSetModified(lHandle);
				return S_FALSE;
			}

		// Notifikation rumschicken
			DEXN_FeatureSetModified(pData -> pbdCode);
		} 
		else {
		// Testen, ob der gegebene Ident zur geforderten Datenquelle paßt
#if defined(_DEBUG)
			if (HACTCONNECTION != hPr) {
			HPROJECT hPrTarget = NULL;

				RETURN_FAILED_HRESULT(GetDatabaseOrProjectHandle (Objs, &hPrTarget));
				TX_ASSERT(hPrTarget == hPr);		// Ident aus anderer Datenquelle ?
			}
#endif // defined(_DEBUG)

		// hier nur neuen KurzText (Namen) einstellen
			if (pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText)
				RETURN_FAILED_HRESULT(Objs -> put_Name (CComBSTR(pData -> pbdKText)));
		}
	
	// LangText (BeschreibungsInfo) einstellen
		if (pData -> pbdLTextLen > 0 && NULL != pData -> pbdLText) {
			RETURN_FAILED_HRESULT(Objs -> put_Description (CComBSTR(pData -> pbdLText)));
		} else {
			RETURN_FAILED_HRESULT(Objs -> put_Description (CComBSTR(g_cbNil)));
		}
	}
	return hr;
}
Example #18
0
// Lesen der Metadaten für eine Objektmenge
HRESULT DatenBasisObjekt::GetPBDDataMerkmal (HPROJECT hPr, PBDDATA *pData)
{
	TX_ASSERT(IsTRiASDBBased());

VARIANT_BOOL fNameIsDefault = VARIANT_TRUE;

	USES_CONVERSION;
	{
	// wenns ein Ansichtsmerkmal sein soll, dann einfach wieder raus
		if ((sizeof(PBDMERKMAL) == pData -> dwSize || sizeof(PBDMERKMALEX) == pData -> dwSize) &&
			MPViewFeature == (((PBDMERKMAL *)pData) -> ipbdMTyp & 0x7F))
		{
			return HRESULT_FROM_ERRCODE(WC_NOTFOUND);
		}

	// Objekteigenschaft aus globaler Tabelle lesen
	WTRiASFeature Feat;
	HRESULT hr = S_OK;

		if (FAILED(hr = GetFeatureFromMap (pData -> pbdCode, Feat)))
			return hr;

	// Testen, ob das gefundene Feature zur geforderten Datenquelle paßt
		if (HACTCONNECTION != hPr) {
		HPROJECT hPrTarget = NULL;

			RETURN_FAILED_HRESULT(GetDatabaseHandle (Feat, &hPrTarget));
			if (hPrTarget != hPr)		// MCode aus anderer Datenquelle
				return HRESULT_FROM_ERRCODE(WC_NOTFOUND);
		}

	// Namen lesen und in Rückgabestruktur setzen
	CComBSTR bstr;

		RETURN_FAILED_HRESULT(Feat -> get_Name (CLEARED(&bstr)));
		fNameIsDefault = GetPropertyFrom (Feat, g_cbNameIsDefault, VARIANT_FALSE);

	char *pStr = OLE2A(bstr);

		if (pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText) {
			if (pStr) {
			int iLen = strlen (pStr);
			
				iLen = min(iLen, pData -> pbdKTextLen-1);
				strncpy (pData -> pbdKText, pStr, iLen);
				pData -> pbdKText[iLen] = '\0';
				pData -> pbdKTextLen = iLen;
			} else {
				*pData -> pbdKText = '\0';
				pData -> pbdKTextLen = 0;
			}
		} else 
			pData -> pbdKTextLen = (NULL != pStr) ? strlen(pStr)+1 : 0;	// benötigte Buffergröße liefern

	// BeschreibungsInfo lesen und in Rückgabestruktur setzen
	CComBSTR bstrLT;

		if (SUCCEEDED(Feat -> get_Description (CLEARED(&bstrLT)))) {
		// möglicherweise wird 'get_Description' nicht unterstützt
		char *pStr = OLE2A(bstrLT);

			if (pData -> pbdLTextLen > 0 && NULL != pData -> pbdLText) {
				if (pStr) {
				int iLen = strlen (pStr);

					iLen = min(iLen, pData -> pbdLTextLen-1);
					strncpy (pData -> pbdLText, pStr, iLen);
					pData -> pbdLText[iLen] = '\0';
					pData -> pbdLTextLen = iLen;
				} else {
					*pData -> pbdLText = '\0';
					pData -> pbdLTextLen = 0;
				}
			} else 
				pData -> pbdLTextLen = (NULL != pStr) ? strlen(pStr)+1 : 0;	// benötigte Buffergröße liefern
		} else
			pData -> pbdLTextLen = 0;

	// evtl. zusätzliche Infos liefern
		if (sizeof(PBDMERKMAL) == pData -> dwSize || sizeof(PBDMERKMALEX) == pData -> dwSize) {
		PBDMERKMAL *pPbdM = (PBDMERKMAL *)pData;
		FEATURETYPE rgType = FEATURETYPE_Unknown;

			pPbdM -> ipbdMTyp = 'a';	// Objektmerkmal
			if (SUCCEEDED(Feat -> get_Type (&rgType))) {
			// Typ der Objekteigenschaft festellen
				switch (VT_FROM_DATATYPE(rgType)) {
				case VT_I4:
				case VT_I2:
				case VT_I1:
				case VT_INT:
				case VT_UI4:
				case VT_UI2:
				case VT_UI1:
				case VT_UINT:
				case VT_BOOL:
				case VT_ERROR:
					pPbdM -> ipbdMTyp = 'i';
					break;

				case VT_R4:
				case VT_R8:
				case VT_DATE:
					pPbdM -> ipbdMTyp = 'f';
					break;

				default:
					break;		// VT_BSTR --> 'a'
				}

			// zusätzliche 
				if (rgType & FEATURETYPE_System)
					pPbdM -> ipbdMTyp |= PBDMERKMAL_SYSTEMFLAG;
				if (rgType & FEATURETYPE_ReadOnly)
					pPbdM -> ipbdMTyp |= PBDMERKMAL_READONLY;
			}

		// Platzbedarf der Objekteigenschaft feststellen
		long lLen = 0;

			if (SUCCEEDED(Feat -> get_Length (&lLen))) 
				pPbdM -> ipbdMLen = lLen;
			else
				pPbdM -> ipbdMLen = _MAX_PATH;	// doch recht willkürlich
		}

	} 
	return fNameIsDefault ? S_FALSE : S_OK;
}
Example #19
0
// Lesen der Metadaten für eine Objektmenge
HRESULT DatenBasisObjekt::GetPBDDataIdent (HPROJECT hPr, PBDDATA *pData)
{
	TX_ASSERT(IsTRiASDBBased());

VARIANT_BOOL fNameIsDefault = VARIANT_TRUE;

	USES_CONVERSION;
	{
	// Objektmenge aus globaler Tabelle lesen
	WTRiASObjects Objs;
	HRESULT hr = S_OK;

		if (FAILED(hr = GetObjectsFromMap (pData -> pbdCode, Objs)))
			return hr;

	// Testen, ob das gefundene Objektmenge zur geforderten Datenquelle paßt
		if (HACTCONNECTION != hPr) {
		HPROJECT hPrTarget = NULL;

			RETURN_FAILED_HRESULT(GetDatabaseOrProjectHandle (Objs, &hPrTarget));
			if (hPrTarget != hPr)			// Ident aus anderer Datenquelle
				return HRESULT_FROM_ERRCODE(WC_NOTFOUND);
		}

	// Namen lesen und in Rückgabestruktur setzen
	CComBSTR bstr;

		RETURN_FAILED_HRESULT(Objs -> get_Name (CLEARED(&bstr)));
		fNameIsDefault = GetPropertyFrom (Objs, g_cbNameIsDefault, VARIANT_TRUE);

	char *pStr = OLE2A(bstr);

		if (pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText) {
			if (pStr) {
			int iLen = strlen (pStr);
			
				iLen = min(iLen, pData -> pbdKTextLen-1);
				strncpy (pData -> pbdKText, pStr, iLen);
				pData -> pbdKText[iLen] = '\0';
				pData -> pbdKTextLen = iLen;
			} else {
				*pData -> pbdKText = '\0';
				pData -> pbdKTextLen = 0;
			}
		} else 
			pData -> pbdKTextLen = (NULL != pStr) ? strlen(pStr)+1 : 0;	// benötigte Buffergröße liefern

	// BeschreibungsInfo lesen und in Rückgabestruktur setzen
	CComBSTR bstrLT;

		if (SUCCEEDED(Objs -> get_Description (CLEARED(&bstrLT)))) {
		// möglicherweise wird 'get_Description' nicht unterstützt
		char *pStr = OLE2A(bstrLT);

			if (pData -> pbdLTextLen > 0 && NULL != pData -> pbdLText) {
				if (pStr) {
				int iLen = strlen (pStr);

					iLen = min(iLen, pData -> pbdLTextLen-1);
					strncpy (pData -> pbdLText, pStr, iLen);
					pData -> pbdLText[iLen] = '\0';
					pData -> pbdLTextLen = iLen;
				} else {
					*pData -> pbdLText = '\0';
					pData -> pbdLTextLen = 0;
				}
			} else 
				pData -> pbdLTextLen = (NULL != pStr) ? strlen(pStr)+1 : 0;	// benötigte Buffergröße liefern
		} else
			pData -> pbdLTextLen = 0;

	}
	return fNameIsDefault ? S_FALSE : S_OK;
}
Example #20
0
STDMETHODIMP CSubIndicator :: IsCanceled (VOID)
{
    TX_ASSERT (NULL != (IProgressIndicator2 *) m_wPI);
    return m_wPI -> IsCanceled ();
}
Example #21
0
STDMETHODIMP CSubIndicator :: put_Flags (PIFLAGS rgFlags)
{
    TX_ASSERT (NULL != (IProgressIndicator2 *) m_wPI);
    return m_wPI -> put_Flags (rgFlags);
}
Example #22
0
STDMETHODIMP CSubIndicator :: RetrieveRange (ULONG *pulMinPos, ULONG *pulMaxPos)
{
    TX_ASSERT (NULL != (IProgressIndicator2 *) m_wPI);
    return m_wPI -> RetrieveRange (pulMinPos, pulMaxPos);
}