Class OleClientSite

All Implemented Interfaces:
Drawable
Direct Known Subclasses:
OleControlSite

public class OleClientSite extends Composite
OleClientSite provides a site to manage an embedded OLE Document within a container.

The OleClientSite provides the following capabilities:

  • creates the in-place editor for a blank document or opening an existing OLE Document
  • lays the editor out
  • provides a mechanism for activating and deactivating the Document
  • provides a mechanism for saving changes made to the document

This object implements the OLE Interfaces IUnknown, IOleClientSite, IAdviseSink, IOleInPlaceSite

Note that although this class is a subclass of Composite, it does not make sense to add Control children to it, or set a layout on it.

Styles
BORDER
Events
Dispose, Move, Resize
See Also:
  • Field Details

    • appClsid

      protected org.eclipse.swt.internal.ole.win32.GUID appClsid
    • frame

      protected OleFrame frame
    • objIUnknown

      protected org.eclipse.swt.internal.ole.win32.IUnknown objIUnknown
    • objIOleObject

      protected org.eclipse.swt.internal.ole.win32.IOleObject objIOleObject
    • objIViewObject2

      protected org.eclipse.swt.internal.ole.win32.IViewObject2 objIViewObject2
    • objIOleInPlaceObject

      protected org.eclipse.swt.internal.ole.win32.IOleInPlaceObject objIOleInPlaceObject
    • objIOleCommandTarget

      protected org.eclipse.swt.internal.ole.win32.IOleCommandTarget objIOleCommandTarget
    • objDocumentView

      protected org.eclipse.swt.internal.ole.win32.IOleDocumentView objDocumentView
    • tempStorage

      protected org.eclipse.swt.internal.ole.win32.IStorage tempStorage
  • Constructor Details

    • OleClientSite

      protected OleClientSite(Composite parent, int style)
    • OleClientSite

      public OleClientSite(Composite parent, int style, File file)
      Create an OleClientSite child widget using the OLE Document type associated with the specified file. The OLE Document type is determined either through header information in the file or through a Registry entry for the file extension. Use style bits to select a particular look or set of properties.
      Parameters:
      parent - a composite widget; must be an OleFrame
      style - the bitwise OR'ing of widget styles
      file - the file that is to be opened in this OLE Document
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT when the parent is null
      • ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
      SWTException -
      • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
      • ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
      • ERROR_CANNOT_OPEN_FILE when failed to open file
      • ERROR_INTERFACE_NOT_FOUND when unable to create callbacks for OLE Interfaces
      • ERROR_INVALID_CLASSID
    • OleClientSite

      public OleClientSite(Composite parent, int style, String progId)
      Create an OleClientSite child widget to edit a blank document using the specified OLE Document application. Use style bits to select a particular look or set of properties.
      Parameters:
      parent - a composite widget; must be an OleFrame
      style - the bitwise OR'ing of widget styles
      progId - the unique program identifier of an OLE Document application; the value of the ProgID key or the value of the VersionIndependentProgID key specified in the registry for the desired OLE Document (for example, the VersionIndependentProgID for Word is Word.Document)
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT when the parent is null
      • ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
      SWTException -
      • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
      • ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
      • ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
    • OleClientSite

      public OleClientSite(Composite parent, int style, String progId, File file)
      Create an OleClientSite child widget to edit the specified file using the specified OLE Document application. Use style bits to select a particular look or set of properties.

      IMPORTANT: This method is not part of the public API for OleClientSite. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code.

      Parameters:
      parent - a composite widget; must be an OleFrame
      style - the bitwise OR'ing of widget styles
      progId - the unique program identifier of am OLE Document application; the value of the ProgID key or the value of the VersionIndependentProgID key specified in the registry for the desired OLE Document (for example, the VersionIndependentProgID for Word is Word.Document)
      file - the file that is to be opened in this OLE Document
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT when the parent is null
      • ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
      SWTException -
      • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
      • ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
      • ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
      • ERROR_CANNOT_OPEN_FILE when failed to open file
      Restriction:
      This method is not intended to be referenced by clients.
  • Method Details

    • addObjectReferences

      protected void addObjectReferences()
    • AddRef

      protected int AddRef()
    • createCOMInterfaces

      protected void createCOMInterfaces()
    • createTempStorage

      protected org.eclipse.swt.internal.ole.win32.IStorage createTempStorage()
    • deactivateInPlaceClient

      public void deactivateInPlaceClient()
      Deactivates an active in-place object and discards the object's undo state.
    • disposeCOMInterfaces

      protected void disposeCOMInterfaces()
    • doVerb

      public int doVerb(int verb)
      Requests that the OLE Document or ActiveX Control perform an action; actions are almost always changes to the activation state.
      Parameters:
      verb - the operation that is requested. This is one of the OLE.OLEIVERB_ values
      Returns:
      an HRESULT value indicating the success of the operation request; OLE.S_OK indicates success
    • exec

      public int exec(int cmdID, int options, Variant in, Variant out)
      Asks the OLE Document or ActiveX Control to execute a command from a standard list of commands. The OLE Document or ActiveX Control must support the IOleCommandTarget interface. The OLE Document or ActiveX Control does not have to support all the commands in the standard list. To check if a command is supported, you can call queryStatus with the cmdID.
      Parameters:
      cmdID - the ID of a command; these are the OLE.OLECMDID_ values - a small set of common commands
      options - the optional flags; these are the OLE.OLECMDEXECOPT_ values
      in - the argument for the command
      out - the return value of the command
      Returns:
      an HRESULT value; OLE.S_OK is returned if successful
    • getClassID

      protected org.eclipse.swt.internal.ole.win32.GUID getClassID(String clientName)
    • getIndent

      public Rectangle getIndent()
      Returns the indent value that would be used to compute the clipping area of the active X object. NOTE: The indent value is no longer being used by the client site.
      Returns:
      the rectangle representing the indent
    • getProgramID

      public String getProgramID()
      Returns the program ID of the OLE Document or ActiveX Control.
      Returns:
      the program ID of the OLE Document or ActiveX Control
    • GetWindow

      protected int GetWindow(long phwnd)
    • isDirty

      public boolean isDirty()
      Returns whether ole document is dirty by checking whether the content of the file representing the document is dirty.
      Returns:
      true if the document has been modified, false otherwise.
      Since:
      3.1
    • isFocusControl

      public boolean isFocusControl()
      Description copied from class: Control
      Returns true if the receiver has the user-interface focus, and false otherwise.
      Overrides:
      isFocusControl in class Control
      Returns:
      the receiver's focus state
    • QueryInterface

      protected int QueryInterface(long riid, long ppvObject)
    • queryStatus

      public int queryStatus(int cmd)
      Returns the status of the specified command. The status is any bitwise OR'd combination of SWTOLE.OLECMDF_SUPPORTED, SWTOLE.OLECMDF_ENABLED, SWTOLE.OLECMDF_LATCHED, SWTOLE.OLECMDF_NINCHED. You can query the status of a command before invoking it with OleClientSite.exec. The OLE Document or ActiveX Control must support the IOleCommandTarget to make use of this method.
      Parameters:
      cmd - the ID of a command; these are the OLE.OLECMDID_ values - a small set of common commands
      Returns:
      the status of the specified command or 0 if unable to query the OLE Object; these are the OLE.OLECMDF_ values
    • Release

      protected int Release()
    • releaseObjectInterfaces

      protected void releaseObjectInterfaces()
    • save

      public boolean save(File file, boolean includeOleInfo)
      Saves the document to the specified file and includes OLE specific information if specified. This method must only be used for files that have an OLE Storage format. For example, a word file edited with Word.Document should be saved using this method because there is formating information that should be stored in the OLE specific Storage format.
      Parameters:
      file - the file to which the changes are to be saved
      includeOleInfo - the flag to indicate whether OLE specific information should be saved.
      Returns:
      true if the save was successful
    • setIndent

      public void setIndent(Rectangle newIndent)
      The indent value is no longer being used by the client site.
      Parameters:
      newIndent - the rectangle representing the indent amount
    • showProperties

      public void showProperties(String title)
      Displays a dialog with the property information for this OLE Object. The OLE Document or ActiveX Control must support the ISpecifyPropertyPages interface.
      Parameters:
      title - the name that will appear in the titlebar of the dialog