OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ocf::TOcPart Class Reference

OC part class represents an embeded or linked part in a document. More...

#include <ocf/ocpart.h>

Inheritance diagram for ocf::TOcPart:
ocf::TUnknown ocf::IBSite2 ocf::IBSite ocf::TOcControl

Public Member Functions

 TOcPart (TOcDocument &document, int id=0)
 Construct a new part with a given temp id Must call Init method to complete initialization.
 
 TOcPart (TOcDocument &document, LPCTSTR name)
 Construct a part from a named stream in an oc doc's storage.
 
 TOcPart (TOcDocument &document, TOcInitInfo &initInfo, owl::TRect pos, int id=0)
 Old style constructor - does init in constructor - OCF messages will get passed before constructor is complete.
 
virtual bool Init (TOcInitInfo *initInfo, owl::TRect pos)
 Perform common ctor initialization.
 
void Delete ()
 Delete this object.
 
bool operator== (const TOcPart &other)
 
IBPartGetBPartI ()
 
TOcStorageGetStorage ()
 
void SetStorage (IStorage *storage, bool remember=true)
 Set the storage for this part.
 
bool Save (bool SameAsLoad=true, bool remember=true)
 Save this part to storage.
 
bool Load ()
 Load this part from its ocpart stream in its current storage.
 
int Detach ()
 
void FinishLoading ()
 
owl::TPoint GetPos () const
 
void SetPos (const owl::TPoint &pos)
 Set part to the new position given in logical units.
 
owl::TSize GetSize () const
 Update this part's idea of its size via the server, & then return that.
 
void SetSize (const owl::TSize &size)
 Set part to the new size given in logical units.
 
owl::TRect GetRect () const
 
void UpdateRect ()
 Set part to the new rect given in logical units.
 
bool IsVisible (const owl::TRect &logicalRect) const
 
void Select (bool select)
 
bool IsSelected () const
 
void SetVisible (bool visible)
 
bool IsVisible () const
 
bool IsActive () const
 
void SetActive ()
 
bool IsLink () const
 
owl::TString GetName ()
 
void Rename ()
 Rename the embed site for linking.
 
bool Save (IStorage *storage, bool sameAsLoad, bool remember)
 
bool Draw (HDC dc, const owl::TRect &pos, const owl::TRect &clip, TOcAspect aspect=asDefault)
 
bool Activate (bool activate)
 
bool Show (bool show)
 
bool Open (bool open)
 
HWND OpenInPlace (HWND hwnd)
 
bool CanOpenInPlace ()
 
bool Close ()
 Disconnect servers by closing & releasing our BOle helper.
 
bool SetHost (IBContainer *container)
 
bool EnumVerbs (const TOcVerb &)
 
bool DoVerb (owl::uint)
 
LPCOLESTR GetServerName (TOcPartName partName)
 
HRESULT QueryServer (const IID &iid, void **iface)
 Query server for its interfaces.
 
bool SetFormatData (TOcFormatInfo *fmt, HANDLE data, bool release)
 Set data into the server object.
 
owl::ulong _IFUNC AddRef ()
 
owl::ulong _IFUNC Release ()
 
HRESULT _IFUNC QueryInterface (const GUID &iid, void **iface)
 
- Public Member Functions inherited from ocf::TUnknown
 operator IUnknown & ()
 
 operator IUnknown * ()
 
IUnknown * SetOuter (IUnknown *outer=0)
 
IUnknown * GetOuter ()
 
unsigned long GetRefCount ()
 
unsigned long AdjustRefCount (int i)
 
IUnknown & Aggregate (TUnknown &inner)
 

Protected Types

enum  TFlag { Visible =0x01 , Selected =0x02 , Active =0x04 , Link =0x08 , Closing =0x10 , OcxDefault =0x20 , OcxCancel =0x40 }
 

Protected Member Functions

 ~TOcPart ()
 
virtual bool InitObj (TOcInitInfo *initInfo)
 
HRESULT QueryObject (const IID &iid, void **iface)
 Callback from TUnknown's implementation of QueryInterface.
 
HRESULT _IFUNC SiteShow (BOOL)
 Show/hide a site.
 
HRESULT _IFUNC DiscardUndo ()
 Discard undo stack for our associated [the active] view.
 
HRESULT _IFUNC GetSiteRect (owl::TRect *, owl::TRect *)
 Retrieve the site rect [relative to the active view?], and optionally the view's rect too?
 
HRESULT _IFUNC SetSiteRect (const owl::TRect *)
 Set the site's rect from an in-place active part.
 
