diff options
Diffstat (limited to 'scripting/java/com/sun/star/script/framework/provider/ScriptContext.java')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/provider/ScriptContext.java | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java b/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java index 9d922cf30c5a..546755e9e93a 100644 --- a/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java +++ b/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java @@ -31,8 +31,7 @@ import com.sun.star.script.provider.XScriptContext; import com.sun.star.script.framework.log.LogUtils; -public class ScriptContext extends PropertySet implements XScriptContext -{ +public class ScriptContext extends PropertySet implements XScriptContext { private final static String HM_DOC_REF = "DocumentReference"; private final static String HM_DESKTOP = "Desktop"; private final static String HM_COMPONENT_CONTEXT = "ComponentContext"; @@ -47,51 +46,50 @@ public class ScriptContext extends PropertySet implements XScriptContext private XComponentContext m_xComponentContext = null; - private ScriptContext( XComponentContext xmComponentContext, - XDesktop xDesktop, XModel xModel, XScriptInvocationContext xInvocContext) - { + private ScriptContext(XComponentContext xmComponentContext, + XDesktop xDesktop, XModel xModel, XScriptInvocationContext xInvocContext) { this.m_xDeskTop = xDesktop; this.m_xComponentContext = xmComponentContext; this.m_xModel = xModel; this.m_xInvocationContext = xInvocContext; - if ( m_xModel != null ) - { - registerProperty( DOC_URI, new Type(String.class), - (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), "m_sDocURI"); + if (m_xModel != null) { + registerProperty(DOC_URI, new Type(String.class), + (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), + "m_sDocURI"); } - registerProperty( HM_DOC_REF, new Type(XModel.class), - (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), "m_xModel"); - registerProperty( HM_DESKTOP, new Type(XDesktop.class), - (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), "m_xDeskTop"); - registerProperty( HM_COMPONENT_CONTEXT, new Type(XDesktop.class), - (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), "m_xComponentContext"); + registerProperty(HM_DOC_REF, new Type(XModel.class), + (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), "m_xModel"); + registerProperty(HM_DESKTOP, new Type(XDesktop.class), + (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), + "m_xDeskTop"); + registerProperty(HM_COMPONENT_CONTEXT, new Type(XDesktop.class), + (short)(PropertyAttribute.MAYBEVOID | PropertyAttribute.TRANSIENT), + "m_xComponentContext"); } - public static XScriptContext createContext( XModel xModel, XScriptInvocationContext xInvocContext, - XComponentContext xCtxt, XMultiComponentFactory xMCF) - { + public static XScriptContext createContext(XModel xModel, + XScriptInvocationContext xInvocContext, + XComponentContext xCtxt, XMultiComponentFactory xMCF) { XScriptContext sc = null; try { Object xInterface = xMCF.createInstanceWithContext( - "com.sun.star.frame.Desktop", xCtxt); + "com.sun.star.frame.Desktop", xCtxt); XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface); - if ( xModel != null ) - { + + if (xModel != null) { sc = new ScriptContext(xCtxt, xDesktop, xModel, xInvocContext); - } - else - { - sc = new EditorScriptContext(xCtxt, xDesktop ); + } else { + sc = new EditorScriptContext(xCtxt, xDesktop); } + } catch (Exception e) { + LogUtils.DEBUG(LogUtils.getTrace(e)); } - catch ( Exception e ) { - LogUtils.DEBUG( LogUtils.getTrace( e ) ); - } + return sc; } @@ -101,13 +99,11 @@ public class ScriptContext extends PropertySet implements XScriptContext @return XModel interface */ - public XModel getDocument() - { + public XModel getDocument() { return m_xModel; } - public XScriptInvocationContext getInvocationContext() - { + public XScriptInvocationContext getInvocationContext() { return m_xInvocationContext; } @@ -116,8 +112,7 @@ public class ScriptContext extends PropertySet implements XScriptContext @return XDesktop interface */ - public XDesktop getDesktop() - { + public XDesktop getDesktop() { return m_xDeskTop; } @@ -126,9 +121,8 @@ public class ScriptContext extends PropertySet implements XScriptContext @return XComponentContext interface */ - public XComponentContext getComponentContext() - { - return m_xComponentContext; + public XComponentContext getComponentContext() { + return m_xComponentContext; } } |