1*a1b4a26bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*a1b4a26bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*a1b4a26bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*a1b4a26bSAndrew Rist * distributed with this work for additional information 6*a1b4a26bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*a1b4a26bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*a1b4a26bSAndrew Rist * "License"); you may not use this file except in compliance 9*a1b4a26bSAndrew Rist * with the License. You may obtain a copy of the License at 10*a1b4a26bSAndrew Rist * 11*a1b4a26bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*a1b4a26bSAndrew Rist * 13*a1b4a26bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*a1b4a26bSAndrew Rist * software distributed under the License is distributed on an 15*a1b4a26bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*a1b4a26bSAndrew Rist * KIND, either express or implied. See the License for the 17*a1b4a26bSAndrew Rist * specific language governing permissions and limitations 18*a1b4a26bSAndrew Rist * under the License. 19*a1b4a26bSAndrew Rist * 20*a1b4a26bSAndrew Rist *************************************************************/ 21*a1b4a26bSAndrew Rist 22*a1b4a26bSAndrew Rist 23cdf0e10cSrcweir package com.sun.star.wizards.ui; 24cdf0e10cSrcweir 25cdf0e10cSrcweir import java.beans.*; 26cdf0e10cSrcweir 27cdf0e10cSrcweir import com.sun.star.wizards.ui.event.CommonListener; 28cdf0e10cSrcweir import com.sun.star.wizards.ui.event.EventNames; 29cdf0e10cSrcweir import com.sun.star.wizards.ui.event.MethodInvocation; 30cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 31cdf0e10cSrcweir import com.sun.star.awt.*; 32cdf0e10cSrcweir import com.sun.star.uno.AnyConverter; 33cdf0e10cSrcweir import com.sun.star.uno.XInterface; 34cdf0e10cSrcweir import com.sun.star.lang.EventObject; 35cdf0e10cSrcweir import com.sun.star.lang.XSingleServiceFactory; 36cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 37cdf0e10cSrcweir import com.sun.star.wizards.common.Desktop; 38cdf0e10cSrcweir import com.sun.star.wizards.common.Helper; 39cdf0e10cSrcweir import com.sun.star.wizards.common.Resource; 40cdf0e10cSrcweir import com.sun.star.container.XIndexContainer; 41cdf0e10cSrcweir import com.sun.star.frame.XTerminateListener; 42cdf0e10cSrcweir import com.sun.star.frame.TerminationVetoException; 43cdf0e10cSrcweir import com.sun.star.lang.IllegalArgumentException; 44cdf0e10cSrcweir import com.sun.star.beans.*; 45cdf0e10cSrcweir import com.sun.star.wizards.common.HelpIds; 46cdf0e10cSrcweir import com.sun.star.wizards.common.PropertyNames; 47cdf0e10cSrcweir 48cdf0e10cSrcweir public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeListener, XTerminateListener, XCompletion 49cdf0e10cSrcweir { 50cdf0e10cSrcweir 51cdf0e10cSrcweir private static final String NEXT_ACTION_PERFORMED = "gotoNextAvailableStep"; 52cdf0e10cSrcweir private static final String BACK_ACTION_PERFORMED = "gotoPreviousAvailableStep"; 53cdf0e10cSrcweir private static final String FINISH_ACTION_PERFORMED = "finishWizard_1"; 54cdf0e10cSrcweir private static final String CANCEL_ACTION_PERFORMED = "cancelWizard_1"; 55cdf0e10cSrcweir private static final String HELP_ACTION_PERFORMED = "callHelp"; 56cdf0e10cSrcweir public VetoableChangeSupport vetos = new VetoableChangeSupport(this); 57cdf0e10cSrcweir private String[] sRightPaneHeaders; 58cdf0e10cSrcweir private int iButtonWidth = 50; 59cdf0e10cSrcweir private int nNewStep = 1; 60cdf0e10cSrcweir private int nOldStep = 1; 61cdf0e10cSrcweir private int nMaxStep = 1; 62cdf0e10cSrcweir protected XItemListener RoadmapItemListener; 63cdf0e10cSrcweir protected XControl xRoadmapControl; 64cdf0e10cSrcweir XItemEventBroadcaster xRoadmapBroadcaster; 65cdf0e10cSrcweir String[] sRMItemLabels; 66cdf0e10cSrcweir private Object oRoadmap; 67cdf0e10cSrcweir private XSingleServiceFactory xSSFRoadmap; 68cdf0e10cSrcweir public XIndexContainer xIndexContRoadmap; 69cdf0e10cSrcweir private Resource oWizardResource; 70cdf0e10cSrcweir public String sMsgEndAutopilot; 71cdf0e10cSrcweir private int hid; 72cdf0e10cSrcweir private boolean bTerminateListenermustberemoved = true; 73cdf0e10cSrcweir 74cdf0e10cSrcweir /** Creates a new instance of WizardDialog 75cdf0e10cSrcweir * the hid is used as following : 76cdf0e10cSrcweir * "HID:(hid)" - the dialog 77cdf0e10cSrcweir * "HID:(hid+1) - the help button 78cdf0e10cSrcweir * "HID:(hid+2)" - the back button 79cdf0e10cSrcweir * "HID:(hid+3)" - the next button 80cdf0e10cSrcweir * "HID:(hid+4)" - the create button 81cdf0e10cSrcweir * "HID:(hid+5)" - the cancel button 82cdf0e10cSrcweir * @param xMSF 83cdf0e10cSrcweir * @param hid_ 84cdf0e10cSrcweir */ WizardDialog(XMultiServiceFactory xMSF, int hid_)85cdf0e10cSrcweir public WizardDialog(XMultiServiceFactory xMSF, int hid_) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir super(xMSF); 88cdf0e10cSrcweir hid = hid_; 89cdf0e10cSrcweir oWizardResource = new Resource(xMSF, "Common", "dbw"); 90cdf0e10cSrcweir sMsgEndAutopilot = oWizardResource.getResText(UIConsts.RID_DB_COMMON + 33); 91cdf0e10cSrcweir 92cdf0e10cSrcweir //new Resource(xMSF,"Common","com"); 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir /** 96cdf0e10cSrcweir * 97cdf0e10cSrcweir * @return 98cdf0e10cSrcweir */ getResource()99cdf0e10cSrcweir public Resource getResource() 100cdf0e10cSrcweir { 101cdf0e10cSrcweir return oWizardResource; 102cdf0e10cSrcweir } 103cdf0e10cSrcweir activate()104cdf0e10cSrcweir public void activate() 105cdf0e10cSrcweir { 106cdf0e10cSrcweir try 107cdf0e10cSrcweir { 108cdf0e10cSrcweir XTopWindow top = UnoRuntime.queryInterface(XTopWindow.class, xWindow); 109cdf0e10cSrcweir if (top != null) 110cdf0e10cSrcweir { 111cdf0e10cSrcweir top.toFront(); 112cdf0e10cSrcweir } 113cdf0e10cSrcweir } 114cdf0e10cSrcweir catch (Exception ex) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir // do nothing; 117cdf0e10cSrcweir } 118cdf0e10cSrcweir } 119cdf0e10cSrcweir setMaxStep(int i)120cdf0e10cSrcweir public void setMaxStep(int i) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir nMaxStep = i; 123cdf0e10cSrcweir } 124cdf0e10cSrcweir getMaxStep()125cdf0e10cSrcweir public int getMaxStep() 126cdf0e10cSrcweir { 127cdf0e10cSrcweir return nMaxStep; 128cdf0e10cSrcweir } 129cdf0e10cSrcweir setOldStep(int i)130cdf0e10cSrcweir public void setOldStep(int i) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir nOldStep = i; 133cdf0e10cSrcweir } 134cdf0e10cSrcweir getOldStep()135cdf0e10cSrcweir public int getOldStep() 136cdf0e10cSrcweir { 137cdf0e10cSrcweir return nOldStep; 138cdf0e10cSrcweir } 139cdf0e10cSrcweir setNewStep(int i)140cdf0e10cSrcweir public void setNewStep(int i) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir nNewStep = i; 143cdf0e10cSrcweir } 144cdf0e10cSrcweir getNewStep()145cdf0e10cSrcweir public int getNewStep() 146cdf0e10cSrcweir { 147cdf0e10cSrcweir return nNewStep; 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir /** 151cdf0e10cSrcweir * @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent) 152cdf0e10cSrcweir */ vetoableChange(java.beans.PropertyChangeEvent arg0)153cdf0e10cSrcweir public void vetoableChange(java.beans.PropertyChangeEvent arg0) 154cdf0e10cSrcweir { 155cdf0e10cSrcweir nNewStep = nOldStep; 156cdf0e10cSrcweir } 157cdf0e10cSrcweir itemStateChanged(com.sun.star.awt.ItemEvent itemEvent)158cdf0e10cSrcweir public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir try 161cdf0e10cSrcweir { 162cdf0e10cSrcweir nNewStep = itemEvent.ItemId; 163cdf0e10cSrcweir nOldStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP)); 164cdf0e10cSrcweir if (nNewStep != nOldStep) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir switchToStep(); 167cdf0e10cSrcweir } 168cdf0e10cSrcweir } 169cdf0e10cSrcweir catch (com.sun.star.lang.IllegalArgumentException exception) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir exception.printStackTrace(System.out); 172cdf0e10cSrcweir } 173cdf0e10cSrcweir } 174cdf0e10cSrcweir setRoadmapInteractive(boolean _bInteractive)175cdf0e10cSrcweir public void setRoadmapInteractive(boolean _bInteractive) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir Helper.setUnoPropertyValue(oRoadmap, "Activated", Boolean.valueOf(_bInteractive)); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir setRoadmapComplete(boolean bComplete)180cdf0e10cSrcweir public void setRoadmapComplete(boolean bComplete) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir Helper.setUnoPropertyValue(oRoadmap, "Complete", Boolean.valueOf(bComplete)); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir isRoadmapComplete()185cdf0e10cSrcweir public boolean isRoadmapComplete() 186cdf0e10cSrcweir { 187cdf0e10cSrcweir try 188cdf0e10cSrcweir { 189cdf0e10cSrcweir return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oRoadmap, "Complete")); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir catch (IllegalArgumentException exception) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir exception.printStackTrace(System.out); 194cdf0e10cSrcweir return false; 195cdf0e10cSrcweir } 196cdf0e10cSrcweir } 197cdf0e10cSrcweir setCurrentRoadmapItemID(short ID)198cdf0e10cSrcweir public void setCurrentRoadmapItemID(short ID) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir if (oRoadmap != null) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir int nCurItemID = getCurrentRoadmapItemID(); 203cdf0e10cSrcweir if (nCurItemID != ID) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir Helper.setUnoPropertyValue(oRoadmap, "CurrentItemID", new Short(ID)); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir } 208cdf0e10cSrcweir } 209cdf0e10cSrcweir getCurrentRoadmapItemID()210cdf0e10cSrcweir public int getCurrentRoadmapItemID() 211cdf0e10cSrcweir { 212cdf0e10cSrcweir try 213cdf0e10cSrcweir { 214cdf0e10cSrcweir return AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmap, "CurrentItemID")); 215cdf0e10cSrcweir } 216cdf0e10cSrcweir catch (com.sun.star.uno.Exception exception) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir exception.printStackTrace(System.out); 219cdf0e10cSrcweir return -1; 220cdf0e10cSrcweir } 221cdf0e10cSrcweir } 222cdf0e10cSrcweir addRoadmap()223cdf0e10cSrcweir public void addRoadmap() 224cdf0e10cSrcweir { 225cdf0e10cSrcweir try 226cdf0e10cSrcweir { 227cdf0e10cSrcweir int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_HEIGHT)).intValue(); 228cdf0e10cSrcweir 229cdf0e10cSrcweir // the roadmap control has got no real TabIndex ever 230cdf0e10cSrcweir // that is not correct, but changing this would need time, so it is used 231cdf0e10cSrcweir // without TabIndex as before 232cdf0e10cSrcweir oRoadmap = insertControlModel("com.sun.star.awt.UnoControlRoadmapModel", "rdmNavi", 233cdf0e10cSrcweir new String[] 234cdf0e10cSrcweir { 235cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, 236cdf0e10cSrcweir PropertyNames.PROPERTY_POSITION_X, 237cdf0e10cSrcweir PropertyNames.PROPERTY_POSITION_Y, 238cdf0e10cSrcweir PropertyNames.PROPERTY_STEP, 239cdf0e10cSrcweir PropertyNames.PROPERTY_TABINDEX, 240cdf0e10cSrcweir "Tabstop", 241cdf0e10cSrcweir PropertyNames.PROPERTY_WIDTH 242cdf0e10cSrcweir }, 243cdf0e10cSrcweir new Object[] 244cdf0e10cSrcweir { 245cdf0e10cSrcweir new Integer(iDialogHeight - 26), 246cdf0e10cSrcweir 0, 247cdf0e10cSrcweir 0, 248cdf0e10cSrcweir 0, 249cdf0e10cSrcweir new Short((short)0), 250cdf0e10cSrcweir Boolean.TRUE, 251cdf0e10cSrcweir 85 252cdf0e10cSrcweir }); 253cdf0e10cSrcweir XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oRoadmap); 254cdf0e10cSrcweir xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, "rdmNavi"); 255cdf0e10cSrcweir 256cdf0e10cSrcweir xSSFRoadmap = UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmap); 257cdf0e10cSrcweir xIndexContRoadmap = UnoRuntime.queryInterface(XIndexContainer.class, oRoadmap); 258cdf0e10cSrcweir // XPropertySet xPropRoadmapModel = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap); 259cdf0e10cSrcweir // xPropRoadmapModel.addPropertyChangeListener("CurrentItemID", new WizardDialog.RoadmapItemListener(this.xDialogModel)); 260cdf0e10cSrcweir 261cdf0e10cSrcweir MethodInvocation mi = new MethodInvocation("itemStateChanged", this, com.sun.star.awt.ItemEvent.class); 262cdf0e10cSrcweir getGuiEventListener().add("rdmNavi", EventNames.EVENT_ITEM_CHANGED, mi); 263cdf0e10cSrcweir xRoadmapControl = this.xDlgContainer.getControl("rdmNavi"); 264cdf0e10cSrcweir xRoadmapBroadcaster = UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRoadmapControl); 265cdf0e10cSrcweir xRoadmapBroadcaster.addItemListener((XItemListener) getGuiEventListener()); 266cdf0e10cSrcweir 267cdf0e10cSrcweir // xRoadmapControl = this.xDlgContainer.getControl("rdmNavi"); 268cdf0e10cSrcweir // xRoadmapBroadcaster.addItemListener(new RoadmapItemListener()); 269cdf0e10cSrcweir Helper.setUnoPropertyValue(oRoadmap, "Text", oWizardResource.getResText(UIConsts.RID_COMMON + 16)); 270cdf0e10cSrcweir } 271cdf0e10cSrcweir catch (NoSuchMethodException ex) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir Resource.showCommonResourceError(xMSF); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir catch (java.lang.Exception jexception) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir jexception.printStackTrace(System.out); 278cdf0e10cSrcweir } 279cdf0e10cSrcweir } 280cdf0e10cSrcweir setRMItemLabels(Resource _oResource, int StartResID)281cdf0e10cSrcweir public void setRMItemLabels(Resource _oResource, int StartResID) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir sRMItemLabels = _oResource.getResArray(StartResID, nMaxStep); 284cdf0e10cSrcweir } 285cdf0e10cSrcweir getRMItemLabels()286cdf0e10cSrcweir public String[] getRMItemLabels() 287cdf0e10cSrcweir { 288cdf0e10cSrcweir return sRMItemLabels; 289cdf0e10cSrcweir } 290cdf0e10cSrcweir 291cdf0e10cSrcweir /* public void insertRoadmapItems(int StartIndex, int RMCount) 292cdf0e10cSrcweir { 293cdf0e10cSrcweir Object oRoadmapItem; 294cdf0e10cSrcweir boolean bEnabled; 295cdf0e10cSrcweir for (int i = StartIndex; i < (StartIndex + RMCount); i++) 296cdf0e10cSrcweir insertSingleRoadmapItem(i, true, sRMItemLabels[i], i); 297cdf0e10cSrcweir }*/ insertRoadmapItem(int _Index, boolean _bEnabled, int _LabelID, int _CurItemID)298cdf0e10cSrcweir public int insertRoadmapItem(int _Index, boolean _bEnabled, int _LabelID, int _CurItemID) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir return insertRoadmapItem(_Index, _bEnabled, sRMItemLabels[_LabelID], _CurItemID); 301cdf0e10cSrcweir } 302cdf0e10cSrcweir insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _CurItemID)303cdf0e10cSrcweir public int insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _CurItemID) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir try 306cdf0e10cSrcweir { 307cdf0e10cSrcweir Object oRoadmapItem = xSSFRoadmap.createInstance(); 308cdf0e10cSrcweir Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_LABEL, _sLabel); 309cdf0e10cSrcweir Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnabled)); 310cdf0e10cSrcweir Helper.setUnoPropertyValue(oRoadmapItem, "ID", new Integer(_CurItemID)); 311cdf0e10cSrcweir xIndexContRoadmap.insertByIndex(Index, oRoadmapItem); 312cdf0e10cSrcweir return Index + 1; 313cdf0e10cSrcweir } 314cdf0e10cSrcweir catch (com.sun.star.uno.Exception exception) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir exception.printStackTrace(System.out); 317cdf0e10cSrcweir return -1; 318cdf0e10cSrcweir } 319cdf0e10cSrcweir } 320cdf0e10cSrcweir getRMItemCount()321cdf0e10cSrcweir public int getRMItemCount() 322cdf0e10cSrcweir { 323cdf0e10cSrcweir return xIndexContRoadmap.getCount(); 324cdf0e10cSrcweir } 325cdf0e10cSrcweir getRoadmapItemByID(int _ID)326cdf0e10cSrcweir public XInterface getRoadmapItemByID(int _ID) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir try 329cdf0e10cSrcweir { 330cdf0e10cSrcweir int CurID; 331cdf0e10cSrcweir XInterface CurRoadmapItem; 332cdf0e10cSrcweir for (int i = 0; i < xIndexContRoadmap.getCount(); i++) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir CurRoadmapItem = (XInterface) xIndexContRoadmap.getByIndex(i); 335cdf0e10cSrcweir CurID = AnyConverter.toInt(Helper.getUnoPropertyValue(CurRoadmapItem, "ID")); 336cdf0e10cSrcweir if (CurID == _ID) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir return CurRoadmapItem; 339cdf0e10cSrcweir } 340cdf0e10cSrcweir } 341cdf0e10cSrcweir return null; 342cdf0e10cSrcweir } 343cdf0e10cSrcweir catch (com.sun.star.uno.Exception exception) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir exception.printStackTrace(System.out); 346cdf0e10cSrcweir return null; 347cdf0e10cSrcweir } 348cdf0e10cSrcweir } 349cdf0e10cSrcweir switchToStep(int _nOldStep, int _nNewStep)350cdf0e10cSrcweir public boolean switchToStep(int _nOldStep, int _nNewStep) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir nOldStep = _nOldStep; 353cdf0e10cSrcweir nNewStep = _nNewStep; 354cdf0e10cSrcweir return switchToStep(); 355cdf0e10cSrcweir } 356cdf0e10cSrcweir switchToStep()357cdf0e10cSrcweir private boolean switchToStep() 358cdf0e10cSrcweir { 359cdf0e10cSrcweir leaveStep(nOldStep, nNewStep); 360cdf0e10cSrcweir if (nNewStep != nOldStep) 361cdf0e10cSrcweir { 362cdf0e10cSrcweir if (nNewStep == nMaxStep) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir setControlProperty("btnWizardNext", "DefaultButton", Boolean.FALSE); 365cdf0e10cSrcweir setControlProperty("btnWizardFinish", "DefaultButton", Boolean.TRUE); 366cdf0e10cSrcweir } 367cdf0e10cSrcweir else 368cdf0e10cSrcweir { 369cdf0e10cSrcweir setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE); 370cdf0e10cSrcweir setControlProperty("btnWizardFinish", "DefaultButton", Boolean.FALSE); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir changeToStep(nNewStep); 373cdf0e10cSrcweir enterStep(nOldStep, nNewStep); 374cdf0e10cSrcweir return true; 375cdf0e10cSrcweir } 376cdf0e10cSrcweir return false; 377cdf0e10cSrcweir } 378cdf0e10cSrcweir leaveStep(int nOldStep, int nNewStep)379cdf0e10cSrcweir abstract protected void leaveStep(int nOldStep, int nNewStep); 380cdf0e10cSrcweir enterStep(int nOldStep, int nNewStep)381cdf0e10cSrcweir abstract protected void enterStep(int nOldStep, int nNewStep); 382cdf0e10cSrcweir changeToStep(int nNewStep)383cdf0e10cSrcweir protected void changeToStep(int nNewStep) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(nNewStep)); 386cdf0e10cSrcweir setCurrentRoadmapItemID((short) (nNewStep)); 387cdf0e10cSrcweir enableNextButton(getNextAvailableStep() > 0); 388cdf0e10cSrcweir enableBackButton(nNewStep != 1); 389cdf0e10cSrcweir } 390cdf0e10cSrcweir 391cdf0e10cSrcweir 392cdf0e10cSrcweir /* (non-Javadoc) 393cdf0e10cSrcweir * @see com.sun.star.wizards.ui.XCompletion#iscompleted(int) 394cdf0e10cSrcweir */ 395cdf0e10cSrcweir /** 396cdf0e10cSrcweir * 397cdf0e10cSrcweir * @param _ndialogpage 398cdf0e10cSrcweir * @return 399cdf0e10cSrcweir */ iscompleted(int _ndialogpage)400cdf0e10cSrcweir public boolean iscompleted(int _ndialogpage) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir return false; 403cdf0e10cSrcweir } 404cdf0e10cSrcweir /* (non-Javadoc) 405cdf0e10cSrcweir * @see com.sun.star.wizards.ui.XCompletion#ismodified(int) 406cdf0e10cSrcweir */ 407cdf0e10cSrcweir 408cdf0e10cSrcweir /** 409cdf0e10cSrcweir * 410cdf0e10cSrcweir * @param _ndialogpage 411cdf0e10cSrcweir * @return 412cdf0e10cSrcweir */ ismodified(int _ndialogpage)413cdf0e10cSrcweir public boolean ismodified(int _ndialogpage) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir return false; 416cdf0e10cSrcweir } 417cdf0e10cSrcweir /* (non-Javadoc) 418cdf0e10cSrcweir * @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean) 419cdf0e10cSrcweir */ 420cdf0e10cSrcweir 421cdf0e10cSrcweir /** 422cdf0e10cSrcweir * 423cdf0e10cSrcweir * @param _ndialogpage 424cdf0e10cSrcweir * @param _biscompleted 425cdf0e10cSrcweir */ setcompleted(int _ndialogpage, boolean _biscompleted)426cdf0e10cSrcweir public void setcompleted(int _ndialogpage, boolean _biscompleted) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir } 429cdf0e10cSrcweir /* (non-Javadoc) 430cdf0e10cSrcweir * @see com.sun.star.wizards.ui.XCompletion#setmodified(int, java.lang.Object, java.lang.Object) 431cdf0e10cSrcweir */ 432cdf0e10cSrcweir 433cdf0e10cSrcweir /** 434cdf0e10cSrcweir * 435cdf0e10cSrcweir * @param _ndialogpage 436cdf0e10cSrcweir * @param ooldValue 437cdf0e10cSrcweir * @param onewValue 438cdf0e10cSrcweir */ setmodified(int _ndialogpage, Object ooldValue, Object onewValue)439cdf0e10cSrcweir public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue) 440cdf0e10cSrcweir { 441cdf0e10cSrcweir } 442cdf0e10cSrcweir drawNaviBar()443cdf0e10cSrcweir public void drawNaviBar() 444cdf0e10cSrcweir { 445cdf0e10cSrcweir 446cdf0e10cSrcweir try 447cdf0e10cSrcweir { 448cdf0e10cSrcweir short curtabindex = UIConsts.SOFIRSTWIZARDNAVITABINDEX; 449cdf0e10cSrcweir Integer IButtonWidth = new Integer(iButtonWidth); 450cdf0e10cSrcweir int iButtonHeight = 14; 451cdf0e10cSrcweir Integer IButtonHeight = new Integer(iButtonHeight); 452cdf0e10cSrcweir Integer ICurStep = 0; 453cdf0e10cSrcweir int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_HEIGHT)).intValue(); 454cdf0e10cSrcweir int iDialogWidth = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_WIDTH)).intValue(); 455cdf0e10cSrcweir int iHelpPosX = 8; 456cdf0e10cSrcweir int iBtnPosY = iDialogHeight - iButtonHeight - 6; 457cdf0e10cSrcweir int iCancelPosX = iDialogWidth - iButtonWidth - 6; 458cdf0e10cSrcweir int iFinishPosX = iCancelPosX - 6 - iButtonWidth; 459cdf0e10cSrcweir int iNextPosX = iFinishPosX - 6 - iButtonWidth; 460cdf0e10cSrcweir int iBackPosX = iNextPosX - 3 - iButtonWidth; 461cdf0e10cSrcweir 462cdf0e10cSrcweir insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnNaviSep", 463cdf0e10cSrcweir new String[] 464cdf0e10cSrcweir { 465cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH 466cdf0e10cSrcweir }, 467cdf0e10cSrcweir new Object[] 468cdf0e10cSrcweir { 469cdf0e10cSrcweir 1, 0, 0, new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth) 470cdf0e10cSrcweir }); 471cdf0e10cSrcweir 472cdf0e10cSrcweir insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep", 473cdf0e10cSrcweir new String[] 474cdf0e10cSrcweir { 475cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH 476cdf0e10cSrcweir }, 477cdf0e10cSrcweir new Object[] 478cdf0e10cSrcweir { 479cdf0e10cSrcweir new Integer(iBtnPosY - 6), 1, 85, 0, ICurStep, 1 480cdf0e10cSrcweir }); 481cdf0e10cSrcweir 482cdf0e10cSrcweir String[] propNames = new String[] 483cdf0e10cSrcweir { 484cdf0e10cSrcweir PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 485cdf0e10cSrcweir }; 486cdf0e10cSrcweir 487cdf0e10cSrcweir Helper.setUnoPropertyValue(super.xDialogModel, PropertyNames.PROPERTY_HELPURL, HelpIds.getHelpIdString(hid)); 488cdf0e10cSrcweir insertButton("btnWizardHelp", HELP_ACTION_PERFORMED, new String[] 489cdf0e10cSrcweir { 490cdf0e10cSrcweir PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 491cdf0e10cSrcweir }, 492cdf0e10cSrcweir new Object[] 493cdf0e10cSrcweir { 494cdf0e10cSrcweir true, IButtonHeight, oWizardResource.getResText(UIConsts.RID_COMMON + 15), new Integer(iHelpPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.HELP_value), ICurStep, new Short(curtabindex++), IButtonWidth 495cdf0e10cSrcweir }); 496cdf0e10cSrcweir insertButton("btnWizardBack", BACK_ACTION_PERFORMED, propNames, 497cdf0e10cSrcweir new Object[] 498cdf0e10cSrcweir { 499cdf0e10cSrcweir false, IButtonHeight, HelpIds.getHelpIdString(hid + 2), oWizardResource.getResText(UIConsts.RID_COMMON + 13), new Integer(iBackPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth 500cdf0e10cSrcweir }); 501cdf0e10cSrcweir 502cdf0e10cSrcweir insertButton("btnWizardNext", NEXT_ACTION_PERFORMED, propNames, 503cdf0e10cSrcweir new Object[] 504cdf0e10cSrcweir { 505cdf0e10cSrcweir true, IButtonHeight, HelpIds.getHelpIdString(hid + 3), oWizardResource.getResText(UIConsts.RID_COMMON + 14), new Integer(iNextPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth 506cdf0e10cSrcweir }); 507cdf0e10cSrcweir 508cdf0e10cSrcweir insertButton("btnWizardFinish", FINISH_ACTION_PERFORMED, propNames, 509cdf0e10cSrcweir new Object[] 510cdf0e10cSrcweir { 511cdf0e10cSrcweir true, IButtonHeight, HelpIds.getHelpIdString(hid + 4), oWizardResource.getResText(UIConsts.RID_COMMON + 12), new Integer(iFinishPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth 512cdf0e10cSrcweir }); 513cdf0e10cSrcweir 514cdf0e10cSrcweir insertButton("btnWizardCancel", CANCEL_ACTION_PERFORMED, propNames, 515cdf0e10cSrcweir new Object[] 516cdf0e10cSrcweir { 517cdf0e10cSrcweir true, IButtonHeight, HelpIds.getHelpIdString(hid + 5), oWizardResource.getResText(UIConsts.RID_COMMON + 11), new Integer(iCancelPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth 518cdf0e10cSrcweir }); 519cdf0e10cSrcweir 520cdf0e10cSrcweir setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE); 521cdf0e10cSrcweir // add a window listener, to know 522cdf0e10cSrcweir // if the user used "escape" key to 523cdf0e10cSrcweir // close the dialog. 524cdf0e10cSrcweir MethodInvocation windowHidden = new MethodInvocation("windowHidden", this); 525cdf0e10cSrcweir xWindow.addWindowListener((CommonListener) getGuiEventListener()); 526cdf0e10cSrcweir String dialogName = (String) Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_NAME); 527cdf0e10cSrcweir getGuiEventListener().add(dialogName, EVENT_ACTION_PERFORMED, windowHidden); 528cdf0e10cSrcweir 529cdf0e10cSrcweir } 530cdf0e10cSrcweir catch (java.lang.Exception jexception) 531cdf0e10cSrcweir { 532cdf0e10cSrcweir jexception.printStackTrace(System.out); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir } 535cdf0e10cSrcweir insertRoadMapItems(String[] items, int[] steps, boolean[] enabled)536cdf0e10cSrcweir protected void insertRoadMapItems(String[] items, int[] steps, boolean[] enabled) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir for (int i = 0; i < items.length; i++) 539cdf0e10cSrcweir { 540cdf0e10cSrcweir insertRoadmapItem(i, enabled[i], items[i], steps[i]); 541cdf0e10cSrcweir } 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir /** This method also enables and disables the "next" button, 545cdf0e10cSrcweir * if the step currently dis/enabled is the one of the next steps. 546cdf0e10cSrcweir * @param _nStep 547cdf0e10cSrcweir * @param bEnabled 548cdf0e10cSrcweir * @param enableNextButton 549cdf0e10cSrcweir */ setStepEnabled(int _nStep, boolean bEnabled, boolean enableNextButton)550cdf0e10cSrcweir public void setStepEnabled(int _nStep, boolean bEnabled, boolean enableNextButton) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir setStepEnabled(_nStep, bEnabled); 553cdf0e10cSrcweir if (getNextAvailableStep() > 0) 554cdf0e10cSrcweir { 555cdf0e10cSrcweir enableNextButton(bEnabled); 556cdf0e10cSrcweir } 557cdf0e10cSrcweir } 558cdf0e10cSrcweir enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish)559cdf0e10cSrcweir public void enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir enableBackButton(_bEnableBack); 562cdf0e10cSrcweir enableNextButton(_bEnableNext); 563cdf0e10cSrcweir enableFinishButton(_bEnableFinish); 564cdf0e10cSrcweir } 565cdf0e10cSrcweir enableBackButton(boolean enabled)566cdf0e10cSrcweir public void enableBackButton(boolean enabled) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir setControlProperty("btnWizardBack", PropertyNames.PROPERTY_ENABLED, enabled ? Boolean.TRUE : Boolean.FALSE); 569cdf0e10cSrcweir } 570cdf0e10cSrcweir enableNextButton(boolean enabled)571cdf0e10cSrcweir public void enableNextButton(boolean enabled) 572cdf0e10cSrcweir { 573cdf0e10cSrcweir setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, enabled ? Boolean.TRUE : Boolean.FALSE); 574cdf0e10cSrcweir } 575cdf0e10cSrcweir enableFinishButton(boolean enabled)576cdf0e10cSrcweir public void enableFinishButton(boolean enabled) 577cdf0e10cSrcweir { 578cdf0e10cSrcweir setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, enabled ? Boolean.TRUE : Boolean.FALSE); 579cdf0e10cSrcweir } 580cdf0e10cSrcweir setStepEnabled(int _nStep, boolean bEnabled)581cdf0e10cSrcweir public void setStepEnabled(int _nStep, boolean bEnabled) 582cdf0e10cSrcweir { 583cdf0e10cSrcweir XInterface xRoadmapItem = getRoadmapItemByID(_nStep); 584cdf0e10cSrcweir if (xRoadmapItem != null) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir Helper.setUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); 587cdf0e10cSrcweir } 588cdf0e10cSrcweir } 589cdf0e10cSrcweir enablefromStep(int _iStep, boolean _bDoEnable)590cdf0e10cSrcweir public void enablefromStep(int _iStep, boolean _bDoEnable) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir if (_iStep <= this.nMaxStep) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir for (int i = _iStep; i <= nMaxStep; i++) 595cdf0e10cSrcweir { 596cdf0e10cSrcweir setStepEnabled(i, _bDoEnable); 597cdf0e10cSrcweir } 598cdf0e10cSrcweir enableFinishButton(_bDoEnable); 599cdf0e10cSrcweir if (!_bDoEnable) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir enableNextButton(_iStep > getCurrentStep() + 1); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir else 604cdf0e10cSrcweir { 605cdf0e10cSrcweir enableNextButton(!(getCurrentStep() == nMaxStep)); 606cdf0e10cSrcweir } 607cdf0e10cSrcweir } 608cdf0e10cSrcweir } 609cdf0e10cSrcweir isStepEnabled(int _nStep)610cdf0e10cSrcweir public boolean isStepEnabled(int _nStep) 611cdf0e10cSrcweir { 612cdf0e10cSrcweir try 613cdf0e10cSrcweir { 614cdf0e10cSrcweir boolean bIsEnabled; 615cdf0e10cSrcweir XInterface xRoadmapItem = getRoadmapItemByID(_nStep); 616cdf0e10cSrcweir if (xRoadmapItem == null) 617cdf0e10cSrcweir // Todo: In this case an exception should be thrown 618cdf0e10cSrcweir { 619cdf0e10cSrcweir return false; 620cdf0e10cSrcweir } 621cdf0e10cSrcweir bIsEnabled = AnyConverter.toBoolean(Helper.getUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED)); 622cdf0e10cSrcweir return bIsEnabled; 623cdf0e10cSrcweir } 624cdf0e10cSrcweir catch (com.sun.star.uno.Exception exception) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir exception.printStackTrace(System.out); 627cdf0e10cSrcweir return false; 628cdf0e10cSrcweir } 629cdf0e10cSrcweir } 630cdf0e10cSrcweir gotoPreviousAvailableStep()631cdf0e10cSrcweir public synchronized void gotoPreviousAvailableStep() 632cdf0e10cSrcweir { 633cdf0e10cSrcweir boolean bIsEnabled; 634cdf0e10cSrcweir if (nNewStep > 1) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir nOldStep = nNewStep; 637cdf0e10cSrcweir nNewStep--; 638cdf0e10cSrcweir while (nNewStep > 0) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir bIsEnabled = isStepEnabled(nNewStep); 641cdf0e10cSrcweir if (bIsEnabled) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir break; 644cdf0e10cSrcweir } 645cdf0e10cSrcweir nNewStep--; 646cdf0e10cSrcweir } 647cdf0e10cSrcweir if (nNewStep == 0) // Exception??? 648cdf0e10cSrcweir { 649cdf0e10cSrcweir nNewStep = nOldStep; 650cdf0e10cSrcweir } 651cdf0e10cSrcweir switchToStep(); 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir 655cdf0e10cSrcweir //TODO discuss with rp getNextAvailableStep()656cdf0e10cSrcweir protected int getNextAvailableStep() 657cdf0e10cSrcweir { 658cdf0e10cSrcweir if (isRoadmapComplete()) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir for (int i = nNewStep + 1; i <= nMaxStep; i++) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir if (isStepEnabled(i)) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir return i; 665cdf0e10cSrcweir } 666cdf0e10cSrcweir } 667cdf0e10cSrcweir } 668cdf0e10cSrcweir return -1; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir gotoNextAvailableStep()671cdf0e10cSrcweir public synchronized void gotoNextAvailableStep() 672cdf0e10cSrcweir { 673cdf0e10cSrcweir nOldStep = nNewStep; 674cdf0e10cSrcweir nNewStep = getNextAvailableStep(); 675cdf0e10cSrcweir if (nNewStep > -1) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir switchToStep(); 678cdf0e10cSrcweir } 679cdf0e10cSrcweir } 680cdf0e10cSrcweir finishWizard()681cdf0e10cSrcweir public abstract boolean finishWizard(); 682cdf0e10cSrcweir 683cdf0e10cSrcweir /** 684cdf0e10cSrcweir * This function will call if the finish button is pressed on the UI. 685cdf0e10cSrcweir */ finishWizard_1()686cdf0e10cSrcweir public void finishWizard_1() 687cdf0e10cSrcweir { 688cdf0e10cSrcweir enableFinishButton(false); 689cdf0e10cSrcweir boolean success = false; 690cdf0e10cSrcweir try 691cdf0e10cSrcweir { 692cdf0e10cSrcweir success = finishWizard(); 693cdf0e10cSrcweir } 694cdf0e10cSrcweir finally 695cdf0e10cSrcweir { 696cdf0e10cSrcweir if ( !success ) 697cdf0e10cSrcweir enableFinishButton( true ); 698cdf0e10cSrcweir } 699cdf0e10cSrcweir if ( success ) 700cdf0e10cSrcweir removeTerminateListener(); 701cdf0e10cSrcweir } 702cdf0e10cSrcweir getMaximalStep()703cdf0e10cSrcweir public int getMaximalStep() 704cdf0e10cSrcweir { 705cdf0e10cSrcweir return this.nMaxStep; 706cdf0e10cSrcweir } 707cdf0e10cSrcweir getCurrentStep()708cdf0e10cSrcweir public int getCurrentStep() 709cdf0e10cSrcweir { 710cdf0e10cSrcweir try 711cdf0e10cSrcweir { 712cdf0e10cSrcweir return AnyConverter.toInt(Helper.getUnoPropertyValue(this.MSFDialogModel, PropertyNames.PROPERTY_STEP)); 713cdf0e10cSrcweir } 714cdf0e10cSrcweir catch (com.sun.star.uno.Exception exception) 715cdf0e10cSrcweir { 716cdf0e10cSrcweir exception.printStackTrace(System.out); 717cdf0e10cSrcweir return -1; 718cdf0e10cSrcweir } 719cdf0e10cSrcweir } 720cdf0e10cSrcweir setCurrentStep(int _nNewstep)721cdf0e10cSrcweir public void setCurrentStep(int _nNewstep) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir nNewStep = _nNewstep; 724cdf0e10cSrcweir changeToStep(nNewStep); 725cdf0e10cSrcweir } 726cdf0e10cSrcweir setRightPaneHeaders(Resource _oResource, int StartResID, int _nMaxStep)727cdf0e10cSrcweir public void setRightPaneHeaders(Resource _oResource, int StartResID, int _nMaxStep) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir String[] sRightPaneHeaders = _oResource.getResArray(StartResID, _nMaxStep); 730cdf0e10cSrcweir setRightPaneHeaders(sRightPaneHeaders); 731cdf0e10cSrcweir } 732cdf0e10cSrcweir setRightPaneHeaders(String[] _sRightPaneHeaders)733cdf0e10cSrcweir public void setRightPaneHeaders(String[] _sRightPaneHeaders) 734cdf0e10cSrcweir { 735cdf0e10cSrcweir this.nMaxStep = _sRightPaneHeaders.length; 736cdf0e10cSrcweir this.sRightPaneHeaders = _sRightPaneHeaders; 737cdf0e10cSrcweir FontDescriptor oFontDesc = new FontDescriptor(); 738cdf0e10cSrcweir oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD; 739cdf0e10cSrcweir 740cdf0e10cSrcweir for (int i = 0; i < sRightPaneHeaders.length; i++) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir insertLabel("lblQueryTitle" + String.valueOf(i), 743cdf0e10cSrcweir new String[] 744cdf0e10cSrcweir { 745cdf0e10cSrcweir PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 746cdf0e10cSrcweir }, 747cdf0e10cSrcweir new Object[] 748cdf0e10cSrcweir { 749cdf0e10cSrcweir oFontDesc, 16, sRightPaneHeaders[i], Boolean.TRUE, 91, 8, new Integer(i + 1), new Short((short) 12), 212 750cdf0e10cSrcweir }); 751cdf0e10cSrcweir } 752cdf0e10cSrcweir } 753cdf0e10cSrcweir cancelWizard()754cdf0e10cSrcweir public void cancelWizard() 755cdf0e10cSrcweir { 756cdf0e10cSrcweir //can be overwritten by extending class 757cdf0e10cSrcweir xDialog.endExecute(); 758cdf0e10cSrcweir } 759cdf0e10cSrcweir callHelp()760cdf0e10cSrcweir public void callHelp() 761cdf0e10cSrcweir { 762cdf0e10cSrcweir //should be overwritten by extending class 763cdf0e10cSrcweir } 764cdf0e10cSrcweir removeTerminateListener()765cdf0e10cSrcweir public void removeTerminateListener() 766cdf0e10cSrcweir { 767cdf0e10cSrcweir if (bTerminateListenermustberemoved) 768cdf0e10cSrcweir { 769cdf0e10cSrcweir Desktop.getDesktop(xMSF).removeTerminateListener(this); 770cdf0e10cSrcweir bTerminateListenermustberemoved = false; 771cdf0e10cSrcweir } 772cdf0e10cSrcweir } 773cdf0e10cSrcweir 774cdf0e10cSrcweir /** 775cdf0e10cSrcweir * called by the cancel button and 776cdf0e10cSrcweir * by the window hidden event. 777cdf0e10cSrcweir * if this method was not called before, 778cdf0e10cSrcweir * perform a cancel. 779cdf0e10cSrcweir */ cancelWizard_1()780cdf0e10cSrcweir public void cancelWizard_1() 781cdf0e10cSrcweir { 782cdf0e10cSrcweir cancelWizard(); 783cdf0e10cSrcweir removeTerminateListener(); 784cdf0e10cSrcweir } 785cdf0e10cSrcweir windowHidden()786cdf0e10cSrcweir public void windowHidden() 787cdf0e10cSrcweir { 788cdf0e10cSrcweir cancelWizard_1(); 789cdf0e10cSrcweir } 790cdf0e10cSrcweir notifyTermination(EventObject arg0)791cdf0e10cSrcweir public void notifyTermination(EventObject arg0) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir cancelWizard_1(); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir queryTermination(EventObject arg0)796cdf0e10cSrcweir public void queryTermination(EventObject arg0) 797cdf0e10cSrcweir throws TerminationVetoException 798cdf0e10cSrcweir { 799cdf0e10cSrcweir activate(); 800cdf0e10cSrcweir throw new TerminationVetoException(); 801cdf0e10cSrcweir } 802cdf0e10cSrcweir disposing(EventObject arg0)803cdf0e10cSrcweir public void disposing(EventObject arg0) 804cdf0e10cSrcweir { 805cdf0e10cSrcweir cancelWizard_1(); 806cdf0e10cSrcweir } 807cdf0e10cSrcweir } 808