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 com.sun.star.awt.FontDescriptor; 26cdf0e10cSrcweir import com.sun.star.awt.XListBox; 27cdf0e10cSrcweir import com.sun.star.wizards.common.*; 28cdf0e10cSrcweir import com.sun.star.wizards.common.JavaTools; 29cdf0e10cSrcweir 30cdf0e10cSrcweir import java.util.*; 31cdf0e10cSrcweir 32cdf0e10cSrcweir /** 33cdf0e10cSrcweir * 34cdf0e10cSrcweir * @author bc93774 35cdf0e10cSrcweir */ 36cdf0e10cSrcweir public class FieldSelection 37cdf0e10cSrcweir { 38cdf0e10cSrcweir public XListBox xFieldsListBox; // Left ListBox 39cdf0e10cSrcweir public XListBox xSelectedFieldsListBox; // right (selected) ListBox 40cdf0e10cSrcweir 41cdf0e10cSrcweir protected UnoDialog CurUnoDialog; 42cdf0e10cSrcweir protected String sIncSuffix; 43cdf0e10cSrcweir protected int FirstHelpIndex; 44cdf0e10cSrcweir protected boolean AppendMode = false; 45cdf0e10cSrcweir protected Integer IStep; 46cdf0e10cSrcweir 47cdf0e10cSrcweir protected int CompPosX; 48cdf0e10cSrcweir protected int CompPosY; 49cdf0e10cSrcweir protected int CompHeight; 50cdf0e10cSrcweir protected int CompWidth; 51cdf0e10cSrcweir 52cdf0e10cSrcweir private XFieldSelectionListener xFieldSelection; 53cdf0e10cSrcweir private int maxfieldcount = 10000000; 54cdf0e10cSrcweir private String[] AllFieldNames; 55cdf0e10cSrcweir private Integer ListBoxWidth; 56cdf0e10cSrcweir 57cdf0e10cSrcweir private Integer SelListBoxPosX; 58cdf0e10cSrcweir 59cdf0e10cSrcweir private boolean bisModified = false; 60cdf0e10cSrcweir 61cdf0e10cSrcweir private final static int SOCMDMOVESEL = 1; 62cdf0e10cSrcweir private final static int SOCMDMOVEALL = 2; 63cdf0e10cSrcweir private final static int SOCMDREMOVESEL = 3; 64cdf0e10cSrcweir private final static int SOCMDREMOVEALL = 4; 65cdf0e10cSrcweir private final static int SOCMDMOVEUP = 5; 66cdf0e10cSrcweir private final static int SOCMDMOVEDOWN = 6; 67cdf0e10cSrcweir private final static int SOFLDSLST = 7; 68cdf0e10cSrcweir private final static int SOSELFLDSLST = 8; 69cdf0e10cSrcweir 70cdf0e10cSrcweir 71cdf0e10cSrcweir class ItemListenerImpl implements com.sun.star.awt.XItemListener 72cdf0e10cSrcweir { 73cdf0e10cSrcweir itemStateChanged(com.sun.star.awt.ItemEvent EventObject)74cdf0e10cSrcweir public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir // int iPos; 77cdf0e10cSrcweir com.sun.star.wizards.common.Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); 78cdf0e10cSrcweir int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); 79cdf0e10cSrcweir switch (iKey) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir 82cdf0e10cSrcweir case SOFLDSLST: 83cdf0e10cSrcweir toggleListboxButtons((short) - 1, (short) - 1); 84cdf0e10cSrcweir break; 85cdf0e10cSrcweir 86cdf0e10cSrcweir case SOSELFLDSLST: 87cdf0e10cSrcweir toggleListboxButtons((short) - 1, (short) - 1); 88cdf0e10cSrcweir break; 89cdf0e10cSrcweir default: 90cdf0e10cSrcweir break; 91cdf0e10cSrcweir } 92cdf0e10cSrcweir com.sun.star.wizards.common.Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); 93cdf0e10cSrcweir } 94cdf0e10cSrcweir disposing(com.sun.star.lang.EventObject eventObject)95cdf0e10cSrcweir public void disposing(com.sun.star.lang.EventObject eventObject) 96cdf0e10cSrcweir { 97cdf0e10cSrcweir } 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir class ActionListenerImpl implements com.sun.star.awt.XActionListener 101cdf0e10cSrcweir { 102cdf0e10cSrcweir disposing(com.sun.star.lang.EventObject eventObject)103cdf0e10cSrcweir public void disposing(com.sun.star.lang.EventObject eventObject) 104cdf0e10cSrcweir { 105cdf0e10cSrcweir } 106cdf0e10cSrcweir actionPerformed(com.sun.star.awt.ActionEvent actionEvent)107cdf0e10cSrcweir public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir try 110cdf0e10cSrcweir { 111cdf0e10cSrcweir int iKey = CurUnoDialog.getControlKey(actionEvent.Source, CurUnoDialog.ControlList); 112cdf0e10cSrcweir switch (iKey) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir case SOFLDSLST: 115cdf0e10cSrcweir selectFields(false); 116cdf0e10cSrcweir break; 117cdf0e10cSrcweir 118cdf0e10cSrcweir case SOSELFLDSLST: 119cdf0e10cSrcweir deselectFields(false); 120cdf0e10cSrcweir break; 121cdf0e10cSrcweir 122cdf0e10cSrcweir case SOCMDMOVESEL: 123cdf0e10cSrcweir selectFields(false); 124cdf0e10cSrcweir break; 125cdf0e10cSrcweir 126cdf0e10cSrcweir case SOCMDMOVEALL: 127cdf0e10cSrcweir selectFields(true); 128cdf0e10cSrcweir break; 129cdf0e10cSrcweir 130cdf0e10cSrcweir case SOCMDREMOVESEL: 131cdf0e10cSrcweir deselectFields(false); 132cdf0e10cSrcweir break; 133cdf0e10cSrcweir 134cdf0e10cSrcweir case SOCMDREMOVEALL: 135cdf0e10cSrcweir deselectFields(true); 136cdf0e10cSrcweir break; 137cdf0e10cSrcweir 138cdf0e10cSrcweir case SOCMDMOVEUP: 139cdf0e10cSrcweir changeSelectionOrder(-1); 140cdf0e10cSrcweir break; 141cdf0e10cSrcweir 142cdf0e10cSrcweir case SOCMDMOVEDOWN: 143cdf0e10cSrcweir changeSelectionOrder(1); 144cdf0e10cSrcweir break; 145cdf0e10cSrcweir 146cdf0e10cSrcweir default: 147cdf0e10cSrcweir // System.err.println( exception); 148cdf0e10cSrcweir break; 149cdf0e10cSrcweir } 150cdf0e10cSrcweir } 151cdf0e10cSrcweir catch (Exception exception) 152cdf0e10cSrcweir { 153cdf0e10cSrcweir exception.printStackTrace(System.out); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir } 156cdf0e10cSrcweir } 157cdf0e10cSrcweir addFieldSelectionListener(XFieldSelectionListener xFieldSelection)158cdf0e10cSrcweir public void addFieldSelectionListener(XFieldSelectionListener xFieldSelection) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir this.xFieldSelection = xFieldSelection; 161cdf0e10cSrcweir this.xFieldSelection.setID(sIncSuffix); 162cdf0e10cSrcweir } 163cdf0e10cSrcweir setAppendMode(boolean _AppendMode)164cdf0e10cSrcweir public void setAppendMode(boolean _AppendMode) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir AppendMode = _AppendMode; 167cdf0e10cSrcweir } 168cdf0e10cSrcweir getAppendMode()169cdf0e10cSrcweir public boolean getAppendMode() 170cdf0e10cSrcweir { 171cdf0e10cSrcweir return AppendMode; 172cdf0e10cSrcweir } 173cdf0e10cSrcweir FieldSelection(UnoDialog CurUnoDialog, int _iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons)174cdf0e10cSrcweir public FieldSelection(UnoDialog CurUnoDialog, int _iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir try 177cdf0e10cSrcweir { 178cdf0e10cSrcweir final String AccessTextMoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 39); 179cdf0e10cSrcweir final String AccessTextRemoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 40); 180cdf0e10cSrcweir final String AccessTextMoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 41); 181cdf0e10cSrcweir final String AccessTextRemoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 42); 182cdf0e10cSrcweir final String AccessMoveFieldUp = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 43); 183cdf0e10cSrcweir final String AccessMoveFieldDown = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 44); 184cdf0e10cSrcweir 185cdf0e10cSrcweir FirstHelpIndex = _FirstHelpIndex; 186cdf0e10cSrcweir short curtabindex = UnoDialog.setInitialTabindex(_iStep); 187cdf0e10cSrcweir int ShiftButtonCount = 2; 188cdf0e10cSrcweir int a = 0; 189cdf0e10cSrcweir this.CurUnoDialog = CurUnoDialog; 190cdf0e10cSrcweir this.CompPosX = CompPosX; 191cdf0e10cSrcweir this.CompPosY = CompPosY; 192cdf0e10cSrcweir this.CompHeight = CompHeight; 193cdf0e10cSrcweir this.CompWidth = CompWidth; 194cdf0e10cSrcweir Object btnmoveall = null; 195cdf0e10cSrcweir Object btnremoveall = null; 196cdf0e10cSrcweir 197cdf0e10cSrcweir final int cmdButtonWidth = 16; 198cdf0e10cSrcweir final int cmdButtonHoriDist = 4; 199cdf0e10cSrcweir final int lblHeight = 8; 200cdf0e10cSrcweir final int lblVertiDist = 2; 201cdf0e10cSrcweir 202cdf0e10cSrcweir ListBoxWidth = new Integer(((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2)); 203cdf0e10cSrcweir Integer cmdShiftButtonPosX = new Integer((CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist)); 204cdf0e10cSrcweir Integer ListBoxPosY = new Integer(CompPosY + lblVertiDist + lblHeight); 205cdf0e10cSrcweir Integer ListBoxHeight = new Integer(CompHeight - 8 - 2); 206cdf0e10cSrcweir SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist); 207cdf0e10cSrcweir 208cdf0e10cSrcweir IStep = new Integer(_iStep); 209cdf0e10cSrcweir if (bshowFourButtons) 210cdf0e10cSrcweir { 211cdf0e10cSrcweir ShiftButtonCount = 4; 212cdf0e10cSrcweir } 213cdf0e10cSrcweir Integer[] ShiftButtonPosY = getYButtonPositions(ShiftButtonCount); 214cdf0e10cSrcweir Integer[] MoveButtonPosY = getYButtonPositions(2); 215cdf0e10cSrcweir Integer cmdMoveButtonPosX = new Integer(SelListBoxPosX.intValue() + ListBoxWidth.intValue() + cmdButtonHoriDist); 216cdf0e10cSrcweir 217cdf0e10cSrcweir Integer CmdButtonWidth = new Integer(cmdButtonWidth); 218cdf0e10cSrcweir 219cdf0e10cSrcweir sIncSuffix = "_" + com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "lblFields_"); 220cdf0e10cSrcweir 221cdf0e10cSrcweir // Label 222cdf0e10cSrcweir CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblFields" + sIncSuffix, 223cdf0e10cSrcweir new String[] 224cdf0e10cSrcweir { 225cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 226cdf0e10cSrcweir }, 227cdf0e10cSrcweir new Object[] 228cdf0e10cSrcweir { 229cdf0e10cSrcweir 8, slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), 109 230cdf0e10cSrcweir }); 231cdf0e10cSrcweir 232cdf0e10cSrcweir // Listbox 'Available fields' 233cdf0e10cSrcweir xFieldsListBox = CurUnoDialog.insertListBox("lstFields" + sIncSuffix, SOFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), 234cdf0e10cSrcweir new String[] 235cdf0e10cSrcweir { 236cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "MultiSelection", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 237cdf0e10cSrcweir }, 238cdf0e10cSrcweir new Object[] 239cdf0e10cSrcweir { 240cdf0e10cSrcweir ListBoxHeight, HelpIds.getHelpIdString(_FirstHelpIndex), Boolean.TRUE, new Integer(CompPosX), ListBoxPosY, IStep, new Short((curtabindex++)), ListBoxWidth 241cdf0e10cSrcweir }); 242cdf0e10cSrcweir 243cdf0e10cSrcweir Object btnmoveselected = CurUnoDialog.insertButton("cmdMoveSelected" + sIncSuffix, SOCMDMOVESEL, new ActionListenerImpl(), 244cdf0e10cSrcweir new String[] 245cdf0e10cSrcweir { 246cdf0e10cSrcweir PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 247cdf0e10cSrcweir }, 248cdf0e10cSrcweir new Object[] 249cdf0e10cSrcweir { 250cdf0e10cSrcweir Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth 251cdf0e10cSrcweir }); 252cdf0e10cSrcweir 253cdf0e10cSrcweir if (bshowFourButtons) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir btnmoveall = CurUnoDialog.insertButton("cmdMoveAll" + sIncSuffix, SOCMDMOVEALL, new ActionListenerImpl(), 256cdf0e10cSrcweir new String[] 257cdf0e10cSrcweir { 258cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 259cdf0e10cSrcweir }, 260cdf0e10cSrcweir new Object[] 261cdf0e10cSrcweir { 262cdf0e10cSrcweir 14, HelpIds.getHelpIdString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth 263cdf0e10cSrcweir }); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir Object btnremoveselected = CurUnoDialog.insertButton("cmdRemoveSelected" + sIncSuffix, SOCMDREMOVESEL, new ActionListenerImpl(), 266cdf0e10cSrcweir new String[] 267cdf0e10cSrcweir { 268cdf0e10cSrcweir PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 269cdf0e10cSrcweir }, 270cdf0e10cSrcweir new Object[] 271cdf0e10cSrcweir { 272cdf0e10cSrcweir Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth 273cdf0e10cSrcweir }); 274cdf0e10cSrcweir 275cdf0e10cSrcweir if (bshowFourButtons) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir btnremoveall = CurUnoDialog.insertButton("cmdRemoveAll" + sIncSuffix, SOCMDREMOVEALL, new ActionListenerImpl(), 278cdf0e10cSrcweir new String[] 279cdf0e10cSrcweir { 280cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 281cdf0e10cSrcweir }, 282cdf0e10cSrcweir new Object[] 283cdf0e10cSrcweir { 284cdf0e10cSrcweir 14, HelpIds.getHelpIdString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth 285cdf0e10cSrcweir }); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir FontDescriptor oFontDesc = new FontDescriptor(); 289cdf0e10cSrcweir oFontDesc.Name = "StarSymbol"; 290cdf0e10cSrcweir 291cdf0e10cSrcweir // Label 'Fields in the form' 292cdf0e10cSrcweir CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelFields" + sIncSuffix, 293cdf0e10cSrcweir new String[] 294cdf0e10cSrcweir { 295cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 296cdf0e10cSrcweir }, 297cdf0e10cSrcweir new Object[] 298cdf0e10cSrcweir { 299cdf0e10cSrcweir 8, slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth 300cdf0e10cSrcweir }); 301cdf0e10cSrcweir 302cdf0e10cSrcweir // ListBox 'Fields in the form' 303cdf0e10cSrcweir xSelectedFieldsListBox = CurUnoDialog.insertListBox("lstSelFields" + sIncSuffix, SOSELFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), 304cdf0e10cSrcweir new String[] 305cdf0e10cSrcweir { 306cdf0e10cSrcweir PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "MultiSelection", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 307cdf0e10cSrcweir }, 308cdf0e10cSrcweir new Object[] 309cdf0e10cSrcweir { 310cdf0e10cSrcweir ListBoxHeight, HelpIds.getHelpIdString(_FirstHelpIndex + 5), Boolean.TRUE, SelListBoxPosX, ListBoxPosY, IStep, new Short(curtabindex++), ListBoxWidth 311cdf0e10cSrcweir }); 312cdf0e10cSrcweir 313cdf0e10cSrcweir Object btnmoveup = CurUnoDialog.insertButton("cmdMoveUp" + sIncSuffix, SOCMDMOVEUP, new ActionListenerImpl(), 314cdf0e10cSrcweir new String[] 315cdf0e10cSrcweir { 316cdf0e10cSrcweir PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 317cdf0e10cSrcweir }, 318cdf0e10cSrcweir new Object[] 319cdf0e10cSrcweir { 320cdf0e10cSrcweir Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, new Short(curtabindex++), CmdButtonWidth 321cdf0e10cSrcweir }); 322cdf0e10cSrcweir 323cdf0e10cSrcweir Object btnmovedown = CurUnoDialog.insertButton("cmdMoveDown" + sIncSuffix, SOCMDMOVEDOWN, new ActionListenerImpl(), 324cdf0e10cSrcweir new String[] 325cdf0e10cSrcweir { 326cdf0e10cSrcweir PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 327cdf0e10cSrcweir }, 328cdf0e10cSrcweir new Object[] 329cdf0e10cSrcweir { 330cdf0e10cSrcweir Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, new Short(curtabindex++), CmdButtonWidth 331cdf0e10cSrcweir }); 332cdf0e10cSrcweir 333cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveselected, AccessTextMoveSelected); 334cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(btnremoveselected, AccessTextRemoveSelected); 335cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(xFieldsListBox, JavaTools.replaceSubString(slblFields, PropertyNames.EMPTY_STRING, "~")); 336cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(xSelectedFieldsListBox, JavaTools.replaceSubString(slblSelFields, PropertyNames.EMPTY_STRING, "~")); 337cdf0e10cSrcweir if (btnmoveall != null) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveall, AccessTextMoveAll); 340cdf0e10cSrcweir } 341cdf0e10cSrcweir if (btnremoveall != null) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(btnremoveall, AccessTextRemoveAll); 344cdf0e10cSrcweir } 345cdf0e10cSrcweir if (btnmoveup != null) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveup, AccessMoveFieldUp); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir if (btnmovedown != null) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmovedown, AccessMoveFieldDown); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir 354cdf0e10cSrcweir } 355cdf0e10cSrcweir catch (Exception exception) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir exception.printStackTrace(System.out); 358cdf0e10cSrcweir } 359cdf0e10cSrcweir } 360cdf0e10cSrcweir 361cdf0e10cSrcweir // Todo: If Value is getting smaller than zero -> throw exception getYButtonPositions(int ButtonCount)362cdf0e10cSrcweir private Integer[] getYButtonPositions(int ButtonCount) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir Integer[] YPosArray; 365cdf0e10cSrcweir if (ButtonCount > 0) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir YPosArray = new Integer[ButtonCount]; 368cdf0e10cSrcweir final int cmdButtonHeight = 14; 369cdf0e10cSrcweir final int cmdButtonVertiDist = 2; 370cdf0e10cSrcweir 371cdf0e10cSrcweir YPosArray[0] = new Integer( (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2))); 372cdf0e10cSrcweir if (ButtonCount > 1) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir for (int i = 1; i < ButtonCount; i++) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir YPosArray[i] = new Integer(YPosArray[i - 1].intValue() + cmdButtonHeight + cmdButtonVertiDist); 377cdf0e10cSrcweir } 378cdf0e10cSrcweir } 379cdf0e10cSrcweir return YPosArray; 380cdf0e10cSrcweir } 381cdf0e10cSrcweir return null; 382cdf0e10cSrcweir } 383cdf0e10cSrcweir getListboxWidth()384cdf0e10cSrcweir public Integer getListboxWidth() 385cdf0e10cSrcweir { 386cdf0e10cSrcweir return this.ListBoxWidth; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir changeSelectionOrder(int iNeighbor)389cdf0e10cSrcweir private void changeSelectionOrder(int iNeighbor) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir short[] iSelIndices = xSelectedFieldsListBox.getSelectedItemsPos(); 392cdf0e10cSrcweir // Todo: we are assuming that the array starts with the lowest index. Verfy this assumption!!!!! 393cdf0e10cSrcweir if (iSelIndices.length == 1) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir short iSelIndex = iSelIndices[0]; 396cdf0e10cSrcweir String[] NewItemList = xSelectedFieldsListBox.getItems(); 397cdf0e10cSrcweir String CurItem = NewItemList[iSelIndex]; 398cdf0e10cSrcweir String NeighborItem = NewItemList[iSelIndex + iNeighbor]; 399cdf0e10cSrcweir NewItemList[iSelIndex + iNeighbor] = CurItem; 400cdf0e10cSrcweir NewItemList[iSelIndex] = NeighborItem; 401cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, NewItemList); 402cdf0e10cSrcweir xSelectedFieldsListBox.selectItem(CurItem, true); 403cdf0e10cSrcweir if (xFieldSelection != null) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir if (iNeighbor < 0) 406cdf0e10cSrcweir { 407cdf0e10cSrcweir xFieldSelection.moveItemUp(CurItem); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir else 410cdf0e10cSrcweir { 411cdf0e10cSrcweir xFieldSelection.moveItemDown(CurItem); 412cdf0e10cSrcweir } 413cdf0e10cSrcweir } 414cdf0e10cSrcweir } 415cdf0e10cSrcweir } 416cdf0e10cSrcweir toggleListboxControls(Boolean BDoEnable)417cdf0e10cSrcweir public void toggleListboxControls(Boolean BDoEnable) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir try 420cdf0e10cSrcweir { 421cdf0e10cSrcweir CurUnoDialog.setControlProperty("lblFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); 422cdf0e10cSrcweir CurUnoDialog.setControlProperty("lblSelFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); 423cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); 424cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); 425cdf0e10cSrcweir 426cdf0e10cSrcweir if (BDoEnable.booleanValue()) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir toggleListboxButtons((short) - 1, (short) - 1); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir else 431cdf0e10cSrcweir { 432cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); 433cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable); 434cdf0e10cSrcweir toggleMoveButtons(BDoEnable.booleanValue(), BDoEnable.booleanValue()); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir } 437cdf0e10cSrcweir catch (Exception exception) 438cdf0e10cSrcweir { 439cdf0e10cSrcweir exception.printStackTrace(System.out); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir // Enable or disable the buttons used for moving the available 444cdf0e10cSrcweir // fields between the two list boxes. toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex)445cdf0e10cSrcweir protected void toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex) 446cdf0e10cSrcweir { 447cdf0e10cSrcweir try 448cdf0e10cSrcweir { 449cdf0e10cSrcweir boolean bmoveUpenabled = false; 450cdf0e10cSrcweir boolean bmoveDownenabled = false; 451cdf0e10cSrcweir CurUnoDialog.selectListBoxItem(xFieldsListBox, iFieldsSelIndex); 452cdf0e10cSrcweir CurUnoDialog.selectListBoxItem(xSelectedFieldsListBox, iSelFieldsSelIndex); 453cdf0e10cSrcweir int SelListBoxSelLength = xSelectedFieldsListBox.getSelectedItems().length; 454cdf0e10cSrcweir int ListBoxSelLength = xFieldsListBox.getSelectedItems().length; 455cdf0e10cSrcweir boolean bIsFieldSelected = (ListBoxSelLength > 0); 456cdf0e10cSrcweir int FieldCount = xFieldsListBox.getItemCount(); 457cdf0e10cSrcweir boolean bSelectSelected = (SelListBoxSelLength > 0); 458cdf0e10cSrcweir int SelectCount = xSelectedFieldsListBox.getItemCount(); 459cdf0e10cSrcweir if (bSelectSelected) 460cdf0e10cSrcweir { 461cdf0e10cSrcweir short[] iSelIndices = xSelectedFieldsListBox.getSelectedItemsPos(); 462cdf0e10cSrcweir bmoveUpenabled = ((iSelIndices[0] > 0) && (iSelIndices.length == 1)); 463cdf0e10cSrcweir bmoveDownenabled = (((iSelIndices[SelListBoxSelLength - 1]) < (short) (SelectCount - 1)) && (iSelIndices.length == 1)); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(SelectCount >= 1)); 466cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bSelectSelected)); 467cdf0e10cSrcweir toggleMoveButtons((FieldCount >= 1), bIsFieldSelected); 468cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdMoveUp" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bmoveUpenabled)); 469cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdMoveDown" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bmoveDownenabled)); 470cdf0e10cSrcweir } 471cdf0e10cSrcweir catch (Exception exception) 472cdf0e10cSrcweir { 473cdf0e10cSrcweir exception.printStackTrace(System.out); 474cdf0e10cSrcweir } 475cdf0e10cSrcweir } 476cdf0e10cSrcweir toggleMoveButtons(boolean _btoggleMoveAll, boolean _btoggleMoveSelected)477cdf0e10cSrcweir protected void toggleMoveButtons(boolean _btoggleMoveAll, boolean _btoggleMoveSelected) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir boolean btoggleMoveAll = (((xFieldsListBox.getItemCount() + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveAll)); 480cdf0e10cSrcweir boolean btoggleMoveSelected = (((xFieldsListBox.getSelectedItems().length + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveSelected)); 481cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(btoggleMoveAll)); 482cdf0e10cSrcweir CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(btoggleMoveSelected)); 483cdf0e10cSrcweir } 484cdf0e10cSrcweir setMultipleMode(boolean _bisMultiple)485cdf0e10cSrcweir public void setMultipleMode(boolean _bisMultiple) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir xFieldsListBox.setMultipleMode(_bisMultiple); 488cdf0e10cSrcweir xSelectedFieldsListBox.setMultipleMode(_bisMultiple); 489cdf0e10cSrcweir } 490cdf0e10cSrcweir emptyFieldsListBoxes()491cdf0e10cSrcweir public void emptyFieldsListBoxes() 492cdf0e10cSrcweir { 493cdf0e10cSrcweir try 494cdf0e10cSrcweir { 495cdf0e10cSrcweir toggleListboxControls(Boolean.FALSE); 496cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, new String[] 497cdf0e10cSrcweir { 498cdf0e10cSrcweir }); 499cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, new String[] 500cdf0e10cSrcweir { 501cdf0e10cSrcweir }); 502cdf0e10cSrcweir } 503cdf0e10cSrcweir catch (Exception exception) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir exception.printStackTrace(System.out); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir } 508cdf0e10cSrcweir mergeList(String[] AllFieldNames, String[] SecondList)509cdf0e10cSrcweir public void mergeList(String[] AllFieldNames, String[] SecondList) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir // int MaxIndex = SecondList.length; 512cdf0e10cSrcweir xFieldsListBox.addItems(AllFieldNames, (short) 0); 513cdf0e10cSrcweir toggleListboxButtons((short) - 1, (short) - 1); 514cdf0e10cSrcweir } 515cdf0e10cSrcweir intializeSelectedFields(String[] _SelectedFieldNames)516cdf0e10cSrcweir public void intializeSelectedFields(String[] _SelectedFieldNames) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir xSelectedFieldsListBox.addItems(_SelectedFieldNames, xSelectedFieldsListBox.getItemCount()); 519cdf0e10cSrcweir } 520cdf0e10cSrcweir removeAllItems(XListBox _xListBox)521cdf0e10cSrcweir private void removeAllItems(XListBox _xListBox) 522cdf0e10cSrcweir { 523cdf0e10cSrcweir _xListBox.removeItems((short) 0, _xListBox.getItemCount()); 524cdf0e10cSrcweir } 525cdf0e10cSrcweir 526cdf0e10cSrcweir // Note Boolean Parameter initialize(String[] _AllFieldNames, boolean _AppendMode)527cdf0e10cSrcweir public void initialize(String[] _AllFieldNames, boolean _AppendMode) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir AppendMode = _AppendMode; 530cdf0e10cSrcweir removeAllItems(xFieldsListBox); 531cdf0e10cSrcweir xFieldsListBox.addItems(_AllFieldNames, (short) 0); 532cdf0e10cSrcweir AllFieldNames = xFieldsListBox.getItems(); 533cdf0e10cSrcweir if ((xSelectedFieldsListBox.getItemCount() > 0) && (!AppendMode)) 534cdf0e10cSrcweir { 535cdf0e10cSrcweir removeAllItems(xSelectedFieldsListBox); 536cdf0e10cSrcweir } 537cdf0e10cSrcweir toggleListboxControls(Boolean.TRUE); 538cdf0e10cSrcweir } 539cdf0e10cSrcweir initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount)540cdf0e10cSrcweir public void initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount) 541cdf0e10cSrcweir { 542cdf0e10cSrcweir String[] AllFieldNames_ = new String[_AllFieldNamesTable.length]; 543cdf0e10cSrcweir for (int i = 0; i < _AllFieldNamesTable.length; i++) 544cdf0e10cSrcweir { 545cdf0e10cSrcweir AllFieldNames_[i] = _AllFieldNamesTable[i][0]; 546cdf0e10cSrcweir } 547cdf0e10cSrcweir initialize(AllFieldNames_, _AppendMode, _maxfieldcount); 548cdf0e10cSrcweir } 549cdf0e10cSrcweir initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount)550cdf0e10cSrcweir public void initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir maxfieldcount = _maxfieldcount; 553cdf0e10cSrcweir initialize(_AllFieldNames, _AppendMode); 554cdf0e10cSrcweir } 555cdf0e10cSrcweir initialize(String[] _AllFieldNames, String[] _SelFieldNames, boolean _AppendMode)556cdf0e10cSrcweir public void initialize(String[] _AllFieldNames, String[] _SelFieldNames, boolean _AppendMode) 557cdf0e10cSrcweir { 558cdf0e10cSrcweir removeAllItems(xSelectedFieldsListBox); 559cdf0e10cSrcweir xSelectedFieldsListBox.addItems(_SelFieldNames, (short) 0); 560cdf0e10cSrcweir initialize(_AllFieldNames, _AppendMode); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir selectFields(boolean bMoveAll)563cdf0e10cSrcweir public void selectFields(boolean bMoveAll) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir // int CurIndex; 566cdf0e10cSrcweir short iFieldSelected = (short) - 1; 567cdf0e10cSrcweir short iSelFieldSelected = (short) - 1; 568cdf0e10cSrcweir // int MaxCurTarget = xSelectedFieldsListBox.getItemCount(); 569cdf0e10cSrcweir String[] SelFieldItems; 570cdf0e10cSrcweir if (bMoveAll) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir SelFieldItems = xFieldsListBox.getItems(); 573cdf0e10cSrcweir removeAllItems(xFieldsListBox); 574cdf0e10cSrcweir if (!AppendMode) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir removeAllItems(xSelectedFieldsListBox); 577cdf0e10cSrcweir xSelectedFieldsListBox.addItems(AllFieldNames, (short) 0); 578cdf0e10cSrcweir } 579cdf0e10cSrcweir else 580cdf0e10cSrcweir { 581cdf0e10cSrcweir xSelectedFieldsListBox.addItems(SelFieldItems, xSelectedFieldsListBox.getItemCount()); 582cdf0e10cSrcweir } 583cdf0e10cSrcweir } 584cdf0e10cSrcweir else 585cdf0e10cSrcweir { 586cdf0e10cSrcweir SelFieldItems = xFieldsListBox.getSelectedItems(); 587cdf0e10cSrcweir int MaxSourceSelected = SelFieldItems.length; 588cdf0e10cSrcweir if (MaxSourceSelected > 0) 589cdf0e10cSrcweir { 590cdf0e10cSrcweir iFieldSelected = xFieldsListBox.getSelectedItemPos(); 591cdf0e10cSrcweir iSelFieldSelected = xSelectedFieldsListBox.getSelectedItemPos(); 592cdf0e10cSrcweir short[] SourceSelList = new short[xFieldsListBox.getSelectedItemsPos().length]; 593cdf0e10cSrcweir SourceSelList = xFieldsListBox.getSelectedItemsPos(); 594cdf0e10cSrcweir xSelectedFieldsListBox.addItems(SelFieldItems, xSelectedFieldsListBox.getItemCount()); 595cdf0e10cSrcweir CurUnoDialog.removeSelectedItems(xFieldsListBox); 596cdf0e10cSrcweir xSelectedFieldsListBox.selectItemPos((short) 0, xSelectedFieldsListBox.getSelectedItems().length > 0); 597cdf0e10cSrcweir } 598cdf0e10cSrcweir } 599cdf0e10cSrcweir toggleListboxButtons(iFieldSelected, iSelFieldSelected); 600cdf0e10cSrcweir if (xFieldSelection != null) 601cdf0e10cSrcweir { 602cdf0e10cSrcweir xFieldSelection.shiftFromLeftToRight(SelFieldItems, xSelectedFieldsListBox.getItems()); 603cdf0e10cSrcweir } 604cdf0e10cSrcweir } 605cdf0e10cSrcweir deselectFields(boolean bMoveAll)606cdf0e10cSrcweir public void deselectFields(boolean bMoveAll) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir // int m = 0; 609cdf0e10cSrcweir String SearchString; 610cdf0e10cSrcweir short iOldFieldSelected = xFieldsListBox.getSelectedItemPos(); 611cdf0e10cSrcweir short iOldSelFieldSelected = xSelectedFieldsListBox.getSelectedItemPos(); 612cdf0e10cSrcweir String[] OldSelFieldItems = xSelectedFieldsListBox.getSelectedItems(); 613cdf0e10cSrcweir if (bMoveAll) 614cdf0e10cSrcweir { 615cdf0e10cSrcweir OldSelFieldItems = xSelectedFieldsListBox.getItems(); 616cdf0e10cSrcweir removeAllItems(xFieldsListBox); 617cdf0e10cSrcweir xFieldsListBox.addItems(AllFieldNames, (short) 0); 618cdf0e10cSrcweir removeAllItems(xSelectedFieldsListBox); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir else 621cdf0e10cSrcweir { 622cdf0e10cSrcweir int MaxOriginalCount = AllFieldNames.length; 623cdf0e10cSrcweir // int MaxSelected = OldSelFieldItems.length; 624cdf0e10cSrcweir String[] SelList = xFieldsListBox.getItems(); 625cdf0e10cSrcweir Vector<String> NewSourceVector = new Vector<String>(); 626cdf0e10cSrcweir for (int i = 0; i < MaxOriginalCount; i++) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir SearchString = AllFieldNames[i]; 629cdf0e10cSrcweir if (JavaTools.FieldInList(SelList, SearchString) != -1) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir NewSourceVector.addElement(SearchString); 632cdf0e10cSrcweir } 633cdf0e10cSrcweir else if (JavaTools.FieldInList(OldSelFieldItems, SearchString) != -1) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir NewSourceVector.addElement(SearchString); 636cdf0e10cSrcweir } 637cdf0e10cSrcweir } 638cdf0e10cSrcweir xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount()); 639cdf0e10cSrcweir if (NewSourceVector.size() > 0) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir String[] NewSourceList = new String[NewSourceVector.size()]; 642cdf0e10cSrcweir NewSourceVector.toArray(NewSourceList); 643cdf0e10cSrcweir xFieldsListBox.addItems(NewSourceList, (short) 0); 644cdf0e10cSrcweir } 645cdf0e10cSrcweir CurUnoDialog.removeSelectedItems(xSelectedFieldsListBox); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir toggleListboxButtons(iOldFieldSelected, iOldSelFieldSelected); 648cdf0e10cSrcweir String[] NewSelFieldItems = xSelectedFieldsListBox.getItems(); 649cdf0e10cSrcweir if (xFieldSelection != null) 650cdf0e10cSrcweir { 651cdf0e10cSrcweir xFieldSelection.shiftFromRightToLeft(OldSelFieldItems, NewSelFieldItems); 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir addItemsToFieldsListbox(String[] _sItems)655cdf0e10cSrcweir public void addItemsToFieldsListbox(String[] _sItems) 656cdf0e10cSrcweir { 657cdf0e10cSrcweir String[] sOldList = xFieldsListBox.getItems(); 658cdf0e10cSrcweir for (int i = 0; i < _sItems.length; i++) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir if (JavaTools.FieldInList(sOldList, _sItems[i]) < 0) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir xFieldsListBox.addItem(_sItems[i], xFieldsListBox.getItemCount()); 663cdf0e10cSrcweir } 664cdf0e10cSrcweir } 665cdf0e10cSrcweir } 666cdf0e10cSrcweir getSelectedFieldNames()667cdf0e10cSrcweir public String[] getSelectedFieldNames() 668cdf0e10cSrcweir { 669cdf0e10cSrcweir return (String[]) CurUnoDialog.getControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST); 670cdf0e10cSrcweir } 671cdf0e10cSrcweir setSelectedFieldNames(String[] _sfieldnames)672cdf0e10cSrcweir public void setSelectedFieldNames(String[] _sfieldnames) 673cdf0e10cSrcweir { 674cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, _sfieldnames); 675cdf0e10cSrcweir String[] sleftboxfieldnames = JavaTools.removefromList(xFieldsListBox.getItems(), _sfieldnames); 676cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, sleftboxfieldnames); 677cdf0e10cSrcweir } 678cdf0e10cSrcweir setModified(boolean _bModified)679cdf0e10cSrcweir public void setModified(boolean _bModified) 680cdf0e10cSrcweir { 681cdf0e10cSrcweir bisModified = _bModified; 682cdf0e10cSrcweir } 683cdf0e10cSrcweir isModified()684cdf0e10cSrcweir public boolean isModified() 685cdf0e10cSrcweir { 686cdf0e10cSrcweir return bisModified; 687cdf0e10cSrcweir } 688cdf0e10cSrcweir changeSelectedFieldNames(String[] _sfieldnames)689cdf0e10cSrcweir public void changeSelectedFieldNames(String[] _sfieldnames) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, _sfieldnames); 692cdf0e10cSrcweir } 693cdf0e10cSrcweir } 694