Eclipse Platform Release 3.7

## org.eclipse.swt.ole.win32
Class OleControlSite

    java.lang.Object
      org.eclipse.swt.widgets.Widget
          org.eclipse.swt.widgets.Control
              org.eclipse.swt.widgets.Scrollable
                  org.eclipse.swt.widgets.Composite
                      org.eclipse.swt.ole.win32.OleClientSite
                          org.eclipse.swt.ole.win32.OleControlSite

All Implemented Interfaces:
  Drawable

    public class OleControlSite

extends OleClientSite

OleControlSite provides a site to manage an embedded ActiveX Control within a container.

In addition to the behaviour provided by OleClientSite, this object provides the following:

- events from the ActiveX control
- notification of property changes from the ActiveX control
- simplified access to well known properties of the ActiveX Control (e.g. font, background color)
- expose ambient properties of the container to the ActiveX Control

This object implements the OLE Interfaces IOleControlSite, IDispatch, and IPropertyNotifySink.

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:
  OLE and ActiveX snippets, SWT Examples: OLEExample, OleWebBrowser

Field Summary

Fields inherited from class org.eclipse.swt.ole.win32.OleClientSite
`appClsid, frame, objDocumentView, objIOleCommandTarget, objIOleInPlaceObject, objIOleObject, objIUnknown, objIViewObject2, tempStorage`

Fields inherited from class org.eclipse.swt.widgets.Control
`handle`

Constructor Summary
`OleControlSite(Composite parent, int style, File file)` Create an OleControlSite child widget using the OLE Document type associated with the specified file.
`OleControlSite(Composite parent, int style, String progId)` Create an OleControlSite child widget using style bits to select a particular look or set of properties.
`OleControlSite(Composite parent, int style, String progId, File file)` Create an OleClientSite child widget to edit the specified file using the specified OLE Document application.

Method Summary
`void` `addEventListener(int eventID, OleListener listener)` Adds the listener to receive events.
`void` `addEventListener(OleAutomation automation, int eventID, OleListener listener)` Adds the listener to receive events.
`void` `addEventListener(OleAutomation automation, String eventSinkId, int eventID, OleListener listener)` Adds the listener to receive events.
`protected void` `addObjectReferences()`
`void` `addPropertyListener(int propertyID, OleListener listener)` Adds the listener to receive events.
`protected void` `createCOMInterfaces()`
`protected void` `disposeCOMInterfaces()`
`Color` `getBackground()` Returns the receiver's background color.
`Font` `getFont()` Returns the font that the receiver will use to paint textual information.
`Color` `getForeground()` Returns the foreground color that the receiver will use to draw.
`protected int` `getLicenseInfo(org.eclipse.swt.internal.ole.win32.GUID clsid)`
`Variant` `getSiteProperty(int dispId)` Get the control site property specified by the dispIdMember, or `null` if the dispId is not recognised.
`protected int` `GetWindow(int phwnd)`
`protected int` `OnUIDeactivate(int fUndoable)`
`protected int` `QueryInterface(int riid, int ppvObject)`
`protected int` `Release()`
`protected void` `releaseObjectInterfaces()`
`void` `removeEventListener(int eventID, OleListener listener)` Removes the listener.
`void` `removeEventListener(OleAutomation automation, org.eclipse.swt.internal.ole.win32.GUID guid, int eventID, OleListener listener)` Deprecated. - use OleControlSite.removeEventListener(OleAutomation, int, OleListener)
`void` `removeEventListener(OleAutomation automation, int eventID, OleListener listener)` Removes the listener.
`void` `removePropertyListener(int propertyID, OleListener listener)` Removes the listener.
`void` `setBackground(Color color)` Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.
`void` `setFont(Font font)` Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.
`void` `setForeground(Color color)` Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.
`void` `setSiteProperty(int dispId, Variant value)` Sets the control site property specified by the dispIdMember to a new value.

Methods inherited from class org.eclipse.swt.ole.win32.OleClientSite
`AddRef, createTempStorage, deactivateInPlaceClient, doVerb, exec, getClassID, getIndent, getProgramID, isDirty, isFocusControl, queryStatus, save, setIndent, showProperties`

Methods inherited from class org.eclipse.swt.widgets.Composite
`changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList`

Methods inherited from class org.eclipse.swt.widgets.Scrollable
`computeTrim, getClientArea, getHorizontalBar, getVerticalBar`

Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

Methods inherited from class org.eclipse.swt.widgets.Widget
`addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### OleControlSite

    public OleControlSite(Composite parent,
                          int style,
                          File file)

  Create an OleControlSite 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
  Since:
    3.5

### OleControlSite

    public OleControlSite(Composite parent,
                          int style,
                          String progId)

  Create an OleControlSite child widget using 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 which has been registered for this ActiveX Control; the value of the ProgID key or the value of the VersionIndependentProgID key specified in the registry for this Control (for example, the VersionIndependentProgID for Internet Explorer is Shell.Explorer)
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when the parent is null
    `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_ACCESS_CLASSFACTORY when Class Factory could not be found
    - ERROR_CANNOT_CREATE_LICENSED_OBJECT when failed to create a licensed OLE Object

