OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
occtrl.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// (c) Copyright 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of the TOcControl Class and helpers
7/// These class encapsulate the hosting of OCX controls...
8//----------------------------------------------------------------------------
9#include <ocf/pch.h>
10#include <ocf/ocstorag.h>
11#include <ocf/ocdoc.h>
12#include <ocf/ocapp.h>
13#include <ocf/ocview.h>
14#include <ocf/occtrl.h>
15#include <ocf/autodefs.h>
16#include <ocf/automacr.h>
17
18namespace ocf {
19
20using namespace owl;
21
22// Routine to convert TOcControl* to TOcxView* [treated as opaque pointers]
23// for exposing delegated properties..
24//
25static ObjectPtr
26GetControlView(ObjectPtr ctl);
27
28//
29//
30//
31TEventEntry::TEventEntry() : IDOfEvent(0), ParamCount(0), NameAndParams(0)
32{}
33
34//
35//
36//
41
42//
43/// \note Does not invoke 'Cleanup' before initializing data member with
44/// newly retrieved information. Invoke 'Cleanup' explicitly if
45/// object has already retrieved event information.
46//
47void
48TEventEntry::Init(int index, ITypeInfo* typeInfo)
49{
52 if (SUCCEEDED(typeInfo->GetFuncDesc(index, &funcDesc))) {
54 IDOfEvent = funcDesc->memid;
55 ParamCount= funcDesc->cParams;
56 NameAndParams= new BSTR[funcDesc->cParams+1];
57
58 uint i;
59 typeInfo->GetNames(funcDesc->memid, NameAndParams,
60 funcDesc->cParams+1, &i);
61 CHECK(i == uint(funcDesc->cParams+1));
62 typeInfo->ReleaseFuncDesc(funcDesc);
63 }
64}
65
66//
67//
68//
69void
71{
72 if (NameAndParams) {
73 for (int i=0; i <= (int)ParamCount; i++)
74 ::SysFreeString(NameAndParams[i]);
75 delete [] NameAndParams;
76 NameAndParams = 0;
77 }
78}
79
80//
81//
82//
84 :EventList(0), Count(0), EventIID(CLSID_NULL)
85{
87
88 LPTYPEATTR tAttr = 0;
89 if (SUCCEEDED(eventTypeInfo->GetTypeAttr(&tAttr))) {
90 EventIID = tAttr->guid;
91 Count = tAttr->cFuncs;
92 if (Count) {
94 for (int i=0; i < (int)Count; i++)
95 EventList[i].Init(i, eventTypeInfo);
96 }
97 eventTypeInfo->ReleaseTypeAttr(tAttr);
98 }
99}
100
101//
102//
103//
105{
106 delete [] EventList;
107}
108
109//
110//
111//
114 PRECONDITION(index < (int)Count);
116 return EventList[index];
117}
118
119///RAYK - help contexts?
120//
121// Control container ambient property support
122//
139
140#if defined(_MSC_VER)
141# pragma warning(push)
142# pragma warning(disable: 4838) // warning C4838: conversion from 'unsigned long' to 'long' requires a narrowing conversion.
143#endif
144
145//
146// Control standard extended properties and standard events
147//
149 //
150 // Standard extended properties
151 //
153 EXPOSE_PROPRW_ID(0x80010007L, Visible, TAutoBool, _T("!Visible"), _T("!Visible"), 0)
155 EXPOSE_PROPRW_ID(0x80010038L, Default, TAutoBool, _T("!Default"), _T("@Default_"), 0)
157 EXPOSE_PROPRW_ID(0x80010100L, Left, TAutoLong, _T("!Left"), _T("!Left"), 0)
159 EXPOSE_PROPRW_ID(0x80010102L, Width, TAutoLong, _T("!Width"), _T("!Width"), 0)
161
162 // Expose ambient properties
163 //
164 EXPOSE_DELEGATE(TOcxView, _T("TOcxView"), GetControlView)
165
167
168#if defined(_MSC_VER)
169# pragma warning(pop)
170#endif
171
172//
173// Control standard extended properties and standard events
174//
176 //
177 // Standard events
178 //
180 EXPOSE_METHOD_ID(DISPID_DBLCLICK, DblClick, TAutoLong, _T("!DblClick"), _T("@DblClick_"), 0)
182 REQUIRED_ARG(TAutoShort, _T("!Button"))
183 REQUIRED_ARG(TAutoShort, _T("!Shift"))
186 EXPOSE_METHOD_ID(DISPID_MOUSEUP, MouseUp, TAutoLong, _T("!MouseUp"), _T("@MouseUp_"), 0)
187 REQUIRED_ARG(TAutoShort, _T("!Button"))
188 REQUIRED_ARG(TAutoShort, _T("!Shift"))
192 REQUIRED_ARG(TAutoShort, _T("!Button"))
193 REQUIRED_ARG(TAutoShort, _T("!Shift"))
196 EXPOSE_METHOD_ID(DISPID_KEYDOWN, KeyDown, TAutoLong, _T("!KeyDown"), _T("@KeyDown_"), 0)
197 REQUIRED_ARG(TAutoShortRef, _T("!KeyCode"))
198 REQUIRED_ARG(TAutoShort, _T("!Shift"))
200 REQUIRED_ARG(TAutoShortRef, _T("!KeyCode"))
201 REQUIRED_ARG(TAutoShort, _T("!Shift"))
202 EXPOSE_METHOD_ID(DISPID_ERROREVENT, ErrorEvent, TAutoLong, _T("!ErrorEvent"),_T("&ErrorEvent_"),0)
203 REQUIRED_ARG(TAutoShort, _T("!Number"))
204 REQUIRED_ARG(TAutoString,_T("!Description"))
205 REQUIRED_ARG(TAutoLong, _T("!SCode"))
206 REQUIRED_ARG(TAutoString,_T("!Source"))
207 REQUIRED_ARG(TAutoString,_T("!HelpFile"))
208 REQUIRED_ARG(TAutoLong, _T("!HelpContext"))
209 REQUIRED_ARG(TAutoBoolRef,_T("!CancelDisplay"))
211 REQUIRED_ARG(TAutoLongRef, _T("!Number"))
212
214
215//
216//
217//
218ObjectPtr GetControlView(ObjectPtr ctl)
219{
220 return (ObjectPtr)((TOcControl*)ctl)->GetActiveControlView();
221}
222
223//
224/// Construct a new part with a given temp id
225//
227 :TOcPart(document, id), pUserName(new TString), BCtrlI(0),
228 pIExtended(0), pEvents(pEv), EventList(0)
229{
230 *pUserName = GetName();
231 if (pEvents)
232 pEventsOwnership=false;
233 else
234 pEventsOwnership=true;
235}
236
237//
238/// Construct a part from a named stream in an oc doc's storage
239//
241 :TOcPart(document, name), pUserName(0), BCtrlI(0), pIExtended(0),
242 pEvents(0), EventList(0)
243{
244// !rayk
245 pEventsOwnership=true;
246}
247
248//
249//
250//
252{
253 if (pIExtended)
256 delete pEvents;
257 delete pUserName;
258 delete EventList;
259}
260
261//
262//
263//
264bool
269
270//
271/// Perform common ctor initialization
272//
273bool
275{
276 if (TOcPart::InitObj((TOcInitInfo *)nullptr) == false)
277 return false;
278
279 if (initInfo) {
280 if (!pIExtended)
281 pIExtended = (TServedObject*)CreateAutoObject(this, ClassInfo);
282
283 if (!pEvents)
284 pEvents = new TOcControlEvent();
285
286 // There must be an IStorage associated with each part, make sure the
287 // ctor got it OK
288 //
289 initInfo->Storage = Storage->GetIStorage();
290
291 // Create part helper
292 //
296
297 // Get the interfaces we need & then release the object itself
298 //
299 if (HRSucceeded(BPart->QueryInterface(IID_IBPart, (LPVOID *)&BPartI)))
300 BPartI->Release();
301 if (HRSucceeded(BPart->QueryInterface(IID_IBLinkable, (LPVOID *)&BLPartI)))
302 BLPartI->Release();
303 if (HRSucceeded(BPart->QueryInterface(IID_IBControl, (LPVOID *)&BCtrlI)))
304 BCtrlI->Release();
305
306 // Initialize the Extended/Ambient IDispatch
307 //
308 HRESULT hr;
309 IBSite* BSiteI;
310 hr = QueryInterface(IID_IBSite, (LPVOID *)&BSiteI);
311 if (HRSucceeded(hr)) {
312 IDispatch* pID = 0;
316 (LPVOID *)&pID)))) {
318 pID->Release();
319 }
320
321 // Init the part
322 //
323 if (!BPartI || !HRSucceeded(hr = BPartI->Init(BSiteI, initInfo))) {
324 BSiteI->Release();
325 BPart->Release();
326 BPart = 0;
328 }
329 BSiteI->Release();
330
331 Rename();
332 if (initInfo->How == ihLink) // Remember that we are a link
333 Flags |= Link;
334
335 // Initialize the Events IDispatch
336 //
338
339 // New parts become active when they are init'd above. Make sure that
340 // our view knows that we are active too.
341 //
342 if (initInfo->Where == iwNew) {
343 Flags |= Active;
344 activeView->ActivatePart(this);
345 }
346 }
347 else
349
350 }
351 return true;
352}
353
354//
355/// Retrieves the ITypeInfo the 'default source' event object of this
356/// control.
357/// \note Receiver must 'Release' the returned object, if successful.
358//
359ITypeInfo*
361{
362 ITypeInfo* pRet = nullptr;
363 if (GetBControlI())
365 return pRet;
366}
367
368//
369/// Retrieves a list of events generated by this control.
370/// Returns true if the event list was successfully retrieved.
371//
372bool
374{
375 // Skip if we've already retrieved the event list
376 //
377 if (EventList && EventList->GetCount())
378 return true;
379
380 // Retrieve Event ITypeInfo
381 //
382 ITypeInfo* eventTypeInfo = GetEventTypeInfo();
383 if (!eventTypeInfo)
384 return false;
385
386 // Allocate new EventList object
387 //
389 eventTypeInfo->Release();
390 return true;
391}
392
393//
394//
395//
398{
399 return EventList;
400}
401
402//
403/// Retrieves the primary IDispatch of the control.
404/// \note Receiver must 'Release' the returned object, if successful.
405//
408{
409 IDispatch* pDisp = 0;
410 if (GetBControlI())
412 return pDisp;
413}
414
415//
416//
417//
418void
420{
421 if (!pEvents)
422 return;
423
424 pEvents->pCtrl = this;
426
427 IDispatch* pID = 0;
429 if (SUCCEEDED(pS->QueryObject(IID_IDispatch, (void**)&pID))) {
430 IID iidEv;
431
433 pS->iidEvent = iidEv;
434
435 ITypeInfo* pITypeInfo;
437 UINT i;
439
441 if (pITypeInfo) {
442 pITypeInfo->GetTypeAttr(&pTA);
443 if (pTA) {
444 cEvents = pTA->cFuncs;
445 pITypeInfo->ReleaseTypeAttr(pTA);
446 for (i = 0; i < cEvents; i++) {
448
449 if (SUCCEEDED(pITypeInfo->GetFuncDesc(i, &pFD))) {
450 ObjectPtr object = this; // copy in case of ptr adjustment
451
452 // see if we have a method associated with this DISPID
453 // if not, find one with the same name and see if the
454 // number of parameters matches
455 //
456 TAutoSymbol* sym = pS->Class->FindId(pFD->memid, object);
457 if (!sym) {
458 UINT cNames;
459 BSTR bstrName; // Event name(function only)
460 DISPID dispid; // Event name(function only)
461 if (SUCCEEDED(pITypeInfo->GetNames(pFD->memid, &bstrName,
462 1, &cNames))) {
463 sym = pS->Class->Lookup(OleStr(bstrName),
466 if (sym &&
467 (sym->DispId == -1 || sym->DispId == 0) &&
468 sym->TestFlag(DISPATCH_METHOD) && // check type
469 pS->Class->GetArgCount(*sym) == pFD->cParams) {
470 sym->DispId = pFD->memid;
471 }
472
473 SysFreeString(bstrName);
474 }
475 }
476 pITypeInfo->ReleaseFuncDesc(pFD);
477 }
478 }
479 }
480 pITypeInfo->Release();
481 }
483 pID->Release();
484 }
485}
486
487//
488//
489//
490TOcView*
495
496//
497//
498//
501{
503 TUnknown* result = 0;
505 if (appDesc) {
506 result = appDesc->CreateAutoObject(obj, clsInfo.GetTypeInfo(),
507 obj, clsInfo.GetTypeInfo(), 0);
508 if (result)
509 ((TServedObject*)result)->AddRef();
510 }
511 return result;
512}
513
514//
515/// Callback from TUnknown's implementation of QueryInterface
516//
519{
521 HRESULT hr;
522
523 // interfaces
524 //
526
527 // helpers
528 //
531 ;
532 return hr;
533}
534
535
536/// Extended property support
537//
538void
543
544//
545//
546//
547TString&
549{
550 return *pUserName;
551}
552
553//
554/// Retrieves the extended IDispatch (exposing extended properties)
555//
558{
559 IDispatch* pID = 0;
561 if (view) {
562 if (HRSucceeded(view->QueryInterface(IID_IDispatch, (LPVOID *)&pID)))
563 pID->Release();
564 }
565 return pID;
566}
567
568//
569//
570//
571void
573{
574 TPoint nuPos(int(value), Pos.y);
575 SetPos(nuPos);
576 UpdateRect();
577}
578
579//
580//
581//
582void
584{
585 TSize nuSize(int(value), Size.cy);
587 UpdateRect();
588}
589
590//
591//
592//
593void
595{
596 TPoint nuPos(Pos.x, int(value));
597 SetPos(nuPos);
598 UpdateRect();
599}
600
601//
602//
603//
604void
606{
607 TSize nuSize(Size.cx, int(Value));
609 UpdateRect();
610}
611
612//
613/// Event support
614//
617{
619 if (!view)
620 return HR_FAIL;
621
622 if (fGotFocus && (view->GetActivePart()) &&
623 (view->GetActivePart() != this))
624 view->GetActivePart()->Activate (FALSE);
625
627 view->ForwardEvent(OC_CTRLEVENT_FOCUS, &ev);
628 return HR_NOERROR;
629}
630
631//
632//
633//
636{
638 if (!view)
639 return HR_FAIL;
640
642 view->ForwardEvent(OC_CTRLEVENT_PROPERTYCHANGE, &ev);
643 return HR_NOERROR;
644}
645
646//
647//
648//
651{
653 if (!view)
654 return HR_FAIL;
655
658 return ev.accept ? HR_OK : HR_FALSE;
659}
660
661//
662//
663//
667{
669 if (!view)
670 return HR_FAIL;
671
673 if (!view->ForwardEvent(OC_VIEWTRANSFORMCOORDS, &ev)) {
674
675 // default if not handled is to go from himetric to pixels and back again
676 // if you want otherwise, you should override this, or answer the
677 // message differently.
678
679 HDC dc = ::GetDC(0);
680 int xPixPerInch = ::GetDeviceCaps(dc, LOGPIXELSX);
681 int yPixPerInch = ::GetDeviceCaps(dc, LOGPIXELSY);
682 ReleaseDC(0, dc);
686 }
687 else if (flags & XFORMCOORDS_CONTAINERTOHIMETRIC) {
690 }
691 }
692 return S_OK;
693}
694
695//
696//
697//
702
703//
704/// TOcxView Class Implementation
705//
707:
709 pBlankString(new TString(" "))
710 //pDisplayName(new TString("Control")),
711 //pScaleUnits(new TString("Control"))
712{
714
716 if (appDesc) {
717 pIAmbients = (TServedObject*)appDesc->CreateAutoObject(
718 (VOID*)this, ClassInfo.GetTypeInfo(),
719 (VOID*)this, ClassInfo.GetTypeInfo(),
720 0);
721 if (pIAmbients)
723 }
724}
725
726//
727//
728//
730{
731 if (pIAmbients)
733 delete pBlankString;
734}
735
736//
737//
738//
741{
743 HRESULT hr;
744
745 // interfaces
746 //
747
749 {
750 }
751 // helpers
752 //
754 {
755 }
756
757 return hr;
758}
759
760//
761//
762//
763void
768
769void
774
775void
780
781void
786
787void
792
793void
798
799void
804
805void
810
811void
816
817void
822
823void
828
829void
831{
832 //pDisplayName = &name;
834}
835
836void
838{
839 //pScaleUnits = &unit;
841}
842
843void
848
849
850void
855
856void
861
862void
867
868void
873
874void
879
880void
885
886void
891
892void
897
898void
903
904void
909
910void
915
916void
921
922void
927
928void
933
934long
936{
937 return GetAmbientValue(OC_AMBIENT_GETBACKCOLOR, RGB(0x80, 0x80, 0x80));
938}
939
940
941long
943{
944 return GetAmbientValue(OC_AMBIENT_GETFORECOLOR, RGB(0x00, 0x00, 0x00));
945}
946
947
948long
953
954
955bool
960
961
962short
964{
965 return (short)(GetAmbientValue(OC_AMBIENT_GETTEXTALIGN, 0) & 0xffff);
966}
967
968
969bool
971{
972 return (bool)(GetAmbientValue(OC_AMBIENT_GETUSERMODE, true) & 0xf);
973}
974
975
976bool
978{
979 return (bool)(GetAmbientValue(OC_AMBIENT_GETUIDEAD, false) & 0xf);
980}
981
982
983bool
988
989
990bool
992{
993 return (bool)(GetAmbientValue(OC_AMBIENT_GETSHOWHATCHING, false) & 0xf);
994}
995
996
997bool
1002
1003
1004bool
1009
1010
1011TString&
1017
1018
1019TString&
1025
1026
1027IDispatch*
1029{
1031
1032 // NOTE: If view handles the message, it should AddRef the font
1033 //
1035}
1036
1037
1038void
1040{
1041 // Will loop through all known controls and let them
1042 // know when an ambient property changes
1043 //
1045 TOcPart* ocPart = (TOcPart*)i.Current();
1047 if (SUCCEEDED(ocPart->QueryInterface(IID_IBControl, (LPVOID *)&CtrlI))) {
1048#if 0
1049 // !BB The following order of call looks very suspicious to me
1050 // !BB Shouldn't one release only and only when the interface pointer
1051 // !BB will no longer be used?? Or, I am missing some subtle issue
1052 // !BB about OLE controls and Ambient property changed.
1053 CtrlI->Release();
1054 CtrlI->AmbientChanged(dispid);
1055#else
1056 CtrlI->AmbientChanged(dispid);
1057 CtrlI->Release();
1058#endif
1059 }
1060 }
1061}
1062
1063long
1065{
1066 uint32 value;
1067 return ForwardEvent(int(ambientMsg), &value) ? value : def;
1068}
1069
1070//
1071// TOcControlEvent Class Implementation
1072// Support for standard events and generic custom event
1073//
1075 :pCtrl(0), pIEvents(0)
1076{
1077}
1078
1084
1085void
1087{
1088 if (!pIEvents)
1089 pIEvents = (TServedObject *)CreateAutoObject(this, ClassInfo);
1090}
1091
1092TUnknown*
1094{
1095 if (pCtrl) {
1096 clsInfo.AutoIds = false;
1098 return pIEvents;
1099 }
1100 else
1101 return 0;
1102}
1103
1104//
1105//
1106//
1107HRESULT
1109{
1111 if (!view)
1112 return E_FAIL;
1113
1115 view->ForwardEvent(msg, &ev);
1116 return S_OK;
1117}
1118
1119//
1120//
1121//
1122HRESULT
1124 short button, short shift,
1125 long x, long y)
1126{
1128 if (!view)
1129 return E_FAIL;
1130
1131 TCtrlMouseEvent ev(pCtrl, id, button, shift, x, y);
1132 view->ForwardEvent(msg, &ev);
1133 return S_OK;
1134}
1135
1136//
1137//
1138//
1139HRESULT
1141 short* keyCode, short shift)
1142{
1144 if (!view)
1145 return E_FAIL;
1146
1148 view->ForwardEvent(msg, &ev);
1149 return S_OK;
1150}
1151
1152//
1153//
1154//
1155HRESULT
1157 SCODE SCode, TAutoString Source,
1158 TAutoString HelpFile, long HelpContext,
1159 bool* CancelDisplay)
1160{
1162 if (!view)
1163 return E_FAIL;
1164
1165 TCtrlErrorEvent ev(pCtrl, Number, Description, SCode, Source, HelpFile,
1166 HelpContext, *CancelDisplay);
1167 view->ForwardEvent(OC_CTRLEVENT_ERROREVENT, &ev);
1168 return S_OK;
1169}
1170
1171//
1172//
1173//
1174HRESULT
1176{
1178 if (!view)
1179 return HR_FAIL;
1180
1183 view->ForwardEvent(OC_CTRLEVENT_CUSTOMEVENT, &ev);
1184 return HR_NOERROR;
1185}
1186
1187//
1188//
1189//
1190HRESULT
1195
1196//
1197//
1198//
1199HRESULT
1204
1205//
1206//
1207//
1208HRESULT
1209TOcControlEvent::MouseDown(short button, short shift, long x, long y)
1210{
1212 button, shift, x, y);
1213}
1214
1215//
1216//
1217//
1218HRESULT
1219TOcControlEvent::MouseMove(short button, short shift, long x, long y)
1220{
1222 button, shift, x, y);
1223}
1224
1225//
1226//
1227//
1228HRESULT
1229TOcControlEvent::MouseUp(short button, short shift, long x, long y)
1230{
1232 DISPID_MOUSEUP, button, shift, x, y);
1233}
1234
1235//
1236//
1237//
1238HRESULT
1244
1245//
1246//
1247//
1248HRESULT
1254
1255//
1256//
1257//
1259
1260//
1261//
1262//
1263static HRESULT
1264OcInvokeProc(LPCTSTR libraryName, LPCSTR procName)
1265{
1267
1270 return hr;
1271
1273 dllRegProc = (REGPROC)::GetProcAddress (libHandle, procName);
1274 if (dllRegProc) {
1275 hr = dllRegProc();
1276 }
1277
1279 return hr;
1280}
1281
1282//
1283//
1284//
1287{
1288 // NOTE: The new recommendation is to refrain from loading the control
1289 // until the 'SelfRegister' string has been found in the VERSIONINFO
1290 // resource...
1291 //
1292 return OcInvokeProc(libraryName, "DllRegisterServer");
1293}
1294
1295//
1296//
1297//
1300{
1301 HRESULT hr;
1302 LPOLESTR str;
1303 hr = StringFromCLSID (classId, &str);
1304
1305 if (SUCCEEDED(hr)) {
1306 TCHAR temp[64];
1307 _tcscpy (temp, OleStr(str));
1308
1309 TCHAR key[255];
1310 wsprintf (key, _T("CLSID\\%s\\InprocServer32"), temp);
1311 CoTaskMemFree(str);
1312
1314 long len = sizeof(ocxPath);
1316 key, ocxPath,
1317 (LONG *)&len);
1318 if (SUCCEEDED(hr)) {
1319
1320 // NOTE: The new recommendation is to refrain from loading the control
1321 // until the 'SelfRegister' string has been found in the VERSIONINFO
1322 // resource...
1323 //
1324 hr = OcInvokeProc(ocxPath, "DllUnregisterServer");
1325 }
1326 }
1327 return hr;
1328}
1329
1330
1331} // OCF namespace
1332
1333//==============================================================================
1334
OLE Automation Class Definitions.
Automation Symbol Table, Command, and Proxy Macro Definitions.
#define DISPID_CATCH_ALL
Definition automacr.h:1045
#define END_AUTOCLASS(cls, flags, name, doc, help)
Definition automacr.h:64
#define EXPOSE_METHOD_ID(id, cmd, cls, name, doc, help)
Definition automacr.h:101
#define EXPOSE_PROPRW_ID(id, cmd, cls, name, doc, help)
Definition automacr.h:107
#define EXPOSE_PROPRO_ID(id, cmd, cls, name, doc, help)
Definition automacr.h:113
#define REQUIRED_ARG(cls, name)
Definition automacr.h:128
#define DEFINE_AUTOCLASS(cls)
Definition automacr.h:61
#define EXPOSE_DELEGATE(cls, name, locator)
Definition automacr.h:134
#define CHECK(condition)
Definition checks.h:239
#define PRECONDITION(condition)
Definition checks.h:227
virtual HRESULT _IFUNC GetEventTypeInfo(ITypeInfo **ppTypeInfo)=0
virtual HRESULT _IFUNC GetCtrlDispatch(IDispatch **ppDispatch)=0
virtual HRESULT _IFUNC SetAmbientDispatch(IDispatch *)=0
virtual HRESULT _IFUNC SetEventDispatch(IDispatch *)=0
virtual HRESULT _IFUNC GetEventIID(IID *iidEvent)=0
virtual HRESULT _IFUNC Init(IBSite *, TOcInitInfo *)=0
IBSite – Supported by container apps for each linked/embedded object.
Definition ocbocole.h:437
Automation argument stack abstraction.
Definition autodefs.h:813
Based on reference counted TString with added automation functionality.
Definition autodefs.h:492
Definition occtrl.h:37
BSTR * NameAndParams
Definition occtrl.h:48
TEventEntry()
Definition occtrl.cpp:31
DISPID IDOfEvent
Definition occtrl.h:46
~TEventEntry()
Definition occtrl.cpp:37
owl::uint ParamCount
Definition occtrl.h:47
void Init(int index, ITypeInfo *typeInfo)
Definition occtrl.cpp:48
void Cleanup()
Definition occtrl.cpp:70
TEventEntry & operator[](int index)
Definition occtrl.cpp:113
owl::uint GetCount() const
Definition occtrl.h:60
owl::uint Count
Definition occtrl.h:64
TEventList(ITypeInfo *typeInfo)
Definition occtrl.cpp:83
TEventEntry * EventList
Definition occtrl.h:63
GUID EventIID
Definition occtrl.h:65
HRESULT BOleComponentCreate(IUnknown **retIface, IUnknown *outer, owl::uint32 idClass)
Create a BOle helper for one of our OC objects in this app.
Definition ocapp.cpp:213
TOcRegistrar & GetRegistrar()
Definition ocapp.h:162
OC Control Event class for standard control events.
Definition occtrl.h:202
long MouseUp(short Button, short Shift, long X, long Y)
Definition occtrl.cpp:1229
long MouseDown(short Button, short Shift, long X, long Y)
Definition occtrl.cpp:1209
HRESULT CustomEvent(long *args)
Definition occtrl.cpp:1175
long KeyUp(short *KeyCode, short Shift)
Definition occtrl.cpp:1249
long ErrorEvent(short number, TAutoString Description, SCODE SCode, TAutoString Source, TAutoString HelpFile, long helpContext, bool *CancelDisplay)
Definition occtrl.cpp:1156
TUnknown * CreateAutoObject(const void *obj, TAutoClass &clsInfo)
Definition occtrl.cpp:1093
HRESULT ForwardClickEvent(owl::uint msg, DISPID id)
Definition occtrl.cpp:1108
long KeyDown(short *KeyCode, short Shift)
Definition occtrl.cpp:1239
HRESULT ForwardKeyEvent(owl::uint msg, DISPID id, short *KeyCode, short Shift)
Definition occtrl.cpp:1140
TOcControl * pCtrl
Definition occtrl.h:237
virtual void InitEventDispatch()
Definition occtrl.cpp:1086
HRESULT ForwardMouseEvent(owl::uint msg, DISPID id, short Button, short Shift, long X, long Y)
Definition occtrl.cpp:1123
long MouseMove(short Button, short Shift, long X, long Y)
Definition occtrl.cpp:1219
TServedObject * pIEvents
Definition occtrl.h:238
Class representing an embedded control within a document.
Definition occtrl.h:78
TOcControlEvent * pEvents
Definition occtrl.h:153
TEventList * GetEventList() const
Definition occtrl.cpp:397
void SetEventDispatch()
Definition occtrl.cpp:419
owl::TString & GetUserName()
Definition occtrl.cpp:548
void SetTop(long Value)
Definition occtrl.cpp:594
bool Init(TOcInitInfo *initInfo, owl::TRect pos)
Definition occtrl.cpp:265
HRESULT QueryObject(const IID &iid, void **iface)
Callback from TUnknown's implementation of QueryInterface.
Definition occtrl.cpp:518
HRESULT _IFUNC TransformCoords(owl::TPointL *lpptlHimetric, owl::TPointF *lpptfContainer, DWORD flags)
Definition occtrl.cpp:665
bool InitObj(TOcInitInfo *initInfo)
Perform common ctor initialization.
Definition occtrl.cpp:274
TServedObject * pIExtended
Definition occtrl.h:152
bool pEventsOwnership
Definition occtrl.h:154
TEventList * EventList
Definition occtrl.h:156
IBControl * BCtrlI
Definition occtrl.h:150
bool FillEventList()
Retrieves a list of events generated by this control.
Definition occtrl.cpp:373
void SetLeft(long Value)
Definition occtrl.cpp:572
ITypeInfo * GetEventTypeInfo()
Retrieves the ITypeInfo the 'default source' event object of this control.
Definition occtrl.cpp:360
HRESULT _IFUNC OnPropertyRequestEdit(DISPID dispid)
Definition occtrl.cpp:650
IDispatch * GetCtlDispatch()
Retrieves the primary IDispatch of the control.
Definition occtrl.cpp:407
owl::TString * pUserName
Definition occtrl.h:151
HRESULT _IFUNC OnPropertyChanged(DISPID dispid)
Definition occtrl.cpp:635
IDispatch * GetParent()
Retrieves the extended IDispatch (exposing extended properties)
Definition occtrl.cpp:557
friend TOcControlEvent
Definition occtrl.h:194
TOcView * GetActiveControlView()
Definition occtrl.cpp:491
IBControl * GetBControlI()
Definition occtrl.h:93
void SetUserName(owl::TString &name)
Extended property support.
Definition occtrl.cpp:539
HRESULT _IFUNC OnControlFocus(BOOL fGotFocus)
Event support.
Definition occtrl.cpp:616
TOcControl(TOcDocument &document, int id=0, TOcControlEvent *pEv=nullptr)
Construct a new part with a given temp id.
Definition occtrl.cpp:226
TUnknown * CreateAutoObject(const void *obj, TAutoClass &clsInfo)
Definition occtrl.cpp:500
void SetHeight(long Value)
Definition occtrl.cpp:605
void SetWidth(long Value)
Definition occtrl.cpp:583
OC Document class, holds parts & is a owner of views.
Definition ocdoc.h:43
TOcPartCollection & GetParts()
Definition ocdoc.h:51
TOcView * GetActiveView()
Definition ocdoc.h:76
OC part class represents an embeded or linked part in a document.
Definition ocpart.h:38
owl::TString GetName()
Definition ocpart.h:91
virtual bool Init(TOcInitInfo *initInfo, owl::TRect pos)
Perform common ctor initialization.
Definition ocpart.cpp:128
void UpdateRect()
Set part to the new rect given in logical units.
Definition ocpart.cpp:625
TOcDocument & OcDocument
The OC document we are imbeded in.
Definition ocpart.h:154
owl::uint16 Flags
Is this part Selected/Visible/Active/ALink?
Definition ocpart.h:162
TOcStorage * Storage
The storage we are in.
Definition ocpart.h:155
virtual bool InitObj(TOcInitInfo *initInfo)
Definition ocpart.cpp:154
IBLinkable * BLPartI
Definition ocpart.h:152
HRESULT QueryObject(const IID &iid, void **iface)
Callback from TUnknown's implementation of QueryInterface.
Definition ocpart.cpp:219
IBPart * BPartI
Definition ocpart.h:151
IUnknown * BPart
Our corresponding helper object & interfaces.
Definition ocpart.h:150
owl::TSize Size
Definition ocpart.h:159
void SetPos(const owl::TPoint &pos)
Set part to the new position given in logical units.
Definition ocpart.cpp:605
void SetSize(const owl::TSize &size)
Set part to the new size given in logical units.
Definition ocpart.cpp:616
owl::TPoint Pos
Definition ocpart.h:158
void Rename()
Rename the embed site for linking.
Definition ocpart.cpp:277
HRESULT _IFUNC QueryInterface(const GUID &iid, void **iface)
Definition ocpart.h:120
IStorage * GetIStorage()
Definition ocstorag.cpp:383
The TOcView partner is a container (viewer) of a given (server/client) document.
Definition ocview.h:136
TOcDocument & OcDocument
Our OC document object.
Definition ocview.h:270
HRESULT QueryObject(const IID &iid, void **iface)
Callback from TUnknown's implementation of QueryInterface.
Definition ocview.cpp:190
TOcApp & OcApp
Our OC application object.
Definition ocview.h:269
owl::TResult ForwardEvent(int eventId, const void *param)
Definition ocview.h:744
The TOcxView partner is a container (viewer) of a given (server/client) document.
Definition occtrl.h:273
void SetAmbUserMode(bool Mode)
Definition occtrl.cpp:881
HRESULT QueryObject(const IID &iid, void **iface)
Definition occtrl.cpp:740
void SetUserMode(bool Mode)
Definition occtrl.cpp:794
bool GetUIDead()
Definition occtrl.cpp:977
bool GetUserMode()
Definition occtrl.cpp:970
void SetAmbDisplayName(owl::TString &Name)
Definition occtrl.cpp:917
TOcxView(TOcDocument &doc, owl::TRegList *regList=0, IUnknown *outer=0)
TOcxView Class Implementation.
Definition occtrl.cpp:706
short GetTextAlign()
Definition occtrl.cpp:963
long GetAmbientValue(long AmbientMsg, long Default)
Definition occtrl.cpp:1064
void SetAmbTextAlign(short Align)
Definition occtrl.cpp:875
void SetAmbMessageReflect(bool MsgRef)
Definition occtrl.cpp:869
void SetDisplayAsDefault(bool Disp)
Definition occtrl.cpp:824
void SetMessageReflect(bool MsgRef)
Definition occtrl.cpp:782
void SetScaleUnits(owl::TString &ScaleUnits)
Definition occtrl.cpp:837
void SetAmbShowGrabHandles(bool Handles)
Definition occtrl.cpp:893
bool GetShowGrabHandles()
Definition occtrl.cpp:984
bool GetSupportsMnemonics()
Definition occtrl.cpp:1005
long GetBackColor()
Definition occtrl.cpp:935
void SetBackColor(long Color)
Definition occtrl.cpp:764
void SetAmbForeColor(long Color)
Definition occtrl.cpp:857
TServedObject * pIAmbients
Definition occtrl.h:332
void SetAmbFont(IDispatch *pFontDisp)
Definition occtrl.cpp:929
long GetForeColor()
Definition occtrl.cpp:942
void AmbientChanged(DISPID dispid)
Definition occtrl.cpp:1039
void SetShowGrabHandles(bool Handles)
Definition occtrl.cpp:806
void SetLocaleID(long LocaleId)
Definition occtrl.cpp:776
long GetLocaleID()
Definition occtrl.cpp:949
owl::TString & GetDisplayName()
Definition occtrl.cpp:1012
bool GetMessageReflect()
Definition occtrl.cpp:956
void SetAmbShowHatching(bool Hatch)
Definition occtrl.cpp:905
bool GetShowHatching()
Definition occtrl.cpp:991
void SetAmbSupportsMnemonics(bool Mnem)
Definition occtrl.cpp:899
void SetAmbLocaleID(long LocaleId)
Definition occtrl.cpp:863
void SetAmbUIDead(bool Dead)
Definition occtrl.cpp:887
void SetAmbScaleUnits(owl::TString &ScaleUnits)
Definition occtrl.cpp:923
void SetAmbBackColor(long Color)
Definition occtrl.cpp:851
void SetSupportsMnemonics(bool Mnem)
Definition occtrl.cpp:812
owl::TString & GetScaleUnits()
Definition occtrl.cpp:1020
void SetDisplayName(owl::TString &Name)
Definition occtrl.cpp:830
IDispatch * GetFont()
Definition occtrl.cpp:1028
void SetFont(IDispatch *pFontDisp)
Definition occtrl.cpp:844
void SetAmbDisplayAsDefault(bool Disp)
Definition occtrl.cpp:911
bool GetDisplayAsDefault()
Definition occtrl.cpp:998
owl::TString * pBlankString
Definition occtrl.h:333
void SetTextAlign(short Align)
Definition occtrl.cpp:788
void SetShowHatching(bool Hatch)
Definition occtrl.cpp:818
void SetForeColor(long Color)
Definition occtrl.cpp:770
void SetUIDead(bool Dead)
Definition occtrl.cpp:800
TAppDescriptor & GetAppDescriptor()
Definition ocreg.h:153
OLE object exposed for automated access of internal object.
Definition autodefs.h:972
owl::ulong _IFUNC AddRef()
Definition autodefs.h:993
HRESULT QueryObject(const IID &iid, void **iface)
Definition autosrv.cpp:84
owl::ulong _IFUNC Release()
Definition autodefs.h:994
Standard implementation of a controlling IUnknown for an object, to be inherited with other COM inter...
Definition oleutil.h:264
IUnknown * GetOuter()
Definition oleutil.h:269
@ xInternalPartError
Definition except.h:105
static void Check(HRESULT stat, TError err, LPCTSTR msg=0)
Definition ocstorag.cpp:58
TPointF is similar to TPoint, but uses floating variables rather than integers.
Definition geometry.h:181
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TPointL is similar to TPoint, but uses long rather than int variables.
Definition geometry.h:132
Iterator for Pointer Container.
Definition template.h:543
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
static auto GetClassesRoot() -> TRegKey &
Special predefined root key used by shell and OLE applications (HKEY_CLASSES_ROOT).
Definition registry.cpp:32
A registration parameter table, composed of a list of TRegItems.
Definition registry.h:531
The tagSIZE struct is defined as.
Definition geometry.h:234
Reference to reference counted string object TUString Lightweight reference object consisting of a po...
Definition string.h:67
char TCHAR
Definition cygwin.h:42
#define _tcscpy
Definition cygwin.h:79
#define _MAX_PATH
Definition cygwin.h:97
#define _T(x)
Definition cygwin.h:51
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
MouseDown
Definition occtrl.cpp:181
@ iwNew
Definition ocobject.h:104
TextAlign
Definition occtrl.cpp:127
@ ihLink
Definition ocobject.h:94
MouseMove
Definition occtrl.cpp:191
Height
Definition occtrl.cpp:160
DisplayAsDefault
Definition occtrl.cpp:133
const owl::uint16 tfNormal
Definition autodefs.h:397
DisplayName
Definition occtrl.cpp:135
void * ObjectPtr
Definition autodefs.h:84
bool HRSucceeded(HRESULT hr)
Definition defs.h:131
CustomEvent
Definition occtrl.cpp:210
Click
Definition occtrl.cpp:179
@ asAnyCommand
any command: method, property get/set, build
Definition autodefs.h:298
HRESULT OcRegisterControl(TCHAR *ocxPath)
Definition occtrl.cpp:1286
HRESULT(PASCAL * REGPROC)()
Definition occtrl.cpp:1258
KeyUp
Definition occtrl.cpp:199
Cancel
Definition occtrl.cpp:154
UserMode
Definition occtrl.cpp:129
const GUID & iid
Definition appdesc.h:328
ShowGrabHandles
Definition occtrl.cpp:131
Parent
Definition occtrl.cpp:152
const BCID cidBOleControl
Definition ocbocole.h:120
HRESULT OcUnregisterControl(CLSID ClassId)
Definition occtrl.cpp:1299
ForeColor
Definition occtrl.cpp:125
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned int uint
Definition number.h:25
Definition of TOcApp application connection class.
#define MAP_LOGHIM_TO_PIX(hiMetric, pixelsPerInch)
Definition ocbocole.h:177
#define MAP_PIX_TO_LOGHIM(pixel, pixelsPerInch)
Definition ocbocole.h:171
Definition of TOcControl class - Proxy object representing a control in.
Definition of TOcDocument Class.
#define _OCFFUNC(p)
Definition defs.h:47
#define HR_OK
Definition defs.h:74
#define HR_NOERROR
Definition defs.h:73
#define HR_FALSE
Definition defs.h:75
#define HR_FAIL
Definition defs.h:83
Definition of TOcStorage & TOcStream classes.
Definition of Compound Document TOcView Class.
#define OC_AMBIENT_GETLOCALEID
Definition ocview.h:827
#define OC_AMBIENT_GETFONT
Definition ocview.h:831
#define OC_AMBIENT_GETBACKCOLOR
Definition ocview.h:818
#define OC_AMBIENT_SETBACKCOLOR
Definition ocview.h:835
#define OC_AMBIENT_SETFONT
Definition ocview.h:848
#define OC_AMBIENT_SETSUPPORTSMNEMONICS
Definition ocview.h:839
#define OC_AMBIENT_SETFORECOLOR
Definition ocview.h:836
#define OC_AMBIENT_SETUSERMODE
Definition ocview.h:845
#define OC_CTRLEVENT_DBLCLICK
Definition ocview.h:807
#define OC_CTRLEVENT_MOUSEDOWN
Definition ocview.h:808
#define OC_AMBIENT_SETSHOWHATCHING
Definition ocview.h:840
#define OC_AMBIENT_GETUIDEAD
Definition ocview.h:821
#define OC_CTRLEVENT_PROPERTYREQUESTEDIT
Definition ocview.h:805
#define OC_AMBIENT_SETDISPLAYNAME
Definition ocview.h:846
#define OC_AMBIENT_SETMESSAGEREFLECT
Definition ocview.h:843
#define OC_AMBIENT_GETTEXTALIGN
Definition ocview.h:825
#define OC_AMBIENT_SETSCALEUNITS
Definition ocview.h:847
#define OC_CTRLEVENT_FOCUS
Definition ocview.h:803
#define OC_AMBIENT_SETDISPLAYASDEFAULT
Definition ocview.h:841
#define OC_AMBIENT_SETSHOWGRABHANDLES
Definition ocview.h:837
#define OC_AMBIENT_GETSHOWHATCHING
Definition ocview.h:823
#define OC_AMBIENT_GETSHOWGRABHANDLES
Definition ocview.h:820
#define OC_CTRLEVENT_MOUSEMOVE
Definition ocview.h:809
#define OC_AMBIENT_SETLOCALEID
Definition ocview.h:844
#define OC_AMBIENT_SETUIDEAD
Definition ocview.h:838
#define OC_AMBIENT_GETMESSAGEREFLECT
Definition ocview.h:826
#define OC_AMBIENT_GETUSERMODE
Definition ocview.h:828
#define OC_CTRLEVENT_KEYDOWN
Definition ocview.h:811
#define OC_CTRLEVENT_MOUSEUP
Definition ocview.h:810
#define OC_CTRLEVENT_CLICK
Definition ocview.h:806
#define OC_AMBIENT_SETTEXTALIGN
Definition ocview.h:842
#define OC_AMBIENT_GETDISPLAYNAME
Definition ocview.h:829
#define OC_CTRLEVENT_KEYUP
Definition ocview.h:812
#define OC_AMBIENT_GETDISPLAYASDEFAULT
Definition ocview.h:824
#define OC_CTRLEVENT_CUSTOMEVENT
Definition ocview.h:814
#define OC_VIEWTRANSFORMCOORDS
Definition ocview.h:802
#define OC_AMBIENT_GETSCALEUNITS
Definition ocview.h:830
#define OC_AMBIENT_GETSUPPORTSMNEMONICS
Definition ocview.h:822
#define OC_CTRLEVENT_PROPERTYCHANGE
Definition ocview.h:804
#define OC_AMBIENT_GETFORECOLOR
Definition ocview.h:819
#define OC_CTRLEVENT_ERROREVENT
Definition ocview.h:813
#define _IFUNC
Definition oleutil.h:28
#define OleStr(s)
Definition string.h:128
Symbol table element.
Definition autodefs.h:404
Base struct for all control event messages.
Definition occtrl.h:366