HRESULT _IFUNC SetSiteExtent (const owl::TSize *)
 Set the part's site extent.
 
HRESULT _IFUNC GetZoom (TOcScaleInfo *scale)
 Get zoom factor for part.
 
void _IFUNC Invalidate (TOcInvalidate)
 Invalidate the site within the active view.
 
void _IFUNC OnSetFocus (BOOL set)
 
HRESULT _IFUNC Init (IBDataProvider *, IBPart *, LPCOLESTR, BOOL)
 
void _IFUNC Disconnect ()
 
HRESULT _IFUNC GetParentWindow (HWND *)
 Get parent window for part.
 
- Protected Member Functions inherited from ocf::TUnknown
 TUnknown ()
 
virtual ~TUnknown ()
 
IUnknown & ThisUnknown ()
 
virtual HRESULT QueryObject (const GUID &iid, void **pif)
 QueryObject used when TUnknown is in constructor/destructor.
 

Protected Attributes

IUnknown * BPart
 Our corresponding helper object & interfaces.
 
IBPartBPartI
 
IBLinkableBLPartI
 
TOcDocumentOcDocument
 The OC document we are imbeded in.
 
TOcStorageStorage
 The storage we are in.
 
owl::tstring Name
 
owl::TPoint Pos
 
owl::TSize Size
 
owl::uint16 Flags
 Is this part Selected/Visible/Active/ALink?
 
- Protected Attributes inherited from ocf::TUnknown
IUnknown * Outer
 

Friends

class TOcPartCollection
 

Detailed Description

OC part class represents an embeded or linked part in a document.

Definition at line 38 of file ocpart.h.

Member Enumeration Documentation

◆ TFlag

Enumerator
Visible 
Selected 
Active 
Link 
Closing 
OcxDefault 
OcxCancel 

Definition at line 160 of file ocpart.h.

Constructor & Destructor Documentation

◆ TOcPart() [1/3]

ocf::TOcPart::TOcPart ( TOcDocument & document,
int id = 0 )

Construct a new part with a given temp id Must call Init method to complete initialization.

Definition at line 26 of file ocpart.cpp.

References AddRef(), ocf::TOcDocument::AllocPartID(), ocf::TOcDocument::GetStorage(), Name, OcDocument, ocf::PartFormat, Storage, ocf::TXObjComp::Throw(), ocf::TOcStorage, and ocf::TXObjComp::xMissingRootIStorage.

◆ TOcPart() [2/3]

ocf::TOcPart::TOcPart ( TOcDocument & document,
LPCTSTR name )

◆ TOcPart() [3/3]

ocf::TOcPart::TOcPart ( TOcDocument & document,
TOcInitInfo & initInfo,
owl::TRect pos,
int id = 0 )

Old style constructor - does init in constructor - OCF messages will get passed before constructor is complete.

Definition at line 52 of file ocpart.cpp.

References AddRef(), ocf::TOcDocument::AllocPartID(), ocf::TOcDocument::GetStorage(), Init(), Name, OcDocument, ocf::PartFormat, Storage, ocf::TXObjComp::Throw(), ocf::TOcStorage, and ocf::TXObjComp::xMissingRootIStorage.

◆ ~TOcPart()

ocf::TOcPart::~TOcPart ( )
protected

Member Function Documentation

◆ Activate()

bool ocf::TOcPart::Activate ( bool activate)

◆ AddRef()

owl::ulong _IFUNC ocf::TOcPart::AddRef ( )
inline

Definition at line 118 of file ocpart.h.

◆ CanOpenInPlace()

bool ocf::TOcPart::CanOpenInPlace ( )
inline

Definition at line 102 of file ocpart.h.

References ocf::HRSucceeded().

◆ Close()

bool ocf::TOcPart::Close ( )

Disconnect servers by closing & releasing our BOle helper.

Definition at line 249 of file ocpart.cpp.

References BLPartI, BPart, BPartI, ocf::IBPart::Close(), Closing, Flags, ocf::HRSucceeded(), and ocf::IBLinkable::OnRename().

◆ Delete()

void ocf::TOcPart::Delete ( )

Delete this object.

Actually, causes object to shutdown as much as possible & then releases a reference.

Definition at line 208 of file ocpart.cpp.

References Activate(), Close(), and Release().

◆ Detach()

int ocf::TOcPart::Detach ( )

◆ DiscardUndo()

HRESULT _IFUNC ocf::TOcPart::DiscardUndo ( )
protectedvirtual

Discard undo stack for our associated [the active] view.

Implements ocf::IBSite.

