OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ocview.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of TOcView Class
7//----------------------------------------------------------------------------
8#include <ocf/pch.h>
9
10#include <ocf/oleutil.h>
11#include <ocf/ocstorag.h>
12#include <ocf/ocview.h>
13#include <ocf/ocremvie.h>
14#include <ocf/ocapp.h>
15#include <ocf/ocpart.h>
16#include <ocf/ocdata.h>
17#include <ocf/autodefs.h>
18#include <owl/private/memory.h>
19#include <owl/lclstrng.h>
20#include <owl/geometry.h>
21
22namespace ocf {
23
24using namespace owl;
25
27
28const TCHAR DocContent[] = _T("All");
29
30//
31/// Compatibility constructor
32//
34:
35 OcApp(doc.OcApp),
36 OcDocument(doc),
37 ContainerHost(new TOcContainerHostMsg),
38 ServerHost(new TOcServerHostMsg),
39 ActivePart(0),
40 LinkFormat(-1),
41 RegList(regList),
42 OcData(0),
43 Options(0),
44 Origin(0,0),
45 Extent(0,0),
46 BContainer(0),
47 BDocumentI(0),
48 BDocument(0),
49 BLDocumentI(0)
50{
52 AddRef(); // TUnknown defaults to 0, we need 1
53 if (regList)
55
56 // Necessary to initialize TOcPart for linking
57 //
59
61 (IUnknown*)(IBContainer*)this, cidBOleDocument))) {
62 BDocument->QueryInterface(IID_IBDocument, (LPVOID *)&BDocumentI);
63 Release();
64 }
65
67 (IUnknown*)(IBContainer*)this, cidBOleContainer))) {
68 if (regList) {
69 const _TCHAR* progid = regList->Lookup(OcApp.IsOptionSet(amDebug) ?
70 "debugprogid" : "progid");
71 if (progid &&
73 Release();
74 BLDocumentI->Init((TOcView*)this, OleStr(progid));
75 }
76 }
77 }
78
79 TRACEX(OcfRefCount, 1, "TOcView() @" << (void*)this);
80}
81
82//
83/// New, interface constructor
84//
86 TRegList* regList, IUnknown* outer)
87:
88 OcApp(doc.OcApp),
89 OcDocument(doc),
90 ContainerHost(ch),
91 ServerHost(sh),
92 ActivePart(0),
93 LinkFormat(-1),
94 RegList(regList),
95 OcData(0),
96 Options(0),
97 Origin(0,0),
98 Extent(0,0),
99 BContainer(0),
100 BDocumentI(0),
101 BDocument(0),
102 BLDocumentI(0)
103{
105 AddRef(); // TUnknown defaults to 0, we need 1
106 if (regList)
108
109 // Necessary to initialize TOcPart for linking
110 //
112
114 (IUnknown*)(IBContainer*)this, cidBOleDocument))) {
115 BDocument->QueryInterface(IID_IBDocument, (LPVOID *)&BDocumentI);
116 Release();
117 }
118
120 (IUnknown*)(IBContainer*)this, cidBOleContainer))) {
121 if (regList) {
122 const _TCHAR* progid = regList->Lookup(OcApp.IsOptionSet(amDebug) ?
123 "debugprogid" : "progid");
124 if (progid &&
126 Release();
127 BLDocumentI->Init((TOcView*)this, OleStr(progid));
128 }
129 }
130 }
131
132 TRACEX(OcfRefCount, 1, _T("TOcView() @") << (void*)this);
133}
134
135//
136//
137//
139{
140 Shutdown();
141}
142
143//
144/// Called from destructor of this class or of derived class to release helpers
145/// and host interfaces
146//
147void
149{
150 if (BContainer) {
151 BContainer->Release();
152 BContainer = 0;
153 }
154 if (BDocument) {
155 BDocument->Release();
156 BDocument = 0;
157 }
158 if (ContainerHost) {
160 ContainerHost = 0;
161 }
162 if (ServerHost) {
164 ServerHost = 0;
165 }
166}
167
168//
169/// Should only be called by the owner/creator of this object. Releases host
170/// interfaces and this.
171//
172void
174{
175 if (ContainerHost) {
177 ContainerHost = 0;
178 }
179 if (ServerHost) {
181 ServerHost = 0;
182 }
183 Release();
184}
185
186//
187/// Callback from TUnknown's implementation of QueryInterface
188//
191{
193 HRESULT hr;
194
195 static_cast<void>
196 (
197 // interfaces
198 //
204
205 // helpers (BContainer needed for embed/link from file)
206 //
207 || (BContainer && SUCCEEDED(hr = BContainer->QueryInterface(iid, iface)))
208 || (BDocument && SUCCEEDED(hr = BDocument->QueryInterface(iid, iface)))
209 );
210
211 // If the QueryInterface failed, try the TOcLinkView
212 //
213
214 if (hr == HR_NOINTERFACE && iid == IID_IDataObject) {
216 if (view)
217 hr = view->QueryInterface(iid, iface);
218 }
219
220 return hr;
221}
222
223//----------------------------------------------------------------------------
224
225//
226//
227//
228void
230{
231 // Don't register drag&drop target here since it will do QueryInterface
232 // in ComponentCreate before the outer is set up. RefCount will be messed
233 // up in this case. Keep Win==0 while initing BDocumentI. OcRemView will init
234 // later.
235 //
236 if (!embedded) {
239 }
240
241 // Make sure at least the BDocument gets its container & application ptrs
242 // setup
243 //
244 if (BDocumentI)
245 BDocumentI->Init(this);
246
247 if (!embedded)
248 Rename();
249
250 // Now keep window handle if embedded
251 //
252 if (embedded) {
255 }
256
257 EvActivate(true); // Default to being the active view on creation
258}
259
260//
261/// Obtain a TOcLinkView representing a moniker, the whole document by default
262//
265{
266 // Default to the whole document contents
267 //
268 if (!name)
270
272
273 // Ask the document whether an TOcLinkView corresponding to the item name
274 // already exists
275 //
277
278 // If not, Create an TOcLinkView for the linked doc/item the TOcLinkView
279 // should remember the moniker. If the host does not accept the link,
280 // then get rid of the linkview & return nothing.
281 //
282 if (!ocLinkView) {
283 ocLinkView = new TOcLinkView(this, RegList);
284 views.Add(ocLinkView);
285
286 ocLinkView->SetMoniker(OleStr(name));
287 ocLinkView->GetLinkRect();
288
291 views.Detach(ocLinkView, true);
292 return 0;
293 }
294 }
295
296 return ocLinkView;
297}
298
299//
300//
301//
302void
304{
305 if (BDocumentI)
307}
308
309//
310/// View is shuting down
311//
312void
314{
315 // Release the data provider object
316 //
317 if (OcData) {
319 OcData = 0;
320 }
321
322 if (BContainer && BDocument && BDocumentI) {
323 // Unregisters drag target
324 //
326
327 // Unregisters moniker for this container
328 //
329 if (BLDocumentI)
330 BLDocumentI->OnRename(0, 0);
331 }
332}
333
334//
335/// View is activated/deactivated
336//
337void
339{
340 // Set the current active document
341 //
342 if (BDocumentI)
344 if (activate)
346}
347
348//
349/// Returns true if view keeps focus, false if the inplace server got it
350//
351bool
353{
354 if (BDocumentI)
356
357 return OcApp.EvSetFocus(set);
358}
359
360//
361//
362//
363bool
370
371//
372//
373//
374bool
379
380//
381//
382//
383bool
388
389//
390//
391//
392void
394{
395 if (!BLDocumentI || OcDocument.GetName().empty())
396 return;
397
398 // update the file moniker
399 //
401
403}
404
405//----------------------------------------------------------------------------
406
407//
408/// Return the client rect for the view window
409//
410TRect
412{
413 TRect r;
414 const_cast<TOcView*>(this)->GetWindowRect(&r);
415 return r;
416}
417
418//
419/// Scroll this container window a give dx,dy
420//
421void
423{
424 Origin += TPoint(dx, dy);
425}
426
427void
429{
430 if (changeInfo.GetPart()) {
434 TRect auxRect=changeInfo.GetPart()->GetRect() - auxPoint;
435 ::InvalidateRect(GetWindow(), &auxRect, true);
436 }
437 }
438}
439
440//
441/// Activate a given part
442//
443bool
445{
446 if (part == ActivePart)
447 return true;
448
449 if (ActivePart && ActivePart->IsActive()) {
450 ActivePart->Activate(false);
451 ActivePart = 0;
452 }
453 if (part) {
454 if (!part->IsActive() && !part->Activate(true))
455 return false;
457 }
458 return true;
459}
460
461/*
462//
463//
464//
465TResult
466TOcView::ForwardEvent(int eventId, const void* param)
467{
468 return ::SendMessage(GetWindow(), WM_OCEVENT, eventId, (LPARAM)param);
469}
470
471//
472//
473//
474TResult
475TOcView::ForwardEvent(int eventId, TParam2 param)
476{
477 return ::SendMessage(GetWindow(), WM_OCEVENT, eventId, param);
478}
479*/
480
481//----------------------------------------------------------------------------
482// IBContains implementation
483
484//
485/// Ask the container to load document named 'path'
486//
489{
491 bool result = ContainerHost->EvOcViewOpenDoc(OleStr(path));
492 if (result) {
493
494 // Register this document in running object table
495 //
497 Rename();
498 }
499
500 return HRFailIfZero(result);
501}
502
503//
504//
505//
508{
510
512 TOcPart* ocPart = (TOcPart*)i.Current();
513 if (ocPart && strcmp(ocPart->GetName(), OleStr(name)) == 0) {
514 ocPart->FinishLoading(); // In case the part hasn't been loaded
515 if (SUCCEEDED(ocPart->QueryInterface(IID_IBPart, (LPVOID*)bpart))) {
516 return HR_NOERROR; // Now there is one more refcount on ocPart
517 }
518 }
519 }
520
521 // Ask the document whether an TOcLinkView corresponding to the item name
522 // already exists. Create one automatically if needed & let host know.
523 //
525
526 if (ocLinkView) {
527 if (SUCCEEDED(ocLinkView->QueryInterface(IID_IBPart, (LPVOID*)bpart)))
528 return HR_NOERROR; // Now there is one more refcount on ocRemView // !CQ ocLinkView?
529 else
530 return HR_FAIL; // This should never happen--its our own link view...
531 }
532
533 return HR_FAIL;
534}
535
536//----------------------------------------------------------------------------
537// IBDataNegotiator implementation
538
539//
540/// Format count
541//
544{
545 return FormatList.Count();
546}
547
548//
549/// Format retrieval
550//
553{
555
556 // Link source is FormatList[0]
557 // Link source will be the first format returned if Link is 0
558 // Link source will be the last format returned if Link is -1
559 //
560 index = (index - LinkFormat) % CountFormats();
561 FormatList[index]->GetFormatInfo(*fmt);
562 return HR_NOERROR;
563}
564
565//----------------------------------------------------------------------------
566// IBWindow implementation
567
568//
569//
570//
576
577//
578//
579//
582{
584
585 ::GetClientRect(GetWindow(), r);
586 return HR_NOERROR;
587}
588
589//
590//
591//
594{
595 // Delegate to app's view window to get its title
596 //
598 return (LPCOLESTR)OrgTitle;
599}
600
601//
602/// Append server's doc title info to our view's window title
603//
604void _IFUNC
615
616//
617//
618//
621{
622 return HR_FAIL; // Not called on BOle sites
623}
624
625//
626//
627//
630{
632
633 // Let individual views decide this
634 //
636}
637
638//
639//
640//
643{
644// PRECONDITION(space); see http://msdn.microsoft.com/en-us/library/ms687211.aspx
645 if (space) {
646 // Let individual views do this
648}
649 // The view don't require extra space;
650 return 0; //S_OK
651}
652
653//
654//
655//
658{
659 return HR_FAIL; // !CQ should do this
660}
661
662//
663//
664//
667{
668 return HR_FAIL; // !CQ should do this
669}
670
671//
672// The in-place server is done. Tell the container to restore its normal UI.
673//
674void _IFUNC
679
680//
681//
682//
685{
686 return HR_FAIL; // !CQ should do this
687}
688
689//
690//
691//
694{
695 return HR_FAIL; // !CQ should do this
696}
697
698//----------------------------------------------------------------------------
699// IBDropDest implementation
700
701//
702/// Drop a part onto this view. Creates the part based on initInfo, activating
703/// it as appropriate
704//
707{
709
710 initInfo->Container = this;
713 TOcDragDrop dd = {
715 };
716
718 return HR_NOERROR;
719
720 // Make sure that the view will accept this drop
721 //
723 return HR_FAIL;
724
725 // Create part now that view approved. BDocument calls AddSite on all views.
726 //
727 try {
728 new TOcPart(OcDocument, *dd.InitInfo, aobjPos);
729 }
730 catch (...) {
731 return HR_FAIL;
732 }
733
734 Rename();
735
736 return HR_NOERROR;
737}
738
739//
740/// Provide feedback to the users drag action in our container window
741//
742void _IFUNC
753
754//
755/// Ask the container view window to scroll itself in a given direction. Asked
756/// by the server when dragging or working in a clipped site.
757//
760{
761 // Have the real view do the work here.
762 //
764 return HR_FALSE;
765 return HR_NOERROR;
766}
767
768//
769//
770//
773{
774 return HR_NOERROR;
775}
776
777//----------------------------------------------------------------------------
778// IBContainer implementation
779
780//
781/// Locate the drop destination object. For default OC, it is just this view.
782/// Other extensions might have subtargets within the view.
783//
786{
787 *dropDest = this;
788 return HR_NOERROR;
789}
790
791//
792//
793//
796{
797 // See if we are in an MDI child & if so activate it
798 //
799 HWND hMdiChild = ::GetParent(GetWindow());
800 if (hMdiChild) {
801 HWND hMdiClient = ::GetParent(hMdiChild);
802 if (hMdiClient) {
803 HWND hMdiFrame = ::GetParent(hMdiClient);
804 while (::GetParent(hMdiFrame)) {
807 hMdiFrame = ::GetParent(hMdiFrame);
808 }
809 ::SendMessage(hMdiClient, WM_MDIACTIVATE, (WPARAM)hMdiChild, 0);
810 }
811 }
812
813 // Bring our app frame to the top, show it & give it focus. Also make sure
814 // that this view is on top & visible
815 //
816 ::SetWindowPos(OcApp.GetWindow(), HWND_TOP, 0, 0, 0, 0,
818 ::SetFocus(OcApp.GetWindow());
819 ::ShowWindow(GetWindow(), SW_SHOWNORMAL);
820 ::SetWindowPos(GetWindow(), HWND_TOP, 0, 0, 0, 0,
821 SWP_NOMOVE|SWP_NOSIZE | SWP_SHOWWINDOW); // why force a show window?
822
823 return HR_NOERROR;
824}
825
826//
827//
828//
831{
833 return HR_FALSE;
834 else
835 return HR_NOERROR;
836}
837
838//----------------------------------------------------------------------------
839// Clipboard related
840
841//
842/// Register the clipboard formats supported
843//
844bool
846{
847 // Register link source first
848 //
849 uint cfLinkSource = ::RegisterClipboardFormat(_T("Link Source"));
850 if (cfLinkSource)
851 FormatList.Add(new TOcFormat(cfLinkSource, _T("%s"), _T("%s"),
852 4 /*BOLE_MED_STREAM*/, true));
853
854 TCHAR key[32];
855 TCHAR val[128];
856 TCHAR* buf;
857 uint i = 0;
858 bool succ = true;
859
860 while (true) {
861 wsprintf(key, _T("format%d"), i);
863 buf = const_cast<LPTSTR>(regList[_W2A(key)]);
864 if (!buf)
865 break;
866 else {
867 // parse the value string
868 //
869 _tcscpy(val, buf);
870 buf = val;
871
873
874 for (int i = 0; i < 3; i++) {
875 TCHAR* current = _tcschr(buf, _T(','));
876 if (!current) {
877 succ = false;
878 break; // error
879 }
880
881 *current = 0;
882 switch (i) {
883 case 0: // Format id or name
884 if (_istdigit(*buf)) {
885 uint id = _ttoi(buf);
886 format->SetFormatId(id);
887 format->SetFormatName(id - 1, OcApp);
888 }
889 else { // register the user defined clipboard format
890 uint cf = ::RegisterClipboardFormat(buf);
891 if (cf == cfLinkSource)
892 format->SetLinkable();
893
894 format->SetFormatId(cf);
895 format->SetFormatName(buf, OcApp);
896 }
897 break;
898
899 case 1: // Aspect
900 format->SetAspect((uint)_ttoi(buf));
901 break;
902
903 case 2:
904 format->SetMedium((uint)_ttoi(buf)); // Storage medium
905 format->SetDirection((uint)_ttoi(current+1)); // Direction
906 break;
907 } // switch
908
909 buf = current + 1;
910 } // for
911
912 if (succ)
913 FormatList.Add(format); // Add to the format list
914 else
915 delete format;
916 } // else
917
918 i++;
919 } // while
920
921 return succ;
922}
923
924//
925//
926//
927bool
932
933//
934/// Paste native data into the container
935//
936bool
938{
939 bool result = false;
940 if (init.Where == iwHandle && init.How == ihEmbed) { // Could be native data
941 TOcFormat* format = FormatList.Find(init.Handle.DataFormat);
942 if (!format) {
943 return false; // Not my native data
944 }
945
946 TOcFormatData formatData(*format, 0, init.Handle.Data, true, where);
948 if (result)
949 init.ReleaseDataObject();
950 }
951
952 return result;
953}
954
955//
956//
957//
958bool
960{
961 LinkFormat = linking ? 0 : -1; // Whether or not to accept a link format
962 TOcInitInfo init(this);
963 bool result = OcApp.Paste(init);
964
965 if (result) {
966 result = PasteNative(init);
967 if (!result)
968 result = ContainerHost->EvOcViewPasteObject(init);
969 }
970
971 return result;
972}
973
974//-----------------------------------------------------------------------------
975// TOcFormat
976//
977
978//
979//
980//
982{
983 _TCHAR fstr[] = _T("%s");
984
985 Id = 0;
986 RegName[0] = 0;
987 _tcscpy(Name, fstr);
988 _tcscpy(ResultName, fstr);
989 Medium = ocrNull;
990 IsLinkable = false;
991 Aspect = 1; // content
992 Direction = 1; // get
993}
994
995//
996//
997//
999 uint medium, bool isLinkable,
1001{
1002 Id = (WORD)id;
1003 Medium = (ocrMedium)medium;
1004 IsLinkable = isLinkable;
1005 Aspect = aspect;
1006 Direction = direction;
1007
1008 RegName[0] = 0;
1009 _tcscpy(Name, name);
1010 _tcscpy(ResultName, resultName);
1011}
1012
1013//
1014//
1015//
1016void
1018{
1019 Id = f.Id;
1020 _tcscpy(Name, OleStr(f.Name));
1021 _tcscpy(ResultName, OleStr(f.ResultName));
1022 Medium = f.Medium;
1023 IsLinkable = f.IsLinkable;
1024}
1025
1026//
1027//
1028//
1029void
1031{
1032 f.Id = uint16(Id);
1033// lstrcpyW(f.Name, OleStr(Name));
1034 memcpy(f.Name, (LPCTSTR)OleStr(Name), (_tcslen(Name)+1)*2);
1035// lstrcpyW(f.ResultName, OleStr(ResultName));
1036 memcpy(f.ResultName, (LPCTSTR)OleStr(ResultName), (_tcslen(ResultName)+1)*2);
1037 f.Medium = (ocrMedium)Medium;
1038 f.IsLinkable = (BOOL)IsLinkable;
1039}
1040
1041//
1042//
1043//
1044void
1046{
1047 TOcFormatName* formatName = ocApp.GetNameList()[name];
1048 if (!formatName)
1049 return;
1050
1051 _tcscpy(RegName, name);
1052 _tcscpy(Name, formatName->GetName());
1053 _tcscpy(ResultName, formatName->GetResultName());
1054}
1055
1056//
1057//
1058//
1059void
1061{
1062 TOcFormatName* formatName = ocApp.GetNameList()[id];
1063 if (!formatName)
1064 return;
1065
1066 _tcscpy(Name, formatName->GetName());
1067 _tcscpy(ResultName, formatName->GetResultName());
1068}
1069
1070
1071//----------------------------------------------------------------------------
1072// TOcFormatList
1073//
1074
1075//
1076//
1077//
1081
1082//
1083//
1084//
1089
1090//
1091//
1092//
1093TOcFormat*
1095{
1096 for (TOcFormatListIter j((TOcFormatList&)*this); j; j++) {
1097 TOcFormat* format = (TOcFormat*)j.Current();
1098 if (format && format->GetFormatId() == id) {
1099 return format;
1100 }
1101 }
1102
1103 return 0;
1104}
1105
1106
1107//----------------------------------------------------------------------------
1108// TOcSiteRect
1109//
1110
1112:
1113 Rect(0,0,0,0), Part(0)
1114{
1115}
1116
1118:
1119 Rect(rect), Part(part)
1120{
1121}
1122
1123//----------------------------------------------------------------------------
1124// TOcScaleFactor
1125//
1126
1127//
1128//
1129//
1131:
1132 SiteSize(1, 1),
1133 PartSize(1, 1)
1134{
1135}
1136
1137//
1138//
1139//
1141{
1142 SiteSize.cx = siteRect.Width();
1143 SiteSize.cy = siteRect.Height();
1144
1146}
1147
1148//
1149//
1150//
1152{
1153 *this = scale;
1154}
1155
1156//
1157/// Assign a BOle structure to this scale factor
1158//
1161{
1162 SiteSize.cx = (int)scaleInfo.xN;
1163 SiteSize.cy = (int)scaleInfo.yN;
1164 PartSize.cx = (int)scaleInfo.xD;
1165 PartSize.cy = (int)scaleInfo.yD;
1166
1167 return *this;
1168}
1169
1170//
1171/// Assign one TOcScaleFactor to another
1172//
1175{
1176 SiteSize = scaleFactor.SiteSize;
1177 PartSize = scaleFactor.PartSize;
1178
1179 return *this;
1180}
1181
1182//
1183/// Copy a BOle scale factor structure
1184//
1185void
1187{
1188 scaleInfo.xN = SiteSize.cx;
1189 scaleInfo.yN = SiteSize.cy;
1190 scaleInfo.xD = PartSize.cx;
1191 scaleInfo.yD = PartSize.cy;
1192}
1193
1194//
1195/// Whether there is zoom factor
1196//
1197bool
1199{
1200 return SiteSize != PartSize;
1201}
1202
1203//
1204/// Change the scaling factor
1205//
1206void
1208{
1209 PartSize.cx = PartSize.cy = 100;
1210 SiteSize.cx = SiteSize.cy = percent;
1211}
1212
1213//
1214/// Get the scale percentage
1215//
1216uint16
1218{
1219 return (uint16)(((uint32)SiteSize.cx * 100 + (PartSize.cx >> 1)) / PartSize.cx);
1220}
1221
1222//
1223// Set scaling factor to 1
1224//
1225void
1227{
1228 PartSize.cx = PartSize.cy = 1;
1229 SiteSize.cx = SiteSize.cy = 1;
1230}
1231//
1233{
1234 return is >> sf.PartSize >> sf.SiteSize;
1235}
1236//
1238{
1239 return os << sf.PartSize << sf.SiteSize;;
1240}
1241//----------------------------------------------------------------------------
1242
1243bool
1248
1249LPCTSTR
1254
1255void
1260
1261bool
1266
1267bool
1272
1273bool
1278
1279bool
1284
1285bool
1290
1291bool
1296
1297bool
1302
1303bool
1308
1309bool
1314
1315bool
1320
1321bool
1326
1327//
1328//
1329//
1330TResult
1332{
1333 return ::SendMessage(EvOcGetWindow(), WM_OCEVENT, eventId, (LPARAM)param);
1334}
1335
1336//
1337//
1338//
1339TResult
1344
1345//----------------------------------------------------------------------------
1346
1347bool
1352
1353bool
1358
1359bool
1364
1365bool
1370
1371bool
1376
1377bool
1382
1383bool
1388
1389void
1394
1395bool
1400
1401bool
1406
1407bool
1412
1413bool
1418
1419bool
1424
1425bool
1430
1431bool
1436
1437bool
1442
1443bool
1448
1449bool
1454
1455//
1456//
1457//
1458TResult
1460{
1461 return ::SendMessage(EvOcGetWindow(), WM_OCEVENT, eventId, (LPARAM)param);
1462}
1463
1464//
1465//
1466//
1467TResult
1472
1473} // OCF namespace
1474
1475//==============================================================================
1476
OLE Automation Class Definitions.
#define CHECK(condition)
Definition checks.h:239
#define PRECONDITION(condition)
Definition checks.h:227
#define DIAG_DECLARE_GROUP(group)
Definition checks.h:404
#define TRACEX(group, level, message)
Definition checks.h:263
IBContainer – Supported by container app's document window.
Definition ocbocole.h:398
virtual HRESULT _IFUNC Init(IBContainer *)=0
virtual HRESULT _IFUNC EnumLinks(IBLinkInfo **)=0
virtual HRESULT _IFUNC OnSetFocus(BOOL)=0
virtual void _IFUNC OnClose()=0
virtual HRESULT _IFUNC BrowseLinks()=0
virtual void _IFUNC OnResize()=0
virtual HRESULT _IFUNC UpdateLinks()=0
virtual void _IFUNC OnActivate(BOOL)=0
IBDropDest – Supported by container app's document window and/or other areas inside the window.
Definition ocbocole.h:409
virtual HRESULT _IFUNC OnRename(IBLinkable *pContainer, LPCOLESTR name)=0
IBPart – Supported by server objects.
Definition ocbocole.h:241
virtual HRESULT _IFUNC Init(IBContains *pC, LPCOLESTR szProgId)=0
OCF Application class.
Definition ocapp.h:144
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
bool Paste(TOcInitInfo &initInfo)
Definition ocapp.cpp:374
bool BrowseClipboard(TOcInitInfo &initInfo)
Definition ocapp.cpp:368
bool EvSetFocus(bool set)
Definition ocapp.h:187
bool IsOptionSet(owl::uint32 option) const
Definition ocapp.h:302
virtual bool EvOcViewPasteObject(TOcInitInfo &init)=0
virtual bool EvOcViewBorderSpaceReq(const owl::TRect *rect)=0
virtual bool EvOcViewDrop(TOcDragDrop &ddInfo)=0
virtual void ReleaseOcObject()=0
virtual HWND EvOcGetWindow() const =0
virtual void EvOcViewSetTitle(LPCTSTR title)=0
virtual LPCTSTR EvOcViewTitle()=0
virtual bool EvOcViewScroll(TOcScrollDir scrollDir)=0
virtual bool EvOcViewBorderSpaceSet(const owl::TRect *rect)=0
virtual bool EvOcPartInvalid(TOcPartChangeInfo &part)=0
virtual bool EvOcViewDrag(TOcDragDrop &ddInfo)=0
virtual bool EvOcViewOpenDoc(LPCTSTR path)=0
virtual void SetWindow(HWND)
Definition ocview.h:528
virtual bool EvOcViewGetScale(TOcScaleFactor &scaleFactor)
Definition ocview.cpp:1322
virtual bool EvOcViewSetSiteRect(TOcSiteRect &sr)
Definition ocview.cpp:1310
virtual bool EvOcViewPasteObject(TOcInitInfo &init)
Definition ocview.cpp:1298
virtual bool EvOcPartInvalid(TOcPartChangeInfo &part)
Definition ocview.cpp:1292
virtual bool EvOcViewPartActivate(TOcPart &ocPart)
Definition ocview.cpp:1316
virtual bool EvOcViewOpenDoc(LPCTSTR path)
Definition ocview.cpp:1244
virtual bool EvOcViewBorderSpaceSet(const owl::TRect *rect)
Definition ocview.cpp:1268
virtual bool EvOcViewDrop(TOcDragDrop &ddInfo)
Definition ocview.cpp:1280
virtual HWND EvOcGetWindow() const
Definition ocview.h:672
virtual bool EvOcViewDrag(TOcDragDrop &ddInfo)
Definition ocview.cpp:1274
virtual LPCTSTR EvOcViewTitle()
Definition ocview.cpp:1250
owl::TResult ForwardEvent(int eventId, const void *param)
Definition ocview.cpp:1331
virtual bool EvOcViewBorderSpaceReq(const owl::TRect *rect)
Definition ocview.cpp:1262
virtual void EvOcViewSetTitle(LPCTSTR title)
Definition ocview.cpp:1256
virtual bool EvOcViewGetSiteRect(TOcSiteRect &sr)
Definition ocview.cpp:1304
virtual bool EvOcViewScroll(TOcScrollDir scrollDir)
Definition ocview.cpp:1286
void Disconnect()
Disconnect from the site.
Definition ocdata.cpp:106
OC Document class, holds parts & is a owner of views.
Definition ocdoc.h:43
TOcLinkCollection & GetViews()
Definition ocdoc.h:53
void SetActiveView(TOcView *view)
Definition ocdoc.cpp:340
void RenameParts(IBRootLinkable *bLDocumentI)
Definition ocdoc.cpp:301
void SetName(const owl::tstring &newName)
Notify container that doc pathname has changed.
Definition ocdoc.cpp:349
owl::tstring GetName() const
Definition ocdoc.h:82
TOcPartCollection & GetParts()
Definition ocdoc.h:51
Used to obtain the native clipboard format data.
Definition ocview.h:416
Clipboard format wrapper.
Definition ocview.h:55
void GetFormatInfo(TOcFormatInfo &f)
Definition ocview.cpp:1030
void operator=(const TOcFormatInfo &)
Definition ocview.cpp:1017
void SetFormatName(TCHAR *name, TOcApp &ocApp)
Definition ocview.cpp:1045
Container of clipboard formats with iterator.
Definition ocview.h:101
void Clear(int del=1)
Definition ocview.h:108
owl::uint Count() const
Definition ocview.h:112
int Find(const TOcFormat *format) const
Definition ocview.h:111
int Add(TOcFormat *format)
Definition ocview.h:109
Clipboard format name.
Definition ocapp.h:52
TOcInitHow How
Definition ocobject.h:120
owl::uint32 ReleaseDataObject()
Definition ocobject.h:114
TOcInitWhere Where
Definition ocobject.h:121
struct ocf::TOcInitInfo::@52::@54 Handle
Used to obtain the item name for building monikers.
Definition ocview.h:403
View/Data change info.
Definition ocpart.h:216
OC part class represents an embeded or linked part in a document.
Definition ocpart.h:38
bool Activate(bool activate)
Definition ocpart.cpp:642
bool IsActive() const
Definition ocpart.h:79
Used to obtain the size of the rectangle that encloses the selection.
Definition ocview.h:364
Use when doing parts save and load.
Definition ocview.h:326
owl::uint16 GetScale()
Get the scale percentage.
Definition ocview.cpp:1217
owl::TSize PartSize
Definition ocview.h:471
void GetScaleFactor(TOcScaleInfo &scaleInfo) const
Copy a BOle scale factor structure.
Definition ocview.cpp:1186
owl::TSize SiteSize
Definition ocview.h:470
void SetScale(owl::uint16 percent)
Change the scaling factor.
Definition ocview.cpp:1207
TOcScaleFactor & operator=(const TOcScaleInfo &scaleInfo)
Assign a BOle structure to this scale factor.
Definition ocview.cpp:1160
bool IsZoomed()
Whether there is zoom factor.
Definition ocview.cpp:1198
virtual bool EvOcViewSetLink(TOcLinkView &view)=0
virtual bool EvOcViewClipData(TOcFormatData &format)=0
virtual void SetWindow(HWND)
Definition ocview.h:633
virtual void ReleaseOcObject()=0
virtual bool EvOcViewDrag(TOcDragDrop &ddInfo)
Definition ocview.cpp:1396
virtual bool EvOcViewSetData(TOcFormatData &format)
Definition ocview.cpp:1360
virtual bool EvOcViewAttachWindow(bool attach)
Definition ocview.cpp:1384
virtual bool EvOcViewClose()
Definition ocview.cpp:1438
virtual bool EvOcViewClipData(TOcFormatData &format)
Definition ocview.cpp:1354
virtual bool EvOcViewPartSize(TOcPartSize &size)
Definition ocview.cpp:1366
virtual bool EvOcViewSetScale(TOcScaleFactor &scaleFactor)
Definition ocview.cpp:1444
virtual bool EvOcViewInsMenus(TOcMenuDescr &sharedMenu)
Definition ocview.cpp:1426
virtual bool EvOcViewBreakLink(TOcLinkView &view)
Definition ocview.cpp:1408
virtual bool EvOcViewGetPalette(LOGPALETTE **palette)
Definition ocview.cpp:1414
virtual bool EvOcViewGetItemName(TOcItemName &item)
Definition ocview.cpp:1348
virtual bool EvOcViewPaint(TOcViewPaint &vp)
Definition ocview.cpp:1378
virtual HWND EvOcGetWindow() const
Definition ocview.h:727
virtual bool EvOcViewSavePart(TOcSaveLoad &ocSave)
Definition ocview.cpp:1372
virtual bool EvOcViewLoadPart(TOcSaveLoad &ocLoad)
Definition ocview.cpp:1420
virtual void EvOcViewSetTitle(LPCTSTR title)
Definition ocview.cpp:1390
virtual bool EvOcViewSetLink(TOcLinkView &view)
Definition ocview.cpp:1402
virtual bool EvOcViewShowTools(TOcToolBarInfo &tbi)
Definition ocview.cpp:1432
virtual bool EvOcViewDoVerb(owl::uint verb)
Definition ocview.cpp:1450
owl::TResult ForwardEvent(int eventId, const void *param)
Definition ocview.cpp:1459
The TOcView partner is a container (viewer) of a given (server/client) document.
Definition ocview.h:136
HRESULT _IFUNC FindDropDest(owl::TPoint *, IBDropDest **)
Locate the drop destination object.
Definition ocview.cpp:785
owl::TRect GetWindowRect() const
Return the client rect for the view window.
Definition ocview.cpp:411
TOcDocument & OcDocument
Our OC document object.
Definition ocview.h:270
IUnknown * BContainer
Container helper object.
Definition ocview.h:264
virtual void ReleaseObject()
Should only be called by the owner/creator of this object.
Definition ocview.cpp:173
virtual bool EvSetFocus(bool set)
Returns true if view keeps focus, false if the inplace server got it.
Definition ocview.cpp:352
HRESULT _IFUNC Scroll(TOcScrollDir scrollDir)
Ask the container view window to scroll itself in a given direction.
Definition ocview.cpp:759
friend class _ICLASS TOcPart
Definition ocview.h:293
void _IFUNC AppendWindowTitle(LPCOLESTR title)
Append server's doc title info to our view's window title.
Definition ocview.cpp:605
HRESULT _IFUNC BringToFront()
Definition ocview.cpp:795
owl::ulong _IFUNC AddRef()
Definition ocview.h:197
friend class _ICLASS TOcLinkView
Definition ocview.h:295
owl::ulong _IFUNC Release()
Definition ocview.h:198
HRESULT _IFUNC AllowInPlace()
Definition ocview.cpp:830
bool UpdateLinks()
Definition ocview.cpp:384
owl::TRegList * RegList
Definition ocview.h:288
void _IFUNC RestoreUI()
Definition ocview.cpp:675
LPCOLESTR _IFUNC GetWindowTitle()
Definition ocview.cpp:593
TOcPart * ActivePart
Currently active part, if any.
Definition ocview.h:278
HRESULT QueryObject(const IID &iid, void **iface)
Callback from TUnknown's implementation of QueryInterface.
Definition ocview.cpp:190
HRESULT _IFUNC Accelerator(MSG *)
Definition ocview.cpp:684
owl::TString OrgTitle
Original window title string.
Definition ocview.h:286
HRESULT _IFUNC SetFrameMenu(HMENU)
Definition ocview.cpp:666
void EvResize()
Definition ocview.cpp:303
HRESULT _IFUNC InsertContainerMenus(HMENU, TOcMenuWidths *)
Definition ocview.cpp:657
bool ActivatePart(TOcPart *part)
Activate a given part.
Definition ocview.cpp:444
HRESULT _IFUNC Drop(TOcInitInfo *, owl::TPoint *, const owl::TRect *)
Drop a part onto this view.
Definition ocview.cpp:706
void Shutdown()
Called from destructor of this class or of derived class to release helpers and host interfaces.
Definition ocview.cpp:148
TOcDataProvider * OcData
Dataprovider representing this view.
Definition ocview.h:289
TOcContainerHost * ContainerHost
The hosting app's container object.
Definition ocview.h:272
HWND _IFUNC GetWindow()
Definition ocview.cpp:572
bool BrowseClipboard(TOcInitInfo &initInfo)
Definition ocview.cpp:928
IUnknown * BDocument
Document helper object.
Definition ocview.h:262
owl::uint _IFUNC CountFormats()
Format count.
Definition ocview.cpp:543
bool BrowseLinks()
Definition ocview.cpp:375
void InvalidatePart(TOcPartChangeInfo &changeInfo)
Definition ocview.cpp:428
bool EnumLinks(IBLinkInfo **)
Definition ocview.cpp:364
virtual void Rename()
Definition ocview.cpp:393
HRESULT _IFUNC RequestBorderSpace(const owl::TRect *)
Definition ocview.cpp:629
void SetupWindow(HWND hWin, bool embedded=false)
Definition ocview.cpp:229
HRESULT _IFUNC SetStatusText(LPCOLESTR text)
Definition ocview.cpp:620
HRESULT _IFUNC GetFormat(owl::uint, TOcFormatInfo *)
Format retrieval.
Definition ocview.cpp:552
TOcLinkView * GetDocLink(LPCTSTR name=0)
Obtain a TOcLinkView representing a moniker, the whole document by default.
Definition ocview.cpp:264
HRESULT _IFUNC GetPart(IBPart **, LPCOLESTR)
Definition ocview.cpp:507
owl::TPoint Origin
Definition ocview.h:282
owl::tstring WinTitle
Definition ocview.h:284
IBRootLinkable * BLDocumentI
RootLinkable interface on the container.
Definition ocview.h:265
bool RegisterClipFormats(owl::TRegList &regList)
Register the clipboard formats supported.
Definition ocview.cpp:845
void _IFUNC DragFeedback(owl::TPoint *, const owl::TRect *, TOcMouseAction, owl::uint, HRESULT &hr)
Provide feedback to the users drag action in our container window.
Definition ocview.cpp:743
owl::TPoint GetOrigin() const
Definition ocview.h:166
bool IsOptionSet(owl::uint32 option) const
Definition ocview.h:857
bool Paste(bool linking=false)
Definition ocview.cpp:959
TOcFormatList FormatList
Definition ocview.h:285
void EvActivate(bool activate)
View is activated/deactivated.
Definition ocview.cpp:338
TOcView(TOcDocument &doc, TOcContainerHost *ch, TOcServerHost *sh, owl::TRegList *regList=0, IUnknown *outer=0)
New, interface constructor.
Definition ocview.cpp:85
TOcApp & OcApp
Our OC application object.
Definition ocview.h:269
TOcServerHost * ServerHost
The hosting app's server object.
Definition ocview.h:273
IBDocument * BDocumentI
Document interface on the document.
Definition ocview.h:263
HRESULT _IFUNC SetBorderSpace(const owl::TRect *)
Definition ocview.cpp:642
int LinkFormat
adjustment for format count
Definition ocview.h:287
HRESULT _IFUNC GetScrollRect(owl::TRect *)
Definition ocview.cpp:772
HRESULT _IFUNC GetAccelerators(HACCEL *, int *)
Definition ocview.cpp:693
bool PasteNative(TOcInitInfo &init, owl::TPoint *where=0)
Paste native data into the container.
Definition ocview.cpp:937
virtual void EvClose()
View is shuting down.
Definition ocview.cpp:313
HRESULT _IFUNC Init(LPCOLESTR)
Ask the container to load document named 'path'.
Definition ocview.cpp:488
void ScrollWindow(int dx, int dy)
Scroll this container window a give dx,dy.
Definition ocview.cpp:422
IUnknown * SetOuter(IUnknown *outer=0)
Definition oleutil.h:298
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
Iterator for Pointer Container.
Definition template.h:543
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
A registration parameter table, composed of a list of TRegItems.
Definition registry.h:531
The tagSIZE struct is defined as.
Definition geometry.h:234
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition objstrm.h:391
Base class for writing streamable objects.
Definition objstrm.h:480
char TCHAR
Definition cygwin.h:42
#define _istdigit
Definition cygwin.h:70
#define _tcscpy
Definition cygwin.h:79
#define _ttoi
Definition cygwin.h:64
#define _tcslen
Definition cygwin.h:74
#define _T(x)
Definition cygwin.h:51
#define _tcschr
Definition cygwin.h:85
Classes for window system geometry.
int LoadString(uint id, TCHAR *buf, int maxChars) const
Loads a string resource identified by id into the buffer pointed to by buff.
Definition module.cpp:586
ocrMedium
Medium: means of data transfer.
Definition registry.h:659
@ ocrNull
Definition registry.h:660
Include for OC, gets common headers when precompiled headers are enabled.
TLocaleString - localized name support.
Reliable platform independent header for common memory and string functions.
#define _W2A(lpw)
Definition memory.h:219
#define _USES_CONVERSION
Definition memory.h:217
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
HRESULT HRFailIfZero(int bexpr)
Definition defs.h:126
@ iwHandle
Definition ocobject.h:105
const TCHAR DocContent[]
Definition ocview.cpp:28
@ ihEmbed
Definition ocobject.h:95
TOcScaleFactor & sf
Definition ocview.cpp:1233
const BCID cidBOleContainer
Definition ocbocole.h:115
bool HRSucceeded(HRESULT hr)
Definition defs.h:131
TOcMouseAction
Definition ocobject.h:46
const GUID & iid
Definition appdesc.h:328
@ voNoInPlace
Definition ocview.h:45
@ amDebug
user requested launching for debugging
Definition ocreg.h:85
TOcScrollDir
Definition ocobject.h:52
const BCID cidBOleDocument
Definition ocbocole.h:111
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
Definition color.h:498
unsigned long uint32
Definition number.h:34
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
LRESULT TResult
Result type.
Definition dispatch.h:52
unsigned short uint16
Definition number.h:33
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
TModule & GetGlobalModule()
Definition global.cpp:48
owl::ipstream & operator>>(owl::ipstream &is, TColor &c)
Extract the color value from a persistent input stream.
Definition color.h:489
Definition of TOcApp application connection class.
#define WM_OCEVENT
Definition ocapp.h:337
Definition of TOcDataProvider Class.
#define HR_NOINTERFACE
Definition defs.h:79
#define _OCFCFUNC(p)
Definition defs.h:48
#define HR_NOERROR
Definition defs.h:73
#define HR_FALSE
Definition defs.h:75
#define HR_FAIL
Definition defs.h:83
Definition of TOcPart class.
Definition of TOcRemView Class.
Definition of TOcStorage & TOcStream classes.
Definition of Compound Document TOcView Class.
#define OC_VIEWBREAKLINK
Definition ocview.h:789
#define OC_VIEWGETITEMNAME
Definition ocview.h:779
#define OC_VIEWATTACHWINDOW
Definition ocview.h:787
#define OC_VIEWGETPALETTE
Definition ocview.h:790
#define OC_VIEWINSMENUS
Definition ocview.h:794
#define OC_VIEWDOVERB
Definition ocview.h:798
#define OC_VIEWSAVEPART
Definition ocview.h:783
#define OC_VIEWDROP
Definition ocview.h:768
#define OC_VIEWLOADPART
Definition ocview.h:793
#define OC_VIEWBORDERSPACESET
Definition ocview.h:766
#define OC_VIEWSETLINK
Definition ocview.h:788
#define OC_VIEWSETSITERECT
Definition ocview.h:774
#define OC_VIEWGETSCALE
Definition ocview.h:776
#define OC_VIEWPARTSIZE
Definition ocview.h:782
#define OC_VIEWSHOWTOOLS
Definition ocview.h:795
#define OC_VIEWPAINT
Definition ocview.h:784
#define OC_VIEWCLOSE
Definition ocview.h:796
#define OC_VIEWGETSITERECT
Definition ocview.h:773
#define OC_VIEWSETSCALE
Definition ocview.h:797
#define OC_VIEWBORDERSPACEREQ
Definition ocview.h:765
#define OC_VIEWCLIPDATA
Definition ocview.h:780
#define OC_VIEWPASTEOBJECT
Definition ocview.h:771
#define OC_VIEWPARTACTIVATE
Definition ocview.h:775
#define OC_VIEWDRAG
Definition ocview.h:767
#define OC_VIEWTITLE
Definition ocview.h:763
#define OC_VIEWSETTITLE
Definition ocview.h:764
#define OC_VIEWPARTINVALID
Definition ocview.h:770
#define OC_VIEWSCROLL
Definition ocview.h:769
#define OC_VIEWOPENDOC
Definition ocview.h:762
#define OC_VIEWSETDATA
Definition ocview.h:781
Low level OLE Utility class definitions.
#define _IFUNC
Definition oleutil.h:28
#define OleStr(s)
Definition string.h:128
For viewdrop & viewdrag.
Definition ocview.h:303
OLECHAR Name[32]
Definition ocobject.h:189
owl::ocrMedium Medium
Definition ocobject.h:191
OLECHAR ResultName[32]
Definition ocobject.h:190
For part adornment painting over part, & painting views.
Definition ocview.h:312