summaryrefslogtreecommitdiff
path: root/odk/examples/java
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/java')
-rw-r--r--odk/examples/java/ConverterServlet/ConverterServlet.java102
-rw-r--r--odk/examples/java/DocumentHandling/DocumentConverter.java58
-rw-r--r--odk/examples/java/DocumentHandling/DocumentLoader.java16
-rw-r--r--odk/examples/java/DocumentHandling/DocumentPrinter.java22
-rw-r--r--odk/examples/java/DocumentHandling/DocumentSaver.java16
-rw-r--r--odk/examples/java/Drawing/SDraw.java110
-rw-r--r--odk/examples/java/EmbedDocument/Container1/EmbedContApp.java84
-rw-r--r--odk/examples/java/EmbedDocument/Container1/EmbedContFrame.java16
-rwxr-xr-xodk/examples/java/EmbedDocument/EmbeddedObject/EditorFrame.java20
-rwxr-xr-xodk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java38
-rwxr-xr-xodk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java2
-rwxr-xr-xodk/examples/java/Inspector/Addons.xcu2
-rw-r--r--odk/examples/java/Inspector/HideableMutableTreeNode.java50
-rw-r--r--odk/examples/java/Inspector/HideableTreeModel.java72
-rw-r--r--odk/examples/java/Inspector/Inspector.java132
-rw-r--r--odk/examples/java/Inspector/InspectorAddon.java54
-rw-r--r--odk/examples/java/Inspector/InspectorPane.java172
-rw-r--r--odk/examples/java/Inspector/InstanceInspector.idl14
-rw-r--r--odk/examples/java/Inspector/Introspector.java186
-rw-r--r--odk/examples/java/Inspector/MethodParametersDialog.java86
-rwxr-xr-xodk/examples/java/Inspector/ObjectInspector.xcu4
-rw-r--r--odk/examples/java/Inspector/ProtocolHandlerAddon.java64
-rw-r--r--odk/examples/java/Inspector/SourceCodeGenerator.java620
-rw-r--r--odk/examples/java/Inspector/SwingDialogProvider.java158
-rw-r--r--odk/examples/java/Inspector/SwingTreeControlProvider.java150
-rw-r--r--odk/examples/java/Inspector/SwingTreePathProvider.java22
-rw-r--r--odk/examples/java/Inspector/SwingUnoFacetteNode.java20
-rw-r--r--odk/examples/java/Inspector/SwingUnoMethodNode.java42
-rw-r--r--odk/examples/java/Inspector/SwingUnoNode.java52
-rw-r--r--odk/examples/java/Inspector/SwingUnoPropertyNode.java40
-rw-r--r--odk/examples/java/Inspector/TDocSupplier.java54
-rw-r--r--odk/examples/java/Inspector/TestInspector.java16
-rw-r--r--odk/examples/java/Inspector/UnoFacetteNode.java22
-rw-r--r--odk/examples/java/Inspector/UnoMethodNode.java66
-rw-r--r--odk/examples/java/Inspector/UnoNode.java132
-rw-r--r--odk/examples/java/Inspector/UnoPropertyNode.java74
-rw-r--r--odk/examples/java/Inspector/UnoTreeRenderer.java18
-rw-r--r--odk/examples/java/Inspector/XDialogProvider.java32
-rw-r--r--odk/examples/java/Inspector/XInstanceInspector.idl18
-rw-r--r--odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java54
-rw-r--r--odk/examples/java/Inspector/XMethodParametersDialog.java6
-rw-r--r--odk/examples/java/Inspector/XTreeControlProvider.java50
-rw-r--r--odk/examples/java/Inspector/XTreePathProvider.java14
-rw-r--r--odk/examples/java/Inspector/XUnoFacetteNode.java22
-rw-r--r--odk/examples/java/Inspector/XUnoMethodNode.java32
-rw-r--r--odk/examples/java/Inspector/XUnoNode.java40
-rw-r--r--odk/examples/java/Inspector/XUnoPropertyNode.java12
-rw-r--r--odk/examples/java/MinimalComponent/BuildMinimalComponent.xml2
-rw-r--r--odk/examples/java/MinimalComponent/MinimalComponent.idl16
-rw-r--r--odk/examples/java/MinimalComponent/MinimalComponent.java28
-rw-r--r--odk/examples/java/MinimalComponent/TestMinimalComponent.java14
-rw-r--r--odk/examples/java/NotesAccess/NotesAccess.java92
-rw-r--r--odk/examples/java/PropertySet/PropTest.java22
-rw-r--r--odk/examples/java/Spreadsheet/CalcAddins.java78
-rw-r--r--odk/examples/java/Spreadsheet/ChartTypeChange.java98
-rw-r--r--odk/examples/java/Spreadsheet/EuroAdaption.java128
-rw-r--r--odk/examples/java/Spreadsheet/SCalc.java122
-rw-r--r--odk/examples/java/Spreadsheet/XCalcAddins.idl6
-rw-r--r--odk/examples/java/Storage/StorageFunctionality.java30
-rw-r--r--odk/examples/java/Storage/Test01.java12
-rw-r--r--odk/examples/java/Storage/Test02.java12
-rw-r--r--odk/examples/java/Storage/Test03.java14
-rw-r--r--odk/examples/java/Storage/Test04.java18
-rw-r--r--odk/examples/java/Storage/Test05.java14
-rw-r--r--odk/examples/java/Storage/Test06.java4
-rw-r--r--odk/examples/java/Storage/Test07.java6
-rw-r--r--odk/examples/java/Storage/Test08.java18
-rw-r--r--odk/examples/java/Storage/Test09.java8
-rw-r--r--odk/examples/java/Storage/TestHelper.java36
-rw-r--r--odk/examples/java/Text/BookmarkInsertion.java106
-rw-r--r--odk/examples/java/Text/GraphicsInserter.java50
-rw-r--r--odk/examples/java/Text/HardFormatting.java102
-rw-r--r--odk/examples/java/Text/SWriter.java200
-rw-r--r--odk/examples/java/Text/StyleCreation.java76
-rw-r--r--odk/examples/java/Text/StyleInitialization.java116
-rw-r--r--odk/examples/java/Text/TextDocumentStructure.java54
-rw-r--r--odk/examples/java/Text/TextReplace.java82
-rw-r--r--odk/examples/java/Text/WriterSelector.java40
-rw-r--r--odk/examples/java/ToDo/ToDo.idl4
-rw-r--r--odk/examples/java/ToDo/ToDo.java262
-rw-r--r--odk/examples/java/ToDo/XToDo.idl10
81 files changed, 2483 insertions, 2483 deletions
diff --git a/odk/examples/java/ConverterServlet/ConverterServlet.java b/odk/examples/java/ConverterServlet/ConverterServlet.java
index 84279fab1016..281b47db370c 100644
--- a/odk/examples/java/ConverterServlet/ConverterServlet.java
+++ b/odk/examples/java/ConverterServlet/ConverterServlet.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// JDK API
@@ -71,18 +71,18 @@ import com.sun.star.lang.XMultiComponentFactory;
*/
public class ConverterServlet extends HttpServlet {
/** Specifies the temporary directory on the web server.
- */
- private String stringWorkingDirectory =
+ */
+ private String stringWorkingDirectory =
System.getProperty( "java.io.tmpdir" ).replace( '\\', '/' );
-
+
/** Specifies the host for the office server.
- */
+ */
private String stringHost = "localhost";
-
+
/** Specifies the port for the office server.
- */
+ */
private String stringPort = "2083";
-
+
/** Called by the server (via the service method) to allow a servlet to handle
* a POST request. The file from the client will be uploaded to the web server
* and converted on the web server and after all pushed to the client.
@@ -90,7 +90,7 @@ public class ConverterServlet extends HttpServlet {
* @param response Object that contains the response the servlet sends to the client.
* @throws ServletException If the request for the POST could not be handled.
* @throws IOException If an input or output error is detected when the servlet handles the request.
- */
+ */
protected void doPost( HttpServletRequest request,
HttpServletResponse response) throws ServletException, java.io.IOException {
try {
@@ -98,35 +98,35 @@ public class ConverterServlet extends HttpServlet {
if ( !stringWorkingDirectory.endsWith( "/" ) ) {
stringWorkingDirectory += "/";
}
-
+
// Construct a MultipartRequest to help read the information.
// Pass in the request, a directory to save files to, and the
// maximum POST size we should attempt to handle.
MultipartRequest multipartrequest =
new MultipartRequest( request, stringWorkingDirectory, 5 * 1024 * 1024 );
-
+
// Getting all file names from the request
Enumeration files = multipartrequest.getFileNames();
-
+
// Every received file will be converted to the specified type
while (files.hasMoreElements()) {
// Getting the name from the element
String stringName = (String)files.nextElement();
-
+
// Getting the filename from the request
String stringFilename =
multipartrequest.getFilesystemName( stringName );
-
+
// Converting the given file on the server to the specified type and
// append a special extension
File cleanupFile = null;
String stringSourceFile = stringWorkingDirectory + stringFilename;
-
+
try {
String stringConvertedFile = convertDocument(stringSourceFile,
multipartrequest.getParameter( "converttype" ),
multipartrequest.getParameter( "extension" ));
-
+
String shortFileName = stringConvertedFile.substring(
stringConvertedFile.lastIndexOf('/') + 1);
@@ -134,10 +134,10 @@ public class ConverterServlet extends HttpServlet {
// Set the filename, is used when the file will be saved (problem with mozilla)
response.addHeader( "Content-Disposition",
"attachment; filename=" + shortFileName);
-
+
// Constructing the multi part response to the client
MultipartResponse multipartresponse = new MultipartResponse(response);
-
+
// Is the convert type HTML?
if ( ( multipartrequest.getParameter( "converttype" ).equals(
"swriter: HTML (StarWriter)" ) )
@@ -152,35 +152,35 @@ public class ConverterServlet extends HttpServlet {
// at the client in order to save the converted file
multipartresponse.startResponse( "application/octet-stream" );
}
-
+
// Pushing the converted file to the client
ServletUtils.returnFile( stringConvertedFile,
response.getOutputStream() );
-
+
// Finishing the multi part response
multipartresponse.finish();
-
+
// clean up the working directory
cleanupFile = new File(stringConvertedFile);
if ( cleanupFile.exists() )
cleanupFile.delete();
-
+
} catch (Exception exc) {
response.setContentType( "text/html;charset=8859-1" );
PrintWriter out = response.getWriter();
exc.printStackTrace();
-
+
out.println( "<html><head>" );
out.println( " <title>" + "SDK Converter Servlet" + "</title>" );
out.println( "</head>" );
- out.println( "<body><br><p>");
+ out.println( "<body><br><p>");
out.println( "<b>Sorry, the conversion failed!</b></p>");
out.println( "<p><b>Error Mesage:</b><br>" + exc.getMessage() + "<br>");
exc.printStackTrace(out);
out.println( "</p></body><html>");
}
-
+
// clean up the working directory
cleanupFile = new File(stringSourceFile);
if ( cleanupFile.exists() )
@@ -191,7 +191,7 @@ public class ConverterServlet extends HttpServlet {
System.err.println( exception.toString() );
}
}
-
+
/** This method converts a document to a given type by using a running
* OpenOffice.org and saves the converted document to the specified
* working directory.
@@ -200,64 +200,64 @@ public class ConverterServlet extends HttpServlet {
* @param stringExtension This string will be appended to the file name of the converted file.
* @return The full path name of the converted file will be returned.
* @see stringWorkingDirectory
- */
+ */
private String convertDocument( String stringDocumentName,
String stringConvertType,
String stringExtension)
throws Exception
{
String stringConvertedFile = "";
-
+
// Converting the document to the favoured type
// try {
// Composing the URL
String stringUrl = "file:///" + stringDocumentName;
-
+
/* Bootstraps a component context with the jurt base components
registered. Component context to be granted to a component for running.
Arbitrary values can be retrieved from the context. */
XComponentContext xcomponentcontext =
com.sun.star.comp.helper.Bootstrap.createInitialComponentContext( null );
-
+
/* Gets the service manager instance to be used (or null). This method has
been added for convenience, because the service manager is a often used
object. */
XMultiComponentFactory xmulticomponentfactory =
xcomponentcontext.getServiceManager();
-
+
/* Creates an instance of the component UnoUrlResolver which
supports the services specified by the factory. */
Object objectUrlResolver =
xmulticomponentfactory.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", xcomponentcontext );
-
+
// Create a new url resolver
XUnoUrlResolver xurlresolver = ( XUnoUrlResolver )
UnoRuntime.queryInterface( XUnoUrlResolver.class,
objectUrlResolver );
-
+
// Resolves an object that is specified as follow:
// uno:<connection description>;<protocol description>;<initial object name>
Object objectInitial = xurlresolver.resolve(
"uno:socket,host=" + stringHost + ",port=" + stringPort +
";urp;StarOffice.ServiceManager" );
-
+
// Create a service manager from the initial object
xmulticomponentfactory = ( XMultiComponentFactory )
UnoRuntime.queryInterface( XMultiComponentFactory.class, objectInitial );
-
+
// Query for the XPropertySet interface.
XPropertySet xpropertysetMultiComponentFactory = ( XPropertySet )
UnoRuntime.queryInterface( XPropertySet.class, xmulticomponentfactory );
-
+
// Get the default context from the office server.
Object objectDefaultContext =
xpropertysetMultiComponentFactory.getPropertyValue( "DefaultContext" );
-
+
// Query for the interface XComponentContext.
xcomponentcontext = ( XComponentContext ) UnoRuntime.queryInterface(
XComponentContext.class, objectDefaultContext );
-
+
/* A desktop environment contains tasks with one or more
frames in which components can be loaded. Desktop is the
environment for components which can instanciate within
@@ -266,24 +266,24 @@ public class ConverterServlet extends HttpServlet {
UnoRuntime.queryInterface( XComponentLoader.class,
xmulticomponentfactory.createInstanceWithContext(
"com.sun.star.frame.Desktop", xcomponentcontext ) );
-
+
// Preparing properties for loading the document
PropertyValue propertyvalue[] = new PropertyValue[ 1 ];
// Setting the flag for hidding the open document
propertyvalue[ 0 ] = new PropertyValue();
propertyvalue[ 0 ].Name = "Hidden";
propertyvalue[ 0 ].Value = new Boolean(true);
-
+
// Loading the wanted document
Object objectDocumentToStore =
xcomponentloader.loadComponentFromURL(
stringUrl, "_blank", 0, propertyvalue );
-
+
// Getting an object that will offer a simple way to store a document to a URL.
XStorable xstorable =
( XStorable ) UnoRuntime.queryInterface( XStorable.class,
objectDocumentToStore );
-
+
// Preparing properties for converting the document
propertyvalue = new PropertyValue[ 2 ];
// Setting the flag for overwriting
@@ -294,20 +294,20 @@ public class ConverterServlet extends HttpServlet {
propertyvalue[ 1 ] = new PropertyValue();
propertyvalue[ 1 ].Name = "FilterName";
propertyvalue[ 1 ].Value = stringConvertType;
-
+
// Appending the favoured extension to the origin document name
int index = stringUrl.lastIndexOf('.');
if ( index >= 0 ) {
stringConvertedFile = stringUrl.substring(0, index) + "." + stringExtension;
- } else {
+ } else {
stringConvertedFile = stringUrl + "." + stringExtension;
}
-
+
// Storing and converting the document
xstorable.storeAsURL( stringConvertedFile, propertyvalue );
-
+
XCloseable xcloseable = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,xstorable );
-
+
// Closing the converted document
if ( xcloseable != null )
xcloseable.close(false);
@@ -318,18 +318,18 @@ public class ConverterServlet extends HttpServlet {
XComponent.class, xstorable );
xComponent.dispose();
}
-
+
// }
// catch( Exception exception ) {
// exception.printStackTrace();
// return( "" );
// }
-
+
if ( stringConvertedFile.startsWith( "file:///" ) ) {
// Truncating the beginning of the file name
stringConvertedFile = stringConvertedFile.substring( 8 );
}
-
+
// Returning the name of the converted file
return stringConvertedFile;
}
diff --git a/odk/examples/java/DocumentHandling/DocumentConverter.java b/odk/examples/java/DocumentHandling/DocumentConverter.java
index 69ded5e24f45..97d407935501 100644
--- a/odk/examples/java/DocumentHandling/DocumentConverter.java
+++ b/odk/examples/java/DocumentHandling/DocumentConverter.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.UnoRuntime;
@@ -59,7 +59,7 @@ public class DocumentConverter {
/** Containing the directory where the converted files are saved
*/
static String sOutputDir = "";
-
+
/** Traversing the given directory recursively and converting their files to
* the favoured type if possible
* @param fileDirectory Containing the directory
@@ -75,17 +75,17 @@ public class DocumentConverter {
// Prepare Url for the output directory
File outdir = new File(DocumentConverter.sOutputDir);
String sOutUrl = "file:///" + outdir.getAbsolutePath().replace( '\\', '/' );
-
+
System.out.println("\nThe converted documents will stored in \""
+ outdir.getPath() + "!");
-
+
System.out.println(sIndent + "[" + fileDirectory.getName() + "]");
sIndent += " ";
-
+
// Getting all files and directories in the current directory
File[] entries = fileDirectory.listFiles();
-
+
// Iterating for each file and directory
for ( int i = 0; i < entries.length; ++i ) {
// Testing, if the entry in the list is a directory
@@ -98,7 +98,7 @@ public class DocumentConverter {
// Composing the URL by replacing all backslashs
String sUrl = "file:///"
+ entries[ i ].getAbsolutePath().replace( '\\', '/' );
-
+
// Loading the wanted document
com.sun.star.beans.PropertyValue propertyValues[] =
new com.sun.star.beans.PropertyValue[1];
@@ -109,13 +109,13 @@ public class DocumentConverter {
Object oDocToStore =
DocumentConverter.xCompLoader.loadComponentFromURL(
sUrl, "_blank", 0, propertyValues);
-
+
// Getting an object that will offer a simple way to store
// a document to a URL.
com.sun.star.frame.XStorable xStorable =
(com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
com.sun.star.frame.XStorable.class, oDocToStore );
-
+
// Preparing properties for converting the document
propertyValues = new com.sun.star.beans.PropertyValue[2];
// Setting the flag for overwriting
@@ -126,16 +126,16 @@ public class DocumentConverter {
propertyValues[1] = new com.sun.star.beans.PropertyValue();
propertyValues[1].Name = "FilterName";
propertyValues[1].Value = DocumentConverter.sConvertType;
-
+
// Appending the favoured extension to the origin document name
int index1 = sUrl.lastIndexOf('/');
- int index2 = sUrl.lastIndexOf('.');
+ int index2 = sUrl.lastIndexOf('.');
String sStoreUrl = sOutUrl + sUrl.substring(index1, index2 + 1)
+ DocumentConverter.sExtension;
-
+
// Storing and converting the document
xStorable.storeAsURL(sStoreUrl, propertyValues);
-
+
// Closing the converted document. Use XCloseable.clsoe if the
// interface is supported, otherwise use XComponent.dispose
com.sun.star.util.XCloseable xCloseable =
@@ -148,21 +148,21 @@ public class DocumentConverter {
com.sun.star.lang.XComponent xComp =
(com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
com.sun.star.lang.XComponent.class, xStorable);
-
+
xComp.dispose();
}
}
catch( Exception e ) {
- e.printStackTrace(System.err);
+ e.printStackTrace(System.err);
}
-
+
System.out.println(sIndent + entries[ i ].getName());
}
}
-
+
sIndent = sIndent.substring(2);
}
-
+
/** Bootstrap UNO, getting the remote component context, getting a new instance
* of the desktop (used interface XComponentLoader) and calling the
* static method traverse
@@ -180,9 +180,9 @@ public class DocumentConverter {
"\"c:/myoffice\" \"swriter: MS Word 97\" \"doc\"");
System.exit(1);
}
-
+
com.sun.star.uno.XComponentContext xContext = null;
-
+
try {
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
@@ -191,35 +191,35 @@ public class DocumentConverter {
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();
-
+
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);
-
+
xCompLoader = (com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class,
oDesktop);
-
+
// Getting the given starting directory
File file = new File(args[0]);
-
+
// Getting the given type to convert to
sConvertType = args[1];
-
+
// Getting the given extension that should be appended to the
// origin document
sExtension = args[2];
-
+
// Getting the given type to convert to
sOutputDir = args[3];
// Starting the conversion of documents in the given directory
// and subdirectories
traverse(file);
-
+
System.exit(0);
} catch( Exception e ) {
e.printStackTrace(System.err);
- System.exit(1);
+ System.exit(1);
}
}
}
diff --git a/odk/examples/java/DocumentHandling/DocumentLoader.java b/odk/examples/java/DocumentHandling/DocumentLoader.java
index 8185cbf6da5f..a5a7fb5fc730 100644
--- a/odk/examples/java/DocumentHandling/DocumentLoader.java
+++ b/odk/examples/java/DocumentHandling/DocumentLoader.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.UnoRuntime;
@@ -47,21 +47,21 @@ public class DocumentLoader {
"java -jar DocumentLoader.jar \"private:factory/swriter\"" );
System.exit(1);
}
-
+
com.sun.star.uno.XComponentContext xContext = null;
try {
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
System.out.println("Connected to a running office ...");
-
+
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();
-
+
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);
-
+
com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
@@ -73,8 +73,8 @@ public class DocumentLoader {
StringBuffer sbTmp = new StringBuffer("file:///");
sbTmp.append(sourceFile.getCanonicalPath().replace('\\', '/'));
sUrl = sbTmp.toString();
- }
-
+ }
+
// Load a Writer document, which will be automaticly displayed
com.sun.star.lang.XComponent xComp = xCompLoader.loadComponentFromURL(
sUrl, "_blank", 0, new com.sun.star.beans.PropertyValue[0]);
diff --git a/odk/examples/java/DocumentHandling/DocumentPrinter.java b/odk/examples/java/DocumentHandling/DocumentPrinter.java
index e6a7a1430d4e..3331f43f809a 100644
--- a/odk/examples/java/DocumentHandling/DocumentPrinter.java
+++ b/odk/examples/java/DocumentHandling/DocumentPrinter.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.UnoRuntime;
@@ -56,10 +56,10 @@ public class DocumentPrinter {
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();
-
+
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);
-
+
com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
@@ -68,17 +68,17 @@ public class DocumentPrinter {
java.io.File sourceFile = new java.io.File(args[1]);
StringBuffer sUrl = new StringBuffer("file:///");
sUrl.append(sourceFile.getCanonicalPath().replace('\\', '/'));
-
+
// Load a Writer document, which will be automaticly displayed
com.sun.star.lang.XComponent xComp = xCompLoader.loadComponentFromURL(
sUrl.toString(), "_blank", 0,
new com.sun.star.beans.PropertyValue[0] );
-
+
// Querying for the interface XPrintable on the loaded document
com.sun.star.view.XPrintable xPrintable =
(com.sun.star.view.XPrintable)UnoRuntime.queryInterface(
com.sun.star.view.XPrintable.class, xComp);
-
+
// Setting the property "Name" for the favoured printer (name of
// IP address)
com.sun.star.beans.PropertyValue propertyValue[] =
@@ -86,19 +86,19 @@ public class DocumentPrinter {
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Name";
propertyValue[0].Value = args[ 0 ];
-
+
// Setting the name of the printer
xPrintable.setPrinter( propertyValue );
-
+
// Setting the property "Pages" so that only the desired pages
// will be printed.
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Pages";
propertyValue[0].Value = args[ 2 ];
-
+
// Printing the loaded document
xPrintable.print( propertyValue );
-
+
System.exit(0);
}
catch( Exception e ) {
diff --git a/odk/examples/java/DocumentHandling/DocumentSaver.java b/odk/examples/java/DocumentHandling/DocumentSaver.java
index f6f21ea48228..93d6231a4b44 100644
--- a/odk/examples/java/DocumentHandling/DocumentSaver.java
+++ b/odk/examples/java/DocumentHandling/DocumentSaver.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.UnoRuntime;
@@ -44,7 +44,7 @@ public class DocumentSaver {
* @param args The program needs two arguments:
* - full file name to open,
* - full file name to save.
- */
+ */
public static void main(String args[]) {
if ( args.length < 2 ) {
System.out.println("usage: java -jar DocumentSaver.jar" +
@@ -66,10 +66,10 @@ public class DocumentSaver {
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();
-
+
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);
-
+
com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
@@ -88,7 +88,7 @@ public class DocumentSaver {
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Hidden";
propertyValue[0].Value = new Boolean(true);
-
+
Object oDocToStore = xCompLoader.loadComponentFromURL(
sLoadUrl.toString(), "_blank", 0, propertyValue );
com.sun.star.frame.XStorable xStorable =
@@ -106,7 +106,7 @@ public class DocumentSaver {
System.out.println("\nDocument \"" + sLoadUrl + "\" saved under \"" +
sSaveUrl + "\"\n");
-
+
com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable)
UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class,
oDocToStore );
@@ -120,7 +120,7 @@ public class DocumentSaver {
com.sun.star.lang.XComponent.class, oDocToStore );
xComp.dispose();
}
- System.out.println("document closed!");
+ System.out.println("document closed!");
System.exit(0);
}
catch( Exception e ) {
diff --git a/odk/examples/java/Drawing/SDraw.java b/odk/examples/java/Drawing/SDraw.java
index dfb544e3db02..551689c5626b 100644
--- a/odk/examples/java/Drawing/SDraw.java
+++ b/odk/examples/java/Drawing/SDraw.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -44,16 +44,16 @@ import java.lang.Math;
import com.sun.star.uno.UnoRuntime;
public class SDraw {
-
-
+
+
public static void main(String args[]) {
-
+
//oooooooooooooooooooooooooooStep 1oooooooooooooooooooooooooooooooooooooooo
// bootstrap UNO and get the remote component context. The context can
// be used to get the service manager
//*************************************************************************
com.sun.star.uno.XComponentContext xContext = null;
-
+
try {
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
@@ -66,19 +66,19 @@ public class SDraw {
com.sun.star.lang.XComponent xDrawDoc = null;
com.sun.star.drawing.XDrawPage xDrawPage = null;
-
+
//oooooooooooooooooooooooooooStep 2oooooooooooooooooooooooooooooooooooooooo
// open an empty document. In this case it's a draw document.
// For this purpose an instance of com.sun.star.frame.Desktop
// is created. It's interface XDesktop provides the XComponentLoader,
// which is used to open the document via loadComponentFromURL
//*************************************************************************
-
- //Open document
- //Draw
+
+ //Open document
+ //Draw
System.out.println("Opening an empty Draw document ...");
xDrawDoc = openDraw(xContext);
-
+
//oooooooooooooooooooooooooooStep 3oooooooooooooooooooooooooooooooooooooooo
// get the drawpage an insert some shapes.
// the documents DrawPageSupplier supplies the DrawPage vi IndexAccess
@@ -86,8 +86,8 @@ public class SDraw {
// instance of the ShapeType and add it to the Shapes-container
// provided by the drawpage
//*************************************************************************
-
-
+
+
// get the drawpage of drawing here
try {
System.out.println( "getting Drawpage" );
@@ -104,9 +104,9 @@ public class SDraw {
System.err.println( "Couldn't create document"+ e );
e.printStackTrace(System.err);
}
-
+
createSequence(xDrawDoc, xDrawPage);
-
+
//put something on the drawpage
System.out.println( "inserting some Shapes" );
com.sun.star.drawing.XShapes xShapes = (com.sun.star.drawing.XShapes)
@@ -115,24 +115,24 @@ public class SDraw {
xShapes.add(createShape(xDrawDoc,2000,1500,1000,1000,"Line",0));
xShapes.add(createShape(xDrawDoc,3000,4500,15000,1000,"Ellipse",16711680));
xShapes.add(createShape(xDrawDoc,5000,3500,7500,5000,"Rectangle",6710932));
-
- //*************************************************************************
- System.out.println("done");
+
+ //*************************************************************************
+ System.out.println("done");
System.exit(0);
}
-
+
public static com.sun.star.lang.XComponent openDraw(
com.sun.star.uno.XComponentContext xContext)
{
com.sun.star.frame.XComponentLoader xCLoader;
com.sun.star.text.XTextDocument xDoc = null;
com.sun.star.lang.XComponent xComp = null;
-
+
try {
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();
-
+
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);
@@ -143,15 +143,15 @@ public class SDraw {
new com.sun.star.beans.PropertyValue[0];
String strDoc = "private:factory/sdraw";
xComp = xCLoader.loadComponentFromURL(strDoc, "_blank", 0, szEmptyArgs);
-
- } catch(Exception e){
+
+ } catch(Exception e){
System.err.println(" Exception " + e);
e.printStackTrace(System.err);
- }
-
+ }
+
return xComp;
}
-
+
public static com.sun.star.drawing.XShape createShape(
com.sun.star.lang.XComponent xDocComp, int height, int width, int x,
int y, String kind, int col)
@@ -160,12 +160,12 @@ public class SDraw {
com.sun.star.awt.Size size = new com.sun.star.awt.Size();
com.sun.star.awt.Point position = new com.sun.star.awt.Point();
com.sun.star.drawing.XShape xShape = null;
-
+
//get MSF
com.sun.star.lang.XMultiServiceFactory xDocMSF =
(com.sun.star.lang.XMultiServiceFactory) UnoRuntime.queryInterface(
com.sun.star.lang.XMultiServiceFactory.class, xDocComp );
-
+
try {
Object oInt = xDocMSF.createInstance("com.sun.star.drawing."
+kind + "Shape");
@@ -177,26 +177,26 @@ public class SDraw {
position.Y = y;
xShape.setSize(size);
xShape.setPosition(position);
-
+
} catch ( Exception e ) {
System.err.println( "Couldn't create instance "+ e );
e.printStackTrace(System.err);
}
-
+
com.sun.star.beans.XPropertySet xSPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xShape);
-
- try {
- xSPS.setPropertyValue("FillColor", new Integer(col));
- } catch (Exception e) {
- System.err.println("Can't change colors " + e);
+
+ try {
+ xSPS.setPropertyValue("FillColor", new Integer(col));
+ } catch (Exception e) {
+ System.err.println("Can't change colors " + e);
e.printStackTrace(System.err);
- }
-
- return xShape;
+ }
+
+ return xShape;
}
-
+
public static com.sun.star.drawing.XShape createSequence(
com.sun.star.lang.XComponent xDocComp, com.sun.star.drawing.XDrawPage xDP)
{
@@ -213,12 +213,12 @@ public class SDraw {
int r = 40;
int g = 0;
int b = 80;
-
+
//get MSF
com.sun.star.lang.XMultiServiceFactory xDocMSF =
(com.sun.star.lang.XMultiServiceFactory)UnoRuntime.queryInterface(
com.sun.star.lang.XMultiServiceFactory.class, xDocComp );
-
+
for (int i=0; i<370; i=i+25) {
try{
oInt = xDocMSF.createInstance("com.sun.star.drawing.EllipseShape");
@@ -231,40 +231,40 @@ public class SDraw {
(new Float(y+(Math.sin((i*Math.PI)/180))*5000)).intValue();
xShape.setSize(size);
xShape.setPosition(position);
-
+
} catch ( Exception e ) {
// Some exception occures.FAILED
System.err.println( "Couldn't get Shape "+ e );
e.printStackTrace(System.err);
}
-
+
b=b+8;
-
+
com.sun.star.beans.XPropertySet xSPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class,
xShape);
-
- try {
+
+ try {
xSPS.setPropertyValue("FillColor", new Integer(getCol(r,g,b)));
xSPS.setPropertyValue("Shadow", new Boolean(true));
- } catch (Exception e) {
- System.err.println("Can't change colors " + e);
+ } catch (Exception e) {
+ System.err.println("Can't change colors " + e);
e.printStackTrace(System.err);
}
xShapes.add(xShape);
}
-
+
com.sun.star.drawing.XShapeGrouper xSGrouper =
(com.sun.star.drawing.XShapeGrouper)UnoRuntime.queryInterface(
com.sun.star.drawing.XShapeGrouper.class, xDP);
-
- xShape = xSGrouper.group(xShapes);
-
+
+ xShape = xSGrouper.group(xShapes);
+
return xShape;
}
-
- public static int getCol(int r, int g, int b) {
- return r*65536+g*256+b;
+
+ public static int getCol(int r, int g, int b) {
+ return r*65536+g*256+b;
}
}
diff --git a/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java b/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java
index d6fd81c2e55c..9e2ff4bdf113 100644
--- a/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java
+++ b/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java
@@ -49,16 +49,16 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
private String m_aLinkURI;
public EmbedContApp( Frame aFrame, XMultiServiceFactory xServiceFactory )
- {
+ {
m_aFrame = aFrame;
m_xServiceFactory = xServiceFactory;
}
-
- public void init()
+
+ public void init()
{
resize( 640, 480 );
- setBackground( Color.gray );
-
+ setBackground( Color.gray );
+
m_aToolkit = Toolkit.getDefaultToolkit();
// Get a menu bar.
@@ -83,10 +83,10 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
aItem = new SaveMenuItem();
m_aFileMenu.add( aItem );
-
+
aItem = new SaveAsMenuItem();
m_aFileMenu.add( aItem );
-
+
// Object menu
m_aObjectMenu = new Menu( "Object", true );
aMenuBar.add( m_aObjectMenu );
@@ -103,8 +103,8 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
aItem = new ConvertLinkToEmbedMenuItem();
m_aObjectMenu.add( aItem );
- // Handle mouse clicks in our window.
-// addMouseListener( new MouseWatcher() );
+ // Handle mouse clicks in our window.
+// addMouseListener( new MouseWatcher() );
addMouseListener( this );
}
@@ -112,11 +112,11 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
{
paint( g );
}
-
+
public void paint( Graphics g )
{
super.paint( g );
-
+
if ( m_xEmbedObj != null )
{
synchronized( this )
@@ -139,7 +139,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
m_xEmbedObj.changeState( EmbedStates.EMBED_RUNNING );
nState = EmbedStates.EMBED_RUNNING;
}
-
+
if ( nState == EmbedStates.EMBED_ACTIVE || nState == EmbedStates.EMBED_RUNNING )
{
XComponentSupplier xCompProv = (XComponentSupplier)UnoRuntime.queryInterface(
@@ -157,7 +157,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
aFlavor.MimeType = "image/png";
aFlavor.HumanPresentableName = "Portable Network Graphics";
aFlavor.DataType = new Type( byte[].class );
-
+
byte[] aPNGData = (byte[])AnyConverter.toArray( xTransfer.getTransferData( aFlavor ) );
if ( aPNGData != null && aPNGData.length != 0 )
{
@@ -199,12 +199,12 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
}
}
}
-
+
public void mousePressed( MouseEvent e ){};
public void mouseEntered( MouseEvent e ){};
public void mouseExited( MouseEvent e ){};
public void mouseReleased( MouseEvent e ){};
-
+
// XEmbeddedClient
public void saveObject()
throws com.sun.star.uno.Exception
@@ -235,7 +235,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
{
// for now nothing to do
}
-
+
// classes
class NewMenuItem extends MenuItem implements ActionListener // Menu New
{
@@ -244,7 +244,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "New", new MenuShortcut( KeyEvent.VK_A ));
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
// clear everything
@@ -261,7 +261,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "SaveAs..." );
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
// open SaveAs dialog and store
@@ -308,7 +308,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "Open", new MenuShortcut( KeyEvent.VK_C ));
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
// clear everything
@@ -325,7 +325,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
{
// create object from specified file
String aFileURI = aFile.toURI().toASCIIString();
-
+
// load from specified file
loadFileURI( aFileURI );
@@ -357,7 +357,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "Save", new MenuShortcut( KeyEvent.VK_D ));
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
// if has persistance store there
@@ -437,7 +437,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "Create", new MenuShortcut( KeyEvent.VK_N ));
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
// remove current object an init a new one
@@ -482,7 +482,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
}
}
}
-
+
generateNewImage();
repaint();
}
@@ -495,7 +495,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "Load from file", new MenuShortcut( KeyEvent.VK_L ));
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
// first remove current object
@@ -545,7 +545,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "Create link", new MenuShortcut( KeyEvent.VK_M ));
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
// first remove current object
@@ -598,15 +598,15 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
super( "Convert link to embed", new MenuShortcut( KeyEvent.VK_M ));
addActionListener( this );
}
-
+
public void actionPerformed( ActionEvent e )
{
if ( !m_bLinkObj )
{
JOptionPane.showMessageDialog( m_aFrame, "The object is not a link!", "Error:", JOptionPane.ERROR_MESSAGE );
- return;
+ return;
}
-
+
if ( m_xEmbedObj != null )
{
if ( m_xStorage != null )
@@ -655,49 +655,49 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
int[] pTempClassID = { 0x8B, 0xC6, 0xB1, 0x65, 0xB1, 0xB2, 0x4E, 0xDD,
0xAA, 0x47, 0xDA, 0xE2, 0xEE, 0x68, 0x9D, 0xD6 };
for ( int ind = 0; ind < 16; ind++ )
- pClassID[ind] = (byte)pTempClassID[ind];
+ pClassID[ind] = (byte)pTempClassID[ind];
}
else if ( aServiceName.equals( "com.sun.star.comp.Writer.GlobalDocument" ) )
{
int[] pTempClassID = { 0xB2, 0x1A, 0x0A, 0x7C, 0xE4, 0x03, 0x41, 0xFE,
0x95, 0x62, 0xBD, 0x13, 0xEA, 0x6F, 0x15, 0xA0 };
for ( int ind = 0; ind < 16; ind++ )
- pClassID[ind] = (byte)pTempClassID[ind];
+ pClassID[ind] = (byte)pTempClassID[ind];
}
else if ( aServiceName.equals( "com.sun.star.comp.Writer.WebDocument" ) )
{
int[] pTempClassID = { 0xA8, 0xBB, 0xA6, 0x0C, 0x7C, 0x60, 0x45, 0x50,
0x91, 0xCE, 0x39, 0xC3, 0x90, 0x3F, 0xAC, 0x5E };
for ( int ind = 0; ind < 16; ind++ )
- pClassID[ind] = (byte)pTempClassID[ind];
+ pClassID[ind] = (byte)pTempClassID[ind];
}
else if ( aServiceName.equals( "com.sun.star.comp.Calc.SpreadsheetDocument" ) )
{
int[] pTempClassID = { 0x47, 0xBB, 0xB4, 0xCB, 0xCE, 0x4C, 0x4E, 0x80,
0xA5, 0x91, 0x42, 0xD9, 0xAE, 0x74, 0x95, 0x0F };
for ( int ind = 0; ind < 16; ind++ )
- pClassID[ind] = (byte)pTempClassID[ind];
+ pClassID[ind] = (byte)pTempClassID[ind];
}
else if ( aServiceName.equals( "com.sun.star.comp.Draw.PresentationDocument" ) )
{
int[] pTempClassID = { 0x91, 0x76, 0xE4, 0x8A, 0x63, 0x7A, 0x4D, 0x1F,
0x80, 0x3B, 0x99, 0xD9, 0xBF, 0xAC, 0x10, 0x47 };
for ( int ind = 0; ind < 16; ind++ )
- pClassID[ind] = (byte)pTempClassID[ind];
+ pClassID[ind] = (byte)pTempClassID[ind];
}
else if ( aServiceName.equals( "com.sun.star.comp.Draw.DrawingDocument" ) )
{
int[] pTempClassID = { 0x4B, 0xAB, 0x89, 0x70, 0x8A, 0x3B, 0x45, 0xB3,
0x99, 0x1C, 0xCB, 0xEE, 0xAC, 0x6B, 0xD5, 0xE3 };
for ( int ind = 0; ind < 16; ind++ )
- pClassID[ind] = (byte)pTempClassID[ind];
+ pClassID[ind] = (byte)pTempClassID[ind];
}
else if ( aServiceName.equals( "com.sun.star.comp.Math.FormulaDocument" ) )
{
int[] pTempClassID = { 0x07, 0x8B, 0x7A, 0xBA, 0x54, 0xFC, 0x45, 0x7F,
0x85, 0x51, 0x61, 0x47, 0xE7, 0x76, 0xA9, 0x97 };
for ( int ind = 0; ind < 16; ind++ )
- pClassID[ind] = (byte)pTempClassID[ind];
+ pClassID[ind] = (byte)pTempClassID[ind];
}
if ( pClassID != null )
@@ -858,7 +858,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
{
JOptionPane.showMessageDialog( m_aFrame, e, "Exception in createTempStorage():", JOptionPane.ERROR_MESSAGE );
}
-
+
return xTempStorage;
}
@@ -878,7 +878,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
Object oStorage = xStorageFactory.createInstanceWithArguments( aArgs );
XStorage xTargetStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oStorage );
m_xStorage.copyToStorage( xTargetStorage );
-
+
XComponent xComponent = (XComponent)UnoRuntime.queryInterface( XComponent.class, m_xStorage );
xComponent.dispose();
@@ -895,7 +895,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
{
JOptionPane.showMessageDialog( m_aFrame, e, "Exception in saveStorageToFileURI():", JOptionPane.ERROR_MESSAGE );
}
-
+
}
public void loadFileURI( String aFileURI )
@@ -983,15 +983,15 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
if ( xLinkOutStream != null && xTruncate != null )
{
xTruncate.truncate();
-
+
char[] aLinkChar = m_aLinkURI.toCharArray();
byte[] aLinkBytes = new byte[ aLinkChar.length ];
for ( int ind = 0; ind < aLinkChar.length; ind++ )
aLinkBytes[ind] = (byte)aLinkChar[ind];
-
+
xLinkOutStream.writeBytes( aLinkBytes );
xLinkOutStream.closeOutput();
-
+
XComponent xComponent = (XComponent) UnoRuntime.queryInterface( XComponent.class,
xLinkStream );
if ( xComponent != null )
@@ -1016,7 +1016,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
e,
"Exception in storeLinkToStorage:",
JOptionPane.ERROR_MESSAGE );
-
+
}
}
}
diff --git a/odk/examples/java/EmbedDocument/Container1/EmbedContFrame.java b/odk/examples/java/EmbedDocument/Container1/EmbedContFrame.java
index 28b6c036b7b0..2a29ff4cc026 100644
--- a/odk/examples/java/EmbedDocument/Container1/EmbedContFrame.java
+++ b/odk/examples/java/EmbedDocument/Container1/EmbedContFrame.java
@@ -19,7 +19,7 @@ import com.sun.star.beans.*;
import com.sun.star.lang.*;
-public class EmbedContFrame extends Frame
+public class EmbedContFrame extends Frame
{
WindowListener m_aCloser = new WindowAdapter()
{
@@ -30,7 +30,7 @@ public class EmbedContFrame extends Frame
}
};
- public EmbedContFrame( String sName )
+ public EmbedContFrame( String sName )
{
super( sName );
addWindowListener( m_aCloser );
@@ -82,18 +82,18 @@ public class EmbedContFrame extends Frame
// Get component context
XComponentContext xComponentContext =
com.sun.star.comp.helper.Bootstrap.createInitialComponentContext( null );
-
+
// initial serviceManager
XMultiComponentFactory xLocalServiceManager = xComponentContext.getServiceManager();
-
+
// create a connector, so that it can contact the office
Object oUrlResolver = xLocalServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver",
xComponentContext );
XUnoUrlResolver xUrlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface( XUnoUrlResolver.class, oUrlResolver );
-
+
Object oInitialObject = xUrlResolver.resolve( sConnectionString );
XNamingService xName = (XNamingService)UnoRuntime.queryInterface( XNamingService.class, oInitialObject );
-
+
XMultiServiceFactory xMSF = null;
if( xName != null ) {
Object oMSF = xName.getRegisteredObject( "StarOffice.ServiceManager" );
@@ -101,8 +101,8 @@ public class EmbedContFrame extends Frame
}
else
System.out.println( "Error: Can't get XNamingService interface from url resolver!" );
-
+
return xMSF;
}
-}
+}
diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/EditorFrame.java b/odk/examples/java/EmbedDocument/EmbeddedObject/EditorFrame.java
index 098555c55e11..0be57999755a 100755
--- a/odk/examples/java/EmbedDocument/EmbeddedObject/EditorFrame.java
+++ b/odk/examples/java/EmbedDocument/EmbeddedObject/EditorFrame.java
@@ -10,12 +10,12 @@ import javax.imageio.ImageIO;
import org.openoffice.examples.embedding.OwnEmbeddedObject;
-public class EditorFrame extends JFrame
+public class EditorFrame extends JFrame
{
OwnEmbeddedObject m_aEmbObj;
JTextArea m_aTextArea;
BufferedImage m_aBufImage;
-
+
WindowListener m_aCloser = new WindowAdapter()
{
public void windowClosing( WindowEvent e )
@@ -25,13 +25,13 @@ public class EditorFrame extends JFrame
Graphics2D aGr = m_aBufImage.createGraphics();
m_aTextArea.paintAll( aGr );
aGr.dispose();
-
+
hide();
m_aEmbObj.CloseFrameRequest();
}
};
- public EditorFrame( String sName, OwnEmbeddedObject aEmbObj, int nWidth, int nHeight )
+ public EditorFrame( String sName, OwnEmbeddedObject aEmbObj, int nWidth, int nHeight )
{
super( sName );
m_aEmbObj = aEmbObj;
@@ -65,18 +65,18 @@ public class EditorFrame extends JFrame
Dimension aToSet =
new Dimension( (int)( aSize.getWidth() + aOwnSize.getWidth() - aAppSize.getWidth() ),
(int)(aSize.getHeight() + aOwnSize.getHeight() - aAppSize.getHeight() ) );
-
+
setSize( aToSet );
validate();
-
+
// pack();
}
-
+
public byte[] getReplacementImage()
{
Dimension aDim = m_aTextArea.getSize();
BufferedImage aBufImage = null;
-
+
if ( m_aBufImage != null )
aBufImage = m_aBufImage;
else
@@ -94,7 +94,7 @@ public class EditorFrame extends JFrame
catch ( java.lang.Exception e )
{}
}
-
+
if ( aBufImage != null )
{
try
@@ -117,5 +117,5 @@ public class EditorFrame extends JFrame
return new byte[0];
}
-}
+}
diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
index 3d10824584f5..df2da9f0ebea 100755
--- a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
+++ b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
@@ -60,7 +60,7 @@ public final class OwnEmbeddedObject extends WeakBase
{
if ( m_aListeners == null )
m_aListeners = new Vector<Object>( 10, 10 );
-
+
return m_aListeners;
}
@@ -69,13 +69,13 @@ public final class OwnEmbeddedObject extends WeakBase
{
if ( m_nObjectState == com.sun.star.embed.EmbedStates.ACTIVE )
m_aObjSize = m_aEditorFrame.getAppSize();
-
+
if ( m_aObjSize != null )
return m_aObjSize;
else
return new Dimension();
}
-
+
// -------------------------------------------------------------
protected void SwitchOwnPersistence( XStorage xParentStorage, XStorage xOwnStorage, String aEntryName )
{
@@ -171,7 +171,7 @@ public final class OwnEmbeddedObject extends WeakBase
catch( com.sun.star.uno.Exception e )
{
throw new com.sun.star.io.IOException( "Error while switching object storage!" );
- }
+ }
}
// -------------------------------------------------------------
@@ -269,9 +269,9 @@ public final class OwnEmbeddedObject extends WeakBase
catch( com.sun.star.uno.Exception e )
{
throw new com.sun.star.io.IOException( "Error while reading one of object streams!" );
- }
+ }
}
-
+
// -------------------------------------------------------------
protected void ReadSizeFromOwnStorage() throws com.sun.star.io.IOException
{
@@ -285,7 +285,7 @@ public final class OwnEmbeddedObject extends WeakBase
m_aObjSize = new Dimension( nWidth, nHeight );
}
}
-
+
// -------------------------------------------------------------
public OwnEmbeddedObject( XComponentContext context, byte[] aClassID )
{
@@ -310,13 +310,13 @@ public final class OwnEmbeddedObject extends WeakBase
try{
xClient.saveObject();
} catch( com.sun.star.uno.Exception e ){}
-
+
m_nObjectState = com.sun.star.embed.EmbedStates.RUNNING;
StateChangeNotification( false, com.sun.star.embed.EmbedStates.ACTIVE, m_nObjectState );
PostEvent( "OnVisAreaChanged" );
}
-
+
// com.sun.star.embed.XCommonEmbedPersist:
// -------------------------------------------------------------
public void storeOwn() throws com.sun.star.embed.WrongStateException, com.sun.star.io.IOException, com.sun.star.uno.Exception
@@ -421,7 +421,7 @@ public final class OwnEmbeddedObject extends WeakBase
}
}
else if ( nEntryConnectionMode == com.sun.star.embed.EntryInitModes.TRUNCATE_INIT )
- {
+ {
SwitchOwnPersistence( xStorage, aEntryName );
m_aEditorFrame = new EditorFrame( m_aEntryName, this, 5, 20 );
m_nObjectState = com.sun.star.embed.EmbedStates.RUNNING;
@@ -446,7 +446,7 @@ public final class OwnEmbeddedObject extends WeakBase
}
else
{
- com.sun.star.embed.XStorage xSubStorage =
+ com.sun.star.embed.XStorage xSubStorage =
xStorage.openStorageElement( aEntryName,
com.sun.star.embed.ElementModes.READWRITE | com.sun.star.embed.ElementModes.TRUNCATE );
@@ -469,7 +469,7 @@ public final class OwnEmbeddedObject extends WeakBase
if ( m_nObjectState == com.sun.star.embed.EmbedStates.LOADED )
{
- xSubStorage =
+ xSubStorage =
xStorage.openStorageElement( aEntryName,
com.sun.star.embed.ElementModes.READWRITE | com.sun.star.embed.ElementModes.NOCREATE );
@@ -477,7 +477,7 @@ public final class OwnEmbeddedObject extends WeakBase
}
else
{
- xSubStorage =
+ xSubStorage =
xStorage.openStorageElement( aEntryName,
com.sun.star.embed.ElementModes.READWRITE | com.sun.star.embed.ElementModes.TRUNCATE );
@@ -786,7 +786,7 @@ public final class OwnEmbeddedObject extends WeakBase
m_aListeners.clear();
}
-
+
m_bDisposed = true;
if ( m_aEditorFrame != null )
@@ -832,7 +832,7 @@ public final class OwnEmbeddedObject extends WeakBase
&& nNewState != com.sun.star.embed.EmbedStates.RUNNING
&& nNewState != com.sun.star.embed.EmbedStates.ACTIVE )
throw new com.sun.star.embed.UnreachableStateException();
-
+
StateChangeNotification( true, nOldState, nNewState );
try
@@ -887,7 +887,7 @@ public final class OwnEmbeddedObject extends WeakBase
if ( m_aObjSize != null )
m_aEditorFrame.setAppSize( m_aObjSize );
-
+
m_xClient.visibilityChanged( true );
m_nObjectState = nNewState;
@@ -1038,15 +1038,15 @@ public final class OwnEmbeddedObject extends WeakBase
pVerbs[nInd].VerbAttributes = com.sun.star.embed.VerbAttributes.MS_VERBATTR_ONCONTAINERMENU;
}
}
-
+
m_pOwnVerbs = pVerbs;
}
}
catch( com.sun.star.uno.Exception e )
- {}
+ {}
}
- if ( m_pOwnVerbs != null )
+ if ( m_pOwnVerbs != null )
return m_pOwnVerbs;
return new com.sun.star.embed.VerbDescriptor[0];
diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java
index fd8f2793c9c5..525d13e63eef 100755
--- a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java
+++ b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java
@@ -67,7 +67,7 @@ public final class OwnEmbeddedObjectFactory extends WeakBase
{
if ( xStorage == null || sEntName == null || sEntName.length() == 0 )
throw new com.sun.star.lang.IllegalArgumentException();
-
+
if ( nEntryConnectionMode == com.sun.star.embed.EntryInitModes.DEFAULT_INIT )
{
if ( aClassID != null && aClassID.length != 0 )
diff --git a/odk/examples/java/Inspector/Addons.xcu b/odk/examples/java/Inspector/Addons.xcu
index 0daa83fb392b..ee44a8d68773 100755
--- a/odk/examples/java/Inspector/Addons.xcu
+++ b/odk/examples/java/Inspector/Addons.xcu
@@ -15,7 +15,7 @@
</prop>
<prop oor:name="Context" oor:type="xs:string">
<value></value>
- </prop>
+ </prop>
</node>
</node>
</node>
diff --git a/odk/examples/java/Inspector/HideableMutableTreeNode.java b/odk/examples/java/Inspector/HideableMutableTreeNode.java
index c7f10ee69c41..37ac35f116b1 100644
--- a/odk/examples/java/Inspector/HideableMutableTreeNode.java
+++ b/odk/examples/java/Inspector/HideableMutableTreeNode.java
@@ -1,73 +1,73 @@
// *** HideableMutableTreeNode ***
import javax.swing.*;
import javax.swing.tree.*;
-
+
/**
- * <code>HideableMutableTreeNode</code> is a <code>DefaultMutableTreeNode</code>
- * implementation that works with <code>HideableTreeModel</code>.
+ * <code>HideableMutableTreeNode</code> is a <code>DefaultMutableTreeNode</code>
+ * implementation that works with <code>HideableTreeModel</code>.
*/
public class HideableMutableTreeNode extends DefaultMutableTreeNode {
/**
- * The node is visible flag.
+ * The node is visible flag.
*/
public boolean bIsvisible = true;
- private static final String SDUMMY = "Dummy";
-
-
+ private static final String SDUMMY = "Dummy";
+
+
/**
- * Creates a tree node that has no parent and no children, but which
+ * Creates a tree node that has no parent and no children, but which
* allows children.
*/
public HideableMutableTreeNode() {
super();
}
-
+
/**
- * Creates a tree node with no parent, no children, but which allows
+ * Creates a tree node with no parent, no children, but which allows
* children, and initializes it with the specified user object.
- *
- * @param userObject - an Object provided by the user that
+ *
+ * @param userObject - an Object provided by the user that
* constitutes the node's data
*/
public HideableMutableTreeNode(Object _userObject) {
super(_userObject);
}
-
+
/**
- * Creates a tree node with no parent, no children, initialized with the
+ * Creates a tree node with no parent, no children, initialized with the
* specified user object, and that allows children only if specified.
- *
+ *
* @param _userObject - an Object provided by the user that describes the node's data
* @param _ballowsChildren - if true, the node is allowed to have childnodes -- otherwise, it is always a leaf node
*/
public HideableMutableTreeNode(Object _userObject, boolean _ballowsChildren) {
super(_userObject, _ballowsChildren);
}
-
+
/**
- * Checks if the node is visible.
- *
+ * Checks if the node is visible.
+ *
* @return true if the node is visible, else false
*/
public boolean isVisible() {
return this.bIsvisible;
}
-
+
/**
- * Sets if the node is visible.
- *
+ * Sets if the node is visible.
+ *
* @param returns true if the node is visible, else false
*/
public void setVisible(boolean _bIsVisible) {
- this.bIsvisible = _bIsVisible;
+ this.bIsvisible = _bIsVisible;
}
-
+
public void addDummyNode(){
removeDummyNode();
DefaultMutableTreeNode oDefaultMutableTreeNode = new DefaultMutableTreeNode(SDUMMY);
add(oDefaultMutableTreeNode);
-
+
}
@@ -84,5 +84,5 @@ public class HideableMutableTreeNode extends DefaultMutableTreeNode {
}
return breturn;
}
-
+
} \ No newline at end of file
diff --git a/odk/examples/java/Inspector/HideableTreeModel.java b/odk/examples/java/Inspector/HideableTreeModel.java
index a4a18553ca87..91444d1478a8 100644
--- a/odk/examples/java/Inspector/HideableTreeModel.java
+++ b/odk/examples/java/Inspector/HideableTreeModel.java
@@ -8,34 +8,34 @@ import java.util.Vector;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
-
+
public class HideableTreeModel implements TreeModel {
private Vector modelListeners = new Vector();
private Object root = null;
-
-
+
+
public HideableTreeModel(TreeNode _root) {
super();
- setRoot(_root);
+ setRoot(_root);
}
-
-
+
+
public Object getRoot() {
return this.root;
}
-
+
protected void setRoot(Object r) {
this.root = r;
}
-
+
public Object[] getPathToRoot(Object node) {
return getPathToRoot(node, 0);
}
-
+
private Object[] getPathToRoot(Object node, int i) {
Object anode[];
@@ -55,22 +55,22 @@ public class HideableTreeModel implements TreeModel {
}
return anode;
}
-
+
public void addTreeModelListener(TreeModelListener l) {
modelListeners.addElement(l);
}
-
+
public void removeTreeModelListener(TreeModelListener l) {
modelListeners.removeElement(l);
}
-
+
public void reload() {
reload(getRoot());
}
-
+
public void reload(Object node) {
if(node != null) {
@@ -78,16 +78,16 @@ public class HideableTreeModel implements TreeModel {
fireTreeStructureChanged(new TreeModelEvent(this, tp));
}
}
-
+
public void valueForPathChanged(TreePath path, Object newValue) {
nodeChanged(path.getLastPathComponent());
}
-
+
public void nodeInserted(Object node, Object child) {
nodeInserted(node, child, -1);
}
-
+
public void nodeInserted(Object node, Object child, int index) {
if(index < 0) {
@@ -100,7 +100,7 @@ public class HideableTreeModel implements TreeModel {
fireTreeNodesInserted(new TreeModelEvent(this, tp, ai, ac));
}
}
-
+
public void nodeRemoved(Object node, Object child, int index) {
if(node != null && child != null && index >= 0) {
@@ -110,7 +110,7 @@ public class HideableTreeModel implements TreeModel {
fireTreeNodesRemoved(new TreeModelEvent(this, tp, ai, ac));
}
}
-
+
public void nodeChanged(Object node) {
if(node != null) {
@@ -118,41 +118,41 @@ public class HideableTreeModel implements TreeModel {
fireTreeNodesChanged(new TreeModelEvent(this, tp, null, null));
}
}
-
+
protected void fireTreeNodesChanged(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeNodesChanged(event);
}
}
-
+
protected void fireTreeNodesInserted(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeNodesInserted(event);
}
}
-
+
protected void fireTreeNodesRemoved(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeNodesRemoved(event);
}
}
-
+
protected void fireTreeStructureChanged(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
((TreeModelListener)modelListeners.elementAt(i)).treeStructureChanged(event);
}
}
-
+
public ArrayList getExpandedPaths(JTree tree) {
ArrayList expandedPaths = new ArrayList();
addExpandedPaths(tree, tree.getPathForRow(0), expandedPaths);
return expandedPaths;
}
-
+
private void addExpandedPaths(JTree tree, TreePath path, ArrayList pathlist) {
Enumeration aEnum = tree.getExpandedDescendants(path);
@@ -162,14 +162,14 @@ public class HideableTreeModel implements TreeModel {
addExpandedPaths(tree, tp, pathlist);
}
}
-
+
public void expandPaths(JTree tree, ArrayList pathlist) {
for(int i = 0; i < pathlist.size(); i++) {
tree.expandPath((TreePath)pathlist.get(i));
}
}
-
+
public boolean isLeaf(Object _oNode) {
if(_oNode instanceof TreeNode) {
@@ -177,16 +177,16 @@ public class HideableTreeModel implements TreeModel {
}
return true;
}
-
-
-
+
+
+
public Object getParent(Object node) {
if(node != getRoot() && (node instanceof TreeNode)) {
return ((TreeNode)node).getParent();
}
return null;
}
-
+
public boolean isNodeVisible(Object node) {
if(node != getRoot()) {
@@ -196,7 +196,7 @@ public class HideableTreeModel implements TreeModel {
}
return true;
}
-
+
public boolean setNodeVisible(Object node, boolean v) {
// can't hide root
@@ -222,7 +222,7 @@ public class HideableTreeModel implements TreeModel {
}
return false;
}
-
+
public boolean isPathToNodeVisible(Object node) {
Object[] path = getPathToRoot(node);
@@ -233,7 +233,7 @@ public class HideableTreeModel implements TreeModel {
}
return true;
}
-
+
public void ensurePathToNodeVisible(Object node) {
Object[] path = getPathToRoot(node);
@@ -241,7 +241,7 @@ public class HideableTreeModel implements TreeModel {
setNodeVisible(path[i], true);
}
}
-
+
public Object getChild(Object parent, int index) {
if(parent instanceof TreeNode) {
@@ -258,7 +258,7 @@ public class HideableTreeModel implements TreeModel {
}
return null;
}
-
+
public int getChildCount(Object parent) {
int count = 0;
@@ -273,7 +273,7 @@ public class HideableTreeModel implements TreeModel {
}
return count;
}
-
+
public int getIndexOfChild(Object parent, Object child) {
int index = -1;
diff --git a/odk/examples/java/Inspector/Inspector.java b/odk/examples/java/Inspector/Inspector.java
index c8887d4c0344..78f5cc182ee4 100644
--- a/odk/examples/java/Inspector/Inspector.java
+++ b/odk/examples/java/Inspector/Inspector.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.awt.Rectangle;
@@ -69,19 +69,19 @@ import org.openoffice.XInstanceInspector;
public class Inspector{
public static final String sIDLDOCUMENTSUBFOLDER = "docs/common/ref/";
-
+
/** This class implements the method of the interface XInstanceInspector.
* Also the class implements the interfaces XServiceInfo, and XTypeProvider.
*/
static public class _Inspector extends WeakBase implements XInstanceInspector, XServiceInfo{
-
- static private final String __serviceName = "org.openoffice.InstanceInspector";
+
+ static private final String __serviceName = "org.openoffice.InstanceInspector";
private HashMap aApplicationHashMap = new HashMap();
private String sTitle = "Object Inspector";
private Vector aHiddenDocuments = new Vector();
// private String[] sApplicationDocUrls = new String[]{"private:factory/swriter", "private:factory/scalc", "private:factory/simpress", "private:factory/sdraw", "private:factory/sbase"};
// private String[] sApplicationDocNames = new String[]{"Text Document", "Spreadsheet", "Presentation", "Drawing", "Database"};
- private XComponentContext m_xComponentContext;
+ private XComponentContext m_xComponentContext;
private HashMap aInspectorPanes = new HashMap();
private XDialogProvider m_oSwingDialogProvider;
private TDocSupplier oTDocSupplier;
@@ -92,39 +92,39 @@ public class Inspector{
public _Inspector(XComponentContext _xComponentContext) {
m_xComponentContext = _xComponentContext;
m_oIntrospector = Introspector.getIntrospector(m_xComponentContext);
- aApplicationHashMap.put("private:factory/swriter", "Text Document");
+ aApplicationHashMap.put("private:factory/swriter", "Text Document");
aApplicationHashMap.put("private:factory/scalc", "Spreadsheet");
aApplicationHashMap.put("private:factory/simpress", "Presentation");
aApplicationHashMap.put("private:factory/sdraw", "Drawing");
aApplicationHashMap.put("private:factory/smath", "Formula");
m_oSwingDialogProvider = new SwingDialogProvider(this, sTitle);
-// aApplicationHashMap.put("private:factory/sbase", "Database");
+// aApplicationHashMap.put("private:factory/sbase", "Database");
}
-
-
+
+
public XComponentContext getXComponentContext(){
return m_xComponentContext;
}
-
-
+
+
public HashMap getInspectorPages(){
return aInspectorPanes;
}
-
-
+
+
protected String getSDKPath(){
String sRetPath = "";
try{
XNameAccess xNameAccess = getConfigurationAccess("org.openoffice.inspector.ObjectInspector", true);
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
- sRetPath = (String) xPropertySet.getPropertyValue("SDKPath");
+ sRetPath = (String) xPropertySet.getPropertyValue("SDKPath");
}catch( Exception exception ) {
exception.printStackTrace(System.out);
}
return sRetPath;
}
-
-
+
+
public String getIDLPath(){
String sRetPath = getSDKPath();
if (m_oIntrospector.isValidSDKInstallationPath(sRetPath)){
@@ -135,8 +135,8 @@ public class Inspector{
}
return sRetPath;
}
-
-
+
+
public void openIdlFileforSelectedNode(){
InspectorPane oInspectorPane = m_oSwingDialogProvider.getSelectedInspectorPage();
if (oInspectorPane != null){
@@ -146,9 +146,9 @@ public class Inspector{
oUnoNode.openIdlDescription(sPath);
}
}
- }
-
-
+ }
+
+
public void assignSDKPath() {
try {
String sInstallationFolder = "";
@@ -169,7 +169,7 @@ public class Inspector{
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
xPropertySet.setPropertyValue("SDKPath", sInstallationFolder);
XChangesBatch xBatch = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, xNameAccess);
- xBatch.commitChanges();
+ xBatch.commitChanges();
}
else{
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFolderPicker);
@@ -183,8 +183,8 @@ public class Inspector{
}catch( Exception exception ) {
exception.printStackTrace(System.out);
}}
-
-
+
+
public void showErrorMessageBox(XWindowPeer _xWindowPeer, String _sTitle, String _sMessage){
try {
Object oToolkit = m_xComponentContext.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit", m_xComponentContext);
@@ -199,8 +199,8 @@ public class Inspector{
} catch (com.sun.star.uno.Exception ex) {
ex.printStackTrace(System.out);
}}
-
-
+
+
public void inspect(java.lang.Object _oUserDefinedObject, String _sTitle) throws com.sun.star.uno.RuntimeException {
try {
int nPageIndex = m_oSwingDialogProvider.getInspectorPageCount();
@@ -212,23 +212,23 @@ public class Inspector{
}catch( Exception exception ) {
exception.printStackTrace(System.out);
}}
-
-
+
+
public void inspectOpenEmptyDocument(String _sApplicationDocUrl){
XComponent xComponent = getTDocSupplier().openEmptyDocument(_sApplicationDocUrl);
String sRootTitle = (String) aApplicationHashMap.get(_sApplicationDocUrl);
inspect(xComponent, sRootTitle);
aHiddenDocuments.add(xComponent);
}
-
-
+
+
public void inspectOpenDocument(String _sTDocUrl){
String sTreeNodeName = getTDocSupplier().getTitleByTDocUrl(_sTDocUrl);
XModel xTDocModel = getTDocSupplier().getXModelByTDocUrl(_sTDocUrl);
inspect(xTDocModel, sTreeNodeName);
- }
-
-
+ }
+
+
public void inspectSelectedNode(){
InspectorPane oInspectorPane = m_oSwingDialogProvider.getSelectedInspectorPage();
if (oInspectorPane != null){
@@ -241,14 +241,14 @@ public class Inspector{
}
}
-
+
public void addSourceCodeOfSelectedNode(){
InspectorPane oInspectorPane = m_oSwingDialogProvider.getSelectedInspectorPage();
if (oInspectorPane != null){
oInspectorPane.addSourceCodeOfSelectedNode();
}
}
-
+
public void invokeSelectedMethod(){
InspectorPane oInspectorPane = m_oSwingDialogProvider.getSelectedInspectorPage();
@@ -256,8 +256,8 @@ public class Inspector{
oInspectorPane.invokeSelectedMethodNode();
}
}
-
-
+
+
public void setSourceCodeLanguage(final int _nLanguage){
try{
String sLanguage = "Java";
@@ -285,11 +285,11 @@ public class Inspector{
}catch( Exception exception ) {
exception.printStackTrace(System.out);
}}
-
-
+
+
private TDocSupplier getTDocSupplier(){
if (oTDocSupplier == null){
- oTDocSupplier = new TDocSupplier(m_xComponentContext);
+ oTDocSupplier = new TDocSupplier(m_xComponentContext);
}
return oTDocSupplier;
}
@@ -297,13 +297,13 @@ public class Inspector{
public String[] getTDocUrls(){
return getTDocSupplier().getTDocUrls();
}
-
-
+
+
public String[] getTDocTitles(String[] _sTDocUrls){
return getTDocSupplier().getTDocTitles(_sTDocUrls);
}
-
-
+
+
public String[][] getApplicationUrls(){
Set aSet = aApplicationHashMap.keySet();
String[][] sReturnList = new String[aSet.size()][];
@@ -318,7 +318,7 @@ public class Inspector{
return sReturnList;
}
-
+
public void disposeHiddenDocuments(){
int nHiddenCount = aHiddenDocuments.size();
if (nHiddenCount > 0){
@@ -336,13 +336,13 @@ public class Inspector{
}
}
}
-
-
+
+
public static String[] getServiceNames() {
String[] sSupportedServiceNames = { __serviceName };
return sSupportedServiceNames;
}
-
+
// Implement the interface XServiceInfo
/** Get all supported service names.
* @return Supported service names.
@@ -350,7 +350,7 @@ public class Inspector{
public String[] getSupportedServiceNames() {
return getServiceNames();
}
-
+
// Implement the interface XServiceInfo
/** Test, if the given service will be supported.
* @param sService Service name.
@@ -359,7 +359,7 @@ public class Inspector{
public boolean supportsService( String sServiceName ) {
return sServiceName.equals( __serviceName );
}
-
+
// Implement the interface XServiceInfo
/** Get the implementation name of the component.
* @return Implementation name of the component.
@@ -367,7 +367,7 @@ public class Inspector{
public String getImplementationName() {
return _Inspector.class.getName();
}
-
+
private int getSourceCodeLanguage(){
int nLanguage = XLanguageSourceCodeGenerator.nJAVA;
@@ -378,10 +378,10 @@ public class Inspector{
nLanguage = XLanguageSourceCodeGenerator.nJAVA;
}
else if (sLanguage.toUpperCase().equals("BASIC")){
- nLanguage = XLanguageSourceCodeGenerator.nBASIC;
+ nLanguage = XLanguageSourceCodeGenerator.nBASIC;
}
else if (sLanguage.toUpperCase().equals("CPLUSPLUS")){
- nLanguage = XLanguageSourceCodeGenerator.nCPLUSPLUS;
+ nLanguage = XLanguageSourceCodeGenerator.nCPLUSPLUS;
}
else{
System.out.println("Warning: Sourcecode language " + sLanguage + " is not defined!");
@@ -391,9 +391,9 @@ public class Inspector{
exception.printStackTrace(System.out);
}
return nLanguage;
- }
-
-
+ }
+
+
public XNameAccess getConfigurationAccess(boolean _bUpdate){
return getConfigurationAccess("org.openoffice.inspector.ObjectInspector", _bUpdate);
}
@@ -411,20 +411,20 @@ public class Inspector{
}
XMultiComponentFactory xMCF = m_xComponentContext.getServiceManager();
Object oDefaultProvider = xMCF.createInstanceWithContext("com.sun.star.configuration.DefaultProvider", this.getXComponentContext());
- XMultiServiceFactory xMSFCfg = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDefaultProvider);
+ XMultiServiceFactory xMSFCfg = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDefaultProvider);
Object oAccess = xMSFCfg.createInstanceWithArguments(sAccess, new Object[]{new NamedValue("nodepath", _sNodePath)});
xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oAccess);
- } catch (com.sun.star.uno.Exception e) {
+ } catch (com.sun.star.uno.Exception e) {
}
return xNameAccess;
}
-
-
+
+
}
-
+
// end of inner class
-
-
+
+
/**
* Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -454,8 +454,8 @@ public class Inspector{
* @see com.sun.star.comp.loader.JavaLoader
*/
public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return (Factory.writeRegistryServiceInfo(_Inspector.class.getName(), _Inspector.getServiceNames(), regKey)
+ return (Factory.writeRegistryServiceInfo(_Inspector.class.getName(), _Inspector.getServiceNames(), regKey)
&& InspectorAddon.__writeRegistryServiceInfo(regKey));
}
}
-
+
diff --git a/odk/examples/java/Inspector/InspectorAddon.java b/odk/examples/java/Inspector/InspectorAddon.java
index be35f8a1988e..92c8ab5c43fa 100644
--- a/odk/examples/java/Inspector/InspectorAddon.java
+++ b/odk/examples/java/Inspector/InspectorAddon.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.XPropertySet;
import com.sun.star.frame.DispatchDescriptor;
@@ -66,12 +66,12 @@ public class InspectorAddon {
"com.sun.star.frame.ProtocolHandler" };
;
private XComponentContext m_xContext = null;
-
+
/** Creates a new instance of InspectorAddon */
public InspectorAddonImpl(XComponentContext _xContext) {
m_xContext = _xContext;
}
-
+
public XDispatch queryDispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) {
XDispatch xRet = null;
if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ) {
@@ -86,37 +86,37 @@ public class InspectorAddon {
public XDispatch[] queryDispatches( /*IN*/DispatchDescriptor[] seqDescripts ) {
int nCount = seqDescripts.length;
- XDispatch[] lDispatcher = new XDispatch[nCount];
+ XDispatch[] lDispatcher = new XDispatch[nCount];
for( int i=0; i<nCount; ++i )
lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags );
- return lDispatcher;
+ return lDispatcher;
}
public void initialize( Object[] object ) throws com.sun.star.uno.Exception {
if ( object.length > 0 ){
m_xFrame = ( XFrame ) UnoRuntime.queryInterface(XFrame.class, object[ 0 ] );
- }
+ }
}
-
+
public class Dispatcher implements XDispatch{
private XFrame m_xFrame = null;
private XModel xModel = null;
-
+
public Dispatcher(XFrame _xFrame){
m_xFrame = _xFrame;
if (m_xFrame != null){
XController xController = m_xFrame.getController();
if (xController != null){
xModel = xController.getModel();
- }
+ }
}
}
// XDispatch
public void dispatch( /*IN*/com.sun.star.util.URL _aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) {
try{
- if ( _aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ){
+ if ( _aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ){
if ( _aURL.Path.equals("inspect")){
Object oUnoInspectObject = xModel;
com.sun.star.lang.XMultiComponentFactory xMCF = m_xContext.getServiceManager();
@@ -130,7 +130,7 @@ public class InspectorAddon {
oUnoInspectObject = m_xFrame;
}
XPropertySet xFramePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xFrame);
- String sTitle = (String) xFramePropertySet.getPropertyValue("Title");
+ String sTitle = (String) xFramePropertySet.getPropertyValue("Title");
String[] sTitleList = sTitle.split(" - ");
if (sTitleList.length > 0){
sTitle = sTitleList[0];
@@ -148,15 +148,15 @@ public class InspectorAddon {
public void removeStatusListener( /*IN*/XStatusListener xControl, /*IN*/com.sun.star.util.URL aURL ) {
}
-
-
+
+
}
-
-
+
+
public static String[] getServiceNames() {
return m_serviceNames;
}
-
+
// Implement the interface XServiceInfo
/** Get all supported service names.
* @return Supported service names.
@@ -164,7 +164,7 @@ public class InspectorAddon {
public String[] getSupportedServiceNames() {
return getServiceNames();
}
-
+
// Implement the interface XServiceInfo
/** Test, if the given service will be supported.
* @param sService Service name.
@@ -172,15 +172,15 @@ public class InspectorAddon {
*/
public boolean supportsService( String sServiceName ) {
int len = m_serviceNames.length;
-
+
for( int i=0; i < len; i++) {
if ( sServiceName.equals( m_serviceNames[i] ) )
return true;
}
-
+
return false;
}
-
+
// Implement the interface XServiceInfo
/** Get the implementation name of the component.
* @return Implementation name of the component.
@@ -188,10 +188,10 @@ public class InspectorAddon {
public String getImplementationName() {
return InspectorAddonImpl.class.getName();
}
-
- }
-
-
+
+ }
+
+
/**
* Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -221,8 +221,8 @@ public class InspectorAddon {
public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
return Factory.writeRegistryServiceInfo(InspectorAddonImpl.class.getName(), InspectorAddonImpl.getServiceNames(), regKey);
}
-
+
// __create( XComponentContext ){
//
-// }
+// }
}
diff --git a/odk/examples/java/Inspector/InspectorPane.java b/odk/examples/java/Inspector/InspectorPane.java
index 4748c1a62f77..14d144781943 100644
--- a/odk/examples/java/Inspector/InspectorPane.java
+++ b/odk/examples/java/Inspector/InspectorPane.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
@@ -62,7 +62,7 @@ import javax.swing.event.TreeWillExpandListener;
private XTreeControlProvider m_xTreeControlProvider;
private String sTitle = "";
-
+
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xMultiServiceFactory XMultiServiceFactory
*/
@@ -74,15 +74,15 @@ import javax.swing.event.TreeWillExpandListener;
m_oSourceCodeGenerator = new SourceCodeGenerator(_nLanguage);
_xTreeControlProvider.addInspectorPane(this);
}
-
+
private void setMaximumOfProgressBar(Object _oUnoObject){
int nMaxValue = 0;
xIdlMethods = m_oIntrospector.getMethods(_oUnoObject);
- aProperties = m_oIntrospector.getProperties(_oUnoObject);
+ aProperties = m_oIntrospector.getProperties(_oUnoObject);
}
-
-
+
+
/** Inspect the given object for methods, properties, interfaces, and
* services.
* @param a The object to inspect
@@ -96,8 +96,8 @@ import javax.swing.event.TreeWillExpandListener;
catch( Exception exception ) {
exception.printStackTrace(System.out);
}}
-
-
+
+
public void setTitle(String _sTitle){
if (_sTitle != null){
if (_sTitle.length() > 0){
@@ -106,13 +106,13 @@ import javax.swing.event.TreeWillExpandListener;
}
}
-
+
public String getTitle(){
return sTitle;
}
-
-
-
+
+
+
private Type[] getTypes(Object _oUnoObject){
Type[] aTypes = null;
if (m_oIntrospector.isArray(_oUnoObject)){
@@ -123,8 +123,8 @@ import javax.swing.event.TreeWillExpandListener;
}
return aTypes;
}
-
-
+
+
private Object invoke(XUnoMethodNode _oUnoMethodNode){
try{
String sParamValueDescription = "";
@@ -140,23 +140,23 @@ import javax.swing.event.TreeWillExpandListener;
if (_oUnoMethodNode.getXIdlMethod().getReturnType().getTypeClass().getValue() == TypeClass.VOID_value){
sNodeDescription += _oUnoMethodNode.getXIdlMethod().getReturnType().getName() + " " + _oUnoMethodNode.getXIdlMethod().getName() + sParamValueDescription;
_oUnoMethodNode.setLabel(sNodeDescription);
- m_xTreeControlProvider.nodeChanged(_oUnoMethodNode);
+ m_xTreeControlProvider.nodeChanged(_oUnoMethodNode);
}
else if (bHasParameters || !bIsPrimitive){
if (bIsPrimitive){
sNodeDescription += m_oSourceCodeGenerator.getStringValueOfObject(oUnoReturnObject, _oUnoMethodNode.getTypeClass());
}
- else{
+ else{
Any aReturnObject = Any.complete(oUnoReturnObject);
String sShortClassName = m_oIntrospector.getShortClassName(aReturnObject.getType().getTypeName());
- sNodeDescription += m_oSourceCodeGenerator.getVariableNameforUnoObject(sShortClassName);
+ sNodeDescription += m_oSourceCodeGenerator.getVariableNameforUnoObject(sShortClassName);
}
if (m_oIntrospector.isArray(oUnoReturnObject)){
if (m_oIntrospector.isUnoTypeObject(oUnoReturnObject)){
oUnoNode = addUnoFacetteNode(_oUnoMethodNode, XUnoFacetteNode.SINTERFACEDESCRIPTION, _oUnoMethodNode.getUnoObject());
}
else if(m_oIntrospector.isUnoPropertyTypeObject(oUnoReturnObject)){
- oUnoNode = addUnoFacetteNode(_oUnoMethodNode, XUnoFacetteNode.SPROPERTYINFODESCRIPTION, oUnoReturnObject);
+ oUnoNode = addUnoFacetteNode(_oUnoMethodNode, XUnoFacetteNode.SPROPERTYINFODESCRIPTION, oUnoReturnObject);
}
else if(m_oIntrospector.isUnoPropertyValueTypeObject(oUnoReturnObject)){
oUnoNode = addUnoFacetteNode(_oUnoMethodNode, XUnoFacetteNode.SPROPERTYVALUEDESCRIPTION, oUnoReturnObject);
@@ -182,7 +182,7 @@ import javax.swing.event.TreeWillExpandListener;
if (bIsPrimitive){
sNodeDescription = _oUnoMethodNode.getStandardMethodDescription() + "=" + UnoMethodNode.getDisplayValueOfPrimitiveType(oUnoReturnObject);
_oUnoMethodNode.setLabel(sNodeDescription);
- m_xTreeControlProvider.nodeChanged(_oUnoMethodNode);
+ m_xTreeControlProvider.nodeChanged(_oUnoMethodNode);
}
}
}
@@ -192,7 +192,7 @@ import javax.swing.event.TreeWillExpandListener;
_oUnoMethodNode.setLabel(_oUnoMethodNode.getLabel() + " = null");
}
else{
- _oUnoMethodNode.setLabel(_oUnoMethodNode.getXIdlMethod().getName() + sParamValueDescription + " = null");
+ _oUnoMethodNode.setLabel(_oUnoMethodNode.getXIdlMethod().getName() + sParamValueDescription + " = null");
}
m_xTreeControlProvider.nodeChanged(_oUnoMethodNode);
}
@@ -200,8 +200,8 @@ import javax.swing.event.TreeWillExpandListener;
}catch(Exception exception ) {
return null;
}}
-
-
+
+
public void invokeSelectedMethodNode(){
XTreePathProvider xTreePathProvider = m_xTreeControlProvider.getSelectedPath();
XUnoNode oUnoNode = xTreePathProvider.getLastPathComponent();
@@ -211,7 +211,7 @@ import javax.swing.event.TreeWillExpandListener;
}
}
-
+
public void addSourceCodeOfSelectedNode(){
XTreePathProvider oTreePathProvider = m_xTreeControlProvider.getSelectedPath();
XUnoNode oUnoNode = oTreePathProvider.getLastPathComponent();
@@ -225,29 +225,29 @@ import javax.swing.event.TreeWillExpandListener;
m_xTreeControlProvider.setSourceCode(sSourceCode);
}
-
+
public void convertCompleteSourceCode(int _nLanguage){
String sSourceCode = m_oSourceCodeGenerator.convertAllUnoObjects(_nLanguage);
- m_xTreeControlProvider.setSourceCode(sSourceCode);
+ m_xTreeControlProvider.setSourceCode(sSourceCode);
}
-
- protected XUnoNode getSelectedNode(){
+
+ protected XUnoNode getSelectedNode(){
return m_xTreeControlProvider.getSelectedNode();
}
-
-
+
+
// add the object to the hashtable for a possible access in the tree
private XUnoFacetteNode addUnoFacetteNode(XUnoNode _oParentNode, String _sNodeDescription, Object _oUnoObject){
return m_xTreeControlProvider.addUnoFacetteNode( _oParentNode, _sNodeDescription, _oUnoObject);
}
-
-
+
+
private XUnoMethodNode addMethodNode(Object _objectElement, XIdlMethod _xIdlMethod){
return m_xTreeControlProvider.addMethodNode(_objectElement, _xIdlMethod);
}
-
-
-
+
+
+
public void addMethodsToTreeNode(XUnoNode _oGrandParentNode, Object _oUnoParentObject, XIdlMethod[] _xIdlMethods){
if (this.m_oIntrospector.isValid(_xIdlMethods)){
for ( int n = 0; n < _xIdlMethods.length; n++ ) {
@@ -258,11 +258,11 @@ import javax.swing.event.TreeWillExpandListener;
_oGrandParentNode.addChildNode(oChildNode);
}
}
- }
+ }
}
}
-
-
+
+
private void addFacetteNodesToTreeNode(XUnoNode _oParentNode, Object _oUnoObject){
if (m_oIntrospector.hasMethods(_oUnoObject)){
XUnoFacetteNode oUnoFacetteNode = addUnoFacetteNode(_oParentNode, XUnoFacetteNode.SMETHODDESCRIPTION, _oUnoObject);
@@ -281,7 +281,7 @@ import javax.swing.event.TreeWillExpandListener;
}
}
-
+
private void addInterfacesToTreeNode(XUnoNode _oGrandParentNode, Object _oUnoParentObject, Type[] _aTypes) {
try {
if (_oUnoParentObject != null){
@@ -293,14 +293,14 @@ import javax.swing.event.TreeWillExpandListener;
catch( Exception exception ) {
exception.printStackTrace(System.out);
}}
-
-
+
+
// add all services for the given object to the tree under the node parent
private void addServicesToTreeNode(XUnoNode _oGrandParentNode, Object _oUnoObject) {
try{
- XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
+ XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
if ( xServiceInfo != null ){
- String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
+ String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
for ( int m = 0; m < sSupportedServiceNames.length; m++ ) {
String sServiceName = sSupportedServiceNames[m];
if (sServiceName.length() > 0){
@@ -313,16 +313,16 @@ import javax.swing.event.TreeWillExpandListener;
catch(Exception exception) {
exception.printStackTrace(System.out);
}}
-
-
+
+
private void addPropertiesAndInterfacesOfService(XUnoNode _oUnoServiceNode){
String sServiceName = _oUnoServiceNode.getClassName();
Object oUnoObject = _oUnoServiceNode.getUnoObject();
addInterfacesToTreeNode(_oUnoServiceNode, oUnoObject, m_oIntrospector.getInterfaces(oUnoObject, sServiceName));
- addPropertiesToTreeNode(_oUnoServiceNode, oUnoObject, m_oIntrospector.getProperties(oUnoObject, sServiceName));
+ addPropertiesToTreeNode(_oUnoServiceNode, oUnoObject, m_oIntrospector.getProperties(oUnoObject, sServiceName));
}
-
+
private void addPropertiesToTreeNode(XUnoNode _oParentNode, Object _oUnoParentObject, Property[] _aProperties) {
try {
if (_aProperties.length > 0){
@@ -339,7 +339,7 @@ import javax.swing.event.TreeWillExpandListener;
_oParentNode.addChildNode(oChildNode);
}
}
- }
+ }
}
}
}
@@ -347,8 +347,8 @@ import javax.swing.event.TreeWillExpandListener;
catch(Exception exception) {
exception.printStackTrace(System.out);
}}
-
-
+
+
public void addContainerElementsToTreeNode(XUnoNode _oParentNode, Object _oUnoParentObject){
Object[] oUnoContainerElements = m_oIntrospector.getUnoObjectsOfContainer(_oUnoParentObject);
if (m_oIntrospector.isValid(oUnoContainerElements)){
@@ -361,37 +361,37 @@ import javax.swing.event.TreeWillExpandListener;
}
}
-
+
private XUnoNode addUnoNode(XUnoNode _oParentNode, Object _oUnoObject, String _sLabel ){
XUnoNode oUnoNode = this.m_xTreeControlProvider.addUnoNode(_oUnoObject);
oUnoNode.setLabel(_sLabel);
- if (_oParentNode != null){
- _oParentNode.addChildNode(oUnoNode);
+ if (_oParentNode != null){
+ _oParentNode.addChildNode(oUnoNode);
}
setNodeFoldable(oUnoNode, _oUnoObject);
return oUnoNode;
}
-
-
+
+
private void setNodeFoldable(XUnoNode _oUnoNode, Object _oUnoObject){
if (_oUnoObject != null){
if (!m_oIntrospector.isObjectPrimitive(_oUnoObject)){
_oUnoNode.setFoldable(true);
}
- }
+ }
}
-
-
+
+
private XUnoNode addUnoNode(XUnoNode _oParentNode, Object _oUnoObject, Type _aType){
XUnoNode oUnoNode = this.m_xTreeControlProvider.addUnoNode(_oUnoObject, _aType);
- if (_oParentNode != null){
- _oParentNode.addChildNode(oUnoNode);
+ if (_oParentNode != null){
+ _oParentNode.addChildNode(oUnoNode);
}
setNodeFoldable(oUnoNode, _oUnoObject);
return oUnoNode;
}
-
-
+
+
private void addPropertySetInfoNodesToTreeNode(XUnoFacetteNode _oUnoFacetteNode, Object _oUnoObject){
if (_oUnoObject.getClass().isArray()){
Object[] object = ( Object[] ) _oUnoObject;
@@ -412,19 +412,19 @@ import javax.swing.event.TreeWillExpandListener;
for ( int i = 0; i < object.length; i++ ) {
if (m_oIntrospector.isObjectPrimitive(object[i])){
XUnoNode oChildNode = addUnoNode(_oUnoNode, null, UnoNode.getNodeDescription(object[i]));
- }
+ }
}
}
else{
String[] sDisplayValues = UnoNode.getDisplayValuesofPrimitiveArray(_oUnoObject);
for ( int i = 0; i < sDisplayValues.length; i++ ) {
XUnoNode oUnoNode = addUnoNode(_oUnoNode, null, sDisplayValues[i]);
- }
+ }
}
}
}
-
-
+
+
private void addPropertySetInfoSubNodes(XUnoPropertyNode _oUnoPropertyNode){
Property aProperty = _oUnoPropertyNode.getProperty();
_oUnoPropertyNode.addChildNode(m_xTreeControlProvider.addUnoPropertyNodeWithName(aProperty));
@@ -432,8 +432,8 @@ import javax.swing.event.TreeWillExpandListener;
_oUnoPropertyNode.addChildNode(m_xTreeControlProvider.addUnoPropertyNodeWithHandle(aProperty));
_oUnoPropertyNode.addChildNode(m_xTreeControlProvider.addUnoPropertyNodeWithAttributesDescription(aProperty));
}
-
-
+
+
private void addPropertyValueSubNodes(XUnoFacetteNode _oUnoFacetteNode, Object _oUnoObject){
if (m_oIntrospector.isUnoPropertyValueTypeObject(_oUnoObject)){
Object[] object = ( Object[] ) _oUnoObject;
@@ -455,8 +455,8 @@ import javax.swing.event.TreeWillExpandListener;
}
}
}
-
-
+
+
public boolean expandNode(XUnoNode _oUnoNode, XTreePathProvider _xTreePathProvider){
if ( _oUnoNode != null ) {
_oUnoNode.setFoldable(false);
@@ -489,7 +489,7 @@ import javax.swing.event.TreeWillExpandListener;
}
else if (m_xTreeControlProvider.isFacetteNode(_oUnoNode)){
XUnoFacetteNode oUnoFacetteNode = (XUnoFacetteNode) _oUnoNode;
- Object oUnoObject = _oUnoNode.getUnoObject();
+ Object oUnoObject = _oUnoNode.getUnoObject();
if (oUnoFacetteNode.isMethodNode()){
addMethodsToTreeNode(oUnoFacetteNode, oUnoObject, m_oIntrospector.getMethods(oUnoObject));
}
@@ -512,7 +512,7 @@ import javax.swing.event.TreeWillExpandListener;
if (oUnoFacetteNode.isInterfaceNode()){
addInterfacesToTreeNode(oUnoFacetteNode, oUnoObject, getTypes(oUnoObject));
}
- if (oUnoFacetteNode.isContainerNode()){
+ if (oUnoFacetteNode.isContainerNode()){
addContainerElementsToTreeNode(oUnoFacetteNode, oUnoObject);
}
}
@@ -534,13 +534,13 @@ import javax.swing.event.TreeWillExpandListener;
else{
addFacetteNodesToTreeNode(_oUnoNode, oUnoObject);
}
- }
+ }
}
return true;
}
-
-
-
+
+
+
public void applyFilter(XUnoFacetteNode _oUnoFacetteNode, String _sFilter){
for (int i = 0; i < _oUnoFacetteNode.getChildCount(); i++){
XUnoNode oUnoNode = _oUnoFacetteNode.getChild(i);
@@ -549,8 +549,8 @@ import javax.swing.event.TreeWillExpandListener;
}
_oUnoFacetteNode.setFilter(_sFilter);
}
-
-
+
+
/** In opposition to 'getUnoObjectOfTreeNode' this method inspects the passed node if it represents a Uno object
* If not it returns null
*
@@ -563,7 +563,7 @@ import javax.swing.event.TreeWillExpandListener;
return null;
}
-
+
public String getFilter(XUnoNode _oUnoNode){
String sFilter = "";
if (_oUnoNode != null){
@@ -586,8 +586,8 @@ import javax.swing.event.TreeWillExpandListener;
}
return sFilter;
}
-
-
+
+
/** In opposition to 'getUnoObjectOfexplictTreeNode' this method inspects the passed node if it represents a Uno object
* if not it keeps checking all ancestors until it finds a Uno representation
*/
@@ -608,11 +608,11 @@ import javax.swing.event.TreeWillExpandListener;
}
xTreePathProvider = xTreePathProvider.getParentPath();
}
- return null;
- }
-
-
- public void showPopUpMenu(Object _invoker, int x, int y) throws ClassCastException{
+ return null;
+ }
+
+
+ public void showPopUpMenu(Object _invoker, int x, int y) throws ClassCastException{
XUnoNode oUnoNode = getSelectedNode();
boolean bdoEnableInvoke = oUnoNode instanceof XUnoMethodNode;
// boolean bdoEnableSourceCodeGeneration = true;
diff --git a/odk/examples/java/Inspector/InstanceInspector.idl b/odk/examples/java/Inspector/InstanceInspector.idl
index 79e43cb181e4..8de7e920acd8 100644
--- a/odk/examples/java/Inspector/InstanceInspector.idl
+++ b/odk/examples/java/Inspector/InstanceInspector.idl
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,16 +29,16 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
#ifndef INCLUDED_ORG_OPENOFFICE_INSTANCEINSPECTOR_IDL
#define INCLUDED_ORG_OPENOFFICE_INSTANCEINSPECTOR_IDL
-#include <XInstanceInspector.idl>
-
-
-module org { module openoffice {
+#include <XInstanceInspector.idl>
+
+
+module org { module openoffice {
/**
* This service describes an instance inspector which can inspect
@@ -46,7 +46,7 @@ module org { module openoffice {
* interfaces, the supported services and properties of this onject.
*/
service InstanceInspector: XInstanceInspector;
-
+
}; };
#endif
diff --git a/odk/examples/java/Inspector/Introspector.java b/odk/examples/java/Inspector/Introspector.java
index f4078931e1ed..cdae4f4d88b2 100644
--- a/odk/examples/java/Inspector/Introspector.java
+++ b/odk/examples/java/Inspector/Introspector.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.IllegalTypeException;
@@ -81,18 +81,18 @@ import java.util.Vector;
import javax.swing.JOptionPane;
public class Introspector extends WeakBase{
-
+
private XIntrospection m_xIntrospection;
private XMultiComponentFactory m_xMultiComponentFactory;
private XComponentContext m_xComponentContext;
- private XTypeDescriptionEnumerationAccess m_xTDEnumerationAccess;
+ private XTypeDescriptionEnumerationAccess m_xTDEnumerationAccess;
private static XComponentContext xOfficeComponentContext;
private XIdlReflection mxIdlReflection;
private URL openHyperlink;
private static Introspector m_oIntrospector = null;
private XSimpleFileAccess xSimpleFileAccess = null;
-
+
public static Introspector getIntrospector(){
if (m_oIntrospector == null){
@@ -102,22 +102,22 @@ public class Introspector extends WeakBase{
return m_oIntrospector;
}
}
-
+
public static Introspector getIntrospector(XComponentContext _xComponentContext){
if (m_oIntrospector == null){
m_oIntrospector = new Introspector(_xComponentContext);
}
return m_oIntrospector;
}
-
-
+
+
/** Creates a new instance of Introspection */
private Introspector(XComponentContext _xComponentContext) {
try{
m_xComponentContext = _xComponentContext;
m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
Object o = m_xMultiComponentFactory.createInstanceWithContext("com.sun.star.beans.Introspection", m_xComponentContext);
- m_xIntrospection = ( XIntrospection ) UnoRuntime.queryInterface(XIntrospection.class, o );
+ m_xIntrospection = ( XIntrospection ) UnoRuntime.queryInterface(XIntrospection.class, o );
Object oCoreReflection = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.reflection.CoreReflection", getXComponentContext());
mxIdlReflection = (XIdlReflection) UnoRuntime.queryInterface(XIdlReflection.class, oCoreReflection);
initTypeDescriptionManager();
@@ -125,23 +125,23 @@ public class Introspector extends WeakBase{
catch( Exception exception ) {
System.err.println( exception );
}}
-
-
+
+
protected XComponentContext getXComponentContext(){
return m_xComponentContext;
}
-
-
+
+
protected XMultiComponentFactory getXMultiComponentFactory(){
return m_xMultiComponentFactory;
}
-
-
+
+
protected XIntrospectionAccess getXIntrospectionAccess(Object _oUnoComponent){
return m_xIntrospection.inspect(_oUnoComponent);
}
-
-
+
+
public boolean isContainer(Object _oUnoObject){
boolean bIsContainer = false;
try {
@@ -164,8 +164,8 @@ public class Introspector extends WeakBase{
}
return bIsContainer;
}
-
-
+
+
// add all containers for the given object to the tree under the node
// parent
public Object[] getUnoObjectsOfContainer(Object _oUnoParentObject) {
@@ -201,36 +201,36 @@ public class Introspector extends WeakBase{
}
return oRetComponents;
}
-
+
protected XIdlMethod[] getMethodsOfInterface(Type _aType){
try{
- XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName());
+ XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName());
return xIdlClass.getMethods();
}
catch( Exception e ) {
System.err.println( e );
return null;
- }}
+ }}
protected XIdlField[] getFieldsOfType(Type _aType){
try{
- XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName());
+ XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName());
return xIdlClass.getFields();
}
catch( Exception e ) {
System.err.println( e );
return null;
- }}
-
+ }}
+
public boolean hasMethods(Object _oUnoObject){
boolean bHasMethods = (getMethods(_oUnoObject).length > 0);
return bHasMethods;
}
-
-
+
+
// add all methods for the given object to the tree under the node parent
public XIdlMethod[] getMethods(Object _oUnoParentObject) {
try {
@@ -246,18 +246,18 @@ public class Introspector extends WeakBase{
return null;
}
-
+
public boolean hasProperties(Object _oUnoObject){
boolean bHasProperties = (getProperties(_oUnoObject).length > 0);
return bHasProperties;
}
-
-
+
+
protected Property[] getProperties( Object _oUnoParentObject){
try {
XIntrospectionAccess xIntrospectionAccess = getXIntrospectionAccess(_oUnoParentObject);
if (xIntrospectionAccess != null){
- Property[] aProperties = xIntrospectionAccess.getProperties(com.sun.star.beans.PropertyConcept.ATTRIBUTES + com.sun.star.beans.PropertyConcept.PROPERTYSET);
+ Property[] aProperties = xIntrospectionAccess.getProperties(com.sun.star.beans.PropertyConcept.ATTRIBUTES + com.sun.star.beans.PropertyConcept.PROPERTYSET);
return aProperties;
}
}
@@ -266,8 +266,8 @@ public class Introspector extends WeakBase{
}
return null;
}
-
-
+
+
protected Property[] getProperties(Object _oUnoObject, String _sServiceName){
Property[] aProperties = getProperties(_oUnoObject);
List aListOfProperties = java.util.Arrays.asList(aProperties);
@@ -284,7 +284,7 @@ public class Introspector extends WeakBase{
aPropertiesVector.toArray(aRetProperties);
return aRetProperties;
}
-
+
protected Type[] getInterfaces(Object _oUnoObject, String _sServiceName){
Type[] aTypes = getInterfaces(_oUnoObject);
@@ -303,12 +303,12 @@ public class Introspector extends WeakBase{
return aRetTypes;
}
-
+
public boolean hasInterfaces(Object _oUnoObject){
return (getInterfaces(_oUnoObject).length > 0);
}
-
+
protected Type[] getInterfaces(Object _oUnoParentObject){
Type[] aTypes = new Type[]{};
XTypeProvider xTypeProvider = ( XTypeProvider ) UnoRuntime.queryInterface( XTypeProvider.class, _oUnoParentObject);
@@ -317,25 +317,25 @@ public class Introspector extends WeakBase{
}
return aTypes;
}
-
-
-
+
+
+
public static boolean isObjectSequence(Object _oUnoObject){
Type aType = AnyConverter.getType(_oUnoObject);
return aType.getTypeClass().getValue() == TypeClass.SEQUENCE_value;
}
-
-
+
+
public static boolean isObjectPrimitive(Object _oUnoObject){
boolean breturn = false;
if (_oUnoObject != null){
Type aType = AnyConverter.getType(_oUnoObject);
- breturn = isObjectPrimitive(_oUnoObject.getClass(), aType.getTypeClass());
+ breturn = isObjectPrimitive(_oUnoObject.getClass(), aType.getTypeClass());
}
return breturn;
}
-
-
+
+
public static boolean isPrimitive(TypeClass _typeClass){
return (( _typeClass == TypeClass.BOOLEAN )
|| ( _typeClass == TypeClass.BYTE )
@@ -351,7 +351,7 @@ public class Introspector extends WeakBase{
|| ( _typeClass == TypeClass.UNSIGNED_LONG )
|| ( _typeClass == TypeClass.UNSIGNED_SHORT ));
}
-
+
public static boolean isObjectPrimitive(Class _oUnoClass, TypeClass _typeClass){
return !( ( !_oUnoClass.isPrimitive() ) && ( _typeClass != TypeClass.ARRAY )
&& ( _typeClass != TypeClass.BOOLEAN )
@@ -367,9 +367,9 @@ public class Introspector extends WeakBase{
&& ( _typeClass != TypeClass.UNSIGNED_HYPER )
&& ( _typeClass != TypeClass.UNSIGNED_LONG )
&& ( _typeClass != TypeClass.UNSIGNED_SHORT ));
- }
-
-
+ }
+
+
protected void initTypeDescriptionManager() {
try {
Object oTypeDescriptionManager = getXComponentContext().getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager");
@@ -382,14 +382,14 @@ public class Introspector extends WeakBase{
protected XTypeDescriptionEnumerationAccess getXTypeDescriptionEnumerationAccess(){
return m_xTDEnumerationAccess;
}
-
-
+
+
protected XConstantTypeDescription[] getFieldsOfConstantGroup(String _sTypeClass){
XConstantTypeDescription[] xConstantTypeDescriptions = null;
try {
TypeClass[] eTypeClasses = new com.sun.star.uno.TypeClass[1];
eTypeClasses[0] = com.sun.star.uno.TypeClass.CONSTANTS;
- XTypeDescriptionEnumeration xTDEnumeration = m_xTDEnumerationAccess.createTypeDescriptionEnumeration(getModuleName(_sTypeClass), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
+ XTypeDescriptionEnumeration xTDEnumeration = m_xTDEnumerationAccess.createTypeDescriptionEnumeration(getModuleName(_sTypeClass), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
while (xTDEnumeration.hasMoreElements()) {
XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
if (xTD.getName().equals(_sTypeClass)){
@@ -397,21 +397,21 @@ public class Introspector extends WeakBase{
xConstantTypeDescriptions = xConstantsTypeDescription.getConstants();
}
String sName = xTD.getName();
- }
+ }
return xConstantTypeDescriptions;
} catch ( java.lang.Exception e) {
System.out.println(System.out);
}
return null;
}
-
+
private XServiceTypeDescription getServiceTypeDescription(String _sServiceName, TypeClass _eTypeClass){
try{
if (_sServiceName.length() > 0){
TypeClass[] eTypeClasses = new com.sun.star.uno.TypeClass[2];
eTypeClasses[0] = com.sun.star.uno.TypeClass.SERVICE;
eTypeClasses[1] = _eTypeClass;
- XTypeDescriptionEnumeration xTDEnumeration = getXTypeDescriptionEnumerationAccess().createTypeDescriptionEnumeration(Introspector.getModuleName(_sServiceName), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
+ XTypeDescriptionEnumeration xTDEnumeration = getXTypeDescriptionEnumerationAccess().createTypeDescriptionEnumeration(Introspector.getModuleName(_sServiceName), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
while (xTDEnumeration.hasMoreElements()) {
XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
if (xTD.getName().equals(_sServiceName)){
@@ -425,8 +425,8 @@ public class Introspector extends WeakBase{
ex.printStackTrace(System.out);
return null;
}}
-
-
+
+
public XPropertyTypeDescription[] getPropertyDescriptionsOfService(String _sServiceName){
try {
XServiceTypeDescription xServiceTypeDescription = getServiceTypeDescription(_sServiceName, com.sun.star.uno.TypeClass.PROPERTY);
@@ -439,8 +439,8 @@ public class Introspector extends WeakBase{
}
return new XPropertyTypeDescription[]{};
}
-
-
+
+
public XTypeDescription getReferencedType(String _sTypeName){
XTypeDescription xTypeDescription = null;
try{
@@ -458,8 +458,8 @@ public class Introspector extends WeakBase{
}
return xTypeDescription;
}
-
-
+
+
public XInterfaceTypeDescription[] getInterfaceDescriptionsOfService(String _sServiceName){
try {
XServiceTypeDescription xServiceTypeDescription = getServiceTypeDescription(_sServiceName, com.sun.star.uno.TypeClass.INTERFACE);
@@ -473,7 +473,7 @@ public class Introspector extends WeakBase{
return new XInterfaceTypeDescription[]{};
}
-
+
static boolean hasByName(XTypeDescription[] _xTypeDescriptions, String _sTypeName){
for (int i = 0; i < _xTypeDescriptions.length; i++){
if (_xTypeDescriptions[i].getName().equals(_sTypeName)){
@@ -482,8 +482,8 @@ public class Introspector extends WeakBase{
}
return false;
}
-
-
+
+
public static String getModuleName(String _sTypeClass){
int nlastindex = _sTypeClass.lastIndexOf(".");
if (nlastindex > -1){
@@ -492,9 +492,9 @@ public class Introspector extends WeakBase{
else{
return "";
}
- }
-
+ }
+
public static String getShortClassName(String _sClassName){
String sShortClassName = _sClassName;
int nindex = _sClassName.lastIndexOf(".");
@@ -502,25 +502,25 @@ public class Introspector extends WeakBase{
sShortClassName = _sClassName.substring(nindex + 1);
}
return sShortClassName;
- }
-
-
+ }
+
+
public static boolean isUnoTypeObject(Object _oUnoObject){
return isOfUnoType(_oUnoObject, "com.sun.star.uno.Type");
}
-
+
public static boolean isUnoPropertyTypeObject(Object _oUnoObject){
return isOfUnoType(_oUnoObject, "com.sun.star.beans.Property");
}
-
+
public static boolean isUnoPropertyValueTypeObject(Object _oUnoObject){
return isOfUnoType(_oUnoObject, "com.sun.star.beans.PropertyValue");
}
-
-
+
+
public static boolean isOfUnoType(Object _oUnoObject, String _sTypeName){
boolean bIsUnoObject = false;
if (_oUnoObject != null){
@@ -530,7 +530,7 @@ public class Introspector extends WeakBase{
if (oUnoArray.length > 0){
bIsUnoObject = ( oUnoArray[0].getClass().getName().equals(_sTypeName));
}
- }
+ }
}
}
else{
@@ -538,8 +538,8 @@ public class Introspector extends WeakBase{
}
return bIsUnoObject;
}
-
-
+
+
public String getConstantDisplayString(int _nValue, XConstantTypeDescription[] _xConstantTypeDescription, String _sDisplayString){
String sPrefix = "";
int[] nbits = new int[_xConstantTypeDescription.length];
@@ -553,7 +553,7 @@ public class Introspector extends WeakBase{
}
return _sDisplayString;
}
-
+
public static boolean isValid(Object[] _oObject){
if (_oObject != null){
@@ -576,20 +576,20 @@ public class Introspector extends WeakBase{
public static boolean isArray(Object _oObject){
return _oObject.getClass().isArray();
}
-
-
+
+
public boolean hasSupportedServices(Object _oUnoObject){
boolean bHasSupportedServices = false;
XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject);
if ( xServiceInfo != null ){
- String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
+ String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
bHasSupportedServices = sSupportedServiceNames.length > 0;
}
return bHasSupportedServices;
}
-
-
- public Object getValueOfText(TypeClass aTypeClass, String sText){
+
+
+ public Object getValueOfText(TypeClass aTypeClass, String sText){
Object oReturn = null;
switch (aTypeClass.getValue()){
case TypeClass.CHAR_value:
@@ -600,7 +600,7 @@ public class Introspector extends WeakBase{
case TypeClass.ENUM_value:
break;
case TypeClass.FLOAT_value:
- oReturn = Float.valueOf(sText);
+ oReturn = Float.valueOf(sText);
break;
case TypeClass.HYPER_value:
oReturn = Long.valueOf(sText);
@@ -609,7 +609,7 @@ public class Introspector extends WeakBase{
oReturn = Integer.valueOf(sText);
break;
case TypeClass.SHORT_value:
- oReturn = Byte.valueOf(sText);
+ oReturn = Byte.valueOf(sText);
break;
case TypeClass.STRING_value:
oReturn = sText;
@@ -621,14 +621,14 @@ public class Introspector extends WeakBase{
oReturn = Integer.valueOf(sText);
break;
case TypeClass.UNSIGNED_SHORT_value:
- oReturn = Byte.valueOf(sText);
+ oReturn = Byte.valueOf(sText);
break;
- default:
+ default:
}
return oReturn;
- }
-
+ }
+
public XSimpleFileAccess getXSimpleFileAccess(){
try {
if (xSimpleFileAccess == null){
@@ -640,22 +640,22 @@ public class Introspector extends WeakBase{
ex.printStackTrace(System.out);
return null;
}}
-
-
+
+
public boolean isValidSDKInstallationPath(String _sSDKInstallationPath){
boolean bIsValid = false;
try {
String sIDLFolder = Introspector.addToPath(_sSDKInstallationPath, Inspector.sIDLDOCUMENTSUBFOLDER);
String sIndexFile = Introspector.addToPath(_sSDKInstallationPath, "index.html");
if (getXSimpleFileAccess() != null){
- bIsValid = (getXSimpleFileAccess().exists(sIDLFolder) && getXSimpleFileAccess().exists(sIndexFile));
+ bIsValid = (getXSimpleFileAccess().exists(sIDLFolder) && getXSimpleFileAccess().exists(sIndexFile));
}
} catch (com.sun.star.uno.Exception ex) {
ex.printStackTrace(System.out);
}
return bIsValid;
}
-
+
public static String addToPath(String _sPath, String _sSubPath){
if (!_sPath.endsWith("/")){
@@ -663,5 +663,5 @@ public class Introspector extends WeakBase{
}
return _sPath + _sSubPath;
}
-
+
}
diff --git a/odk/examples/java/Inspector/MethodParametersDialog.java b/odk/examples/java/Inspector/MethodParametersDialog.java
index a2ebf7e66c41..803873703afb 100644
--- a/odk/examples/java/Inspector/MethodParametersDialog.java
+++ b/odk/examples/java/Inspector/MethodParametersDialog.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.reflection.ParamInfo;
@@ -63,7 +63,7 @@ public class MethodParametersDialog extends JDialog{
private ActionListener oActionListener;
private JButton jHelpButton = new JButton("Help");
private JButton jOKButton = new JButton("Ok");
- private JButton jInvokeButton = new JButton("Invoke");
+ private JButton jInvokeButton = new JButton("Invoke");
private Object m_oReturnButton = null;
private Object m_oUnoObject = null;
private Object m_oUnoReturnObject = null;
@@ -71,8 +71,8 @@ public class MethodParametersDialog extends JDialog{
private JPanel jResultPanel = null;
private boolean bisdiposed = false;
private XUnoMethodNode m_xUnoMethodNode;
-
-
+
+
public MethodParametersDialog(XUnoMethodNode _xUnoMethodNode){
m_xUnoMethodNode = _xUnoMethodNode;
m_xIdlMethod = _xUnoMethodNode.getXIdlMethod();
@@ -80,8 +80,8 @@ public class MethodParametersDialog extends JDialog{
m_oUnoObject = m_xUnoMethodNode.getUnoObject();
Object[] m_aParameterObjects = new Object[m_aParamInfo.length];
}
-
-
+
+
public Vector getMethodObjects() {
super.setModal(true);
addBorderPanel(getContentPane(), BorderLayout.NORTH);
@@ -99,7 +99,7 @@ public class MethodParametersDialog extends JDialog{
for (int i = 0; i < m_aParameterPanels.length; i++){
m_aParameterPanels[i] = new ParameterPanel(m_aParamInfo[i]);
jPnlParamContainer.add(m_aParameterPanels[i]);
- }
+ }
jPnlParamContainer.add(new ButtonPanel(), java.awt.BorderLayout.SOUTH);
getContentPane().add(jPnlParamContainer, java.awt.BorderLayout.CENTER);
pack();
@@ -108,7 +108,7 @@ public class MethodParametersDialog extends JDialog{
super.setFocusable(true);
super.setFocusableWindowState(true);
super.requestFocus();
- m_aParameterPanels[0].getInputComponent().requestFocusInWindow();
+ m_aParameterPanels[0].getInputComponent().requestFocusInWindow();
setVisible(true);
if (!bisdiposed){
Vector aMethodObjects = new Vector();
@@ -122,8 +122,8 @@ public class MethodParametersDialog extends JDialog{
return null;
}
}
-
-
+
+
private void insertResultPanel(Exception _oInvocationException){
boolean bAddPanel = false;
if (jResultPanel == null){
@@ -143,22 +143,22 @@ public class MethodParametersDialog extends JDialog{
}
jResultPanel.add(jLblResult,BorderLayout.WEST);
if (bAddPanel){
- int nPos = jPnlParamContainer.getComponentCount() - 1;
+ int nPos = jPnlParamContainer.getComponentCount() - 1;
jPnlParamContainer.add(jResultPanel, nPos);
}
super.pack();
super.validate();
}
-
-
+
+
private Object[] getParameterValues(){
Object[] oParameterValues = new Object[m_aParameterPanels.length];
for (int i = 0; i < m_aParameterPanels.length; i++){
oParameterValues[i] = m_aParameterPanels[i].getValue();
- }
+ }
return oParameterValues;
}
-
+
private boolean isCompleted(){
boolean bIsCompleted = true;
@@ -167,11 +167,11 @@ public class MethodParametersDialog extends JDialog{
if (!bIsCompleted){
break;
}
- }
+ }
return bIsCompleted;
}
-
-
+
+
private void addBorderPanel(java.awt.Container _jContainer, String _sLayout){
JPanel jPnlBorder = new JPanel();
jPnlBorder.setPreferredSize(new java.awt.Dimension(10, 10));
@@ -184,8 +184,8 @@ public class MethodParametersDialog extends JDialog{
jPnlBorder.setMaximumSize(new java.awt.Dimension(10, 10));
_jContainer.add(jPnlBorder);
}
-
-
+
+
private class ParameterPanel extends JPanel{
private JComponent m_jComponent;
private TypeClass m_aTypeClass = null;
@@ -207,13 +207,13 @@ public class MethodParametersDialog extends JDialog{
addGapPanel(jPnlCenter1);
switch (m_aTypeClass.getValue()){
case TypeClass.BOOLEAN_value:
- jComboBox.setBackground(new java.awt.Color(255, 255, 255));
+ jComboBox.setBackground(new java.awt.Color(255, 255, 255));
jComboBox.setPreferredSize(new java.awt.Dimension(50, 19));
jComboBox.addItem("True");
jComboBox.addItem("False");
jComboBox.addKeyListener(new UpdateUIAdapter());
jPnlCenter1.add(jComboBox);
- m_jComponent = jComboBox;
+ m_jComponent = jComboBox;
break;
case TypeClass.BYTE_value:
case TypeClass.CHAR_value:
@@ -230,20 +230,20 @@ public class MethodParametersDialog extends JDialog{
jTextField.setPreferredSize(new java.awt.Dimension(50, 19));
jTextField.addKeyListener(new UpdateUIAdapter());
jPnlCenter1.add(jTextField);
- m_jComponent = jTextField;
+ m_jComponent = jTextField;
break;
default:
System.out.println("Type " + m_aTypeClass.getValue() + " not yet defined in 'ParameterPanel()'");
- }
+ }
add(jPnlCenter1, java.awt.BorderLayout.CENTER);
JPanel jPnlEast = new JPanel();
- add(jPnlEast, BorderLayout.EAST);
+ add(jPnlEast, BorderLayout.EAST);
}
-
+
private JComponent getInputComponent(){
return m_jComponent;
}
-
+
public Object getValue(){
Object oReturn = null;
if (m_jComponent instanceof JTextField){
@@ -256,8 +256,8 @@ public class MethodParametersDialog extends JDialog{
}
return oReturn;
}
-
-
+
+
public boolean isCompleted(){
if (m_jComponent instanceof JTextField){
return !((JTextField) m_jComponent).getText().equals("");
@@ -268,7 +268,7 @@ public class MethodParametersDialog extends JDialog{
}
}
-
+
private class UpdateUIAdapter extends KeyAdapter{
public void keyReleased(KeyEvent e){
boolean bIsCompleted = isCompleted();
@@ -280,8 +280,8 @@ public class MethodParametersDialog extends JDialog{
}
}
}
-
-
+
+
private class ButtonPanel extends JPanel{
public ButtonPanel(){
@@ -295,7 +295,7 @@ public class MethodParametersDialog extends JDialog{
public void actionPerformed(ActionEvent e) {
oActionListener.actionPerformed(e);
}
- });
+ });
jHelpButton.setEnabled(oActionListener != null);
jPnlBottomCenter.add(jHelpButton);
addGapPanel(jPnlBottomCenter);
@@ -305,7 +305,7 @@ public class MethodParametersDialog extends JDialog{
invokeParameterMethod();
dispose();
}
- });
+ });
jOKButton.setEnabled(isCompleted());
jInvokeButton.setEnabled(isCompleted());
jInvokeButton.addActionListener(new ActionListener() {
@@ -313,7 +313,7 @@ public class MethodParametersDialog extends JDialog{
invokeParameterMethod();
}
});
-
+
jPnlBottomCenter.add(jOKButton);
addGapPanel(jPnlBottomCenter);
jPnlBottomCenter.add(jInvokeButton);
@@ -327,18 +327,18 @@ public class MethodParametersDialog extends JDialog{
dispose();
}
});
-
+
jPnlBottomCenter.add(jCancelButton);
add(jPnlBottomCenter);
}
}
-
-
+
+
public void addActionListener(ActionListener _oActionListener){
oActionListener = _oActionListener;
- jHelpButton.setEnabled(oActionListener != null);
+ jHelpButton.setEnabled(oActionListener != null);
}
-
+
public void invokeParameterMethod(){
try{
@@ -348,6 +348,6 @@ public class MethodParametersDialog extends JDialog{
} catch (Exception ex) {
insertResultPanel(ex);
m_oUnoReturnObject = null;
- }}
-
+ }}
+
}
diff --git a/odk/examples/java/Inspector/ObjectInspector.xcu b/odk/examples/java/Inspector/ObjectInspector.xcu
index 79459ab48f24..93c2711f2ec8 100755
--- a/odk/examples/java/Inspector/ObjectInspector.xcu
+++ b/odk/examples/java/Inspector/ObjectInspector.xcu
@@ -3,8 +3,8 @@
<!ENTITY ProductName "Object Inspector">
<!ENTITY ProductVersion "0.8">
]>
-<oor:component-data
- xmlns:oor="http://openoffice.org/2001/registry"
+<oor:component-data
+ xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
oor:name="ObjectInspector" oor:package="org.openoffice.inspector">
<prop oor:name="Language" oor:type="xs:string">
diff --git a/odk/examples/java/Inspector/ProtocolHandlerAddon.java b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
index ad3b0efe8747..2844d25e3def 100644
--- a/odk/examples/java/Inspector/ProtocolHandlerAddon.java
+++ b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.XComponentContext;
@@ -42,12 +42,12 @@ import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.uno.Type;
-import com.sun.star.frame.XStatusListener;
-import com.sun.star.frame.XDispatchProvider;
-import com.sun.star.frame.XDispatch;
-import com.sun.star.frame.XModel;
-import com.sun.star.frame.XFrame;
-import com.sun.star.frame.DispatchDescriptor;
+import com.sun.star.frame.XStatusListener;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.DispatchDescriptor;
import com.sun.star.awt.XToolkit;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.awt.XMessageBox;
@@ -62,14 +62,14 @@ public class ProtocolHandlerAddon {
*/
public static class ProtocolHandlerAddonImpl extends WeakBase implements
XDispatchProvider,
- XDispatch,
+ XDispatch,
XInitialization,
XServiceInfo {
/** The service name, that must be used to get an instance of this service.
*/
static private final String[] m_serviceNames = { "com.sun.star.frame.ProtocolHandler" };
-
+
/** The component context, that gives access to the service manager and all registered services.
*/
private XComponentContext m_xCmpCtx;
@@ -83,7 +83,7 @@ public class ProtocolHandlerAddon {
private XFrame m_xFrame;
private XStatusListener m_xStatusListener;
-
+
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
@@ -91,7 +91,7 @@ public class ProtocolHandlerAddon {
public ProtocolHandlerAddonImpl( XComponentContext xComponentContext ) {
m_xCmpCtx = xComponentContext;
}
-
+
/** This method is a member of the interface for initializing an object
* directly after its creation.
* @param object This array of arbitrary objects will be passed to the
@@ -114,7 +114,7 @@ public class ProtocolHandlerAddon {
m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
m_xCmpCtx));
}
-
+
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
@@ -125,7 +125,7 @@ public class ProtocolHandlerAddon {
public static String[] getServiceNames() {
return m_serviceNames;
}
-
+
/** This method returns true, if the given service will be
* supported by the component.
* @param stringService Service name.
@@ -133,22 +133,22 @@ public class ProtocolHandlerAddon {
*/
public boolean supportsService( String sService ) {
int len = m_serviceNames.length;
-
+
for( int i=0; i < len; i++) {
if ( sService.equals( m_serviceNames[i] ) )
return true;
}
-
+
return false;
}
-
+
/** Return the class name of the component.
* @return Class name of the component.
*/
public String getImplementationName() {
return ProtocolHandlerAddonImpl.class.getName();
}
-
+
// XDispatchProvider
public XDispatch queryDispatch( /*IN*/com.sun.star.util.URL aURL,
/*IN*/String sTargetFrameName,
@@ -164,23 +164,23 @@ public class ProtocolHandlerAddon {
}
return xRet;
}
-
+
public XDispatch[] queryDispatches( /*IN*/DispatchDescriptor[] seqDescripts ) {
int nCount = seqDescripts.length;
XDispatch[] lDispatcher = new XDispatch[nCount];
-
+
for( int i=0; i<nCount; ++i )
lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL,
seqDescripts[i].FrameName,
seqDescripts[i].SearchFlags );
-
- return lDispatcher;
+
+ return lDispatcher;
}
// XDispatch
public void dispatch( /*IN*/com.sun.star.util.URL aURL,
/*IN*/com.sun.star.beans.PropertyValue[] aArguments ) {
-
+
if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 )
{
if ( aURL.Path.compareTo( "Function1" ) == 0 )
@@ -197,11 +197,11 @@ public class ProtocolHandlerAddon {
}
}
}
-
+
public void addStatusListener( /*IN*/XStatusListener xControl,
/*IN*/com.sun.star.util.URL aURL ) {
}
-
+
public void removeStatusListener( /*IN*/XStatusListener xControl,
/*IN*/com.sun.star.util.URL aURL ) {
}
@@ -221,7 +221,7 @@ public class ProtocolHandlerAddon {
aDescriptor.WindowAttributes = WindowAttribute.BORDER |
WindowAttribute.MOVEABLE |
WindowAttribute.CLOSEABLE;
-
+
XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
if ( null != xPeer ) {
XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
@@ -235,12 +235,12 @@ public class ProtocolHandlerAddon {
}
}
} catch ( com.sun.star.uno.Exception e) {
- // do your error handling
+ // do your error handling
}
}
}
-
-
+
+
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
* <p>
@@ -256,14 +256,14 @@ public class ProtocolHandlerAddon {
*/
public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {
XSingleComponentFactory xFactory = null;
-
+
if ( sImplementationName.equals( ProtocolHandlerAddonImpl.class.getName() ) )
xFactory = Factory.createComponentFactory(ProtocolHandlerAddonImpl.class,
ProtocolHandlerAddonImpl.getServiceNames());
-
+
return xFactory;
}
-
+
/** Writes the service information into the given registry key.
* This method is called by the <code>JavaLoader</code>.
* @return returns true if the operation succeeded
diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java
index 6661fe9604ad..932854cd0d28 100644
--- a/odk/examples/java/Inspector/SourceCodeGenerator.java
+++ b/odk/examples/java/Inspector/SourceCodeGenerator.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.UnknownPropertyException;
@@ -60,12 +60,12 @@ public class SourceCodeGenerator {
private XLanguageSourceCodeGenerator m_xLanguageSourceCodeGenerator;
private String sHeaderCode = "";
private String sStatementCode = "";
- private String sMainMethodSignature = "";
-
+ private String sMainMethodSignature = "";
+
private Hashtable aVariables = new Hashtable();
private final String SSUFFIXSEPARATOR = "_";
private final String SVARIABLENAME = "VariableName";
- private final String SARRAYVARIABLENAME = "VariableNameList";
+ private final String SARRAYVARIABLENAME = "VariableNameList";
private final String SUNOOBJECTNAME = "oUnobject";
private final String SUNOSTRUCTNAME = "aUnoStruct";
private Introspector m_oIntrospector;
@@ -75,17 +75,17 @@ public class SourceCodeGenerator {
private boolean bXPropertySetExceptionsAreAdded = false;
private XUnoNode oInitialUnoNode = null;
private final String sINITIALVARIABLENAME = "_oUnoEntryObject";
-
-
+
+
/** Creates a new instance of SourceCodeGenerator */
public SourceCodeGenerator(int _nLanguage) {
this.setLanguage(_nLanguage);
m_oIntrospector = Introspector.getIntrospector();
}
-
+
public String addSourceCodeOfUnoObject(XTreePathProvider _xTreepathProvider, boolean _brememberPath, boolean _bAddMethodSignature, boolean _baddHeader){
- String sSourceCode = "";
+ String sSourceCode = "";
String sVariableName = "";
if (_xTreepathProvider != null) {
for (int i = 0; i < _xTreepathProvider.getPathCount(); i++){
@@ -106,7 +106,7 @@ public class SourceCodeGenerator {
sVariableName = oUnoReturnObjectDefinition.getVariableName();
}
}
- else if (oUnoNode instanceof XUnoPropertyNode){
+ else if (oUnoNode instanceof XUnoPropertyNode){
XUnoPropertyNode oUnoPropertyNode = (XUnoPropertyNode) oUnoNode;
Any oReturnObject = com.sun.star.uno.Any.complete(oUnoPropertyNode.getUnoReturnObject());
UnoObjectDefinition oUnoReturnObjectDefinition = new UnoObjectDefinition(oReturnObject);
@@ -118,7 +118,7 @@ public class SourceCodeGenerator {
}
}
}
- }
+ }
String sCompleteCode = combineCompleteSourceCode(sMainMethodSignature, _baddHeader);
xTreepathProvider = _xTreepathProvider;
if (_brememberPath){
@@ -126,10 +126,10 @@ public class SourceCodeGenerator {
}
return sCompleteCode;
}
-
-
+
+
private void setLanguage(int _nLanguage){
- XLanguageSourceCodeGenerator xLanguageSourceCodeGenerator = null;
+ XLanguageSourceCodeGenerator xLanguageSourceCodeGenerator = null;
switch(_nLanguage){
case XLanguageSourceCodeGenerator.nJAVA:
xLanguageSourceCodeGenerator = new JavaCodeGenerator();
@@ -147,15 +147,15 @@ public class SourceCodeGenerator {
m_xLanguageSourceCodeGenerator = xLanguageSourceCodeGenerator;
}
}
-
+
private void resetSourceCodeGeneration(int _nLanguage){
- aVariables.clear();
+ aVariables.clear();
this.sHeaderStatements.clear();
setLanguage(_nLanguage);
String sHeaderCode = "";
sStatementCode = "";
}
-
+
private String generateVariableNameFromMethod(String _sMethodName, String _sPrefix, boolean _bConsiderAll){
String sReturn = "";
if (_sMethodName.startsWith(_sPrefix)){
@@ -175,8 +175,8 @@ public class SourceCodeGenerator {
}
return sReturn;
}
-
-
+
+
private String generateVariableNameFromMethod(XIdlMethod _xIdlMethod){
// todo: refactor this!!!
String sMethodName = _xIdlMethod.getName();
@@ -208,18 +208,18 @@ public class SourceCodeGenerator {
}
return sReturn;
}
-
-
+
+
public String convertAllUnoObjects(int _nLanguage){
- String sSourceCode = "";
+ String sSourceCode = "";
resetSourceCodeGeneration(_nLanguage);
int ncount = aTreepathProviders.size();
for (int i=0; i< ncount; i++){
- sSourceCode = addSourceCodeOfUnoObject((XTreePathProvider) aTreepathProviders.get(i), false, (i==0), (i == (ncount-1)));
+ sSourceCode = addSourceCodeOfUnoObject((XTreePathProvider) aTreepathProviders.get(i), false, (i==0), (i == (ncount-1)));
}
return sSourceCode;
}
-
+
private UnoObjectDefinition getUnoObjectDefinition(XTreePathProvider _xTreePathProvider, XUnoMethodNode _oUnoMethodNode, int _nindex){
XUnoNode oUnoNode = null;
Object oUnoReturnObject = null;
@@ -250,12 +250,12 @@ public class SourceCodeGenerator {
}
return oUnoObjectDefinition;
}
-
-
+
+
private String combineCompleteSourceCode(String _sMethodSignature, boolean _bAddHeader){
String sCompleteCode = "";
if (_bAddHeader){
- sMainMethodSignature = m_xLanguageSourceCodeGenerator.getMainMethodSignatureSourceCode(oInitialUnoNode, sINITIALVARIABLENAME);
+ sMainMethodSignature = m_xLanguageSourceCodeGenerator.getMainMethodSignatureSourceCode(oInitialUnoNode, sINITIALVARIABLENAME);
m_xLanguageSourceCodeGenerator.assignqueryInterfaceHeaderSourceCode();
sCompleteCode += getHeaderSourceCode();
}
@@ -263,12 +263,12 @@ public class SourceCodeGenerator {
sCompleteCode += sStatementCode;
if (_bAddHeader){
sCompleteCode += m_xLanguageSourceCodeGenerator.getMethodTerminationSourceCode();
- sCompleteCode += "\n" + m_xLanguageSourceCodeGenerator.getCommentSign() + "...";
+ sCompleteCode += "\n" + m_xLanguageSourceCodeGenerator.getCommentSign() + "...";
}
return sCompleteCode;
}
-
+
public String getPropertyStatementSourceCode(XUnoPropertyNode _oUnoPropertyNode, String _sVariableName, UnoObjectDefinition _oUnoReturnObjectDefinition){
String sReturnObjectVariableDefinition = "";
String sStatement = "";
@@ -280,7 +280,7 @@ public class SourceCodeGenerator {
sReturnObjectVariableDefinition = getVariableInitialization(_oUnoReturnObjectDefinition, false);
sStatement += m_xLanguageSourceCodeGenerator.getStructSourceCode(sReturnObjectVariableDefinition, oUnoObjectDefinition.getVariableName(), sPropertyName);
return sStatement;
- }
+ }
}
sStatement += addQueryInterfaceSourceCode(oUnoObjectDefinition, _sVariableName, "com.sun.star.beans.XPropertySet");
if (_oUnoReturnObjectDefinition.getTypeClass().getValue() != TypeClass.VOID_value){
@@ -290,8 +290,8 @@ public class SourceCodeGenerator {
addXPropertySetRelatedExceptions();
return sStatement;
}
-
-
+
+
public String getMethodStatementSourceCode(XUnoMethodNode _oUnoMethodNode, String _sVariableName, UnoObjectDefinition _oUnoReturnObjectDefinition){
String sReturnObjectVariableDefinition = "";
String sStatement = "";
@@ -311,8 +311,8 @@ public class SourceCodeGenerator {
addExceptions(xIdlMethod);
return sStatement;
}
-
-
+
+
private String addQueryInterfaceSourceCode(UnoObjectDefinition _oUnoObjectDefinition, String _sVariableName, String _sTypeName){
String sLocStatement = "";
if (m_xLanguageSourceCodeGenerator.needsqueryInterface()){
@@ -321,13 +321,13 @@ public class SourceCodeGenerator {
sLocStatement += m_xLanguageSourceCodeGenerator.getqueryInterfaceSourceCode(_sTypeName, sObjectVariableDefinition, _sVariableName);
}
}
- else{
+ else{
_oUnoObjectDefinition.setVariableName(_sVariableName);
}
return sLocStatement;
}
-
-
+
+
private void addXPropertySetRelatedExceptions(){
if (!bXPropertySetExceptionsAreAdded){
sExceptions.add("com.sun.star.beans.UnknownPropertyException");
@@ -337,8 +337,8 @@ public class SourceCodeGenerator {
baddExceptionHandling = true;
}
}
-
-
+
+
private void addExceptions(XIdlMethod _xIdlMethod){
XIdlClass[] xIdlClasses = _xIdlMethod.getExceptionTypes();
for (int i = 0; i > xIdlClasses.length; i++){
@@ -346,12 +346,12 @@ public class SourceCodeGenerator {
baddExceptionHandling = true;
}
}
-
+
private String getRootDescription(XUnoNode _oUnoNode){
return "_o" + _oUnoNode.toString();
}
-
-
+
+
private String getHeaderSourceCode(){
Enumeration aEnumeration = aVariables.elements();
while(aEnumeration.hasMoreElements()){
@@ -369,10 +369,10 @@ public class SourceCodeGenerator {
sHeaderSourcecode += m_xLanguageSourceCodeGenerator.getFinalHeaderStatements();
return sHeaderSourcecode +"\n" + m_xLanguageSourceCodeGenerator.getCommentSign() + "...\n";
}
-
-
+
+
private class HeaderStatements extends Vector{
-
+
public boolean contains(Object _oElement){
String sCompName = (String) _oElement;
for (int i = 0; i < this.size(); i++){
@@ -383,8 +383,8 @@ public class SourceCodeGenerator {
}
return false;
}
-
-
+
+
public boolean add(Object _oElement){
if (_oElement instanceof String){
if (!contains(_oElement)){
@@ -394,9 +394,9 @@ public class SourceCodeGenerator {
}
return false;
}
- }
-
-
+ }
+
+
private boolean isVariableDeclared(UnoObjectDefinition _oUnoObjectDefinition, String _sDefaultStemName){
boolean bisDeclared = false;
if (!_sDefaultStemName.equals("")){
@@ -436,11 +436,11 @@ public class SourceCodeGenerator {
}
return bisDeclared;
}
-
-
+
+
private String addUniqueVariableName(String _sStemVariableName, UnoObjectDefinition _oUnoObjectDefinition){
boolean bElementexists = true;
- int a = 2;
+ int a = 2;
String sCompName = _sStemVariableName;
while (bElementexists){
if (! aVariables.containsKey(sCompName)){
@@ -452,9 +452,9 @@ public class SourceCodeGenerator {
return sCompName;
}
-
-
- private String getTypeString(String _sTypeName, TypeClass _aTypeClass, boolean _bAsHeaderSourceCode){
+
+
+ private String getTypeString(String _sTypeName, TypeClass _aTypeClass, boolean _bAsHeaderSourceCode){
String sTypeString = "";
switch (_aTypeClass.getValue()){
case TypeClass.BOOLEAN_value:
@@ -464,49 +464,49 @@ public class SourceCodeGenerator {
sTypeString = m_xLanguageSourceCodeGenerator.getbyteTypeDescription();
break;
case TypeClass.CHAR_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getcharTypeDescription();
+ sTypeString = m_xLanguageSourceCodeGenerator.getcharTypeDescription();
break;
case TypeClass.DOUBLE_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getdoubleTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getdoubleTypeDescription();
+ break;
case TypeClass.FLOAT_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getfloatTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getfloatTypeDescription();
+ break;
case TypeClass.HYPER_value:
- sTypeString = m_xLanguageSourceCodeGenerator.gethyperTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.gethyperTypeDescription();
+ break;
case TypeClass.LONG_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getlongTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getlongTypeDescription();
+ break;
case TypeClass.SHORT_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getshortTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getshortTypeDescription();
+ break;
case TypeClass.STRING_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getstringTypeDescription(_bAsHeaderSourceCode);
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getstringTypeDescription(_bAsHeaderSourceCode);
+ break;
case TypeClass.UNSIGNED_HYPER_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getunsignedhyperTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getunsignedhyperTypeDescription();
+ break;
case TypeClass.UNSIGNED_LONG_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getunsignedlongTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getunsignedlongTypeDescription();
+ break;
case TypeClass.UNSIGNED_SHORT_value:
- sTypeString = m_xLanguageSourceCodeGenerator.getdoubleTypeDescription();
- break;
+ sTypeString = m_xLanguageSourceCodeGenerator.getdoubleTypeDescription();
+ break;
case TypeClass.SEQUENCE_value:
//TODO consider mulitdimensional Arrays
XTypeDescription xTypeDescription = Introspector.getIntrospector().getReferencedType(_sTypeName);
if (xTypeDescription != null){
sTypeString = getTypeString(xTypeDescription.getName(), xTypeDescription.getTypeClass(), _bAsHeaderSourceCode);
}
- break;
+ break;
case TypeClass.ANY_value:
sTypeString = m_xLanguageSourceCodeGenerator.getanyTypeDescription(_bAsHeaderSourceCode);
break;
case TypeClass.TYPE_value:
sTypeString = m_xLanguageSourceCodeGenerator.getObjectTypeDescription("com.sun.star.uno.Type", _bAsHeaderSourceCode);
break;
- case TypeClass.ENUM_value:
+ case TypeClass.ENUM_value:
case TypeClass.STRUCT_value:
case TypeClass.INTERFACE_ATTRIBUTE_value:
case TypeClass.INTERFACE_METHOD_value:
@@ -514,14 +514,14 @@ public class SourceCodeGenerator {
case TypeClass.PROPERTY_value:
sTypeString = m_xLanguageSourceCodeGenerator.getObjectTypeDescription(_sTypeName, _bAsHeaderSourceCode);
break;
- default:
+ default:
}
return sTypeString;
- }
-
-
+ }
+
+
private String getVariableDeclaration(UnoObjectDefinition _oUnoObjectDefinition, boolean _bInitialize, String _sVariableDefaultName){
- TypeClass aTypeClass = _oUnoObjectDefinition.getTypeClass();
+ TypeClass aTypeClass = _oUnoObjectDefinition.getTypeClass();
TypeClass aLocTypeClass = aTypeClass;
boolean bIsArray = false;
if (_oUnoObjectDefinition.getUnoObject() != null){
@@ -543,8 +543,8 @@ public class SourceCodeGenerator {
addUniqueVariableName(sVariableName, _oUnoObjectDefinition);
return sVariableDeclaration;
}
-
-
+
+
public String getVariableInitialization(UnoObjectDefinition _oUnoObjectDefinition, boolean _bInitialize){
String sObjectVariableDeclaration = "";
String sVariableName = _oUnoObjectDefinition.getVariableName();
@@ -556,9 +556,9 @@ public class SourceCodeGenerator {
}
return sObjectVariableDeclaration;
}
-
-
-
+
+
+
public String getVariableNameforUnoObject(String _sShortClassName){
if (_sShortClassName.startsWith("X")){
return "x" + _sShortClassName.substring(1);
@@ -567,18 +567,18 @@ public class SourceCodeGenerator {
return _sShortClassName;
}
}
-
-
+
+
class UnoObjectDefinition{
Object m_oUnoObject = null;
Type aType = null;
- String sVariableStemName = "";
+ String sVariableStemName = "";
String m_sCentralVariableStemName = "";
String sVariableName = "";
String m_sTypeName = "";
TypeClass m_aTypeClass = null;
Object[] m_oParameterObjects = null;
-
+
public UnoObjectDefinition(Any _oUnoObject){
m_sTypeName = _oUnoObject.getType().getTypeName();
@@ -586,8 +586,8 @@ class UnoObjectDefinition{
m_oUnoObject = _oUnoObject;
m_sCentralVariableStemName = getCentralVariableStemName(m_aTypeClass);
}
-
-
+
+
public UnoObjectDefinition(Object _oUnoObject, String _sTypeName, TypeClass _aTypeClass){
m_oUnoObject = _oUnoObject;
m_sTypeName = _sTypeName;
@@ -595,15 +595,15 @@ class UnoObjectDefinition{
m_sCentralVariableStemName = getCentralVariableStemName(m_aTypeClass);
}
-
+
public UnoObjectDefinition(Object _oUnoObject, String _sTypeName){
m_oUnoObject = _oUnoObject;
m_sTypeName = _sTypeName;
m_aTypeClass = AnyConverter.getType(_oUnoObject).getTypeClass();
m_sCentralVariableStemName = getCentralVariableStemName(m_aTypeClass);
}
-
-
+
+
private String getCentralVariableStemName(TypeClass _aTypeClass){
String sCentralVariableStemName = "";
int nTypeClass = _aTypeClass.getValue();
@@ -614,7 +614,7 @@ class UnoObjectDefinition{
if (xTypeDescription != null){
sCentralVariableStemName = getCentralVariableStemName(xTypeDescription.getTypeClass());
}
- break;
+ break;
case TypeClass.TYPE_value:
sCentralVariableStemName = SVARIABLENAME;
break;
@@ -627,64 +627,64 @@ class UnoObjectDefinition{
case TypeClass.PROPERTY_value:
String sShortClassName = m_oIntrospector.getShortClassName(getTypeName());
sCentralVariableStemName = getVariableNameforUnoObject(sShortClassName);
- default:
+ default:
sCentralVariableStemName = SVARIABLENAME;
- }
+ }
return sCentralVariableStemName;
}
-
+
/** may return null
*/
public Object getUnoObject(){
return m_oUnoObject;
}
-
+
public void setTypeClass(TypeClass _aTypeClass){
sVariableStemName = "";
m_aTypeClass = _aTypeClass;
}
-
-
+
+
public TypeClass getTypeClass(){
return m_aTypeClass;
}
-
-
+
+
public void setTypeName(String _sTypeName){
sVariableStemName = "";
m_sTypeName = _sTypeName;
- }
-
-
+ }
+
+
public String getTypeName(){
return m_sTypeName;
- }
-
-
+ }
+
+
public void setCentralVariableStemName(String _sCentralVariableStemName){
m_sCentralVariableStemName = _sCentralVariableStemName;
}
-
-
+
+
public String getVariableStemName(){
if (sVariableStemName.equals("")){
sVariableStemName = getVariableStemName(m_aTypeClass);
}
return sVariableStemName;
}
-
-
+
+
public void addParameterObjects(Object[] _oParameterObjects){
m_oParameterObjects = _oParameterObjects;
}
-
+
public Object[] getParameterObjects(){
return m_oParameterObjects;
}
-
+
public boolean hasParameterObjects(){
boolean breturn = false;
if (m_oParameterObjects != null){
@@ -692,8 +692,8 @@ class UnoObjectDefinition{
}
return breturn;
}
-
-
+
+
public String getVariableStemName(TypeClass _aTypeClass){
int nTypeClass = _aTypeClass.getValue();
switch(nTypeClass){
@@ -703,7 +703,7 @@ class UnoObjectDefinition{
case TypeClass.DOUBLE_value:
case TypeClass.FLOAT_value:
sVariableStemName = "f" + m_sCentralVariableStemName;
- break;
+ break;
case TypeClass.BYTE_value:
case TypeClass.HYPER_value:
case TypeClass.LONG_value:
@@ -712,18 +712,18 @@ class UnoObjectDefinition{
case TypeClass.UNSIGNED_SHORT_value:
case TypeClass.SHORT_value:
sVariableStemName = "n" + m_sCentralVariableStemName;
- break;
+ break;
case TypeClass.CHAR_value:
case TypeClass.STRING_value:
sVariableStemName = "s" + m_sCentralVariableStemName;
- break;
+ break;
case TypeClass.SEQUENCE_value:
//TODO consider mulitdimensional Arrays
XTypeDescription xTypeDescription = Introspector.getIntrospector().getReferencedType(getTypeName());
if (xTypeDescription != null){
sVariableStemName = getVariableStemName(xTypeDescription.getTypeClass());
}
- break;
+ break;
case TypeClass.TYPE_value:
sVariableStemName = "a" + m_sCentralVariableStemName;
break;
@@ -731,7 +731,7 @@ class UnoObjectDefinition{
sVariableStemName = "o" + m_sCentralVariableStemName;
break;
case TypeClass.STRUCT_value:
- case TypeClass.ENUM_value:
+ case TypeClass.ENUM_value:
sVariableStemName = "a" + m_sCentralVariableStemName;
break;
case TypeClass.INTERFACE_ATTRIBUTE_value:
@@ -740,35 +740,35 @@ class UnoObjectDefinition{
case TypeClass.PROPERTY_value:
String sShortClassName = m_oIntrospector.getShortClassName(getTypeName());
sVariableStemName = getVariableNameforUnoObject(sShortClassName);
- default:
- }
+ default:
+ }
return sVariableStemName;
}
-
-
+
+
private void setVariableName(String _sVariableName){
sVariableName = _sVariableName;
}
-
-
+
+
private String getVariableName(String _sCentralVariableStemName){
if (!_sCentralVariableStemName.equals("")){
this.m_sCentralVariableStemName = _sCentralVariableStemName;
}
return getVariableName();
}
-
-
+
+
private String getVariableName() throws NullPointerException{
if (sVariableName.equals("")){
- int a = 2;
+ int a = 2;
sVariableName = getVariableStemName();
boolean bleaveloop = false;
while (!bleaveloop){
if (aVariables.containsKey(sVariableName)){
String sUnoObjectIdentity = ((UnoObjectDefinition) aVariables.get(sVariableName)).getUnoObject().toString();
if (m_oUnoObject != null){
- if ((sUnoObjectIdentity.equals(m_oUnoObject.toString()) && (!m_oIntrospector.isPrimitive(this.getTypeClass())) &&
+ if ((sUnoObjectIdentity.equals(m_oUnoObject.toString()) && (!m_oIntrospector.isPrimitive(this.getTypeClass())) &&
(! m_oIntrospector.isObjectSequence(m_oUnoObject)))){
bleaveloop = true;
}
@@ -789,8 +789,8 @@ class UnoObjectDefinition{
return sVariableName;
}
}
-
-
+
+
public String getStringValueOfObject(Object _oUnoObject, TypeClass _aTypeClass){
String sReturn = "";
switch (_aTypeClass.getValue()){
@@ -836,13 +836,13 @@ class UnoObjectDefinition{
nshortValue = ((Short) _oUnoObject).shortValue();
sReturn += Short.toString(nshortValue);
break;
- default:
+ default:
System.out.println("Type " + _aTypeClass.getValue() + " not yet defined in 'getStringValueOfObject()'");
- }
+ }
return sReturn;
}
-
-
+
+
public String getMethodParameterValueDescription(XUnoMethodNode _oUnoMethodNode, Object[] _oParamObjects, boolean _bIncludeParameterNames){
String sParamSourceCode = "";
ParamInfo[] aParamInfos = _oUnoMethodNode.getXIdlMethod().getParameterInfos();
@@ -855,7 +855,7 @@ class UnoObjectDefinition{
String sParamDescription = getStringValueOfObject(_oParamObjects[i], aTypeClass);
sParamDescription = this.m_xLanguageSourceCodeGenerator.castLiteral(sParamDescription, aTypeClass);
sParamSourceCode += sParamDescription;
-
+
if (i < _oParamObjects.length - 1){
sParamSourceCode += ", ";
}
@@ -863,33 +863,33 @@ class UnoObjectDefinition{
}
return sParamSourceCode;
}
-
-
+
+
public class JavaCodeGenerator implements XLanguageSourceCodeGenerator{
String sStatementsCode = "";
boolean bAddAnyConverter = false;
// boolean bAddTypeImport = false;
boolean bIsPropertyUnoObjectDefined = false;
-
+
public JavaCodeGenerator(){
}
-
-
+
+
public String getStatementTerminationCharacter(){
return ";";
}
-
-
+
+
public String getHeaderSourceCode(Object _oUnoObject, String _sClassName, TypeClass _aTypeClass){
String sClassName = _sClassName;
String sHeaderStatement = "";
if (_oUnoObject != null){
- if (!m_oIntrospector.isObjectPrimitive(_oUnoObject)){
+ if (!m_oIntrospector.isObjectPrimitive(_oUnoObject)){
if (m_oIntrospector.isObjectSequence(_oUnoObject)){
XTypeDescription xTypeDescription = m_oIntrospector.getReferencedType(sClassName);
if (xTypeDescription != null){
if (!m_oIntrospector.isPrimitive(xTypeDescription.getTypeClass())){
- sClassName = getTypeString(xTypeDescription.getName(), xTypeDescription.getTypeClass(), true);
+ sClassName = getTypeString(xTypeDescription.getName(), xTypeDescription.getTypeClass(), true);
}
// primitive Types are not supposed to turn up in the import section...
else{
@@ -909,27 +909,27 @@ class UnoObjectDefinition{
}
if (!sClassName.equals("")){
sHeaderStatement = "import " + sClassName + ";\n";
- }
+ }
}
return sHeaderStatement;
}
-
-
+
+
public String getFinalHeaderStatements(){
return "";
}
-
-
+
+
public void assignqueryInterfaceHeaderSourceCode(){
sHeaderStatements.add("import com.sun.star.uno.UnoRuntime;\n");
sHeaderStatements.add("import com.sun.star.uno.XInterface;\n");
if (bAddAnyConverter){
sHeaderStatements.add("import com.sun.star.uno.AnyConverter;\n");
- }
+ }
}
-
-
-
+
+
+
public String getConvertedSourceCodeValueOfObject(String _sReturnVariableName, String _sObjectDescription, TypeClass _aTypeClass, String _sTypeName){
boolean bLocAddAnyConverter = true;
String sReturn = "";
@@ -964,7 +964,7 @@ class UnoObjectDefinition{
case TypeClass.SHORT_value:
sReturn = _sReturnVariableName + " = AnyConverter.toShort(" + _sObjectDescription + ")";
break;
- case TypeClass.UNSIGNED_SHORT_value:
+ case TypeClass.UNSIGNED_SHORT_value:
sReturn = _sReturnVariableName + " = AnyConverter.toUnsignedShort(" + _sObjectDescription + ")";
break;
case TypeClass.STRING_value:
@@ -988,12 +988,12 @@ class UnoObjectDefinition{
}
return sReturn;
}
-
-
+
+
public String getStructSourceCode(String _sReturnVariableDescription, String _sObjectDescription, String _sMember){
return "\t" + _sReturnVariableDescription + " = " + _sObjectDescription + "." + _sMember + ";";
}
-
+
public String getMainMethodSignatureSourceCode(XUnoNode _oUnoNode, String _soReturnObjectDescription){
//TODO try to use + _oUnoNode.getClassName() instead of the hack
String sReturn = "public void codesnippet(XInterface " + _soReturnObjectDescription + "){";
@@ -1005,18 +1005,18 @@ class UnoObjectDefinition{
public String getMethodSeparator(){
return ".";
- }
+ }
public boolean needsqueryInterface(){
return true;
}
-
+
public String getqueryInterfaceSourceCode(String _sClassName, String _sReturnVariableName, String _sIncomingObjectName){
String sShortClassName = m_oIntrospector.getShortClassName(_sClassName);
return "\t" + _sReturnVariableName + " = (" + sShortClassName + ") UnoRuntime.queryInterface(" + sShortClassName + ".class, " + _sIncomingObjectName + ");\n";
}
-
+
public String getPropertyValueGetterSourceCode(String _sPropertyName, String _sReturnVariableName, String _sIncomingObjectName, TypeClass _aTypeClass, String _sTypeName){
String sObjectDescription = _sIncomingObjectName + ".getPropertyValue(\"" + _sPropertyName + "\")";
String sReturn = getConvertedSourceCodeValueOfObject(_sReturnVariableName, sObjectDescription, _aTypeClass, _sTypeName);
@@ -1025,8 +1025,8 @@ class UnoObjectDefinition{
return sReturn;
// return "\t" + _sReturnVariableName + " = " + _sIncomingObjectName + ".getPropertyValue(\"" + _sPropertyName + "\");";
}
-
-
+
+
public String getObjectTypeDescription(String _sClassName, boolean _bAsHeader){
String sReturn = "";
if (_bAsHeader){
@@ -1037,8 +1037,8 @@ class UnoObjectDefinition{
}
return sReturn;
}
-
-
+
+
public String getMethodTerminationSourceCode(){
String sReturn = "";
int nIndex = 1;
@@ -1063,7 +1063,7 @@ class UnoObjectDefinition{
sReturn += "\n}";
return sReturn;
}
-
+
public String castLiteral(String _sExpression, TypeClass _aTypeClass){
String sReturn = "";
switch (_aTypeClass.getValue()){
@@ -1074,7 +1074,7 @@ class UnoObjectDefinition{
sReturn = "(byte) " + _sExpression;
break;
case TypeClass.CHAR_value:
- sReturn = "'" + _sExpression + "'";
+ sReturn = "'" + _sExpression + "'";
break;
case TypeClass.DOUBLE_value:
sReturn = "(double) " + _sExpression;
@@ -1097,56 +1097,56 @@ class UnoObjectDefinition{
sReturn = _sExpression;
break;
case TypeClass.ENUM_value:
- default:
- sReturn = _sExpression;
+ default:
+ sReturn = _sExpression;
System.out.println("Type " + _aTypeClass.getValue() + " not yet defined in 'castliteral()'");
- }
+ }
return sReturn;
}
-
-
+
+
public String getbooleanTypeDescription(){
- return "boolean";
+ return "boolean";
}
public String getbyteTypeDescription(){
- return "byte";
+ return "byte";
}
public String getshortTypeDescription(){
- return "short";
+ return "short";
}
public String getunsignedshortTypeDescription(){
- return "short";
+ return "short";
}
public String getlongTypeDescription(){
- return "int";
+ return "int";
}
public String getunsignedlongTypeDescription(){
- return "int";
+ return "int";
}
public String gethyperTypeDescription(){
- return "long";
+ return "long";
}
public String getunsignedhyperTypeDescription(){
- return "long";
+ return "long";
}
public String getfloatTypeDescription(){
- return "float";
+ return "float";
}
public String getdoubleTypeDescription(){
- return "double";
+ return "double";
}
public String getcharTypeDescription(){
- return "char";
+ return "char";
}
public String getstringTypeDescription(boolean _bAsHeaderSourceCode){
@@ -1154,7 +1154,7 @@ class UnoObjectDefinition{
return "";
}
else{
- return "String";
+ return "String";
}
}
@@ -1175,13 +1175,13 @@ class UnoObjectDefinition{
return "Object";
}
}
-
-
+
+
public String getStringValue(String _sValue){
return _sValue;
}
-
-
+
+
public String getVariableDeclaration(String _sTypeString, String _sVariableName, boolean _bIsArray, TypeClass _aTypeClass, boolean _bInitialize){
String sReturn = "";
if (_bIsArray){
@@ -1192,8 +1192,8 @@ class UnoObjectDefinition{
}
return sReturn;
}
-
-
+
+
public String getArrayDeclaration(String _sVariableDeclaration){
String sReturn = "";
String[] sDeclarations = _sVariableDeclaration.split(" ");
@@ -1208,28 +1208,28 @@ class UnoObjectDefinition{
}
return sReturn;
}
-
+
public String getCommentSign(){
return "//";
}
- }
-
-
+ }
+
+
public class BasicCodeGenerator implements XLanguageSourceCodeGenerator{
String sStatementsCode = "";
-
+
public BasicCodeGenerator(){
}
-
+
public String getHeaderSourceCode(Object _oUnoObject, String _sClassName, TypeClass _aTypeClass){
String sHeaderStatement = "";
return sHeaderStatement;
}
-
+
public String getFinalHeaderStatements(){
return "";
}
-
+
public String getMainMethodSignatureSourceCode(XUnoNode _oUnoNode, String _soReturnObjectDescription){
//TODO try to use + _oUnoNode.getClassName() instead of the hack
return "Sub Main(" + _soReturnObjectDescription + " as " + getanyTypeDescription(false) + ")";
@@ -1241,41 +1241,41 @@ class UnoObjectDefinition{
public void assignqueryInterfaceHeaderSourceCode(){
}
-
+
public String getMethodSeparator(){
return ".";
- }
-
-
+ }
+
+
public String getqueryInterfaceSourceCode(String _sClassName, String _sReturnVariableName, String _sIncomingObjectName){
return _sIncomingObjectName;
}
-
+
public String getPropertyValueGetterSourceCode(String _sPropertyName, String _sReturnVariableName, String _sIncomingObjectName, TypeClass _aTypeClass, String _sTypeName){
return "\t" + _sReturnVariableName + " = " + _sIncomingObjectName + "." + _sPropertyName;
}
-
-
- public String getStructSourceCode(String _sReturnVariableDescription, String _sObjectDescription, String _sMember){
+
+
+ public String getStructSourceCode(String _sReturnVariableDescription, String _sObjectDescription, String _sMember){
return getPropertyValueGetterSourceCode(_sMember, _sReturnVariableDescription, _sObjectDescription, null, "" );
- }
+ }
public String getConvertedSourceCodeValueOfObject(String _sReturnVariableName, String _sObjectDescription, TypeClass _aTypeClass, String _sTypeName){
- return _sReturnVariableName + " = " + _sObjectDescription;
+ return _sReturnVariableName + " = " + _sObjectDescription;
}
-
+
public String getObjectTypeDescription(String _sClassName, boolean _bAsHeader){
return "Object";
}
-
-
+
+
public String getMethodTerminationSourceCode(){
- return "\nEnd Sub\n";
+ return "\nEnd Sub\n";
}
-
+
public String castLiteral(String _sExpression, TypeClass _aTypeClass){
String sReturn = "";
switch (_aTypeClass.getValue()){
@@ -1296,57 +1296,57 @@ class UnoObjectDefinition{
sReturn = "\"" +_sExpression + "\"";
break;
case TypeClass.ENUM_value:
- default:
- sReturn = _sExpression;
+ default:
+ sReturn = _sExpression;
System.out.println("Type " + _aTypeClass.getValue() + " not yet defined in 'castliteral()'");
- }
+ }
return sReturn;
- }
-
-
-
+ }
+
+
+
public String getbooleanTypeDescription(){
- return "Boolean";
+ return "Boolean";
}
public String getbyteTypeDescription(){
- return "Integer";
+ return "Integer";
}
public String getshortTypeDescription(){
- return "Integer";
+ return "Integer";
}
public String getunsignedshortTypeDescription(){
- return "Integer";
+ return "Integer";
}
public String getlongTypeDescription(){
- return "Integer";
+ return "Integer";
}
public String getunsignedlongTypeDescription(){
- return "Long";
+ return "Long";
}
public String gethyperTypeDescription(){
- return "Long";
+ return "Long";
}
public String getunsignedhyperTypeDescription(){
- return "Long";
+ return "Long";
}
public String getfloatTypeDescription(){
- return "Double";
+ return "Double";
}
public String getdoubleTypeDescription(){
- return "Double";
+ return "Double";
}
public String getcharTypeDescription(){
- return "String";
+ return "String";
}
public String getstringTypeDescription(boolean _bAsHeaderSourceCode){
@@ -1354,7 +1354,7 @@ class UnoObjectDefinition{
return "";
}
else{
- return "String";
+ return "String";
}
}
@@ -1375,12 +1375,12 @@ class UnoObjectDefinition{
return "Object";
}
}
-
+
public String getStatementTerminationCharacter(){
return "";
}
-
-
+
+
public String getVariableDeclaration(String _sTypeString, String _sVariableName, boolean bIsArray, TypeClass _aTypeClass, boolean _bInitialize){
String sReturn = "";
if (bIsArray){
@@ -1392,12 +1392,12 @@ class UnoObjectDefinition{
return sReturn;
}
-
+
public String getStringValue(String _sValue){
return _sValue;
}
-
-
+
+
public String getArrayDeclaration(String _sVariableDeclaration){
String sReturn = "";
String[] sDeclarations = _sVariableDeclaration.split(" ");
@@ -1416,37 +1416,37 @@ class UnoObjectDefinition{
public String getCommentSign(){
return "'";
}
-
- }
+
+ }
public class CPlusPlusCodeGenerator implements XLanguageSourceCodeGenerator{
String sStatementsCode = "";
boolean bIncludeStringHeader = false;
boolean bIncludeAny = false;
boolean bIncludeSequenceHeader = false;
-
+
public CPlusPlusCodeGenerator(){
}
-
+
private String getCSSNameSpaceString(){
return "css";
}
-
+
public String getStatementTerminationCharacter(){
return ";";
}
-
-
+
+
public String getHeaderSourceCode(Object _oUnoObject, String _sClassName, TypeClass _aTypeClass){
String sClassName = _sClassName;
String sHeaderStatement = "";
if (_oUnoObject != null){
- if (!m_oIntrospector.isObjectPrimitive(_oUnoObject)){
+ if (!m_oIntrospector.isObjectPrimitive(_oUnoObject)){
if (m_oIntrospector.isObjectSequence(_oUnoObject)){
XTypeDescription xTypeDescription = m_oIntrospector.getReferencedType(sClassName);
if (xTypeDescription != null){
if (!m_oIntrospector.isPrimitive(xTypeDescription.getTypeClass())){
- sClassName = getTypeString(xTypeDescription.getName(), xTypeDescription.getTypeClass(), true);
+ sClassName = getTypeString(xTypeDescription.getName(), xTypeDescription.getTypeClass(), true);
}
// primitive Types are not supposed to turn up in the import section...
else{
@@ -1465,22 +1465,22 @@ class UnoObjectDefinition{
return sHeaderStatement;
}
-
-
+
+
public String getFinalHeaderStatements(){
String sReturn = "";
sReturn += "\nnamespace " + getCSSNameSpaceString() + " = com::sun::star;\n";
sReturn += "using namespace rtl;\n";
return sReturn;
}
-
-
+
+
private String getHeaderOfClass(String _sClassName){
return "#include \"" + _sClassName.replace('.', '/') + ".hpp\"\n"; // #include <com/sun/star/uno/XComponentContext.hpp>
}
+
-
-
+
public void assignqueryInterfaceHeaderSourceCode(){
sHeaderStatements.add("#include \"sal/config.h\"\n");
sHeaderStatements.add("#include \"sal/types.h\"\n");
@@ -1496,8 +1496,8 @@ class UnoObjectDefinition{
sHeaderStatements.add(getHeaderOfClass("com.sun.star.uno.Any"));
}
}
-
-
+
+
public String getMainMethodSignatureSourceCode(XUnoNode _oUnoNode, String _soReturnObjectDescription){
String sReturn = "";
sReturn = "void codesnippet(const " + getCSSNameSpaceString() + "::uno::Reference<" + getCSSNameSpaceString() + "::uno::XInterface>& " + _soReturnObjectDescription + " ){";
@@ -1514,10 +1514,10 @@ class UnoObjectDefinition{
sReturn += ", ";
}
sReturn += getObjectTypeDescription(sCurException, false);
-
+
}
}
-
+
}
sReturn += "{";
return sReturn;
@@ -1527,13 +1527,13 @@ class UnoObjectDefinition{
public boolean needsqueryInterface(){
return true;
}
-
-
+
+
public String getqueryInterfaceSourceCode(String _sClassName, String _sReturnVariableName, String _sIncomingObjectName){
return "\t" + _sReturnVariableName + "( " + _sIncomingObjectName + ", " + getCSSNameSpaceString() + "::uno::UNO_QUERY_THROW);\n";
}
-
-
+
+
public String getPropertyValueGetterSourceCode(String _sPropertyName, String _sReturnVariableName, String _sIncomingObjectName, TypeClass _aTypeClass, String _sTypeName){
String sFirstLine = "\t";
String sReturnVariableName = _sReturnVariableName;
@@ -1552,12 +1552,12 @@ class UnoObjectDefinition{
return sFirstLine + sSecondLine;
}
-
- public String getStructSourceCode(String _sReturnVariableDescription, String _sObjectDescription, String _sMember){
+
+ public String getStructSourceCode(String _sReturnVariableDescription, String _sObjectDescription, String _sMember){
return "\t" + _sReturnVariableDescription + " = " + _sObjectDescription + "->" + _sMember + ";";
}
-
-
+
+
public String getConvertedSourceCodeValueOfObject(String _sReturnVariableName, String _sObjectDescription, TypeClass _aTypeClass, String _sTypeName){
// if (m_oIntrospector.isPrimitive(_aTypeClass)){
return _sObjectDescription + " >>= " + _sReturnVariableName;
@@ -1565,15 +1565,15 @@ class UnoObjectDefinition{
// else{
// return _sReturnVariableName + " = " + _sObjectDescription;
// }
- }
-
-
+ }
+
+
public String getStringValue(String _sValue){
bIncludeStringHeader = true;
return "OUString(RTL_CONSTASCII_USTRINGPARAM(\"" + _sValue + "\"))";
}
-
-
+
+
public String getObjectTypeDescription(String _sClassName, boolean _bAsHeader){
String sReturn = "";
if (_bAsHeader){
@@ -1586,17 +1586,17 @@ class UnoObjectDefinition{
}
return sReturn;
}
-
-
+
+
public String getMethodTerminationSourceCode(){
- return "\n}";
+ return "\n}";
}
-
+
public String getMethodSeparator(){
return "->";
- }
-
-
+ }
+
+
public String castLiteral(String _sExpression, TypeClass _aTypeClass){
String sReturn = "";
switch (_aTypeClass.getValue()){
@@ -1619,55 +1619,55 @@ class UnoObjectDefinition{
sReturn = getStringValue(_sExpression);
break;
case TypeClass.ENUM_value:
- default:
- sReturn = _sExpression;
+ default:
+ sReturn = _sExpression;
System.out.println("Type " + _aTypeClass.getValue() + " not yet defined in 'castliteral()'");
- }
+ }
return sReturn;
- }
-
+ }
+
public String getbooleanTypeDescription(){
- return "sal_Bool";
+ return "sal_Bool";
}
public String getbyteTypeDescription(){
- return "sal_Int8";
+ return "sal_Int8";
}
public String getshortTypeDescription(){
- return "sal_Int16";
+ return "sal_Int16";
}
public String getunsignedshortTypeDescription(){
- return "sal_uInt16";
+ return "sal_uInt16";
}
public String getlongTypeDescription(){
- return "sal_Int32";
+ return "sal_Int32";
}
public String getunsignedlongTypeDescription(){
- return "sal_uInt32";
+ return "sal_uInt32";
}
public String gethyperTypeDescription(){
- return "sal_Int64";
+ return "sal_Int64";
}
public String getunsignedhyperTypeDescription(){
- return "sal_uInt64";
+ return "sal_uInt64";
}
public String getfloatTypeDescription(){
- return "float";
+ return "float";
}
public String getdoubleTypeDescription(){
- return "double";
+ return "double";
}
public String getcharTypeDescription(){
- return "sal_Unicode";
+ return "sal_Unicode";
}
public String getstringTypeDescription(boolean _bAsHeaderSourceCode){
@@ -1676,7 +1676,7 @@ class UnoObjectDefinition{
return "";
}
else{
- return "OUString";
+ return "OUString";
}
}
@@ -1685,7 +1685,7 @@ class UnoObjectDefinition{
return "com/sun/star/uno/Type";
}
else{
- return "Type";
+ return "Type";
}
}
@@ -1697,8 +1697,8 @@ class UnoObjectDefinition{
return "XInterface";
}
}
-
-
+
+
public String getVariableDeclaration(String _sTypeString, String _sVariableName, boolean bIsArray, TypeClass _aTypeClass, boolean _bInitialize){
boolean bIsPrimitive = m_oIntrospector.isPrimitive(_aTypeClass);
@@ -1706,7 +1706,7 @@ class UnoObjectDefinition{
String sReturn = "";
if (bIsArray){
bIncludeSequenceHeader = true;
- sReturn = getCSSNameSpaceString() + "::uno::Sequence<" + _sTypeString + "> " + _sVariableName;
+ sReturn = getCSSNameSpaceString() + "::uno::Sequence<" + _sTypeString + "> " + _sVariableName;
}
else{
if (bIsPrimitive){
@@ -1735,10 +1735,10 @@ class UnoObjectDefinition{
case TypeClass.STRING_value:
sReturn = _sTypeString + " " + _sVariableName;
break;
- default:
+ default:
sReturn = _sTypeString + " " + _sVariableName;
System.out.println("Type " + _aTypeClass.getValue() + " not yet defined in 'getVariableDeclaration()'");
- }
+ }
}
}
else{
@@ -1747,20 +1747,20 @@ class UnoObjectDefinition{
}
return sReturn;
}
-
+
public String getArrayDeclaration(String _sVariableDeclaration){
this.bIncludeSequenceHeader = true;
String sReturn = "";
String[] sDeclarations = _sVariableDeclaration.split(" ");
if (sDeclarations.length == 2){
- sReturn = getCSSNameSpaceString() +"::uno::Sequence<" + sDeclarations[1] + ">";
+ sReturn = getCSSNameSpaceString() +"::uno::Sequence<" + sDeclarations[1] + ">";
}
return sReturn;
}
-
+
public String getCommentSign(){
return "//";
}
-
- }
+
+ }
}
diff --git a/odk/examples/java/Inspector/SwingDialogProvider.java b/odk/examples/java/Inspector/SwingDialogProvider.java
index 59a35726e11e..7b85070c2491 100644
--- a/odk/examples/java/Inspector/SwingDialogProvider.java
+++ b/odk/examples/java/Inspector/SwingDialogProvider.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.XComponentContext;
@@ -64,8 +64,8 @@ public class SwingDialogProvider implements XDialogProvider{
private Inspector._Inspector m_oInspector;
private JDialog m_jInspectorDialog = new JDialog();
private JTabbedPane m_jTabbedPane1 = new JTabbedPane();
- private Container cp;
-
+ private Container cp;
+
private JMenu jMnuOptions = new JMenu("Options");
private JRadioButtonMenuItem jJavaMenuItem = null;
private JRadioButtonMenuItem jCPlusPlusMenuItem = null;
@@ -74,31 +74,31 @@ public class SwingDialogProvider implements XDialogProvider{
/** Creates a new instance of SwingPopupMentuProvider */
public SwingDialogProvider(Inspector._Inspector _oInspector, String _sTitle) {
m_oInspector = _oInspector;
- m_xComponentContext = _oInspector.getXComponentContext();
- insertMenus();
- initializePopupMenu();
+ m_xComponentContext = _oInspector.getXComponentContext();
+ insertMenus();
+ initializePopupMenu();
cp = m_jInspectorDialog.getContentPane();
cp.setLayout(new java.awt.BorderLayout(0, 10));
- m_jTabbedPane1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+ m_jTabbedPane1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
m_jInspectorDialog.addWindowListener(new InspectorWindowAdapter());
m_jInspectorDialog.addComponentListener(new InspectorComponentAdapter());
m_jInspectorDialog.setTitle(_sTitle);
m_jInspectorDialog.setLocation(100, 50);
- m_jInspectorDialog.getContentPane().add(m_jTabbedPane1);
+ m_jInspectorDialog.getContentPane().add(m_jTabbedPane1);
}
-
-
-
+
+
+
public JDialog getDialog(){
return m_jInspectorDialog;
}
-
+
public void addMenuBar(JMenuBar _jMenuBar){
- getDialog().setJMenuBar(_jMenuBar);
+ getDialog().setJMenuBar(_jMenuBar);
}
-
-
+
+
public void removeTabPaneByIndex(int _nIndex){
if (_nIndex > -1){
String sSelInspectorPanelTitle = m_jTabbedPane1.getTitleAt(_nIndex);
@@ -107,28 +107,28 @@ public class SwingDialogProvider implements XDialogProvider{
}
}
-
+
public void selectInspectorPageByIndex(int nTabIndex){
m_jTabbedPane1.setSelectedIndex(nTabIndex);
}
-
-
+
+
public int getInspectorPageCount(){
return m_jTabbedPane1.getTabCount();
}
-
-
+
+
public JTabbedPane getTabbedPane(){
return m_jTabbedPane1;
}
-
-
+
+
public InspectorPane getSelectedInspectorPage(){
int nIndex = m_jTabbedPane1.getSelectedIndex();
return getInspectorPage(nIndex);
}
-
-
+
+
public InspectorPane getInspectorPage(int _nIndex){
InspectorPane oInspectorPane = null;
if (_nIndex > -1){
@@ -138,8 +138,8 @@ public class SwingDialogProvider implements XDialogProvider{
}
return oInspectorPane;
}
-
-
+
+
public void removeTabPanes(){
int nCount = m_jTabbedPane1.getTabCount();
if (nCount > 0){
@@ -148,13 +148,13 @@ public class SwingDialogProvider implements XDialogProvider{
}
}
}
-
+
public void removeSelectedTabPane(){
int nIndex = getTabbedPane().getSelectedIndex();
removeTabPaneByIndex(nIndex);
}
-
-
+
+
private class InspectorComponentAdapter extends ComponentAdapter{
public void componentHidden(ComponentEvent e){
m_jInspectorDialog.pack();
@@ -165,23 +165,23 @@ public class SwingDialogProvider implements XDialogProvider{
public void componentShown(ComponentEvent e){
m_jInspectorDialog.pack();
m_jInspectorDialog.invalidate();
- }
+ }
}
-
+
private class InspectorWindowAdapter extends WindowAdapter{
public void windowClosed(WindowEvent e){
removeTabPanes();
m_oInspector.disposeHiddenDocuments();
}
-
+
public void windowClosing(WindowEvent e){
removeTabPanes();
m_oInspector.disposeHiddenDocuments();
}
- }
-
-
-
+ }
+
+
+
private void initializePopupMenu(){
m_jPopupMenu.add(getInspectMenuItem("Inspect"));
m_jPopupMenu.add(getSourceCodeMenuItem(SADDTOSOURCECODE));
@@ -189,8 +189,8 @@ public class SwingDialogProvider implements XDialogProvider{
m_jPopupMenu.addSeparator();
m_jPopupMenu.add(getHelpMenuItem("Help"));
}
-
-
+
+
private void addOpenDocumentMenu(JMenu _jMnuRoot){
ActionListener oActionListener = new ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -215,7 +215,7 @@ public class SwingDialogProvider implements XDialogProvider{
};
String[][] sApplUrls = m_oInspector.getApplicationUrls();
for (int i = 0; i < sApplUrls.length; i++){
- addSingleMenuItem(_jMnuRoot, sApplUrls[i][1], sApplUrls[i][0], oActionListener);
+ addSingleMenuItem(_jMnuRoot, sApplUrls[i][1], sApplUrls[i][0], oActionListener);
}
}
@@ -226,14 +226,14 @@ public class SwingDialogProvider implements XDialogProvider{
jMnuItemOpenDoc.addActionListener(_oActionListener);
_jMnuOpenDocs.add(jMnuItemOpenDoc);
}
-
-
+
+
private void addHelpMenu(JMenuBar _jInspectMenuBar){
JMenu jMnuHelp = new JMenu("Help");
jMnuHelp.add(getHelpMenuItem("Idl-Help"));
_jInspectMenuBar.add(jMnuHelp);
}
-
+
private JMenuItem getHelpMenuItem(String _sMenuTitle){
JMenuItem jMnuHelpItem = new JMenuItem(_sMenuTitle);
@@ -241,31 +241,31 @@ public class SwingDialogProvider implements XDialogProvider{
jMnuHelpItem.setMnemonic('H');
jMnuHelpItem.addActionListener(new ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt) {
- m_oInspector.openIdlFileforSelectedNode();
+ m_oInspector.openIdlFileforSelectedNode();
}
- });
+ });
return jMnuHelpItem;
}
-
+
private void addFileMenu(JMenuBar _jInspectMenuBar){
JMenu jMnuFile = new JMenu("File");
- JMenuItem jMnuItemRemoveInspector = new JMenuItem("Remove");
+ JMenuItem jMnuItemRemoveInspector = new JMenuItem("Remove");
jMnuItemRemoveInspector.addActionListener(new ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt) {
removeSelectedTabPane();
}
});
jMnuFile.add(jMnuItemRemoveInspector);
- JMenuItem jMnuItemExit = new JMenuItem("Exit");
+ JMenuItem jMnuItemExit = new JMenuItem("Exit");
jMnuItemExit.addActionListener(new ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt) {
getDialog().dispose();
}
- });
- jMnuFile.add(jMnuItemExit);
+ });
+ jMnuFile.add(jMnuItemExit);
_jInspectMenuBar.add(jMnuFile);
}
-
+
private JMenuItem getInspectMenuItem(String _sLabel){
JMenuItem jMnuSelectedObject = new JMenuItem(_sLabel);
jMnuSelectedObject.addActionListener(new ActionListener(){
@@ -275,8 +275,8 @@ public class SwingDialogProvider implements XDialogProvider{
});
return jMnuSelectedObject;
}
-
-
+
+
private JMenuItem getSourceCodeMenuItem(String _sLabel){
JMenuItem jMnuSelectedObject = new JMenuItem(_sLabel);
jMnuSelectedObject.addActionListener(new ActionListener(){
@@ -286,7 +286,7 @@ public class SwingDialogProvider implements XDialogProvider{
});
return jMnuSelectedObject;
}
-
+
private JMenuItem getInvokeMenuItem(String _sLabel){
JMenuItem jMnuSelectedObject = new JMenuItem(_sLabel);
jMnuSelectedObject.addActionListener(new ActionListener(){
@@ -296,25 +296,25 @@ public class SwingDialogProvider implements XDialogProvider{
});
return jMnuSelectedObject;
}
-
-
+
+
private void addInspectMenu(JMenuBar _jInspectMenuBar){
JMenu jMnuInspect = new JMenu("Inspect");
addApplicationDocumentMenu(jMnuInspect);
jMnuInspect.addSeparator();
addGlobalServiceManagerMenu(jMnuInspect);
jMnuInspect.addSeparator();
- jMnuInspect.add(getInspectMenuItem("Selected Object"));
+ jMnuInspect.add(getInspectMenuItem("Selected Object"));
jMnuInspect.addSeparator();
- addOpenDocumentMenu(jMnuInspect);
- _jInspectMenuBar.add(jMnuInspect);
+ addOpenDocumentMenu(jMnuInspect);
+ _jInspectMenuBar.add(jMnuInspect);
}
public int getLanguage(){
return XLanguageSourceCodeGenerator.nJAVA;
}
-
-
+
+
public void selectSourceCodeLanguage(int _nLanguage){
switch (_nLanguage){
case XLanguageSourceCodeGenerator.nJAVA:
@@ -332,7 +332,7 @@ public class SwingDialogProvider implements XDialogProvider{
}
private JRadioButtonMenuItem addLanguageMenuItem(ButtonGroup _group, String _sLanguageTitle, boolean _bSelect, char _sMnemonic, final int _nLanguage){
- JRadioButtonMenuItem jMenuItem = new JRadioButtonMenuItem(_sLanguageTitle, _bSelect);
+ JRadioButtonMenuItem jMenuItem = new JRadioButtonMenuItem(_sLanguageTitle, _bSelect);
jMenuItem.setMnemonic(_sMnemonic);
_group.add(jMenuItem);
jMenuItem.addActionListener(new ActionListener(){
@@ -342,19 +342,19 @@ public class SwingDialogProvider implements XDialogProvider{
});
return jMenuItem;
}
-
-
+
+
public String getIDLPath(){
return this.m_oInspector.getIDLPath();
}
-
+
private void addOptionsMenu(JMenuBar _jInspectMenuBar){
ButtonGroup oButtonGroup = new ButtonGroup();
jJavaMenuItem = addLanguageMenuItem(oButtonGroup, "Generate Java Sourcecode", true, 'J', XLanguageSourceCodeGenerator.nJAVA);
jMnuOptions.add(jJavaMenuItem);
jCPlusPlusMenuItem = addLanguageMenuItem(oButtonGroup, "Generate C++ Sourcecode", false, 'C', XLanguageSourceCodeGenerator.nCPLUSPLUS);
jMnuOptions.add(jCPlusPlusMenuItem);
- jBasicMenuItem = addLanguageMenuItem(oButtonGroup, "Generate OpenOffice.org Basic Sourcecode", false, 'B', XLanguageSourceCodeGenerator.nBASIC);
+ jBasicMenuItem = addLanguageMenuItem(oButtonGroup, "Generate OpenOffice.org Basic Sourcecode", false, 'B', XLanguageSourceCodeGenerator.nBASIC);
jMnuOptions.add(jBasicMenuItem);
jMnuOptions.addSeparator();
JMenuItem jMenuItem = new JMenuItem("Path to SDK-Installation");
@@ -364,12 +364,12 @@ public class SwingDialogProvider implements XDialogProvider{
m_oInspector.assignSDKPath();
}
});
-
+
jMnuOptions.add(jMenuItem);
- _jInspectMenuBar.add(jMnuOptions);
+ _jInspectMenuBar.add(jMnuOptions);
}
-
-
+
+
private void insertMenus(){
JMenuBar jMenuBar1 = new javax.swing.JMenuBar();
addFileMenu(jMenuBar1);
@@ -380,10 +380,10 @@ public class SwingDialogProvider implements XDialogProvider{
jMenuBar1.setFont(new java.awt.Font("Dialog", 0, 12));
jMenuBar1.add(jMnuEdit);
jMenuBar1.add(jMnuView);
- addHelpMenu(jMenuBar1);
+ addHelpMenu(jMenuBar1);
addMenuBar(jMenuBar1);
}
-
+
private void addGlobalServiceManagerMenu(JMenu _jMnuRoot){
JMenuItem jMnuGlobalServiceManager = new JMenuItem("Global Service Manager");
jMnuGlobalServiceManager.addActionListener(new ActionListener(){
@@ -394,8 +394,8 @@ public class SwingDialogProvider implements XDialogProvider{
_jMnuRoot.add(jMnuGlobalServiceManager);
}
-
-
+
+
public void enablePopupMenuItem(String _sMenuTitle, boolean _bdoEnable){
Component[] oComponents = m_jPopupMenu.getComponents();
for (int i = 0; i < oComponents.length; i++){
@@ -414,8 +414,8 @@ public class SwingDialogProvider implements XDialogProvider{
m_jPopupMenu.show((Component) _invoker, x, y);
}
}
-
-
+
+
public void show(int _nPageIndex){
Dimension aDimension = m_jInspectorDialog.getSize();
selectInspectorPageByIndex(_nPageIndex);
@@ -430,13 +430,13 @@ public class SwingDialogProvider implements XDialogProvider{
}
public void paint(){
- m_jTabbedPane1.paintImmediately(m_jTabbedPane1.getBounds());
+ m_jTabbedPane1.paintImmediately(m_jTabbedPane1.getBounds());
}
-
+
public void addInspectorPage(String _sTitle, Object _oContainer) throws ClassCastException{
if (_oContainer instanceof Component){
m_jTabbedPane1.addTab(_sTitle, (Component) _oContainer);
}
- }
+ }
}
diff --git a/odk/examples/java/Inspector/SwingTreeControlProvider.java b/odk/examples/java/Inspector/SwingTreeControlProvider.java
index 2405e8bc36ce..bf00acd77d0b 100644
--- a/odk/examples/java/Inspector/SwingTreeControlProvider.java
+++ b/odk/examples/java/Inspector/SwingTreeControlProvider.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.Property;
@@ -75,27 +75,27 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
private JLabel jLblPath = new JLabel("Generated source code");
private JProgressBar jProgressBar1 = new JProgressBar();
private JTree jTree = new javax.swing.JTree();
- private XDialogProvider m_xDialogProvider;
+ private XDialogProvider m_xDialogProvider;
private HideableTreeModel treeModel;
private UnoTreeRenderer oUnoTreeRenderer;
private InspectorPane m_oInspectorPane;
private Object oUserDefinedObject = null;
private boolean bIsUserDefined = false;
private SwingUnoNode oRootNode;
-
+
private final int nDIALOGWIDTH = 800;
-
-
-
+
+
+
public SwingTreeControlProvider(XDialogProvider _xDialogProvider){
- m_xDialogProvider = _xDialogProvider;
+ m_xDialogProvider = _xDialogProvider;
}
-
+
public void addInspectorPane(InspectorPane _oInspectorPane){
m_oInspectorPane = _oInspectorPane;
}
-
+
public InspectorPane getInspectorPane() throws NullPointerException{
if (m_oInspectorPane == null){
throw new NullPointerException("InspectorPage has not been added to TreeControl");
@@ -104,21 +104,21 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
return m_oInspectorPane;
}
}
-
+
private void ComponentSelector(Object _oRootObject, String _sRootTreeNodeName) {
String sTreeNodeName = _sRootTreeNodeName;
oRootNode = new SwingUnoNode(_oRootObject);
oRootNode.setLabel(_sRootTreeNodeName);
treeModel = new HideableTreeModel(oRootNode);
jTree.setModel(treeModel);
- jTree.setRootVisible(true);
+ jTree.setRootVisible(true);
jTree.setVisible(true);
oRootNode.setFoldable(true);
enableFilterElements(null);
}
-
-
+
+
private void insertTopPanel(JPanel _jPnlCenter){
javax.swing.JPanel jPnlTop = new javax.swing.JPanel(new BorderLayout(10, 10));
jPnlTop.setPreferredSize(new java.awt.Dimension(nDIALOGWIDTH, 20));
@@ -129,10 +129,10 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
jtxtFilter.setPreferredSize(new java.awt.Dimension(200, 10));
jtxtFilter.addKeyListener(new InspectorKeyFilterAdapter());
jPnlTop.add(jtxtFilter, java.awt.BorderLayout.CENTER);
- _jPnlCenter.add(jPnlTop, java.awt.BorderLayout.NORTH);
+ _jPnlCenter.add(jPnlTop, java.awt.BorderLayout.NORTH);
}
-
-
+
+
private void insertBottomPanel(JSplitPane _jSplitPane){ //JPanel _jPnlCenter){
jtxtGeneratedSourceCode.setTabSize(4);
jtxtGeneratedSourceCode.getAccessibleContext().setAccessibleName("generated SourceCode");
@@ -141,7 +141,7 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
jtxtGeneratedSourceCode.setEditable(false);
_jSplitPane.setBottomComponent(jScrollPane);
}
-
+
private void insertBorderPanes(Container _cp){
JPanel jPnlEast = new JPanel(new BorderLayout());
JPanel jPnlNorth = new JPanel(new BorderLayout());
@@ -154,9 +154,9 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
_cp.add(jPnlEast, java.awt.BorderLayout.EAST);
jPnlSouth.setPreferredSize(new java.awt.Dimension(10, 10));
_cp.add(jPnlSouth, java.awt.BorderLayout.SOUTH);
- }
-
-
+ }
+
+
public String enableFilterElements(XUnoNode _oUnoNode){
String sFilter ="";
boolean bIsFacetteNode = isFacetteNode(_oUnoNode);
@@ -166,8 +166,8 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
jtxtFilter.setText(sFilter);
return sFilter;
}
-
-
+
+
private class InspectorKeyFilterAdapter extends KeyAdapter{
public void keyReleased(KeyEvent e){
String sFilter = jtxtFilter.getText();
@@ -178,16 +178,16 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
}
}
}
-
-
-
+
+
+
/** Inspect the given object for methods, properties, interfaces, and
* services.
* @param a The object to inspect
* @throws RuntimeException If
*/
public Object inspect(java.lang.Object _oUserDefinedObject, String _sTitle) throws com.sun.star.uno.RuntimeException {
- JPanel jPnlContainer = new javax.swing.JPanel(new BorderLayout(10, 10));
+ JPanel jPnlContainer = new javax.swing.JPanel(new BorderLayout(10, 10));
try {
javax.swing.JPanel jPnlCenter = new javax.swing.JPanel();
bIsUserDefined = (_oUserDefinedObject != null);
@@ -197,7 +197,7 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
}
javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
TreeSelectionModel tsm = new DefaultTreeSelectionModel();
- tsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ tsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
jTree.setSelectionModel(tsm);
jTree.setVisible(false);
jPnlCenter.setLayout(new java.awt.BorderLayout(10, 10));
@@ -206,15 +206,15 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
jScrollPane1.setViewportView(jTree);
jScrollPane1.setPreferredSize(new java.awt.Dimension(600, 600));
jScrollPane1.getAccessibleContext().setAccessibleName("API view scroll pane");
-
+
JScrollBar jHScrollBar = jScrollPane1.createHorizontalScrollBar();
jHScrollBar.getAccessibleContext().setAccessibleName("API view horizontal scroll bar");
jScrollPane1.setHorizontalScrollBar(jHScrollBar);
-
+
JScrollBar jVScrollBar = jScrollPane1.createVerticalScrollBar();
jVScrollBar.getAccessibleContext().setAccessibleName("API view vertical scroll bar");
jScrollPane1.setVerticalScrollBar(jVScrollBar);
-
+
JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jSplitPane.setTopComponent(jScrollPane1);
jPnlCenter.add(jSplitPane, java.awt.BorderLayout.CENTER);
@@ -251,11 +251,11 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
}
//unfortunately under Windows the method "isPopupTrigger" always returns false
else if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK){
- m_oInspectorPane.showPopUpMenu(e.getComponent(), e.getX(), e.getY());
+ m_oInspectorPane.showPopUpMenu(e.getComponent(), e.getX(), e.getY());
}
}
});
- jPnlContainer.add(jPnlCenter, java.awt.BorderLayout.CENTER);
+ jPnlContainer.add(jPnlCenter, java.awt.BorderLayout.CENTER);
insertBorderPanes(jPnlContainer);
if (this.bIsUserDefined){
ComponentSelector(oUserDefinedObject, m_oInspectorPane.getTitle());
@@ -265,15 +265,15 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
}
catch( Exception exception ) {
exception.printStackTrace(System.out);
- }
+ }
return jPnlContainer;
}
-
+
public HideableTreeModel getModel(){
return treeModel;
}
-
-
+
+
public void addTreeExpandListener(){
jTree.addTreeWillExpandListener(
new TreeWillExpandListener() {
@@ -288,26 +288,26 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
public void treeWillCollapse( javax.swing.event.TreeExpansionEvent evt) throws javax.swing.tree.ExpandVetoException {
}
});
- }
-
-
+ }
+
+
public void setSourceCode(String _sSourceCode){
jtxtGeneratedSourceCode.setText(_sSourceCode);
}
-
-
+
+
public XTreePathProvider getSelectedPath(){
return new SwingTreePathProvider(jTree.getSelectionPath());
}
-
-
+
+
public void expandPath(XTreePathProvider _xTreePathProvider) throws ClassCastException{
SwingTreePathProvider oSwingTreePathProvider = (SwingTreePathProvider) _xTreePathProvider;
jTree.expandPath(oSwingTreePathProvider.getSwingTreePath());
}
-
-
- public XUnoNode getSelectedNode(){
+
+
+ public XUnoNode getSelectedNode(){
XUnoNode oUnoNode = null;
TreePath aTreePath = jTree.getSelectionPath();
Object oNode = aTreePath.getLastPathComponent();
@@ -317,27 +317,27 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
return oUnoNode;
}
-
+
public void nodeInserted(XUnoNode _oParentNode, XUnoNode _oChildNode, int index) {
getModel().nodeInserted(_oParentNode, _oChildNode, _oParentNode.getChildCount()-1);
- }
-
-
+ }
+
+
public void nodeChanged(XUnoNode _oNode) {
getModel().nodeChanged(_oNode);
}
-
-
- public boolean setNodeVisible(Object node, boolean v) {
+
+
+ public boolean setNodeVisible(Object node, boolean v) {
return getModel().setNodeVisible(node, v);
- }
-
+ }
+
public boolean isPropertyNode(XUnoNode _oUnoNode){
return (_oUnoNode instanceof SwingUnoPropertyNode);
}
-
+
public boolean isMethodNode(XUnoNode _oUnoNode){
return (_oUnoNode instanceof SwingUnoMethodNode);
}
@@ -345,19 +345,19 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
public boolean isFacetteNode(XUnoNode _oUnoNode){
return (_oUnoNode instanceof SwingUnoFacetteNode);
- }
-
+ }
+
public XUnoNode addUnoNode(Object _oUnoObject){
return new SwingUnoNode(_oUnoObject);
}
-
-
+
+
public XUnoNode addUnoNode(Object _oUnoObject, Type _aType){
return new SwingUnoNode(_oUnoObject, _aType);
}
-
-
+
+
public XUnoFacetteNode addUnoFacetteNode(XUnoNode _oParentNode, String _sNodeDescription, Object _oUnoObject){
SwingUnoFacetteNode oSwingUnoFacetteNode = new SwingUnoFacetteNode(_oUnoObject);
oSwingUnoFacetteNode.setLabel(_sNodeDescription);
@@ -367,34 +367,34 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
return oSwingUnoFacetteNode;
}
-
+
public XUnoMethodNode addMethodNode(Object _objectElement, XIdlMethod _xIdlMethod){
SwingUnoMethodNode oSwingUnoMethodNode = new SwingUnoMethodNode(_xIdlMethod, _objectElement, m_xDialogProvider);
return oSwingUnoMethodNode;
}
-
-
+
+
public XUnoPropertyNode addUnoPropertyNodeWithName(Property _aProperty){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty);
oUnoPropertyNode.setLabel("Name: " + _aProperty.Name);
return oUnoPropertyNode;
}
-
+
public XUnoPropertyNode addUnoPropertyNodeWithHandle(Property _aProperty){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty);
oUnoPropertyNode.setLabel("Handle: " + _aProperty.Handle);
return oUnoPropertyNode;
}
-
+
public XUnoPropertyNode addUnoPropertyNodeWithType(Property _aProperty){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty);
oUnoPropertyNode.setLabel("Type: " + _aProperty.Type.getTypeName());
return oUnoPropertyNode;
}
-
-
+
+
public XUnoPropertyNode addUnoPropertyNodeWithAttributesDescription(Property _aProperty){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty);
XConstantTypeDescription[] xPropertyAttributesTypeDescriptions = Introspector.getIntrospector().getFieldsOfConstantGroup("com.sun.star.beans.PropertyAttribute");
@@ -402,22 +402,22 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
oUnoPropertyNode.setLabel(sDisplay);
return oUnoPropertyNode;
}
-
-
+
+
public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, Property _aProperty){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty, _oUnoObject, null);
oUnoPropertyNode.setPropertyNodeType(XUnoPropertyNode.nPROPERTYSETINFOTYPE);
oUnoPropertyNode.setLabel(UnoPropertyNode.getStandardPropertyDescription(_aProperty, null));
return oUnoPropertyNode;
}
-
-
+
+
public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, Property _aProperty, Object _oUnoReturnObject){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty, _oUnoObject, _oUnoReturnObject);
oUnoPropertyNode.setLabel(UnoPropertyNode.getStandardPropertyDescription(_aProperty, _oUnoReturnObject));
return oUnoPropertyNode;
}
-
+
public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, PropertyValue _aPropertyValue, Object _oReturnObject){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aPropertyValue, _oUnoObject, _oReturnObject);
diff --git a/odk/examples/java/Inspector/SwingTreePathProvider.java b/odk/examples/java/Inspector/SwingTreePathProvider.java
index 02829682bc50..37376c269b42 100644
--- a/odk/examples/java/Inspector/SwingTreePathProvider.java
+++ b/odk/examples/java/Inspector/SwingTreePathProvider.java
@@ -3,37 +3,37 @@ import javax.swing.tree.TreePath;
public class SwingTreePathProvider implements XTreePathProvider {
TreePath m_aTreePath;
-
+
/** Creates a new instance of TreePathProvider */
public SwingTreePathProvider(TreePath _aTreePath) {
m_aTreePath = _aTreePath;
}
-
-
+
+
public XUnoNode getLastPathComponent(){
return (XUnoNode) m_aTreePath.getLastPathComponent();
}
-
-
+
+
public XUnoNode getPathComponent(int i){
return (XUnoNode) m_aTreePath.getPathComponent(i);
}
-
+
public int getPathCount(){
return m_aTreePath.getPathCount();
}
-
-
+
+
public XTreePathProvider getParentPath(){
return new SwingTreePathProvider(m_aTreePath.getParentPath());
}
-
-
+
+
public XTreePathProvider pathByAddingChild(XUnoNode _oUnoNode){
TreePath aTreePath = m_aTreePath.pathByAddingChild(_oUnoNode);
return new SwingTreePathProvider(aTreePath);
}
-
+
public TreePath getSwingTreePath(){
return m_aTreePath;
}
diff --git a/odk/examples/java/Inspector/SwingUnoFacetteNode.java b/odk/examples/java/Inspector/SwingUnoFacetteNode.java
index 96374f1e5b9e..1fbc0f1acb93 100644
--- a/odk/examples/java/Inspector/SwingUnoFacetteNode.java
+++ b/odk/examples/java/Inspector/SwingUnoFacetteNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.reflection.XIdlMethod;
@@ -38,27 +38,27 @@ import com.sun.star.uno.XComponentContext;
import javax.swing.tree.DefaultMutableTreeNode;
public class SwingUnoFacetteNode extends SwingUnoNode implements XUnoFacetteNode{
- String m_sFilter = "";
-
+ String m_sFilter = "";
+
/** Creates a new instance of UnoMethodNode */
public SwingUnoFacetteNode(Object _oUnoObject){
super(_oUnoObject);
setFoldable(true);
}
-
-
+
+
public String getFilter(){
return m_sFilter;
}
-
+
public void setFilter(String _sFilter){
m_sFilter = _sFilter;
}
-
+
public String getName(){
return toString();
}
-
+
// TODO The implementation of the following methods is not really robust and should be changed!!!
public boolean isMethodNode(){
return ((String) getUserObject()).equals(SMETHODDESCRIPTION);
@@ -76,7 +76,7 @@ public class SwingUnoFacetteNode extends SwingUnoNode implements XUnoFacetteNode
public boolean isServiceNode(){
return ((String) getUserObject()).equals(SSERVICEDESCRIPTION);
}
-
+
public boolean isInterfaceNode(){
return ((String) getUserObject()).equals(SINTERFACEDESCRIPTION);
}
diff --git a/odk/examples/java/Inspector/SwingUnoMethodNode.java b/odk/examples/java/Inspector/SwingUnoMethodNode.java
index c01c6074b795..3487d430dfb5 100644
--- a/odk/examples/java/Inspector/SwingUnoMethodNode.java
+++ b/odk/examples/java/Inspector/SwingUnoMethodNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.reflection.XIdlMethod;
import com.sun.star.uno.TypeClass;
@@ -43,9 +43,9 @@ public class SwingUnoMethodNode extends SwingUnoNode implements ActionListener,
private UnoMethodNode m_oUnoMethodNode;
private XDialogProvider m_xDialogProvider = null;
-
+
public SwingUnoMethodNode(XIdlMethod _xIdlMethod, Object _oUnoObject, XDialogProvider _xDialogProvider) {
- super(_oUnoObject);
+ super(_oUnoObject);
m_oUnoMethodNode = new UnoMethodNode(_xIdlMethod, _oUnoObject, this);
m_xDialogProvider = _xDialogProvider;
setUserObject(m_oUnoMethodNode.getNodeDescription());
@@ -57,11 +57,11 @@ public class SwingUnoMethodNode extends SwingUnoNode implements ActionListener,
public boolean isFoldable(){
return m_oUnoMethodNode.isFoldable();
}
-
+
public String getName(){
return m_oUnoMethodNode.getName();
- }
-
+ }
+
public String getClassName(){
String sClassName = "";
sClassName = getXIdlMethod().getDeclaringClass().getName();
@@ -69,17 +69,17 @@ public class SwingUnoMethodNode extends SwingUnoNode implements ActionListener,
sClassName = super.getClassName();
}
return sClassName;
- }
-
+ }
+
public String getAnchor(){
return m_oUnoMethodNode.getAnchor();
}
-
+
public Object invoke(Object _oUnoObject, Object[] _oParameters) throws com.sun.star.uno.Exception{
return m_oUnoMethodNode.invoke(_oUnoObject, _oParameters);
}
-
-
+
+
public Object[] getLastParameterObjects(){
return m_oUnoMethodNode.getLastParameterObjects();
}
@@ -108,30 +108,30 @@ public class SwingUnoMethodNode extends SwingUnoNode implements ActionListener,
return m_oUnoMethodNode.isInvoked();
}
- public boolean isInvokable(){
+ public boolean isInvokable(){
return m_oUnoMethodNode.isInvokable();
}
-
+
public boolean isPrimitive() {
return m_oUnoMethodNode.isPrimitive();
}
-
+
public void actionPerformed(ActionEvent e){
openIdlDescription(m_xDialogProvider.getIDLPath());
}
-
+
public Vector getMethodObjects(){
MethodParametersDialog oMethodParametersDialog = new MethodParametersDialog(this);
oMethodParametersDialog.addActionListener(this);
- return oMethodParametersDialog.getMethodObjects();
+ return oMethodParametersDialog.getMethodObjects();
}
-
-
+
+
public String getParameterDescription(){
return m_oUnoMethodNode.getParameterDescription();
}
-
-
+
+
public String getStandardMethodDescription(){
return m_oUnoMethodNode.getStandardMethodDescription();
}
diff --git a/odk/examples/java/Inspector/SwingUnoNode.java b/odk/examples/java/Inspector/SwingUnoNode.java
index 19295cc4b4d0..14f23e94ad6d 100644
--- a/odk/examples/java/Inspector/SwingUnoNode.java
+++ b/odk/examples/java/Inspector/SwingUnoNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.Type;
import javax.swing.tree.TreeNode;
@@ -37,31 +37,31 @@ import javax.swing.tree.TreeNode;
public class SwingUnoNode extends HideableMutableTreeNode implements XUnoNode{
private UnoNode m_oUnoNode;
-
+
/** Creates a new instance of SwingUnoNode */
public SwingUnoNode(Object _oUnoObject) {
- super();
+ super();
m_oUnoNode = new UnoNode(_oUnoObject);
}
-
+
public SwingUnoNode(Object _oUnoObject, Type _aType) {
super();
- m_oUnoNode = new UnoNode(_oUnoObject, _aType);
+ m_oUnoNode = new UnoNode(_oUnoObject, _aType);
if (_aType != null){
this.setLabel(_aType.getTypeName());
}
}
-
-
+
+
public Object getUnoObject(){
return m_oUnoNode.getUnoObject();
}
-
+
public void setVisible(String _sFilter){
boolean bisVisible = isFilterApplicable(_sFilter);
super.setVisible(bisVisible);
- }
+ }
public boolean isFilterApplicable(String _sFilter) {
return m_oUnoNode.isFilterApplicable(_sFilter, getName());
@@ -91,13 +91,13 @@ public class SwingUnoNode extends HideableMutableTreeNode implements XUnoNode{
}
}
return sClassName;
- }
+ }
public String getAnchor() {
return m_oUnoNode.getAnchor();
}
-
-
+
+
public void setFoldable(boolean _bIsFoldable){
if (_bIsFoldable){
addDummyNode();
@@ -107,16 +107,16 @@ public class SwingUnoNode extends HideableMutableTreeNode implements XUnoNode{
}
}
-
+
public XUnoNode getParentNode(){
return (SwingUnoNode) super.getParent();
}
-
-
+
+
public void addChildNode(XUnoNode _xUnoNode) {
super.add((SwingUnoNode) _xUnoNode);
}
-
+
public void setLabel(String _sLabel){
super.setUserObject(_sLabel);
this.m_oUnoNode.setLabel(_sLabel);
@@ -126,30 +126,30 @@ public class SwingUnoNode extends HideableMutableTreeNode implements XUnoNode{
return (String) super.getUserObject();
}
-
+
public int getChildCount(){
return super.getChildCount();
}
-
-
+
+
public XUnoNode getChild(int _i){
return (SwingUnoNode) super.getChildAt(_i);
}
-
+
public int getNodeType(){
return m_oUnoNode.getNodeType();
}
-
+
public void setNodeType(int _nNodeType){
m_oUnoNode.setNodeType(_nNodeType);
}
-
-
+
+
public String getName(){
return getClassName();
}
-
-
+
+
public Type getUnoType(){
return m_oUnoNode.getUnoType();
}
diff --git a/odk/examples/java/Inspector/SwingUnoPropertyNode.java b/odk/examples/java/Inspector/SwingUnoPropertyNode.java
index f72229db6f10..34decfec1d1c 100644
--- a/odk/examples/java/Inspector/SwingUnoPropertyNode.java
+++ b/odk/examples/java/Inspector/SwingUnoPropertyNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,16 +29,16 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.Property;
import com.sun.star.beans.PropertyValue;
public class SwingUnoPropertyNode extends SwingUnoNode implements XUnoPropertyNode{
-
+
private UnoPropertyNode m_oUnoPropertyNode = null;
-
-
+
+
public SwingUnoPropertyNode(Property _aProperty, Object _oUnoObject, Object _oUnoReturnObject) {
super(_oUnoObject);
m_oUnoPropertyNode = new UnoPropertyNode(_aProperty, _oUnoObject, _oUnoReturnObject);
@@ -46,51 +46,51 @@ public class SwingUnoPropertyNode extends SwingUnoNode implements XUnoPropertyNo
setFoldable(m_oUnoPropertyNode.isFoldable());
}
-
+
public SwingUnoPropertyNode(Property _aProperty){
super(null);
m_oUnoPropertyNode = new UnoPropertyNode(_aProperty);
}
-
- public SwingUnoPropertyNode(PropertyValue _aPropertyValue, Object _oUnoObject, Object _oUnoReturnObject) {
+
+ public SwingUnoPropertyNode(PropertyValue _aPropertyValue, Object _oUnoObject, Object _oUnoReturnObject) {
super(_oUnoObject);
m_oUnoPropertyNode = new UnoPropertyNode(_aPropertyValue, _oUnoObject, _oUnoReturnObject);
}
-
+
public String getName(){
return m_oUnoPropertyNode.getName();
}
-
-
+
+
public Object getUnoReturnObject(){
return m_oUnoPropertyNode.getUnoReturnObject();
}
-
+
public String getClassName(){
String sClassName = m_oUnoPropertyNode.getClassName();
if (sClassName.equals("")){
sClassName = super.getClassName();
- }
+ }
return sClassName;
- }
-
+ }
+
public String getAnchor(){
return m_oUnoPropertyNode.getAnchor();
}
-
+
public int getPropertyNodeType(){
return m_oUnoPropertyNode.getPropertyNodeType();
}
-
-
+
+
public void setPropertyNodeType(int _nPropertyType){
m_oUnoPropertyNode.setPropertyNodeType(_nPropertyType);
}
-
+
public Property getProperty(){
return m_oUnoPropertyNode.getProperty();
}
-
+
}
diff --git a/odk/examples/java/Inspector/TDocSupplier.java b/odk/examples/java/Inspector/TDocSupplier.java
index 1022507eb387..81d8ca05e533 100644
--- a/odk/examples/java/Inspector/TDocSupplier.java
+++ b/odk/examples/java/Inspector/TDocSupplier.java
@@ -3,7 +3,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -30,7 +30,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.Property;
@@ -55,31 +55,31 @@ import javax.swing.JOptionPane;
public class TDocSupplier {
private XMultiComponentFactory m_xMultiComponentFactory;
private XComponentContext m_xComponentContext;
-
-
+
+
/** Creates a new instance of TDocSupplier */
public TDocSupplier(XComponentContext _xComponentContext) {
m_xComponentContext = _xComponentContext;
m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
}
-
-
+
+
protected XComponentContext getXComponentContext(){
return m_xComponentContext;
}
-
-
+
+
protected XMultiComponentFactory getXMultiComponentFactory(){
return m_xMultiComponentFactory;
}
-
+
public XModel getXModelByTDocUrl(String _sTDocUrl){
try{
XRow xRow = getXRowOfTDocUrl(_sTDocUrl, "DocumentModel");
if (xRow != null){
Object oModel = xRow.getObject(1, null);
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, oModel);
- return xModel;
+ return xModel;
}
}catch(Exception exception){
exception.printStackTrace(System.out);
@@ -87,8 +87,8 @@ public class TDocSupplier {
JOptionPane.showMessageDialog(new javax.swing.JFrame(), "The selected Document could not be opened!", "Object Inspector", JOptionPane.ERROR_MESSAGE);
return null;
}
-
-
+
+
public String getTitleByTDocUrl(String _sTDocUrl){
try{
XRow xRow = this.getXRowOfTDocUrl(_sTDocUrl, "Title");
@@ -101,18 +101,18 @@ public class TDocSupplier {
JOptionPane.showMessageDialog(new javax.swing.JFrame(), "The selected Document could not be opened!", "Object Inspector", JOptionPane.ERROR_MESSAGE);
return "";
}
-
-
+
+
private XRow getXRowOfTDocUrl(String _sTDocUrl, String _sPropertyName){
try{
String[] keys = new String[2];
keys[ 0 ] = "Local";
keys[ 1 ] = "Office";
- Object oUCB = getXMultiComponentFactory().createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", keys, getXComponentContext() );
+ Object oUCB = getXMultiComponentFactory().createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", keys, getXComponentContext() );
XContentIdentifierFactory xIdFactory = (XContentIdentifierFactory)UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB);
XContentProvider xProvider = (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, oUCB);
XContentIdentifier xId = xIdFactory.createContentIdentifier(_sTDocUrl);
- XContent xContent = xProvider.queryContent(xId);
+ XContent xContent = xProvider.queryContent(xId);
XCommandProcessor xCmdProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
Property aProperty = new Property();
aProperty.Name = _sPropertyName; // "DocumentModel"; //DocumentModel
@@ -127,8 +127,8 @@ public class TDocSupplier {
exception.printStackTrace(System.out);
return null;
}}
-
-
+
+
protected String[] getTDocTitles(String[] _sTDocUrls){
String[] sTitles = new String[_sTDocUrls.length];
for (int i = 0; i < _sTDocUrls.length; i++){
@@ -136,33 +136,33 @@ public class TDocSupplier {
}
return sTitles;
}
-
-
+
+
protected String[] getTDocUrls(){
try{
Object oSimpleFileAccess = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", getXComponentContext());
XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
String[] sContent = xSimpleFileAccess.getFolderContents("vnd.sun.star.tdoc:/", false);
- return sContent;
+ return sContent;
} catch( Exception e ) {
System.err.println( e );
return new String[]{};
}}
-
-
+
+
public XComponent openEmptyDocument(String _sUrl){
try{
PropertyValue[] aPropertyValues = new PropertyValue[1];
aPropertyValues[0] = new PropertyValue();
aPropertyValues[0].Name = "Hidden";
- aPropertyValues[0].Value = Boolean.TRUE;
+ aPropertyValues[0].Value = Boolean.TRUE;
Object oDesktop = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.frame.Desktop", getXComponentContext());
XComponentLoader xCL = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
- return xCL.loadComponentFromURL(_sUrl, "_default", 0, aPropertyValues);
+ return xCL.loadComponentFromURL(_sUrl, "_default", 0, aPropertyValues);
}
catch( Exception exception ) {
System.err.println( exception );
return null;
- }}
-
+ }}
+
}
diff --git a/odk/examples/java/Inspector/TestInspector.java b/odk/examples/java/Inspector/TestInspector.java
index a2255dff859a..e7583f944d09 100644
--- a/odk/examples/java/Inspector/TestInspector.java
+++ b/odk/examples/java/Inspector/TestInspector.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.lang.XSingleComponentFactory;
@@ -38,7 +38,7 @@ import com.sun.star.uno.UnoRuntime;
import java.io.DataInputStream;
public class TestInspector {
-
+
public static void main(String args[]) {
com.sun.star.uno.XComponentContext xContext = null;
try {
@@ -55,24 +55,24 @@ public class TestInspector {
try {
com.sun.star.lang.XMultiComponentFactory xMCF = xContext.getServiceManager();
// Creating an instance of the instance inspector with arguments
-
+
XSingleComponentFactory xFactory = Inspector.__getComponentFactory(Inspector._Inspector.class.getName());
Object obj= null;
if (xFactory != null) {
- obj = xFactory.createInstanceWithContext(xContext);
+ obj = xFactory.createInstanceWithContext(xContext);
}
org.openoffice.XInstanceInspector xInstInspector = null;
if (obj != null) {
- xInstInspector = (org.openoffice.XInstanceInspector)UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
+ xInstInspector = (org.openoffice.XInstanceInspector)UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
}
-
+
/* A desktop environment contains tasks with one or more
frames in which components can be loaded. Desktop is the
environment for components which can instanciate within
frames. */
com.sun.star.frame.XComponentLoader xCmpLoader = (com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class,
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext));
-
+
// Load a new spreadsheet document, which will be automaticly
// displayed and is used for inspection
com.sun.star.lang.XComponent xComp = xCmpLoader.loadComponentFromURL("private:factory/scalc", "_blank", 0, new com.sun.star.beans.PropertyValue[0] );
diff --git a/odk/examples/java/Inspector/UnoFacetteNode.java b/odk/examples/java/Inspector/UnoFacetteNode.java
index 53296129b2da..0fd91e434736 100644
--- a/odk/examples/java/Inspector/UnoFacetteNode.java
+++ b/odk/examples/java/Inspector/UnoFacetteNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.reflection.XIdlMethod;
@@ -39,27 +39,27 @@ import javax.swing.tree.DefaultMutableTreeNode;
public class UnoFacetteNode extends UnoNode{
String m_sFilter = "";
-
-
+
+
/** Creates a new instance of UnoMethodNode */
public UnoFacetteNode(Object _oUnoObject){
super(_oUnoObject);
- addDummyNode();
+ addDummyNode();
}
-
-
+
+
public String getFilter(){
return m_sFilter;
}
-
+
public void setFilter(String _sFilter){
m_sFilter = _sFilter;
}
-
+
public String getName(){
return toString();
}
-
+
// TODO The implementation of the following nodes is not really robust and should be changed!!!
public boolean isMethodNode(){
return ((String) getUserObject()).equals(SMETHODDESCRIPTION);
@@ -77,7 +77,7 @@ public class UnoFacetteNode extends UnoNode{
public boolean isServiceNode(){
return ((String) getUserObject()).equals(SSERVICEDESCRIPTION);
}
-
+
public boolean isInterfaceNode(){
return ((String) getUserObject()).equals(SINTERFACEDESCRIPTION);
}
diff --git a/odk/examples/java/Inspector/UnoMethodNode.java b/odk/examples/java/Inspector/UnoMethodNode.java
index 57793809bc5e..d80aa6f70d6b 100644
--- a/odk/examples/java/Inspector/UnoMethodNode.java
+++ b/odk/examples/java/Inspector/UnoMethodNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.reflection.ParamInfo;
@@ -47,8 +47,8 @@ public class UnoMethodNode extends UnoNode{
Object m_oUnoReturnObject = null;
boolean m_bisInvoked = false;
XUnoMethodNode m_xUnoMethodNode = null;
-
-
+
+
/** Creates a new instance of UnoMethodNode */
public UnoMethodNode(XIdlMethod _xIdlMethod, Object _oUnoObject, XUnoMethodNode _xUnoMethodNode) {
super(_oUnoObject);
@@ -56,11 +56,11 @@ public class UnoMethodNode extends UnoNode{
m_oParamObjects = new Object[m_xIdlMethod.getParameterInfos().length];
m_xUnoMethodNode = _xUnoMethodNode;
}
-
+
protected boolean isFoldable(){
return ((!this.isPrimitive()) && (getTypeClass().getValue() != TypeClass.VOID_value));
}
-
+
protected boolean isInvokable(){
boolean bisFoldable = true;
XIdlClass[] xIdlClasses = m_xIdlMethod.getParameterTypes();
@@ -72,22 +72,22 @@ public class UnoMethodNode extends UnoNode{
}
return bisFoldable;
}
-
+
public XIdlMethod getXIdlMethod(){
return m_xIdlMethod;
}
-
-
+
+
public String getAnchor(){
return getXIdlMethod().getName();
}
-
+
public String getName(){
return getXIdlMethod().getName();
}
-
-
+
+
public Object invoke(){
Object oUnoReturnObject = null;
if (!hasParameters()){
@@ -109,13 +109,13 @@ public class UnoMethodNode extends UnoNode{
m_oUnoReturnObject = oUnoReturnObject;
return oUnoReturnObject;
}
-
-
+
+
public boolean isInvoked(){
return m_bisInvoked;
}
-
-
+
+
protected String getNodeDescription(){
String sNodeDescription = "";
String sParameters = getParameterDescription();
@@ -124,7 +124,7 @@ public class UnoMethodNode extends UnoNode{
}
else{
TypeClass typeClass = getTypeClass();
- if (typeClass != TypeClass.VOID){
+ if (typeClass != TypeClass.VOID){
sNodeDescription = getStandardMethodDescription();
}
else{
@@ -133,7 +133,7 @@ public class UnoMethodNode extends UnoNode{
}
return sNodeDescription;
}
-
+
public String getStandardMethodDescription(){
String sNodeDescription = m_xIdlMethod.getReturnType().getName() + " " + m_xIdlMethod.getName() + " (" + getParameterDescription() + " )";
@@ -142,23 +142,23 @@ public class UnoMethodNode extends UnoNode{
}
return sNodeDescription;
}
-
-
+
+
public boolean hasParameters(){
return (m_xIdlMethod.getParameterInfos().length > 0);
}
-
-
+
+
public Object[] getLastParameterObjects(){
return m_oParamObjects;
}
-
-
+
+
public Object getLastUnoReturnObject(){
return m_oUnoReturnObject;
}
-
+
public String getParameterDescription(){
ParamInfo[] paramInfo = m_xIdlMethod.getParameterInfos();
String sParameters = "";
@@ -180,7 +180,7 @@ public class UnoMethodNode extends UnoNode{
return sParameters;
}
-
+
// return the parameter mode (IN, OUT, INOUT)
private static String getParamMode(ParamMode paramMode) {
String toReturn = "";
@@ -195,34 +195,34 @@ public class UnoMethodNode extends UnoNode{
}
return( toReturn );
}
-
+
public TypeClass getTypeClass(){
XIdlClass xIdlClass = m_xIdlMethod.getReturnType();
return xIdlClass.getTypeClass();
}
-
+
private Object invokeParameterlessMethod(){
try {
Object[][] aParamInfo = new Object[1][];
aParamInfo[0] = new Object[] {};
- return getXIdlMethod().invoke(getUnoObject(), aParamInfo);
+ return getXIdlMethod().invoke(getUnoObject(), aParamInfo);
} catch (Exception ex) {
ex.printStackTrace(System.out);
return null;
}}
-
+
public boolean isPrimitive(){
return Introspector.isObjectPrimitive(m_xIdlMethod.getClass(), getTypeClass());
}
-
-
+
+
protected Object invoke(Object _oUnoObject, Object[] oParameters) throws com.sun.star.uno.Exception{
Object[][] aParams = new Object[1][oParameters.length];
for ( int i = 0; i < oParameters.length; i++ ) {
aParams[0][i] = oParameters[i];
}
return m_xIdlMethod.invoke(_oUnoObject, aParams);
- }
+ }
}
diff --git a/odk/examples/java/Inspector/UnoNode.java b/odk/examples/java/Inspector/UnoNode.java
index 2bfaaf34a356..50d6ec3243d5 100644
--- a/odk/examples/java/Inspector/UnoNode.java
+++ b/odk/examples/java/Inspector/UnoNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.PropertyValue;
@@ -56,8 +56,8 @@ import java.util.List;
import java.util.Vector;
public class UnoNode{
-
- String sPath = null;
+
+ String sPath = null;
Object m_oUnoObject;
private XMultiComponentFactory m_xMultiComponentFactory;
private XComponentContext m_xComponentContext;
@@ -65,54 +65,54 @@ public class UnoNode{
private int m_nNodeType = XUnoNode.nOTHERS;
private Type aType = null;
private String sLabel = "";
-
-
-
+
+
+
/** Creates a new instance of UnoNode */
public UnoNode(Object _oUnoObject) {
m_xComponentContext = Introspector.getIntrospector().getXComponentContext();
- m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
+ m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
m_oUnoObject = _oUnoObject;
}
-
+
public UnoNode(Object _oUnoObject, Type _aType) {
this(_oUnoObject);
aType = _aType;
m_nNodeType = XUnoNode.nINTERFACE;
}
-
+
public Object getUnoObject(){
return m_oUnoObject;
- }
-
-
+ }
+
+
protected XComponentContext getXComponentContext(){
return m_xComponentContext;
}
-
-
+
+
protected XMultiComponentFactory getXMultiComponentFactory(){
return m_xMultiComponentFactory;
}
-
-
+
+
private static XTypeDescriptionEnumerationAccess getXTypeDescriptionEnumerationAccess(){
return Introspector.getIntrospector().getXTypeDescriptionEnumerationAccess();
}
-
+
public String getAnchor(){
return "";
}
-
+
public int getNodeType(){
return m_nNodeType;
}
-
+
public void setNodeType(int _nNodeType){
m_nNodeType = _nNodeType;
}
-
+
public String getClassName(){
String sClassName = "";
if (m_nNodeType == XUnoNode.nINTERFACE){
@@ -123,8 +123,8 @@ public class UnoNode{
}
return sClassName;
}
-
-
+
+
public Type getUnoType(){
return aType;
}
@@ -132,7 +132,7 @@ public class UnoNode{
protected void setLabel(String _sLabel){
sLabel = _sLabel;
}
-
+
public void openIdlDescription(String _sIDLUrl, String _sClassName, String _sAnchor){
try{
String sIDLUrl = _sIDLUrl;
@@ -164,7 +164,7 @@ public class UnoNode{
getXDispatcher(openHyperlink).dispatch(openHyperlink, new PropertyValue[] {pv});
} catch(Exception exception) {
exception.printStackTrace(System.out);
- }}
+ }}
private com.sun.star.util.URL getDispatchURL(String _sURL){
@@ -204,7 +204,7 @@ public class UnoNode{
} catch (Exception e) {
e.printStackTrace(System.out);
return null;
- }}
+ }}
private PropertyValue[] loadArgs(String url) {
@@ -212,21 +212,21 @@ public class UnoNode{
pv.Name = "URL";
pv.Value = url;
return new PropertyValue[] {pv};
- }
-
-
-
+ }
+
+
+
public boolean isFilterApplicable(String _sFilter, String _sName){
boolean bFilterDoesApply = true;
if (_sFilter.length() > 0){
- if (_sName.indexOf(_sFilter) == -1){
+ if (_sName.indexOf(_sFilter) == -1){
bFilterDoesApply = false;
}
}
return bFilterDoesApply;
}
-
-
+
+
// public static String getServiceDescription(Object _oUnoObject){
// String sClassName = "";
// XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oUnoObject);
@@ -238,15 +238,15 @@ public class UnoNode{
// }
// return sClassName;
// }
-
-
-
+
+
+
private static String[] getMandatoryServiceNames(String _sServiceName){
String[] sMandatoryServiceNames = new String[]{};
try {
TypeClass[] eTypeClasses = new com.sun.star.uno.TypeClass[1];
eTypeClasses[0] = com.sun.star.uno.TypeClass.SERVICE;
- XTypeDescriptionEnumeration xTDEnumeration = getXTypeDescriptionEnumerationAccess().createTypeDescriptionEnumeration(Introspector.getModuleName(_sServiceName), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
+ XTypeDescriptionEnumeration xTDEnumeration = getXTypeDescriptionEnumerationAccess().createTypeDescriptionEnumeration(Introspector.getModuleName(_sServiceName), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
while (xTDEnumeration.hasMoreElements()) {
XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
if (xTD.getName().equals(_sServiceName)){
@@ -257,16 +257,16 @@ public class UnoNode{
for (int i = 0; i < nlength; i++){
sMandatoryServiceNames[i] = xMandatoryServiceTypeDescriptions[i].getName();
}
-
- }
- }
+
+ }
+ }
} catch ( java.lang.Exception e) {
System.out.println(System.out);
}
return sMandatoryServiceNames;
}
-
-
+
+
private static String[] removeMandatoryServiceNames(String[] _sServiceNames){
try{
List aList = java.util.Arrays.asList(_sServiceNames);
@@ -288,8 +288,8 @@ public class UnoNode{
}
return new String[]{};
}
-
-
+
+
public static String getDisplayValueOfPrimitiveType(Object _objectElement){
String sValue ="";
try{
@@ -297,41 +297,41 @@ public class UnoNode{
sValue = AnyConverter.toString(_objectElement);
}
else if (AnyConverter.isBoolean(_objectElement)){
- sValue += AnyConverter.toBoolean(_objectElement);
+ sValue += AnyConverter.toBoolean(_objectElement);
}
else if (AnyConverter.isByte(_objectElement)){
- sValue += AnyConverter.toByte(_objectElement);
+ sValue += AnyConverter.toByte(_objectElement);
}
else if (AnyConverter.isChar(_objectElement)){
- sValue += AnyConverter.toChar(_objectElement);
+ sValue += AnyConverter.toChar(_objectElement);
}
else if (AnyConverter.isDouble(_objectElement)){
- sValue += AnyConverter.toDouble(_objectElement);
+ sValue += AnyConverter.toDouble(_objectElement);
}
else if (AnyConverter.isFloat(_objectElement)){
- sValue += AnyConverter.toFloat(_objectElement);
+ sValue += AnyConverter.toFloat(_objectElement);
}
else if (AnyConverter.isInt(_objectElement)){
- sValue += AnyConverter.toInt(_objectElement);
+ sValue += AnyConverter.toInt(_objectElement);
}
else if (AnyConverter.isLong(_objectElement)){
- sValue += AnyConverter.toLong(_objectElement);
+ sValue += AnyConverter.toLong(_objectElement);
}
else if (AnyConverter.isShort(_objectElement)){
- sValue += AnyConverter.toShort(_objectElement);
- }
+ sValue += AnyConverter.toShort(_objectElement);
+ }
}
catch( Exception e ) {
System.err.println( e );
}
return sValue;
}
-
+
protected static String[] getDisplayValuesofPrimitiveArray(Object _oUnoObject){
String[] sDisplayValues = null;
try{
Type aType = AnyConverter.getType(_oUnoObject);
- TypeClass aTypeClass = aType.getTypeClass();
+ TypeClass aTypeClass = aType.getTypeClass();
int nTypeValue = aTypeClass.getValue();
if (nTypeValue == TypeClass.SEQUENCE_value){
nTypeValue = (sequenceComponentType(aType)).getTypeClass().getValue();
@@ -387,7 +387,7 @@ public class UnoNode{
}
break;
case TypeClass.CHAR_value:
- break;
+ break;
default:
System.out.println("Value could not be retrieved: " + aType.getTypeClass().getClass().getName());
}
@@ -396,9 +396,9 @@ public class UnoNode{
catch( Exception e ) {
System.err.println( e );
return null;
- }}
-
-
+ }}
+
+
private static Type sequenceComponentType(Type sequenceType) {
// assert sequenceType.getTypeClass() == TypeClass.SEQUENCE;
String n = sequenceType.getTypeName();
@@ -406,15 +406,15 @@ public class UnoNode{
// assert n.startsWith(PREFIX);
return new Type(n.substring(PREFIX.length()));
}
-
-
+
+
public static String getNodeDescription(Object _oUnoObject, int _nIndex){
return getNodeDescription(_oUnoObject) + "[" + (_nIndex + 1) + "]";
}
public static String getNodeDescription(Object _oUnoObject){
- XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
+ XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
if ( xServiceInfo != null ) {
return xServiceInfo.getImplementationName();
}
@@ -425,13 +425,13 @@ public class UnoNode{
else{
return _oUnoObject.getClass().getName();
}
- }
-
+ }
+
public void setParameterObjects(Object[] _oParamObjects){
m_oParamObjects = _oParamObjects;
}
-
+
public Object[] getParameterObjects(){
return m_oParamObjects;
- }
+ }
}
diff --git a/odk/examples/java/Inspector/UnoPropertyNode.java b/odk/examples/java/Inspector/UnoPropertyNode.java
index 4b22b01f1b8a..e9efe526a24b 100644
--- a/odk/examples/java/Inspector/UnoPropertyNode.java
+++ b/odk/examples/java/Inspector/UnoPropertyNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.Property;
@@ -48,17 +48,17 @@ import com.sun.star.uno.XComponentContext;
import javax.swing.tree.DefaultMutableTreeNode;
public class UnoPropertyNode extends UnoNode{
-
+
Property aProperty;
PropertyValue aPropertyValue;
String m_sPropertyName;
Object m_oUnoReturnObject;
private int m_nPropertyType = XUnoPropertyNode.nDEFAULT;
private String sLabel = "";
-
+
private static XConstantTypeDescription[] xPropertyAttributesTypeDescriptions = null;
-
-
+
+
/** Creates a new instance of UnoMethodNode */
public UnoPropertyNode(Property _aProperty, Object _oUnoObject, Object _oUnoReturnObject) {
super(_oUnoObject);
@@ -74,7 +74,7 @@ public class UnoPropertyNode extends UnoNode{
m_sPropertyName = aProperty.Name;
m_oUnoReturnObject = null;
}
-
+
public UnoPropertyNode(PropertyValue _aPropertyValue, Object _oUnoObject, Object _oUnoReturnObject) {
super(_oUnoObject);
m_oUnoReturnObject = _oUnoReturnObject;
@@ -82,17 +82,17 @@ public class UnoPropertyNode extends UnoNode{
m_sPropertyName = aPropertyValue.Name;
}
-
+
public int getPropertyNodeType(){
return m_nPropertyType;
}
-
-
+
+
public void setPropertyNodeType(int _nPropertyType){
m_nPropertyType = _nPropertyType;
}
-
-
+
+
public String getPropertyName(){
return m_sPropertyName;
}
@@ -101,7 +101,7 @@ public class UnoPropertyNode extends UnoNode{
return this.m_sPropertyName;
}
-
+
public String getClassName(){
String sClassName = "";
if (m_oUnoObject != null){
@@ -120,15 +120,15 @@ public class UnoPropertyNode extends UnoNode{
sClassName = "com.sun.star.beans.Property";
}
return sClassName;
- }
-
-
+ }
+
+
public String getAnchor(){
return m_sPropertyName;
}
-
-
-
+
+
+
protected boolean doesServiceSupportProperty(String _sServiceName, String _sPropertyName){
try {
XPropertyTypeDescription[] xPropertyTypeDescriptions = Introspector.getIntrospector().getPropertyDescriptionsOfService(_sServiceName);
@@ -142,18 +142,18 @@ public class UnoPropertyNode extends UnoNode{
}
return false;
}
-
-
+
+
public Object getUnoReturnObject(){
return m_oUnoReturnObject;
}
-
-
+
+
private boolean isPrimitive(){
boolean bIsPrimitive = true;
if (getUnoReturnObject() != null){
if (getProperty() != null){
- bIsPrimitive = Introspector.isObjectPrimitive(getUnoReturnObject().getClass(), getProperty().Type.getTypeClass());
+ bIsPrimitive = Introspector.isObjectPrimitive(getUnoReturnObject().getClass(), getProperty().Type.getTypeClass());
}
else{
bIsPrimitive = Introspector.isObjectPrimitive(getUnoReturnObject().getClass());
@@ -164,8 +164,8 @@ public class UnoPropertyNode extends UnoNode{
}
return bIsPrimitive;
}
-
-
+
+
protected boolean isFoldable(){
boolean bIsFoldable = false;
if (! isPrimitive()){
@@ -174,8 +174,8 @@ public class UnoPropertyNode extends UnoNode{
}
return bIsFoldable;
}
-
-
+
+
protected String getLabel(){
if (!sLabel.equals("")){
if (! isPrimitive()){
@@ -186,32 +186,32 @@ public class UnoPropertyNode extends UnoNode{
sLabel = getStandardPropertyDescription(aProperty, getUnoReturnObject());
}
}
- else {
+ else {
sLabel = getStandardPropertyDescription(aProperty, getUnoReturnObject());
}
}
return sLabel;
}
-
+
public Property getProperty(){
return aProperty;
}
-
+
protected static String getPropertyTypeDescription(Property _aProperty, Object _oUnoObject){
- return _aProperty.Type.getTypeName() + " " + _aProperty.Name + " = " + _oUnoObject.toString();
- }
+ return _aProperty.Type.getTypeName() + " " + _aProperty.Name + " = " + _oUnoObject.toString();
+ }
protected static String getStandardPropertyDescription(Property _aProperty, Object _objectElement){
if (!Introspector.isObjectPrimitive(_objectElement)){
- return _aProperty.Name + " = (" + _aProperty.Type.getTypeName() + ") ";
+ return _aProperty.Name + " = (" + _aProperty.Type.getTypeName() + ") ";
}
else{
- return _aProperty.Name + " (" + _aProperty.Type.getTypeName() + ") = " + getDisplayValueOfPrimitiveType(_objectElement);
+ return _aProperty.Name + " (" + _aProperty.Type.getTypeName() + ") = " + getDisplayValueOfPrimitiveType(_objectElement);
}
}
-
+
protected static String getStandardPropertyValueDescription(PropertyValue _aPropertyValue){
if (!Introspector.isObjectPrimitive(_aPropertyValue.Value)){
return _aPropertyValue.Name;
@@ -219,7 +219,7 @@ public class UnoPropertyNode extends UnoNode{
else{
return _aPropertyValue.Name + " : " + UnoNode.getDisplayValueOfPrimitiveType(_aPropertyValue.Value);
}
- }
+ }
}
diff --git a/odk/examples/java/Inspector/UnoTreeRenderer.java b/odk/examples/java/Inspector/UnoTreeRenderer.java
index 54094275606c..9c2772124658 100644
--- a/odk/examples/java/Inspector/UnoTreeRenderer.java
+++ b/odk/examples/java/Inspector/UnoTreeRenderer.java
@@ -55,13 +55,13 @@ public class UnoTreeRenderer extends DefaultTreeCellRenderer{
private Icon m_oPropertyValueIcon;
private boolean bSelected;
private int nWidth = 0;
-
-
+
+
/** Creates a new instance of UnoTreeRenderer */
public UnoTreeRenderer(){
super();
try {
-
+
final ClassLoader loader = ClassLoader.getSystemClassLoader();
m_oMethodIcon = new ImageIcon(loader.getResource("images/methods_16.png"));
m_oPropertyIcon = new ImageIcon("images/properties_16.png");
@@ -74,14 +74,14 @@ public class UnoTreeRenderer extends DefaultTreeCellRenderer{
System.out.println("Sorry, could not locate resourecs, treecell icons will not be displayed.");
}
}
-
-
+
+
public synchronized Component getTreeCellRendererComponent(JTree tree,Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus){
try{
bSelected = sel;
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Component rc = super.getTreeCellRendererComponent( tree, value, sel,expanded, leaf, row,hasFocus);
- String sLabelText = (String)node.getUserObject();
+ String sLabelText = (String)node.getUserObject();
if (sLabelText != null){
if (sLabelText.equals(XUnoFacetteNode.SCONTAINERDESCRIPTION)){
// setIcon(m_oContainerIcon);
@@ -113,9 +113,9 @@ public class UnoTreeRenderer extends DefaultTreeCellRenderer{
}
return this;
}
-
-
-
+
+
+
public void paintComponent(Graphics g) {
FontMetrics fm = getFontMetrics(getFont());
int x, y;
diff --git a/odk/examples/java/Inspector/XDialogProvider.java b/odk/examples/java/Inspector/XDialogProvider.java
index e8bfadc1873f..fdf406273b7e 100644
--- a/odk/examples/java/Inspector/XDialogProvider.java
+++ b/odk/examples/java/Inspector/XDialogProvider.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,37 +29,37 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
public interface XDialogProvider {
-
- public static String SINVOKE = "Invoke";
-
+
+ public static String SINVOKE = "Invoke";
+
public static String SADDTOSOURCECODE = "Add to Sourcecode";
-
- public void enablePopupMenuItem(String _sMenuTitle, boolean _bdoEnable);
-
+
+ public void enablePopupMenuItem(String _sMenuTitle, boolean _bdoEnable);
+
public void showPopUpMenu(Object invoker, int x, int y) throws java.lang.ClassCastException;
-
+
public InspectorPane getSelectedInspectorPage();
public void addInspectorPage(String _sTitle, Object _oContainer);
-
+
public InspectorPane getInspectorPage(int _nIndex);
public int getInspectorPageCount();
-
+
public void selectInspectorPageByIndex(int nTabIndex);
-
+
public void show(int _nPageIndex) throws java.lang.ClassCastException;
-
+
public void selectSourceCodeLanguage(int _nLanguage);
-
+
public void paint();
-
+
// returns one of the constants defined in XLanguageSourceCodeGenerator
public int getLanguage();
-
+
public String getIDLPath();
}
diff --git a/odk/examples/java/Inspector/XInstanceInspector.idl b/odk/examples/java/Inspector/XInstanceInspector.idl
index 134879f68cee..2749535816b2 100644
--- a/odk/examples/java/Inspector/XInstanceInspector.idl
+++ b/odk/examples/java/Inspector/XInstanceInspector.idl
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,28 +29,28 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
#ifndef INCLUDED_ORG_OPENOFFICE_XINSTANCEINSPECTOR_IDL
#define INCLUDED_ORG_OPENOFFICE_XINSTANCEINSPECTOR_IDL
-#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/uno/XInterface.idl>
+
+module org { module openoffice {
-module org { module openoffice {
-
- interface XInstanceInspector {
+ interface XInstanceInspector {
/**
* For a given instance this method displays all services, interfaces,
* methods, attributes, and contents in a tree. All dependend
* instances are also inspected and displayed, so the user could browse
* the tree. If you press the key "F1", the API-documentation from
- * www.openoffice.org for the current instance will be displayed in a
+ * www.openoffice.org for the current instance will be displayed in a
* new window.
*/
- void inspect( [in] any aInstance, [in] string sTitle );
+ void inspect( [in] any aInstance, [in] string sTitle );
};
-
+
}; };
#endif
diff --git a/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java b/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java
index 832f0aa51d4b..aaf424607a8a 100644
--- a/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java
+++ b/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,78 +29,78 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.TypeClass;
import java.util.Vector;
public interface XLanguageSourceCodeGenerator {
-
+
public static final int nJAVA = 0;
public static final int nCPLUSPLUS = 1;
public static final int nBASIC = 2;
-
+
public String getHeaderSourceCode(Object _oUnoObject, String _sClassName, TypeClass _aTypeClass);
- public String getFinalHeaderStatements();
+ public String getFinalHeaderStatements();
public void assignqueryInterfaceHeaderSourceCode();
-
+
public String getMainMethodSignatureSourceCode(XUnoNode _oUnoNode, String _soReturnObjectDescription);
-
+
public String getMethodTerminationSourceCode();
-
+
public String getStatementTerminationCharacter();
- public boolean needsqueryInterface();
-
+ public boolean needsqueryInterface();
+
public String getqueryInterfaceSourceCode(String _sReturnValueDescription, String _sClassName, String _sObjectDescription);
-
+
public String getPropertyValueGetterSourceCode(String _sPropertyName, String _sReturnVariableName, String _sIncomingObjectName, TypeClass _aTypeClass, String _sTypeName);
-
+
public String getStructSourceCode(String _sReturnVariableDescription, String _sObjectDescription, String _sMember);
-
+
public String getObjectTypeDescription(String _sClassName, boolean _bAsHeader);
-
+
public String getbooleanTypeDescription();
public String getbyteTypeDescription();
public String getshortTypeDescription();
-
+
public String getunsignedshortTypeDescription();
public String getlongTypeDescription();
public String getunsignedlongTypeDescription();
-
+
public String gethyperTypeDescription();
public String getunsignedhyperTypeDescription();
public String getfloatTypeDescription();
-
+
public String getdoubleTypeDescription();
public String getcharTypeDescription();
-
+
public String getstringTypeDescription(boolean _bAsHeaderSourceCode);
-
+
public String gettypeTypeDescription(boolean _bAsHeaderSourceCode);
-
+
public String getanyTypeDescription(boolean _bAsHeaderSourceCode);
-
+
public String getArrayDeclaration(String sVariableDeclaration);
-
+
public String getVariableDeclaration(String _sTypeString, String _sVariableName, boolean _bIsArray, TypeClass aTypeClass, boolean _bInitialize);
-
+
public String getMethodSeparator();
-
+
public String getStringValue(String _sValue);
-
+
public String getConvertedSourceCodeValueOfObject(String _sReturnVariableName, String _sObjectDescription, TypeClass _aTypeClass, String _sTypeName);
-
+
public String castLiteral(String _sExpression, TypeClass _aTypeClass);
-
+
public String getCommentSign();
}
diff --git a/odk/examples/java/Inspector/XMethodParametersDialog.java b/odk/examples/java/Inspector/XMethodParametersDialog.java
index 8bad4f19b9c5..d8fcdb13c9b1 100644
--- a/odk/examples/java/Inspector/XMethodParametersDialog.java
+++ b/odk/examples/java/Inspector/XMethodParametersDialog.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,9 +29,9 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
public interface XMethodParametersDialog {
-
+
}
diff --git a/odk/examples/java/Inspector/XTreeControlProvider.java b/odk/examples/java/Inspector/XTreeControlProvider.java
index ca40d70afae2..8f0d951e1a29 100644
--- a/odk/examples/java/Inspector/XTreeControlProvider.java
+++ b/odk/examples/java/Inspector/XTreeControlProvider.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.Property;
@@ -42,52 +42,52 @@ public interface XTreeControlProvider {
public static String sTitle = "User defined";
public String enableFilterElements(XUnoNode _oUnoNode);
-
+
public void setSourceCode(String _sSourceCode);
-
+
public Object inspect(java.lang.Object _oUserDefinedObject, String _sTitle) throws com.sun.star.uno.RuntimeException;
-
+
public void nodeInserted(XUnoNode _oParentNode, XUnoNode _oChildNode, int index);
-
+
public void nodeChanged(XUnoNode _oNode);
-
- public boolean setNodeVisible(Object node, boolean v);
-
+
+ public boolean setNodeVisible(Object node, boolean v);
+
public XUnoNode getSelectedNode();
-
+
public XTreePathProvider getSelectedPath();
-
+
public void expandPath(XTreePathProvider xTreePathProvider) throws java.lang.ClassCastException;
-
+
public void addTreeExpandListener();
-
- public void addInspectorPane(InspectorPane _oInspectorPane);
-
+
+ public void addInspectorPane(InspectorPane _oInspectorPane);
+
public boolean isPropertyNode(XUnoNode _oUnoNode);
-
+
public boolean isMethodNode(XUnoNode _oUnoNode);
public boolean isFacetteNode(XUnoNode _oUnoNode);
-
+
public XUnoNode addUnoNode(Object _oUnoObject);
-
+
public XUnoNode addUnoNode(Object _oUnoObject, Type _aType);
public XUnoFacetteNode addUnoFacetteNode(XUnoNode _oParentNode, String _sNodeDescription, Object _oUnoObject);
-
+
public XUnoMethodNode addMethodNode(Object _objectElement, XIdlMethod _xIdlMethod);
-
+
public XUnoPropertyNode addUnoPropertyNodeWithName(Property _aProperty);
public XUnoPropertyNode addUnoPropertyNodeWithHandle(Property _aProperty);
public XUnoPropertyNode addUnoPropertyNodeWithType(Property _aProperty);
-
+
public XUnoPropertyNode addUnoPropertyNodeWithAttributesDescription(Property _aProperty);
-
+
public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, Property _aProperty);
-
+
public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, PropertyValue _aPropertyValue, Object _oReturnObject);
-
- public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, Property _aProperty, Object _oUnoReturnObject);
+
+ public XUnoPropertyNode addUnoPropertyNode(Object _oUnoObject, Property _aProperty, Object _oUnoReturnObject);
}
diff --git a/odk/examples/java/Inspector/XTreePathProvider.java b/odk/examples/java/Inspector/XTreePathProvider.java
index 5067bad409c1..8a2f1ba58b59 100644
--- a/odk/examples/java/Inspector/XTreePathProvider.java
+++ b/odk/examples/java/Inspector/XTreePathProvider.java
@@ -12,14 +12,14 @@
* @author bc93774
*/
public interface XTreePathProvider {
-
+
public XUnoNode getLastPathComponent();
-
+
public XUnoNode getPathComponent(int i);
-
- public int getPathCount();
-
+
+ public int getPathCount();
+
public XTreePathProvider getParentPath();
-
- public XTreePathProvider pathByAddingChild(XUnoNode _oUnoNode);
+
+ public XTreePathProvider pathByAddingChild(XUnoNode _oUnoNode);
}
diff --git a/odk/examples/java/Inspector/XUnoFacetteNode.java b/odk/examples/java/Inspector/XUnoFacetteNode.java
index 6ef4bf4d67a9..9bf091b234f3 100644
--- a/odk/examples/java/Inspector/XUnoFacetteNode.java
+++ b/odk/examples/java/Inspector/XUnoFacetteNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
@@ -44,20 +44,20 @@ public interface XUnoFacetteNode extends XUnoNode {
public static String SINTERFACEDESCRIPTION = "Interfaces";
public static String SCONTENTDESCRIPTION = "Content";
public static String SPROPERTYVALUEDESCRIPTION = "PropertyValues";
-
-
+
+
public boolean isMethodNode();
-
+
public boolean isPropertyNode();
-
+
public boolean isContainerNode();
-
+
public boolean isServiceNode();
-
+
public boolean isInterfaceNode();
-
+
public String getFilter();
-
+
public void setFilter(String _sFilter);
-
+
}
diff --git a/odk/examples/java/Inspector/XUnoMethodNode.java b/odk/examples/java/Inspector/XUnoMethodNode.java
index 074c2fe913ba..93167840a978 100644
--- a/odk/examples/java/Inspector/XUnoMethodNode.java
+++ b/odk/examples/java/Inspector/XUnoMethodNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.reflection.XIdlMethod;
@@ -38,31 +38,31 @@ import java.util.Vector;
public interface XUnoMethodNode extends XUnoNode {
-
+
public XIdlMethod getXIdlMethod();
-
+
public boolean isInvoked();
-
+
public Object invoke() throws com.sun.star.uno.Exception;
-
+
public Object invoke(Object _oUnoObject, Object[] _oParameters) throws com.sun.star.uno.Exception;
-
+
public boolean isInvokable();
-
+
public boolean hasParameters();
-
+
public Object[] getLastParameterObjects();
-
+
public Object getLastUnoReturnObject();
-
+
public TypeClass getTypeClass();
-
+
public boolean isPrimitive();
-
+
public Vector getMethodObjects();
-
+
public boolean isFoldable();
-
+
public String getStandardMethodDescription();
-
+
}
diff --git a/odk/examples/java/Inspector/XUnoNode.java b/odk/examples/java/Inspector/XUnoNode.java
index ae65374aca7a..a27c0aa3a4ab 100644
--- a/odk/examples/java/Inspector/XUnoNode.java
+++ b/odk/examples/java/Inspector/XUnoNode.java
@@ -3,7 +3,7 @@ import com.sun.star.uno.Type;
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -30,7 +30,7 @@ import com.sun.star.uno.Type;
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
@@ -39,44 +39,44 @@ public interface XUnoNode {
public static final int nINTERFACE = 1;
public static final int nSERVICE = 2;
public static final int nOTHERS = 3;
-
+
public String getAnchor();
-
+
public String getClassName();
-
+
public void openIdlDescription(String _sIDLUrl);
-
+
public boolean isFilterApplicable(String _sFilter);
-
+
public void setVisible(String _sFilter);
-
+
public void setParameterObjects(Object[] _oParamObjects);
-
+
public Object[] getParameterObjects();
-
+
public String getName();
-
+
public void setFoldable(boolean _bIsFoldable);
-
+
public Object getUnoObject();
-
+
public XUnoNode getParentNode();
-
+
public void addChildNode(XUnoNode _xUnoNode);
-
+
public void setLabel(String _sLabel);
public String getLabel();
-
+
public int getChildCount();
-
+
public XUnoNode getChild(int _index);
-
+
public int getNodeType();
-
+
// possible values are nINTERFACE, nSERVICE, nOTHERS
public void setNodeType(int _nNodeType);
-
+
/** delivers only the Uno-Type when the NodeType is set to nINTERFACE
* otherwise (when the NodeType has not been set returns null
*/
diff --git a/odk/examples/java/Inspector/XUnoPropertyNode.java b/odk/examples/java/Inspector/XUnoPropertyNode.java
index e4aa4caba668..27d6c5021e1d 100644
--- a/odk/examples/java/Inspector/XUnoPropertyNode.java
+++ b/odk/examples/java/Inspector/XUnoPropertyNode.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.beans.Property;
@@ -39,13 +39,13 @@ public interface XUnoPropertyNode extends XUnoNode {
public static int nDEFAULT = 0;
public static int nPROPERTYSETINFOTYPE = 1;
public static int nPROPERTYVALUETYPE = 2;
-
+
public Object getUnoReturnObject();
-
+
public int getPropertyNodeType();
-
+
public void setPropertyNodeType(int _nPropertyType);
public Property getProperty();
-
+
}
diff --git a/odk/examples/java/MinimalComponent/BuildMinimalComponent.xml b/odk/examples/java/MinimalComponent/BuildMinimalComponent.xml
index 6aa7c5b9322f..a296f7f932c6 100644
--- a/odk/examples/java/MinimalComponent/BuildMinimalComponent.xml
+++ b/odk/examples/java/MinimalComponent/BuildMinimalComponent.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- author: Bertram Nolte
+ author: Bertram Nolte
created: 2001-10-11
revision: 1.0
-->
diff --git a/odk/examples/java/MinimalComponent/MinimalComponent.idl b/odk/examples/java/MinimalComponent/MinimalComponent.idl
index c24011ccdafc..41ee6c53c14f 100644
--- a/odk/examples/java/MinimalComponent/MinimalComponent.idl
+++ b/odk/examples/java/MinimalComponent/MinimalComponent.idl
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,14 +29,14 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
-#ifndef _org_openoffice_MinimalComponent_idl_
-#define _org_openoffice_MinimalComponent_idl_
-
-#include <com/sun/star/lang/XServiceInfo.idl>
-
+#ifndef _org_openoffice_MinimalComponent_idl_
+#define _org_openoffice_MinimalComponent_idl_
+
+#include <com/sun/star/lang/XServiceInfo.idl>
+
// org
module org {
// openoffice
@@ -49,4 +49,4 @@ module org {
};
};
-#endif
+#endif
diff --git a/odk/examples/java/MinimalComponent/MinimalComponent.java b/odk/examples/java/MinimalComponent/MinimalComponent.java
index 47129efc00d2..ef75cb287c1d 100644
--- a/odk/examples/java/MinimalComponent/MinimalComponent.java
+++ b/odk/examples/java/MinimalComponent/MinimalComponent.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.lib.uno.helper.Factory;
@@ -59,7 +59,7 @@ public class MinimalComponent {
*/
static private final String __serviceName =
"org.openoffice.MinimalComponent";
-
+
/** The initial component contextr, that gives access to
* the service manager, supported singletons, ...
* It's often later used
@@ -70,7 +70,7 @@ public class MinimalComponent {
* It's often later used
*/
private XMultiComponentFactory m_xMCF;
-
+
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
@@ -78,13 +78,13 @@ public class MinimalComponent {
public _MinimalComponent(XComponentContext xCompContext) {
try {
m_cmpCtx = xCompContext;
- m_xMCF = m_cmpCtx.getServiceManager();
+ m_xMCF = m_cmpCtx.getServiceManager();
}
catch( Exception e ) {
e.printStackTrace();
}
}
-
+
/** This method is a member of the interface for initializing an object
* directly after its creation.
* @param object This array of arbitrary objects will be passed to the
@@ -99,7 +99,7 @@ public class MinimalComponent {
* your component using these objects.
*/
}
-
+
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
@@ -115,7 +115,7 @@ public class MinimalComponent {
String[] sSupportedServiceNames = { __serviceName };
return sSupportedServiceNames;
}
-
+
/** This method returns true, if the given service will be
* supported by the component.
* @param sServiceName Service name.
@@ -124,16 +124,16 @@ public class MinimalComponent {
public boolean supportsService( String sServiceName ) {
return sServiceName.equals( __serviceName );
}
-
+
/** Return the class name of the component.
* @return Class name of the component.
*/
public String getImplementationName() {
return _MinimalComponent.class.getName();
- }
+ }
}
-
-
+
+
/**
* Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -147,11 +147,11 @@ public class MinimalComponent {
public static XSingleComponentFactory __getComponentFactory(String sImplName)
{
XSingleComponentFactory xFactory = null;
-
+
if ( sImplName.equals( _MinimalComponent.class.getName() ) )
xFactory = Factory.createComponentFactory(_MinimalComponent.class,
_MinimalComponent.getServiceNames());
-
+
return xFactory;
}
diff --git a/odk/examples/java/MinimalComponent/TestMinimalComponent.java b/odk/examples/java/MinimalComponent/TestMinimalComponent.java
index 9a6df86f6fe1..219eea7ca504 100644
--- a/odk/examples/java/MinimalComponent/TestMinimalComponent.java
+++ b/odk/examples/java/MinimalComponent/TestMinimalComponent.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.lang.XSingleComponentFactory;
@@ -42,7 +42,7 @@ import com.sun.star.lang.XServiceInfo;
public class TestMinimalComponent {
public static void main(String args[]) {
com.sun.star.uno.XComponentContext xContext = null;
-
+
try {
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
@@ -51,19 +51,19 @@ public class TestMinimalComponent {
XServiceInfo xSIMinimalComponent =
org.openoffice.MinimalComponent.create(xContext);
-
+
System.out.println("\nXServiceInfo is used to get the implementation" +
" name: " +
xSIMinimalComponent.getImplementationName() +
- "\nOk\n");
+ "\nOk\n");
xContext = null;
-
+
System.exit(0);
}
catch( Exception e ) {
System.err.println( e );
e.printStackTrace();
System.exit(1);
- }
+ }
}
}
diff --git a/odk/examples/java/NotesAccess/NotesAccess.java b/odk/examples/java/NotesAccess/NotesAccess.java
index f337304e09c7..e989c9cfa760 100644
--- a/odk/examples/java/NotesAccess/NotesAccess.java
+++ b/odk/examples/java/NotesAccess/NotesAccess.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// Lotus Notes Domino API
@@ -59,29 +59,29 @@ import com.sun.star.table.XCell;
* with existing values of documents from a Lotus Notes database.
*/
public class NotesAccess implements Runnable {
-
+
/** Host server of the Domino Directory.
*/
static String stringHost = "";
-
+
/** User in the host's Domino Directory.
*/
static String stringUser = "";
-
+
/** Password for the user in the host's Domino Directory.
*/
static String stringPassword = "";
-
+
/** Database with documents to get data from.
*/
static String stringDatabase = "";
-
+
/** Reading the arguments and constructing the thread.
* @param argv Holding values for the host, user, and the password of the user.
*/
public static void main( String args[] ) {
Thread thread;
-
+
if ( args.length < 4 ) {
System.out.println(
"usage: java -jar NotesAccess.jar \"<Domino Host>\" \"<User>\" " +
@@ -91,7 +91,7 @@ public class NotesAccess implements Runnable {
"java -jar NotesAccess.jar \"\" \"\" \"\" \"Stocks.nsf\"" );
System.exit( 1 );
}
-
+
if ( !args[ 0 ].trim().equals( "" ) ) {
stringHost = args[ 0 ].trim();
}
@@ -99,7 +99,7 @@ public class NotesAccess implements Runnable {
stringUser = args[ 1 ].trim();
}
stringPassword = args[ 2 ].trim();
-
+
try {
java.io.File sourceFile = new java.io.File(args[ 3 ].trim());
stringDatabase = sourceFile.getCanonicalPath();
@@ -108,31 +108,31 @@ public class NotesAccess implements Runnable {
e.printStackTrace();
System.exit( 1 );
}
-
+
if ( stringHost.equals( "" ) ) {
// Initializing.
NotesAccess notesaccess = new NotesAccess();
-
+
// Allowing only local calls to the Domino classes.
thread = new NotesThread( ( Runnable ) notesaccess );
}
else {
// Extracting the host, user, and password.
NotesAccess notesaccess = new NotesAccess();
-
+
// Allowing remote calls to the Domino classes.
thread = new Thread( ( Runnable ) notesaccess );
}
-
+
// Starting the thread.
thread.start();
}
-
+
/** This is the default constructor without arguments.
*/
public NotesAccess() {
}
-
+
/** Reading all documents from the given database and writing the data to
* an OpenOffice.org Calc spreadsheet document.
*/
@@ -141,11 +141,11 @@ public class NotesAccess implements Runnable {
// get the remote office component context
XComponentContext xContext =
com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
System.out.println("Connected to a running office ...");
-
- XMultiComponentFactory xMCF = xContext.getServiceManager();
-
+
+ XMultiComponentFactory xMCF = xContext.getServiceManager();
+
/* A desktop environment contains tasks with one or more
frames in which components can be loaded. Desktop is the
environment for components which can instanciate within
@@ -154,28 +154,28 @@ public class NotesAccess implements Runnable {
UnoRuntime.queryInterface(XComponentLoader.class,
xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext));
-
+
// Load a Writer document, which will be automaticly displayed
XComponent xComponent = xLoader.loadComponentFromURL(
"private:factory/scalc", "_blank", 0,
new PropertyValue[0] );
-
+
// Querying for the interface XSpreadsheetDocument
XSpreadsheetDocument xSpreadsheetDoc =
(XSpreadsheetDocument) UnoRuntime.queryInterface(
XSpreadsheetDocument.class, xComponent);
-
+
// Getting all sheets from the spreadsheet document.
XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets() ;
-
+
// Querying for the interface XIndexAccess.
XIndexAccess xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
XIndexAccess.class, xSpreadsheets);
-
+
// Getting the first spreadsheet.
XSpreadsheet xSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(
XSpreadsheet.class, xIndexAccess.getByIndex(0));
-
+
Session session;
if ( !stringHost.equals( "" ) ) {
// Creating a Notes session for remote calls to the Domino classes.
@@ -187,69 +187,69 @@ public class NotesAccess implements Runnable {
// Domino classes.
session = NotesFactory.createSession();
}
-
+
// Getting the specified Notes database.
Database database = session.getDatabase( "", stringDatabase );
-
+
// Getting a collection of all documents from the database.
DocumentCollection documentCollection = database.getAllDocuments();
-
+
// Getting the first document from the database
Document document = documentCollection.getFirstDocument();
-
+
// Start to write to cells at this row.
int intRowToStart = 0;
-
+
// The current row.
int intRow = intRowToStart;
-
+
// The current column.
int intColumn = 0;
-
+
// Process all documents
while ( document != null ) {
// Getting the name of the stock.
String stringName = document.getItemValueString("Name");
-
+
// Inserting the name to a specified cell.
insertIntoCell(intColumn, intRow, stringName, xSpreadsheet, "");
-
+
// Getting the number of stocks.
double intNumber = document.getItemValueInteger( "Number" );
-
+
// Inserting the number of stocks to a specified cell.
insertIntoCell( intColumn + 1, intRow, String.valueOf(intNumber),
xSpreadsheet, "V" );
-
+
// Getting current share price.
double doubleSharePrice = document.getItemValueDouble("SharePrice");
-
+
// Inserting the current share price to a specified cell.
insertIntoCell(intColumn + 2, intRow,
String.valueOf(doubleSharePrice),
xSpreadsheet, "V");
-
+
// Inserting the total value.
insertIntoCell(intColumn + 3, intRow, "=B"
+ String.valueOf( intRow + 1 )
+ "*C" + String.valueOf(intRow + 1),
xSpreadsheet, "");
-
+
// Increasing the current row.
intRow++;
-
+
// Getting the next document from the collection.
document = documentCollection.getNextDocument();
}
-
+
// Summing all specific amounts.
insertIntoCell(intColumn + 3, intRow, "=sum(D"
+ String.valueOf( intRowToStart + 1 ) + ":D"
+ String.valueOf( intRow ),
xSpreadsheet, "");
-
+
xContext = null;
-
+
// Leaving the program.
System.exit(0);
}
@@ -257,7 +257,7 @@ public class NotesAccess implements Runnable {
e.printStackTrace();
}
}
-
+
/** Inserting a value or formula to a cell defined by the row and column.
* @param intCellX Row.
* @param intCellY Column.
@@ -272,7 +272,7 @@ public class NotesAccess implements Runnable {
String stringFlag)
{
XCell xCell = null;
-
+
try {
xCell = xSpreadsheet.getCellByPosition( intCellX, intCellY );
} catch ( com.sun.star.lang.IndexOutOfBoundsException exception ) {
diff --git a/odk/examples/java/PropertySet/PropTest.java b/odk/examples/java/PropertySet/PropTest.java
index e8652c7689bb..fded3c08c3ec 100644
--- a/odk/examples/java/PropertySet/PropTest.java
+++ b/odk/examples/java/PropertySet/PropTest.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,11 +29,11 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
/*
-This example shows a UNO component that inherits com.sun.star.lib.uno.helper.PropertySet in
+This example shows a UNO component that inherits com.sun.star.lib.uno.helper.PropertySet in
order to provide implementations of these interfaces:
com.sun.star.beans.XPropertySet
@@ -140,11 +140,11 @@ public class PropTest extends PropertySet implements XServiceInfo
public Object[] arObjectA; // MAYBEVOID
public Any[] arAnyA; // MAYBEVOID
public XInterface[] arXinterfaceA; // MAYBEVOID
- public boolean[][] ar2BoolA; // MAYBEVOID
+ public boolean[][] ar2BoolA; // MAYBEVOID
public Boolean boolClassA; // MAYBEVOID
public Character charClassA; // MAYBEVOID
- public Byte byteClassA; // MAYBEVOID
- public Short shortClassA; // MAYBEVOID
+ public Byte byteClassA; // MAYBEVOID
+ public Short shortClassA; // MAYBEVOID
public Integer intClassA; // MAYBEVOID
public Long longClassA; // MAYBEVOID
public Float floatClassA; // MAYBEVOID
@@ -152,7 +152,7 @@ public class PropTest extends PropertySet implements XServiceInfo
// readonly
public int roIntA= 100;
- public Integer roIntClassA= new Integer(100);
+ public Integer roIntClassA= new Integer(100);
public Object roObjectA= new Integer(101);
public Any roAnyA= new Any( new Type(int.class), new Integer(102));
@@ -167,7 +167,7 @@ public class PropTest extends PropertySet implements XServiceInfo
public Object mvObjectA;
public Any mvAnyA;
public XInterface mvXinterfaceA;
-
+
public static final String __serviceName="PropTest";
public PropTest() {
@@ -219,7 +219,7 @@ public class PropTest extends PropertySet implements XServiceInfo
registerProperty("mvAnyA", PropertyAttribute.MAYBEVOID);
registerProperty("mvXinterfaceA", PropertyAttribute.MAYBEVOID);
}
-
+
// XServiceName
public String getImplementationName( )
@@ -234,7 +234,7 @@ public class PropTest extends PropertySet implements XServiceInfo
return true;
return false;
}
-
+
//XServiceName
public String[] getSupportedServiceNames( )
{
@@ -257,7 +257,7 @@ public class PropTest extends PropertySet implements XServiceInfo
return xSingleServiceFactory;
}
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey)
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey)
{
return FactoryHelper.writeRegistryServiceInfo( PropTest.class.getName(),
PropTest.__serviceName, regKey);
diff --git a/odk/examples/java/Spreadsheet/CalcAddins.java b/odk/examples/java/Spreadsheet/CalcAddins.java
index 6a052a7e2eea..0f0fddad97d3 100644
--- a/odk/examples/java/Spreadsheet/CalcAddins.java
+++ b/odk/examples/java/Spreadsheet/CalcAddins.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// Template for an Office Calc add-in Java implementation file.
@@ -61,7 +61,7 @@ import org.openoffice.sheet.addin.XCalcAddins;
* information about the component (__writeRegistryServiceInfo()).
*/
public class CalcAddins {
-
+
/** This inner class provides the component as a concrete implementation
* of the service description. It implements the needed interfaces.
* @implements XCalcAddins, XAddIn, XServiceName, XServiceInfo, XTypeProvider
@@ -72,15 +72,15 @@ public class CalcAddins {
XServiceName,
XServiceInfo
{
-
+
/** The component will be registered under this name.
*/
static private final String __serviceName = "org.openoffice.sheet.addin.CalcAddins";
-
+
static private final String ADDIN_SERVICE = "com.sun.star.sheet.AddIn";
-
+
private Locale aFuncLoc;
-
+
private static final String[] stringFunctionName = {
/** TO DO:
* You should replace these method names by the method names of your interface.
@@ -88,19 +88,19 @@ public class CalcAddins {
"getMyFirstValue",
"getMySecondValue"
};
-
+
private static final short shortINVALID = -1;
-
+
/** TO DO:
* For each of your methods you should make up a new constant with a different value.
*/
private static final short shortGETMYFIRSTVALUE = 0;
private static final short shortGETMYSECONDVALUE = 1;
-
-
+
+
/** TO DO:
* This is where you implement all methods of your interface. The parameters have to
- * be the same as in your IDL file and their types have to be the correct
+ * be the same as in your IDL file and their types have to be the correct
* IDL-to-Java mappings of their types in the IDL file.
*/
public int getMyFirstValue(
@@ -108,39 +108,39 @@ public class CalcAddins {
) {
return (int) 1;
}
-
+
public int getMySecondValue(
com.sun.star.beans.XPropertySet xOptions,
int intDummy
) {
return( (int) ( 2 + intDummy ) );
}
-
-
+
+
// Implement method from interface XServiceName
public String getServiceName() {
return( __serviceName );
}
-
+
// Implement methods from interface XServiceInfo
public boolean supportsService(String stringServiceName) {
return( stringServiceName.equals( ADDIN_SERVICE ) ||
stringServiceName.equals( __serviceName ) );
}
-
+
public String getImplementationName() {
return( _CalcAddins.class.getName() );
}
-
+
public String[] getSupportedServiceNames() {
String[] stringSupportedServiceNames = { ADDIN_SERVICE, __serviceName };
return( stringSupportedServiceNames );
}
-
+
// Implement methods from interface XAddIn
public String getDisplayArgumentName(String stringProgrammaticFunctionName,int intArgument) {
String stringReturn = "";
-
+
switch( this.getFunctionID( stringProgrammaticFunctionName ) ) {
/** TO DO:
* You should list all argument names for each of your methods, here.
@@ -165,10 +165,10 @@ public class CalcAddins {
}
return( stringReturn );
}
-
+
public String getDisplayFunctionName(String stringProgrammaticName) {
String stringReturn = "";
-
+
switch( this.getFunctionID( stringProgrammaticName ) ) {
/** TO DO:
* Assign the name of each of your methods.
@@ -180,21 +180,21 @@ public class CalcAddins {
stringReturn = "getMySecondValue";
break;
}
-
+
return( stringReturn );
}
-
+
public String getProgrammaticCategoryName(String p1) {
return( "Add-In" );
}
-
+
public String getDisplayCategoryName(String p1) {
return( "Add-In" );
}
-
+
public String getFunctionDescription(String stringProgrammaticName) {
String stringReturn = "";
-
+
switch( this.getFunctionID( stringProgrammaticName ) ) {
/** TO DO:
* Enter a description for each of your methods that office users will understand.
@@ -206,13 +206,13 @@ public class CalcAddins {
stringReturn = "This is your second method.";
break;
}
-
+
return( stringReturn );
}
-
+
public String getArgumentDescription(String stringProgrammaticFunctionName,int intArgument) {
String stringReturn = "";
-
+
switch( this.getFunctionID( stringProgrammaticFunctionName ) ) {
/** TO DO:
* Enter a description for every argument of every method. Make them so that office users will understand.
@@ -237,20 +237,20 @@ public class CalcAddins {
}
return( stringReturn );
}
-
+
public String getProgrammaticFuntionName(String p1) {
return( "" );
}
-
+
// Implement methods from interface XLocalizable
public Locale getLocale() {
return( aFuncLoc );
}
-
+
public void setLocale(Locale p1) {
aFuncLoc = p1;
}
-
+
// Auxiliary functions
private short getFunctionID( String stringProgrammaticName ) {
for ( int i = 0; i < stringFunctionName.length; i++ ) {
@@ -258,11 +258,11 @@ public class CalcAddins {
return( ( short ) i );
}
}
-
+
return( -1 );
}
}
-
+
/**
* Returns a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -277,16 +277,16 @@ public class CalcAddins {
XMultiServiceFactory multiFactory,
XRegistryKey regKey) {
XSingleServiceFactory xSingleServiceFactory = null;
-
+
if (implName.equals(_CalcAddins.class.getName()) )
xSingleServiceFactory = FactoryHelper.getServiceFactory(_CalcAddins.class,
_CalcAddins.__serviceName,
multiFactory,
regKey);
-
+
return xSingleServiceFactory;
}
-
+
/**
* Writes the service information into the given registry key.
* This method is called by the <code>JavaLoader</code>
diff --git a/odk/examples/java/Spreadsheet/ChartTypeChange.java b/odk/examples/java/Spreadsheet/ChartTypeChange.java
index 1a86ee3d0b97..ab4e44bfdc4c 100644
--- a/odk/examples/java/Spreadsheet/ChartTypeChange.java
+++ b/odk/examples/java/Spreadsheet/ChartTypeChange.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.awt.Rectangle;
@@ -73,36 +73,36 @@ import com.sun.star.uno.XComponentContext;
* @author Bertram Nolte
*/
public class ChartTypeChange {
-
+
/** Table chart, which type will be changed.
*/
private XTableChart xtablechart = null;
-
+
/** Service factory
*/
private XMultiComponentFactory xMCF = null;
-
+
/** Component context
*/
private XComponentContext xCompContext = null;
-
+
/** Beginning of the program.
* @param args No arguments will be passed to the class.
*/
public static void main(String args[]) {
try {
ChartTypeChange charttypechange = new ChartTypeChange();
-
+
// Double array holding all values the chart should be based on.
String[][] stringValues = {
{ "", "Jan", "Feb", "Mar", "Apr", "Mai" },
{ "Profit", "12.3", "43.2", "5.1", "76", "56.8" },
{ "Rival in business", "12.2", "12.6", "17.7", "20.4", "100" },
};
-
+
// Create the chart with
charttypechange.getChart( stringValues );
-
+
String[] stringChartType = {
"com.sun.star.chart.LineDiagram",
"com.sun.star.chart.BarDiagram",
@@ -112,39 +112,39 @@ public class ChartTypeChange {
"com.sun.star.chart.StockDiagram",
"com.sun.star.chart.AreaDiagram"
};
-
+
for ( int intCounter = 0; intCounter < stringChartType.length;
intCounter++ ) {
charttypechange.changeChartType( stringChartType[ intCounter ],
false );
Thread.sleep( 3000 );
}
-
+
System.exit(0);
}
catch( Exception exception ) {
System.err.println( exception );
}
}
-
+
/** The constructor connects to the OpenOffice.org.
* @param args Parameters for this constructor (connection string).
* @throws Exception All exceptions are thrown from this method.
*/
public ChartTypeChange()
throws Exception {
-
+
/* Bootstraps a component context. Component context to be granted
to a component for running. Arbitrary values can be retrieved
from the context. */
xCompContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
/* Gets the service manager instance to be used (or null). This method has
been added for convenience, because the service manager is a often used
object. */
- xMCF = xCompContext.getServiceManager();
+ xMCF = xCompContext.getServiceManager();
}
-
+
/** This method will change the type of a specified chart.
* @param stringType The chart will be converted to this type.
* @param booleanIs3D If the chart should be displayed in 3D this parameter should be set to true.
@@ -155,7 +155,7 @@ public class ChartTypeChange {
XEmbeddedObjectSupplier xEmbeddedObjSupplier = (XEmbeddedObjectSupplier)
UnoRuntime.queryInterface(XEmbeddedObjectSupplier.class, xtablechart);
XInterface xInterface = xEmbeddedObjSupplier.getEmbeddedObject();
-
+
XChartDocument xChartDoc = (XChartDocument)UnoRuntime.queryInterface(
XChartDocument.class, xInterface);
XDiagram xDiagram = (XDiagram) xChartDoc.getDiagram();
@@ -163,14 +163,14 @@ public class ChartTypeChange {
UnoRuntime.queryInterface( XMultiServiceFactory.class, xChartDoc );
Object object = xMSF.createInstance( stringType );
xDiagram = (XDiagram) UnoRuntime.queryInterface(XDiagram.class, object);
-
+
XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, xDiagram );
xPropSet.setPropertyValue( "Dim3D", new Boolean( booleanIs3D ) );
-
+
xChartDoc.setDiagram(xDiagram);
}
-
+
/** Loading an OpenOffice.org Calc document and getting a chart by name.
* @param stringFileName Name of the OpenOffice.org Calc document which should
* be loaded.
@@ -186,30 +186,30 @@ public class ChartTypeChange {
UnoRuntime.queryInterface( XComponentLoader.class,
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop",
xCompContext ) );
-
+
// Load a Writer document, which will be automaticly displayed
XComponent xComponent = xComponentloader.loadComponentFromURL(
"file:///" + stringFileName, "_blank", 0,
new PropertyValue[0] );
-
+
// Query for the interface XSpreadsheetDocument
XSpreadsheetDocument xSpreadSheetDocument = ( XSpreadsheetDocument )
UnoRuntime.queryInterface( XSpreadsheetDocument.class, xComponent );
-
+
XSpreadsheets xSpreadsheets = xSpreadSheetDocument.getSheets() ;
-
+
XIndexAccess xIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets );
-
+
XSpreadsheet xSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(
XSpreadsheet.class, xIndexAccess.getByIndex(0));
-
+
XTableChartsSupplier xTableChartsSupplier = ( XTableChartsSupplier )
UnoRuntime.queryInterface( XTableChartsSupplier.class, xSpreadsheet );
-
+
xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
XIndexAccess.class, xTableChartsSupplier.getCharts() );
-
+
this.xtablechart = (XTableChart) UnoRuntime.queryInterface(
XTableChart.class, xIndexAccess.getByIndex( 0 ) );
}
@@ -217,7 +217,7 @@ public class ChartTypeChange {
System.err.println( exception );
}
}
-
+
/** Creating an empty OpenOffice.org Calc document, inserting data, and getting a
* chart by name.
* @param stringValues Double array with the values for the chart.
@@ -233,27 +233,27 @@ public class ChartTypeChange {
xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop",
xCompContext ) );
-
+
// Create an empty calc document, which will be automaticly displayed
XComponent xComponent = xcomponentloader.loadComponentFromURL(
"private:factory/scalc", "_blank", 0,
new PropertyValue[0] );
-
+
// Query for the interface XSpreadsheetDocument
XSpreadsheetDocument xspreadsheetdocument = ( XSpreadsheetDocument )
UnoRuntime.queryInterface( XSpreadsheetDocument.class, xComponent );
-
+
// Get all sheets of the spreadsheet document.
XSpreadsheets xspreadsheets = xspreadsheetdocument.getSheets() ;
-
+
// Get the index of the spreadsheet document.
XIndexAccess xindexaccess = (XIndexAccess) UnoRuntime.queryInterface(
XIndexAccess.class, xspreadsheets );
-
+
// Get the first spreadsheet.
XSpreadsheet xspreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(
XSpreadsheet.class, xindexaccess.getByIndex(0));
-
+
// The double array will written to the spreadsheet
for ( int intY = 0; intY < stringValues.length; intY++ ) {
for ( int intX = 0; intX < stringValues[ intY ].length;
@@ -263,21 +263,21 @@ public class ChartTypeChange {
stringValues[ intY ][ intX ], xspreadsheet, "" );
}
}
-
+
// Create a rectangle, which holds the size of the chart.
Rectangle rectangle = new Rectangle();
rectangle.X = 500;
rectangle.Y = 3000;
rectangle.Width = 25000;
rectangle.Height = 11000;
-
+
// Get the cell range of the spreadsheet.
XCellRange xcellrange = ( XCellRange ) UnoRuntime.queryInterface(
XCellRange.class, xspreadsheet );
-
+
// Create the Unicode of the character for the column name.
char charRectangle = ( char ) ( 65 + stringValues.length - 1 );
-
+
// Get maximum length all rows in the double array.
int intMaximumWidthRow = 0;
for ( int intRow = 0; intRow < stringValues.length; intRow++ ) {
@@ -285,35 +285,35 @@ public class ChartTypeChange {
intMaximumWidthRow = stringValues[ intRow ].length;
}
}
-
+
// Get the cell range of the written values.
XCellRange xcellrangeChart = xcellrange.getCellRangeByName( "A1:" +
charRectangle + intMaximumWidthRow );
-
+
// Get the addressable cell range.
XCellRangeAddressable xcellrangeaddressable =
( XCellRangeAddressable ) UnoRuntime.queryInterface(
XCellRangeAddressable.class, xcellrangeChart );
-
+
// Get the cell range address.
CellRangeAddress cellrangeaddress = xcellrangeaddressable.getRangeAddress();
-
+
// Create the cell range address for the chart.
CellRangeAddress[] cellrangeaddressChart =
new CellRangeAddress[ 1 ];
cellrangeaddressChart[ 0 ] = cellrangeaddress;
-
+
// Get the table charts supplier of the spreadsheet.
XTableChartsSupplier xtablechartssupplier = ( XTableChartsSupplier )
UnoRuntime.queryInterface( XTableChartsSupplier.class, xspreadsheet );
-
+
// Get all table charts of the spreadsheet.
XTableCharts xtablecharts = xtablechartssupplier.getCharts();
-
+
// Create a table chart with all written values.
xtablecharts.addNewByName( "Example", rectangle,
cellrangeaddressChart, true, true );
-
+
// Get the created table chart.
this.xtablechart = ( XTableChart ) UnoRuntime.queryInterface(
XTableChart.class, (( XNameAccess ) UnoRuntime.queryInterface(
@@ -323,7 +323,7 @@ public class ChartTypeChange {
System.err.println( exception );
}
}
-
+
/** Inserting a given value to a cell, that is specified by the parameters intX
* and intY.
* @param intX Column on the spreadsheet.
@@ -338,7 +338,7 @@ public class ChartTypeChange {
XSpreadsheet xspreadsheet, String stringFlag )
{
XCell xcell = null;
-
+
try {
xcell = xspreadsheet.getCellByPosition( intX, intY );
}
diff --git a/odk/examples/java/Spreadsheet/EuroAdaption.java b/odk/examples/java/Spreadsheet/EuroAdaption.java
index f167f93810bd..43c2b47d138c 100644
--- a/odk/examples/java/Spreadsheet/EuroAdaption.java
+++ b/odk/examples/java/Spreadsheet/EuroAdaption.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -79,68 +79,68 @@ import com.sun.star.util.XNumberFormatsSupplier;
public class EuroAdaption {
- public static void main(String args[]) {
+ public static void main(String args[]) {
// You need the desktop to create a document
// The getDesktop method does the UNO bootstrapping, gets the
// remote servie manager and the desktop object.
com.sun.star.frame.XDesktop xDesktop = null;
xDesktop = getDesktop();
-
+
// create a sheet document
XSpreadsheetDocument xSheetdocument = null;
xSheetdocument = ( XSpreadsheetDocument ) createSheetdocument( xDesktop );
System.out.println( "Create a new Spreadsheet" );
-
+
// get the collection of all sheets from the document
XSpreadsheets xSheets = null;
xSheets = (XSpreadsheets) xSheetdocument.getSheets();
-
+
// the Action Interface provides methods to hide actions,
// like inserting data, on a sheet, that increase the performance
XActionLockable xActionInterface = null;
xActionInterface = (XActionLockable) UnoRuntime.queryInterface(
XActionLockable.class, xSheetdocument );
-
+
// lock all actions
xActionInterface.addActionLock();
-
+
com.sun.star.sheet.XSpreadsheet xSheet = null;
try {
// get via the index access the first sheet
XIndexAccess xElements = (XIndexAccess) UnoRuntime.queryInterface(
XIndexAccess.class, xSheets );
- // specify the first sheet from the spreadsheet
+ // specify the first sheet from the spreadsheet
xSheet = (XSpreadsheet) UnoRuntime.queryInterface(
- XSpreadsheet.class, xElements.getByIndex( 0 ));
+ XSpreadsheet.class, xElements.getByIndex( 0 ));
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
// get the interface to apply and create new numberformats
XNumberFormatsSupplier xNumberFormatSupplier = null;
xNumberFormatSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(
XNumberFormatsSupplier.class, xSheetdocument );
XNumberFormats xNumberFormats = null;
xNumberFormats = xNumberFormatSupplier.getNumberFormats();
-
+
// insert some example data in a sheet
createExampleData( xSheet, xNumberFormats );
System.out.println( "Insert example data and use the number format with the currency 'DM'" );
-
+
// Change the currency from the cells from DM to Euro
Convert( xSheet, xNumberFormats, "DM", "EUR", 1.95583f );
System.out.println( "Change the number format to EUR and divide the values with the factor 1.95583" );
-
+
// remove all locks, the user see all changes
xActionInterface.removeActionLock();
-
+
System.out.println("done");
System.exit(0);
}
-
-
+
+
public static void Convert( XSpreadsheet xSheet, XNumberFormats xNumberFormats,
String sOldSymbol, String sNewSymbol,
float fFactor ) {
@@ -148,51 +148,51 @@ public class EuroAdaption {
Locale xLanguage = new Locale();
xLanguage.Country = "de"; // Germany -> DM
xLanguage.Language = "de"; // German
-
+
// Numberformat string with sNewSymbol
String sSimple = "0 [$" + sNewSymbol + "]";
// create a number format key with the sNewSymbol
int iSimpleKey = NumberFormat( xNumberFormats, sSimple, xLanguage );
-
+
// you have to use the FormatSupplier interface to get the
// CellFormat enumeration
XCellFormatRangesSupplier xCellFormatSupplier =
(XCellFormatRangesSupplier)UnoRuntime.queryInterface(
XCellFormatRangesSupplier.class, xSheet );
-
+
// getCellFormatRanges() has the interfaces for the enumeration
XEnumerationAccess xEnumerationAccess =
(XEnumerationAccess)UnoRuntime.queryInterface(
XEnumerationAccess.class,
xCellFormatSupplier.getCellFormatRanges() );
-
+
XEnumeration xRanges = xEnumerationAccess.createEnumeration();
// create an AnyConverter for later use
AnyConverter aAnyConv = new AnyConverter();
-
+
while( xRanges.hasMoreElements() ) {
// the enumeration returns a cellrange
XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(
XCellRange.class, xRanges.nextElement());
-
+
// the PropertySet the get and set the properties from the cellrange
XPropertySet xCellProp = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xCellRange );
-
+
// getPropertyValue returns an Object, you have to cast it to
// type that you need
Object oNumberObject = xCellProp.getPropertyValue( "NumberFormat" );
int iNumberFormat = aAnyConv.toInt(oNumberObject);
-
+
// get the properties from the cellrange numberformat
XPropertySet xFormat = (XPropertySet)
xNumberFormats.getByKey(iNumberFormat );
-
+
short fType = aAnyConv.toShort(xFormat.getPropertyValue("Type"));
String sCurrencySymbol = aAnyConv.toString(
xFormat.getPropertyValue("CurrencySymbol"));
-
+
// change the numberformat only on cellranges with a
// currency numberformat
if( ( (fType & com.sun.star.util.NumberFormat.CURRENCY) > 0) &&
@@ -208,36 +208,36 @@ public class EuroAdaption {
Locale oLocale = (Locale) aAnyConv.toObject(
new com.sun.star.uno.Type(Locale.class),
xFormat.getPropertyValue("Locale"));
-
+
// create a new numberformat string
String sNew = xNumberFormats.generateFormat( iSimpleKey,
oLocale, bThousandSep, bNegativeRed,
fDecimals, fLeadingZeros );
-
+
// get the NumberKey from the numberformat
int iNewNumberFormat = NumberFormat( xNumberFormats,
sNew, oLocale );
-
+
// set the new numberformat to the cellrange DM->EUR
xCellProp.setPropertyValue( "NumberFormat",
new Integer( iNewNumberFormat ) );
-
+
// interate over all cells from the cellrange with an
// content and use the DM/EUR factor
XCellRangesQuery xCellRangesQuery = (XCellRangesQuery)
UnoRuntime.queryInterface(
XCellRangesQuery.class, xCellRange );
-
+
XSheetCellRanges xSheetCellRanges =
xCellRangesQuery.queryContentCells(
(short) com.sun.star.sheet.CellFlags.VALUE );
-
+
if( xSheetCellRanges.getCount() > 0 ) {
XEnumerationAccess xCellEnumerationAccess =
xSheetCellRanges.getCells();
XEnumeration xCellEnumeration =
xCellEnumerationAccess.createEnumeration();
-
+
while( xCellEnumeration.hasMoreElements() ) {
XCell xCell = (XCell) UnoRuntime.queryInterface(
XCell.class, xCellEnumeration.nextElement());
@@ -251,16 +251,16 @@ public class EuroAdaption {
e.printStackTrace(System.err);
}
}
-
-
+
+
public static int NumberFormat( XNumberFormats xNumberFormat, String sFormat,
com.sun.star.lang.Locale xLanguage ) {
int nRetKey = 0;
-
+
try {
// exists the numberformat
nRetKey = xNumberFormat.queryKey( sFormat, xLanguage, true );
-
+
// if not, create a new one
if( nRetKey == -1 ) {
nRetKey = xNumberFormat.addNew( sFormat, xLanguage );
@@ -271,36 +271,36 @@ public class EuroAdaption {
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return( nRetKey );
}
-
-
+
+
public static void createExampleData( XSpreadsheet xSheet,
XNumberFormats xNumberFormat ) {
-
+
// enter in a cellrange numbers and change the numberformat to DM
XCell xCell = null;
XCellRange xCellRange = null;
-
+
try {
Locale xLanguage = new Locale();
xLanguage.Country = "de"; // Germany -> DM
xLanguage.Language = "de"; // German
-
+
// Numberformat string from DM
String sSimple = "0 [$DM]";
-
+
// get the numberformat key
int iNumberFormatKey = NumberFormat(xNumberFormat, sSimple, xLanguage);
-
+
for( int iCounter=1; iCounter < 10; iCounter++ ) {
// get one cell and insert a number
xCell = xSheet.getCellByPosition( 2, 1 + iCounter );
xCell.setValue( (double) iCounter * 2 );
xCellRange = xSheet.getCellRangeByPosition( 2, 1 + iCounter,
2, 1 + iCounter );
-
+
// get the ProperySet from the cell, to change the numberformat
XPropertySet xCellProp = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xCellRange );
@@ -312,17 +312,17 @@ public class EuroAdaption {
e.printStackTrace(System.err);
}
}
-
+
public static XDesktop getDesktop() {
XDesktop xDesktop = null;
XMultiComponentFactory xMCF = null;
-
+
try {
XComponentContext xContext = null;
-
+
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
// get the remote office service manager
xMCF = xContext.getServiceManager();
if( xMCF != null ) {
@@ -340,50 +340,50 @@ public class EuroAdaption {
e.printStackTrace(System.err);
System.exit(1);
}
-
-
+
+
return xDesktop;
}
-
-
+
+
public static XSpreadsheetDocument createSheetdocument( XDesktop xDesktop ) {
XSpreadsheetDocument aSheetDocument = null;
-
+
try {
XComponent xComponent = null;
xComponent = CreateNewDocument( xDesktop, "scalc" );
-
+
aSheetDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(
XSpreadsheetDocument.class, xComponent);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return aSheetDocument;
}
-
+
protected static XComponent CreateNewDocument( XDesktop xDesktop,
String sDocumentType ) {
String sURL = "private:factory/" + sDocumentType;
-
+
XComponent xComponent = null;
XComponentLoader xComponentLoader = null;
PropertyValue xValues[] = new PropertyValue[1];
PropertyValue xEmptyArgs[] = new PropertyValue[0];
-
+
try {
xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(
XComponentLoader.class, xDesktop );
-
+
xComponent = xComponentLoader.loadComponentFromURL(
sURL, "_blank", 0, xEmptyArgs);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return xComponent ;
}
-
+
}
diff --git a/odk/examples/java/Spreadsheet/SCalc.java b/odk/examples/java/Spreadsheet/SCalc.java
index 1ff2c56ddbdb..1938244f5733 100644
--- a/odk/examples/java/Spreadsheet/SCalc.java
+++ b/odk/examples/java/Spreadsheet/SCalc.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -82,15 +82,15 @@ import com.sun.star.table.XTableChartsSupplier;
public class SCalc {
-
+
public static void main(String args[]) {
-
+
//oooooooooooooooooooooooooooStep 1oooooooooooooooooooooooooooooooooooooooooo
// call UNO bootstrap method and get the remote component context form
// the a running office (office will be started if necessary)
//***************************************************************************
XComponentContext xContext = null;
-
+
// get the remote office component context
try {
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
@@ -106,26 +106,26 @@ public class SCalc {
// is created. The desktop provides the XComponentLoader interface,
// which is used to open the document via loadComponentFromURL
//***************************************************************************
-
+
//Open document
-
+
//Calc
XSpreadsheetDocument myDoc = null;
// XCell oCell = null;
-
+
System.out.println("Opening an empty Calc document");
myDoc = openCalc(xContext);
-
+
//***************************************************************************
-
-
+
+
//oooooooooooooooooooooooooooStep 3oooooooooooooooooooooooooooooooooooooooooo
// create cell styles.
// For this purpose get the StyleFamiliesSupplier and the the familiy
// CellStyle. Create an instance of com.sun.star.style.CellStyle and
// add it to the family. Now change some properties
//***************************************************************************
-
+
try {
XStyleFamiliesSupplier xSFS = (XStyleFamiliesSupplier)
UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, myDoc);
@@ -155,9 +155,9 @@ public class SCalc {
} catch (Exception e) {
e.printStackTrace(System.err);
}
-
+
//***************************************************************************
-
+
//oooooooooooooooooooooooooooStep 4oooooooooooooooooooooooooooooooooooooooooo
// get the sheet an insert some data.
// Get the sheets from the document and then the first from this container.
@@ -165,10 +165,10 @@ public class SCalc {
// getCellByPosition and insert into this cell via setValue() (for floats)
// or setFormula() for formulas and Strings
//***************************************************************************
-
-
+
+
XSpreadsheet xSheet=null;
-
+
try {
System.out.println("Getting spreadsheet") ;
XSpreadsheets xSheets = myDoc.getSheets() ;
@@ -176,16 +176,16 @@ public class SCalc {
XIndexAccess.class, xSheets);
xSheet = (XSpreadsheet) UnoRuntime.queryInterface(
XSpreadsheet.class, oIndexSheets.getByIndex(0));
-
+
} catch (Exception e) {
System.out.println("Couldn't get Sheet " +e);
e.printStackTrace(System.err);
}
-
-
-
+
+
+
System.out.println("Creating the Header") ;
-
+
insertIntoCell(1,0,"JAN",xSheet,"");
insertIntoCell(2,0,"FEB",xSheet,"");
insertIntoCell(3,0,"MAR",xSheet,"");
@@ -199,10 +199,10 @@ public class SCalc {
insertIntoCell(11,0,"NOV",xSheet,"");
insertIntoCell(12,0,"DEC",xSheet,"");
insertIntoCell(13,0,"SUM",xSheet,"");
-
-
+
+
System.out.println("Fill the lines");
-
+
insertIntoCell(0,1,"Smith",xSheet,"");
insertIntoCell(1,1,"42",xSheet,"V");
insertIntoCell(2,1,"58.9",xSheet,"V");
@@ -217,8 +217,8 @@ public class SCalc {
insertIntoCell(11,1,"22.4",xSheet,"V");
insertIntoCell(12,1,"23.5",xSheet,"V");
insertIntoCell(13,1,"=SUM(B2:M2)",xSheet,"");
-
-
+
+
insertIntoCell(0,2,"Jones",xSheet,"");
insertIntoCell(1,2,"21",xSheet,"V");
insertIntoCell(2,2,"40.9",xSheet,"V");
@@ -233,7 +233,7 @@ public class SCalc {
insertIntoCell(11,2,"25.4",xSheet,"V");
insertIntoCell(12,2,"28.5",xSheet,"V");
insertIntoCell(13,2,"=SUM(B3:M3)",xSheet,"");
-
+
insertIntoCell(0,3,"Brown",xSheet,"");
insertIntoCell(1,3,"31.45",xSheet,"V");
insertIntoCell(2,3,"-20.9",xSheet,"V");
@@ -248,22 +248,22 @@ public class SCalc {
insertIntoCell(11,3,"25.4",xSheet,"V");
insertIntoCell(12,3,"38.5",xSheet,"V");
insertIntoCell(13,3,"=SUM(A4:L4)",xSheet,"");
-
+
//***************************************************************************
-
+
//oooooooooooooooooooooooooooStep 5oooooooooooooooooooooooooooooooooooooooooo
// apply the created cell style.
// For this purpose get the PropertySet of the Cell and change the
// property CellStyle to the appropriate value.
//***************************************************************************
-
+
// change backcolor
chgbColor( 1 , 0, 13, 0, "My Style", xSheet );
chgbColor( 0 , 1, 0, 3, "My Style", xSheet );
chgbColor( 1 , 1, 13, 3, "My Style2", xSheet );
-
+
//***************************************************************************
-
+
//oooooooooooooooooooooooooooStep 6oooooooooooooooooooooooooooooooooooooooooo
// insert a 3D chart.
// get the CellRange which holds the data for the chart and its RangeAddress
@@ -272,36 +272,36 @@ public class SCalc {
// get the ChartDocument, which provide the Diagramm. Change the properties
// Dim3D (3 dimension) and String (the title) of the diagramm.
//***************************************************************************
-
+
// insert a chart
-
+
Rectangle oRect = new Rectangle();
oRect.X = 500;
oRect.Y = 3000;
oRect.Width = 25000;
oRect.Height = 11000;
-
+
XCellRange oRange = (XCellRange)UnoRuntime.queryInterface(
XCellRange.class, xSheet);
XCellRange myRange = oRange.getCellRangeByName("A1:N4");
XCellRangeAddressable oRangeAddr = (XCellRangeAddressable)
UnoRuntime.queryInterface(XCellRangeAddressable.class, myRange);
CellRangeAddress myAddr = oRangeAddr.getRangeAddress();
-
+
CellRangeAddress[] oAddr = new CellRangeAddress[1];
oAddr[0] = myAddr;
XTableChartsSupplier oSupp = (XTableChartsSupplier)UnoRuntime.queryInterface(
XTableChartsSupplier.class, xSheet);
-
+
XTableChart oChart = null;
-
+
System.out.println("Insert Chart");
-
+
XTableCharts oCharts = oSupp.getCharts();
oCharts.addNewByName("Example", oRect, oAddr, true, true);
-
+
// get the diagramm and Change some of the properties
-
+
try {
oChart = (XTableChart) (UnoRuntime.queryInterface(
XTableChart.class, ((XNameAccess)UnoRuntime.queryInterface(
@@ -326,19 +326,19 @@ public class SCalc {
System.err.println("Changin Properties failed "+e);
e.printStackTrace(System.err);
}
-
- System.out.println("done");
+
+ System.out.println("done");
System.exit(0);
}
-
+
public static XSpreadsheetDocument openCalc(XComponentContext xContext)
- {
+ {
//define variables
XMultiComponentFactory xMCF = null;
XComponentLoader xCLoader;
XSpreadsheetDocument xSpreadSheetDoc = null;
XComponent xComp = null;
-
+
try {
// get the servie manager rom the office
xMCF = xContext.getServiceManager();
@@ -350,28 +350,28 @@ public class SCalc {
// query the desktop object for the XComponentLoader
xCLoader = ( XComponentLoader ) UnoRuntime.queryInterface(
XComponentLoader.class, oDesktop );
-
+
PropertyValue [] szEmptyArgs = new PropertyValue [0];
String strDoc = "private:factory/scalc";
xComp = xCLoader.loadComponentFromURL(strDoc, "_blank", 0, szEmptyArgs );
xSpreadSheetDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface(
XSpreadsheetDocument.class, xComp);
-
- } catch(Exception e){
+
+ } catch(Exception e){
System.err.println(" Exception " + e);
e.printStackTrace(System.err);
- }
-
+ }
+
return xSpreadSheetDoc;
}
-
-
+
+
public static void insertIntoCell(int CellX, int CellY, String theValue,
XSpreadsheet TT1, String flag)
- {
+ {
XCell xCell = null;
-
+
try {
xCell = TT1.getCellByPosition(CellX, CellY);
} catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
@@ -384,9 +384,9 @@ public class SCalc {
} else {
xCell.setFormula(theValue);
}
-
+
}
-
+
public static void chgbColor( int x1, int y1, int x2, int y2,
String template, XSpreadsheet TT )
{
@@ -397,10 +397,10 @@ public class SCalc {
System.err.println("Could not get CellRange");
ex.printStackTrace(System.err);
}
-
+
XPropertySet xCPS = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xCR );
-
+
try {
xCPS.setPropertyValue("CellStyle", template);
} catch (Exception e) {
@@ -408,5 +408,5 @@ public class SCalc {
e.printStackTrace(System.err);
}
}
-
+
}
diff --git a/odk/examples/java/Spreadsheet/XCalcAddins.idl b/odk/examples/java/Spreadsheet/XCalcAddins.idl
index bd515b6ebced..403c1f138ef4 100644
--- a/odk/examples/java/Spreadsheet/XCalcAddins.idl
+++ b/odk/examples/java/Spreadsheet/XCalcAddins.idl
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
#ifndef INCLUDED_ORG_OPENOFFICE_SHEET_ADDIN_XCALCADDIN_IDL
#define INCLUDED_ORG_OPENOFFICE_SHEET_ADDIN_XCALCADDIN_IDL
@@ -68,7 +68,7 @@ module org {
*/
[in] com::sun::star::beans::XPropertySet xOptions
);
-
+
long getMySecondValue(
/** Parameters:
You could insert further arguments after the
diff --git a/odk/examples/java/Storage/StorageFunctionality.java b/odk/examples/java/Storage/StorageFunctionality.java
index 0532259821b9..01708044f80f 100644
--- a/odk/examples/java/Storage/StorageFunctionality.java
+++ b/odk/examples/java/Storage/StorageFunctionality.java
@@ -18,7 +18,7 @@ import com.sun.star.lang.*;
import storagetesting.*;
public class StorageFunctionality {
-
+
public static void main( String args[] )
{
// connect to the office
@@ -28,9 +28,9 @@ public class StorageFunctionality {
if ( args.length == 1 ) {
sConnectionString = args[0];
}
-
+
XMultiServiceFactory xMSF = null;
-
+
// create connection(s) and get multiservicefactory
try {
xMSF = connect( sConnectionString );
@@ -44,7 +44,7 @@ public class StorageFunctionality {
System.out.println( "Error: Couldn't get MSF, exception: " + e );
return;
}
-
+
XSingleServiceFactory xStorageFactory = null;
try
{
@@ -100,11 +100,11 @@ public class StorageFunctionality {
System.out.println( "\ntesting failed" );
System.out.println( "done" );
-
+
System.exit( 0 );
- }
-
-
+ }
+
+
public static XMultiServiceFactory connect( String sConnectStr )
throws com.sun.star.uno.Exception,
com.sun.star.uno.RuntimeException,
@@ -114,34 +114,34 @@ public class StorageFunctionality {
XComponentContext xComponentContext =
com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(
null );
-
+
// initial serviceManager
XMultiComponentFactory xLocalServiceManager =
xComponentContext.getServiceManager();
-
+
// create a connector, so that it can contact the office
Object oUrlResolver = xLocalServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", xComponentContext );
XUnoUrlResolver xUrlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface(
XUnoUrlResolver.class, oUrlResolver );
-
+
Object oInitialObject = xUrlResolver.resolve( sConnectStr );
XNamingService xName = (XNamingService)UnoRuntime.queryInterface(
XNamingService.class, oInitialObject );
-
+
XMultiServiceFactory xMSF = null;
if( xName != null ) {
System.err.println( "got the remote naming service !" );
Object oMSF = xName.getRegisteredObject("StarOffice.ServiceManager" );
-
+
xMSF = (XMultiServiceFactory)
UnoRuntime.queryInterface( XMultiServiceFactory.class, oMSF );
}
else
System.out.println( "Error: Can't get XNamingService interface from url resolver!" );
-
+
return xMSF;
}
-
+
}
diff --git a/odk/examples/java/Storage/Test01.java b/odk/examples/java/Storage/Test01.java
index 7c3309dbcbbd..7c9de41c37be 100644
--- a/odk/examples/java/Storage/Test01.java
+++ b/odk/examples/java/Storage/Test01.java
@@ -36,7 +36,7 @@ public class Test01 implements StorageTest {
m_aTestHelper.Error( "No valid temporary file was created!" );
return false;
}
-
+
// create temporary storage based on arbitrary medium
// after such a storage is closed it is lost
Object oTempStorage = m_xStorageFactory.createInstance();
@@ -56,7 +56,7 @@ public class Test01 implements StorageTest {
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
-
+
byte pBytes1[] = { 1, 1, 1, 1, 1 };
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
@@ -68,7 +68,7 @@ public class Test01 implements StorageTest {
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream2", "MediaType2", false, pBytes2 ) )
return false;
-
+
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage,
"MediaType3",
@@ -82,7 +82,7 @@ public class Test01 implements StorageTest {
false,
ElementModes.ELEMENT_WRITE ) )
return false;
-
+
// create temporary storage based on a previously created temporary file
Object pArgs[] = new Object[2];
pArgs[0] = (Object) sTempFileURL;
@@ -131,7 +131,7 @@ public class Test01 implements StorageTest {
m_aTestHelper.Error( "Can't open existing substorage!" );
return false;
}
-
+
if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType4", false, ElementModes.ELEMENT_READ ) )
return false;
@@ -152,7 +152,7 @@ public class Test01 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/Test02.java b/odk/examples/java/Storage/Test02.java
index 40f8706657b9..b258f10ca999 100644
--- a/odk/examples/java/Storage/Test02.java
+++ b/odk/examples/java/Storage/Test02.java
@@ -35,7 +35,7 @@ public class Test02 implements StorageTest {
XStream xTempFileStream = m_aTestHelper.CreateTempFileStream( m_xMSF );
if ( xTempFileStream == null )
return false;
-
+
// create storage based on the temporary stream
Object pArgs[] = new Object[2];
pArgs[0] = (Object) xTempFileStream;
@@ -58,7 +58,7 @@ public class Test02 implements StorageTest {
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
-
+
byte pBytes1[] = { 1, 1, 1, 1, 1 };
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
@@ -78,7 +78,7 @@ public class Test02 implements StorageTest {
false,
ElementModes.ELEMENT_WRITE ) )
return false;
-
+
// commit substorage first
if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
return false;
@@ -106,7 +106,7 @@ public class Test02 implements StorageTest {
if ( xTempInStream == null )
return false;
-
+
// open input stream
// since no mode is provided the result storage must be opened readonly
Object pOneArg[] = new Object[1];
@@ -132,7 +132,7 @@ public class Test02 implements StorageTest {
m_aTestHelper.Error( "Can't open existing substorage!" );
return false;
}
-
+
if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType3", false, ElementModes.ELEMENT_READ ) )
return false;
@@ -146,7 +146,7 @@ public class Test02 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/Test03.java b/odk/examples/java/Storage/Test03.java
index 962e52323e6a..f1d5d415067f 100644
--- a/odk/examples/java/Storage/Test03.java
+++ b/odk/examples/java/Storage/Test03.java
@@ -50,7 +50,7 @@ public class Test03 implements StorageTest {
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
-
+
byte pBytes1[] = { 1, 1, 1, 1, 1 };
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
@@ -72,10 +72,10 @@ public class Test03 implements StorageTest {
if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
return false;
-
+
if ( !m_aTestHelper.disposeStorage( xTempSubStorage ) )
return false;
-
+
// ================================================
// check storage hyerarchy tree
// ================================================
@@ -145,14 +145,14 @@ public class Test03 implements StorageTest {
return false;
}
- if ( !( sRootCont[0].equals( "SubStorage1" ) && sRootCont[1].equals( "SubStream1" )
+ if ( !( sRootCont[0].equals( "SubStorage1" ) && sRootCont[1].equals( "SubStream1" )
|| sRootCont[0].equals( "SubStream1" ) && sRootCont[1].equals( "SubStorage1" ) )
|| !( xRootNameAccess.hasByName( "SubStream1" ) && xRootNameAccess.hasByName( "SubStorage1" ) ) )
{
m_aTestHelper.Error( "Root storage contains wrong list of children!" );
return false;
}
-
+
// get storage through XNameAccess
XStorage xResultSubStorage = getStorageFromNameAccess( xRootNameAccess, "SubStorage1" );
if ( xResultSubStorage == null )
@@ -175,7 +175,7 @@ public class Test03 implements StorageTest {
m_aTestHelper.Error( "'SubStream2' can not be detected as child stream element of 'SubStorage1'!" );
return false;
}
-
+
return true;
}
catch( Exception e )
@@ -183,7 +183,7 @@ public class Test03 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
public XStorage getStorageFromNameAccess( XNameAccess xAccess, String sName )
{
diff --git a/odk/examples/java/Storage/Test04.java b/odk/examples/java/Storage/Test04.java
index 19b988f10ff5..943fcfff8a38 100644
--- a/odk/examples/java/Storage/Test04.java
+++ b/odk/examples/java/Storage/Test04.java
@@ -39,7 +39,7 @@ public class Test04 implements StorageTest {
m_aTestHelper.Error( "No valid temporary file was created!" );
return false;
}
-
+
// create temporary storage based on arbitrary medium
// after such a storage is closed it is lost
Object oTempStorage = m_xStorageFactory.createInstance();
@@ -61,7 +61,7 @@ public class Test04 implements StorageTest {
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
-
+
byte pBytes1[] = { 1, 1, 1, 1, 1 };
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
@@ -83,7 +83,7 @@ public class Test04 implements StorageTest {
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage2, "SubStream2", "MediaType2", false, pBytes2 ) )
return false;
-
+
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage,
"MediaType3",
@@ -97,14 +97,14 @@ public class Test04 implements StorageTest {
false,
ElementModes.ELEMENT_WRITE ) )
return false;
-
+
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage2,
"MediaType5",
false,
ElementModes.ELEMENT_WRITE ) )
return false;
-
+
// create temporary storage based on a previously created temporary file
Object pArgs[] = new Object[2];
pArgs[0] = (Object) sTempFileURL;
@@ -124,7 +124,7 @@ public class Test04 implements StorageTest {
// if storage is not commited before disposing all the changes will be lost
if ( !m_aTestHelper.commitStorage( xTempSubStorage2 ) )
return false;
-
+
// a storage must be disposed before moving/removing otherwise the access will be denied
if ( !m_aTestHelper.disposeStorage( xTempSubStorage2 ) )
return false;
@@ -187,7 +187,7 @@ public class Test04 implements StorageTest {
m_aTestHelper.Error( "Can't open existing substorage!" );
return false;
}
-
+
if ( !m_aTestHelper.checkStorageProperties( xResSubStorage1, "MediaType4", false, ElementModes.ELEMENT_READ ) )
return false;
@@ -227,7 +227,7 @@ public class Test04 implements StorageTest {
// remove element and check that it was removed completelly
if ( !m_aTestHelper.removeElement( xResStorage, "SubStorage2" ) )
return false;
-
+
try
{
XNameAccess xResAccess = (XNameAccess) UnoRuntime.queryInterface( XNameAccess.class, xResStorage );
@@ -267,7 +267,7 @@ public class Test04 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/Test05.java b/odk/examples/java/Storage/Test05.java
index 5d2f2e359136..263e2d2561c7 100644
--- a/odk/examples/java/Storage/Test05.java
+++ b/odk/examples/java/Storage/Test05.java
@@ -70,7 +70,7 @@ public class Test05 implements StorageTest {
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
-
+
byte pBytes1[] = { 1, 1, 1, 1, 1 };
@@ -83,7 +83,7 @@ public class Test05 implements StorageTest {
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
if ( !m_aTestHelper.WriteBytesToSubstream( xSubSubStorage, "SubStream2", "MediaType2", false, pBytes2 ) )
return false;
-
+
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempFileStorage,
"MediaType3",
@@ -167,7 +167,7 @@ public class Test05 implements StorageTest {
m_aTestHelper.Error( "Wrong exception is thrown by disposed storage: " + e );
return false;
}
-
+
try
{
xSubStream1.getInputStream();
@@ -195,7 +195,7 @@ public class Test05 implements StorageTest {
m_aTestHelper.Error( "Wrong exception is thrown by disposed stream: " + e );
return false;
}
-
+
// dispose root storage
if ( !m_aTestHelper.disposeStorage( xTempFileStorage ) )
@@ -227,7 +227,7 @@ public class Test05 implements StorageTest {
m_aTestHelper.Error( "Can't open existing substorage 'SubSubStorage'!" );
return false;
}
-
+
if ( !m_aTestHelper.checkStorageProperties( xResSubStorage, "MediaType4", false, ElementModes.ELEMENT_READ ) )
return false;
@@ -240,7 +240,7 @@ public class Test05 implements StorageTest {
m_aTestHelper.Error( "Can't open existing substorage 'SubSubStorage'!" );
return false;
}
-
+
if ( !m_aTestHelper.checkStorageProperties( xResSubSubStorage, "MediaType5", false, ElementModes.ELEMENT_READ ) )
return false;
@@ -262,7 +262,7 @@ public class Test05 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/Test06.java b/odk/examples/java/Storage/Test06.java
index 854bc27b446c..7ee3a832b5f3 100644
--- a/odk/examples/java/Storage/Test06.java
+++ b/odk/examples/java/Storage/Test06.java
@@ -72,7 +72,7 @@ public class Test06 implements StorageTest {
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
-
+
// in case stream is open for reading it must exist
try
{
@@ -272,7 +272,7 @@ public class Test06 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/Test07.java b/odk/examples/java/Storage/Test07.java
index 25a2677f3728..25e3fedf4df3 100644
--- a/odk/examples/java/Storage/Test07.java
+++ b/odk/examples/java/Storage/Test07.java
@@ -36,7 +36,7 @@ public class Test07 implements StorageTest {
m_aTestHelper.Error( "No valid temporary file was created!" );
return false;
}
-
+
// create temporary storage based on arbitrary medium
// after such a storage is closed it is lost
Object oTempStorage = m_xStorageFactory.createInstance();
@@ -60,7 +60,7 @@ public class Test07 implements StorageTest {
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream2", "MediaType2", false, pBytes2, pPass2 ) )
return false;
-
+
// create temporary storage based on a previously created temporary file
Object pArgs[] = new Object[2];
pArgs[0] = (Object) sTempFileURL;
@@ -131,7 +131,7 @@ public class Test07 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/Test08.java b/odk/examples/java/Storage/Test08.java
index 6c839943abc9..147f57262992 100644
--- a/odk/examples/java/Storage/Test08.java
+++ b/odk/examples/java/Storage/Test08.java
@@ -30,7 +30,7 @@ public class Test08 implements StorageTest {
{
try
{
-
+
// create temporary storage based on arbitrary medium
// after such a storage is closed it is lost
Object oTempStorage = m_xStorageFactory.createInstance();
@@ -50,7 +50,7 @@ public class Test08 implements StorageTest {
m_aTestHelper.Message( "Optional interface XEncryptionProtectedSource is not implemented, feature can not be tested!" );
return true;
}
-
+
byte pPass1[] = { 1, 2, 3 };
byte pPass2[] = { 3, 2, 1 };
@@ -62,7 +62,7 @@ public class Test08 implements StorageTest {
m_aTestHelper.Error( "Can't set a common encryption key for the storage, exception:" + e );
return false;
}
-
+
// open a new substorage
XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
"SubStorage1",
@@ -72,7 +72,7 @@ public class Test08 implements StorageTest {
m_aTestHelper.Error( "Can't create substorage!" );
return false;
}
-
+
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
// the stream will be encrypted with common password
byte pBytes1[] = { 1, 1, 1, 1, 1 };
@@ -93,7 +93,7 @@ public class Test08 implements StorageTest {
// the stream will not be encrypted
if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "SubStream3", "MediaType3", false, pBytes3, pPass2 ) )
return false;
-
+
// set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly
if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage,
"MediaType4",
@@ -115,7 +115,7 @@ public class Test08 implements StorageTest {
m_aTestHelper.Error( "No valid temporary file was created!" );
return false;
}
-
+
// create temporary storage based on a previously created temporary file
Object pArgs[] = new Object[2];
pArgs[0] = (Object) sTempFileURL;
@@ -164,7 +164,7 @@ public class Test08 implements StorageTest {
m_aTestHelper.Error( "Can't open existing substorage!" );
return false;
}
-
+
if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType5", false, ElementModes.ELEMENT_READ ) )
return false;
@@ -177,7 +177,7 @@ public class Test08 implements StorageTest {
m_aTestHelper.Error( "XEncryptionProtectedSource was successfully used already, so it must be supported!" );
return false;
}
-
+
try {
xResultStorageEncryption.setEncryptionKey( pPass2 );
}
@@ -208,6 +208,6 @@ public class Test08 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/Test09.java b/odk/examples/java/Storage/Test09.java
index 319766024fc8..f4ae8ee879f3 100644
--- a/odk/examples/java/Storage/Test09.java
+++ b/odk/examples/java/Storage/Test09.java
@@ -30,7 +30,7 @@ public class Test09 implements StorageTest {
{
try
{
-
+
// create temporary storage based on arbitrary medium
// after such a storage is closed it is lost
Object oTempStorage = m_xStorageFactory.createInstance();
@@ -49,7 +49,7 @@ public class Test09 implements StorageTest {
// the stream will not be encrypted
if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream1", "MediaType1", false, pBytes, pPass1 ) )
return false;
-
+
// create temporary file
String sTempFileURL = m_aTestHelper.CreateTempFile( m_xMSF );
if ( sTempFileURL == null || sTempFileURL == "" )
@@ -57,7 +57,7 @@ public class Test09 implements StorageTest {
m_aTestHelper.Error( "No valid temporary file was created!" );
return false;
}
-
+
// create temporary storage based on a previously created temporary file
Object pArgs[] = new Object[2];
pArgs[0] = (Object) sTempFileURL;
@@ -118,6 +118,6 @@ public class Test09 implements StorageTest {
m_aTestHelper.Error( "Exception: " + e );
return false;
}
- }
+ }
}
diff --git a/odk/examples/java/Storage/TestHelper.java b/odk/examples/java/Storage/TestHelper.java
index f5b487bc5730..2868de481f81 100644
--- a/odk/examples/java/Storage/TestHelper.java
+++ b/odk/examples/java/Storage/TestHelper.java
@@ -32,7 +32,7 @@ public class TestHelper {
Error( "Can't get XOutputStream implementation from substream '" + sStreamName + "'!" );
return false;
}
-
+
// get XTrucate implementation from output stream
XTruncate xTruncate = (XTruncate) UnoRuntime.queryInterface( XTruncate.class, xOutput );
if ( xTruncate == null )
@@ -40,7 +40,7 @@ public class TestHelper {
Error( "Can't get XTruncate implementation from substream '" + sStreamName + "'!" );
return false;
}
-
+
// write requested byte sequence
try
{
@@ -125,7 +125,7 @@ public class TestHelper {
Error( "Can't create substream '" + sStreamName + "', exception : " + e + "!" );
return false;
}
-
+
return WriteBytesToStream( xSubStream, sStreamName, sMediaType, bCompressed, pBytes );
}
@@ -237,7 +237,7 @@ public class TestHelper {
Message( "Optional interface XEncryptionProtectedSource is not implemented, feature can not be tested!" );
return -1;
}
-
+
try {
xStreamEncryption.setEncryptionKey( pNewPass );
}
@@ -282,7 +282,7 @@ public class TestHelper {
Error( "'IsRoot' property contains wrong value!" );
bOk = false;
}
-
+
if ( ( bIsRoot && ( nPropMode | ElementModes.ELEMENT_READ ) != ( nMode | ElementModes.ELEMENT_READ ) )
|| ( !bIsRoot && ( nPropMode & nMode ) != nMode ) )
{
@@ -325,13 +325,13 @@ public class TestHelper {
+ sMediaType + "', set '" + sPropMediaType + "' !" );
bOk = false;
}
-
+
if ( bPropIsRoot != bIsRoot )
{
Error( "'IsRoot' property contains wrong value!" );
bOk = false;
}
-
+
if ( ( bIsRoot && ( nPropMode | ElementModes.ELEMENT_READ ) != ( nMode | ElementModes.ELEMENT_READ ) )
|| ( !bIsRoot && ( nPropMode & nMode ) != nMode ) )
{
@@ -364,7 +364,7 @@ public class TestHelper {
Error( "Can't get XInputStream implementation from substream '" + sName + "'!" );
return false;
}
-
+
byte pContents[][] = new byte[1][]; // ???
// read contents
@@ -418,11 +418,11 @@ public class TestHelper {
bOk = true;
if ( !sPropMediaType.equals( sMediaType ) )
{
- Error( "'MediaType' property contains wrong value for stream '" + sName + "',\nexpected: '"
+ Error( "'MediaType' property contains wrong value for stream '" + sName + "',\nexpected: '"
+ sMediaType + "', set: '" + sPropMediaType + "'!" );
bOk = false;
}
-
+
if ( nPropSize != pBytes.length )
{
Error( "'Size' property contains wrong value for stream'" + sName + "'!" );
@@ -464,7 +464,7 @@ public class TestHelper {
Error( "Can't open substream '" + sName + "', exception : " + e + "!" );
return false;
}
-
+
return InternalCheckStream( xSubStream, sName, sMediaType, pBytes );
}
@@ -475,7 +475,7 @@ public class TestHelper {
byte[] pPass )
{
// Important: a common password for any of parent storage should not be set or
- // should be different from pPass
+ // should be different from pPass
if ( pPass.length == 0 )
{
@@ -496,7 +496,7 @@ public class TestHelper {
Error( "Unexpected exception in case of opening of encrypted stream '" + sName + "' without password: " + e + "!" );
return false;
}
-
+
byte pWrongPass[] = { 1, 1 };
pWrongPass[0] += pPass[0];
try
@@ -512,7 +512,7 @@ public class TestHelper {
Error( "Unexpected exception in case of opening of encrypted stream '" + sName + "' with wrong password: " + e + "!" );
return false;
}
-
+
XStream xSubStream = null;
try
{
@@ -529,7 +529,7 @@ public class TestHelper {
Error( "Can't open encrypted substream '" + sName + "', exception : " + e + "!" );
return false;
}
-
+
return InternalCheckStream( xSubStream, sName, sMediaType, pBytes );
}
@@ -571,7 +571,7 @@ public class TestHelper {
return true;
}
-
+
public boolean disposeStorage( XStorage xStorage )
{
// dispose the storage
@@ -639,7 +639,7 @@ public class TestHelper {
Error( "Can't close output part of a stream, exception :" + e );
return false;
}
-
+
return true;
}
@@ -681,7 +681,7 @@ public class TestHelper {
public String CreateTempFile( XMultiServiceFactory xMSF )
{
String sResult = null;
-
+
// try to get temporary file representation
XPropertySet xTempFileProps = null;
try
diff --git a/odk/examples/java/Text/BookmarkInsertion.java b/odk/examples/java/Text/BookmarkInsertion.java
index 89fb0ec4e841..03c9cb24340d 100644
--- a/odk/examples/java/Text/BookmarkInsertion.java
+++ b/odk/examples/java/Text/BookmarkInsertion.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -37,62 +37,62 @@
// Step 2: open an empty text document
// Step 3: enter a example text
// Step 4: insert some bookmarks
-//
+//
// Chapter 5.1.1.4 Inserting bookmarks
//***************************************************************************
import com.sun.star.uno.UnoRuntime;
public class BookmarkInsertion {
-
+
public static void main(String args[]) {
// You need the desktop to create a document
// The getDesktop method does the UNO bootstrapping, gets the
// remote servie manager and the desktop object.
com.sun.star.frame.XDesktop xDesktop = null;
xDesktop = getDesktop();
-
+
// create text document
com.sun.star.text.XTextDocument xTextDocument = null;
xTextDocument = createTextdocument(xDesktop);
-
+
// put example text in document
createExampleData(xTextDocument);
-
-
+
+
String mOffending[] = { "negro(e|es)?","bor(ed|ing)?",
"bloody?", "bleed(ing)?" };
String mBad[] = { "possib(le|ilit(y|ies))", "real(ly)+", "brilliant" };
-
+
String sOffendPrefix = "Offending";
String sBadPrefix = "BadStyle";
-
+
markList(xTextDocument, mOffending, sOffendPrefix);
markList(xTextDocument, mBad, sBadPrefix);
-
+
System.out.println("Done");
-
- System.exit(0);
+
+ System.exit(0);
}
-
+
public static void markList(com.sun.star.text.XTextDocument xTextDocument,
String mList[], String sPrefix) {
int iCounter=0;
com.sun.star.uno.XInterface xSearchInterface = null;
com.sun.star.text.XTextRange xSearchTextRange = null;
-
+
try {
for( iCounter = 0; iCounter < mList.length; iCounter++ ) {
// the findfirst returns a XInterface
xSearchInterface = (com.sun.star.uno.XInterface)FindFirst(
xTextDocument, mList[ iCounter ] );
-
+
if( xSearchInterface != null ) {
// get the TextRange form the XInterface
xSearchTextRange = (com.sun.star.text.XTextRange)
UnoRuntime.queryInterface(
com.sun.star.text.XTextRange.class, xSearchInterface);
-
+
InsertBookmark(xTextDocument, xSearchTextRange,
sPrefix + iCounter);
}
@@ -101,10 +101,10 @@ public class BookmarkInsertion {
catch( Exception e) {
e.printStackTrace(System.err);
System.exit(1);
- }
+ }
}
-
-
+
+
public static void InsertBookmark(com.sun.star.text.XTextDocument xTextDocument,
com.sun.star.text.XTextRange xTextRange,
String sBookName) {
@@ -115,25 +115,25 @@ public class BookmarkInsertion {
xDocMSF = (com.sun.star.lang.XMultiServiceFactory)
UnoRuntime.queryInterface(
com.sun.star.lang.XMultiServiceFactory.class, xTextDocument);
-
+
// the bookmark service is a context dependend service, you need
// the MultiServiceFactory from the document
Object xObject = xDocMSF.createInstance("com.sun.star.text.Bookmark");
-
+
// set the name from the bookmark
com.sun.star.container.XNamed xNameAccess = null;
xNameAccess = (com.sun.star.container.XNamed)
UnoRuntime.queryInterface(
com.sun.star.container.XNamed.class, xObject);
-
+
xNameAccess.setName(sBookName);
-
+
// create a XTextContent, for the method 'insertTextContent'
com.sun.star.text.XTextContent xTextContent = null;
xTextContent = (com.sun.star.text.XTextContent)
UnoRuntime.queryInterface(
com.sun.star.text.XTextContent.class, xNameAccess);
-
+
// insertTextContent need a TextRange not a cursor to specify the
// position from the bookmark
xTextDocument.getText().insertTextContent(xTextRange, xTextContent, true);
@@ -144,74 +144,74 @@ public class BookmarkInsertion {
e.printStackTrace(System.err);
}
}
-
+
protected static com.sun.star.uno.XInterface FindFirst(
com.sun.star.text.XTextDocument xTextDocument, String sSearchString)
{
com.sun.star.util.XSearchDescriptor xSearchDescriptor = null;
com.sun.star.util.XSearchable xSearchable = null;
com.sun.star.uno.XInterface xSearchInterface = null;
-
+
try {
xSearchable = (com.sun.star.util.XSearchable)
UnoRuntime.queryInterface(
com.sun.star.util.XSearchable.class, xTextDocument);
xSearchDescriptor = (com.sun.star.util.XSearchDescriptor)
xSearchable.createSearchDescriptor();
-
+
xSearchDescriptor.setSearchString(sSearchString);
-
+
com.sun.star.beans.XPropertySet xPropertySet = null;
xPropertySet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xSearchDescriptor);
-
+
xPropertySet.setPropertyValue("SearchRegularExpression",
new Boolean( true ) );
-
+
xSearchInterface = (com.sun.star.uno.XInterface)
xSearchable.findFirst(xSearchDescriptor);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return xSearchInterface;
}
-
+
protected static void createExampleData(
com.sun.star.text.XTextDocument xTextDocument )
{
com.sun.star.text.XTextCursor xTextCursor = null;
-
+
try {
xTextCursor = (com.sun.star.text.XTextCursor)
xTextDocument.getText().createTextCursor();
-
+
xTextCursor.setString( "He heard quiet steps behind him. That didn't bode well. Who could be following him this late at night and in this deadbeat part of town? And at this particular moment, just after he pulled off the big time and was making off with the greenbacks. Was there another crook who'd had the same idea, and was now watching him and waiting for a chance to grab the fruit of his labor?" );
xTextCursor.collapseToEnd();
xTextCursor.setString( "Or did the steps behind him mean that one of many bloody officers in town was on to him and just waiting to pounce and snap those cuffs on his wrists? He nervously looked all around. Suddenly he saw the alley. Like lightening he darted off to the left and disappeared between the two warehouses almost falling over the trash can lying in the middle of the sidewalk. He tried to nervously tap his way along in the inky darkness and suddenly stiffened: it was a dead-end, he would have to go back the way he had come" );
xTextCursor.collapseToEnd();
xTextCursor.setString( "The steps got louder and louder, he saw the black outline of a figure coming around the corner. Is this the end of the line? he thought pressing himself back against the wall trying to make himself invisible in the dark, was all that planning and energy wasted? He was dripping with sweat now, cold and wet, he could smell the brilliant fear coming off his clothes. Suddenly next to him, with a barely noticeable squeak, a door swung quietly to and fro in the night's breeze." );
-
+
xTextCursor.gotoStart(false);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
- }
-
+
+ }
+
public static com.sun.star.frame.XDesktop getDesktop() {
com.sun.star.frame.XDesktop xDesktop = null;
com.sun.star.lang.XMultiComponentFactory xMCF = null;
-
+
try {
com.sun.star.uno.XComponentContext xContext = null;
-
+
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
// get the remote office service manager
xMCF = xContext.getServiceManager();
if( xMCF != null ) {
@@ -229,16 +229,16 @@ public class BookmarkInsertion {
e.printStackTrace(System.err);
System.exit(1);
}
-
-
+
+
return xDesktop;
}
-
+
public static com.sun.star.text.XTextDocument createTextdocument(
com.sun.star.frame.XDesktop xDesktop )
{
com.sun.star.text.XTextDocument aTextDocument = null;
-
+
try {
com.sun.star.lang.XComponent xComponent = CreateNewDocument(xDesktop,
"swriter");
@@ -249,36 +249,36 @@ public class BookmarkInsertion {
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return aTextDocument;
}
-
-
+
+
protected static com.sun.star.lang.XComponent CreateNewDocument(
com.sun.star.frame.XDesktop xDesktop,
String sDocumentType )
{
String sURL = "private:factory/" + sDocumentType;
-
+
com.sun.star.lang.XComponent xComponent = null;
com.sun.star.frame.XComponentLoader xComponentLoader = null;
com.sun.star.beans.PropertyValue xValues[] =
new com.sun.star.beans.PropertyValue[1];
com.sun.star.beans.PropertyValue xEmptyArgs[] =
new com.sun.star.beans.PropertyValue[0];
-
+
try {
xComponentLoader = (com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
com.sun.star.frame.XComponentLoader.class, xDesktop);
-
+
xComponent = xComponentLoader.loadComponentFromURL(
sURL, "_blank", 0, xEmptyArgs);
}
catch( Exception e) {
e.printStackTrace(System.out);
}
-
+
return xComponent ;
}
}
diff --git a/odk/examples/java/Text/GraphicsInserter.java b/odk/examples/java/Text/GraphicsInserter.java
index 866da1c0849f..a42ccaabf119 100644
--- a/odk/examples/java/Text/GraphicsInserter.java
+++ b/odk/examples/java/Text/GraphicsInserter.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.UnoRuntime;
@@ -52,7 +52,7 @@ public class GraphicsInserter {
}
com.sun.star.uno.XComponentContext xContext = null;
-
+
try {
// bootstrap UNO and get the remote component context. The context can
@@ -62,8 +62,8 @@ public class GraphicsInserter {
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
- xContext.getServiceManager();
-
+ xContext.getServiceManager();
+
/* A desktop environment contains tasks with one or more
frames in which components can be loaded. Desktop is the
environment for components which can instanciate within
@@ -72,30 +72,30 @@ public class GraphicsInserter {
UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class,
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop",
xContext ) );
-
+
com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface(
com.sun.star.frame.XComponentLoader.class, xDesktop);
-
+
// Load a Writer document, which will be automaticly displayed
com.sun.star.lang.XComponent xComp = xCompLoader.loadComponentFromURL(
"private:factory/swriter", "_blank", 0,
new com.sun.star.beans.PropertyValue[0]);
-
+
// Querying for the interface XTextDocument on the xcomponent
com.sun.star.text.XTextDocument xTextDoc =
(com.sun.star.text.XTextDocument)UnoRuntime.queryInterface(
com.sun.star.text.XTextDocument.class, xComp);
-
+
// Querying for the interface XMultiServiceFactory on the xtextdocument
com.sun.star.lang.XMultiServiceFactory xMSFDoc =
(com.sun.star.lang.XMultiServiceFactory)UnoRuntime.queryInterface(
com.sun.star.lang.XMultiServiceFactory.class, xTextDoc);
-
+
// Providing a log file for output
PrintWriter printwriterLog = new PrintWriter(
new BufferedWriter( new FileWriter("log.txt") ) );
-
+
Object oGraphic = null;
try {
// Creating the service GraphicObject
@@ -106,18 +106,18 @@ public class GraphicsInserter {
System.out.println( "Could not create instance" );
exception.printStackTrace( printwriterLog );
}
-
+
// Getting the text
com.sun.star.text.XText xText = xTextDoc.getText();
-
+
// Getting the cursor on the document
com.sun.star.text.XTextCursor xTextCursor = xText.createTextCursor();
-
+
// Querying for the interface XTextContent on the GraphicObject
com.sun.star.text.XTextContent xTextContent =
(com.sun.star.text.XTextContent)UnoRuntime.queryInterface(
com.sun.star.text.XTextContent.class, oGraphic );
-
+
// Printing information to the log file
printwriterLog.println( "inserting graphic" );
try {
@@ -127,10 +127,10 @@ public class GraphicsInserter {
System.out.println( "Could not insert Content" );
exception.printStackTrace(System.err);
}
-
+
// Printing information to the log file
printwriterLog.println( "adding graphic" );
-
+
// Querying for the interface XPropertySet on GraphicObject
com.sun.star.beans.XPropertySet xPropSet =
(com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
@@ -141,34 +141,34 @@ public class GraphicsInserter {
StringBuffer sUrl = new StringBuffer("file:///");
sUrl.append(sourceFile.getCanonicalPath().replace('\\', '/'));
System.out.println( "insert graphic \"" + sUrl + "\"");
-
+
// Setting the anchor type
xPropSet.setPropertyValue("AnchorType",
com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH );
-
+
// Setting the graphic url
xPropSet.setPropertyValue( "GraphicURL", sUrl.toString() );
-
+
// Setting the horizontal position
xPropSet.setPropertyValue( "HoriOrientPosition",
new Integer( 5500 ) );
-
+
// Setting the vertical position
xPropSet.setPropertyValue( "VertOrientPosition",
new Integer( 4200 ) );
-
+
// Setting the width
xPropSet.setPropertyValue( "Width", new Integer( 4400 ) );
-
+
// Setting the height
xPropSet.setPropertyValue( "Height", new Integer( 4000 ) );
} catch ( Exception exception ) {
System.out.println( "Couldn't set property 'GraphicURL'" );
exception.printStackTrace( printwriterLog );
}
-
+
xContext = null;
-
+
System.exit(0);
}
catch( Exception e ) {
diff --git a/odk/examples/java/Text/HardFormatting.java b/odk/examples/java/Text/HardFormatting.java
index b1ec48da7cb7..7d8bf94f5971 100644
--- a/odk/examples/java/Text/HardFormatting.java
+++ b/odk/examples/java/Text/HardFormatting.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -45,64 +45,64 @@
import com.sun.star.uno.UnoRuntime;
public class HardFormatting {
-
+
public static void main(String args[]) {
// You need the desktop to create a document
// The getDesktop method does the UNO bootstrapping, gets the
// remote servie manager and the desktop object.
com.sun.star.frame.XDesktop xDesktop = null;
xDesktop = getDesktop();
-
+
try {
// create text document
com.sun.star.text.XTextDocument xTextDocument = null;
xTextDocument = createTextdocument(xDesktop);
-
+
// the text interface contains all methods and properties to
// manipulate the content from a text document
com.sun.star.text.XText xText = null;
xText = xTextDocument.getText();
-
+
String sMyText = "A very short paragraph for illustration only";
-
+
// you can travel with the cursor throught the text document.
// you travel only at the model, not at the view. The cursor that you can
// see on the document doesn't change the position
com.sun.star.text.XTextCursor xTextCursor = null;
xTextCursor = (com.sun.star.text.XTextCursor)
xTextDocument.getText().createTextCursor();
-
+
xText.insertString( xTextCursor, "Headline", false );
xText.insertControlCharacter(xTextCursor,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
-
+
xText.insertString(xTextCursor, sMyText, false);
-
+
com.sun.star.text.XTextRange xTextRange = null;
com.sun.star.beans.XPropertySet xPropertySet = null;
-
- // BEGIN: 'Hard formating'
+
+ // BEGIN: 'Hard formating'
// the text range not the cursor contains the 'parastyle' property
xTextRange = xText.getEnd();
xPropertySet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xTextRange);
-
+
// create a paragraph cursor to travel throught the paragraphs
com.sun.star.text.XParagraphCursor xParagraphCursor = null;
xParagraphCursor = (com.sun.star.text.XParagraphCursor)
UnoRuntime.queryInterface(
com.sun.star.text.XParagraphCursor.class, xTextRange);
-
+
xParagraphCursor.gotoStart( false );
xParagraphCursor.gotoEndOfParagraph( true );
xTextRange = xParagraphCursor.getText().getStart();
-
+
// create a WordCursor to travel into the paragraph
com.sun.star.text.XWordCursor xWordCursor = null;
xWordCursor = (com.sun.star.text.XWordCursor) UnoRuntime.queryInterface(
com.sun.star.text.XWordCursor.class, xTextRange);
-
+
// the PropertySet from the cursor contains the text attributes
xPropertySet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
@@ -114,18 +114,18 @@ public class HardFormatting {
+ xPropertySet.getPropertyValue("CharFontName").toString()
+ "\nWeight : "
+ xPropertySet.getPropertyValue("CharWeight").toString() );
-
+
xWordCursor.gotoNextWord(false);
xWordCursor.gotoNextWord(false);
xWordCursor.gotoEndOfWord(true);
-
+
xPropertySet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xWordCursor);
xPropertySet.setPropertyValue("CharWeight",
new Float(com.sun.star.awt.FontWeight.BOLD));
xPropertySet.setPropertyValue("CharColor", new Integer( 255 ) );
-
+
System.out.println(
"Parastyle : "
+ xPropertySet.getPropertyValue("ParaStyleName").toString()
@@ -133,46 +133,46 @@ public class HardFormatting {
+ xPropertySet.getPropertyValue("CharFontName").toString()
+ "\nWeight : "
+ xPropertySet.getPropertyValue("CharWeight").toString() );
-
+
// the PropertyState contains information where the attribute is set,
// is a text part hard formated or not.
com.sun.star.beans.XPropertyState xPropertyState = null;
xPropertyState = (com.sun.star.beans.XPropertyState)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertyState.class, xWordCursor);
-
+
com.sun.star.beans.PropertyState xPropertyStateValue =
xPropertyState.getPropertyState("CharWeight");
-
+
checkPropertyState( xWordCursor, xPropertyStateValue );
-
+
xWordCursor.goRight( (short) 3 , true );
xPropertyStateValue = xPropertyState.getPropertyState("CharWeight");
-
+
System.out.println("Increase the selection with three characters");
checkPropertyState(xWordCursor, xPropertyStateValue);
-
+
xPropertyState.setPropertyToDefault("CharWeight");
-
+
System.out.println("Set the default value on the selection");
xPropertyStateValue = xPropertyState.getPropertyState("CharWeight");
checkPropertyState(xWordCursor, xPropertyStateValue);
-
+
// END: 'Hard formating' Section from the Cookbook
}
catch( Exception e) {
e.printStackTrace(System.err);
System.exit(1);
}
-
-
+
+
System.out.println("Done");
-
+
System.exit(0);
-
+
}
-
-
+
+
public static void checkPropertyState(
com.sun.star.text.XWordCursor xWordCursor,
com.sun.star.beans.PropertyState xPropertyStateValue )
@@ -184,36 +184,36 @@ public class HardFormatting {
+ "' completly hard formated" );
break;
}
-
+
case com.sun.star.beans.PropertyState.DEFAULT_VALUE_value: {
System.out.println( "-> The selection '"
+ xWordCursor.getString()
+ "' isn't hard formated" );
break;
}
-
+
case com.sun.star.beans.PropertyState.AMBIGUOUS_VALUE_value: {
System.out.println( "-> The selection '"
+ xWordCursor.getString()
+ "' isn't completly hard formated" );
break;
}
-
+
default:
System.out.println( "No PropertyState found" );
}
}
-
+
public static com.sun.star.frame.XDesktop getDesktop() {
com.sun.star.frame.XDesktop xDesktop = null;
com.sun.star.lang.XMultiComponentFactory xMCF = null;
-
+
try {
com.sun.star.uno.XComponentContext xContext = null;
-
+
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
// get the remote office service manager
xMCF = xContext.getServiceManager();
if( xMCF != null ) {
@@ -231,16 +231,16 @@ public class HardFormatting {
e.printStackTrace(System.err);
System.exit(1);
}
-
-
+
+
return xDesktop;
}
-
+
public static com.sun.star.text.XTextDocument createTextdocument(
com.sun.star.frame.XDesktop xDesktop )
{
com.sun.star.text.XTextDocument aTextDocument = null;
-
+
try {
com.sun.star.lang.XComponent xComponent = CreateNewDocument(xDesktop,
"swriter");
@@ -251,36 +251,36 @@ public class HardFormatting {
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return aTextDocument;
}
-
-
+
+
protected static com.sun.star.lang.XComponent CreateNewDocument(
com.sun.star.frame.XDesktop xDesktop,
String sDocumentType )
{
String sURL = "private:factory/" + sDocumentType;
-
+
com.sun.star.lang.XComponent xComponent = null;
com.sun.star.frame.XComponentLoader xComponentLoader = null;
com.sun.star.beans.PropertyValue xValues[] =
new com.sun.star.beans.PropertyValue[1];
com.sun.star.beans.PropertyValue xEmptyArgs[] =
new com.sun.star.beans.PropertyValue[0];
-
+
try {
xComponentLoader = (com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
com.sun.star.frame.XComponentLoader.class, xDesktop);
-
+
xComponent = xComponentLoader.loadComponentFromURL(
sURL, "_blank", 0, xEmptyArgs);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return xComponent ;
}
}
diff --git a/odk/examples/java/Text/SWriter.java b/odk/examples/java/Text/SWriter.java
index 18ae35481189..ca7696b4cf4b 100644
--- a/odk/examples/java/Text/SWriter.java
+++ b/odk/examples/java/Text/SWriter.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -44,16 +44,16 @@
import com.sun.star.uno.UnoRuntime;
public class SWriter {
-
+
public static void main(String args[]) {
-
-
+
+
//oooooooooooooooooooooooooooStep 1oooooooooooooooooooooooooooooooooooooooo
// bootstrap UNO and get the remote component context. The context can
// be used to get the service manager
//*************************************************************************
com.sun.star.uno.XComponentContext xContext = null;
-
+
try {
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
@@ -70,39 +70,39 @@ public class SWriter {
// For this purpose an instance of com.sun.star.frame.Desktop
// is created. It's interface XDesktop provides the XComponentLoader,
// which is used to open the document via loadComponentFromURL
- //*************************************************************************
-
+ //*************************************************************************
+
//Open Writer document
-
+
System.out.println("Opening an empty Writer document");
com.sun.star.text.XTextDocument myDoc = openWriter(xContext);
-
+
//*************************************************************************
-
-
+
+
//oooooooooooooooooooooooooooStep 3oooooooooooooooooooooooooooooooooooooooo
// insert some text.
// For this purpose get the Text-Object of the document an create the
// cursor. Now it is possible to insert a text at the cursor-position
// via insertString
//*************************************************************************
-
-
+
+
//getting the text object
com.sun.star.text.XText xText = myDoc.getText();
-
+
//create a cursor object
com.sun.star.text.XTextCursor xTCursor = xText.createTextCursor();
-
+
//inserting some Text
xText.insertString( xTCursor, "The first line in the newly created text document.\n", false );
-
+
//inserting a second line
xText.insertString( xTCursor, "Now we're in the second line\n", false );
-
+
//*************************************************************************
-
-
+
+
//oooooooooooooooooooooooooooStep 4oooooooooooooooooooooooooooooooooooooooo
// insert a text table.
// For this purpose get MultiServiceFactory of the document, create an
@@ -110,18 +110,18 @@ public class SWriter {
// be inserted at the cursor position via insertTextContent.
// After that some properties are changed and some data is inserted.
//*************************************************************************
-
- //inserting a text table
+
+ //inserting a text table
System.out.println("Inserting a text table");
-
+
//getting MSF of the document
com.sun.star.lang.XMultiServiceFactory xDocMSF =
(com.sun.star.lang.XMultiServiceFactory) UnoRuntime.queryInterface(
com.sun.star.lang.XMultiServiceFactory.class, myDoc);
-
+
//create instance of a text table
com.sun.star.text.XTextTable xTT = null;
-
+
try {
Object oInt = xDocMSF.createInstance("com.sun.star.text.TextTable");
xTT = (com.sun.star.text.XTextTable)
@@ -130,12 +130,12 @@ public class SWriter {
System.err.println("Couldn't create instance "+ e);
e.printStackTrace(System.err);
}
-
+
//initialize the text table with 4 columns an 4 rows
xTT.initialize(4,4);
-
+
com.sun.star.beans.XPropertySet xTTRowPS = null;
-
+
//insert the table
try {
xText.insertTextContent(xTCursor, xTT, false);
@@ -143,71 +143,71 @@ public class SWriter {
com.sun.star.container.XIndexAccess xTTRows = xTT.getRows();
xTTRowPS = (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xTTRows.getByIndex(0));
-
+
} catch (Exception e) {
System.err.println("Couldn't insert the table " + e);
e.printStackTrace(System.err);
}
-
-
+
+
// get the property set of the text table
-
+
com.sun.star.beans.XPropertySet xTTPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xTT);
-
+
// Change the BackColor
- try {
+ try {
xTTPS.setPropertyValue("BackTransparent", new Boolean(false));
xTTPS.setPropertyValue("BackColor",new Integer(13421823));
xTTRowPS.setPropertyValue("BackTransparent", new Boolean(false));
xTTRowPS.setPropertyValue("BackColor",new Integer(6710932));
-
+
} catch (Exception e) {
System.err.println("Couldn't change the color " + e);
e.printStackTrace(System.err);
- }
-
+ }
+
// write Text in the Table headers
System.out.println("Write text in the table headers");
-
+
insertIntoCell("A1","FirstColumn", xTT);
insertIntoCell("B1","SecondColumn", xTT) ;
insertIntoCell("C1","ThirdColumn", xTT) ;
insertIntoCell("D1","SUM", xTT) ;
-
-
+
+
//Insert Something in the text table
System.out.println("Insert something in the text table");
-
+
(xTT.getCellByName("A2")).setValue(22.5);
(xTT.getCellByName("B2")).setValue(5615.3);
(xTT.getCellByName("C2")).setValue(-2315.7);
(xTT.getCellByName("D2")).setFormula("sum <A2:C2>");
-
+
(xTT.getCellByName("A3")).setValue(21.5);
(xTT.getCellByName("B3")).setValue(615.3);
(xTT.getCellByName("C3")).setValue(-315.7);
(xTT.getCellByName("D3")).setFormula("sum <A3:C3>");
-
+
(xTT.getCellByName("A4")).setValue(121.5);
(xTT.getCellByName("B4")).setValue(-615.3);
(xTT.getCellByName("C4")).setValue(415.7);
(xTT.getCellByName("D4")).setFormula("sum <A4:C4>");
-
-
+
+
//oooooooooooooooooooooooooooStep 5oooooooooooooooooooooooooooooooooooooooo
// insert a colored text.
// Get the propertySet of the cursor, change the CharColor and add a
// shadow. Then insert the Text via InsertString at the cursor position.
//*************************************************************************
-
+
// get the property set of the cursor
com.sun.star.beans.XPropertySet xTCPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class,
xTCursor);
-
+
Object oldValue = null;
-
+
// Change the CharColor and add a Shadow
try {
xTCPS.setPropertyValue("CharColor",new Integer(255));
@@ -216,33 +216,33 @@ public class SWriter {
System.err.println("Couldn't change the color " + e);
e.printStackTrace(System.err);
}
-
+
//create a paragraph break
- try {
+ try {
xText.insertControlCharacter(xTCursor,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
-
+
} catch (Exception e) {
System.err.println("Couldn't insert break "+ e);
e.printStackTrace(System.err);
- }
-
+ }
+
//inserting colored Text
System.out.println("Inserting colored Text");
-
+
xText.insertString(xTCursor, " This is a colored Text - blue with shadow\n",
false );
-
+
//create a paragraph break
try {
xText.insertControlCharacter(xTCursor,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
-
+
} catch (Exception e) {
System.err.println("Couldn't insert break "+ e);
e.printStackTrace(System.err);
}
-
+
//oooooooooooooooooooooooooooStep 6oooooooooooooooooooooooooooooooooooooooo
// insert a text frame.
// create an instance of com.sun.star.text.TextFrame using the MSF of the
@@ -250,32 +250,32 @@ public class SWriter {
// Now get the text-Object of the frame an the corresponding cursor.
// Insert some text via insertString.
//*************************************************************************
-
- // Create a TextFrame
+
+ // Create a TextFrame
com.sun.star.text.XTextFrame xTF = null;
com.sun.star.drawing.XShape xTFS = null;
-
+
try {
Object oInt = xDocMSF.createInstance("com.sun.star.text.TextFrame");
xTF = (com.sun.star.text.XTextFrame) UnoRuntime.queryInterface(
com.sun.star.text.XTextFrame.class,oInt);
xTFS = (com.sun.star.drawing.XShape) UnoRuntime.queryInterface(
com.sun.star.drawing.XShape.class,oInt);
-
+
com.sun.star.awt.Size aSize = new com.sun.star.awt.Size();
aSize.Height = 400;
aSize.Width = 15000;
-
- xTFS.setSize(aSize);
+
+ xTFS.setSize(aSize);
} catch (Exception e) {
System.err.println("Couldn't create instance "+ e);
e.printStackTrace(System.err);
- }
-
- // get the property set of the text frame
+ }
+
+ // get the property set of the text frame
com.sun.star.beans.XPropertySet xTFPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xTF);
-
+
// Change the AnchorType
try {
xTFPS.setPropertyValue("AnchorType",
@@ -283,42 +283,42 @@ public class SWriter {
} catch (Exception e) {
System.err.println("Couldn't change the color " + e);
e.printStackTrace(System.err);
- }
-
+ }
+
//insert the frame
System.out.println("Insert the text frame");
-
+
try {
xText.insertTextContent(xTCursor, xTF, false);
} catch (Exception e) {
System.err.println("Couldn't insert the frame " + e);
e.printStackTrace(System.err);
- }
-
+ }
+
//getting the text object of Frame
com.sun.star.text.XText xTextF = xTF.getText();
-
+
//create a cursor object
com.sun.star.text.XTextCursor xTCF = xTextF.createTextCursor();
-
+
//inserting some Text
xTextF.insertString(xTCF,
"The first line in the newly created text frame.", false);
-
-
+
+
xTextF.insertString(xTCF,
"\nWith this second line the height of the frame raises.", false);
-
+
//insert a paragraph break
- try {
+ try {
xText.insertControlCharacter(xTCursor,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false );
-
+
} catch (Exception e) {
System.err.println("Couldn't insert break "+ e);
e.printStackTrace(System.err);
}
-
+
// Change the CharColor and add a Shadow
try {
xTCPS.setPropertyValue("CharColor",new Integer(65536));
@@ -326,24 +326,24 @@ public class SWriter {
} catch (Exception e) {
System.err.println("Couldn't change the color " + e);
e.printStackTrace(System.err);
- }
-
+ }
+
xText.insertString(xTCursor, " That's all for now !!", false );
-
+
System.out.println("done");
-
- System.exit(0);
+
+ System.exit(0);
}
-
-
+
+
public static com.sun.star.text.XTextDocument openWriter(
com.sun.star.uno.XComponentContext xContext)
- {
+ {
//define variables
com.sun.star.frame.XComponentLoader xCLoader;
com.sun.star.text.XTextDocument xDoc = null;
com.sun.star.lang.XComponent xComp = null;
-
+
try {
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
@@ -362,36 +362,36 @@ public class SWriter {
xDoc = (com.sun.star.text.XTextDocument)
UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class,
xComp);
-
- } catch(Exception e){
+
+ } catch(Exception e){
System.err.println(" Exception " + e);
e.printStackTrace(System.err);
- }
+ }
return xDoc;
}
-
+
public static void insertIntoCell(String CellName, String theText,
com.sun.star.text.XTextTable xTTbl) {
-
+
com.sun.star.text.XText xTableText = (com.sun.star.text.XText)
UnoRuntime.queryInterface(com.sun.star.text.XText.class,
xTTbl.getCellByName(CellName));
-
+
//create a cursor object
com.sun.star.text.XTextCursor xTC = xTableText.createTextCursor();
-
+
com.sun.star.beans.XPropertySet xTPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xTC);
-
+
try {
xTPS.setPropertyValue("CharColor",new Integer(16777215));
} catch (Exception e) {
System.err.println(" Exception " + e);
e.printStackTrace(System.err);
- }
-
+ }
+
//inserting some Text
xTableText.setString( theText );
-
+
}
}
diff --git a/odk/examples/java/Text/StyleCreation.java b/odk/examples/java/Text/StyleCreation.java
index 91cfb3f7a8c6..362604af6311 100644
--- a/odk/examples/java/Text/StyleCreation.java
+++ b/odk/examples/java/Text/StyleCreation.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -51,108 +51,108 @@ public class StyleCreation {
// remote servie manager and the desktop object.
com.sun.star.frame.XDesktop xDesktop = null;
xDesktop = getDesktop();
-
+
try {
// create text document
com.sun.star.text.XTextDocument xTextDocument = null;
xTextDocument = createTextdocument(xDesktop);
-
+
// the service '..ParagraphStyle' is context dependend, you need
// the multi service factory from the document to use the service
com.sun.star.lang.XMultiServiceFactory xDocMSF =
(com.sun.star.lang.XMultiServiceFactory)UnoRuntime.queryInterface(
com.sun.star.lang.XMultiServiceFactory.class, xTextDocument);
-
+
// use the service 'com.sun.star.style.ParagraphStyle'
com.sun.star.uno.XInterface xInterface = (com.sun.star.uno.XInterface)
xDocMSF.createInstance("com.sun.star.style.ParagraphStyle");
-
+
// create a supplier to get the Style family collection
com.sun.star.style.XStyleFamiliesSupplier xSupplier =
(com.sun.star.style.XStyleFamiliesSupplier)UnoRuntime.queryInterface(
com.sun.star.style.XStyleFamiliesSupplier.class, xTextDocument );
-
+
// get the NameAccess interface from the Style family collection
com.sun.star.container.XNameAccess xNameAccess =
xSupplier.getStyleFamilies();
-
+
// select the Paragraph styles, you get the Paragraph style collection
com.sun.star.container.XNameContainer xParaStyleCollection =
(com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(
com.sun.star.container.XNameContainer.class,
xNameAccess.getByName("ParagraphStyles"));
-
+
// create a PropertySet to set the properties for the new Paragraphstyle
com.sun.star.beans.XPropertySet xPropertySet =
(com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xInterface );
System.out.println( "create a PropertySet to set the properties for the new Paragraphstyle" );
-
+
// set some properties from the Paragraph style
xPropertySet.setPropertyValue("CharFontName", new String( "Helvetica" ) );
System.out.println( "set name of the font to 'Helvetica'" );
-
+
xPropertySet.setPropertyValue("CharHeight", new Float( 36 ) );
System.out.println( "Change the height of th font to 36" );
-
+
xPropertySet.setPropertyValue("CharWeight",
new Float( com.sun.star.awt.FontWeight.BOLD ) );
System.out.println( "set the font attribute 'Bold'" );
-
+
xPropertySet.setPropertyValue("CharAutoKerning", new Boolean( true ) );
System.out.println( "set the paragraph attribute 'AutoKerning'" );
xPropertySet.setPropertyValue("ParaAdjust",
new Integer( com.sun.star.style.ParagraphAdjust.CENTER_value ) );
System.out.println( "set the paragraph adjust to LEFT" );
-
+
xPropertySet.setPropertyValue("ParaFirstLineIndent", new Integer( 0 ) );
System.out.println( "set the first line indent to 0 cm" );
-
+
xPropertySet.setPropertyValue("BreakType",
com.sun.star.style.BreakType.PAGE_AFTER );
System.out.println( "set the paragraph attribute Breaktype to PageAfter" );
-
+
// insert the new Paragraph style in the Paragraph style collection
xParaStyleCollection.insertByName( "myheading", xPropertySet );
System.out.println( "create new paragraph style, with the values from the Propertyset");
-
+
// get the Textrange from the document
com.sun.star.text.XTextRange xTextRange =
xTextDocument.getText().getStart();
-
+
// get the PropertySet from the current paragraph
com.sun.star.beans.XPropertySet xParagraphPropertySet =
(com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xTextRange );
// change the value from the property 'ParaStyle' to apply the
- // Paragraph style
+ // Paragraph style
// To run the sample with StarOffice 5.2 you'll have to change
// 'ParaStyleName' to 'ParaStyle' in the next line
xParagraphPropertySet.setPropertyValue("ParaStyleName",
new String( "myheading" ) );
- System.out.println( "apply the new paragraph style");
+ System.out.println( "apply the new paragraph style");
}
catch( Exception e) {
e.printStackTrace(System.err);
System.exit(1);
}
-
+
System.out.println("done");
-
+
System.exit(0);
}
-
-
+
+
public static com.sun.star.frame.XDesktop getDesktop() {
com.sun.star.frame.XDesktop xDesktop = null;
com.sun.star.lang.XMultiComponentFactory xMCF = null;
-
+
try {
com.sun.star.uno.XComponentContext xContext = null;
-
+
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
// get the remote office service manager
xMCF = xContext.getServiceManager();
if( xMCF != null ) {
@@ -170,16 +170,16 @@ public class StyleCreation {
e.printStackTrace(System.err);
System.exit(1);
}
-
-
+
+
return xDesktop;
}
-
+
public static com.sun.star.text.XTextDocument createTextdocument(
com.sun.star.frame.XDesktop xDesktop )
{
com.sun.star.text.XTextDocument aTextDocument = null;
-
+
try {
com.sun.star.lang.XComponent xComponent = CreateNewDocument(xDesktop,
"swriter");
@@ -190,36 +190,36 @@ public class StyleCreation {
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return aTextDocument;
}
-
-
+
+
protected static com.sun.star.lang.XComponent CreateNewDocument(
com.sun.star.frame.XDesktop xDesktop,
String sDocumentType )
{
String sURL = "private:factory/" + sDocumentType;
-
+
com.sun.star.lang.XComponent xComponent = null;
com.sun.star.frame.XComponentLoader xComponentLoader = null;
com.sun.star.beans.PropertyValue xValues[] =
new com.sun.star.beans.PropertyValue[1];
com.sun.star.beans.PropertyValue xEmptyArgs[] =
new com.sun.star.beans.PropertyValue[0];
-
+
try {
xComponentLoader = (com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
com.sun.star.frame.XComponentLoader.class, xDesktop);
-
+
xComponent = xComponentLoader.loadComponentFromURL(
sURL, "_blank", 0, xEmptyArgs);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return xComponent ;
}
}
diff --git a/odk/examples/java/Text/StyleInitialization.java b/odk/examples/java/Text/StyleInitialization.java
index c08243609499..22d8eb4d063e 100644
--- a/odk/examples/java/Text/StyleInitialization.java
+++ b/odk/examples/java/Text/StyleInitialization.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -44,35 +44,35 @@ import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.AnyConverter;
public class StyleInitialization {
-
+
public static void main(String args[]) {
// You need the desktop to create a document
// The getDesktop method does the UNO bootstrapping, gets the
// remote servie manager and the desktop object.
com.sun.star.frame.XDesktop xDesktop = null;
xDesktop = getDesktop();
-
+
try {
// BEGIN: 'Style basics' Section from the Tutorial
-
+
// create text document
com.sun.star.text.XTextDocument xTextDocument = null;
xTextDocument = createTextdocument( xDesktop );
-
+
// the text interface contains all methods and properties to
// manipulate the content from a text document
com.sun.star.text.XText xText = null;
xText = xTextDocument.getText();
-
+
String sMyText = "A very short paragraph for illustration only";
-
+
// you can travel with the cursor throught the text document.
// you travel only at the model, not at the view. The cursor that you can
// see on the document doesn't change the position
com.sun.star.text.XTextCursor xTextCursor = null;
xTextCursor = (com.sun.star.text.XTextCursor)
xTextDocument.getText().createTextCursor();
-
+
com.sun.star.beans.XPropertySet oCPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xTextCursor);
@@ -80,64 +80,64 @@ public class StyleInitialization {
oCPS.setPropertyValue("CharFontName","Helvetica");
}
catch (Exception ex) {
-
+
}
-
+
xText.insertString( xTextCursor, "Headline", false );
-
+
try {
oCPS.setPropertyValue("CharFontName","Times");
}
catch (Exception ex) {
-
+
}
xText.insertControlCharacter(xTextCursor,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
-
+
xText.insertString( xTextCursor, sMyText, false );
-
+
com.sun.star.text.XTextRange xTextRange = null;
com.sun.star.beans.XPropertySet xPropertySet = null;
-
+
// the text range not the cursor contains the 'parastyle' property
xTextRange = xText.getEnd();
xPropertySet = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xTextRange );
-
+
// To run the sample with StarOffice 5.2 you'll have to change
// 'ParaStyleName' to 'ParaStyle' in the next line
System.out.println( "Current Parastyle : "
+ xPropertySet.getPropertyValue("ParaStyleName") );
-
+
// END: 'Style basics' Section from the Tutorial
-
+
// There are two way to travel throught the paragraphs, with a
// paragraph cursor, or a enumeration.
// You find both ways in this example
-
+
// The first way, with the paragraph cursor
com.sun.star.text.XParagraphCursor xParagraphCursor = null;
xParagraphCursor = (com.sun.star.text.XParagraphCursor)
UnoRuntime.queryInterface(
com.sun.star.text.XParagraphCursor.class, xTextRange );
-
+
xParagraphCursor.gotoStart( false );
xParagraphCursor.gotoEndOfParagraph( true );
-
+
// The second way, with the paragraph enumeration
com.sun.star.container.XEnumerationAccess xEnumerationAccess = null;
xEnumerationAccess = (com.sun.star.container.XEnumerationAccess)
UnoRuntime.queryInterface(
com.sun.star.container.XEnumerationAccess.class, xText );
-
+
// the enumeration contains all paragraph form the document
com.sun.star.container.XEnumeration xParagraphEnumeration = null;
xParagraphEnumeration = xEnumerationAccess.createEnumeration();
-
+
com.sun.star.text.XTextContent xParagraph = null;
com.sun.star.text.XTextRange xWord = null;
-
+
com.sun.star.container.XEnumerationAccess xParaEnumerationAccess = null;
com.sun.star.container.XEnumeration xPortionEnumeration = null;
@@ -148,26 +148,26 @@ public class StyleInitialization {
UnoRuntime.queryInterface(
com.sun.star.text.XTextContent.class,
xParagraphEnumeration.nextElement());
-
+
// you need the method getAnchor to a TextRange -> to manipulate
// the paragraph
String sText = xParagraph.getAnchor().getString();
-
+
// create a cursor from this paragraph
com.sun.star.text.XTextCursor xParaCursor = null;
xParaCursor = xParagraph.getAnchor().getText().createTextCursor();
-
+
// goto the start and end of the paragraph
xParaCursor.gotoStart( false );
xParaCursor.gotoEnd( true );
-
+
// The enumeration from the paragraphs contain parts from the
// paragraph with a different attributes.
xParaEnumerationAccess = (com.sun.star.container.XEnumerationAccess)
UnoRuntime.queryInterface(
com.sun.star.container.XEnumerationAccess.class, xParagraph);
xPortionEnumeration = xParaEnumerationAccess.createEnumeration();
-
+
while ( xPortionEnumeration.hasMoreElements() ) {
// output of all parts from the paragraph with different attributes
xWord = (com.sun.star.text.XTextRange) UnoRuntime.queryInterface(
@@ -177,22 +177,22 @@ public class StyleInitialization {
System.out.println( "Content of the paragraph : " + sWordString );
}
}
-
+
// BEGIN: 'Finding a suitable style' Section from the Tutorial
-
+
// craete a supplier to get the styles-collection
com.sun.star.style.XStyleFamiliesSupplier xSupplier = null;
xSupplier = ( com.sun.star.style.XStyleFamiliesSupplier ) UnoRuntime.queryInterface(
com.sun.star.style.XStyleFamiliesSupplier.class, xTextDocument );
-
+
// use the name access from the collection
com.sun.star.container.XNameAccess xNameAccess = null;
xNameAccess = xSupplier.getStyleFamilies();
-
+
com.sun.star.container.XNameContainer xParaStyleCollection = null;
xParaStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(
com.sun.star.container.XNameContainer.class, xNameAccess.getByName( "ParagraphStyles" ));
-
+
// create a array from strings with the name of all paragraph styles from the text document
String[] sElementNames = xParaStyleCollection.getElementNames();
int iElementCount = sElementNames.length;
@@ -203,21 +203,21 @@ public class StyleInitialization {
xStyle = (com.sun.star.style.XStyle) UnoRuntime.queryInterface(
com.sun.star.style.XStyle.class,
xParaStyleCollection.getByName( sElementNames[iCounter] ));
-
+
// create a property set of all properties from the style
xPropertySet = (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xStyle );
-
+
AnyConverter aAnyConv = new AnyConverter();
String sFontname = aAnyConv.toString(xPropertySet.getPropertyValue("CharFontName"));
sFontname = sFontname.toLowerCase();
-
+
// if the style use the font 'Albany', apply it to the current paragraph
if( sFontname.compareTo("albany") == 0 ) {
// create a property set from the current paragraph, to change the paragraph style
xPropertySet = (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xTextRange );
-
+
// To run the sample with StarOffice 5.2 you'll have to change 'ParaStyleName'
// to 'ParaStyle' in the next line
xPropertySet.setPropertyValue("ParaStyleName", new String( sElementNames[iCounter] ) );
@@ -230,24 +230,24 @@ public class StyleInitialization {
catch( Exception e) {
e.printStackTrace(System.err);
}
-
-
+
+
System.out.println("Done");
-
+
System.exit(0);
-
+
}
-
+
public static com.sun.star.frame.XDesktop getDesktop() {
com.sun.star.frame.XDesktop xDesktop = null;
com.sun.star.lang.XMultiComponentFactory xMCF = null;
-
+
try {
com.sun.star.uno.XComponentContext xContext = null;
-
+
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
// get the remote office service manager
xMCF = xContext.getServiceManager();
if( xMCF != null ) {
@@ -265,16 +265,16 @@ public class StyleInitialization {
e.printStackTrace(System.err);
System.exit(1);
}
-
-
+
+
return xDesktop;
}
-
+
public static com.sun.star.text.XTextDocument createTextdocument(
com.sun.star.frame.XDesktop xDesktop )
{
com.sun.star.text.XTextDocument aTextDocument = null;
-
+
try {
com.sun.star.lang.XComponent xComponent = CreateNewDocument(xDesktop,
"swriter");
@@ -285,36 +285,36 @@ public class StyleInitialization {
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return aTextDocument;
}
-
-
+
+
protected static com.sun.star.lang.XComponent CreateNewDocument(
com.sun.star.frame.XDesktop xDesktop,
String sDocumentType )
{
String sURL = "private:factory/" + sDocumentType;
-
+
com.sun.star.lang.XComponent xComponent = null;
com.sun.star.frame.XComponentLoader xComponentLoader = null;
com.sun.star.beans.PropertyValue xValues[] =
new com.sun.star.beans.PropertyValue[1];
com.sun.star.beans.PropertyValue xEmptyArgs[] =
new com.sun.star.beans.PropertyValue[0];
-
+
try {
xComponentLoader = (com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
com.sun.star.frame.XComponentLoader.class, xDesktop);
-
+
xComponent = xComponentLoader.loadComponentFromURL(
sURL, "_blank", 0, xEmptyArgs);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return xComponent ;
}
}
diff --git a/odk/examples/java/Text/TextDocumentStructure.java b/odk/examples/java/Text/TextDocumentStructure.java
index f60ce98c937d..1d91f6f1f44c 100644
--- a/odk/examples/java/Text/TextDocumentStructure.java
+++ b/odk/examples/java/Text/TextDocumentStructure.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -42,10 +42,10 @@
import com.sun.star.uno.UnoRuntime;
public class TextDocumentStructure {
-
+
public static void main(String args[]) {
com.sun.star.uno.XComponentContext xContext = null;
-
+
try {
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
@@ -70,7 +70,7 @@ public class TextDocumentStructure {
String strDoc = "private:factory/swriter";
System.out.println("create new text document");
-
+
com.sun.star.lang.XComponent xComp = xCLoader.loadComponentFromURL(
strDoc, "_blank", 0, szEmptyArgs);
@@ -81,16 +81,16 @@ public class TextDocumentStructure {
// create some example data
com.sun.star.text.XText xText = xTextDocument.getText();
- createExampleData( xText );
-
+ createExampleData( xText );
+
// Begin section 'The structure of text documents' of the Tutorial
-
+
com.sun.star.container.XEnumeration xParagraphEnumeration = null;
com.sun.star.container.XEnumerationAccess xParaEnumerationAccess = null;
com.sun.star.container.XEnumeration xPortionEnumeration = null;
com.sun.star.container.XEnumeration xTextPortionEnum;
com.sun.star.text.XTextContent xTextElement = null;
-
+
System.out.println("create an enumeration of all paragraphs");
// create an enumeration access of all paragraphs of a document
com.sun.star.container.XEnumerationAccess xEnumerationAccess =
@@ -98,7 +98,7 @@ public class TextDocumentStructure {
UnoRuntime.queryInterface(
com.sun.star.container.XEnumerationAccess.class, xText);
xParagraphEnumeration = xEnumerationAccess.createEnumeration();
-
+
// Loop through all paragraphs of the document
while ( xParagraphEnumeration.hasMoreElements() ) {
xTextElement = (com.sun.star.text.XTextContent)
@@ -108,14 +108,14 @@ public class TextDocumentStructure {
com.sun.star.lang.XServiceInfo xServiceInfo =
(com.sun.star.lang.XServiceInfo)UnoRuntime.queryInterface(
com.sun.star.lang.XServiceInfo.class, xTextElement);
-
+
// check ifs the current paragraph really a paragraph or an
// anchor of a frame or picture
if( xServiceInfo.supportsService("com.sun.star.text.Paragraph") ) {
com.sun.star.text.XTextRange xTextRange =
xTextElement.getAnchor();
System.out.println( "This is a Paragraph" );
-
+
// create another enumeration to get all text portions of
// the paragraph
xParaEnumerationAccess =
@@ -124,7 +124,7 @@ public class TextDocumentStructure {
com.sun.star.container.XEnumerationAccess.class,
xTextElement);
xTextPortionEnum = xParaEnumerationAccess.createEnumeration();
-
+
while ( xTextPortionEnum.hasMoreElements() ) {
com.sun.star.text.XTextRange xTextPortion =
(com.sun.star.text.XTextRange)UnoRuntime.queryInterface(
@@ -132,7 +132,7 @@ public class TextDocumentStructure {
xTextPortionEnum.nextElement());
System.out.println( "Text from the portion : "
+ xTextPortion.getString() );
-
+
com.sun.star.beans.XPropertySet xPropertySet =
(com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
@@ -140,22 +140,22 @@ public class TextDocumentStructure {
xTextPortion);
System.out.println( "Name of the font : "
+ xPropertySet.getPropertyValue( "CharFontName" ) );
-
+
// PropertyState status of each text portion.
com.sun.star.beans.XPropertyState xPropertyState =
(com.sun.star.beans.XPropertyState)
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertyState.class,
xTextPortion);
-
+
if( xPropertyState.getPropertyState("CharWeight").equals(
com.sun.star.beans.PropertyState.AMBIGUOUS_VALUE) )
System.out.println( "- The text range contains more than one different attributes" );
-
+
if( xPropertyState.getPropertyState( "CharWeight" ).equals(
com.sun.star.beans.PropertyState.DIRECT_VALUE ) )
System.out.println( " - The text range contains hard formats" );
-
+
if( xPropertyState.getPropertyState( "CharWeight" ).equals(
com.sun.star.beans.PropertyState.DEFAULT_VALUE ) )
System.out.println( " - The text range doesn't contains hard formats" );
@@ -170,36 +170,36 @@ public class TextDocumentStructure {
e.printStackTrace(System.err);
System.exit(1);
}
-
+
System.out.println("done");
System.exit(0);
}
-
+
public static void createExampleData( com.sun.star.text.XText xText ) {
-
+
try {
xText.setString( "This is an example sentence" );
-
+
com.sun.star.text.XWordCursor xWordCursor =
(com.sun.star.text.XWordCursor)UnoRuntime.queryInterface(
com.sun.star.text.XWordCursor.class, xText.getStart());
-
+
xWordCursor.gotoNextWord(false);
xWordCursor.gotoNextWord(false);
xWordCursor.gotoEndOfWord(true);
-
+
com.sun.star.beans.XPropertySet xPropertySet =
(com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xWordCursor );
xPropertySet.setPropertyValue("CharWeight",
new Float( com.sun.star.awt.FontWeight.BOLD ));
-
+
System.out.println("create example data");
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
-
+
+
}
}
diff --git a/odk/examples/java/Text/TextReplace.java b/odk/examples/java/Text/TextReplace.java
index 980b955e990f..0194d79b9825 100644
--- a/odk/examples/java/Text/TextReplace.java
+++ b/odk/examples/java/Text/TextReplace.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
//***************************************************************************
@@ -43,37 +43,37 @@
import com.sun.star.uno.UnoRuntime;
public class TextReplace {
-
+
public static void main(String args[]) {
// You need the desktop to create a document
// The getDesktop method does the UNO bootstrapping, gets the
// remote servie manager and the desktop object.
com.sun.star.frame.XDesktop xDesktop = null;
xDesktop = getDesktop();
-
+
com.sun.star.text.XTextDocument xTextDocument =
createTextdocument( xDesktop );
createExampleData( xTextDocument );
-
+
String mBritishWords[] = {"colour", "neighbour", "centre", "behaviour",
"metre", "through" };
String mUSWords[] = { "color", "neighbor", "center", "behavior",
- "meter", "thru" };
-
+ "meter", "thru" };
+
try {
com.sun.star.util.XReplaceDescriptor xReplaceDescr = null;
com.sun.star.util.XSearchDescriptor xSearchDescriptor = null;
com.sun.star.util.XReplaceable xReplaceable = null;
-
+
xReplaceable = (com.sun.star.util.XReplaceable)
UnoRuntime.queryInterface(
com.sun.star.util.XReplaceable.class, xTextDocument);
-
+
// You need a descriptor to set properies for Replace
xReplaceDescr = (com.sun.star.util.XReplaceDescriptor)
xReplaceable.createReplaceDescriptor();
-
+
System.out.println("Change all occurrences of ...");
for( int iArrayCounter = 0; iArrayCounter < mBritishWords.length;
iArrayCounter++ )
@@ -83,37 +83,37 @@ public class TextReplace {
// Set the properties the replace method need
xReplaceDescr.setSearchString(mBritishWords[iArrayCounter] );
xReplaceDescr.setReplaceString(mUSWords[iArrayCounter] );
-
+
// Replace all words
xReplaceable.replaceAll( xReplaceDescr );
}
-
+
}
catch( Exception e) {
e.printStackTrace(System.err);
- }
-
+ }
+
System.out.println("Done");
-
+
System.exit(0);
-
+
}
-
+
protected static void createExampleData(
com.sun.star.text.XTextDocument xTextDocument )
{
// Create textdocument and insert example text
com.sun.star.text.XTextCursor xTextCursor = null;
-
+
try {
xTextCursor = (com.sun.star.text.XTextCursor)
xTextDocument.getText().createTextCursor();
com.sun.star.text.XText xText = (com.sun.star.text.XText)
xTextDocument.getText();
-
+
xText.insertString( xTextCursor,
"He nervously looked all around. Suddenly he saw his ", false );
-
+
xText.insertString( xTextCursor, "neighbour ", true );
com.sun.star.beans.XPropertySet xCPS = (com.sun.star.beans.XPropertySet)
UnoRuntime.queryInterface(
@@ -123,9 +123,9 @@ public class TextReplace {
// Go to last character
xTextCursor.gotoEnd(false);
xCPS.setPropertyValue( "CharColor", new Integer( 0 ) );
-
+
xText.insertString( xTextCursor, "in the alley. Like lightening he darted off to the left and disappeared between the two warehouses almost falling over the trash can lying in the ", false );
-
+
xText.insertString( xTextCursor, "centre ", true );
xCPS = (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xTextCursor);
@@ -134,31 +134,31 @@ public class TextReplace {
// Go to last character
xTextCursor.gotoEnd(false);
xCPS.setPropertyValue( "CharColor", new Integer( 0 ) );
-
+
xText.insertString( xTextCursor, "of the sidewalk.", false );
-
+
xText.insertControlCharacter( xTextCursor,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false );
xText.insertString( xTextCursor, "He tried to nervously tap his way along in the inky darkness and suddenly stiffened: it was a dead-end, he would have to go back the way he had come.", false );
-
+
xTextCursor.gotoStart(false);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
}
-
+
public static com.sun.star.frame.XDesktop getDesktop() {
com.sun.star.frame.XDesktop xDesktop = null;
com.sun.star.lang.XMultiComponentFactory xMCF = null;
-
+
try {
com.sun.star.uno.XComponentContext xContext = null;
-
+
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
-
+
// get the remote office service manager
xMCF = xContext.getServiceManager();
if( xMCF != null ) {
@@ -176,16 +176,16 @@ public class TextReplace {
e.printStackTrace(System.err);
System.exit(1);
}
-
-
+
+
return xDesktop;
}
-
+
public static com.sun.star.text.XTextDocument createTextdocument(
com.sun.star.frame.XDesktop xDesktop )
{
com.sun.star.text.XTextDocument aTextDocument = null;
-
+
try {
com.sun.star.lang.XComponent xComponent = CreateNewDocument(xDesktop,
"swriter");
@@ -196,36 +196,36 @@ public class TextReplace {
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return aTextDocument;
}
-
-
+
+
protected static com.sun.star.lang.XComponent CreateNewDocument(
com.sun.star.frame.XDesktop xDesktop,
String sDocumentType )
{
String sURL = "private:factory/" + sDocumentType;
-
+
com.sun.star.lang.XComponent xComponent = null;
com.sun.star.frame.XComponentLoader xComponentLoader = null;
com.sun.star.beans.PropertyValue xValues[] =
new com.sun.star.beans.PropertyValue[1];
com.sun.star.beans.PropertyValue xEmptyArgs[] =
new com.sun.star.beans.PropertyValue[0];
-
+
try {
xComponentLoader = (com.sun.star.frame.XComponentLoader)
UnoRuntime.queryInterface(
com.sun.star.frame.XComponentLoader.class, xDesktop);
-
+
xComponent = xComponentLoader.loadComponentFromURL(
sURL, "_blank", 0, xEmptyArgs);
}
catch( Exception e) {
e.printStackTrace(System.err);
}
-
+
return xComponent ;
}
}
diff --git a/odk/examples/java/Text/WriterSelector.java b/odk/examples/java/Text/WriterSelector.java
index 6fd00189d657..5c90aabc62dd 100644
--- a/odk/examples/java/Text/WriterSelector.java
+++ b/odk/examples/java/Text/WriterSelector.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.uno.UnoRuntime;
@@ -44,7 +44,7 @@ public class WriterSelector {
*/
public static void main(String args[]) {
com.sun.star.uno.XComponentContext xContext = null;
-
+
try {
// bootstrap UNO and get the remote component context. The context can
@@ -54,14 +54,14 @@ public class WriterSelector {
// get the remote office service manager
com.sun.star.lang.XMultiComponentFactory xMCF =
- xContext.getServiceManager();
-
+ xContext.getServiceManager();
+
// get a new instance of the desktop
com.sun.star.frame.XDesktop xDesktop = (com.sun.star.frame.XDesktop)
UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class,
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop",
xContext ) );
-
+
com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface(
com.sun.star.frame.XComponentLoader.class, xDesktop);
@@ -76,15 +76,15 @@ public class WriterSelector {
xDoc.getText().setString("Please select something in this text and press then \"return\" in the shell where you have started the example.\n");
// ensure that the document content is optimal visible
- com.sun.star.frame.XModel xModel =
+ com.sun.star.frame.XModel xModel =
(com.sun.star.frame.XModel)UnoRuntime.queryInterface(
com.sun.star.frame.XModel.class, xDoc);
-
+
com.sun.star.view.XViewSettingsSupplier xViewSettings =
(com.sun.star.view.XViewSettingsSupplier)UnoRuntime.queryInterface(
com.sun.star.view.XViewSettingsSupplier.class, xModel.getCurrentController());
xViewSettings.getViewSettings().setPropertyValue(
- "ZoomType", new Short((short)0));
+ "ZoomType", new Short((short)0));
}
// test document will be closed later
@@ -93,23 +93,23 @@ public class WriterSelector {
do{
c = (char) System.in.read();
}while ((c != 13) && (c != 10));
-
+
// Getting the current frame from the OpenOffice.org Server.
com.sun.star.frame.XFrame xframe = xDesktop.getCurrentFrame();
-
+
// Getting the controller.
com.sun.star.frame.XController xController = xframe.getController();
-
+
com.sun.star.view.XSelectionSupplier xSelSupplier =
(com.sun.star.view.XSelectionSupplier)UnoRuntime.queryInterface(
com.sun.star.view.XSelectionSupplier.class, xController );
-
+
Object oSelection = xSelSupplier.getSelection();
-
+
com.sun.star.lang.XServiceInfo xServInfo =
(com.sun.star.lang.XServiceInfo)UnoRuntime.queryInterface(
com.sun.star.lang.XServiceInfo.class, oSelection );
-
+
if ( xServInfo.supportsService("com.sun.star.text.TextRanges") )
{
com.sun.star.container.XIndexAccess xIndexAccess =
@@ -123,17 +123,17 @@ public class WriterSelector {
UnoRuntime.queryInterface(
com.sun.star.text.XTextRange.class,
xIndexAccess.getByIndex(i));
-
+
System.out.println( "You have selected a text range: \""
+ xTextRange.getString() + "\"." );
}
}
-
+
if ( xServInfo.supportsService("com.sun.star.text.TextGraphicObject") )
{
System.out.println( "You have selected a graphics." );
}
-
+
if ( xServInfo.supportsService("com.sun.star.text.TextTableCursor") )
{
System.out.println( "You have selected a text table." );
@@ -150,8 +150,8 @@ public class WriterSelector {
} else
{
xComponent.dispose();
- }
-
+ }
+
System.exit(0);
}
catch( Exception e ) {
diff --git a/odk/examples/java/ToDo/ToDo.idl b/odk/examples/java/ToDo/ToDo.idl
index 3aa45ccf4448..317671d1bf7e 100644
--- a/odk/examples/java/ToDo/ToDo.idl
+++ b/odk/examples/java/ToDo/ToDo.idl
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
#ifndef INCLUDED_ORG_OPENOFFICE_TODO_IDL
diff --git a/odk/examples/java/ToDo/ToDo.java b/odk/examples/java/ToDo/ToDo.java
index 87257c406903..df6310b360d3 100644
--- a/odk/examples/java/ToDo/ToDo.java
+++ b/odk/examples/java/ToDo/ToDo.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
import com.sun.star.lib.uno.helper.Factory;
@@ -78,17 +78,17 @@ import java.util.Arrays;
* (<CODE>__writeRegistryServiceInfo</CODE>).
*/
public class ToDo {
-
+
/** This class implements the component. At least the interfaces
* XInterface, XTypeProvider, and XWeak implemented by the helper class
* WeakBase and XServiceInfo should be provided by the service.
*/
public static class ToDoImpl extends WeakBase implements XServiceInfo, XToDo {
-
+
/** The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "org.openoffice.ToDo";
-
+
/** The initial component contextr, that gives access to
* the service manager, supported singletons, ...
* It's often later used
@@ -110,28 +110,28 @@ public class ToDo {
static private final int INT_COLUMN_END_DAY_OF_WEEK = 6;
static private final int INT_COLUMN_DUEDATE = 7;
static private final int INT_COLUMN_STATUS = 8;
-
+
static private final int INT_ROW_FROM = 14; // 8
-
+
static private final int INT_ROW_HOLIDAYS_START = 4;
static private final int INT_COLUMN_HOLIDAYS_START = 7; // 10
-
+
static private final String STRING_SEPARATOR = "/";
-
+
/** The constructor of the inner class has a XComponenContext parameter.
* @param xCompContext the initial component context
*/
public ToDoImpl(XComponentContext xCompContext) {
try {
m_cmpCtx = xCompContext;
- m_xMCF = m_cmpCtx.getServiceManager();
+ m_xMCF = m_cmpCtx.getServiceManager();
}
catch( Exception e ) {
e.printStackTrace(System.err);
}
}
-
+
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
@@ -142,8 +142,8 @@ public class ToDo {
public static String[] getServiceNames() {
String[] sSupportedServiceNames = { __serviceName };
return sSupportedServiceNames;
- }
-
+ }
+
/** This method returns true, if the given service will be
* supported by the component.
* @param sService Service name.
@@ -152,14 +152,14 @@ public class ToDo {
public boolean supportsService(String sServiceName) {
return sServiceName.equals( __serviceName );
}
-
+
/** Return the class name of the component.
* @return Class name of the component.
*/
public String getImplementationName() {
return ToDoImpl.class.getName();
}
-
+
/** For every bug/feature listed in a spreadsheet document this method
* calculates the start date, day of week of the start date, the end date
* and the day of week of the end date. All calculations are dependent
@@ -181,74 +181,74 @@ public class ToDo {
XSpreadsheetDocument xspreadsheetdocument =
( XSpreadsheetDocument ) UnoRuntime.queryInterface(
XSpreadsheetDocument.class, aInstance );
-
+
// Querying for the interface XIndexAccess
XIndexAccess xindexaccess = ( XIndexAccess )
UnoRuntime.queryInterface( XIndexAccess.class,
xspreadsheetdocument.getSheets() );
-
+
// Getting the first XSpreadsheet
XSpreadsheet xspreadsheet = (XSpreadsheet)UnoRuntime.queryInterface(
XSpreadsheet.class, xindexaccess.getByIndex( 0 ));
-
+
// Querying for the interface XCellRange on the XSpeadsheet
XCellRange xcellrange = ( XCellRange )
UnoRuntime.queryInterface( XCellRange.class, xspreadsheet );
-
+
/* Getting the gregorian calendar with the date on which to start
the calculation */
GregorianCalendar gregCalAbsoluteStartDate =
this.getGregorianCalendarFromString(this.getStringFromCell(
xcellrange, 5, 2 ) );
gregCalAbsoluteStartDate.add( Calendar.DATE, -1 );
-
+
// Set the start date with the absolute start date
GregorianCalendar gregCalStartDate =
(GregorianCalendar) gregCalAbsoluteStartDate.clone();
-
+
/* Creating the service FunctionAccess, which allows generic
access to all spreadsheet functions */
Object objectFunctionAccess =
m_xMCF.createInstanceWithContext(
"com.sun.star.sheet.FunctionAccess", m_cmpCtx );
-
+
// Querying for the interface XFunctionAccess on service
// FunctionAccess
XFunctionAccess xfunctionaccess = (XFunctionAccess)
UnoRuntime.queryInterface(XFunctionAccess.class,
objectFunctionAccess );
-
+
// Creating vector for holidays
Vector vectorHolidays = new Vector();
-
+
// Get the Official Holidays
this.getOfficialHolidays( vectorHolidays, xcellrange,
xfunctionaccess,
gregCalStartDate.get(
Calendar.YEAR ) );
-
+
// Get the private holidays
this.getPrivateHolidays(vectorHolidays, xcellrange,
xfunctionaccess);
-
+
// Getting the object array of holidays
Object[] objectSortedHolidays = vectorHolidays.toArray();
-
+
// Sorting the holidays
Arrays.sort( objectSortedHolidays );
-
+
// Collect the Official Holidays and the private holidays
Object [][]objectHolidays =
new Object[][] { objectSortedHolidays };
-
+
// Row index
int intRowTo = this.INT_ROW_FROM - 1;
-
+
// Getting the feature of the first cell
String sFeature = this.getStringFromCell(xcellrange,
intRowTo + 1,
this.INT_COLUMN_FEATURE);
-
+
// Determine the last row with an entry in the first column
while ( ( sFeature != null ) &&
( !sFeature.equals( "" ) ) ) {
@@ -256,10 +256,10 @@ public class ToDo {
sFeature = this.getStringFromCell( xcellrange,
intRowTo + 1, this.INT_COLUMN_FEATURE );
}
-
+
// Setting the last row to be calculated
final int INT_ROW_TO = intRowTo + 1;
-
+
// Deleting cells which will be recalculated
for ( int intRow = this.INT_ROW_FROM; intRow < INT_ROW_TO + 5;
intRow++ ) {
@@ -269,11 +269,11 @@ public class ToDo {
this.setStringToCell(xcellrange, intRow, intColumn, "");
}
}
-
+
/* Clearing the background color of the due date cells and setting
the hyperlink to the bugtracker */
for (int intRow = this.INT_ROW_FROM; intRow < INT_ROW_TO; intRow++)
- {
+ {
// Querying for the interface XPropertySet for the cell
// providing the due date
XPropertySet xpropertyset = ( XPropertySet )
@@ -281,73 +281,73 @@ public class ToDo {
xcellrange.getCellByPosition(
this.INT_COLUMN_DUEDATE,
intRow ));
-
+
// Changing the background color of the cell to white
xpropertyset.setPropertyValue( "CellBackColor",
new Integer( 16777215 ) );
-
+
// Getting the cell of the bug id
XCell xcell = xcellrange.getCellByPosition(
this.INT_COLUMN_FEATURE, intRow );
-
+
// Querying for the interface XSimpleText
XSimpleText xsimpletext = ( XSimpleText )
UnoRuntime.queryInterface( XSimpleText.class, xcell );
-
+
// Getting the text cursor
XTextCursor xtextcursor = xsimpletext.createTextCursor();
-
+
// Querying for the interface XTextRange
XTextRange xtextrange = ( XTextRange )
UnoRuntime.queryInterface( XTextRange.class, xtextcursor );
-
+
// Getting the bug ID from the cell
- String sBugID = xtextrange.getString();
+ String sBugID = xtextrange.getString();
if ( !sBugID.startsWith(
"http://www.openoffice.org/issues/show_bug.cgi?id=") ) {
String sBugIDLink =
"http://www.openoffice.org/issues/show_bug.cgi?id=" + sBugID;
-
+
// Querying for the interface XMultiServiceFactory
XMultiServiceFactory xMSFTextField =
(XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class, aInstance );
-
+
// Creating an instance of the text field URL
Object objectTextField =
xMSFTextField.createInstance(
"com.sun.star.text.TextField.URL" );
-
+
// Querying for the interface XTextField
XTextField xtextfield = ( XTextField )
UnoRuntime.queryInterface( XTextField.class,
objectTextField );
-
+
// Querying for the interface XPropertySet
XPropertySet xpropertysetTextField = ( XPropertySet )
UnoRuntime.queryInterface( XPropertySet.class,
xtextfield );
-
+
// Setting the URL
xpropertysetTextField.setPropertyValue( "URL",
sBugIDLink );
-
+
// Setting the representation of the URL
xpropertysetTextField.setPropertyValue( "Representation",
sBugID );
-
+
// Querying for the interface XText
XText xtext = ( XText )UnoRuntime.queryInterface(
XText.class, xcell );
-
+
// Delete cell content
xtextrange.setString( "" );
-
+
// Inserting the text field URL to the cell
xtext.insertTextContent( xtextrange, xtextfield, false );
}
}
-
+
// Processing all features/bugs in the table
for (int intRow = this.INT_ROW_FROM; intRow < INT_ROW_TO; intRow++)
{
@@ -358,11 +358,11 @@ public class ToDo {
// Getting the number of needed days to perform the feature
int intNeededDays = (int) Math.round( xcell.getValue() );
-
+
// Getting the content of a specified cell
String sStatus = this.getStringFromCell( xcellrange,
intRow, this.INT_COLUMN_STATUS );
-
+
/* Testing if the number of needed days is greater than
zero and if
the status is not "done" */
@@ -373,54 +373,54 @@ public class ToDo {
gregCalStartDate = this.getWorkday(
gregCalStartDate, 1, objectHolidays,
xfunctionaccess );
-
+
// Getting a string with the date format jjjj-mm-dd from
// the gregorian calendar
String sDate = this.getStringFromGregorianCalendar(
gregCalStartDate );
-
+
// Set the start date in the specified cell of the table
this.setStringToCell(xcellrange, intRow,
this.INT_COLUMN_STARTDATE, sDate);
-
+
// For the start day set the day of week in the specified
// cell of the table
this.setDayOfWeek( gregCalStartDate,
xcellrange, intRow,
this.INT_COLUMN_START_DAY_OF_WEEK );
-
+
// Getting the end date after a specified number of workdays
GregorianCalendar gregCalEndDate =
this.getWorkday( gregCalStartDate,
intNeededDays - 1,
objectHolidays, xfunctionaccess );
-
+
// Creating a string with the date format jjjj-mm-dd
sDate = this.getStringFromGregorianCalendar(
gregCalEndDate );
-
+
// Set the end date in the specified cell of the table
this.setStringToCell( xcellrange, intRow,
this.INT_COLUMN_ENDDATE, sDate );
-
+
// For the end day set the day of week in the specified
// cell of the table
this.setDayOfWeek(gregCalEndDate, xcellrange,
intRow, this.INT_COLUMN_END_DAY_OF_WEEK);
-
+
// Set the initial date for the next loop
gregCalStartDate = ( GregorianCalendar )
gregCalEndDate.clone();
-
+
// Get the due date from the table
String sDueDate = this.getStringFromCell(
xcellrange, intRow, this.INT_COLUMN_DUEDATE );
-
+
// Testing if the due date is not empty
if ( !sDueDate.equals( "" ) ) {
GregorianCalendar gregCalDueDate =
this.getGregorianCalendarFromString(sDueDate);
-
+
// Testing if the due date is before the calculated
// end date
if ( gregCalDueDate.before(
@@ -433,10 +433,10 @@ public class ToDo {
-( intNeededDays - 1 ),
objectHolidays,
xfunctionaccess);
-
+
// Begin with the current row
int intRowToInsert = intRow;
-
+
// Get the start date for the feature/bug in the
// current row
GregorianCalendar gregCalPreviousStartDate =
@@ -444,7 +444,7 @@ public class ToDo {
this.getStringFromCell(
xcellrange, intRowToInsert,
this.INT_COLUMN_STARTDATE ) );
-
+
// Testing if we have to search for an earlier date
// to begin
while ((gregCalLatestDateToStart.before(
@@ -452,32 +452,32 @@ public class ToDo {
(INT_ROW_FROM != intRowToInsert)) {
// Decrease the row
intRowToInsert--;
-
+
// Get the start date for the feature/bug in
// the current row
String sStartDate = this.getStringFromCell(
xcellrange, intRowToInsert,
this.INT_COLUMN_STARTDATE );
-
+
// Search until a valid start date is found
while ( sStartDate.equals( "" ) ) {
// Decrease the row
intRowToInsert--;
-
+
// Get the start date for the feature/bug
// in the current row
sStartDate = this.getStringFromCell(
xcellrange, intRowToInsert,
this.INT_COLUMN_STARTDATE );
}
-
+
// Get the GregorianCalender format for the
// start date
gregCalPreviousStartDate =
this.getGregorianCalendarFromString(
sStartDate );
}
-
+
// Getting the cell of the column "Needed Days"
// in the row where to insert
XCell xcellNeededDaysWhereToInsert =
@@ -488,25 +488,25 @@ public class ToDo {
int intNeededDaysWhereToInsert = (int)
Math.round(
xcellNeededDaysWhereToInsert.getValue());
-
+
GregorianCalendar gregCalPreviousNewEndDate =
this.getWorkday(gregCalPreviousStartDate,
intNeededDays - 1 +
intNeededDaysWhereToInsert,
objectHolidays,
- xfunctionaccess);
+ xfunctionaccess);
String sPreviousDueDate = this.getStringFromCell(
xcellrange, intRowToInsert,
this.INT_COLUMN_DUEDATE );
-
+
GregorianCalendar gregCalPreviousDueDate = null;
-
+
if ( !sPreviousDueDate.equals( "" ) ) {
gregCalPreviousDueDate =
this.getGregorianCalendarFromString(
sPreviousDueDate );
}
-
+
if ( ( intRowToInsert == intRow ) ||
( gregCalPreviousNewEndDate.after(
gregCalPreviousDueDate ) ) ) {
@@ -518,7 +518,7 @@ public class ToDo {
xcellrange.getCellByPosition(
this.INT_COLUMN_DUEDATE,
intRow ) );
-
+
// Changing the background color of the cell
// to red
xpropertyset.setPropertyValue(
@@ -533,19 +533,19 @@ public class ToDo {
XTableRows xTableRows =
xcolumnrowrange.getRows();
xTableRows.insertByIndex( intRowToInsert, 1 );
-
+
// Querying for the interface
// XCellRangeMovement on XCellRange
XCellRangeMovement xcellrangemovement =
(XCellRangeMovement)UnoRuntime.queryInterface(
XCellRangeMovement.class, xcellrange );
-
+
// Creating the cell address of the destination
CellAddress celladdress = new CellAddress();
celladdress.Sheet = 0;
celladdress.Column = 0;
celladdress.Row = intRowToInsert;
-
+
// Creating the cell range of the source
CellRangeAddress cellrangeaddress =
new CellRangeAddress();
@@ -554,20 +554,20 @@ public class ToDo {
cellrangeaddress.StartRow = intRow + 1;
cellrangeaddress.EndColumn = 8;
cellrangeaddress.EndRow = intRow + 1;
-
+
// Moves the cell range to another position in
// the document
xcellrangemovement.moveRange(celladdress,
cellrangeaddress);
-
+
// Removing the row not needed anymore
xcolumnrowrange.getRows().removeByIndex(intRow
+ 1, 1);
-
+
// Set the current row, because we want to
// recalculate all rows below
intRow = intRowToInsert - 1;
-
+
// Tests at which line we want to insert
if ( intRow >= this.INT_ROW_FROM ) {
// Get the start date
@@ -591,8 +591,8 @@ public class ToDo {
catch( Exception exception ) {
showExceptionMessage( exception );
}
- }
-
+ }
+
/** Getting a string from a gregorian calendar.
* @param gregCal Date to be converted.
* @return string (converted gregorian calendar).
@@ -602,45 +602,45 @@ public class ToDo {
+ STRING_SEPARATOR + gregCal.get( Calendar.DATE )
// + STRING_SEPARATOR + ( gregCal.get( Calendar.MONTH ) + 1 )
+ STRING_SEPARATOR + gregCal.get( Calendar.YEAR );
-
+
return sDate;
}
-
+
/** Getting a GregorianCalendar from a string.
* @param sDate String to be converted.
* @return The result of the converting of the string.
*/
public GregorianCalendar getGregorianCalendarFromString( String sDate ) {
int []intDateValue = this.getDateValuesFromString( sDate );
-
+
return( new GregorianCalendar( intDateValue[ 2 ], intDateValue[ 0 ],
intDateValue[ 1 ] ) );
}
-
+
/** Getting the day, month and year from a string.
* @param sDate String to be parsed.
* @return Returns an array of integer variables.
*/
public int[] getDateValuesFromString( String sDate) {
int[] intDateValues = new int[ 3 ];
-
+
int intPositionFirstTag = sDate.indexOf( STRING_SEPARATOR );
int intPositionSecondTag = sDate.indexOf(STRING_SEPARATOR,
intPositionFirstTag + 1);
-
+
// Getting the value of the month
intDateValues[ 0 ] = Integer.parseInt(
sDate.substring(0, intPositionFirstTag)) - 1;
// Getting the value of the day
intDateValues[ 1 ] = Integer.parseInt(
- sDate.substring(intPositionFirstTag + 1, intPositionSecondTag));
+ sDate.substring(intPositionFirstTag + 1, intPositionSecondTag));
// Getting the value of the year
intDateValues[ 2 ] = Integer.parseInt(
sDate.substring(intPositionSecondTag + 1, sDate.length()));
-
+
return intDateValues;
}
-
+
/** Getting a content from a specified cell.
* @param xcellrange Providing access to cells.
* @param intRow Number of row.
@@ -650,7 +650,7 @@ public class ToDo {
public String getStringFromCell( XCellRange xcellrange, int intRow,
int intColumn ) {
XTextRange xtextrangeStartDate = null;
-
+
try {
// Getting the cell holding the information about the start date
XCell xcellStartDate = xcellrange.getCellByPosition(intColumn,
@@ -662,11 +662,11 @@ public class ToDo {
catch( Exception exception ) {
this.showExceptionMessage( exception );
}
-
+
// Getting the start date
return xtextrangeStartDate.getString().trim();
}
-
+
/** Writing a specified string to a specified cell.
* @param xcellrange Providing access to the cells.
* @param intRow Number of row.
@@ -689,7 +689,7 @@ public class ToDo {
this.showExceptionMessage( exception );
}
}
-
+
/** Calculates the week of day and calls the method "setStringToCell".
* @param gregCal Day to be written to the cell.
* @param xcellrange Providing access to the cells.
@@ -712,11 +712,11 @@ public class ToDo {
} else if ( intDayOfWeek == Calendar.FRIDAY ) {
sDayOfWeek = "FRI";
}
-
+
this.setStringToCell( xcellrange, intRow, intColumn,
sDayOfWeek );
}
-
+
/** Calculates the dates of the official holidays with help of Calc
* functions.
* @param vectorHolidays Holding all holidays.
@@ -738,15 +738,15 @@ public class ToDo {
intNumberOfYear <= ( intHowManyYears - 1 );
intNumberOfYear++ ) {
intYear += intNumberOfYear;
-
+
// Getting the Easter sunday
Double dEasterSunday = ( Double )
xfunctionaccess.callFunction(
"EASTERSUNDAY", new Object[] { new Integer(intYear) });
-
+
int intEasterSunday = (int)Math.round(
dEasterSunday.doubleValue());
-
+
// New-year
vectorHolidays.addElement( xfunctionaccess.callFunction(
"DATE",
@@ -754,15 +754,15 @@ public class ToDo {
new Integer( intYear ),
new Integer( 1 ),
new Integer( 1 ) } ));
-
+
// Good Friday
vectorHolidays.addElement(
new Double( intEasterSunday - 2 ) );
-
+
// Easter monday
vectorHolidays.addElement(
new Double( intEasterSunday + 1 ) );
-
+
// Labour Day
vectorHolidays.addElement( xfunctionaccess.callFunction(
"DATE",
@@ -770,13 +770,13 @@ public class ToDo {
new Integer( intYear ),
new Integer( 5 ),
new Integer( 1 ) } ));
-
+
// Ascension Day
vectorHolidays.addElement(new Double(intEasterSunday + 39 ));
-
+
// Pentecost monday
vectorHolidays.addElement(new Double(intEasterSunday + 50 ));
-
+
// German Unification
vectorHolidays.addElement( xfunctionaccess.callFunction(
"DATE",
@@ -784,7 +784,7 @@ public class ToDo {
new Integer( intYear ),
new Integer( 10 ),
new Integer( 3 ) } ));
-
+
// Christmas Day First
vectorHolidays.addElement( xfunctionaccess.callFunction(
"DATE",
@@ -792,7 +792,7 @@ public class ToDo {
new Integer( intYear ),
new Integer( 12 ),
new Integer( 25 ) } ));
-
+
// Christmas Day Second
vectorHolidays.addElement( xfunctionaccess.callFunction(
"DATE",
@@ -806,7 +806,7 @@ public class ToDo {
this.showExceptionMessage( exception );
}
}
-
+
/** Returns the serial number of the date before or after a specified
* number of workdays.
* @param gregCalStartDate Date to start with the calculation.
@@ -821,7 +821,7 @@ public class ToDo {
int intDays, Object[][] objectHolidays,
XFunctionAccess xfunctionaccess ) {
GregorianCalendar gregCalWorkday = null;
-
+
try {
// Getting the value of the start date
Double dDate = ( Double ) xfunctionaccess.callFunction(
@@ -831,18 +831,18 @@ public class ToDo {
new Integer( gregCalStartDate.get( Calendar.MONTH ) + 1 ),
new Integer( gregCalStartDate.get( Calendar.DATE ) )
} );
-
+
Double dWorkday = ( Double ) xfunctionaccess.callFunction(
"com.sun.star.sheet.addin.Analysis.getWorkday",
new Object[] { dDate, new Integer( intDays ), objectHolidays } );
-
+
Double dYear = ( Double ) xfunctionaccess.callFunction(
"YEAR", new Object[] { dWorkday } );
Double dMonth = ( Double ) xfunctionaccess.callFunction(
"MONTH", new Object[] { dWorkday } );
Double dDay = ( Double ) xfunctionaccess.callFunction(
"DAY", new Object[] { dWorkday } );
-
+
gregCalWorkday = new GregorianCalendar(
dYear.intValue(),
dMonth.intValue() - 1,
@@ -851,10 +851,10 @@ public class ToDo {
catch( Exception exception ) {
this.showExceptionMessage( exception );
}
-
+
return gregCalWorkday;
}
-
+
/** Getting the holidays from the spreadsheet.
* @param vectorHolidays Holding all holidays.
* @param xcellrange Providing the cells.
@@ -866,13 +866,13 @@ public class ToDo {
try {
int intRow = this.INT_ROW_HOLIDAYS_START;
int intColumn = this.INT_COLUMN_HOLIDAYS_START;
-
+
double dHolidayStart = xcellrange.getCellByPosition(
intColumn, intRow ).getValue();
-
+
double dHolidayEnd = xcellrange.getCellByPosition(
intColumn + 1, intRow ).getValue();
-
+
while ( dHolidayStart != 0 ) {
if ( dHolidayEnd == 0 ) {
vectorHolidays.addElement(
@@ -887,7 +887,7 @@ public class ToDo {
vectorHolidays.addElement( new Double( intHoliday ) );
}
}
-
+
intRow++;
dHolidayStart = xcellrange.getCellByPosition(
intColumn, intRow).getValue();
@@ -899,7 +899,7 @@ public class ToDo {
this.showExceptionMessage( exception );
}
}
-
+
/** Showing the stack trace in a JOptionPane.
* @param sMessage The message to show.
*/
@@ -913,7 +913,7 @@ public class ToDo {
javax.swing.JOptionPane.INFORMATION_MESSAGE);
jframe.dispose();
}
-
+
/** Writing the stack trace from an exception to a string and calling
* the method showMessage() with this string.
* @param exception The occured exception.
@@ -926,9 +926,9 @@ public class ToDo {
exception.printStackTrace( printwriter);
System.err.println( exception );
this.showMessage( swriter.getBuffer().substring(0) );
- }
+ }
}
-
+
/**
* Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -941,11 +941,11 @@ public class ToDo {
*/
public static XSingleComponentFactory __getComponentFactory(String sImplName) {
XSingleComponentFactory xFactory = null;
-
+
if ( sImplName.equals( ToDoImpl.class.getName() ) )
xFactory = Factory.createComponentFactory(ToDoImpl.class,
ToDoImpl.getServiceNames());
-
+
return xFactory;
}
diff --git a/odk/examples/java/ToDo/XToDo.idl b/odk/examples/java/ToDo/XToDo.idl
index 5cae425c4ea0..10d592f77aad 100644
--- a/odk/examples/java/ToDo/XToDo.idl
+++ b/odk/examples/java/ToDo/XToDo.idl
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
#ifndef INCLUDED_ORG_OPENOFFICE_XTODO_IDL
@@ -40,10 +40,10 @@
module org {
/// openoffice
module openoffice {
- /// example interface
+ /// example interface
interface XToDo {
- void recalc( [in] any aInstance );
- };
+ void recalc( [in] any aInstance );
+ };
};
};