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
;
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",
53 PropertyNames
.PROPERTY_HEIGHT
, PropertyNames
.PROPERTY_LABEL
, PropertyNames
.PROPERTY_POSITION_X
, PropertyNames
.PROPERTY_POSITION_Y
, PropertyNames
.PROPERTY_STEP
, PropertyNames
.PROPERTY_TABINDEX
, PropertyNames
.PROPERTY_WIDTH
57 UIConsts
.INTEGERS
[8], slblFormName
, 97, 25, UIConsts
.INTEGERS
[8], Short
.valueOf(curtabindex
++), 111
59 txtFormName
= CurUnoDialog
.insertTextField("txtFormName", new XTextListenerAdapter() {
61 public void textChanged(TextEvent event
) {
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
71 UIConsts
.INTEGER_12
, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts
.INTEGERS
[8], Short
.valueOf((short) 82), PropertyNames
.EMPTY_STRING
, 185
73 CurUnoDialog
.insertLabel("lblProceed",
76 PropertyNames
.PROPERTY_HEIGHT
, PropertyNames
.PROPERTY_LABEL
, PropertyNames
.PROPERTY_POSITION_X
, PropertyNames
.PROPERTY_POSITION_Y
, PropertyNames
.PROPERTY_STEP
, PropertyNames
.PROPERTY_TABINDEX
, PropertyNames
.PROPERTY_WIDTH
80 UIConsts
.INTEGERS
[8], slblProceed
, 97, 62, UIConsts
.INTEGERS
[8], Short
.valueOf(curtabindex
++), 185
82 CurUnoDialog
.insertRadioButton("optWorkWithForm", null,
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
89 UIConsts
.INTEGERS
[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm
, 101, 77, Short
.valueOf((short) 1), UIConsts
.INTEGERS
[8], Short
.valueOf(curtabindex
++), 107
91 optModifyForm
= CurUnoDialog
.insertRadioButton("optModifyForm", null,
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
98 UIConsts
.INTEGERS
[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm
, 101, 89, UIConsts
.INTEGERS
[8], Short
.valueOf(curtabindex
++), 107
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());