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 package com.sun.star.wizards.ui; 24 25 import com.sun.star.awt.*; 26 import com.sun.star.awt.XReschedule; 27 import com.sun.star.beans.Property; 28 import com.sun.star.beans.XMultiPropertySet; 29 30 import com.sun.star.beans.XPropertySet; 31 import com.sun.star.container.XNameAccess; 32 import com.sun.star.container.XNameContainer; 33 import com.sun.star.lang.*; 34 import com.sun.star.frame.XFrame; 35 import com.sun.star.lang.IllegalArgumentException; 36 import com.sun.star.lang.XComponent; 37 import com.sun.star.lang.XMultiServiceFactory; 38 import com.sun.star.uno.*; 39 import com.sun.star.wizards.common.*; 40 import com.sun.star.wizards.common.Desktop; 41 import com.sun.star.wizards.common.Helper; 42 import com.sun.star.wizards.ui.event.*; 43 44 import java.util.Hashtable; 45 46 public class UnoDialog implements EventNames 47 { 48 49 public XMultiServiceFactory xMSF; 50 public XMultiServiceFactory MSFDialogModel; 51 public XNameContainer xDlgNames; 52 public XControlContainer xDlgContainer; 53 private XNameAccess m_xDlgNameAccess; 54 public XControl xControl; 55 public XDialog xDialog; 56 public XReschedule xReschedule; 57 public XWindow xWindow; 58 public XComponent xComponent; 59 public XInterface xDialogModel; 60 public XInterface xUnoDialog; 61 public XPropertySet xPSetDlg; 62 public XVclWindowPeer xVclWindowPeer; 63 public Hashtable ControlList; 64 public Resource m_oResource; 65 public XWindowPeer xWindowPeer = null; 66 private PeerConfig m_oPeerConfig; 67 protected AbstractListener guiEventListener; 68 getGuiEventListener()69 public AbstractListener getGuiEventListener() 70 { 71 return guiEventListener; 72 } 73 UnoDialog(XMultiServiceFactory xMSF, String[] PropertyNames, Object[] PropertyValues)74 public UnoDialog(XMultiServiceFactory xMSF, String[] PropertyNames, Object[] PropertyValues) 75 { 76 try 77 { 78 this.xMSF = xMSF; 79 ControlList = new Hashtable(); 80 xDialogModel = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialogModel"); 81 XMultiPropertySet xMultiPSetDlg = UnoRuntime.queryInterface(XMultiPropertySet.class, xDialogModel); 82 xMultiPSetDlg.setPropertyValues(PropertyNames, PropertyValues); 83 MSFDialogModel = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDialogModel); 84 xUnoDialog = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialog"); 85 xControl = UnoRuntime.queryInterface(XControl.class, xUnoDialog); 86 XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, xDialogModel); 87 xControl.setModel(xControlModel); 88 xPSetDlg = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel); 89 xDlgContainer = UnoRuntime.queryInterface(XControlContainer.class, xUnoDialog); 90 xDlgNames = UnoRuntime.queryInterface(XNameContainer.class, xDialogModel); 91 // xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); 92 xComponent = UnoRuntime.queryInterface(XComponent.class, xUnoDialog); 93 xWindow = UnoRuntime.queryInterface(XWindow.class, xUnoDialog); 94 95 // setPeerConfiguration(); // LLA: will be done, if really used! 96 } 97 catch (com.sun.star.uno.Exception exception) 98 { 99 exception.printStackTrace(System.out); 100 } 101 } 102 getControlKey(Object EventObject, Hashtable ControlList)103 public int getControlKey(Object EventObject, Hashtable ControlList) 104 { 105 int iKey; 106 XControl xContrl = UnoRuntime.queryInterface(XControl.class, EventObject); 107 XControlModel xControlModel = xContrl.getModel(); 108 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); 109 try 110 { 111 String sName = (String) xPSet.getPropertyValue(PropertyNames.PROPERTY_NAME); 112 Integer KeyObject = (Integer) ControlList.get(sName); 113 iKey = KeyObject.intValue(); 114 } 115 catch (com.sun.star.uno.Exception exception) 116 { 117 exception.printStackTrace(System.out); 118 iKey = 2000; 119 } 120 return iKey; 121 } 122 createPeerConfiguration()123 public void createPeerConfiguration() 124 { 125 m_oPeerConfig = new PeerConfig(this); 126 } 127 getPeerConfiguration()128 public PeerConfig getPeerConfiguration() 129 { 130 if (m_oPeerConfig == null) 131 { 132 createPeerConfiguration(); 133 } 134 return m_oPeerConfig; 135 } 136 getDlgNameAccess()137 XNameAccess getDlgNameAccess() 138 { 139 if (m_xDlgNameAccess == null) 140 { 141 m_xDlgNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); 142 } 143 return m_xDlgNameAccess; 144 } setControlProperty(String ControlName, String PropertyName, Object PropertyValue)145 public void setControlProperty(String ControlName, String PropertyName, Object PropertyValue) 146 { 147 try 148 { 149 if (PropertyValue != null) 150 { 151 if (!getDlgNameAccess().hasByName(ControlName)) 152 { 153 return; 154 } 155 Object xControlModel = getDlgNameAccess().getByName(ControlName); 156 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); 157 if (AnyConverter.isArray(PropertyValue)) 158 { 159 com.sun.star.uno.Type seqType = new com.sun.star.uno.Type(PropertyValue.getClass()); 160 PropertyValue = new com.sun.star.uno.Any(seqType, PropertyValue); 161 /* PropertyValue = Helper.getArrayValue(PropertyValue); 162 if (PropertyValue == null) 163 PropertyValue = new short[]{}; 164 */ 165 } 166 xPSet.setPropertyValue(PropertyName, PropertyValue); 167 } 168 } 169 catch (com.sun.star.uno.Exception exception) 170 { 171 exception.printStackTrace(System.out); 172 } 173 } 174 getResource()175 public Resource getResource() 176 { 177 return m_oResource; 178 } 179 setControlProperties(String ControlName, String[] PropertyNames, Object[] PropertyValues)180 public void setControlProperties(String ControlName, String[] PropertyNames, Object[] PropertyValues) 181 { 182 try 183 { 184 if (PropertyValues != null) 185 { 186 if (!getDlgNameAccess().hasByName(ControlName)) 187 { 188 return; 189 } 190 Object xControlModel = getDlgNameAccess().getByName(ControlName); 191 XMultiPropertySet xMultiPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel); 192 xMultiPSet.setPropertyValues(PropertyNames, PropertyValues); 193 } 194 } 195 catch (com.sun.star.uno.Exception exception) 196 { 197 exception.printStackTrace(System.out); 198 } 199 } 200 getControlProperty(String ControlName, String PropertyName)201 public Object getControlProperty(String ControlName, String PropertyName) 202 { 203 try 204 { 205 Object xControlModel = getDlgNameAccess().getByName(ControlName); 206 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); 207 return xPSet.getPropertyValue(PropertyName); 208 } 209 catch (com.sun.star.uno.Exception exception) 210 { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException, 211 exception.printStackTrace(System.out); // com.sun.star.lang.WrappedTargetException, com.sun.star.beans.PropertyVetoException 212 return null; // com.sun.star.lang.IllegalArgumentException 213 } 214 } 215 printControlProperties(String ControlName)216 public void printControlProperties(String ControlName) 217 { 218 try 219 { 220 Object xControlModel = getDlgNameAccess().getByName(ControlName); 221 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); 222 Property[] allProps = xPSet.getPropertySetInfo().getProperties(); 223 for (int i = 0; i < allProps.length; i++) 224 { 225 String sName = allProps[i].Name; 226 System.out.println(sName); 227 } 228 } 229 catch (com.sun.star.uno.Exception exception) 230 { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException, 231 exception.printStackTrace(System.out); // com.sun.star.lang.WrappedTargetException, com.sun.star.beans.PropertyVetoException 232 } 233 } 234 getMAPConversionFactor(String ControlName)235 public double getMAPConversionFactor(String ControlName) 236 { 237 XControl xControl2 = xDlgContainer.getControl(ControlName); 238 XView xView = UnoRuntime.queryInterface(XView.class, xControl2); 239 Size aSize = xView.getSize(); 240 double dblMAPWidth = (double) (((Integer) Helper.getUnoPropertyValue(xControl2.getModel(), PropertyNames.PROPERTY_WIDTH)).intValue()); 241 return (((double) (aSize.Width)) / dblMAPWidth); 242 } 243 getpreferredLabelSize(String LabelName, String sLabel)244 public Size getpreferredLabelSize(String LabelName, String sLabel) 245 { 246 XControl xControl2 = xDlgContainer.getControl(LabelName); 247 XFixedText xFixedText = UnoRuntime.queryInterface(XFixedText.class, xControl2); 248 String OldText = xFixedText.getText(); 249 xFixedText.setText(sLabel); 250 XLayoutConstrains xLayoutConstrains = UnoRuntime.queryInterface(XLayoutConstrains.class, xControl2); 251 Size aSize = xLayoutConstrains.getPreferredSize(); 252 xFixedText.setText(OldText); 253 return aSize; 254 } 255 removeSelectedItems(XListBox xListBox)256 public void removeSelectedItems(XListBox xListBox) 257 { 258 short[] SelList = xListBox.getSelectedItemsPos(); 259 int Sellen = SelList.length; 260 for (int i = Sellen - 1; i >= 0; i--) 261 { 262 xListBox.removeItems(SelList[i], (short) 1); 263 } 264 } 265 getListBoxItemCount(XListBox _xListBox)266 public static int getListBoxItemCount(XListBox _xListBox) 267 { 268 // This function may look ugly, but this is the only way to check the count 269 // of values in the model,which is always right. 270 // the control is only a view and could be right or not. 271 final String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.STRING_ITEM_LIST); 272 return fieldnames.length; 273 } 274 getSelectedItemPos(XListBox _xListBox)275 public static short getSelectedItemPos(XListBox _xListBox) 276 { 277 short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.SELECTED_ITEMS); 278 return ipos[0]; 279 } 280 isListBoxSelected(XListBox _xListBox)281 public static boolean isListBoxSelected(XListBox _xListBox) 282 { 283 short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.SELECTED_ITEMS); 284 return ipos.length > 0; 285 } 286 addSingleItemtoListbox(XListBox xListBox, String ListItem, short iSelIndex)287 public void addSingleItemtoListbox(XListBox xListBox, String ListItem, short iSelIndex) 288 { 289 xListBox.addItem(ListItem, xListBox.getItemCount()); 290 if (iSelIndex != -1) 291 { 292 xListBox.selectItemPos(iSelIndex, true); 293 } 294 } 295 insertLabel(String sName, String[] sPropNames, Object[] oPropValues)296 public XFixedText insertLabel(String sName, String[] sPropNames, Object[] oPropValues) 297 { 298 try 299 { 300 Object oFixedText = insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", sName, sPropNames, oPropValues); 301 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oFixedText); 302 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 303 Object oLabel = xDlgContainer.getControl(sName); 304 return UnoRuntime.queryInterface(XFixedText.class, oLabel); 305 } 306 catch (java.lang.Exception ex) 307 { 308 ex.printStackTrace(); 309 return null; 310 } 311 } 312 313 /* public XButton insertButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception{ 314 Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlButtonModel", sName, sProperties, sValues); 315 XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); 316 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 317 Object objectButton = xDlgContainer.getControl( new String(sName)); 318 XButton xButton = ( XButton ) UnoRuntime.queryInterface( XButton.class, objectButton ); 319 xButton.addActionListener(xActionListener); 320 Integer ControlKey = new Integer(iControlKey); 321 if (ControlList != null) 322 ControlList.put(sName, ControlKey); 323 return xButton; 324 } */ insertButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues)325 public XButton insertButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception 326 { 327 Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlButtonModel", sName, sProperties, sValues); 328 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); 329 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 330 Object objectButton = xDlgContainer.getControl(sName); 331 XButton xButton = UnoRuntime.queryInterface(XButton.class, objectButton); 332 if (xActionListener != null) 333 { 334 xButton.addActionListener(xActionListener); 335 } 336 Integer ControlKey = new Integer(iControlKey); 337 if (ControlList != null) 338 { 339 ControlList.put(sName, ControlKey); 340 } 341 return xButton; 342 } 343 insertCheckBox(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues)344 public void insertCheckBox(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception 345 { 346 Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlCheckBoxModel", sName, sProperties, sValues); 347 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); 348 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 349 Object objectCheckBox = xDlgContainer.getControl(sName); 350 XCheckBox xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox); 351 if (xItemListener != null) 352 { 353 xCheckBox.addItemListener(xItemListener); 354 } 355 Integer ControlKey = new Integer(iControlKey); 356 if (ControlList != null) 357 { 358 ControlList.put(sName, ControlKey); 359 } 360 } 361 insertNumericField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)362 public void insertNumericField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception 363 { 364 Object oNumericFieldModel = insertControlModel("com.sun.star.awt.UnoControlNumericFieldModel", sName, sProperties, sValues); 365 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel); 366 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 367 Object objectNumericField = xDlgContainer.getControl(sName); 368 XTextComponent xNumericField = UnoRuntime.queryInterface(XTextComponent.class, objectNumericField); 369 if (xTextListener != null) 370 { 371 xNumericField.addTextListener(xTextListener); 372 } 373 Integer ControlKey = new Integer(iControlKey); 374 if (ControlList != null) 375 { 376 ControlList.put(sName, ControlKey); 377 } 378 } 379 insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues)380 public XScrollBar insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues) 381 { 382 try 383 { 384 Object oScrollModel = insertControlModel("com.sun.star.awt.UnoControlScrollBarModel", sName, sProperties, sValues); 385 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oScrollModel); 386 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 387 Object oScrollBar = xDlgContainer.getControl(sName); 388 XScrollBar xScrollBar = UnoRuntime.queryInterface(XScrollBar.class, oScrollBar); 389 if (xAdjustmentListener != null) 390 { 391 xScrollBar.addAdjustmentListener(xAdjustmentListener); 392 } 393 Integer ControlKey = new Integer(iControlKey); 394 if (ControlList != null) 395 { 396 ControlList.put(sName, ControlKey); 397 } 398 return xScrollBar; 399 } 400 catch (com.sun.star.uno.Exception exception) 401 { 402 exception.printStackTrace(System.out); 403 return null; 404 } 405 } 406 insertTextField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)407 public XTextComponent insertTextField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) 408 { 409 return insertEditField("com.sun.star.awt.UnoControlEditModel", sName, iControlKey, xTextListener, sProperties, sValues); 410 } 411 insertFormattedField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)412 public XTextComponent insertFormattedField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) 413 { 414 return insertEditField("com.sun.star.awt.UnoControlFormattedFieldModel", sName, iControlKey, xTextListener, sProperties, sValues); 415 } 416 insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)417 public XTextComponent insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) 418 { 419 try 420 { 421 XInterface xTextModel = insertControlModel(ServiceName, sName, sProperties, sValues); 422 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xTextModel); 423 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 424 XControl xTextField = xDlgContainer.getControl(sName); 425 XTextComponent xTextBox = UnoRuntime.queryInterface(XTextComponent.class, xTextField); 426 if (xTextListener != null) 427 { 428 xTextBox.addTextListener(xTextListener); 429 } 430 Integer ControlKey = new Integer(iControlKey); 431 ControlList.put(sName, ControlKey); 432 return xTextBox; 433 } 434 catch (com.sun.star.uno.Exception exception) 435 { 436 exception.printStackTrace(System.out); 437 return null; 438 } 439 } 440 insertListBox(String sName, int iControlKey, XActionListener xActionListener, XItemListener xItemListener, String[] sProperties, Object[] sValues)441 public XListBox insertListBox(String sName, int iControlKey, XActionListener xActionListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception 442 { 443 XInterface xListBoxModel = insertControlModel("com.sun.star.awt.UnoControlListBoxModel", sName, sProperties, sValues); 444 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xListBoxModel); 445 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 446 XControl xControlListBox = xDlgContainer.getControl(sName); 447 XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xControlListBox); 448 if (xItemListener != null) 449 { 450 xListBox.addItemListener(xItemListener); 451 } 452 if (xActionListener != null) 453 { 454 xListBox.addActionListener(xActionListener); 455 } 456 Integer ControlKey = new Integer(iControlKey); 457 ControlList.put(sName, ControlKey); 458 return xListBox; 459 } 460 insertComboBox(String sName, int iControlKey, XActionListener xActionListener, XTextListener xTextListener, XItemListener xItemListener, String[] sProperties, Object[] sValues)461 public XComboBox insertComboBox(String sName, int iControlKey, XActionListener xActionListener, XTextListener xTextListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception 462 { 463 XInterface xComboBoxModel = insertControlModel("com.sun.star.awt.UnoControlComboBoxModel", sName, sProperties, sValues); 464 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel); 465 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 466 XControl xControlComboBox = xDlgContainer.getControl(sName); 467 XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, xControlComboBox); 468 if (xItemListener != null) 469 { 470 xComboBox.addItemListener(xItemListener); 471 } 472 if (xTextListener != null) 473 { 474 XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox); 475 xTextComponent.addTextListener(xTextListener); 476 } 477 if (xActionListener != null) 478 { 479 xComboBox.addActionListener(xActionListener); 480 } 481 Integer ControlKey = new Integer(iControlKey); 482 ControlList.put(sName, ControlKey); 483 return xComboBox; 484 } 485 insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues)486 public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) 487 { 488 try 489 { 490 XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); 491 if (xItemListener != null) 492 { 493 xRadioButton.addItemListener(xItemListener); 494 } 495 return xRadioButton; 496 } 497 catch (com.sun.star.uno.Exception exception) 498 { 499 exception.printStackTrace(System.out); 500 return null; 501 } 502 } 503 insertRadioButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues)504 public XButton insertRadioButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) 505 { 506 try 507 { 508 XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); 509 XButton xButton = UnoRuntime.queryInterface(XButton.class, xRadioButton); 510 if (xActionListener != null) 511 { 512 xButton.addActionListener(xActionListener); 513 } 514 return xButton; 515 } 516 catch (com.sun.star.uno.Exception exception) 517 { 518 exception.printStackTrace(System.out); 519 return null; 520 } 521 } 522 insertRadioButton(String sName, int iControlKey, String[] sProperties, Object[] sValues)523 public XRadioButton insertRadioButton(String sName, int iControlKey, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception 524 { 525 XRadioButton xRadioButton = insertRadioButton(sName, sProperties, sValues); 526 Integer ControlKey = new Integer(iControlKey); 527 ControlList.put(sName, ControlKey); 528 return xRadioButton; 529 } 530 insertRadioButton(String sName, String[] sProperties, Object[] sValues)531 public XRadioButton insertRadioButton(String sName, String[] sProperties, Object[] sValues) 532 { 533 try 534 { 535 XInterface oRadioButtonModel = insertControlModel("com.sun.star.awt.UnoControlRadioButtonModel", sName, sProperties, sValues); 536 XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oRadioButtonModel); 537 xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); 538 XControl xControlRadioButton = xDlgContainer.getControl(sName); 539 return UnoRuntime.queryInterface(XRadioButton.class, xControlRadioButton); 540 } 541 catch (com.sun.star.uno.Exception exception) 542 { 543 exception.printStackTrace(System.out); 544 return null; 545 } 546 } 547 548 /** 549 * @author bc93774 550 * The problem with setting the visibility of controls is that changing the current step 551 * of a dialog will automatically make all controls visible. The PropertyNames.PROPERTY_STEP property always wins against 552 * the property "visible". Therfor a control meant to be invisible is placed on a step far far away. 553 * @param the name of the control 554 * @param iStep change the step if you want to make the control invisible 555 */ setControlVisible(String controlname, int iStep)556 private void setControlVisible(String controlname, int iStep) 557 { 558 try 559 { 560 int iCurStep = AnyConverter.toInt(getControlProperty(controlname, PropertyNames.PROPERTY_STEP)); 561 setControlProperty(controlname, PropertyNames.PROPERTY_STEP, new Integer(iStep)); 562 } 563 catch (com.sun.star.uno.Exception exception) 564 { 565 exception.printStackTrace(System.out); 566 } 567 } 568 569 /** 570 * @author bc93774 571 * The problem with setting the visibility of controls is that changing the current step 572 * of a dialog will automatically make all controls visible. The PropertyNames.PROPERTY_STEP property always wins against 573 * the property "visible". Therfor a control meant to be invisible is placed on a step far far away. 574 * Afterwards the step property of the dialog has to be set with "repaintDialogStep". As the performance 575 * of that method is very bad it should be used only once for all controls 576 * @param controlname the name of the control 577 * @param bIsVisible sets the control visible or invisible 578 */ setControlVisible(String controlname, boolean bIsVisible)579 public void setControlVisible(String controlname, boolean bIsVisible) 580 { 581 try 582 { 583 int iCurControlStep = AnyConverter.toInt(getControlProperty(controlname, PropertyNames.PROPERTY_STEP)); 584 int iCurDialogStep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_STEP)); 585 int iNewStep; 586 if (bIsVisible) 587 { 588 setControlProperty(controlname, PropertyNames.PROPERTY_STEP, new Integer(iCurDialogStep)); 589 } 590 else 591 { 592 setControlProperty(controlname, PropertyNames.PROPERTY_STEP, UIConsts.INVISIBLESTEP); 593 } 594 } 595 catch (com.sun.star.uno.Exception exception) 596 { 597 exception.printStackTrace(System.out); 598 } 599 } 600 601 /** 602 * repaints the currentDialogStep 603 * @author bc93774 604 */ repaintDialogStep()605 public void repaintDialogStep() 606 { 607 try 608 { 609 int ncurstep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_STEP)); 610 Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, 99); 611 Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(ncurstep)); 612 } 613 catch (com.sun.star.uno.Exception exception) 614 { 615 exception.printStackTrace(System.out); 616 } 617 } 618 insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues)619 public XInterface insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues) 620 { 621 try 622 { 623 XInterface xControlModel = (XInterface) MSFDialogModel.createInstance(ServiceName); 624 Helper.setUnoPropertyValues(xControlModel, sProperties, sValues); 625 xDlgNames.insertByName(sName, xControlModel); 626 return xControlModel; 627 } 628 catch (com.sun.star.uno.Exception exception) 629 { 630 exception.printStackTrace(System.out); 631 return null; 632 } 633 } 634 setFocus(String ControlName)635 public void setFocus(String ControlName) 636 { 637 Object oFocusControl = xDlgContainer.getControl(ControlName); 638 XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, oFocusControl); 639 xWindow.setFocus(); 640 } 641 combineListboxList(String sFirstEntry, String[] MainList)642 public static String[] combineListboxList(String sFirstEntry, String[] MainList) 643 { 644 try 645 { 646 String[] FirstList = new String[] 647 { 648 sFirstEntry 649 }; 650 String[] ResultList = new String[MainList.length + 1]; 651 System.arraycopy(FirstList, 0, ResultList, 0, 1); 652 System.arraycopy(MainList, 0, ResultList, 1, MainList.length); 653 return ResultList; 654 } 655 catch (java.lang.Exception jexception) 656 { 657 jexception.printStackTrace(System.out); 658 return null; 659 } 660 } 661 selectListBoxItem(XListBox xListBox, short iFieldsSelIndex)662 public void selectListBoxItem(XListBox xListBox, short iFieldsSelIndex) 663 { 664 if (iFieldsSelIndex > -1) 665 { 666 int FieldCount = xListBox.getItemCount(); 667 if (FieldCount > 0) 668 { 669 if (iFieldsSelIndex < FieldCount) 670 { 671 xListBox.selectItemPos(iFieldsSelIndex, true); 672 } 673 else 674 { 675 xListBox.selectItemPos((short) (iFieldsSelIndex - 1), true); 676 } 677 } 678 } 679 } 680 681 /** deselects a Listbox. MultipleMode is not supported 682 * 683 * @param _xBasisListBox 684 */ deselectListBox(XInterface _xBasisListBox)685 public static void deselectListBox(XInterface _xBasisListBox) 686 { 687 Object oListBoxModel = getModel(_xBasisListBox); 688 Object sList = Helper.getUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST); 689 Helper.setUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST, new String[] 690 { 691 }); 692 Helper.setUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST, sList); 693 } 694 calculateDialogPosition(Rectangle FramePosSize)695 public void calculateDialogPosition(Rectangle FramePosSize) 696 { 697 // Todo: check if it would be useful or possible to create a dialog peer, that can be used for the messageboxes to 698 // maintain modality when they pop up. 699 Rectangle CurPosSize = xWindow.getPosSize(); 700 int WindowHeight = FramePosSize.Height; 701 int WindowWidth = FramePosSize.Width; 702 int DialogWidth = CurPosSize.Width; 703 int DialogHeight = CurPosSize.Height; 704 int iXPos = ((WindowWidth / 2) - (DialogWidth / 2)); 705 int iYPos = ((WindowHeight / 2) - (DialogHeight / 2)); 706 xWindow.setPosSize(iXPos, iYPos, DialogWidth, DialogHeight, PosSize.POS); 707 } 708 709 /** 710 * 711 * @param FramePosSize 712 * @return 0 for cancel, 1 for ok 713 * @throws com.sun.star.uno.Exception 714 */ executeDialog(Rectangle FramePosSize)715 public short executeDialog(Rectangle FramePosSize) throws com.sun.star.uno.Exception 716 { 717 if (xControl.getPeer() == null) 718 { 719 throw new java.lang.IllegalArgumentException("Please create a peer, using your own frame"); 720 } 721 calculateDialogPosition(FramePosSize); 722 if (xWindowPeer == null) 723 { 724 createWindowPeer(); 725 } 726 xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); 727 // xVclWindowPeer.setProperty("AutoMnemonics", new Boolean(true)); 728 this.BisHighContrastModeActivated = Boolean.valueOf(this.isHighContrastModeActivated()); 729 xDialog = UnoRuntime.queryInterface(XDialog.class, xUnoDialog); 730 return xDialog.execute(); 731 } 732 setVisible(UnoDialog parent)733 public void setVisible(UnoDialog parent) throws com.sun.star.uno.Exception 734 { 735 calculateDialogPosition(parent.xWindow.getPosSize()); 736 if (xWindowPeer == null) 737 { 738 createWindowPeer(); 739 } 740 XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); 741 xDialog = UnoRuntime.queryInterface(XDialog.class, xUnoDialog); 742 this.xWindow.setVisible(true); 743 } 744 745 /** 746 * 747 * @param parent 748 * @return 0 for cancel, 1 for ok. 749 * @throws com.sun.star.uno.Exception 750 */ executeDialog(UnoDialog parent)751 public short executeDialog(UnoDialog parent) 752 throws com.sun.star.uno.Exception 753 { 754 return executeDialog(parent.xWindow.getPosSize()); 755 } 756 757 /** 758 * 759 * @param xComponent 760 * @return 0 for cancel, 1 for ok. 761 * @throws com.sun.star.uno.Exception 762 */ executeDialog(XInterface xComponent)763 public short executeDialog(XInterface xComponent) throws com.sun.star.uno.Exception 764 { 765 XFrame frame = UnoRuntime.queryInterface(XFrame.class, xComponent); 766 if (frame != null) 767 { 768 XWindow w = frame.getComponentWindow(); 769 if (w != null) 770 { 771 return executeDialog(w.getPosSize()); 772 } 773 } 774 775 return executeDialog(new Rectangle(0, 0, 640, 400)); 776 } 777 778 /** 779 * When possible, use the other executeDialog methods, since 780 * there may be problems retrieving the actual active frame, 781 * for example under linux. 782 * @return 0 for cancel, 1 for ok 783 */ executeDialog()784 public short executeDialog() throws com.sun.star.uno.Exception 785 { 786 return executeDialog(Desktop.getActiveFrame(xMSF)); 787 } 788 setAutoMnemonic(String ControlName, boolean bValue)789 public void setAutoMnemonic(String ControlName, boolean bValue) 790 { 791 Object oControl = xDlgContainer.getControl(ControlName); 792 xControl = UnoRuntime.queryInterface(XControl.class, oControl); 793 XWindowPeer xWindowPeer = xControl.getPeer(); 794 XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControl.getPeer()); 795 xVclWindowPeer.setProperty("AutoMnemonics", Boolean.valueOf(bValue)); 796 } 797 modifyFontWeight(String ControlName, float FontWeight)798 public void modifyFontWeight(String ControlName, float FontWeight) 799 { 800 FontDescriptor oFontDesc = new FontDescriptor(); 801 oFontDesc.Weight = FontWeight; 802 setControlProperty(ControlName, PropertyNames.FONT_DESCRIPTOR, oFontDesc); 803 } 804 805 /** 806 * create a peer for this 807 * dialog, using the given 808 * peer as a parent. 809 * @param parentPeer 810 * @return 811 * @throws java.lang.Exception 812 */ createWindowPeer(XWindowPeer parentPeer)813 public XWindowPeer createWindowPeer(XWindowPeer parentPeer) throws com.sun.star.uno.Exception 814 { 815 xWindow.setVisible(false); 816 Object tk = xMSF.createInstance("com.sun.star.awt.Toolkit"); 817 if (parentPeer == null) 818 { 819 parentPeer = UnoRuntime.queryInterface(XToolkit.class, tk).getDesktopWindow(); 820 } 821 XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, tk); 822 xReschedule = UnoRuntime.queryInterface(XReschedule.class, xToolkit); 823 // TEUER! 824 xControl.createPeer(xToolkit, parentPeer); 825 xWindowPeer = xControl.getPeer(); 826 return xControl.getPeer(); 827 } 828 829 /** 830 * Creates a peer for this 831 * dialog, using the active OO frame 832 * as the parent window. 833 * @return 834 * @throws java.lang.Exception 835 */ createWindowPeer()836 public XWindowPeer createWindowPeer() throws com.sun.star.uno.Exception 837 { 838 return createWindowPeer(null); 839 } 840 841 // deletes the first entry when this is equal to "DelEntryName" 842 // returns true when a new item is selected deletefirstListboxEntry(String ListBoxName, String DelEntryName)843 public void deletefirstListboxEntry(String ListBoxName, String DelEntryName) 844 { 845 XControl xListControl = xDlgContainer.getControl(ListBoxName); 846 XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xListControl); 847 String FirstItem = xListBox.getItem((short) 0); 848 if (FirstItem.equals(DelEntryName)) 849 { 850 short SelPos = xListBox.getSelectedItemPos(); 851 xListBox.removeItems((short) 0, (short) 1); 852 if (SelPos > 0) 853 { 854 setControlProperty(ListBoxName, PropertyNames.SELECTED_ITEMS, new short[SelPos]); 855 xListBox.selectItemPos((short) (SelPos - 1), true); 856 } 857 } 858 } 859 setPeerProperty(String ControlName, String PropertyName, Object PropertyValue)860 public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue) 861 { 862 Object oControl = xDlgContainer.getControl(ControlName); 863 XControl xControl = UnoRuntime.queryInterface(XControl.class, oControl); 864 XWindowPeer xControlPeer = xControl.getPeer(); 865 XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer); 866 xVclWindowPeer.setProperty(PropertyName, PropertyValue); 867 } 868 getModel(Object control)869 public static Object getModel(Object control) 870 { 871 XControl xControl = UnoRuntime.queryInterface(XControl.class, control); 872 return xControl.getModel(); 873 } 874 setEnabled(Object control, boolean enabled)875 public static void setEnabled(Object control, boolean enabled) 876 { 877 setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE); 878 } 879 setEnabled(Object control, Boolean enabled)880 public static void setEnabled(Object control, Boolean enabled) 881 { 882 Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_ENABLED, enabled); 883 } 884 885 /** 886 * @author bc93774 887 * @param oControlModel the model of a control 888 * @return the LabelType according to UIConsts.CONTROLTYPE 889 */ getControlModelType(Object oControlModel)890 public static int getControlModelType(Object oControlModel) 891 { 892 XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oControlModel); 893 if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFixedTextModel")) 894 { 895 return UIConsts.CONTROLTYPE.FIXEDTEXT; 896 } 897 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlButtonModel")) 898 { 899 return UIConsts.CONTROLTYPE.BUTTON; 900 } 901 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlCurrencyFieldModel")) 902 { 903 return UIConsts.CONTROLTYPE.CURRENCYFIELD; 904 } 905 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlDateFieldModel")) 906 { 907 return UIConsts.CONTROLTYPE.DATEFIELD; 908 } 909 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFixedLineModel")) 910 { 911 return UIConsts.CONTROLTYPE.FIXEDLINE; 912 } 913 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFormattedFieldModel")) 914 { 915 return UIConsts.CONTROLTYPE.FORMATTEDFIELD; 916 } 917 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlRoadmapModel")) 918 { 919 return UIConsts.CONTROLTYPE.ROADMAP; 920 } 921 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlNumericFieldModel")) 922 { 923 return UIConsts.CONTROLTYPE.NUMERICFIELD; 924 } 925 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlPatternFieldModel")) 926 { 927 return UIConsts.CONTROLTYPE.PATTERNFIELD; 928 } 929 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlHyperTextModel")) 930 { 931 return UIConsts.CONTROLTYPE.HYPERTEXT; 932 } 933 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlProgressBarModel")) 934 { 935 return UIConsts.CONTROLTYPE.PROGRESSBAR; 936 } 937 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlTimeFieldModel")) 938 { 939 return UIConsts.CONTROLTYPE.TIMEFIELD; 940 } 941 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlImageControlModel")) 942 { 943 return UIConsts.CONTROLTYPE.IMAGECONTROL; 944 } 945 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlRadioButtonModel")) 946 { 947 return UIConsts.CONTROLTYPE.RADIOBUTTON; 948 } 949 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlCheckBoxModel")) 950 { 951 return UIConsts.CONTROLTYPE.CHECKBOX; 952 } 953 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlEditModel")) 954 { 955 return UIConsts.CONTROLTYPE.EDITCONTROL; 956 } 957 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlComboBoxModel")) 958 { 959 return UIConsts.CONTROLTYPE.COMBOBOX; 960 } 961 else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlListBoxModel")) // TODO Comboboxes?? 962 { 963 return UIConsts.CONTROLTYPE.LISTBOX; 964 } 965 else 966 { 967 return UIConsts.CONTROLTYPE.UNKNOWN; 968 } 969 } 970 971 /** 972 * @author bc93774 973 * @param oControlModel 974 * @return the name of the property that contains the value of a controlmodel 975 */ getDisplayProperty(Object oControlModel)976 public static String getDisplayProperty(Object oControlModel) 977 { 978 XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oControlModel); 979 int itype = getControlModelType(oControlModel); 980 return getDisplayProperty(itype); 981 } 982 983 /** 984 * @author bc93774 985 * @param itype The type of the control conforming to UIConst.ControlType 986 * @return the name of the property that contains the value of a controlmodel 987 */ getDisplayProperty(int itype)988 public static String getDisplayProperty(int itype) 989 { 990 // String propertyname = PropertyNames.EMPTY_STRING; 991 switch (itype) 992 { 993 case UIConsts.CONTROLTYPE.FIXEDTEXT: 994 return PropertyNames.PROPERTY_LABEL; 995 case UIConsts.CONTROLTYPE.BUTTON: 996 return PropertyNames.PROPERTY_LABEL; 997 case UIConsts.CONTROLTYPE.FIXEDLINE: 998 return PropertyNames.PROPERTY_LABEL; 999 case UIConsts.CONTROLTYPE.NUMERICFIELD: 1000 return "Value"; 1001 case UIConsts.CONTROLTYPE.CURRENCYFIELD: 1002 return "Value"; 1003 case UIConsts.CONTROLTYPE.FORMATTEDFIELD: 1004 return "EffectiveValue"; 1005 case UIConsts.CONTROLTYPE.DATEFIELD: 1006 return "Date"; 1007 case UIConsts.CONTROLTYPE.TIMEFIELD: 1008 return "Time"; 1009 case UIConsts.CONTROLTYPE.SCROLLBAR: 1010 return "ScrollValue"; 1011 case UIConsts.CONTROLTYPE.PROGRESSBAR: 1012 return "ProgressValue"; 1013 case UIConsts.CONTROLTYPE.IMAGECONTROL: 1014 return PropertyNames.PROPERTY_IMAGEURL; 1015 case UIConsts.CONTROLTYPE.RADIOBUTTON: 1016 return PropertyNames.PROPERTY_STATE; 1017 case UIConsts.CONTROLTYPE.CHECKBOX: 1018 return PropertyNames.PROPERTY_STATE; 1019 case UIConsts.CONTROLTYPE.EDITCONTROL: 1020 return "Text"; 1021 case UIConsts.CONTROLTYPE.COMBOBOX: 1022 return "Text"; 1023 case UIConsts.CONTROLTYPE.PATTERNFIELD: 1024 return "Text"; 1025 case UIConsts.CONTROLTYPE.LISTBOX: 1026 return PropertyNames.SELECTED_ITEMS; 1027 default: 1028 return PropertyNames.EMPTY_STRING; 1029 } 1030 } 1031 addResourceHandler(String _Unit, String _Module)1032 public void addResourceHandler(String _Unit, String _Module) 1033 { 1034 m_oResource = new Resource(xMSF, _Unit, _Module); 1035 } 1036 setInitialTabindex(int _istep)1037 public static short setInitialTabindex(int _istep) 1038 { 1039 return (short) (_istep * 100); 1040 } 1041 private Boolean BisHighContrastModeActivated = null; 1042 isHighContrastModeActivated()1043 public boolean isHighContrastModeActivated() 1044 { 1045 if (xVclWindowPeer != null) 1046 { 1047 if (BisHighContrastModeActivated == null) 1048 { 1049 int nUIColor; 1050 try 1051 { 1052 nUIColor = AnyConverter.toInt(this.xVclWindowPeer.getProperty("DisplayBackgroundColor")); 1053 } 1054 catch (IllegalArgumentException e) 1055 { 1056 e.printStackTrace(System.out); 1057 return false; 1058 } 1059 //TODO: The following methods could be wrapped in an own class implementation 1060 int nRed = getRedColorShare(nUIColor); 1061 int nGreen = getGreenColorShare(nUIColor); 1062 int nBlue = getBlueColorShare(nUIColor); 1063 int nLuminance = ((nBlue * 28 + nGreen * 151 + nRed * 77) / 256); 1064 boolean bisactivated = (nLuminance <= 25); 1065 BisHighContrastModeActivated = Boolean.valueOf(bisactivated); 1066 return bisactivated; 1067 } 1068 else 1069 { 1070 return BisHighContrastModeActivated.booleanValue(); 1071 } 1072 } 1073 else 1074 { 1075 return false; 1076 } 1077 } 1078 getRedColorShare(int _nColor)1079 public static int getRedColorShare(int _nColor) 1080 { 1081 int nRed = _nColor / 65536; 1082 int nRedModulo = _nColor % 65536; 1083 int nGreen = nRedModulo / 256; 1084 int nGreenModulo = (nRedModulo % 256); 1085 int nBlue = nGreenModulo; 1086 return nRed; 1087 } 1088 getGreenColorShare(int _nColor)1089 public static int getGreenColorShare(int _nColor) 1090 { 1091 int nRed = _nColor / 65536; 1092 int nRedModulo = _nColor % 65536; 1093 int nGreen = nRedModulo / 256; 1094 return nGreen; 1095 } 1096 getBlueColorShare(int _nColor)1097 public static int getBlueColorShare(int _nColor) 1098 { 1099 int nRed = _nColor / 65536; 1100 int nRedModulo = _nColor % 65536; 1101 int nGreen = nRedModulo / 256; 1102 int nGreenModulo = (nRedModulo % 256); 1103 int nBlue = nGreenModulo; 1104 return nBlue; 1105 } 1106 getWizardImageUrl(int _nResId, int _nHCResId)1107 public String getWizardImageUrl(int _nResId, int _nHCResId) 1108 { 1109 if (isHighContrastModeActivated()) 1110 { 1111 return "private:resource/wzi/image/" + _nHCResId; 1112 } 1113 else 1114 { 1115 return "private:resource/wzi/image/" + _nResId; 1116 } 1117 } 1118 getImageUrl(String _surl, String _shcurl)1119 public String getImageUrl(String _surl, String _shcurl) 1120 { 1121 if (isHighContrastModeActivated()) 1122 { 1123 return _shcurl; 1124 } 1125 else 1126 { 1127 return _surl; 1128 } 1129 } 1130 getListBoxLineCount()1131 public static short getListBoxLineCount() 1132 { 1133 return (short)20; 1134 } 1135 } 1136