Package org.eclipse.swt.ole.win32
Class OleClientSite
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
- All Implemented Interfaces:
Drawable
- Direct Known Subclasses:
OleControlSite
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
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.eclipse.swt.internal.ole.win32.GUID
protected OleFrame
protected org.eclipse.swt.internal.ole.win32.IOleDocumentView
protected org.eclipse.swt.internal.ole.win32.IOleCommandTarget
protected org.eclipse.swt.internal.ole.win32.IOleInPlaceObject
protected org.eclipse.swt.internal.ole.win32.IOleObject
protected org.eclipse.swt.internal.ole.win32.IUnknown
protected org.eclipse.swt.internal.ole.win32.IViewObject2
protected org.eclipse.swt.internal.ole.win32.IStorage
Fields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom
-
Constructor Summary
ModifierConstructorDescriptionprotected
OleClientSite
(Composite parent, int style) OleClientSite
(Composite parent, int style, File file) Create an OleClientSite child widget using the OLE Document type associated with the specified file.OleClientSite
(Composite parent, int style, String progId) Create an OleClientSite child widget to edit a blank document using the specified OLE Document application.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. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected int
AddRef()
protected void
protected org.eclipse.swt.internal.ole.win32.IStorage
void
Deactivates an active in-place object and discards the object's undo state.protected void
int
doVerb
(int verb) Requests that the OLE Document or ActiveX Control perform an action; actions are almost always changes to the activation state.int
Asks the OLE Document or ActiveX Control to execute a command from a standard list of commands.protected org.eclipse.swt.internal.ole.win32.GUID
getClassID
(String clientName) Returns the indent value that would be used to compute the clipping area of the active X object.Returns the program ID of the OLE Document or ActiveX Control.protected int
GetWindow
(long phwnd) boolean
isDirty()
Returns whether ole document is dirty by checking whether the content of the file representing the document is dirty.boolean
Returnstrue
if the receiver has the user-interface focus, andfalse
otherwise.protected int
QueryInterface
(long riid, long ppvObject) int
queryStatus
(int cmd) Returns the status of the specified command.protected int
Release()
protected void
boolean
Saves the document to the specified file and includes OLE specific information if specified.void
The indent value is no longer being used by the client site.void
showProperties
(String title) Displays a dialog with the property information for this OLE Object.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, setScrollbarsMode
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, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, 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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, 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, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, 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
-
Field Details
-
appClsid
protected org.eclipse.swt.internal.ole.win32.GUID appClsid -
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
-
OleClientSite
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 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
-
OleClientSite
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 OleFramestyle
- the bitwise OR'ing of widget stylesprogId
- 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
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
- 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
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 commandsoptions
- the optional flags; these are the OLE.OLECMDEXECOPT_ valuesin
- the argument for the commandout
- the return value of the command- Returns:
- an HRESULT value; OLE.S_OK is returned if successful
-
getClassID
-
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
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
Returnstrue
if the receiver has the user-interface focus, andfalse
otherwise.- Overrides:
isFocusControl
in classControl
- 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
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 savedincludeOleInfo
- the flag to indicate whether OLE specific information should be saved.- Returns:
- true if the save was successful
-
setIndent
The indent value is no longer being used by the client site.- Parameters:
newIndent
- the rectangle representing the indent amount
-
showProperties
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
-