diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/source/java/org/openoffice/test/tools/OfficeDocumentView.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/test/source/java/org/openoffice/test/tools/OfficeDocumentView.java b/test/source/java/org/openoffice/test/tools/OfficeDocumentView.java index 841607d9a377..9d5db59ac009 100644 --- a/test/source/java/org/openoffice/test/tools/OfficeDocumentView.java +++ b/test/source/java/org/openoffice/test/tools/OfficeDocumentView.java @@ -28,6 +28,8 @@ package org.openoffice.test.tools; /**************************************************************************/ +import com.sun.star.beans.NamedValue; +import com.sun.star.beans.PropertyState; import com.sun.star.beans.PropertyValue; import com.sun.star.frame.XController; import com.sun.star.frame.XDispatch; @@ -93,6 +95,7 @@ public class OfficeDocumentView return xReturn; } + /* ------------------------------------------------------------------ */ /** retrieves a dispatcher for the given URL, obtained at the current view of the document */ @@ -109,17 +112,33 @@ public class OfficeDocumentView @return <TRUE/> if the URL was successfully dispatched */ - public boolean dispatch( String url ) throws com.sun.star.uno.Exception + public boolean dispatch( String i_url ) throws com.sun.star.uno.Exception + { + return dispatch( i_url, new PropertyValue[0] ); + } + + /* ------------------------------------------------------------------ */ + public boolean dispatch( final String i_url, final PropertyValue[] i_arguments ) throws com.sun.star.uno.Exception { URL[] completeURL = new URL[] { new URL() }; - completeURL[0].Complete = url; + completeURL[0].Complete = i_url; XDispatch dispatcher = getDispatcher( completeURL ); if ( dispatcher == null ) return false; - PropertyValue[] aDummyArgs = new PropertyValue[] { }; - dispatcher.dispatch( completeURL[0], aDummyArgs ); + dispatcher.dispatch( completeURL[0], i_arguments ); return true; } + + /* ------------------------------------------------------------------ */ + public boolean dispatch( final String i_url, final NamedValue[] i_arguments ) throws com.sun.star.uno.Exception + { + final PropertyValue[] dispatchArgs = new PropertyValue[ i_arguments.length ]; + for ( int i=0; i<i_arguments.length; ++i ) + { + dispatchArgs[i] = new PropertyValue( i_arguments[i].Name, -1, i_arguments[i].Value, PropertyState.DIRECT_VALUE ); + } + return dispatch( i_url, dispatchArgs ); + } }; |