Definition at line 323 of file ocpart.cpp.

References HR_NOERROR.

◆ Disconnect()

void _IFUNC ocf::TOcPart::Disconnect ( )
protectedvirtual

Implements ocf::IBSite.

Definition at line 494 of file ocpart.cpp.

◆ DoVerb()

bool ocf::TOcPart::DoVerb ( owl::uint whichVerb)

◆ Draw()

◆ EnumVerbs()

bool ocf::TOcPart::EnumVerbs ( const TOcVerb & verb)

Definition at line 738 of file ocpart.cpp.

References BPartI, ocf::IBPart::EnumVerbs(), and ocf::HRIsOK().

◆ FinishLoading()

void ocf::TOcPart::FinishLoading ( )

◆ GetBPartI()

IBPart * ocf::TOcPart::GetBPartI ( )
inline

Definition at line 53 of file ocpart.h.

◆ GetName()

owl::TString ocf::TOcPart::GetName ( )
inline

Definition at line 91 of file ocpart.h.

References ocf::Name.

◆ GetParentWindow()

HRESULT _IFUNC ocf::TOcPart::GetParentWindow ( HWND * hWnd)
protectedvirtual

Get parent window for part.

Implements ocf::IBSite2.

Definition at line 436 of file ocpart.cpp.

References ocf::TOcDocument::GetActiveView(), and OcDocument.

◆ GetPos()

owl::TPoint ocf::TOcPart::GetPos ( ) const
inline

Definition at line 63 of file ocpart.h.

◆ GetRect()

owl::TRect ocf::TOcPart::GetRect ( ) const
inline

Definition at line 67 of file ocpart.h.

◆ GetServerName()

LPCOLESTR ocf::TOcPart::GetServerName ( TOcPartName partName)
inline

Definition at line 109 of file ocpart.h.

◆ GetSiteRect()

HRESULT _IFUNC ocf::TOcPart::GetSiteRect ( owl::TRect * posRect,
owl::TRect * clipRect )
protectedvirtual

Retrieve the site rect [relative to the active view?], and optionally the view's rect too?

Implements ocf::IBSite.

Definition at line 333 of file ocpart.cpp.

References ocf::TOcDocument::GetActiveView(), HR_FAIL, HR_INVALIDARG, HR_NOERROR, OcDocument, Pos, PRECONDITION, and Size.

◆ GetSize()

TSize ocf::TOcPart::GetSize ( ) const

Update this part's idea of its size via the server, & then return that.

Use GetRect() to just get the current site rect.

Definition at line 593 of file ocpart.cpp.

References BPartI, ocf::IBDataProvider::GetPartSize(), and Size.

◆ GetStorage()

TOcStorage * ocf::TOcPart::GetStorage ( )
inline

Definition at line 54 of file ocpart.h.

◆ GetZoom()

HRESULT _IFUNC ocf::TOcPart::GetZoom ( TOcScaleInfo * scale)
protectedvirtual

Get zoom factor for part.

Implements ocf::IBSite.

Definition at line 447 of file ocpart.cpp.

References ocf::TOcDocument::GetActiveView(), HR_FAIL, HR_INVALIDARG, HR_NOERROR, OcDocument, and PRECONDITION.

◆ Init() [1/2]

HRESULT _IFUNC ocf::TOcPart::Init ( IBDataProvider * ,
IBPart * ,
LPCOLESTR ,
BOOL  )
protectedvirtual

Implements ocf::IBSite.

Definition at line 488 of file ocpart.cpp.

References HR_FAIL.

◆ Init() [2/2]

bool ocf::TOcPart::Init ( TOcInitInfo * initInfo,
owl::TRect pos )
virtual

Perform common ctor initialization.

Reimplemented in ocf::TOcControl.

Definition at line 128 of file ocpart.cpp.

References ocf::TOcPartCollection::Add(), BPart, ocf::TOcDocument::GetActiveView(), ocf::TOcDocument::GetParts(), InitObj(), OcDocument, Pos, and Size.

◆ InitObj()

◆ Invalidate()

void _IFUNC ocf::TOcPart::Invalidate ( TOcInvalidate type)
protectedvirtual

Invalidate the site within the active view.

Implements ocf::IBSite.

Definition at line 471 of file ocpart.cpp.

References ocf::TOcDocument::GetActiveView(), and OcDocument.

◆ IsActive()

bool ocf::TOcPart::IsActive ( ) const
inline

Definition at line 79 of file ocpart.h.

References owl::ToBool().

◆ IsLink()

bool ocf::TOcPart::IsLink ( ) const
inline

