bump product version to 5.0.4.1
[LibreOffice.git] / wizards / com / sun / star / wizards / form / Finalizer.java
blobef2541d2d56ada97f3a3389c9caeace6e181f836
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 package com.sun.star.wizards.form;
20 import com.sun.star.awt.TextEvent;
21 import com.sun.star.awt.XRadioButton;
22 import com.sun.star.awt.XTextComponent;
23 import com.sun.star.wizards.common.Desktop;
24 import com.sun.star.wizards.common.PropertyNames;
25 import com.sun.star.wizards.ui.*;
26 import com.sun.star.wizards.ui.event.XTextListenerAdapter;
28 /**
30 * To change the template for this generated type comment go to
31 * Window>Preferences>Java>Code Generation>Code and Comments
33 public class Finalizer
36 private WizardDialog CurUnoDialog;
37 private XRadioButton optModifyForm;
38 private XTextComponent txtFormName;
39 private FormDocument oFormDocument;
41 public Finalizer(WizardDialog _CurUnoDialog)
43 this.CurUnoDialog = _CurUnoDialog;
44 short curtabindex = (short) (FormWizard.SOSTORE_PAGE * 100);
46 String slblFormName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 50);
47 String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 51);
48 String sWorkWithForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 52);
49 String sModifyForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 53);
50 CurUnoDialog.insertLabel("lblFormName",
51 new String[]
53 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
55 new Object[]
57 UIConsts.INTEGERS[8], slblFormName, 97, 25, UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 111
58 });
59 txtFormName = CurUnoDialog.insertTextField("txtFormName", new XTextListenerAdapter() {
60 @Override
61 public void textChanged(TextEvent event) {
62 toggleFinishButton();
65 new String[]
67 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH
69 new Object[]
71 UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], Short.valueOf((short) 82), PropertyNames.EMPTY_STRING, 185
72 });
73 CurUnoDialog.insertLabel("lblProceed",
74 new String[]
76 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
78 new Object[]
80 UIConsts.INTEGERS[8], slblProceed, 97, 62, UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 185
81 });
82 CurUnoDialog.insertRadioButton("optWorkWithForm", null,
83 new String[]
85 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
87 new Object[]
89 UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, 101, 77, Short.valueOf((short) 1), UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 107
90 });
91 optModifyForm = CurUnoDialog.insertRadioButton("optModifyForm", null,
92 new String[]
94 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
96 new Object[]
98 UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, 101, 89, UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 107
99 });
102 public void initialize(String _formname, FormDocument _oFormDocument)
104 if (oFormDocument == null)
106 oFormDocument = _oFormDocument;
108 if (txtFormName.getText().length() == 0)
110 txtFormName.setText(Desktop.getUniqueName(_oFormDocument.oMainFormDBMetaData.getFormDocuments(), _formname));
114 private void toggleFinishButton()
116 CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0);
119 public String getName()
121 return txtFormName.getText();
124 public boolean getOpenForEditing()
126 return optModifyForm.getState();
129 public boolean finish()
131 return oFormDocument.oMainFormDBMetaData.storeDatabaseDocumentToTempPath(this.oFormDocument.xComponent, getName());