OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ocpart.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 TOcPart Class
7//----------------------------------------------------------------------------
8#include <ocf/pch.h>
9#include <ocf/ocstorag.h>
10#include <ocf/ocpart.h>
11#include <ocf/ocdoc.h>
12#include <ocf/ocapp.h>
13#include <ocf/ocview.h>
14
15namespace ocf {
16
17using namespace owl;
18
19const _TCHAR PartFormat[] = _T("OcPart.%d");
20const _TCHAR PartStreamName[] = _T("\03OcPart");
21
22//
23/// Construct a new part with a given temp id
24/// Must call Init method to complete initialization
25//
26TOcPart::TOcPart(TOcDocument& document, int id)
27:
28 OcDocument(document), BPart(0), BPartI(0), BLPartI(0), Flags(Visible),
29 Storage(0)
30{
31 AddRef(); // TUnknown defaults to 0, we need 1
32 if (!id)
34 _TCHAR name[32];
35 wsprintf(name, PartFormat, id);
36 Name = name;
37
38 // There must be a Root IStorage associated with each document
39 //
42
43 // Create a sub-storage from the parent storage in init
44 //
45 Storage = new TOcStorage(*OcDocument.GetStorage(), name, true, STGM_READWRITE);
46}
47
48//
49/// Old style constructor - does init in constructor -
50/// OCF messages will get passed before constructor is complete
51//
53 TRect objPos, int id)
54:
55 OcDocument(document), BPart(0), BPartI(0), BLPartI(0), Flags(Visible),
56 Storage(0)
57{
58 // Part position and size are in logical units
59 //
60 AddRef(); // TUnknown defaults to 0, we need 1
61 if (!id)
63 _TCHAR name[32];
64 wsprintf(name, PartFormat, id);
65 Name = name;
66
67 // There must be a Root IStorage associated with each document
68 //
71
72 // Create a sub-storage from the parent storage in init
73 //
74 Storage = new TOcStorage(*OcDocument.GetStorage(), name, true, STGM_READWRITE);
75 Init (&initInfo, objPos);
76}
77
78//
79/// Construct a part from a named stream in an oc doc's storage
80//
81TOcPart::TOcPart(TOcDocument& document, LPCTSTR name)
82:
83 OcDocument(document), BPart(0), BPartI(0), BLPartI(0), Flags(Visible),
84 Storage(0),
85 Name(name)
86{
87 AddRef(); // TUnknown defaults to 0, we need 1
88
89 // There must be an IStorage associated with each document
90 //
93
94 // Open a sub-storage from the parent storage in init
95 //
96 Storage = new TOcStorage(*OcDocument.GetStorage(), name, false, STGM_READWRITE);
97
98 // Load our data, and then add ourselves to our document's part collection if
99 // everthing succeeds. We'll initialize our helper objects when the parts
100 // become visible.
101 //
102 Load();
103 OcDocument.GetParts().Add(this);
104}
105
106//
107//
108//
110{
111 // Detach this part from its document
112 //
113 Detach();
114
115 // double check if active part is "this" and, in case, delete it
116 if (OcDocument.GetActiveView()->GetActivePart() == this)
118
119 // Delete any associated storage
120 //
121 delete Storage;
122}
123
124//
125/// Perform common ctor initialization
126//
127bool
128TOcPart::Init(TOcInitInfo * initInfo, TRect objPos)
129{
130 if (BPart)
131 return false; // already initialized
132
133 // Part position and size are in logical units
134 //
135 TOcSiteRect siteRect(this, objPos);
137 if (view) {
138 view->ContainerHost->EvOcViewSetSiteRect(siteRect);
139 Pos = siteRect.Rect.TopLeft();
140 Size = siteRect.Rect.Size();
141 }
142
143 if (InitObj(initInfo)) {
144 OcDocument.GetParts().Add(this);
145 return true;
146 }
147 return false;
148}
149
150//
151//
152//
153bool
155{
156 // Initialize our helpers & then add ourselves to our document's part
157 // collection if everything succeeds
158 //
159 if (initInfo) {
160
161 // There must be an IStorage associated with each part, make sure the ctor
162 // got it OK
163 //
164 initInfo->Storage = Storage->GetIStorage();
165
166 // Create part helper
167 //
171
172 // Get the interfaces we need & then release the object itself
173 //
174 if (HRSucceeded(BPart->QueryInterface(IID_IBPart, (LPVOID *)&BPartI)))
175 BPartI->Release();
176 if (HRSucceeded(BPart->QueryInterface(IID_IBLinkable, (LPVOID *)&BLPartI)))
177 BLPartI->Release();
178
179 HRESULT hr;
180 if (!BPartI || !HRSucceeded(hr = BPartI->Init(this, initInfo))) {
181 BPart->Release();
182 BPart = 0;
184 }
185
186 Rename();
187 if (initInfo->How == ihLink) // Remember that we are a link
188 Flags |= Link;
189
190 // New parts become active when they are init'd above. Make sure that our
191 // view knows that we are active too.
192 //
193 if (initInfo->Where == iwNew) {
194 Flags |= Active;
195 TOcView* activeView = OcDocument.GetActiveView();
196 CHECK(activeView);
197 activeView->ActivatePart(this);
198 }
199 }
200 return true;
201}
202
203//
204/// Delete this object. Actually, causes object to shutdown as much as possible
205/// & then releases a reference.
206//
207void
209{
210 Activate(false);
211 Close();
212 Release();
213}
214
215//
216/// Callback from TUnknown's implementation of QueryInterface
217//
218HRESULT
219TOcPart::QueryObject(const IID & iid, void * * iface)
220{
221 PRECONDITION(iface);
222 HRESULT hr;
223
224 // interfaces
225 //
226 HRSucceeded(hr = IBSite_QueryInterface(this, iid, iface))
227
228 // helpers
229 //
230 || (BPart && HRSucceeded(hr = BPart->QueryInterface(iid, iface)))
231 ;
232 return hr;
233}
234
235//
236/// Query server for its interfaces
237//
238HRESULT
239TOcPart::QueryServer(const IID & iid, void * * iface)
240{
241 PRECONDITION(iface);
242 return BPartI->DoQueryInterface(iid, iface);
243}
244
245//
246/// Disconnect servers by closing & releasing our BOle helper
247//
248bool
250{
251 if (!BPartI)
252 return true;
253
254 if (BLPartI)
255 BLPartI->OnRename(0, 0);
256
257 if (HRSucceeded(BPartI->Close())) {
258 // release our BOle helper object
259 //
260 BPart->Release();
261 BPart = 0;
262 BPartI = 0;
263 BLPartI = 0;
264
265 // So that it won't get created again in Draw
266 //
267 Flags |= Closing;
268 return true;
269 }
270 return false;
271}
272
273//
274/// Rename the embed site for linking
275//
276void
278{
279 TOcView* activeView = OcDocument.GetActiveView();
280 CHECK(activeView);
281
282 IBRootLinkable* bLDocumentI;
283 activeView->QueryInterface(IID_IBRootLinkable, (LPVOID *)&bLDocumentI);
284 activeView->Release();
285
286 if (BLPartI && bLDocumentI)
287 BLPartI->OnRename(bLDocumentI, GetName());
288}
289
290//----------------------------------------------------------------------------
291// ISite Implementation--delegates site/view related queries/notifies to the
292// active view of this part
293//
294
295//
296/// Show/hide a site.
297//
298HRESULT _IFUNC
300{
302
303 // When this part is activated, the site is hidden. This is a good time to
304 // make sure our state is in sync.
305 //
306 if (!show) {
307 // Make sure the view knows about the active part
308 //
309 Flags |= Active;
311 if (view) {
312 view->ActivatePart(this);
314 }
315 }
316 return HR_NOERROR;
317}
318
319//
320/// Discard undo stack for our associated [the active] view
321//
322HRESULT _IFUNC
324{
325 return HR_NOERROR;
326}
327
328//
329/// Retrieve the site rect [relative to the active view?], and optionally the
330/// view's rect too?
331//
332HRESULT _IFUNC
333TOcPart::GetSiteRect(TRect * posRect, TRect * clipRect)
334{
335 PRECONDITION(posRect);
336 if (!posRect)
337 return HR_INVALIDARG;
338
340 if (!view)
341 return HR_FAIL;
342 if (posRect) {
343 TOcSiteRect siteRect(this, TRect(Pos, Size));
344 view->ContainerHost->EvOcViewGetSiteRect(siteRect);
345 *posRect = siteRect.Rect;
346
347 // If we don't know our site size yet, then fail this call. Let the server
348 // pick a size.
349 //
350 if (posRect->right-posRect->left <= 0 || posRect->bottom-posRect->top <= 0) {
351 posRect->right = posRect->left;
352 posRect->bottom = posRect->top;
353 return HR_FAIL;
354 }
355 }
356
357 if (clipRect)
358 view->GetWindowRect(clipRect);
359 return HR_NOERROR;
360}
361
362//
363/// Set the site's rect from an in-place active part. Since user is in control
364/// we generally respect both Pos & Size changes.
365//
366HRESULT _IFUNC
368{
369 PRECONDITION(newRect);
370 if (!newRect)
371 return HR_INVALIDARG;
372
374 if (!view)
375 return HR_FAIL;
376
377 // Give other views a chance to update
378 //
379 Invalidate(invView); // erase old image
380
381 TOcSiteRect siteRect(this, *newRect);
382 view->ContainerHost->EvOcViewSetSiteRect(siteRect);
383 Size = siteRect.Rect.Size();
384 Pos = siteRect.Rect.TopLeft();
385
386 // Give other views a chance to update
387 //
388 Invalidate(invView); // refresh new image position
389 return HR_NOERROR;
390}
391
392//
393/// Set the part's site extent. This comes either after a SetPartRect, or for
394/// open editing, comes alone.
395//
396HRESULT _IFUNC
398{
399 PRECONDITION(newSize);
400 if (!newSize)
401 return HR_INVALIDARG;
402
404 if (!view)
405 return HR_FAIL;
406
407 // Only accept server's size if we don't have a size yet. Always say OK.
408 //
409// if (Size.cx > 0 && Size.cy > 0)
410// return HR_NOERROR;
411
412 // Give other views a chance to update
413 //
414 Invalidate(invView); // display new image
415
416 TSize ext(*newSize);
417 TOcSiteRect siteRect(this, TRect(Pos, ext));
418
419 if (view->ContainerHost->EvOcViewSetSiteRect(siteRect))
420 Size = siteRect.Rect.Size();
421 else
422 //\\// container doesn't accept server size (keep what we have)
423 return HR_FAIL;
424
425 // Give other views a chance to update
426 //
427 Invalidate(invView); // refresh new image position
428
429 return HR_NOERROR;
430}
431
432//
433/// Get parent window for part
434//
435HRESULT _IFUNC
437{
438 TOcView* activeView = OcDocument.GetActiveView();
439 *hWnd = activeView->GetWindow();
440 return 0;
441}
442
443//
444/// Get zoom factor for part
445//
446HRESULT _IFUNC
448{
449 PRECONDITION(zoom);
450 if (!zoom)
451 return HR_INVALIDARG;
452
454 if (!view)
455 return HR_FAIL;
456
457 TOcScaleFactor scaleFactor(*zoom);
458 if (!view->ContainerHost->EvOcViewGetScale(scaleFactor)) {
459 zoom->xD = zoom->xN = zoom->yD = zoom->yN = 1;
460 }
461 else
462 scaleFactor.GetScaleFactor(*zoom);
463
464 return HR_NOERROR;
465}
466
467//
468/// Invalidate the site within the active view
469//
470void _IFUNC
472{
474 TOcPartChangeInfo changeInfo(this, type);
475 if (view)
476 view->InvalidatePart(changeInfo);
477}
478
479void _IFUNC
481{
483 if (view && set)
484 ::SetFocus(view->GetWindow());
485}
486
487HRESULT _IFUNC
488TOcPart::Init(IBDataProvider *, IBPart *, LPCOLESTR, BOOL)
489{
490 return HR_FAIL; // never called
491}
492
493void _IFUNC
495{
496 // no need to do anything
497}
498
499//----------------------------------------------------------------------------
500
501//
502/// Save this part to storage. May be any of:
503/// - Save to our storage : sameAsLoad==1
504/// - Copy to a storage : sameAsLoad==0, remember==0
505/// - SaveAs a new storage: sameAsLoad==0, remember==1
506//
507bool
508TOcPart::Save(bool sameAsLoad, bool remember)
509{
510 STATSTG statstg;
511 if (!HRSucceeded(Storage->Stat(&statstg, STATFLAG_NONAME)))
512 return false;
513
514 TOcStorage* oldStorage = 0;
515
516 // If not sameAsLoad, then we are saving to a new storage. Switch to that,
517 // at least for this save.
518 //
519 if (!sameAsLoad) {
520 oldStorage = Storage;
521 Storage = new TOcStorage(*OcDocument.GetStorage(), GetName(), true, STGM_READWRITE);
522 }
523
524 // Create/open a stream in our storage to save part information
525 //
526 TOcStream stream(*Storage, PartStreamName, true, statstg.grfMode);
527
528 // Write TOcPart data into stream, Name was written by our Doc
529 //
530 if (!HRSucceeded(stream.Write(&Pos, sizeof Pos)))
531 return false;
532
533 if (!HRSucceeded(stream.Write(&Size, sizeof Size)))
534 return false;
535
536 if (!HRSucceeded(stream.Write(&Flags, sizeof Flags)))
537 return false;
538
539 // Now have actual server part write itself to this storage
540 //
541 bool result = Save(Storage->GetIStorage(), sameAsLoad, remember);
542
543 // If this is a different storage, then either save it (remember) or put
544 // it back & clean up.
545 //
546 if (!sameAsLoad) {
547 if (remember) {
548 delete oldStorage;
549 }
550 else {
551 delete Storage;
552 Storage = oldStorage;
553 }
554 }
555
556 return result;
557}
558
559//
560/// Load this part from its ocpart stream in its current storage
561//
562bool
564{
565 // Open a stream with oc part information
566 //
567 STATSTG statstg;
568 if (!HRSucceeded(Storage->Stat(&statstg, STATFLAG_NONAME)))
569 return false;
570 TOcStream stream(*Storage, PartStreamName, false, statstg.grfMode);
571
572 // Read TOcPart data from stream. Server part info will be read in as needed
573 // after Init()
574 //
575 if (!HRSucceeded(stream.Read(&Pos, sizeof Pos)))
576 return false;
577
578 if (!HRSucceeded(stream.Read(&Size, sizeof Size)))
579 return false;
580
581 if (!HRSucceeded(stream.Read(&Flags, sizeof Flags)))
582 return false;
583 Flags &= ~(Closing | Active); // These Flags are not persistent
584
585 return true;
586}
587
588//
589/// Update this part's idea of its size via the server, & then return that.
590/// Use GetRect() to just get the current site rect.
591//
592TSize
594{
595 BPartI->GetPartSize(&const_cast<TSize&>(Size));
596 return Size;
597}
598
599//
600/// Set part to the new position given in logical units
601/// \note Does you update the part's location.
602/// Must explicitly call UpdateRect!
603//
604void
606{
607 Pos = pos;
608}
609
610//
611/// Set part to the new size given in logical units
612/// \note Does you update the part's location.
613/// Must explicitly call UpdateRect!
614//
615void
617{
618 Size = size;
619}
620
621//
622/// Set part to the new rect given in logical units
623//
624void
626{
627 // Use device units for Bolero
628 //
630 if (!view)
631 return;
632
633 TOcSiteRect siteRect(this, TRect(Pos, Size));
634 view->ContainerHost->EvOcViewGetSiteRect(siteRect);
635 BPartI->SetPartPos(&siteRect.Rect);
636}
637
638//----------------------------------------------------------------------------
639// IBPart pass-thrus not inlined
640//
641bool
642TOcPart::Activate(bool activate)
643{
644 TOcView* activeView = OcDocument.GetActiveView();
645 CHECK(activeView);
646
647 if (activate && activeView->GetActivePart())
648 if (!activeView->ActivatePart(0)) // deactivate currently active part, if any
649 return false;
650
651 // Makes sure that the part gets the active view as its host.
652 // This is important in multi-view situation.
653 //
654 SetHost(activeView);
655 if (!HRSucceeded(BPartI->Activate(activate)))
656 return false;
657
658 if (activate) {
659 Flags |= Active;
660 activeView->SetActivePart(this);
661 }
662 else {
663 Flags &= ~Active;
664 activeView->SetActivePart(0);
665 }
666 return true;
667}
668
669void
671{
672 // Load embeded object on demand
673 //
674 if (!BPartI) {
676 InitObj(&initInfo);
677 }
678}
679
680
681//
682/// Set data into the server object
683//
684bool
685TOcPart::SetFormatData(TOcFormatInfo * fmt, HANDLE data, bool release)
686{
687 IBPart2* bPartI2;
688 if (HRSucceeded(BPart->QueryInterface(IID_IBPart2, (LPVOID *)&bPartI2)))
689 ((IBPart*)bPartI2)->Release();
690 else
691 return false;
692
693 return HRSucceeded(bPartI2->SetFormatData(fmt, data, release));
694}
695
696
697bool
698TOcPart::Save(IStorage* storage, bool sameAsLoad, bool remember)
699{
700 PRECONDITION(storage);
701 if (BPartI)
702 return HRSucceeded(BPartI->Save(storage, sameAsLoad, remember));
703 return false;
704}
705
706bool
707TOcPart::Draw(HDC dc, const TRect& pos, const TRect& clip, TOcAspect aspect)
708{
709 PRECONDITION(dc);
710
711 // Don't draw anything if we are closing down the part
712 //
713 if (Flags & Closing)
714 return true;
715
716 const RECTL posl = { pos.left, pos.top, pos.right, pos.bottom };
717 const RECTL clipl = { clip.left, clip.top, clip.right, clip.bottom };
718
719 // Load embeded object on demand
720 //
721 if (!BPartI) {
723 InitObj(&initInfo);
724 // Update the link
725 //
726 if (IsLink()) {
728 if (view)
729 view->UpdateLinks();
730 }
731
732 }
733
734 return HRSucceeded(BPartI->Draw(dc, &posl, &clipl, aspect, drNone));
735}
736
737bool
739{
740 if (BPartI)
741 return HRIsOK(BPartI->EnumVerbs(const_cast<TOcVerb*>(&verb)));
742
743 return false;
744}
745
746bool
748{
749 if (BPartI) {
750 if (HRSucceeded(BPartI->DoVerb(whichVerb))) {
751 TOcView* activeView = OcDocument.GetActiveView();
752 CHECK(activeView);
753 activeView->SetActivePart(this); // we may be activated now...
754 return true;
755 }
756 }
757 return false;
758}
759
760int
762{
763 return OcDocument.GetParts().Detach(this);
764}
765
766void
768{
769 if (visible)
770 Flags |= Visible;
771 else
772 Flags &= ~Visible;
773
774 if (IsActive())
775 BPartI->Show(visible);
776 else
777 Invalidate(invView); // refresh new image position
778}
779
780
781//
782/// Set the storage for this part
783//
784void
785TOcPart::SetStorage(IStorage* storage, bool remember)
786{
787 if (Storage && (storage == Storage->GetIStorage()))
788 return;
789
790 if (remember)
791 delete Storage;
792
793 if (storage)
794 Storage = new TOcStorage(storage);
795 else
796 Storage = 0;
797}
798
799
800//----------------------------------------------------------------------------
801// CdPartCollection
802//
803
807
812
813//
814/// Release parts in the collection
815//
816void
818{
819 for (int i = Count() - 1; i >= 0; i--) {
820 TOcPart* part = (TOcPart*)(*this)[i];
821 part->Release();
822 }
823}
824
825//
826/// walk thru Part collection & return the last one that logical point hits,
827/// (first one in Z order)
828//
829TOcPart*
831{
832 TRect hitRect(logicalPoint, TSize(1,1));
833
834 TOcPart* p = 0;
835 for (TOcPartCollectionIter i(*this); i; i++)
836 if (i.Current()->IsVisible(hitRect))
837 p = (TOcPart*)i.Current();
838 return p;
839}
840
841//
842/// Select/unselect all parts
843//
844bool
846{
847 for (TOcPartCollectionIter i(*this); i; i++)
848 i.Current()->Select(select);
849 return true;
850}
851
852int
853TOcPartCollection::Detach(TOcPart* const& part, int del)
854{
855 int ret = Base::Detach(Find(part));
856 if (ret && del)
857 const_cast<TOcPart*>(part)->Release();
858 return ret;
859}
860
861//--------------------------------- OcVerb -----------------------------------
862//
864:
865 TypeName(0),
866 VerbName(0),
867 VerbIndex(0),
868 CanDirty(false)
869{
870}
871
872} // OCF namespace
873
874//==============================================================================
875
#define CHECK(condition)
Definition checks.h:239
#define PRECONDITION(condition)
Definition checks.h:227
virtual HRESULT _IFUNC SetFormatData(TOcFormatInfo *fmt, HANDLE data, BOOL release)=0
IBDataProvider – Supported by parts and/or sites which can be copied to the OLE2 clipboard.
Definition ocbocole.h:224
virtual HRESULT _IFUNC Save(IStorage *, BOOL fSamAsLoad, BOOL fRemember)=0
virtual HRESULT _IFUNC Draw(HDC, const RECTL *, const RECTL *, TOcAspect, TOcDraw bd=drNone)=0
virtual HRESULT _IFUNC GetPartSize(owl::TSize *)=0
virtual HRESULT _IFUNC OnRename(IBLinkable *pContainer, LPCOLESTR name)=0
IBPart2 – Supported by server objects.
Definition ocbocole.h:274
IBPart – Supported by server objects.
Definition ocbocole.h:246
virtual HRESULT _IFUNC Activate(BOOL)=0
virtual HRESULT _IFUNC Close()=0
virtual HRESULT _IFUNC SetPartPos(owl::TRect *)=0
virtual HRESULT _IFUNC Show(BOOL)=0
virtual HRESULT _IFUNC DoVerb(owl::uint)=0
virtual HRESULT _IFUNC EnumVerbs(TOcVerb *)=0
virtual HRESULT _IFUNC DoQueryInterface(const IID &iid, void **pif)=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
virtual bool EvOcViewGetSiteRect(TOcSiteRect &sr)=0
virtual bool EvOcViewPartActivate(TOcPart &ocPart)=0
virtual bool EvOcViewGetScale(TOcScaleFactor &scaleFactor)=0
virtual bool EvOcViewSetSiteRect(TOcSiteRect &sr)=0
OC Document class, holds parts & is a owner of views.
Definition ocdoc.h:43
TOcApp & GetOcApp()
Definition ocdoc.h:87
int AllocPartID()
Definition ocdoc.h:86
TOcStorage * GetStorage()
Definition ocdoc.h:58
TOcPartCollection & GetParts()
Definition ocdoc.h:51
TOcView * GetActiveView()
Definition ocdoc.h:76
TOcInitHow How
Definition ocobject.h:120
IStorage * Storage
Definition ocobject.h:124
TOcInitWhere Where
Definition ocobject.h:121
View/Data change info.
Definition ocpart.h:216
virtual unsigned Count() const
Definition ocpart.h:185
bool SelectAll(bool select=false)
Select/unselect all parts.
Definition ocpart.cpp:845
void Clear()
Release parts in the collection.
Definition ocpart.cpp:817
int Find(TOcPart *const &part)
Definition ocpart.h:183
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
int Detach(TOcPart *const &part, int del=0)
Definition ocpart.cpp:853
int Add(TOcPart *const &part)
Definition ocpart.h:180
OC part class represents an embeded or linked part in a document.
Definition ocpart.h:38
bool Close()
Disconnect servers by closing & releasing our BOle helper.
Definition ocpart.cpp:249
void SetVisible(bool visible)
Definition ocpart.cpp:767
owl::TString GetName()
Definition ocpart.h:91
owl::TSize GetSize() const
Update this part's idea of its size via the server, & then return that.
Definition ocpart.cpp:593
virtual bool Init(TOcInitInfo *initInfo, owl::TRect pos)
Perform common ctor initialization.
Definition ocpart.cpp:128
void UpdateRect()
Set part to the new rect given in logical units.
Definition ocpart.cpp:625
TOcDocument & OcDocument
The OC document we are imbeded in.
Definition ocpart.h:154
owl::tstring Name
Definition ocpart.h:157
HRESULT _IFUNC DiscardUndo()
Discard undo stack for our associated [the active] view.
Definition ocpart.cpp:323
owl::uint16 Flags
Is this part Selected/Visible/Active/ALink?
Definition ocpart.h:162
void _IFUNC OnSetFocus(BOOL set)
Definition ocpart.cpp:480
int Detach()
Definition ocpart.cpp:761
void FinishLoading()
Definition ocpart.cpp:670
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
TOcStorage * Storage
The storage we are in.
Definition ocpart.h:155
virtual bool InitObj(TOcInitInfo *initInfo)
Definition ocpart.cpp:154
HRESULT _IFUNC GetParentWindow(HWND *)
Get parent window for part.
Definition ocpart.cpp:436
IBLinkable * BLPartI
Definition ocpart.h:152
owl::ulong _IFUNC Release()
Definition ocpart.h:119
bool EnumVerbs(const TOcVerb &)
Definition ocpart.cpp:738
HRESULT QueryObject(const IID &iid, void **iface)
Callback from TUnknown's implementation of QueryInterface.
Definition ocpart.cpp:219
bool Activate(bool activate)
Definition ocpart.cpp:642
IBPart * BPartI
Definition ocpart.h:151
bool SetHost(IBContainer *container)
Definition ocpart.h:104
HRESULT _IFUNC SetSiteExtent(const owl::TSize *)
Set the part's site extent.
Definition ocpart.cpp:397
IUnknown * BPart
Our corresponding helper object & interfaces.
Definition ocpart.h:150
HRESULT _IFUNC SetSiteRect(const owl::TRect *)
Set the site's rect from an in-place active part.
Definition ocpart.cpp:367
owl::ulong _IFUNC AddRef()
Definition ocpart.h:118
void SetStorage(IStorage *storage, bool remember=true)
Set the storage for this part.
Definition ocpart.cpp:785
bool IsLink() const
Definition ocpart.h:81
owl::TSize Size
Definition ocpart.h:159
bool Load()
Load this part from its ocpart stream in its current storage.
Definition ocpart.cpp:563
HRESULT _IFUNC GetSiteRect(owl::TRect *, owl::TRect *)
Retrieve the site rect [relative to the active view?
Definition ocpart.cpp:333
HRESULT _IFUNC SiteShow(BOOL)
Show/hide a site.
Definition ocpart.cpp:299
void SetPos(const owl::TPoint &pos)
Set part to the new position given in logical units.
Definition ocpart.cpp:605
bool SetFormatData(TOcFormatInfo *fmt, HANDLE data, bool release)
Set data into the server object.
Definition ocpart.cpp:685
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
TOcPart(TOcDocument &document, int id=0)
Construct a new part with a given temp id Must call Init method to complete initialization.
Definition ocpart.cpp:26
void _IFUNC Disconnect()
Definition ocpart.cpp:494
bool Save(bool SameAsLoad=true, bool remember=true)
Save this part to storage.
Definition ocpart.cpp:508
void Select(bool select)
Definition ocpart.h:74
bool DoVerb(owl::uint)
Definition ocpart.cpp:747
bool IsActive() const
Definition ocpart.h:79
void _IFUNC Invalidate(TOcInvalidate)
Invalidate the site within the active view.
Definition ocpart.cpp:471
owl::TPoint Pos
Definition ocpart.h:158
HRESULT _IFUNC GetZoom(TOcScaleInfo *scale)
Get zoom factor for part.
Definition ocpart.cpp:447
void Rename()
Rename the embed site for linking.
Definition ocpart.cpp:277
void GetScaleFactor(TOcScaleInfo &scaleInfo) const
Copy a BOle scale factor structure.
Definition ocview.cpp:1186
owl::TRect Rect
Definition ocview.h:486
TOcStorage(LPCTSTR fileName, bool create, owl::uint32 mode=STGM_READWRITE|STGM_TRANSACTED)
Definition ocstorag.cpp:269
IStorage * GetIStorage()
Definition ocstorag.cpp:383
HRESULT Stat(STATSTG *pstatstg, owl::uint32 grfStatFlag)
Definition ocstorag.cpp:484
HRESULT Write(void const *pv, owl::ulong cb, owl::ulong *written=0)
Definition ocstorag.cpp:166
HRESULT Read(void *pv, owl::ulong cb, owl::ulong *read=0)
Definition ocstorag.cpp:155
LPCOLESTR TypeName
Definition ocpart.h:205
owl::uint VerbIndex
Definition ocpart.h:207
bool CanDirty
Definition ocpart.h:208
LPCOLESTR VerbName
Definition ocpart.h:206
The TOcView partner is a container (viewer) of a given (server/client) document.
Definition ocview.h:136
owl::TRect GetWindowRect() const
Return the client rect for the view window.
Definition ocview.cpp:411
owl::ulong _IFUNC Release()
Definition ocview.h:198
bool UpdateLinks()
Definition ocview.cpp:384
TOcPart * GetActivePart()
Definition ocview.h:178
bool ActivatePart(TOcPart *part)
Activate a given part.
Definition ocview.cpp:444
TOcContainerHost * ContainerHost
The hosting app's container object.
Definition ocview.h:272
HWND _IFUNC GetWindow()
Definition ocview.cpp:572
void InvalidatePart(TOcPartChangeInfo &changeInfo)
Definition ocview.cpp:428
HRESULT _IFUNC QueryInterface(const GUID &iid, void **iface)
Definition ocview.h:199
void SetActivePart(TOcPart *part)
Definition ocview.h:179
IUnknown * GetOuter()
Definition oleutil.h:269
@ xMissingRootIStorage
Definition except.h:104
@ xInternalPartError
Definition except.h:105
static void Check(HRESULT stat, TError err, LPCTSTR msg=0)
Definition ocstorag.cpp:58
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
const TPoint & TopLeft() const
Returns the upperleft point.
Definition geometry.h:983
TRect()
Default constructor that does nothing.
Definition geometry.h:889
TSize Size() const
Returns the size of rectangle.
Definition geometry.h:1057
The tagSIZE struct is defined as.
Definition geometry.h:234
TSize()
Default constructor that does nothing.
Definition geometry.h:1406
bool Detach(int loc)
Definition template.h:1573
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation).
Definition appdesc.h:22
bool HRIsOK(HRESULT hr)
Definition defs.h:132
TOcAspect
Definition ocobject.h:64
@ iwStorage
Definition ocobject.h:102
@ iwNew
Definition ocobject.h:104
@ ihEmbed
Definition ocobject.h:95
@ ihLink
Definition ocobject.h:94
TOcInvalidate
Definition ocobject.h:59
@ invView
Definition ocobject.h:61
bool HRSucceeded(HRESULT hr)
Definition defs.h:131
const BCID cidBOlePart
Definition ocbocole.h:117
const TCHAR PartFormat[]
Definition ocpart.cpp:19
const TCHAR PartStreamName[]
Definition ocpart.cpp:20
_T("!ForeColor")
const GUID & iid
Definition appdesc.h:328
TOcPartCollection::Iterator TOcPartCollectionIter
Definition ocpart.h:195
@ drNone
Definition ocobject.h:82
unsigned int uint
Definition number.h:25
Definition of TOcApp application connection class.
Definition of TOcDocument Class.
interface _ICLASS IStorage
Definition ocdoc.h:25
#define HR_INVALIDARG
Definition defs.h:78
#define HR_NOERROR
Definition defs.h:73
#define HR_FAIL
Definition defs.h:83
Definition of TOcPart class.
Definition of TOcStorage & TOcStream classes.
Definition of Compound Document TOcView Class.
#define _IFUNC
Definition oleutil.h:28
owl::ulong xN
numerator in x direction
Definition ocobject.h:75
owl::ulong yN
numerator in y direction
Definition ocobject.h:77
owl::ulong yD
denominator in y direction
Definition ocobject.h:78
owl::ulong xD
denominator in x direction
Definition ocobject.h:76