Definition at line 81 of file ocpart.h.

References owl::ToBool().

◆ IsSelected()

bool ocf::TOcPart::IsSelected ( ) const
inline

Definition at line 76 of file ocpart.h.

References owl::ToBool().

◆ IsVisible() [1/2]

bool ocf::TOcPart::IsVisible ( ) const
inline

Definition at line 78 of file ocpart.h.

References owl::ToBool().

◆ IsVisible() [2/2]

bool ocf::TOcPart::IsVisible ( const owl::TRect & logicalRect) const
inline

Definition at line 69 of file ocpart.h.

References owl::ToBool(), and owl::TRect::Touches().

◆ Load()

bool ocf::TOcPart::Load ( )

Load this part from its ocpart stream in its current storage.

Definition at line 563 of file ocpart.cpp.

References Active, Closing, Flags, ocf::HRSucceeded(), ocf::PartStreamName, Pos, Size, ocf::TOcStorage::Stat(), and Storage.

◆ OnSetFocus()

void _IFUNC ocf::TOcPart::OnSetFocus ( BOOL set)
protectedvirtual

Implements ocf::IBSite.

Definition at line 480 of file ocpart.cpp.

References ocf::TOcDocument::GetActiveView(), and OcDocument.

◆ Open()

bool ocf::TOcPart::Open ( bool open)
inline

Definition at line 100 of file ocpart.h.

References ocf::HRSucceeded().

◆ OpenInPlace()

HWND ocf::TOcPart::OpenInPlace ( HWND hwnd)
inline

Definition at line 101 of file ocpart.h.

◆ operator==()

bool ocf::TOcPart::operator== ( const TOcPart & other)
inline

Definition at line 49 of file ocpart.h.

References owl::ToBool().

◆ QueryInterface()

HRESULT _IFUNC ocf::TOcPart::QueryInterface ( const GUID & iid,
void ** iface )
inline

Definition at line 120 of file ocpart.h.

◆ QueryObject()

HRESULT ocf::TOcPart::QueryObject ( const IID & iid,
void ** iface )
protected

Callback from TUnknown's implementation of QueryInterface.

Definition at line 219 of file ocpart.cpp.

References BPart, ocf::HRSucceeded(), and PRECONDITION.

◆ QueryServer()

HRESULT ocf::TOcPart::QueryServer ( const IID & iid,
void ** iface )

Query server for its interfaces.

Definition at line 239 of file ocpart.cpp.

References BPartI, ocf::IBPart::DoQueryInterface(), and PRECONDITION.

◆ Release()

owl::ulong _IFUNC ocf::TOcPart::Release ( )
inline

Definition at line 119 of file ocpart.h.

◆ Rename()

void ocf::TOcPart::Rename ( )

Rename the embed site for linking.

Definition at line 277 of file ocpart.cpp.

References BLPartI, CHECK, ocf::TOcDocument::GetActiveView(), GetName(), OcDocument, and ocf::IBLinkable::OnRename().

◆ Save() [1/2]

bool ocf::TOcPart::Save ( bool sameAsLoad = true,
bool remember = true )

Save this part to storage.

May be any of:

  • Save to our storage : sameAsLoad==1
  • Copy to a storage : sameAsLoad==0, remember==0
  • SaveAs a new storage: sameAsLoad==0, remember==1

Definition at line 508 of file ocpart.cpp.

References Flags, ocf::TOcStorage::GetIStorage(), GetName(), ocf::TOcDocument::GetStorage(), ocf::HRSucceeded(), OcDocument, ocf::PartStreamName, Pos, Save(), Size, ocf::TOcStorage::Stat(), Storage, and ocf::TOcStorage.

◆ Save() [2/2]

bool ocf::TOcPart::Save ( IStorage * storage,
bool sameAsLoad,
bool remember )

Definition at line 698 of file ocpart.cpp.

References BPartI, ocf::HRSucceeded(), PRECONDITION, and ocf::IBDataProvider::Save().

◆ Select()

void ocf::TOcPart::Select ( bool select)
inline

Definition at line 74 of file ocpart.h.

◆ SetActive()

void ocf::TOcPart::SetActive ( )
inline

Definition at line 80 of file ocpart.h.

◆ SetFormatData()

bool ocf::TOcPart::SetFormatData ( TOcFormatInfo * fmt,
HANDLE data,
bool release )

Set data into the server object.

Definition at line 685 of file ocpart.cpp.

References BPart, and ocf::HRSucceeded().

◆ SetHost()

bool ocf::TOcPart::SetHost ( IBContainer * container)
inline

