com.jniwrapper.win32.automation
Class OfficeContainer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bycom.jniwrapper.win32.automation.OleContainer
              extended bycom.jniwrapper.win32.automation.OfficeContainer
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class OfficeContainer
extends OleContainer

This class enables to embed OLE/ActiveX MS Office controls into java application.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.jniwrapper.win32.automation.OleContainer
OleContainer.AutoActivateMode, OleContainer.SizeMode
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OfficeContainer()
          Creates OLE container for MS Office components.
OfficeContainer(OleMessageLoop messageLoop)
          Creates OLE container for MS Office components.
 
Method Summary
 void activate()
          Activates embedded document.
 void createObject(CLSID clsid)
          Creates an object in the container by CLSID.
 void createObject(java.io.File file)
          Creates an object in the container by association specified by the file name.
 void createObject(java.lang.String oleClassName)
          Creates an object in the container by class name.
 void deactivate()
          Deactivates embedded document.
 void destroyObject()
          Destroys the previously created OleObject.
protected  void drawScreenshot(java.awt.Graphics g)
          Default method for drawing an embedded component which is in inactive state.
protected  boolean gainedFocus()
           
 CLSID getContainedObjectCLSID()
          Retrieves CLSID of the object embedded into OLE container
protected  int getProcessID()
           
protected  boolean gotSameRoots(Wnd wnd1, Wnd wnd2)
           
protected  boolean isActive()
          Returns UI state
 boolean isStaticMode()
          Returns true if the embedded object is displayed in a static mode and false in a UI active mode.
protected  void makeContainerWindowFocused()
           
 void paint(java.awt.Graphics g)
           
protected  void resizeWindow()
           
 HResult save(java.io.File file)
          Saves an OLE object to file.
protected  void setActivatedWindow(Wnd activatedWindow)
           
protected  void setActive(boolean active)
           
protected  void setProcessID(int processID)
           
 void setStaticMode(boolean value)
          Changes the embedded workbook displaying mode.
 
Methods inherited from class com.jniwrapper.win32.automation.OleContainer
disableFocusGainedIgnoreTimeout, doVerb, draw, drawBitmap, enableFocusGainedIgnoreTimeout, getActivatedWindow, getActivationVerb, getAutoActivateMode, getContainerBounds, getContainerWindow, getCurrentDocumentType, getFileOperationsHandler, getObjectWindow, getOleClientSite, getOleMessageLoop, getOleObject, getOleObjectViewSize, getParentContainer, getPrintDocumentHandler, getRootWindow, getSibling, getSizeMode, inPlaceDeactivate, insertObject, isComponentDisplayed, isHandleUpdateAsSave, isIgnoreTimeout, isPrintPreview, load, load, load, open, removeNotify, save, save, setActivationVerb, setAutoActivateMode, setComponentDisplayed, setFileOperationsHandler, setHandleUpdateAsSave, setPrintDocumentHandler, setSizeMode, shouldActivateWhenVisible, takeScreenshot, uiActivate, uiDeactivate
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OfficeContainer

public OfficeContainer()
Creates OLE container for MS Office components.


OfficeContainer

public OfficeContainer(OleMessageLoop messageLoop)
Creates OLE container for MS Office components.

Parameters:
messageLoop - - Ole Message Loop specific for this container. Shall be started before creating an object.
Method Detail

setActivatedWindow

protected void setActivatedWindow(Wnd activatedWindow)
Overrides:
setActivatedWindow in class OleContainer

createObject

public void createObject(CLSID clsid)
                  throws ComException
Creates an object in the container by CLSID. A previously created object is destroyed automatically.

Overrides:
createObject in class OleContainer
Parameters:
clsid - - CLSID of the object to be created
Throws:
ComException

createObject

public void createObject(java.io.File file)
                  throws ComException
Creates an object in the container by association specified by the file name. A previously created object is destroyed automatically.

Overrides:
createObject in class OleContainer
Parameters:
file - - source(storage) file of the object to be created
Throws:
ComException

createObject

public void createObject(java.lang.String oleClassName)
                  throws ComException
Creates an object in the container by class name. A previously created object is destroyed automatically.

Overrides:
createObject in class OleContainer
Parameters:
oleClassName - - class name of the object to be created
Throws:
ComException

resizeWindow

protected void resizeWindow()
Overrides:
resizeWindow in class OleContainer

save

public HResult save(java.io.File file)
Description copied from class: OleContainer
Saves an OLE object to file.

Overrides:
save in class OleContainer
Parameters:
file - for saving
Returns:
returns non-negative result of native method. Can be used to determine user choise in overwrite dialog.
See Also:
HResult.S_OK, HResult.S_FALSE

activate

public void activate()
Activates embedded document.

Overrides:
activate in class OleContainer

deactivate

public void deactivate()
Deactivates embedded document.


drawScreenshot

protected void drawScreenshot(java.awt.Graphics g)
Default method for drawing an embedded component which is in inactive state.


destroyObject

public void destroyObject()
Destroys the previously created OleObject.

Overrides:
destroyObject in class OleContainer

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class OleContainer

isActive

protected boolean isActive()
Returns UI state

Returns:
- UI state: true - UI activated; false - UI deactivated

setActive

protected void setActive(boolean active)
Parameters:
active - - true - UI activated, other components addressing the same server may loose the UI controls; false - UI deactivated, UI controls free for usage in other components.

gainedFocus

protected boolean gainedFocus()
Overrides:
gainedFocus in class OleContainer

setStaticMode

public void setStaticMode(boolean value)
Changes the embedded workbook displaying mode.

Parameters:
value - if true the workbook is displayed in a static mode, otherwise in a UI active mode.

isStaticMode

public boolean isStaticMode()
Returns true if the embedded object is displayed in a static mode and false in a UI active mode.

Returns:
true if the embedded object is displayed in a static mode and false in a UI active mode.

getContainedObjectCLSID

public CLSID getContainedObjectCLSID()
Retrieves CLSID of the object embedded into OLE container

Returns:
- CLSID of the embedded object

gotSameRoots

protected boolean gotSameRoots(Wnd wnd1,
                               Wnd wnd2)
Overrides:
gotSameRoots in class OleContainer

getProcessID

protected int getProcessID()

setProcessID

protected void setProcessID(int processID)

makeContainerWindowFocused

protected void makeContainerWindowFocused()
Overrides:
makeContainerWindowFocused in class OleContainer