OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
olewindo.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 TOleWindow. Window class that supports OLE 2
7/// container & server using OCF TOcView & TOcRemView
8//----------------------------------------------------------------------------
9#include <ocf/pch.h>
10
11#include <owl/window.h>
12#include <owl/gdiobjec.h>
13#include <owl/scroller.h>
14#include <ocf/ocdoc.h>
15#include <ocf/ocview.h>
16#include <ocf/occtrl.h>
17#include <ocf/oleframe.h>
18#include <ocf/olewindo.h>
19#include <owl/uimetric.h>
20#include <owl/edit.rh>
21#include <owl/docview.rh>
22#include <ocf/oleview.rh>
23
24namespace ocf {
25
26using namespace owl;
27
28using namespace std;
29
31DIAG_DECLARE_GROUP(OcfRemView);//????????????????????????????????????????????????????????
32
33///----------------------------------------------------------------------------
34/// Size of rectangle in two clks must occur to be a doubleClick
35/// ---- moved in StartDrag ----
36/// TSize DblClkDelta(TUIMetric::CxDoubleClk/2,
37/// TUIMetric::CyDoubleClk/2);
38
39//----------------------------------------------------------------------------
40// TOleClientDC
41//
42
43//
44/// Constructs a TOleClientDC object . The parameter win references the window that
45/// TOleClientDC uses to create a device context (DC). If the scale parameter is
46/// true, TOleClientDC takes care of scaling. However, if your application handles
47/// scaling, you can pass scale as false.
48/// Scrolling is controlled by the presence of a scroller (TScroller). TOleClientDC
49/// by default takes care of both scaling and scrolling.
50//
52:
53 TClientDC(win)
54{
55 win.SetupDC(*this, scale);
56}
57
58//----------------------------------------------------------------------------
59// TOleWindow
60//
61
78
80
81 EV_COMMAND(CM_EDITDELETE, CmEditDelete),
85 EV_COMMAND(CM_EDITCOPY, CmEditCopy),
87 EV_COMMAND(CM_EDITPASTE, CmEditPaste),
89 EV_COMMAND(CM_EDITPASTESPECIAL, CmEditPasteSpecial),
91 EV_COMMAND(CM_EDITPASTELINK, CmEditPasteLink),
93 EV_COMMAND(CM_EDITINSERTOBJECT, CmEditInsertObject),
94
95 EV_COMMAND(CM_EDITINSERTCONTROL, CmEditInsertControl),
98
103 EV_COMMAND(CM_EDITCONVERT, CmEditConvert),
105 EV_COMMAND(CM_EDITSHOWOBJECTS, CmEditShowObjects),
106
107 EV_MESSAGE(WM_OCEVENT, EvOcEvent),
108/// EV_OC_VIEWDISCARDUNDO, // !CQ not processing this yet...
109
110 // Container specific messages
111 //
125
126 // Server specific messages
127 //
145
146 // Ambient properties
147 //
176
177 // Standard Events
178 //
181
182
183 // Ctrl events
184 //
197
199
200//
201/// Constructs a TOleWindow object associated with the specified parent window and
202/// module instance.
203//
205:
206 TWindow(parent, 0, module),
207 Pos(0, 0, 0, 0),
208 Remote(false),
209 ShowObjects(false)
210{
211 // Initialize virtual base, in case the derived-most used default ctor
212 //
213 TWindow::Init(parent, 0, module);
214
215 // Derived class will need to create a OcDocument object to hold the OLE
216 // parts that we create and a OcView to provide OLE services
217 //
218 OcApp = 0;
219 OcDoc = 0;
220 OcView = 0;
221
222 Init();
223}
224
225//
226/// Initializes the TOleWindow object with the appropriate window style and
227/// initializes the necessary data members (for example, sets the accelerator ID to
228/// IDA_OLEVIEW).
229//
230void
232{
233 // Clip children to not paint on in-place servers, & clip siblings to not
234 // paint on floating tool palettes
235 //
236 Attr.Style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
237
238 Attr.AccelTable = IDA_OLEVIEW;
240 DragPart = 0;
241 DragDC = 0;
242
243 // Minimum part size
244 //
245 HDC dc = GetDC(0);
246 MinWidth = GetDeviceCaps(dc, LOGPIXELSX) / 4;
247 MinHeight = GetDeviceCaps(dc, LOGPIXELSY) / 4;
248 ReleaseDC(0, dc);
249
250 // Snag the OcApp from the TOleFrame object for quick reference
251 //
253 CHECK(olefr);
254 OcApp = olefr->GetOcApp();
255 OcApp->AddRef();
256}
257
258//
259/// Checks to see if there are any open views, and, if no open views exist, destroys
260/// the TOleWindow object.
261//
263{
264 // Let the OC objects go. They will delete themselves when they can
265 // If it's a remote view, then the last release is called by the container.
266 //
267 if (OcDoc)
268 OcDoc->Close(); // close all the embedded parts first
269 if (OcView && !IsRemote()) {
270 OcView->ReleaseObject(); // use ReleaseObject here to tell it we are gone
271 OcView = 0;
272 }
273
274 delete OcDoc;
275 if (OcApp) {
276 OcApp->Release();
277 OcApp = 0;
278 }
279}
280
281//
282/// Establishes a connection between the TOcView object and the view's HWND so the
283/// view can send notification messages to the window.
284//
285void
287{
288 if (!OcView)
289 CreateOcView(0, false, 0); // don't have much context by this time
290 CHECK(OcView);
292 OcView->SetupWindow(*this, IsRemote());
293}
294
295//
296/// Called to perform the actual setting up of the OcView member
297//
298/// Creates an ObjectComponents view associated with the embedded object. Associates
299/// the view with the document template specified in tpl. If isEmbedded is true, a
300/// remote view is created (that is, a TOcRemView instead of a TOcView). The outer
301/// parameter refers to the IUnknown interface with which the view will aggregate
302/// itself.
303///
304/// Derived class needs to construct the TOcView/TOcRemView here & return it
305//
306TOcView*
308{
309 if (!OcDoc)
310 OcDoc = new TOcDocument(*GetOcApp());
311
312 if (!OcView) {
313 TRegList* regList = link ? &link->GetRegList() : 0;
314
315 // Create a remote view on the server document if it embeded, else make a
316 // normal container view [capable of hosting OCXes or 'normal' servers]
317 //
318 if (isRemote)
320 else
321
322 // By default, our 32-bit container support can 'hold' embedded objects
323 // and OCX controls. So we'll default to a 'TOcxView'. However, this
324 // can be optimized if the container will never contain any OLE controls.
325 //
326#if !defined(OWL_NO_OCX_CONTAINER_SUPPORT)
328#endif
329
331 }
332 return OcView;
333}
334
335//
336/// Overrides the usual EvCommandEnable message in order to enable the OLE verbs
337/// from CM_EDITFIRSTVERB to CM_EDITLASTVERB. These commands enable the OLE-specific
338/// Edit menu selections, such as Edit, Open, and Play. Many of the other commands
339/// are passed to TWindow::EvCommand for normal processing.
340/// If a window is embedded, however, TOleWindow calls upon TWindow's
341/// RouteCommandEnable to perform command enabling.
342//
343void
345{
346 if (CM_EDITFIRSTVERB <= commandEnabler.GetId() && commandEnabler.GetId() <= CM_EDITLASTVERB) {
348 }
349 else if (IsRemote()) {
350 // Get the focus, in case it is a child that should receive the cmds
351 // fall back to this window in case the Ole menu bar stole focus!
352 //
356
358 }
359 else {
361 }
362}
363
364//
365/// Overrides the usual EvCommand message to handle the OLE verbs from
366/// CM_EDITFIRSTVERB to CM_EDITLASTVERB. These commands, which are defined in
367/// oleview.rh, correspond to the OLE-specific Edit menu selections such as Edit,
368/// Open, and Play. All of the other commands are passed to TWindow::EvCommand for
369/// normal processing.
370//
373{
374 TRACEX(OcfRemView, 1, _T("TOleWindow::EvCommand - id(") << id << _T("), ctl(") <<\
375 hex << static_cast<void*>(hCtl) << _T("), code(") << notifyCode << _T(")"));
376
377 if (hCtl == 0) {
378 if (CM_EDITFIRSTVERB <= id && id <= CM_EDITLASTVERB) {
380 return 0;
381 }
382 }
384}
385
386//
387/// Intercept CanClose() to interpose OpenEdit semantics. OLE2 servers don't
388/// prompt the user on close--just save & close.
389///
390/// Returns true if the window can be closed. Checks all the server's child windows'
391/// CanClose functions, which must return true before the window can be closed.
392/// Terminates any open editing transactions before closing the window; otherwise,
393/// passes control to TWindow::CanClose.
394///
395bool
397{
398 // We don't want to close the view for DLL servers
399 //
402 CHECK(olefr);
403 olefr->ShowWindow(SW_HIDE);
404 OleShutDown();
405 return false;
406 }
407
408 if (GetOcRemView() || TWindow::CanClose()) {
409 if (OcDoc)
410 OcDoc->Close();
411 return true;
412 }
413 return false;
414}
415
416//
417/// Invalidates the area where the embedded object exists. The server uses this
418/// function to tell OLE that the part (the embedded object), has changed. OLE then
419/// asks the server to redraw the part into a new metafile so that OLE can redraw
420/// the object for the container application even when the server application is not
421/// active.
422//
423void
429
430//
431/// Checks whether the window is in Open-Edit mode.
432//
433bool
435{
436 TOcRemView* ocRemView = const_cast<TOleWindow*>(this)->GetOcRemView();
437 return ocRemView && ocRemView->GetState() == TOcRemView::OpenEditing;
438}
439
440//
441//
442//
443TOcPart*
445{
446 TRect rect;
447
448 // Pass size request on if caller does not specify
449 //
450 if (!pos) {
451 pos = &rect;
453 }
454
455 TOcPart* part;
456 try {
457 part = new TOcPart (*GetOcDoc());
458 part->Init(&initInfo, *pos);
460 OcView->Rename();
462 }
463 catch (TXOle& /*xole*/) {
464 return 0;
465 }
466 return part;
467}
468
469//
470//
471//
472TOcPart*
474{
476
477 // Initialize InitInfo structure
478 //
479 initInfo.CId = (BCID) &objIID; // Object's GUID
480 initInfo.Where = iwNew; // Flag it's a new embedding
481 initInfo.How = ihEmbed; // Want embedded
482
483 return InsertObject(initInfo, pos);
484}
485
486//
487//
488//
489TOcPart*
491{
492 // Get IID of OCX from specified ProgID
493 //
496
497 if (FAILED(hr)) {
498 return 0;
499 }
500 return InsertObject(objIID, pos);
501}
502
503
504//
505//
506//
509{
510 TRect rect;
511
512 // Pass size request on if caller does not specify
513 //
514 if (!pos) {
515 pos = &rect;
517 }
518
519 // If user did not specify the size (i.e. right & bottom), use
520 // some default values...
521 //
522 if (pos->left == pos->right)
523 pos->right = pos->left + 100;
524 if (pos->top == pos->bottom)
525 pos->bottom = pos->top + 100;
526
527 TOcControl* ctrl;
528 try {
529 ctrl = new TOcControl (*GetOcDoc());
530 ctrl->Init(&initInfo, *pos);
531 SetSelection(ctrl);
532 OcView->Rename();
534 ctrl->SetId(id);
535 }
536 catch (TXOle& /*xole*/) {
537 return 0;
538 }
539 return ctrl;
540}
541
542//
543//
544//
547{
549
550 // Initialize InitInfo structure
551 //
552 initInfo.CId = (BCID) &ocxIID; // OCX's GUID
553 initInfo.Where = iwNewOcx; // Flag it's an OCX
554 initInfo.How = ihEmbed; // Want embedded
555
556 return InsertControl(initInfo, pos, id);
557}
558
559//
560//
561//
564{
565 // Get IID of OCX from specified ProgID
566 //
569
570 if (FAILED(hr)) {
571 return 0;
572 }
573 return InsertControl(ocxIID, pos, id);
574}
575
576
577//
578//
579//
582{
583 // Iterate through all parts of this window
584 //
585 for (TOcPartCollectionIter i(GetOcDoc()->GetParts()); i; i++) {
586 TOcPart* p = *i;
587
588 // NOTE: Here we'll simply dynamic_cast the TOcPart pointer to a
589 // TOcControl. A more OLEish approach would be to querry for
590 // a control interface [IBControl for example] as a safety
591 // measure first.
592 //
594 if (pCtrl) {
596 if (SUCCEEDED(pCtrl->QueryServer(IID_IOleObject, (void**)&pOleObject))) {
597
598 // !BB Could add a call to pOleObject->GetUserType to retrieve
599 // !BB the name of the control for debugging purposes...
601 if (SUCCEEDED(pOleObject->GetUserClassID(&userClsId)) &&
602 userClsId == ocxIID) {
603 if (id == 0 || pCtrl->GetId() == id) {
604 pOleObject->Release();
605 return pCtrl;
606 }
607 }
608 pOleObject->Release();
609 }
610 }
611 }
612
613 // Control proxy was not found
614 //
615 return 0;
616}
617
618
619//
620/// Enables the FileClose command, which lets the user exit from the window view.
621//
622void
624{
625 // if open editing server, reflect the container's name in "close" option
626 //
627 if (IsOpenEditing() && GetOcRemView() && GetOcRemView()->GetKind() != TOcRemView::Link) {
628 TCHAR strCloseMenu[128];
631 if (title.Length() > 0) {
632 _tcscpy(strCloseMenu, optName.c_str());
634 //LPCTSTR str = title;
635 //optName += str;
636 }
637 //ce.SetText(optName.c_str());
638 ce.SetText(&strCloseMenu[0]);
639 }
640}
641
642//
643/// Enables a command with an ID of CM_EDITINSERTOBJECT if the OcApp and OcView
644/// objects exist. Disables the command otherwise.
645//
646void
651
652//
653/// Enables a command with an ID of CM_EDITINSERTCONTROL if the OcApp and OcView
654/// objects exist. Disables the command otherwise.
655//
656void
661
662//
663/// Gets the position (rect) where the embedded object is inserted. You need to
664/// override this function if you want to override any default position.
665///
666/// \note Currently we're using only the top left point for position, size is
667/// redundant.
668//
669void
671{
672 TOleClientDC dc(*this);
673
674 // Default insertion point is at 0.5" away from current viewport origin
675 //
676 rect.left = dc.GetDeviceCaps(LOGPIXELSX) / 2; // in pixels
677 rect.top = dc.GetDeviceCaps(LOGPIXELSY) / 2; // in pixels
678
679 // Adjust the position of embedded object to be in pixels and reflect the
680 // zoom factor.
681 //
682 dc.LPtoDP((TPoint*)&rect, 1);
683
684 // No size yet.
685 //
686 rect.right = rect.left;
687 rect.bottom = rect.top;
688}
689
690//
691/// Responds to a command with an ID of CM_EDITINSERTOBJECT by creating,
692/// initializing, painting, and selecting an OLE object (TOcPart object).
693//
694void
704
705//
706/// Responds to a command with an ID of CM_EDITINSERTCONTROL by creating,
707/// initializing, painting, and selecting an OCX control (TOcControl object).
708//
709void
719
720//
721/// Enables a command with an ID of CM_EDITDELETE, which lets the user delete the
722/// selected object from the view.
723//
724void
729
730//
731/// Responds to a command with an ID of CM_EDITDELETE by deleting the selected text.
732//
733void
745
746//
747/// Enables a command with an ID of CM_EDITCUT, which lets a user copy and delete
748/// the selected object from the view.
749//
750void
752{
753 ce.Enable(DragPart != 0);
754}
755
756//
757/// Responds to a command with an ID of CM_EDITCUT by copying the selected text to
758/// the clipboard before cutting the text.
759//
760void
767
768//
769/// Enables a command with an ID of CM_EDITCOPY, which lets the user copy selected
770/// object to the clipboard.
771//
772void
777
778//
779/// Responds to a command with an ID of CM_EDITCOPY by copying the selected text to
780/// the clipboard.
781//
782void
788
789//
790/// Enables a PasteLink command with an ID of CM_EDITPASTELINK, which lets the user
791/// link to the embedded object on the clipboard. See the ocrxxxx Clipboard
792/// Constants for a description of the available clipboard formats.
793//
794void
800
801//
802/// Responds to a command with an ID of CM_EDITPASTELINK by creating a link between
803/// the current document and the object on the clipboard.
804//
805void
810
811//
812/// Enables a command with an ID of CM_EDITPASTE, which lets the user paste the
813/// embedded object from the clipboard.
814//
815void
821
822//
823/// Responds to a command with an ID of CM_EDITPASTE by pasting an object from the
824/// clipboard into the document.
825//
826void
832
833//
834/// Enables the PasteSpecial command, which lets the user select a clipboard format
835/// to be pasted or paste linked. See the ocrxxxx Clipboard Constants for a
836/// description of the available clipboard formats.-
837//
838void
844
845//
846/// Responds to a command with an ID of CM_EDITPASTESPECIAL by letting the user
847/// select an object from a list of available formats for pasting from the clipboard
848/// onto the document.
849//
850void
852{
854
855 if (GetOcView()->BrowseClipboard(initInfo)) {
856 if (!OcView->PasteNative(initInfo)) { // Not native data
858 }
860 }
861}
862
863//
864/// Enables a command with an ID of CM_EDITOBJECT, which lets the user edit the
865/// embedded object.
866//
867void
869{
870 // Downcast to get at submenu item
871 //
873 if (!me)
874 return;
875
876 int verbPos = me->GetPosition(); // remember the verb menu position
877 TMenu editMenu(me->GetMenu());
878
880 if (!DragPart) {
881 // Remove the verb menu, if any
882 //
883 if (editMenu.GetSubMenu(verbPos)) {
884 editMenu.DeleteMenu(verbPos, MF_BYPOSITION);
886 CM_EDITOBJECT, optName.c_str());
887 }
888 ce.Enable(false);
889 return;
890 }
891
892 // Add verb menu
893 //
897 newMenuName += _T(" ");
900 reinterpret_cast<TMenuItem>(verbMenu->GetHandle()), newMenuName.c_str());
901 delete verbMenu;
902 ce.Enable(true);
903}
904
905//
906/// Enables a command with an ID of CM_EDITCONVERT, which lets the user convert the
907/// selected object from one format to another. This is an OLE-specific pop-up menu option.
908//
909void
914
915/// Responds to a command with an ID of CM_EDITCONVERT by converting an object from
916/// one type to another.
917void
922
923//
924/// Enables a command with an ID of CM_EDITLINKS, which lets the user manually
925/// update the list of linked items in the current view.
926//
927void
933
934//
935/// Responds to a command with an ID of CM_EDITLINKS by updating the user-selected
936/// list of linked items in the current view.
937//
938void
944
945//
946/// Enables the Edit|Verbs command, which lets the user select one of the
947/// OLE-specific verbs from the Edit menu: for example, Edit, Open, or Play.
948//
949void
954
955//
956/// Responds to a command with an ID of CM_EDITSHOWOBJECTS by toggling the value of
957/// the ShowObjects data member.
958//
959void
965
966//
967/// Checks or unchecks the Edit|Show Objects menu command according to the value of
968/// the ShowObjects data member.
969//
970void
975
976//
977/// Returns true if the container's view holds an in-place active embedded object.
978//
979bool
981{
982 return OcView->GetActivePart() != 0;
983}
984
985//
986/// Performs hit testing to tell where the cursor is located within the window and
987/// what object the cursor is moving over. If the cursor is within an embedded
988/// object, EvSetCursor changes the shape of the cursor.
989/// When the cursor is over an inactive part and not on a handle, EvSetCursor uses
990/// an arrow cursor. If the cursor is on one of the handles of the embedded part,
991/// EvSetCursor changes the cursor to a resizing cursor.
992//
993bool
995{
996 TPoint pt;
1000
1001 if (hitTest == HTCLIENT) {
1002 if (p) { // there is an activated part
1004 if (handle.HitTest(pt) == TUIHandle::MidCenter) {
1005 return false; // let the inplace server set its cursor shape
1006 }
1007 else { // use arrow cursor
1009 return true;
1010 }
1011 }
1012 }
1013
1014 // Set cursor for resize when cursor over inactive part
1015 //
1016 if (!p && DragPart) {
1018 TOleClientDC dc(*this);
1019 dc.LPtoDP((TPoint*)&rect, 2);
1020
1023
1024 if (handle.HitTest(pt) != TUIHandle::Outside)
1025 ::SetCursor(::LoadCursor(0, TResId(handle.GetCursorId(handle.HitTest(pt)))));
1026 else
1027 ::SetCursor(::LoadCursor(0, IDC_ARROW));
1028
1029 return true;
1030 }
1031
1032 return ShowCursor(hWnd, hitTest, mouseMsg);
1033}
1034
1035//
1036/// Handles the WM_NCHITTEST message, setting the cursor according to its position
1037/// on the screen. By default, the cursor is always an arrow. But by overriding the
1038/// ShowCursor function, you can specify the conditions under which the cursor
1039/// should change and to which bitmap it should change.
1040/// HWND is the window containing the cursor, hitTest is a constant that represents
1041/// the current position of the mouse (for a list of possible values, see the
1042/// WM_NCHITTEST topic), and mouseMsg is a constant that represents the current
1043/// mouse action, such as WM_MOUSEACTIVATE.
1044/// For an example of an implementation of the ShowCursor function, see Step 17 of
1045/// the OWL tutorial.
1046//
1047bool
1048TOleWindow::ShowCursor(THandle /*hWnd*/, uint /*hitTest*/, uint /*mouseMsg*/)
1049{
1051 return true;
1052}
1053
1054//
1055// Find out if drag and drop needs to be started
1056//
1057bool
1059{
1062
1063 // no part no drag
1064 if (!DragPart)
1065 return false;
1066
1067 // maybe it was a double click
1068 if (abs(point.X()-DragStart.X()) <= DblClkDelta.cx ||
1069 abs(point.Y()-DragStart.Y()) <= DblClkDelta.cy)
1070 return false;
1071
1072 // start drag and drop anyway if outside client area
1073 if (!InClient(*DragDC, point))
1074 return true;
1075
1076 // start if ctrl or ctrl-shift is pressed but not if alt since move inside client area
1077 // doesn't really make sense (a move is a move don't bother ole for that)
1078 if ((modKeys & MK_CONTROL))
1079 return true;
1080
1081 return false;
1082}
1083
1084//
1085/// This is a response method for an incoming EV_WM_DROPFILES message.
1086/// Accept dropped file from file manager
1087//
1088void
1090{
1091 int fileCount = dropInfo.DragQueryFileCount();
1092 for (int index = 0; index < fileCount; index++) {
1093 int fileLength = dropInfo.DragQueryFileNameLen(index)+1;
1095 dropInfo.DragQueryFile(index, OleStr((OLECHAR*)filePath), fileLength);
1096
1098 initInfo.Path = filePath;
1099
1100 TRect rect;
1102 TOcPart* part = new TOcPart (*GetOcDoc());
1103 part->Init(&initInfo, rect);
1105
1106 OcView->Rename();
1108 }
1109 dropInfo.DragFinish();
1110}
1111
1112//
1113/// Responds to a mouse button double click message. EvLButtonDblClk performs hit
1114/// testing to see which embedded object, if any, is being clicked on, then in-place
1115/// activates the embedded object.
1116//
1117void
1119{
1121 TOleClientDC dc(*this);
1123 dc.DPtoLP(&point);
1124
1126
1127 if (modKeys & MK_CONTROL) {
1128 if (p)
1129 p->Open(true); // Ctrl key forces open editing
1130 }
1131 else {
1132 SetSelection(p);
1133
1134 if (p && p == GetOcView()->GetActivePart()) { // resync the active flag
1135 p->Activate(false);
1136 }
1137
1138 GetOcView()->ActivatePart(p); // In-place activation
1139 }
1140}
1141
1142//
1143/// Selects the embedded object indicated in the part parameter. When the embedded
1144/// object is selected, a selection box is drawn around the area. After an embedded
1145/// object is selected, the user can perform operations on the embedded object: for
1146/// example, moving, sizing, or copying the embedded object to the clipboard.
1147//
1148void
1150{
1151 if (part == DragPart)
1152 return;
1153
1154 // Invalidate old part
1155 //
1157 if (DragPart) {
1158 DragPart->Select(false);
1159 DragPart->Activate(false);
1161 }
1162
1163 DragPart = part;
1164 changeInfo.SetPart(DragPart);
1165 if (DragPart) {
1166 part->Select(true); // select this one
1168 }
1169}
1170
1171//
1172/// Responds to a right button down message. Performs additional hit testing to see
1173/// which embedded object, if any, is being clicked on and displays a local menu
1174/// with appropriate options for the embedded object.
1175/// point refers to the place where the mouse is located. modKeys holds the values
1176/// for a combined key and transaction, such as a Shift+Double-click of the mouse
1177/// button.
1178//
1179void
1181{
1183
1184 // Perform hit test on parts...
1185 //
1187 TOleClientDC dc(*this);
1189 dc.DPtoLP(&point);
1190
1192 SetSelection(p);
1193
1194 if (DragPart) {
1195 // Create popup menu
1196 //
1198 TPopupMenu popMenu(menu.GetSubMenu(0));
1199
1200 if (popMenu.GetHandle()) {
1203
1206 newMenuName += _T(" ");
1209 reinterpret_cast<TMenuItem>(verbMenu->GetHandle()), newMenuName.c_str());
1210 delete verbMenu;
1211
1212 // Add the verb menu
1213 //
1215
1216 // Route commands through main window
1217 //
1218 popMenu.TrackPopupMenu(TPM_RIGHTBUTTON, oldPoint, 0, *this);
1219 }
1220 }
1221}
1222
1223//
1224/// If an embedded object is no longer the active embedded object, either because
1225/// the user has ended an in-place editing session or because the user has clicked
1226/// outside the embedded object, call Deactivate to unselect the object. Returns
1227/// true if successful.
1228//
1229bool
1231{
1232 // Deactivate active part, if any
1233 //
1234 if (DragPart && DragPart->IsActive()) {
1235 SetSelection(0);
1236 return true;
1237 }
1238 else
1239 return false;
1240}
1241
1242//
1243/// Selects the embedded object at the specified point (measured in logical units).
1244/// Returns true if the object is captured by the mouse drag; otherwise, returns
1245/// false.
1246//
1247bool
1249{
1251
1252 // If the point is not on the current selection, perform hit test on parts
1253 // to find & select one
1254 //
1255 if (!DragPart || !DragPart->IsVisible(TRect(point, TSize(1,1))))
1256 SetSelection(GetOcDoc()->GetParts().Locate(point));
1257
1258 // If a part is now selected, manipulate it.
1259 //
1260 if (DragPart) {
1262 DragRect.right++;
1263 DragRect.bottom++;
1264 if (DragPart->IsSelected()) {
1267 DragHit = handle.HitTest(point);
1268 }
1269 else {
1271 }
1272
1273 if (!DragDC)
1274 DragDC = new TOleClientDC(*this);
1276
1278 SetCapture();
1279
1280 return true;
1281 }
1282
1283 return false;
1284}
1285
1286//
1287/// Responds to a left button down message by beginning a mouse drag transaction at
1288/// the given point. Performs additional hit testing to see which embedded object,
1289/// if any, is being clicked on. The modKeys parameter holds the values for a key
1290/// combination such as a shift and double click of the mouse button.
1291/// See also EvRButtonDown
1292//
1293void
1295{
1296 // Deactivating in-place active object, if any
1297 //
1298 if (Deactivate())
1299 return;
1300
1301 // Convert the point to logical unit
1302 //
1303 if (!DragDC)
1304 DragDC = new TOleClientDC(*this);
1305
1307 DragDC->DPtoLP(&point);
1309}
1310
1311//
1312/// Returns true if point is inside the client area of the window. Returns false otherwise.
1313//
1314bool
1316{
1318
1319 dc.DPtoLP((TPoint*)&logicalRect, 2);
1320 return logicalRect.Contains(point);
1321}
1322
1323//
1324/// Responds to a mouse move message with the appropriate transaction. If the mouse
1325/// is being dragged, the embedded object is moved. If a resizing operation occurs,
1326/// then the embedded object is resized. This message is handled only when a mouse
1327/// dragging or resizing action involving the embedded object occurs.
1328//
1329void
1331{
1332 if (!DragDC)
1333 return;
1334
1335 // Convert the point to logical unit
1336 //
1338 DragDC->DPtoLP(&point);
1339
1340 // A MidCenter hit is a move
1341 //
1343 DragDC->DrawFocusRect(DragRect); // erase old rect
1344
1345 // check if initiate drag and drop
1346 if (StartDrag(modKeys, point)) {
1349 outAction);
1350
1355
1356 // Delete the dragged part since it was dragged out
1357 //
1358 if (outAction == daDropMove) {
1359 DragPart->Delete();
1360 DragPart = 0;
1361 }
1362 }
1363 else {
1365 DragRect.Offset(delta.x, delta.y);
1366 DragDC->DrawFocusRect(DragRect); // draw new rect
1367 }
1368 }
1369 // All other non-outside hits are resizes
1370 //
1371 else if (DragHit != TUIHandle::Outside) { // handle
1372 DragDC->DrawFocusRect(DragRect); // erase old rect
1373 int dl = (DragHit%3) == 0 ? point.x - DragPt.x : 0;
1374 int dr = (DragHit%3) == 2 ? point.x - DragPt.x : 0;
1375 int dt = (DragHit/3) == 0 ? point.y - DragPt.y : 0;
1376 int db = (DragHit/3) == 2 ? point.y - DragPt.y : 0;
1377
1378 // maintain minimum part size
1379 //
1380 if ((DragRect.Width() + dr - dl) >= MinWidth) {
1381 DragRect.left += dl;
1382 DragRect.right += dr;
1383 }
1384 if ((DragRect.Height() + db - dt) >= MinHeight) {
1385 DragRect.top += dt;
1386 DragRect.bottom += db;
1387 }
1388
1389 DragDC->DrawFocusRect(DragRect); // draw new rect
1390 }
1391
1392 DragPt = point;
1393}
1394
1395//
1396/// Responds to a left button up message by ending a mouse drag action. point refers
1397/// to the place where the mouse is located. modKeys holds the values for a combined
1398/// key and mouse transaction.
1399//
1400void
1401TOleWindow::EvLButtonUp(uint /*modKeys*/, const TPoint& /*point*/)
1402{
1403 if (DragPart) {
1405
1406 // All non-outside hits are moves or resizes
1407 //
1408 if (DragHit != TUIHandle::Outside) {
1412 DragPart->SetSize(DragRect.Size()); // A MidCenter hit is a move only
1414 }
1416
1419 }
1420
1421 if (DragDC) {
1422 delete DragDC;
1423 DragDC = 0;
1424 DragRect.SetNull();
1425 }
1426}
1427
1428//
1429/// Passes the event to TWindow::EvSize for normal processing and forwards the event
1430/// to TOcView::EvResize to let a possible in-place server adjust its size.
1431//
1432void
1434{
1436 OcView->EvResize();
1437}
1438
1439//
1440/// Responds to a message forwarded from the MDI child window (if one exists) and
1441/// lets the TOcView class know that the view window child window frame has been
1442/// activated or deactivated.
1443/// The hWndActivated parameter contains a handle to the MDI child window being
1444/// activated. Both the child window being activated being activated and the child
1445/// window (hWndDeactivated) being deactivated receive this message.
1446//
1447void
1449{
1450 if (OcView)
1452}
1453
1454/// Forwards the WM_MOUSEACTIVATE message to the top parent of the TOleWindow object.
1455uint
1457{
1458 if (topParent)
1460
1461 return MA_ACTIVATE;
1462}
1463
1464//
1465/// Responds to a change in focus of the window. hWndLostFocus contains a handle to
1466/// the window losing the focus. EvSetFocus checks to see if an in-place server
1467/// exists and, if so, passes the focus to the in-place server.
1468//
1469void
1471{
1473 if (OcView)
1474 OcView->EvSetFocus(true); // Maybe active part (if any) wants focus
1475}
1476
1477//
1478/// In response to a WM_HSCROLL message, EvHScroll calls TWindow::EvHScroll and
1479/// invalidates the window.
1480//
1481void
1488
1489//
1490/// In response to a WM_VSCROLL message, EvVScroll calls TWindow::EvVScroll and
1491/// invalidates the window.
1492//
1493void
1500
1501//
1502/// Handles WM_MENUSELECT to provide hint text in the container's status bar, based
1503/// on the menu item id. It treats popup items separately and asks them for their
1504/// ids. This implementation is similar to the code in TDecoratedFrame.
1505//
1506void
1508{
1509 if (GetOcRemView()) {
1510 if (flags == 0xFFFF && hMenu == 0) { // menu closing
1512 return;
1513 }
1514 else if (flags & MF_POPUP)
1515 {
1517 const int posItem = menuItemId;
1518 menuItemId = popupMenu.GetMenuItemID(posItem);
1519 }
1520 else if (flags & (MF_SEPARATOR | MF_MENUBREAK | MF_MENUBARBREAK))
1521 {
1522 menuItemId = 0; // display an empty help message
1523 }
1526 }
1527 else
1529}
1530
1531//
1532/// Responds to a WM_OCEVENT message and subdispatches the message based on wParam.
1533/// ObjectComponents sends WM_OCEVENT messages when it needs to communicate with an
1534/// OLE-generated event; for example, if a server wants to display toolbars.
1535//
1536TResult
1544
1545//
1546/// Asks the container for the caption in its frame window. Returns the frame
1547/// window's caption.
1548//
1549LPCTSTR
1551{
1552 TCHAR title[128];
1553 Parent->GetWindowText(title, 128);
1555
1556 return ContainerName.c_str();
1557}
1558
1559//
1560/// Sets the window's caption to title. The new caption is the name of the in-place
1561/// active server merged with the caption of the container's window. In the case of
1562/// an MDI child window, the new caption is the in-place server's name merged with
1563/// the caption of the MDI child window. When the child window is maximized, the
1564/// merged caption is appended to the end of the main frame window's caption.
1565//
1566void
1568{
1569 if (title && *title)
1570 Parent->SetWindowText(title);
1571 else if (GetOcRemView() && GetOcRemView()->GetKind() == TOcRemView::Link) {
1573 if (caption)
1574 Parent->SetWindowText(caption);
1575 }
1576}
1577
1578//
1579/// Requests that the server create space for a tool bar in the view of an embedded
1580/// object.
1581/// If the TOleWindow object is unable to handle the message,
1582/// EvOcViewBorderSpaceReq returns false, the default value.
1583//
1584bool
1586{
1587 return false;
1588}
1589
1590//
1591/// Requests that the server's tool bar be placed in the container's view of an
1592/// embedded object.
1593/// If the TOleWindow object is unable to handle the message, EvOcViewBorderSpaceSet
1594/// returns false, the default value.
1595//
1596bool
1598{
1599 return false;
1600}
1601
1602//
1603/// Requests a given object be dropped at a specified place on the container's
1604/// window.
1605/// If the TOleWindow object is unable to handle the message, EvOcViewDrop returns
1606/// false.
1607//
1608bool
1610{
1611 return true; // ok to drop anything, we can take it...
1612}
1613
1614//
1615/// Handles an OC_VIEWDRAG message asking the container to provide visual feedback
1616/// while the user is dragging the embedded object.
1617/// If the TOleWindow object is unable to handle the message, EvOcViewDrag returns
1618/// false.
1619//
1620bool
1622{
1623 TClientDC dc(*this);
1624 TPen pen(TColor(128, 128, 128), 4, PS_DOT);
1625 dc.SelectObject(pen);
1628
1629 dc.Rectangle(*ddInfo.Pos);
1630 return true;
1631}
1632
1633//
1634/// Asks the container to scroll the view window and updates any internal state as
1635/// needed. EvOcViewScroll is called when the server is resizing or a drop
1636/// interaction occurs near the edge of the window.
1637/// If the TOleWindow object is unable to handle the message, EvOcViewScroll returns
1638/// false.
1639//
1640bool
1642{
1643 return false;
1644}
1645
1646//
1647/// Gets the size of the rectangle (the site) where the embedded object is to be
1648/// placed. rect refers to the size of the bounding rectangle that encloses the
1649/// embedded object.
1650//
1651bool
1653{
1654 TOleClientDC dc(*this);
1655
1656 return dc.LPtoDP((TPoint*)rect, 2);
1657}
1658
1659//
1660/// Converts the rect to logical units. This area, referred to as the site, is
1661/// measured in logical units that take into account any scaling factor. rect refers
1662/// to the size of the bounding rectangle that encloses the embedded object.
1663//
1664bool
1666{
1667 TOleClientDC dc(*this);
1668
1669 return dc.DPtoLP((TPoint*)rect, 2);
1670}
1671
1672//
1673/// Responds to an OC_VIEWGETSCALE message and gets the scaling for the server
1674/// object, causing the embedded object to be displayed using the correct scaling
1675/// value (for example, 120%). scaleFactor indicates the scaling factor, the ratio
1676/// between the size of the embedded object and the size of the site where the
1677/// object is to be displayed.
1678/// If the TOleWindow object is unable to handle the message, EvOcViewGetScale
1679/// returns false.
1680//
1681bool
1687
1688//
1689/// Notifies ObjectWindows container applications that an embedded object is active.
1690/// ocPart is the embedded object that has been activated. EvOcViewPartActivate
1691/// returns true after the embedded object has been activated.
1692//
1693bool
1699
1700//
1701/// Pastes an OLE object into the document pointed to by the TOleWindow::OcDoc data
1702/// member.
1703//
1704bool
1706{
1707 TRect rect;
1709 TOcPart* part = new TOcPart (*GetOcDoc());
1710 part->Init(&init, rect);
1711 init.ReleaseDataObject();
1712 return true;
1713}
1714
1715//
1716/// Asks the server to paint an object at a given position on a specified device
1717/// context.
1718/// If the TOleWindow object is unable to handle the message, EvOcViewPaint returns
1719/// false.
1720//
1721bool
1723{
1724 // Paint according to the view paint structure
1725 //
1726 TDC dc(vp.DC);
1727 Pos = *vp.Pos;
1728
1729 // Paint embedded objects
1730 //
1731
1733 SetupDC(dc, !metafile);
1734
1735 if (vp.Moniker) {
1736 PaintLink(dc, true, Pos, *vp.Moniker);
1737 }
1738 else if (vp.PaintSelection) {
1739 PaintSelection(dc, true, Pos, vp.UserData);
1740 }
1741 else {
1742 Paint(dc, true, Pos);
1743 PaintParts(dc, true, Pos, metafile);
1744 }
1745
1746 Pos.SetNull();
1747
1748 return true;
1749}
1750
1751//
1752/// Asks the server to close a currently open document and its associated view.
1753/// If the TOleWindow object is unable to handle the message, EvOcViewClose returns
1754/// false.
1755///
1756/// TOcRemView is going away, disconnect TOleWindow with it so we don't use it
1757/// later. If this is a remote view, then close the doc too.
1758//
1759bool
1761{
1762 if (IsRemote() && OcDoc)
1763 OcDoc->Close();
1764
1765 OcView = 0;
1766 return true;
1767}
1768
1769//
1770/// Asks the server to write an embedded object's data (the part as represented by
1771/// the ocSave parameter) into storage.
1772/// If the TOleWindow object is unable to handle the message, EvOcViewSavePart
1773/// returns false.
1774//
1775bool
1777{
1778 return true;
1779}
1780
1781//
1782/// Requests that an embedded object load itself.
1783/// If the TOleWindow object is unable to handle the message, EvOcViewLoadPart
1784/// returns false.
1785//
1786bool
1788{
1789 return true;
1790}
1791
1792//
1793/// The server asks itself the size of its current rectangle and lets the container
1794/// know about the size of the server's view in pixels.
1795/// If the TOleWindow object is unable to handle the message, EvOcViewPartSize
1796/// returns false.
1797//
1798bool
1800{
1801 return false;
1802}
1803
1804//
1805/// Asks the container to open an existing document, which will be used for linking
1806/// from the embedding site.
1807/// If the TOleWindow object is unable to handle the message, EvOcViewOpenDoc
1808/// returns false.
1809//
1810bool
1812{
1813 return true;
1814}
1815
1816//
1817/// Requests that the menus in a composite menu (a menu composed of both the
1818/// server's and the container's menus).
1819/// If the TOleWindow object is unable to handle the message, EvOcViewInsMenus
1820/// returns false.
1821//
1822bool
1824{
1825 return false;
1826}
1827
1828//
1829/// Asks the server to provide its tool bars for display in the container's window.
1830/// Returns true if tool bars are supplied.
1831/// If the TOleWindow object is unable to handle the message, EvOcViewShowTools
1832/// returns false.
1833//
1834bool
1836{
1839 TWindow* toolBar = mainWindow->ChildWithId(IDW_TOOLBAR);
1840 if (!toolBar)
1841 return false;
1842 tbi.HTopTB = THandle(*toolBar);
1843 return true;
1844}
1845
1846//
1847/// Requests the color palette to draw the object.
1848/// If the TOleWindow object is unable to handle the message, EvOcViewGetPalette
1849/// returns false.
1850//
1851bool
1853{
1854 return false;
1855}
1856
1857//
1858/// Requests clipboard data in the specified format.
1859/// If the TOleWindow object is unable to handle the message, EvOcViewClipData
1860/// returns false.
1861//
1862bool
1864{
1865 return false;
1866}
1867
1868//
1869// Set format data into server
1870//
1871bool
1873{
1874 return false;
1875}
1876
1877//
1878/// Handles the EV_OC_AMBIENT_GETBACKCOLOR message, which is sent by an OCX control.
1879/// Returns false by default. You should override the default implementation so the
1880/// function stores the window background color in rgb and returns true.
1881//
1882bool
1884{
1885 return false;
1886}
1887
1888/// Handles the EV_OC_AMBIENT_GETFORECOLOR message, which is sent by an OCX control.
1889/// Returns false by default. You should override the default implementation so the
1890/// function stores the window forecolor in rgb and returns true.
1891bool
1893{
1894 return false;
1895}
1896
1897/// Handles the EV_OC_AMBIENT_GETLOCALEID message, which is sent by an OCX control.
1898/// Returns false by default. You should override the default implementation so the
1899/// function stores the window locale ID in locale and returns true.
1900bool
1902{
1903 return false;
1904}
1905
1906/// Handles the EV_OC_AMBIENT_GETTEXTALIGN message, which is sent by an OCX control.
1907/// Returns false by default. You should override the default implementation so the
1908/// function stores the window text alignment in show and returns true.
1909bool
1911{
1912 return false;
1913}
1914
1915/// Handles the EV_OC_AMBIENT_GETMESSAGEREFLECT message, which is sent by an OCX
1916/// control. Returns false by default. You should override the default
1917/// implementation so the function stores whether or not the window reflects
1918/// messages back to the control in msgReflect and returns true.
1919bool
1921{
1922 return false;
1923}
1924
1925/// Handles the EV_OC_AMBIENT_GETUSERMODE message, which is sent by an OCX control.
1926/// Returns false by default. You should override the default implementation so the
1927/// function stores whether or not the window is in user mode in mode and returns
1928/// true.
1929bool
1931{
1932 return false;
1933}
1934
1935/// Handles the EV_OC_AMBIENT_GETUIDEAD message, which is sent by an OCX control.
1936/// Returns false by default. You should override the default implementation so the
1937/// function stores whether or not the window's user interface is disabled in dead
1938/// and returns true.
1939bool
1941{
1942 return false;
1943}
1944
1945/// Handles the EV_OC_AMBIENT_GETSHOWGRABHANDLES message, which is sent by an OCX
1946/// control. Returns false by default. You should override the default
1947/// implementation so the function stores whether or not the window shows grab
1948/// handles in show and returns true.
1949bool
1951{
1952 return false;
1953}
1954
1955/// Handles the EV_OC_AMBIENT_GETSHOWHATCHING message, which is sent by an OCX
1956/// control. Returns false by default. You should override the default
1957/// implementation so the function stores whether or not the window shows hatching
1958/// in show and returns true.
1959bool
1961{
1962 return false;
1963}
1964
1965/// Handles the EV_OC_AMBIENT_GETDISPLAYASDEFAULT message, which is sent by an OCX
1966/// control. Returns false by default. You should override the default
1967/// implementation so the function stores whether or not the control is a default
1968/// control (buttons only) in disp and returns true.
1969bool
1971{
1972 return false;
1973}
1974
1975/// Handles the EV_OC_AMBIENT_GETSUPPORTSMNEMONICS message, which is sent by an OCX
1976/// control. Returns false by default. You should override the default
1977/// implementation so the function stores whether or not the window supports
1978/// mnemonics in support and returns true.
1979bool
1981{
1982 return false;
1983}
1984
1985/// Handles the EV_OC_AMBIENT_GETDISPLAYNAME message, which is sent by an OCX
1986/// control. Returns false by default. You should override the default
1987/// implementation so the function stores a control name (used in error messages) in
1988/// name and returns true.
1989bool
1991{
1992 return false;
1993}
1994
1995/// Handles the EV_OC_AMBIENT_GETSCALEUNITS message, which is sent by an OCX
1996/// control. Returns false by default. You should override the default
1997/// implementation so the function stores the window scale units in units and
1998/// returns true.
1999bool
2001{
2002 return false;
2003}
2004
2005/// Handles the EV_OC_AMBIENT_GETFONT message, which is sent by an OCX control.
2006/// Returns false by default. You should override the default implementation so the
2007/// function stores the window font information in font and returns true.
2008bool
2010{
2011 return false;
2012}
2013
2014/// Handles the EV_OC_AMBIENT_SETBACKCOLOR message, which is sent by an OCX control.
2015/// Returns false by default. You can override the default implementation so the
2016/// window changes its background color to rgb and returns true.
2017bool
2019{
2020 return false;
2021}
2022
2023/// Handles the EV_OC_AMBIENT_SETFORECOLOR message, which is sent by an OCX control.
2024/// Returns false by default. You can override the default implementation so the
2025/// window changes its background color to rgb and returns true.
2026bool
2028{
2029 return false;
2030}
2031
2032/// Handles the EV_OC_AMBIENT_SETLOCALEID message, which is sent by an OCX control.
2033/// Returns false by default. You can override the default implementation so the
2034/// window changes its locale ID to locale and returns true.
2035bool
2037{
2038 return false;
2039}
2040
2041/// Handles the EV_OC_AMBIENT_SETTEXTALIGN message, which is sent by an OCX control.
2042/// Returns false by default. You can override the default implementation so the
2043/// window aligns text according to the value in align and returns true.
2044bool
2046{
2047 return false;
2048}
2049
2050/// Handles the EV_OC_AMBIENT_SETMESSAGEREFLECT message, which is sent by an OCX
2051/// control. Returns false by default. You can override the default implementation
2052/// so the window does or doesn't reflect messages according to the value in
2053/// msgReflect.
2054bool
2056{
2057 return false;
2058}
2059
2060/// Handles the EV_OC_AMBIENT_SETUSERMODE message, which is sent by an OCX control.
2061/// Returns false by default. You can override the default implementation so the
2062/// window sets user mode equal to the value in mode.
2063bool
2065{
2066 return false;
2067}
2068
2069/// Handles the EV_OC_AMBIENT_SETUIDEAD message, which is sent by an OCX control.
2070/// Returns false by default. You can override the default implementation so the
2071/// window enables or disables itself according to the value in dead.
2072bool
2074{
2075 return false;
2076}
2077
2078/// Handles the EV_OC_AMBIENT_SETSHOWGRABHANDLES message, which is sent by an OCX
2079/// control. Returns false by default. You can override the default implementation
2080/// so the window shows or hides grab handles according to the value in show.
2081bool
2083{
2084 return false;
2085}
2086
2087/// Handles the EV_OC_AMBIENT_SETSETSHOWHATCHING message, which is sent by an OCX
2088/// control. Returns false by default. You can override the default implementation
2089/// so the window shows or hides hatching according to the value in hatching.
2090bool
2092{
2093 return false;
2094}
2095
2096/// Handles the EV_OC_AMBIENT_SETDISPLAYASDEFAULT message, which is sent by an OCX
2097/// control. Returns false by default. You can override the default implementation
2098/// so the window displays itself as a default control (if the window represents a
2099/// button control) if disp is true.
2100bool
2102{
2103 return false;
2104}
2105
2106/// Handles the EV_OC_AMBIENT_SETSUPPORTSMNEMONICS message, which is sent by an OCX
2107/// control. Returns false by default. You can override the default implementation
2108/// so the window turns its support for mnemonics on or off according to the value
2109/// in support.
2110bool
2112{
2113 return false;
2114}
2115
2116/// Handles the EV_OC_AMBIENT_SETDISPLAYNAME message, which is sent by an OCX
2117/// control. Returns false by default. You can override the default implementation
2118/// so the window changes its display name (for error messages) to name and returns true.
2119bool
2121{
2122 return false;
2123}
2124
2125/// Handles the EV_OC_AMBIENT_SETSCALEUNITS message, which is sent by an OCX
2126/// control. Returns false by default. You can override the default implementation
2127/// so the window sets its scale units equal to units and returns true.
2128bool
2130{
2131 return false;
2132}
2133
2134/// Handles the EV_OC_AMBIENT_SETFONT message, which is sent by an OCX control.
2135/// Returns false by default. You can override the default implementation so the
2136/// window changes its font to font and returns true.
2137bool
2139{
2140 return false;
2141}
2142
2143//
2144// Control Event Dispatches
2145
2146//
2147/// Handles the EV_OC_CTRLCLICK message, which is sent by an OCX control. Returns
2148/// false by default. You can override the default implementation so the window
2149/// responds to the message and returns true.
2150//
2151bool
2153{
2154 return false;
2155}
2156
2157/// Handles the EV_OC_CTRLDBLCLICK message, which is sent by an OCX control. Returns
2158/// false by default. You can override the default implementation so the window
2159/// responds to the message and returns true.
2160bool
2162{
2163 return false;
2164}
2165
2166/// Handles the EV_OC_CTRLMOUSEDOWN message, which is sent by an OCX control.
2167/// Returns false by default. You can override the default implementation so the
2168/// window responds to the message and returns true.
2169bool
2171{
2172 return false;
2173}
2174
2175/// Handles the EV_OC_CTRLMOUSEUP message, which is sent by an OCX control. Returns
2176/// false by default. You can override the default implementation so the window
2177/// responds to the message and returns true.
2178bool
2180{
2181 return false;
2182}
2183
2184/// Handles the EV_OC_CTRLMOUSEMOVE message, which is sent by an OCX control.
2185/// Returns false by default. You can override the default implementation so the
2186/// window responds to the message and returns true.
2187bool
2189{
2190 return false;
2191}
2192
2193/// Handles the EV_OC_CTRLKEYDOWN message, which is sent by an OCX control. Returns
2194/// false by default. You can override the default implementation so the window
2195/// responds to the message and returns true.
2196bool
2198{
2199 return false;
2200}
2201
2202/// Handles the EV_OC_CTRLKEYUP message, which is sent by an OCX control. Returns
2203/// false by default. You can override the default implementation so the window
2204/// responds to the message and returns true.
2205bool
2207{
2208 return false;
2209}
2210
2211/// Handles the EV_OC_CTRLERROREVENT message, which is sent by an OCX control.
2212/// Returns false by default. You can override the default implementation so the
2213/// window responds to the message and returns true.
2214bool
2216{
2217 return false;
2218}
2219
2220/// Handles the EV_OC_CTRLFOCUS message, which is sent by an OCX control. Returns
2221/// false by default. You can override the default implementation so the window
2222/// responds to the message and returns true.
2223bool
2225{
2226 return false;
2227}
2228
2229/// Handles the EV_OC_CTRLPROPERTYCHANGE message, which is sent by an OCX control.
2230/// Returns false by default. You can override the default implementation so the
2231/// window responds to the message and returns true.
2232bool
2234{
2235 return false;
2236}
2237
2238/// Handles the EV_OC_PROPERTYREQUESTEDIT message, which is sent by an OCX control.
2239/// Returns false by default. You can override the default implementation so the
2240/// window responds to the message and returns true.
2241bool
2243{
2244 return false;
2245}
2246
2247/// Handles the EV_OC_CTRLCUSTOMEVENT message, which is sent by an OCX control.
2248/// Returns false by default. You can override the default implementation so the
2249/// window responds to the message and returns true.
2250bool
2252{
2253 return false;
2254}
2255
2256//
2257/// Repaints the embedded objects on the given device context. The erase parameter
2258/// is true if the background of the embedded object is to be repainted. rect
2259/// indicates the area that needs repainting. metafile indicates whether or not the
2260/// object is a metafile.
2261//
2262bool
2264{
2265 if (!GetOcDoc())
2266 return false;
2267
2270
2271 if (IsRemote()) {
2273 clientRect.Offset(-clientRect.left, -clientRect.top);
2274 }
2275 else {
2277 }
2278
2279 TPoint scrollPos(0, 0);
2280
2281 if (!metafile) {
2282 dc.DPtoLP((TPoint*)&logicalRect, 2);
2283 }
2284 else {
2285 if (Scroller) {
2286 scrollPos.x = (int)Scroller->XPos;
2287 scrollPos.y = (int)Scroller->YPos;
2288 }
2289 }
2290
2291 for (TOcPartCollectionIter i(GetOcDoc()->GetParts()); i; i++){
2292 TOcPart& p = *(i.Current());
2293 if (p.IsVisible(logicalRect) || metafile) {
2294 TRect r = p.GetRect();
2295 r.Offset(-scrollPos.x, -scrollPos.y);
2296 p.Draw(dc, r, clientRect, asDefault);
2297
2298 if (metafile)
2299 continue;
2300
2301 // Paint selection
2302 //
2303 if ((p.IsSelected() || ShowObjects) && r.Width() > 0 && r.Height() > 0) {
2305 if (p.IsSelected())
2308 }
2309 }
2310 }
2311 return true;
2312}
2313
2314//
2315/// Sets the ratio of the embedded object's size to the size of the site.
2316//
2317void
2323
2324//
2325/// Gets the logical units (typically pixels) per inch for a document so that the
2326/// document's embedded objects can be painted correctly on the screen device
2327/// context.
2328//
2329void
2337
2338//
2339/// Determines the viewport's origin and extent (the logical coordinates and the
2340/// size of the device context). Sets up the device context (DC) before painting the
2341/// embedded object. dc refers to the DC and scale indicates that the scaling factor
2342/// to use when painting the embedded object is a ratio between the site and the
2343/// embedded object.
2344//
2345void
2347{
2349
2350 // Setup window and viewport origin according to scroll amount
2351 //
2352 TPoint scrollPos(0, 0);
2353 if (Scroller) {
2354 scrollPos.x = (int)Scroller->XPos;
2355 scrollPos.y = (int)Scroller->YPos;
2356 }
2357
2358 if (!scale) {
2360 return;
2361 }
2362
2363 // Don't scale the scrolling amount
2364 //
2365 if (Scale.SiteSize.cx)
2366 scrollPos.x = (int)(((uint32)scrollPos.x * Scale.PartSize.cx +
2367 Scale.SiteSize.cx/2) / Scale.SiteSize.cx);
2368 if (Scale.SiteSize.cy)
2369 scrollPos.y = (int)(((uint32)scrollPos.y * Scale.PartSize.cy +
2370 Scale.SiteSize.cy/2) / Scale.SiteSize.cy);
2372
2374
2375 // set the window and viewport extaccording to zoom factor
2376 //
2377 TSize ext;
2379 dc.SetWindowExt(ext);
2380
2381 ext.cx = dc.GetDeviceCaps(LOGPIXELSX);
2382 ext.cy = dc.GetDeviceCaps(LOGPIXELSY);
2383
2384 if (Scale.PartSize.cx)
2385 ext.cx = (int)(((uint32)ext.cx * Scale.SiteSize.cx + Scale.PartSize.cx/2) /
2386 Scale.PartSize.cx);
2387 if (Scale.PartSize.cy)
2388 ext.cy = (int)(((uint32)ext.cy * Scale.SiteSize.cy + Scale.PartSize.cy/2) /
2389 Scale.PartSize.cy);
2390 dc.SetViewportExt(ext);
2391}
2392
2393//
2394/// Sets up the dc for proper scaling and scrolling and then calls the derived
2395/// class's Paint method to paint the contents of the dc.
2396//
2397void
2399{
2400 if (IsFlagSet(wfAlias))
2401 DefaultProcessing(); // use application-defined wndproc
2402
2403 else {
2404 TPaintDC dc(*this);
2405 TRect& rect = *(TRect*)&dc.Ps.rcPaint;
2406
2407 if (Scroller)
2408 Scroller->BeginView(dc, rect);
2409
2411 SetupDC(dc, !metafile);
2412 Paint(dc, dc.Ps.fErase, rect);
2413 PaintParts(dc, dc.Ps.fErase, rect, metafile);
2414
2415 if (Scroller)
2416 Scroller->EndView();
2417 }
2418}
2419
2420//
2421/// Informs an active container that one of its embedded objects needs to be
2422/// redrawn. Changes in the container's part should be reflected in any other,
2423/// non-active views. Returns true after all views have been notified of the
2424/// necessary changes.
2425/// If the TOleWindow object is unable to handle the message, EvOcViewPartInvalid
2426/// returns false.
2427//
2428bool
2430{
2431 // Our document is now dirty...
2432
2433 // Reflect the change in part in other (non-active) views
2434 //
2435 TRect rect(changeInfo.GetPart()->GetRect());
2436 rect.right++;
2437 rect.bottom++;
2438 TOleClientDC dc(*this);
2439 dc.LPtoDP((TPoint*)&rect, 2);
2440
2441 InvalidateRect(rect); // Multiview support to be done in derived classes
2442
2443 // Notify container if this is an intermediate container
2444 //
2446
2447 return true; // stop further processing by OCF
2448}
2449
2450//
2451/// Creates and enables a pop-up menu option (ocVerb) on the Edit menu. The verb
2452/// describes an action (for example, Edit, Open, Play) that is appropriate for the
2453/// embedded object.
2454//
2457{
2459 while (DragPart->EnumVerbs(ocVerb)) {
2460 verbMenu->AppendMenu(MF_STRING|MF_ENABLED,
2461 (uint)CM_EDITFIRSTVERB + ocVerb.VerbIndex,
2462 (LPCTSTR)OleStr(ocVerb.VerbName));
2463 }
2464
2465 verbMenu->AppendMenu(MF_SEPARATOR, 0, 0);
2467 verbMenu->AppendMenu(MF_STRING, CM_EDITCONVERT, optName.c_str());
2468
2469 return verbMenu;
2470}
2471
2472//
2473/// Executes an OLE-related menu option from the Edit menu (for example, Edit, Copy,
2474/// or Play) that is associated with the selected object.
2475//
2476void
2481
2482//
2483/// Attaches the view to its ObjectWindows parent window so that the user can
2484/// perform open editing on the embedded object, or if the embedded object has been
2485/// de-activated while in-place editing was occurring.
2486/// If the TOleWindow object is unable to handle the message, EvOcViewAttachWindow
2487/// returns false.
2488//
2489bool
2491{
2493 TOleFrame);
2494 if (!mainWindow)
2495 return false; // server app is shutting down
2496
2497 if (attach) {
2498 if (IsOpenEditing()) {
2499 // Derived class needs to managed setting up frame differently, like
2500 // for MDI etc.
2501 //
2502 mainWindow->SetClientWindow(this);
2503 }
2504 }
2505 else {
2506 if (IsOpenEditing() && Parent != mainWindow)
2507 Parent->PostMessage(WM_CLOSE);
2508 SetParent(mainWindow->GetRemViewBucket()); // simple reparent
2509 }
2510 return true;
2511}
2512
2513//
2514/// Handles the EV_OC_VIEWDOVERB message. Returns false. Implement your own event
2515/// handler to control how the window responds to verbs selected by the user.
2516//
2517bool
2519{
2520 return false;
2521}
2522
2523//
2524// Perform the action indentified by verb
2525//
2526bool
2528{
2529 return false;
2530}
2531
2532//
2533/// Shuts down the associated ObjectComponents partners, if possible.
2534//
2535bool
2537{
2538 if (IsRemote()) {
2540 if (IsOpenEditing())
2541 ocRemView->Disconnect();
2542 }
2543 else {
2544 if (OcView)
2545 OcView->EvClose();
2546 }
2547 return true;
2548}
2549
2550//
2551/// Performs normal window cleanup and informs the TOcView object that the window is closed.
2552//
2553void
2555{
2557 TOleFrame);
2558 if (mainWindow)
2559 mainWindow->OleViewClosing(true);
2560 OleShutDown();
2561 if (mainWindow)
2562 mainWindow->OleViewClosing(false);
2564}
2565
2566//
2567/// Responds to an OC_VIEWSETSCALE message and handles the scaling for server
2568/// application, ensuring that the embedded object is displayed using the correct
2569/// scaling values (for example, 120%). The server uses this value in its paint
2570/// procedure when the embedded object needs to be redrawn. scaleFactor indicates
2571/// the scaling factor, the ratio between the size of the embedded object and the
2572/// size of the site where the object is to be displayed.
2573/// If the TOleWindow object is unable to handle the message, EvOcViewSetScale
2574/// returns false.
2575//
2576bool
2582
2583//
2584/// Handles the EV_OC_VIEWGETITEMNAME. Returns false.
2585//
2586bool
2588{
2589 return false;
2590}
2591
2592//----------------------------------------------------------------------------
2593// Linking Spport
2594//
2595
2596//
2597/// Responds to an OC_VIEWSETLINK message TOcLinkView sends when the server document
2598/// provides a link to a container document. EvOcViewSetLink establishes the link
2599/// between a TOleLinkView and a TOcLinkView. view references the view with which
2600/// the document or selection is associated. Returns false if unsuccessful.
2601/// Doc/View applications use TOleView 's implementation of this function.
2602//
2603bool
2605{
2606 return false;
2607}
2608
2609//
2610/// EvOcViewBreakLink responds to an OC_VIEWBREAKLINK message that TOcLinkView sends
2611/// when the server document that provides the link shuts down. EvOcViewBreakLink
2612/// breaks the link with a server document or a selection by deleting the
2613/// TOleLinkView associated with the TOcLinkView (view). Returns false if
2614/// unsuccessful. Doc/View applications use TOleView's EvOcViewBreakLink, which
2615/// overrides TOleWindow's version.
2616//
2617bool
2619{
2620 return false;
2621}
2622
2624
2625#if OWL_PERSISTENT_STREAMS
2626
2627//
2628//
2629//
2630void*
2631TOleWindow::Streamer::Read(ipstream& is, uint32 /*version*/) const
2632{
2633 owl::ReadBaseObject((TWindow*)GetObject(), is);
2634
2635 GetObject()->Remote = false; // intialized in CreateOcView()
2636 GetObject()->OcApp = 0; // initialized in Init()
2637 GetObject()->OcDoc = 0;
2638 GetObject()->OcView = 0;
2639 GetObject()->Init();
2640
2641 is >> GetObject()->Scale; // current scaling factor
2642 is >> GetObject()->Pos; // current position
2643 is >> GetObject()->ShowObjects; // Show embedded part frames?
2644
2645 return GetObject();
2646}
2647
2648//
2649//
2650//
2651void
2652TOleWindow::Streamer::Write(opstream& os) const
2653{
2654 owl::WriteBaseObject((TWindow*)GetObject(), os);
2655 os << GetObject()->Scale; // current scaling factor
2656 os << GetObject()->Pos; // current position
2657 os << GetObject()->ShowObjects; // Show embedded part frames?
2658}
2659
2660#endif
2661
2662
2663
2664} // OCF namespace
2665
2666//==============================================================================
2667
#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
bool Convert(TOcPart *ocPart, bool b)
Open the Convert dialog, and perform the conversion if OK.
Definition ocapp.cpp:448
owl::ulong _IFUNC AddRef()
Definition ocapp.h:215
bool BrowseControls(TOcInitInfo &initInfo)
Definition ocapp.cpp:362
bool Copy(TOcPart *ocPart)
Copy Selected embedded object.
Definition ocapp.cpp:383
owl::ulong _IFUNC Release()
Definition ocapp.h:216
bool Browse(TOcInitInfo &initInfo)
Definition ocapp.cpp:356
bool IsOptionSet(owl::uint32 option) const
Definition ocapp.h:302
owl::uint EnableEditMenu(TOcMenuEnable enable, IBDataConsumer *ocview)
Definition ocapp.cpp:350
bool Drag(TOcDataProvider *ocData, TOcDropAction inAction, TOcDropAction &outAction)
Drag a selection.
Definition ocapp.cpp:416
Class representing an embedded control within a document.
Definition occtrl.h:78
owl::uint GetId() const
Definition occtrl.h:106
bool Init(TOcInitInfo *initInfo, owl::TRect pos)
Definition occtrl.cpp:265
void SetId(owl::uint id)
Definition occtrl.h:107
TOcPartCollection & GetParts()
Definition ocdoc.h:51
Used to obtain the native clipboard format data.
Definition ocview.h:416
owl::uint32 ReleaseDataObject()
Definition ocobject.h:114
Used to obtain the item name for building monikers.
Definition ocview.h:403
View/Data change info.
Definition ocpart.h:216
TOcPart * Locate(owl::TPoint &point)
walk thru Part collection & return the last one that logical point hits, (first one in Z order)
Definition ocpart.cpp:830
OC part class represents an embeded or linked part in a document.
Definition ocpart.h:38
bool Open(bool open)
Definition ocpart.h:100
bool IsVisible(const owl::TRect &logicalRect) const
Definition ocpart.h:69
int Detach()
Definition ocpart.cpp:761
HRESULT QueryServer(const IID &iid, void **iface)
Query server for its interfaces.
Definition ocpart.cpp:239
bool Draw(HDC dc, const owl::TRect &pos, const owl::TRect &clip, TOcAspect aspect=asDefault)
Definition ocpart.cpp:707
bool EnumVerbs(const TOcVerb &)
Definition ocpart.cpp:738
bool Activate(bool activate)
Definition ocpart.cpp:642
bool IsSelected() const
Definition ocpart.h:76
bool IsLink() const
Definition ocpart.h:81
void SetPos(const owl::TPoint &pos)
Set part to the new position given in logical units.
Definition ocpart.cpp:605
void Delete()
Delete this object.
Definition ocpart.cpp:208
void SetSize(const owl::TSize &size)
Set part to the new size given in logical units.
Definition ocpart.cpp:616
void Select(bool select)
Definition ocpart.h:74
bool DoVerb(owl::uint)
Definition ocpart.cpp:747
bool IsActive() const
Definition ocpart.h:79
owl::TRect GetRect() const
Definition ocpart.h:67
Used to obtain the size of the rectangle that encloses the selection.
Definition ocview.h:364
Remote Viewer object for a server document.
Definition ocremvie.h:26
owl::TString GetContainerTitle()
Get the window text of the container.
Definition ocremvie.cpp:280
@ Link
Load-from-file is really a link.
Definition ocremvie.h:67
void Invalidate(TOcInvalidate)
Invalidate the site within the active view.
Definition ocremvie.cpp:217
bool SetContainerStatusText(LPCTSTR text)
Definition ocremvie.h:160
@ OpenEditing
Open editing.
Definition ocremvie.h:60
Use when doing parts save and load.
Definition ocview.h:326
owl::TSize PartSize
Definition ocview.h:471
owl::TSize SiteSize
Definition ocview.h:470
void SetScale(owl::uint16 percent)
Change the scaling factor.
Definition ocview.cpp:1207
The TOcView partner is a container (viewer) of a given (server/client) document.
Definition ocview.h:136
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
TOcPart * GetActivePart()
Definition ocview.h:178
void EvResize()
Definition ocview.cpp:303
bool ActivatePart(TOcPart *part)
Activate a given part.
Definition ocview.cpp:444
bool BrowseLinks()
Definition ocview.cpp:375
virtual void Rename()
Definition ocview.cpp:393
void SetupWindow(HWND hWin, bool embedded=false)
Definition ocview.cpp:229
bool Paste(bool linking=false)
Definition ocview.cpp:959
void EvActivate(bool activate)
View is activated/deactivated.
Definition ocview.cpp:338
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
The TOcxView partner is a container (viewer) of a given (server/client) document.
Definition occtrl.h:273
Derived from TClientDC, TOleClientDC is a helper class that translates between two different coordina...
Definition olewindo.h:385
TOleClientDC(TOleWindow &win, bool scale=true)
Constructs a TOleClientDC object .
Definition olewindo.cpp:51
Decorated frame that supports OLE 2 using OCF.
Definition oleframe.h:65
The generic OLE2 window. Use as a client of a frame window.
Definition olewindo.h:91
void EvSize(owl::uint sizeType, const owl::TSize &size)
Passes the event to TWindow::EvSize for normal processing and forwards the event to TOcView::EvResize...
bool EvOcViewLoadPart(TOcSaveLoad &ocLoad)
Requests that an embedded object load itself.
virtual bool EvOcAmbientSetBackColor(long rgb)
Handles the EV_OC_AMBIENT_SETBACKCOLOR message, which is sent by an OCX control.
bool EvOcViewSetLink(TOcLinkView &view)
Responds to an OC_VIEWSETLINK message TOcLinkView sends when the server document provides a link to a...
bool EvOcViewBorderSpaceReq(owl::TRect *rect)
Requests that the server create space for a tool bar in the view of an embedded object.
void SetupWindow() override
Establishes a connection between the TOcView object and the view's HWND so the view can send notifica...
Definition olewindo.cpp:286
virtual bool EvOcCtrlKeyDown(TCtrlKeyEvent *pev)
Handles the EV_OC_CTRLKEYDOWN message, which is sent by an OCX control.
bool HasActivePart()
Returns true if the container's view holds an in-place active embedded object.
Definition olewindo.cpp:980
virtual void InvalidatePart(TOcInvalidate invalid)
Invalidates the area where the embedded object exists.
Definition olewindo.cpp:424
TOcDocument * OcDoc
Holds the ObjectComponents document associated with this TOleWindow.
Definition olewindo.h:338
virtual bool EvOcAmbientSetSupportsMnemonics(bool support)
Handles the EV_OC_AMBIENT_SETSUPPORTSMNEMONICS message, which is sent by an OCX control.
void EvMDIActivate(HWND hWndActivated, HWND hWndDeactivated)
Responds to a message forwarded from the MDI child window (if one exists) and lets the TOcView class ...
bool EvOcViewGetItemName(TOcItemName &item)
Handles the EV_OC_VIEWGETITEMNAME. Returns false.
TOcView * GetOcView()
Points to the ObjectComponents container view associated with this window.
Definition olewindo.h:414
virtual bool EvOcAmbientSetTextAlign(short align)
Handles the EV_OC_AMBIENT_SETTEXTALIGN message, which is sent by an OCX control.
void CeFileClose(owl::TCommandEnabler &ce)
Enables the FileClose command, which lets the user exit from the window view.
Definition olewindo.cpp:623
void CeEditObject(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITOBJECT, which lets the user edit the embedded object.
Definition olewindo.cpp:868
void CmEditConvert()
Responds to a command with an ID of CM_EDITCONVERT by converting an object from one type to another.
Definition olewindo.cpp:918
virtual bool EvOcCtrlMouseUp(TCtrlMouseEvent *pev)
Handles the EV_OC_CTRLMOUSEUP message, which is sent by an OCX control.
void CmEditDelete()
Responds to a command with an ID of CM_EDITDELETE by deleting the selected text.
Definition olewindo.cpp:734
void EvOcViewSetTitle(LPCTSTR title)
Sets the window's caption to title.
void CeEditDelete(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITDELETE, which lets the user delete the selected object from th...
Definition olewindo.cpp:725
virtual bool EvOcAmbientGetMessageReflect(bool *msgReflect)
Handles the EV_OC_AMBIENT_GETMESSAGEREFLECT message, which is sent by an OCX control.
virtual bool EvOcAmbientGetUserMode(bool *mode)
Handles the EV_OC_AMBIENT_GETUSERMODE message, which is sent by an OCX control.
virtual bool EvOcCtrlKeyUp(TCtrlKeyEvent *pev)
Handles the EV_OC_CTRLKEYUP message, which is sent by an OCX control.
bool EvOcViewGetPalette(LOGPALETTE **palette)
Requests the color palette to draw the object.
void EvCommandEnable(owl::TCommandEnabler &) override
Overrides the usual EvCommandEnable message in order to enable the OLE verbs from CM_EDITFIRSTVERB to...
Definition olewindo.cpp:344
owl::TPoint DragPt
Indicates the point (in logical units) where the mouse is over the dragged object.
Definition olewindo.h:322
virtual void SetSelection(TOcPart *part)
Selects the embedded object indicated in the part parameter.
bool EvOcViewPartActivate(TOcPart &ocPart)
Notifies ObjectWindows container applications that an embedded object is active.
void CmEditPasteLink()
Responds to a command with an ID of CM_EDITPASTELINK by creating a link between the current document ...
Definition olewindo.cpp:806
TOcPart * InsertObject(TOcInitInfo &initInfo, owl::TRect *pos=0)
Definition olewindo.cpp:444
bool EvOcViewShowTools(TOcToolBarInfo &tbi)
Asks the server to provide its tool bars for display in the container's window.
bool EvOcViewScroll(TOcScrollDir scrollDir)
Asks the container to scroll the view window and updates any internal state as needed.
bool EvOcViewSavePart(TOcSaveLoad &ocSave)
Asks the server to write an embedded object's data (the part as represented by the ocSave parameter) ...
bool EvOcViewSetSiteRect(owl::TRect *rect)
Converts the rect to logical units.
void EvVScroll(owl::uint scrollCode, owl::uint thumbPos, HWND hWndCtl)
In response to a WM_VSCROLL message, EvVScroll calls TWindow::EvVScroll and invalidates the window.
owl::TPoint DragStart
Holds the point where the dragging of the embedded object began.
Definition olewindo.h:328
void CeEditCut(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITCUT, which lets a user copy and delete the selected object fro...
Definition olewindo.cpp:751
virtual bool EvOcAmbientGetForeColor(long *rgb)
Handles the EV_OC_AMBIENT_GETFORECOLOR message, which is sent by an OCX control.
virtual void SetupDC(owl::TDC &dc, bool scale=true)
Determines the viewport's origin and extent (the logical coordinates and the size of the device conte...
owl::TResult EvOcEvent(owl::TParam1 param1, owl::TParam2 param2)
Responds to a WM_OCEVENT message and subdispatches the message based on wParam.
TOcControl * GetOcControlOfOCX(CLSID ocxIID, owl::uint id=0)
Definition olewindo.cpp:581
virtual bool ShowCursor(HWND wnd, owl::uint hitTest, owl::uint mouseMsg)
Handles the WM_NCHITTEST message, setting the cursor according to its position on the screen.
virtual bool EvOcCtrlPropertyRequestEdit(TCtrlPropertyEvent *pev)
Handles the EV_OC_PROPERTYREQUESTEDIT message, which is sent by an OCX control.
void CmEditPaste()
Responds to a command with an ID of CM_EDITPASTE by pasting an object from the clipboard into the doc...
Definition olewindo.cpp:827
virtual bool EvOcCtrlErrorEvent(TCtrlErrorEvent *pev)
Handles the EV_OC_CTRLERROREVENT message, which is sent by an OCX control.
int MinWidth
The minimum width of the part.
Definition olewindo.h:358
virtual bool EvOcAmbientGetSupportsMnemonics(bool *support)
Handles the EV_OC_AMBIENT_GETSUPPORTSMNEMONICS message, which is sent by an OCX control.
bool IsOpenEditing() const
Checks whether the window is in Open-Edit mode.
Definition olewindo.cpp:434
virtual bool EvOcAmbientGetDisplayAsDefault(bool *disp)
Handles the EV_OC_AMBIENT_GETDISPLAYASDEFAULT message, which is sent by an OCX control.
bool EvOcViewGetScale(TOcScaleFactor &scaleFactor)
Responds to an OC_VIEWGETSCALE message and gets the scaling for the server object,...
void EvPaint()
Sets up the dc for proper scaling and scrolling and then calls the derived class's Paint method to pa...
virtual bool EvOcAmbientSetScaleUnits(owl::TString *units)
Handles the EV_OC_AMBIENT_SETSCALEUNITS message, which is sent by an OCX control.
void CmEditCopy()
Responds to a command with an ID of CM_EDITCOPY by copying the selected text to the clipboard.
Definition olewindo.cpp:783
virtual bool EvOcAmbientGetDisplayName(owl::TString **name)
Handles the EV_OC_AMBIENT_GETDISPLAYNAME message, which is sent by an OCX control.
LPCTSTR EvOcViewTitle()
Asks the container for the caption in its frame window.
void CmEditLinks()
Responds to a command with an ID of CM_EDITLINKS by updating the user-selected list of linked items i...
Definition olewindo.cpp:939
virtual bool EvOcAmbientGetScaleUnits(owl::TString **units)
Handles the EV_OC_AMBIENT_GETSCALEUNITS message, which is sent by an OCX control.
bool EvSetCursor(HWND hWndCursor, owl::uint hitTest, owl::uint mouseMsg)
Performs hit testing to tell where the cursor is located within the window and what object the cursor...
Definition olewindo.cpp:994
virtual bool EvOcViewTransformCoords(owl::uint verb)
virtual bool EvOcAmbientGetBackColor(long *rgb)
Handles the EV_OC_AMBIENT_GETBACKCOLOR message, which is sent by an OCX control.
virtual bool EvOcAmbientGetLocaleID(long *locale)
Handles the EV_OC_AMBIENT_GETLOCALEID message, which is sent by an OCX control.
owl::TPopupMenu * CreateVerbPopup(const TOcVerb &ocVerb)
Creates and enables a pop-up menu option (ocVerb) on the Edit menu.
virtual bool EvOcCtrlClick(TCtrlEvent *pev)
Handles the EV_OC_CTRLCLICK message, which is sent by an OCX control.
void EvLButtonDblClk(owl::uint modKeys, const owl::TPoint &point)
Responds to a mouse button double click message.
virtual bool EvOcViewPartInvalid(TOcPartChangeInfo &changeInfo)
Informs an active container that one of its embedded objects needs to be redrawn.
void CmEditPasteSpecial()
Responds to a command with an ID of CM_EDITPASTESPECIAL by letting the user select an object from a l...
Definition olewindo.cpp:851
virtual bool EvOcCtrlDblClick(TCtrlEvent *pev)
Handles the EV_OC_CTRLDBLCLICK message, which is sent by an OCX control.
virtual bool OleShutDown()
Shuts down the associated ObjectComponents partners, if possible.
virtual bool EvOcAmbientSetLocaleID(long locale)
Handles the EV_OC_AMBIENT_SETLOCALEID message, which is sent by an OCX control.
bool Remote
Returns true if the window represents an embedded server. Returns false otherwise.
Definition olewindo.h:351
void CeEditPasteLink(owl::TCommandEnabler &ce)
Enables a PasteLink command with an ID of CM_EDITPASTELINK, which lets the user link to the embedded ...
Definition olewindo.cpp:795
virtual LPCTSTR GetFileName()
On linking must be implemented and return the file name.
Definition olewindo.h:486
virtual bool Select(owl::uint modKeys, owl::TPoint &point)
Selects the embedded object at the specified point (measured in logical units).
virtual bool EvOcAmbientSetUserMode(bool mode)
Handles the EV_OC_AMBIENT_SETUSERMODE message, which is sent by an OCX control.
bool EvOcViewBorderSpaceSet(owl::TRect *rect)
Requests that the server's tool bar be placed in the container's view of an embedded object.
void CeEditPasteSpecial(owl::TCommandEnabler &ce)
Enables the PasteSpecial command, which lets the user select a clipboard format to be pasted or paste...
Definition olewindo.cpp:839
void CeEditInsertObject(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITINSERTOBJECT if the OcApp and OcView objects exist.
Definition olewindo.cpp:647
owl::TRect DragRect
Holds the rectangle being dragged.
Definition olewindo.h:325
virtual bool EvOcAmbientSetShowHatching(bool show)
Handles the EV_OC_AMBIENT_SETSETSHOWHATCHING message, which is sent by an OCX control.
owl::TUIHandle::TWhere DragHit
Indicates the position in the embedded object where the user points and clicks the mouse.
Definition olewindo.h:316
virtual bool PaintLink(owl::TDC &dc, bool erase, owl::TRect &rect, owl::TString &moniker)
Repaints part of an object on the given device context.
Definition olewindo.h:471
virtual bool EvOcAmbientGetTextAlign(short *align)
Handles the EV_OC_AMBIENT_GETTEXTALIGN message, which is sent by an OCX control.
owl::TRect Pos
Holds the current area in the window where the object is embedded.
Definition olewindo.h:335
bool EvOcViewDrag(TOcDragDrop &ddInfo)
Handles an OC_VIEWDRAG message asking the container to provide visual feedback while the user is drag...
void EvDoVerb(owl::uint whichVerb)
Executes an OLE-related menu option from the Edit menu (for example, Edit, Copy, or Play) that is ass...
TOcPart * DragPart
Points to the embedded object (the part) being dragged.
Definition olewindo.h:310
int MinHeight
The minimum height of the part.
Definition olewindo.h:361
owl::tstring ContainerName
Holds the name of the container.
Definition olewindo.h:348
void EvLButtonDown(owl::uint modKeys, const owl::TPoint &point)
Responds to a left button down message by beginning a mouse drag transaction at the given point.
virtual bool EvOcCtrlMouseMove(TCtrlMouseEvent *pev)
Handles the EV_OC_CTRLMOUSEMOVE message, which is sent by an OCX control.
virtual bool EvOcAmbientSetShowGrabHandles(bool show)
Handles the EV_OC_AMBIENT_SETSHOWGRABHANDLES message, which is sent by an OCX control.
bool EvOcViewBreakLink(TOcLinkView &view)
EvOcViewBreakLink responds to an OC_VIEWBREAKLINK message that TOcLinkView sends when the server docu...
void EvDropFiles(owl::TDropInfo dropInfo)
This is a response method for an incoming EV_WM_DROPFILES message.
virtual bool EvOcAmbientGetShowGrabHandles(bool *show)
Handles the EV_OC_AMBIENT_GETSHOWGRABHANDLES message, which is sent by an OCX control.
TOcControl * InsertControl(TOcInitInfo &initInfo, owl::TRect *pos=0, int id=0)
Definition olewindo.cpp:508
void Init()
Initializes the TOleWindow object with the appropriate window style and initializes the necessary dat...
Definition olewindo.cpp:231
TOcApp * GetOcApp()
Returns the ObjectComponents application associated with this window.
Definition olewindo.h:434
virtual bool EvOcAmbientSetUIDead(bool dead)
Handles the EV_OC_AMBIENT_SETUIDEAD message, which is sent by an OCX control.
bool EvOcViewDoVerb(owl::uint verb)
Handles the EV_OC_VIEWDOVERB message.
virtual void GetInsertPosition(owl::TRect &rect)
Gets the position (rect) where the embedded object is inserted.
Definition olewindo.cpp:670
virtual void GetLogPerUnit(owl::TSize &logPerUnit)
Gets the logical units (typically pixels) per inch for a document so that the document's embedded obj...
bool InClient(owl::TDC &dc, owl::TPoint &point)
Returns true if point is inside the client area of the window. Returns false otherwise.
void EvLButtonUp(owl::uint modKeys, const owl::TPoint &point)
Responds to a left button up message by ending a mouse drag action.
bool EvOcViewInsMenus(TOcMenuDescr &sharedMenu)
Requests that the menus in a composite menu (a menu composed of both the server's and the container's...
virtual bool EvOcAmbientSetForeColor(long rgb)
Handles the EV_OC_AMBIENT_SETFORECOLOR message, which is sent by an OCX control.
virtual bool EvOcAmbientSetDisplayName(owl::TString *name)
Handles the EV_OC_AMBIENT_SETDISPLAYNAME message, which is sent by an OCX control.
void CeEditConvert(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITCONVERT, which lets the user convert the selected object from ...
Definition olewindo.cpp:910
owl::uint EvMouseActivate(HWND topParent, owl::uint hitCode, owl::uint msg)
Forwards the WM_MOUSEACTIVATE message to the top parent of the TOleWindow object.
~TOleWindow()
Checks to see if there are any open views, and, if no open views exist, destroys the TOleWindow objec...
Definition olewindo.cpp:262
virtual bool EvOcCtrlPropertyChange(TCtrlPropertyEvent *pev)
Handles the EV_OC_CTRLPROPERTYCHANGE message, which is sent by an OCX control.
bool EvOcViewPasteObject(TOcInitInfo &init)
Pastes an OLE object into the document pointed to by the TOleWindow::OcDoc data member.
owl::TDC * DragDC
Points to the device context used while an object is being dragged.
Definition olewindo.h:319
void EvRButtonDown(owl::uint modKeys, const owl::TPoint &point)
Responds to a right button down message.
TOcScaleFactor Scale
Holds the current scaling factor. The server uses this information to determine how to scale the docu...
Definition olewindo.h:331
void CeEditShowObjects(owl::TCommandEnabler &ce)
Checks or unchecks the Edit|Show Objects menu command according to the value of the ShowObjects data ...
Definition olewindo.cpp:971
bool EvOcViewClose()
Asks the server to close a currently open document and its associated view.
virtual bool EvOcAmbientGetFont(IDispatch **font)
Handles the EV_OC_AMBIENT_GETFONT message, which is sent by an OCX control.
virtual bool EvOcAmbientGetShowHatching(bool *show)
Handles the EV_OC_AMBIENT_GETSHOWHATCHING message, which is sent by an OCX control.
void EvMenuSelect(owl::uint menuItemId, owl::uint flags, HMENU hMenu)
Handles WM_MENUSELECT to provide hint text in the container's status bar, based on the menu item id.
void CeEditPaste(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITPASTE, which lets the user paste the embedded object from the ...
Definition olewindo.cpp:816
virtual bool EvOcAmbientSetDisplayAsDefault(bool disp)
Handles the EV_OC_AMBIENT_SETDISPLAYASDEFAULT message, which is sent by an OCX control.
bool EvOcViewPartSize(TOcPartSize &size)
The server asks itself the size of its current rectangle and lets the container know about the size o...
auto CanClose() -> bool override
Intercept CanClose() to interpose OpenEdit semantics.
Definition olewindo.cpp:396
virtual bool EvOcAmbientSetMessageReflect(bool msgReflect)
Handles the EV_OC_AMBIENT_SETMESSAGEREFLECT message, which is sent by an OCX control.
bool EvOcViewOpenDoc(LPCTSTR path)
Asks the container to open an existing document, which will be used for linking from the embedding si...
void CleanupWindow() override
Performs normal window cleanup and informs the TOcView object that the window is closed.
virtual bool EvOcCtrlCustomEvent(TCtrlCustomEvent *pev)
Handles the EV_OC_CTRLCUSTOMEVENT message, which is sent by an OCX control.
void CeEditLinks(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITLINKS, which lets the user manually update the list of linked ...
Definition olewindo.cpp:928
void CmEditCut()
Responds to a command with an ID of CM_EDITCUT by copying the selected text to the clipboard before c...
Definition olewindo.cpp:761
TOcRemView * GetOcRemView()
Returns the server's view associated with this window.
Definition olewindo.h:426
void CmEditInsertControl()
Responds to a command with an ID of CM_EDITINSERTCONTROL by creating, initializing,...
Definition olewindo.cpp:710
virtual bool PaintSelection(owl::TDC &dc, bool erase, owl::TRect &rect, void *userData=0)
Repaints the selected portion of a document on the given device context.
Definition olewindo.h:458
TOcApp * OcApp
Holds the ObjectComponents application associated with this TOleWindow.
Definition olewindo.h:344
bool ShowObjects
Is true if the embedded object's frame (the gray or shaded brushes around the object) is displayed.
Definition olewindo.h:355
auto EvCommand(owl::uint id, HWND hWndCtl, owl::uint notifyCode) -> owl::TResult override
Overrides the usual EvCommand message to handle the OLE verbs from CM_EDITFIRSTVERB to CM_EDITLASTVER...
Definition olewindo.cpp:372
void CeEditInsertControl(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITINSERTCONTROL if the OcApp and OcView objects exist.
Definition olewindo.cpp:657
void EvMouseMove(owl::uint modKeys, const owl::TPoint &point)
Responds to a mouse move message with the appropriate transaction.
bool EvOcViewDrop(TOcDragDrop &ddInfo)
Requests a given object be dropped at a specified place on the container's window.
bool IsRemote() const
Returns true if the window represents an embedded server.
Definition olewindo.h:448
bool EvOcViewPaint(TOcViewPaint &vp)
Asks the server to paint an object at a given position on a specified device context.
virtual bool EvOcCtrlFocus(TCtrlFocusEvent *pev)
Handles the EV_OC_CTRLFOCUS message, which is sent by an OCX control.
void CeEditVerbs(owl::TCommandEnabler &ce)
Enables the Edit|Verbs command, which lets the user select one of the OLE-specific verbs from the Edi...
Definition olewindo.cpp:950
virtual TOcView * CreateOcView(owl::TRegLink *link, bool isRemote, IUnknown *outer)
Called to perform the actual setting up of the OcView member.
Definition olewindo.cpp:307
TOcView * OcView
Holds the ObjectComponents view or remote view (the server's) associated with the TOleWindow view.
Definition olewindo.h:341
bool EvOcViewClipData(TOcFormatData &format)
Requests clipboard data in the specified format.
virtual bool EvOcAmbientGetUIDead(bool *dead)
Handles the EV_OC_AMBIENT_GETUIDEAD message, which is sent by an OCX control.
bool EvOcViewAttachWindow(bool attach)
Attaches the view to its ObjectWindows parent window so that the user can perform open editing on the...
virtual bool EvOcCtrlMouseDown(TCtrlMouseEvent *pev)
Handles the EV_OC_CTRLMOUSEDOWN message, which is sent by an OCX control.
bool EvOcViewSetScale(TOcScaleFactor &scaleFactor)
Responds to an OC_VIEWSETSCALE message and handles the scaling for server application,...
virtual bool Deactivate()
If an embedded object is no longer the active embedded object, either because the user has ended an i...
void CeEditCopy(owl::TCommandEnabler &ce)
Enables a command with an ID of CM_EDITCOPY, which lets the user copy selected object to the clipboar...
Definition olewindo.cpp:773
bool EvOcViewSetData(TOcFormatData &format)
void CmEditShowObjects()
Responds to a command with an ID of CM_EDITSHOWOBJECTS by toggling the value of the ShowObjects data ...
Definition olewindo.cpp:960
virtual bool EvOcAmbientSetFont(IDispatch *font)
Handles the EV_OC_AMBIENT_SETFONT message, which is sent by an OCX control.
void CmEditInsertObject()
Responds to a command with an ID of CM_EDITINSERTOBJECT by creating, initializing,...
Definition olewindo.cpp:695
TOcDocument * GetOcDoc()
Returns the ObjectComponents document associated with this window.
Definition olewindo.h:405
void EvHScroll(owl::uint scrollCode, owl::uint thumbPos, HWND hWndCtl)
In response to a WM_HSCROLL message, EvHScroll calls TWindow::EvHScroll and invalidates the window.
bool EvOcViewGetSiteRect(owl::TRect *rect)
Gets the size of the rectangle (the site) where the embedded object is to be placed.
void EvSetFocus(HWND hWndLostFocus)
Responds to a change in focus of the window.
virtual void SetScale(owl::uint16 percent)
Sets the ratio of the embedded object's size to the size of the site.
virtual bool StartDrag(owl::uint modKeys, owl::TPoint &point)
virtual bool PaintParts(owl::TDC &dc, bool erase, owl::TRect &rect, bool metafile)
Repaints the embedded objects on the given device context.
OLE API related exception object.
Definition except.h:33
TFrameWindow * GetMainWindow()
Return the current main window.
Definition applicat.h:592
A device context class derived from TWindowDC, TClientDC provides access to the client area owned by ...
Definition dc.h:640
Class wrapper for management of color values.
Definition color.h:245
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
Definition window.h:209
@ Unchecked
Command is not enabled.
Definition window.h:226
@ Checked
Command is enabled.
Definition window.h:227
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
virtual bool SetViewportOrg(const TPoint &origin, TPoint *oldOrg=nullptr)
Sets this DC's viewport origin to the given origin value, and saves the previous origin in oldOrg.
Definition dc.cpp:444
virtual int GetDeviceCaps(int index) const
Used under WIN3.1 or later, GetDeviceCaps returns capability information about this DC.
Definition dc.cpp:373
void SelectObject(const TBrush &brush)
Selects the given GDI brush object into this DC.
Definition dc.cpp:113
virtual int SetMapMode(int mode)
Sets the current window mapping mode of this DC to mode.
Definition dc.cpp:431
bool DPtoLP(TPoint *points, int count=1) const
Converts each of the count points in the points array from device points to logical points.
Definition dc.h:1406
int SetROP2(int mode)
Sets the current foreground mix mode mode of this DC to the given mode value and returns the previous...
Definition dc.h:1180
bool LPtoDP(TPoint *points, int count=1) const
Converts each of the count points in the points array from logical points to device points.
Definition dc.h:1423
bool DrawFocusRect(int x1, int y1, int x2, int y2)
Draws the given rectangle on this DC in the style used to indicate focus.
Definition dc.h:1854
bool Rectangle(int x1, int y1, int x2, int y2)
Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.
Definition dc.h:2298
virtual bool SetWindowExt(const TSize &extent, TSize *oldExtent=nullptr)
Sets this DC's window x- and y-extents to the given extent values.
Definition dc.cpp:536
virtual void SelectStockObject(int index)
Selects into the DC a predefined stock pen, brush, font, or palette.
Definition dc.cpp:206
bool SetWindowOrg(const TPoint &origin, TPoint *oldOrg=nullptr)
Sets the origin of the window associated with this DC to the given origin value, and saves the previo...
Definition dc.cpp:506
virtual bool SetViewportExt(const TSize &extent, TSize *oldExtent=nullptr)
Sets this DC's viewport x- and y-extents to the given extent values.
Definition dc.cpp:474
TDropInfo is a simple class that supports file-name drag-and-drop operations using the WM_DROPFILES m...
Definition wsyscls.h:257
A nested class, TEventInfo provides specific information about the type of message sent,...
Definition eventhan.h:170
virtual bool Find(TEventInfo &info, TEqualOperator op=0)
Searches the list of response table entries looking for a match.
Definition eventhan.cpp:371
TResult Dispatch(TEventInfo &info, TParam1, TParam2=0)
Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handl...
Definition eventhan.cpp:396
The TMenu class encapsulates window menus.
Definition menu.h:77
HMENU GetSubMenu(int posItem) const
Returns the handle of the menu specified by posItem.
Definition menu.h:446
Derived from TCommandEnabler, TMenuItemEnabler is a command enabler for menu items.
Definition framewin.h:39
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
A DC class that wraps begin and end paint calls for use in an WM_PAINT response function.
Definition dc.h:671
PAINTSTRUCT Ps
The paint structure associated with this TPaintDC object.
Definition dc.h:677
TPen is derived from TGdiObject.
Definition gdiobjec.h:138
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
int X() const
Returns the x coordinate of the point.
Definition geometry.h:463
int Y() const
Returns the Y coordinate of the point.
Definition geometry.h:472
TPopupMenu creates an empty pop-up menu to add to an existing window or pop-up menu.
Definition menu.h:189
Iterator for Pointer Container.
Definition template.h:543
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
int Height() const
Returns the height of this rectangle (bottom - top).
Definition geometry.h:1048
TRect & Offset(int dx, int dy)
Changes this rectangle so its corners are offset by the given delta values.
Definition geometry.cpp:114
const TPoint & TopLeft() const
Returns the upperleft point.
Definition geometry.h:983
int Width() const
Returns the width of this rectangle (right - left).
Definition geometry.h:1039
void SetNull()
Sets the left, top, right, and bottom of the rectangle to 0.
Definition geometry.h:1075
TSize Size() const
Returns the size of rectangle.
Definition geometry.h:1057
A registration parameter table, composed of a list of TRegItems.
Definition registry.h:531
Derived from TWindowDC, TScreenDC is a DC class that provides direct access to the screen bitmap.
Definition dc.h:610
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
Assists in drawing user manupulators for on-screen objects.
Definition uihelper.h:186
void Paint(TDC &dc) const
Paints the TUIHandle object onto the specified device context, dc.
Definition uihandle.cpp:202
@ Outside
Hit completely outside the object.
Definition uihelper.h:222
@ MidCenter
Somewhere inside the rectangle.
Definition uihelper.h:217
@ Grapples
Eight grapple boxes are drawn.
Definition uihelper.h:238
@ DashFramed
Frame rect is drawn dashed.
Definition uihelper.h:237
@ HandlesIn
Handles on the inside of the rectange.
Definition uihelper.h:234
@ Framed
Frame rect is drawn solid.
Definition uihelper.h:236
static const TUIMetric CyDoubleClk
Definition uimetric.h:71
static const TUIMetric CxDoubleClk
Definition uimetric.h:70
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
static TPoint GetCursorPos()
Definition window.h:1212
bool SetCursor(TModule *module, TResId resId)
Sets the mouse cursor for the window, loading the given resId from the given module.
Definition window.cpp:3766
HMENU LoadMenu(TResId id) const
Definition window.h:611
HWND SetCapture()
Sets the mouse capture to the current window.
Definition window.h:2121
virtual void SetParent(TWindow *newParent)
Sets the parent for the specified window by setting Parent to the specified new Parent window object.
Definition window.cpp:738
TApplication * GetApplication() const
Gets a pointer to the TApplication object associated with this.
Definition window.h:1855
virtual void EvCommandEnable(TCommandEnabler &ce)
Called by WindowProc to handle WM_COMMAND_ENABLE messages, EvCommandEnable calls the CmXxxx command-h...
Definition window.cpp:1135
TRect GetWindowRect() const
Gets the screen coordinates of the window's rectangle.
Definition window.h:2257
void EvHScroll(uint scrollCode, uint thumbPos, HWND hWndCtl)
Response method for an incoming WM_HSCROLL message.
Definition window.cpp:1865
void EvVScroll(uint scrollCode, uint thumbPos, HWND hWndCtl)
Response method for an incoming WM_VSCROLL message.
Definition window.cpp:1892
virtual void InvalidateRect(const TRect &rect, bool erase=true)
Invalidates a specified client area.
Definition window.h:2834
void Init(TWindow *parent, LPCTSTR title, TModule *module)
Normal initialization of a default constructed TWindow.
Definition window.cpp:401
static void ReleaseCapture()
Releases the mouse capture from this window.
Definition window.h:2130
TModule * GetModule() const
Returns a pointer to the module object.
Definition window.h:1841
void RouteCommandEnable(HWND hInitCmdTarget, TCommandEnabler &ce)
Walks the chain of windows from the initial target window to this window.
Definition window.cpp:1161
void ClientToScreen(TPoint &point) const
Converts the client coordinates specified in point to screen coordinates for the new window.
Definition window.h:2248
bool IsChild(HWND hWnd) const
Returns true if the window is a child window or a descendant window of this window.
Definition window.h:3176
virtual void CleanupWindow()
Always called immediately before the HWindow becomes invalid, CleanupWindow gives derived classes an ...
Definition window.cpp:2640
HCURSOR LoadCursor(TResId id) const
Definition window.h:612
TResult ForwardMessage(HWND handle, bool send=true)
Forwards the window's current message.
Definition window.cpp:3302
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
Definition window.cpp:852
TRect GetClientRect() const
Gets the coordinates of the window's client area (the area in a window you can use for drawing).
Definition window.h:2217
virtual TResult EvCommand(uint id, HWND hWndCtl, uint notifyCode)
WindowProc calls EvCommand to handle WM_COMMAND messages.
Definition window.cpp:999
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
Definition window.cpp:2795
void EvSetFocus(HWND hWndLostFocus)
The default message handler for WM_SETFOCUS.
Definition window.h:4084
void ScreenToClient(TPoint &point) const
Uses the screen coordinates specified in point to calculate the client window's coordinates and then ...
Definition window.h:2192
virtual void SetupWindow()
Performs setup following creation of an associated MS-Windows window.
Definition window.cpp:2575
virtual void Paint(TDC &dc, bool erase, TRect &rect)
Repaints the client area (the area you can use for drawing) of a window.
Definition window.cpp:2071
bool IsFlagSet(uint mask)
Returns the state of the bit flag in Attr.Flags whose mask is supplied.
Definition window.h:1797
static HWND GetFocus()
Gets a handle to the window that has the focus.
Definition window.h:2139
void EvMenuSelect(uint menuItemId, uint flags, HMENU hMenu)
The default message handler for WM_MENUSELECT.
Definition window.h:3827
void EvSize(uint sizeType, const TSize &size)
Response method for an incoming WM_SIZE message.
Definition window.cpp:1632
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
Definition window.h:2822
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
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
#define _tcscat
Definition cygwin.h:83
#define _tcscpy
Definition cygwin.h:79
#define _T(x)
Definition cygwin.h:51
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition eventhan.h:492
Definition of abstract GDI object class and derived classes.
void ReadBaseObject(Base *base, ipstream &in)
Definition objstrm.h:1159
#define IMPLEMENT_STREAMABLE1(cls, base1)
Definition objstrm.h:1725
void WriteBaseObject(Base *base, opstream &out)
Definition objstrm.h:1150
@ AutoDelete
Definition gdibase.h:70
@ NoAutoDelete
Definition gdibase.h:70
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
@ wfAlias
TWindow is an alias to a preexisting HWND.
Definition window.h:59
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
EV_OC_CTRLEVENT_KEYUP
Definition olewindo.cpp:192
@ asDefault
Definition ocobject.h:69
EV_OC_VIEWSETLINK
Definition oleview.cpp:49
EV_OC_VIEWSETTITLE
Definition olewindo.cpp:114
EV_OC_VIEWDROP
Definition olewindo.cpp:117
EV_OC_VIEWSETSITERECT
Definition oledialg.cpp:20
@ meEnableBrowseClipboard
Definition ocobject.h:148
@ meEnableBrowseLinks
Definition ocobject.h:149
@ meEnablePasteLink
Definition ocobject.h:147
@ meEnablePaste
Definition ocobject.h:146
EV_OC_VIEWSHOWTOOLS
Definition olewindo.cpp:132
owl::uint32 BCID
Definition ocbocole.h:109
EV_OC_VIEWGETPALETTE
Definition olewindo.cpp:133
EV_OC_AMBIENT_GETFORECOLOR
Definition olewindo.cpp:149
EV_OC_VIEWCLOSE
Definition oleview.cpp:46
@ iwFile
Definition ocobject.h:101
@ iwNewOcx
Definition ocobject.h:106
@ iwNew
Definition ocobject.h:104
EV_OC_AMBIENT_SETSCALEUNITS
Definition olewindo.cpp:174
EV_OC_VIEWSCROLL
Definition olewindo.cpp:119
EV_OC_AMBIENT_GETFONT
Definition olewindo.cpp:161
EV_OC_CTRLEVENT_FOCUS
Definition olewindo.cpp:187
@ ihEmbed
Definition ocobject.h:95
EV_OC_CTRLEVENT_CLICK
Definition olewindo.cpp:179
EV_OC_VIEWBORDERSPACESET
Definition olewindo.cpp:116
EV_OC_AMBIENT_GETDISPLAYNAME
Definition olewindo.cpp:159
EV_OC_VIEWPASTEOBJECT
Definition olewindo.cpp:124
class _ICLASS TOcPart
Definition ocapp.h:34
EV_OC_AMBIENT_GETSHOWHATCHING
Definition olewindo.cpp:156
EV_OC_VIEWINSMENUS
Definition oleview.cpp:45
TOcInvalidate
Definition ocobject.h:59
@ invView
Definition ocobject.h:61
@ invData
Definition ocobject.h:60
EV_OC_VIEWOPENDOC
Definition oleview.cpp:47
EV_OC_AMBIENT_SETUIDEAD
Definition olewindo.cpp:168
EV_OC_AMBIENT_SETSHOWHATCHING
Definition olewindo.cpp:170
EV_OC_AMBIENT_SETSHOWGRABHANDLES
Definition olewindo.cpp:169
EV_OC_AMBIENT_SETDISPLAYASDEFAULT
Definition olewindo.cpp:171
class _ICLASS TOcControl
Definition ocdoc.h:34
EV_OC_CTRLEVENT_DBLCLICK
Definition olewindo.cpp:180
EV_OC_AMBIENT_SETFONT
Definition olewindo.cpp:175
EV_OC_AMBIENT_GETSUPPORTSMNEMONICS
Definition olewindo.cpp:158
EV_OC_VIEWPAINT
Definition olewindo.cpp:128
EV_OC_VIEWTITLE
Definition olewindo.cpp:113
EV_OC_VIEWPARTINVALID
EV_OC_VIEWDISCARDUNDO, // !CQ not processing this yet...
Definition oleview.cpp:39
EV_OC_AMBIENT_GETTEXTALIGN
Definition olewindo.cpp:151
EV_OC_VIEWPARTACTIVATE
Definition olewindo.cpp:123
EV_OC_VIEWBORDERSPACEREQ
Definition olewindo.cpp:115
EV_OC_CTRLEVENT_KEYDOWN
Definition olewindo.cpp:191
EV_OC_AMBIENT_SETSUPPORTSMNEMONICS
Definition olewindo.cpp:172
EV_OC_AMBIENT_SETUSERMODE
Definition olewindo.cpp:167
EV_OC_AMBIENT_SETBACKCOLOR
Definition olewindo.cpp:162
EV_OC_AMBIENT_GETUSERMODE
Definition olewindo.cpp:153
EV_OC_AMBIENT_GETDISPLAYASDEFAULT
Definition olewindo.cpp:157
EV_OC_CTRLEVENT_PROPERTYCHANGE
Definition olewindo.cpp:193
class _ICLASS TOcDocument
Definition ocpart.h:30
EV_OC_VIEWPARTSIZE
Definition olewindo.cpp:137
EV_OC_AMBIENT_GETMESSAGEREFLECT
Definition olewindo.cpp:152
EV_OC_AMBIENT_GETBACKCOLOR
Definition olewindo.cpp:148
EV_OC_AMBIENT_GETUIDEAD
Definition olewindo.cpp:154
EV_OC_VIEWSETDATA
Definition olewindo.cpp:135
EV_OC_VIEWCLIPDATA
Definition olewindo.cpp:134
EV_OC_AMBIENT_SETLOCALEID
Definition olewindo.cpp:164
EV_OC_AMBIENT_GETSCALEUNITS
Definition olewindo.cpp:160
Parent
Definition occtrl.cpp:152
EV_OC_VIEWSETSCALE
Definition olewindo.cpp:140
EV_OC_CTRLEVENT_PROPERTYREQUESTEDIT
Definition olewindo.cpp:194
EV_OC_AMBIENT_GETSHOWGRABHANDLES
Definition olewindo.cpp:155
EV_OC_VIEWGETITEMNAME
Definition oleview.cpp:51
EV_OC_VIEWGETSITERECT
Definition olewindo.cpp:121
EV_OC_CTRLEVENT_MOUSEUP
Definition olewindo.cpp:190
EV_OC_AMBIENT_SETTEXTALIGN
Definition olewindo.cpp:165
EV_OC_VIEWSAVEPART
Definition oleview.cpp:43
EV_OC_CTRLEVENT_MOUSEDOWN
Definition olewindo.cpp:188
EV_OC_VIEWATTACHWINDOW
Definition oleview.cpp:48
EV_OC_AMBIENT_GETLOCALEID
Definition olewindo.cpp:150
@ amExeMode
may be overridden per instance if running DLL
Definition ocreg.h:88
TOcDropAction
Definition ocobject.h:39
@ daDropMove
Definition ocobject.h:42
@ daDropLink
Definition ocobject.h:43
@ daDropCopy
Definition ocobject.h:41
EV_OC_VIEWGETSCALE
Definition olewindo.cpp:120
TOcScrollDir
Definition ocobject.h:52
EV_OC_AMBIENT_SETFORECOLOR
Definition olewindo.cpp:163
EV_OC_CTRLEVENT_MOUSEMOVE
Definition olewindo.cpp:189
EV_OC_VIEWBREAKLINK
Definition oleview.cpp:50
EV_OC_CTRLEVENT_CUSTOMEVENT
Definition olewindo.cpp:196
EV_OC_VIEWDRAG
Definition olewindo.cpp:118
EV_OC_AMBIENT_SETDISPLAYNAME
Definition olewindo.cpp:173
EV_OC_CTRLEVENT_ERROREVENT
Definition olewindo.cpp:195
EV_OC_VIEWLOADPART
Definition oleview.cpp:44
EV_OC_AMBIENT_SETMESSAGEREFLECT
Definition olewindo.cpp:166
EV_OC_VIEWDOVERB
Definition olewindo.cpp:144
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
EV_WM_LBUTTONUP
Definition docking.cpp:2056
EV_WM_SETCURSOR
Definition docking.cpp:99
EV_WM_DROPFILES
Definition mdiclien.cpp:33
EV_WM_MOUSEACTIVATE
Definition floatfra.cpp:30
EV_WM_HSCROLL
Definition notetab.cpp:55
EV_WM_LBUTTONDBLCLK
Definition docking.cpp:962
EV_WM_PAINT
Definition control.cpp:28
EV_WM_MOUSEMOVE
Definition docking.cpp:2054
const int IDW_TOOLBAR
Definition decframe.h:24
EV_WM_RBUTTONDOWN
Definition gadgetwi.cpp:49
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
WPARAM TParam1
First parameter type.
Definition dispatch.h:54
OWL_DIAGINFO
Definition animctrl.cpp:14
EV_WM_SETFOCUS
Definition edit.cpp:84
END_RESPONSE_TABLE
Definition button.cpp:26
EV_WM_MENUSELECT
Definition decframe.cpp:33
LRESULT TResult
Result type.
Definition dispatch.h:52
unsigned short uint16
Definition number.h:33
std::string tstring
Definition defs.h:79
EV_WM_VSCROLL
Definition scrollba.cpp:18
unsigned int uint
Definition number.h:25
EV_WM_LBUTTONDOWN
Definition checklst.cpp:195
EV_WM_SIZE
Definition decframe.cpp:34
EV_WM_MDIACTIVATE
Definition mdichild.cpp:30
#define WM_OCEVENT
Definition ocapp.h:337
Definition of TOcControl class - Proxy object representing a control in.
Definition of TOcDocument Class.
Definition of Compound Document TOcView Class.
TOleWindow - Class encapsulating a window which can be an OLE container or server window.
#define TYPESAFE_DOWNCAST(object, toClass)
Definition defs.h:269
Definition of class TScroller.
#define OleStr(s)
Definition string.h:128
Base struct for all control event messages.
Definition occtrl.h:366
For viewdrop & viewdrag.
Definition ocview.h:303
For part adornment painting over part, & painting views.
Definition ocview.h:312
Definition of TUIMetric, a UI metrics provider class.
Base window class TWindow definition, including HWND encapsulation.
#define EV_COMMAND_ENABLE(id, method)
Response table entry for enabling a command.
Definition windowev.h:193
#define EV_MESSAGE(message, method)
Response table entry for raw message handling Uses a dispatcher that just forwards WPARAM and LPARAM.
Definition windowev.h:113
#define EV_COMMAND(id, method)
Response table entry for a menu/accelerator/push button message.
Definition windowev.h:171