134dd1e25SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 334dd1e25SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 434dd1e25SAndrew Rist * or more contributor license agreements. See the NOTICE file 534dd1e25SAndrew Rist * distributed with this work for additional information 634dd1e25SAndrew Rist * regarding copyright ownership. The ASF licenses this file 734dd1e25SAndrew Rist * to you under the Apache License, Version 2.0 (the 834dd1e25SAndrew Rist * "License"); you may not use this file except in compliance 934dd1e25SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 1134dd1e25SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 1334dd1e25SAndrew Rist * Unless required by applicable law or agreed to in writing, 1434dd1e25SAndrew Rist * software distributed under the License is distributed on an 1534dd1e25SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1634dd1e25SAndrew Rist * KIND, either express or implied. See the License for the 1734dd1e25SAndrew Rist * specific language governing permissions and limitations 1834dd1e25SAndrew Rist * under the License. 19cdf0e10cSrcweir * 2034dd1e25SAndrew Rist *************************************************************/ 2134dd1e25SAndrew Rist 22cdf0e10cSrcweir //*************************************************************************** 23cdf0e10cSrcweir // comment: Step 1: get the Desktop object from the office 24cdf0e10cSrcweir // Step 2: open an empty Calc document 25cdf0e10cSrcweir // Step 3: enter a example text, set the numberformat to DM 26cdf0e10cSrcweir // Step 4: change the numberformat to EUR (Euro) 27cdf0e10cSrcweir // Step 5: use the DM/EUR factor on each cell with a content 28cdf0e10cSrcweir //*************************************************************************** 29cdf0e10cSrcweir 30cdf0e10cSrcweir import com.sun.star.beans.PropertyValue; 31cdf0e10cSrcweir import com.sun.star.beans.XPropertySet; 32cdf0e10cSrcweir 33cdf0e10cSrcweir import com.sun.star.container.XEnumeration; 34cdf0e10cSrcweir import com.sun.star.container.XIndexAccess; 35cdf0e10cSrcweir import com.sun.star.container.XEnumerationAccess; 36cdf0e10cSrcweir 37cdf0e10cSrcweir import com.sun.star.document.XActionLockable; 38cdf0e10cSrcweir 39cdf0e10cSrcweir import com.sun.star.frame.XDesktop; 40cdf0e10cSrcweir import com.sun.star.frame.XComponentLoader; 41cdf0e10cSrcweir 42cdf0e10cSrcweir import com.sun.star.lang.Locale; 43cdf0e10cSrcweir import com.sun.star.lang.XComponent; 44cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory; 45cdf0e10cSrcweir 46cdf0e10cSrcweir import com.sun.star.table.XCell; 47cdf0e10cSrcweir import com.sun.star.table.XCellRange; 48cdf0e10cSrcweir 49cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheet; 50cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheets; 51cdf0e10cSrcweir import com.sun.star.sheet.XSheetCellRanges; 52cdf0e10cSrcweir import com.sun.star.sheet.XCellRangesQuery; 53cdf0e10cSrcweir import com.sun.star.sheet.XCellFormatRangesSupplier; 54cdf0e10cSrcweir import com.sun.star.sheet.XCellRangesQuery; 55cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheetDocument; 56cdf0e10cSrcweir 57cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 58cdf0e10cSrcweir import com.sun.star.uno.AnyConverter; 59cdf0e10cSrcweir import com.sun.star.uno.XInterface; 60cdf0e10cSrcweir import com.sun.star.uno.XComponentContext; 61cdf0e10cSrcweir 62cdf0e10cSrcweir import com.sun.star.util.NumberFormat; 63cdf0e10cSrcweir import com.sun.star.util.XNumberFormats; 64cdf0e10cSrcweir import com.sun.star.util.XNumberFormatsSupplier; 65cdf0e10cSrcweir 66cdf0e10cSrcweir 67cdf0e10cSrcweir public class EuroAdaption { 68cdf0e10cSrcweir main(String args[])69cdf0e10cSrcweir public static void main(String args[]) { 70cdf0e10cSrcweir // You need the desktop to create a document 71cdf0e10cSrcweir // The getDesktop method does the UNO bootstrapping, gets the 72cdf0e10cSrcweir // remote servie manager and the desktop object. 73cdf0e10cSrcweir com.sun.star.frame.XDesktop xDesktop = null; 74cdf0e10cSrcweir xDesktop = getDesktop(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir // create a sheet document 77cdf0e10cSrcweir XSpreadsheetDocument xSheetdocument = null; 78cdf0e10cSrcweir xSheetdocument = ( XSpreadsheetDocument ) createSheetdocument( xDesktop ); 79cdf0e10cSrcweir System.out.println( "Create a new Spreadsheet" ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir // get the collection of all sheets from the document 82cdf0e10cSrcweir XSpreadsheets xSheets = null; 83cdf0e10cSrcweir xSheets = (XSpreadsheets) xSheetdocument.getSheets(); 84cdf0e10cSrcweir 85cdf0e10cSrcweir // the Action Interface provides methods to hide actions, 86cdf0e10cSrcweir // like inserting data, on a sheet, that increase the performance 87cdf0e10cSrcweir XActionLockable xActionInterface = null; 88cdf0e10cSrcweir xActionInterface = (XActionLockable) UnoRuntime.queryInterface( 89cdf0e10cSrcweir XActionLockable.class, xSheetdocument ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir // lock all actions 92cdf0e10cSrcweir xActionInterface.addActionLock(); 93cdf0e10cSrcweir 94cdf0e10cSrcweir com.sun.star.sheet.XSpreadsheet xSheet = null; 95cdf0e10cSrcweir try { 96cdf0e10cSrcweir // get via the index access the first sheet 97cdf0e10cSrcweir XIndexAccess xElements = (XIndexAccess) UnoRuntime.queryInterface( 98cdf0e10cSrcweir XIndexAccess.class, xSheets ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir // specify the first sheet from the spreadsheet 101cdf0e10cSrcweir xSheet = (XSpreadsheet) UnoRuntime.queryInterface( 102cdf0e10cSrcweir XSpreadsheet.class, xElements.getByIndex( 0 )); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir catch( Exception e) { 105cdf0e10cSrcweir e.printStackTrace(System.err); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir // get the interface to apply and create new numberformats 109cdf0e10cSrcweir XNumberFormatsSupplier xNumberFormatSupplier = null; 110cdf0e10cSrcweir xNumberFormatSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface( 111cdf0e10cSrcweir XNumberFormatsSupplier.class, xSheetdocument ); 112cdf0e10cSrcweir XNumberFormats xNumberFormats = null; 113cdf0e10cSrcweir xNumberFormats = xNumberFormatSupplier.getNumberFormats(); 114cdf0e10cSrcweir 115cdf0e10cSrcweir // insert some example data in a sheet 116cdf0e10cSrcweir createExampleData( xSheet, xNumberFormats ); 117cdf0e10cSrcweir System.out.println( "Insert example data and use the number format with the currency 'DM'" ); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // Change the currency from the cells from DM to Euro 120cdf0e10cSrcweir Convert( xSheet, xNumberFormats, "DM", "EUR", 1.95583f ); 121cdf0e10cSrcweir System.out.println( "Change the number format to EUR and divide the values with the factor 1.95583" ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir // remove all locks, the user see all changes 124cdf0e10cSrcweir xActionInterface.removeActionLock(); 125cdf0e10cSrcweir 126cdf0e10cSrcweir System.out.println("done"); 127cdf0e10cSrcweir System.exit(0); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir Convert( XSpreadsheet xSheet, XNumberFormats xNumberFormats, String sOldSymbol, String sNewSymbol, float fFactor )131cdf0e10cSrcweir public static void Convert( XSpreadsheet xSheet, XNumberFormats xNumberFormats, 132cdf0e10cSrcweir String sOldSymbol, String sNewSymbol, 133cdf0e10cSrcweir float fFactor ) { 134cdf0e10cSrcweir try { 135cdf0e10cSrcweir Locale xLanguage = new Locale(); 136cdf0e10cSrcweir xLanguage.Country = "de"; // Germany -> DM 137cdf0e10cSrcweir xLanguage.Language = "de"; // German 138cdf0e10cSrcweir 139cdf0e10cSrcweir // Numberformat string with sNewSymbol 140cdf0e10cSrcweir String sSimple = "0 [$" + sNewSymbol + "]"; 141cdf0e10cSrcweir // create a number format key with the sNewSymbol 142cdf0e10cSrcweir int iSimpleKey = NumberFormat( xNumberFormats, sSimple, xLanguage ); 143cdf0e10cSrcweir 144cdf0e10cSrcweir // you have to use the FormatSupplier interface to get the 145cdf0e10cSrcweir // CellFormat enumeration 146cdf0e10cSrcweir XCellFormatRangesSupplier xCellFormatSupplier = 147cdf0e10cSrcweir (XCellFormatRangesSupplier)UnoRuntime.queryInterface( 148cdf0e10cSrcweir XCellFormatRangesSupplier.class, xSheet ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir // getCellFormatRanges() has the interfaces for the enumeration 151cdf0e10cSrcweir XEnumerationAccess xEnumerationAccess = 152cdf0e10cSrcweir (XEnumerationAccess)UnoRuntime.queryInterface( 153cdf0e10cSrcweir XEnumerationAccess.class, 154cdf0e10cSrcweir xCellFormatSupplier.getCellFormatRanges() ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir XEnumeration xRanges = xEnumerationAccess.createEnumeration(); 157cdf0e10cSrcweir 158cdf0e10cSrcweir // create an AnyConverter for later use 159cdf0e10cSrcweir AnyConverter aAnyConv = new AnyConverter(); 160cdf0e10cSrcweir 161cdf0e10cSrcweir while( xRanges.hasMoreElements() ) { 162cdf0e10cSrcweir // the enumeration returns a cellrange 163cdf0e10cSrcweir XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface( 164cdf0e10cSrcweir XCellRange.class, xRanges.nextElement()); 165cdf0e10cSrcweir 166cdf0e10cSrcweir // the PropertySet the get and set the properties from the cellrange 167cdf0e10cSrcweir XPropertySet xCellProp = (XPropertySet)UnoRuntime.queryInterface( 168cdf0e10cSrcweir XPropertySet.class, xCellRange ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir // getPropertyValue returns an Object, you have to cast it to 171cdf0e10cSrcweir // type that you need 172cdf0e10cSrcweir Object oNumberObject = xCellProp.getPropertyValue( "NumberFormat" ); 173cdf0e10cSrcweir int iNumberFormat = aAnyConv.toInt(oNumberObject); 174cdf0e10cSrcweir 175cdf0e10cSrcweir // get the properties from the cellrange numberformat 176cdf0e10cSrcweir XPropertySet xFormat = (XPropertySet) 177cdf0e10cSrcweir xNumberFormats.getByKey(iNumberFormat ); 178cdf0e10cSrcweir 179cdf0e10cSrcweir short fType = aAnyConv.toShort(xFormat.getPropertyValue("Type")); 180cdf0e10cSrcweir String sCurrencySymbol = aAnyConv.toString( 181cdf0e10cSrcweir xFormat.getPropertyValue("CurrencySymbol")); 182cdf0e10cSrcweir 183cdf0e10cSrcweir // change the numberformat only on cellranges with a 184cdf0e10cSrcweir // currency numberformat 185cdf0e10cSrcweir if( ( (fType & com.sun.star.util.NumberFormat.CURRENCY) > 0) && 186cdf0e10cSrcweir ( sCurrencySymbol.compareTo( sOldSymbol ) == 0 ) ) { 187cdf0e10cSrcweir boolean bThousandSep = aAnyConv.toBoolean( 188cdf0e10cSrcweir xFormat.getPropertyValue("ThousandsSeparator")); 189cdf0e10cSrcweir boolean bNegativeRed = aAnyConv.toBoolean( 190cdf0e10cSrcweir xFormat.getPropertyValue("NegativeRed")); 191cdf0e10cSrcweir short fDecimals = aAnyConv.toShort( 192cdf0e10cSrcweir xFormat.getPropertyValue("Decimals")); 193cdf0e10cSrcweir short fLeadingZeros = aAnyConv.toShort( 194cdf0e10cSrcweir xFormat.getPropertyValue("LeadingZeros")); 195cdf0e10cSrcweir Locale oLocale = (Locale) aAnyConv.toObject( 196cdf0e10cSrcweir new com.sun.star.uno.Type(Locale.class), 197cdf0e10cSrcweir xFormat.getPropertyValue("Locale")); 198cdf0e10cSrcweir 199cdf0e10cSrcweir // create a new numberformat string 200cdf0e10cSrcweir String sNew = xNumberFormats.generateFormat( iSimpleKey, 201cdf0e10cSrcweir oLocale, bThousandSep, bNegativeRed, 202cdf0e10cSrcweir fDecimals, fLeadingZeros ); 203cdf0e10cSrcweir 204cdf0e10cSrcweir // get the NumberKey from the numberformat 205cdf0e10cSrcweir int iNewNumberFormat = NumberFormat( xNumberFormats, 206cdf0e10cSrcweir sNew, oLocale ); 207cdf0e10cSrcweir 208cdf0e10cSrcweir // set the new numberformat to the cellrange DM->EUR 209cdf0e10cSrcweir xCellProp.setPropertyValue( "NumberFormat", 210cdf0e10cSrcweir new Integer( iNewNumberFormat ) ); 211cdf0e10cSrcweir 212cdf0e10cSrcweir // interate over all cells from the cellrange with an 213cdf0e10cSrcweir // content and use the DM/EUR factor 214cdf0e10cSrcweir XCellRangesQuery xCellRangesQuery = (XCellRangesQuery) 215cdf0e10cSrcweir UnoRuntime.queryInterface( 216cdf0e10cSrcweir XCellRangesQuery.class, xCellRange ); 217cdf0e10cSrcweir 218cdf0e10cSrcweir XSheetCellRanges xSheetCellRanges = 219cdf0e10cSrcweir xCellRangesQuery.queryContentCells( 220cdf0e10cSrcweir (short) com.sun.star.sheet.CellFlags.VALUE ); 221cdf0e10cSrcweir 222cdf0e10cSrcweir if( xSheetCellRanges.getCount() > 0 ) { 223cdf0e10cSrcweir XEnumerationAccess xCellEnumerationAccess = 224cdf0e10cSrcweir xSheetCellRanges.getCells(); 225cdf0e10cSrcweir XEnumeration xCellEnumeration = 226cdf0e10cSrcweir xCellEnumerationAccess.createEnumeration(); 227cdf0e10cSrcweir 228cdf0e10cSrcweir while( xCellEnumeration.hasMoreElements() ) { 229cdf0e10cSrcweir XCell xCell = (XCell) UnoRuntime.queryInterface( 230cdf0e10cSrcweir XCell.class, xCellEnumeration.nextElement()); 231cdf0e10cSrcweir xCell.setValue( (double) xCell.getValue() / fFactor ); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir } 235cdf0e10cSrcweir } 236cdf0e10cSrcweir } 237cdf0e10cSrcweir catch( Exception e) { 238cdf0e10cSrcweir e.printStackTrace(System.err); 239cdf0e10cSrcweir } 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir NumberFormat( XNumberFormats xNumberFormat, String sFormat, com.sun.star.lang.Locale xLanguage )243cdf0e10cSrcweir public static int NumberFormat( XNumberFormats xNumberFormat, String sFormat, 244cdf0e10cSrcweir com.sun.star.lang.Locale xLanguage ) { 245cdf0e10cSrcweir int nRetKey = 0; 246cdf0e10cSrcweir 247cdf0e10cSrcweir try { 248cdf0e10cSrcweir // exists the numberformat 249cdf0e10cSrcweir nRetKey = xNumberFormat.queryKey( sFormat, xLanguage, true ); 250cdf0e10cSrcweir 251cdf0e10cSrcweir // if not, create a new one 252cdf0e10cSrcweir if( nRetKey == -1 ) { 253cdf0e10cSrcweir nRetKey = xNumberFormat.addNew( sFormat, xLanguage ); 254cdf0e10cSrcweir if( nRetKey == -1 ) 255cdf0e10cSrcweir nRetKey = 0; 256cdf0e10cSrcweir } 257cdf0e10cSrcweir } 258cdf0e10cSrcweir catch( Exception e) { 259cdf0e10cSrcweir e.printStackTrace(System.err); 260cdf0e10cSrcweir } 261cdf0e10cSrcweir 262cdf0e10cSrcweir return( nRetKey ); 263cdf0e10cSrcweir } 264cdf0e10cSrcweir 265cdf0e10cSrcweir createExampleData( XSpreadsheet xSheet, XNumberFormats xNumberFormat )266cdf0e10cSrcweir public static void createExampleData( XSpreadsheet xSheet, 267cdf0e10cSrcweir XNumberFormats xNumberFormat ) { 268cdf0e10cSrcweir 269cdf0e10cSrcweir // enter in a cellrange numbers and change the numberformat to DM 270cdf0e10cSrcweir XCell xCell = null; 271cdf0e10cSrcweir XCellRange xCellRange = null; 272cdf0e10cSrcweir 273cdf0e10cSrcweir try { 274cdf0e10cSrcweir Locale xLanguage = new Locale(); 275cdf0e10cSrcweir xLanguage.Country = "de"; // Germany -> DM 276cdf0e10cSrcweir xLanguage.Language = "de"; // German 277cdf0e10cSrcweir 278cdf0e10cSrcweir // Numberformat string from DM 279cdf0e10cSrcweir String sSimple = "0 [$DM]"; 280cdf0e10cSrcweir 281cdf0e10cSrcweir // get the numberformat key 282cdf0e10cSrcweir int iNumberFormatKey = NumberFormat(xNumberFormat, sSimple, xLanguage); 283cdf0e10cSrcweir 284cdf0e10cSrcweir for( int iCounter=1; iCounter < 10; iCounter++ ) { 285cdf0e10cSrcweir // get one cell and insert a number 286cdf0e10cSrcweir xCell = xSheet.getCellByPosition( 2, 1 + iCounter ); 287cdf0e10cSrcweir xCell.setValue( (double) iCounter * 2 ); 288cdf0e10cSrcweir xCellRange = xSheet.getCellRangeByPosition( 2, 1 + iCounter, 289cdf0e10cSrcweir 2, 1 + iCounter ); 290cdf0e10cSrcweir 291*d0f02d50Smseidel // get the PropertySet from the cell, to change the numberformat 292cdf0e10cSrcweir XPropertySet xCellProp = (XPropertySet)UnoRuntime.queryInterface( 293cdf0e10cSrcweir XPropertySet.class, xCellRange ); 294cdf0e10cSrcweir xCellProp.setPropertyValue( "NumberFormat", 295cdf0e10cSrcweir new Integer(iNumberFormatKey) ); 296cdf0e10cSrcweir } 297cdf0e10cSrcweir } 298cdf0e10cSrcweir catch( Exception e) { 299cdf0e10cSrcweir e.printStackTrace(System.err); 300cdf0e10cSrcweir } 301cdf0e10cSrcweir } 302cdf0e10cSrcweir getDesktop()303cdf0e10cSrcweir public static XDesktop getDesktop() { 304cdf0e10cSrcweir XDesktop xDesktop = null; 305cdf0e10cSrcweir XMultiComponentFactory xMCF = null; 306cdf0e10cSrcweir 307cdf0e10cSrcweir try { 308cdf0e10cSrcweir XComponentContext xContext = null; 309cdf0e10cSrcweir 310cdf0e10cSrcweir // get the remote office component context 311cdf0e10cSrcweir xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); 312cdf0e10cSrcweir 313cdf0e10cSrcweir // get the remote office service manager 314cdf0e10cSrcweir xMCF = xContext.getServiceManager(); 315cdf0e10cSrcweir if( xMCF != null ) { 316cdf0e10cSrcweir System.out.println("Connected to a running office ..."); 317cdf0e10cSrcweir 318cdf0e10cSrcweir Object oDesktop = xMCF.createInstanceWithContext( 319cdf0e10cSrcweir "com.sun.star.frame.Desktop", xContext); 320cdf0e10cSrcweir xDesktop = (XDesktop) UnoRuntime.queryInterface( 321cdf0e10cSrcweir XDesktop.class, oDesktop); 322cdf0e10cSrcweir } 323cdf0e10cSrcweir else 324cdf0e10cSrcweir System.out.println( "Can't create a desktop. No connection, no remote servicemanager available!" ); 325cdf0e10cSrcweir } 326cdf0e10cSrcweir catch( Exception e) { 327cdf0e10cSrcweir e.printStackTrace(System.err); 328cdf0e10cSrcweir System.exit(1); 329cdf0e10cSrcweir } 330cdf0e10cSrcweir 331cdf0e10cSrcweir 332cdf0e10cSrcweir return xDesktop; 333cdf0e10cSrcweir } 334cdf0e10cSrcweir 335cdf0e10cSrcweir createSheetdocument( XDesktop xDesktop )336cdf0e10cSrcweir public static XSpreadsheetDocument createSheetdocument( XDesktop xDesktop ) { 337cdf0e10cSrcweir XSpreadsheetDocument aSheetDocument = null; 338cdf0e10cSrcweir 339cdf0e10cSrcweir try { 340cdf0e10cSrcweir XComponent xComponent = null; 341cdf0e10cSrcweir xComponent = CreateNewDocument( xDesktop, "scalc" ); 342cdf0e10cSrcweir 343cdf0e10cSrcweir aSheetDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface( 344cdf0e10cSrcweir XSpreadsheetDocument.class, xComponent); 345cdf0e10cSrcweir } 346cdf0e10cSrcweir catch( Exception e) { 347cdf0e10cSrcweir e.printStackTrace(System.err); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir return aSheetDocument; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir CreateNewDocument( XDesktop xDesktop, String sDocumentType )353cdf0e10cSrcweir protected static XComponent CreateNewDocument( XDesktop xDesktop, 354cdf0e10cSrcweir String sDocumentType ) { 355cdf0e10cSrcweir String sURL = "private:factory/" + sDocumentType; 356cdf0e10cSrcweir 357cdf0e10cSrcweir XComponent xComponent = null; 358cdf0e10cSrcweir XComponentLoader xComponentLoader = null; 359cdf0e10cSrcweir PropertyValue xValues[] = new PropertyValue[1]; 360cdf0e10cSrcweir PropertyValue xEmptyArgs[] = new PropertyValue[0]; 361cdf0e10cSrcweir 362cdf0e10cSrcweir try { 363cdf0e10cSrcweir xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface( 364cdf0e10cSrcweir XComponentLoader.class, xDesktop ); 365cdf0e10cSrcweir 366cdf0e10cSrcweir xComponent = xComponentLoader.loadComponentFromURL( 367cdf0e10cSrcweir sURL, "_blank", 0, xEmptyArgs); 368cdf0e10cSrcweir } 369cdf0e10cSrcweir catch( Exception e) { 370cdf0e10cSrcweir e.printStackTrace(System.err); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir return xComponent ; 374cdf0e10cSrcweir } 375cdf0e10cSrcweir 376cdf0e10cSrcweir } 377