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 addControl
children to it, or set a layout on it.- Styles
- BORDER
- Events
- Dispose, Move, Resize
-
-
Field Summary
-
Fields inherited from class org.eclipse.swt.ole.win32.OleClientSite
appClsid, frame, objDocumentView, objIOleCommandTarget, objIOleInPlaceObject, objIOleObject, objIUnknown, objIViewObject2, tempStorage
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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 long
getLicenseInfo(org.eclipse.swt.internal.ole.win32.GUID clsid)
Variant
getSiteProperty(int dispId)
Get the control site property specified by the dispIdMember, ornull
if the dispId is not recognised.protected int
GetWindow(long phwnd)
protected int
OnUIDeactivate(int fUndoable)
protected int
QueryInterface(long riid, long ppvObject)
protected int
Release()
protected void
releaseObjectInterfaces()
void
removeEventListener(int eventID, OleListener listener)
Removes the listener.void
removeEventListener(OleAutomation automation, 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
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, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, 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, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, 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, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, 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, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
-
-
-
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 OleFramestyle
- the bitwise OR'ing of widget stylesfile
- 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 OleFramestyle
- the bitwise OR'ing of widget stylesprogId
- 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 OleFramestyle
- the bitwise OR'ing of widget stylesprogId
- 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 eventlistener
- 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 notificationeventID
- the id of the eventlistener
- 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 notificationeventSinkId
- the GUID of the event sinkeventID
- the id of the eventlistener
- the listener- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT when listener is null
- Since:
- 3.2
-
addObjectReferences
protected void addObjectReferences()
- Overrides:
addObjectReferences
in classOleClientSite
-
addPropertyListener
public void addPropertyListener(int propertyID, OleListener listener)
Adds the listener to receive events.- Parameters:
propertyID
- the identifier of the propertylistener
- the listener- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT when listener is null
-
createCOMInterfaces
protected void createCOMInterfaces()
- Overrides:
createCOMInterfaces
in classOleClientSite
-
disposeCOMInterfaces
protected void disposeCOMInterfaces()
- Overrides:
disposeCOMInterfaces
in classOleClientSite
-
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 classControl
- 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.
-
getForeground
public Color getForeground()
Description copied from class:Control
Returns the foreground color that the receiver will use to draw.- Overrides:
getForeground
in classControl
- Returns:
- the receiver's foreground color
-
getLicenseInfo
protected long getLicenseInfo(org.eclipse.swt.internal.ole.win32.GUID clsid)
-
getSiteProperty
public Variant getSiteProperty(int dispId)
Get the control site property specified by the dispIdMember, ornull
if the dispId is not recognised.- Parameters:
dispId
- the dispId- Returns:
- the property value or
null
- Since:
- 2.1
-
GetWindow
protected int GetWindow(long phwnd)
- Overrides:
GetWindow
in classOleClientSite
-
OnUIDeactivate
protected int OnUIDeactivate(int fUndoable)
-
QueryInterface
protected int QueryInterface(long riid, long ppvObject)
- Overrides:
QueryInterface
in classOleClientSite
-
Release
protected int Release()
- Overrides:
Release
in classOleClientSite
-
releaseObjectInterfaces
protected void releaseObjectInterfaces()
- Overrides:
releaseObjectInterfaces
in classOleClientSite
-
removeEventListener
public void removeEventListener(int eventID, OleListener listener)
Removes the listener.- Parameters:
eventID
- the event identifierlistener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT when listener is null
-
removeEventListener
@Deprecated 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 notificationguid
- the identifier of the events COM interfaceeventID
- the event identifierlistener
- 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 notificationeventID
- the event identifierlistener
- 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 propertylistener
- 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.
- Overrides:
setBackground
in classControl
- 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.
-
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 classControl
- 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 Controlvalue
- The new value for the property as expressed in a Variant.- Since:
- 2.1
-
-