OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ocview.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4/// \file
5/// Definition of Compound Document TOcView Class
6//----------------------------------------------------------------------------
7
8#if !defined(OCF_OCVIEW_H)
9#define OCF_OCVIEW_H
10
11#include <owl/private/defs.h>
12#if defined(BI_HAS_PRAGMA_ONCE)
13# pragma once
14#endif
15
16#include <ocf/ocdoc.h> // Client related
17#include <ocf/ocapp.h> // Client related
18#include <owl/dispatch.h>
19#include <owl/contain.h>
20
21namespace owl {class _OWLCLASS TRegLink;};
22namespace owl {class _OWLCLASS TRegList;};
23
24namespace ocf {
25//
26// Classes referenced
27//
31
32//
33// OCF Mixin classes for users derived application class
34//
35#if !defined(_OCMCLASS)
36# define _OCMCLASS
37#endif
40
41//
42// View options flags, set with SetOption
43//
45 voNoInPlace = 0x0001, // If FALSE, allow inplace activate in container
46 voNoNestedInPlace = 0x0002, // If FALSE, allow nested inplace activate " "
47 voNoInPlaceServer = 0x0004, // If FALSE, allow server to activate inplace
48};
49
50//
51/// \class TOcFormat
52// ~~~~~ ~~~~~~~~~
53/// Clipboard format wrapper
54//
56 public:
57 TOcFormat();
58 TOcFormat(owl::uint fmtId, LPCTSTR fmtName, LPCTSTR fmtResultName,
59 owl::uint fmtMedium, bool fmtIsLinkable,
60 owl::uint aspect = 1, owl::uint direction = 1);
61
62 void operator =(const TOcFormatInfo&);
63 bool operator ==(const TOcFormat& other) {return owl::ToBool(&other == this);}
64 void SetFormatId(owl::uint id) {Id = id;}
65 void SetFormatName(LPTSTR name, TOcApp& ocApp);
66 void SetFormatName(owl::uint id, TOcApp& ocApp);
67 void SetMedium(owl::uint medium) {Medium = (owl::ocrMedium)medium;}
68 void SetAspect(owl::uint aspect) {Aspect = aspect;}
69 void SetDirection(owl::uint direction) {Direction = direction;}
70 void SetLinkable(bool link = true) {IsLinkable = link;}
71 void Disable(bool disable = true) {Disabled = disable;}
72
73 owl::uint GetFormatId() const {return Id;}
74 LPTSTR GetRegName() {return RegName;}
75 LPTSTR GetFormatName() {return Name;}
76 owl::uint GetMedium() const {return Medium;}
77 owl::uint GetAspect() const {return Aspect;}
78 owl::uint GetDirection() const {return Direction;}
79 bool IsDisabled() const {return Disabled;}
80
81 void GetFormatInfo(TOcFormatInfo & f);
82
83 private:
84 owl::uint Id;
85 _TCHAR RegName[32];
86 _TCHAR Name[32];
87 _TCHAR ResultName[32];
88 owl::ocrMedium Medium;
89 bool IsLinkable;
90
91 owl::uint Aspect; // last three data members added & maintained by ocf
92 owl::uint Direction;
93 bool Disabled; // Format not available
94};
95
96//
97/// \class TOcFormatList
98// ~~~~~ ~~~~~~~~~~~~~
99/// Container of clipboard formats with iterator
100//
101class _OCFCLASS TOcFormatList : public owl::TIPtrArray<TOcFormat*> {
102 public:
105 //void operator delete(void* ptr) {TStandardAllocator::operator delete(ptr);}
106
107 TOcFormat*& operator [](unsigned index) { return Base::operator[](index);}
108 void Clear(int del = 1) { Base::Flush(del==1);}
109 int Add(TOcFormat* format) { return Base::Add(format);}
110 int IsEmpty() const { return Base::Empty();}
111 int Find(const TOcFormat* format) const { return Base::Find((TOcFormat*)format);}
112 owl::uint Count() const { return Base::Size();}
113 int Detach(TOcFormat* item, bool del = false)
114 {
115 return del ? Base::DestroyItem(item) : Base::DetachItem(item);
116 }
117 TOcFormat* Find(owl::uint const id) const;
118
119 private:
120 typedef owl::TIPtrArray<TOcFormat*> Base;
121};
122
123// class TOcFormatListIter
124// ~~~~~ ~~~~~~~~~~~~~~~~~
126
127//
128/// \class TOcView
129// ~~~~~ ~~~~~~~
130/// The TOcView partner is a container (viewer) of a given (server/client)
131/// document.
132//
133class _ICLASS TOcView : public TUnknown,
134 public IBContainer,
135 public IBContains,
136 public IBDropDest {
137 public:
139 owl::TRegList* regList=0, IUnknown* outer=0);
140
141 // !CQ compatibility only
142 TOcView(TOcDocument& doc, owl::TRegList* regList=0, IUnknown* outer=0);
143
144 void SetupWindow(HWND hWin, bool embedded = false);
145
146 virtual void ReleaseObject();
147
148 TOcDocument& GetOcDocument() {return OcDocument;}
149
150 // Helper functions
151 //
152 IBRootLinkable* GetLinkable() {return BLDocumentI;}
153
154 /// \name Clipboard support
155 /// @{
156 bool RegisterClipFormats(owl::TRegList& regList);
157 bool BrowseClipboard(TOcInitInfo& initInfo);
158 bool PasteNative(TOcInitInfo& init, owl::TPoint * where = 0);
159 bool Paste(bool linking = false);
160 void SetOcData(TOcDataProvider* ocData = 0) {OcData = ocData;}
161 TOcDataProvider* GetOcData() {return OcData;}
162 /// @}
163
164 /// \name View related
165 /// @{
166 owl::TPoint GetOrigin() const {return Origin;}
167 owl::TRect GetWindowRect() const;
168 void ScrollWindow(int dx, int dy);
169 void InvalidatePart(TOcPartChangeInfo& changeInfo);
170 virtual void Rename();
171 TOcLinkView* GetDocLink(LPCTSTR name=0);
172 bool IsOptionSet(owl::uint32 option) const;
173 void SetOption(owl::uint32 bit, bool state);
174 /// @}
175
176 /// \name Get/Set active part
177 /// @{
178 TOcPart* GetActivePart() {return ActivePart;}
179 void SetActivePart(TOcPart* part) {ActivePart = part;} // Internal use
180 bool ActivatePart(TOcPart* part);
181 /// @}
182
183 /// \name IBDocument pass-thrus
184 /// @{
185 void EvResize();
186 void EvActivate(bool activate);
187 virtual void EvClose();
188 virtual bool EvSetFocus(bool set);
189 bool EnumLinks(IBLinkInfo * *);
190 bool BrowseLinks();
191 bool UpdateLinks();
192 /// @}
193
194 /// \name Object reference & lifetime managment
195 /// For internal OCF use only
196 /// @{
197 owl::ulong _IFUNC AddRef() {return GetOuter()->AddRef();}
198 owl::ulong _IFUNC Release() {return GetOuter()->Release();}
199 HRESULT _IFUNC QueryInterface(const GUID & iid, void ** iface)
200 {return GetOuter()->QueryInterface(iid, iface);}
201 /// @}
202
203 protected:
204 /// \name IBContains implementation for BOle to use
205 /// @{
206 HRESULT _IFUNC Init(LPCOLESTR);
207 HRESULT _IFUNC GetPart(IBPart * *, LPCOLESTR);
208 /// @}
209
210 /// \name IBDataNegotiator implementation
211 /// @{
212 owl::uint _IFUNC CountFormats();
213 HRESULT _IFUNC GetFormat(owl::uint, TOcFormatInfo *);
214 /// @}
215
216 /// \name IBWindow implementation
217 /// @{
218 HWND _IFUNC GetWindow();
219 HRESULT _IFUNC GetWindowRect(owl::TRect * r);
220 LPCOLESTR _IFUNC GetWindowTitle();
221 void _IFUNC AppendWindowTitle(LPCOLESTR title);
222 HRESULT _IFUNC SetStatusText(LPCOLESTR text);
223 HRESULT _IFUNC RequestBorderSpace(const owl::TRect *);
224 HRESULT _IFUNC SetBorderSpace(const owl::TRect *);
225 HRESULT _IFUNC InsertContainerMenus(HMENU, TOcMenuWidths *);
226 HRESULT _IFUNC SetFrameMenu(HMENU);
227 void _IFUNC RestoreUI();
228 HRESULT _IFUNC Accelerator(MSG *);
229 HRESULT _IFUNC GetAccelerators(HACCEL *, int *);
230 /// @}
231
232 /// \name IBDropDest implementation
233 /// @{
234 HRESULT _IFUNC Drop(TOcInitInfo *, owl::TPoint *, const owl::TRect *);
235 void _IFUNC DragFeedback(owl::TPoint *, const owl::TRect *, TOcMouseAction, owl::uint, HRESULT& hr);
236 HRESULT _IFUNC Scroll(TOcScrollDir scrollDir);
237 HRESULT _IFUNC GetScrollRect(owl::TRect *);
238 /// @}
239
240 /// \name IBContainer implementation
241 /// @{
242 HRESULT _IFUNC FindDropDest(owl::TPoint *, IBDropDest * *);
243 HRESULT _IFUNC AllowInPlace();
244 HRESULT _IFUNC BringToFront();
245 /// @}
246
247 protected:
248 // !CQ hacked in to support occtrl for now
249 owl::TResult ForwardEvent(int eventId, const void* param);
250 owl::TResult ForwardEvent(int eventId, owl::TParam2 param = 0);
251
252 protected:
253 ~TOcView();
254 void Shutdown();// called from derived class destructor to release helpers
255
256 // TUnknown overrides
257 //
258 HRESULT QueryObject(const IID & iid, void * * iface);
259
260 // BOle side support
261 //
262 IUnknown* BDocument; ///< Document helper object
263 IBDocument* BDocumentI; ///< Document interface on the document
264 IUnknown* BContainer; ///< Container helper object
265 IBRootLinkable* BLDocumentI; ///< RootLinkable interface on the container
266
267 // OC wiring
268 //
269 TOcApp& OcApp; ///< Our OC application object
270 TOcDocument& OcDocument; ///< Our OC document object
271
272 TOcContainerHost* ContainerHost; ///< The hosting app's container object
273 TOcServerHost* ServerHost; ///< The hosting app's server object
274
275 // App side support
276 //
277// !CQ ripped out HWND Win; // Actual app container window
278 TOcPart* ActivePart; ///< Currently active part, if any
279
281
286 owl::TString OrgTitle; ///< Original window title string
287 int LinkFormat; ///< adjustment for format count
289 TOcDataProvider* OcData; ///< Dataprovider representing this view
290
291 friend class _ICLASS TOcControl;
293 friend class _ICLASS TOcPart;
295 friend class _ICLASS TOcLinkView;
296};
297
298//----------------------------------------------------------------------------
299
300//
301/// For viewdrop & viewdrag
302//
304 TOcInitInfo * InitInfo; ///< ViewDrop event only, else 0
307};
308
309//
310/// For part adornment painting over part, & painting views
311//
313 HDC DC;
317 bool PaintSelection; ///< paint the selection only
318 owl::TString* Moniker; ///< moniker if any
319 void* UserData; ///< User data
320
321};
322
323//
324/// Use when doing parts save and load
325//
327 public:
329 : StorageI(0), SameAsLoad(false), Remember(true), SaveSelection(false),
330 UserData(0) {}
331 TOcSaveLoad(IStorage* storageI, bool sameAsLoad = true, bool remember = false,
332 bool saveSelection = false, void* userData = 0)
333 {
334 StorageI = storageI;
335 SameAsLoad = sameAsLoad;
336 Remember = remember;
337 SaveSelection = saveSelection;
338 UserData = userData;
339 }
340
341 public:
343 bool SameAsLoad; ///< Same IStorage as one used for loading
344 bool Remember; ///< whether to keep the IStorage ptr after save/load
345 bool SaveSelection; ///< whether to save only the selection
346 void* UserData; ///< User data
347};
348
349//
350//
351//
353 bool Show; ///< whether this is a show or a hide
354 HWND HFrame; ///< Container frame for show, Server frame for hide
356 HWND HTopTB;
359};
360
361//
362/// Used to obtain the size of the rectangle that encloses the selection
363//
365 public:
367 :
368 PartRect(0, 0, 0, 0),
369 Selection(false),
370 Moniker(0),
371 UserData(0)
372 {
373 }
374
375 TOcPartSize(owl::TRect rect, bool selection = false, owl::TString* moniker = 0, void* userData = 0)
376 :
377 PartRect(rect),
378 Selection(selection),
379 Moniker(moniker),
380 UserData(userData)
381 {
382 }
383
384 TOcPartSize(bool selection, owl::TString* moniker = 0, void* userData = 0)
385 :
386 PartRect(0, 0, 0, 0),
387 Selection(selection),
388 Moniker(moniker),
389 UserData(userData)
390 {
391 }
392
393 public:
394 owl::TRect PartRect; ///< rect enclosing the whole/part of the embedded object
395 bool Selection; ///< whether we want rect for the whole or part(selection)
396 owl::TString* Moniker; ///< we want the selection rect for moniker
397 void* UserData; ///< User data
398};
399
400//
401/// Used to obtain the item name for building monikers
402//
404 public:
405 TOcItemName() : Selection(false) {}
406 TOcItemName(bool selection) : Selection(selection) {}
407
408 public:
409 owl::TString Name; ///< Item moniker
410 bool Selection; ///< Whether we want name for the whole or part(selection)
411};
412
413//
414/// Used to obtain the native clipboard format data
415//
417 public:
418 TOcFormatData(TOcFormat& format, void* userData = 0, HANDLE handle = 0,
419 bool paste = false, owl::TPoint * where = 0)
420 :
421 Format(format), UserData(userData), Handle(handle),
422 Paste(paste), Where(where) {}
423
424 public:
425 TOcFormat& Format; ///< Clipboard format
426 void* UserData; ///< User data for mapping to a selection
427 HANDLE Handle; ///< clipboard data in handle
428 bool Paste; ///< are we doing a paste?
429 owl::TPoint * Where; ///< Where to drop this data
430};
431
432//
433/// Used to obtain the item name for building monikers
434//
436 public:
437 TOcItemLink(LPCTSTR moniker, TOcLinkView* view)
438 :
439 Moniker(moniker),
440 OcLinkView(view)
441 {
442 }
443
444 public:
445 LPCTSTR Moniker; ///< item moniker
446
447/// The TOcLinkView connector object associated with this view.
449};
450
451//
452// class TOcScaleFactor
453// ~~~~~ ~~~~~~~~~~~~~~
455 public:
457 TOcScaleFactor(const owl::TRect& siteRect, const owl::TSize& partSize);
458 TOcScaleFactor(const TOcScaleInfo & scaleInfo);
459
460 TOcScaleFactor& operator =(const TOcScaleInfo & scaleInfo);
461 TOcScaleFactor& operator =(const TOcScaleFactor& scaleFactor);
462 void GetScaleFactor(TOcScaleInfo & scaleInfo) const;
463
464 bool IsZoomed();
465 void SetScale(owl::uint16 percent);
466 owl::uint16 GetScale();
467 void Reset();
468
469 public:
472};
473
474/// \cond
477/// \endcond
478
479//
480// class TOcSiteRect
481// ~~~~~ ~~~~~~~~~~~
483 public:
484 TOcSiteRect();
485 TOcSiteRect(TOcPart *part, const owl::TRect& rect);
488};
489
490//----------------------------------------------------------------------------
491
492//
493// class TOcContainerHost
494// ~~~~~ ~~~~~~~~~~~~~~~~
496 public:
497 // OC-Host support
498 //
499 virtual void ReleaseOcObject() = 0;
500
501 // Container methods
502 //
503 virtual bool EvOcViewOpenDoc(LPCTSTR path) = 0;
504 virtual LPCTSTR EvOcViewTitle() = 0;
505 virtual void EvOcViewSetTitle(LPCTSTR title) = 0;
506
507 virtual bool EvOcViewBorderSpaceReq(const owl::TRect * rect) = 0;
508 virtual bool EvOcViewBorderSpaceSet(const owl::TRect * rect) = 0;
509 virtual bool EvOcViewDrag(TOcDragDrop & ddInfo) = 0;
510 virtual bool EvOcViewDrop(TOcDragDrop & ddInfo) = 0;
511 virtual bool EvOcViewScroll(TOcScrollDir scrollDir) = 0;
512 virtual bool EvOcPartInvalid(TOcPartChangeInfo& part) = 0;
513 virtual bool EvOcViewPasteObject(TOcInitInfo& init) = 0;
514
515 // From site (TOcPart)
516 //
517// virtual bool EvOcViewGetSiteRect(owl::TRect * rect) = 0;
518// virtual bool EvOcViewSetSiteRect(owl::TRect * rect) = 0;
519 virtual bool EvOcViewGetSiteRect(TOcSiteRect& sr) = 0;
520 virtual bool EvOcViewSetSiteRect(TOcSiteRect& sr) = 0;
521 virtual bool EvOcViewPartActivate(TOcPart& ocPart) = 0;
522 virtual bool EvOcViewGetScale(TOcScaleFactor& scaleFactor) = 0;
523
524 virtual HWND EvOcGetWindow() const = 0;
525
526 // For compatibility, don't need to implement
527 //
528 virtual void SetWindow(HWND) {}
529};
530
531/*
532//
533// class TOcCtrlContainerHost
534// ~~~~~ ~~~~~~~~~~~~~~~~~~~~
535class _OCMCLASS TOcCtrlContainerHost {
536 public:
537 // OC-Host support
538 //
539 virtual void ReleaseOcObject() = 0;
540
541 // Control methods
542 //
543 virtual bool EvOcViewTransformCoords(owl::uint verb) = 0;
544
545 // Ambient property methods
546 //
547 virtual bool EvOcAmbientGetBackColor(long* rgb) = 0;
548 virtual bool EvOcAmbientGetForeColor(long* rgb) = 0;
549 virtual bool EvOcAmbientGetLocaleID(long* locale) = 0;
550 virtual bool EvOcAmbientGetTextAlign(short* align) = 0;
551 virtual bool EvOcAmbientGetMessageReflect(bool* msgReflect) = 0;
552 virtual bool EvOcAmbientGetUserMode(bool* mode) = 0;
553 virtual bool EvOcAmbientGetUIDead(bool* dead) = 0;
554 virtual bool EvOcAmbientGetShowGrabHandles(bool* show) = 0;
555 virtual bool EvOcAmbientGetShowHatching(bool* show) = 0;
556 virtual bool EvOcAmbientGetSupportsMnemonics(bool* support) = 0;
557 virtual bool EvOcAmbientGetDisplayName(owl::TString** name) = 0;
558 virtual bool EvOcAmbientGetScaleUnits(owl::TString** units) = 0;
559 virtual bool EvOcAmbientGetFont(IDispatch** font) = 0;
560
561 virtual bool EvOcAmbientSetBackColor(long rgb) = 0;
562 virtual bool EvOcAmbientSetForeColor(long rgb) = 0;
563 virtual bool EvOcAmbientSetLocaleID(long locale) = 0;
564 virtual bool EvOcAmbientSetTextAlign(short align) = 0;
565 virtual bool EvOcAmbientSetMessageReflect(bool msgReflect) = 0;
566 virtual bool EvOcAmbientSetUserMode(bool mode) = 0;
567 virtual bool EvOcAmbientSetUIDead(bool dead) = 0;
568 virtual bool EvOcAmbientSetShowGrabHandles(bool show) = 0;
569 virtual bool EvOcAmbientSetShowHatching(bool show) = 0;
570 virtual bool EvOcAmbientSetSupportsMnemonics(bool support) = 0;
571 virtual bool EvOcAmbientSetDisplayName(owl::TString* name) = 0;
572 virtual bool EvOcAmbientSetScaleUnits(owl::TString* units) = 0;
573 virtual bool EvOcAmbientSetFont(IDispatch* font) = 0;
574
575 // Ctrl event methods
576 //
577 virtual bool EvOcCtrlClick(TCtrlEvent* pev) = 0;
578 virtual bool EvOcCtrlDblClick(TCtrlEvent* pev) = 0;
579 virtual bool EvOcCtrlMouseDown(TCtrlMouseEvent* pev) = 0;
580 virtual bool EvOcCtrlMouseMove(TCtrlMouseEvent* pev) = 0;
581 virtual bool EvOcCtrlMouseUp(TCtrlMouseEvent* pev) = 0;
582 virtual bool EvOcCtrlKeyDown(TCtrlKeyEvent* pev) = 0;
583 virtual bool EvOcCtrlKeyUp(TCtrlKeyEvent* pev) = 0;
584 virtual bool EvOcCtrlErrorEvent(TCtrlErrorEvent* pev) = 0;
585 virtual bool EvOcCtrlFocus(TCtrlFocusEvent* pev) = 0;
586 virtual bool EvOcCtrlPropertyChange(TCtrlPropertyEvent* pev) = 0;
587 virtual bool EvOcCtrlPropertyRequestEdit(TCtrlPropertyEvent* pev) = 0;
588 virtual bool EvOcCtrlCustomEvent(TCtrlCustomEvent* pev) = 0;
589};
590*/
591
592//
593// class TOcServerHost
594// ~~~~~ ~~~~~~~~~~~~~
596 public:
597 // OC-Host support
598 //
599 virtual void ReleaseOcObject() = 0;
600
601 // Data server methods
602 //
603 virtual bool EvOcViewGetItemName(TOcItemName& item) = 0;
604 virtual bool EvOcViewClipData(TOcFormatData & format) = 0;
605 virtual bool EvOcViewSetData(TOcFormatData & format) = 0;
606 virtual bool EvOcViewPartSize(TOcPartSize & size) = 0;
607 virtual bool EvOcViewSavePart(TOcSaveLoad & ocSave) = 0;
608 virtual bool EvOcViewPaint(TOcViewPaint & vp) = 0;
609
610 // Link server methods
611 //
612 virtual bool EvOcViewAttachWindow(bool attach) = 0;
613 virtual void EvOcViewSetTitle(LPCTSTR title) = 0; // Open editing
614 virtual bool EvOcViewDrag(TOcDragDrop & ddInfo) = 0; // drag from server
615 virtual bool EvOcViewSetLink(TOcLinkView& view) = 0;
616 virtual bool EvOcViewBreakLink(TOcLinkView& view) = 0;
617 virtual bool EvOcViewGetPalette(LOGPALETTE * * palette) = 0;
618
619 // Embed server methods
620 //
621 virtual bool EvOcViewLoadPart(TOcSaveLoad & ocLoad) = 0;
622 virtual bool EvOcViewInsMenus(TOcMenuDescr & sharedMenu) = 0;
623 virtual bool EvOcViewShowTools(TOcToolBarInfo & tbi) = 0;
624
625 virtual bool EvOcViewClose() = 0;
626 virtual bool EvOcViewSetScale(TOcScaleFactor& scaleFactor) = 0;
627 virtual bool EvOcViewDoVerb(owl::uint verb) = 0;
628
629 virtual HWND EvOcGetWindow() const = 0;
630
631 // For compatibility, don't need to implement
632 //
633 virtual void SetWindow(HWND) {}
634};
635
636//----------------------------------------------------------------------------
637
638//
639// class TOcContainerHostMsg
640// ~~~~~ ~~~~~~~~~~~~~~~~~~~
642 public:
644
645 // OC-Host support
646 //
647 virtual void ReleaseOcObject() {delete this;}
648
649 // Container methods
650 //
651 virtual bool EvOcViewOpenDoc(LPCTSTR path);
652 virtual LPCTSTR EvOcViewTitle();
653 virtual void EvOcViewSetTitle(LPCTSTR title);
654
655 virtual bool EvOcViewBorderSpaceReq(const owl::TRect * rect);
656 virtual bool EvOcViewBorderSpaceSet(const owl::TRect * rect);
657 virtual bool EvOcViewDrag(TOcDragDrop & ddInfo);
658 virtual bool EvOcViewDrop(TOcDragDrop & ddInfo);
659 virtual bool EvOcViewScroll(TOcScrollDir scrollDir);
660 virtual bool EvOcPartInvalid(TOcPartChangeInfo& part);
661 virtual bool EvOcViewPasteObject(TOcInitInfo& init);
662
663 // From site (TOcPart)
664 //
665// virtual bool EvOcViewGetSiteRect(owl::TRect * rect);
666// virtual bool EvOcViewSetSiteRect(owl::TRect * rect);
667 virtual bool EvOcViewGetSiteRect(TOcSiteRect& sr);
668 virtual bool EvOcViewSetSiteRect(TOcSiteRect& sr);
669 virtual bool EvOcViewPartActivate(TOcPart& ocPart);
670 virtual bool EvOcViewGetScale(TOcScaleFactor& scaleFactor);
671
672 virtual HWND EvOcGetWindow() const {return Wnd;}
673
674 // For compatibility
675 //
676 virtual void SetWindow(HWND hWnd) {Wnd = hWnd;}
677
678 protected:
679 owl::TResult ForwardEvent(int eventId, const void* param);
680 owl::TResult ForwardEvent(int eventId, owl::TParam2 param = 0);
681
682 private:
683 HWND Wnd; // For sending messages to real host window, & window ops
684
685 friend TOcView; // !CQ hacked in to support occtrl for now
686};
687
688//
689// class TOcServerHostMsg
690// ~~~~~ ~~~~~~~~~~~~~~~~
692 public:
693 TOcServerHostMsg() : Wnd(0) {}
694
695 // OC-Host support
696 //
697 virtual void ReleaseOcObject() {delete this;}
698
699 // Data server methods
700 //
701 virtual bool EvOcViewGetItemName(TOcItemName& item);
702 virtual bool EvOcViewClipData(TOcFormatData & format);
703 virtual bool EvOcViewSetData(TOcFormatData & format);
704 virtual bool EvOcViewPartSize(TOcPartSize & size);
705 virtual bool EvOcViewSavePart(TOcSaveLoad & ocSave);
706 virtual bool EvOcViewPaint(TOcViewPaint & vp);
707
708 // Link server methods
709 //
710 virtual bool EvOcViewAttachWindow(bool attach);
711 virtual void EvOcViewSetTitle(LPCTSTR title); // Open editing
712 virtual bool EvOcViewDrag(TOcDragDrop & ddInfo); // drag from server
713 virtual bool EvOcViewSetLink(TOcLinkView& view);
714 virtual bool EvOcViewBreakLink(TOcLinkView& view);
715 virtual bool EvOcViewGetPalette(LOGPALETTE * * palette);
716
717 // Embed server methods
718 //
719 virtual bool EvOcViewLoadPart(TOcSaveLoad & ocLoad);
720 virtual bool EvOcViewInsMenus(TOcMenuDescr & sharedMenu);
721 virtual bool EvOcViewShowTools(TOcToolBarInfo & tbi);
722
723 virtual bool EvOcViewClose();
724 virtual bool EvOcViewSetScale(TOcScaleFactor& scaleFactor);
725 virtual bool EvOcViewDoVerb(owl::uint verb);
726
727 virtual HWND EvOcGetWindow() const {return Wnd;}
728
729 // For compatibility
730 //
731 virtual void SetWindow(HWND hWnd) {Wnd = hWnd;}
732
733 protected:
734 owl::TResult ForwardEvent(int eventId, const void* param);
735 owl::TResult ForwardEvent(int eventId, owl::TParam2 param = 0);
736
737 private:
738 HWND Wnd; // For sending messages to real host window
739};
740
741// !CQ hacked in to support occtrl for now
742//
743inline owl::TResult
744TOcView::ForwardEvent(int eventId, const void* param)
745{
746 return dynamic_cast<TOcContainerHostMsg*>(ContainerHost)->
747 ForwardEvent(eventId, param);
748}
749
750inline owl::TResult
752{
753 return dynamic_cast<TOcContainerHostMsg*>(ContainerHost)->
754 ForwardEvent(eventId, param);
755}
756
757
758//----------------------------------------------------------------------------
759// Subdispatch IDs for TOcView clients
760//
761 // Container
762#define OC_VIEWOPENDOC 0x0200 // ask container to open itself
763#define OC_VIEWTITLE 0x0201 // Get view window title
764#define OC_VIEWSETTITLE 0x0202 // Set view window title
765#define OC_VIEWBORDERSPACEREQ 0x0203 // Request/Set border space in view
766#define OC_VIEWBORDERSPACESET 0x0204 // Request/Set border space in view
767#define OC_VIEWDRAG 0x0205 // Provide drag feedback (c&s)
768#define OC_VIEWDROP 0x0206 // Accept a drop
769#define OC_VIEWSCROLL 0x0207 // Scroll view
770#define OC_VIEWPARTINVALID 0x0208 // a part needs repainting
771#define OC_VIEWPASTEOBJECT 0x0209 // let container know a part is pasted
772
773#define OC_VIEWGETSITERECT 0x020A // Ask container for the site rect
774#define OC_VIEWSETSITERECT 0x020B // Ask container to set the site rect
775#define OC_VIEWPARTACTIVATE 0x020C // Let container know the part is activated
776#define OC_VIEWGETSCALE 0x020D // Ask container to give scaling info
777
778 // Data Server
779#define OC_VIEWGETITEMNAME 0x0301 // Ask container to name its content or selection
780#define OC_VIEWCLIPDATA 0x0302 // Ask for a clip data
781#define OC_VIEWSETDATA 0x0303 // Set format data into server
782#define OC_VIEWPARTSIZE 0x0304 // Ask server for a its extent
783#define OC_VIEWSAVEPART 0x0305 // Ask server to save document
784#define OC_VIEWPAINT 0x0306 // Paint remote view. Like WM_PAINT + extra
785
786 // Link Server
787#define OC_VIEWATTACHWINDOW 0x0310 // RL: ask server to attach to its owner window
788#define OC_VIEWSETLINK 0x0311 // Ask to establish link to item
789#define OC_VIEWBREAKLINK 0x0312 // Ask server to break link to item
790#define OC_VIEWGETPALETTE 0x0313 // RL: ask server for its logical palette
791
792 // Embed Server
793#define OC_VIEWLOADPART 0x0321 // R: ask server to load document
794#define OC_VIEWINSMENUS 0x0322 // R: ask server to insert its menus in mbar
795#define OC_VIEWSHOWTOOLS 0x0323 // R: ask server to show its tools
796#define OC_VIEWCLOSE 0x0324 // R: tell server to close this remote view
797#define OC_VIEWSETSCALE 0x0325 // R: ask server to handle scaling
798#define OC_VIEWDOVERB 0x0326 // R: ask server to do a verb
799
800// Control event notification from control part to container view
801//
802#define OC_VIEWTRANSFORMCOORDS 0x0330 // C: view to transform ctrl coords
803#define OC_CTRLEVENT_FOCUS 0x0340 // Ctrl got/lost focus notify
804#define OC_CTRLEVENT_PROPERTYCHANGE 0x0341 // Ctrl prop changed notify
805#define OC_CTRLEVENT_PROPERTYREQUESTEDIT 0x0342// Ctrl prop request edit
806#define OC_CTRLEVENT_CLICK 0x0343 // Ctrl click notify
807#define OC_CTRLEVENT_DBLCLICK 0x0344 // Ctrl dblclick notify
808#define OC_CTRLEVENT_MOUSEDOWN 0x0345 // Ctrl mouse down notify
809#define OC_CTRLEVENT_MOUSEMOVE 0x0346 // Ctrl mouse move notify
810#define OC_CTRLEVENT_MOUSEUP 0x0347 // Ctrl mouse up notify
811#define OC_CTRLEVENT_KEYDOWN 0x0348 // Ctrl key down notify
812#define OC_CTRLEVENT_KEYUP 0x0349 // Ctrl key up notify
813#define OC_CTRLEVENT_ERROREVENT 0x034A // Ctrl error event notify
814#define OC_CTRLEVENT_CUSTOMEVENT 0x034B // Ctrl custom event notify
815
816// Control request for view ambient properties from container view
817//
818#define OC_AMBIENT_GETBACKCOLOR 0x0350
819#define OC_AMBIENT_GETFORECOLOR 0x0351
820#define OC_AMBIENT_GETSHOWGRABHANDLES 0x0352
821#define OC_AMBIENT_GETUIDEAD 0x0353
822#define OC_AMBIENT_GETSUPPORTSMNEMONICS 0x0354
823#define OC_AMBIENT_GETSHOWHATCHING 0x0355
824#define OC_AMBIENT_GETDISPLAYASDEFAULT 0x0356
825#define OC_AMBIENT_GETTEXTALIGN 0x0357
826#define OC_AMBIENT_GETMESSAGEREFLECT 0x0358
827#define OC_AMBIENT_GETLOCALEID 0x0359
828#define OC_AMBIENT_GETUSERMODE 0x035A
829#define OC_AMBIENT_GETDISPLAYNAME 0x035B
830#define OC_AMBIENT_GETSCALEUNITS 0x035C
831#define OC_AMBIENT_GETFONT 0x035D
832
833// Control set view ambient properties
834//
835#define OC_AMBIENT_SETBACKCOLOR 0x0360
836#define OC_AMBIENT_SETFORECOLOR 0x0361
837#define OC_AMBIENT_SETSHOWGRABHANDLES 0x0362
838#define OC_AMBIENT_SETUIDEAD 0x0363
839#define OC_AMBIENT_SETSUPPORTSMNEMONICS 0x0364
840#define OC_AMBIENT_SETSHOWHATCHING 0x0365
841#define OC_AMBIENT_SETDISPLAYASDEFAULT 0x0366
842#define OC_AMBIENT_SETTEXTALIGN 0x0367
843#define OC_AMBIENT_SETMESSAGEREFLECT 0x0368
844#define OC_AMBIENT_SETLOCALEID 0x0369
845#define OC_AMBIENT_SETUSERMODE 0x036A
846#define OC_AMBIENT_SETDISPLAYNAME 0x036B
847#define OC_AMBIENT_SETSCALEUNITS 0x036C
848#define OC_AMBIENT_SETFONT 0x036D
849
850#define OC_USEREVENT 0xF000 // User defined events
851
852//----------------------------------------------------------------------------
853// Inline Implementations
854//
855
856//
857inline bool TOcView::IsOptionSet(owl::uint32 option) const
858{
859 return owl::ToBool(Options & option);
860}
861
862//
863inline void TOcView::SetOption(owl::uint32 bit, bool state)
864{
865 if (state)
866 Options |= bit;
867 else
868 Options &= ~bit;
869}
870
871} // OCF namespace
872
873#endif // OCF_OCVIEW_H
874
IBContainer – Supported by container app's document window.
Definition ocbocole.h:398
IContains abstract base class.
Definition ocbocole.h:346
IBDocument – Supported by BOleDocument one per container child window.
Definition ocbocole.h:360
IBDropDest – Supported by container app's document window and/or other areas inside the window.
Definition ocbocole.h:409
IBPart – Supported by server objects.
Definition ocbocole.h:241
OCF Application class.
Definition ocapp.h:144
virtual bool EvOcViewPasteObject(TOcInitInfo &init)=0
virtual bool EvOcViewBorderSpaceReq(const owl::TRect *rect)=0
virtual bool EvOcViewDrop(TOcDragDrop &ddInfo)=0
virtual bool EvOcViewGetSiteRect(TOcSiteRect &sr)=0
virtual void ReleaseOcObject()=0
virtual HWND EvOcGetWindow() const =0
virtual bool EvOcViewPartActivate(TOcPart &ocPart)=0
virtual void EvOcViewSetTitle(LPCTSTR title)=0
virtual LPCTSTR EvOcViewTitle()=0
virtual bool EvOcViewScroll(TOcScrollDir scrollDir)=0
virtual bool EvOcViewGetScale(TOcScaleFactor &scaleFactor)=0
virtual bool EvOcViewBorderSpaceSet(const owl::TRect *rect)=0
virtual bool EvOcViewSetSiteRect(TOcSiteRect &sr)=0
virtual bool EvOcPartInvalid(TOcPartChangeInfo &part)=0
virtual bool EvOcViewDrag(TOcDragDrop &ddInfo)=0
virtual bool EvOcViewOpenDoc(LPCTSTR path)=0
virtual void SetWindow(HWND)
Definition ocview.h:528
virtual HWND EvOcGetWindow() const
Definition ocview.h:672
virtual void SetWindow(HWND hWnd)
Definition ocview.h:676
virtual void ReleaseOcObject()
Definition ocview.h:647
OC Control Event class for standard control events.
Definition occtrl.h:202
Class representing an embedded control within a document.
Definition occtrl.h:78
Data Provider object for a container document.
Definition ocdata.h:30
OC Document class, holds parts & is a owner of views.
Definition ocdoc.h:43
Used to obtain the native clipboard format data.
Definition ocview.h:416
void * UserData
User data for mapping to a selection.
Definition ocview.h:426
owl::TPoint * Where
Where to drop this data.
Definition ocview.h:429
HANDLE Handle
clipboard data in handle
Definition ocview.h:427
bool Paste
are we doing a paste?
Definition ocview.h:428
TOcFormat & Format
Clipboard format.
Definition ocview.h:425
TOcFormatData(TOcFormat &format, void *userData=0, HANDLE handle=0, bool paste=false, owl::TPoint *where=0)
Definition ocview.h:418
Clipboard format wrapper.
Definition ocview.h:55
void SetDirection(owl::uint direction)
Definition ocview.h:69
owl::uint GetDirection() const
Definition ocview.h:78
void SetAspect(owl::uint aspect)
Definition ocview.h:68
void SetMedium(owl::uint medium)
Definition ocview.h:67
void Disable(bool disable=true)
Definition ocview.h:71
TCHAR * GetRegName()
Definition ocview.h:74
void SetFormatId(owl::uint id)
Definition ocview.h:64
bool IsDisabled() const
Definition ocview.h:79
void SetLinkable(bool link=true)
Definition ocview.h:70
owl::uint GetMedium() const
Definition ocview.h:76
owl::uint GetFormatId() const
Definition ocview.h:73
owl::uint GetAspect() const
Definition ocview.h:77
TCHAR * GetFormatName()
Definition ocview.h:75
Container of clipboard formats with iterator.
Definition ocview.h:101
void Clear(int del=1)
Definition ocview.h:108
owl::uint Count() const
Definition ocview.h:112
int Find(const TOcFormat *format) const
Definition ocview.h:111
int Detach(TOcFormat *item, bool del=false)
Definition ocview.h:113
int IsEmpty() const
Definition ocview.h:110
int Add(TOcFormat *format)
Definition ocview.h:109
Used to obtain the item name for building monikers.
Definition ocview.h:403
TOcItemName(bool selection)
Definition ocview.h:406
owl::TString Name
Item moniker.
Definition ocview.h:409
bool Selection
Whether we want name for the whole or part(selection)
Definition ocview.h:410
View/Data change info.
Definition ocpart.h:216
OC part class represents an embeded or linked part in a document.
Definition ocpart.h:38
Used to obtain the size of the rectangle that encloses the selection.
Definition ocview.h:364
void * UserData
User data.
Definition ocview.h:397
TOcPartSize(bool selection, owl::TString *moniker=0, void *userData=0)
Definition ocview.h:384
TOcPartSize(owl::TRect rect, bool selection=false, owl::TString *moniker=0, void *userData=0)
Definition ocview.h:375
owl::TString * Moniker
we want the selection rect for moniker
Definition ocview.h:396
bool Selection
whether we want rect for the whole or part(selection)
Definition ocview.h:395
owl::TRect PartRect
rect enclosing the whole/part of the embedded object
Definition ocview.h:394
Use when doing parts save and load.
Definition ocview.h:326
bool SaveSelection
whether to save only the selection
Definition ocview.h:345
bool SameAsLoad
Same IStorage as one used for loading.
Definition ocview.h:343
IStorage * StorageI
Definition ocview.h:342
TOcSaveLoad(IStorage *storageI, bool sameAsLoad=true, bool remember=false, bool saveSelection=false, void *userData=0)
Definition ocview.h:331
bool Remember
whether to keep the IStorage ptr after save/load
Definition ocview.h:344
void * UserData
User data.
Definition ocview.h:346
owl::TSize PartSize
Definition ocview.h:471
owl::TSize SiteSize
Definition ocview.h:470
virtual bool EvOcViewGetItemName(TOcItemName &item)=0
virtual bool EvOcViewBreakLink(TOcLinkView &view)=0
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 EvOcViewSetLink(TOcLinkView &view)=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 void SetWindow(HWND)
Definition ocview.h:633
virtual void ReleaseOcObject()=0
virtual bool EvOcViewClose()=0
virtual bool EvOcViewInsMenus(TOcMenuDescr &sharedMenu)=0
virtual void EvOcViewSetTitle(LPCTSTR title)=0
virtual void SetWindow(HWND hWnd)
Definition ocview.h:731
virtual void ReleaseOcObject()
Definition ocview.h:697
virtual HWND EvOcGetWindow() const
Definition ocview.h:727
TOcPart * Part
Definition ocview.h:487
owl::TRect Rect
Definition ocview.h:486
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
IUnknown * BContainer
Container helper object.
Definition ocview.h:264
owl::ulong _IFUNC AddRef()
Definition ocview.h:197
void SetOcData(TOcDataProvider *ocData=0)
Definition ocview.h:160
owl::ulong _IFUNC Release()
Definition ocview.h:198
owl::TRegList * RegList
Definition ocview.h:288
TOcPart * ActivePart
Currently active part, if any.
Definition ocview.h:278
TOcDocument & GetOcDocument()
Definition ocview.h:148
owl::TString OrgTitle
Original window title string.
Definition ocview.h:286
TOcPart * GetActivePart()
Definition ocview.h:178
TOcDataProvider * OcData
Dataprovider representing this view.
Definition ocview.h:289
TOcContainerHost * ContainerHost
The hosting app's container object.
Definition ocview.h:272
IUnknown * BDocument
Document helper object.
Definition ocview.h:262
TOcDataProvider * GetOcData()
Definition ocview.h:161
HRESULT _IFUNC QueryInterface(const GUID &iid, void **iface)
Definition ocview.h:199
owl::TSize Extent
Definition ocview.h:283
owl::TPoint Origin
Definition ocview.h:282
owl::tstring WinTitle
Definition ocview.h:284
owl::uint32 Options
Definition ocview.h:280
IBRootLinkable * BLDocumentI
RootLinkable interface on the container.
Definition ocview.h:265
owl::TPoint GetOrigin() const
Definition ocview.h:166
bool IsOptionSet(owl::uint32 option) const
Definition ocview.h:857
TOcFormatList FormatList
Definition ocview.h:285
void SetOption(owl::uint32 bit, bool state)
Definition ocview.h:863
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
void SetActivePart(TOcPart *part)
Definition ocview.h:179
int LinkFormat
adjustment for format count
Definition ocview.h:287
IBRootLinkable * GetLinkable()
Definition ocview.h:152
owl::TResult ForwardEvent(int eventId, const void *param)
Definition ocview.h:744
Standard implementation of a controlling IUnknown for an object, to be inherited with other COM inter...
Definition oleutil.h:264
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
Iterator for Pointer Container.
Definition template.h:543
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
A registration parameter table, composed of a list of TRegItems.
Definition registry.h:531
The tagSIZE struct is defined as.
Definition geometry.h:234
Reference to reference counted string object TUString Lightweight reference object consisting of a po...
Definition string.h:67
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
Definition of container classes used and made available by OWL.
Dispatch functions (crackers) to crack a Windows message and pass control to a member function via a ...
ocrMedium
Medium: means of data transfer.
Definition registry.h:659
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
TOcAspect
Definition ocobject.h:64
TOcScaleFactor & sf
Definition ocview.cpp:1233
TOcFormatList::Iterator TOcFormatListIter
Definition ocview.h:125
class _ICLASS TOcControl
Definition ocdoc.h:34
TOcMouseAction
Definition ocobject.h:46
const GUID & iid
Definition appdesc.h:328
TOcViewOptions
Definition ocview.h:44
@ voNoInPlace
Definition ocview.h:45
@ voNoInPlaceServer
Definition ocview.h:47
@ voNoNestedInPlace
Definition ocview.h:46
TOcScrollDir
Definition ocobject.h:52
class _ICLASS TOcStorage
Definition ocdoc.h:32
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned long ulong
Definition number.h:26
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
Definition color.h:498
unsigned long uint32
Definition number.h:34
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
bool ToBool(const T &t)
Definition defs.h:291
LRESULT TResult
Result type.
Definition dispatch.h:52
unsigned short uint16
Definition number.h:33
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
owl::ipstream & operator>>(owl::ipstream &is, TColor &c)
Extract the color value from a persistent input stream.
Definition color.h:489
Definition of TOcApp application connection class.
#define _OCMCLASS
Definition ocapp.h:42
Definition of TOcDocument Class.
interface _ICLASS IStorage
Definition ocdoc.h:25
#define _OCFCLASS
Definition defs.h:45
#define _OCFCFUNC(p)
Definition defs.h:48
#define _IFUNC
Definition oleutil.h:28
#define _ICLASS
Definition oleutil.h:25
#define _OWLCLASS
Definition defs.h:338
For viewdrop & viewdrag.
Definition ocview.h:303
owl::TRect * Pos
Definition ocview.h:306
TOcInitInfo * InitInfo
ViewDrop event only, else 0.
Definition ocview.h:304
owl::TPoint * Where
Definition ocview.h:305
bool Show
whether this is a show or a hide
Definition ocview.h:353
HWND HFrame
Container frame for show, Server frame for hide.
Definition ocview.h:354
For part adornment painting over part, & painting views.
Definition ocview.h:312
void * UserData
User data.
Definition ocview.h:319
TOcAspect Aspect
Definition ocview.h:316
owl::TRect * Pos
Definition ocview.h:314
owl::TRect * Clip
Definition ocview.h:315
bool PaintSelection
paint the selection only
Definition ocview.h:317
owl::TString * Moniker
moniker if any
Definition ocview.h:318