### OleControlSite

    public OleControlSite(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
  Since:
    3.5
  Restriction:
    This method is not intended to be referenced by clients.

Method Detail

### addEventListener

    public void addEventListener(int eventID,
                                 OleListener listener)

  Adds the listener to receive events.

  Parameters:
    `eventID` - the id of the event
    `listener` - the listener
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null

### addEventListener

    public void addEventListener(OleAutomation automation,
                                 int eventID,
                                 OleListener listener)

  Adds the listener to receive events.

  Parameters:
    `automation` - the automation object that provides the event notification
    `eventID` - the id of the event
    `listener` - the listener
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null
  Since:
    2.0

### addEventListener

    public void addEventListener(OleAutomation automation,
                                 String eventSinkId,
                                 int eventID,
                                 OleListener listener)

  Adds the listener to receive events.

  Parameters:
    `automation` - the automation object that provides the event notification
    `eventSinkId` - the GUID of the event sink
    `eventID` - the id of the event
    `listener` - the listener
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null
  Since:
    3.2

### addObjectReferences

    protected void addObjectReferences()

  Overrides:
    `addObjectReferences` in class `OleClientSite`

### addPropertyListener

    public void addPropertyListener(int propertyID,
                                    OleListener listener)

  Adds the listener to receive events.

  Parameters:
    `propertyID` - the identifier of the property
    `listener` - the listener
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null

### createCOMInterfaces

    protected void createCOMInterfaces()

  Overrides:
    `createCOMInterfaces` in class `OleClientSite`

### disposeCOMInterfaces

    protected void disposeCOMInterfaces()

  Overrides:
    `disposeCOMInterfaces` in class `OleClientSite`

### getBackground

    public Color getBackground()

  Description copied from class: `Control`
  Returns the receiver's background color.

  Note: This operation is a hint and may be overridden by the platform. For example, on some versions of Windows the background of a TabFolder, is a gradient rather than a solid color.

  Overrides:
    `getBackground` in class `Control`
  Returns:
    the background color

### getFont

    public Font getFont()

  Description copied from class: `Control`
  Returns the font that the receiver will use to paint textual information.

  Overrides:
    `getFont` in class `Control`
  Returns:
    the receiver's font

### getForeground

    public Color getForeground()

  Description copied from class: `Control`
  Returns the foreground color that the receiver will use to draw.

  Overrides:
    `getForeground` in class `Control`
  Returns:
    the receiver's foreground color

### getLicenseInfo

    protected int getLicenseInfo(org.eclipse.swt.internal.ole.win32.GUID clsid)

### getSiteProperty

    public Variant getSiteProperty(int dispId)

  Get the control site property specified by the dispIdMember, or `null` if the dispId is not recognised.

  Parameters:
    `dispId` - the dispId
  Returns:
    the property value or `null`
  Since:
    2.1

### GetWindow

    protected int GetWindow(int phwnd)

  Overrides:
    `GetWindow` in class `OleClientSite`

### OnUIDeactivate

    protected int OnUIDeactivate(int fUndoable)

### QueryInterface

    protected int QueryInterface(int riid,
                                 int ppvObject)

  Overrides:
    `QueryInterface` in class `OleClientSite`

### Release

    protected int Release()

  Overrides:
    `Release` in class `OleClientSite`

### releaseObjectInterfaces

    protected void releaseObjectInterfaces()

  Overrides:
    `releaseObjectInterfaces` in class `OleClientSite`

### removeEventListener

    public void removeEventListener(int eventID,
                                    OleListener listener)

  Removes the listener.

  Parameters:
    `eventID` - the event identifier
    `listener` - the listener which should no longer be notified
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null

### removeEventListener

    public void removeEventListener(OleAutomation automation,
                                    org.eclipse.swt.internal.ole.win32.GUID guid,
                                    int eventID,
                                    OleListener listener)

  Deprecated. - use OleControlSite.removeEventListener(OleAutomation, int, OleListener)

  Removes the listener.

  Parameters:
    `automation` - the automation object that provides the event notification
    `guid` - the identifier of the events COM interface
    `eventID` - the event identifier
    `listener` - the listener
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null
  Since:
    2.0

### removeEventListener

    public void removeEventListener(OleAutomation automation,
                                    int eventID,
                                    OleListener listener)

  Removes the listener.

  Parameters:
    `automation` - the automation object that provides the event notification
    `eventID` - the event identifier
    `listener` - the listener which should no longer be notified
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null
  Since:
    2.0

### removePropertyListener

    public void removePropertyListener(int propertyID,
                                       OleListener listener)

  Removes the listener.

  Parameters:
    `propertyID` - the identifier of the property
    `listener` - the listener which should no longer be notified
  Throws:
    `IllegalArgumentException` -
    - ERROR_NULL_ARGUMENT when listener is null

### setBackground

    public void setBackground(Color color)

  Description copied from class: `Control`
  Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.

  Note: This operation is a hint and may be overridden by the platform. For example, on Windows the background of a Button cannot be changed.

  Overrides:
    `setBackground` in class `Control`
  Parameters:
    `color` - the new color (or null)

### setFont

    public void setFont(Font font)

  Description copied from class: `Control`
  Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.

  Overrides:
    `setFont` in class `Control`
  Parameters:
    `font` - the new font (or null)

### setForeground

    public void setForeground(Color color)

  Description copied from class: `Control`
  Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.

  Note: This operation is a hint and may be overridden by the platform.

  Overrides:
    `setForeground` in class `Control`
  Parameters:
    `color` - the new color (or null)

### setSiteProperty

    public void setSiteProperty(int dispId,
                                Variant value)

  Sets the control site property specified by the dispIdMember to a new value. The value will be disposed by the control site when it is no longer required using Variant.dispose. Passing a value of null will clear the dispId value.

  Parameters:
    `dispId` - the ID of the property as specified by the IDL of the ActiveX Control
    `value` - The new value for the property as expressed in a Variant.
  Since:
    2.1

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.