OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ocremvie.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 TOcRemView Class
7//----------------------------------------------------------------------------
8#include <ocf/pch.h>
9
10#include <ocf/ocremvie.h>
11#include <ocf/ocapp.h>
12#include <ocf/ocstorag.h>
13#include <ocf/ocbocole.h>
14
15
16namespace ocf {
17
18using namespace owl;
19
20using namespace std;
21
24
25const _TCHAR RemViewStreamName[] = _T("OcRemoteView");
26
27//
28/// Constructor for compatibility only
29//
31:
32 BSiteI(0), BContainerI(0), BLSiteI(0),
33 State(Hidden),
34 Kind(DontKnow),
36{
37 Init();
38 TRACEX(OcfRefCount, 1, "TOcRemView() @" << (void*)this);
39}
40
41//
42/// New constructor that uses host interfaces
43//
46 TRegList* regList, IUnknown* outer)
47:
48 BSiteI(0), BContainerI(0), BLSiteI(0),
49 State(Hidden),
50 Kind(DontKnow),
52{
53 Init();
54 TRACEX(OcfRefCount, 1, "TOcRemView() @" << (void*)this);
55}
56
57//
58/// Do real constructor work
59//
60void
62{
63 // Create a site for this remote view
64 //
65 if (SUCCEEDED(OcApp.BOleComponentCreate(&BSite, (IUnknown*)(IBContainer*)this,
67
68 if (SUCCEEDED(BSite->QueryInterface(IID_IBSite, (LPVOID *)&BSiteI)))
69 Release();
70
71 // Connect the part and the site
72 //
73 if (BSiteI) {
74 const _TCHAR* progid = RegList->Lookup(OcApp.IsOptionSet(amDebug) ?
75 "debugprogid" : "progid");
76 BSiteI->Init((IBDataProvider2*)this, this, OleStr(progid), true);
77 }
78
79 if (SUCCEEDED(BSite->QueryInterface(IID_IBContainer, (LPVOID *)&BContainerI)))
80 Release();
81
82 if (SUCCEEDED(BSite->QueryInterface(IID_IBLinkable,(LPVOID *)&BLSiteI)))
83 BLSiteI->Release(); // avoid deadlock
84
85 if (SUCCEEDED(BSite->QueryInterface(IID_IBApplication, (LPVOID *)&BAppI)))
86 BAppI->Release(); // avoid deadlock
87 }
88}
89
90//
91//
92//
94{
95 // Make sure running object is unregistered
96 //
97 if (Kind == LoadFromFile && State != Closing)
98 EvClose();
99
100 // Disconnect the server view host with this OcRemView
101 //
103
104 // Release all helpers, but first call base class to release helpers
105 // BEFORE BSite is released
106 //
107 Shutdown();
108
109 if (BSite) {
110 BSite->Release(); // Causes OcAppShutDown if last TOcRemView
111 BSite = 0;
112 }
113}
114
115//
116/// Should only be called by the owner/creator of this object
117//
118void
120{
121 AddRef(); // cancel release, view holds a pointer but not a ref count
123}
124
125//
126//
127//
130{
132 HRESULT hr;
133
134 static_cast<void>
135 (
136 // interfaces
137 //
140
141 // helpers
142 //
143 || (BSite && SUCCEEDED(hr = BSite->QueryInterface(iid, iface)))
144
145 // base classes
146 //
148 );
149
150 return hr;
151}
152
153
156{
157 return GetOuter()->AddRef();
158}
159
162{
163 return GetOuter()->Release();
164}
165
168{
169 return GetOuter()->QueryInterface(iid, iface);
170}
171
172//----------------------------------------------------------------------------
173// IBDropDest forwarding to base
174//
175void _IFUNC
177 uint cf, HRESULT& hr)
178{
179 TOcView::DragFeedback(p, r, a, cf, hr);
180}
181
182//----------------------------------------------------------------------------
183// IBContainer overrides of TOcView implementation
184//
185
186//
187/// Show the container window
188//
195
196//
197/// Check option flag to see if in place activation is allowed
198//
201{
203 return HR_FALSE;
205 return HR_FALSE;
206 else
207 return HR_NOERROR;
208}
209
210//----------------------------------------------------------------------------
211// IBSite pass-thrus
212
213//
214/// Invalidate the site within the active view
215//
216void
222
223//
224/// Disconnect from the client site
225//
226void
228{
229 TRACEX(OcfRemView, 1, "Disconnect() on " << (void*)this);
230
231 if (BSiteI)
233}
234
235//
236/// Set focus to the inplace server
237//
238bool
240{
241 BSiteI->OnSetFocus(set);
242 return TOcView::EvSetFocus(set);
243}
244
245
246//----------------------------------------------------------------------------
247// IBDocument pass-thrus
248
249void
251{
252 TRACEX(OcfRemView, 1, "EvClose() on " << (void*)this);
253
254 if (BSite && BLSiteI)
255 BLSiteI->OnRename(0, 0);
256
257 OcDocument.Close(); // Disconnect from the parts, if any
259}
260
261//
262/// Update monikers with new name
263//
264void
266{
268
270
271 // Update the part's moniker
272 //
273// BLSiteI->OnRename(BLDocumentI, OleStr(DefaultStreamName));
274}
275
276//
277/// Get the window text of the container
278//
281{
282 if (BContainerI)
283 return BContainerI->GetWindowTitle();
284 return _T("");
285}
286
287//
288/// Get the initial size and position from the app
289//
290void
292{
294
295 // See if the container has already provided a site size, & if so provide it
296 // as a default size to the server object.
297 //
298 bool haveSite = false;
299 if (BSiteI)
300 haveSite = SUCCEEDED(BSiteI->GetSiteRect(&ps.PartRect, 0))
301 && !ps.PartRect.IsEmpty();
302
303 // Let the server app provide an initial server extent if it wants to.
304 //
306
307 // The server has not requested a specific size. If the container has
308 // already provided a site size, use it. Otherwise pick an arbitrary
309 // non-zero size.
310 //
311 if (!haveSite) {
312 HDC dc = ::GetDC(0);
313
314 // a 3" x 2" extent for server
315 //
316 ps.PartRect = TRect(0, 0,
317 ::GetDeviceCaps(dc, LOGPIXELSX)*3,
318 ::GetDeviceCaps(dc, LOGPIXELSY)*2);
319 ReleaseDC(0, dc);
320 }
321 }
322 Extent = ps.PartRect.Size();
323 Origin = ps.PartRect.TopLeft();
324}
325
326//
327/// Save remote view specific information to compound file
328//
329bool
331{
332 TOcStorage Storage(storageI);
333
334 // Create/open a stream in our storage to save part information
335 //
337 if (!SUCCEEDED(Storage.Stat(&statstg, STATFLAG_NONAME)))
338 return false;
339
340 TOcStream stream(Storage, RemViewStreamName, true, statstg.grfMode);
341
342 // Write TOcRemView data into stream
343 //
344 ulong count;
345 if (!SUCCEEDED(stream.Write(&Origin, sizeof(TPoint), &count)))
346 return false;
347
348 if (!SUCCEEDED(stream.Write(&Extent, sizeof(TSize), &count)))
349 return false;
350
351 return true;
352}
353
354//
355/// Load remote view specific information
356//
357bool
359{
360 TOcStorage Storage(storageI);
361
362 // Open a stream with oc part information
363 //
365 if (!HRSucceeded(Storage.Stat(&statstg, STATFLAG_NONAME)))
366 return false;
367
368 try {
369 TOcStream stream(Storage, RemViewStreamName, false, statstg.grfMode);
370
371 // Read TOcPart data from stream. Server part info will be read in as
372 // needed after Init()
373 //
374 ulong count;
375 if (!HRSucceeded(stream.Read(&Origin, sizeof(TPoint), &count)))
376 return false;
377
378 if (!HRSucceeded(stream.Read(&Extent, sizeof(TSize), &count)))
379 return false;
380 }
381 catch (TXObjComp&) {
382 // There is no remote view related info saved.
383 // This happens when saving the document while running as a stand alone
384 // app. But subsequently, a embed from file is executed.
385 }
386
387 return true;
388}
389
390//----------------------------------------------------------------------------
391// IBContains
392
393//
394/// This is called when we want to create a part from data saved
395/// in the storage named "path"
396//
399{
401
403
404 // Assume for now that we are created to load our object from a file. Kind
405 // will get changed later to Link if we are asked to Open()
406 //
408
409 // Read object's data from storage
410 //
412 return HR_FAIL;
413 }
414
415 // Pretend we are open editing to make sure that the doc server is attached
416 // to a child window in case this is a link.
417 //
420
421 // If embed from file, we had to call BDocumentI->Init() to initialize
422 // IBApplication, but we do not want to register the drop target, therefore,
423 // we use a 0 for the window handle.
424 //
427 BDocumentI->Init(this);
429
430 // Register this document in running object table
431 //
433 return HR_NOERROR;
434}
435
438{
439 if (Kind == LoadFromFile)
440 Kind = Link; // must be a link, not a transient load
441
443}
444
445//----------------------------------------------------------------------------
446// IDataNegotiator implementation to eliminate ambiguity (IBPart & IBDropDest)
447
453
456{
457 return TOcView::GetFormat(index, fmt);
458}
459
460//----------------------------------------------------------------------------
461// IBDataProvider2 implementation
462
463//
464/// Request native data for pasting into client application.
465/// This is only called at paste time (not at copy time).
466//
469{
471
473 if (format) {
476 return formatData.Handle;
477 }
478 return 0;
479}
480
481//
482/// Request native data for pasting into client application.
483/// This is only called at paste time (not at copy time).
484//
487{
490
492 if (format) {
495 return HR_NOERROR;
496 }
497 return HR_FAIL;
498}
499
500//
501/// Render the view in the DC provided. May be a MetaFile
502/// Packup all the args & forward message to real view to paint
503//
505TOcRemView::Draw(HDC dc, const RECTL * pos, const RECTL * clip,
507{
508 PRECONDITION(dc);
509 bool metafile = ::GetDeviceCaps(dc, TECHNOLOGY) == DT_METAFILE;
510
511 // Rely on the BOle shading
512 //
513 if (bd == drShadingOnly)
514 return HR_NOERROR;
515
516 TRect p((int)pos->left, (int)pos->top, (int)pos->right, (int)pos->bottom);
517 TRect c((int)clip->left, (int)clip->top, (int)clip->right, (int)clip->bottom);
518
523 int oldMapMode;
524 HRGN hRgn;
525
526 if (metafile) {
527 p.SetEmpty();
528 ::SetMapMode(dc, MM_ANISOTROPIC);
529
530 ::SetWindowExtEx(dc, Extent.cx, Extent.cy, 0);
531 ::SetWindowOrgEx(dc, 0, 0, 0);
532 }
533 else if (!OcApp.IsOptionSet(amExeModule)) {
534 if (p.Width() != Extent.cx || p.Height() != Extent.cy) {
537 }
538 hRgn = ::CreateRectRgn(0, 0, 0, 0);
539 ::GetClipRgn(dc, hRgn);
540 ::LPtoDP(dc, (TPoint*)&p, 2);
541 ::LPtoDP(dc, (TPoint*)&c, 2);
542 ::IntersectClipRect(dc, c.left, c.top, c.right, c.bottom);
543
544 ::SetViewportOrgEx(dc, p.left, p.top, &oldViewOrg);
548 oldMapMode = ::GetMapMode(dc);
549 }
550
551 p.Normalize();
552 c.Normalize();
553
554 TOcViewPaint vp = { dc, &p, &c, (TOcAspect)aspect, false, 0, 0 };
555 bool result = ServerHost->EvOcViewPaint(vp);
556
557 // Restore the dc attributes
558 //
560 ::SetMapMode(dc, oldMapMode);
564 ::SetWindowExtEx(dc, oldWinExt.cx, oldWinExt.cy, 0);
565 ::SelectClipRgn(dc, hRgn);
567 }
568
569 return HRFailIfZero(result);
570}
571
572//
573/// Return the 'size' of the document that this view in on
574//
577{
578 *size = Extent;
579 return HR_NOERROR;
580}
581
582//
583/// Save the document that we are a view on
584//
593
594//----------------------------------------------------------------------------
595// IBPart2 implementation
596
597//
598/// Load the associated document and activate the remote view
599//
602{
604
605 // Now we know that we are a normal embedding
606 //
607 Kind = Embedding;
608
609 // If existing document, notify the app to read it in.
610 //
611 if (initInfo->Where == iwStorage) {
612 TOcSaveLoad ocLoad(initInfo->Storage, true, true);
614 return HR_FAIL;
615 }
616 else if (initInfo->Where == iwNew)
618
619 // Show & activate this embedded object
620 //
621 Show(true);
622 Activate(true);
623
624 return HR_NOERROR;
625}
626
627//
628/// Close the remote view window, & if canShutDown is true, try to close the
629/// server app too
630//
633{
634 TRACEX(OcfRemView, 1, "Close() on " << (void*)this <<
635 " Closing:" << (int)ToBool(State==Closing) << " Win:" << hex <<
636 static_cast<void*>(ServerHost->EvOcGetWindow()));
637
638 // Keep DLL server in memory until its ref count goes to 0
639 //
641 EvClose();
642 }
643
644 // Remember that we are closing so that we don't do Close() again
645 //
646 State = Closing;
647
648 return HR_NOERROR;
649}
650
651//
652/// Query to determine if this server view can open in place
653//
656{
658 return HR_FALSE; // Force server to open edit
659 else
660 return HR_NOERROR; // allow in place activation
661}
662
663//
664/// Set a new position for our document within its container
665//
668{
669 Origin = *(POINT*)&r->left;
670
671 CHECK(BSiteI);
675
676 // No scaling
677 //
678 if (scale.xN == 1 && scale.yN == 1) {
679 scaleFactor.SiteSize.cx = scaleFactor.PartSize.cx = r->right - r->left;
680 scaleFactor.SiteSize.cy = scaleFactor.PartSize.cy = r->bottom - r->top;
681 }
682
683 ::MoveWindow(GetWindow(), r->left, r->top,
684 scaleFactor.SiteSize.cx, scaleFactor.SiteSize.cy, true);
685
687
688 return HR_NOERROR;
689}
690
693{
694 Extent = *size;
695 return HR_NOERROR;
696}
697
698//
699/// Activate this view
700//
703{
704 if (activate && GetWindow())
705 ::SetFocus(GetWindow());
706 return HR_NOERROR;
707}
708
709//
710/// Show/Hide the server view window
711//
714{
715 if (GetWindow())
716 ::ShowWindow(GetWindow(), show ? SW_SHOW : SW_HIDE);
717 return HR_NOERROR;
718}
719
720//
721/// Start or end open editing
722/// Work with the window Z-order and parenting
723//
726{
727 if (open) {
728 // Just show the window, if it's already active
729 //
730 if (State == InPlaceActive) {
732 ::BringWindowToTop(contWin);
733 }
734 else {
735 State = OpenEditing; // we now transition into open edit state
736 if (Kind == LoadFromFile)
737 Kind = Link; // must be a link, not a transient load
738
739 // Register drag&drop target
740 //
741 BDocumentI->Init(this);
742
743 // Forward event to app to let it attach the window to an appropriate
744 // frame
745 //
747 BringToFront();
748
749 // Build up open edit caption in the form "<menuname> in <containername>"
750 //
751 if (RegList && Kind != Link) {
752 owl::tstring newTitle = (*RegList)["menuname"];
755 if (str)
756 newTitle += OleStr(str);
758 }
759 else {
760 ServerHost->EvOcViewSetTitle(nullptr); // if link, caption is filename
761 }
762 }
763 }
764 else {
765 // Unregister drag&drop target
766 //
768
769 // Reparent back to the real parent
770 //
772 }
773 return HR_NOERROR;
774}
775
776//
777/// Enumerate the verbs for our document
778//
781{
782 return HR_FAIL; // Not called on BOle parts
783}
784
785//
786/// Perform a verb on our document
787//
793
794//
795/// Open or close this view as an in-place edit session. If hWndParent is 0,
796/// then in-place is closing
797//
800{
801 if (hWndParent) {
802 State = InPlaceActive; // transition into in-place-active state
803
804 // Register drag&drop target
805 //
806 BDocumentI->Init(this);
807
808 ::SetParent(GetWindow(), hWndParent);
809 }
810 else {
811 State = Hidden; // transition back into normal, hidden state
813
814 // Deactivate in-place active object, if any
815 //
816 if (ActivePart)
817 ActivePart->Activate(false);
818
819 // Set back to real parent and don't show it
820 //
821 if (!ServerHost->EvOcViewAttachWindow(false)) {
822 Show(false);
823 ::SetParent(GetWindow(), OcApp.GetWindow());
824 }
825 }
826 return GetWindow();
827}
828
829//
830/// Insert the server's menus into the shared menubar
831//
834{
836
838 md.HMenu = hMenu;
839
840 int i;
841 for (i = 0; i < 6; i++) {
842 md.Width[i] = (int)omw->Width[i];
843 i++;
844 md.Width[i] = 0; // make sure the server's are zeroed
845 omw->Width[i] = 0;
846 }
847
849 return HR_FAIL;
850
851 for (i = 0; i < 6; i++)
852 omw->Width[i] = md.Width[i];
853
854 return HR_NOERROR;
855}
856
857//
858/// Retrieve rectangle info about the toolbars
859//
860static void
861getTBRects(TOcToolBarInfo & tbi,
864{
865 if (tbi.HLeftTB)
866 ::GetWindowRect(tbi.HLeftTB, &ltbr);
867 else
868 ltbr.Set(0,0,0,0);
869 if (tbi.HTopTB)
870 ::GetWindowRect(tbi.HTopTB, &ttbr);
871 else
872 ttbr.Set(0,0,0,0);
873 if (tbi.HRightTB)
874 ::GetWindowRect(tbi.HRightTB, &rtbr);
875 else
876 rtbr.Set(0,0,0,0);
877 if (tbi.HBottomTB)
878 ::GetWindowRect(tbi.HBottomTB, &btbr);
879 else
880 btbr.Set(0,0,0,0);
881 border.Set(ltbr.Width() ? ltbr.Width()-1 : 0,
882 ttbr.Height() ? ttbr.Height()-1 : 0,
883 rtbr.Width() ? rtbr.Width()-1 : 0,
884 btbr.Height() ? btbr.Height()-1 : 0);
885}
886
887//
888/// Actually parent & position the toolbars in the container frame.
889/// Assume all the toolbars have WS_BORDER style & overlaps accordingly
890//
891static void
892adjustTBPos(TOcToolBarInfo & tbi, const TRect& contFrameR, bool setParent,
893 const TRect& ttbr, const TRect& ltbr,
894 const TRect& btbr, const TRect& rtbr,
895 const TRect& border)
896{
897 if (tbi.HLeftTB) {
898 ::MoveWindow(tbi.HLeftTB, -1, -1+border.top, ltbr.Width(),
899 contFrameR.Height()+2-border.top-border.bottom, true);
900 if (setParent) {
901 ::SetParent(tbi.HLeftTB, tbi.HFrame);
902 ::ShowWindow(tbi.HLeftTB, SW_NORMAL);
903 }
904 }
905 if (tbi.HTopTB) {
906 ::MoveWindow(tbi.HTopTB, -1, -1, contFrameR.Width()+2, ttbr.Height(),
907 true);
908 if (setParent) {
909 ::SetParent(tbi.HTopTB, tbi.HFrame);
910 ::ShowWindow(tbi.HTopTB, SW_NORMAL);
911 }
912 }
913 if (tbi.HRightTB) {
914 ::MoveWindow(tbi.HRightTB, contFrameR.right-rtbr.Width()+1, -1+border.top,
915 rtbr.Width(), contFrameR.Height()+2-border.top-border.bottom,
916 true);
917 if (setParent) {
918 ::SetParent(tbi.HRightTB, tbi.HFrame);
919 ::ShowWindow(tbi.HRightTB, SW_NORMAL);
920 }
921 }
922 if (tbi.HBottomTB) {
923 ::MoveWindow(tbi.HBottomTB, -1, contFrameR.bottom-btbr.Height()+1,
924 contFrameR.Width()+2, btbr.Height(), true);
925 if (setParent) {
926 ::SetParent(tbi.HBottomTB, tbi.HFrame);
927 ::ShowWindow(tbi.HBottomTB, SW_NORMAL);
928 }
929 }
930}
931
932//
933/// Show or hide the tool windows used by our view
934//
937{
939 tbi.Show = show;
940 tbi.HTopTB = tbi.HLeftTB = tbi.HBottomTB = tbi.HRightTB = 0;
941 if (show)
942 tbi.HFrame = BAppI->GetWindow(); // Container's frame
943 else
944 tbi.HFrame = OcApp.GetWindow(); // This server's frame
945
946 // Let the view create/destroy its toolbars & fill them in for us to work
947 // with. View may also change the HFrame for special purposes
948 //
950 return HR_FAIL;
951
952 // Assist view in showing toobars by negotiating, parenting to the container
953 // frame & showing the provided toolbars
954 //
955 if (show) {
956 TRect ltbr;
957 TRect ttbr;
958 TRect rtbr;
959 TRect btbr;
961 getTBRects(tbi, ltbr, ttbr, rtbr, btbr, border);
962
963 // Request the desired border space from the container. Scale back requests
964 // as needed if container denies requests.
965 //
966 int i;
967 for (i = 0; i < 3; i++) {
969 switch (i) {
970 case 0:
971 border.bottom = 0;
972 tbi.HBottomTB = 0;
973 break;
974 case 1:
975 border.right = 0;
976 tbi.HRightTB = 0;
977 break;
978 case 2:
979 border.left = 0;
980 tbi.HLeftTB = 0;
981 }
982 }
983 else
984 break;
985 }
986 if (i == 3 || !SUCCEEDED(BAppI->SetBorderSpace(&border)))
987 return HR_FAIL; // don't know why it failed. Give up
988
991 adjustTBPos(tbi, contFrameR, true, ltbr, ttbr, rtbr, btbr, border);
992 }
993 // Assist view in hiding toobars by reparenting them to frame (defaults to
994 // this server) & hiding them
995 //
996 else {
997 if (tbi.HLeftTB) {
998 ::SetParent(tbi.HLeftTB, tbi.HFrame);
999 ::ShowWindow(tbi.HLeftTB, SW_HIDE);
1000 }
1001 if (tbi.HTopTB) {
1002 ::SetParent(tbi.HTopTB, tbi.HFrame);
1003 ::ShowWindow(tbi.HTopTB, SW_HIDE);
1004 }
1005 if (tbi.HRightTB) {
1006 ::SetParent(tbi.HRightTB, tbi.HFrame);
1007 ::ShowWindow(tbi.HRightTB, SW_HIDE);
1008 }
1009 if (tbi.HBottomTB) {
1010 ::SetParent(tbi.HBottomTB, tbi.HFrame);
1011 ::ShowWindow(tbi.HBottomTB, SW_HIDE);
1012 }
1013 }
1014 return HR_NOERROR;
1015}
1016
1017//
1018/// A container window has resized. Perform any necessary adjustment of our
1019/// tools.
1020//
1021void _IFUNC
1023{
1024 if (!isMainFrame)
1025 return;
1026
1027 TRect ltbr;
1028 TRect ttbr;
1029 TRect rtbr;
1030 TRect btbr;
1031 TRect border;
1032 getTBRects(ToolBarInfo, ltbr, ttbr, rtbr, btbr, border);
1033 adjustTBPos(ToolBarInfo, *contFrameR, false, ltbr, ttbr, rtbr, btbr, border);
1034}
1035
1036//
1037/// Let the server provide drag feedback
1038//
1041{
1043
1045 TOcDragDrop dd = { 0, &awhere, 0 };
1047}
1048
1049//
1050/// Optional palette query for
1051//
1059
1062{
1063 return HR_FAIL; // Not called on BOle parts.
1064}
1065
1068{
1070
1071 return TOcView::QueryInterface(iid, iface); // Unused on server side
1072}
1073
1076{
1077 return 0; // not called on BOle parts
1078}
1079
1080} // OCF namespace
1081
1082//==============================================================================
1083
#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
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)
Definition checks.h:429
IBContainer – Supported by container app's document window.
Definition ocbocole.h:398
IBDataProvider2 – new version of IBDataProvider.
Definition ocbocole.h:233
virtual HRESULT _IFUNC Init(IBContainer *)=0
virtual void _IFUNC OnClose()=0
virtual HRESULT _IFUNC OnRename(IBLinkable *pContainer, LPCOLESTR name)=0
IBPart – Supported by server objects.
Definition ocbocole.h:241
IBSite – Supported by container apps for each linked/embedded object.
Definition ocbocole.h:437
virtual HRESULT _IFUNC GetSiteRect(owl::TRect *, owl::TRect *)=0
virtual void _IFUNC OnSetFocus(BOOL)=0
virtual void _IFUNC Invalidate(TOcInvalidate)=0
virtual HRESULT _IFUNC GetZoom(TOcScaleInfo *pScale)=0
virtual HRESULT _IFUNC Init(IBDataProvider *, IBPart *, LPCOLESTR, BOOL)=0
virtual void _IFUNC Disconnect()=0
virtual HRESULT _IFUNC SetBorderSpace(const owl::TRect *)=0
virtual LPCOLESTR _IFUNC GetWindowTitle()=0
virtual HRESULT _IFUNC RequestBorderSpace(const owl::TRect *)=0
virtual HWND _IFUNC GetWindow()=0
virtual HRESULT _IFUNC GetWindowRect(owl::TRect *)=0
HRESULT BOleComponentCreate(IUnknown **retIface, IUnknown *outer, owl::uint32 idClass)
Create a BOle helper for one of our OC objects in this app.
Definition ocapp.cpp:213
bool IsOptionSet(owl::uint32 option) const
Definition ocapp.h:302
virtual HWND EvOcGetWindow() const =0
virtual bool EvOcViewOpenDoc(LPCTSTR path)=0
virtual void SetWindow(HWND)
Definition ocview.h:528
OC Document class, holds parts & is a owner of views.
Definition ocdoc.h:43
void SetName(const owl::tstring &newName)
Notify container that doc pathname has changed.
Definition ocdoc.cpp:349
Used to obtain the native clipboard format data.
Definition ocview.h:416
Clipboard format wrapper.
Definition ocview.h:55
int Find(const TOcFormat *format) const
Definition ocview.h:111
bool Activate(bool activate)
Definition ocpart.cpp:642
Used to obtain the size of the rectangle that encloses the selection.
Definition ocview.h:364
TOcToolBarInfo ToolBarInfo
Inplace tool bar info.
Definition ocremvie.h:149
IBApplication * BAppI
Site's application interface.
Definition ocremvie.h:147
HRESULT _IFUNC Close()
Close the remote view window, & if canShutDown is true, try to close the server app too.
Definition ocremvie.cpp:632
HRESULT _IFUNC InsertMenus(HMENU, TOcMenuWidths *)
Insert the server's menus into the shared menubar.
Definition ocremvie.cpp:833
HRESULT _IFUNC Show(BOOL)
Show/Hide the server view window.
Definition ocremvie.cpp:713
void Rename()
Update monikers with new name.
Definition ocremvie.cpp:265
HRESULT _IFUNC SetFormatData(TOcFormatInfo *fmt, HANDLE data, BOOL release)
Request native data for pasting into client application.
Definition ocremvie.cpp:486
void _IFUNC DragFeedback(owl::TPoint *p, const owl::TRect *r, TOcMouseAction a, owl::uint cf, HRESULT &hr)
Definition ocremvie.cpp:176
HRESULT _IFUNC Open(BOOL)
Start or end open editing Work with the window Z-order and parenting.
Definition ocremvie.cpp:725
HRESULT _IFUNC SetHost(IBContainer *objContainer)
IUnknown * BSite
In-place site helper.
Definition ocremvie.h:145
HRESULT _IFUNC EnumVerbs(TOcVerb *)
Enumerate the verbs for our document.
Definition ocremvie.cpp:780
HRESULT _IFUNC GetPalette(LOGPALETTE **)
Optional palette query for.
HANDLE _IFUNC GetFormatData(TOcFormatInfo *)
Request native data for pasting into client application.
Definition ocremvie.cpp:468
IBContainer * BContainerI
Definition ocremvie.h:143
HRESULT _IFUNC SetPartSize(owl::TSize *)
Definition ocremvie.cpp:692
owl::TString GetContainerTitle()
Get the window text of the container.
Definition ocremvie.cpp:280
void Init()
Do real constructor work.
Definition ocremvie.cpp:61
@ LoadFromFile
Transient load-from-file.
Definition ocremvie.h:66
@ Link
Load-from-file is really a link.
Definition ocremvie.h:67
@ Embedding
Normal Embedding.
Definition ocremvie.h:65
bool Load(IStorage *storageI)
Load remote view specific information.
Definition ocremvie.cpp:358
void _IFUNC FrameResized(const owl::TRect *, BOOL)
A container window has resized.
HRESULT _IFUNC GetPartSize(owl::TSize *)
Return the 'size' of the document that this view in on.
Definition ocremvie.cpp:576
void Invalidate(TOcInvalidate)
Invalidate the site within the active view.
Definition ocremvie.cpp:217
HRESULT _IFUNC CanOpenInPlace()
Query to determine if this server view can open in place.
Definition ocremvie.cpp:655
IBSite * BSiteI
Site interface.
Definition ocremvie.h:146
HRESULT _IFUNC Draw(HDC, const RECTL *, const RECTL *, TOcAspect, TOcDraw bd)
Render the view in the DC provided.
Definition ocremvie.cpp:505
HRESULT _IFUNC GetFormat(owl::uint index, TOcFormatInfo *fmt)
Definition ocremvie.cpp:455
HRESULT _IFUNC ShowTools(BOOL)
Show or hide the tool windows used by our view.
Definition ocremvie.cpp:936
owl::ulong _IFUNC AddRef()
Definition ocremvie.cpp:155
HRESULT _IFUNC QueryInterface(const GUID &iid, void **iface)
Definition ocremvie.cpp:167
LPOLESTR _IFUNC GetName(TOcPartName)
HRESULT _IFUNC AllowInPlace()
Check option flag to see if in place activation is allowed.
Definition ocremvie.cpp:200
virtual bool EvSetFocus(bool set)
Set focus to the inplace server.
Definition ocremvie.cpp:239
TKind Kind
What kind of server view this is.
Definition ocremvie.h:152
HRESULT _IFUNC DoQueryInterface(const IID &iid, void **pif)
owl::ulong _IFUNC Release()
Definition ocremvie.cpp:161
HRESULT QueryObject(const IID &iid, void **iface)
Definition ocremvie.cpp:129
HWND _IFUNC OpenInPlace(HWND)
Open or close this view as an in-place edit session.
Definition ocremvie.cpp:799
TState State
Current state of this server view.
Definition ocremvie.h:151
HRESULT _IFUNC DoVerb(owl::uint)
Perform a verb on our document.
Definition ocremvie.cpp:789
@ Hidden
Current state of this server view.
Definition ocremvie.h:58
@ InPlaceActive
Inplace active.
Definition ocremvie.h:61
@ Closing
Shutting down.
Definition ocremvie.h:59
@ OpenEditing
Open editing.
Definition ocremvie.h:60
void Disconnect()
Disconnect from the client site.
Definition ocremvie.cpp:227
HRESULT _IFUNC Activate(BOOL)
Activate this view.
Definition ocremvie.cpp:702
HRESULT _IFUNC GetPart(IBPart **, LPCOLESTR)
Definition ocremvie.cpp:437
HRESULT _IFUNC SetPartPos(owl::TRect *)
Set a new position for our document within its container.
Definition ocremvie.cpp:667
TOcRemView(TOcDocument &doc, TOcContainerHost *cs, TOcServerHost *ss, owl::TRegList *regList=0, IUnknown *outer=0)
New constructor that uses host interfaces.
Definition ocremvie.cpp:44
owl::uint _IFUNC CountFormats()
Definition ocremvie.cpp:449
virtual void ReleaseObject()
Should only be called by the owner/creator of this object.
Definition ocremvie.cpp:119
IBLinkable * BLSiteI
for site moniker
Definition ocremvie.h:144
void GetInitialRect(bool selection=false)
Get the initial size and position from the app.
Definition ocremvie.cpp:291
bool Save(IStorage *storageI)
Save remote view specific information to compound file.
Definition ocremvie.cpp:330
HRESULT _IFUNC BringToFront()
Show the container window.
Definition ocremvie.cpp:190
Use when doing parts save and load.
Definition ocview.h:326
virtual bool EvOcViewSetData(TOcFormatData &format)=0
virtual bool EvOcViewPartSize(TOcPartSize &size)=0
virtual HWND EvOcGetWindow() const =0
virtual bool EvOcViewGetPalette(LOGPALETTE **palette)=0
virtual bool EvOcViewDrag(TOcDragDrop &ddInfo)=0
virtual bool EvOcViewPaint(TOcViewPaint &vp)=0
virtual bool EvOcViewClipData(TOcFormatData &format)=0
virtual bool EvOcViewAttachWindow(bool attach)=0
virtual bool EvOcViewLoadPart(TOcSaveLoad &ocLoad)=0
virtual bool EvOcViewSavePart(TOcSaveLoad &ocSave)=0
virtual bool EvOcViewDoVerb(owl::uint verb)=0
virtual bool EvOcViewShowTools(TOcToolBarInfo &tbi)=0
virtual bool EvOcViewSetScale(TOcScaleFactor &scaleFactor)=0
virtual bool EvOcViewClose()=0
virtual bool EvOcViewInsMenus(TOcMenuDescr &sharedMenu)=0
virtual void EvOcViewSetTitle(LPCTSTR title)=0
HRESULT Stat(STATSTG *pstatstg, owl::uint32 grfStatFlag)
Definition ocstorag.cpp:484
The TOcView partner is a container (viewer) of a given (server/client) document.
Definition ocview.h:136
TOcDocument & OcDocument
Our OC document object.
Definition ocview.h:270
virtual void ReleaseObject()
Should only be called by the owner/creator of this object.
Definition ocview.cpp:173
virtual bool EvSetFocus(bool set)
Returns true if view keeps focus, false if the inplace server got it.
Definition ocview.cpp:352
HRESULT _IFUNC BringToFront()
Definition ocview.cpp:795
owl::TRegList * RegList
Definition ocview.h:288
TOcPart * ActivePart
Currently active part, if any.
Definition ocview.h:278
HRESULT QueryObject(const IID &iid, void **iface)
Callback from TUnknown's implementation of QueryInterface.
Definition ocview.cpp:190
void Shutdown()
Called from destructor of this class or of derived class to release helpers and host interfaces.
Definition ocview.cpp:148
TOcContainerHost * ContainerHost
The hosting app's container object.
Definition ocview.h:272
HWND _IFUNC GetWindow()
Definition ocview.cpp:572
owl::uint _IFUNC CountFormats()
Format count.
Definition ocview.cpp:543
HRESULT _IFUNC QueryInterface(const GUID &iid, void **iface)
Definition ocview.h:199
virtual void Rename()
Definition ocview.cpp:393
owl::TSize Extent
Definition ocview.h:283
HRESULT _IFUNC GetFormat(owl::uint, TOcFormatInfo *)
Format retrieval.
Definition ocview.cpp:552
HRESULT _IFUNC GetPart(IBPart **, LPCOLESTR)
Definition ocview.cpp:507
owl::TPoint Origin
Definition ocview.h:282
void _IFUNC DragFeedback(owl::TPoint *, const owl::TRect *, TOcMouseAction, owl::uint, HRESULT &hr)
Provide feedback to the users drag action in our container window.
Definition ocview.cpp:743
bool IsOptionSet(owl::uint32 option) const
Definition ocview.h:857
TOcFormatList FormatList
Definition ocview.h:285
TOcApp & OcApp
Our OC application object.
Definition ocview.h:269
TOcServerHost * ServerHost
The hosting app's server object.
Definition ocview.h:273
IBDocument * BDocumentI
Document interface on the document.
Definition ocview.h:263
virtual void EvClose()
View is shuting down.
Definition ocview.cpp:313
IUnknown * GetOuter()
Definition oleutil.h:269
Base OC exception class.
Definition except.h:90
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
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
void SetEmpty()
Empties this rectangle by setting left, top, right, and bottom to 0.
Definition geometry.h:898
int Width() const
Returns the width of this rectangle (right - left).
Definition geometry.h:1039
TRect & Normalize()
Normalizes this rectangle by switching the left and right data member values if left > right,...
Definition geometry.cpp:99
A registration parameter table, composed of a list of TRegItems.
Definition registry.h:531
LPCTSTR Lookup(LPCSTR key, TLangId lang=TLocaleString::UserDefaultLangId)
Performs the lookup of the TRegItems using a key (an item name such as progid) and returns the value ...
Definition regheap.cpp:58
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
#define _T(x)
Definition cygwin.h:51
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
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
TOcAspect
Definition ocobject.h:64
const BCID cidBOleInProcSite
Definition ocbocole.h:114
HRESULT HRFailIfZero(int bexpr)
Definition defs.h:126
const BCID cidBOleSite
Definition ocbocole.h:113
@ iwStorage
Definition ocobject.h:102
@ iwNew
Definition ocobject.h:104
Height
Definition occtrl.cpp:160
TOcInvalidate
Definition ocobject.h:59
bool HRSucceeded(HRESULT hr)
Definition defs.h:131
TOcMouseAction
Definition ocobject.h:46
@ voNoInPlace
Definition ocview.h:45
@ voNoInPlaceServer
Definition ocview.h:47
@ voNoNestedInPlace
Definition ocview.h:46
@ amExeMode
may be overridden per instance if running DLL
Definition ocreg.h:88
@ amExeModule
set for EXE components, 0 if DLL inproc server
Definition ocreg.h:87
@ amDebug
user requested launching for debugging
Definition ocreg.h:85
TOcPartName
Definition ocobject.h:87
TOcDraw
Definition ocobject.h:81
@ drShadingOnly
Definition ocobject.h:83
const TCHAR RemViewStreamName[]
Definition ocremvie.cpp:25
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned long ulong
Definition number.h:26
bool ToBool(const T &t)
Definition defs.h:291
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
TModule & GetGlobalModule()
Definition global.cpp:48
Definition of TOcApp application connection class.
ObjectComponents BOcOle engine linking & embedding interfaces.
interface _ICLASS IStorage
Definition ocdoc.h:25
#define HR_NOERROR
Definition defs.h:73
#define HR_FALSE
Definition defs.h:75
#define HR_FAIL
Definition defs.h:83
Definition of TOcRemView Class.
Definition of TOcStorage & TOcStream classes.
#define _IFUNC
Definition oleutil.h:28
#define OWL_INI
Definition defs.h:170
#define OleStr(s)
Definition string.h:128
For viewdrop & viewdrag.
Definition ocview.h:303
For part adornment painting over part, & painting views.
Definition ocview.h:312