Definition at line 104 of file ocpart.h.

References ocf::HRSucceeded().

◆ SetPos()

void ocf::TOcPart::SetPos ( const owl::TPoint & pos)

Set part to the new position given in logical units.

Note
Does you update the part's location. Must explicitly call UpdateRect!

Definition at line 605 of file ocpart.cpp.

References Pos.

◆ SetSiteExtent()

HRESULT _IFUNC ocf::TOcPart::SetSiteExtent ( const owl::TSize * newSize)
protectedvirtual

Set the part's site extent.

This comes either after a SetPartRect, or for open editing, comes alone.

Implements ocf::IBSite.

Definition at line 397 of file ocpart.cpp.

References ocf::TOcDocument::GetActiveView(), HR_FAIL, HR_INVALIDARG, HR_NOERROR, Invalidate(), ocf::invView, OcDocument, Pos, PRECONDITION, and Size.

◆ SetSiteRect()

HRESULT _IFUNC ocf::TOcPart::SetSiteRect ( const owl::TRect * newRect)
protectedvirtual

Set the site's rect from an in-place active part.

Since user is in control we generally respect both Pos & Size changes.

Implements ocf::IBSite.

Definition at line 367 of file ocpart.cpp.

References ocf::TOcDocument::GetActiveView(), HR_FAIL, HR_INVALIDARG, HR_NOERROR, Invalidate(), ocf::invView, OcDocument, Pos, PRECONDITION, and Size.

◆ SetSize()

void ocf::TOcPart::SetSize ( const owl::TSize & size)

Set part to the new size given in logical units.

Note
Does you update the part's location. Must explicitly call UpdateRect!

Definition at line 616 of file ocpart.cpp.

References Size.

◆ SetStorage()

void ocf::TOcPart::SetStorage ( IStorage * storage,
bool remember = true )

Set the storage for this part.

Definition at line 785 of file ocpart.cpp.

References ocf::TOcStorage::GetIStorage(), Storage, and ocf::TOcStorage.

◆ SetVisible()

void ocf::TOcPart::SetVisible ( bool visible)

Definition at line 767 of file ocpart.cpp.

References BPartI, Flags, Invalidate(), ocf::invView, IsActive(), ocf::IBPart::Show(), and Visible.

◆ Show()

bool ocf::TOcPart::Show ( bool show)
inline

Definition at line 99 of file ocpart.h.

References ocf::HRSucceeded().

◆ SiteShow()

HRESULT _IFUNC ocf::TOcPart::SiteShow ( BOOL show)
protectedvirtual

Show/hide a site.

Implements ocf::IBSite.

Definition at line 299 of file ocpart.cpp.

References Active, Flags, ocf::TOcDocument::GetActiveView(), HR_NOERROR, Invalidate(), ocf::invView, and OcDocument.

◆ UpdateRect()

void ocf::TOcPart::UpdateRect ( )

Set part to the new rect given in logical units.

Definition at line 625 of file ocpart.cpp.

References BPartI, ocf::TOcDocument::GetActiveView(), OcDocument, Pos, ocf::IBPart::SetPartPos(), and Size.

Friends And Related Symbol Documentation

◆ TOcPartCollection

Definition at line 164 of file ocpart.h.

Member Data Documentation

◆ BLPartI

IBLinkable* ocf::TOcPart::BLPartI
protected

Definition at line 152 of file ocpart.h.

◆ BPart

IUnknown* ocf::TOcPart::BPart
protected

Our corresponding helper object & interfaces.

Definition at line 150 of file ocpart.h.

◆ BPartI

IBPart* ocf::TOcPart::BPartI
protected

Definition at line 151 of file ocpart.h.

◆ Flags

owl::uint16 ocf::TOcPart::Flags
protected

Is this part Selected/Visible/Active/ALink?

Definition at line 162 of file ocpart.h.

◆ Name

owl::tstring ocf::TOcPart::Name
protected

Definition at line 157 of file ocpart.h.

◆ OcDocument

TOcDocument& ocf::TOcPart::OcDocument
protected

The OC document we are imbeded in.

Definition at line 154 of file ocpart.h.

◆ Pos

owl::TPoint ocf::TOcPart::Pos
protected

Definition at line 158 of file ocpart.h.

◆ Size

owl::TSize ocf::TOcPart::Size
protected

Definition at line 159 of file ocpart.h.

◆ Storage

TOcStorage* ocf::TOcPart::Storage
protected

The storage we are in.

Definition at line 155 of file ocpart.h.


The documentation for this class was generated from the following files: