1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 /* 23 * CellBinding.java 24 * 25 * Created on 12. Mai 2004, 15:15 26 */ 27 28 package integration.forms; 29 30 import com.sun.star.uno.*; 31 import com.sun.star.util.*; 32 import com.sun.star.lang.*; 33 import com.sun.star.beans.*; 34 import com.sun.star.form.binding.*; 35 import com.sun.star.accessibility.*; 36 import com.sun.star.awt.XListBox; 37 import com.sun.star.table.CellAddress; 38 import com.sun.star.table.XCell; 39 import com.sun.star.sheet.XCellRangeData; 40 import com.sun.star.sheet.XCellRangeFormula; 41 import com.sun.star.table.CellRangeAddress; 42 import com.sun.star.text.XTextRange; 43 44 /** 45 * 46 * @author fs93730 47 */ 48 public class CellBinding extends complexlib.ComplexTestCase 49 { 50 /** the test document our form layer lives in */ 51 private SpreadsheetDocument m_document; 52 /** our form layer */ 53 private FormLayer m_formLayer; 54 /** our service factory */ 55 private XMultiServiceFactory m_orb; 56 57 /** Creates a new instance of CellBinding */ 58 public CellBinding() 59 { 60 } 61 62 public String[] getTestMethodNames() 63 { 64 return new String[] { 65 "checkTextFieldBinding", 66 "checkBooleanRadioBinding", 67 "checkStringRadioBinding", 68 "checkBooleanCheckBoxBinding", 69 "checkStringCheckBoxBinding", 70 "checkListBoxBinding", 71 "checkListBoxIndexBinding" 72 }; 73 } 74 75 public String getTestObjectName() 76 { 77 return "Form Control Spreadsheet Cell Binding Test"; 78 } 79 80 /* ------------------------------------------------------------------ */ 81 /** closes our document, if we have an open one 82 */ 83 private void closeDocument() 84 { 85 try 86 { 87 // close our document 88 if ( m_document != null ) 89 { 90 XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, 91 m_document.getDocument() ); 92 closeDoc.close( true ); 93 } 94 } 95 catch ( com.sun.star.uno.Exception e ) 96 { 97 } 98 } 99 100 /* ------------------------------------------------------------------ */ 101 public void before() throws com.sun.star.uno.Exception, java.lang.Exception 102 { 103 m_orb = (XMultiServiceFactory)param.getMSF(); 104 m_document = new SpreadsheetDocument( m_orb ); 105 m_formLayer = new FormLayer( m_document ); 106 } 107 108 /* ------------------------------------------------------------------ */ 109 public void after() throws com.sun.star.uno.Exception, java.lang.Exception 110 { 111 closeDocument(); 112 } 113 114 /* ------------------------------------------------------------------ */ 115 public void checkTextFieldBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception 116 { 117 final short col = 0; 118 final short row = 2; 119 final String text = new String( "content" ); 120 final String otherText = new String( "something else" ); 121 final String yetAnotherText = new String( "yet another text" ); 122 123 // cretae a normal text control 124 XPropertySet controlModel = m_formLayer.createControlAndShape( "DatabaseTextField", 30, 9, 30, 6 ); 125 126 // bind it to cell A1 127 bindToCell( controlModel, col, row ); 128 129 // switch to alive mode 130 m_document.getCurrentView().toggleFormDesignMode(); 131 132 // test the data transfer control -> cell 133 simulateUserTextInput( controlModel, text ); 134 verifyStringCellContent( col, row, text, "A text field does not forward its user input to the cell." ); 135 136 // the same, but this time changing the control value programmatically 137 controlModel.setPropertyValue( "Text", otherText ); 138 verifyStringCellContent( col, row, otherText, "A text field does not forward programmatic changes to the cell." ); 139 140 // the other way round: cell->control 141 setCellText( col, row, yetAnotherText ); 142 String controlText = (String)controlModel.getPropertyValue( "Text" ); 143 if ( !controlText.equals( yetAnotherText ) ) 144 failed( "Changes in the cell are not forwarded to the text field." ); 145 } 146 /* ------------------------------------------------------------------ */ 147 public void checkBooleanRadioBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception 148 { 149 // two radio buttons 150 XPropertySet primaryRadio = createRadio( 28, "radio button no. 1", "radio group", "primary" ); 151 XPropertySet secondaryRadio = createRadio( 33, "radio button no. 2", "radio group", "secodary" ); 152 153 // bind them 154 short col = (short)0; 155 short row1 = (short)6; 156 short row2 = (short)7; 157 bindToCell( primaryRadio, col, row1 ); 158 bindToCell( secondaryRadio, col, row2 ); 159 160 // check the first button 161 simulateUserRadioCheck( primaryRadio ); 162 // check the cell content 163 verifyNumericCellContent( col, row1, 1, "Radio buttons do not forward their (boolean) values to cells (1)." ); 164 verifyNumericCellContent( col, row2, 0, "Radio buttons do not forward their (boolean) values to cells (2)." ); 165 // check the second button 166 simulateUserRadioCheck( secondaryRadio ); 167 // check the cell content 168 verifyNumericCellContent( col, row1, 0, "Radio buttons do not forward their (boolean) values to cells (3)." ); 169 verifyNumericCellContent( col, row2, 1, "Radio buttons do not forward their (boolean) values to cells (4)." ); 170 171 // the other way round: writing values into the cell 172 setCellValue( col, row1, 1.0 ); 173 // setting this should have checked the primary radio, which should have unchecked the secondary radio, 174 // which should have been propagated to the second cell 175 verifyNumericCellContent( col, row2, 0, "Changing primary cell is not propagated to the secondary cell (via the radio buttons)." ); 176 177 // setting an empty cell should result in the radio being unchecked 178 setCellEmpty( col, row1 ); 179 if ( ((Short)primaryRadio.getPropertyValue( "State" )).shortValue() != 0 ) 180 failed( "Setting a cell to 'empty' does not reset the bound radio button." ); 181 } 182 183 /* ------------------------------------------------------------------ */ 184 public void checkStringRadioBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception 185 { 186 // two radio buttons 187 XPropertySet primaryRadio = createRadio( 46, "radio button A", "radio ref group", "primary" ); 188 XPropertySet secondaryRadio = createRadio( 51, "radio button B", "radio ref group", "secodary" ); 189 190 // give the ref values 191 String refValueA = new String( "ref value A" ); 192 String refValueB = new String( "ref value B" ); 193 primaryRadio.setPropertyValue( "RefValue", refValueA ); 194 secondaryRadio.setPropertyValue( "RefValue", refValueB ); 195 196 // bind them to the same cell 197 short col = (short)0; 198 short row = (short)10; 199 bindToCell( primaryRadio, col, row ); 200 bindToCell( secondaryRadio, col, row ); 201 202 // checking a radio should set the respective ref value at the cell 203 simulateUserRadioCheck( primaryRadio ); 204 verifyStringCellContent( col, row, refValueA, "A bound radio button with a reference value does not pass this value to the cell upon checking (1)." ); 205 simulateUserRadioCheck( secondaryRadio ); 206 verifyStringCellContent( col, row, refValueB, "A bound radio button with a reference value does not pass this value to the cell upon checking (2)." ); 207 208 // changing the cell should check the buttons if the cell text equals the ref value 209 setCellText( col, row, "no ref value" ); 210 verifyRadioStates( primaryRadio, secondaryRadio, (short)0, (short)0, "Radio button not unchecked, though the bound cell value does not equal ref value." ); 211 212 setCellText( col, row, refValueA ); 213 verifyRadioStates( primaryRadio, secondaryRadio, (short)1, (short)0, "Radio button not properly un/checked according to the cell and ref value (1)." ); 214 215 setCellText( col, row, refValueB ); 216 verifyRadioStates( primaryRadio, secondaryRadio, (short)0, (short)1, "Radio button not properly un/checked according to the cell and ref value (2)." ); 217 } 218 219 /* ------------------------------------------------------------------ */ 220 public void checkBooleanCheckBoxBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception 221 { 222 XPropertySet checkBox = m_formLayer.createControlAndShape( "DatabaseCheckBox", 30, 59, 40, 4 ); 223 checkBox.setPropertyValue( "Label", "check box" ); 224 checkBox.setPropertyValue( "TriState", new Boolean( true ) ); 225 226 short col = (short)0; 227 short row = (short)13; 228 bindToCell( checkBox, col, row ); 229 230 // initialize with "not checked" 231 checkBox.setPropertyValue( "State", new Short( (short)0 ) ); 232 verifyNumericCellContent( col, row, 0, "programmatically unchecking the check box is not propagated to the cell." ); 233 234 // first click: "not checked" -> "checked" 235 simulateUserCheckBoxCheck( checkBox, (short)1 ); 236 verifyNumericCellContent( col, row, 1, "moving the check box state to 'checked' is not propagated to the cell." ); 237 238 // second click: "checked" -> "indetermined" 239 simulateUserCheckBoxCheck( checkBox, (short)2 ); 240 verifyVoidCell( col, row, "propagating the 'indetermined' state to the cell does not work." ); 241 242 // third click: "indetermined" -> "not checked" 243 simulateUserCheckBoxCheck( checkBox, (short)0 ); 244 verifyNumericCellContent( col, row, 0, "unchecking a check box via UI is not propagated to the cell." ); 245 } 246 247 /* ------------------------------------------------------------------ */ 248 public void checkStringCheckBoxBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception 249 { 250 String refValue = new String( "checked " ); 251 252 XPropertySet checkBox = m_formLayer.createControlAndShape( "DatabaseCheckBox", 30, 68, 40, 4 ); 253 checkBox.setPropertyValue( "Label", "check box with ref value" ); 254 checkBox.setPropertyValue( "TriState", new Boolean( true ) ); 255 checkBox.setPropertyValue( "RefValue", refValue ); 256 257 short col = (short)0; 258 short row = (short)15; 259 bindToCell( checkBox, col, row ); 260 261 // initialize with "not checked" 262 checkBox.setPropertyValue( "State", new Short( (short)0 ) ); 263 verifyNumericCellContent( col, row, 0, "programmatically unchecking the check box is not propagated to the cell." ); 264 265 // first click: "not checked" -> "checked" 266 simulateUserCheckBoxCheck( checkBox, (short)1 ); 267 verifyStringCellContent( col, row, refValue, "moving the check box state to 'checked' does not propagated the ref value to the cell." ); 268 269 // second click: "checked" -> "indetermined" 270 simulateUserCheckBoxCheck( checkBox, (short)2 ); 271 verifyVoidCell( col, row, "propagating the 'indetermined' state to the cell does not work, when exchanging ref values." ); 272 273 // third click: "indetermined" -> "not checked" 274 simulateUserCheckBoxCheck( checkBox, (short)0 ); 275 verifyStringCellContent( col, row, "", "unchecking a check box via UI does not propagated the ref value to the cell." ); 276 } 277 278 /* ------------------------------------------------------------------ */ 279 /** verifies that a list box, which is bound via an ordinary value binding, 280 * works as expected 281 */ 282 public void checkListBoxBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception 283 { 284 XPropertySet listBox = m_formLayer.createControlAndShape( "DatabaseListBox", 30, 80, 40, 6 ); 285 listBox.setPropertyValue( "Dropdown", new Boolean( true ) ); 286 listBox.setPropertyValue( "StringItemList", new String[] { "Apples", "Oranges", "Peaches" } ); 287 288 short col = (short)0; 289 short row = (short)18; 290 291 // ............................................................... 292 // add a list entry source which fills the list boxes list from cells in the 293 // spreadsheet 294 short sourceCol = (short)4; 295 setCellText( sourceCol, (short)( row - 1 ), "Apples" ); 296 setCellText( sourceCol, (short)( row + 0 ), "Oranges" ); 297 setCellText( sourceCol, (short)( row + 1 ), "Peaches" ); 298 299 //setListSource( listBox, sourceCol, row, (short)( row + 2 ) ); 300 // TODO: this is currently prone to deadlocks 301 302 // ............................................................... 303 // bind to a cell 304 bindToCell( listBox, col, row ); 305 306 // ............................................................... 307 // do the tests 308 listBox.setPropertyValue( "SelectedItems", new short[] { (short)0 } ); 309 verifyStringCellContent( col, row, "Apples", "programmatically selecting a list entry is not propagated to the cell." ); 310 311 simulateUserListBoxSelection( listBox, "Oranges" ); 312 verifyStringCellContent( col, row, "Oranges", "UI-selecting a list entry is not propagated to the cell." ); 313 314 setCellText( col, row, "Peaches" ); 315 short[] selectedItems = (short[])listBox.getPropertyValue( "SelectedItems" ); 316 assureEquals( "changes in the cell bound to a list box are not propagated to the list box selection", 317 2, selectedItems[0] ); 318 } 319 320 /* ------------------------------------------------------------------ */ 321 /** verifies that a list box, which is bound via a value binding exchanging the <b>index</b> 322 * of the selected entry, works as expected 323 */ 324 public void checkListBoxIndexBinding() throws com.sun.star.uno.Exception, java.lang.Exception 325 { 326 XPropertySet listBox = m_formLayer.createControlAndShape( "DatabaseListBox", 30, 94, 40, 6 ); 327 listBox.setPropertyValue( "Dropdown", new Boolean( true ) ); 328 listBox.setPropertyValue( "StringItemList", new String[] { "Pears", "Bananas", "Strawberries" } ); 329 330 short col = (short)0; 331 short row = (short)21; 332 333 // ............................................................... 334 // add a list entry source which fills the list boxes list from cells in the 335 // spreadsheet 336 short sourceCol = (short)4; 337 setCellText( sourceCol, (short)( row - 1 ), "Pears" ); 338 setCellText( sourceCol, (short)( row + 0 ), "Bananas" ); 339 setCellText( sourceCol, (short)( row + 1 ), "Strawberries" ); 340 341 //setListSource( listBox, sourceCol, row, (short)( row + 2 ) ); 342 // TODO: this is currently prone to deadlocks 343 344 // ............................................................... 345 // bind to a cell 346 bindToCell( listBox, col, row, "com.sun.star.table.ListPositionCellBinding" ); 347 348 // ............................................................... 349 // do the tests 350 listBox.setPropertyValue( "SelectedItems", new short[] { (short)0 } ); 351 verifyNumericCellContent( col, row, 1, "programmatically selecting a list entry is not propagated (as index) to the cell." ); 352 353 simulateUserListBoxSelection( listBox, "Bananas" ); 354 verifyNumericCellContent( col, row, 2, "UI-selecting a list entry is not propagated (as index) to the cell." ); 355 356 setCellValue( col, row, 3 ); 357 short[] selectedItems = (short[])listBox.getPropertyValue( "SelectedItems" ); 358 assureEquals( "changes in the cell bound to a list box via list index are not propagated to the list box selection", 359 2, selectedItems[0] ); 360 } 361 362 /* ------------------------------------------------------------------ */ 363 /** verifies that the content of a given cell equals a given string 364 */ 365 private XPropertySet createRadio( int yPos, String label, String name, String tag ) throws com.sun.star.uno.Exception, java.lang.Exception 366 { 367 XPropertySet radio = m_formLayer.createControlAndShape( "DatabaseRadioButton", 30, yPos, 40, 4 ); 368 radio.setPropertyValue( "Label", label ); 369 radio.setPropertyValue( "Name", name ); 370 radio.setPropertyValue( "Tag", tag ); 371 return radio; 372 } 373 374 /* ------------------------------------------------------------------ */ 375 /** verifies the states of two radio button 376 */ 377 private boolean verifyRadioStates( XPropertySet radio1, XPropertySet radio2, short value1, short value2, 378 String errorMessage ) throws com.sun.star.uno.Exception, java.lang.Exception 379 { 380 if ( ( ((Short)radio1.getPropertyValue( "State" )).shortValue() != value1 ) 381 || ( ((Short)radio2.getPropertyValue( "State" )).shortValue() != value2 ) 382 ) 383 { 384 failed( errorMessage ); 385 return false; 386 } 387 return true; 388 } 389 390 /* ------------------------------------------------------------------ */ 391 /** verifies that the content of a given cell equals a given string 392 */ 393 private boolean verifyVoidCell( short col, short row, String failErrorMessage ) throws com.sun.star.uno.Exception 394 { 395 XCellRangeData cell = (XCellRangeData)UnoRuntime.queryInterface( XCellRangeData.class, 396 m_document.getSheet( 0 ).getCellByPosition( col, row ) 397 ); 398 Object cellContent = cell.getDataArray()[0][0]; 399 if ( ((com.sun.star.uno.Any)cellContent).getType().getTypeClass() != com.sun.star.uno.TypeClass.VOID ) 400 { 401 failed( failErrorMessage ); 402 return false; 403 } 404 return true; 405 } 406 407 /* ------------------------------------------------------------------ */ 408 /** verifies that the content of a given cell equals a given string 409 */ 410 private boolean verifyNumericCellContent( short col, short row, double value, String failErrorMessage ) throws com.sun.star.uno.Exception 411 { 412 XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class, 413 m_document.getSheet( 0 ).getCellByPosition( col, row ) 414 ); 415 if ( cell.getValue() != value ) 416 { 417 failed( failErrorMessage ); 418 return false; 419 } 420 return true; 421 } 422 423 /* ------------------------------------------------------------------ */ 424 /** verifies that the content of a given cell equals a given string 425 */ 426 private boolean verifyStringCellContent( short col, short row, String text, String failErrorMessage ) throws com.sun.star.uno.Exception 427 { 428 XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, 429 m_document.getSheet( 0 ).getCellByPosition( col, row ) 430 ); 431 if ( !cell.getString().equals( text ) ) 432 { 433 failed( failErrorMessage ); 434 return false; 435 } 436 return true; 437 } 438 439 /* ------------------------------------------------------------------ */ 440 /** sets the text of a given cell to a given string 441 */ 442 private void setCellText( short col, short row, String text ) throws com.sun.star.uno.Exception 443 { 444 XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, 445 m_document.getSheet( 0 ).getCellByPosition( col, row ) 446 ); 447 cell.setString( text ); 448 } 449 450 /* ------------------------------------------------------------------ */ 451 /** sets a numeric value in a given cell 452 */ 453 private void setCellValue( short col, short row, double value ) throws com.sun.star.uno.Exception 454 { 455 XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class, 456 m_document.getSheet( 0 ).getCellByPosition( col, row ) 457 ); 458 cell.setValue( value ); 459 } 460 461 /* ------------------------------------------------------------------ */ 462 /** sets a numeric value in a given cell 463 */ 464 private void setCellEmpty( short col, short row ) throws com.sun.star.uno.Exception 465 { 466 // as long as #i29130# is not fixed, we do not set the cell to "empty", but to 467 // an invalid formular, which serves well for our purpose 468 XCellRangeFormula cell = (XCellRangeFormula)UnoRuntime.queryInterface( XCellRangeFormula.class, 469 m_document.getSheet( 0 ).getCellByPosition( col, row ) 470 ); 471 String[][] args = new String[][] { new String[] { "=INVALID_FUNCTION()" } }; 472 cell.setFormulaArray( args ); 473 } 474 475 /* ------------------------------------------------------------------ */ 476 /** binds the given control model to the given cell in the first sheet, 477 * using the given service name for the binding 478 */ 479 private void bindToCell( XPropertySet controlModel, short column, short row, String _bindingServiceName ) throws com.sun.star.uno.Exception 480 { 481 XBindableValue bindableModel = (XBindableValue)UnoRuntime.queryInterface( XBindableValue.class, 482 controlModel 483 ); 484 485 CellAddress address = new CellAddress(); 486 address.Column = column; 487 address.Row = row; 488 address.Sheet = 0; 489 490 NamedValue[] parameters = new NamedValue[] { new NamedValue() }; 491 parameters[0].Name = "BoundCell"; 492 parameters[0].Value = address; 493 494 XValueBinding cellBinding = (XValueBinding)UnoRuntime.queryInterface( XValueBinding.class, 495 m_document.createInstanceWithArguments( _bindingServiceName, parameters ) 496 ); 497 498 bindableModel.setValueBinding( cellBinding ); 499 } 500 501 /* ------------------------------------------------------------------ */ 502 /** binds the given control model to the given cell in the first sheet 503 */ 504 private void bindToCell( XPropertySet _controlModel, short _column, short _row ) throws com.sun.star.uno.Exception 505 { 506 bindToCell( _controlModel, _column, _row, "com.sun.star.table.CellValueBinding" ); 507 } 508 509 /* ------------------------------------------------------------------ */ 510 /** sets the given cell range as list entry source for the given control 511 */ 512 private void setListSource( XPropertySet _listSink, short _sourceCol, short _rowStart, short _rowEnd ) throws com.sun.star.uno.Exception 513 { 514 CellRangeAddress listSourceAddress = new CellRangeAddress( (short)0, (int)_sourceCol, (int)_rowStart, (int)_sourceCol, (int)_rowEnd ); 515 NamedValue addressParameter = new NamedValue( "CellRange", listSourceAddress ); 516 517 XListEntrySource listSource = (XListEntrySource)UnoRuntime.queryInterface( XListEntrySource.class, 518 m_document.createInstanceWithArguments( "com.sun.star.table.CellRangeListSource", new NamedValue[]{ addressParameter } ) 519 ); 520 XListEntrySink listSink = (XListEntrySink)UnoRuntime.queryInterface( XListEntrySink.class, 521 _listSink ); 522 listSink.setListEntrySource( listSource ); 523 } 524 525 /* ------------------------------------------------------------------ */ 526 /** simulates a user action to check a radio button 527 */ 528 private void simulateUserRadioCheck( XPropertySet radioModel ) throws com.sun.star.uno.Exception 529 { 530 XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( 531 XAccessible.class, m_document.getCurrentView().getControl( radioModel ) ); 532 533 XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface( 534 XAccessibleValue.class, accessible.getAccessibleContext() ); 535 536 Integer newValue = new Integer( 1 ); 537 xValue.setCurrentValue( newValue ); 538 } 539 540 /* ------------------------------------------------------------------ */ 541 /** simulates a user action to check a radio button 542 */ 543 private void simulateUserCheckBoxCheck( XPropertySet checkBox, short state ) throws com.sun.star.uno.Exception 544 { 545 XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( 546 XAccessible.class, m_document.getCurrentView().getControl( checkBox ) ); 547 548 XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface( 549 XAccessibleValue.class, accessible.getAccessibleContext() ); 550 551 xValue.setCurrentValue( new Short( state ) ); 552 } 553 554 /* ------------------------------------------------------------------ */ 555 /** simulates a user selecting an entry in a list box 556 */ 557 private void simulateUserListBoxSelection( XPropertySet _listBox, String _selectEntry ) throws com.sun.star.uno.Exception 558 { 559 XListBox listBoxControl = (XListBox)UnoRuntime.queryInterface( 560 XListBox.class, m_document.getCurrentView().getControl( _listBox ) ); 561 listBoxControl.selectItem( _selectEntry, true ); 562 } 563 564 /* ------------------------------------------------------------------ */ 565 /** simulates text input into the control belonging to the given model 566 */ 567 private void simulateUserTextInput( XPropertySet controlModel, String text ) throws com.sun.star.uno.Exception 568 { 569 XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( 570 XAccessible.class, m_document.getCurrentView().getControl( controlModel ) ); 571 572 XAccessibleContext context = accessible.getAccessibleContext(); 573 XServiceInfo si = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, 574 accessible.getAccessibleContext() ); 575 576 XAccessibleEditableText textAccess = (XAccessibleEditableText)UnoRuntime.queryInterface( 577 XAccessibleEditableText.class, accessible.getAccessibleContext() ); 578 579 textAccess.setText( text ); 580 } 581 } 582