FRX SDK Documentation 2025 SP0
Loading...
Searching...
No Matches
FxDynPropManager.h
Go to the documentation of this file.
1#pragma once
2
3//
4// (C) Copyright 2005-2024 by Graebert GmbH.
5//
6// Permission to use, copy, modify, and distribute this software in
7// object code form for any purpose and without fee is hereby granted,
8// provided that the above copyright notice appears in all copies and
9// that both that copyright notice and the limited warranty and
10// restricted rights notice below appear in all supporting
11// documentation.
12//
13// GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
14// GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
15// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
16// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
17// UNINTERRUPTED OR ERROR FREE.
18#ifdef __ATLCOM_H__
19#include <comutil.h>
20#include "../include/acadi.h"
21
22#pragma section("FXARX_DYNPROP$__a", read, shared)
23#pragma section("FXARX_DYNPROP$__z", read, shared)
24#pragma section("FXARX_DYNPROP$__m", read, shared)
25
26extern "C" {
27 __declspec( selectany ) __declspec( allocate( "FXARX_DYNPROP$__a" ) ) _OPM_DYNPROP_ENTRY* __pOpmObjMapEntryFirst = NULL;
29}
30
31#if defined(_WIN64) || defined(_AC64)
32#define OPM_DYNPROP_OBJECT_ENTRY_PRAGMA(classname, rxclass) __pragma(comment(linker, "/include:__pOpmObjMap_" #rxclass #classname)) ;
33#else
34#define OPM_DYNPROP_OBJECT_ENTRY_PRAGMA(classname, rxclass) __pragma(comment(linker, "/include:___pOpmObjMap_" #rxclass #classname)) ;
35#endif
36
37#define OPM_DYNPROP_OBJECT_ENTRY_MAKE(classname, rxclass, clsid) \
38 __declspec(selectany) _OPM_DYNPROP_ENTRY __OpmObjMap_##rxclass##classname = {classname::_CreatorClass::CreateInstance, NULL, rxclass::desc (), NULL, &clsid, NULL} ; \
39 extern "C" __declspec(allocate("FXARX_DYNPROP$__m")) __declspec(selectany) _OPM_DYNPROP_ENTRY* const __pOpmObjMap_##rxclass##classname = &__OpmObjMap_##rxclass##classname ; \
40 OPM_DYNPROP_OBJECT_ENTRY_PRAGMA(classname, rxclass)
41
42#define OPM_DYNPROP_OBJECT_ENTRY_AUTO(classname, rxclass) \
43 OPM_DYNPROP_OBJECT_ENTRY_MAKE(classname, rxclass, __uuidof (IDynamicProperty2))
44
45#define OPM_DYNPROP_OBJECT_LEGACY1ENTRY_AUTO(classname, rxclass) \
46 OPM_DYNPROP_OBJECT_ENTRY_MAKE(classname, rxclass, __uuidof (IDynamicProperty))GET_OPM_COMMAND_PROPERTY_MANAGER
47
48#if defined(_WIN64) || defined(_AC64)
49#define OPM_DYNPROP_COMMAND_ENTRY_PRAGMA(classname, cmdname) __pragma(comment(linker, "/include:__pOpmObjMap_" #cmdname #classname)) ;
50#else
51#define OPM_DYNPROP_COMMAND_ENTRY_PRAGMA(classname, cmdname) __pragma(comment(linker, "/include:___pOpmObjMap_" #cmdname #classname)) ;
52#endif
53
54#define OPM_DYNPROP_COMMAND_ENTRY_MAKE(classname, cmdname, clsid) \
55 __declspec(selectany) _OPM_DYNPROP_ENTRY __OpmObjMap_##cmdname##classname = {classname::_CreatorClass::CreateInstance, _RXST(#cmdname), NULL, NULL, &clsid} ; \
56 extern "C" __declspec(allocate("FXARX_DYNPROP$__m")) __declspec(selectany) _OPM_DYNPROP_ENTRY* const __pOpmObjMap_##cmdname##classname = &__OpmObjMap_##cmdname##classname ; \
57 OPM_DYNPROP_COMMAND_ENTRY_PRAGMA(classname, cmdname)
58
59#define OPM_DYNPROP_COMMAND_ENTRY_AUTO(classname, cmdname) \
60 OPM_DYNPROP_COMMAND_ENTRY_MAKE(classname, cmdname, __uuidof (IDynamicProperty2))
61
62#define OPM_DYNPROP_COMMAND_LEGACY1ENTRY_AUTO(classname, cmdname) \
63 OPM_DYNPROP_COMMAND_ENTRY_MAKE(classname, cmdname, __uuidof (IDynamicProperty))
64
65
66#define OPM_DYNPROP_PERINSTANCE_ENTRY_AUTO(classname, rxclass) \
67 OPM_DYNPROP_OBJECT_ENTRY_MAKE(classname, rxclass, __uuidof (IPropertySource))
68
69
70//-----------------------------------------------------------------------------
72
73public:
78 if ( *ppEntry != NULL ) {
79 if ( *( ( *ppEntry )->pclsid ) == __uuidof ( IDynamicProperty2 ) || *( ( *ppEntry )->pclsid ) == __uuidof ( IDynamicProperty ) ) {
80 //- Dynamic properties via the Property Manager
82 ATLASSERT( !( ( *ppEntry )->pClass && ( *ppEntry )->strCmd ) );
83 ATLASSERT( ( *ppEntry )->pClass || ( *ppEntry )->strCmd );
84 if ( ( *ppEntry )->pClass != NULL && ( *ppEntry )->pClass == AcDbDatabase::desc( ) ) {
85 //- Zero Selection property
86 if ( ( pPropMan = GET_OPMEXTENSION_CREATE_PROTOCOL( )->CreateOPMObjectProtocol( NULL , 2 )->GetPropertyManager( ) ) == NULL )
88 }
89 else if ( ( *ppEntry )->pClass != NULL ) {
90 //- Class property
91 if ( ( pPropMan = GET_OPMPROPERTY_MANAGER( ( *ppEntry )->pClass ) ) == NULL )
93 }
94 else {
95 //- Command property
96 if ( GET_OPMEXTENSION_CREATE_PROTOCOL( )->GetOPMManager( ( *ppEntry )->strCmd , &pPropMan ) == FALSE ) {
97 if ( ( pPropMan = GET_OPM_COMMAND_PROPERTY_MANAGER( ( *ppEntry )->strCmd ) ) == NULL )
99 }
100 OPMPropertyExtension *pOPMExt = GET_OPMEXTENSION_CREATE_PROTOCOL( )->CreateOPMCommandProtocol( ( *ppEntry )->strCmd );
101 pOPMExt->SetPropertyManager( pPropMan );
102 }
103 _com_util::CheckError( ( *ppEntry )->pfnCreateInstance( NULL , *( ( *ppEntry )->pclsid ) , ( void ** )&( ( *ppEntry )->pProp ) ) );
104 ( *ppEntry )->pProp->AddRef( );
105 _com_util::CheckError( pPropMan->AddProperty( ( *ppEntry )->pProp ) );
106 }
107 else if ( *( ( *ppEntry )->pclsid ) == __uuidof ( IPropertySource ) ) {
108 //- Per Instance Property
109 ATLASSERT( ( *ppEntry )->pClass );
110 _com_util::CheckError( ( *ppEntry )->pfnCreateInstance( NULL , *( ( *ppEntry )->pclsid ) , ( void ** )&( ( *ppEntry )->pPropSrc ) ) );
111 CComBSTR propName;
112 ( *ppEntry )->pPropSrc->get_Name( &propName );
113 IPropertySource *pPropSrc = GET_OPM_PERINSTANCE_PROPERTY_SOURCES( )->GetPropertySourceAt( &propName );
114 if ( pPropSrc == NULL ) {
115 if ( GET_OPM_PERINSTANCE_PROPERTY_SOURCES( )->SetPropertySourceAt( &propName , ( *ppEntry )->pPropSrc ) == false )
117 }
118 else {
119 ( *ppEntry )->pPropSrc->Release( );
120 ( *ppEntry )->pPropSrc = pPropSrc;
121 pPropSrc = NULL; //- Don't call release
122 }
123 if ( GET_OPM_PERINSTANCE_EXTENSION_PROTOCOL( ( *ppEntry )->pClass )->AddObjectPropertySourceName( &propName ) == false )
125 }
126 }
127 }
128 }
129 virtual ~AcRxDynPropManager( ) {
133 if ( *ppEntry != NULL ) {
134 if ( *( ( *ppEntry )->pclsid ) == __uuidof ( IDynamicProperty2 ) || *( ( *ppEntry )->pclsid ) == __uuidof ( IDynamicProperty ) ) {
135 //- Dynamic properties via the Property Manager
136 ATLASSERT( !( ( *ppEntry )->pClass && ( *ppEntry )->strCmd ) );
137 ATLASSERT( ( *ppEntry )->pClass || ( *ppEntry )->strCmd );
139 if ( ( *ppEntry )->pClass != NULL && ( *ppEntry )->pClass == AcDbDatabase::desc( ) ) {
140 //- Zero Selection property
141 if ( ( pPropMan = GET_OPMEXTENSION_CREATE_PROTOCOL( )->CreateOPMObjectProtocol( NULL , 2 )->GetPropertyManager( ) ) == NULL )
143 }
144 else if ( ( *ppEntry )->pClass != NULL ) {
145 //- Class property
146 if ( ( pPropMan = GET_OPMPROPERTY_MANAGER( ( *ppEntry )->pClass ) ) == NULL )
148 }
149 else {
150 //- Command property
151 if ( GET_OPMEXTENSION_CREATE_PROTOCOL( )->GetOPMManager( ( *ppEntry )->strCmd , &pPropMan ) == FALSE ) {
152 if ( ( pPropMan = GET_OPM_COMMAND_PROPERTY_MANAGER( ( *ppEntry )->strCmd ) ) == NULL )
154 }
155 }
156 if ( ( *ppEntry )->pProp != NULL ) {
157 _com_util::CheckError( pPropMan->RemoveProperty( ( *ppEntry )->pProp ) );
158 ( *ppEntry )->pProp->Release( );
159 }
160 }
161 else if ( *( ( *ppEntry )->pclsid ) == __uuidof ( IPropertySource ) ) {
162 //- Per Instance Property
163 ATLASSERT( ( *ppEntry )->pClass );
164 CComBSTR propName;
165 ( *ppEntry )->pPropSrc->get_Name( &propName );
166 if ( GET_OPM_PERINSTANCE_EXTENSION_PROTOCOL( ( *ppEntry )->pClass )->RemoveObjectPropertySourceName( &propName ) == false )
168 if ( ( *ppEntry )->pPropSrc->Release( ) <= 1 ) {
169 if ( GET_OPM_PERINSTANCE_PROPERTY_SOURCES( )->RemovePropertySourceAt( &propName ) == false )
171 }
172 }
173 }
174 }
175 }
176};
177#endif
#define GET_OPM_PERINSTANCE_EXTENSION_PROTOCOL(pAcRxClass)
#define GET_OPM_PERINSTANCE_PROPERTY_SOURCES()
__declspec(selectany) _FXARX_COMMAND_ENTRY *__pFXARXCommandFirst
static AcRxClass *__cdecl desc(void)
#define GET_OPMEXTENSION_CREATE_PROTOCOL()
Definition interfaces.h:359
#define GET_OPM_COMMAND_PROPERTY_MANAGER(pCommandName)
Definition interfaces.h:365
#define GET_OPMPROPERTY_MANAGER(pAcRxClass)
Definition interfaces.h:362